package documentation
(source)

Python Abstract Syntax Tree New Generation

The aim of this module is to provide a common base representation of python source code for projects such as pychecker, pyreverse, pylint... Well, actually the development of this library is essentially governed by pylint's needs.

It extends class defined in the python's _ast module with some additional methods and attributes. Instance attributes are added by a builder object, which can either generate extended ast (let's call them astroid ;) by visiting an existent ast tree or by inspecting living object. Methods are added by monkey patching ast classes.

Main modules are:

  • nodes and scoped_nodes for more information about methods and attributes added to different node classes
  • the manager contains a high level object to get astroid trees from source files and living objects. It maintains a cache of previously constructed tree for quick access
  • builder contains the class responsible to build astroid trees
Package brain No package docstring; 34/49 modules documented
Package interpreter No package docstring; 2/2 modules, 0/1 package documented
Package nodes Every available node class.
Module __pkginfo__ Undocumented
Module arguments No module docstring; 1/1 class documented
Module astroid​_manager This file contain the global astroid MANAGER, to prevent circular import that happened when the only possibility to import it was from astroid.__init__.py.
Module bases This module contains base classes and functions for the nodes and some inference utils.
Module builder The AstroidBuilder makes astroid from living object and / or from _ast
Module const Undocumented
Module context Various context related utilities, including inference and call contexts.
Module decorators A few useful function/method decorators.
Module exceptions this module contains exceptions used in the astroid library
Module filter​_statements _filter_stmts and helper functions. This method gets used in LocalsDictnodes.NodeNG._scope_lookup. It is not considered public.
Module helpers Various helper utilities.
Module inference this module contains a set of functions to handle inference on astroid trees
Module inference​_tip Transform utilities (filters and decorator)
Module manager astroid manager: avoid multiple astroid build of a same module when possible by providing a class responsible to get astroid representation from various source and using a cache of built modules)
Module mixins This module contains some mixins for the different nodes.
Module modutils Python modules manipulation utility functions.
Module node​_classes Undocumented
Module objects No summary
Module protocols this module contains a set of functions to handle python protocols for nodes where it makes sense.
Module raw​_building this module contains a set of functions to create astroid trees from scratch (build_* functions) or from living object (object_build_* functions)
Module rebuilder this module contains utilities for rebuilding an _ast tree in order to get a single Astroid representation
Module scoped​_nodes Undocumented
Module test​_utils Utility functions for test code that uses astroid ASTs as input.
Module transforms No module docstring; 1/1 class documented
Module util No module docstring; 1/4 function, 4/4 classes documented
Module _ast No module docstring; 0/1 variable, 1/7 function, 0/1 class documented

From __init__.py:

Constant ASTROID​_INSTALL​_DIRECTORY Undocumented
Constant BRAIN​_MODULES​_DIRECTORY Undocumented
ASTROID_INSTALL_DIRECTORY = (source)

Undocumented

Value
Path(__file__).parent
BRAIN_MODULES_DIRECTORY = (source)

Undocumented

Value
ASTROID_INSTALL_DIRECTORY/'brain'