File tree Expand file tree Collapse file tree 3 files changed +9
-17
lines changed
Expand file tree Collapse file tree 3 files changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -20,12 +20,11 @@ def main():
2020 except error .StagpyError as err :
2121 if DEBUG :
2222 raise
23+ errtype = type (err ).__name__
2324 print ('Oops! StagPy encountered the following problem while '
24- 'processing your request.' ,
25- 'Please check the path to your simulation and the command line '
26- 'arguments.' , '' ,
27- '{}: {}' .format (err .__class__ .__name__ , err ),
28- sep = '\n ' , file = sys .stderr )
25+ 'processing your request.' , 'Please check the path to your '
26+ 'simulation and the command line arguments.' , '' ,
27+ f'{ errtype } : { err } ' , sep = '\n ' , file = sys .stderr )
2928 sys .exit ()
3029
3130
Original file line number Diff line number Diff line change @@ -27,15 +27,11 @@ def info_cmd():
2727 lstep = sdat .steps [- 1 ]
2828 print (f'StagYY run in { sdat .path } ' )
2929 if lsnap .geom .threed :
30- dimension = '{} x {} x {}' .format (lsnap .geom .nxtot ,
31- lsnap .geom .nytot ,
32- lsnap .geom .nztot )
30+ dimension = '{0.nxtot} x {0.nytot} x {0.nztot}' .format (lsnap .geom )
3331 elif lsnap .geom .twod_xz :
34- dimension = '{} x {}' .format (lsnap .geom .nxtot ,
35- lsnap .geom .nztot )
32+ dimension = '{0.nxtot} x {0.nztot}' .format (lsnap .geom )
3633 else :
37- dimension = '{} x {}' .format (lsnap .geom .nytot ,
38- lsnap .geom .nztot )
34+ dimension = '{0.nytot} x {0.nztot}' .format (lsnap .geom )
3935 if lsnap .geom .cartesian :
4036 print ('Cartesian' , dimension )
4137 elif lsnap .geom .cylindrical :
Original file line number Diff line number Diff line change 99
1010from . import conf
1111
12- INT_FMT = '{:05d}'
13-
1412
1513def out_name (stem , timestep = None ):
1614 """Return StagPy out file name.
@@ -29,7 +27,7 @@ def out_name(stem, timestep=None):
2927 if conf .core .shortname :
3028 return conf .core .outname
3129 if timestep is not None :
32- stem = ( stem + INT_FMT ). format ( timestep )
30+ stem = f' { stem } { timestep :05d } '
3331 return conf .core .outname + '_' + stem
3432
3533
@@ -45,8 +43,7 @@ def scilabel(value, precision=2):
4543 Returns:
4644 str: the scientific notation the specified value.
4745 """
48- fmt = f'{{:.{ precision } e}}'
49- man , exp = fmt .format (value ).split ('e' )
46+ man , exp = f'{ value :.{precision }e} ' .split ('e' )
5047 exp = int (exp )
5148 return fr'{ man } \times 10^{{{ exp } }}'
5249
You can’t perform that action at this time.
0 commit comments