Skip to content

Commit e5b4851

Browse files
committed
STY: PEP8 in doc/tools
1 parent f16abaf commit e5b4851

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

doc/tools/apigen.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(self,
4040
rst_extension='.txt',
4141
package_skip_patterns=None,
4242
module_skip_patterns=None,
43-
other_defines = True
43+
other_defines=True
4444
):
4545
''' Initialize package for parsing
4646
@@ -162,7 +162,7 @@ def _uri2path(self, uri):
162162
path = path.replace('.', os.path.sep)
163163
path = os.path.join(self.root_path, path)
164164
# XXX maybe check for extensions as well?
165-
if os.path.exists(path + '.py'): # file
165+
if os.path.exists(path + '.py'): # file
166166
path += '.py'
167167
elif os.path.exists(os.path.join(path, '__init__.py')):
168168
path = os.path.join(path, '__init__.py')
@@ -184,7 +184,7 @@ def _parse_module(self, uri):
184184
if filename is None:
185185
print(filename, 'erk')
186186
# nothing that we could handle here.
187-
return ([],[])
187+
return ([], [])
188188

189189
f = open(filename, 'rt')
190190
functions, classes = self._parse_lines(f)
@@ -276,7 +276,7 @@ def generate_api_doc(self, uri):
276276

277277
# Make a shorter version of the uri that omits the package name for
278278
# titles
279-
uri_short = re.sub(r'^%s\.' % self.package_name,'',uri)
279+
uri_short = re.sub(r'^%s\.' % self.package_name, '', uri)
280280

281281
head = '.. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n'
282282
body = ''
@@ -300,10 +300,10 @@ def generate_api_doc(self, uri):
300300
body += '\n.. autoclass:: ' + c + '\n'
301301
# must NOT exclude from index to keep cross-refs working
302302
body += ' :members:\n' \
303-
' :undoc-members:\n' \
304-
' :show-inheritance:\n' \
305-
'\n' \
306-
' .. automethod:: __init__\n\n'
303+
' :undoc-members:\n' \
304+
' :show-inheritance:\n' \
305+
'\n' \
306+
' .. automethod:: __init__\n\n'
307307
head += '.. autosummary::\n\n'
308308
for f in classes + functions:
309309
head += ' ' + f + '\n'
@@ -402,7 +402,7 @@ def discover_modules(self):
402402
package_uri = '.'.join((root_uri, subpkg_name))
403403
package_path = self._uri2path(package_uri)
404404
if (package_path and
405-
self._survives_exclude(package_uri, 'package')):
405+
self._survives_exclude(package_uri, 'package')):
406406
modules.append(package_uri)
407407

408408
return sorted(modules)
@@ -467,7 +467,7 @@ def write_api_docs(self, outdir):
467467
os.mkdir(outdir)
468468
# compose list of modules
469469
modules = self.discover_modules()
470-
self.write_modules_api(modules,outdir)
470+
self.write_modules_api(modules, outdir)
471471

472472
def write_index(self, outdir, froot='gen', relative_to=None):
473473
"""Make a reST API index file from written files
@@ -493,10 +493,11 @@ def write_index(self, outdir, froot='gen', relative_to=None):
493493
path = os.path.join(outdir, froot+self.rst_extension)
494494
# Path written into index is relative to rootpath
495495
if relative_to is not None:
496-
relpath = (outdir + os.path.sep).replace(relative_to + os.path.sep, '')
496+
relpath = (
497+
outdir + os.path.sep).replace(relative_to + os.path.sep, '')
497498
else:
498499
relpath = outdir
499-
idx = open(path,'wt')
500+
idx = open(path, 'wt')
500501
w = idx.write
501502
w('.. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n')
502503

@@ -505,5 +506,5 @@ def write_index(self, outdir, froot='gen', relative_to=None):
505506
w("=" * len(title) + "\n\n")
506507
w('.. toctree::\n\n')
507508
for f in self.written_modules:
508-
w(' %s\n' % os.path.join(relpath,f))
509+
w(' %s\n' % os.path.join(relpath, f))
509510
idx.close()

doc/tools/build_modref_templates.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
# version comparison
1515
from distutils.version import LooseVersion as V
1616

17-
#*****************************************************************************
17+
# *****************************************************************************
18+
1819

1920
def abort(error):
2021
print('*WARNING* API documentation not generated: %s' % error)

0 commit comments

Comments
 (0)