Skip to content

Commit

Permalink
STY: Giant comma spacing fixup.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
charris committed Aug 18, 2013
1 parent 8ddb0ce commit fbd6510
Show file tree
Hide file tree
Showing 251 changed files with 6,968 additions and 6,968 deletions.
2 changes: 1 addition & 1 deletion doc/newdtype_example/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# So, the setitem code will be called with scalars on the
# wrong shaped array.
# But we can get a view as an ndarray of the given type:
g = np.array([1,2,3,4,5,6,7,8]).view(ff.floatint_type)
g = np.array([1, 2, 3, 4, 5, 6, 7, 8]).view(ff.floatint_type)

# Now, the elements will be the scalar type associated
# with the ndarray.
Expand Down
2 changes: 1 addition & 1 deletion doc/newdtype_example/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

def configuration(parent_package = '', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('floatint',parent_package,top_path)
config = Configuration('floatint', parent_package, top_path)

config.add_extension('floatint',
sources = ['floatint.c']);
Expand Down
2 changes: 1 addition & 1 deletion doc/numpybook/comparison/ctypes/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def add(a, b):
a = N.require(a, dtype, requires)
b = N.require(b, dtype, requires)
c = N.empty_like(a)
func(a,b,c,a.size)
func(a, b, c, a.size)
return c

def filter2d(a):
Expand Down
6 changes: 3 additions & 3 deletions doc/numpybook/comparison/timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
filter.DFILTER2D(a,b)
"""

N = [10,20,30,40,50,100,200,300, 400, 500]
N = [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]

res = {}

Expand All @@ -57,6 +57,6 @@
print(sys.path)
for n in N:
print("%s - %d" % (kind, n))
t = timeit.Timer(eval('%s_run'%kind), eval('%s_pre %% (%d,%d)'%(kind,n,n)))
mytime = min(t.repeat(3,100))
t = timeit.Timer(eval('%s_run'%kind), eval('%s_pre %% (%d,%d)'%(kind, n, n)))
mytime = min(t.repeat(3, 100))
res[kind].append(mytime)
2 changes: 1 addition & 1 deletion doc/numpybook/comparison/weave/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ def filter(a):
}
"""
b = zeros_like(a)
weave.inline(code,['a','b'])
weave.inline(code, ['a', 'b'])
return b
10 changes: 5 additions & 5 deletions doc/numpybook/comparison/weave/inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def example1(a):
results[1] = 4.0;
return_val = results;
"""
return weave.inline(code,['a'])
return weave.inline(code, ['a'])

def arr(a):
if a.ndim != 2:
Expand All @@ -36,16 +36,16 @@ def arr(a):
}
"""
b = zeros_like(a)
weave.inline(code,['a','b'])
weave.inline(code, ['a', 'b'])
return b

a = [None]*10
print(example1(a))
print(a)

a = rand(512,512)
a = rand(512, 512)
b = arr(a)

h = [[0.25,0.5,0.25],[0.5,1,0.5],[0.25,0.5,0.25]]
h = [[0.25, 0.5, 0.25], [0.5, 1, 0.5], [0.25, 0.5, 0.25]]
import scipy.signal as ss
b2 = ss.convolve(h,a,'same')
b2 = ss.convolve(h, a, 'same')
4 changes: 2 additions & 2 deletions doc/numpybook/runcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def runpycode(lyxstr, name='MyCode'):
def main(args):
usage = "%prog {options} filename"
parser = optparse.OptionParser(usage)
parser.add_option('-n','--name', default='MyCode')
parser.add_option('-n', '--name', default='MyCode')

options, args = parser.parse_args(args)
if len(args) < 1:
Expand All @@ -143,7 +143,7 @@ def main(args):
fid.close()
print("Processing %s" % options.name)
newstr = runpycode(str, options.name)
fid = file(args[0],'w')
fid = file(args[0], 'w')
fid.write(newstr)
fid.close()

Expand Down
2 changes: 1 addition & 1 deletion doc/swig/test/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@
author = "Bill Spotz",
py_modules = ["Array", "Farray", "Vector", "Matrix", "Tensor",
"Fortran"],
ext_modules = [_Array , _Farray , _Vector , _Matrix , _Tensor,
ext_modules = [_Array, _Farray, _Vector, _Matrix, _Tensor,
_Fortran]
)
4 changes: 2 additions & 2 deletions doc/swig/test/testArray.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def testView(self):
a = self.array1.view()
self.failUnless(isinstance(a, np.ndarray))
self.failUnless(len(a) == self.length)
self.failUnless((a == [1,2,3,4,5]).all())
self.failUnless((a == [1, 2, 3, 4, 5]).all())

######################################################################

Expand All @@ -138,7 +138,7 @@ def testConstructor1(self):

def testConstructor2(self):
"Test Array2 array constructor"
na = np.zeros((3,4), dtype="l")
na = np.zeros((3, 4), dtype="l")
aa = Array.Array2(na)
self.failUnless(isinstance(aa, Array.Array2))

Expand Down
16 changes: 8 additions & 8 deletions doc/swig/test/testFarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Add the distutils-generated build directory to the python search path and then
# import the extension module
libDir = "lib.%s-%s" % (get_platform(), sys.version[:3])
sys.path.insert(0,os.path.join("build", libDir))
sys.path.insert(0, os.path.join("build", libDir))
import Farray

######################################################################
Expand All @@ -36,7 +36,7 @@ def testConstructor2(self):
"Test Farray copy constructor"
for i in range(self.nrows):
for j in range(self.ncols):
self.array[i,j] = i + j
self.array[i, j] = i + j
arrayCopy = Farray.Farray(self.array)
self.failUnless(arrayCopy == self.array)

Expand Down Expand Up @@ -66,10 +66,10 @@ def testSetGet(self):
n = self.ncols
for i in range(m):
for j in range(n):
self.array[i,j] = i*j
self.array[i, j] = i*j
for i in range(m):
for j in range(n):
self.failUnless(self.array[i,j] == i*j)
self.failUnless(self.array[i, j] == i*j)

def testSetBad1(self):
"Test Farray __setitem__ method, negative row"
Expand Down Expand Up @@ -114,7 +114,7 @@ def testAsString(self):
"""
for i in range(self.nrows):
for j in range(self.ncols):
self.array[i,j] = i+j
self.array[i, j] = i+j
self.failUnless(self.array.asString() == result)

def testStr(self):
Expand All @@ -128,20 +128,20 @@ def testStr(self):
"""
for i in range(self.nrows):
for j in range(self.ncols):
self.array[i,j] = i-j
self.array[i, j] = i-j
self.failUnless(str(self.array) == result)

def testView(self):
"Test Farray view method"
for i in range(self.nrows):
for j in range(self.ncols):
self.array[i,j] = i+j
self.array[i, j] = i+j
a = self.array.view()
self.failUnless(isinstance(a, np.ndarray))
self.failUnless(a.flags.f_contiguous)
for i in range(self.nrows):
for j in range(self.ncols):
self.failUnless(a[i,j] == i+j)
self.failUnless(a[i, j] == i+j)

######################################################################

Expand Down
2 changes: 1 addition & 1 deletion doc/swig/test/testFortran.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def testSecondElementObject(self):
"Test Fortran matrix initialized from nested list fortranarray"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
second = Fortran.__dict__[self.typeStr + "SecondElement"]
matrix = np.asfortranarray([[0,1,2],[3,4,5],[6,7,8]], self.typeCode)
matrix = np.asfortranarray([[0, 1, 2], [3, 4, 5], [6, 7, 8]], self.typeCode)
self.assertEquals(second(matrix), 3)

######################################################################
Expand Down
Loading

0 comments on commit fbd6510

Please sign in to comment.