@@ -101,7 +101,6 @@ class are included in the generated documentation. Defaults to ``False``.
101101# actually built.
102102
103103import inspect
104- import io
105104import os
106105import re
107106import sys
@@ -112,11 +111,6 @@ class are included in the generated documentation. Defaults to ``False``.
112111
113112__all__ = []
114113
115- if sys .version_info [0 ] == 3 :
116- text_type = str
117- else :
118- text_type = unicode # noqa
119-
120114automod_templ_modheader = """
121115{modname} {pkgormod}
122116{modhds}{pkgormodhds}
@@ -377,14 +371,14 @@ def automodapi_replace(sourcestr, app, dotoctree=True, docname=None,
377371 if app .config .automodapi_writereprocessed :
378372 # sometimes they are unicode, sometimes not, depending on how
379373 # sphinx has processed things
380- if isinstance (newsourcestr , text_type ):
374+ if isinstance (newsourcestr , str ):
381375 ustr = newsourcestr
382376 else :
383377 ustr = newsourcestr .decode (app .config .source_encoding )
384378
385379 if docname is None :
386- with io . open (os .path .join (app .srcdir , 'unknown.automodapi' ),
387- 'a' , encoding = 'utf8' ) as f :
380+ with open (os .path .join (app .srcdir , 'unknown.automodapi' ),
381+ 'a' , encoding = 'utf8' ) as f :
388382 f .write (u'\n **NEW DOC**\n \n ' )
389383 f .write (ustr )
390384 else :
@@ -394,8 +388,8 @@ def automodapi_replace(sourcestr, app, dotoctree=True, docname=None,
394388 filename = docname + os .path .splitext (env .doc2path (docname ))[1 ]
395389 filename += '.automodapi'
396390
397- with io . open (os .path .join (app .srcdir , filename ), 'w' ,
398- encoding = 'utf8' ) as f :
391+ with open (os .path .join (app .srcdir , filename ), 'w' ,
392+ encoding = 'utf8' ) as f :
399393 f .write (ustr )
400394
401395 return newsourcestr
0 commit comments