[Numpy-svn] r2814 - trunk/numpy/lib

numpy-svn at scipy.org numpy-svn at scipy.org
Thu Jul 13 17:06:28 EDT 2006


Author: cookedm
Date: 2006-07-13 16:06:26 -0500 (Thu, 13 Jul 2006)
New Revision: 2814

Modified:
   trunk/numpy/lib/convertcode.py
Log:
convertcode: replace ArrayType, NewAxis, and typecode =

Modified: trunk/numpy/lib/convertcode.py
===================================================================
--- trunk/numpy/lib/convertcode.py	2006-07-13 02:48:24 UTC (rev 2813)
+++ trunk/numpy/lib/convertcode.py	2006-07-13 21:06:26 UTC (rev 2814)
@@ -69,7 +69,7 @@
     astr = astr.replace(".itemsize()",".itemsize")
     astr = astr.replace("matrixmultiply","dot")
     # preserve uses of flat that should be o.k.
-    tmpstr = flatindex_re.sub("@@@@\\2",astr)
+    tmpstr = flatindex_re.sub(r"@@@@\2",astr)
     # replace other uses of flat
     tmpstr = tmpstr.replace(".flat",".ravel()")
     # put back .flat where it was valid
@@ -81,11 +81,13 @@
 svspc3 = re.compile(r'(\S+[.]savespace[(].*[)])')
 #shpe = re.compile(r'(\S+\s*)[.]shape\s*=[^=]\s*(.+)')
 def replaceother(astr):
-    astr = astr.replace("typecode=","dtype=")
+    astr = re.sub(r'typecode\s*=', 'dtype=', astr)
     astr = astr.replace("UserArray","ndarray")
-    astr = svspc.sub('\\1)',astr)
+    astr = astr.replace('ArrayType', 'ndarray')
+    astr = astr.replace('NewAxis', 'newaxis')
+    astr = svspc.sub(r'\1)',astr)
     astr = svspc2.sub('True',astr)
-    astr = svspc3.sub('pass  ## \\1', astr)
+    astr = svspc3.sub(r'pass  ## \1', astr)
     #astr = shpe.sub('\\1=\\1.reshape(\\2)', astr)
     return astr
 




More information about the Numpy-svn mailing list