Spaces:
Sleeping
Sleeping
Upload backend/venv/lib/python3.10/site-packages/marshmallow/base.py with huggingface_hub
Browse files
backend/venv/lib/python3.10/site-packages/marshmallow/base.py
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Abstract base classes.
|
| 2 |
+
|
| 3 |
+
These are necessary to avoid circular imports between schema.py and fields.py.
|
| 4 |
+
|
| 5 |
+
.. warning::
|
| 6 |
+
|
| 7 |
+
This module is deprecated. Users should not import from this module.
|
| 8 |
+
Use `marshmallow.fields.Field` and `marshmallow.schema.Schema` as base classes instead.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from __future__ import annotations
|
| 12 |
+
|
| 13 |
+
from abc import ABC, abstractmethod
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
class FieldABC(ABC):
|
| 17 |
+
"""Abstract base class from which all Field classes inherit."""
|
| 18 |
+
|
| 19 |
+
@abstractmethod
|
| 20 |
+
def serialize(self, attr, obj, accessor=None):
|
| 21 |
+
pass
|
| 22 |
+
|
| 23 |
+
@abstractmethod
|
| 24 |
+
def deserialize(self, value):
|
| 25 |
+
pass
|
| 26 |
+
|
| 27 |
+
@abstractmethod
|
| 28 |
+
def _serialize(self, value, attr, obj, **kwargs):
|
| 29 |
+
pass
|
| 30 |
+
|
| 31 |
+
@abstractmethod
|
| 32 |
+
def _deserialize(self, value, attr, data, **kwargs):
|
| 33 |
+
pass
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class SchemaABC(ABC):
|
| 37 |
+
"""Abstract base class from which all Schemas inherit."""
|
| 38 |
+
|
| 39 |
+
@abstractmethod
|
| 40 |
+
def dump(self, obj, *, many: bool | None = None):
|
| 41 |
+
pass
|
| 42 |
+
|
| 43 |
+
@abstractmethod
|
| 44 |
+
def dumps(self, obj, *, many: bool | None = None):
|
| 45 |
+
pass
|
| 46 |
+
|
| 47 |
+
@abstractmethod
|
| 48 |
+
def load(self, data, *, many: bool | None = None, partial=None, unknown=None):
|
| 49 |
+
pass
|
| 50 |
+
|
| 51 |
+
@abstractmethod
|
| 52 |
+
def loads(
|
| 53 |
+
self,
|
| 54 |
+
json_data,
|
| 55 |
+
*,
|
| 56 |
+
many: bool | None = None,
|
| 57 |
+
partial=None,
|
| 58 |
+
unknown=None,
|
| 59 |
+
**kwargs,
|
| 60 |
+
):
|
| 61 |
+
pass
|