cottax.consumers.declaration.conventions module¶
Conventions, what a declaring part’s arguments mean, and cottax’s own readings: a function’s reads (ParameterReads), a term written where a place is due (term_of), what is written per place (per_place_of).
- class ParameterReads(by_name: bool = True)[source]¶
Bases:
Frozencottax’s reading of a function’s reads (reads_of), a parameter reads omits read at its own name unless by_name is off.
- by_name: bool = True¶
- reads_of[V: Place](parameters: tuple[str, ...], reads: Reads, read_in: ReadIn[V], *, place: Callable[[Any], V], given: Callable[[str], V], of: str, by_name: bool)[source]¶
The reads of the function of taking parameters, one per parameter in order: where reads says (a tuple is every parameter’s, in order); else by name under the rule read_in names it with; else, by_name, by name through place. A read written as a value, tagged or not, is minted at given(parameter); a name or a path tagged is that place, carrying the tags. Every parameter once, and no other name.
- Return type:
tuple[PlaceWithValue[V],...]
- written_at[V: Place](x: Any, *, place: Callable[[Any], V], minted: Callable[[], V])[source]¶
What is written where a place is due, as a place: a name or a path, tagged or not, that place carrying the tags; a value, tagged or not, at minted(), given it bare and the place carrying the tags.
- Return type:
- term_of[V: Place](x: V, written: Any, *, place: Callable[[Any], V], value_at: PlaceToPlace[V])[source]¶
What is written where a place is due, about x: zero (None), a value (a place minted by value_at off x, given it), or a place; tagged or not, as a read is.
- Return type:
Optional[PlaceWithValue[V]]
- per_place_of[V: Place](among: tuple[V, ...], written: Any, *, place: Callable[[Any], V])[source]¶
What is written for each of among: a mapping by name, or one thing for the one place there is.
- Return type:
dict[V,Any]
- class Conventions(reads: , tuple[~cottax.consumers.declaration.interface_types.PlaceWithValue, ...]]=ParameterReads(by_name=True), term: , ~cottax.consumers.declaration.interface_types.PlaceWithValue | None]=<function term_of>, per_place: , dict]=<function per_place_of>)[source]¶
Bases:
FrozenWhat a declaring part’s arguments mean, in three shapes, each a callable and cottax’s by default, so a study changes one: Conventions(term=my_term), my_term calling term_of for what it does not read itself. Held as a declaring part’s conventions, and asked through its methods of the same names (parameter_reads, term, per_place).
- reads: Callable[..., tuple[PlaceWithValue, ...]] = ParameterReads(by_name=True)¶
the reads of the function of, one per parameter in order: reads as written (a mapping by parameter, or a tuple of every one), read_in a rule per name, a value minted at given(parameter).
- Type:
reads(parameters, reads, read_in, *, place, given, of)
- term[V: Place](written: Any, *, place: Callable[[Any], V], value_at: PlaceToPlace[V])¶
term(x, written, *, place, value_at): what is written where a place about x is due: None for zero, a value at value_at(x), or a place.
- Return type:
Optional[PlaceWithValue[V]]