From 0b026903e794c05ab4474f1835a31f6adae7d973 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 19:17:18 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- compliance_checker/ioos.py | 35 +++++++++++++++++------------ compliance_checker/tests/test_cf.py | 10 ++++----- compliance_checker/util.py | 1 + 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/compliance_checker/ioos.py b/compliance_checker/ioos.py index 733b9e910..2deed9913 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 367ffc6d9..360683be3 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 8117ad3e7..6b03e98ba 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