Updated comments to use print as a function

This commit is contained in:
Andrew Murray 2016-11-19 11:19:43 +11:00
parent 06895b6fa4
commit 4ed31e8ef7
17 changed files with 46 additions and 46 deletions

View File

@ -119,9 +119,9 @@ class BdfFontFile(FontFile.FontFile):
# fontname = ";".join(font[1:]) # fontname = ";".join(font[1:])
# print "#", fontname # print("#", fontname)
# for i in comments: # for i in comments:
# print "#", i # print("#", i)
while True: while True:
c = bdf_char(fp) c = bdf_char(fp)

View File

@ -58,14 +58,14 @@ class CurImageFile(BmpImagePlugin.BmpImageFile):
m = s m = s
elif i8(s[0]) > i8(m[0]) and i8(s[1]) > i8(m[1]): elif i8(s[0]) > i8(m[0]) and i8(s[1]) > i8(m[1]):
m = s m = s
# print "width", i8(s[0]) # print("width", i8(s[0]))
# print "height", i8(s[1]) # print("height", i8(s[1]))
# print "colors", i8(s[2]) # print("colors", i8(s[2]))
# print "reserved", i8(s[3]) # print("reserved", i8(s[3]))
# print "hotspot x", i16(s[4:]) # print("hotspot x", i16(s[4:]))
# print "hotspot y", i16(s[6:]) # print("hotspot y", i16(s[6:]))
# print "bytes", i32(s[8:]) # print("bytes", i32(s[8:]))
# print "offset", i32(s[12:]) # print("offset", i32(s[12:]))
if not m: if not m:
raise TypeError("No cursors were found") raise TypeError("No cursors were found")

View File

@ -88,7 +88,7 @@ class FontFile(object):
x = xx x = xx
s = src[0] + x0, src[1] + y0, src[2] + x0, src[3] + y0 s = src[0] + x0, src[1] + y0, src[2] + x0, src[3] + y0
self.bitmap.paste(im.crop(src), s) self.bitmap.paste(im.crop(src), s)
# print chr(i), dst, s # print(chr(i), dst, s)
self.metrics[i] = d, dst, s self.metrics[i] = d, dst, s
def save(self, filename): def save(self, filename):

View File

@ -112,7 +112,7 @@ class FpxImageFile(ImageFile.ImageFile):
if id in prop: if id in prop:
self.jpeg[i] = prop[id] self.jpeg[i] = prop[id]
# print len(self.jpeg), "tables loaded" # print(len(self.jpeg), "tables loaded")
self._open_subimage(1, self.maxid) self._open_subimage(1, self.maxid)
@ -141,7 +141,7 @@ class FpxImageFile(ImageFile.ImageFile):
offset = i32(s, 28) offset = i32(s, 28)
length = i32(s, 32) length = i32(s, 32)
# print size, self.mode, self.rawmode # print(size, self.mode, self.rawmode)
if size != self.size: if size != self.size:
raise IOError("subimage mismatch") raise IOError("subimage mismatch")

View File

@ -2161,7 +2161,7 @@ def fromarray(obj, mode=None):
typekey = (1, 1) + shape[2:], arr['typestr'] typekey = (1, 1) + shape[2:], arr['typestr']
mode, rawmode = _fromarray_typemap[typekey] mode, rawmode = _fromarray_typemap[typekey]
except KeyError: except KeyError:
# print typekey # print(typekey)
raise TypeError("Cannot handle this data type") raise TypeError("Cannot handle this data type")
else: else:
rawmode = mode rawmode = mode

View File

@ -152,8 +152,8 @@ class LutBuilder(object):
# # Debugging # # Debugging
# for p,r in patterns: # for p,r in patterns:
# print p,r # print(p,r)
# print '--' # print('--')
# compile the patterns into regular expressions for speed # compile the patterns into regular expressions for speed
for i, pattern in enumerate(patterns): for i, pattern in enumerate(patterns):

View File

@ -107,7 +107,7 @@ class IptcImageFile(ImageFile.ImageFile):
else: else:
self.info[tag] = tagdata self.info[tag] = tagdata
# print tag, self.info[tag] # print(tag, self.info[tag])
# mode # mode
layers = i8(self.info[(3, 60)][0]) layers = i8(self.info[(3, 60)][0])

View File

@ -316,7 +316,7 @@ class JpegImageFile(ImageFile.ImageFile):
if i in MARKER: if i in MARKER:
name, description, handler = MARKER[i] name, description, handler = MARKER[i]
# print hex(i), name, description # print(hex(i), name, description)
if handler is not None: if handler is not None:
handler(self, i) handler(self, i)
if i == 0xFFDA: # start of scan if i == 0xFFDA: # start of scan

View File

@ -75,7 +75,7 @@ def isSpiderHeader(t):
labrec = int(h[13]) # no. records in file header labrec = int(h[13]) # no. records in file header
labbyt = int(h[22]) # total no. of bytes in header labbyt = int(h[22]) # total no. of bytes in header
lenbyt = int(h[23]) # record length in bytes lenbyt = int(h[23]) # record length in bytes
# print "labrec = %d, labbyt = %d, lenbyt = %d" % (labrec,labbyt,lenbyt) # print("labrec = %d, labbyt = %d, lenbyt = %d" % (labrec,labbyt,lenbyt))
if labbyt != (labrec * lenbyt): if labbyt != (labrec * lenbyt):
return 0 return 0
# looks like a valid header # looks like a valid header

View File

@ -338,7 +338,7 @@ class IFDRational(Rational):
'rfloordiv','mod','rmod', 'pow','rpow', 'pos', 'neg', 'rfloordiv','mod','rmod', 'pow','rpow', 'pos', 'neg',
'abs', 'trunc', 'lt', 'gt', 'le', 'ge', 'nonzero', 'abs', 'trunc', 'lt', 'gt', 'le', 'ge', 'nonzero',
'ceil', 'floor', 'round'] 'ceil', 'floor', 'round']
print "\n".join("__%s__ = _delegate('__%s__')" % (s,s) for s in a) print("\n".join("__%s__ = _delegate('__%s__')" % (s,s) for s in a))
""" """
__add__ = _delegate('__add__') __add__ = _delegate('__add__')
@ -800,7 +800,7 @@ class ImageFileDirectory_v1(ImageFileDirectory_v2):
ifd = ImageFileDirectory_v1() ifd = ImageFileDirectory_v1()
ifd[key] = 'Some Data' ifd[key] = 'Some Data'
ifd.tagtype[key] = 2 ifd.tagtype[key] = 2
print ifd[key] print(ifd[key])
('Some Data',) ('Some Data',)
Also contains a dictionary of tag types as read from the tiff image file, Also contains a dictionary of tag types as read from the tiff image file,
@ -1197,7 +1197,7 @@ class TiffImageFile(ImageFile.ImageFile):
"tiff_sgilog24", "tiff_sgilog24",
"tiff_raw_16"]: "tiff_raw_16"]:
# if DEBUG: # if DEBUG:
# print "Activating g4 compression for whole file" # print("Activating g4 compression for whole file")
# Decoder expects entire file as one tile. # Decoder expects entire file as one tile.
# There's a buffer size limit in load (64k) # There's a buffer size limit in load (64k)

View File

@ -111,7 +111,7 @@ class WmfStubImageFile(ImageFile.StubImageFile):
self.info["dpi"] = 72 self.info["dpi"] = 72
# print self.mode, self.size, self.info # print(self.mode, self.size, self.info)
# sanity check (standard metafile header) # sanity check (standard metafile header)
if s[22:26] != b"\x01\x00\t\x00": if s[22:26] != b"\x01\x00\t\x00":

View File

@ -51,10 +51,10 @@ for i0 in range(65556):
print() print()
# print check(min_size, min_start) # print(check(min_size, min_start))
print("#define ACCESS_TABLE_SIZE", min_size) print("#define ACCESS_TABLE_SIZE", min_size)
print("#define ACCESS_TABLE_HASH", min_start) print("#define ACCESS_TABLE_HASH", min_start)
# for m in modes: # for m in modes:
# print m, "=>", hash(m, min_start) % min_size # print(m, "=>", hash(m, min_start) % min_size)

View File

@ -323,10 +323,10 @@ class CoreResamplePassesTest(PillowTestCase):
class CoreResampleCoefficientsTest(PillowTestCase): class CoreResampleCoefficientsTest(PillowTestCase):
def test_reduce(self): def test_reduce(self):
test_color = 254 test_color = 254
# print '' # print()
for size in range(400000, 400010, 2): for size in range(400000, 400010, 2):
# print '\r', size, # print(size)
i = Image.new('L', (size, 1), 0) i = Image.new('L', (size, 1), 0)
draw = ImageDraw.Draw(i) draw = ImageDraw.Draw(i)
draw.rectangle((0, 0, i.size[0] // 2 - 1, 0), test_color) draw.rectangle((0, 0, i.size[0] // 2 - 1, 0), test_color)
@ -334,7 +334,7 @@ class CoreResampleCoefficientsTest(PillowTestCase):
px = i.resize((5, i.size[1]), Image.BICUBIC).load() px = i.resize((5, i.size[1]), Image.BICUBIC).load()
if px[2, 0] != test_color // 2: if px[2, 0] != test_color // 2:
self.assertEqual(test_color // 2, px[2, 0]) self.assertEqual(test_color // 2, px[2, 0])
# print '\r>', size, test_color // 2, px[2, 0] # print('>', size, test_color // 2, px[2, 0])
def test_nonzero_coefficients(self): def test_nonzero_coefficients(self):
# regression test for the wrong coefficients calculation # regression test for the wrong coefficients calculation

View File

@ -8,10 +8,10 @@ import locale
# on windows, in polish locale: # on windows, in polish locale:
# import locale # import locale
# print locale.setlocale(locale.LC_ALL, 'polish') # print(locale.setlocale(locale.LC_ALL, 'polish'))
# import string # import string
# print len(string.whitespace) # print(len(string.whitespace))
# print ord(string.whitespace[6]) # print(ord(string.whitespace[6]))
# Polish_Poland.1250 # Polish_Poland.1250
# 7 # 7

View File

@ -54,7 +54,7 @@ class TestNumpy(PillowTestCase):
i = Image.fromarray(a) i = Image.fromarray(a)
if list(i.split()[0].getdata()) != list(range(100)): if list(i.split()[0].getdata()) != list(range(100)):
print("data mismatch for", dtype) print("data mismatch for", dtype)
# print dtype, list(i.getdata()) # print(dtype, list(i.getdata()))
return i return i
# Check supported 1-bit integer formats # Check supported 1-bit integer formats