class documentation

class MNode: (source)

Constructor: MNode(name)

View In Hierarchy

Build a Module node of the given input source file with publicly APIs to manipulate for parsing and code instrumentation file.

Method __init__ No summary
Method __str__ returns an string representation of the object
Method gen_ast Build AST tree for th source
Method gen_cfg Undocumented
Method gen_import_relations Undocumented
Method make_unit_walker Returns a generator of units at statement level
Method parse_func_calls Returns a list of function calls ranking by their line numbers
Method parse_func_defs Return a list of dictionaries, each of its item is a dictionary of function/class definition information.
Method parse_import_stmts Return a dictionary data structure to map the imported name, from which module and its aliases.
Method parse_vars Returns a list of variable records ranking by their line numbers
Method retrieve_meta Undocumented
Method rewrite rewrite code
Instance Variable ast Undocumented
Instance Variable call_links Undocumented
Instance Variable children Undocumented
Instance Variable class_pair Undocumented
Instance Variable full_name Undocumented
Instance Variable name Undocumented
Instance Variable node_type_dict Undocumented
Instance Variable node_type_gt Undocumented
Instance Variable parent Undocumented
Instance Variable source Undocumented
Method _parse_func_defs Parse the function and class definitions in this module
Method _process_base_names Undocumented
Method _read_scope Undocumented
Method _retrieve_by_scope retrieve an AST node by the scope directive.
def __init__(self, name): (source)
Parameters
nameThe filename of the input source file.
def __str__(self): (source)

returns an string representation of the object

def gen_ast(self): (source)

Build AST tree for th source

def gen_cfg(self): (source)

Undocumented

def gen_import_relations(): (source)

Undocumented

def make_unit_walker(self): (source)

Returns a generator of units at statement level

def parse_func_calls(self, scope=''): (source)

Returns a list of function calls ranking by their line numbers

Parameters
scopea dotted string to provide name space. For instance, A.fun
means to retrieve the function named fun in the class A
def parse_func_defs(self): (source)

Return a list of dictionaries, each of its item is a dictionary of function/class definition information.

def parse_import_stmts(self): (source)

Return a dictionary data structure to map the imported name, from which module and its aliases.

def parse_vars(self, scope=''): (source)

Returns a list of variable records ranking by their line numbers

Parameters
scopea dotted string to provide name space. For instance, A.fun
means to retreive the function named fun in the class A
def retrieve_meta(self, node): (source)

Undocumented

def rewrite(self, scope='mod'): (source)

rewrite code

Undocumented

call_links = (source)

Undocumented

children: list = (source)

Undocumented

class_pair = (source)

Undocumented

full_name: str = (source)

Undocumented

Undocumented

node_type_dict = (source)

Undocumented

node_type_gt = (source)

Undocumented

Undocumented

Undocumented

def _parse_func_defs(self, ast_node_lst, def_records, scope='mod'): (source)

Parse the function and class definitions in this module

Parameters
ast_node_lsta list of statements to be visited.
def_recordsa list of dictionary, each of whose entry is a
scopethe scope that is currently being visited. When it is "mod",
function/class definition.
it is visiting under the entire module.
def _process_base_names(self, bases): (source)

Undocumented

def _read_scope(self, scope): (source)

Undocumented

def _retrieve_by_scope(self, target_search_node, scope): (source)

retrieve an AST node by the scope directive.

Parameters
target_search_nodethe AST node to be examined for entries in the
scopea dotted string to provide name space. For instance, A.fun
given scope.
function/class definition.
means to retrieve the function named fun in the class A