Permalink
Browse files

PEP8: Fix E502 the backslash is redundant between brackets

  • Loading branch information...
1 parent d1523ad commit b5ccb042162580a5e789773112e43b9b7653ac45 @timleslie timleslie committed Apr 12, 2013
Showing with 191 additions and 190 deletions.
  1. +1 −1 scipy/__init__.py
  2. +13 −13 scipy/cluster/hierarchy.py
  3. +2 −2 scipy/cluster/vq.py
  4. +1 −1 scipy/constants/codata.py
  5. +1 −1 scipy/fftpack/basic.py
  6. +3 −3 scipy/fftpack/tests/test_basic.py
  7. +3 −3 scipy/integrate/quadrature.py
  8. +4 −4 scipy/interpolate/fitpack2.py
  9. +1 −1 scipy/interpolate/interpolate.py
  10. +2 −2 scipy/interpolate/tests/test_fitpack.py
  11. +1 −1 scipy/io/arff/arffread.py
  12. +3 −3 scipy/io/harwell_boeing/_fortran_format_parser.py
  13. +5 −5 scipy/io/harwell_boeing/hb.py
  14. +9 −9 scipy/io/idl.py
  15. +1 −1 scipy/io/matlab/mio5.py
  16. +1 −1 scipy/io/matlab/tests/test_mio.py
  17. +1 −1 scipy/lib/blas/setup.py
  18. +1 −1 scipy/lib/lapack/setup.py
  19. +1 −1 scipy/linalg/decomp_qr.py
  20. +1 −1 scipy/linalg/setup.py
  21. +1 −1 scipy/misc/pilutil.py
  22. +1 −1 scipy/ndimage/measurements.py
  23. +1 −1 scipy/odr/models.py
  24. +1 −1 scipy/optimize/setup.py
  25. +1 −1 scipy/optimize/tests/test_anneal.py
  26. +1 −1 scipy/signal/ltisys.py
  27. +1 −1 scipy/signal/tests/test_fir_filter_design.py
  28. +18 −18 scipy/sparse/bsr.py
  29. +12 −12 scipy/sparse/compressed.py
  30. +9 −9 scipy/sparse/coo.py
  31. +2 −2 scipy/sparse/csc.py
  32. +1 −1 scipy/sparse/csgraph/tests/test_graph_laplacian.py
  33. +7 −7 scipy/sparse/csr.py
  34. +4 −4 scipy/sparse/dia.py
  35. +2 −2 scipy/sparse/dok.py
  36. +1 −1 scipy/sparse/linalg/dsolve/umfpack/tests/test_umfpack.py
  37. +2 −2 scipy/sparse/linalg/isolve/tests/demo_lgmres.py
  38. +7 −7 scipy/sparse/linalg/isolve/tests/test_lsmr.py
  39. +2 −2 scipy/sparse/linalg/isolve/utils.py
  40. +1 −1 scipy/spatial/kdtree.py
  41. +2 −2 scipy/special/orthogonal.py
  42. +1 −1 scipy/special/setup.py
  43. +1 −1 scipy/special/spfun_stats.py
  44. +3 −3 scipy/special/tests/test_basic.py
  45. +20 −20 scipy/stats/distributions.py
  46. +3 −2 scipy/stats/kde.py
  47. +1 −1 scipy/stats/morestats.py
  48. +6 −6 scipy/stats/mstats_basic.py
  49. +2 −2 scipy/stats/stats.py
  50. +6 −6 scipy/stats/tests/test_continuous_basic.py
  51. +1 −1 scipy/stats/tests/test_continuous_extra.py
  52. +4 −4 scipy/stats/tests/test_discrete_basic.py
  53. +1 −1 scipy/stats/tests/test_distributions.py
  54. +4 −4 scipy/weave/build_tools.py
  55. +2 −2 scipy/weave/catalog.py
  56. +1 −1 scipy/weave/examples/vq.py
  57. +2 −2 scipy/weave/tests/test_blitz_tools.py
  58. +1 −1 tox.ini
View
@@ -84,7 +84,7 @@
majver, minver = [float(i) for i in _num.version.version.split('.')[:2]]
if majver < 1 or (majver == 1 and minver < 5):
import warnings
- warnings.warn("Numpy 1.5.0 or above is recommended for this version of " \
+ warnings.warn("Numpy 1.5.0 or above is recommended for this version of "
"scipy (detected version %s)" % _num.version.version,
UserWarning)
View
@@ -632,7 +632,7 @@ def linkage(y, method='single', metric='euclidean'):
[y] = _copy_arrays_if_base_present([y])
Z = np.zeros((d - 1, 4))
- _hierarchy_wrap.linkage_wrap(y, Z, int(d), \
+ _hierarchy_wrap.linkage_wrap(y, Z, int(d),
int(_cpy_non_euclid_methods[method]))
elif len(s) == 2:
X = y
@@ -643,7 +643,7 @@ def linkage(y, method='single', metric='euclidean'):
if method in _cpy_non_euclid_methods:
dm = distance.pdist(X, metric)
Z = np.zeros((n - 1, 4))
- _hierarchy_wrap.linkage_wrap(dm, Z, n, \
+ _hierarchy_wrap.linkage_wrap(dm, Z, n,
int(_cpy_non_euclid_methods[method]))
elif method in _cpy_euclid_methods:
if metric != 'euclidean':
@@ -1560,7 +1560,7 @@ def fcluster(Z, t, criterion='inconsistent', depth=2, R=None, monocrit=None):
return T
-def fclusterdata(X, t, criterion='inconsistent', \
+def fclusterdata(X, t, criterion='inconsistent',
metric='euclidean', depth=2, method='single', R=None):
"""
Cluster observation data using a given metric.
@@ -2230,15 +2230,15 @@ def _append_contraction_marks_sub(Z, iv, i, n, contraction_marks):
_append_contraction_marks_sub(Z, iv, Z[i - n, 1], n, contraction_marks)
-def _dendrogram_calculate_info(Z, p, truncate_mode, \
- color_threshold=np.inf, get_leaves=True, \
- orientation='top', labels=None, \
- count_sort=False, distance_sort=False, \
- show_leaf_counts=False, i=-1, iv=0.0, \
- ivl=[], n=0, icoord_list=[], dcoord_list=[], \
- lvs=None, mhr=False, \
- current_color=[], color_list=[], \
- currently_below_threshold=[], \
+def _dendrogram_calculate_info(Z, p, truncate_mode,
+ color_threshold=np.inf, get_leaves=True,
+ orientation='top', labels=None,
+ count_sort=False, distance_sort=False,
+ show_leaf_counts=False, i=-1, iv=0.0,
+ ivl=[], n=0, icoord_list=[], dcoord_list=[],
+ lvs=None, mhr=False,
+ current_color=[], color_list=[],
+ currently_below_threshold=[],
leaf_label_func=None, level=0,
contraction_marks=None,
link_color_func=None):
@@ -2724,7 +2724,7 @@ def _leader_identify(tr, T):
right = tr.get_right()
lfid = _leader_identify(left, T)
rfid = _leader_identify(right, T)
- print('ndid: %d lid: %d lfid: %d rid: %d rfid: %d' \
+ print('ndid: %d lid: %d lfid: %d rid: %d rfid: %d'
% (tr.get_id(), left.get_id(), lfid, right.get_id(), rfid))
if lfid != rfid:
if lfid != -1:
View
@@ -251,7 +251,7 @@ def py_vq(obs, code_book):
if not np.ndim(obs) == np.ndim(code_book):
raise ValueError("Observation and code_book should have the same rank")
elif not d == code_book.shape[1]:
- raise ValueError("Code book(%d) and obs(%d) should have the same " \
+ raise ValueError("Code book(%d) and obs(%d) should have the same "
"number of features (eg columns)""" %
(code_book.shape[1], d))
@@ -496,7 +496,7 @@ def kmeans(obs, k_or_guess, iter=20, thresh=1e-5):
if type(k_or_guess) == type(array([])):
guess = k_or_guess
if guess.size < 1:
- raise ValueError("Asked for 0 cluster ? initial book was %s" % \
+ raise ValueError("Asked for 0 cluster ? initial book was %s" %
guess)
result = _kmeans(obs, guess, thresh=thresh)
else:
@@ -966,7 +966,7 @@ def find(sub=None, disp=False):
if sub is None:
result = list(_current_constants.keys())
else:
- result = [key for key in _current_constants \
+ result = [key for key in _current_constants
if sub.lower() in key.lower()]
result.sort()
View
@@ -426,7 +426,7 @@ def _raw_fftnd(x, s, axes, direction, overwrite_x, work_function):
else:
noaxes = False
if len(axes) != len(s):
- raise ValueError("when given, axes and shape arguments "\
+ raise ValueError("when given, axes and shape arguments "
"have to be of the same length")
for dim in s:
@@ -561,7 +561,7 @@ def test_shape_axes_argument(self):
y = fftn(small_x,shape=(4,4),axes=(-2,-1))
assert_array_almost_equal(y,fftn(large_x1))
y = fftn(small_x,shape=(4,4),axes=(-1,-2))
- assert_array_almost_equal(y,swapaxes(\
+ assert_array_almost_equal(y,swapaxes(
fftn(swapaxes(large_x1,-1,-2)),-1,-2))
def test_shape_axes_argument2(self):
@@ -634,7 +634,7 @@ def test_complex(self):
for f in [fft, ifft]:
try:
f(x)
- raise AssertionError("Type %r not supported but does not fail" % \
+ raise AssertionError("Type %r not supported but does not fail" %
np.longcomplex)
except ValueError:
pass
@@ -649,7 +649,7 @@ def test_real(self):
for f in [fft, ifft]:
try:
f(x)
- raise AssertionError("Type %r not supported but does not fail" % \
+ raise AssertionError("Type %r not supported but does not fail" %
np.longcomplex)
except ValueError:
pass
@@ -274,8 +274,8 @@ def _basic_simps(y,start,stop,x,dx,axis):
hsum = h0 + h1
hprod = h0 * h1
h0divh1 = h0 / h1
- result = add.reduce(hsum/6.0*(y[slice0]*(2-1.0/h0divh1) + \
- y[slice1]*hsum*hsum/hprod + \
+ result = add.reduce(hsum/6.0*(y[slice0]*(2-1.0/h0divh1) +
+ y[slice1]*hsum*hsum/hprod +
y[slice2]*(2-h0divh1)),axis)
return result
@@ -452,7 +452,7 @@ def romb(y, dx=1.0, axis=-1, show=False):
if show:
if not isscalar(R[(1,1)]):
- print("*** Printing table only supported for integrals" + \
+ print("*** Printing table only supported for integrals" +
" of a single data set.")
else:
try:
@@ -706,12 +706,12 @@ def __init__(self, x, y, z, tx, ty, w=None, bbox=[None]*4, kx=3, ky=3,
ty1[ky+1:ny-ky-1] = ty
xb,xe,yb,ye = bbox
- tx1,ty1,c,fp,ier = dfitpack.surfit_lsq(x,y,z,tx1,ty1,w,\
- xb,xe,yb,ye,\
+ tx1,ty1,c,fp,ier = dfitpack.surfit_lsq(x,y,z,tx1,ty1,w,
+ xb,xe,yb,ye,
kx,ky,eps,lwrk2=1)
if ier>10:
- tx1,ty1,c,fp,ier = dfitpack.surfit_lsq(x,y,z,tx1,ty1,w,\
- xb,xe,yb,ye,\
+ tx1,ty1,c,fp,ier = dfitpack.surfit_lsq(x,y,z,tx1,ty1,w,
+ xb,xe,yb,ye,
kx,ky,eps,lwrk2=ier)
if ier in [0,-1,-2]: # normal return
pass
@@ -341,7 +341,7 @@ def __init__(self, x, y, kind='linear', axis=-1,
order = kind
kind = 'spline'
elif kind not in ('linear', 'nearest'):
- raise NotImplementedError("%s is unsupported: Use fitpack "\
+ raise NotImplementedError("%s is unsupported: Use fitpack "
"routines for other types." % kind)
x = array(x, copy=self.copy)
y = array(y, copy=self.copy)
@@ -136,7 +136,7 @@ def check_3(self,f=f1,per=0,s=0,a=0,b=2*pi,N=20,xb=None,xe=None,
x=a+(b-a)*arange(N+1,dtype=float)/float(N) # nodes
v=f(x)
nk=[]
- put(" k : Roots of s(x) approx %s x in [%s,%s]:"%\
+ put(" k : Roots of s(x) approx %s x in [%s,%s]:"%
(f(None),repr(round(a,3)),repr(round(b,3))))
for k in range(1,6):
tck=splrep(x,v,s=s,per=per,k=k,xe=xe)
@@ -164,7 +164,7 @@ def check_4(self,f=f1,per=0,s=0,a=0,b=2*pi,N=20,xb=None,xe=None,
err2 = abs(splev(uv[0],tck)-f(uv[0]))
assert_(err1 < 1e-2)
assert_(err2 < 1e-2)
- put(" %d : %s %.1e %.1e"%\
+ put(" %d : %s %.1e %.1e"%
(k,repr([round(z,3) for z in uv]),
err1,
err2))
@@ -255,7 +255,7 @@ def tokenize_multilines(iterable, val):
m = r_comattrval.match("".join(all[:-1]))
return m.group(1), m.group(2), i
else:
- raise ValueError("Cannot parse attribute names spread over multi "\
+ raise ValueError("Cannot parse attribute names spread over multi "
"lines yet")
@@ -204,7 +204,7 @@ def next_token(self):
self.curpos = m.end()
return Token(self.tokens[i], m.group(), self.curpos)
else:
- raise SyntaxError("Unknown character at position %d (%s)" \
+ raise SyntaxError("Unknown character at position %d (%s)"
% (self.curpos, self.data[curpos]))
@@ -264,10 +264,10 @@ def _expect(self, token, tp):
def _parse_format(self, tokens):
if not tokens[0].type == "LPAR":
- raise SyntaxError("Expected left parenthesis at position "\
+ raise SyntaxError("Expected left parenthesis at position "
"%d (got '%s')" % (0, tokens[0].value))
elif not tokens[-1].type == "RPAR":
- raise SyntaxError("Expected right parenthesis at position "\
+ raise SyntaxError("Expected right parenthesis at position "
"%d (got '%s')" % (len(tokens), tokens[-1].value))
tokens = tokens[1:-1]
@@ -98,7 +98,7 @@ def from_data(cls, m, title="Default title", key="0", mxtype=None, fmt=None):
elif values.dtype.kind in np.typecodes["AllFloat"]:
tp = "real"
else:
- raise NotImplementedError("type %s for values not implemented" \
+ raise NotImplementedError("type %s for values not implemented"
% values.dtype)
mxtype = HBMatrixType(tp, "unsymmetric", "assembled")
else:
@@ -160,7 +160,7 @@ def from_file(cls, fid):
else:
rhs_nlines = _expect_int(rhs_nlines)
if not rhs_nlines == 0:
- raise ValueError("Only files without right hand side supported for " \
+ raise ValueError("Only files without right hand side supported for "
"now.")
# Third line
@@ -245,12 +245,12 @@ def __init__(self, title, key,
values_format = parser.parse(values_format_str)
if isinstance(values_format, ExpFormat):
if not mxtype.value_type in ["real", "complex"]:
- raise ValueError("Inconsistency between matrix type %s and " \
+ raise ValueError("Inconsistency between matrix type %s and "
"value type %s" % (mxtype, values_format))
values_dtype = np.float64
elif isinstance(values_format, IntFormat):
if not mxtype.value_type in ["integer"]:
- raise ValueError("Inconsistency between matrix type %s and " \
+ raise ValueError("Inconsistency between matrix type %s and "
"value type %s" % (mxtype, values_format))
# XXX: fortran int -> dtype association ?
values_dtype = np.int
@@ -387,7 +387,7 @@ class HBMatrixType(object):
@classmethod
def from_fortran(cls, fmt):
if not len(fmt) == 3:
- raise ValueError("Fortran format for matrix type should be 3 " \
+ raise ValueError("Fortran format for matrix type should be 3 "
"characters long")
try:
value_type = cls._f2q_type[fmt[0]]
View
@@ -252,11 +252,11 @@ def _read_structure(f, array_desc, struct_desc):
for col in columns:
dtype = col['typecode']
if col['structure']:
- structure[col['name']][i] = _read_structure(f, \
- struct_desc['arrtable'][col['name']], \
+ structure[col['name']][i] = _read_structure(f,
+ struct_desc['arrtable'][col['name']],
struct_desc['structtable'][col['name']])
elif col['array']:
- structure[col['name']][i] = _read_array(f, dtype, \
+ structure[col['name']][i] = _read_array(f, dtype,
struct_desc['arrtable'][col['name']])
else:
structure[col['name']][i] = _read_data(f, dtype)
@@ -285,14 +285,14 @@ def _read_array(f, typecode, array_desc):
raise Exception("Error occurred while reading byte array")
# Read bytes as numpy array
- array = np.fromstring(f.read(array_desc['nbytes']), \
+ array = np.fromstring(f.read(array_desc['nbytes']),
dtype=DTYPE_DICT[typecode])
elif typecode in [2, 12]:
# These are 2 byte types, need to skip every two as they are not packed
- array = np.fromstring(f.read(array_desc['nbytes']*2), \
+ array = np.fromstring(f.read(array_desc['nbytes']*2),
dtype=DTYPE_DICT[typecode])[1::2]
else:
@@ -351,10 +351,10 @@ def _read_record(f):
raise Exception("VARSTART is not 7")
if rectypedesc['structure']:
- record['data'] = _read_structure(f, rectypedesc['array_desc'], \
+ record['data'] = _read_structure(f, rectypedesc['array_desc'],
rectypedesc['struct_desc'])
elif rectypedesc['array']:
- record['data'] = _read_array(f, rectypedesc['typecode'], \
+ record['data'] = _read_array(f, rectypedesc['typecode'],
rectypedesc['array_desc'])
else:
dtype = rectypedesc['typecode']
@@ -413,7 +413,7 @@ def _read_record(f):
else:
- raise Exception("record['rectype']=%s not implemented" % \
+ raise Exception("record['rectype']=%s not implemented" %
record['rectype'])
f.seek(nextrec)
@@ -846,7 +846,7 @@ def readsav(file_name, idict=None, python_dict=False,
break
print("-"*50)
- print("Successfully read %i records of which:" % \
+ print("Successfully read %i records of which:" %
(len(records)))
# Create convenience list of record types
View
@@ -297,7 +297,7 @@ def get_variables(self, variable_names=None):
res = self.read_var_array(hdr, process)
except MatReadError as err:
warnings.warn(
- 'Unreadable variable "%s", because "%s"' % \
+ 'Unreadable variable "%s", because "%s"' %
(name, err),
Warning, stacklevel=2)
res = "Read error: %s" % err
@@ -271,7 +271,7 @@ def _check_level(label, expected, actual):
decimal=5)
return
# Check types are as expected
- assert_true(types_compatible(expected, actual), \
+ assert_true(types_compatible(expected, actual),
"Expected type %s, got %s at %s" %
(type(expected), type(actual), label))
# A field in a record array may not be an ndarray
View
@@ -43,7 +43,7 @@ def configuration(parent_package='',top_path=None):
blas_opt = get_info('blas_opt',notfound_action=2)
- atlas_version = ([v[3:-3] for k,v in blas_opt.get('define_macros',[]) \
+ atlas_version = ([v[3:-3] for k,v in blas_opt.get('define_macros',[])
if k=='ATLAS_INFO']+[None])[0]
if atlas_version:
print(('ATLAS version: %s' % atlas_version))
@@ -24,7 +24,7 @@ def configuration(parent_package='',top_path=None):
lapack_opt = get_info('lapack_opt',notfound_action=2)
- atlas_version = ([v[3:-3] for k,v in lapack_opt.get('define_macros',[]) \
+ atlas_version = ([v[3:-3] for k,v in lapack_opt.get('define_macros',[])
if k=='ATLAS_INFO']+[None])[0]
if atlas_version:
print(('ATLAS version: %s' % atlas_version))
@@ -411,7 +411,7 @@ def rq(a, overwrite_a=False, lwork=None, mode='full', check_finite=True):
"""
if not mode in ['full', 'r', 'economic']:
- raise ValueError(\
+ raise ValueError(
"Mode argument should be one of ['full', 'r', 'economic']")
if check_finite:
View
@@ -18,7 +18,7 @@ def configuration(parent_package='',top_path=None):
if not lapack_opt:
raise NotFoundError('no lapack/blas resources found')
- atlas_version = ([v[3:-3] for k,v in lapack_opt.get('define_macros',[]) \
+ atlas_version = ([v[3:-3] for k,v in lapack_opt.get('define_macros',[])
if k=='ATLAS_INFO']+[None])[0]
if atlas_version:
print(('ATLAS version: %s' % atlas_version))
View
@@ -215,7 +215,7 @@ def toimage(arr, high=255, low=0, cmin=None, cmax=None, pal=None,
if iscomplexobj(data):
raise ValueError("Cannot convert a complex-valued array.")
shape = list(data.shape)
- valid = len(shape)==2 or ((len(shape)==3) and \
+ valid = len(shape)==2 or ((len(shape)==3) and
((3 in shape) or (4 in shape)))
if not valid:
raise ValueError("'arr' does not have a suitable array shape for any mode.")
Oops, something went wrong.

0 comments on commit b5ccb04

Please sign in to comment.