From 70a20d0d363187dee1900d8bb3a246b7a678f98d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 17:18:27 +0000 Subject: [PATCH 1/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- compliance_checker/cf/util.py | 26 ++++++++++++-------------- compliance_checker/runner.py | 6 ++++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/compliance_checker/cf/util.py b/compliance_checker/cf/util.py index 9b7ba325..93fbb101 100644 --- a/compliance_checker/cf/util.py +++ b/compliance_checker/cf/util.py @@ -1,18 +1,16 @@ import itertools import os +import posixpath import sys +from functools import lru_cache from importlib.resources import files from pkgutil import get_data +from typing import Tuple, Union -from functools import lru_cache import requests from cf_units import Unit from lxml import etree -from netCDF4 import Variable, Dimension, Dataset, Group - -import posixpath - -from typing import Tuple, Union +from netCDF4 import Dataset, Dimension, Group, Variable from compliance_checker.cfutil import units_convertible @@ -420,13 +418,13 @@ def get_possible_label_variable_dimensions(variable: Variable) -> Tuple[int, ... return variable.dimensions -@lru_cache() -def maybe_lateral_reference_variable_or_dimension(group: Union[Group, Dataset], - name: str, - reference_type: Union[Variable, Dimension]): +@lru_cache +def maybe_lateral_reference_variable_or_dimension( + group: Union[Group, Dataset], name: str, reference_type: Union[Variable, Dimension], +): def can_lateral_search(name): - return (not name.startswith(".") and posixpath.split(name)[0] == "") + return not name.startswith(".") and posixpath.split(name)[0] == "" if reference_type == "variable": # first try to fetch any @@ -441,8 +439,9 @@ def can_lateral_search(name): # alphanumeric string by itself, not a relative or absolute # search by proximity - if (posixpath.split(name)[0] == "" and - not (name.startswith(".") or name.startswith("/"))): + if posixpath.split(name)[0] == "" and not ( + name.startswith(".") or name.startswith("/") + ): group_traverse = group while group_traverse.parent: group_traverse = group_traverse.parent @@ -461,7 +460,6 @@ def can_lateral_search(name): # perform lateral search if we aren't in the root group - def reference_attr_variables( dataset: Dataset, attributes_string: str, diff --git a/compliance_checker/runner.py b/compliance_checker/runner.py index ffbdeaa1..957ce578 100644 --- a/compliance_checker/runner.py +++ b/compliance_checker/runner.py @@ -150,10 +150,12 @@ def stdout_output(cls, cs, score_dict, verbose, limit): for ds, score_groups in score_dict.items(): for checker, (groups, errors) in score_groups.items(): score_list, points, out_of = cs.standard_output( - ds, limit, checker, groups) + ds, limit, checker, groups, + ) # send list of grouped result objects to stdout & reasoning_routine cs.standard_output_generation( - groups, limit, points, out_of, check=checker) + groups, limit, points, out_of, check=checker, + ) return groups @classmethod From 3694eeb4aa30e26a363755ead011e13809770609 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 17:28:43 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- compliance_checker/cf/util.py | 4 +++- compliance_checker/runner.py | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/compliance_checker/cf/util.py b/compliance_checker/cf/util.py index 93fbb101..b498a8ca 100644 --- a/compliance_checker/cf/util.py +++ b/compliance_checker/cf/util.py @@ -420,7 +420,9 @@ def get_possible_label_variable_dimensions(variable: Variable) -> Tuple[int, ... @lru_cache def maybe_lateral_reference_variable_or_dimension( - group: Union[Group, Dataset], name: str, reference_type: Union[Variable, Dimension], + group: Union[Group, Dataset], + name: str, + reference_type: Union[Variable, Dimension], ): def can_lateral_search(name): diff --git a/compliance_checker/runner.py b/compliance_checker/runner.py index 957ce578..da00d383 100644 --- a/compliance_checker/runner.py +++ b/compliance_checker/runner.py @@ -150,11 +150,18 @@ def stdout_output(cls, cs, score_dict, verbose, limit): for ds, score_groups in score_dict.items(): for checker, (groups, errors) in score_groups.items(): score_list, points, out_of = cs.standard_output( - ds, limit, checker, groups, + ds, + limit, + checker, + groups, ) # send list of grouped result objects to stdout & reasoning_routine cs.standard_output_generation( - groups, limit, points, out_of, check=checker, + groups, + limit, + points, + out_of, + check=checker, ) return groups