-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Possible error in PLE0605 #7672
Comments
Thanks for the report! Hm... in the example: from other import a, b
__all__ = ["a"]
__all__ += (foo := ["b"]) pyright reports the symbol Although I agree this is syntactically equivalent, if it's not supported by type checkers I'm not sure we should treat it as valid. |
I think it's reasonable to support if the code changes aren't too tricky :) |
## Summary This PR adds support for named expressions when analyzing `__all__` assignments, as per #7672. It also loosens the enforcement around assignments like: `__all__ = list(some_other_expression)`. We shouldn't flag these as invalid, even though we can't analyze the members, since we _know_ they evaluate to a `list`. Closes #7672. ## Test Plan `cargo test`
In astropy/astropy#15385 we are trying to fix some
__all__
statements and ran into the followingMy suggested fix was
However PLE0605 is still complaining. I don't think this is correct since the above should be, from the "perspective" of
__all__
equivalent towhich passes the check.
The inclusion of the walrus operator for assigning to another variable makes the AST more complicated but should be equivalent statically to excluding the walrus.
The text was updated successfully, but these errors were encountered: