class documentation

class AstroidManager: (source)

View In Hierarchy

Responsible to build astroid from files or modules.

Use the Borg (singleton) pattern.

Method __init__ Undocumented
Method ast​_from​_class get astroid for the given class
Method ast​_from​_file given a module name, return the astroid object
Method ast​_from​_module given an imported module, return the astroid object
Method ast​_from​_module​_name given a module name, return the astroid object
Method ast​_from​_string Given some source code as a string, return its corresponding astroid object
Method bootstrap Bootstrap the required AST modules needed for the manager to work
Method cache​_module Cache a module if no module with the same name is known yet.
Method clear​_cache Clear the underlying cache. Also bootstraps the builtins module.
Method file​_from​_module​_name Undocumented
Method infer​_ast​_from​_something infer astroid for the given class
Method register​_failed​_import​_hook Registers a hook to resolve imports that cannot be found otherwise.
Method visit​_transforms Visit the transforms and apply them to the given node.
Method zip​_import​_data Undocumented
Class Variable brain Undocumented
Class Variable max​_inferable​_values Undocumented
Class Variable name Undocumented
Instance Variable __dict__ Undocumented
Instance Variable always​_load​_extensions Undocumented
Instance Variable astroid​_cache Undocumented
Instance Variable extension​_package​_whitelist Undocumented
Instance Variable optimize​_ast Undocumented
Property builtins​_module Undocumented
Property register​_transform Undocumented
Property unregister​_transform Undocumented
Method _build​_namespace​_module Undocumented
Method _build​_stub​_module Undocumented
Method _can​_load​_extension Undocumented
Instance Variable _failed​_import​_hooks Undocumented
Instance Variable _mod​_file​_cache Undocumented
Instance Variable _transform Undocumented
def __init__(self): (source)

Undocumented

def ast_from_class(self, klass, modname=None): (source)
get astroid for the given class
def ast_from_file(self, filepath, modname=None, fallback=True, source=False): (source)
given a module name, return the astroid object
def ast_from_module(self, module, modname=None): (source)
given an imported module, return the astroid object
Parameters
module:types.ModuleTypeUndocumented
modname:Optional[str]Undocumented
def ast_from_module_name(self, modname, context_file=None): (source)
given a module name, return the astroid object
def ast_from_string(self, data, modname='', filepath=None): (source)
Given some source code as a string, return its corresponding astroid object
def bootstrap(self): (source)

Bootstrap the required AST modules needed for the manager to work

The bootstrap usually involves building the AST for the builtins module, which is required by the rest of astroid to work correctly.

def cache_module(self, module): (source)
Cache a module if no module with the same name is known yet.
def clear_cache(self): (source)
Clear the underlying cache. Also bootstraps the builtins module.
def file_from_module_name(self, modname, contextfile): (source)

Undocumented

def infer_ast_from_something(self, obj, context=None): (source)
infer astroid for the given class
def register_failed_import_hook(self, hook): (source)

Registers a hook to resolve imports that cannot be found otherwise.

hook must be a function that accepts a single argument modname which contains the name of the module or package that could not be imported. If hook can resolve the import, must return a node of type astroid.Module, otherwise, it must raise AstroidBuildingError.

def visit_transforms(self, node): (source)
Visit the transforms and apply them to the given node.
def zip_import_data(self, filepath): (source)

Undocumented

brain: dict = (source)

Undocumented

max_inferable_values: ClassVar[int] = (source)

Undocumented

name: str = (source)

Undocumented

__dict__ = (source)

Undocumented

always_load_extensions: bool = (source)

Undocumented

astroid_cache: dict = (source)

Undocumented

extension_package_whitelist = (source)

Undocumented

optimize_ast: bool = (source)

Undocumented

@property
builtins_module = (source)

Undocumented

@property
register_transform = (source)

Undocumented

@property
unregister_transform = (source)

Undocumented

def _build_namespace_module(self, modname, path): (source)

Undocumented

Parameters
modname:strUndocumented
path:List[str]Undocumented
Returns
nodes.ModuleUndocumented
def _build_stub_module(self, modname): (source)

Undocumented

def _can_load_extension(self, modname): (source)

Undocumented

Parameters
modname:strUndocumented
Returns
boolUndocumented
_failed_import_hooks: list = (source)

Undocumented

_mod_file_cache: dict = (source)

Undocumented

_transform = (source)

Undocumented