Skip to content

Commit

Permalink
De-deprecate key_separator as public, non-null API
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmoore committed Apr 16, 2021
1 parent 4f941fe commit 64dffde
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
13 changes: 5 additions & 8 deletions zarr/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,8 +1027,9 @@ class FSStore(MutableMapping):
The destination to map. Should include protocol and path,
like "s3://bucket/root"
normalize_keys : bool
key_separator : str (deprecated)
See dimension_separator
key_separator : str
public API for accessing dimension_separator. Never `None`
See dimension_separator for more informatino.
mode : str
"w" for writable, "r" for read-only
exceptions : list of Exception subclasses
Expand All @@ -1054,14 +1055,10 @@ def __init__(self, url, normalize_keys=True, key_separator=None,
self.mode = mode
self.exceptions = exceptions

# Handle deprecated properties
# For backwards compatibility. Guaranteed to be non-None
if key_separator is not None:
warnings.warn(
"key_separator has been replaced by dimension_separator "
"in 2.8.0", DeprecationWarning)
dimension_separator = key_separator

# For backwards compatibility. Guaranteed to be non-None
self.key_separator = dimension_separator
if self.key_separator is None:
self.key_separator = "."
Expand Down Expand Up @@ -1651,7 +1648,7 @@ class DBMStore(MutableMapping):
write_lock: bool, optional
Use a lock to prevent concurrent writes from multiple threads (True by default).
dimension_separator : {'.', '/'}, optional
Separator placed between the dimensions of a chunk.
Separator placed between the dimensions of a chunk.e
**open_kwargs
Keyword arguments to pass the `open` function.
Expand Down
9 changes: 4 additions & 5 deletions zarr/tests/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,11 +1069,10 @@ def create_store(self, normalize_keys=False, key_separator=".", **kwargs):

path = tempfile.mkdtemp()
atexit.register(atexit_rmtree, path)
with pytest.warns(DeprecationWarning):
return FSStore(
path,
normalize_keys=normalize_keys,
key_separator=key_separator)
return FSStore(
path,
normalize_keys=normalize_keys,
key_separator=key_separator)


@pytest.fixture()
Expand Down

0 comments on commit 64dffde

Please sign in to comment.