topology.interact

topology module for interactive mode.

Functions

topology.interact.interact(mgr)

Shell setup function.

This function will setup the library, create the default namespace with shell symbols, setup the history file, the autocompleter and launch a shell session.

Classes

class topology.interact.NamespaceCompleter(ns)

Readline completer using a dictionary namespace.

Inheritance

Inheritance diagram of NamespaceCompleter

dict_attributes(element)

Type aware attributes to dictionary function.

Parameters:element – Python object to list attributes.
Return type:dict
Returns:A dict of the element attributes.
format_matches(path, attrs, prefixed)

Format a list of attributes to be shown in autocompleter.

Parameters:
  • path – List of string representing the path to the node.
  • attrs – List of attributes of the node.
  • prefixed – Prefix attributes must have in order to be shown.
Return type:

list

Returns:

Formatted list of attributes.

search_tree(root, path)

Search for a node in a Python object as if it were a tree: namespaces, modules, objects, method, attributes, etc.

Parameters:
  • root – The root Python object.
  • path (list) – List of names representing the path.
Return type:

list

Returns:

The subnode or None if not found.