@@ -188,7 +188,7 @@ def __init__(self, pointer):
188
188
def new_from_name (operation_name ):
189
189
vop = vips_lib .vips_operation_new (_to_bytes (operation_name ))
190
190
if vop == ffi .NULL :
191
- raise Error ('no such operation {0}' . format ( operation_name ) )
191
+ raise Error (f 'no such operation { operation_name } ' )
192
192
return Operation (vop )
193
193
194
194
def set (self , name , flags , match_image , value ):
@@ -232,18 +232,16 @@ def call(operation_name, *args, **kwargs):
232
232
intro = Introspect .get (operation_name )
233
233
234
234
if len (intro .required_input ) != len (args ):
235
- raise Error ('{0} needs {1} arguments, but {2} given'
236
- .format (operation_name ,
237
- len (intro .required_input ),
238
- len (args )))
235
+ raise Error (f'{ operation_name } needs { len (intro .required_input )} '
236
+ f'arguments, but { len (args )} given' )
239
237
240
238
op = Operation .new_from_name (operation_name )
241
239
242
240
# set any string options before any args so they can't be
243
241
# overridden
244
242
string_options = kwargs .pop ('string_options' , '' )
245
243
if not op .set_string (string_options ):
246
- raise Error ('unable to call {0}' . format ( operation_name ) )
244
+ raise Error (f 'unable to call { operation_name } ' )
247
245
248
246
# the first image argument is the thing we expand constants to
249
247
# match ... look inside tables for images, since we may be passing
@@ -283,8 +281,8 @@ def add_reference(x):
283
281
for name in kwargs :
284
282
if (name not in intro .optional_input and
285
283
name not in intro .optional_output ):
286
- raise Error ('{0 } does not support optional argument {1} '
287
- . format ( operation_name , name ) )
284
+ raise Error (f' { operation_name } does not support optional '
285
+ f'argument { name } ' )
288
286
289
287
value = kwargs [name ]
290
288
details = intro .details [name ]
@@ -300,7 +298,7 @@ def add_reference(x):
300
298
vop = vips_lib .vips_cache_operation_build (op .pointer )
301
299
if vop == ffi .NULL :
302
300
vips_lib .vips_object_unref_outputs (op .vobject )
303
- raise Error ('unable to call {0}' . format ( operation_name ) )
301
+ raise Error (f 'unable to call { operation_name } ' )
304
302
op = Operation (vop )
305
303
306
304
# attach all input refs to output x
@@ -353,7 +351,7 @@ def generate_docstring(operation_name):
353
351
intro = Introspect .get (operation_name )
354
352
if (intro .flags & _OPERATION_DEPRECATED ) != 0 :
355
353
raise Error ('No such operator.' ,
356
- 'operator "{0 }" is deprecated' . format ( operation_name ) )
354
+ f 'operator "{ operation_name } " is deprecated' )
357
355
358
356
result = intro .description [0 ].upper () + intro .description [1 :] + '.\n \n '
359
357
result += 'Example:\n '
@@ -417,7 +415,7 @@ def generate_sphinx(operation_name):
417
415
intro = Introspect .get (operation_name )
418
416
if (intro .flags & _OPERATION_DEPRECATED ) != 0 :
419
417
raise Error ('No such operator.' ,
420
- 'operator "{0 }" is deprecated' . format ( operation_name ) )
418
+ f 'operator "{ operation_name } " is deprecated' )
421
419
422
420
if intro .member_x is not None :
423
421
result = '.. method:: '
@@ -451,14 +449,13 @@ def generate_sphinx(operation_name):
451
449
452
450
for name in intro .method_args + intro .doc_optional_input :
453
451
details = intro .details [name ]
454
- result += (':param {0}: {1}\n ' .
455
- format (name , details ['blurb' ]))
456
- result += (':type {0}: {1}\n ' .
457
- format (name , GValue .gtype_to_python (details ['type' ])))
452
+ result += f':param { name } : { details ["blurb" ]} \n '
453
+ result += (f':type { name } : '
454
+ f'{ GValue .gtype_to_python (details ["type" ])} \n ' )
458
455
for name in intro .doc_optional_output :
459
- result += (':param {0 }: enable output: {1} \n ' .
460
- format ( name , intro .details [name ][' blurb' ]) )
461
- result += ( ':type {0 }: bool\n ' . format ( name ))
456
+ result += (f ':param { name } : '
457
+ f'enable output: { intro .details [name ][" blurb" ] } \n ' )
458
+ result += f ':type { name } : bool\n '
462
459
463
460
output_types = [GValue .gtype_to_python (intro .details [name ]['type' ])
464
461
for name in intro .required_output ]
@@ -532,7 +529,7 @@ def add_name(gtype, a, b):
532
529
print (' .. autosummary::' )
533
530
print (' :nosignatures:\n ' )
534
531
for name in all_names :
535
- print (' ~{0}' . format ( name ) )
532
+ print (f ' ~{ name } ' )
536
533
print ()
537
534
538
535
# Output docs
0 commit comments