Skip to content

Commit 97d3a3a

Browse files
[pre-commit.ci] pre-commit autoupdate (#8900)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 7e24150 commit 97d3a3a

File tree

6 files changed

+11
-25
lines changed

6 files changed

+11
-25
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ repos:
1313
- id: mixed-line-ending
1414
- repo: https://github.com/astral-sh/ruff-pre-commit
1515
# Ruff version.
16-
rev: 'v0.2.0'
16+
rev: 'v0.3.4'
1717
hooks:
1818
- id: ruff
1919
args: ["--fix", "--show-fixes"]
2020
# https://github.com/python/black#version-control-integration
2121
- repo: https://github.com/psf/black-pre-commit-mirror
22-
rev: 24.1.1
22+
rev: 24.3.0
2323
hooks:
2424
- id: black-jupyter
2525
- repo: https://github.com/keewis/blackdoc
2626
rev: v0.3.9
2727
hooks:
2828
- id: blackdoc
2929
exclude: "generate_aggregations.py"
30-
additional_dependencies: ["black==24.1.1"]
30+
additional_dependencies: ["black==24.3.0"]
3131
- id: blackdoc-autoupdate-black
3232
- repo: https://github.com/pre-commit/mirrors-mypy
33-
rev: v1.8.0
33+
rev: v1.9.0
3434
hooks:
3535
- id: mypy
3636
# Copied from setup.cfg

xarray/coding/times.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -446,15 +446,7 @@ def format_cftime_datetime(date) -> str:
446446
"""Converts a cftime.datetime object to a string with the format:
447447
YYYY-MM-DD HH:MM:SS.UUUUUU
448448
"""
449-
return "{:04d}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}.{:06d}".format(
450-
date.year,
451-
date.month,
452-
date.day,
453-
date.hour,
454-
date.minute,
455-
date.second,
456-
date.microsecond,
457-
)
449+
return f"{date.year:04d}-{date.month:02d}-{date.day:02d} {date.hour:02d}:{date.minute:02d}:{date.second:02d}.{date.microsecond:06d}"
458450

459451

460452
def infer_timedelta_units(deltas) -> str:

xarray/coding/variables.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ def get_duck_array(self):
8181
return self.func(self.array.get_duck_array())
8282

8383
def __repr__(self) -> str:
84-
return "{}({!r}, func={!r}, dtype={!r})".format(
85-
type(self).__name__, self.array, self.func, self.dtype
86-
)
84+
return f"{type(self).__name__}({self.array!r}, func={self.func!r}, dtype={self.dtype!r})"
8785

8886

8987
class NativeEndiannessArray(indexing.ExplicitlyIndexedNDArrayMixin):

xarray/core/arithmetic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
6262
if method != "__call__":
6363
# TODO: support other methods, e.g., reduce and accumulate.
6464
raise NotImplementedError(
65-
"{} method for ufunc {} is not implemented on xarray objects, "
65+
f"{method} method for ufunc {ufunc} is not implemented on xarray objects, "
6666
"which currently only support the __call__ method. As an "
6767
"alternative, consider explicitly converting xarray objects "
68-
"to NumPy arrays (e.g., with `.values`).".format(method, ufunc)
68+
"to NumPy arrays (e.g., with `.values`)."
6969
)
7070

7171
if any(isinstance(o, SupportsArithmetic) for o in out):

xarray/core/computation.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,7 @@ def __ne__(self, other):
133133
return not self == other
134134

135135
def __repr__(self):
136-
return "{}({!r}, {!r})".format(
137-
type(self).__name__,
138-
list(self.input_core_dims),
139-
list(self.output_core_dims),
140-
)
136+
return f"{type(self).__name__}({list(self.input_core_dims)!r}, {list(self.output_core_dims)!r})"
141137

142138
def __str__(self):
143139
lhs = ",".join("({})".format(",".join(dims)) for dims in self.input_core_dims)

xarray/core/formatting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ def inline_sparse_repr(array):
289289
"""Similar to sparse.COO.__repr__, but without the redundant shape/dtype."""
290290
sparse_array_type = array_type("sparse")
291291
assert isinstance(array, sparse_array_type), array
292-
return "<{}: nnz={:d}, fill_value={!s}>".format(
293-
type(array).__name__, array.nnz, array.fill_value
292+
return (
293+
f"<{type(array).__name__}: nnz={array.nnz:d}, fill_value={array.fill_value!s}>"
294294
)
295295

296296

0 commit comments

Comments
 (0)