Skip to content

Commit bbd683d

Browse files
committed
pre-commit fixes
1 parent bf74f63 commit bbd683d

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

xarray/backends/api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1442,7 +1442,7 @@ def to_zarr(
14421442
chunk_store=chunk_store,
14431443
append_dim=append_dim,
14441444
write_region=region,
1445-
safe_chunks=safe_chunks
1445+
safe_chunks=safe_chunks,
14461446
)
14471447
writer = ArrayWriter()
14481448
# TODO: figure out how to properly handle unlimited_dims

xarray/backends/zarr.py

+19-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import pathlib
3-
from distutils.version import LooseVersion
43
import warnings
4+
from distutils.version import LooseVersion
55

66
import numpy as np
77

@@ -171,8 +171,8 @@ def _determine_zarr_chunks(enc_chunks, var_chunks, ndim, name, safe_chunks):
171171
)
172172
if safe_chunks:
173173
raise ValueError(
174-
base_error +
175-
"Consider either rechunking using `chunk()`, deleting "
174+
base_error
175+
+ "Consider either rechunking using `chunk()`, deleting "
176176
"or modifying `encoding['chunks']`, or specify `safe_chunks=False`."
177177
)
178178
else:
@@ -188,8 +188,8 @@ def _determine_zarr_chunks(enc_chunks, var_chunks, ndim, name, safe_chunks):
188188
)
189189
if safe_chunks:
190190
raise ValueError(
191-
base_error +
192-
"Consider either rechunking using `chunk()`, deleting "
191+
base_error
192+
+ "Consider either rechunking using `chunk()`, deleting "
193193
"or modifying `encoding['chunks']`, or specify `safe_chunks=False`."
194194
)
195195
else:
@@ -215,7 +215,9 @@ def _get_zarr_dims_and_attrs(zarr_obj, dimension_key):
215215
return dimensions, attributes
216216

217217

218-
def extract_zarr_variable_encoding(variable, raise_on_invalid=False, name=None, safe_chunks=True):
218+
def extract_zarr_variable_encoding(
219+
variable, raise_on_invalid=False, name=None, safe_chunks=True
220+
):
219221
"""
220222
Extract zarr encoding dictionary from xarray Variable
221223
@@ -297,7 +299,7 @@ class ZarrStore(AbstractWritableDataStore):
297299
"_read_only",
298300
"_synchronizer",
299301
"_write_region",
300-
"_safe_chunks"
302+
"_safe_chunks",
301303
)
302304

303305
@classmethod
@@ -313,7 +315,7 @@ def open_group(
313315
storage_options=None,
314316
append_dim=None,
315317
write_region=None,
316-
safe_chunks=True
318+
safe_chunks=True,
317319
):
318320

319321
# zarr doesn't support pathlib.Path objects yet. zarr-python#601
@@ -337,11 +339,17 @@ def open_group(
337339
zarr_group = zarr.open_consolidated(store, **open_kwargs)
338340
else:
339341
zarr_group = zarr.open_group(store, **open_kwargs)
340-
return cls(zarr_group, consolidate_on_close, append_dim, write_region, safe_chunks)
342+
return cls(
343+
zarr_group, consolidate_on_close, append_dim, write_region, safe_chunks
344+
)
341345

342346
def __init__(
343-
self, zarr_group, consolidate_on_close=False, append_dim=None, write_region=None,
344-
safe_chunks=True
347+
self,
348+
zarr_group,
349+
consolidate_on_close=False,
350+
append_dim=None,
351+
write_region=None,
352+
safe_chunks=True,
345353
):
346354
self.ds = zarr_group
347355
self._read_only = self.ds.read_only

xarray/core/dataset.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,7 @@ def to_zarr(
17221722
consolidated: bool = False,
17231723
append_dim: Hashable = None,
17241724
region: Mapping[str, slice] = None,
1725-
safe_chunks: bool = True
1725+
safe_chunks: bool = True,
17261726
) -> "ZarrStore":
17271727
"""Write dataset contents to a zarr group.
17281728
@@ -1825,7 +1825,7 @@ def to_zarr(
18251825
consolidated=consolidated,
18261826
append_dim=append_dim,
18271827
region=region,
1828-
safe_chunks=safe_chunks
1828+
safe_chunks=safe_chunks,
18291829
)
18301830

18311831
def __repr__(self) -> str:

0 commit comments

Comments
 (0)