cottax.consumers.surface.interface module

A surface converts whatever is input to cottax native names.

Of a place:

  1. DerivedNames: how a class of names gives the other class, and a name one deeper.

Of a type that wants to be a place or a node (Written):

  1. How it is converted from what it can be given from the surface (itself + the naming rules)

class DerivedNames[N: Label, V: Place][source]

Bases: Answer, Generic[N, V]

How a class of names gives the other class, and a name one deeper; how it wears a purpose is core’s Minting.

about: AbstractClassVar[Any] = (<class 'cottax.core.maths.places.Place'>, Label)

a class, a type alias of one, a protocol, or a tuple of those. @answers refuses a class that is none; a protocol is met by shape, which a class cannot be asked.

Type:

What the interface is answered per, bound by the interface

abstractmethod beside(place: V, name: str)[source]

place one name deeper: where a read written as a value sits, under its purpose.

Return type:

V

abstractmethod node_at(place: V)[source]

The node name a place gives: where a closure over it binds.

Return type:

N

abstractmethod place_at(node: N)[source]

The place a node name gives: where a driver’s per-problem data sits.

Return type:

V

abstractmethod node_in_tree(steps: tuple[Step, ...])[source]

The node name a position in a tree of models gives: the steps to it from the root.

Return type:

N

class Written[N: Label, V: Place][source]

Bases: Answer, Generic[N, V]

What a study writes where a name is due that is neither a string nor an exact name: the places it stands for, and the node name it takes. Registered by the owner of its class (pytree for a V / N builder, declaration for a wrapper or a problem); a class nobody answers is no name.

abstractmethod places(written: Any)[source]

The places written stands for; None where it is no place.

Return type:

tuple[V, ...] | None

abstractmethod node(written: Any, names: DerivedNames[N, V])[source]

The node name written takes, names the surface’s rules; None where it is no node name.

Return type:

Optional[N]

class Locator[V: Place, N: Label][source]

Bases: Frozen, Choice, Generic[V, N]

How a bare string is converted to a cottax native Place or Label.

Handed in as:

surface.located(Under(V.plasma, GetAttrKey)), a surface whose strings are attributes under .plasma; cx.Scope(V.plasma, GetAttrKey) is the same.

places: AbstractClassVar[type[Place]]

what the names derived from one are found by.

Type:

The class of place it locates

nodes: AbstractClassVar[type[Label]]

The class of node name it locates.

abstractmethod place(s: str)[source]

A string written where a place is due.

Return type:

V

abstractmethod node(s: str)[source]

A string written where a node is due.

Return type:

N

class Part(locator: Locator[V, N])[source]

Bases: Surface, Choice

A level of a surface adding methods: each takes exact names, its parameters annotated Place or Label read by the surface before it runs, and returns a declaration, an op or a run. What it defaults to is an AbstractVar a final binds. Two parts defining one name are refused where they are joined.

Handed in as:

class Mine(ShippedSurface, MyPart), the shipped parts and one of a study’s own, then Mine(locator, conventions) – or a surface joining only the parts it names.

class Editing(locator: Locator[V, N])[source]

Bases: Part

Core’s own edits, written by name: the ops a study writes by hand, each named after the op it builds; a copy goes where copies says.

copies: AbstractVar[PlaceToPlace]

^copy.var.

Type:

Where a cut’s copy of a place goes

copy(var: Place)[source]

Where a cut of var puts its copy, as this surface’s cuts and closings mint it.

Return type:

Place

cut(var: Place, readers: tuple[Label, ...], *, copy_of: PlaceToPlace | None = None)[source]

readers (one, or several) read a copy of var; its producer stays.

Return type:

Cut

rename(node: Label, onto: Mapping[Place, Place])[source]

The node reads and owns each place of onto at the place it maps to.

Return type:

Rename

determine(requirement: Label, *unknowns: Place)[source]

The requirement determines unknowns: a problem.

Return type:

Determine

nest(inner: Label, outer: Label)[source]

The problem inner is answered inside every iteration of outer.

Return type:

Nest

unnest(inner: Label)[source]

The problem inner answered at its own level again.

Return type:

Unnest

combine(at: Label, nodes: tuple[Label, ...], kind: type)[source]

nodes folded into one at at, by kind’s +.

Return type:

Combine

delete(nodes: tuple[Label, ...])[source]

nodes (one, or several) unbound.

Return type:

Delete

implement(implementations: Mapping[Label, object])[source]

Each node run by what it maps to.

Return type:

Implement