MCPcopy Create free account
hub / github.com/ipython/ipython / write_index

Method write_index

docs/sphinxext/apigen.py:423–453  ·  view source on GitHub ↗

Make a reST API index file from written files Parameters ---------- outdir : string Directory to which to write generated index file path : string Filename to write index to relative_to : string path to which written filena

(self, outdir, path='gen.rst', relative_to=None)

Source from the content-addressed store, hash-verified

421 self.write_modules_api(modules,outdir)
422
423 def write_index(self, outdir, path='gen.rst', relative_to=None):
424 """Make a reST API index file from written files
425
426 Parameters
427 ----------
428 outdir : string
429 Directory to which to write generated index file
430 path : string
431 Filename to write index to
432 relative_to : string
433 path to which written filenames are relative. This
434 component of the written file path will be removed from
435 outdir, in the generated index. Default is None, meaning,
436 leave path as it is.
437 """
438 if self.written_modules is None:
439 raise ValueError('No modules written')
440 # Get full filename path
441 path = os.path.join(outdir, path)
442 # Path written into index is relative to rootpath
443 if relative_to is not None:
444 relpath = outdir.replace(relative_to + os.path.sep, '')
445 else:
446 relpath = outdir
447 with open(path,'wt') as idx:
448 w = idx.write
449 w('.. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n')
450 w('.. autosummary::\n'
451 ' :toctree: %s\n\n' % relpath)
452 for mod in self.written_modules:
453 w(' %s\n' % mod)

Callers 1

autogen_api.pyFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected