提交 5deb979e authored 作者: James Bergstra's avatar James Bergstra

extending epydoc with local script

上级 a640fca5
...@@ -12,21 +12,13 @@ if os.path.exists(os.path.join(sys.path[0], 'epydoc.py')): ...@@ -12,21 +12,13 @@ if os.path.exists(os.path.join(sys.path[0], 'epydoc.py')):
from epydoc import docintrospecter from epydoc import docintrospecter
from epydoc.apidoc import RoutineDoc from epydoc.apidoc import RoutineDoc
from theano.gof import Op def specialize_to_RoutineDoc(value, value_doc, module_name):
def applicability_test(value):
return isinstance(value, Op)
def introspecter(value, value_doc, module_name):
value_doc.specialize_to(RoutineDoc) value_doc.specialize_to(RoutineDoc)
# print value
# try:
# value_doc.specialize_to(RoutineDoc)
# print 'Yay!', value
# except:
# print value
docintrospecter.register_introspecter(applicability_test, introspecter, priority=-1) docintrospecter.register_introspecter(
lambda value: getattr(value, '__epydoc_asRoutine', False),
specialize_to_RoutineDoc,
priority=-1)
from epydoc.cli import cli from epydoc.cli import cli
cli() cli()
......
...@@ -11,7 +11,7 @@ mkdir -p html/api && mkdir -p html/doc ...@@ -11,7 +11,7 @@ mkdir -p html/api && mkdir -p html/doc
python __init__.py python __init__.py
if [ " $1" != " rst" ]; then if [ " $1" != " rst" ]; then
epydoc --config local.epydoc ./epydoc --config local.epydoc
fi fi
if [ " $1" != " epydoc" ]; then if [ " $1" != " epydoc" ]; then
......
...@@ -527,9 +527,13 @@ def _scal_elemwise(symbol): ...@@ -527,9 +527,13 @@ def _scal_elemwise(symbol):
scalar_op = getattr(scal, symbolname) scalar_op = getattr(scal, symbolname)
rval = elemwise.Elemwise(scalar_op, name=symbolname) rval = elemwise.Elemwise(scalar_op, name=symbolname)
if getattr(symbol, '__doc__', ''): if getattr(symbol, '__doc__', False):
rval.__doc__ = symbol.__doc__ + '\n' + rval.__doc__ rval.__doc__ = symbol.__doc__ + '\n' + rval.__doc__
#for the meaning of this see the ./epydoc script
# it makes epydoc display rval as if it were a function, not an object
rval.__epydoc_asRoutine = True
return rval return rval
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论