10
10
import time
11
11
import typing
12
12
from concurrent import futures
13
- from typing import Union
14
13
from pathlib import Path
14
+ from typing import Union
15
+
15
16
import psutil
16
17
17
- # from ..logging import str_error, str_info, str_running, str_success, str_warn
18
18
from lasso .logging import str_error , str_info , str_running , str_success , str_warn
19
19
20
+
20
21
# pylint: disable = too-many-lines
21
22
22
23
DC_STAGE_SETUP = "SETUP"
@@ -337,9 +338,7 @@ def _parse_crash_code(self, crash_code) -> str:
337
338
self .logger .info (self ._msg_option .format ("crash-code" , crash_code ))
338
339
339
340
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} "
343
342
self .logger .error (err_msg )
344
343
raise RuntimeError (str_error (err_msg ))
345
344
@@ -647,22 +646,21 @@ def run_import(self, pool: futures.ThreadPoolExecutor):
647
646
str (i_filepath + counter_offset ),
648
647
]
649
648
# 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
+ ]
650
657
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
+ ]
666
664
667
665
# append args to list
668
666
import_arguments .append (args )
@@ -689,7 +687,11 @@ def run_import(self, pool: futures.ThreadPoolExecutor):
689
687
690
688
if n_imports_finished != n_new_imports_finished :
691
689
# 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
+
693
695
print (str_running (msg ), end = "" , flush = True )
694
696
self .logger .info (msg )
695
697
@@ -1206,7 +1208,7 @@ def read_config_file(self, config_file: str) -> list[str]:
1206
1208
conf_lines = conf .readlines ()
1207
1209
line = 0
1208
1210
1209
- for i in range (0 , len (conf_lines )):
1211
+ for i in range (len (conf_lines )):
1210
1212
if conf_lines [i ].find ("FUNCTION" ) >= 0 :
1211
1213
line = i + 1
1212
1214
break
@@ -1216,7 +1218,7 @@ def read_config_file(self, config_file: str) -> list[str]:
1216
1218
if line != 0 :
1217
1219
while 1 :
1218
1220
while 1 :
1219
- for i in range (0 , len (conf_lines [line ])):
1221
+ for i in range (len (conf_lines [line ])):
1220
1222
if conf_lines [line ][i ] == "<" :
1221
1223
element_start = i + 1
1222
1224
if conf_lines [line ][i ] == ">" :
@@ -1231,7 +1233,7 @@ def read_config_file(self, config_file: str) -> list[str]:
1231
1233
j += 1
1232
1234
items = check .split (" " )
1233
1235
pos = - 1
1234
- for n in range (0 , len (items )):
1236
+ for n in range (len (items )):
1235
1237
if items [n ].startswith ("!" ):
1236
1238
msg = f"FOUND at { n } "
1237
1239
print (msg )
@@ -1240,7 +1242,7 @@ def read_config_file(self, config_file: str) -> list[str]:
1240
1242
break
1241
1243
pos = len (items )
1242
1244
1243
- for n in range (0 , pos ):
1245
+ for n in range (pos ):
1244
1246
if items [n ] == "PDMX" or items [n ] == "pdmx" :
1245
1247
break
1246
1248
if items [n ] == "PDXMX" or items [n ] == "pdxmx" :
@@ -1262,7 +1264,7 @@ def read_config_file(self, config_file: str) -> list[str]:
1262
1264
1263
1265
for k in range (n , pos ):
1264
1266
postval = None
1265
- for m in range (0 , n ):
1267
+ for m in range (n ):
1266
1268
if items [m ] == "coordinates" :
1267
1269
items [m ] = "geometry"
1268
1270
if postval is None :
0 commit comments