3939 psutil = None
4040
4141
42- class Parameters ( object ) :
42+ class Parameters :
4343 pass
4444
4545
@@ -206,7 +206,7 @@ def __init__(self, interactive: bool = False, returntype: ReturnType = ReturnTyp
206206 try :
207207 self ._runtime_configuration = utils .load_configuration (RUNTIME_CONF_FILE )
208208 except ValueError as exc : # pragma: no cover
209- self .abort ('Error loading %r: %s' % ( RUNTIME_CONF_FILE , exc ) )
209+ self .abort (f 'Error loading { RUNTIME_CONF_FILE !r } : { exc } ' )
210210
211211 self ._processmanagertype = getattr (self ._parameters , 'process_manager' , 'intelmq' )
212212 if self ._processmanagertype not in process_managers ():
@@ -828,13 +828,13 @@ def check(self, no_connections=False):
828828 try :
829829 with open (HARMONIZATION_CONF_FILE ) as file_handle :
830830 files [HARMONIZATION_CONF_FILE ] = json .load (file_handle )
831- except (IOError , ValueError ) as exc : # pragma: no cover
831+ except (OSError , ValueError ) as exc : # pragma: no cover
832832 check_logger .error ('Could not load %r: %s.' , HARMONIZATION_CONF_FILE , exc )
833833 retval = 1
834834 try :
835835 with open (RUNTIME_CONF_FILE ) as file_handle :
836836 files [RUNTIME_CONF_FILE ] = yaml .load (file_handle )
837- except (IOError , ValueError ) as exc :
837+ except (OSError , ValueError ) as exc :
838838 check_logger .error ('Could not load %r: %s.' , RUNTIME_CONF_FILE , exc )
839839 retval = 1
840840 if retval :
@@ -933,7 +933,7 @@ def check(self, no_connections=False):
933933 bot_check = bot .check (bot_parameters )
934934 if bot_check :
935935 for log_line in bot_check :
936- getattr (check_logger , log_line [0 ])("Bot %r: %s" % ( bot_id , log_line [1 ]) )
936+ getattr (check_logger , log_line [0 ])(f "Bot { bot_id !r } : { log_line [1 ]} " )
937937 for group in utils .list_all_bots ().values ():
938938 for bot_id , bot in group .items ():
939939 if subprocess .call (['which' , bot ['module' ]], stdout = subprocess .DEVNULL ,
@@ -1026,7 +1026,7 @@ def upgrade_conf(self, previous=None, dry_run=None, function=None,
10261026 utils .write_configuration (state_file , state , new = True , useyaml = False )
10271027 except Exception as exc :
10281028 self ._logger .error ('Error writing state file %r: %s.' , state_file , exc )
1029- return 1 , 'Error writing state file %r: %s.' % ( state_file , exc )
1029+ return 1 , f 'Error writing state file { state_file !r } : { exc } .'
10301030 self ._logger .info ('Successfully wrote initial state file.' )
10311031
10321032 runtime = utils .load_configuration (RUNTIME_CONF_FILE )
@@ -1241,7 +1241,7 @@ def debug(self, sections=None):
12411241 'CONFIG_DIR' , 'ROOT_DIR' ):
12421242 output ['paths' ][path ] = variables [path ]
12431243 if self ._returntype is ReturnType .TEXT :
1244- print ('%s: %r' % ( path , variables [path ]) )
1244+ print (f' { path } : { variables [path ]!r } ' )
12451245 if sections is None or 'environment_variables' in sections :
12461246 output ['environment_variables' ] = {}
12471247 if self ._returntype is ReturnType .TEXT :
@@ -1251,7 +1251,7 @@ def debug(self, sections=None):
12511251 'PATH' ):
12521252 output ['environment_variables' ][variable ] = os .getenv (variable )
12531253 if self ._returntype is ReturnType .TEXT :
1254- print ('%s: %r' % ( variable , os .getenv (variable )) )
1254+ print (f' { variable } : { os .getenv (variable )!r } ' )
12551255 return 0 , output
12561256
12571257 def log_bot_message (self , status , * args ):
0 commit comments