@@ -138,7 +138,9 @@ def parse_name(self) -> bool:
138138 fullname , _ , path , base = match .groups () # type: ignore
139139 except AttributeError :
140140 logger .warning (
141- "invalid signature for auto%s (%r)" % (self .objtype , self .name ),
141+ "invalid signature for auto%s (%r)" ,
142+ self .objtype ,
143+ self .name ,
142144 type = "c_autodoc" ,
143145 )
144146 return False
@@ -213,8 +215,10 @@ def import_object(self, raiseerror: bool = False) -> bool:
213215 else :
214216 logger .warning (
215217 "Unable to find file, %s, in any of the directories %s "
216- "all directories are relative to the top documentation source directory"
217- % (self .get_real_modname (), self .env .config .c_autodoc_roots ),
218+ "all directories are relative to the top documentation source "
219+ "directory" ,
220+ self .get_real_modname (),
221+ self .env .config .c_autodoc_roots ,
218222 location = (self .env .docname , self .directive .lineno ),
219223 )
220224 return False
@@ -230,7 +234,7 @@ def import_object(self, raiseerror: bool = False) -> bool:
230234 modules_dict = self .env .temp_data .setdefault ("c:loaded_modules" , {})
231235
232236 if filename not in modules_dict :
233- with open (filename ) as f :
237+ with open (filename , encoding = "utf-8" ) as f :
234238 contents = [f .read ()]
235239
236240 # let extensions preprocess files
@@ -280,7 +284,8 @@ def get_compilation_database(self) -> Optional[str]:
280284 return filename
281285
282286 logger .warning (
283- 'Compilation database "%s" not found.' % (filename ,),
287+ 'Compilation database "%s" not found.' ,
288+ filename ,
284289 location = (self .env .docname , self .directive .lineno ),
285290 )
286291
@@ -312,7 +317,9 @@ def get_object_members(self, want_all: bool) -> Tuple[bool, List[Tuple[str, Any]
312317 object_members .append ((member , self .object .children [member ]))
313318 else :
314319 logger .warning (
315- 'Missing member "%s" in object "%s"' % (member , self .fullname ),
320+ 'Missing member "%s" in object "%s"' ,
321+ member ,
322+ self .fullname ,
316323 type = "c_autodoc" ,
317324 )
318325
@@ -422,7 +429,8 @@ def __init__(
422429 """
423430 super ().__init__ (directive , name , indent )
424431
425- # Sphinx 3.1 compatibility. 4.0 deprecated the "reporter" attribute. 5.0 removes it.
432+ # Sphinx 3.1 compatibility. 4.0 deprecated the "reporter" attribute. 5.0
433+ # removes it.
426434 reporter = getattr (self .directive , "reporter" , None )
427435
428436 self ._original_directive = self .directive
0 commit comments