-
Notifications
You must be signed in to change notification settings - Fork 192
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
fix: __all__ references are not ignored #1129
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder what happens for this snippet:
import a, b
__all__: "list[str]" = ["a", "b"]
is_type_hint=False, | ||
) | ||
|
||
list(self.scope.assignments[name])[0].record_access(access) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add an entry into self.__deferred_accesses
instead, to make sure this Access
gets the same treatment as any other.
Co-authored-by: Zsolt Dollenstein <[email protected]>
Co-authored-by: Zsolt Dollenstein <[email protected]>
Gotta fix the type errors (looks like |
Summary
Creating a
RemoveUnusedImports
transformer according to the docs does not properly handle the__all__
variable.Test Plan
I added a test to
libcst/metadata/tests/test_scope_provider.py
that ensures the imports have references that target the strings in__all__
.