From 084999196f3085dcaae715cfacb0bb0b2572ed6e Mon Sep 17 00:00:00 2001 From: Paul Madden Date: Thu, 17 Jul 2025 16:34:35 +0000 Subject: [PATCH] Update code-quality tools and tweak code in response --- recipe/meta.json | 12 ++++++------ recipe/meta.yaml | 12 ++++++------ src/uwtools/config/support.py | 3 +++ src/uwtools/tests/config/test_support.py | 6 ++++++ src/uwtools/utils/tasks.py | 2 +- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/recipe/meta.json b/recipe/meta.json index f24d61620..fd63bb473 100644 --- a/recipe/meta.json +++ b/recipe/meta.json @@ -8,20 +8,20 @@ "f90nml >=1.4,<1.5", "iotaa >=1.3,<2", "jinja2 >=3.1,<3.2", - "jq ==1.7.*", + "jq ==1.8.*", "jsonschema >=4.18,<4.24", "lxml >=5.2,<5.5", "make ==4.4.*", - "mypy ==1.15.*", + "mypy ==1.17.*", "pip", - "pytest ==8.3.*", - "pytest-cov ==6.1.*", - "pytest-xdist ==3.6.*", + "pytest ==8.4.*", + "pytest-cov ==6.2.*", + "pytest-xdist ==3.8.*", "python <3.14,==3.9,>=3.9", "python-dateutil >=2.9,<2.10", "pyyaml >=6.0,<6.1", "requests >=2.32,<2.33", - "ruff ==0.11.*", + "ruff ==0.12.*", "setuptools" ], "run": [ diff --git a/recipe/meta.yaml b/recipe/meta.yaml index e9e5dd83d..7d98cab9b 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -28,13 +28,13 @@ requirements: test: requires: - docformatter 1.7.* - - jq 1.7.* + - jq 1.8.* - make 4.4.* - - mypy 1.15.* - - pytest 8.3.* - - pytest-cov 6.1.* - - pytest-xdist 3.6.* + - mypy 1.17.* + - pytest 8.4.* + - pytest-cov 6.2.* + - pytest-xdist 3.8.* - python {{ pymin }} - - ruff 0.11.* + - ruff 0.12.* about: license: LGPL diff --git a/src/uwtools/config/support.py b/src/uwtools/config/support.py index ad031a624..ed8ccc7b5 100644 --- a/src/uwtools/config/support.py +++ b/src/uwtools/config/support.py @@ -107,6 +107,9 @@ def __eq__(self, other: object) -> bool: return NotImplemented return self.tag == other.tag and self.value == other.value + def __hash__(self): + return hash(str(self)) + def __repr__(self) -> str: return ("%s %s" % (self.tag, self.value)).strip() diff --git a/src/uwtools/tests/config/test_support.py b/src/uwtools/tests/config/test_support.py index ae95b4856..db04313e2 100644 --- a/src/uwtools/tests/config/test_support.py +++ b/src/uwtools/tests/config/test_support.py @@ -60,6 +60,12 @@ def test_config_support_UWYAMLTag__eq(): assert tag0 == tag1 +def test_config_support_UWYAMLTag__hash(): + node = yaml.nodes.Node(tag="!foo", value="bar", start_mark=None, end_mark=None) + tag = support.UWYAMLTag(yaml.SafeLoader("data"), node=node) + assert hash(tag) == hash("!foo bar") + + class TestUWYAMLConvert: """ Tests for class uwtools.config.support.UWYAMLConvert. diff --git a/src/uwtools/utils/tasks.py b/src/uwtools/utils/tasks.py index faceee8e0..4be69edb9 100644 --- a/src/uwtools/utils/tasks.py +++ b/src/uwtools/utils/tasks.py @@ -121,7 +121,7 @@ def filecopy(src: Path | str, dst: Path | str, check: bool = True) -> Node: return filecopy_http(str(src), dst, check) if src_scheme in SCHEMES.local: return filecopy_local(_local_path(src), dst, check) - _bad_scheme(src, src_scheme) # noqa: RET503 + return _bad_scheme(src, src_scheme) @task