-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Function compatibility rewrite #2521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
bb05f3c
New algorithm for checking function compatibility.
sixolet 8b3b788
Rename argument shorter
sixolet 5e68ee3
Explain what i am doing better
sixolet 8bf9c53
Stop checking argument names for multiple base classes
sixolet 1e4d467
Elide __foo argument names from funcs where args are not typed
sixolet c42bd86
Cosmetic
sixolet c8d4458
Make the text descriptions of args more concise
sixolet d7df8cd
Account for one left argument with two corresponding right args
sixolet d811a82
cosmetic
sixolet 95d1c58
cosmetic
sixolet d752499
Remove `In class foo`
sixolet 499e1d2
Factor out corresponding_argument method
sixolet 7617eac
Optional for the name and pos
sixolet 77c8f73
typo
sixolet 62fd868
Ignore implicitly typed function arg names
sixolet 5c6d574
Test for ignoring arg names for implicit defs
sixolet 4397926
Fix tests
sixolet 2a07da8
Delete tests for implicit callable lacking names as they make no sens…
sixolet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Rename argument shorter
- Loading branch information
commit 8b3b788ead8b0e704ae1a91a50713cf66ae1ac1e
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,6 +130,8 @@ ee_var = everywhere | |
ee_var = specific_1 # The difference between Callable[[...], blah] and one with a *args: Any, **kwargs: Any is that the ... goes loosely both ways. | ||
ee_def = specific_1 # E: Incompatible types in assignment (expression has type Callable[[int, str], None], variable has type Callable[[Any, Any], None]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error message is confusing (missing indication of |
||
|
||
[builtins fixtures/dict.pyi] | ||
|
||
[case testLackOfNames] | ||
def f(__a: int, __b: str) -> None: pass | ||
def g(a: int, b: str) -> None: pass | ||
|
@@ -152,8 +154,6 @@ gg = g | |
ff = g | ||
gg = f # E: Incompatible types in assignment (expression has type Callable[[int, str], None], variable has type Callable[[Arg('a', int, False), Arg('b', str, False)], None]) | ||
|
||
[builtins fixtures/dict.pyi] | ||
|
||
[case testFunctionTypeCompatibilityWithOtherTypes] | ||
from typing import Callable | ||
f = None # type: Callable[[], None] | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra
[]
around...
in comment: should beCallable[..., blah]
.