Utilities for working with file paths.
- sleap.io.pathutils.filenames_prefix_change(filenames, old_prefix, new_prefix, missing: Optional[bool] = None, confirm_callback: Optional[Callable] = None)¶
Finds missing files by changing the initial part of paths.
filenames – The list of filenames, needn’t all be missing.
old_prefix – Initial part of path to replace.
new_prefix – Initial part with which to replace it.
missing – List of which files are known to be missing; if not given, then we’ll check each file.
confirm_callback – If given, then we’ll call this before applying change to confirm that user wants to apply the change.
missing, if given) have new data.
- sleap.io.pathutils.find_changed_subpath(old_path: str, new_path: str) Tuple[str, str] ¶
Finds the smallest initial section of path that was changed.
old_path – Old path
new_path – New path
(initial part of old path), (corresponding replacement in new path)
Given a list of filenames, returns list of whether file exists.