diff options
| author | Emile Anclin <emile.anclin@logilab.fr> | 2009-11-25 17:27:23 +0100 |
|---|---|---|
| committer | Emile Anclin <emile.anclin@logilab.fr> | 2009-11-25 17:27:23 +0100 |
| commit | 6b59dfa123bb3cfb7474ba321f3ea813bf07e3c8 (patch) | |
| tree | 85d59842d94c26eed04b87d6a9e738ca6dbae311 | |
| parent | 0e0a115601ebbbaace352003299573450a4f1b31 (diff) | |
| download | astroid-git-6b59dfa123bb3cfb7474ba321f3ea813bf07e3c8.tar.gz | |
trying to handle the imports
--HG--
branch : rebuild
| -rw-r--r-- | _nodes_ast.py | 3 | ||||
| -rw-r--r-- | builder.py | 2 | ||||
| -rw-r--r-- | inference.py | 2 | ||||
| -rw-r--r-- | infutils.py | 3 | ||||
| -rw-r--r-- | lookup.py | 11 | ||||
| -rw-r--r-- | nodes.py | 1 | ||||
| -rw-r--r-- | protocols.py | 2 |
7 files changed, 11 insertions, 13 deletions
diff --git a/_nodes_ast.py b/_nodes_ast.py index 04a80eb8..216048f4 100644 --- a/_nodes_ast.py +++ b/_nodes_ast.py @@ -77,7 +77,8 @@ from _ast import ( from logilab.astng.utils import ASTVisitor -BaseClass = object +class BaseClass(object): + """base class for ASTNG node classes""" _BIN_OP_CLASSES = {_Add: '+', _BitAnd: '&', @@ -140,11 +140,11 @@ class ASTNGBuilder: node.package = path and path.find('__init__.py') > -1 or False node.name = modname node.pure_python = True + node = self.rebuilder.walk(node) # XXX get the added attributes if self._manager is not None: self._manager._cache[node.file] = node if self._file: self._manager._cache[abspath(self._file)] = node - self.rebuilder.walk(node) return node # astng from living objects ############################################### diff --git a/inference.py b/inference.py index d8f67c97..9e60662f 100644 --- a/inference.py +++ b/inference.py @@ -30,7 +30,7 @@ try: except NameError: class GeneratorExit(Exception): pass -from logilab.astng import MANAGER, _nodes as nodes, raw_building +from logilab.astng import MANAGER, nodes, raw_building from logilab.astng import ASTNGError, InferenceError, UnresolvableName, \ NoDefault, NotFoundError, ASTNGBuildingException from logilab.astng.infutils import YES, Instance, InferenceContext, \ diff --git a/infutils.py b/infutils.py index f08afa56..b4e5650c 100644 --- a/infutils.py +++ b/infutils.py @@ -25,7 +25,8 @@ __doctype__ = "restructuredtext en" from logilab.common.compat import chain, imap from logilab.astng._exceptions import InferenceError, NotFoundError, UnresolvableName -from logilab.astng._nodes import BaseClass, List, Tuple, Function, If, TryExcept +from logilab.astng._nodes import BaseClass +from logilab.astng.node_classes import List, Tuple, If, TryExcept class Proxy(BaseClass): @@ -31,7 +31,7 @@ __docformat__ = "restructuredtext en" import __builtin__ from logilab.astng import MANAGER, NotFoundError -from logilab.astng import _nodes as nodes +from logilab.astng import nodes # XXX this will not work ?? circular import from logilab.astng._nodes import BaseClass, NodeNG from logilab.astng.infutils import are_exclusive, copy_context, _infer_stmts @@ -118,7 +118,7 @@ class LookupMixIn(BaseClass): # current node (gen exp, list comp) _stmts = [node] break - optional_assign = isinstance(ass_type, nodes.LOOP_SCOPES) + optional_assign = isinstance(ass_type, (nodes.For, nodes.Comprehension)) if optional_assign and ass_type.parent_of(self): # we are inside a loop, loop var assigment is hidding previous # assigment @@ -194,11 +194,6 @@ class LocalsDictNodeNG(LookupMixIn, NodeNG): """ this class provides locals handling common to Module, Function and Class nodes, including a dict like interface for direct access to locals information - - /!\ this class should not be used directly /!\ it's - only used as a methods and attribute container, and update the - original class from the compiler.ast module using its dictionary - (see below the class definition) """ # attributes below are set by the builder module or by raw factories @@ -315,4 +310,6 @@ class LocalsDictNodeNG(LookupMixIn, NodeNG): __contains__ = has_key +# maybe import at the end ? +from logilab.astng import nodes @@ -54,7 +54,6 @@ from logilab.astng.node_classes import (Arguments, AssAttr, AssName, Assert, List, ListComp, Name, Pass, Print, Raise, Return, Slice, Subscript, TryExcept, TryFinally, Tuple, UnaryOp, While, With, Yield) from logilab.astng.scoped_nodes import Module, GenExpr, Lambda, Function, Class -from logilab.astng.lookup import LookupMixIn # astng fields definition #################################################### diff --git a/protocols.py b/protocols.py index 492f3e91..b7962fe2 100644 --- a/protocols.py +++ b/protocols.py @@ -27,7 +27,7 @@ __doctype__ = "restructuredtext en" from logilab.astng import InferenceError, NoDefault, _nodes as nodes from logilab.astng.infutils import copy_context, unpack_infer, \ raise_if_nothing_infered, yes_if_nothing_infered, Instance, Generator, YES -from logilab.astng._nodes import Const, Class, Function, Tuple, List, \ +from logilab.astng.nodes import Const, Class, Function, Tuple, List, \ const_factory # unary operations ############################################################ |
