Skip to content

Commit

Permalink
PEP8: Fix E203 whitespace before ','
Browse files Browse the repository at this point in the history
  • Loading branch information
timleslie committed Apr 19, 2013
1 parent 6e4ecd9 commit 2529e10
Show file tree
Hide file tree
Showing 47 changed files with 249 additions and 249 deletions.
6 changes: 3 additions & 3 deletions scipy/constants/codata.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ def _check_obsolete(key):
key, _current_codata), ConstantWarning)


def value(key) :
def value(key):
"""
Value in physical_constants indexed by key
Expand Down Expand Up @@ -886,7 +886,7 @@ def value(key) :
return physical_constants[key][0]


def unit(key) :
def unit(key):
"""
Unit in physical_constants indexed by key
Expand Down Expand Up @@ -916,7 +916,7 @@ def unit(key) :
return physical_constants[key][1]


def precision(key) :
def precision(key):
"""
Relative precision in physical_constants indexed by key
Expand Down
8 changes: 4 additions & 4 deletions scipy/fftpack/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,12 +505,12 @@ def test_axes_argument(self):
assert_array_almost_equal(swapaxes(y,-1,-3),fftn(ijk_space))
y = fftn(x,axes=(2,0,1)) # ikj_space
assert_array_almost_equal(swapaxes(swapaxes(y,-1,-3),
-1,-2)
,fftn(ikj_space))
-1,-2),
fftn(ikj_space))
y = fftn(x,axes=(1,2,0)) # jik_space
assert_array_almost_equal(swapaxes(swapaxes(y,-1,-3),
-3,-2)
,fftn(jik_space))
-3,-2),
fftn(jik_space))
y = fftn(x,axes=(1,0,2)) # jki_space
assert_array_almost_equal(swapaxes(y,-2,-3),fftn(jki_space))
y = fftn(x,axes=(0,2,1)) # kij_space
Expand Down
12 changes: 6 additions & 6 deletions scipy/integrate/tests/test_quadrature.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ def test_nd(self):
x = np.arange(3 * 2 * 4).reshape(3, 2, 4)
y = x
y_int = cumtrapz(y, x, initial=0)
y_expected = np.array([[[0. , 0.5, 2. , 4.5],
[0. , 4.5, 10. , 16.5]],
[[0. , 8.5, 18. , 28.5],
[0. , 12.5, 26. , 40.5]],
[[0. , 16.5, 34. , 52.5],
[0. , 20.5, 42. , 64.5]]])
y_expected = np.array([[[0., 0.5, 2., 4.5],
[0., 4.5, 10., 16.5]],
[[0., 8.5, 18., 28.5],
[0., 12.5, 26., 40.5]],
[[0., 16.5, 34., 52.5],
[0., 20.5, 42., 64.5]]])

assert_allclose(y_int, y_expected)

Expand Down
2 changes: 1 addition & 1 deletion scipy/interpolate/fitpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def splev(x, tck, der=0, ext=0):
except:
parametric = False
if parametric:
return list(map(lambda c, x=x, t=t, k=k, der=der : splev(x, [t,c,k], der, ext), c))
return list(map(lambda c, x=x, t=t, k=k, der=der: splev(x, [t,c,k], der, ext), c))
else:
if not (0 <= der <= k):
raise ValueError("0<=der=%d<=k=%d must hold" % (der,k))
Expand Down
2 changes: 1 addition & 1 deletion scipy/interpolate/interpolate_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def nearest(x, y, new_x):
Rounds each `new_x` to nearest `x` and returns the corresponding `y`.
"""
shifted_x = np.concatenate((np.array([x[0]-1]) , x[0:-1]))
shifted_x = np.concatenate((np.array([x[0]-1]), x[0:-1]))

midpoints_of_x = atleast_1d_and_contiguous(.5*(x + shifted_x))
new_x = atleast_1d_and_contiguous(new_x)
Expand Down
6 changes: 3 additions & 3 deletions scipy/io/arff/arffread.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def go_data(ofile):
"""Skip header.
the first next() call of the returned iterator will be the @data line"""
return itertools.dropwhile(lambda x : not r_datameta.match(x), ofile)
return itertools.dropwhile(lambda x: not r_datameta.match(x), ofile)


#----------------
Expand Down Expand Up @@ -542,8 +542,8 @@ def _loadarff(ofile):

# This can be used once we want to support integer as integer values and
# not as numeric anymore (using masked arrays ?).
acls2dtype = {'real' : np.float, 'integer' : np.float, 'numeric' : np.float}
acls2conv = {'real' : safe_float, 'integer' : safe_float, 'numeric' : safe_float}
acls2dtype = {'real': np.float, 'integer': np.float, 'numeric': np.float}
acls2conv = {'real': safe_float, 'integer': safe_float, 'numeric': safe_float}
descr = []
convertors = []
if not hasstr:
Expand Down
2 changes: 1 addition & 1 deletion scipy/io/matlab/benchmarks/bench_structarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ def bench_run():
n_structs))


if __name__ == '__main__' :
if __name__ == '__main__':
bench_run()
2 changes: 1 addition & 1 deletion scipy/io/matlab/mio5.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ def to_writeable(source):
dtype.append((field,object))
values.append(value)
if dtype:
return np.array([tuple(values)] ,dtype)
return np.array([tuple(values)],dtype)
else:
return None
# Next try and convert to an array
Expand Down
22 changes: 11 additions & 11 deletions scipy/lib/lapack/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

from scipy.lib.lapack import flapack, clapack

FUNCS_TP = {'ssygv' : np.float32,
FUNCS_TP = {'ssygv': np.float32,
'dsygv': np.float,
'ssygvd' : np.float32,
'dsygvd' : np.float,
'ssyev' : np.float32,
'ssygvd': np.float32,
'dsygvd': np.float,
'ssyev': np.float32,
'dsyev': np.float,
'ssyevr' : np.float32,
'dsyevr' : np.float,
'ssyevr' : np.float32,
'dsyevr' : np.float,
'sgehrd' : np.float32,
'dgehrd' : np.float,
'sgebal' : np.float32,
'ssyevr': np.float32,
'dsyevr': np.float,
'ssyevr': np.float32,
'dsyevr': np.float,
'sgehrd': np.float32,
'dgehrd': np.float,
'sgebal': np.float32,
'dgebal': np.float}

# Test FLAPACK if not empty
Expand Down
2 changes: 1 addition & 1 deletion scipy/linalg/_decomp_qz.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def qz(A, B, output='real', lwork=None, sort=None, overwrite_a=False,

if sort is None:
sort_t = 0
sfunction = lambda x : None
sfunction = lambda x: None
else:
sort_t = 1
sfunction = _select_function(sort, typa)
Expand Down
6 changes: 3 additions & 3 deletions scipy/linalg/blas.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@
_type_conv = {'f':'s', 'd':'d', 'F':'c', 'D':'z', 'G':'z'}

# some convenience alias for complex functions
_blas_alias = {'cnrm2' : 'scnrm2', 'znrm2' : 'dznrm2',
'cdot' : 'cdotc', 'zdot' : 'zdotc',
'cger' : 'cgerc', 'zger' : 'zgerc',
_blas_alias = {'cnrm2': 'scnrm2', 'znrm2': 'dznrm2',
'cdot': 'cdotc', 'zdot': 'zdotc',
'cger': 'cgerc', 'zger': 'zgerc',
'sdotc': 'sdot', 'sdotu': 'sdot',
'ddotc': 'ddot', 'ddotu': 'ddot'}

Expand Down
2 changes: 1 addition & 1 deletion scipy/linalg/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

__all__ = ['LinAlgError', 'norm']

_nrm2_prefix = {'f' : 's', 'F': 'sc', 'D': 'dz'}
_nrm2_prefix = {'f': 's', 'F': 'sc', 'D': 'dz'}


def norm(a, ord=None):
Expand Down
16 changes: 8 additions & 8 deletions scipy/linalg/tests/test_decomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1817,7 +1817,7 @@ def test_qz_double_sort(self):
[1.0, 2.0, -4.0, 1.0],
[1.2, 3.0, -4.0, 4.0]])

sort = lambda ar,ai,beta : ai == 0
sort = lambda ar,ai,beta: ai == 0

assert_raises(ValueError, qz, A, B, sort=sort)
if False:
Expand All @@ -1831,16 +1831,16 @@ def test_qz_double_sort(self):
# dependent
assert_array_almost_equal(np.abs(AA), np.abs(np.array(
[[35.7864, -80.9061, -12.0629, -9.498],
[0. , 2.7638, -2.3505, 7.3256],
[0. , 0. , 0.6258, -0.0398],
[0. , 0. , 0. , -12.8217]])), 4)
[0., 2.7638, -2.3505, 7.3256],
[0., 0., 0.6258, -0.0398],
[0., 0., 0., -12.8217]])), 4)
assert_array_almost_equal(np.abs(BB), np.abs(np.array(
[[4.5324, -8.7878, 3.2357, -3.5526],
[0. , 1.4314, -2.1894, 0.9709],
[0. , 0. , 1.3126, -0.3468],
[0. , 0. , 0. , 0.559]])), 4)
[0., 1.4314, -2.1894, 0.9709],
[0., 0., 1.3126, -0.3468],
[0., 0., 0., 0.559]])), 4)
assert_array_almost_equal(np.abs(Q), np.abs(np.array(
[[-0.4193, -0.605 , -0.1894, -0.6498],
[[-0.4193, -0.605, -0.1894, -0.6498],
[-0.5495, 0.6987, 0.2654, -0.3734],
[-0.4973, -0.3682, 0.6194, 0.4832],
[-0.5243, 0.1008, -0.7142, 0.4526]])), 4)
Expand Down
8 changes: 4 additions & 4 deletions scipy/linalg/tests/test_matfuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ class TestSignM(TestCase):

def test_nils(self):
a = array([[29.2, -24.2, 69.5, 49.8, 7.],
[-9.2, 5.2, -18. , -16.8, -2.],
[-10. , 6. , -20. , -18. , -2.],
[-9.2, 5.2, -18., -16.8, -2.],
[-10., 6., -20., -18., -2.],
[-9.6, 9.6, -25.5, -15.4, -2.],
[9.8, -4.8, 18. , 18.2, 2.]])
[9.8, -4.8, 18., 18.2, 2.]])
cr = array([[11.94933333,-2.24533333,15.31733333,21.65333333,-2.24533333],
[-3.84266667,0.49866667,-4.59066667,-7.18666667,0.49866667],
[-4.08,0.56,-4.92,-7.6 ,0.56],
[-4.08,0.56,-4.92,-7.6,0.56],
[-4.03466667,1.04266667,-5.59866667,-7.02666667,1.04266667],
[4.15733333,-0.50133333,4.90933333,7.81333333,-0.50133333]])
r = signm(a)
Expand Down
2 changes: 1 addition & 1 deletion scipy/ndimage/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def gaussian_filter1d(input, sigma, axis=-1, order=0, output=None,
for ii in range(2 * lw + 1):
weights[ii] /= sum
# implement first, second and third order derivatives:
if order == 1 : # first derivative
if order == 1: # first derivative
weights[lw] = 0.0
for ii in range(1, lw + 1):
x = float(ii)
Expand Down
8 changes: 4 additions & 4 deletions scipy/ndimage/tests/test_ndimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1312,8 +1312,8 @@ def shift(x):
data = numpy.array([1,2,3,4.])
expected = {'constant': [1.5,2.5,3.5,-1,-1,-1,-1],
'wrap': [1.5,2.5,3.5,1.5,2.5,3.5,1.5],
'mirror' : [1.5,2.5,3.5,3.5,2.5,1.5,1.5],
'nearest' : [1.5,2.5,3.5,4,4,4,4]}
'mirror': [1.5,2.5,3.5,3.5,2.5,1.5,1.5],
'nearest': [1.5,2.5,3.5,4,4,4,4]}

for mode in expected:
assert_array_equal(expected[mode],
Expand All @@ -1330,8 +1330,8 @@ def shift(x):
data = numpy.array([1,2,3,4])
expected = {'constant': [-1,1,2,3],
'wrap': [3,1,2,3],
'mirror' : [2,1,2,3],
'nearest' : [1,1,2,3]}
'mirror': [2,1,2,3],
'nearest': [1,1,2,3]}

for mode in expected:
assert_array_equal(expected[mode],
Expand Down
4 changes: 2 additions & 2 deletions scipy/odr/tests/test_odr.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_explicit(self):
)
assert_array_almost_equal(
out.sd_beta,
np.array([1.0349270280543437, 1.583997785262061 , 0.0063321988657267]),
np.array([1.0349270280543437, 1.583997785262061, 0.0063321988657267]),
)
assert_array_almost_equal(
out.cov_beta,
Expand Down Expand Up @@ -203,7 +203,7 @@ def test_multi(self):
-0.0563083340093696, 0.1269490939468611],
[-0.0058700836512467, -0.0051181304940204, -0.0563083340093696,
0.0066939246261263, -0.0140184391377962],
[0.011281212888768 , 0.0130726943624117, 0.1269490939468611,
[0.011281212888768, 0.0130726943624117, 0.1269490939468611,
-0.0140184391377962, 0.0316733013820852]]),
)

Expand Down
24 changes: 12 additions & 12 deletions scipy/optimize/_tstutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,38 @@
from scipy.optimize import zeros as cc


def f1(x) :
def f1(x):
return x*(x-1.)


def f2(x) :
def f2(x):
return x**2 - 1


def f3(x) :
def f3(x):
return x*(x-1.)*(x-2.)*(x-3.)


def f4(x) :
if x > 1 :
def f4(x):
if x > 1:
return 1.0 + .1*x
if x < 1 :
if x < 1:
return -1.0 + .1*x
return 0


def f5(x) :
if x != 1 :
def f5(x):
if x != 1:
return 1.0/(1. - x)
return 0


def f6(x) :
if x > 1 :
def f6(x):
if x > 1:
return random()
elif x < 1 :
elif x < 1:
return -random()
else :
else:
return 0

description = """
Expand Down
30 changes: 15 additions & 15 deletions scipy/optimize/anneal.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,22 +428,22 @@ def anneal(func, x0, args=(), schedule='fast', full_output=0,
"""

opts = {'schedule' : schedule,
'T0' : T0,
'Tf' : Tf,
'maxfev' : maxeval,
'maxaccept' : maxaccept,
'maxiter' : maxiter,
'boltzmann' : boltzmann,
opts = {'schedule': schedule,
'T0': T0,
'Tf': Tf,
'maxfev': maxeval,
'maxaccept': maxaccept,
'maxiter': maxiter,
'boltzmann': boltzmann,
'learn_rate': learn_rate,
'ftol' : feps,
'quench' : quench,
'm' : m,
'n' : n,
'lower' : lower,
'upper' : upper,
'dwell' : dwell,
'disp' : disp}
'ftol': feps,
'quench': quench,
'm': m,
'n': n,
'lower': lower,
'upper': upper,
'dwell': dwell,
'disp': disp}

res = _minimize_anneal(func, x0, args, **opts)

Expand Down
6 changes: 3 additions & 3 deletions scipy/optimize/benchmarks/bench_zeros.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ def bench_run(self):

print('TESTING SPEED\n')
print('times in seconds for %d iterations \n' % repeat)
for i in range(len(functions)) :
for i in range(len(functions)):
print('function %s\n' % fstrings[i])
func = functions[i]
for j in range(len(methods)) :
for j in range(len(methods)):
meth = methods[j]
try:
t = measure("meth(func,a,b)",repeat)
Expand All @@ -34,5 +34,5 @@ def bench_run(self):
print('%s : %5.3f' % (mstrings[j],t))
print('\n\n')

if __name__ == '__main__' :
if __name__ == '__main__':
run_module_suite()
Loading

0 comments on commit 2529e10

Please sign in to comment.