Fix mypy compatibility for curry.partial#2094
Fix mypy compatibility for curry.partial#2094AdrianAcala wants to merge 3 commits intodry-python:masterfrom
Conversation
| lambda index: checker.accept(exprs[index]), | ||
| ) | ||
|
|
||
| arg_context = checker.argument_infer_context() |
There was a problem hiding this comment.
Sorry, how does this change fix the mypy compat? What even is the problem that we are fixing here?
There was a problem hiding this comment.
Based off of this commit python/mypy@0291ec9,
the infer_constraints_for_callable function was modified to require an additional arg_names parameter. This change, combined with how mypy processes function calls internally, caused the direct use of checker.argument_infer_context() as a parameter to fail
When the context is saved to a local variable first, mypy correctly recognizes it during parameter binding.
a06a7e9 to
efa6e4e
Compare
efa6e4e to
4a40f83
Compare
|
@sobolevn , ready for your review whenever you have time. Thanks so much for the work you do 😃 |
|
Any word on this? |
- Introduced a new test suite for the `partial` function in `typesafety/test_curry/test_partial/test_partial.py` to ensure its correct behavior with various argument types and signatures. - Updated `mypy.ini` to specify Python version and include the necessary plugins for type checking. - Fixed compatibility issues with `curry.partial` and mypy 1.6.1+. - Added a new entry in `CHANGELOG.md` for unreleased bugfixes.
4a40f83 to
311c13a
Compare
d77aacc to
6dbd2d7
Compare
|
Pushed changes so it can be easily merged. @sobolevn can you please review? |
82edc0a to
bf9eca9
Compare
bf9eca9 to
9be7cd3
Compare
for more information, see https://pre-commit.ci
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2094 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 80 81 +1
Lines 2485 2593 +108
Branches 437 46 -391
==========================================
+ Hits 2485 2593 +108 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
curry.partialcompatibility with mypy 1.6.1+.inference.pyto use a local variable for argument inference context.partialfunctionality intest_partial.py.I have made things!
Checklist
CHANGELOG.mdRelated issues
curry.partial#1711🙏 Please, if you or your company finds
dry-pythonvaluable, help us sustain the project by sponsoring it transparently on https://github.com/sponsors/dry-python. As a thank you, your profile/company logo will be added to our main README which receives hundreds of unique visitors per day.