2929from sphinx .util .compat import Directive
3030import inspect
3131
32+
3233def mangle_docstrings (app , what , name , obj , options , lines ,
3334 reference_offset = [0 ]):
3435
@@ -78,6 +79,7 @@ def mangle_docstrings(app, what, name, obj, options, lines,
7879
7980 reference_offset [0 ] += len (references )
8081
82+
8183def mangle_signature (app , what , name , obj , options , sig , retann ):
8284 # Do not try to inspect classes that don't define `__init__`
8385 if (inspect .isclass (obj ) and
@@ -93,6 +95,7 @@ def mangle_signature(app, what, name, obj, options, sig, retann):
9395 sig = re .sub (u"^[^(]*" , u"" , doc ['Signature' ])
9496 return sig , u''
9597
98+
9699def setup (app , get_doc_object_ = get_doc_object ):
97100 global get_doc_object
98101 get_doc_object = get_doc_object_
@@ -115,6 +118,7 @@ def setup(app, get_doc_object_=get_doc_object):
115118from sphinx .domains .c import CDomain
116119from sphinx .domains .python import PythonDomain
117120
121+
118122class ManglingDomainBase (object ):
119123 directive_mangling_map = {}
120124
@@ -127,6 +131,7 @@ def wrap_mangling_directives(self):
127131 self .directives [name ] = wrap_mangling_directive (
128132 self .directives [name ], objtype )
129133
134+
130135class NumpyPythonDomain (ManglingDomainBase , PythonDomain ):
131136 name = 'np'
132137 directive_mangling_map = {
@@ -139,6 +144,7 @@ class NumpyPythonDomain(ManglingDomainBase, PythonDomain):
139144 'attribute' : 'attribute' ,
140145 }
141146
147+
142148class NumpyCDomain (ManglingDomainBase , CDomain ):
143149 name = 'np-c'
144150 directive_mangling_map = {
@@ -149,6 +155,7 @@ class NumpyCDomain(ManglingDomainBase, CDomain):
149155 'var' : 'object' ,
150156 }
151157
158+
152159def wrap_mangling_directive (base_directive , objtype ):
153160 class directive (base_directive ):
154161 def run (self ):
0 commit comments