partis.schema.valued module#

class Valued(val=None, schema=None, loc=None, bias=None)[source]#

Bases: object

Base class of schema primitive values

Parameters:
  • val (object) – Source data to be evaluated

  • schema (Schema | SchemaPrim) –

  • loc (Loc) – Location information of source data (E.G. file, line/column number)

class BoolValued(val=None, schema=None, loc=None, bias=None)[source]#

Bases: Valued, int

Container for fully or partially evaluated boolean data

Parameters:
  • val (bool) – Source data to be evaluated

  • schema (Schema | SchemaPrim) –

  • loc (Loc) – Location information of source data (E.G. file, line/column number)

class IntValued(val=None, schema=None, loc=None, bias=None)[source]#

Bases: Valued, int

Container for fully or partially evaluated integer data

Parameters:
  • val (int) – Source data to be evaluated

  • schema (Schema | SchemaPrim) –

  • loc (Loc) – Location information of source data (E.G. file, line/column number)

class FloatValued(val=None, schema=None, loc=None, bias=None)[source]#

Bases: Valued, float

Container for fully or partially evaluated float data

Parameters:
  • val (float) – Source data to be evaluated

  • schema (Schema | SchemaPrim) –

  • loc (Loc) – Location information of source data (E.G. file, line/column number)

class StrValued(val=None, schema=None, loc=None, bias=None)[source]#

Bases: Valued, str

Container for fully or partially evaluated string data

Parameters:
  • val (str) – Source data to be evaluated

  • schema (Schema | SchemaPrim) –

  • loc (Loc) – Location information of source data (E.G. file, line/column number)

class SeqValued(val=None, schema=None, loc=None, bias=None)[source]#

Bases: Valued, list

Container for fully or partially evaluated sequence (list, array) data

Parameters:
  • val (list[object]) – Source data to be evaluated

  • schema (Schema | SchemaPrim) –

  • loc (Loc) – Location information of source data (E.G. file, line/column number)

append(val)[source]#

Append object to the end of the list.

extend(vals)[source]#

Extend list by appending elements from the iterable.

class MapValued(*args, **kwargs)[source]#

Bases: Valued, adict

Container for fully or partially evaluated mapping (dictionary, record) data

Parameters:
  • val (dict[str, object]) – Source data to be evaluated

  • schema (Schema | SchemaPrim) –

  • loc (Loc) – Location information of source data (E.G. file, line/column number)

class StructValuedMeta(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: ValuedMeta, SchemaStructProxy

class StructValued(*args, **kwargs)[source]#

Bases: Valued, Mapping

Container for fully or partially evaluated fixed mapping data.

Note

The terminology of ‘struct’ is used to indicate that the allowed key-value pairs of the value are fixed, such that keys may not be added or removed dynamically. However, key-values may be heterogenous, with a unique schema defined for each key, unlike the generic MapValue that specifies the same schema for all keys.

Parameters:
  • val (NoneType | object) – Source data used to initialize values

  • loc (NoneType | Loc) – Location information of source data (E.G. file, line/column number)

Raises:

SchemaValidationError – If the value is not valid

schema tag_key: str = 'type'
schema tag: str = 'base'
schema struct_proxy: None = None
schema default_val: RequiredType = Required
schema default_eval: RequiredType = Required
schema init_val: dict = { 'type' : 'base' }
schema evaluated: NotEvaluated
keys() a set-like object providing a view on D's keys[source]#
values() an object providing a view on D's values[source]#
items() a set-like object providing a view on D's items[source]#
get(k[, d]) D[k] if k in D, else d.  d defaults to None.[source]#
class StructValued_schema#

Bases: object

Container for fully or partially evaluated fixed mapping data.

Note

The terminology of ‘struct’ is used to indicate that the allowed key-value pairs of the value are fixed, such that keys may not be added or removed dynamically. However, key-values may be heterogenous, with a unique schema defined for each key, unlike the generic MapValue that specifies the same schema for all keys.

Parameters:
  • val (NoneType | object) – Source data used to initialize values

  • loc (NoneType | Loc) – Location information of source data (E.G. file, line/column number)

Raises:

SchemaValidationError – If the value is not valid

schema tag_key: str = 'type'
schema tag: str = 'base'
schema struct_proxy: None = None
schema default_val: RequiredType = Required
schema default_eval: RequiredType = Required
schema init_val: dict = { 'type' : 'base' }
schema evaluated: NotEvaluated#