Skip to content

Commit

Permalink
comments [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
alimanfoo committed Nov 6, 2018
1 parent 9c0c621 commit ccef26c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 0 additions & 1 deletion zarr/convenience.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,6 @@ def is_zarr_key(key):
return (key.endswith('.zarray') or key.endswith('.zgroup') or
key.endswith('.zattrs'))

# out = {key: store[key].decode() for key in store if is_zarr_key(key)}
out = {
'zarr_consolidated_format': 1,
'metadata': {
Expand Down
8 changes: 8 additions & 0 deletions zarr/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,21 @@ def json_dumps(o):


def parse_metadata(s):

# Here we allow that a store may return an already-parsed metadata object,
# or a string of JSON that we will parse here. We allow for an already-parsed
# object to accommodate a consolidated metadata store, where all the metadata for
# all groups and arrays will already have been parsed from JSON.

if isinstance(s, Mapping):
# assume metadata has already been parsed into a mapping object
meta = s

else:
# assume metadata needs to be parsed as JSON
s = ensure_str(s)
meta = json.loads(s)

return meta


Expand Down

0 comments on commit ccef26c

Please sign in to comment.