summaryrefslogtreecommitdiff
path: root/inference.py
diff options
context:
space:
mode:
authorEmile Anclin <emile.anclin@logilab.fr>2010-12-02 12:20:43 +0100
committerEmile Anclin <emile.anclin@logilab.fr>2010-12-02 12:20:43 +0100
commit957735efa408c22a8c6702f42d076d3b3458f9b0 (patch)
treee36de19d088308a9113ca41e87d791a93730daf3 /inference.py
parent8b74c1c07d154ed80a65ea5af7c689870f19c70f (diff)
downloadastroid-git-957735efa408c22a8c6702f42d076d3b3458f9b0.tar.gz
reduce circular imports II: move boot straping stuff to raw_building
- inference doesn't depend on importing raw_building from logilab.astng anymore - fix also test import
Diffstat (limited to 'inference.py')
-rw-r--r--inference.py35
1 files changed, 2 insertions, 33 deletions
diff --git a/inference.py b/inference.py
index def91a03..27c2aa42 100644
--- a/inference.py
+++ b/inference.py
@@ -32,7 +32,8 @@ try:
except NameError:
class GeneratorExit(Exception): pass
-from logilab.astng import nodes, raw_building
+from logilab.astng import nodes
+
from logilab.astng.manager import ASTNGManager
from logilab.astng.exceptions import (ASTNGBuildingException, ASTNGError,
InferenceError, NoDefault, NotFoundError, UnresolvableName)
@@ -42,38 +43,6 @@ from logilab.astng.protocols import _arguments_infer_argname
MANAGER = ASTNGManager()
-_CONST_PROXY = {
- type(None): raw_building.build_class('NoneType'),
- bool: MANAGER.astng_from_class(bool),
- int: MANAGER.astng_from_class(int),
- long: MANAGER.astng_from_class(long),
- float: MANAGER.astng_from_class(float),
- complex: MANAGER.astng_from_class(complex),
- str: MANAGER.astng_from_class(str),
- unicode: MANAGER.astng_from_class(unicode),
- }
-_CONST_PROXY[type(None)].parent = _CONST_PROXY[bool].parent
-if sys.version_info >= (2, 6):
- _CONST_PROXY[bytes] = MANAGER.astng_from_class(bytes)
-
-# TODO : find a nicer way to handle this situation; we should at least
-# be able to avoid calling MANAGER.astng_from_class(const.value.__class__)
-# each time (if we can not avoid the property). However __proxied introduced an
-# infinite recursion (see https://bugs.launchpad.net/pylint/+bug/456870)
-def _set_proxied(const):
- return _CONST_PROXY[const.value.__class__]
-nodes.Const._proxied = property(_set_proxied)
-
-def Const_pytype(self):
- return self._proxied.qname()
-nodes.Const.pytype = Const_pytype
-
-
-nodes.List._proxied = MANAGER.astng_from_class(list)
-nodes.Tuple._proxied = MANAGER.astng_from_class(tuple)
-nodes.Dict._proxied = MANAGER.astng_from_class(dict)
-Generator._proxied = MANAGER.infer_astng_from_something(type(a for a in ()))
-
class CallContext:
"""when inferring a function call, this class is used to remember values