summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhippo91 <guillaume.peillex@gmail.com>2021-01-20 19:03:44 +0100
committerhippo91 <guillaume.peillex@gmail.com>2021-01-20 19:03:44 +0100
commit1bd5976486336dc3e500a59d7df33f9057f28022 (patch)
tree719190a590f20266bc000ad137e03a2ef26a0332
parent01c678ad8a94be36ca316d63d08b1b79ab82ea11 (diff)
downloadastroid-git-1bd5976486336dc3e500a59d7df33f9057f28022.tar.gz
Defines PY39 variable
-rw-r--r--astroid/brain/brain_type.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/astroid/brain/brain_type.py b/astroid/brain/brain_type.py
index fcd4e99c..c8b89a09 100644
--- a/astroid/brain/brain_type.py
+++ b/astroid/brain/brain_type.py
@@ -21,6 +21,9 @@ import sys
from astroid import MANAGER, extract_node, inference_tip, nodes
+PY39 = sys.version_info >= (3, 9)
+
+
def _looks_like_type_subscript(node):
"""
Try to figure out if a Name node is used inside a type related subscript
@@ -55,7 +58,7 @@ def infer_type_sub(node, context=None):
return node.infer(context=context)
-if sys.version_info[:2] == (3, 9):
+if PY39:
MANAGER.register_transform(
nodes.Name, inference_tip(infer_type_sub), _looks_like_type_subscript
)