-
-
Notifications
You must be signed in to change notification settings - Fork 325
N5FSStore #793
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
Merged
Merged
N5FSStore #793
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
d26923a
Drop skip_if_nested_chunks from test_storage.py
joshmoore c06476d
Add failing nested test
joshmoore ce8b2f0
Make DirectoryStore dimension_separator aware
joshmoore e183566
Migrate key logic to core rather than storage
joshmoore 449a67f
Fix linting in new test
joshmoore 10c874e
Merge 'origin/master' into fix-dstore
joshmoore 2e4f4d7
Extend the test suite for dim_sep
joshmoore 8660fa5
add n5fsstore and tests
d-v-b 3b341ed
resolve merge conflicts with main
d-v-b bb1121c
slightly smarter kwarg interception
d-v-b be8f37f
remove outdated unittest ref and fix the name of a test func
d-v-b 95b2573
fix massive string block and fix default key_separator kwarg for FSStore
d-v-b ceba78d
flake8
d-v-b 02ea91c
promote n5store to toplevel import and fix examples in docstring
d-v-b cb62c10
Merge branch 'master' into fix-dstore
joshmoore 68adca5
Try fsspec 2021.7 (see #802)
joshmoore f2f75b7
Revert "Try fsspec 2021.7 (see #802)"
joshmoore 930a821
Merge branch 'master' into n5fsstore
d-v-b a57b3bc
Add missing core tests for N5FSStore, and rchanges required for makin…
d-v-b 9bb058f
Merge branch 'fix-dstore' of https://github.com/joshmoore/zarr-python…
d-v-b ee9cdbc
tmp: debug
joshmoore a853a29
uncomment N5 chunk ordering test
d-v-b 7d3c879
more commented tests get uncommented
d-v-b f3ecd79
add dimension_separator to array metadata adaptor
d-v-b 2d3d286
Merge branch 'fix-dstore' into pr-793+773
joshmoore 5a105eb
Revert "tmp: debug"
joshmoore 51b3109
Attempt failed: keeping '.' and switching
joshmoore aa75c98
Revert "Attempt failed: keeping '.' and switching"
joshmoore 3daea7c
regex: attempt failed due to slight diff in files
joshmoore ce8a79e
Revert "regex: attempt failed due to slight diff in files"
joshmoore 985c2a4
N5: use "." internally for dimension separation
joshmoore 51836df
move FSSpec import guard
d-v-b 3c5da2f
remove os.path.sep concatenation in listdir that was erroring a test,…
d-v-b eea4aaa
resolve merge conflicts in favor of upstream
d-v-b b8fe803
resolve merge conflicts in favor of upstream
d-v-b 8fec1d6
make listdir implementation for n5fsstore look more like fsstore's li…
d-v-b 46ebb44
Update hexdigest tests for N5Stores to account for the presence of th…
d-v-b 864773d
Add tests for dimension_separator in array meta for N5Stores
d-v-b 3b56155
N5FSStore: try to increase code coverage
joshmoore b0f6d33
flake8
d-v-b 82ce89f
add chunk nesting test to N5FSStore test suite
d-v-b 267c744
Merge branch 'master' into n5fsstore
joshmoore 2b85410
make array_meta_key, group_meta_key, attrs_key private
d-v-b 8bd6c41
Merge branch 'n5fsstore' of https://github.com/d-v-b/zarr-python into…
d-v-b aa4a723
N5FSStore: Remove ImportError test
joshmoore 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -1065,22 +1065,28 @@ class FSStore(MutableMapping): | |
Separator placed between the dimensions of a chunk. | ||
storage_options : passed to the fsspec implementation | ||
""" | ||
_array_meta_key = array_meta_key | ||
_group_meta_key = group_meta_key | ||
_attrs_key = attrs_key | ||
|
||
_META_KEYS = (attrs_key, group_meta_key, array_meta_key) | ||
|
||
def __init__(self, url, normalize_keys=False, key_separator=None, | ||
def __init__(self, url, normalize_keys=True, key_separator=None, | ||
mode='w', | ||
exceptions=(KeyError, PermissionError, IOError), | ||
dimension_separator=None, | ||
**storage_options): | ||
import fsspec | ||
self.normalize_keys = normalize_keys | ||
|
||
protocol, _ = fsspec.core.split_protocol(url) | ||
# set auto_mkdir to True for local file system | ||
if protocol in (None, "file") and not storage_options.get("auto_mkdir"): | ||
storage_options["auto_mkdir"] = True | ||
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. ❤️ |
||
|
||
self.map = fsspec.get_mapper(url, **storage_options) | ||
self.fs = self.map.fs # for direct operations | ||
self.path = self.fs._strip_protocol(url) | ||
self.mode = mode | ||
self.exceptions = exceptions | ||
|
||
# For backwards compatibility. Guaranteed to be non-None | ||
if key_separator is not None: | ||
dimension_separator = key_separator | ||
|
@@ -1091,7 +1097,6 @@ def __init__(self, url, normalize_keys=False, key_separator=None, | |
|
||
# Pass attributes to array creation | ||
self._dimension_separator = dimension_separator | ||
|
||
if self.fs.exists(self.path) and not self.fs.isdir(self.path): | ||
raise FSPathExistNotDir(url) | ||
|
||
|
@@ -1100,7 +1105,7 @@ def _normalize_key(self, key): | |
if key: | ||
*bits, end = key.split('/') | ||
|
||
if end not in FSStore._META_KEYS: | ||
if end not in (self._array_meta_key, self._group_meta_key, self._attrs_key): | ||
end = end.replace('.', self.key_separator) | ||
key = '/'.join(bits + [end]) | ||
|
||
|
@@ -1178,7 +1183,7 @@ def listdir(self, path=None): | |
if self.key_separator != "/": | ||
return children | ||
else: | ||
if array_meta_key in children: | ||
if self._array_meta_key in children: | ||
# special handling of directories containing an array to map nested chunk | ||
# keys back to standard chunk keys | ||
new_children = [] | ||
|
Oops, something went wrong.
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 concerned me that it would need protecting by try/except block. In testing it, I realized FSStore only throws on
__init__
and therefore N5FSStore could be less conservative. I've pushed:aa4a723