fleche.storage.pickle_file

Attributes

logger

_HMAC_MIN_KEY_BYTES

Classes

PickleFile

Store values as files on the filesystem using a serialization module.

Functions

_normalize_secret_key(→ list[bytes])

Normalize a secret key value to list[bytes].

Module Contents

fleche.storage.pickle_file.logger[source]
fleche.storage.pickle_file._HMAC_MIN_KEY_BYTES = 32[source]
fleche.storage.pickle_file._normalize_secret_key(key) list[bytes][source]

Normalize a secret key value to list[bytes].

Accepts: - bytes: wrapped in a list - str: split on ":" delimiter, each part encoded to UTF-8 - list[bytes]: each element validated for minimum length - list[str]: each element (or colon-delimited parts) encoded to UTF-8

Each resulting key must be at least _HMAC_MIN_KEY_BYTES bytes long.

Raises:
  • TypeError – if key or any element is not bytes or str.

  • ValueError – if any resulting key is shorter than _HMAC_MIN_KEY_BYTES.

class fleche.storage.pickle_file.PickleFile[source]

Bases: fleche.storage.file.FileStorage

Store values as files on the filesystem using a serialization module.

secret_key: list[bytes] = [][source]
serializer: Any[source]
compress: bool = False[source]
__post_init__()[source]
classmethod with_pickle(*args, **kwargs)[source]

Construct a PickleFile using the standard pickle module.

classmethod with_cloudpickle(*args, **kwargs)[source]

Construct a PickleFile using the cloudpickle module.

classmethod with_dill(*args, **kwargs)[source]

Construct a PickleFile using the dill module.

__getstate__()[source]
__setstate__(state)[source]
_save(value: Any, key: fleche.digest.Digest) fleche.digest.Digest[source]
_load(key: fleche.digest.Digest) Any[source]