diff options
| author | Marc Mueller <30130371+cdce8p@users.noreply.github.com> | 2021-07-19 23:22:31 +0200 |
|---|---|---|
| committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-07-20 09:14:33 +0200 |
| commit | 42bb0c619d4fe2d250032b8beafe3616b7af8b8d (patch) | |
| tree | 9b6cf199c2ffb1555e2a88477fbc1f1cd2ea30d9 /astroid | |
| parent | 8bf4f1792f27510b79a6bd6e7ad1f2567bec4394 (diff) | |
| download | astroid-git-42bb0c619d4fe2d250032b8beafe3616b7af8b8d.tar.gz | |
Remove redundant isinstance calls in brain_typing
Diffstat (limited to 'astroid')
| -rw-r--r-- | astroid/brain/brain_typing.py | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/astroid/brain/brain_typing.py b/astroid/brain/brain_typing.py index c5f06735..549c4195 100644 --- a/astroid/brain/brain_typing.py +++ b/astroid/brain/brain_typing.py @@ -225,8 +225,7 @@ def _looks_like_typing_alias(node: Call) -> bool: :param node: call node """ return ( - isinstance(node, Call) - and isinstance(node.func, Name) + isinstance(node.func, Name) and node.func.name == "_alias" and ( # _alias function works also for builtins object such as list and dict @@ -327,19 +326,15 @@ def _looks_like_tuple_alias(node: Call) -> bool: PY37: Tuple = _VariadicGenericAlias(tuple, (), inst=False, special=True) PY39: Tuple = _TupleType(tuple, -1, inst=False, name='Tuple') """ - return ( - isinstance(node, Call) - and isinstance(node.func, Name) - and ( - not PY39_PLUS - and node.func.name == "_VariadicGenericAlias" - and isinstance(node.args[0], Name) - and node.args[0].name == "tuple" - or PY39_PLUS - and node.func.name == "_TupleType" - and isinstance(node.args[0], Name) - and node.args[0].name == "tuple" - ) + return isinstance(node.func, Name) and ( + not PY39_PLUS + and node.func.name == "_VariadicGenericAlias" + and isinstance(node.args[0], Name) + and node.args[0].name == "tuple" + or PY39_PLUS + and node.func.name == "_TupleType" + and isinstance(node.args[0], Name) + and node.args[0].name == "tuple" ) |
