Pickle
Pickle is a binary serialization format that is specific to Python. It is a very powerful serialization format that can serialize almost any Python object. However, it is not recommended to use pickle to serialize and deserialize data from untrusted sources, as it can lead to security vulnerabilities.
It is only used as the default serializer for Jobs
to ensure that the Job
can be serialized and deserialized across different Python environments.
By default, the pickle
serializer uses the the first available sub-library in the following order of priority:
- cloudpickle
- dill
- pickle
References
API Reference
Bases: kvdb.io.serializers.base.BinaryBaseSerializer
METHOD | DESCRIPTION |
---|---|
adecode |
Decodes the value asynchronously |
adumps |
Dumps the value asynchronously |
aencode |
Encodes the value asynchronously |
aloads |
Loads the value asynchronously |
compress_value |
Compresses the value |
copy |
Copies the serializer |
create_hash |
Creates a hash for the object |
decode |
Decodes the value |
decode_value |
Decode the value with the Pickle Library |
decompress_value |
Decompresses the value |
deprecated_decompress_value |
Attempts to decompress the value using the deprecated compressor |
dumps |
Dumps the value |
encode |
Encodes the value |
encode_value |
Encode the value with the Pickle Library |
fetch_object_classname |
Fetches the object classname |
loads |
Loads the value |
set_default_lib |
Sets the default Pickle library |
ATTRIBUTE | DESCRIPTION |
---|---|
compression_enabled |
Returns if compression is enabled
TYPE:
|
compression_level |
Returns the compression level
TYPE:
|
Source code in kvdb/io/serializers/_pickle.py
adecode
async
adumps
async
aencode
async
aloads
async
compress_value
Compresses the value
Source code in kvdb/io/serializers/base.py
copy
copy(**kwargs) -> kvdb.io.serializers.base.BaseSerializer
Copies the serializer
Source code in kvdb/io/serializers/base.py
create_hash
decode
Decodes the value
Source code in kvdb/io/serializers/base.py
decode_value
decode_value(value: bytes, **kwargs) -> typing.Union[
kvdb.io.serializers.base.SchemaType,
typing.Dict,
typing.Any,
]
Decode the value with the Pickle Library
Source code in kvdb/io/serializers/_pickle.py
decompress_value
Decompresses the value
Source code in kvdb/io/serializers/base.py
deprecated_decompress_value
deprecated_decompress_value(
value: typing.Union[str, bytes], **kwargs
) -> typing.Optional[typing.Union[str, bytes]]
Attempts to decompress the value using the deprecated compressor
Source code in kvdb/io/serializers/base.py
dumps
Dumps the value
Source code in kvdb/io/serializers/base.py
encode
encode_value
encode_value(
value: typing.Union[
typing.Any, kvdb.io.serializers.base.SchemaType
],
**kwargs
) -> bytes
Encode the value with the Pickle Library
Source code in kvdb/io/serializers/_pickle.py
fetch_object_classname
loads
Loads the value
Source code in kvdb/io/serializers/base.py
set_default_lib
classmethod
set_default_lib(
lib: typing.Union[
str,
kvdb.io.serializers._pickle.PickleLibT,
kvdb.io.serializers.base.ModuleType,
]
) -> None
Sets the default Pickle library