cottax.pytree.consumers.visualization module

Registers how a key path is drawn (PlaceDrawing); offers NoFormat, jax’s spelling, chosen as a drawing’s formatter=.

class PathDrawing[source]

Bases: PlaceDrawing

A key path, written plainly, as jax spells it, minted under a Mint, grouped by its leading string keys.

spell_plain(path: Path)[source]

A string key as itself, dot-joined – [‘mda’][‘y1’] is mda.y1, ^cond[‘y1’] is ^cond.y1. Any other key (an index, an attribute, a kind no surface mints) is written as jax writes it, so a name is never mis-written.

Return type:

str

spelling(path: Path)[source]

A name as its own kind writes it in full, in a one-line summary or a refusal.

Return type:

str

minted_from(path: Path)[source]

Its purpose and the path under it.

Return type:

tuple[str, Path] | None

namespace_of(path: Path, depth: int | None = None)[source]

Its leading string keys (a DictKey of a string, or an attribute), without its own last key, at most depth of them. A minted name is read through its namespace, so ^solve.physics.x is in physics.

Return type:

tuple[str, ...]

class NoFormat[source]

Bases: Formatter

The name as jax spells it, notation included.

spell(path: Path)[source]
Return type:

str

set(source: str)[source]
Return type:

str

label(text: str)[source]
Return type:

str

text(text: Text)[source]
Return type:

str

outright(path: Path)[source]
Return type:

bool

notation(m: Mint)[source]
Return type:

Notation