Serializers

class testoot.base.TestootSerializer(file_type_hint: testoot.base.FileType, mode: str = 'b')[source]
__init__(file_type_hint: testoot.base.FileType, mode: str = 'b')[source]

Init

Parameters
  • file_type_hint – hint for generating file or resource name

  • mode – hint for storage stream

abstract dump(obj: any, stream: io.IOBase)[source]
property file_type_hint
abstract load(stream: io.IOBase) → any[source]
property mode
class testoot.serializers.BinarySerializer(file_type_hint: Optional[testoot.base.FileType] = None)[source]

Serializer for binary data.

__init__(file_type_hint: Optional[testoot.base.FileType] = None)[source]

Init

Parameters
  • file_type_hint – hint for generating file or resource name

  • mode – hint for storage stream

dump(obj: any, stream: io.IOBase)[source]
load(stream: io.IOBase) → any[source]
class testoot.serializers.JsonSerializer(file_type_hint: Optional[testoot.base.FileType] = None)[source]

Serializer for only json data.

__init__(file_type_hint: Optional[testoot.base.FileType] = None)[source]

Init

Parameters
  • file_type_hint – hint for generating file or resource name

  • mode – hint for storage stream

dump(obj: any, stream: io.IOBase)[source]
load(stream: io.IOBase) → any[source]
class testoot.serializers.PickleSerializer(file_type_hint: Optional[testoot.base.FileType] = None)[source]

Binary serializer for almost all Python objects.

PICKLE_PROTOCOL_VERSION = 4
__init__(file_type_hint: Optional[testoot.base.FileType] = None)[source]

Init

Parameters
  • file_type_hint – hint for generating file or resource name

  • mode – hint for storage stream

dump(obj: any, stream: io.IOBase)[source]
load(stream: io.IOBase) → any[source]
class testoot.serializers.StringSerializer(file_type_hint: Optional[testoot.base.FileType] = None)[source]

Serializer only for string type (utf-8).

__init__(file_type_hint: Optional[testoot.base.FileType] = None)[source]

Init

Parameters
  • file_type_hint – hint for generating file or resource name

  • mode – hint for storage stream

dump(obj: any, stream: io.IOBase)[source]
load(stream: io.IOBase) → any[source]