os_util module

datumaro.util.os_util.check_instruction_set(instruction)[source]
datumaro.util.os_util.import_foreign_module(name, path)[source]
datumaro.util.os_util.walk(path, max_depth=None)[source]
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.copytree(src, dst)[source]
datumaro.util.os_util.suppress_output(stdout: bool = True, stderr: bool = False)[source]
datumaro.util.os_util.catch_output()[source]
datumaro.util.os_util.dir_items(path, ext, truncate_ext=False)[source]
datumaro.util.os_util.split_path(path)[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