-
-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow reading utf-8 encoded json files #1312
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
33057b9
read utf-8 in json
nhz2 5290626
update release
nhz2 a5dcc40
Merge branch 'main' into fix-utf8-attrs
nhz2 acdeb6e
Merge branch 'main' into fix-utf8-attrs
nhz2 010f5cb
Merge branch 'main' into fix-utf8-attrs
nhz2 adc55e4
Merge branch 'main' into fix-utf8-attrs
nhz2 207627e
Update zarr/util.py
nhz2 2024d7f
allow str
nhz2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"foo": "た"} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"zarr_format": 2 | ||
} | ||
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same with this one |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,10 @@ | |
|
||
from zarr._storage.store import meta_root | ||
from zarr.attrs import Attributes | ||
from zarr.storage import KVStore | ||
from zarr.storage import KVStore, DirectoryStore | ||
from zarr._storage.v3 import KVStoreV3 | ||
from zarr.tests.util import CountingDict, CountingDictV3 | ||
from zarr.hierarchy import group | ||
|
||
|
||
@pytest.fixture(params=[2, 3]) | ||
|
@@ -42,11 +43,17 @@ def test_storage(self, zarr_version): | |
a['baz'] = 42 | ||
assert attrs_key in store | ||
assert isinstance(store[attrs_key], bytes) | ||
d = json.loads(str(store[attrs_key], 'ascii')) | ||
d = json.loads(str(store[attrs_key], 'utf-8')) | ||
if zarr_version == 3: | ||
d = d['attributes'] | ||
assert dict(foo='bar', baz=42) == d | ||
|
||
def test_utf8_encoding(self, zarr_version): | ||
|
||
# fixture data | ||
fixture = group(store=DirectoryStore('fixture')) | ||
assert fixture['utf8attrs'].attrs.asdict() == dict(foo='た') | ||
Comment on lines
+51
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is failing there |
||
|
||
def test_get_set_del_contains(self, zarr_version): | ||
|
||
store = _init_store(zarr_version) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is missing from the
sdist
on PyPIThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @jakirkham. Argh, I thought I had caught these issues but likely only if there's code to generate it them as well. Are you already working on a fix or shall I?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to go ahead. I might not get to this for a while
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forget if we already discussed this before, but maybe we can make some fixes to CI to ensure we catch these issues in PRs. Wrote up some thoughts on this in issue ( #1347 )