diff --git a/pyproject.toml b/pyproject.toml index 1b2ee4a..fff593d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ [build-system] requires = [ - "setuptools == 75.6.0", + "setuptools == 75.8.0", "setuptools_scm[toml] == 8.1.0", "frequenz-repo-config[lib] == 0.11.0", ] @@ -45,7 +45,7 @@ dev-flake8 = [ "flake8 == 7.1.1", "flake8-docstrings == 1.7.0", "flake8-pyproject == 1.2.3", # For reading the flake8 config from pyproject.toml - "pydoclint == 0.5.14", + "pydoclint == 0.6.0", "pydocstyle == 6.3.0", ] dev-formatting = ["black == 24.10.0", "isort == 5.13.2"] @@ -56,7 +56,7 @@ dev-mkdocs = [ "mkdocs-gen-files == 0.5.0", "mkdocs-literate-nav == 0.6.1", "mkdocs-macros-plugin == 1.3.7", - "mkdocs-material == 9.5.49", + "mkdocs-material == 9.6.1", "mkdocstrings[python] == 0.27.0", "mkdocstrings-python == 1.13.0", "frequenz-repo-config[lib] == 0.11.0", @@ -75,12 +75,12 @@ dev-pylint = [ ] dev-pytest = [ "pytest == 8.3.4", - "pylint == 3.3.3", # We need this to check for the examples + "pylint == 3.3.4", # We need this to check for the examples "frequenz-repo-config[extra-lint-examples] == 0.11.0", "pytest-mock == 3.14.0", - "pytest-asyncio == 0.25.1", + "pytest-asyncio == 0.25.3", "async-solipsism == 0.7", - "hypothesis == 6.123.2", + "hypothesis == 6.124.9", "frequenz-quantities[marshmallow]", ] diff --git a/src/frequenz/quantities/experimental/marshmallow.py b/src/frequenz/quantities/experimental/marshmallow.py index ed0dc74..483bbdf 100644 --- a/src/frequenz/quantities/experimental/marshmallow.py +++ b/src/frequenz/quantities/experimental/marshmallow.py @@ -69,10 +69,12 @@ def _serialize( assert self.parent is not None # Determine the serialization format - serialize_as_string = self.metadata.get( - "serialize_as_string", - self.parent.context.get("serialize_as_string_default", False), + default = ( + False + if self.parent.context is None + else self.parent.context.get("serialize_as_string_default", False) ) + serialize_as_string = self.metadata.get("serialize_as_string", default) if serialize_as_string: # Use the Quantity's native string representation (includes unit)