[meld] Several naming and PEP8 fixes



commit 988b36850316fbc7c9694832889b637fd5e07121
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Dec 31 09:56:24 2017 +1000

    Several naming and PEP8 fixes

 meld/misc.py   | 6 ++++--
 meld/tree.py   | 4 ++--
 meld/vc/_vc.py | 4 ++--
 meld/vc/git.py | 4 ++--
 4 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/meld/misc.py b/meld/misc.py
index 712c0a07..23684234 100644
--- a/meld/misc.py
+++ b/meld/misc.py
@@ -275,7 +275,8 @@ def read_pipe_iter(command, workdir, errorstream, yield_interval=0.1):
     this function yields None.
     When all the data is read, the entire string is yielded.
     """
-    class sentinel(object):
+    class Sentinel(object):
+
         def __init__(self):
             self.proc = None
 
@@ -322,7 +323,8 @@ def read_pipe_iter(command, workdir, errorstream, yield_interval=0.1):
             if status:
                 errorstream.error("Exit code: %i\n" % status)
             yield status, "".join(bits)
-    return sentinel()()
+
+    return Sentinel()()
 
 
 def write_pipe(command, text, error=None):
diff --git a/meld/tree.py b/meld/tree.py
index 5ec56ba0..8d76c893 100644
--- a/meld/tree.py
+++ b/meld/tree.py
@@ -159,9 +159,9 @@ class DiffTreeStore(SearchableTreeStore):
         self.set_value(it, col_idx(COL_STRIKE, pane), strike)
 
     def get_state(self, it, pane):
-        STATE = self.column_index(COL_STATE, pane)
+        state_idx = self.column_index(COL_STATE, pane)
         try:
-            return int(self.get_value(it, STATE))
+            return int(self.get_value(it, state_idx))
         except TypeError:
             return None
 
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index d80f287e..05d73c8b 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -435,8 +435,8 @@ def call_temp_output(cmd, cwd, file_id=''):
 
 # Return the return value of a given command
 def call(cmd, cwd=None):
-    NULL = open(os.devnull, "wb")
-    return subprocess.call(cmd, cwd=cwd, stdout=NULL, stderr=NULL)
+    devnull = open(os.devnull, "wb")
+    return subprocess.call(cmd, cwd=cwd, stdout=devnull, stderr=devnull)
 
 
 base_re = re.compile(
diff --git a/meld/vc/git.py b/meld/vc/git.py
index 3f66880a..6235a408 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -78,9 +78,9 @@ class Vc(_vc.Vc):
             return False
 
     @classmethod
-    def check_repo_root(self, location):
+    def check_repo_root(cls, location):
         # Check exists instead of isdir, since .git might be a git-file
-        return os.path.exists(os.path.join(location, self.VC_DIR))
+        return os.path.exists(os.path.join(location, cls.VC_DIR))
 
     def get_commits_to_push_summary(self):
         branch_refs = self.get_commits_to_push()


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