summaryrefslogtreecommitdiff
path: root/numpy/lib/convertcode.py
diff options
context:
space:
mode:
authorcookedm <cookedm@localhost>2006-07-13 21:06:26 +0000
committercookedm <cookedm@localhost>2006-07-13 21:06:26 +0000
commitde0ac347a7332b04ff35b21c87e7e1bdb0cb5bc4 (patch)
treea1c8b0b1fb06d7d4df5c2bba5a2c49d2cb550c76 /numpy/lib/convertcode.py
parent705fa01506ea1d98add04ff2e2717a70c627507a (diff)
downloadnumpy-de0ac347a7332b04ff35b21c87e7e1bdb0cb5bc4.tar.gz
convertcode: replace ArrayType, NewAxis, and typecode =
Diffstat (limited to 'numpy/lib/convertcode.py')
-rw-r--r--numpy/lib/convertcode.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/numpy/lib/convertcode.py b/numpy/lib/convertcode.py
index 38c10dc82..b70f83a33 100644
--- a/numpy/lib/convertcode.py
+++ b/numpy/lib/convertcode.py
@@ -69,7 +69,7 @@ def replaceattr(astr):
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 @@ svspc2 = re.compile(r'([^,(\s]+[.]spacesaver[(][)])')
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