marshmallow 3.23.1__tar.gz → 3.23.3__tar.gz

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.
Files changed (76) hide show
  1. {marshmallow-3.23.1 → marshmallow-3.23.3}/CHANGELOG.rst +23 -0
  2. {marshmallow-3.23.1 → marshmallow-3.23.3}/PKG-INFO +1 -15
  3. {marshmallow-3.23.1 → marshmallow-3.23.3}/README.rst +0 -13
  4. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/api_reference.rst +0 -10
  5. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/conf.py +1 -21
  6. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/index.rst +0 -9
  7. marshmallow-3.23.3/docs/marshmallow.fields.rst +18 -0
  8. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/marshmallow.schema.rst +1 -0
  9. {marshmallow-3.23.1 → marshmallow-3.23.3}/pyproject.toml +1 -2
  10. {marshmallow-3.23.1 → marshmallow-3.23.3}/src/marshmallow/fields.py +24 -52
  11. {marshmallow-3.23.1 → marshmallow-3.23.3}/src/marshmallow/schema.py +3 -18
  12. {marshmallow-3.23.1 → marshmallow-3.23.3}/src/marshmallow/utils.py +1 -1
  13. marshmallow-3.23.1/docs/_static/css/sponsor-message.css +0 -15
  14. marshmallow-3.23.1/docs/_static/css/versionwarning.css +0 -42
  15. marshmallow-3.23.1/docs/marshmallow.fields.rst +0 -9
  16. {marshmallow-3.23.1 → marshmallow-3.23.3}/CONTRIBUTING.rst +0 -0
  17. {marshmallow-3.23.1 → marshmallow-3.23.3}/LICENSE +0 -0
  18. {marshmallow-3.23.1 → marshmallow-3.23.3}/NOTICE +0 -0
  19. {marshmallow-3.23.1 → marshmallow-3.23.3}/SECURITY.md +0 -0
  20. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/.gitignore +0 -0
  21. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/_static/marshmallow-logo.png +0 -0
  22. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/_templates/donate.html +0 -0
  23. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/_templates/useful-links.html +0 -0
  24. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/about.rst.inc +0 -0
  25. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/authors.rst +0 -0
  26. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/changelog.rst +0 -0
  27. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/code_of_conduct.rst +0 -0
  28. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/contributing.rst +0 -0
  29. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/custom_fields.rst +0 -0
  30. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/dashing.json +0 -0
  31. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/ecosystem.rst +0 -0
  32. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/examples.rst +0 -0
  33. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/extending.rst +0 -0
  34. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/install.rst +0 -0
  35. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/kudos.rst +0 -0
  36. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/license.rst +0 -0
  37. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/marshmallow.class_registry.rst +0 -0
  38. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/marshmallow.decorators.rst +0 -0
  39. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/marshmallow.error_store.rst +0 -0
  40. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/marshmallow.exceptions.rst +0 -0
  41. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/marshmallow.utils.rst +0 -0
  42. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/marshmallow.validate.rst +0 -0
  43. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/nesting.rst +0 -0
  44. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/quickstart.rst +0 -0
  45. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/upgrading.rst +0 -0
  46. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/whos_using.rst +0 -0
  47. {marshmallow-3.23.1 → marshmallow-3.23.3}/docs/why.rst +0 -0
  48. {marshmallow-3.23.1 → marshmallow-3.23.3}/src/marshmallow/__init__.py +0 -0
  49. {marshmallow-3.23.1 → marshmallow-3.23.3}/src/marshmallow/base.py +0 -0
  50. {marshmallow-3.23.1 → marshmallow-3.23.3}/src/marshmallow/class_registry.py +0 -0
  51. {marshmallow-3.23.1 → marshmallow-3.23.3}/src/marshmallow/decorators.py +0 -0
  52. {marshmallow-3.23.1 → marshmallow-3.23.3}/src/marshmallow/error_store.py +0 -0
  53. {marshmallow-3.23.1 → marshmallow-3.23.3}/src/marshmallow/exceptions.py +0 -0
  54. {marshmallow-3.23.1 → marshmallow-3.23.3}/src/marshmallow/orderedset.py +0 -0
  55. {marshmallow-3.23.1 → marshmallow-3.23.3}/src/marshmallow/py.typed +0 -0
  56. {marshmallow-3.23.1 → marshmallow-3.23.3}/src/marshmallow/types.py +0 -0
  57. {marshmallow-3.23.1 → marshmallow-3.23.3}/src/marshmallow/validate.py +0 -0
  58. {marshmallow-3.23.1 → marshmallow-3.23.3}/src/marshmallow/warnings.py +0 -0
  59. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/__init__.py +0 -0
  60. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/base.py +0 -0
  61. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/conftest.py +0 -0
  62. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/foo_serializer.py +0 -0
  63. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/mypy_test_cases/test_validation_error.py +0 -0
  64. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/test_decorators.py +0 -0
  65. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/test_deserialization.py +0 -0
  66. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/test_error_store.py +0 -0
  67. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/test_exceptions.py +0 -0
  68. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/test_fields.py +0 -0
  69. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/test_options.py +0 -0
  70. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/test_registry.py +0 -0
  71. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/test_schema.py +0 -0
  72. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/test_serialization.py +0 -0
  73. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/test_utils.py +0 -0
  74. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/test_validate.py +0 -0
  75. {marshmallow-3.23.1 → marshmallow-3.23.3}/tests/test_version_attributes.py +0 -0
  76. {marshmallow-3.23.1 → marshmallow-3.23.3}/tox.ini +0 -0
@@ -1,6 +1,29 @@
1
1
  Changelog
2
2
  ---------
3
3
 
4
+ 3.23.3 (2025-01-03)
5
+ *******************
6
+
7
+ Bug fixes:
8
+
9
+ - Typing: Fix typing for `Schema.from_dict <marshmallow.schema.Schema.from_dict>` (:issue:`1653`).
10
+ Thanks :user:`SteadBytes` for reporting.
11
+
12
+ Support:
13
+
14
+ - Documentation: Various documentation cleanups, including more concise docs in the `marshmallow.fields` API reference (:issue:`2307`).
15
+ Thanks :user:`AbdealiLoKo` for reporting.
16
+
17
+ 3.23.2 (2024-12-18)
18
+ *******************
19
+
20
+ Bug fixes:
21
+
22
+ - Improve type hint formatting for ``Field``, ``Nested``, and ``Function`` fields
23
+ to resolve PyCharm warnings (:issue:`2268`).
24
+ Thanks :user:`Fares-Abubaker` for reporting and fixing.
25
+
26
+
4
27
  3.23.1 (2024-11-01)
5
28
  *******************
6
29
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: marshmallow
3
- Version: 3.23.1
3
+ Version: 3.23.3
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>
@@ -22,7 +22,6 @@ Requires-Dist: pre-commit>=3.5,<5.0 ; extra == "dev"
22
22
  Requires-Dist: sphinx==8.1.3 ; extra == "docs"
23
23
  Requires-Dist: sphinx-issues==5.0.0 ; extra == "docs"
24
24
  Requires-Dist: alabaster==1.0.0 ; extra == "docs"
25
- Requires-Dist: sphinx-version-warning==1.1.2 ; extra == "docs"
26
25
  Requires-Dist: autodocsumm==0.2.14 ; extra == "docs"
27
26
  Requires-Dist: pytest ; extra == "tests"
28
27
  Requires-Dist: simplejson ; extra == "tests"
@@ -59,19 +58,6 @@ marshmallow: simplified object serialization
59
58
 
60
59
  **marshmallow** is an ORM/ODM/framework-agnostic library for converting complex datatypes, such as objects, to and from native Python datatypes.
61
60
 
62
- Sponsor Message
63
- ===============
64
-
65
- Input an OpenAPI spec to generate API docs that look as good as Stripe's. `Request a preview <https://form.typeform.com/to/uc55zY0F>`_ of your docs on Fern.
66
-
67
- .. image:: https://github.com/user-attachments/assets/69916225-0d61-4bd7-b3b9-e378557673cb
68
- :target: https://form.typeform.com/to/uc55zY0F
69
- :align: center
70
- :alt: Fern logo
71
-
72
- Example
73
- =======
74
-
75
61
  .. code-block:: python
76
62
 
77
63
  from datetime import date
@@ -22,19 +22,6 @@ marshmallow: simplified object serialization
22
22
 
23
23
  **marshmallow** is an ORM/ODM/framework-agnostic library for converting complex datatypes, such as objects, to and from native Python datatypes.
24
24
 
25
- Sponsor Message
26
- ===============
27
-
28
- Input an OpenAPI spec to generate API docs that look as good as Stripe's. `Request a preview <https://form.typeform.com/to/uc55zY0F>`_ of your docs on Fern.
29
-
30
- .. image:: https://github.com/user-attachments/assets/69916225-0d61-4bd7-b3b9-e378557673cb
31
- :target: https://form.typeform.com/to/uc55zY0F
32
- :align: center
33
- :alt: Fern logo
34
-
35
- Example
36
- =======
37
-
38
25
  .. code-block:: python
39
26
 
40
27
  from datetime import date
@@ -13,13 +13,3 @@ API Reference
13
13
  marshmallow.error_store
14
14
  marshmallow.class_registry
15
15
  marshmallow.exceptions
16
-
17
- .. automodule:: marshmallow
18
- :members:
19
- :undoc-members:
20
- :autosummary:
21
-
22
- .. data:: EXCLUDE
23
- .. data:: INCLUDE
24
- .. data:: RAISE
25
- .. data:: missing
@@ -8,14 +8,13 @@ extensions = [
8
8
  "sphinx.ext.viewcode",
9
9
  "alabaster",
10
10
  "sphinx_issues",
11
- "versionwarning.extension",
12
11
  "autodocsumm",
13
12
  ]
14
13
 
15
14
  primary_domain = "py"
16
15
  default_role = "py:obj"
17
16
 
18
- intersphinx_mapping = {"python": ("https://python.readthedocs.io/en/latest/", None)}
17
+ intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
19
18
 
20
19
  issues_github_path = "marshmallow-code/marshmallow"
21
20
 
@@ -36,7 +35,6 @@ exclude_patterns = ["_build"]
36
35
  html_theme_path = [alabaster.get_path()]
37
36
  html_theme = "alabaster"
38
37
  html_static_path = ["_static"]
39
- html_css_files = ["css/versionwarning.css", "css/sponsor-message.css"]
40
38
  templates_path = ["_templates"]
41
39
  html_show_sourcelink = False
42
40
 
@@ -76,21 +74,3 @@ html_sidebars = {
76
74
  "relations.html",
77
75
  ],
78
76
  }
79
-
80
- # sphinx-version-warning config
81
- versionwarning_messages = {
82
- "latest": (
83
- "This document is for the development version. "
84
- 'For the stable version documentation, see <a href="/en/stable/">here</a>.'
85
- ),
86
- "2.x-line": (
87
- "marshmallow 2 is no longer supported as of 2020-08-18. "
88
- '<a href="https://marshmallow.readthedocs.io/en/latest/upgrading.html#upgrading-to-3-0">'
89
- "Update your code to use marshmallow 3</a>."
90
- ),
91
- }
92
- # Show warning at top of page
93
- versionwarning_body_selector = "div.document"
94
- versionwarning_banner_title = ""
95
- # For debugging locally
96
- # versionwarning_project_version = "latest"
@@ -6,15 +6,6 @@ marshmallow: simplified object serialization
6
6
 
7
7
  Release v\ |version|. (:doc:`Changelog <changelog>`)
8
8
 
9
- .. admonition:: Sponsor Message
10
-
11
- Input an OpenAPI spec to generate API docs that look as good as Stripe's. `Request a preview <https://form.typeform.com/to/uc55zY0F>`_ of your docs on Fern.
12
-
13
- .. image:: https://github.com/user-attachments/assets/69916225-0d61-4bd7-b3b9-e378557673cb
14
- :target: https://form.typeform.com/to/uc55zY0F
15
- :align: center
16
- :alt: Fern logo
17
-
18
9
  .. include:: about.rst.inc
19
10
 
20
11
  Upgrading from an older version?
@@ -0,0 +1,18 @@
1
+ .. _api_fields:
2
+
3
+ Fields
4
+ ======
5
+
6
+ Base Field Class
7
+ ----------------
8
+
9
+ .. autoclass:: marshmallow.fields.Field
10
+ :private-members:
11
+
12
+ Field Subclasses
13
+ ----------------
14
+
15
+ .. automodule:: marshmallow.fields
16
+ :members:
17
+ :autosummary:
18
+ :exclude-members: Field, default_error_messages, mapping_type, num_type, DESERIALIZATION_CLASS
@@ -4,5 +4,6 @@ Schema
4
4
  .. autoclass:: marshmallow.schema.Schema
5
5
  :inherited-members:
6
6
  :autosummary:
7
+ :exclude-members: OPTIONS_CLASS
7
8
 
8
9
  .. autoclass:: marshmallow.schema.SchemaOpts
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "marshmallow"
3
- version = "3.23.1"
3
+ version = "3.23.3"
4
4
  description = "A lightweight library for converting complex datatypes to and from native Python datatypes."
5
5
  readme = "README.rst"
6
6
  license = { file = "LICENSE" }
@@ -36,7 +36,6 @@ docs = [
36
36
  "sphinx==8.1.3",
37
37
  "sphinx-issues==5.0.0",
38
38
  "alabaster==1.0.0",
39
- "sphinx-version-warning==1.1.2",
40
39
  "autodocsumm==0.2.14",
41
40
  ]
42
41
  tests = ["pytest", "simplejson"]
@@ -1,5 +1,3 @@
1
- """Field classes for various types of data."""
2
-
3
1
  from __future__ import annotations
4
2
 
5
3
  import collections
@@ -84,7 +82,6 @@ class Field(FieldABC):
84
82
  """Basic field from which other fields should extend. It applies no
85
83
  formatting by default, and should only be used in cases where
86
84
  data does not need to be formatted before being serialized or deserialized.
87
- On error, the name of the field will be returned.
88
85
 
89
86
  :param dump_default: If set, this value will be used during serialization if the
90
87
  input value is missing. If not set, the field will be excluded from the
@@ -108,8 +105,9 @@ class Field(FieldABC):
108
105
  :param required: Raise a :exc:`ValidationError` if the field value
109
106
  is not supplied during deserialization.
110
107
  :param allow_none: Set this to `True` if `None` should be considered a valid value during
111
- validation/deserialization. If ``load_default=None`` and ``allow_none`` is unset,
112
- will default to ``True``. Otherwise, the default is ``False``.
108
+ validation/deserialization. If set to `False` (the default), `None` is considered invalid input.
109
+ If ``load_default`` is explicitly set to `None` and ``allow_none`` is unset,
110
+ `allow_none` is implicitly set to ``True``.
113
111
  :param load_only: If `True` skip this field during serialization, otherwise
114
112
  its value will be present in the serialized data.
115
113
  :param dump_only: If `True` skip this field during deserialization, otherwise
@@ -118,28 +116,12 @@ class Field(FieldABC):
118
116
  :param dict error_messages: Overrides for `Field.default_error_messages`.
119
117
  :param metadata: Extra information to be stored as field metadata.
120
118
 
121
- .. versionchanged:: 2.0.0
122
- Removed `error` parameter. Use ``error_messages`` instead.
123
-
124
- .. versionchanged:: 2.0.0
125
- Added `allow_none` parameter, which makes validation/deserialization of `None`
126
- consistent across fields.
127
-
128
- .. versionchanged:: 2.0.0
129
- Added `load_only` and `dump_only` parameters, which allow field skipping
130
- during the (de)serialization process.
131
-
132
- .. versionchanged:: 2.0.0
133
- Added `missing` parameter, which indicates the value for a field if the field
134
- is not found during deserialization.
135
-
136
- .. versionchanged:: 2.0.0
137
- ``default`` value is only used if explicitly set. Otherwise, missing values
138
- inputs are excluded from serialized output.
139
-
140
119
  .. versionchanged:: 3.0.0b8
141
120
  Add ``data_key`` parameter for the specifying the key in the input and
142
121
  output data. This parameter replaced both ``load_from`` and ``dump_to``.
122
+
123
+ .. versionchanged:: 3.13.0
124
+ Replace ``missing`` and ``default`` parameters with ``load_default`` and ``dump_default``.
143
125
  """
144
126
 
145
127
  # Some fields, such as Method fields and Function fields, are not expected
@@ -166,9 +148,9 @@ class Field(FieldABC):
166
148
  data_key: str | None = None,
167
149
  attribute: str | None = None,
168
150
  validate: (
169
- None
170
- | typing.Callable[[typing.Any], typing.Any]
151
+ typing.Callable[[typing.Any], typing.Any]
171
152
  | typing.Iterable[typing.Callable[[typing.Any], typing.Any]]
153
+ | None
172
154
  ) = None,
173
155
  required: bool = False,
174
156
  allow_none: bool | None = None,
@@ -321,8 +303,9 @@ class Field(FieldABC):
321
303
  self,
322
304
  attr: str,
323
305
  obj: typing.Any,
324
- accessor: typing.Callable[[typing.Any, str, typing.Any], typing.Any]
325
- | None = None,
306
+ accessor: (
307
+ typing.Callable[[typing.Any, str, typing.Any], typing.Any] | None
308
+ ) = None,
326
309
  **kwargs,
327
310
  ):
328
311
  """Pulls the value for the given key from the object, applies the
@@ -425,9 +408,6 @@ class Field(FieldABC):
425
408
  :raise ValidationError: In case of formatting or validation failure.
426
409
  :return: The deserialized value.
427
410
 
428
- .. versionchanged:: 2.0.0
429
- Added ``attr`` and ``data`` parameters.
430
-
431
411
  .. versionchanged:: 3.0.0
432
412
  Added ``**kwargs`` to signature.
433
413
  """
@@ -538,11 +518,15 @@ class Nested(Field):
538
518
 
539
519
  def __init__(
540
520
  self,
541
- nested: SchemaABC
542
- | SchemaMeta
543
- | str
544
- | dict[str, Field | type[Field]]
545
- | typing.Callable[[], SchemaABC | SchemaMeta | dict[str, Field | type[Field]]],
521
+ nested: (
522
+ SchemaABC
523
+ | SchemaMeta
524
+ | str
525
+ | dict[str, Field | type[Field]]
526
+ | typing.Callable[
527
+ [], SchemaABC | SchemaMeta | dict[str, Field | type[Field]]
528
+ ]
529
+ ),
546
530
  *,
547
531
  dump_default: typing.Any = missing_,
548
532
  default: typing.Any = missing_,
@@ -744,10 +728,6 @@ class List(Field):
744
728
  :param cls_or_instance: A field class or instance.
745
729
  :param kwargs: The same keyword arguments that :class:`Field` receives.
746
730
 
747
- .. versionchanged:: 2.0.0
748
- The ``allow_none`` parameter now applies to deserialization and
749
- has the same semantics as the other fields.
750
-
751
731
  .. versionchanged:: 3.0.0rc9
752
732
  Does not serialize scalar values to single-item lists.
753
733
  """
@@ -1459,9 +1439,6 @@ class TimeDelta(Field):
1459
1439
  will always be truncated to microseconds.
1460
1440
  For example, `1.12345` interpreted as microseconds will result in `timedelta(microseconds=1)`.
1461
1441
 
1462
- .. versionchanged:: 2.0.0
1463
- Always serializes to an integer value to avoid rounding errors.
1464
- Add `precision` parameter.
1465
1442
  .. versionchanged:: 3.17.0
1466
1443
  Allow (de)serialization to `float` through use of a new `serialization_type` parameter.
1467
1444
  `int` is the default to retain previous behaviour.
@@ -1944,9 +1921,6 @@ class Method(Field):
1944
1921
  a value The method must take a single argument ``value``, which is the
1945
1922
  value to deserialize.
1946
1923
 
1947
- .. versionchanged:: 2.0.0
1948
- Removed optional ``context`` parameter on methods. Use ``self.context`` instead.
1949
-
1950
1924
  .. versionchanged:: 2.3.0
1951
1925
  Deprecated ``method_name`` parameter in favor of ``serialize`` and allow
1952
1926
  ``serialize`` to not be passed at all.
@@ -2024,14 +1998,14 @@ class Function(Field):
2024
1998
  def __init__(
2025
1999
  self,
2026
2000
  serialize: (
2027
- None
2028
- | typing.Callable[[typing.Any], typing.Any]
2001
+ typing.Callable[[typing.Any], typing.Any]
2029
2002
  | typing.Callable[[typing.Any, dict], typing.Any]
2003
+ | None
2030
2004
  ) = None,
2031
2005
  deserialize: (
2032
- None
2033
- | typing.Callable[[typing.Any], typing.Any]
2006
+ typing.Callable[[typing.Any], typing.Any]
2034
2007
  | typing.Callable[[typing.Any, dict], typing.Any]
2008
+ | None
2035
2009
  ) = None,
2036
2010
  **kwargs,
2037
2011
  ):
@@ -2065,8 +2039,6 @@ class Constant(Field):
2065
2039
  ``dump_only=True`` or ``load_only=True`` respectively.
2066
2040
 
2067
2041
  :param constant: The constant to return for the field attribute.
2068
-
2069
- .. versionadded:: 2.0.0
2070
2042
  """
2071
2043
 
2072
2044
  _CHECK_ATTRIBUTE = False
@@ -280,13 +280,6 @@ class Schema(base.SchemaABC, metaclass=SchemaMeta):
280
280
 
281
281
  .. versionchanged:: 3.0.0
282
282
  `prefix` parameter removed.
283
-
284
- .. versionchanged:: 2.0.0
285
- `__validators__`, `__preprocessors__`, and `__data_handlers__` are removed in favor of
286
- `marshmallow.decorators.validates_schema`,
287
- `marshmallow.decorators.pre_load` and `marshmallow.decorators.post_dump`.
288
- `__accessor__` and `__error_handler__` are deprecated. Implement the
289
- `handle_error` and `get_attribute` methods instead.
290
283
  """
291
284
 
292
285
  TYPE_MAPPING = {
@@ -422,7 +415,7 @@ class Schema(base.SchemaABC, metaclass=SchemaMeta):
422
415
  @classmethod
423
416
  def from_dict(
424
417
  cls,
425
- fields: dict[str, ma_fields.Field | type[ma_fields.Field]],
418
+ fields: dict[str, ma_fields.Field],
426
419
  *,
427
420
  name: str = "GeneratedSchema",
428
421
  ) -> type[Schema]:
@@ -444,11 +437,10 @@ class Schema(base.SchemaABC, metaclass=SchemaMeta):
444
437
 
445
438
  .. versionadded:: 3.0.0
446
439
  """
447
- attrs = fields.copy()
448
- attrs["Meta"] = type(
440
+ Meta = type(
449
441
  "GeneratedMeta", (getattr(cls, "Meta", object),), {"register": False}
450
442
  )
451
- schema_cls = type(name, (cls,), attrs)
443
+ schema_cls = type(name, (cls,), {**fields.copy(), "Meta": Meta})
452
444
  return schema_cls
453
445
 
454
446
  ##### Override-able methods #####
@@ -463,8 +455,6 @@ class Schema(base.SchemaABC, metaclass=SchemaMeta):
463
455
  :param many: Value of ``many`` on dump or load.
464
456
  :param partial: Value of ``partial`` on load.
465
457
 
466
- .. versionadded:: 2.0.0
467
-
468
458
  .. versionchanged:: 3.0.0rc9
469
459
  Receives `many` and `partial` (on deserialization) as keyword arguments.
470
460
  """
@@ -473,8 +463,6 @@ class Schema(base.SchemaABC, metaclass=SchemaMeta):
473
463
  def get_attribute(self, obj: typing.Any, attr: str, default: typing.Any):
474
464
  """Defines how to pull values from an object to serialize.
475
465
 
476
- .. versionadded:: 2.0.0
477
-
478
466
  .. versionchanged:: 3.0.0a1
479
467
  Changed position of ``obj`` and ``attr``.
480
468
  """
@@ -508,9 +496,6 @@ class Schema(base.SchemaABC, metaclass=SchemaMeta):
508
496
  :param obj: The object(s) to serialize.
509
497
  :param bool many: `True` if ``data`` should be serialized as a collection.
510
498
  :return: A dictionary of the serialized data
511
-
512
- .. versionchanged:: 1.0.0
513
- Renamed from ``marshal``.
514
499
  """
515
500
  if many and obj is not None:
516
501
  return [self._serialize(d, many=False) for d in obj]
@@ -138,7 +138,7 @@ def get_fixed_timezone(offset: int | float | dt.timedelta) -> dt.timezone:
138
138
  if isinstance(offset, dt.timedelta):
139
139
  offset = offset.total_seconds() // 60
140
140
  sign = "-" if offset < 0 else "+"
141
- hhmm = "%02d%02d" % divmod(abs(offset), 60)
141
+ hhmm = "{:02d}{:02d}".format(*divmod(abs(offset), 60))
142
142
  name = sign + hhmm
143
143
  return dt.timezone(dt.timedelta(minutes=offset), name)
144
144
 
@@ -1,15 +0,0 @@
1
- /* Override alabaster's admonition styling, which we used for sponsored messages */
2
-
3
- div.admonition-sponsor-message p.admonition-title {
4
- font-size: 18px;
5
- font-style: normal;
6
- }
7
-
8
- p.admonition-title::after {
9
- content: "";
10
- }
11
-
12
- div.admonition-sponsor-message p {
13
- font-size: 14px;
14
- font-style: italic;
15
- }
@@ -1,42 +0,0 @@
1
- #version-warning-banner {
2
- margin: 10px 0;
3
- padding: 10px;
4
- border-radius: 4px;
5
-
6
- letter-spacing: 1px;
7
- color: #fff;
8
- text-shadow: 0 0 2px #000;
9
- text-align: center;
10
- font-size: 0.9em;
11
-
12
- background: #004b6b
13
- repeating-linear-gradient(
14
- 135deg,
15
- transparent,
16
- transparent 20px,
17
- rgba(255, 255, 255, 0.1) 20px,
18
- rgba(255, 255, 255, 0.1) 40px
19
- );
20
- }
21
-
22
- #version-warning-banner .admonition-title {
23
- font-size: inherit;
24
- font-weight: bold;
25
- }
26
-
27
- #version-warning-banner p.admonition-title::after {
28
- content: none;
29
- }
30
-
31
- #version-warning-banner a {
32
- color: #fff;
33
- border-color: #fff;
34
- }
35
-
36
- #version-warning-banner p {
37
- display: inline;
38
- }
39
-
40
- div.warning {
41
- border: 0;
42
- }
@@ -1,9 +0,0 @@
1
- .. _api_fields:
2
-
3
- Fields
4
- ======
5
-
6
- .. automodule:: marshmallow.fields
7
- :members:
8
- :private-members:
9
- :autosummary:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes