gemseo / utils

Show inherited members

directory_creator module

Tools for the creation of directories.

class gemseo.utils.directory_creator.DirectoryCreator(root_directory='', directory_naming_method=DirectoryNamingMethod.NUMBERED)[source]

Bases: Serializable

A class to create directories.

Initialize self. See help(type(self)) for accurate signature.

Parameters:
  • root_directory (str | Path) –

    The path to the root directory, wherein unique directories will be created. If empty, use the current working directory.

    By default it is set to “”.

  • directory_naming_method (DirectoryNamingMethod) –

    The method to create the directory names.

    By default it is set to “NUMBERED”.

create()[source]

Create a directory.

Returns:

The directory path.

Return type:

Path

property last_directory: Path | None

The last created directory or None if none has been created.

class gemseo.utils.directory_creator.DirectoryNamingMethod(value)[source]

Bases: StrEnum

The method to generate directory names.

NUMBERED = 'NUMBERED'

The generated directories are named by an integer i+1, i+2, i+3 etc, where i is the maximum value of the already existing directories.

UUID = 'UUID'

A unique number based on the UUID function is generated.

This last option shall be used if multiple MDO processes are run in the same working directory. This is multi-process safe.