From 23a389fd6e5bbe7add4b805716019475f96ac464 Mon Sep 17 00:00:00 2001 From: David Hassell Date: Mon, 17 Jun 2024 10:32:00 +0100 Subject: [PATCH] update linting package versions for Python 3.12 --- .pre-commit-config.yaml | 8 ++++---- cf/field.py | 6 +++--- cf/test/test_Data.py | 4 +--- cf/test/test_functions.py | 20 ++++++++++---------- cf/weights.py | 6 +++--- 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ea21c5d13c..3aa8dd0405 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: # Use specific format-enforcing pre-commit hooks from the core library # with the default configuration (see pre-commit.com for documentation) - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.6.0 hooks: - id: check-ast - id: debug-statements @@ -23,7 +23,7 @@ repos: # (see https://black.readthedocs.io/en/stable/ for documentation and see # the cf-python pyproject.toml file for our custom black configuration) - repo: https://github.com/ambv/black - rev: 23.1.0 + rev: 24.4.2 hooks: - id: black language_version: python3 @@ -53,7 +53,7 @@ repos: # (see https://flake8.pycqa.org/en/latest/ for documentation and see # the cf-python .flake8 file for our custom flake8 configuration) - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + rev: 7.1.0 hooks: - id: flake8 @@ -62,7 +62,7 @@ repos: # compatible with 'black' with the lines set to ensure so in the repo's # pyproject.toml. Other than that and the below, no extra config is required. - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort name: isort (python) diff --git a/cf/field.py b/cf/field.py index 61132fb6b3..9220a9c0c2 100644 --- a/cf/field.py +++ b/cf/field.py @@ -10479,9 +10479,9 @@ def convolution_filter( new_bounds[0 : length - lower_offset, 1:] = old_bounds[ lower_offset:length, 1: ] - new_bounds[ - length - lower_offset : length, 1: - ] = old_bounds[length - 1, 1:] + new_bounds[length - lower_offset : length, 1:] = ( + old_bounds[length - 1, 1:] + ) coord.set_bounds(self._Bounds(data=new_bounds)) diff --git a/cf/test/test_Data.py b/cf/test/test_Data.py index c94e60f563..fd61d0e9af 100644 --- a/cf/test/test_Data.py +++ b/cf/test/test_Data.py @@ -2389,9 +2389,7 @@ def test_Data_BINARY_AND_UNARY_OPERATORS(self): except Exception: pass else: - self.assertTrue( - (x**d).all(), "{}**{}".format(x, repr(d)) - ) + self.assertTrue((x**d).all(), "{}**{}".format(x, repr(d))) self.assertTrue( d.__truediv__(x).equals( diff --git a/cf/test/test_functions.py b/cf/test/test_functions.py index 370d0a9036..9cc5e5eab1 100644 --- a/cf/test/test_functions.py +++ b/cf/test/test_functions.py @@ -389,24 +389,24 @@ def test_normalize_slice(self): cf.normalize_slice(slice(2, 5, -2), 8, cyclic=True), slice(2, -3, -2), ) - + self.assertEqual( cf.normalize_slice(slice(-8, 0, 1), 8, cyclic=True), - slice(-8, 0, 1) - ) + slice(-8, 0, 1), + ) self.assertEqual( cf.normalize_slice(slice(0, 7, -1), 8, cyclic=True), - slice(0, -1, -1) - ) + slice(0, -1, -1), + ) self.assertEqual( cf.normalize_slice(slice(-1, -8, 1), 8, cyclic=True), - slice(-1, 0, 1) - ) + slice(-1, 0, 1), + ) self.assertEqual( cf.normalize_slice(slice(-8, -1, -1), 8, cyclic=True), - slice(0, -1, -1) - ) - + slice(0, -1, -1), + ) + with self.assertRaises(IndexError): cf.normalize_slice([1, 2], 8) diff --git a/cf/weights.py b/cf/weights.py index 63025febb7..24a63aa8f7 100644 --- a/cf/weights.py +++ b/cf/weights.py @@ -1461,9 +1461,9 @@ def linear( else: # Bounds exist if methods: - weights[ - (da_key,) - ] = f"linear {f.constructs.domain_axis_identity(da_key)}" + weights[(da_key,)] = ( + f"linear {f.constructs.domain_axis_identity(da_key)}" + ) else: weights[(da_key,)] = dim.cellsize