[diffoscope] 10/12: fix pep8 E261
Mattia Rizzolo
mattia at debian.org
Sat Sep 9 22:04:39 CEST 2017
This is an automated email from the git hooks/post-receive script.
mattia pushed a commit to branch master
in repository diffoscope.
commit d02e913cc6fc6d2f39f9b7b85e7941604e839498
Author: Mattia Rizzolo <mattia at debian.org>
Date: Sat Sep 9 21:57:21 2017 +0200
fix pep8 E261
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
---
diffoscope/changes.py | 2 +-
diffoscope/comparators/cbfs.py | 4 ++--
diffoscope/comparators/utils/command.py | 2 +-
diffoscope/comparators/utils/container.py | 2 +-
diffoscope/comparators/utils/file.py | 10 +++++-----
diffoscope/config.py | 10 +++++-----
diffoscope/diff.py | 2 +-
diffoscope/presenters/html/html.py | 24 ++++++++++++------------
tests/test_main.py | 4 ++--
tests/test_readers.py | 2 +-
10 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/diffoscope/changes.py b/diffoscope/changes.py
index 7fd5889..ae57da3 100644
--- a/diffoscope/changes.py
+++ b/diffoscope/changes.py
@@ -316,7 +316,7 @@ class Changes(object):
checksums = self.get("Files")
field_name = "md5sum"
- changed_files = None # appease pylint
+ changed_files = None # appease pylint
for changed_files in checksums:
if changed_files['name'] == os.path.basename(filename):
break
diff --git a/diffoscope/comparators/cbfs.py b/diffoscope/comparators/cbfs.py
index be5e0ed..149f3e4 100644
--- a/diffoscope/comparators/cbfs.py
+++ b/diffoscope/comparators/cbfs.py
@@ -84,10 +84,10 @@ class CbfsContainer(Archive):
CBFS_HEADER_MAGIC = 0x4F524243
CBFS_HEADER_VERSION1 = 0x31313131
CBFS_HEADER_VERSION2 = 0x31313132
-CBFS_HEADER_SIZE = 8 * 4 # 8 * uint32_t
+CBFS_HEADER_SIZE = 8 * 4 # 8 * uint32_t
# On 2015-12-15, the largest image produced by coreboot is 16 MiB
-CBFS_MAXIMUM_FILE_SIZE = 24 * 2 ** 20 # 24 MiB
+CBFS_MAXIMUM_FILE_SIZE = 24 * 2 ** 20 # 24 MiB
def is_header_valid(buf, size, offset=0):
magic, version, romsize, bootblocksize, align, cbfs_offset, architecture, pad = struct.unpack_from('!IIIIIIII', buf, offset)
diff --git a/diffoscope/comparators/utils/command.py b/diffoscope/comparators/utils/command.py
index 5014140..9453a1b 100644
--- a/diffoscope/comparators/utils/command.py
+++ b/diffoscope/comparators/utils/command.py
@@ -64,7 +64,7 @@ class Command(object, metaclass=abc.ABCMeta):
return ' '.join(map(lambda x: '{}' if x == self.path else shlex.quote(x), self.cmdline()))
def env(self):
- return None # inherit parent environment by default
+ return None # inherit parent environment by default
# Define only if needed. We take care of closing stdin.
#def feed_stdin(self, stdin)
diff --git a/diffoscope/comparators/utils/container.py b/diffoscope/comparators/utils/container.py
index b35cfa3..5627f5b 100644
--- a/diffoscope/comparators/utils/container.py
+++ b/diffoscope/comparators/utils/container.py
@@ -112,7 +112,7 @@ class Container(object, metaclass=abc.ABCMeta):
def get_adjusted_members_sizes(self):
for name, member in self.get_adjusted_members():
if member.is_directory():
- size = 4096 # default "size" of a directory
+ size = 4096 # default "size" of a directory
else:
size = path_apparent_size(member.path)
yield name, (member, size)
diff --git a/diffoscope/comparators/utils/file.py b/diffoscope/comparators/utils/file.py
index e17ed38..a87a2dd 100644
--- a/diffoscope/comparators/utils/file.py
+++ b/diffoscope/comparators/utils/file.py
@@ -36,7 +36,7 @@ try:
except ImportError: # noqa
tlsh = None
-SMALL_FILE_THRESHOLD = 65536 # 64 kiB
+SMALL_FILE_THRESHOLD = 65536 # 64 kiB
logger = logging.getLogger(__name__)
@@ -58,7 +58,7 @@ def path_apparent_size(path=".", visited=None):
class File(object, metaclass=abc.ABCMeta):
- if hasattr(magic, 'open'): # use Magic-file-extensions from file
+ if hasattr(magic, 'open'): # use Magic-file-extensions from file
@classmethod
def guess_file_type(self, path):
if not hasattr(self, '_mimedb'):
@@ -72,7 +72,7 @@ class File(object, metaclass=abc.ABCMeta):
self._mimedb_encoding = magic.open(magic.MAGIC_MIME_ENCODING)
self._mimedb_encoding.load()
return self._mimedb_encoding.file(path)
- else: # use python-magic
+ else: # use python-magic
@classmethod
def guess_file_type(self, path):
if not hasattr(self, '_mimedb'):
@@ -125,14 +125,14 @@ class File(object, metaclass=abc.ABCMeta):
lambda m, t: t.search(m), file.magic_file_type),
(cls.FILE_TYPE_HEADER_PREFIX,
bytes.startswith, file.file_header),
- ) if test[0]] # filter out undefined tests
+ ) if test[0]] # filter out undefined tests
all_tests = [test for test in (
(cls.FILE_EXTENSION_SUFFIX,
str.endswith, file.name),
(file_type_tests,
run_tests, any),
- ) if test[0]] # filter out undefined tests, inc. file_type_tests if it's empty
+ ) if test[0]] # filter out undefined tests, inc. file_type_tests if it's empty
return run_tests(all, all_tests) if all_tests else False
diff --git a/diffoscope/config.py b/diffoscope/config.py
index 4565573..aa23d2b 100644
--- a/diffoscope/config.py
+++ b/diffoscope/config.py
@@ -25,13 +25,13 @@ class Config(object):
max_diff_block_lines_saved = float("inf")
# hard limits, restricts single-file and multi-file formats
- max_report_size = 40 * 2 ** 20 # 40 MB
- max_diff_block_lines = 2 ** 10 # 1024 lines
+ max_report_size = 40 * 2 ** 20 # 40 MB
+ max_diff_block_lines = 2 ** 10 # 1024 lines
# structural limits, restricts single-file formats
# semi-restricts multi-file formats
- max_page_size = 400 * 2 ** 10 # 400 kB
- max_page_size_child = 200 * 2 ** 10 # 200 kB
- max_page_diff_block_lines = 2 ** 7 # 128 lines
+ max_page_size = 400 * 2 ** 10 # 400 kB
+ max_page_size_child = 200 * 2 ** 10 # 200 kB
+ max_page_diff_block_lines = 2 ** 7 # 128 lines
max_text_report_size = 0
diff --git a/diffoscope/diff.py b/diffoscope/diff.py
index 4c32a47..9a27c4c 100644
--- a/diffoscope/diff.py
+++ b/diffoscope/diff.py
@@ -293,7 +293,7 @@ def color_unified_diff(diff):
DIFFON = "\x01"
DIFFOFF = "\x02"
-MAX_WF_SIZE = 1024 # any higher, and linediff takes >1 second and >200MB RAM
+MAX_WF_SIZE = 1024 # any higher, and linediff takes >1 second and >200MB RAM
def _linediff_sane(x):
# turn non-printable chars into "."
diff --git a/diffoscope/presenters/html/html.py b/diffoscope/presenters/html/html.py
index ddbcd78..875f318 100644
--- a/diffoscope/presenters/html/html.py
+++ b/diffoscope/presenters/html/html.py
@@ -219,7 +219,7 @@ def output_node(ctx, difference, path, indentstr, indentnum):
ud_cont = ud_cont.send
udiff = udiff.pformatl(PartialString.of(ud_cont))
else:
- for _ in ud_cont: pass # exhaust the iterator, avoids GeneratorExit
+ for _ in ud_cont: pass # exhaust the iterator, avoids GeneratorExit
ud_cont = None
# PartialString for this node
@@ -237,7 +237,7 @@ def output_node(ctx, difference, path, indentstr, indentnum):
{-1}""", 2, cont).pformatl(indent, child)
t = cont(t, child)
- assert len(t.holes) >= len(difference.details) + 1 # there might be extra holes for the unified diff continuation
+ assert len(t.holes) >= len(difference.details) + 1 # there might be extra holes for the unified diff continuation
return cont(t, u""), ud_cont
def output_header(css_url, our_css_url=False, icon_url=None):
@@ -294,7 +294,7 @@ class HTMLSideBySidePresenter(object):
supports_visual_diffs = True
def __init__(self):
- self.max_lines = Config().max_diff_block_lines # only for html-dir
+ self.max_lines = Config().max_diff_block_lines # only for html-dir
self.max_lines_parent = Config().max_page_diff_block_lines
self.max_page_size_child = Config().max_page_size_child
@@ -370,11 +370,11 @@ class HTMLSideBySidePresenter(object):
if self.spl_rows >= self.max_lines:
raise DiffBlockLimitReached()
- if self.spl_current_page == 0: # on parent page
+ if self.spl_current_page == 0: # on parent page
if self.spl_rows < self.max_lines_parent:
return False
logger.debug("new unified-diff subpage, parent page went over %s lines", self.max_lines_parent)
- else: # on child page
+ else: # on child page
if self.bytes_max_total and self.bytes_written > self.bytes_max_total:
raise PrintLimitReached()
if self.spl_print_func.bytes_written < self.max_page_size_child:
@@ -557,11 +557,11 @@ class HTMLPresenter(Presenter):
return templates.DIFFNODE_LIMIT
def output_difference(self, ctx, root_difference):
- outputs = {} # nodes to their partial output
- ancestors = {} # child nodes to ancestor nodes
+ outputs = {} # nodes to their partial output
+ ancestors = {} # child nodes to ancestor nodes
placeholder_len = len(self.output_node_placeholder("XXXXXXXXXXXXXXXX", not ctx.single_page))
- continuations = {} # functions to print unified diff continuations (html-dir only)
- printers = {} # nodes to their printers
+ continuations = {} # functions to print unified diff continuations (html-dir only)
+ printers = {} # nodes to their printers
def smallest_first(node, parscore):
depth = parscore[0] + 1 if parscore else 0
@@ -569,7 +569,7 @@ class HTMLPresenter(Presenter):
# Difference is not comparable so use memory address in event of a tie
return depth, node.size_self(), id(node), parents + [node]
- pruned = set() # children
+ pruned = set() # children
for node, score in root_difference.traverse_heapq(smallest_first, yield_score=True):
if node in pruned:
continue
@@ -608,7 +608,7 @@ class HTMLPresenter(Presenter):
outputs[ancestor] = outputs[ancestor].pformat({node: placeholder})
self.maybe_print(ancestor, printers, outputs, continuations)
footer = output_footer()
- if not make_new_subpage: # we hit a limit, either max-report-size or single-page
+ if not make_new_subpage: # we hit a limit, either max-report-size or single-page
if not outputs:
# no more holes, don't traverse any more nodes
break
@@ -648,7 +648,7 @@ class HTMLPresenter(Presenter):
def ensure_jquery(self, jquery_url, basedir, default_override):
if jquery_url is None:
jquery_url = default_override
- default_override = None # later, we can detect jquery_url was None
+ default_override = None # later, we can detect jquery_url was None
if jquery_url == 'disable' or not jquery_url:
return None
diff --git a/tests/test_main.py b/tests/test_main.py
index dbb5e91..38f5d3e 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -79,7 +79,7 @@ def test_remove_temp_files_on_sigterm(capsys, tmpdir, monkeypatch):
os._exit(ret)
else:
_, ret = os.waitpid(pid, 0)
- assert (ret >> 8) == 2 # having received SIGTERM is trouble
+ assert (ret >> 8) == 2 # having received SIGTERM is trouble
assert os.listdir(str(tmpdir)) == []
def test_ctrl_c_handling(tmpdir, monkeypatch, capsys):
@@ -108,7 +108,7 @@ def test_no_differences(capsys):
def test_no_differences_directories(capsys, tmpdir):
def create_dir(x):
path = str(tmpdir.mkdir(x))
- os.utime(path, (0, 0)) # Ensure consistent mtime
+ os.utime(path, (0, 0)) # Ensure consistent mtime
return path
ret, out, err = run(capsys, create_dir('a'), create_dir('b'))
diff --git a/tests/test_readers.py b/tests/test_readers.py
index d4fea55..bb7e9ce 100644
--- a/tests/test_readers.py
+++ b/tests/test_readers.py
@@ -34,7 +34,7 @@ def run_read_write(capsys, diff, *args):
assert err == ''
assert exc.value.code == 1
- assert out == get_data(diff) # presented-output is same as parsed-input
+ assert out == get_data(diff) # presented-output is same as parsed-input
return out
def run_diff_read(diffpath):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list