diff options
author | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2009-06-25 13:32:31 +0200 |
---|---|---|
committer | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2009-06-25 13:32:31 +0200 |
commit | aa7197a8d577c82d7c0c9c52dc2ada247594e94e (patch) | |
tree | 44a2fe2fec4bc266f8de6b2a6da1ba63914a49e4 /builder.py | |
parent | 256f14f6c0c9cf1a1c84ae0b1fd038123fb41586 (diff) | |
download | astroid-git-aa7197a8d577c82d7c0c9c52dc2ada247594e94e.tar.gz |
d-t-w, use assertIsInstance
Diffstat (limited to 'builder.py')
-rw-r--r-- | builder.py | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -47,13 +47,13 @@ try: except: from compiler import parse from logilab.astng import patchcomptransformer - + # ast NG builder ############################################################## class ASTNGBuilder: """provide astng building methods """ - + def __init__(self, manager=None): if manager is None: from logilab.astng import MANAGER as manager @@ -94,7 +94,7 @@ class ASTNGBuilder: self._done = {} self.object_build(node, module) return node - + def file_build(self, path, modname=None): """build astng from a source code file (i.e. from an ast) @@ -120,13 +120,13 @@ class ASTNGBuilder: finally: self._file = None sys.path.pop(0) - + return node - + def string_build(self, data, modname='', path=None): """build astng from a source code stream (i.e. from an ast)""" return self.ast_build(parse(data + '\n'), modname, path) - + def ast_build(self, node, modname='', path=None): """recurse on the ast (soon ng) to add some arguments et method""" if path is not None: @@ -138,7 +138,7 @@ class ASTNGBuilder: node.package = True else: node.package = path and path.find('__init__.py') > -1 or False - node.name = modname + node.name = modname node.pure_python = True if self._manager is not None: self._manager._cache[node.file] = node @@ -151,7 +151,7 @@ class ASTNGBuilder: # # this is actually a really minimal representation, including only Module, # Function and Class nodes and some others as guessed - + def object_build(self, node, obj): """recursive method which create a partial ast from real objects (only function, class, and method are handled) @@ -179,7 +179,7 @@ class ASTNGBuilder: if self._member_module(member) != self._module.__name__: imported_member(node, member, name) continue - object_build_methoddescriptor(node, member) + object_build_methoddescriptor(node, member) elif isclass(member): # verify this is not an imported class if self._member_module(member) != self._module.__name__: @@ -215,7 +215,7 @@ def imported_member(node, member, name): check if it's sound valid and then add an import node, else use a dummy node """ - # /!\ some classes like ExtensionClass doesn't have a + # /!\ some classes like ExtensionClass doesn't have a # __module__ attribute ! member_module = getattr(member, '__module__', '__builtin__') try: @@ -224,4 +224,4 @@ def imported_member(node, member, name): attach_dummy_node(node, name, member) else: attach_import_node(node, member_module, name) - + |