Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 5, 2024
1 parent 421a417 commit 8cf2a7e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ome_zarr/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def init_store(self, path: str, mode: str = "r") -> FSStore:
mode=mode,
**kwargs,
) # TODO: open issue for using Path
print("Created v0.5 store %s(%s, %s, %s)" % (cls, path, mode, kwargs))
print("Created v0.5 store {}({}, {}, {})".format(cls, path, mode, kwargs))
return store


Expand Down
12 changes: 6 additions & 6 deletions ome_zarr/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from urllib.parse import urljoin

import dask.array as da
from zarr import Group, Array, open
from zarr import Array, Group, open

# from zarr.v2.storage import FSStore
from zarr.abc.store import Store
Expand Down Expand Up @@ -109,20 +109,20 @@ def __init_metadata(self) -> None:
try:
# NB: zarr_format not supported in Group.open() or Array.open() yet
# We want to use zarr_format=None to handle v2 or v3
zarr_group = Group.open(self.__store) #, zarr_format=None)
zarr_group = Group.open(self.__store) # , zarr_format=None)
self.zgroup: JSONDict = zarr_group.metadata.to_dict()
self.__metadata = self.zgroup
except FileNotFoundError:
# group doesn't exist yet, try array
try:
zarr_array = Array.open(self.__store) #, zarr_format=None)
zarr_array = Array.open(self.__store) # , zarr_format=None)
self.zarray: JSONDict = zarr_array.metadata.to_dict()
self.__metadata = self.zarray
except (ValueError, KeyError, FileNotFoundError):
# exceptions raised may change here?
print("__init_metadata DOESN'T EXIST", self.__store)
self.__exists = False

print("__init_metadat EXISTS?", self.__exists, self.__metadata)
# self.zarray: JSONDict = await self.get_json(".zarray")
# self.zgroup: JSONDict = await self.get_json(".zgroup")
Expand Down Expand Up @@ -214,9 +214,9 @@ async def get_json(self, subpath: str) -> JSONDict:
All other exceptions log at the ERROR level.
"""
try:
print('get_json', subpath)
print("get_json", subpath)
data = await self.__store.get(subpath)
print('data', data)
print("data", data)

if not data:
return {}
Expand Down
8 changes: 7 additions & 1 deletion ome_zarr/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,13 @@ def write_multiscale(

else:
# We create the array and write data to it immediately...
a = group.create_array(str(path), chunks=chunks_opt, shape=data.shape, dtype=data.dtype, **options)
a = group.create_array(
str(path),
chunks=chunks_opt,
shape=data.shape,
dtype=data.dtype,
**options,
)
# These 2 lines are equivalent to e.g. a[:,:] = data (for any number of dimensions)
s = [np.s_[:]] * len(data.shape)
a[tuple(s)] = data
Expand Down

0 comments on commit 8cf2a7e

Please sign in to comment.