cottax.consumers.json

A graph written as JSON, write_json, and read back, read_json (format.py): places by the PlaceCodec, node names by the LabelCodec and nodes by the Spelling registered for their class (interface.py). Every refusal kind is in refusals.

write_json[N: Label, V: Place](graph: NestingGraph[N, V], implementations: bool = True)[source]

A graph written as JSON, ready for json.dump: each binding its name and its definition, places by the registered codecs. With implementations=False, the structure alone. Each node is written twice: once by the check, once here.

Return type:

dict

read_json(data: dict, resolve: Callable[[str], object] = loaded)[source]

The graph data spells, every rule asked of it: places and node names by the codecs registered under the file’s tags, each node by the spelling registered for its kind; a name resolved by resolve.

Return type:

NestingGraph

Submodules