Skip to content

Commit 2299ee6

Browse files
author
James William Pye
committed
s/xrange/range
1 parent b51e9c7 commit 2299ee6

13 files changed

Lines changed: 30 additions & 30 deletions

postgresql/configfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def parse_line(line, equality = '=', comment = comment, quote = quote):
4242
inquotes = False
4343
escaped = False
4444
val_len = 0
45-
for i in xrange(preval_len, len(val)):
45+
for i in range(preval_len, len(val)):
4646
c = val[i]
4747
if c == quote:
4848
if inquotes is False:

postgresql/driver/dbapi20.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def setoutputsize(self, sizes, columns = None):
8484
def callproc(self, proname, args):
8585
p = self.pg_api_c.query("SELECT %s(%s)" %(
8686
proname, ','.join([
87-
'$%d' %(x,) for x in xrange(1, len(args) + 1)
87+
'$%d' %(x,) for x in range(1, len(args) + 1)
8888
])
8989
))
9090
self.__portals.insert(0, p(*args))
@@ -116,8 +116,8 @@ def _mkquery(self, query, parameters):
116116
pnmap = {}
117117
plist = []
118118
nseq = []
119-
for x in xrange(len(parameters)):
120-
pnmap[parameters[x][0]] = '$' + unicode(x + 1)
119+
for x in range(len(parameters)):
120+
pnmap[parameters[x][0]] = '$' + str(x + 1)
121121
plist.append(parameters[x][1])
122122
nseq.append(parameters[x][0])
123123
# Substitute %(key)s with the $x positional parameter number

postgresql/driver/tracenull.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ def __call__(self, *args, **kw):
10051005
)
10061006
word_idx.sort(cmp = lambda x, y: cmp(x[1], y[1]))
10071007
current_word = word_idx.pop(0)
1008-
for x in xrange(argc):
1008+
for x in range(argc):
10091009
if x == current_word[1]:
10101010
input.append(current_word[0])
10111011
current_word = word_idx.pop(0)
@@ -1048,7 +1048,7 @@ def __init__(self, connection, ident, description = ()):
10481048

10491049
self._input_attmap = {}
10501050
argnames = proctup.get('proargnames') or ()
1051-
for x in xrange(len(argnames)):
1051+
for x in range(len(argnames)):
10521052
an = argnames[x]
10531053
if an is not None:
10541054
self._input_attmap[an] = x
@@ -1060,7 +1060,7 @@ def __init__(self, connection, ident, description = ()):
10601060
# ($1::type, $2::type, ... $n::type)
10611061
', '.join([
10621062
'$%d::%s' %(x + 1, proargs[x])
1063-
for x in xrange(len(proargs))
1063+
for x in range(len(proargs))
10641064
]),
10651065
# Description for anonymous record returns
10661066
(description and \

postgresql/protocol/client3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ def reverse(self):
210210
order. Last in, first out.
211211
"""
212212
r = []
213-
for x in xrange(len(self.completed) - 1, -1, -1):
213+
for x in range(len(self.completed) - 1, -1, -1):
214214
c = self.completed[x][1]
215-
for y in xrange(len(c) - 1, -1, -1):
215+
for y in range(len(c) - 1, -1, -1):
216216
r.append(c[y])
217217
return r
218218

@@ -258,7 +258,7 @@ def standard_put(self, messages):
258258
if cmd.type not in (
259259
element.Function.type, element.Query.type
260260
):
261-
for offset in xrange(offset, len(self.commands)):
261+
for offset in range(offset, len(self.commands)):
262262
if self.commands[offset] is element.SynchronizeMessage:
263263
break
264264
else:

postgresql/protocol/element3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ def parse(subtype, data):
846846
if len(formats_str) != natts * 2:
847847
raise ProtocolError("number of formats and data do not match up")
848848
return subtype(format, [
849-
UNSHORT(formats_str[x:x+2]) for x in xrange(0, natts * 2, 2)
849+
UNSHORT(formats_str[x:x+2]) for x in range(0, natts * 2, 2)
850850
])
851851
parse = classmethod(parse)
852852

postgresql/protocol/typstruct.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def record_unpack(data):
352352
columns = long_unpack(data[0:4])
353353
offset = 4
354354

355-
for x in xrange(columns):
355+
for x in range(columns):
356356
typid = oid_unpack(data[offset:offset+4])
357357
offset += 4
358358

postgresql/test/perf_copy_io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def incsize(data):
3232
data = [incsize('\t'.join((
3333
str(x), getWord(), getWord(),
3434
getWord(), getWord(), getWord()
35-
)))+'\n' for x in xrange(tuples)]
35+
)))+'\n' for x in range(tuples)]
3636

3737
sys.stderr.write("starting copy...\n")
3838
start = time.time()

postgresql/test/perf_query_io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
def insertSamples(count, insert_records):
1313
recs = [
14-
(-3, 123, 0xfffffea023, u'some_óäæ_thing', 'varying', u'æ')
15-
for x in xrange(count)
14+
(-3, 123, 0xfffffea023, 'some_óäæ_thing', 'varying', 'æ')
15+
for x in range(count)
1616
]
1717

1818
gen = time.time()

postgresql/test/test_bytea_codec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class test_bytea_codec(unittest.TestCase):
1111
def testEncoding(self):
12-
for x in xrange(255):
12+
for x in range(255):
1313
c = chr(x)
1414
b = c.encode('bytea')
1515
if c == '\\':
@@ -29,7 +29,7 @@ def testDecoding(self):
2929
self.failUnlessRaises(ValueError, r'\f'.decode, 'bytea')
3030
self.failUnlessRaises(ValueError, r'\800'.decode, 'bytea')
3131
self.failUnlessRaises(ValueError, r'\7f0'.decode, 'bytea')
32-
for x in xrange(255):
32+
for x in range(255):
3333
seq = ('\\' + oct(x).lstrip('0').rjust(3, '0'))
3434
dx = ord(seq.decode('bytea'))
3535
if dx != x:

postgresql/test/test_driver.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import sys
66
import os
77
import unittest
8-
import thread
8+
import threading
99
import time
1010
import datetime
1111

@@ -29,8 +29,8 @@
2929
),
3030
),
3131
('bytea', (
32-
''.join([chr(x) for x in xrange(256)]),
33-
''.join([chr(x) for x in xrange(255, -1, -1)]),
32+
''.join([chr(x) for x in range(256)]),
33+
''.join([chr(x) for x in range(255, -1, -1)]),
3434
),
3535
),
3636
('smallint[]', (
@@ -83,7 +83,7 @@ def sendint(l):
8383
else:
8484
l.append(None)
8585
rl = []
86-
thread.start_new_thread(sendint, (rl,))
86+
threading.start_new_thread(sendint, (rl,))
8787
self.failUnlessRaises(pg_exc.QueryCanceledError,
8888
execute, "SELECT pg_sleep(5)")
8989
b = time.time()

0 commit comments

Comments
 (0)