fleche.storage.pickle_file ========================== .. py:module:: fleche.storage.pickle_file Attributes ---------- .. autoapisummary:: fleche.storage.pickle_file.logger fleche.storage.pickle_file._HMAC_MIN_KEY_BYTES Classes ------- .. autoapisummary:: fleche.storage.pickle_file.PickleFile Functions --------- .. autoapisummary:: fleche.storage.pickle_file._normalize_secret_key Module Contents --------------- .. py:data:: logger .. py:data:: _HMAC_MIN_KEY_BYTES :value: 32 .. py:function:: _normalize_secret_key(key) -> list[bytes] 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``. :raises ValueError: if any resulting key is shorter than ``_HMAC_MIN_KEY_BYTES``. .. py:class:: PickleFile Bases: :py:obj:`fleche.storage.file.FileStorage` Store values as files on the filesystem using a serialization module. .. py:attribute:: secret_key :type: list[bytes] :value: [] .. py:attribute:: serializer :type: Any .. py:attribute:: compress :type: bool :value: False .. py:method:: __post_init__() .. py:method:: with_pickle(*args, **kwargs) :classmethod: Construct a PickleFile using the standard pickle module. .. py:method:: with_cloudpickle(*args, **kwargs) :classmethod: Construct a PickleFile using the cloudpickle module. .. py:method:: with_dill(*args, **kwargs) :classmethod: Construct a PickleFile using the dill module. .. py:method:: __getstate__() .. py:method:: __setstate__(state) .. py:method:: _save(value: Any, key: fleche.digest.Digest) -> fleche.digest.Digest .. py:method:: _load(key: fleche.digest.Digest) -> Any