OpenQuizz
Une application de gestion des contenus pédagogiques
|
Data Structures | |
class | Evolver |
Public Member Functions | |
def | __new__ (cls, initial={}, size=_UNDEFINED_CHECKED_PMAP_SIZE) |
def | evolver (self) |
def | __repr__ (self) |
def | serialize (self, format=None) |
def | create (cls, source_data, _factory_fields=None) |
def | __reduce__ (self) |
![]() | |
def | __getitem__ (self, key) |
def | __contains__ (self, key) |
def | __iter__ (self) |
def | __getattr__ (self, key) |
def | iterkeys (self) |
def | itervalues (self) |
def | iteritems (self) |
def | values (self) |
def | keys (self) |
def | items (self) |
def | __len__ (self) |
def | __eq__ (self, other) |
def | __lt__ (self, other) |
def | __str__ (self) |
def | __hash__ (self) |
def | set (self, key, val) |
def | remove (self, key) |
def | discard (self, key) |
def | update (self, *maps) |
def | update_with (self, update_fn, *maps) |
def | __add__ (self, other) |
def | transform (self, *transformations) |
def | copy (self) |
![]() | |
def | __new__ (mcs, name, bases, dct) |
Additional Inherited Members | |
![]() | |
get | |
A CheckedPMap is a PMap which allows specifying type and invariant checks. >>> class IntToFloatMap(CheckedPMap): ... __key_type__ = int ... __value_type__ = float ... __invariant__ = lambda k, v: (int(v) == k, 'Invalid mapping') ... >>> IntToFloatMap({1: 1.5, 2: 2.25}) IntToFloatMap({1: 1.5, 2: 2.25})
def __new__ | ( | cls, | |
initial = {} , |
|||
size = _UNDEFINED_CHECKED_PMAP_SIZE |
|||
) |
Reimplemented from PMap.
def __reduce__ | ( | self | ) |
Reimplemented from PMap.
def __repr__ | ( | self | ) |
Reimplemented from PMap.
def create | ( | cls, | |
source_data, | |||
_factory_fields = None |
|||
) |
Reimplemented from CheckedType.
def evolver | ( | self | ) |
Create a new evolver for this pmap. For a discussion on evolvers in general see the documentation for the pvector evolver. Create the evolver and perform various mutating updates to it: >>> m1 = m(a=1, b=2) >>> e = m1.evolver() >>> e['c'] = 3 >>> len(e) 3 >>> del e['a'] The underlying pmap remains the same: >>> m1 pmap({'b': 2, 'a': 1}) The changes are kept in the evolver. An updated pmap can be created using the persistent() function on the evolver. >>> m2 = e.persistent() >>> m2 pmap({'c': 3, 'b': 2}) The new pmap will share data with the original pmap in the same way that would have been done if only using operations on the pmap.
Reimplemented from PMap.
def serialize | ( | self, | |
format = None |
|||
) |
Reimplemented from CheckedType.