Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 5, 2024
1 parent ead0a4a commit 0b02690
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
35 changes: 21 additions & 14 deletions compliance_checker/ioos.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Check for IOOS-approved attributes
"""

import re
from numbers import Number

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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"]
),
),
)

Expand All @@ -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",
]
),
),
)

Expand Down
10 changes: 4 additions & 6 deletions compliance_checker/tests/test_cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:",
Expand Down
1 change: 1 addition & 0 deletions compliance_checker/util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
General purpose utility functions to aid in compliance checking tasks
"""

from collections import OrderedDict

import isodate
Expand Down

0 comments on commit 0b02690

Please sign in to comment.