cognition.decision.stage¶
Support for workflow housed within a single enumerated field.
Attributes¶
Function to optionally provide kwargs based upon interaction with IO |
Classes¶
Extensible state with an |
Functions¶
|
Given that a decision process is using a staged |
Module Contents¶
- class cognition.decision.stage.StagedState[T: enum.Enum]¶
Bases:
cognition.util.enumeration.EnumDispatch[T]Extensible state with an enumerated stage controlled via enum-named transition
To use…
declare
dataclasses.dataclass()subclass withstagefield type and initial valueadd additional fields as necessary
implement enum-named methods for non- terminal stages; each of which must return the next stage value (and can take arbitrary supporting arguments)
- stage: T¶
Required field: locus of task-flow state
- transition(*args, **kwargs)¶
Update stage via enum-named methods; each such method must return the next stage, with logic dependent upon passed arguments.
- Parameters:
args (Any) – positional arguments to pass
kwargs (Any) – keyword arguments to pass
- Return type:
None
- type cognition.decision.stage.StageSupporter = BiFunction[S, IOContainer, Mapping[str, Any] | None]¶
Function to optionally provide kwargs based upon interaction with IO
- cognition.decision.stage.staged_operator[SE, SS](dp, stage, **kwargs)¶
Given that a decision process is using a staged state, convenience decorator to add a full operator that applies during a supplied stage
- Parameters:
dp (cognition.decision.dp.DecisionProcess[SS]) – decision process to add operator to
stage (SE) – stage when added operator should apply
kwargs (Any) – operator params
- Return type:
cognition.util.functypes.Function[StageSupporter[SE, SS], StageSupporter[SE, SS]]