cottax.consumers.execution.interface module

Execution asks of a place:

  1. What a data structure holding it is, and how it is read and written (Answer)

Of a feature:

  1. Driver implementations, each implementing a DriverContract (Choice)

class DataStructure[V: Place][source]

Bases: Answer, Generic[V]

A caller’s data, indexed by places: registered for the place classes it indexes, and handed the data on each call. A slot holding None holds no value.

about

alias of Place

abstractmethod holds(data: Any, place: V)[source]

Whether data has a slot at place.

Return type:

bool

abstractmethod read(data: Any, places: Iterable[V])[source]

The value in data at each of places, in that order, None where its slot holds none; refuses a place it does not hold.

Return type:

OrderedMap[V, Any]

abstractmethod write(data: Any, values: Mapping[V, Any])[source]

data with values written; refuses a place it cannot hold.

Return type:

Any

class DriverImplementation[D: DriverContract][source]

Bases: Frozen, Choice, Generic[D]

Implementation for a DriverContract, named per contract in ImplementDrivers, per problem in Drive or Implement.

The type parameter is the contract it implements: Newton(DriverImplementation[RootFinder]) implements a RootFinder.

Needs and provides are with respect to that contract.

Handed in as:

Plan(graph) + ImplementDrivers({RootFinder : Newton()}) where the first is a DriverContract type (contract) and the latter is a DriverImplementation for that contract.

Plan(graph) + Implement({node_name : Newton()}) where the first is a node name and the latter is a DriverImplementation for that node.

implements: AbstractClassVar[type[DriverContract]]

abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.

Type:

What the level binds in place of the annotation

needs: AbstractClassVar[frozenset[type[Role]]]

abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.

Type:

What the level binds in place of the annotation

provides: AbstractClassVar[frozenset[type[Role]]]

abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.

Type:

What the level binds in place of the annotation