Skip to content
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

Add failing test #161

Merged
merged 3 commits into from
Oct 5, 2023
Merged

Add failing test #161

merged 3 commits into from
Oct 5, 2023

Conversation

sondrelg
Copy link
Member

@sondrelg sondrelg commented Aug 4, 2023

Closes #160

Prevents false positive TC004 errors when an import name is shadowed by function arguments.

@@ -11,7 +11,7 @@ class FunctionRangesDict(TypedDict):
end: int

class FunctionScopeImportsDict(TypedDict):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the change from imports to names below, would it perhaps make sense to rename the class, too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good point 👍

@olepbr
Copy link

olepbr commented Aug 7, 2023

Not overly familiar with the codebase, but the change makes sense to me :-)

When an import name is shadowed by function arguments, we
should not raise TC004 errors.
@sondrelg sondrelg marked this pull request as ready for review October 5, 2023 07:05
@sondrelg sondrelg merged commit cfb194d into main Oct 5, 2023
5 of 6 checks passed
@sondrelg sondrelg deleted the sondrelg/160 branch October 5, 2023 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TC004: False positive when variable name matches name of module in TYPE_CHECKING block
2 participants