-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
UP006: Incorrect autofix when shadowing builtin #3284
Comments
Thanks, you're right! These should check for redefined builtins. |
Wow, thanks for the quick fix! Should I open up a new issue to handle the case when the builtins are overriden/shadowed? |
What do you think the ideal behavior would be in that case? |
To fetch the original object via the builtin module, e.g: import builtins
class F:
type = "abc"
def foo() -> builtins.type[list]:
return list |
Yeah we can open an issue for that. It will be tricky to do right now because fixes can't introduce new imports. So for now, we could support this in the event that a module already imports |
@charliermarsh original builtins can also be found in |
@jdahlin - True! Although that can also be overridden 😂 Feel free to open an issue for it :) |
The autofix for UP006 is not working correctly when shadowing a builtin such as
type
.Test case
Expected code after autofix:
Actual code after autofix:
The text was updated successfully, but these errors were encountered: