summaryrefslogtreecommitdiff
path: root/nodes.py
diff options
context:
space:
mode:
authorSylvain Thénault <sylvain.thenault@logilab.fr>2009-03-06 15:14:20 +0100
committerSylvain Thénault <sylvain.thenault@logilab.fr>2009-03-06 15:14:20 +0100
commitdba9f1c2ea725079905941d0ac92f0ba9af9f978 (patch)
tree3854d96cdc5afc024add46aee404a4311ca664a9 /nodes.py
parentea1f3c714637ee810c169345c678520caa4b0456 (diff)
downloadastroid-git-dba9f1c2ea725079905941d0ac92f0ba9af9f978.tar.gz
remove NoneType and Bool special classes, use Const instead
--HG-- branch : _ast_compat
Diffstat (limited to 'nodes.py')
-rw-r--r--nodes.py65
1 files changed, 32 insertions, 33 deletions
diff --git a/nodes.py b/nodes.py
index f738db21..c222a6dc 100644
--- a/nodes.py
+++ b/nodes.py
@@ -340,8 +340,7 @@ def const_factory(value):
except KeyError:
pass
try:
- cls, value = CONST_VALUE_TRANSFORMS[value]
- node = cls(value)
+ node = Const(value)
except KeyError:
node = _const_factory(value)
return node
@@ -585,38 +584,38 @@ class Generator(Proxy):
# XXX why not using Const node ? Or reintroduce Num / Str
-class NoneType(Instance, NodeNG):
- """None value (instead of Name('None')"""
- _astng_fields = ()
- _proxied_class = None.__class__
- _proxied = None
- def __init__(self, value):
- self.value = value
- def __repr__(self):
- return 'None'
- def get_children(self):
- return iter(())
- __str__ = __repr__
+# class NoneType(Instance, NodeNG):
+# """None value (instead of Name('None')"""
+# _astng_fields = ()
+# _proxied_class = None.__class__
+# _proxied = None
+# def __init__(self, value):
+# self.value = value
+# def __repr__(self):
+# return 'None'
+# def get_children(self):
+# return iter(())
+# __str__ = __repr__
-class Bool(Instance, NodeNG):
- """None value (instead of Name('True') / Name('False')"""
- _astng_fields = ()
- _proxied_class = bool
- _proxied = None
- def __init__(self, value):
- self.value = value
- def __repr__(self):
- return str(self.value)
- def get_children(self):
- return iter(())
- __str__ = __repr__
-
-CONST_NAME_TRANSFORMS = {'None': (NoneType, None),
- 'True': (Bool, True),
- 'False': (Bool, False)}
-CONST_VALUE_TRANSFORMS = {None: (NoneType, None),
- True: (Bool, True),
- False: (Bool, False)}
+# class Bool(Instance, NodeNG):
+# """None value (instead of Name('True') / Name('False')"""
+# _astng_fields = ()
+# _proxied_class = bool
+# _proxied = None
+# def __init__(self, value):
+# self.value = value
+# def __repr__(self):
+# return str(self.value)
+# def get_children(self):
+# return iter(())
+# __str__ = __repr__
+
+CONST_NAME_TRANSFORMS = {'None': (Const, None),
+ 'True': (Const, True),
+ 'False': (Const, False)}
+# CONST_VALUE_TRANSFORMS = {None: (NoneType, None),
+# True: (Bool, True),
+# False: (Bool, False)}
# inference utilities #########################################################