summaryrefslogtreecommitdiff
path: root/rdiff-backup/rdiff_backup/rorpiter.py
diff options
context:
space:
mode:
authorben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-04-30 02:02:56 +0000
committerben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-04-30 02:02:56 +0000
commitd49f6dccf43983b317d31aa49b7e9a54aa28bf01 (patch)
tree1986d43b549551e12b60b6c03251061eae7bf433 /rdiff-backup/rdiff_backup/rorpiter.py
parentef22311017db214255b24f93de2a43d75f9d45cc (diff)
downloadrdiff-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/rdiff_backup/rorpiter.py')
-rw-r--r--rdiff-backup/rdiff_backup/rorpiter.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/rdiff-backup/rdiff_backup/rorpiter.py b/rdiff-backup/rdiff_backup/rorpiter.py
index e98fa13..bad02a4 100644
--- a/rdiff-backup/rdiff_backup/rorpiter.py
+++ b/rdiff-backup/rdiff_backup/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)