[Scipy-svn] r4681 - in trunk/scipy: . fftpack integrate ndimage sparse/linalg/dsolve sparse/linalg/eigen/lobpcg stats

scipy-svn@scip... scipy-svn@scip...
Mon Sep 1 13:28:33 CDT 2008


Author: alan.mcintyre
Date: 2008-09-01 13:28:08 -0500 (Mon, 01 Sep 2008)
New Revision: 4681

Modified:
   trunk/scipy/__init__.py
   trunk/scipy/fftpack/info.py
   trunk/scipy/integrate/ode.py
   trunk/scipy/ndimage/filters.py
   trunk/scipy/sparse/linalg/dsolve/__init__.py
   trunk/scipy/sparse/linalg/eigen/lobpcg/__init__.py
   trunk/scipy/stats/distributions.py
   trunk/scipy/stats/mstats.py
Log:
Correct handling of __doc__ to allow for running under python -OO.


Modified: trunk/scipy/__init__.py
===================================================================
--- trunk/scipy/__init__.py	2008-09-01 14:40:30 UTC (rev 4680)
+++ trunk/scipy/__init__.py	2008-09-01 18:28:08 UTC (rev 4681)
@@ -34,7 +34,8 @@
 
 __all__ += ['randn', 'rand', 'fft', 'ifft']
 
-__doc__ += """
+if __doc__:
+    __doc__ += """
 Contents
 --------
 
@@ -76,17 +77,20 @@
 
 del name, subpackages
 
-__doc__ += """
+if __doc__:
+    __doc__ += """
 
 Available subpackages
 ---------------------
 """
-__doc__ += pkgload.get_pkgdocs()
+if __doc__:
+    __doc__ += pkgload.get_pkgdocs()
 
 from numpy.testing import Tester
 test = Tester().test
 bench = Tester().bench
-__doc__ += """
+if __doc__:
+    __doc__ += """
 
 Utility tools
 -------------

Modified: trunk/scipy/fftpack/info.py
===================================================================
--- trunk/scipy/fftpack/info.py	2008-09-01 14:40:30 UTC (rev 4680)
+++ trunk/scipy/fftpack/info.py	2008-09-01 18:28:08 UTC (rev 4681)
@@ -51,7 +51,10 @@
            'rfftfreq'
            ]
 
-__doc_title__ = __doc__.lstrip().split('\n',1)[0]
+if __doc__:
+    __doc_title__ = __doc__.lstrip().split('\n',1)[0]
+else:
+    __doc_title__ = None
 
 postpone_import = 1
 

Modified: trunk/scipy/integrate/ode.py
===================================================================
--- trunk/scipy/integrate/ode.py	2008-09-01 14:40:30 UTC (rev 4680)
+++ trunk/scipy/integrate/ode.py	2008-09-01 18:28:08 UTC (rev 4681)
@@ -99,7 +99,8 @@
 
 """
 
-__doc__ += integrator_info
+if __doc__:
+    __doc__ += integrator_info
 
 # XXX: Integrators must have:
 # ===========================
@@ -188,7 +189,8 @@
 
 """
 
-    __doc__ += integrator_info
+    if __doc__:
+        __doc__ += integrator_info
 
     def __init__(self, f, jac=None):
         """

Modified: trunk/scipy/ndimage/filters.py
===================================================================
--- trunk/scipy/ndimage/filters.py	2008-09-01 14:40:30 UTC (rev 4680)
+++ trunk/scipy/ndimage/filters.py	2008-09-01 18:28:08 UTC (rev 4681)
@@ -44,8 +44,9 @@
 
 def moredoc(*args):
     def decorate(f):
-        if not f.__doc__: f.__doc__ = ""
-        for a in args: f.__doc__ += a
+        if f.__doc__ is not None:
+            for a in args: 
+                f.__doc__ += a
         return f
     return decorate
 

Modified: trunk/scipy/sparse/linalg/dsolve/__init__.py
===================================================================
--- trunk/scipy/sparse/linalg/dsolve/__init__.py	2008-09-01 14:40:30 UTC (rev 4680)
+++ trunk/scipy/sparse/linalg/dsolve/__init__.py	2008-09-01 18:28:08 UTC (rev 4681)
@@ -2,9 +2,9 @@
 
 from info import __doc__
 
-import umfpack
+#import umfpack
 #__doc__ = '\n\n'.join( (__doc__,  umfpack.__doc__) )
-del umfpack
+#del umfpack
 
 from linsolve import *
 

Modified: trunk/scipy/sparse/linalg/eigen/lobpcg/__init__.py
===================================================================
--- trunk/scipy/sparse/linalg/eigen/lobpcg/__init__.py	2008-09-01 14:40:30 UTC (rev 4680)
+++ trunk/scipy/sparse/linalg/eigen/lobpcg/__init__.py	2008-09-01 18:28:08 UTC (rev 4681)
@@ -2,7 +2,8 @@
 
 from info import __doc__
 import lobpcg
-__doc__ = '\n\n'.join( (lobpcg.__doc__, __doc__) )
+if __doc__ and lobpcg.__doc__:
+    __doc__ = '\n\n'.join( (lobpcg.__doc__, __doc__) )
 del lobpcg
 
 from lobpcg import *

Modified: trunk/scipy/stats/distributions.py
===================================================================
--- trunk/scipy/stats/distributions.py	2008-09-01 14:40:30 UTC (rev 4680)
+++ trunk/scipy/stats/distributions.py	2008-09-01 18:28:08 UTC (rev 4681)
@@ -324,7 +324,7 @@
             longname = hstr + name
         if self.__doc__ is None:
             self.__doc__ = rv_continuous.__doc__
-        if self.__doc__ is not None:
+        else:
             self.__doc__ = self.__doc__.replace("A Generic",longname)
             if name is not None:
                 self.__doc__ = self.__doc__.replace("generic",name)
@@ -3428,7 +3428,7 @@
             longname = hstr + name
         if self.__doc__ is None:
             self.__doc__ = rv_discrete.__doc__
-        if self.__doc__ is not None:
+        else:
             self.__doc__ = self.__doc__.replace("A Generic",longname)
             if name is not None:
                 self.__doc__ = self.__doc__.replace("generic",name)

Modified: trunk/scipy/stats/mstats.py
===================================================================
--- trunk/scipy/stats/mstats.py	2008-09-01 14:40:30 UTC (rev 4680)
+++ trunk/scipy/stats/mstats.py	2008-09-01 18:28:08 UTC (rev 4681)
@@ -591,9 +591,11 @@
     t = rpb*ma.sqrt(df/(1.0-rpb**2))
     prob = betai(0.5*df, 0.5, df/(df+t*t))
     return rpb, prob
-pointbiserialr.__doc__ = stats.pointbiserialr.__doc__ + genmissingvaldoc
 
+if stats.pointbiserialr.__doc__:
+    pointbiserialr.__doc__ = stats.pointbiserialr.__doc__ + genmissingvaldoc
 
+
 def linregress(*args):
     if len(args) == 1:  # more than 1D array?
         args = ma.array(args[0], copy=True)
@@ -630,9 +632,11 @@
     intercept = ymean - slope*xmean
     sterrest = ma.sqrt(1.-r*r) * y.std()
     return slope, intercept, r, prob, sterrest, Syy/Sxx
-linregress.__doc__ = stats.linregress.__doc__ + genmissingvaldoc
 
+if stats.linregress.__doc__:
+    linregress.__doc__ = stats.linregress.__doc__ + genmissingvaldoc
 
+
 def theilslopes(y, x=None, alpha=0.05):
     """Computes the Theil slope over the dataset (x,y), as the median of all slopes
     between paired values.
@@ -1084,9 +1088,11 @@
         return trimr(a, limits=limits, inclusive=inclusive, axis=axis)
     else:
         return trima(a, limits=limits, inclusive=inclusive)
-trim.__doc__ = trim.__doc__ % trimdoc
 
+if trim.__doc__:
+    trim.__doc__ = trim.__doc__ % trimdoc
 
+
 def trimboth(data, proportiontocut=0.2, inclusive=(True,True), axis=None):
     """Trims the data by masking the int(proportiontocut*n) smallest and
     int(proportiontocut*n) largest values of data along the given axis, where n



More information about the Scipy-svn mailing list