os_util module
- datumaro.util.os_util.find_files(dirpath: str, exts: Union[str, Iterable[str]], recursive: bool = False, max_depth: Optional[int] = None) Iterator[str] [source]
- datumaro.util.os_util.is_subpath(path: str, base: str) bool [source]
Tests if a path is subpath of another path or the paths are equal.
- datumaro.util.os_util.make_file_name(s: str) str [source]
Normalizes string, converts to lowercase, removes non-alpha characters, and converts spaces to hyphens.
- datumaro.util.os_util.generate_next_name(names: Iterable[str], basename: str, sep: str = '.', suffix: str = '', default: Optional[str] = None) str [source]
Generates the “next” name by appending a next index to the occurrence of the basename with the highest index in the input collection.
Returns: next string name
Example:
- Inputs:
name_abc
name_base
name_base1
name_base5
Basename: name_base
Output: name_base6