gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated: flake8 fixes for pydiffer


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: flake8 fixes for pydiffer
Date: Mon, 05 Mar 2018 09:10:35 +0100

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 204601365 flake8 fixes for pydiffer
204601365 is described below

commit 2046013659e9b495e8561a4cb56bc4e0de0287ac
Author: ng0 <address@hidden>
AuthorDate: Mon Mar 5 08:10:43 2018 +0000

    flake8 fixes for pydiffer
---
 contrib/pydiffer.py.in | 67 +++++++++++++++++++++++++++-----------------------
 1 file changed, 36 insertions(+), 31 deletions(-)

diff --git a/contrib/pydiffer.py.in b/contrib/pydiffer.py.in
index 23d546b25..10145371c 100644
--- a/contrib/pydiffer.py.in
+++ b/contrib/pydiffer.py.in
@@ -4,36 +4,41 @@ import sys
 import difflib
 import filecmp
 
-def getdiff (old, new):
-  diff = []
-  with open (old) as a:
-    with open (new) as b:
-      for l in difflib.unified_diff (a.read ().splitlines (), b.read 
().splitlines ()):
-        diff.append (l)
-  return diff
-
-def dc_getdiff (dc, old, new):
-  diff = []
-  for f in dc.left_only:
-    diff.append ("Only in {}: {}".format (old, f))
-  for f in dc.right_only:
-    diff.append ("Only in {}: {}".format (new, f))
-  for f in dc.diff_files:
-    r = getdiff (os.path.join (old, f), os.path.join (new, f))
-    diff.extend (r)
-  for dn, dc in dc.subdirs.items ():
-    r = dc_getdiff (dc, os.path.join (old, dn), os.path.join (new, dn))
-    diff.extend (r)
-  return diff
-
-def dcdiff (old, new):
-  dc = filecmp.dircmp (old, new)
-  diff = dc_getdiff (dc, old, new)
-  return diff
-
-def main ():
-  for l in dcdiff (sys.argv[1], sys.argv[2]):
-    print (l)
+
+def getdiff(old, new):
+    diff = []
+    with open(old) as a:
+        with open(new) as b:
+            for l in difflib.unified_diff(a.read().splitlines(), 
b.read().splitlines()):
+                diff.append(l)
+    return diff
+
+
+def dc_getdiff(dc, old, new):
+    diff = []
+    for f in dc.left_only:
+        diff.append("Only in {}: {}".format(old, f))
+    for f in dc.right_only:
+        diff.append("Only in {}: {}".format(new, f))
+    for f in dc.diff_files:
+        r = getdiff(os.path.join(old, f), os.path.join(new, f))
+        diff.extend(r)
+    for dn, dc in dc.subdirs.items():
+        r = dc_getdiff(dc, os.path.join(old, dn), os.path.join(new, dn))
+        diff.extend(r)
+    return diff
+
+
+def dcdiff(old, new):
+    dc = filecmp.dircmp(old, new)
+    diff = dc_getdiff(dc, old, new)
+    return diff
+
+
+def main():
+    for l in dcdiff(sys.argv[1], sys.argv[2]):
+        print(l)
+
 
 if __name__ == '__main__':
-  main ()
+    main()

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]