cottax.consumers.surface

What a study writes, read into exact names: a string through the surface’s locator, a path written in full, and what stands for a place or takes a node name. A part is a level of a surface adding methods over exact names; RolePlaces, where a driver’s data and reports are named, and core_role_places, core’s roles’ rules.

class Surface[N: Label, V: Place](locator: Locator[V, N])[source]

Bases: Frozen, Generic[N, V]

What a model is written through: locator says what a bare string means, and what else is written means what its Written answer says. A part is a level under it adding methods; a surface a study uses joins parts, a class. A method’s parameter annotated Place, Label or a tuple of either (alone, | None, varargs, or in a Mapping) is read through the surface before the method runs: a caller writes it any way the surface reads, and the method is handed it exact.

locator: Locator[V, N]
located(locator: Locator[V, N])[source]

The same surface, strings meaning what locator says.

Return type:

Self

place(written: Any, *, role: str = 'what is written')[source]

A place: a string, as the locator says, an exact place, or what it stands for (Written), if one place: a V path, a wrapper’s one output.

Return type:

V

places(written: Any, *, role: str = 'what is written')[source]

Places: one written alone, or several; what stands for places, all of them.

Return type:

tuple[V, ...]

node(written: Any, *, role: str = 'what is written')[source]

A node name: a string, as the locator says, an exact name, or the name it takes (Written): an N path, a wrapper’s function’s name.

Return type:

N

nodes(written: Any, *, role: str = 'what is written')[source]

Node names: one written alone, or several.

Return type:

tuple[N, ...]

property derived: DerivedNames[N, V]

The names derived from the class of place the locator locates.

class Purpose(mint: Mint)[source]

Bases: Frozen

A purpose as a study writes it: called on a name as written, the Derived name.

mint: Mint
beside(written: Any, *names: str)[source]

The place for this purpose names deeper than the place written.

Return type:

Derived

class Derived(mint: Mint, written: Any, beside: tuple[str, ...])[source]

Bases: Frozen

The name mint derives from one as written, read where the surface reads it and never stored: cx.copy(‘y’), cx.solve(‘f’), cx.given.beside(‘y’, ‘k’) (beside the names one deeper first, a place only).

mint: Mint
written: Any
beside: tuple[str, ...]
class RolePlaces(entries: OrderedMap[type[Role], PlaceToPlace])[source]

Bases: Frozen

Where a driver’s data and reports go, a rule per role (entries), found along the role’s ancestry, the most specific first: a PerUnknown role’s applied to each unknown, a PerProblem one’s to the problem’s name read as a place. A role with no entry is refused: nothing is named after a role unless a rule says so. a | b joins two, b’s winning.

entries: OrderedMap[type[Role], PlaceToPlace]
rule(role: type[Role])[source]

The rule for role: its own entry, else its nearest ancestor’s.

Return type:

PlaceToPlace

Submodules