marshmallow 3.26.1__py3-none-any.whl → 4.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- marshmallow/__init__.py +1 -51
- marshmallow/constants.py +22 -0
- marshmallow/decorators.py +56 -40
- marshmallow/exceptions.py +3 -3
- marshmallow/experimental/__init__.py +5 -0
- marshmallow/experimental/context.py +73 -0
- marshmallow/fields.py +378 -451
- marshmallow/schema.py +131 -193
- marshmallow/types.py +14 -6
- marshmallow/utils.py +17 -226
- marshmallow/validate.py +2 -16
- {marshmallow-3.26.1.dist-info → marshmallow-4.0.0.dist-info}/METADATA +8 -6
- marshmallow-4.0.0.dist-info/RECORD +19 -0
- {marshmallow-3.26.1.dist-info → marshmallow-4.0.0.dist-info}/WHEEL +1 -1
- marshmallow/base.py +0 -61
- marshmallow/warnings.py +0 -10
- marshmallow-3.26.1.dist-info/RECORD +0 -18
- {marshmallow-3.26.1.dist-info → marshmallow-4.0.0.dist-info/licenses}/LICENSE +0 -0
marshmallow/types.py
CHANGED
|
@@ -7,13 +7,23 @@
|
|
|
7
7
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
|
+
try:
|
|
11
|
+
from typing import TypeAlias
|
|
12
|
+
except ImportError: # Remove when dropping Python 3.9
|
|
13
|
+
from typing_extensions import TypeAlias
|
|
14
|
+
|
|
10
15
|
import typing
|
|
11
16
|
|
|
12
17
|
#: A type that can be either a sequence of strings or a set of strings
|
|
13
|
-
StrSequenceOrSet = typing.Union[
|
|
18
|
+
StrSequenceOrSet: TypeAlias = typing.Union[
|
|
19
|
+
typing.Sequence[str], typing.AbstractSet[str]
|
|
20
|
+
]
|
|
14
21
|
|
|
15
22
|
#: Type for validator functions
|
|
16
|
-
Validator = typing.Callable[[typing.Any], typing.Any]
|
|
23
|
+
Validator: TypeAlias = typing.Callable[[typing.Any], typing.Any]
|
|
24
|
+
|
|
25
|
+
#: A valid option for the ``unknown`` schema option and argument
|
|
26
|
+
UnknownOption: TypeAlias = typing.Literal["exclude", "include", "raise"]
|
|
17
27
|
|
|
18
28
|
|
|
19
29
|
class SchemaValidator(typing.Protocol):
|
|
@@ -23,6 +33,7 @@ class SchemaValidator(typing.Protocol):
|
|
|
23
33
|
original_data: typing.Any = ...,
|
|
24
34
|
*,
|
|
25
35
|
partial: bool | StrSequenceOrSet | None = None,
|
|
36
|
+
unknown: UnknownOption | None = None,
|
|
26
37
|
many: bool = False,
|
|
27
38
|
) -> None: ...
|
|
28
39
|
|
|
@@ -33,8 +44,5 @@ class RenderModule(typing.Protocol):
|
|
|
33
44
|
) -> str: ...
|
|
34
45
|
|
|
35
46
|
def loads(
|
|
36
|
-
self,
|
|
37
|
-
json_data: str | bytes | bytearray,
|
|
38
|
-
*args: typing.Any,
|
|
39
|
-
**kwargs: typing.Any,
|
|
47
|
+
self, s: str | bytes | bytearray, *args: typing.Any, **kwargs: typing.Any
|
|
40
48
|
) -> typing.Any: ...
|
marshmallow/utils.py
CHANGED
|
@@ -3,99 +3,38 @@
|
|
|
3
3
|
# ruff: noqa: T201, T203
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
|
-
import collections
|
|
7
6
|
import datetime as dt
|
|
8
|
-
import functools
|
|
9
7
|
import inspect
|
|
10
|
-
import json
|
|
11
|
-
import re
|
|
12
8
|
import typing
|
|
13
|
-
import
|
|
14
|
-
from collections.abc import Mapping
|
|
15
|
-
from email.utils import format_datetime, parsedate_to_datetime
|
|
16
|
-
from pprint import pprint as py_pprint
|
|
9
|
+
from collections.abc import Mapping, Sequence
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
from
|
|
11
|
+
# Remove when we drop Python 3.9
|
|
12
|
+
try:
|
|
13
|
+
from typing import TypeGuard
|
|
14
|
+
except ImportError:
|
|
15
|
+
from typing_extensions import TypeGuard
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
from marshmallow.fields import Field
|
|
17
|
+
from marshmallow.constants import missing
|
|
24
18
|
|
|
25
19
|
|
|
26
|
-
|
|
27
|
-
INCLUDE = "include"
|
|
28
|
-
RAISE = "raise"
|
|
29
|
-
_UNKNOWN_VALUES = {EXCLUDE, INCLUDE, RAISE}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class _Missing:
|
|
33
|
-
def __bool__(self):
|
|
34
|
-
return False
|
|
35
|
-
|
|
36
|
-
def __copy__(self):
|
|
37
|
-
return self
|
|
38
|
-
|
|
39
|
-
def __deepcopy__(self, _):
|
|
40
|
-
return self
|
|
41
|
-
|
|
42
|
-
def __repr__(self):
|
|
43
|
-
return "<marshmallow.missing>"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# Singleton value that indicates that a field's value is missing from input
|
|
47
|
-
# dict passed to `Schema.load <marshmallow.Schema.load>`. If the field's value is not required,
|
|
48
|
-
# it's ``default`` value is used.
|
|
49
|
-
missing = _Missing()
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def is_generator(obj) -> bool:
|
|
20
|
+
def is_generator(obj) -> TypeGuard[typing.Generator]:
|
|
53
21
|
"""Return True if ``obj`` is a generator"""
|
|
54
22
|
return inspect.isgeneratorfunction(obj) or inspect.isgenerator(obj)
|
|
55
23
|
|
|
56
24
|
|
|
57
|
-
def is_iterable_but_not_string(obj) ->
|
|
25
|
+
def is_iterable_but_not_string(obj) -> TypeGuard[typing.Iterable]:
|
|
58
26
|
"""Return True if ``obj`` is an iterable object that isn't a string."""
|
|
59
27
|
return (hasattr(obj, "__iter__") and not hasattr(obj, "strip")) or is_generator(obj)
|
|
60
28
|
|
|
61
29
|
|
|
62
|
-
def
|
|
63
|
-
"""Return True if ``obj`` is a
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def is_instance_or_subclass(val, class_) -> bool:
|
|
68
|
-
"""Return True if ``val`` is either a subclass or instance of ``class_``."""
|
|
69
|
-
try:
|
|
70
|
-
return issubclass(val, class_)
|
|
71
|
-
except TypeError:
|
|
72
|
-
return isinstance(val, class_)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def is_keyed_tuple(obj) -> bool:
|
|
76
|
-
"""Return True if ``obj`` has keyed tuple behavior, such as
|
|
77
|
-
namedtuples or SQLAlchemy's KeyedTuples.
|
|
78
|
-
"""
|
|
79
|
-
return isinstance(obj, tuple) and hasattr(obj, "_fields")
|
|
30
|
+
def is_sequence_but_not_string(obj) -> TypeGuard[Sequence]:
|
|
31
|
+
"""Return True if ``obj`` is a sequence that isn't a string."""
|
|
32
|
+
return isinstance(obj, Sequence) and not isinstance(obj, (str, bytes))
|
|
80
33
|
|
|
81
34
|
|
|
82
|
-
def
|
|
83
|
-
"""
|
|
84
|
-
|
|
85
|
-
:meth:`marshmallow.Schema.dump`.
|
|
86
|
-
|
|
87
|
-
.. deprecated:: 3.7.0
|
|
88
|
-
marshmallow.pprint will be removed in marshmallow 4.
|
|
89
|
-
"""
|
|
90
|
-
warnings.warn(
|
|
91
|
-
"marshmallow's pprint function is deprecated and will be removed in marshmallow 4.",
|
|
92
|
-
RemovedInMarshmallow4Warning,
|
|
93
|
-
stacklevel=2,
|
|
94
|
-
)
|
|
95
|
-
if isinstance(obj, collections.OrderedDict):
|
|
96
|
-
print(json.dumps(obj, *args, **kwargs))
|
|
97
|
-
else:
|
|
98
|
-
py_pprint(obj, *args, **kwargs)
|
|
35
|
+
def is_collection(obj) -> TypeGuard[typing.Iterable]:
|
|
36
|
+
"""Return True if ``obj`` is a collection type, e.g list, tuple, queryset."""
|
|
37
|
+
return is_iterable_but_not_string(obj) and not isinstance(obj, Mapping)
|
|
99
38
|
|
|
100
39
|
|
|
101
40
|
# https://stackoverflow.com/a/27596917
|
|
@@ -105,97 +44,6 @@ def is_aware(datetime: dt.datetime) -> bool:
|
|
|
105
44
|
)
|
|
106
45
|
|
|
107
46
|
|
|
108
|
-
def from_rfc(datestring: str) -> dt.datetime:
|
|
109
|
-
"""Parse a RFC822-formatted datetime string and return a datetime object.
|
|
110
|
-
|
|
111
|
-
https://stackoverflow.com/questions/885015/how-to-parse-a-rfc-2822-date-time-into-a-python-datetime # noqa: B950
|
|
112
|
-
"""
|
|
113
|
-
return parsedate_to_datetime(datestring)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
def rfcformat(datetime: dt.datetime) -> str:
|
|
117
|
-
"""Return the RFC822-formatted representation of a datetime object.
|
|
118
|
-
|
|
119
|
-
:param datetime: The datetime.
|
|
120
|
-
"""
|
|
121
|
-
return format_datetime(datetime)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
# Hat tip to Django for ISO8601 deserialization functions
|
|
125
|
-
|
|
126
|
-
_iso8601_datetime_re = re.compile(
|
|
127
|
-
r"(?P<year>\d{4})-(?P<month>\d{1,2})-(?P<day>\d{1,2})"
|
|
128
|
-
r"[T ](?P<hour>\d{1,2}):(?P<minute>\d{1,2})"
|
|
129
|
-
r"(?::(?P<second>\d{1,2})(?:\.(?P<microsecond>\d{1,6})\d{0,6})?)?"
|
|
130
|
-
r"(?P<tzinfo>Z|[+-]\d{2}(?::?\d{2})?)?$"
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
_iso8601_date_re = re.compile(r"(?P<year>\d{4})-(?P<month>\d{1,2})-(?P<day>\d{1,2})$")
|
|
134
|
-
|
|
135
|
-
_iso8601_time_re = re.compile(
|
|
136
|
-
r"(?P<hour>\d{1,2}):(?P<minute>\d{1,2})"
|
|
137
|
-
r"(?::(?P<second>\d{1,2})(?:\.(?P<microsecond>\d{1,6})\d{0,6})?)?"
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
def get_fixed_timezone(offset: float | dt.timedelta) -> dt.timezone:
|
|
142
|
-
"""Return a tzinfo instance with a fixed offset from UTC."""
|
|
143
|
-
if isinstance(offset, dt.timedelta):
|
|
144
|
-
offset = offset.total_seconds() // 60
|
|
145
|
-
sign = "-" if offset < 0 else "+"
|
|
146
|
-
hhmm = "{:02d}{:02d}".format(*divmod(abs(offset), 60))
|
|
147
|
-
name = sign + hhmm
|
|
148
|
-
return dt.timezone(dt.timedelta(minutes=offset), name)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
def from_iso_datetime(value):
|
|
152
|
-
"""Parse a string and return a datetime.datetime.
|
|
153
|
-
|
|
154
|
-
This function supports time zone offsets. When the input contains one,
|
|
155
|
-
the output uses a timezone with a fixed offset from UTC.
|
|
156
|
-
"""
|
|
157
|
-
match = _iso8601_datetime_re.match(value)
|
|
158
|
-
if not match:
|
|
159
|
-
raise ValueError("Not a valid ISO8601-formatted datetime string")
|
|
160
|
-
kw = match.groupdict()
|
|
161
|
-
kw["microsecond"] = kw["microsecond"] and kw["microsecond"].ljust(6, "0")
|
|
162
|
-
tzinfo = kw.pop("tzinfo")
|
|
163
|
-
if tzinfo == "Z":
|
|
164
|
-
tzinfo = dt.timezone.utc
|
|
165
|
-
elif tzinfo is not None:
|
|
166
|
-
offset_mins = int(tzinfo[-2:]) if len(tzinfo) > 3 else 0
|
|
167
|
-
offset = 60 * int(tzinfo[1:3]) + offset_mins
|
|
168
|
-
if tzinfo[0] == "-":
|
|
169
|
-
offset = -offset
|
|
170
|
-
tzinfo = get_fixed_timezone(offset)
|
|
171
|
-
kw = {k: int(v) for k, v in kw.items() if v is not None}
|
|
172
|
-
kw["tzinfo"] = tzinfo
|
|
173
|
-
return dt.datetime(**kw) # noqa: DTZ001
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
def from_iso_time(value):
|
|
177
|
-
"""Parse a string and return a datetime.time.
|
|
178
|
-
|
|
179
|
-
This function doesn't support time zone offsets.
|
|
180
|
-
"""
|
|
181
|
-
match = _iso8601_time_re.match(value)
|
|
182
|
-
if not match:
|
|
183
|
-
raise ValueError("Not a valid ISO8601-formatted time string")
|
|
184
|
-
kw = match.groupdict()
|
|
185
|
-
kw["microsecond"] = kw["microsecond"] and kw["microsecond"].ljust(6, "0")
|
|
186
|
-
kw = {k: int(v) for k, v in kw.items() if v is not None}
|
|
187
|
-
return dt.time(**kw)
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
def from_iso_date(value):
|
|
191
|
-
"""Parse a string and return a datetime.date."""
|
|
192
|
-
match = _iso8601_date_re.match(value)
|
|
193
|
-
if not match:
|
|
194
|
-
raise ValueError("Not a valid ISO8601-formatted date string")
|
|
195
|
-
kw = {k: int(v) for k, v in match.groupdict().items()}
|
|
196
|
-
return dt.date(**kw)
|
|
197
|
-
|
|
198
|
-
|
|
199
47
|
def from_timestamp(value: typing.Any) -> dt.datetime:
|
|
200
48
|
if value is True or value is False:
|
|
201
49
|
raise ValueError("Not a valid POSIX timestamp")
|
|
@@ -231,22 +79,6 @@ def timestamp_ms(value: dt.datetime) -> float:
|
|
|
231
79
|
return timestamp(value) * 1000
|
|
232
80
|
|
|
233
81
|
|
|
234
|
-
def isoformat(datetime: dt.datetime) -> str:
|
|
235
|
-
"""Return the ISO8601-formatted representation of a datetime object.
|
|
236
|
-
|
|
237
|
-
:param datetime: The datetime.
|
|
238
|
-
"""
|
|
239
|
-
return datetime.isoformat()
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
def to_iso_time(time: dt.time) -> str:
|
|
243
|
-
return dt.time.isoformat(time)
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
def to_iso_date(date: dt.date) -> str:
|
|
247
|
-
return dt.date.isoformat(date)
|
|
248
|
-
|
|
249
|
-
|
|
250
82
|
def ensure_text_type(val: str | bytes) -> str:
|
|
251
83
|
if isinstance(val, bytes):
|
|
252
84
|
val = val.decode("utf-8")
|
|
@@ -331,50 +163,9 @@ def callable_or_raise(obj):
|
|
|
331
163
|
return obj
|
|
332
164
|
|
|
333
165
|
|
|
334
|
-
def _signature(func: typing.Callable) -> list[str]:
|
|
335
|
-
return list(inspect.signature(func).parameters.keys())
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
def get_func_args(func: typing.Callable) -> list[str]:
|
|
339
|
-
"""Given a callable, return a list of argument names. Handles
|
|
340
|
-
`functools.partial` objects and class-based callables.
|
|
341
|
-
|
|
342
|
-
.. versionchanged:: 3.0.0a1
|
|
343
|
-
Do not return bound arguments, eg. ``self``.
|
|
344
|
-
"""
|
|
345
|
-
if inspect.isfunction(func) or inspect.ismethod(func):
|
|
346
|
-
return _signature(func)
|
|
347
|
-
if isinstance(func, functools.partial):
|
|
348
|
-
return _signature(func.func)
|
|
349
|
-
# Callable class
|
|
350
|
-
return _signature(func)
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
def resolve_field_instance(cls_or_instance: type[Field] | Field) -> Field:
|
|
354
|
-
"""Return a field instance from a field class or instance.
|
|
355
|
-
|
|
356
|
-
:param cls_or_instance: Field class or instance.
|
|
357
|
-
"""
|
|
358
|
-
if isinstance(cls_or_instance, type):
|
|
359
|
-
if not issubclass(cls_or_instance, FieldABC):
|
|
360
|
-
raise FieldInstanceResolutionError
|
|
361
|
-
return cls_or_instance()
|
|
362
|
-
if not isinstance(cls_or_instance, FieldABC):
|
|
363
|
-
raise FieldInstanceResolutionError
|
|
364
|
-
return cls_or_instance
|
|
365
|
-
|
|
366
|
-
|
|
367
166
|
def timedelta_to_microseconds(value: dt.timedelta) -> int:
|
|
368
|
-
"""Compute the total microseconds of a timedelta
|
|
167
|
+
"""Compute the total microseconds of a timedelta.
|
|
369
168
|
|
|
370
|
-
https://github.com/python/cpython/blob/
|
|
169
|
+
https://github.com/python/cpython/blob/v3.13.1/Lib/_pydatetime.py#L805-L807
|
|
371
170
|
"""
|
|
372
171
|
return (value.days * (24 * 3600) + value.seconds) * 1000000 + value.microseconds
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
def validate_unknown_parameter_value(obj: typing.Any) -> str:
|
|
376
|
-
if obj not in _UNKNOWN_VALUES:
|
|
377
|
-
raise ValueError(
|
|
378
|
-
f"Object {obj!r} is not a valid value for the 'unknown' parameter"
|
|
379
|
-
)
|
|
380
|
-
return obj
|
marshmallow/validate.py
CHANGED
|
@@ -4,13 +4,11 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import re
|
|
6
6
|
import typing
|
|
7
|
-
import warnings
|
|
8
7
|
from abc import ABC, abstractmethod
|
|
9
8
|
from itertools import zip_longest
|
|
10
9
|
from operator import attrgetter
|
|
11
10
|
|
|
12
11
|
from marshmallow.exceptions import ValidationError
|
|
13
|
-
from marshmallow.warnings import ChangedInMarshmallow4Warning
|
|
14
12
|
|
|
15
13
|
if typing.TYPE_CHECKING:
|
|
16
14
|
from marshmallow import types
|
|
@@ -62,14 +60,10 @@ class And(Validator):
|
|
|
62
60
|
# ValidationError: ['Must be greater than or equal to 0.', 'Not an even value.']
|
|
63
61
|
|
|
64
62
|
:param validators: Validators to combine.
|
|
65
|
-
:param error: Error message to use when a validator returns ``False``.
|
|
66
63
|
"""
|
|
67
64
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
def __init__(self, *validators: types.Validator, error: str | None = None):
|
|
65
|
+
def __init__(self, *validators: types.Validator):
|
|
71
66
|
self.validators = tuple(validators)
|
|
72
|
-
self.error: str = error or self.default_error_message
|
|
73
67
|
|
|
74
68
|
def _repr_args(self) -> str:
|
|
75
69
|
return f"validators={self.validators!r}"
|
|
@@ -79,15 +73,7 @@ class And(Validator):
|
|
|
79
73
|
kwargs: dict[str, typing.Any] = {}
|
|
80
74
|
for validator in self.validators:
|
|
81
75
|
try:
|
|
82
|
-
|
|
83
|
-
if not isinstance(validator, Validator) and r is False:
|
|
84
|
-
warnings.warn(
|
|
85
|
-
"Returning `False` from a validator is deprecated. "
|
|
86
|
-
"Raise a `ValidationError` instead.",
|
|
87
|
-
ChangedInMarshmallow4Warning,
|
|
88
|
-
stacklevel=2,
|
|
89
|
-
)
|
|
90
|
-
raise ValidationError(self.error) # noqa: TRY301
|
|
76
|
+
validator(value)
|
|
91
77
|
except ValidationError as err:
|
|
92
78
|
kwargs.update(err.kwargs)
|
|
93
79
|
if isinstance(err.messages, dict):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: marshmallow
|
|
3
|
-
Version:
|
|
3
|
+
Version: 4.0.0
|
|
4
4
|
Summary: A lightweight library for converting complex datatypes to and from native Python datatypes.
|
|
5
5
|
Author-email: Steven Loria <sloria1@gmail.com>
|
|
6
6
|
Maintainer-email: Steven Loria <sloria1@gmail.com>, Jérôme Lafréchoux <jerome@jolimont.fr>, Jared Deckard <jared@shademaps.com>
|
|
@@ -15,16 +15,18 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
-
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: backports-datetime-fromisoformat; python_version < '3.11'
|
|
20
|
+
Requires-Dist: typing-extensions; python_version < '3.11'
|
|
19
21
|
Requires-Dist: marshmallow[tests] ; extra == "dev"
|
|
20
22
|
Requires-Dist: tox ; extra == "dev"
|
|
21
23
|
Requires-Dist: pre-commit>=3.5,<5.0 ; extra == "dev"
|
|
22
24
|
Requires-Dist: autodocsumm==0.2.14 ; extra == "docs"
|
|
23
25
|
Requires-Dist: furo==2024.8.6 ; extra == "docs"
|
|
24
26
|
Requires-Dist: sphinx-copybutton==0.5.2 ; extra == "docs"
|
|
25
|
-
Requires-Dist: sphinx-issues==5.0.
|
|
26
|
-
Requires-Dist: sphinx==8.
|
|
27
|
-
Requires-Dist: sphinxext-opengraph==0.
|
|
27
|
+
Requires-Dist: sphinx-issues==5.0.1 ; extra == "docs"
|
|
28
|
+
Requires-Dist: sphinx==8.2.3 ; extra == "docs"
|
|
29
|
+
Requires-Dist: sphinxext-opengraph==0.10.0 ; extra == "docs"
|
|
28
30
|
Requires-Dist: pytest ; extra == "tests"
|
|
29
31
|
Requires-Dist: simplejson ; extra == "tests"
|
|
30
32
|
Project-URL: Changelog, https://marshmallow.readthedocs.io/en/latest/changelog.html
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
marshmallow/__init__.py,sha256=EEHr24mHh2kH_pszxdnToOfBG6Z2wqeOKbb0iiDGFv4,587
|
|
2
|
+
marshmallow/class_registry.py,sha256=HTC9srCEaRsiy5L_vUKQso7IQfeZeRXxZfz4_2NitoM,3029
|
|
3
|
+
marshmallow/constants.py,sha256=maYmT3pvjQgfummof45SJI_pDqHDFWSu3knVN7su78M,374
|
|
4
|
+
marshmallow/decorators.py,sha256=CwD37uih8cyquwYGv-qKVPUUtKmj4tgas45AKwTdlZk,9987
|
|
5
|
+
marshmallow/error_store.py,sha256=iCPSdw8nJGiS4fjWuIAY1aSI_Hhckcdo3l_g-7pjaMw,2240
|
|
6
|
+
marshmallow/exceptions.py,sha256=CFb7Xb4KNIqsWycl6cUYlrQFGyNBR7zm18HI0BbXs_I,2335
|
|
7
|
+
marshmallow/fields.py,sha256=CIpnQ_MzX6h4_yO81mR0nJg34CjvieGYFQ7MQOycUOM,72081
|
|
8
|
+
marshmallow/orderedset.py,sha256=-Lq83AWIIFs2bxptDwkHtfQ63ebX3WD3R6N3B5rRnVI,2936
|
|
9
|
+
marshmallow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
marshmallow/schema.py,sha256=fIF1M3JS8wwNxrzchP7HhrtcDEn-KrLrujLqalA84S8,49904
|
|
11
|
+
marshmallow/types.py,sha256=EAMyppcDjDmSd57IWpBRk5RFY6uPoI8CvDr4pLaBXj8,1297
|
|
12
|
+
marshmallow/utils.py,sha256=T05FkN2S3z3Bc1jF6hfnA9jJEaUqULI3p60bGgFL8Fc,5467
|
|
13
|
+
marshmallow/validate.py,sha256=X6uhUir-2DqUVzKMkEN6I8LrLPJ1mbL8RECRggByllU,23931
|
|
14
|
+
marshmallow/experimental/__init__.py,sha256=5_iaUmT7_f6QML2LJXmA3xqgk5UBAgCeIazHtC1GVgc,147
|
|
15
|
+
marshmallow/experimental/context.py,sha256=_4KF6sNK6pE0MckyYTGXmU3hJL2tY-TN4oVmE_eDob0,2040
|
|
16
|
+
marshmallow-4.0.0.dist-info/licenses/LICENSE,sha256=kGtdkFHkJhRMsXOtkRZnuOvQWpxYTCwmwTWzKj7RIAE,1064
|
|
17
|
+
marshmallow-4.0.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
18
|
+
marshmallow-4.0.0.dist-info/METADATA,sha256=UsJ51KLqw0tcRrYZfoCL3mi7e1Hd9-TFKfRWYHIWEMQ,7432
|
|
19
|
+
marshmallow-4.0.0.dist-info/RECORD,,
|
marshmallow/base.py
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
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
|
marshmallow/warnings.py
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
marshmallow/__init__.py,sha256=TU1arjtOLs87YDfW4Z35YVbaY2CUXK-VgylcuL8LaQg,2387
|
|
2
|
-
marshmallow/base.py,sha256=39W78-rnuzzx5T95YWBEECzjtqxdUA8XzYJNHd39VLg,1362
|
|
3
|
-
marshmallow/class_registry.py,sha256=HTC9srCEaRsiy5L_vUKQso7IQfeZeRXxZfz4_2NitoM,3029
|
|
4
|
-
marshmallow/decorators.py,sha256=pMjGPaXBZCRfAdQS3Bz5ieTZGA3BOv61FdTPsLwCtMQ,8749
|
|
5
|
-
marshmallow/error_store.py,sha256=iCPSdw8nJGiS4fjWuIAY1aSI_Hhckcdo3l_g-7pjaMw,2240
|
|
6
|
-
marshmallow/exceptions.py,sha256=DuARdOcirCdJxmlp16V97hQKAXOokvdW12jXtYOlGyk,2326
|
|
7
|
-
marshmallow/fields.py,sha256=TKVxFY9hLpq7ch6_HEb1be5uPw0fgs-uC4n5o_fTkg8,74756
|
|
8
|
-
marshmallow/orderedset.py,sha256=-Lq83AWIIFs2bxptDwkHtfQ63ebX3WD3R6N3B5rRnVI,2936
|
|
9
|
-
marshmallow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
marshmallow/schema.py,sha256=Dc6ent2eI-0g9phGc1FB4EURpSNDRGFOjpyE2BWwYTc,52207
|
|
11
|
-
marshmallow/types.py,sha256=VY0_D-Xou7nKjcvWB1iccm8cZtxI3rkis1nhNelNn5Q,979
|
|
12
|
-
marshmallow/utils.py,sha256=tLzu9FDL3Ph51qKsoqWIyPSwg8dZ8rzjeXXGLUndHFE,11943
|
|
13
|
-
marshmallow/validate.py,sha256=Fx3F8F20dBGg-Wrv84Chx5SYedX9E0l592hR4MxS0kQ,24652
|
|
14
|
-
marshmallow/warnings.py,sha256=YHC0kQQBbTKCiA1FuwnbnXqrph7oKuU9BjTV4cxwnzE,192
|
|
15
|
-
marshmallow-3.26.1.dist-info/LICENSE,sha256=kGtdkFHkJhRMsXOtkRZnuOvQWpxYTCwmwTWzKj7RIAE,1064
|
|
16
|
-
marshmallow-3.26.1.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
|
|
17
|
-
marshmallow-3.26.1.dist-info/METADATA,sha256=9TJTS8CSQ5yUx_cNqkUz_0dQU9p0gCQcsJ_lUeq_7tE,7310
|
|
18
|
-
marshmallow-3.26.1.dist-info/RECORD,,
|
|
File without changes
|