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

Class ApiDocWriter

docs/sphinxext/apigen.py:77–463  ·  view source on GitHub ↗

Class for automatic detection and parsing of API docs to Sphinx-parsable reST format

Source from the content-addressed store, hash-verified

75
76# Functions and classes
77class ApiDocWriter:
78 ''' Class for automatic detection and parsing of API docs
79 to Sphinx-parsable reST format'''
80
81 # only separating first two levels
82 rst_section_levels = ['*', '=', '-', '~', '^']
83
84 def __init__(self,
85 package_name,
86 rst_extension='.rst',
87 package_skip_patterns=None,
88 module_skip_patterns=None,
89 names_from__all__=None,
90 ):
91 ''' Initialize package for parsing
92
93 Parameters
94 ----------
95 package_name : string
96 Name of the top-level package. *package_name* must be the
97 name of an importable package
98 rst_extension : string, optional
99 Extension for reST files, default '.rst'
100 package_skip_patterns : None or sequence of {strings, regexps}
101 Sequence of strings giving URIs of packages to be excluded
102 Operates on the package path, starting at (including) the
103 first dot in the package path, after *package_name* - so,
104 if *package_name* is ``sphinx``, then ``sphinx.util`` will
105 result in ``.util`` being passed for earching by these
106 regexps. If is None, gives default. Default is:
107 ['\\.tests$']
108 module_skip_patterns : None or sequence
109 Sequence of strings giving URIs of modules to be excluded
110 Operates on the module name including preceding URI path,
111 back to the first dot after *package_name*. For example
112 ``sphinx.util.console`` results in the string to search of
113 ``.util.console``
114 If is None, gives default. Default is:
115 ['\\.setup$', '\\._']
116 names_from__all__ : set, optional
117 Modules listed in here will be scanned by doing ``from mod import *``,
118 rather than finding function and class definitions by scanning the
119 AST. This is intended for API modules which expose things defined in
120 other files. Modules listed here must define ``__all__`` to avoid
121 exposing everything they import.
122 '''
123 if package_skip_patterns is None:
124 package_skip_patterns = ['\\.tests$']
125 if module_skip_patterns is None:
126 module_skip_patterns = ['\\.setup$', '\\._']
127 self.package_name = package_name
128 self.rst_extension = rst_extension
129 self.package_skip_patterns = package_skip_patterns
130 self.module_skip_patterns = module_skip_patterns
131 self.names_from__all__ = names_from__all__ or set()
132
133 def get_package_name(self):
134 return self._package_name

Callers 1

autogen_api.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…