Use range() instead of xrange()

This commit is contained in:
Wouter Bolsterlee
2016-03-20 22:07:11 +01:00
committed by Wouter Bolsterlee
parent c67ceaab04
commit a8cf18312b
2 changed files with 5 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ import logging
import socket import socket
import threading import threading
from six.moves import queue from six.moves import queue, range
from thriftpy.thrift import TException from thriftpy.thrift import TException
@@ -68,7 +68,7 @@ class ConnectionPool(object):
connection_kwargs = kwargs connection_kwargs = kwargs
connection_kwargs['autoconnect'] = False connection_kwargs['autoconnect'] = False
for i in xrange(size): for i in range(size):
connection = Connection(**connection_kwargs) connection = Connection(**connection_kwargs)
self._queue.put(connection) self._queue.put(connection)

View File

@@ -6,6 +6,8 @@ These functions are not part of the public API.
import re import re
from six.moves import range
CAPITALS = re.compile('([A-Z])') CAPITALS = re.compile('([A-Z])')
@@ -64,7 +66,7 @@ def str_increment(s):
drops everything after it. If the string only contains ``0xFF`` bytes, drops everything after it. If the string only contains ``0xFF`` bytes,
`None` is returned. `None` is returned.
""" """
for i in xrange(len(s) - 1, -1, -1): for i in range(len(s) - 1, -1, -1):
if s[i] != '\xff': if s[i] != '\xff':
return s[:i] + chr(ord(s[i]) + 1) return s[:i] + chr(ord(s[i]) + 1)