Fix many whitespace problems
@@ -737,8 +737,8 @@ class Writer:
data.extend(l)
if self.rescale:
oldextend = extend
- factor = \
- float(2**self.rescale[1]-1) / float(2**self.rescale[0]-1)
+ factor = (float(2 ** self.rescale[1] - 1) /
+ float(2 ** self.rescale[0] - 1))
def extend(sl):
oldextend([int(round(factor * x)) for x in sl])
@@ -1546,15 +1546,15 @@ class Reader:
# writes to the output array randomly (well, not quite), so the
# entire output array must be in memory.
fmt = 'BH'[self.bitdepth > 8]
- a = array(fmt, [0]*vpr*self.height)
+ a = array(fmt, [0] * (vpr * self.height))
source_offset = 0
for xstart, ystart, xstep, ystep in _adam7:
if xstart >= self.width:
continue
- # The previous (reconstructed) scanline. None at the
- # beginning of a pass to indicate that there is no previous
- # line.
+ # The previous (reconstructed) scanline.
+ # `None` at the beginning of a pass
+ # to indicate that there is no previous line.
recon = None
# Pixels per row (reduced pass image)
ppr = int(math.ceil((self.width - xstart) / float(xstep)))
@@ -1597,7 +1597,8 @@ class Reader:
return array('B', raw)
if self.bitdepth == 16:
raw = tostring(raw)
- return array('H', struct.unpack('!%dH' % (len(raw)//2), raw))
+ return array('H',
+ struct.unpack('!%dH' % (len(raw) // 2), raw))
assert self.bitdepth < 8
width = self.width
# Samples per byte
@@ -1906,7 +1907,8 @@ class Reader:
# Like :meth:`group` but producing an array.array object for
# each row.
pixels = map(lambda *row: array(arraycode, row),
- *[iter(self.deinterlace(raw))]*self.width*self.planes)
+ * [iter(self.deinterlace(raw))] *
+ (self.width * self.planes))
else:
pixels = self.iterboxed(self.iterstraight(raw))
meta = dict()
