[meld/VersionControlRework: 10/123] meld.vc._vc: Simplify our Entry classes



commit bc752d54c3d4cd93cd5799348e2137587f1c53ae
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Mar 21 15:04:13 2015 +1000

    meld.vc._vc: Simplify our Entry classes

 meld/vc/_vc.py |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index 698e05b..ac0118c 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -77,10 +77,11 @@ class Entry(object):
         STATE_NONEXIST: _("Not present"),
     }
 
-    def __init__(self, path, name, state):
+    def __init__(self, path, name, state, options=None):
         self.path = path
         self.state = state
         self.parent, self.name = os.path.split(path.rstrip("/"))
+        self.options = options
 
     def __str__(self):
         return "<%s:%s %s>" % (self.__class__.__name__, self.path,
@@ -95,18 +96,11 @@ class Entry(object):
 
 
 class Dir(Entry):
-    def __init__(self, path, name, state, options=None):
-        Entry.__init__(self, path, name, state)
-        self.isdir = 1
-        self.options = options
+    isdir = True
 
 
 class File(Entry):
-    def __init__(self, path, name, state, options=""):
-        assert path[-1] != "/"
-        Entry.__init__(self, path, name, state)
-        self.isdir = 0
-        self.options = options
+    isdir = False
 
 
 class Vc(object):


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