more xrange to range
parent
2639b15ef4
commit
515687e1bb
|
@ -45,7 +45,7 @@ class BMPWriter(object):
|
||||||
self.fp.write(struct.pack('BBBx', i, i, i))
|
self.fp.write(struct.pack('BBBx', i, i, i))
|
||||||
elif ncols == 256:
|
elif ncols == 256:
|
||||||
# grayscale color table
|
# grayscale color table
|
||||||
for i in xrange(256):
|
for i in range(256):
|
||||||
self.fp.write(struct.pack('BBBx', i, i, i))
|
self.fp.write(struct.pack('BBBx', i, i, i))
|
||||||
self.pos0 = self.fp.tell()
|
self.pos0 = self.fp.tell()
|
||||||
self.pos1 = self.pos0 + self.datasize
|
self.pos1 = self.pos0 + self.datasize
|
||||||
|
@ -98,7 +98,7 @@ class ImageWriter(object):
|
||||||
data = stream.get_data()
|
data = stream.get_data()
|
||||||
i = 0
|
i = 0
|
||||||
width = (width+7)//8
|
width = (width+7)//8
|
||||||
for y in xrange(height):
|
for y in range(height):
|
||||||
bmp.write_line(y, data[i:i+width])
|
bmp.write_line(y, data[i:i+width])
|
||||||
i += width
|
i += width
|
||||||
elif image.bits == 8 and image.colorspace is LITERAL_DEVICE_RGB:
|
elif image.bits == 8 and image.colorspace is LITERAL_DEVICE_RGB:
|
||||||
|
@ -106,14 +106,14 @@ class ImageWriter(object):
|
||||||
data = stream.get_data()
|
data = stream.get_data()
|
||||||
i = 0
|
i = 0
|
||||||
width = width*3
|
width = width*3
|
||||||
for y in xrange(height):
|
for y in range(height):
|
||||||
bmp.write_line(y, data[i:i+width])
|
bmp.write_line(y, data[i:i+width])
|
||||||
i += width
|
i += width
|
||||||
elif image.bits == 8 and image.colorspace is LITERAL_DEVICE_GRAY:
|
elif image.bits == 8 and image.colorspace is LITERAL_DEVICE_GRAY:
|
||||||
bmp = BMPWriter(fp, 8, width, height)
|
bmp = BMPWriter(fp, 8, width, height)
|
||||||
data = stream.get_data()
|
data = stream.get_data()
|
||||||
i = 0
|
i = 0
|
||||||
for y in xrange(height):
|
for y in range(height):
|
||||||
bmp.write_line(y, data[i:i+width])
|
bmp.write_line(y, data[i:i+width])
|
||||||
i += width
|
i += width
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -208,7 +208,7 @@ class PDFXRefFallback(PDFXRef):
|
||||||
except PSEOF:
|
except PSEOF:
|
||||||
pass
|
pass
|
||||||
n = min(n, len(objs)//2)
|
n = min(n, len(objs)//2)
|
||||||
for index in xrange(n):
|
for index in range(n):
|
||||||
objid1 = objs[index*2]
|
objid1 = objs[index*2]
|
||||||
self.offsets[objid1] = (objid, index, 0)
|
self.offsets[objid1] = (objid, index, 0)
|
||||||
return
|
return
|
||||||
|
@ -254,7 +254,7 @@ class PDFXRefStream(PDFBaseXRef):
|
||||||
|
|
||||||
def get_objids(self):
|
def get_objids(self):
|
||||||
for (start, nobjs) in self.ranges:
|
for (start, nobjs) in self.ranges:
|
||||||
for i in xrange(nobjs):
|
for i in range(nobjs):
|
||||||
offset = self.entlen * i
|
offset = self.entlen * i
|
||||||
ent = self.data[offset:offset+self.entlen]
|
ent = self.data[offset:offset+self.entlen]
|
||||||
f1 = nunpack(ent[:self.fl1], 1)
|
f1 = nunpack(ent[:self.fl1], 1)
|
||||||
|
|
|
@ -806,7 +806,7 @@ def rijndaelSetupDecrypt(key, keybits):
|
||||||
j -= 4
|
j -= 4
|
||||||
# apply the inverse MixColumn transform to all round keys but the first and the last:
|
# apply the inverse MixColumn transform to all round keys but the first and the last:
|
||||||
p = 0
|
p = 0
|
||||||
for i in xrange(1, nrounds):
|
for i in range(1, nrounds):
|
||||||
p += 4
|
p += 4
|
||||||
rk[p+0] = (
|
rk[p+0] = (
|
||||||
Td0[Te4[(rk[p+0] >> 24) ] & 0xff] ^
|
Td0[Te4[(rk[p+0] >> 24) ] & 0xff] ^
|
||||||
|
|
Loading…
Reference in New Issue