2
0
Эх сурвалжийг харах

_compat: Inline specific namedtuple instances.

Change-Id: I16870d81791d5fdaf2dd9d505e7c1f3905d46a00
Dave Borowitz 13 жил өмнө
parent
commit
d0c6630a52

+ 0 - 4
dulwich/_compat.py

@@ -254,7 +254,3 @@ except ImportError:
             pass
 
         return result
-
-
-TreeEntryTuple = namedtuple('TreeEntryTuple', ['path', 'mode', 'sha'])
-TreeChangeTuple = namedtuple('TreeChangeTuple', ['type', 'old', 'new'])

+ 3 - 3
dulwich/diff_tree.py

@@ -24,7 +24,7 @@ import stat
 
 from dulwich._compat import (
     defaultdict,
-    TreeChangeTuple,
+    namedtuple,
     )
 from dulwich.objects import (
     S_ISGITLINK,
@@ -47,8 +47,8 @@ _MAX_FILES = 200
 _REWRITE_THRESHOLD = None
 
 
-class TreeChange(TreeChangeTuple):
-    """Class encapsulating a single change between two trees."""
+class TreeChange(namedtuple('TreeChange', ['type', 'old', 'new'])):
+    """Named tuple a single change between two trees."""
 
     @classmethod
     def add(cls, new):

+ 3 - 3
dulwich/objects.py

@@ -41,7 +41,7 @@ from dulwich.errors import (
 from dulwich.file import GitFile
 from dulwich._compat import (
     make_sha,
-    TreeEntryTuple,
+    namedtuple,
     )
 
 ZERO_SHA = "0" * 40
@@ -688,8 +688,8 @@ class Tag(ShaFile):
     message = serializable_property("message", "The message attached to this tag")
 
 
-class TreeEntry(TreeEntryTuple):
-    """Namedtuple encapsulating a single tree entry."""
+class TreeEntry(namedtuple('TreeEntry', ['path', 'mode', 'sha'])):
+    """Named tuple encapsulating a single tree entry."""
 
     def in_path(self, path):
         """Return a copy of this entry with the given path prepended."""