summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-18 22:38:27 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-19 20:32:26 +0200
commitc8b1b0ea5e2807826928190205417726c0044893 (patch)
tree865fc324e5aac134bd5ea5d9aa8faf12302aa67a
parent62545380804b098d1776a014f8aa633cf70a85e7 (diff)
downloadastroid-git-c8b1b0ea5e2807826928190205417726c0044893.tar.gz
Fix pylint warnings in astroid/brain/brain_typing.py
-rw-r--r--astroid/brain/brain_typing.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/astroid/brain/brain_typing.py b/astroid/brain/brain_typing.py
index cf61a60c..41e3ea63 100644
--- a/astroid/brain/brain_typing.py
+++ b/astroid/brain/brain_typing.py
@@ -105,10 +105,10 @@ def looks_like_typing_typevar_or_newtype(node):
return False
-def infer_typing_typevar_or_newtype(node, context=None):
+def infer_typing_typevar_or_newtype(node, context_itton=None):
"""Infer a typing.TypeVar(...) or typing.NewType(...) call"""
try:
- func = next(node.func.infer(context=context))
+ func = next(node.func.infer(context=context_itton))
except InferenceError as exc:
raise UseInferenceDefault from exc
@@ -119,16 +119,16 @@ def infer_typing_typevar_or_newtype(node, context=None):
typename = node.args[0].as_string().strip("'")
node = extract_node(TYPING_TYPE_TEMPLATE.format(typename))
- return node.infer(context=context)
+ return node.infer(context=context_itton)
def _looks_like_typing_subscript(node):
"""Try to figure out if a Subscript node *might* be a typing-related subscript"""
if isinstance(node, nodes.Name):
return node.name in TYPING_MEMBERS
- elif isinstance(node, nodes.Attribute):
+ if isinstance(node, nodes.Attribute):
return node.attrname in TYPING_MEMBERS
- elif isinstance(node, nodes.Subscript):
+ if isinstance(node, nodes.Subscript):
return _looks_like_typing_subscript(node.value)
return False
@@ -232,8 +232,7 @@ def _forbid_class_getitem_access(node: nodes.ClassDef) -> None:
"""
if attr == "__class_getitem__":
raise AttributeInferenceError("__class_getitem__ access is not allowed")
- else:
- return origin_func(attr, *args, **kwargs)
+ return origin_func(attr, *args, **kwargs)
try:
node.getattr("__class_getitem__")