module documentation

Undocumented

Class AstBuilder Undocumented
Class TreeRewriter No class docstring; 0/8 instance variable, 1/75 method documented
Function extract_node Parses some Python code as a module and extracts a designated AST node.
Constant BASE_MANAGER Undocumented
Function _bin_op_from_module Undocumented
Function _bool_op_to_module Undocumented
Function _comp_op_from_module Undocumented
Function _context_from_module Undocumented
Function _unary_op_from_module Undocumented
Constant _STATEMENT_SELECTOR Undocumented
def extract_node(code, py2=False): (source)

Parses some Python code as a module and extracts a designated AST node. # DISCLIAMER: Inspiration taken from astroid project Statements: To extract one or more statement nodes, append #@ to the end of the line To give the extraction a name, append a name after #@ Examples: >>> def x(): >>> def y(): >>> x = 1 #@ x_constant (value) >>> return 1 #@ an_int_constant The return statement will be extracted with a name tuple, constant >>> class X(object): >>> def meth(self): #@ >>> pass The function object 'meth' will be extracted. If no statements or expressions are selected, the last toplevel statement will be returned. If the selected statement is a discard statement, (i.e. an expression turned into a statement), the wrapped expression is returned instead. For convenience, singleton lists are unpacked. :param str code: A piece of Python code that is parsed as a module. Will be passed through textwrap.dedent first. :param py2: flag to determine ast version :returns: The designated node from the parse tree, or a list of nodes, wrapped with namedtuple :rtype: namedtuple

BASE_MANAGER = (source)

Undocumented

Value
BaseManager()
def _bin_op_from_module(module): (source)

Undocumented

def _bool_op_to_module(module): (source)

Undocumented

def _comp_op_from_module(module): (source)

Undocumented

def _context_from_module(module): (source)

Undocumented

def _unary_op_from_module(module): (source)

Undocumented

_STATEMENT_SELECTOR: str = (source)

Undocumented

Value
'#@'