code_utils.py#

Tools for working with code.

openmdao.utils.code_utils.get_class_attributes(fname, class_dict=None)[source]

Find all referenced attributes in all classes defined in the given file.

Parameters:
fnamestr

File name.

class_dictdict or None

Dict mapping class names to attribute names.

Returns:
dict

The dict maps class name to a set of attribute names.

openmdao.utils.code_utils.get_nested_calls(class_, method_name, stream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Display the call tree for the specified class method and all ‘self’ class methods it calls.

Parameters:
class_class

The starting class.

method_namestr

The name of the class method.

streamfile-like

The output stream where output will be displayed.

Returns:
networkx.DiGraph

A graph containing edges from methods to their sub-methods.