-
Notifications
You must be signed in to change notification settings - Fork 221
Invalid use of @overload #9014
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
Closed
Closed
Invalid use of @overload #9014
Changes from 8 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
9f84ad7
add placeholders
MJoshuaB c81ff56
add new placeholder comments
MJoshuaB 18762be
exploring AST unfinished - minor emergency had to leave
2238161
identifying some mismatched functions
46053e6
fine tuning and testing required
27edb80
minimal tests added
112173d
Merge pull request #2 from Azure/main
JessicaBell00 c5ffb91
Merge branch 'Azure:main' into main
JessicaBell00 7dc03ca
Merge branch 'working-main' into main
JessicaBell00 18f09e9
Merge pull request #5 from MJoshuaB/main
JessicaBell00 af098f7
Merge branch 'Azure:main' into working-main
JessicaBell00 6e53b16
Final Refactor
80657b4
not running multiple times picking up on different function types
5b69e7e
Merge branch 'main' into invalid-use-of-@overload
16234397 a0e5c18
removed code not reached
bf6936c
Merge remote-tracking branch 'origin/invalid-use-of-@overload' into i…
3ed8120
Checks at a class level
ac9921a
Merge branch 'main' into invalid-use-of-@overload
16234397 4c638df
Looking into different connection_verify assignments
ab62179
Placeholders added back
16234397 795c861
Checker base done
a835da4
Checker, Tests, & Readme done
efe6ddc
Merge branch 'main' into working-main
MJoshuaB c50a082
Merge branch 'working-main' into do-not-hardcode-boolean-connection_v…
16234397 24e9647
Merge pull request #10 from MJoshuaB/do-not-hardcode-boolean-connecti…
16234397 1f78550
Merge branch 'working-main' into invalid-use-of-@overload
16234397 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
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
31 changes: 31 additions & 0 deletions
31
...ns/azure-pylint-guidelines-checker/tests/test_files/invalid_use_of_overload_acceptable.py
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 |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Test file for InvalidUseOfOverload checker | ||
|
|
||
| from typing import Awaitable, overload, Union | ||
|
|
||
|
|
||
| @overload | ||
| def double(a: str) -> Awaitable[int]: | ||
| ... | ||
|
|
||
| @overload | ||
| def double(a: int) -> Awaitable[int]: | ||
| ... | ||
|
|
||
| async def double(a: Union[str, int]) -> int: | ||
| if isinstance(a, str): | ||
16234397 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return len(a)*2 | ||
| return a * 2 | ||
|
|
||
|
|
||
| @overload | ||
| def single(a: str): | ||
| ... | ||
|
|
||
| @overload | ||
| def single(a: int): | ||
| ... | ||
|
|
||
| def single(a: Union[str, int]) -> int: | ||
| if isinstance(a, str): | ||
| return len(a) | ||
| return a | ||
31 changes: 31 additions & 0 deletions
31
...ons/azure-pylint-guidelines-checker/tests/test_files/invalid_use_of_overload_violation.py
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 |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Test file for InvalidUseOfOverload checker - testing what mypy doesn't pick up | ||
|
|
||
| from typing import Awaitable, overload, Union | ||
|
|
||
|
|
||
| @overload | ||
| def double(a: str) -> Awaitable[int]: | ||
| ... | ||
|
|
||
| @overload | ||
| def double(a: int): | ||
| ... | ||
|
|
||
| async def double(a: Union[str, int]) -> int: | ||
| if isinstance(a, str): | ||
| return len(a)*2 | ||
| return a * 2 | ||
|
|
||
|
|
||
| @overload | ||
| def doubleAgain(a: str): | ||
| ... | ||
|
|
||
| @overload | ||
| def doubleAgain(a: int): | ||
| ... | ||
|
|
||
| async def doubleAgain(a: Union[str, int]) -> int: | ||
| if isinstance(a, str): | ||
| return len(a)*2 | ||
| return a * 2 |
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
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.
Uh oh!
There was an error while loading. Please reload this page.