@@ -159,7 +159,7 @@ def __init__(self, server, *, username=None, password=None, token=None):
159
159
transport = transport ,
160
160
allow_none = True ,
161
161
)
162
- except ( IOError , OSError ) :
162
+ except OSError :
163
163
raise exceptions .APIError (f'Unable to connect to { self ._server } ' )
164
164
165
165
self ._client = rpc
@@ -269,8 +269,8 @@ def patch_list(
269
269
state_id = self ._state_id_by_name (state )
270
270
if state_id == 0 :
271
271
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 "
274
274
)
275
275
else :
276
276
filters ['state_id' ] = state_id
@@ -279,8 +279,8 @@ def patch_list(
279
279
project_id = self ._project_id_by_name (project )
280
280
if project_id == 0 :
281
281
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 "
284
284
)
285
285
else :
286
286
filters ['project_id' ] = project_id
@@ -296,7 +296,7 @@ def patch_list(
296
296
person_ids = self ._person_ids_by_name (submitter )
297
297
if len (person_ids ) == 0 :
298
298
sys .stderr .write (
299
- "Note: Nobody found matching *%s *\n " % submitter
299
+ f "Note: Nobody found matching *{ submitter } *\n "
300
300
)
301
301
else :
302
302
for person_id in person_ids :
@@ -308,9 +308,7 @@ def patch_list(
308
308
patches = []
309
309
delegate_ids = self ._person_ids_by_name (delegate )
310
310
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 " )
314
312
else :
315
313
for delegate_id in delegate_ids :
316
314
filters ['delegate_id' ] = delegate_id
@@ -324,7 +322,7 @@ def patch_get(self, patch_id):
324
322
patch = self ._client .patch_get (patch_id )
325
323
if patch == {}:
326
324
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?'
328
326
)
329
327
330
328
return self ._decode_patch (patch )
@@ -341,7 +339,7 @@ def patch_get_mbox(self, patch_id):
341
339
mbox = self ._client .patch_get_mbox (patch_id )
342
340
if len (mbox ) == 0 :
343
341
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?'
345
343
)
346
344
347
345
return mbox , patch ['filename' ]
@@ -361,9 +359,7 @@ def patch_set(
361
359
if state :
362
360
state_id = self ._state_id_by_name (state )
363
361
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 } *' )
367
363
sys .exit (1 )
368
364
369
365
params ['state' ] = state_id
@@ -377,9 +373,7 @@ def patch_set(
377
373
try :
378
374
self ._client .patch_set (patch_id , params )
379
375
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 } ' )
383
377
384
378
# states
385
379
@@ -423,9 +417,7 @@ def check_create(
423
417
description ,
424
418
)
425
419
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 } ' )
429
421
430
422
431
423
class REST (API ):
0 commit comments