mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Updated comments to use print as a function
This commit is contained in:
parent
06895b6fa4
commit
4ed31e8ef7
|
@ -119,9 +119,9 @@ class BdfFontFile(FontFile.FontFile):
|
|||
|
||||
# fontname = ";".join(font[1:])
|
||||
|
||||
# print "#", fontname
|
||||
# print("#", fontname)
|
||||
# for i in comments:
|
||||
# print "#", i
|
||||
# print("#", i)
|
||||
|
||||
while True:
|
||||
c = bdf_char(fp)
|
||||
|
|
|
@ -58,14 +58,14 @@ class CurImageFile(BmpImagePlugin.BmpImageFile):
|
|||
m = s
|
||||
elif i8(s[0]) > i8(m[0]) and i8(s[1]) > i8(m[1]):
|
||||
m = s
|
||||
# print "width", i8(s[0])
|
||||
# print "height", i8(s[1])
|
||||
# print "colors", i8(s[2])
|
||||
# print "reserved", i8(s[3])
|
||||
# print "hotspot x", i16(s[4:])
|
||||
# print "hotspot y", i16(s[6:])
|
||||
# print "bytes", i32(s[8:])
|
||||
# print "offset", i32(s[12:])
|
||||
# print("width", i8(s[0]))
|
||||
# print("height", i8(s[1]))
|
||||
# print("colors", i8(s[2]))
|
||||
# print("reserved", i8(s[3]))
|
||||
# print("hotspot x", i16(s[4:]))
|
||||
# print("hotspot y", i16(s[6:]))
|
||||
# print("bytes", i32(s[8:]))
|
||||
# print("offset", i32(s[12:]))
|
||||
if not m:
|
||||
raise TypeError("No cursors were found")
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ class FontFile(object):
|
|||
x = xx
|
||||
s = src[0] + x0, src[1] + y0, src[2] + x0, src[3] + y0
|
||||
self.bitmap.paste(im.crop(src), s)
|
||||
# print chr(i), dst, s
|
||||
# print(chr(i), dst, s)
|
||||
self.metrics[i] = d, dst, s
|
||||
|
||||
def save(self, filename):
|
||||
|
|
|
@ -112,7 +112,7 @@ class FpxImageFile(ImageFile.ImageFile):
|
|||
if id in prop:
|
||||
self.jpeg[i] = prop[id]
|
||||
|
||||
# print len(self.jpeg), "tables loaded"
|
||||
# print(len(self.jpeg), "tables loaded")
|
||||
|
||||
self._open_subimage(1, self.maxid)
|
||||
|
||||
|
@ -141,7 +141,7 @@ class FpxImageFile(ImageFile.ImageFile):
|
|||
offset = i32(s, 28)
|
||||
length = i32(s, 32)
|
||||
|
||||
# print size, self.mode, self.rawmode
|
||||
# print(size, self.mode, self.rawmode)
|
||||
|
||||
if size != self.size:
|
||||
raise IOError("subimage mismatch")
|
||||
|
|
|
@ -2161,7 +2161,7 @@ def fromarray(obj, mode=None):
|
|||
typekey = (1, 1) + shape[2:], arr['typestr']
|
||||
mode, rawmode = _fromarray_typemap[typekey]
|
||||
except KeyError:
|
||||
# print typekey
|
||||
# print(typekey)
|
||||
raise TypeError("Cannot handle this data type")
|
||||
else:
|
||||
rawmode = mode
|
||||
|
|
|
@ -152,8 +152,8 @@ class LutBuilder(object):
|
|||
|
||||
# # Debugging
|
||||
# for p,r in patterns:
|
||||
# print p,r
|
||||
# print '--'
|
||||
# print(p,r)
|
||||
# print('--')
|
||||
|
||||
# compile the patterns into regular expressions for speed
|
||||
for i, pattern in enumerate(patterns):
|
||||
|
|
|
@ -107,7 +107,7 @@ class IptcImageFile(ImageFile.ImageFile):
|
|||
else:
|
||||
self.info[tag] = tagdata
|
||||
|
||||
# print tag, self.info[tag]
|
||||
# print(tag, self.info[tag])
|
||||
|
||||
# mode
|
||||
layers = i8(self.info[(3, 60)][0])
|
||||
|
|
|
@ -316,7 +316,7 @@ class JpegImageFile(ImageFile.ImageFile):
|
|||
|
||||
if i in MARKER:
|
||||
name, description, handler = MARKER[i]
|
||||
# print hex(i), name, description
|
||||
# print(hex(i), name, description)
|
||||
if handler is not None:
|
||||
handler(self, i)
|
||||
if i == 0xFFDA: # start of scan
|
||||
|
|
|
@ -75,7 +75,7 @@ def isSpiderHeader(t):
|
|||
labrec = int(h[13]) # no. records in file header
|
||||
labbyt = int(h[22]) # total no. of bytes in header
|
||||
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):
|
||||
return 0
|
||||
# looks like a valid header
|
||||
|
|
|
@ -338,7 +338,7 @@ class IFDRational(Rational):
|
|||
'rfloordiv','mod','rmod', 'pow','rpow', 'pos', 'neg',
|
||||
'abs', 'trunc', 'lt', 'gt', 'le', 'ge', 'nonzero',
|
||||
'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__')
|
||||
|
@ -800,7 +800,7 @@ class ImageFileDirectory_v1(ImageFileDirectory_v2):
|
|||
ifd = ImageFileDirectory_v1()
|
||||
ifd[key] = 'Some Data'
|
||||
ifd.tagtype[key] = 2
|
||||
print ifd[key]
|
||||
print(ifd[key])
|
||||
('Some Data',)
|
||||
|
||||
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_raw_16"]:
|
||||
# if DEBUG:
|
||||
# print "Activating g4 compression for whole file"
|
||||
# print("Activating g4 compression for whole file")
|
||||
|
||||
# Decoder expects entire file as one tile.
|
||||
# There's a buffer size limit in load (64k)
|
||||
|
|
|
@ -111,7 +111,7 @@ class WmfStubImageFile(ImageFile.StubImageFile):
|
|||
|
||||
self.info["dpi"] = 72
|
||||
|
||||
# print self.mode, self.size, self.info
|
||||
# print(self.mode, self.size, self.info)
|
||||
|
||||
# sanity check (standard metafile header)
|
||||
if s[22:26] != b"\x01\x00\t\x00":
|
||||
|
|
|
@ -51,10 +51,10 @@ for i0 in range(65556):
|
|||
|
||||
print()
|
||||
|
||||
# print check(min_size, min_start)
|
||||
# print(check(min_size, min_start))
|
||||
|
||||
print("#define ACCESS_TABLE_SIZE", min_size)
|
||||
print("#define ACCESS_TABLE_HASH", min_start)
|
||||
|
||||
# for m in modes:
|
||||
# print m, "=>", hash(m, min_start) % min_size
|
||||
# print(m, "=>", hash(m, min_start) % min_size)
|
||||
|
|
|
@ -21,7 +21,7 @@ class TestBmpReference(PillowTestCase):
|
|||
im.load()
|
||||
except Exception: # as msg:
|
||||
pass
|
||||
# print ("Bad Image %s: %s" %(f,msg))
|
||||
# print("Bad Image %s: %s" %(f,msg))
|
||||
|
||||
def test_questionable(self):
|
||||
""" These shouldn't crash/dos, but it's not well defined that these
|
||||
|
@ -46,7 +46,7 @@ class TestBmpReference(PillowTestCase):
|
|||
except Exception: # as msg:
|
||||
if os.path.basename(f) in supported:
|
||||
raise
|
||||
# print ("Bad Image %s: %s" %(f,msg))
|
||||
# print("Bad Image %s: %s" %(f,msg))
|
||||
|
||||
def test_good(self):
|
||||
""" These should all work. There's a set of target files in the
|
||||
|
|
|
@ -47,9 +47,9 @@ class TestFormatHSV(PillowTestCase):
|
|||
|
||||
img = Image.merge('RGB', (r, g, b))
|
||||
|
||||
# print (("%d, %d -> "% (int(1.75*px),int(.25*px))) + \
|
||||
# "(%s, %s, %s)"%img.getpixel((1.75*px, .25*px)))
|
||||
# print (("%d, %d -> "% (int(.75*px),int(.25*px))) + \
|
||||
# print(("%d, %d -> "% (int(1.75*px),int(.25*px))) + \
|
||||
# "(%s, %s, %s)"%img.getpixel((1.75*px, .25*px)))
|
||||
# print(("%d, %d -> "% (int(.75*px),int(.25*px))) + \
|
||||
# "(%s, %s, %s)"%img.getpixel((.75*px, .25*px)))
|
||||
return img
|
||||
|
||||
|
@ -95,8 +95,8 @@ class TestFormatHSV(PillowTestCase):
|
|||
im = src.convert('HSV')
|
||||
comparable = self.to_hsv_colorsys(src)
|
||||
|
||||
# print (im.getpixel((448, 64)))
|
||||
# print (comparable.getpixel((448, 64)))
|
||||
# print(im.getpixel((448, 64)))
|
||||
# print(comparable.getpixel((448, 64)))
|
||||
|
||||
# print(im.split()[0].histogram())
|
||||
# print(comparable.split()[0].histogram())
|
||||
|
@ -111,15 +111,15 @@ class TestFormatHSV(PillowTestCase):
|
|||
self.assert_image_similar(im.split()[2], comparable.split()[2],
|
||||
1, "Value conversion is wrong")
|
||||
|
||||
# print (im.getpixel((192, 64)))
|
||||
# print(im.getpixel((192, 64)))
|
||||
|
||||
comparable = src
|
||||
im = im.convert('RGB')
|
||||
|
||||
# im.split()[0].show()
|
||||
# comparable.split()[0].show()
|
||||
# print (im.getpixel((192, 64)))
|
||||
# print (comparable.getpixel((192, 64)))
|
||||
# print(im.getpixel((192, 64)))
|
||||
# print(comparable.getpixel((192, 64)))
|
||||
|
||||
self.assert_image_similar(im.split()[0], comparable.split()[0],
|
||||
3, "R conversion is wrong")
|
||||
|
@ -132,8 +132,8 @@ class TestFormatHSV(PillowTestCase):
|
|||
im = hopper('RGB').convert('HSV')
|
||||
comparable = self.to_hsv_colorsys(hopper('RGB'))
|
||||
|
||||
# print ([ord(x) for x in im.split()[0].tobytes()[:80]])
|
||||
# print ([ord(x) for x in comparable.split()[0].tobytes()[:80]])
|
||||
# print([ord(x) for x in im.split()[0].tobytes()[:80]])
|
||||
# print([ord(x) for x in comparable.split()[0].tobytes()[:80]])
|
||||
|
||||
# print(im.split()[0].histogram())
|
||||
# print(comparable.split()[0].histogram())
|
||||
|
@ -153,8 +153,8 @@ class TestFormatHSV(PillowTestCase):
|
|||
# print(converted.split()[1].histogram())
|
||||
# print(target.split()[1].histogram())
|
||||
|
||||
# print ([ord(x) for x in target.split()[1].tobytes()[:80]])
|
||||
# print ([ord(x) for x in converted.split()[1].tobytes()[:80]])
|
||||
# print([ord(x) for x in target.split()[1].tobytes()[:80]])
|
||||
# print([ord(x) for x in converted.split()[1].tobytes()[:80]])
|
||||
|
||||
self.assert_image_similar(converted.split()[0], comparable.split()[0],
|
||||
3, "R conversion is wrong")
|
||||
|
|
|
@ -323,10 +323,10 @@ class CoreResamplePassesTest(PillowTestCase):
|
|||
class CoreResampleCoefficientsTest(PillowTestCase):
|
||||
def test_reduce(self):
|
||||
test_color = 254
|
||||
# print ''
|
||||
# print()
|
||||
|
||||
for size in range(400000, 400010, 2):
|
||||
# print '\r', size,
|
||||
# print(size)
|
||||
i = Image.new('L', (size, 1), 0)
|
||||
draw = ImageDraw.Draw(i)
|
||||
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()
|
||||
if px[2, 0] != test_color // 2:
|
||||
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):
|
||||
# regression test for the wrong coefficients calculation
|
||||
|
|
|
@ -8,10 +8,10 @@ import locale
|
|||
# on windows, in polish locale:
|
||||
|
||||
# import locale
|
||||
# print locale.setlocale(locale.LC_ALL, 'polish')
|
||||
# print(locale.setlocale(locale.LC_ALL, 'polish'))
|
||||
# import string
|
||||
# print len(string.whitespace)
|
||||
# print ord(string.whitespace[6])
|
||||
# print(len(string.whitespace))
|
||||
# print(ord(string.whitespace[6]))
|
||||
|
||||
# Polish_Poland.1250
|
||||
# 7
|
||||
|
|
|
@ -54,7 +54,7 @@ class TestNumpy(PillowTestCase):
|
|||
i = Image.fromarray(a)
|
||||
if list(i.split()[0].getdata()) != list(range(100)):
|
||||
print("data mismatch for", dtype)
|
||||
# print dtype, list(i.getdata())
|
||||
# print(dtype, list(i.getdata()))
|
||||
return i
|
||||
|
||||
# Check supported 1-bit integer formats
|
||||
|
|
Loading…
Reference in New Issue
Block a user