Merge pull request #1616 from srinivasreddy/clean_up
Add six.moves.range instead of xrange
This commit is contained in:
commit
3a5538813c
@ -127,7 +127,7 @@ class BaseList(list):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
for i in xrange(self.__len__()):
|
for i in six.moves.range(self.__len__()):
|
||||||
yield self[i]
|
yield self[i]
|
||||||
|
|
||||||
def __setitem__(self, key, value, *args, **kwargs):
|
def __setitem__(self, key, value, *args, **kwargs):
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import six
|
||||||
|
|
||||||
from mongoengine.errors import OperationError
|
from mongoengine.errors import OperationError
|
||||||
from mongoengine.queryset.base import (BaseQuerySet, CASCADE, DENY, DO_NOTHING,
|
from mongoengine.queryset.base import (BaseQuerySet, CASCADE, DENY, DO_NOTHING,
|
||||||
NULLIFY, PULL)
|
NULLIFY, PULL)
|
||||||
@ -112,7 +114,7 @@ class QuerySet(BaseQuerySet):
|
|||||||
# Pull in ITER_CHUNK_SIZE docs from the database and store them in
|
# Pull in ITER_CHUNK_SIZE docs from the database and store them in
|
||||||
# the result cache.
|
# the result cache.
|
||||||
try:
|
try:
|
||||||
for _ in xrange(ITER_CHUNK_SIZE):
|
for _ in six.moves.range(ITER_CHUNK_SIZE):
|
||||||
self._result_cache.append(self.next())
|
self._result_cache.append(self.next())
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
# Getting this exception means there are no more docs in the
|
# Getting this exception means there are no more docs in the
|
||||||
@ -166,7 +168,7 @@ class QuerySetNoCache(BaseQuerySet):
|
|||||||
return '.. queryset mid-iteration ..'
|
return '.. queryset mid-iteration ..'
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
for _ in xrange(REPR_OUTPUT_SIZE + 1):
|
for _ in six.moves.range(REPR_OUTPUT_SIZE + 1):
|
||||||
try:
|
try:
|
||||||
data.append(self.next())
|
data.append(self.next())
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user