partis.schema_meta.struct module#

class SchemaStructDeclared(name, bases, namespace, tag, tag_key=None)[source]#

Bases: SchemaDeclared

Meta-class for all schema declareds

A schema declared acts as a forward declaration of a schema class if a reference to the schema is needed before the schema class has actually been defined. The eventual schema definition must have the exact same tag_key and tag as the declared that it defines. Once it has been defined, the actual schema definition may be retrieved from the schema property. A declared may only be defined by a single eventual schema class.

Parameters:
  • name (str) – Class name of type

  • bases (list[type]) – Base classes of type

  • namespace (dict[str, object]) –

  • tag_key (NoneType | str) – The key for the tag defining this schema. (default: ‘type’)

  • tag (str) – The tag defining this schema

See also

SchemaDeclared SchemaStruct

property tag_key#

The key for the tag defining this schema

Type:

str

property tag#

The tag defining this schema

Type:

str

class SchemaStruct(name, bases, namespace, tag_key=None, tag=None, declared=None, struct=None, struct_proxy=None, evaluated=None, default_val=None, default_eval=None, init_val=None, preset_vals=None, valued_type=None, doc=None, loc=None)[source]#

Bases: Schema

Meta-class for all defined schemas

Parameters:
  • name (str) – Class name of type

  • bases (list[type]) – Base classes of type

  • namespace (dict[str, object]) –

  • tag_key (NoneType | str) – The key for the tag defining this schema

  • tag (NoneType | str) – The tag defining this schema

  • declared (NoneType | SchemaDeclared) – The schema declared for which this is the definition. If given, the tag_key, tag are not required.

  • struct (NoneType | dict[ str, SchemaStruct | SchemaPrim ]) – Structure of the defined schema Mapping. Keys must be valid attribute names, not be “private” names starting with ‘__’ (double-underscore) or ‘_p’, or names of any Mapping attributes ‘keys’, ‘values’, ‘items’, or ‘get’.

  • struct_proxy (NoneType | RequiredType | str) – Key of primary structure value that may be set, using defaults for all other values. If any other values are required, specifying this will raise an error.

Raises:

SchemaDefinitionError – If the schema definition is not valid

See also

SchemaDeclared SchemaStruct

property tag_key#

Key used to obtain the tag for this struct type

Type:

str

property tag#

Tag for this struct type

Type:

str

property struct#

Structure of the defined schema

Type:

dict[ str, SchemaStruct | SchemaPrim ]

default_val#
default_eval#
init_val#
property evaluated#

Evaluation class

Type:

Evaluated

hints#
class SchemaStructProxy(name, bases, namespace, tag_key=None, tag=None, declared=None, struct=None, struct_proxy=None, evaluated=None, default_val=None, default_eval=None, init_val=None, preset_vals=None, doc=None, loc=None)[source]#

Bases: SchemaProxy

property tag_key#

Key used to obtain the tag for this struct type

Type:

str

property tag#

Tag for this struct type

Type:

str