From e8eb240050b0bc309458438a5e3fb7861f702a34 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sat, 14 Feb 2009 22:11:19 +0000 Subject: Document constants in numpy.doc.constants --- numpy/doc/constants.py | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 numpy/doc/constants.py (limited to 'numpy/doc') diff --git a/numpy/doc/constants.py b/numpy/doc/constants.py new file mode 100644 index 000000000..8240aab8e --- /dev/null +++ b/numpy/doc/constants.py @@ -0,0 +1,80 @@ +""" +========= +Constants +========= + +Numpy includes several constants: + +%(constant_list)s +""" +import textwrap + +# Maintain same format as in numpy.add_newdocs +constants = [] +def add_newdoc(module, name, doc): + constants.append((name, doc)) + +add_newdoc('numpy', 'Inf', + """ + """) + +add_newdoc('numpy', 'Infinity', + """ + """) + +add_newdoc('numpy', 'NAN', + """ + """) + +add_newdoc('numpy', 'NINF', + """ + """) + +add_newdoc('numpy', 'NZERO', + """ + """) + +add_newdoc('numpy', 'NaN', + """ + """) + +add_newdoc('numpy', 'PINF', + """ + """) + +add_newdoc('numpy', 'PZERO', + """ + """) + +add_newdoc('numpy', 'e', + """ + """) + +add_newdoc('numpy', 'inf', + """ + """) + +add_newdoc('numpy', 'infty', + """ + """) + +add_newdoc('numpy', 'nan', + """ + """) + +add_newdoc('numpy', 'newaxis', + """ + """) + +if __doc__: + constants_str = [] + constants.sort() + for name, doc in constants: + constants_str.append(""".. const:: %s\n %s""" % ( + name, textwrap.dedent(doc).replace("\n", "\n "))) + constants_str = "\n".join(constants_str) + + __doc__ = __doc__ % dict(constant_list=constants_str) + del constants_str, name, doc + +del constants, add_newdoc -- cgit v1.2.1