We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
dict.__dict__['fromkeys']
Ruff doesn't like classmethod descriptors, or seems to think that they're undefined, which is rather odd.
a = type({}).__dict__['fromkeys'] b = dict.__dict__['fromkeys'] assert a is b
Saving the above to bug.py, and running only with F821:
bug.py
F821
PS I:\Development> ruff -V ruff 0.1.9 PS I:\Development> ruff --isolated --show-source --select F821 bug.py bug.py:2:20: F821 Undefined name `fromkeys` | 1 | a = type({}).__dict__['fromkeys'] 2 | b = dict.__dict__['fromkeys'] | ^^^^^^^^ F821 3 | assert a is b | Found 1 error.
Note only the second line yields an error -- using type({}) as an indirection for dict solves the issue.
type({})
dict
A
The text was updated successfully, but these errors were encountered:
Thanks — I’m guessing it thinks it’s a type annotation, as when subscripting dict directly.
Sorry, something went wrong.
Closed by #9309.
Thanks Charlie!
charliermarsh
No branches or pull requests
Ruff doesn't like classmethod descriptors, or seems to think that they're undefined, which is rather odd.
Saving the above to
bug.py
, and running only withF821
:Note only the second line yields an error -- using
type({})
as an indirection fordict
solves the issue.A
The text was updated successfully, but these errors were encountered: