repast4py.util module

repast4py.util.find_free_filename(file_path)

Given a file path, check if that file exists, and if so, repeatedly add a numeric infix to that file path until the file does not exist.

For example, if output/counts.csv, exists check if counts_1.csv, counts_2.csv, and so on exists until finding one that doesn’t exist.

Parameters:

file_path (str) – the path to the file to check

Returns:

the path to the unused file

Return type:

Path

repast4py.util.is_empty(lst)

Returns whether or not the specified list of lists is empty.

Parameters:

lst (List[List]) – the list of lists

Returns:

True if the list is empty or all of its nested lists are empty, otherwise False.

Return type:

bool