[Numpy-svn] r6366 - trunk/numpy/doc

numpy-svn@scip... numpy-svn@scip...
Sat Feb 14 16:12:15 CST 2009


Author: ptvirtan
Date: 2009-02-14 16:11:19 -0600 (Sat, 14 Feb 2009)
New Revision: 6366

Added:
   trunk/numpy/doc/constants.py
Log:
Document constants in numpy.doc.constants

Added: trunk/numpy/doc/constants.py
===================================================================
--- trunk/numpy/doc/constants.py	2009-02-14 22:10:24 UTC (rev 6365)
+++ trunk/numpy/doc/constants.py	2009-02-14 22:11:19 UTC (rev 6366)
@@ -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



More information about the Numpy-svn mailing list