diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index ee836239..c32a9fb4 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -37,6 +37,6 @@ jobs: continue-on-error: true - name: Upload to codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: files: coverage.xml diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index d8904e80..e134f7c0 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -25,7 +25,7 @@ jobs: run: git fetch origin 'refs/tags/*:refs/tags/*' - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.11" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 15d03562..04b4269c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: - test_requirements.txt - repo: https://github.com/psf/black - rev: 23.10.0 + rev: 24.1.1 hooks: - id: black language_version: python3 @@ -29,13 +29,13 @@ repos: hooks: - id: add-trailing-comma -- repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.1.0 +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.2.0 hooks: - id: ruff - repo: https://github.com/tox-dev/pyproject-fmt - rev: 1.2.0 + rev: 1.7.0 hooks: - id: pyproject-fmt diff --git a/compliance_checker/ioos.py b/compliance_checker/ioos.py index 733b9e91..2deed991 100644 --- a/compliance_checker/ioos.py +++ b/compliance_checker/ioos.py @@ -1,6 +1,7 @@ """ Check for IOOS-approved attributes """ + import re from numbers import Number @@ -1543,12 +1544,14 @@ def check_gts_ingest_requirements(self, ds): BaseCheck.HIGH, False, # always fail "NDBC/GTS Ingest Requirements", - [var_passed_ingest_msg.format(", ".join(_var_passed))] - if all_passed_ingest_reqs - else [ - var_passed_ingest_msg.format(", ".join(_var_passed)), - var_failed_ingest_msg.format(", ".join(_var_failed)), - ], + ( + [var_passed_ingest_msg.format(", ".join(_var_passed))] + if all_passed_ingest_reqs + else [ + var_passed_ingest_msg.format(", ".join(_var_passed)), + var_failed_ingest_msg.format(", ".join(_var_failed)), + ] + ), ) def check_instrument_variables(self, ds): @@ -1764,9 +1767,11 @@ def check_instrument_make_model_calib_date(self, ds): BaseCheck.MEDIUM, valid, "instrument_variable:make_model", - None - if valid - else [f"Attribute {v}:make_model ({mm}) should be a string"], + ( + None + if valid + else [f"Attribute {v}:make_model ({mm}) should be a string"] + ), ), ) @@ -1784,11 +1789,13 @@ def check_instrument_make_model_calib_date(self, ds): BaseCheck.MEDIUM, valid, "instrument_variable:calibration_date", - None - if valid - else [ - f"Attribute {v}:calibration_date ({cd}) should be an ISO-8601 string", - ], + ( + None + if valid + else [ + f"Attribute {v}:calibration_date ({cd}) should be an ISO-8601 string", + ] + ), ), ) diff --git a/compliance_checker/tests/test_cf.py b/compliance_checker/tests/test_cf.py index 367ffc6d..360683be 100644 --- a/compliance_checker/tests/test_cf.py +++ b/compliance_checker/tests/test_cf.py @@ -1300,9 +1300,7 @@ def test_check_time_coordinate(self): # NB: >= 60 seconds is nonstandard, but isn't actually a CF requirement # until CF 1.9 onwards dataset.variables["time"].units = "months since 0-1-1 23:00:60" - dataset.variables[ - "time" - ].climatology = ( + dataset.variables["time"].climatology = ( "nonexistent_variable_reference_only_used_to_test_year_zero_failure" ) results = self.cf.check_time_coordinate(dataset) @@ -2952,9 +2950,9 @@ def test_bad_lsid(self): messages = results[0].msgs assert results[0].value[0] < results[0].value[1] assert len(messages) == 1 - taxon_lsid[ - 0 - ] = "http://www.lsid.info/urn:lsid:marinespecies.org:taxname:99999999999" + taxon_lsid[0] = ( + "http://www.lsid.info/urn:lsid:marinespecies.org:taxname:99999999999" + ) results = self.cf.check_taxa(dataset) assert messages[0].startswith( "Taxon id must match one of the following forms:", diff --git a/compliance_checker/util.py b/compliance_checker/util.py index 8117ad3e..6b03e98b 100644 --- a/compliance_checker/util.py +++ b/compliance_checker/util.py @@ -1,6 +1,7 @@ """ General purpose utility functions to aid in compliance checking tasks """ + from collections import OrderedDict import isodate