MCPcopy Index your code
hub / github.com/ipython/ipython / write_index

Method write_index

docs/sphinxext/apigen.py:433–463  ·  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

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

Callers 1

autogen_api.pyFile · 0.80

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected