summaryrefslogtreecommitdiff
path: root/pylint
diff options
context:
space:
mode:
authorYilei "Dolee" Yang <yileiyang@google.com>2023-04-07 00:16:29 -0700
committerGitHub <noreply@github.com>2023-04-07 07:16:29 +0000
commitcb255eaaed8bba6bec1f7bf5d4cde15821c1dd46 (patch)
treedfc919cdd22f126f5b5e03f9a780d2722168cc8e /pylint
parenteeddd667a6e73ef58fb47cdda154c1751f0ffe71 (diff)
downloadpylint-git-cb255eaaed8bba6bec1f7bf5d4cde15821c1dd46.tar.gz
Fix typelias `invalid-name` false positives for Union variables without assignment. (#8541)
Diffstat (limited to 'pylint')
-rw-r--r--pylint/checkers/base/name_checker/checker.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/pylint/checkers/base/name_checker/checker.py b/pylint/checkers/base/name_checker/checker.py
index 12cc584db..9203d7acf 100644
--- a/pylint/checkers/base/name_checker/checker.py
+++ b/pylint/checkers/base/name_checker/checker.py
@@ -602,10 +602,7 @@ class NameChecker(_BasicChecker):
# Union is a special case because it can be used as a type alias
# or as a type annotation. We only want to check the former.
assert node is not None
- return not (
- isinstance(node.parent, nodes.AnnAssign)
- and node.parent.value is not None
- )
+ return not isinstance(node.parent, nodes.AnnAssign)
elif isinstance(inferred, nodes.FunctionDef):
if inferred.qname() == "typing.TypeAlias":
return True