cottax.consumers.json.interface_types module

What a spelling writes and reads a node through (Writer, Reader), and Json, what it writes.

type Json = Any
class Writer[N: Label, V: Place](*args, **kwargs)[source]

Bases: Protocol, Generic[N, V]

What a spelling writes a node through, for the node bound at name.

name: N
place(place: V)[source]
Return type:

Json

places(places: tuple[V, ...])[source]
Return type:

list

label(name: N)[source]
Return type:

Json

node(node: NodeDefinition[V])[source]

A node it holds, by its own final’s spelling.

Return type:

dict

implementation(obj: object)[source]

What runs a node: by name, or a dataclass as a value.

Return type:

dict

value(obj: object)[source]

A dataclass as its class and fields: a driver, say.

Return type:

dict

refuse(what: str, reason: str)[source]

What to raise where what is not written: the export’s check reports it.

Return type:

Exception

class Reader[N: Label, V: Place](*args, **kwargs)[source]

Bases: Protocol, Generic[N, V]

What a spelling reads a node through, for the node bound at name.

name: N
place(data: Json)[source]
Return type:

V

places(data: list)[source]
Return type:

tuple[V, ...]

label(data: Json)[source]
Return type:

N

node(data: dict)[source]
Return type:

NodeDefinition[V]

implementation(data: dict)[source]
Return type:

object

value(data: dict)[source]
Return type:

Any