specless.automaton.factory.AutomatonCollection
- class specless.automaton.factory.AutomatonCollection[source]
Bases:
ObjectFactory
registering the builders for the different types of automaton objects with a more readable interface to our generic factory class.
Methods
Returns an instance object built with the keyed builder key and the constructor arguments in kwargs
return an instance of an automaton given the automaton_type and the config_data.
adds the builder object to the internal builder dictionary
- create(key: str, **kwargs)
Returns an instance object built with the keyed builder key and the constructor arguments in kwargs
- Parameters:
key (string) – The _builders dict key reffering to the builder
kwargs (dictionary) – The keywords arguments needed by the builder specified by key
- Returns:
A concrete object built by the builder specified with key
- Return type:
who knows lol
- Raises:
ValueError – given key must match an existing builder in _builders
- get(automaton_type: str, **config_data) Automaton [source]
return an instance of an automaton given the automaton_type and the config_data.
If the automaton has already been intialized with the same configuration data, it will return the already-initialized instance of it
- Parameters:
automaton_type – The automaton type
config_data – The keywords arguments to pass to the specific automaton builder class
- Returns:
an intialized / active reference to the desired type of automaton object
- register_builder(key: str, builder: Builder) None
adds the builder object to the internal builder dictionary
effects: the _builders dictionary has the key-builder pair appended
- Parameters:
key (string) – The _builders dict key reffering to the builder
builder (Builder) – The Builder object This can be any function, class or object implementing the .__call__() method