diff options
author | ben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2002-04-30 02:02:56 +0000 |
---|---|---|
committer | ben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2002-04-30 02:02:56 +0000 |
commit | d49f6dccf43983b317d31aa49b7e9a54aa28bf01 (patch) | |
tree | 1986d43b549551e12b60b6c03251061eae7bf433 /rdiff-backup/src/rorpiter.py | |
parent | ef22311017db214255b24f93de2a43d75f9d45cc (diff) | |
download | rdiff-backup-d49f6dccf43983b317d31aa49b7e9a54aa28bf01.tar.gz |
Changed for 0.7.3 release
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@48 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/src/rorpiter.py')
-rw-r--r-- | rdiff-backup/src/rorpiter.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/rdiff-backup/src/rorpiter.py b/rdiff-backup/src/rorpiter.py index e98fa13..bad02a4 100644 --- a/rdiff-backup/src/rorpiter.py +++ b/rdiff-backup/src/rorpiter.py @@ -1,6 +1,6 @@ execfile("robust.py") from __future__ import generators -import tempfile +import tempfile, UserList ####################################################################### # @@ -224,7 +224,7 @@ MakeStatic(RORPIter) -class IndexedTuple: +class IndexedTuple(UserList.UserList): """Like a tuple, but has .index This is used by CollateIterator above, and can be passed to the @@ -238,9 +238,15 @@ class IndexedTuple: def __len__(self): return len(self.data) def __getitem__(self, key): - """This only works for numerical keys (faster that way)""" + """This only works for numerical keys (easier this way)""" return self.data[key] + def __lt__(self, other): return self.__cmp__(other) == -1 + def __le__(self, other): return self.__cmp__(other) != 1 + def __ne__(self, other): return not self.__eq__(other) + def __gt__(self, other): return self.__cmp__(other) == 1 + def __ge__(self, other): return self.__cmp__(other) != -1 + def __cmp__(self, other): assert isinstance(other, IndexedTuple) if self.index < other.index: return -1 @@ -255,6 +261,4 @@ class IndexedTuple: else: return None def __str__(self): - assert len(self.data) == 2 - return "(%s, %s).%s" % (str(self.data[0]), str(self.data[1]), - str(self.index)) + return "(%s).%s" % (", ".join(map(str, self.data)), self.index) |