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
On 0.9.6, the following snippet triggers RUF012:
from collections.abc import Mapping from typing import TypeAlias Values: TypeAlias = Mapping[str, str] class Base: values: Values class Derived(Base): values: Values = {"a": "b"} # RUF012
However, if values: Values is replaced with values: Mapping[str, str], the error goes away.
values: Values
values: Mapping[str, str]
Using the Python 3.12 type statement instead of TypeAlias does not change the behaviour.
type
TypeAlias
The text was updated successfully, but these errors were encountered:
Thanks for the report! I think we could probably try to resolve the type alias here, at least within the same file.
The general case requires type inference as mentioned in some related issues like #13137, #13630, #5639, and #5429.
Sorry, something went wrong.
I can work on this if its fine with you guys.
Sure, go for it
vladNed
Successfully merging a pull request may close this issue.
Description
On 0.9.6, the following snippet triggers RUF012:
However, if
values: Values
is replaced withvalues: Mapping[str, str]
, the error goes away.Using the Python 3.12
type
statement instead ofTypeAlias
does not change the behaviour.The text was updated successfully, but these errors were encountered: