diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-08-18 11:51:25 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-08-18 11:51:25 -0600 |
commit | fbd6510d58a47ea0d166c48a82793f05425406e4 (patch) | |
tree | 330ce703eb02d20f96099c3fe0fc36ae33d4905b /numpy/oldnumeric/alter_code2.py | |
parent | 8ddb0ce0acafe75d78df528b4d2540dfbf4b364d (diff) | |
download | numpy-fbd6510d58a47ea0d166c48a82793f05425406e4.tar.gz |
STY: Giant comma spacing fixup.
Run the 2to3 ws_comma fixer on *.py files. Some lines are now too long
and will need to be broken at some point. OTOH, some lines were already
too long and need to be broken at some point. Now seems as good a time
as any to do this with open PRs at a minimum.
Diffstat (limited to 'numpy/oldnumeric/alter_code2.py')
-rw-r--r-- | numpy/oldnumeric/alter_code2.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/numpy/oldnumeric/alter_code2.py b/numpy/oldnumeric/alter_code2.py index c163c9565..1ec15c855 100644 --- a/numpy/oldnumeric/alter_code2.py +++ b/numpy/oldnumeric/alter_code2.py @@ -35,11 +35,11 @@ import glob # To convert typecharacters we need to # Not very safe. Disabled for now.. def replacetypechars(astr): - astr = astr.replace("'s'","'h'") - astr = astr.replace("'b'","'B'") - astr = astr.replace("'1'","'b'") - astr = astr.replace("'w'","'H'") - astr = astr.replace("'u'","'I'") + astr = astr.replace("'s'", "'h'") + astr = astr.replace("'b'", "'B'") + astr = astr.replace("'1'", "'b'") + astr = astr.replace("'w'", "'H'") + astr = astr.replace("'u'", "'I'") return astr def changeimports(fstr, name, newname): @@ -49,13 +49,13 @@ def changeimports(fstr, name, newname): fromall=0 fstr = fstr.replace(importasstr, 'import %s as ' % newname) - fstr = fstr.replace(importstr, 'import %s as %s' % (newname,name)) + fstr = fstr.replace(importstr, 'import %s as %s' % (newname, name)) ind = 0 Nlen = len(fromstr) Nlen2 = len("from %s import " % newname) while True: - found = fstr.find(fromstr,ind) + found = fstr.find(fromstr, ind) if (found < 0): break ind = found + Nlen @@ -66,7 +66,7 @@ def changeimports(fstr, name, newname): return fstr, fromall def replaceattr(astr): - astr = astr.replace("matrixmultiply","dot") + astr = astr.replace("matrixmultiply", "dot") return astr def replaceother(astr): @@ -131,7 +131,7 @@ def convertall(direc=os.path.curdir): <usesnumeric>.py.orig. A new file named <usesnumeric>.py is then written with the updated code. """ - files = glob.glob(os.path.join(direc,'*.py')) + files = glob.glob(os.path.join(direc, '*.py')) for afile in files: convertfile(afile) |