[Scipy-svn] r6390 - trunk/scipy/stats

scipy-svn at scipy.org scipy-svn at scipy.org
Fri May 14 11:16:51 EDT 2010


Author: rgommers
Date: 2010-05-14 10:16:51 -0500 (Fri, 14 May 2010)
New Revision: 6390

Modified:
   trunk/scipy/stats/distributions.py
Log:
DOC: fix bug for stats doc generation by more complete string substitution.

If the shapes keyword is None, the Parameters section should not display
the two lines for shapes.

Modified: trunk/scipy/stats/distributions.py
===================================================================
--- trunk/scipy/stats/distributions.py	2010-05-11 01:52:36 UTC (rev 6389)
+++ trunk/scipy/stats/distributions.py	2010-05-14 15:16:51 UTC (rev 6390)
@@ -121,6 +121,8 @@
                            _doc_cdf, _doc_sf, _doc_ppf, _doc_isf,
                            _doc_stats, _doc_entropy, _doc_fit])
 
+# Note that the two lines for %(shapes) are searched for and replaced in
+# rv_continuous and rv_discrete - update there if the exact string changes
 _doc_default_callparams = \
 """
 Parameters
@@ -660,6 +662,11 @@
         tempdict['name'] = self.name or 'distname'
         tempdict['shapes'] = self.shapes or ''
 
+        if self.shapes is None:
+            # remove shapes from call parameters if there are none
+            for item in ['callparams', 'default', 'before_notes']:
+                tempdict[item] = tempdict[item].replace(\
+                        "\n%(shapes)s : array-like\n    shape parameters", "")
         for i in range(2):
             if self.shapes is None:
                 # necessary because we use %(shapes)s in two forms (w w/o ", ")
@@ -3999,6 +4006,11 @@
         tempdict['name'] = self.name or 'distname'
         tempdict['shapes'] = self.shapes or ''
 
+        if self.shapes is None:
+            # remove shapes from call parameters if there are none
+            for item in ['callparams', 'default', 'before_notes']:
+                tempdict[item] = tempdict[item].replace(\
+                        "\n%(shapes)s : array-like\n    shape parameters", "")
         for i in range(2):
             if self.shapes is None:
                 # necessary because we use %(shapes)s in two forms (w w/o ", ")




More information about the Scipy-svn mailing list