OpenQuizz
Une application de gestion des contenus pédagogiques
pyrsistent._field_common Namespace Reference

Data Structures

class  _PField
 
class  PTypeError
 

Functions

def set_fields (dct, bases, name)
 
def check_global_invariants (subject, invariants)
 
def serialize (serializer, format, value)
 
def check_type (destination_cls, field, name, value)
 
def is_type_cls (type_cls, field_type)
 
def is_field_ignore_extra_complaint (type_cls, field, ignore_extra)
 
def field (type=PFIELD_NO_TYPE, invariant=PFIELD_NO_INVARIANT, initial=PFIELD_NO_INITIAL, mandatory=False, factory=PFIELD_NO_FACTORY, serializer=PFIELD_NO_SERIALIZER)
 
def pset_field (item_type, optional=False, initial=())
 
def pvector_field (item_type, optional=False, initial=())
 
def pmap_field (key_type, value_type, optional=False, invariant=PFIELD_NO_INVARIANT)
 

Variables

 PY2
 
 PFIELD_NO_TYPE
 
 PFIELD_NO_INVARIANT
 
 PFIELD_NO_FACTORY
 
 PFIELD_NO_INITIAL
 
 PFIELD_NO_SERIALIZER
 
 SEQ_FIELD_TYPE_SUFFIXES
 

Function Documentation

◆ check_global_invariants()

def pyrsistent._field_common.check_global_invariants (   subject,
  invariants 
)

◆ check_type()

def pyrsistent._field_common.check_type (   destination_cls,
  field,
  name,
  value 
)

◆ field()

def pyrsistent._field_common.field (   type = PFIELD_NO_TYPE,
  invariant = PFIELD_NO_INVARIANT,
  initial = PFIELD_NO_INITIAL,
  mandatory = False,
  factory = PFIELD_NO_FACTORY,
  serializer = PFIELD_NO_SERIALIZER 
)
Field specification factory for :py:class:`PRecord`.

:param type: a type or iterable with types that are allowed for this field
:param invariant: a function specifying an invariant that must hold for the field
:param initial: value of field if not specified when instantiating the record
:param mandatory: boolean specifying if the field is mandatory or not
:param factory: function called when field is set.
:param serializer: function that returns a serialized version of the field

◆ is_field_ignore_extra_complaint()

def pyrsistent._field_common.is_field_ignore_extra_complaint (   type_cls,
  field,
  ignore_extra 
)

◆ is_type_cls()

def pyrsistent._field_common.is_type_cls (   type_cls,
  field_type 
)

◆ pmap_field()

def pyrsistent._field_common.pmap_field (   key_type,
  value_type,
  optional = False,
  invariant = PFIELD_NO_INVARIANT 
)
Create a checked ``PMap`` field.

:param key: The required type for the keys of the map.
:param value: The required type for the values of the map.
:param optional: If true, ``None`` can be used as a value for
    this field.
:param invariant: Pass-through to ``field``.

:return: A ``field`` containing a ``CheckedPMap``.

◆ pset_field()

def pyrsistent._field_common.pset_field (   item_type,
  optional = False,
  initial = () 
)
Create checked ``PSet`` field.

:param item_type: The required type for the items in the set.
:param optional: If true, ``None`` can be used as a value for
    this field.
:param initial: Initial value to pass to factory if no value is given
    for the field.

:return: A ``field`` containing a ``CheckedPSet`` of the given type.

◆ pvector_field()

def pyrsistent._field_common.pvector_field (   item_type,
  optional = False,
  initial = () 
)
Create checked ``PVector`` field.

:param item_type: The required type for the items in the vector.
:param optional: If true, ``None`` can be used as a value for
    this field.
:param initial: Initial value to pass to factory if no value is given
    for the field.

:return: A ``field`` containing a ``CheckedPVector`` of the given type.

◆ serialize()

def pyrsistent._field_common.serialize (   serializer,
  format,
  value 
)

◆ set_fields()

def pyrsistent._field_common.set_fields (   dct,
  bases,
  name 
)

Variable Documentation

◆ PFIELD_NO_FACTORY

PFIELD_NO_FACTORY

◆ PFIELD_NO_INITIAL

PFIELD_NO_INITIAL

◆ PFIELD_NO_INVARIANT

PFIELD_NO_INVARIANT

◆ PFIELD_NO_SERIALIZER

PFIELD_NO_SERIALIZER

◆ PFIELD_NO_TYPE

PFIELD_NO_TYPE

◆ PY2

PY2

◆ SEQ_FIELD_TYPE_SUFFIXES

SEQ_FIELD_TYPE_SUFFIXES