hyperiax.Schema

class hyperiax.Schema(fields)[source]

Bases: object

Ordered, hashable collection of named FieldSpecs.

Fields are stored as a tuple[(name, spec), ...] sorted by name so that equal sets of fields always hash identically regardless of insert order.

Parameters:

fields (tuple[tuple[str, FieldSpec], ...])

__init__(fields)
Parameters:

fields (tuple[tuple[str, FieldSpec], ...])

Return type:

None

Methods

__init__(fields)

from_dict(d)

with_added(**extra)

Return a new Schema with extra fields appended.

without(*names)

Return a new Schema with the named fields removed.

Attributes

fields: tuple[tuple[str, FieldSpec], ...]
classmethod from_dict(d)[source]
Return type:

Schema

Parameters:

d (Mapping[str, tuple | FieldSpec | None])

property names: tuple[str, ...]
with_added(**extra)[source]

Return a new Schema with extra fields appended. Raises if a name collides.

Return type:

Schema

without(*names)[source]

Return a new Schema with the named fields removed.

Return type:

Schema

Parameters:

names (str)