nemo_curator.utils.operation_utils

View as Markdown

Module Contents

Functions

NameDescription
get_tmp_dirRetrieve the appropriate temporary directory based on the runtime environment.
make_named_temporary_fileContext manager to create a named temporary file.
make_pipeline_named_temporary_fileContext manager to create a named temporary file for pipelines.
make_pipeline_temporary_dirContext manager to create a temporary directory for pipelines.
make_temporary_dirContext manager to create a temporary directory.

API

nemo_curator.utils.operation_utils.get_tmp_dir() -> pathlib.Path

Retrieve the appropriate temporary directory based on the runtime environment.

Returns: pathlib.Path

pathlib.Path: Path to the temporary directory.

nemo_curator.utils.operation_utils.make_named_temporary_file(
prefix: str | None = None,
suffix: str | None = None,
delete: bool = True,
target_dir: pathlib.Path | None = None
) -> collections.abc.Generator[pathlib.Path, None, None]

Context manager to create a named temporary file.

Parameters:

prefix
Optional[str]Defaults to None

Prefix for the file name. Defaults to None.

suffix
Optional[str]Defaults to None

suffix for the file name. Defaults to None.

delete
boolDefaults to True

If True, the file will be deleted upon exit. Defaults to True.

target_dir
Optional[pathlib.Path]Defaults to None

Directory where the file should be created. Defaults to None.

nemo_curator.utils.operation_utils.make_pipeline_named_temporary_file(
sub_dir: str | None = None,
suffix: str | None = None
) -> collections.abc.Generator[pathlib.Path, None, None]

Context manager to create a named temporary file for pipelines.

nemo_curator.utils.operation_utils.make_pipeline_temporary_dir(
sub_dir: str | None = None
) -> collections.abc.Generator[pathlib.Path, None, None]

Context manager to create a temporary directory for pipelines.

nemo_curator.utils.operation_utils.make_temporary_dir(
prefix: str | None = None,
target_dir: pathlib.Path | None = None,
delete: bool = True
) -> collections.abc.Generator[pathlib.Path, None, None]

Context manager to create a temporary directory.

Parameters:

prefix
Optional[str]Defaults to None

Prefix for the directory name. Defaults to None.

target_dir
Optional[pathlib.Path]Defaults to None

Parent directory for the temporary directory. Defaults to None.

delete
boolDefaults to True

If True, the directory will be deleted upon exit. Defaults to True.