[meld] misc: fix pyflakes and pep8



commit 2b7d8a0ff41a24da91973f29e91b547e47f07939
Author: Sandro Bonazzola <sandro bonazzola gmail com>
Date:   Sun Jan 11 09:22:19 2015 +0100

    misc: fix pyflakes and pep8
    
    Fixed pyflakes and pep8 issues in misc.py
    
    Signed-off-by: Sandro Bonazzola <sandro bonazzola gmail com>

 meld/misc.py |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/meld/misc.py b/meld/misc.py
index 02fd9d1..28ac575 100644
--- a/meld/misc.py
+++ b/meld/misc.py
@@ -24,7 +24,6 @@ import shutil
 import re
 import subprocess
 
-from gi.repository import GObject
 from gi.repository import Gtk
 
 from meld.conf import _
@@ -129,6 +128,7 @@ def position_menu_under_widget(menu, widget):
 
     return (x, y, False)
 
+
 def make_tool_button_widget(label):
     """Make a GtkToolButton label-widget suggestive of a menu dropdown"""
     arrow = Gtk.Arrow(
@@ -140,9 +140,11 @@ def make_tool_button_widget(label):
     hbox.show_all()
     return hbox
 
+
 def gdk_to_cairo_color(color):
     return (color.red / 65535., color.green / 65535., color.blue / 65535.)
 
+
 def all_equal(alist):
     """Return true if all members of the list are equal to the first.
 
@@ -154,7 +156,8 @@ def all_equal(alist):
             if n != first:
                 return 0
     return 1
-    
+
+
 def shorten_names(*names):
     """Remove redunant parts of a list of names (e.g. /tmp/foo{1,2} -> foo{1,2}
     """
@@ -252,6 +255,7 @@ def write_pipe(command, text, error=None):
     proc.communicate(text)
     return proc.wait()
 
+
 def commonprefix(dirs):
     """Given a list of pathnames, returns the longest common leading component.
     """
@@ -268,6 +272,7 @@ def commonprefix(dirs):
                 break
     return os.sep.join(prefix)
 
+
 def copy2(src, dst):
     """Like shutil.copy2 but ignores chmod errors, and copies symlinks as links
     See [Bug 568000] Copying to NTFS fails
@@ -290,6 +295,7 @@ def copy2(src, dst):
         if e.errno not in (errno.EPERM, errno.ENOTSUP):
             raise
 
+
 def copytree(src, dst):
     """Similar to shutil.copytree, but always copies symlinks and doesn't
     error out if the destination path already exists.
@@ -321,15 +327,18 @@ def copytree(src, dst):
         if e.errno != errno.EPERM:
             raise
 
+
 def shell_escape(glob_pat):
     # TODO: handle all cases
     assert not re.compile(r"[][*?]").findall(glob_pat)
     return glob_pat.replace('{', '[{]').replace('}', '[}]')
 
+
 def shell_to_regex(pat):
     """Translate a shell PATTERN to a regular expression.
 
-    Based on fnmatch.translate(). We also handle {a,b,c} where fnmatch does not.
+    Based on fnmatch.translate().
+    We also handle {a,b,c} where fnmatch does not.
     """
 
     i, n = 0, len(pat)
@@ -370,7 +379,9 @@ def shell_to_regex(pat):
             else:
                 stuff = pat[i:j]
                 i = j+1
-                res += '(%s)' % "|".join([shell_to_regex(p)[:-1] for p in stuff.split(",")])
+                res += '(%s)' % "|".join(
+                    [shell_to_regex(p)[:-1] for p in stuff.split(",")]
+                )
         else:
             res += re.escape(c)
     return res + "$"


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