From cd0cb837129a781ed854a55a590e668f60953625 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 21:48:05 +0000 Subject: [PATCH 1/2] Build(deps): Bump the required group with 6 updates Bumps the required group with 6 updates: | Package | From | To | | --- | --- | --- | | [pydoclint](https://github.com/jsh9/pydoclint) | `0.5.14` | `0.6.0` | | [mkdocs-material](https://github.com/squidfunk/mkdocs-material) | `9.5.49` | `9.6.1` | | [pylint](https://github.com/pylint-dev/pylint) | `3.3.3` | `3.3.4` | | [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) | `0.25.1` | `0.25.3` | | [hypothesis](https://github.com/HypothesisWorks/hypothesis) | `6.123.2` | `6.124.9` | | [setuptools](https://github.com/pypa/setuptools) | `75.6.0` | `75.8.0` | Updates `pydoclint` from 0.5.14 to 0.6.0 - [Release notes](https://github.com/jsh9/pydoclint/releases) - [Changelog](https://github.com/jsh9/pydoclint/blob/main/CHANGELOG.md) - [Commits](https://github.com/jsh9/pydoclint/compare/0.5.14...0.6.0) Updates `mkdocs-material` from 9.5.49 to 9.6.1 - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.5.49...9.6.1) Updates `pylint` from 3.3.3 to 3.3.4 - [Release notes](https://github.com/pylint-dev/pylint/releases) - [Commits](https://github.com/pylint-dev/pylint/compare/v3.3.3...v3.3.4) Updates `pytest-asyncio` from 0.25.1 to 0.25.3 - [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) - [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.25.1...v0.25.3) Updates `hypothesis` from 6.123.2 to 6.124.9 - [Release notes](https://github.com/HypothesisWorks/hypothesis/releases) - [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.123.2...hypothesis-python-6.124.9) Updates `setuptools` from 75.6.0 to 75.8.0 - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/v75.6.0...v75.8.0) --- updated-dependencies: - dependency-name: pydoclint dependency-type: direct:production update-type: version-update:semver-minor dependency-group: required - dependency-name: mkdocs-material dependency-type: direct:production update-type: version-update:semver-minor dependency-group: required - dependency-name: pylint dependency-type: direct:production update-type: version-update:semver-patch dependency-group: required - dependency-name: pytest-asyncio dependency-type: direct:production update-type: version-update:semver-patch dependency-group: required - dependency-name: hypothesis dependency-type: direct:production update-type: version-update:semver-minor dependency-group: required - dependency-name: setuptools dependency-type: direct:production update-type: version-update:semver-minor dependency-group: required ... Signed-off-by: dependabot[bot] --- pyproject.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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]", ] From 18879af222f987efb92b97ee5a2c48de238c64de Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Mon, 3 Feb 2025 09:43:27 +0100 Subject: [PATCH 2/2] Make sure the context exists before trying to access it Signed-off-by: Leandro Lucarella --- src/frequenz/quantities/experimental/marshmallow.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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)