ComponentManager

class wishbone.componentmanager.ComponentManager(namespace=['wishbone', 'wishbone_contrib', 'wishbone_external'], protocol_categories=['encode', 'decode'], module_categories=['flow', 'input', 'output', 'process'], function_categories=['template', 'module'])[source]

Loads Wishbone components and information.

When initiated it indexes all the Wishbone components found in the available <namespace>.<component_type>.<category> combinations.

A complete component reference would then be something like: wishbone.module.process.modify

  • wishbone is the namespace
  • module is the component type
  • process is the component category
  • modify is the name of the component

Note

The default Wishbone namespaces are wishbone, for the builtin modules and wishbone_contrib or wishbone_external for externally developed components.

There exist 3 component types:
  • module
  • function
  • protocol
Parameters:
  • namespace – The list of namespaces to search for <categories>
  • module_categories – The list of module categories to search
  • function_categories – The list of function categories to search
exists(name)[source]

Validates whether the component with <name> exists.

Parameters:name – The complete name of the component.
Returns:True if component exists. False otherwise.
Return type:bool
getComponent(namespace, component_type, category, name)[source]

Returns the module with name <namespace>.<component_type>.<category>.<name>

<namespace>.<component_type>.<category>.<name> must be an entrypoint.

Parameters:
  • namespace – The component namespace
  • component_type – The component type.
  • category – The component category.
  • name – The component name.
Returns:

A wishbone.Actor, wishbone.Function based class

Return type:

class

Raises:
  • NoSuchComponent – The module does not exist.
  • InvalidComponent – There was module found but it was not deemed valid.
getComponentByName(name)[source]

Returns the module with name name. name should be a valid entrypoint.

Parameters:

name – The complete module name.

Returns:

A wishbone.Actor or wishbone.Function based class

Return type:

class

Raises:
  • NoSuchComponent – The module does not exist.
  • InvalidComponent – There was module found but it was not deemed valid.
getComponentDoc(namespace, component_type, category, name)[source]

Returns the docstring of module namespace.`category`.`group`.`name`

Parameters:
  • namespace – The namespace value.
  • component_type – The component type.
  • category – The component type category.
  • name – The component name name.
Returns:

The docstring of the module.

Return type:

str

Raises:

InvalidModule – The docstring does not have the correct format.

getComponentList()[source]

Finds and lists all the components found at the defined <namespace>.<module_categories>. combinations.

Yields:tuple – A 4 element tuple: (namespace, component_type, category, name)
getComponentTable()[source]

Returns an ascii table of all found Wishbone components.

Returns:The ascii table containing all modules.
Return type:str
getComponentTitle(namespace, component_type, category, name)[source]

Returns the title of the module category.`group`.`name` docstring.

Parameters:
  • namespace – The namespace value.
  • component_type – The component type.
  • category – The component type category.
  • name – The component name name.
Returns:

The docstring/module title

Return type:

str

Raises:

InvalidModule – The docstring does not have the correct format.

getComponentVersion(namespace, component_type, category, name)[source]

Returns the version of the module.

Parameters:
  • namespace – The namespace value.
  • component_type – The component type.
  • category – The component type category.
  • name – The component name name.
Returns:

The version of the module.

Return type:

str

validateComponentName(name)[source]

Validates a component reference name for the proper format.

Parameters:name – The name to validate.
Returns:True when valid. False when invalid.
Return type:bool