Skip to content

Commit d924d93

Browse files
Update pre-commit hooks (#10021)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent c252152 commit d924d93

20 files changed

+56
-65
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repos:
2525
- id: text-unicode-replacement-char
2626
- repo: https://github.com/astral-sh/ruff-pre-commit
2727
# Ruff version.
28-
rev: v0.8.6
28+
rev: v0.9.4
2929
hooks:
3030
- id: ruff-format
3131
- id: ruff

xarray/backends/api.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ def _get_default_engine_remote_uri() -> Literal["netcdf4", "pydap"]:
104104
engine = "pydap"
105105
except ImportError as err:
106106
raise ValueError(
107-
"netCDF4 or pydap is required for accessing "
108-
"remote datasets via OPeNDAP"
107+
"netCDF4 or pydap is required for accessing remote datasets via OPeNDAP"
109108
) from err
110109
return engine
111110

@@ -1669,8 +1668,7 @@ def open_mfdataset(
16691668
)
16701669
else:
16711670
raise ValueError(
1672-
f"{combine} is an invalid option for the keyword argument"
1673-
" ``combine``"
1671+
f"{combine} is an invalid option for the keyword argument ``combine``"
16741672
)
16751673
except ValueError:
16761674
for ds in datasets:

xarray/backends/h5netcdf_.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ def __init__(self, manager, group=None, mode=None, lock=HDF5_LOCK, autoclose=Fal
119119
else:
120120
if type(manager) is not h5netcdf.File:
121121
raise ValueError(
122-
"must supply a h5netcdf.File if the group "
123-
"argument is provided"
122+
"must supply a h5netcdf.File if the group argument is provided"
124123
)
125124
root = manager
126125
manager = DummyFileManager(root)

xarray/coding/cftimeindex.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,16 +294,18 @@ def __repr__(self):
294294
offset=offset,
295295
first_row_offset=offset,
296296
)
297-
datastr = "\n".join([front_str, f"{' '*offset}...", end_str])
297+
datastr = "\n".join([front_str, f"{' ' * offset}...", end_str])
298298

299299
attrs_str = format_attrs(self)
300300
# oneliner only if smaller than display_width
301301
full_repr_str = f"{klass_name}([{datastr}], {attrs_str})"
302302
if len(full_repr_str) > display_width:
303303
# if attrs_str too long, one per line
304304
if len(attrs_str) >= display_width - offset:
305-
attrs_str = attrs_str.replace(",", f",\n{' '*(offset-2)}")
306-
full_repr_str = f"{klass_name}([{datastr}],\n{' '*(offset-1)}{attrs_str})"
305+
attrs_str = attrs_str.replace(",", f",\n{' ' * (offset - 2)}")
306+
full_repr_str = (
307+
f"{klass_name}([{datastr}],\n{' ' * (offset - 1)}{attrs_str})"
308+
)
307309

308310
return full_repr_str
309311

xarray/core/common.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,7 @@ def get_squeeze_dims(
412412

413413
if any(xarray_obj.sizes[k] > 1 for k in dim):
414414
raise ValueError(
415-
"cannot select a dimension to squeeze out "
416-
"which has length greater than one"
415+
"cannot select a dimension to squeeze out which has length greater than one"
417416
)
418417
return dim
419418

xarray/core/dataarray.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3512,8 +3512,7 @@ def fillna(self, value: Any) -> Self:
35123512
"""
35133513
if utils.is_dict_like(value):
35143514
raise TypeError(
3515-
"cannot provide fill value as a dictionary with "
3516-
"fillna on a DataArray"
3515+
"cannot provide fill value as a dictionary with fillna on a DataArray"
35173516
)
35183517
out = ops.fillna(self, value)
35193518
return out
@@ -4537,8 +4536,7 @@ def from_dict(cls, d: Mapping[str, Any]) -> Self:
45374536
}
45384537
except KeyError as e:
45394538
raise ValueError(
4540-
"cannot convert dict when coords are missing the key "
4541-
f"'{e.args[0]}'"
4539+
f"cannot convert dict when coords are missing the key '{e.args[0]}'"
45424540
) from e
45434541
try:
45444542
data = d["data"]

xarray/core/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6478,7 +6478,7 @@ def transpose(
64786478
if (len(dim) > 0) and (isinstance(dim[0], list)):
64796479
list_fix = [f"{x!r}" if isinstance(x, str) else f"{x}" for x in dim[0]]
64806480
raise TypeError(
6481-
f'transpose requires dim to be passed as multiple arguments. Expected `{", ".join(list_fix)}`. Received `{dim[0]}` instead'
6481+
f"transpose requires dim to be passed as multiple arguments. Expected `{', '.join(list_fix)}`. Received `{dim[0]}` instead"
64826482
)
64836483

64846484
# Use infix_dims to check once for missing dimensions

xarray/core/datatree.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,7 @@ def set_close(self, close: Callable[[], None] | None) -> None:
276276

277277
def close(self) -> None:
278278
raise AttributeError(
279-
"cannot close a DatasetView(). Close the associated DataTree node "
280-
"instead"
279+
"cannot close a DatasetView(). Close the associated DataTree node instead"
281280
)
282281

283282
# FIXME https://github.com/python/mypy/issues/7328

xarray/core/datatree_render.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ def __init__(self, vertical: str, cont: str, end: str):
3131
self.vertical = vertical
3232
self.cont = cont
3333
self.end = end
34-
assert (
35-
len(cont) == len(vertical) == len(end)
36-
), f"'{vertical}', '{cont}' and '{end}' need to have equal length"
34+
assert len(cont) == len(vertical) == len(end), (
35+
f"'{vertical}', '{cont}' and '{end}' need to have equal length"
36+
)
3737

3838
@property
3939
def empty(self) -> str:

xarray/core/formatting_html.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ def summarize_attrs(attrs) -> str:
7272
def _icon(icon_name) -> str:
7373
# icon_name should be defined in xarray/static/html/icon-svg-inline.html
7474
return (
75-
f"<svg class='icon xr-{icon_name}'>"
76-
f"<use xlink:href='#{icon_name}'>"
77-
"</use>"
78-
"</svg>"
75+
f"<svg class='icon xr-{icon_name}'><use xlink:href='#{icon_name}'></use></svg>"
7976
)
8077

8178

0 commit comments

Comments
 (0)