Skip to content

Commit 8076e5b

Browse files
committed
Revert "Update Array to respect FSStore's key_separator (zarr-developers#718)"
This reverts commit 449ed26.
1 parent b170a48 commit 8076e5b

File tree

2 files changed

+7
-56
lines changed

2 files changed

+7
-56
lines changed

zarr/core.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,11 +1952,7 @@ def _process_for_setitem(self, ckey, chunk_selection, value, fields=None):
19521952
return self._encode_chunk(chunk)
19531953

19541954
def _chunk_key(self, chunk_coords):
1955-
if hasattr(self._store, 'key_separator'):
1956-
separator = self._store.key_separator
1957-
else:
1958-
separator = '.'
1959-
return self._key_prefix + separator.join(map(str, chunk_coords))
1955+
return self._key_prefix + '.'.join(map(str, chunk_coords))
19601956

19611957
def _decode_chunk(self, cdata, start=None, nitems=None, expected_shape=None):
19621958
# decompress

zarr/tests/test_hierarchy.py

Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
from zarr.core import Array
2222
from zarr.creation import open_array
2323
from zarr.hierarchy import Group, group, open_group
24-
from zarr.storage import (ABSStore, DBMStore, DirectoryStore, FSStore,
25-
LMDBStore, LRUStoreCache, MemoryStore,
26-
NestedDirectoryStore, SQLiteStore, ZipStore,
27-
array_meta_key, atexit_rmglob, atexit_rmtree,
28-
group_meta_key, init_array, init_group)
24+
from zarr.storage import (ABSStore, DBMStore, DirectoryStore, LMDBStore,
25+
LRUStoreCache, MemoryStore, NestedDirectoryStore,
26+
SQLiteStore, ZipStore, array_meta_key, atexit_rmglob,
27+
atexit_rmtree, group_meta_key, init_array,
28+
init_group)
2929
from zarr.util import InfoReporter
30-
from zarr.tests.util import skip_test_env_var, have_fsspec
30+
from zarr.tests.util import skip_test_env_var
3131

3232

3333
# noinspection PyStatementEffect
@@ -971,51 +971,6 @@ def create_store():
971971
return store, None
972972

973973

974-
@pytest.mark.skipif(have_fsspec is False, reason="needs fsspec")
975-
class TestGroupWithFSStore(TestGroup):
976-
977-
@staticmethod
978-
def create_store():
979-
path = tempfile.mkdtemp()
980-
atexit.register(atexit_rmtree, path)
981-
store = FSStore(path)
982-
return store, None
983-
984-
def test_round_trip_nd(self):
985-
data = np.arange(1000).reshape(10, 10, 10)
986-
name = 'raw'
987-
988-
store, _ = self.create_store()
989-
f = open_group(store, mode='w')
990-
f.create_dataset(name, data=data, chunks=(5, 5, 5),
991-
compressor=None)
992-
h = open_group(store, mode='r')
993-
np.testing.assert_array_equal(h[name][:], data)
994-
995-
996-
@pytest.mark.skipif(have_fsspec is False, reason="needs fsspec")
997-
class TestGroupWithNestedFSStore(TestGroupWithFSStore):
998-
999-
@staticmethod
1000-
def create_store():
1001-
path = tempfile.mkdtemp()
1002-
atexit.register(atexit_rmtree, path)
1003-
store = FSStore(path, key_separator='/', auto_mkdir=True)
1004-
return store, None
1005-
1006-
def test_inconsistent_dimension_separator(self):
1007-
data = np.arange(1000).reshape(10, 10, 10)
1008-
name = 'raw'
1009-
1010-
store, _ = self.create_store()
1011-
f = open_group(store, mode='w')
1012-
1013-
# cannot specify dimension_separator that conflicts with the store
1014-
with pytest.raises(ValueError):
1015-
f.create_dataset(name, data=data, chunks=(5, 5, 5),
1016-
compressor=None, dimension_separator='.')
1017-
1018-
1019974
class TestGroupWithZipStore(TestGroup):
1020975

1021976
@staticmethod

0 commit comments

Comments
 (0)