@@ -159,7 +159,7 @@ def __init__(self, server, *, username=None, password=None, token=None):
159159 transport = transport ,
160160 allow_none = True ,
161161 )
162- except ( IOError , OSError ) :
162+ except OSError :
163163 raise exceptions .APIError (f'Unable to connect to { self ._server } ' )
164164
165165 self ._client = rpc
@@ -269,8 +269,8 @@ def patch_list(
269269 state_id = self ._state_id_by_name (state )
270270 if state_id == 0 :
271271 sys .stderr .write (
272- "Note: No State found matching %s *, "
273- "ignoring filter\n " % state
272+ f "Note: No State found matching { state } *, "
273+ f "ignoring filter\n "
274274 )
275275 else :
276276 filters ['state_id' ] = state_id
@@ -279,8 +279,8 @@ def patch_list(
279279 project_id = self ._project_id_by_name (project )
280280 if project_id == 0 :
281281 sys .stderr .write (
282- "Note: No Project found matching %s , "
283- "ignoring filter\n " % project
282+ f "Note: No Project found matching { project } , "
283+ f "ignoring filter\n "
284284 )
285285 else :
286286 filters ['project_id' ] = project_id
@@ -296,7 +296,7 @@ def patch_list(
296296 person_ids = self ._person_ids_by_name (submitter )
297297 if len (person_ids ) == 0 :
298298 sys .stderr .write (
299- "Note: Nobody found matching *%s *\n " % submitter
299+ f "Note: Nobody found matching *{ submitter } *\n "
300300 )
301301 else :
302302 for person_id in person_ids :
@@ -308,9 +308,7 @@ def patch_list(
308308 patches = []
309309 delegate_ids = self ._person_ids_by_name (delegate )
310310 if len (delegate_ids ) == 0 :
311- sys .stderr .write (
312- "Note: Nobody found matching *%s*\n " % delegate
313- )
311+ sys .stderr .write (f"Note: Nobody found matching *{ delegate } *\n " )
314312 else :
315313 for delegate_id in delegate_ids :
316314 filters ['delegate_id' ] = delegate_id
@@ -324,7 +322,7 @@ def patch_get(self, patch_id):
324322 patch = self ._client .patch_get (patch_id )
325323 if patch == {}:
326324 raise exceptions .APIError (
327- 'Unable to fetch patch %d ; does it exist?' % patch_id
325+ f 'Unable to fetch patch { patch_id } ; does it exist?'
328326 )
329327
330328 return self ._decode_patch (patch )
@@ -341,7 +339,7 @@ def patch_get_mbox(self, patch_id):
341339 mbox = self ._client .patch_get_mbox (patch_id )
342340 if len (mbox ) == 0 :
343341 raise exceptions .APIError (
344- 'Unable to fetch mbox for patch %d ; does it exist?' % patch_id
342+ f 'Unable to fetch mbox for patch { patch_id } ; does it exist?'
345343 )
346344
347345 return mbox , patch ['filename' ]
@@ -361,9 +359,7 @@ def patch_set(
361359 if state :
362360 state_id = self ._state_id_by_name (state )
363361 if state_id == 0 :
364- raise exceptions .APIError (
365- 'No State found matching %s*' % state
366- )
362+ raise exceptions .APIError (f'No State found matching { state } *' )
367363 sys .exit (1 )
368364
369365 params ['state' ] = state_id
@@ -377,9 +373,7 @@ def patch_set(
377373 try :
378374 self ._client .patch_set (patch_id , params )
379375 except xmlrpclib .Fault as f :
380- raise exceptions .APIError (
381- 'Error updating patch: %s' % f .faultString
382- )
376+ raise exceptions .APIError (f'Error updating patch: { f .faultString } ' )
383377
384378 # states
385379
@@ -423,9 +417,7 @@ def check_create(
423417 description ,
424418 )
425419 except xmlrpclib .Fault as f :
426- raise exceptions .APIError (
427- 'Error creating check: %s' % f .faultString
428- )
420+ raise exceptions .APIError (f'Error creating check: { f .faultString } ' )
429421
430422
431423class REST (API ):
0 commit comments