Skip to content
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

Make consolidate_metadata for DirectoryStore following symlinks #2063

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion zarr/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ def keys(self):

@staticmethod
def _keys_fast(path, walker=os.walk):
for dirpath, _, filenames in walker(path):
for dirpath, _, filenames in walker(path, followlinks=True):
dirpath = os.path.relpath(dirpath, path)
if dirpath == os.curdir:
for f in filenames:
Expand Down
6 changes: 3 additions & 3 deletions zarr/tests/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ def test_normalize_keys(self):
assert self.root + "foo" in store

def test_listing_keys_slash(self):
def mock_walker_slash(_path):
def mock_walker_slash(*_args, **_kwargs):
yield from [
# trailing slash in first key
("root_with_slash/", ["d1", "g1"], [".zgroup"]),
Expand All @@ -1084,15 +1084,15 @@ def mock_walker_slash(_path):
assert res == {".zgroup", "g1/.zgroup", "d1/.zarray"}

def test_listing_keys_no_slash(self):
def mock_walker_no_slash(_path):
def mock_walker_no_slash(*_args, **_kwargs):
yield from [
# no trailing slash in first key
("root_with_no_slash", ["d1", "g1"], [".zgroup"]),
("root_with_no_slash/d1", [], [".zarray"]),
("root_with_no_slash/g1", [], [".zgroup"]),
]

res = set(DirectoryStore._keys_fast("root_with_no_slash", mock_walker_no_slash))
res = set(DirectoryStore._keys_fast("root_with_no_slash", walker=mock_walker_no_slash))
assert res == {".zgroup", "g1/.zgroup", "d1/.zarray"}


Expand Down
Loading