Skip to content

Commit

Permalink
Merge pull request #786 from davidhassell/main
Browse files Browse the repository at this point in the history
Update linting package versions for Python 3.12
  • Loading branch information
davidhassell authored Jun 17, 2024
2 parents e233717 + 23a389f commit 11e3aba
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions cf/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
4 changes: 1 addition & 3 deletions cf/test/test_Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
20 changes: 10 additions & 10 deletions cf/test/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions cf/weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 11e3aba

Please sign in to comment.