profit.util.component

Component Base Class

abstract base class to register subclasses

Module Contents

Classes

Component

Helper class that provides a standard way to create an ABC using

class profit.util.component.Component[source]

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

_components
component = 'Component'
classmethod __init_subclass__(label=None)[source]

This method is called when a class is subclassed.

Register a new (sub-)component

classmethod register(label)[source]

Decorator to register new subcomponents.

This will allow access to the subcomponent via Component[label]. Internally the subcomponents are stored in _components. Warning: this is totally unrelated to ABC.register Not necessary when a Component is subclassed, __init_subclass__ is used instead

classmethod __class_getitem__(label)[source]

Returns the subcomponent.