Skip to content

Commit a2a5bc0

Browse files
yarikopticclaude
andcommitted
Fix type annotation in upload sync path prefix calculation
Replace incorrect use of reduce() with direct os.path.commonprefix() call. The original code used reduce() incorrectly - os.path.commonprefix() already accepts a list of paths and returns the longest common prefix. This removes one type: ignore comment and improves code clarity. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent a3dd9f9 commit a2a5bc0

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

dandi/upload.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from collections.abc import Iterator, Sequence
55
from contextlib import ExitStack
66
from enum import Enum
7-
from functools import reduce
87
import io
98
import os.path
109
from pathlib import Path
@@ -493,7 +492,7 @@ def upload_agg(*ignored: Any) -> str:
493492
for p in paths:
494493
rp = os.path.relpath(p, dandiset.path)
495494
relpaths.append("" if rp == "." else rp)
496-
path_prefix = reduce(os.path.commonprefix, relpaths) # type: ignore[arg-type]
495+
path_prefix = os.path.commonprefix(relpaths)
497496
to_delete = []
498497
for asset in remote_dandiset.get_assets_with_path_prefix(path_prefix):
499498
if any(

0 commit comments

Comments
 (0)