jztools.serializer.serializer#
Functions
|
Classes
|
Extension of JSON serializer that also supports objects implementing or being supported by a |
Exceptions
|
|
|
- exception jztools.serializer.serializer.ExtensionMissing(in_type)#
Bases:
TypeError
- exception jztools.serializer.serializer.UnserializableType(in_type)#
Bases:
TypeError
- class jztools.serializer.serializer.Serializer(extension_types: Iterable[AbstractTypeSerializer] = ())#
Bases:
objectExtension of JSON serializer that also supports objects implementing or being supported by a
TypeSerializableinterface as well lists, tuples, sets and dictionaries (with string keys) of such objects. Note that, unlike the default json behavior,Serializerpreserves types such as tuple and list.Default extensions include
sliceobjects andnumpy.dtypeobjects.- Parameters:
extension_types – List of types that implement
Serializablethat the serializer will take into account.
- default_extension_types = [<class 'jztools.serializer.extensions.SliceSerializer'>, <class 'jztools.serializer.extensions.DtypeSerializer'>, <class 'jztools.serializer.extensions.NDArraySerializer'>]#
Contains list of external supported types. External modules register their types by appending to this class-level list.
- load_safe(filelike, *args, **kwargs)#
Similar to load, but with no errors on empty files. Returns (obj, ‘success’) on success, (None, ‘empty’) if the file is empty, or (None, ‘missing’) if the file does not exist.