utils.io

Module Contents

utils.io.refresh(path, file_pattern)[source]

Clean and create the folder if this does not exist.

Parameters:
  • path – the path containing the files to remove
  • file_pattern – the string pattern of the files to remove
utils.io.get_pattern_pos(pattern, filename)[source]

Return the line number (as string) of the first occurrence of a pattern in filename

Parameters:
  • pattern – the pattern of the string to find
  • filename – the file name containing the pattern to search
Returns:

the line number containing the pattern or “-1” if the pattern was not found

utils.io.files_with_pattern_recur(folder, pattern)[source]

Return all files with a certain pattern in folder+subdirectories

Parameters:
  • folder – the folder to search for
  • pattern – the string to search for
Returns:

the files containing the pattern.

utils.io.write_mat_on_file(fileout, data)[source]

Write the matrix results stored in data to filename_out

Parameters:
  • fileout – the output file
  • data – the data to store in a file
utils.io.replace_str_in_file(filename_out, old_string, new_string)[source]

Replace a string with another in filename_out

Parameters:
  • filename_out – the output file
  • old_string – the old string that should be replaced
  • new_string – the new string replacing old_string
utils.io.replace_str_in_report(report)[source]

Replace nasty strings in COPASI report file.

Parameters:report – the report
utils.io.remove_file_silently(filename)[source]

Remove a filename silently, without reporting warnings or error messages. This is not really needed by Linux, but Windows sometimes fails to remove the file even if this exists.

Parameters:filename – the file to remove
utils.io.git_pull(repo_name)[source]

Pull a git repository.

Parameters:repo_name – the repository to pull
utils.io.git_clone(repo)[source]

Clone a git repository.

Parameters:repo – the repository to clone
utils.io.git_retrieve(repo)[source]

Clone or pull a git repository.

Parameters:repo – the repository to clone or pull