Coverage for model_workflow/tools/remove_trash.py: 100%
10 statements
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-23 10:54 +0000
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-23 10:54 +0000
1from glob import glob
2from os import remove
3from os.path import exists
5# Remove trash files
6def remove_trash (directory : str):
7 # Remove this time.txt file which is beeing created sometimes and I don't know where it comes from
8 trash = [ directory + '/time.txt' ]
9 # Find gromacs backups
10 trash += glob(directory + '/#*')
11 # Find reduced trajectories
12 trash += glob(directory + '/f*.trajectory.xtc')
13 # Remove each trash file
14 for filepath in trash:
15 if exists(filepath):
16 remove(filepath)