diff options
Diffstat (limited to 'pylint/checkers/base/name_checker')
-rw-r--r-- | pylint/checkers/base/name_checker/__init__.py | 4 | ||||
-rw-r--r-- | pylint/checkers/base/name_checker/checker.py | 11 | ||||
-rw-r--r-- | pylint/checkers/base/name_checker/naming_style.py | 4 |
3 files changed, 12 insertions, 7 deletions
diff --git a/pylint/checkers/base/name_checker/__init__.py b/pylint/checkers/base/name_checker/__init__.py index 3d6818b7a..dec4335f5 100644 --- a/pylint/checkers/base/name_checker/__init__.py +++ b/pylint/checkers/base/name_checker/__init__.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt __all__ = [ "NameChecker", diff --git a/pylint/checkers/base/name_checker/checker.py b/pylint/checkers/base/name_checker/checker.py index 58f7198ef..56ae925fb 100644 --- a/pylint/checkers/base/name_checker/checker.py +++ b/pylint/checkers/base/name_checker/checker.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Basic checker for Python code.""" @@ -476,7 +476,12 @@ class NameChecker(_BasicChecker): # global introduced variable aren't in the function locals if node.name in frame and node.name not in frame.argnames(): if not _redefines_import(node): - self._check_name("variable", node.name, node) + if isinstance( + assign_type, nodes.AnnAssign + ) and self._assigns_typealias(assign_type.annotation): + self._check_name("typealias", node.name, node) + else: + self._check_name("variable", node.name, node) # Check names defined in class scopes elif isinstance(frame, nodes.ClassDef): diff --git a/pylint/checkers/base/name_checker/naming_style.py b/pylint/checkers/base/name_checker/naming_style.py index 8ccec4289..6410f9181 100644 --- a/pylint/checkers/base/name_checker/naming_style.py +++ b/pylint/checkers/base/name_checker/naming_style.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations |