dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00552
[PATCH 29/33] _compat: Inline specific namedtuple instances.
From: Dave Borowitz <dborowitz@xxxxxxxxxx>
Change-Id: I16870d81791d5fdaf2dd9d505e7c1f3905d46a00
---
dulwich/_compat.py | 4 ----
dulwich/diff_tree.py | 6 +++---
dulwich/objects.py | 6 +++---
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/dulwich/_compat.py b/dulwich/_compat.py
index 2a9611f..7010378 100644
--- a/dulwich/_compat.py
+++ b/dulwich/_compat.py
@@ -253,7 +253,3 @@ except ImportError:
pass
return result
-
-
-TreeEntryTuple = namedtuple('TreeEntryTuple', ['path', 'mode', 'sha'])
-TreeChangeTuple = namedtuple('TreeChangeTuple', ['type', 'old', 'new'])
diff --git a/dulwich/diff_tree.py b/dulwich/diff_tree.py
index 61ebd76..c263f36 100644
--- a/dulwich/diff_tree.py
+++ b/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):
diff --git a/dulwich/objects.py b/dulwich/objects.py
index dffb5d6..26ebef4 100644
--- a/dulwich/objects.py
+++ b/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."""
--
1.7.3.1
References