@@ -114,69 +114,57 @@ def __str__(self):
114114 The contents as a string for printing to the terminal
115115 """
116116
117- info = \
118- f'Machine: { self .machine } \n ' \
117+ info = (
118+ f'Machine: { self .machine } \n '
119119 f' E3SM Supported Machine: { self .e3sm_supported } '
120-
121- if self .e3sm_supported and self .compilers is not None and \
122- self .mpilibs is not None and self .os is not None :
123- info = \
124- f'{ info } \n ' \
125- f' Compilers: { ", " .join (self .compilers )} \n ' \
126- f' MPI libraries: { ", " .join (self .mpilibs )} \n ' \
120+ )
121+
122+ if (
123+ self .e3sm_supported
124+ and self .compilers is not None
125+ and self .mpilibs is not None
126+ and self .os is not None
127+ ):
128+ info = (
129+ f'{ info } \n '
130+ f' Compilers: { ", " .join (self .compilers )} \n '
131+ f' MPI libraries: { ", " .join (self .mpilibs )} \n '
127132 f' OS: { self .os } '
133+ )
128134
129135 info = f'{ info } \n '
130136
131- print_unified = (self .e3sm_unified_activation is not None or
132- self .e3sm_unified_base is not None or
133- self .e3sm_unified_mpi is not None )
137+ print_unified = (
138+ self .e3sm_unified_activation is not None
139+ or self .e3sm_unified_base is not None
140+ or self .e3sm_unified_mpi is not None
141+ )
134142 if print_unified :
135- info = \
136- f'{ info } \n ' \
137- f'E3SM-Unified: '
143+ info = f'{ info } \n E3SM-Unified: '
138144
139145 if self .e3sm_unified_activation is None :
140- info = \
141- f'{ info } \n ' \
142- f' E3SM-Unified is not currently loaded'
146+ info = f'{ info } \n E3SM-Unified is not currently loaded'
143147 else :
144- info = \
145- f'{ info } \n ' \
146- f' Activation: { self .e3sm_unified_activation } '
148+ info = f'{ info } \n Activation: { self .e3sm_unified_activation } '
147149 if self .e3sm_unified_base is not None :
148- info = \
149- f'{ info } \n ' \
150- f' Base path: { self .e3sm_unified_base } '
150+ info = f'{ info } \n Base path: { self .e3sm_unified_base } '
151151 if self .e3sm_unified_mpi is not None :
152- info = \
153- f'{ info } \n ' \
154- f' MPI type: { self .e3sm_unified_mpi } '
152+ info = f'{ info } \n MPI type: { self .e3sm_unified_mpi } '
155153 info = f'{ info } \n '
156154
157155 print_diags = self .diagnostics_base is not None
158156 if print_diags :
159- info = \
160- f'{ info } \n ' \
161- f'Diagnostics: '
157+ info = f'{ info } \n Diagnostics: '
162158
163159 if self .diagnostics_base is not None :
164- info = \
165- f'{ info } \n ' \
166- f' Base path: { self .diagnostics_base } '
160+ info = f'{ info } \n Base path: { self .diagnostics_base } '
167161 info = f'{ info } \n '
168162
169- info = \
170- f'{ info } \n ' \
171- f'Config options: '
163+ info = f'{ info } \n Config options: '
172164 for section in self .config .sections ():
173- info = \
174- f'{ info } \n ' \
175- f' [{ section } ]'
165+ info = f'{ info } \n [{ section } ]'
176166 for key , value in self .config .items (section ):
177- info = \
178- f'{ info } \n ' \
179- f' { key } = { value } '
167+ info = f'{ info } \n { key } = { value } '
180168 info = f'{ info } \n '
181169 return info
182170
@@ -232,30 +220,35 @@ def get_account_defaults(self):
232220 return account , partition , constraint , qos
233221
234222 def _get_config (self ):
235- """ get a parser for config options """
223+ """get a parser for config options"""
236224
237225 config = configparser .ConfigParser (
238- interpolation = configparser .ExtendedInterpolation ())
226+ interpolation = configparser .ExtendedInterpolation ()
227+ )
239228
240229 machine = self .machine
241230 try :
242- cfg_path = \
231+ cfg_path = (
243232 importlib_resources .files ('mache.machines' ) / f'{ machine } .cfg'
233+ )
244234 config .read (str (cfg_path ))
245235 except FileNotFoundError :
246236 # this isn't a known machine so use the default
247- cfg_path = \
237+ cfg_path = (
248238 importlib_resources .files ('mache.machines' ) / 'default.cfg'
239+ )
249240 config .read (str (cfg_path ))
250241
251242 return config
252243
253244 def _parse_compilers_and_mpi (self ):
254- """ Parse the compilers and mpi modules from XML config files """
245+ """Parse the compilers and mpi modules from XML config files"""
255246 machine = self .machine
256247
257- xml_path = (importlib_resources .files ('mache.cime_machine_config' ) /
258- 'config_machines.xml' )
248+ xml_path = (
249+ importlib_resources .files ('mache.cime_machine_config' )
250+ / 'config_machines.xml'
251+ )
259252
260253 root = etree .parse (str (xml_path ))
261254
@@ -299,11 +292,12 @@ def _parse_compilers_and_mpi(self):
299292 self .os = machine_os
300293
301294 def _detect_e3sm_unified (self ):
302- """ Read E3SM-Unified base path and detect whether it is running """
295+ """Read E3SM-Unified base path and detect whether it is running"""
303296 config = self .config
304297
305- if config is not None and \
306- config .has_option ('e3sm_unified' , 'base_path' ):
298+ if config is not None and config .has_option (
299+ 'e3sm_unified' , 'base_path'
300+ ):
307301 self .e3sm_unified_base = config .get ('e3sm_unified' , 'base_path' )
308302
309303 if 'E3SMU_SCRIPT' in os .environ :
@@ -313,10 +307,11 @@ def _detect_e3sm_unified(self):
313307 self .e3sm_unified_mpi = os .environ ['E3SMU_MPI' ].lower ()
314308
315309 def _get_diagnostics_info (self ):
316- """ Get config options related to diagnostics data """
310+ """Get config options related to diagnostics data"""
317311
318312 config = self .config
319313
320- if config is not None and \
321- config .has_option ('diagnostics' , 'base_path' ):
314+ if config is not None and config .has_option (
315+ 'diagnostics' , 'base_path'
316+ ):
322317 self .diagnostics_base = config .get ('diagnostics' , 'base_path' )
0 commit comments