Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#8900)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Apr 1, 2024
1 parent 7e24150 commit 97d3a3a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 25 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ repos:
- id: mixed-line-ending
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.2.0'
rev: 'v0.3.4'
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
# https://github.com/python/black#version-control-integration
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.1
rev: 24.3.0
hooks:
- id: black-jupyter
- repo: https://github.com/keewis/blackdoc
rev: v0.3.9
hooks:
- id: blackdoc
exclude: "generate_aggregations.py"
additional_dependencies: ["black==24.1.1"]
additional_dependencies: ["black==24.3.0"]
- id: blackdoc-autoupdate-black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.9.0
hooks:
- id: mypy
# Copied from setup.cfg
Expand Down
10 changes: 1 addition & 9 deletions xarray/coding/times.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,15 +446,7 @@ def format_cftime_datetime(date) -> str:
"""Converts a cftime.datetime object to a string with the format:
YYYY-MM-DD HH:MM:SS.UUUUUU
"""
return "{:04d}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}.{:06d}".format(
date.year,
date.month,
date.day,
date.hour,
date.minute,
date.second,
date.microsecond,
)
return f"{date.year:04d}-{date.month:02d}-{date.day:02d} {date.hour:02d}:{date.minute:02d}:{date.second:02d}.{date.microsecond:06d}"


def infer_timedelta_units(deltas) -> str:
Expand Down
4 changes: 1 addition & 3 deletions xarray/coding/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ def get_duck_array(self):
return self.func(self.array.get_duck_array())

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


class NativeEndiannessArray(indexing.ExplicitlyIndexedNDArrayMixin):
Expand Down
4 changes: 2 additions & 2 deletions xarray/core/arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
if method != "__call__":
# TODO: support other methods, e.g., reduce and accumulate.
raise NotImplementedError(
"{} method for ufunc {} is not implemented on xarray objects, "
f"{method} method for ufunc {ufunc} is not implemented on xarray objects, "
"which currently only support the __call__ method. As an "
"alternative, consider explicitly converting xarray objects "
"to NumPy arrays (e.g., with `.values`).".format(method, ufunc)
"to NumPy arrays (e.g., with `.values`)."
)

if any(isinstance(o, SupportsArithmetic) for o in out):
Expand Down
6 changes: 1 addition & 5 deletions xarray/core/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,7 @@ def __ne__(self, other):
return not self == other

def __repr__(self):
return "{}({!r}, {!r})".format(
type(self).__name__,
list(self.input_core_dims),
list(self.output_core_dims),
)
return f"{type(self).__name__}({list(self.input_core_dims)!r}, {list(self.output_core_dims)!r})"

def __str__(self):
lhs = ",".join("({})".format(",".join(dims)) for dims in self.input_core_dims)
Expand Down
4 changes: 2 additions & 2 deletions xarray/core/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ def inline_sparse_repr(array):
"""Similar to sparse.COO.__repr__, but without the redundant shape/dtype."""
sparse_array_type = array_type("sparse")
assert isinstance(array, sparse_array_type), array
return "<{}: nnz={:d}, fill_value={!s}>".format(
type(array).__name__, array.nnz, array.fill_value
return (
f"<{type(array).__name__}: nnz={array.nnz:d}, fill_value={array.fill_value!s}>"
)


Expand Down

0 comments on commit 97d3a3a

Please sign in to comment.