Skip to content

Commit

Permalink
_compat: Inline specific namedtuple instances.
Browse files Browse the repository at this point in the history
Change-Id: I16870d81791d5fdaf2dd9d505e7c1f3905d46a00
  • Loading branch information
dborowitz authored and jelmer committed Jul 28, 2011
1 parent 79d46fc commit d0c6630
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 0 additions & 4 deletions dulwich/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,3 @@ def __getnewargs__(self):
pass

return result


TreeEntryTuple = namedtuple('TreeEntryTuple', ['path', 'mode', 'sha'])
TreeChangeTuple = namedtuple('TreeChangeTuple', ['type', 'old', 'new'])
6 changes: 3 additions & 3 deletions dulwich/diff_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

from dulwich._compat import (
defaultdict,
TreeChangeTuple,
namedtuple,
)
from dulwich.objects import (
S_ISGITLINK,
Expand All @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions dulwich/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from dulwich.file import GitFile
from dulwich._compat import (
make_sha,
TreeEntryTuple,
namedtuple,
)

ZERO_SHA = "0" * 40
Expand Down Expand Up @@ -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."""
Expand Down

0 comments on commit d0c6630

Please sign in to comment.