[Scipy-svn] r6535 - in branches/0.8.x/scipy/io: . tests

scipy-svn@scip... scipy-svn@scip...
Fri Jun 18 08:12:06 CDT 2010


Author: rgommers
Date: 2010-06-18 08:12:05 -0500 (Fri, 18 Jun 2010)
New Revision: 6535

Modified:
   branches/0.8.x/scipy/io/recaster.py
   branches/0.8.x/scipy/io/tests/test_recaster.py
Log:
Deprecate io.recaster module.

Modified: branches/0.8.x/scipy/io/recaster.py
===================================================================
--- branches/0.8.x/scipy/io/recaster.py	2010-06-18 13:11:47 UTC (rev 6534)
+++ branches/0.8.x/scipy/io/recaster.py	2010-06-18 13:12:05 UTC (rev 6535)
@@ -5,9 +5,20 @@
 """
 
 from numpy import *
+from numpy.lib.utils import deprecate
 
+# deprecated in 0.8, will be removed in 0.9.
+@deprecate
 def sctype_attributes():
-    ''' Return dictionary describing numpy scalar types '''
+    """Return dictionary describing numpy scalar types
+
+    .. deprecated:: sctype_attributes is deprecated in scipy 0.8 and
+                    will be removed in scipy 0.9.
+    """
+    return _sctype_attributes()
+
+
+def _sctype_attributes():
     d_dict = {}
     for sc_type in ('complex','float'):
         t_list = sctypes[sc_type]
@@ -46,9 +57,13 @@
 class RecastError(ValueError):
     pass
 
+# deprecated in 0.8, will be removed in 0.9.
 class Recaster(object):
     ''' Class to recast arrays to one of acceptable scalar types
 
+    .. deprecated:: Recaster is deprecated in scipy 0.8 and will be
+                    removed in scipy 0.9.
+
     Initialization specifies acceptable types (ATs)
 
     Implements recast method - returns array that may be of different
@@ -58,7 +73,7 @@
     specified in options at object creation.
     '''
 
-    _sctype_attributes = sctype_attributes()
+    _sctype_attributes = _sctype_attributes()
     _k = 2**10
     _option_defaults = {
         'only_if_none': {
@@ -107,6 +122,7 @@
         }
         }
 
+    @deprecate
     def __init__(self, sctype_list=None,
                  sctype_tols=None,
                  recast_options='only_if_none'):

Modified: branches/0.8.x/scipy/io/tests/test_recaster.py
===================================================================
--- branches/0.8.x/scipy/io/tests/test_recaster.py	2010-06-18 13:11:47 UTC (rev 6534)
+++ branches/0.8.x/scipy/io/tests/test_recaster.py	2010-06-18 13:12:05 UTC (rev 6535)
@@ -1,3 +1,5 @@
+import warnings
+
 import numpy as np
 from numpy.testing import *
 
@@ -167,5 +169,7 @@
             assert dtt is outp, \
                    'Expected %s from %s, got %s' % (outp, inp, dtt)
 
+warnings.simplefilter('ignore', category=DeprecationWarning)
+
 if __name__ == "__main__":
     run_module_suite()



More information about the Scipy-svn mailing list