Beispiel #1
0
 def import_module(self, modname, relative_only=False):
     """import the given module considering self as context"""
     try:
         return MANAGER.astng_from_module_name(self.relative_name(modname))
     except ASTNGBuildingException:
         if relative_only:
             raise
     module = MANAGER.astng_from_module_name(modname)
     return module
Beispiel #2
0
 def import_module(self, modname, relative_only=False):
     """import the given module considering self as context"""
     try:
         return MANAGER.astng_from_module_name(self.relative_name(modname))
     except ASTNGBuildingException:
         if relative_only:
             raise
     module = MANAGER.astng_from_module_name(modname)
     return module
Beispiel #3
0
def infer_empty_node(self, context=None):
    if not self.has_underlying_object():
        yield YES
    else:
        try:
            for infered in MANAGER.infer_astng_from_something(self.object,
                                                              context=context):
                yield infered
        except ASTNGError:
            yield YES
Beispiel #4
0
def builtin_lookup(name):
    """lookup a name into the builtin module
    return the list of matching statements and the astng for the builtin
    module
    """
    builtinastng = MANAGER.astng_from_module(__builtin__)
    try:
        stmts = builtinastng.locals[name]
    except KeyError:
        stmts = ()
    return builtinastng, stmts
Beispiel #5
0
def builtin_lookup(name):
    """lookup a name into the builtin module
    return the list of matching statements and the astng for the builtin
    module
    """
    builtinastng = MANAGER.astng_from_module(__builtin__)
    try:
        stmts = builtinastng.locals[name]
    except KeyError:
        stmts = ()
    return builtinastng, stmts