Method summary
- __init__(self, modules)
- __iter__(self)
- add_node(self, klass)
- create(self, class_names = None)
- get_class(self, name)
- get_node(self, name, create = 0)
- get_node_from_class(self, cls, create = 0)
Methods
- __init__(self, modules)
Initialize the instance with the given modules.
Parameters
modules : sequence of modules or a module
This is either a single module or a sequence of modules. The instance uses these list of modules to generate the class tree.
- __iter__(self)
- add_node(self, klass)
Create a node for the given class.
- create(self, class_names = None)
This method generates the class tree given an optional list of class names.
Parameters
class_names - list of str
An optional list of names of the classes to generate the tree for. Defaults to None where the class list is computed from the modules.
- get_class(self, name)
Given a class name in the given modules returns the class.
- get_node(self, name, create = 0)
Get a node of the given name.
Parameters
name : str
Name of the node to get.
create : boolean
If True, a new node will be added if no node of the given name is available. Defaults to False.
Returns
- TreeNode
- get_node_from_class(self, cls, create = 0)
Get a node of the given class.
Parameters
cls : class
Class of the node to get.
create : boolean
If True, a new node will be added if no node of the given name is available. Defaults to False.
Returns
- TreeNode