class_docstr: Automatic detection and parsing of API docs to Sphinx-parsable reST
  format.
docstr: Make a reST API index file from written files.
  
  Parameters
  ----------
  path : string
      Filename to write an index to
  outdir : string
      Directory to which to write generated index file
  froot : string, optional
      root (filename without extension) of filename to write to
      Defaults to 'gen'.  We add ``self.rst_extension``.
  relative_to : string
      path to which written filenames are relative.  This
      component of the written file path will be removed from
      outdir, in the generated index.  Default is None, meaning,
      leave the path as it is.
docstr_tok: ["Make","a","reST","API","index","file","from","written","files",".","Parameters","--","--","--","--","--","path",":","string","Filename","to","write","an","index","to","outdir",":","string","Directory","to","which","to","write","generated","index","file","froot",":","string",",","optional","root","(","filename","without","extension",")","of","filename","to","write","to","Defaults","to","'gen","'",".","We","add","``","self.rst_extension","``",".","relative_to",":","string","path","to","which","written","filenames","are","relative",".","This","component","of","the","written","file","path","will","be","removed","from","outdir",",","in","the","generated","index",".","Default","is","None",",","meaning",",","leave","the","path","as","it","is","."]
code: def write_index(self, outdir, froot="gen", relative_to=None):
      """Make a reST API index file from written files.
  
      Parameters
      ----------
      path : string
          Filename to write an index to
      outdir : string
          Directory to which to write generated index file
      froot : string, optional
          root (filename without extension) of filename to write to
          Defaults to 'gen'.  We add ``self.rst_extension``.
      relative_to : string
          path to which written filenames are relative.  This
          component of the written file path will be removed from
          outdir, in the generated index.  Default is None, meaning,
          leave the path as it is.
      """
      if self.written_modules is None:
          raise ValueError("No modules written")
      # Get full filename path
      path = os.path.join(outdir, froot + self.rst_extension)
      # Path written into index is relative to rootpath
      if relative_to is not None:
          relpath = (outdir + os.path.sep).replace(
              relative_to + os.path.sep, ""
          )
      else:
          relpath = outdir
      idx = open(path, "wt")
      w = idx.write
      w(".. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n")
  
      title = "API Reference"
      w(title + "\n")
      w("=" * len(title) + "\n\n")
      w(".. toctree::\n\n")
      for f in self.written_modules:
          w("   %s\n" % os.path.join(relpath, f))
      idx.close()
  
imports: import ast
  import os
  import re
  from importlib import import_module
  from types import BuiltinFunctionType, FunctionType
  from inspect import ismethod, getmodule
label_desc: Use image node_id 16 for calling the ApiDocWriter obj's underlying member method code with example usage: obj.write_index(outdir, froot, relative_to) without return types