class documentation
class TypeMachineBuilder(Generic[
The main entry-point into Automat, used to construct a factory for instances of InputProtocol that take an instance of Core.
Describe the machine with TypeMachineBuilder.state
.upon
.to
, then build it with TypeMachineBuilder.build
, like so:
from typing import Protocol class Inputs(Protocol): def method(self) -> None: ... class Core: ... from automat import TypeMachineBuilder builder = TypeMachineBuilder(Inputs, Core) state = builder.state("state") state.upon(Inputs.method).loop().returns(None) Machine = builder.build() machine = Machine(Core()) machine.method()
Method | build |
Create a TypeMachine , and prevent further modification to the state machine being built. |
Method | state |
Construct a state. |
Class Variable | core |
Undocumented |
Class Variable | input |
Undocumented |
Method | _check |
Ensure that ``input`` is a valid member function of the input protocol, not just a function that happens to take the right first argument. |
Class Variable | _automaton |
Undocumented |
Class Variable | _registrars |
Undocumented |
Instance Variable | _built |
Undocumented |
Instance Variable | _initial |
Undocumented |
@overload
def state(self, name:
@overloadstr
) -> TypedState[ InputProtocol, Core]
:def state(self, name:
(source)
¶
str
, dataFactory: Callable[ Concatenate[ InputProtocol, Core, P], Data]
) -> TypedDataState[ InputProtocol, Core, Data, P]
:Construct a state.
Ensure that ``input`` is a valid member function of the input protocol, not just a function that happens to take the right first argument.