Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 451
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
Uh oh!
There was an error while loading. Please reload this page.
N5FSStore #793
Changes from all commits
d26923ac06476dce8b2f0e183566449a67f10c874e2e4f4d78660fa53b341edbb1121cbe8f37f95b2573ceba78d02ea91ccb62c1068adca5f2f75b7930a821a57b3bc9bb058fee9cdbca853a297d3c879f3ecd792d3d2865a105eb51b3109aa75c983daea7cce8a79e985c2a451836df3c5da2feea4aaab8fe8038fec1d646ebb44864773d3b56155b0f6d3382ce89f267c7442b854108bd6c41aa4a723File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
Member 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 = [] | ||
Uh oh!
There was an error while loading. Please reload this page.
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