7be4daa40aa9 — sietse.brouwer 7 years ago
style fixes in pep8_hook.py
1 files changed, 4 insertions(+), 7 deletions(-)

M pep8_hook.py
M pep8_hook.py +4 -7
@@ 9,8 9,6 @@ import tempfile
 from contextlib import contextmanager
 from subprocess import check_output
 
-# make this a pretxncommit hook
-
 
 @contextmanager
 def tempdir(prefix):

          
@@ 47,7 45,8 @@ def write_file(repo, rev, filename, fold
 
 def run_pep8(repo, rev, filenames, folder, quiet):
     """Return a summary pep8 error report"""
-    write_our_file = functools.partial(write_file, repo=repo, rev=rev, folder=folder)
+    write_our_file = functools.partial(write_file, repo=repo, rev=rev,
+            folder=folder)
     if quiet:
         pep8style = pep8.StyleGuide(quiet=True, config_file=True)
     else:

          
@@ 56,6 55,7 @@ def run_pep8(repo, rev, filenames, folde
 
     known_filenames = filter(lambda f: f in repo[rev], filenames)
     written_files = (write_our_file(filename=f) for f in known_filenames)
+
     return pep8style.check_files(written_files).total_errors
 
 

          
@@ 74,7 74,6 @@ def pep8_hook(ui, repo, hooktype, node, 
     except ValueError:
         max_change = 0
 
-
     if len(parent2):
         # we are on a merge commit
         ui.note('merge commit, not checking pep8')

          
@@ 85,13 84,11 @@ def pep8_hook(ui, repo, hooktype, node, 
     with tempdir('old-') as tempold, tempdir('new-') as tempnew:
         old_count = get_pep8_total(repo, parent1, filenames, tempold)
         new_count = get_pep8_total(repo, node, filenames, tempnew)
-        # ipdb.set_trace()
 
         if old_count + max_change < new_count:
             print_pep8(repo, node, filenames, tempnew)
             ui.status((
-                    'pep8 count went from {old} to {new}, ' +
-                    'please reduce to {target}\n'
+                    'pep8 count went from {old} to {new}, please reduce to {target}\n'
                 ).format(
                     old=old_count,
                     new=new_count,