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 namespacemodule
is the component typeprocess
is the component categorymodify
is the name of the component
Note
The default Wishbone namespaces are
wishbone
, for the builtin modules andwishbone_contrib
orwishbone_external
for externally developed components.- There exist 3 component types:
- module
- function
- protocol
Parameters: -
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: Returns: A
wishbone.Actor
,wishbone.Function
based classReturn 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: 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: Returns: The docstring/module title
Return type: str
Raises: InvalidModule
– The docstring does not have the correct format.