Commit b89e8e18 authored by Chris Lamb's avatar Chris Lamb 💬

PEP8: E226 - Add missing whitespaces around operators.

parent 28aa66ee
......@@ -81,10 +81,10 @@ class ApkContainer(Archive):
current_dir.insert(0, relpath)
continue
relpath = abspath[len(self._unpacked)+1:]
relpath = abspath[len(self._unpacked) + 1:]
if filename == 'AndroidManifest.xml':
containing_dir = root[len(self._unpacked)+1:]
containing_dir = root[len(self._unpacked) + 1:]
if containing_dir == 'original':
self._andmanifest_orig = relpath
if containing_dir == '':
......
......@@ -61,7 +61,7 @@ def _parse(file):
_format(xml)
xml.normalize()
return xml.toprettyxml(indent=2*' ', encoding='utf-8').decode('utf-8')
return xml.toprettyxml(indent=2 * ' ', encoding='utf-8').decode('utf-8')
class XMLFile(File):
......
......@@ -431,23 +431,23 @@ def linediff_wagnerfischer(s, t):
quadratic performance O(m*n).
'''
m, n = len(s), len(t)
d = [[(0, 0) for i in range(n+1)] for i in range(m+1)]
d = [[(0, 0) for i in range(n + 1)] for i in range(m + 1)]
d[0][0] = (0, (0, 0))
for i in range(1, m+1):
d[i][0] = (i, (i-1, 0))
for j in range(1, n+1):
d[0][j] = (j, (0, j-1))
for i in range(1, m+1):
for j in range(1, n+1):
if s[i-1] == t[j-1]:
for i in range(1, m + 1):
d[i][0] = (i, (i -1, 0))
for j in range(1, n + 1):
d[0][j] = (j, (0, j - 1))
for i in range(1, m + 1):
for j in range(1, n + 1):
if s[i - 1] == t[j - 1]:
cost = 0
else:
cost = 1
d[i][j] = min((d[i-1][j][0] + 1, (i-1, j)),
(d[i][j-1][0] + 1, (i, j-1)),
(d[i-1][j-1][0] + cost, (i-1, j-1)))
d[i][j] = min((d[i - 1][j][0] + 1, (i -1, j)),
(d[i][j - 1][0] + 1, (i, j - 1)),
(d[i - 1][j - 1][0] + cost, (i - 1, j - 1)))
coords = []
coord = (m, n)
......@@ -464,13 +464,13 @@ def linediff_wagnerfischer(s, t):
fx, fy = father_coord
father_val = d[fx][fy][0]
diff = (cx-fx, cy-fy)
diff = (cx - fx, cy - fy)
if diff == (0, 1):
yield (False, ""), (True, t[fy])
elif diff == (1, 0):
yield (True, s[fx]), (False, "")
elif child_val-father_val == 1:
elif child_val - father_val == 1:
yield (True, s[fx]), (True, t[fy])
else:
assert s[fx] == t[fy]
......
......@@ -149,7 +149,7 @@ class Difference(object):
yield self
if depth != 0:
for d in self._details:
yield from d.traverse_depth(depth-1)
yield from d.traverse_depth(depth - 1)
def traverse_breadth(self, queue=None):
queue = queue if queue is not None else [self]
......
......@@ -129,7 +129,7 @@ def convert(s, ponct=0, tag=''):
n = TABSIZE - (i % TABSIZE)
if n == 0:
n = TABSIZE
t.write('<span class="diffponct">\xbb</span>'+'\xa0'*(n-1))
t.write('<span class="diffponct">\xbb</span>' + '\xa0' * (n - 1))
elif c == " " and ponct == 1:
t.write('<span class="diffponct">\xb7</span>')
elif c == "\n" and ponct == 1:
......@@ -215,7 +215,7 @@ def output_node(ctx, difference, path, indentstr, indentnum):
visuals = u""
for visual in difference.visuals:
visuals += output_visual(visual, path, indentstr, indentnum+1)
visuals += output_visual(visual, path, indentstr, indentnum + 1)
udiff = u""
ud_cont = None
......@@ -240,7 +240,7 @@ def output_node(ctx, difference, path, indentstr, indentnum):
# Add holes for child nodes
for d in difference.details:
child = output_node_frame(d, path + [d], indentstr, indentnum+1, PartialString.of(d))
child = output_node_frame(d, path + [d], indentstr, indentnum +1, PartialString.of(d))
child = PartialString.numl(u"""{0[1]}<div class="difference">
{1}{0[1]}</div>
{-1}""", 2, cont).pformatl(indent, child)
......@@ -600,7 +600,7 @@ class HTMLPresenter(Presenter):
ancestor = ancestors.pop(node, None)
assert ancestor in path or (ancestor is None and node is root_difference)
node_output, node_continuation = output_node(ctx, node, path, " ", len(path)-1)
node_output, node_continuation = output_node(ctx, node, path, " ", len(path) - 1)
add_to_existing = False
if ancestor:
......
......@@ -29,7 +29,7 @@ def round_sigfig(num, s):
# https://stackoverflow.com/questions/3410976/how-to-round-a-number-to-significant-figures-in-python
# This was too painful :/
x = float(('%%.%sg' % s) % num)
return x if abs(x) < (10**(s-1)) else int(x)
return x if abs(x) < (10 ** (s -1)) else int(x)
def sizeof_fmt(num, suffix='B', sigfig=3):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment