1010import time
1111import typing
1212from concurrent import futures
13- from typing import Union
1413from pathlib import Path
14+ from typing import Union
15+
1516import psutil
1617
17- # from ..logging import str_error, str_info, str_running, str_success, str_warn
1818from lasso .logging import str_error , str_info , str_running , str_success , str_warn
1919
20+
2021# pylint: disable = too-many-lines
2122
2223DC_STAGE_SETUP = "SETUP"
@@ -337,9 +338,7 @@ def _parse_crash_code(self, crash_code) -> str:
337338 self .logger .info (self ._msg_option .format ("crash-code" , crash_code ))
338339
339340 if not crash_code_ok :
340- err_msg = (
341- f"Invalid crash code '{ crash_code } '. Please use one of: { str (valid_crash_codes )} "
342- )
341+ err_msg = f"Invalid crash code '{ crash_code } '. Please use one of: { valid_crash_codes !s} "
343342 self .logger .error (err_msg )
344343 raise RuntimeError (str_error (err_msg ))
345344
@@ -647,22 +646,21 @@ def run_import(self, pool: futures.ThreadPoolExecutor):
647646 str (i_filepath + counter_offset ),
648647 ]
649648 # indeed there is a parameter file
649+ elif self .use_id_mapping :
650+ args = [
651+ self .diffcrash_home / f"DFC_Import_{ self .crash_code } " ,
652+ "-ID" ,
653+ self .simulation_runs [i_filepath ],
654+ self .project_dir ,
655+ str (i_filepath + counter_offset ),
656+ ]
650657 else :
651- if self .use_id_mapping :
652- args = [
653- self .diffcrash_home / f"DFC_Import_{ self .crash_code } " ,
654- "-ID" ,
655- self .simulation_runs [i_filepath ],
656- self .project_dir ,
657- str (i_filepath + counter_offset ),
658- ]
659- else :
660- args = [
661- self .diffcrash_home / f"DFC_Import_{ self .crash_code } " ,
662- self .simulation_runs [i_filepath ],
663- self .project_dir ,
664- str (i_filepath + counter_offset ),
665- ]
658+ args = [
659+ self .diffcrash_home / f"DFC_Import_{ self .crash_code } " ,
660+ self .simulation_runs [i_filepath ],
661+ self .project_dir ,
662+ str (i_filepath + counter_offset ),
663+ ]
666664
667665 # append args to list
668666 import_arguments .append (args )
@@ -689,7 +687,11 @@ def run_import(self, pool: futures.ThreadPoolExecutor):
689687
690688 if n_imports_finished != n_new_imports_finished :
691689 # pylint: disable = consider-using-f-string
692- msg = f"Running Imports ... [{ n_new_imports_finished } /{ len (return_code_futures )} ] - { percentage :3.2f} %\r "
690+ msg = (
691+ f"Running Imports ... [{ n_new_imports_finished } /{ len (return_code_futures )} ] - "
692+ f"{ percentage :3.2f} %\r "
693+ )
694+
693695 print (str_running (msg ), end = "" , flush = True )
694696 self .logger .info (msg )
695697
@@ -1206,7 +1208,7 @@ def read_config_file(self, config_file: str) -> list[str]:
12061208 conf_lines = conf .readlines ()
12071209 line = 0
12081210
1209- for i in range (0 , len (conf_lines )):
1211+ for i in range (len (conf_lines )):
12101212 if conf_lines [i ].find ("FUNCTION" ) >= 0 :
12111213 line = i + 1
12121214 break
@@ -1216,7 +1218,7 @@ def read_config_file(self, config_file: str) -> list[str]:
12161218 if line != 0 :
12171219 while 1 :
12181220 while 1 :
1219- for i in range (0 , len (conf_lines [line ])):
1221+ for i in range (len (conf_lines [line ])):
12201222 if conf_lines [line ][i ] == "<" :
12211223 element_start = i + 1
12221224 if conf_lines [line ][i ] == ">" :
@@ -1231,7 +1233,7 @@ def read_config_file(self, config_file: str) -> list[str]:
12311233 j += 1
12321234 items = check .split (" " )
12331235 pos = - 1
1234- for n in range (0 , len (items )):
1236+ for n in range (len (items )):
12351237 if items [n ].startswith ("!" ):
12361238 msg = f"FOUND at { n } "
12371239 print (msg )
@@ -1240,7 +1242,7 @@ def read_config_file(self, config_file: str) -> list[str]:
12401242 break
12411243 pos = len (items )
12421244
1243- for n in range (0 , pos ):
1245+ for n in range (pos ):
12441246 if items [n ] == "PDMX" or items [n ] == "pdmx" :
12451247 break
12461248 if items [n ] == "PDXMX" or items [n ] == "pdxmx" :
@@ -1262,7 +1264,7 @@ def read_config_file(self, config_file: str) -> list[str]:
12621264
12631265 for k in range (n , pos ):
12641266 postval = None
1265- for m in range (0 , n ):
1267+ for m in range (n ):
12661268 if items [m ] == "coordinates" :
12671269 items [m ] = "geometry"
12681270 if postval is None :
0 commit comments