TypeCodec

TypeCodec(
    name: str,
    cls: type,
    role: Role,
    fields: tuple[str, ...],
    encode: Callable[[Any, Encoder], dict[str, Any]],
    decode: Callable[[dict[str, Any], Decoder], Any],
    kinds: frozenset[str] = frozenset(),
    display_forms: frozenset[str] = frozenset(),
)

How one type of a vocabulary is written and read.

encode returns the type’s fields (without @type), and decode builds the object from them; both are given the encoder or decoder so that they can write and read the values the fields hold. fields names exactly the keys the specification gives the type. kinds are the kinds a value of this type may stand for (§7.3); display_forms, for a tone, are the forms a name template may name.

Attributes

Name Description
name
cls
role
fields
encode
decode
kinds
display_forms