cottax.consumers.execution.drive module

Drive: every undriven problem driven, and implemented, by the first implementation accepting it; a driven one implemented by the first implementing its contract.

class Drive(implementations: tuple[DriverImplementation, ...], contracts: tuple[DriverContract, ...], places: Callable[[object, tuple, DriverContract], tuple[tuple, tuple]])[source]

Bases: ComposedOp

Every problem no driver answers yet, driven by the first implementation whose contract accepts its shape, under the first of contracts it implements, at the places places(at, unknowns, contract) gives (its data and its reports, as Assign takes them), and implemented by it. A problem already driven and not implemented is implemented by the first implementation whose implements covers its contract; one already implemented is left alone.

implementations: tuple[DriverImplementation, ...]
contracts: tuple[DriverContract, ...]
places: Callable[[object, tuple, DriverContract], tuple[tuple, tuple]]
composed(graph: NestingGraph)[source]

The ops this one is. Takes a graph, so an expansion may depend on what it meets.

Return type:

tuple[GraphOp, ...]

chosen(name, problem)[source]
Return type:

DriverImplementation

covering(name, contract: DriverContract)[source]

The first implementation of contract, a problem’s already.

Return type:

DriverImplementation

contract_for(implementation: DriverImplementation)[source]

The default contract an implementation answers: the first it implements.

Return type:

DriverContract