From d0c6630a52ea1e804cfeb2003836fc4d89f8b81f Mon Sep 17 00:00:00 2001 From: Dave Borowitz Date: Thu, 28 Jul 2011 15:16:05 +0200 Subject: [PATCH] _compat: Inline specific namedtuple instances. 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 b4fdc57f6..9d861b74c 100644 --- a/dulwich/_compat.py +++ b/dulwich/_compat.py @@ -254,7 +254,3 @@ def __getnewargs__(self): 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 61ebd7656..c263f36c1 100644 --- a/dulwich/diff_tree.py +++ b/dulwich/diff_tree.py @@ -24,7 +24,7 @@ from dulwich._compat import ( defaultdict, - TreeChangeTuple, + namedtuple, ) from dulwich.objects import ( S_ISGITLINK, @@ -47,8 +47,8 @@ _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 dffb5d60a..26ebef46a 100644 --- a/dulwich/objects.py +++ b/dulwich/objects.py @@ -41,7 +41,7 @@ from dulwich.file import GitFile from dulwich._compat import ( make_sha, - TreeEntryTuple, + namedtuple, ) ZERO_SHA = "0" * 40 @@ -688,8 +688,8 @@ def _set_object(self, value): 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."""