Skip to content

Commit

Permalink
Merge pull request #1038 from ocefpaf/fix_pre-commits
Browse files Browse the repository at this point in the history
Fix pre commits
  • Loading branch information
ocefpaf authored Sep 5, 2023
2 parents 5e19fbb + e7f8647 commit 63c6a9e
Show file tree
Hide file tree
Showing 17 changed files with 474 additions and 450 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@ repos:
- test_requirements.txt

- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black
language_version: python3

- repo: https://github.com/asottile/add-trailing-comma
rev: v3.0.0
rev: v3.1.0
hooks:
- id: add-trailing-comma


- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.277
rev: v0.0.287
hooks:
- id: ruff

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 0.13.0
rev: 1.1.0
hooks:
- id: pyproject-fmt

Expand Down
12 changes: 4 additions & 8 deletions cchecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ def main():
for checker_name in sorted(checker_names):
if checker_name not in check_suite.checkers:
print(
"Cannot find checker '{}' with which to "
"describe checks".format(checker_name),
f"Cannot find checker '{checker_name}' with which to "
"describe checks",
file=sys.stderr,
)
error_stat = 1
Expand Down Expand Up @@ -293,9 +293,7 @@ def main():
if output_len == 1:
if args.format != "json":
print(
"Running Compliance Checker on the datasets from: {}".format(
args.dataset_location,
),
f"Running Compliance Checker on the datasets from: {args.dataset_location}",
file=sys.stderr,
)
return_value, errors = ComplianceChecker.run_checker(
Expand All @@ -315,9 +313,7 @@ def main():
for output, dataset in zip(args.output, args.dataset_location):
if args.format != "json":
print(
"Running Compliance Checker on the dataset from: {}".format(
dataset,
),
f"Running Compliance Checker on the dataset from: {dataset}",
file=sys.stderr,
)
return_value, errors = ComplianceChecker.run_checker(
Expand Down
24 changes: 8 additions & 16 deletions compliance_checker/acdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ def check_lat_extents(self, ds):
False,
"geospatial_lat_extents_match",
[
"Could not convert one of geospatial_lat_min ({}) or max ({}) to float see CF-1.6 spec chapter 4.1"
"".format(ds.geospatial_lat_min, ds.geospatial_lat_max),
f"Could not convert one of geospatial_lat_min ({ds.geospatial_lat_min}) or max ({ds.geospatial_lat_max}) to float see CF-1.6 spec chapter 4.1"
"",
],
)

Expand Down Expand Up @@ -347,8 +347,8 @@ def check_lon_extents(self, ds):
False,
"geospatial_lon_extents_match",
[
"Could not convert one of geospatial_lon_min ({}) or max ({}) to float see CF-1.6 spec chapter 4.1"
"".format(ds.geospatial_lon_min, ds.geospatial_lon_max),
f"Could not convert one of geospatial_lon_min ({ds.geospatial_lon_min}) or max ({ds.geospatial_lon_max}) to float see CF-1.6 spec chapter 4.1"
"",
],
)

Expand Down Expand Up @@ -440,7 +440,7 @@ def verify_geospatial_bounds(self, ds):
[
(
"Could not parse WKT from geospatial_bounds,"
' possible bad value: "{}"'.format(ds.geospatial_bounds)
f' possible bad value: "{ds.geospatial_bounds}"'
),
],
variable_name="geospatial_bounds",
Expand Down Expand Up @@ -637,19 +637,13 @@ def check_time_extents(self, ds):
if start_dt > timedelta(hours=1):
msgs.append(
"Date time mismatch between time_coverage_start and actual "
"time values {} (time_coverage_start) != {} (time[0])".format(
t_min.isoformat(),
time0.isoformat(),
),
f"time values {t_min.isoformat()} (time_coverage_start) != {time0.isoformat()} (time[0])",
)
score -= 1
if end_dt > timedelta(hours=1):
msgs.append(
"Date time mismatch between time_coverage_end and actual "
"time values {} (time_coverage_end) != {} (time[N])".format(
t_max.isoformat(),
time1.isoformat(),
),
f"time values {t_max.isoformat()} (time_coverage_end) != {time1.isoformat()} (time[N])",
)
score -= 1

Expand All @@ -676,9 +670,7 @@ def verify_convention_version(self, ds):
return ratable_result((1, 2), "Global Attributes", m)
except AttributeError: # NetCDF attribute not found
m = [
"No Conventions attribute present; must contain ACDD-{}".format(
self._cc_spec_version,
),
f"No Conventions attribute present; must contain ACDD-{self._cc_spec_version}",
]
# Result will have name "Global Attributes" to group with globals
return ratable_result((0, 2), "Global Attributes", m)
Expand Down
5 changes: 1 addition & 4 deletions compliance_checker/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,7 @@ def attr_check(kvp, ds, priority, ret_val, gname=None, var_name=None):
msgs.append(f"{display_name} not present")
elif res == 1:
msgs.append(
"{} present, but not in expected value list ({})".format(
display_name,
sorted(other),
),
f"{display_name} present, but not in expected value list ({sorted(other)})",
)

ret_val.append(
Expand Down
Loading

0 comments on commit 63c6a9e

Please sign in to comment.