utils.operation_utils#

Module Contents#

Functions#

get_tmp_dir

Retrieve the appropriate temporary directory based on the runtime environment.

make_named_temporary_file

Context manager to create a named temporary file.

make_pipeline_named_temporary_file

Context manager to create a named temporary file for pipelines.

make_pipeline_temporary_dir

Context manager to create a temporary directory for pipelines.

make_temporary_dir

Context manager to create a temporary directory.

API#

utils.operation_utils.get_tmp_dir() pathlib.Path#

Retrieve the appropriate temporary directory based on the runtime environment.

Returns: pathlib.Path: Path to the temporary directory.

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.

Args: prefix (Optional[str], optional): Prefix for the file name. Defaults to None. suffix (Optional[str], optional): suffix for the file name. Defaults to None. delete (bool, optional): If True, the file will be deleted upon exit. Defaults to True. target_dir (Optional[pathlib.Path], optional): Directory where the file should be created. Defaults to None.

Yields: Generator[pathlib.Path, None, None]: Path of the created temporary file.

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.

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.

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.

Args: prefix (Optional[str], optional): Prefix for the directory name. Defaults to None. target_dir (Optional[pathlib.Path], optional): Parent directory for the temporary directory. Defaults to None. delete (bool, optional): If True, the directory will be deleted upon exit. Defaults to True.

Yields: Generator[pathlib.Path, None, None]: Path of the created temporary directory.