Skip to content

Commit 10f3c94

Browse files
committed
Ignore special dotfiles at Zarr root when syncing at the end of a download
1 parent fb4dbc1 commit 10f3c94

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

dandi/download.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
from .utils import (
5858
abbrev_prompt,
5959
ensure_datetime,
60+
exclude_from_zarr,
6061
flattened,
6162
is_same_time,
6263
on_windows,
@@ -879,7 +880,9 @@ def digest_callback(path: str, algoname: str, d: str) -> None:
879880
d = dirs.popleft()
880881
is_empty = True
881882
for p in list(d.iterdir()):
882-
if (
883+
if d == zarr_basepath and exclude_from_zarr(p):
884+
is_empty = False
885+
elif (
883886
p.is_file()
884887
and p.relative_to(zarr_basepath).as_posix() not in remote_paths
885888
):

dandi/tests/test_download.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def test_download_different_zarr_onto_excluded_dotfiles(
359359
download(
360360
zarr_dandiset.dandiset.version_api_url, tmp_path, existing="overwrite-different"
361361
)
362-
assert list_paths(zarr_path, dirs=True) == [
362+
assert list_paths(zarr_path, dirs=True, exclude_vcs=False) == [
363363
zarr_path / ".dandi",
364364
zarr_path / ".dandi" / "somefile.txt",
365365
zarr_path / ".datalad",

dandi/utils.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,9 @@ def good_file(path: str) -> bool:
356356
yield p
357357

358358

359-
def list_paths(dirpath: Union[str, Path], dirs: bool = False) -> List[Path]:
359+
def list_paths(
360+
dirpath: Union[str, Path], dirs: bool = False, exclude_vcs: bool = True
361+
) -> List[Path]:
360362
return sorted(
361363
map(
362364
Path,
@@ -366,6 +368,7 @@ def list_paths(dirpath: Union[str, Path], dirs: bool = False) -> List[Path]:
366368
dirs=dirs,
367369
exclude_dotfiles=False,
368370
exclude_dotdirs=False,
371+
exclude_vcs=exclude_vcs,
369372
),
370373
)
371374
)

0 commit comments

Comments
 (0)