@@ -217,13 +217,11 @@ def _parse_module_with_import(self, uri):
217217 continue
218218 obj = mod .__dict__ [obj_str ]
219219 # Check if function / class defined in module
220- if not self .other_defines and not getmodule (obj ) = = mod :
220+ if not self .other_defines and getmodule (obj ) ! = mod :
221221 continue
222222 # figure out if obj is a function or class
223223 if (
224- hasattr (obj , 'func_name' )
225- or isinstance (obj , BuiltinFunctionType )
226- or isinstance (obj , FunctionType )
224+ hasattr (obj , 'func_name' ) or isinstance (obj , (BuiltinFunctionType , FunctionType ))
227225 ):
228226 functions .append (obj_str )
229227 else :
@@ -278,7 +276,7 @@ def generate_api_doc(self, uri):
278276
279277 # Make a shorter version of the uri that omits the package name for
280278 # titles
281- uri_short = re .sub (r'^%s\.' % self .package_name , '' , uri )
279+ uri_short = re .sub (rf'^ { self .package_name } \.' , '' , uri )
282280
283281 head = '.. AUTO-GENERATED FILE -- DO NOT EDIT!\n \n '
284282 body = ''
@@ -345,7 +343,7 @@ def _survives_exclude(self, matchstr, match_type):
345343 elif match_type == 'package' :
346344 patterns = self .package_skip_patterns
347345 else :
348- raise ValueError ('Cannot interpret match type "%s"' % match_type )
346+ raise ValueError (f 'Cannot interpret match type "{ match_type } "' )
349347 # Match to URI without package name
350348 L = len (self .package_name )
351349 if matchstr [:L ] == self .package_name :
@@ -426,7 +424,7 @@ def write_modules_api(self, modules, outdir):
426424 written_modules = []
427425
428426 for ulm , mods in module_by_ulm .items ():
429- print ('Generating docs for %s:' % ulm )
427+ print (f 'Generating docs for { ulm } :' )
430428 document_head = []
431429 document_body = []
432430
@@ -506,5 +504,5 @@ def write_index(self, outdir, froot='gen', relative_to=None):
506504 w ('=' * len (title ) + '\n \n ' )
507505 w ('.. toctree::\n \n ' )
508506 for f in self .written_modules :
509- w (' %s \n ' % os .path .join (relpath , f ))
507+ w (f ' { os .path .join (relpath , f )} \n ' )
510508 idx .close ()
0 commit comments