Closed
Description
Bug description
Issue
Code:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from numpy import ndarray
a: ndarray # E0601 here
b=ndarray()
Note that only the type hint was flagged by the error, the assignment was not.
Related to
#7574 (may be fixed by #8071)
#7979 (fixed in #7980)
#7368 (fixed by #7360)
However, none of these seem to cover type hints.
Configuration
No response
Command used
pylint --disable=missing-module-docstring .\pylint_test.py
Pylint output
************* Module pylint_test
pylint_test.py:6:3: E0601: Using variable 'ndarray' before assignment (used-before-assignment)
Expected behavior
No issues for the type hint.
Pylint version
pylint 2.15.10
astroid 2.13.3
Python 3.11.1 (tags/v3.11.1:a7a450f, Dec 6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)]
OS / Environment
Windows 11 x64 21H2
Additional dependencies
No response