summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2019-06-01 12:26:02 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2019-06-01 12:26:02 +0200
commitb58d4628b7b40e0af882166ffe945f7cb9d2dbda (patch)
treed6e174fe6fdedfe151d2a89dcc3874b2f64e2f6a
parent7947bad7a1590adc2e59d7408aeb039c2027788c (diff)
downloadastroid-git-b58d4628b7b40e0af882166ffe945f7cb9d2dbda.tar.gz
Cache a bunch of type calls
-rw-r--r--astroid/raw_building.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/astroid/raw_building.py b/astroid/raw_building.py
index c29cd2a3..d9a1dc47 100644
--- a/astroid/raw_building.py
+++ b/astroid/raw_building.py
@@ -34,6 +34,9 @@ MANAGER = manager.AstroidManager()
_CONSTANTS = tuple(node_classes.CONST_CLS)
_BUILTINS = vars(builtins)
+TYPE_NONE = type(None)
+TYPE_NOTIMPLEMENTED = type(NotImplemented)
+TYPE_ELLIPSIS = type(...)
def _io_discrepancy(member):
@@ -390,13 +393,13 @@ def _astroid_bootstrapping():
# pylint: disable=redefined-outer-name
for cls, node_cls in node_classes.CONST_CLS.items():
- if cls is type(None):
+ if cls is TYPE_NONE:
proxy = build_class("NoneType")
proxy.parent = astroid_builtin
- elif cls is type(NotImplemented):
+ elif cls is TYPE_NOTIMPLEMENTED:
proxy = build_class("NotImplementedType")
proxy.parent = astroid_builtin
- elif cls is type(...):
+ elif cls is TYPE_ELLIPSIS:
proxy = build_class("Ellipsis")
proxy.parent = astroid_builtin
else:
@@ -428,8 +431,8 @@ def _astroid_bootstrapping():
types.GetSetDescriptorType,
types.GeneratorType,
types.MemberDescriptorType,
- type(None),
- type(NotImplemented),
+ TYPE_NONE,
+ TYPE_NOTIMPLEMENTED,
types.FunctionType,
types.MethodType,
types.BuiltinFunctionType,