some minor range to xrange conversion (where safe to do)

This commit is contained in:
Miroslav Stampar
2011-10-21 22:34:27 +00:00
parent eb240243ea
commit 25f0ec3597
24 changed files with 29 additions and 29 deletions

View File

@@ -562,7 +562,7 @@ class Agent:
inbandQuery = self.prefixQuery("UNION ALL SELECT ", prefix=prefix)
if limited:
inbandQuery += ",".join(map(lambda x: char if x != position else '(SELECT %s)' % query, range(0, count)))
inbandQuery += ",".join(map(lambda x: char if x != position else '(SELECT %s)' % query, xrange(0, count)))
inbandQuery += FROM_TABLE.get(Backend.getIdentifiedDbms(), "")
inbandQuery = self.suffixQuery(inbandQuery, comment, suffix)
@@ -583,7 +583,7 @@ class Agent:
if Backend.getIdentifiedDbms() in FROM_TABLE and inbandQuery.endswith(FROM_TABLE[Backend.getIdentifiedDbms()]):
inbandQuery = inbandQuery[:-len(FROM_TABLE[Backend.getIdentifiedDbms()])]
for element in range(0, count):
for element in xrange(0, count):
if element > 0:
inbandQuery += ", "
@@ -610,7 +610,7 @@ class Agent:
if multipleUnions:
inbandQuery += " UNION ALL SELECT "
for element in range(count):
for element in xrange(count):
if element > 0:
inbandQuery += ", "

View File

@@ -2817,7 +2817,7 @@ def safeSQLIdentificatorNaming(name, isTable=False):
parts = name.split('.')
for i in range(len(parts)):
for i in xrange(len(parts)):
if not re.match(r"\A[A-Za-z0-9_]+\Z", parts[i]):
if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.ACCESS):
parts[i] = "`%s`" % parts[i].strip("`")

View File

@@ -414,7 +414,7 @@ class Dump:
warnMsg += "due to the large table size"
logger.warning(warnMsg)
for i in range(count):
for i in xrange(count):
console = (i >= count - TRIM_STDOUT_DUMP_SIZE)
field = 1
values = []

View File

@@ -111,10 +111,10 @@ def __setRequestParams():
conf.paramDict[PLACE.URI] = {}
parts = conf.url.split(URI_INJECTION_MARK_CHAR)
for i in range(len(parts)-1):
for i in xrange(len(parts)-1):
result = str()
for j in range(len(parts)):
for j in xrange(len(parts)):
result += parts[j]
if i == j:

View File

@@ -110,7 +110,7 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
return
# Start the threads
for numThread in range(numThreads):
for numThread in xrange(numThreads):
thread = threading.Thread(target=exceptionHandledFunction, name=str(numThread), args=[threadFunction])
# Reference: http://stackoverflow.com/questions/190010/daemon-threads-explanation