Pylint incorrectly flags as unused-import things that are used as variable type annotations · Issue #1063 · pylint-dev/pylint (original) (raw)

Steps to reproduce

from typing import Optional

a = None # type: Optional[str]

Current behavior

pylint flags Optional as an unused-import

Expected behavior

pylint shouldn't flag Optional as unused-import

pylint --version output

pylint 1.6.4,
astroid 1.4.8
Python 3.5.2 (default, Jun 28 2016, 08:46:01)
[GCC 6.1.1 20160602]

Supporting documentation:
https://www.python.org/dev/peps/pep-0484/