Skip to content

Commit

Permalink
more work on base store
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Sep 22, 2020
1 parent eec6e1a commit 3730e43
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL
addopts = --durations=10
filterwarnings =
error::DeprecationWarning:zarr.*
error::UserWarning:zarr.*
ignore:PY_SSIZE_T_CLEAN will be required.*:DeprecationWarning
12 changes: 10 additions & 2 deletions zarr/hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,16 @@ class Group(MutableMapping):
"""

def __init__(self, store, path=None, read_only=False, chunk_store=None,
cache_attrs=True, synchronizer=None):
def __init__(
self,
store,
path=None,
read_only=False,
chunk_store=None,
cache_attrs=True,
synchronizer=None,
):
assert hasattr(store, "listdir")
self._store = store
self._chunk_store = chunk_store
self._path = normalize_storage_path(path)
Expand Down
9 changes: 3 additions & 6 deletions zarr/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ def rmdir(store: Store, path: Path = None):
store.rmdir(path) # type: ignore
else:
# slow version, delete one key at a time
warnings.warn(
"Store {store} has not `rmdir` method. From zarr 2.5 you may want"
"to inherit from `Store`.".format(store=store)
)
_rmdir_from_keys(store, path)


Expand Down Expand Up @@ -176,7 +172,8 @@ def listdir(store: Store, path: Path = None):
# slow version, iterate through all keys
warnings.warn(
"Store {store} has not `listdir` method. From zarr 2.5 you may want"
"to inherit from `Store`.".format(store=store)
"to inherit from `Store`.".format(store=store),
stacklevel=2,
)
return _listdir_from_keys(store, path)

Expand Down Expand Up @@ -2729,7 +2726,7 @@ def __init__(self, store, metadata_key='.zmetadata'):
consolidated_format)

# decode metadata
self.meta_store = meta['metadata']
self.meta_store = meta["metadata"]

def __getitem__(self, key):
return self.meta_store[key]
Expand Down

0 comments on commit 3730e43

Please sign in to comment.