Skip to content
Merged
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
3 changes: 1 addition & 2 deletions dandi/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from collections.abc import Iterator, Sequence
from contextlib import ExitStack
from enum import Enum
from functools import reduce
import io
import os.path
from pathlib import Path
Expand Down Expand Up @@ -493,7 +492,7 @@ def upload_agg(*ignored: Any) -> str:
for p in paths:
rp = os.path.relpath(p, dandiset.path)
relpaths.append("" if rp == "." else rp)
path_prefix = reduce(os.path.commonprefix, relpaths) # type: ignore[arg-type]
path_prefix = os.path.commonprefix(relpaths)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how it should have worked even

In [5]: reduce(os.path.commonprefix, ['1/1','1/1/12','1/3'])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[5], line 1
----> 1 reduce(os.path.commonprefix, ['1/1','1/1/12','1/3'])

TypeError: commonprefix() takes 1 positional argument but 2 were given

In [6]: reduce(os.path.commonprefix, ['1/1','1/1/12'])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[6], line 1
----> 1 reduce(os.path.commonprefix, ['1/1','1/1/12'])

TypeError: commonprefix() takes 1 positional argument but 2 were given

In [7]: reduce(os.path.commonprefix, ['1/1'])
Out[7]: '1/1'

but that means that we do not unittest this case at all. this spaghetti code though is too long/deep to craft a test now I think... will just proceed

to_delete = []
for asset in remote_dandiset.get_assets_with_path_prefix(path_prefix):
if any(
Expand Down
Loading