HOTFIX: ensure path casting in tracker
All checks were successful
Pytest / pytest (3.12) (push) Successful in 1m17s
Pytest / pytest (3.13) (push) Successful in 1m11s
Ruff / ruff (push) Successful in 59s
Mypy / mypy (push) Successful in 1m11s
Pytest / pytest (3.14) (push) Successful in 1m14s

This commit is contained in:
Justus Kuhlmann 2026-05-06 16:52:07 +02:00
commit 075cb2f756
Signed by: jkuhl
GPG key ID: 00ED992DD79B85A6

View file

@ -21,6 +21,7 @@ def get_tracker(path: Path) -> str:
tracker: str
The tracker used in the dataset.
"""
path = Path(path)
config_path = path / CONFIG_FILENAME
config = ConfigParser()
if os.path.exists(config_path):
@ -42,6 +43,7 @@ def get(path: Path, file: Path) -> None:
file: str
The file to get.
"""
path = Path(path)
tracker = get_tracker(path)
if tracker == 'datalad':
if file == get_db_file(path):
@ -70,6 +72,7 @@ def save(path: Path, message: str, files: Optional[list[Path]]=None) -> None:
files: list[str], optional
The files to save. If None, all changes are saved.
"""
path = Path(path)
tracker = get_tracker(path)
if tracker == 'datalad':
if files is not None:
@ -93,6 +96,7 @@ def init(path: Path, tracker: str='datalad') -> None:
tracker: str
The tracker to use. Currently only 'datalad' and 'None' are supported.
"""
path = Path(path)
if tracker == 'datalad':
dl.create(path)
elif tracker == 'None':
@ -113,6 +117,7 @@ def unlock(path: Path, file: Path) -> None:
file : str
The file to unlock.
"""
path = Path(path)
tracker = get_tracker(path)
if tracker == 'datalad':
dl.unlock(os.path.join(path, file), dataset=path)
@ -136,6 +141,7 @@ def clone(path: Path, source: str, target: str) -> None:
target: str
The target path to clone the dataset to.
"""
path = Path(path)
tracker = get_tracker(path)
if tracker == 'datalad':
dl.clone(target=target, source=source, dataset=path)
@ -159,6 +165,7 @@ def drop(path: Path, reckless: Optional[str]=None) -> None:
reckless: Optional[str]
The datalad's reckless option for dropping data.
"""
path = Path(path)
tracker = get_tracker(path)
if tracker == 'datalad':
dl.drop(path, reckless=reckless)