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
Starting from pylint 2.4.0, an imported symbol from my own package which is only used in a # type: annotation has been unexpectedly reported as an unused-import.
This works fine with pylint 2.3.1.
Steps to reproduce
mod1/my_types.py:
class Base():
pass
class Foo(Base):
pass
class Bar(Base):
pass
mod1/usage.py:
#!/usr/bin/python3
import sys
from mod1.my_types import Base, Foo, Bar
def main():
if sys.argv[1:]:
foo_or_bar = Foo() # type: Base
else:
foo_or_bar = Bar()
print(foo_or_bar.__class__)
if __name__ == "__main__":
main()
Current behavior
mod1/usage.py:5: [W0611: unused-import] Unused Base imported from mod1.my_types
The text was updated successfully, but these errors were encountered:
saf
changed the title
False-positive 'unused-import' for base class name in type annotation
False-positive 'unused-import' for base class name used in type annotation
Oct 15, 2019
Starting from pylint 2.4.0, an imported symbol from my own package which is only used in a
# type:
annotation has been unexpectedly reported as anunused-import
.This works fine with pylint 2.3.1.
Steps to reproduce
mod1/my_types.py
:mod1/usage.py
:Current behavior
Expected behavior
No error reported about the unused import.
pylint --version output
The text was updated successfully, but these errors were encountered: