Skip to content

Commit ce129a5

Browse files
grlee77joshmoore
andauthored
Remove/relax erroneous "meta" path check (#1123)
* assertion on path not containing meta should be meta/ this avoids disallowing key names such as 'metabolite', for instance * remove meta check altogether from the v2 branch as it is v3-specific * update docs/release.rst * Add test for #6853 Co-authored-by: Josh Moore <[email protected]>
1 parent 2cfee9c commit ce129a5

File tree

5 files changed

+33
-2
lines changed

5 files changed

+33
-2
lines changed

docs/release.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ Bug fixes
3535
* Fix bug in LRUEStoreCache in which the current size wasn't reset on invalidation.
3636
By :user:`BGCMHou <BGCMHou>` and :user:`Josh Moore <joshmoore>` :issue:`1076`, :issue:`1077`.
3737

38+
* Remove erroneous check that disallowed array keys starting with "meta".
39+
By :user:`Gregory R. Lee <grlee77>`; :issue:`1105`.
40+
3841
Documentation
3942
~~~~~~~~~~~~~
4043

fixture/meta/.zarray

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"chunks": [
3+
2,
4+
2
5+
],
6+
"compressor": {
7+
"blocksize": 0,
8+
"clevel": 5,
9+
"cname": "lz4",
10+
"id": "blosc",
11+
"shuffle": 1
12+
},
13+
"dimension_separator": ".",
14+
"dtype": "<i8",
15+
"fill_value": 0,
16+
"filters": null,
17+
"order": "C",
18+
"shape": [
19+
2,
20+
2
21+
],
22+
"zarr_format": 2
23+
}

fixture/meta/0.0

48 Bytes
Binary file not shown.

zarr/hierarchy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,6 @@ def _array_iter(self, keys_only, method, recurse):
628628
if self._version == 2:
629629
for key in sorted(listdir(self._store, self._path)):
630630
path = self._key_prefix + key
631-
assert not path.startswith("meta")
632631
if contains_array(self._store, path):
633632
_key = key.rstrip("/")
634633
yield _key if keys_only else (_key, self[key])
@@ -643,7 +642,7 @@ def _array_iter(self, keys_only, method, recurse):
643642
if key.endswith(array_sfx):
644643
key = key[:-len(array_sfx)]
645644
path = self._key_prefix + key
646-
assert not path.startswith("meta")
645+
assert not path.startswith("meta/")
647646
if key.endswith('.group' + self._metadata_key_suffix):
648647
# skip group metadata keys
649648
continue

zarr/tests/test_storage.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2559,3 +2559,9 @@ def test_normalize_store_arg(tmpdir):
25592559
path = tempfile.mkdtemp()
25602560
store = normalize_store_arg("file://" + path, zarr_version=2, mode='w')
25612561
assert isinstance(store, FSStore)
2562+
2563+
2564+
def test_meta_prefix_6853():
2565+
2566+
fixture = group(store=DirectoryStore('fixture'))
2567+
assert list(fixture.arrays())

0 commit comments

Comments
 (0)