Skip to content

Commit 613bcf5

Browse files
committed
Remove use of backslash as line continuation.
1 parent f3e9efc commit 613bcf5

4 files changed

Lines changed: 52 additions & 50 deletions

File tree

pygpu/_array.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ def __divmod__(self, other):
143143
mod = self._empty_like_me(dtype=odtype)
144144

145145
if odtype.kind == 'f':
146-
tmpl = "div = floor((%(out_t)s)a / (%(out_t)s)b)," \
147-
"mod = fmod((%(out_t)s)a, (%(out_t)s)b)"
146+
tmpl = ("div = floor((%(out_t)s)a / (%(out_t)s)b),"
147+
"mod = fmod((%(out_t)s)a, (%(out_t)s)b)")
148148
else:
149-
tmpl = "div = (%(out_t)s)a / (%(out_t)s)b," \
150-
"mod = a %% b"
149+
tmpl = ("div = (%(out_t)s)a / (%(out_t)s)b,"
150+
"mod = a %% b")
151151

152152
ksrc = tmpl % {'out_t': dtype_to_ctype(odtype)}
153153

@@ -168,11 +168,11 @@ def __rdivmod__(self, other):
168168
mod = self._empty_like_me(dtype=odtype)
169169

170170
if odtype.kind == 'f':
171-
tmpl = "div = floor((%(out_t)s)a / (%(out_t)s)b)," \
172-
"mod = fmod((%(out_t)s)a, (%(out_t)s)b)"
171+
tmpl = ("div = floor((%(out_t)s)a / (%(out_t)s)b),"
172+
"mod = fmod((%(out_t)s)a, (%(out_t)s)b)")
173173
else:
174-
tmpl = "div = (%(out_t)s)a / (%(out_t)s)b," \
175-
"mod = a %% b"
174+
tmpl = ("div = (%(out_t)s)a / (%(out_t)s)b,"
175+
"mod = a %% b")
176176

177177
ksrc = tmpl % {'out_t': dtype_to_ctype(odtype)}
178178

pygpu/gpuarray.pyx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,8 +1374,8 @@ cdef GpuArray pygpu_empty_like(GpuArray a, ga_order ord, int typecode):
13741374
cdef GpuArray res
13751375

13761376
if ord == GA_ANY_ORDER:
1377-
if py_CHKFLAGS(a, GA_F_CONTIGUOUS) and \
1378-
not py_CHKFLAGS(a, GA_C_CONTIGUOUS):
1377+
if (py_CHKFLAGS(a, GA_F_CONTIGUOUS) and
1378+
not py_CHKFLAGS(a, GA_C_CONTIGUOUS)):
13791379
ord = GA_F_ORDER
13801380
else:
13811381
ord = GA_C_ORDER
@@ -1688,8 +1688,10 @@ cdef class GpuArray:
16881688
"""
16891689
if not np.PyArray_ISBEHAVED(dst):
16901690
raise ValueError, "Destination Numpy array is not well behaved: aligned and writeable"
1691-
if not ((self.flags.c_contiguous and self.flags.aligned and dst.flags['C_CONTIGUOUS']) or \
1692-
(self.flags.f_contiguous and self.flags.aligned and dst.flags['F_CONTIGUOUS'])):
1691+
if (not ((self.flags.c_contiguous and self.flags.aligned and
1692+
dst.flags['C_CONTIGUOUS']) or
1693+
(self.flags.f_contiguous and self.flags.aligned and
1694+
dst.flags['F_CONTIGUOUS']))):
16931695
raise ValueError, "GpuArray and Numpy array do not match in contiguity or GpuArray is not aligned"
16941696
if self.dtype != dst.dtype:
16951697
raise ValueError, "GpuArray and Numpy array do not have matching data types"
@@ -2033,13 +2035,13 @@ cdef class GpuArray:
20332035
# is also required for numpy compat.
20342036
el = key.index(Ellipsis)
20352037
if isinstance(key, tuple):
2036-
key = key[:el] + \
2037-
(Ellipsis,)*(self.ga.nd - (len(key) - 1)) + \
2038-
key[el+1:]
2038+
key = (key[:el] +
2039+
(Ellipsis,)*(self.ga.nd - (len(key) - 1)) +
2040+
key[el+1:])
20392041
else:
2040-
key = key[:el] + \
2041-
[Ellipsis,]*(self.ga.nd - (len(key) - 1)) + \
2042-
key[el+1:]
2042+
key = (key[:el] +
2043+
[Ellipsis,]*(self.ga.nd - (len(key) - 1)) +
2044+
key[el+1:])
20432045
if len(key) > self.ga.nd:
20442046
raise IndexError, "too many indices"
20452047
for i in range(0, len(key)):

pygpu/tests/test_blas.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ def test_gemv():
4949
bools = [False, True]
5050
for shape, order, trans, offseted_i, sliced in product(
5151
[(100, 128), (128, 50)], 'fc', bools, bools, [1, 2, -1, -2]):
52-
yield gemv, shape, 'float32', order, trans, \
53-
offseted_i, sliced, True, False
52+
yield (gemv, shape, 'float32', order, trans,
53+
offseted_i, sliced, True, False)
5454
for overwrite, init_y in product(bools, bools):
55-
yield gemv, (4, 3), 'float32', 'f', False, False, 1, \
56-
overwrite, init_y
55+
yield (gemv, (4, 3), 'float32', 'f', False, False, 1,
56+
overwrite, init_y)
5757
yield gemv, (32, 32), 'float64', 'f', False, False, 1, True, False
5858
for alpha, beta, overwrite in product(
5959
[0, 1, -1, 0.6], [0, 1, -1, 0.6], bools):
60-
yield gemv, (32, 32), 'float32', 'f', False, False, 1, \
61-
overwrite, True, alpha, beta
60+
yield (gemv, (32, 32), 'float32', 'f', False, False, 1,
61+
overwrite, True, alpha, beta)
6262

6363

6464
@guard_devsup
@@ -96,17 +96,17 @@ def test_gemm():
9696
for (m, n, k), order, trans, offseted_o in product(
9797
[(48, 15, 32), (15, 32, 48)], list(product(*['fc']*3)),
9898
list(product(bools, bools)), bools):
99-
yield gemm, m, n, k, 'float32', order, trans, \
100-
offseted_o, 1, False, False
99+
yield (gemm, m, n, k, 'float32', order, trans,
100+
offseted_o, 1, False, False)
101101
for sliced, overwrite, init_res in product([1, 2, -1, -2], bools, bools):
102-
yield gemm, 4, 3, 2, 'float32', ('f', 'f', 'f'), \
103-
(False, False), False, sliced, overwrite, init_res
104-
yield gemm, 32, 32, 32, 'float64', ('f', 'f', 'f'), (False, False), \
105-
False, 1, False, False
102+
yield (gemm, 4, 3, 2, 'float32', ('f', 'f', 'f'),
103+
(False, False), False, sliced, overwrite, init_res)
104+
yield (gemm, 32, 32, 32, 'float64', ('f', 'f', 'f'), (False, False),
105+
False, 1, False, False)
106106
for alpha, beta, overwrite in product(
107107
[0, 1, -1, 0.6], [0, 1, -1, 0.6], bools):
108-
yield gemm, 32, 23, 32, 'float32', ('f', 'f', 'f'), \
109-
(False, False), False, 1, overwrite, True, alpha, beta
108+
yield (gemm, 32, 23, 32, 'float32', ('f', 'f', 'f'),
109+
(False, False), False, 1, overwrite, True, alpha, beta)
110110

111111

112112
@guard_devsup
@@ -179,17 +179,17 @@ def test_rgemmBatch_3d():
179179
[1, 17, 31], [(24, 7, 16), (7, 16, 24)],
180180
list(product('fc', 'fc', 'c')),
181181
list(product(bools, bools)), bools):
182-
yield rgemmBatch_3d, b, m, n, k, 'float32', order, trans, \
183-
offseted_o, 1, False, False
182+
yield (rgemmBatch_3d, b, m, n, k, 'float32', order, trans,
183+
offseted_o, 1, False, False)
184184
for sliced, overwrite, init_res in product([1, 2, -1, -2], bools, bools):
185-
yield rgemmBatch_3d, 5, 4, 3, 2, 'float32', ('f', 'f', 'c'), \
186-
(False, False), False, sliced, overwrite, init_res
187-
yield rgemmBatch_3d, 16, 16, 16, 16, 'float64', ('f', 'f', 'c'), \
188-
(False, False), False, 1, False, False
185+
yield (rgemmBatch_3d, 5, 4, 3, 2, 'float32', ('f', 'f', 'c'),
186+
(False, False), False, sliced, overwrite, init_res)
187+
yield (rgemmBatch_3d, 16, 16, 16, 16, 'float64', ('f', 'f', 'c'),
188+
(False, False), False, 1, False, False)
189189
for alpha, beta, overwrite in product(
190190
[0, 1, -1, 0.6], [0, 1, -1, 0.6], bools):
191-
yield rgemmBatch_3d, 16, 16, 9, 16, 'float32', ('f', 'f', 'c'), \
192-
(False, False), False, 1, overwrite, True, alpha, beta
191+
yield (rgemmBatch_3d, 16, 16, 9, 16, 'float32', ('f', 'f', 'c'),
192+
(False, False), False, 1, overwrite, True, alpha, beta)
193193

194194

195195
@guard_devsup

pygpu/tests/test_gpu_ndarray.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def test_hash():
4949

5050
def test_bool():
5151
for data in [numpy.empty((0, 33)), [[1]], [[0]], [], [0], [1], 0, 1]:
52-
assert bool(pygpu.asarray(data, context=ctx)) == \
53-
bool(numpy.asarray(data))
52+
assert (bool(pygpu.asarray(data, context=ctx)) ==
53+
bool(numpy.asarray(data)))
5454

5555

5656
def test_transfer():
@@ -143,8 +143,8 @@ def test_ascontiguousarray():
143143
for offseted_i in [True, True]:
144144
for sliced in [1, 2, -1, -2]:
145145
for order in ['f', 'c']:
146-
yield ascontiguousarray, shp, dtype, offseted_o, \
147-
offseted_i, sliced, order
146+
yield (ascontiguousarray, shp, dtype, offseted_o,
147+
offseted_i, sliced, order)
148148

149149

150150
@guard_devsup
@@ -179,8 +179,8 @@ def test_asfortranarray():
179179
for offseted_inner in [True, False]:
180180
for sliced in [1, 2, -1, -2]:
181181
for order in ['f', 'c']:
182-
yield asfortranarray, shp, dtype, offseted_outer, \
183-
offseted_inner, sliced, order
182+
yield (asfortranarray, shp, dtype, offseted_outer,
183+
offseted_inner, sliced, order)
184184

185185

186186
@guard_devsup
@@ -416,8 +416,8 @@ def test_copy_view():
416416

417417

418418
def check_memory_region(a, a_op, b, b_op):
419-
assert numpy.may_share_memory(a, a_op) == \
420-
pygpu.gpuarray.may_share_memory(b, b_op)
419+
assert (numpy.may_share_memory(a, a_op) ==
420+
pygpu.gpuarray.may_share_memory(b, b_op))
421421

422422

423423
@guard_devsup
@@ -527,8 +527,8 @@ def test_transpose():
527527
for sliced in [1, 2, -2, -1]:
528528
yield transpose, shp, offseted, sliced, order
529529
for perm in permutations(list(range(len(shp)))):
530-
yield transpose_perm, shp, perm, offseted, sliced, \
531-
order
530+
yield (transpose_perm, shp, perm, offseted, sliced,
531+
order)
532532

533533

534534
def transpose(shp, offseted, sliced, order):

0 commit comments

Comments
 (0)