biogeme.tools.files module

class biogeme.tools.files.TemporaryFile[source]

Bases: object

remove()[source]
biogeme.tools.files.create_backup(filename, rename=True)[source]

If the file exist, we create a backup copy.

Parameters:
  • filename (str) – name of the file

  • rename (bool) – if True, the file is renamed. If False, a copy is made.

Return type:

str

biogeme.tools.files.files_of_type(extension, name, all_files=False)[source]

Identify the list of files with a given extension in the local directory

Parameters:
  • extension (str) – extension of the requested files (without the dot): ‘yaml’, or ‘html’

  • name (str) – filename, without extension

  • all_files (bool) – if all_files is False, only files containing the name of the model are identified. If all_files is True, all files with the requested extension are identified.

Return type:

list[str]

Returns:

list of files with the requested extension.

biogeme.tools.files.is_valid_filename(filename)[source]

Verifies is a string is a valid filename

Return type:

tuple[bool, str]

Parameters:

filename (str)