@@ -138,7 +138,7 @@ def _process_param(self, param, desc, fake_autosummary):
138
138
# XXX: If changing the following, please check the rendering when param
139
139
# ends with '_', e.g. 'word_'
140
140
# See https://github.com/numpy/numpydoc/pull/144
141
- display_param = '**%s **' % param
141
+ display_param = f '**{ param } **'
142
142
143
143
if not fake_autosummary :
144
144
return display_param , desc
@@ -156,14 +156,12 @@ def _process_param(self, param, desc, fake_autosummary):
156
156
157
157
prefix = getattr (self , '_name' , '' )
158
158
if prefix :
159
- link_prefix = '%s.' % prefix
159
+ link_prefix = f' { prefix } .'
160
160
else :
161
161
link_prefix = ''
162
162
163
163
# Referenced object has a docstring
164
- display_param = ':obj:`%s <%s%s>`' % (param ,
165
- link_prefix ,
166
- param )
164
+ display_param = f':obj:`{ param } <{ link_prefix } { param } >`'
167
165
if obj_doc :
168
166
# Overwrite desc. Take summary logic of autosummary
169
167
desc = re .split (r'\n\s*\n' , obj_doc .strip (), 1 )[0 ]
@@ -239,11 +237,11 @@ def _str_member_list(self, name):
239
237
"""
240
238
out = []
241
239
if self [name ]:
242
- out += ['.. rubric:: %s' % name , '' ]
240
+ out += [f '.. rubric:: { name } ' , '' ]
243
241
prefix = getattr (self , '_name' , '' )
244
242
245
243
if prefix :
246
- prefix = '~%s.' % prefix
244
+ prefix = f'~ { prefix } .'
247
245
248
246
autosum = []
249
247
others = []
@@ -259,7 +257,7 @@ def _str_member_list(self, name):
259
257
260
258
if param_obj and pydoc .getdoc (param_obj ):
261
259
# Referenced object has a docstring
262
- autosum += [" %s%s" % ( prefix , param .name ) ]
260
+ autosum += [f " { prefix } { param .name } " ]
263
261
else :
264
262
others .append (param )
265
263
@@ -279,7 +277,7 @@ def _str_member_list(self, name):
279
277
desc = " " .join (x .strip ()
280
278
for x in param .desc ).strip ()
281
279
if param .type :
282
- desc = "(%s) %s" % ( param .type , desc )
280
+ desc = f"( { param .type } ) { desc } "
283
281
out += [fmt % (name , desc )]
284
282
out += [hdr ]
285
283
out += ['' ]
@@ -316,14 +314,14 @@ def _str_index(self):
316
314
if len (idx ) == 0 :
317
315
return out
318
316
319
- out += [' .. index:: %s' % idx .get ('default' , '' )]
317
+ out += [f" .. index:: { idx .get ('default' , '' )} " ]
320
318
for section , references in idx .items ():
321
319
if section == 'default' :
322
320
continue
323
321
elif section == 'refguide' :
324
- out += [' single: %s' % ( ' , ' .join (references )) ]
322
+ out += [f" single: { ' , ' .join (references )} " ]
325
323
else :
326
- out += [' %s: %s' % ( section , ',' .join (references )) ]
324
+ out += [f" { section } : { ',' .join (references )} " ]
327
325
out += ['' ]
328
326
return out
329
327
@@ -343,7 +341,7 @@ def _str_references(self):
343
341
m = re .match (r'.. \[([a-z0-9._-]+)\]' , line , re .I )
344
342
if m :
345
343
items .append (m .group (1 ))
346
- out += [' ' + ", " .join (["[%s ]_" % item for item in items ]), '' ]
344
+ out += [' ' + ", " .join ([f"[ { item } ]_" for item in items ]), '' ]
347
345
return out
348
346
349
347
def _str_examples (self ):
0 commit comments