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
This one's a mouthful, but I did verify that this is still an issue with 2.1.1-23-g0af480e -- current master as of writing.
Consider this example:
from __future__ importannotationsfromosimportPathLikefromtypingimportUnion_PathType=Union[str, 'PathLike[str]']
deffoo(arg: _PathType) ->str:
returnstr(arg)
First, note that PathLike[str] is a case where MyPy uses a Generic type stub, but that the runtime object here is not subscriptable. In these cases, such types must be string quoted, even when using delayed annotations support from PEP 563.
Next, even when moving this import below a TYPE_CHECKING stanza, pyflakes still warns.
Lastly, this is an error in pylint (pylint-dev/pylint#3299) and pycharm (As of 2019.3.2) as well. Worse, each tool has separate pragmas to silence the error.
This error appears related to #247 but that was about PEP 484 type hint comments, not string quoted type hints. The issue is possibly distinct from #510 because PEP 563 delayed annotations have no effect here: quoted types are a requisite; but these two reports may share a root cause. Pull #479 does not resolve this problem.
Hopefully that's good homework. :)
--js
The text was updated successfully, but these errors were encountered:
This one's a mouthful, but I did verify that this is still an issue with 2.1.1-23-g0af480e -- current master as of writing.
Consider this example:
First, note that
PathLike[str]
is a case where MyPy uses a Generic type stub, but that the runtime object here is not subscriptable. In these cases, such types must be string quoted, even when using delayed annotations support from PEP 563.See here for more information on this circumstance: https://mypy.readthedocs.io/en/stable/common_issues.html#using-classes-that-are-generic-in-stubs-but-not-at-runtime
The warning produced is:
Next, even when moving this import below a TYPE_CHECKING stanza, pyflakes still warns.
Lastly, this is an error in pylint (pylint-dev/pylint#3299) and pycharm (As of 2019.3.2) as well. Worse, each tool has separate pragmas to silence the error.
This error appears related to #247 but that was about PEP 484 type hint comments, not string quoted type hints. The issue is possibly distinct from #510 because PEP 563 delayed annotations have no effect here: quoted types are a requisite; but these two reports may share a root cause. Pull #479 does not resolve this problem.
Hopefully that's good homework. :)
--js
The text was updated successfully, but these errors were encountered: