Patch from Raphael Ackermann <raphael.ackermann@gmail.com> -- Fix 0001538: tabs and spaces are mixed in some source files
svn: r9713
This commit is contained in:
@@ -31,21 +31,21 @@ class ListCursor(object):
|
||||
records. It should probably also have DB_DUPSORT if you want to
|
||||
have sorted records.
|
||||
"""
|
||||
self._cursor = cursor
|
||||
self._cursor = cursor
|
||||
self._object_cache = {}
|
||||
|
||||
self.top()
|
||||
|
||||
|
||||
def top(self):
|
||||
self._cursor.first()
|
||||
self._index = 0
|
||||
self._cursor.first()
|
||||
self._index = 0
|
||||
|
||||
def next(self):
|
||||
"""
|
||||
Move to the next record.
|
||||
"""
|
||||
data = self._cursor.next()
|
||||
data = self._cursor.next()
|
||||
|
||||
# If there was a next record that data will
|
||||
# not be None
|
||||
@@ -54,13 +54,13 @@ class ListCursor(object):
|
||||
# they point to the current record.
|
||||
self._index+= 1
|
||||
|
||||
return data
|
||||
return data
|
||||
|
||||
def prev(self):
|
||||
"""
|
||||
Move to the previous record.
|
||||
"""
|
||||
data = self._cursor.prev()
|
||||
data = self._cursor.prev()
|
||||
|
||||
# If there was a next record that data will
|
||||
# not be None
|
||||
@@ -69,7 +69,7 @@ class ListCursor(object):
|
||||
# they point to the current record.
|
||||
self._index -= 1
|
||||
|
||||
return data
|
||||
return data
|
||||
|
||||
|
||||
def has_children(self,path):
|
||||
@@ -149,7 +149,7 @@ class ListCursor(object):
|
||||
ret = self._unpickle(ret)
|
||||
self._object_cache[index] = ret
|
||||
|
||||
return ret
|
||||
return ret
|
||||
|
||||
def _unpickle(self,rec):
|
||||
"""
|
||||
@@ -174,3 +174,4 @@ class ListCursor(object):
|
||||
return self.lookup(path[0])
|
||||
|
||||
|
||||
|
||||
|
||||
+17
-16
@@ -16,13 +16,13 @@ class PathCursor(object):
|
||||
|
||||
For example, with the following table indexed on Surname::
|
||||
|
||||
Record Value Index
|
||||
============ =====
|
||||
Record Value Index
|
||||
============ =====
|
||||
|
||||
Blogs, Jo [0,0]
|
||||
Blogs, Jane [0,1]
|
||||
Smith, Wilman [1,0]
|
||||
Smith, John [1,1]
|
||||
Blogs, Jo [0,0]
|
||||
Blogs, Jane [0,1]
|
||||
Smith, Wilman [1,0]
|
||||
Smith, John [1,1]
|
||||
|
||||
@ivar _index: The current index pointed to by the cursor.
|
||||
|
||||
@@ -43,21 +43,21 @@ class PathCursor(object):
|
||||
records. It should probably also have DB_DUPSORT if you want to
|
||||
have sorted records.
|
||||
"""
|
||||
self._cursor = cursor
|
||||
self._cursor = cursor
|
||||
self._object_cache = {}
|
||||
|
||||
self.top()
|
||||
|
||||
|
||||
def top(self):
|
||||
self._cursor.first()
|
||||
self._index = [0,0]
|
||||
self._cursor.first()
|
||||
self._index = [0,0]
|
||||
|
||||
def next_nodup(self):
|
||||
"""
|
||||
Move to the next non-duplcate record.
|
||||
"""
|
||||
data = self._cursor.next_nodup()
|
||||
data = self._cursor.next_nodup()
|
||||
|
||||
# If there was a next record that data will
|
||||
# not be None
|
||||
@@ -67,13 +67,13 @@ class PathCursor(object):
|
||||
self._index[0] += 1
|
||||
self._index[1] = 0
|
||||
|
||||
return data
|
||||
return data
|
||||
|
||||
def prev_nodup(self):
|
||||
"""
|
||||
Move to the previous non-duplicate record.
|
||||
"""
|
||||
data = self._cursor.prev_nodup()
|
||||
data = self._cursor.prev_nodup()
|
||||
|
||||
# If there was a next record that data will
|
||||
# not be None
|
||||
@@ -83,13 +83,13 @@ class PathCursor(object):
|
||||
self._index[0] -= 1
|
||||
self._index[1] = 0
|
||||
|
||||
return data
|
||||
return data
|
||||
|
||||
def next_dup(self):
|
||||
"""
|
||||
Move to the next record with a duplicate key to the current record.
|
||||
"""
|
||||
data = self._cursor.next_dup()
|
||||
data = self._cursor.next_dup()
|
||||
|
||||
# If there was a next record that data will
|
||||
# not be None
|
||||
@@ -97,7 +97,7 @@ class PathCursor(object):
|
||||
# Update the secondary index.
|
||||
self._index[1] += 1
|
||||
|
||||
return data
|
||||
return data
|
||||
|
||||
def has_children(self,path):
|
||||
"""
|
||||
@@ -228,7 +228,7 @@ class PathCursor(object):
|
||||
ret = self._unpickle(ret)
|
||||
self._object_cache[index] = {'primary':ret}
|
||||
|
||||
return ret
|
||||
return ret
|
||||
|
||||
def _unpickle(self,rec):
|
||||
"""
|
||||
@@ -322,3 +322,4 @@ class PathCursor(object):
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user