diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-04-07 11:53:06 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-07 11:53:06 +0000 |
commit | ed67cc806606668bec945c9b62f006d7aad02664 (patch) | |
tree | 108fd329b285642b56d01edd65ebfb46da25eea9 /pylint | |
parent | 011c6ac1a4efa41ce82fb230ca06f97ae50d662e (diff) | |
download | pylint-git-ed67cc806606668bec945c9b62f006d7aad02664.tar.gz |
Fix typelias `invalid-name` false positives for Union variables without assignment. (#8541) (#8548)
(cherry picked from commit cb255eaaed8bba6bec1f7bf5d4cde15821c1dd46)
Co-authored-by: Yilei "Dolee" Yang <yileiyang@google.com>
Diffstat (limited to 'pylint')
-rw-r--r-- | pylint/checkers/base/name_checker/checker.py | 5 |
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 c2b615a48..58f7198ef 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 |