summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manager.py21
-rw-r--r--node_classes.py7
2 files changed, 13 insertions, 15 deletions
diff --git a/manager.py b/manager.py
index c496f9ae..59a9f8e6 100644
--- a/manager.py
+++ b/manager.py
@@ -227,22 +227,21 @@ class ASTNGManager(OptionsProviderMixIn):
return modastng.getattr(klass.__name__)[0] # XXX
- def infer_astng_from_something(self, obj, modname=None, context=None):
+ def infer_astng_from_something(self, obj, context=None):
"""infer astng for the given class"""
if hasattr(obj, '__class__') and not isinstance(obj, type):
klass = obj.__class__
else:
klass = obj
- if modname is None:
- try:
- modname = klass.__module__
- except AttributeError:
- raise ASTNGBuildingException(
- 'Unable to get module for %s' % safe_repr(klass))
- except Exception, ex:
- raise ASTNGBuildingException(
- 'Unexpected error while retrieving module for %s: %s'
- % (safe_repr(klass), ex))
+ try:
+ modname = klass.__module__
+ except AttributeError:
+ raise ASTNGBuildingException(
+ 'Unable to get module for %s' % safe_repr(klass))
+ except Exception, ex:
+ raise ASTNGBuildingException(
+ 'Unexpected error while retrieving module for %s: %s'
+ % (safe_repr(klass), ex))
try:
name = klass.__name__
except AttributeError:
diff --git a/node_classes.py b/node_classes.py
index 0fc83745..27a7af30 100644
--- a/node_classes.py
+++ b/node_classes.py
@@ -23,7 +23,7 @@
import sys
from logilab.astng.exceptions import NoDefault
-from logilab.astng.bases import (NodeNG, Statement, Instance, copy_context,
+from logilab.astng.bases import (NodeNG, Statement, Instance, InferenceContext,
_infer_stmts, YES)
from logilab.astng.mixins import BlockRangeMixIn, AssignTypeMixin, \
ParentAssignTypeMixin, FromImportMixIn
@@ -115,15 +115,14 @@ class LookupMixIn(object):
"""
return self.scope().scope_lookup(self, name)
- def ilookup(self, name, context=None):
+ def ilookup(self, name):
"""infered lookup
return an iterator on infered values of the statements returned by
the lookup method
"""
frame, stmts = self.lookup(name)
- context = copy_context(context)
- context.lookupname = name
+ context = InferenceContext()
return _infer_stmts(stmts, context, frame)
def _filter_stmts(self, stmts, frame, offset):