carputils
Doxygen code documentation for the python framework controlling openCARP
|
Functions for cleaning directories and manage overwrite behavior. More...
Functions | |
def | clean_directory (filelist=None, globstr=None, regex=None) |
Remove the specified files. More... | |
def | overwrite_mode_prompt (name, directory) |
def | overwrite_mode_error (name, directory) |
def | overwrite_check (name, mode='prompt') |
Make sure the user does not overwrite an existing output directory. More... | |
Variables | |
bool | OVERWRITE_CHECK = True |
bool | CLEAN_BATCH = False |
int | CLEAN_REMOVED_COUNT = 0 |
dictionary | OVERWRITE_MODES |
Functions for cleaning directories and manage overwrite behavior.
def carputils.clean.clean_directory | ( | filelist = None , |
|
globstr = None , |
|||
regex = None |
|||
) |
Remove the specified files.
This convenience method is provided to minimise duplication of directory cleanup code in run scripts. Files and directories can be specified by an explicit list, glob expression or regular expression. The user is prompted with a list of files to be removed before anything is done. Exits the program when done.
filelist | list of str List of file and directory names to be removed. |
globstr | str Glob expression (e.g. 'output_*' to match files and directories for removal). |
regex | str Regular expression (e.g. '^output_\\d{4}' ) to match files and directories for removal. |
def carputils.clean.overwrite_check | ( | name, | |
mode = 'prompt' |
|||
) |
Make sure the user does not overwrite an existing output directory.
simID | str The simulation output directory. |
mode | str, optional The overwrite mode - one of 'append','prompt', 'error', 'delete' or 'overwrite' |
def carputils.clean.overwrite_mode_error | ( | name, | |
directory | |||
) |
def carputils.clean.overwrite_mode_prompt | ( | name, | |
directory | |||
) |
bool carputils.clean.CLEAN_BATCH = False |
int carputils.clean.CLEAN_REMOVED_COUNT = 0 |
bool carputils.clean.OVERWRITE_CHECK = True |