cottax.consumers.declaration.interface module

A declaration interface for a surface for types of conditional nodes.

class Declaring(locator: Locator[V, N], conventions: ~cottax.consumers.declaration.conventions.Conventions = Conventions(reads=ParameterReads(by_name=True), term=<function term_of>, per_place=<function per_place_of>))[source]

Bases: Part

Part declaring multiple nodes (residuals / implicit models / rates)

Includes conventions on what means what here (i.e. does it read all function parameter strictly?)

class Mine(ShippedSurface, MyDeclaring), a declaring part of a study’s own beside the shipped ones; surface.reading(conventions) reads its arguments otherwise.

conventions: Conventions = Conventions(reads=ParameterReads(by_name=True), term=<function term_of>, per_place=<function per_place_of>)

cottax’s unless a study says otherwise.

Type:

What each argument that may be a value means

function

function(fn, *outputs) where it is used, @function(*outputs) where it is written. Each parameter is read where reads says, else by name under the surface read_in names it in, else by name in this one.

Type:

A function computing its outputs, returned in that order

declare(*models: Any)[source]

Walk a model tree yielding a Declared: the graph plus already given values and tags.

Return type:

Declared

reading(conventions: Conventions)[source]

The same surface, arguments read as conventions says.

Return type:

Self

parameter_reads(fn: Body, reads: Any, read_in: Mapping[Callable[[str], Any], Any], *, given: Callable[[str], Any])[source]

The place each parameter of fn reads, as conventions.reads says.

Return type:

tuple[PlaceWithValue, ...]

term(x: Any, written: Any, value_at: PlaceToPlace)[source]

What is written where a place about x is due, as conventions.term says: None for zero, a value at value_at(x), or a place.

Return type:

PlaceWithValue | None

per_place(among: tuple[Any, ...], written: Any)[source]

What is written for each of among, as conventions.per_place says.

Return type:

dict[Place, Any]