summaryrefslogtreecommitdiff
path: root/requests_cache/serializers/pipeline.py
diff options
context:
space:
mode:
authorJordan Cook <jordan.cook@pioneer.com>2021-06-22 13:05:56 -0500
committerJordan Cook <jordan.cook@pioneer.com>2021-07-03 15:44:10 -0500
commita08c39ad6b213eb379df5872de0a695348c82542 (patch)
tree6ad91cb2aaf45d4b62c89e2c33fb3b060b42ce77 /requests_cache/serializers/pipeline.py
parentc4b9e4d4dcad5470de4a30464a6ac8a875615ad9 (diff)
downloadrequests-cache-a08c39ad6b213eb379df5872de0a695348c82542.tar.gz
Some serialization fixes & updates:
* Fix tests on python 3.6: * Make `cattrs` optional again * Don't run tests for serializers with missing optional dependencies * Show any skipped tests in pytest output * Fix redirect serialization for backends that serialize all values (DynamoDB and Redis) * Otherwise, the redirect value (which is just another key) will get converted into a `CachedResponse` * Make `pickle` serializer use `cattrs` if installed * Make `bson` serializer compatible with both `pymongo` version and standalone `bson` library * Split up `CattrStage` and preconf converters into separate modules * Turn preconf converters into `Stage` objects * Add `DeprecationWarning` for previous method of using `itsdangerous`, now that there's a better way to initialize it via `SerializerPipeline` * Remove `suppress_warnings` kwarg that's now unused * Make `SerializerPipeline`, `Stage`, and `CattrStage` importable from top-level package (`from requests_cache import ...`) * Add some more details to docs and docstrings
Diffstat (limited to 'requests_cache/serializers/pipeline.py')
-rw-r--r--requests_cache/serializers/pipeline.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/requests_cache/serializers/pipeline.py b/requests_cache/serializers/pipeline.py
index 9cd2fcf..e16799f 100644
--- a/requests_cache/serializers/pipeline.py
+++ b/requests_cache/serializers/pipeline.py
@@ -4,8 +4,7 @@ from ..models import CachedResponse
class Stage:
- # Generic utility class for aliasing dumps and loads to
- # other methods
+ """Generic class to wrap serialization steps with consistent ``dumps()`` and ``loads()`` methods"""
def __init__(self, obj: Any, dumps: str = "dumps", loads: str = "loads"):
self.obj = obj
@@ -14,6 +13,8 @@ class Stage:
class SerializerPipeline:
+ """A sequence of steps used to serialize and deserialize response objects"""
+
def __init__(self, steps: List):
self.steps = steps
self.dump_steps = [step.dumps for step in steps]