You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug A clear and concise description of what the bug is.
Imports are incorrectly removed from class scopes.
Sometimes I use class scopes to keep imports contained when implementing multiple versions of the same interface
$ pycln snippet.py
a.py:2:4 'import threading' was removed! �
a.py 1 import was removed! �
All done! � �
1 import was removed, 1 file was changed.
Error traceback or unexpected output (if present):
Traceback (most recent call last):
File "snippet.py", line 6, in<module>
assert MyClass.threading
AttributeError: type object 'MyClass' has no attribute 'threading'
Unexpected fixed code (if present):
classMyClass:
defrun(self):
assertself.threading
Expected behavior:
Description: A clear and concise description of what you expected to happen.
Describe the bug A clear and concise description of what the bug is.
Imports are incorrectly removed from class scopes.
Sometimes I use class scopes to keep imports contained when implementing multiple versions of the same interface
pycln
incorrectly removes these. Note that I also tried withautoflake
and it works correctly and does not remove these imports.To Reproduce Steps to reproduce the behavior:
Take this code snippet:
Run this Pycln command:
Error traceback or unexpected output (if present):
Unexpected fixed code (if present):
Expected behavior:
NOTHING. The code snippet should not be changed.
Expected fixed code (if present): SAME AS INPUT
Environment (please complete the following informations):
Additional context Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: