From acee922f84c6a22bc38a3dba2a301a2c70164526 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 18:45:07 +0000 Subject: [PATCH] chore: update pre-commit hooks (#546) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update pre-commit hooks updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.6...v0.9.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- cf_units/__init__.py | 6 ++---- cf_units/tests/test_coding_standards.py | 6 +++--- cf_units/util.py | 3 +-- setup.py | 3 +-- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 34f13de9..2b67369e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -72,7 +72,7 @@ repos: types: [file, python] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.8.6" + rev: "v0.9.1" hooks: # Run the linter - id: ruff diff --git a/cf_units/__init__.py b/cf_units/__init__.py index 7441050e..4cf0b4a9 100644 --- a/cf_units/__init__.py +++ b/cf_units/__init__.py @@ -1768,8 +1768,7 @@ def convert(self, value, other, ctype=FLOAT64, inplace=False): # Strict type check of numpy array. if result.dtype.type not in (np.float32, np.float64): raise TypeError( - "Expect a numpy array of " - f"'{np.float32}' or '{np.float64}'" + f"Expect a numpy array of '{np.float32}' or '{np.float64}'" ) ctype = result.dtype.type # Utilise global convenience dictionary @@ -1788,8 +1787,7 @@ def convert(self, value, other, ctype=FLOAT64, inplace=False): else: if ctype not in _cv_convert_scalar: raise ValueError( - "Invalid target type. Can only " - "convert to float or double." + "Invalid target type. Can only convert to float or double." ) # Utilise global convenience dictionary # _cv_convert_scalar diff --git a/cf_units/tests/test_coding_standards.py b/cf_units/tests/test_coding_standards.py index 33d0c1b0..bde08a77 100644 --- a/cf_units/tests/test_coding_standards.py +++ b/cf_units/tests/test_coding_standards.py @@ -155,18 +155,18 @@ def test_python_versions(): ci_tests_file, ( f"os: [ubuntu-latest]\n" - f"{8*' '}version: [" + f"{8 * ' '}version: [" + ", ".join([f"py{p}" for p in supported_strip]) + "]" ), ), ( ci_tests_file, - (f"os: ubuntu-latest\n{12*' '}version: py{supported_latest}"), + (f"os: ubuntu-latest\n{12 * ' '}version: py{supported_latest}"), ), ( ci_tests_file, - (f"os: macos-latest\n{12*' '}version: py{supported_latest}"), + (f"os: macos-latest\n{12 * ' '}version: py{supported_latest}"), ), ] diff --git a/cf_units/util.py b/cf_units/util.py index 804fc32b..05dfefed 100644 --- a/cf_units/util.py +++ b/cf_units/util.py @@ -59,8 +59,7 @@ def __new__(cls, name, bases, namespace): if "__init__" not in namespace: # Create a default __init__ method for the class method_source = ( - f"def __init__(self, {args}):\n " - f"self._init_from_tuple(({args},))" + f"def __init__(self, {args}):\n self._init_from_tuple(({args},))" ) exec(method_source, namespace) diff --git a/setup.py b/setup.py index 465a83b4..5feda6bf 100644 --- a/setup.py +++ b/setup.py @@ -70,8 +70,7 @@ def get_package_data(): xml_database = Path(xml_database) if not xml_database.is_file(): emsg = ( - f"Can't open {xml_env} file {xml_database} " - "during cf-units wheel build." + f"Can't open {xml_env} file {xml_database} during cf-units wheel build." ) raise ValueError(emsg) # We have a valid XML file, so copy the distro bundle into the