From 4ed31e8ef78f7e8aa31823ed5599c71037361b2f Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 19 Nov 2016 11:19:43 +1100 Subject: [PATCH] Updated comments to use print as a function --- PIL/BdfFontFile.py | 4 ++-- PIL/CurImagePlugin.py | 16 ++++++++-------- PIL/FontFile.py | 2 +- PIL/FpxImagePlugin.py | 4 ++-- PIL/Image.py | 2 +- PIL/ImageMorph.py | 4 ++-- PIL/IptcImagePlugin.py | 2 +- PIL/JpegImagePlugin.py | 2 +- PIL/SpiderImagePlugin.py | 2 +- PIL/TiffImagePlugin.py | 6 +++--- PIL/WmfImagePlugin.py | 2 +- Tests/make_hash.py | 4 ++-- Tests/test_bmp_reference.py | 4 ++-- Tests/test_format_hsv.py | 24 ++++++++++++------------ Tests/test_image_resample.py | 6 +++--- Tests/test_locale.py | 6 +++--- Tests/test_numpy.py | 2 +- 17 files changed, 46 insertions(+), 46 deletions(-) diff --git a/PIL/BdfFontFile.py b/PIL/BdfFontFile.py index e6cc22f91..d663b55f9 100644 --- a/PIL/BdfFontFile.py +++ b/PIL/BdfFontFile.py @@ -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) diff --git a/PIL/CurImagePlugin.py b/PIL/CurImagePlugin.py index 4db4c4073..39b3fd9a3 100644 --- a/PIL/CurImagePlugin.py +++ b/PIL/CurImagePlugin.py @@ -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") diff --git a/PIL/FontFile.py b/PIL/FontFile.py index d86f9b3ab..c8860a905 100644 --- a/PIL/FontFile.py +++ b/PIL/FontFile.py @@ -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): diff --git a/PIL/FpxImagePlugin.py b/PIL/FpxImagePlugin.py index a4a9098a7..6595a08bb 100644 --- a/PIL/FpxImagePlugin.py +++ b/PIL/FpxImagePlugin.py @@ -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") diff --git a/PIL/Image.py b/PIL/Image.py index cabc10743..c086dfcd7 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -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 diff --git a/PIL/ImageMorph.py b/PIL/ImageMorph.py index 0bbfbb42b..2f7d762c4 100644 --- a/PIL/ImageMorph.py +++ b/PIL/ImageMorph.py @@ -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): diff --git a/PIL/IptcImagePlugin.py b/PIL/IptcImagePlugin.py index 1de17cbba..319e6abfe 100644 --- a/PIL/IptcImagePlugin.py +++ b/PIL/IptcImagePlugin.py @@ -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]) diff --git a/PIL/JpegImagePlugin.py b/PIL/JpegImagePlugin.py index 221bf6495..360c4c9d8 100644 --- a/PIL/JpegImagePlugin.py +++ b/PIL/JpegImagePlugin.py @@ -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 diff --git a/PIL/SpiderImagePlugin.py b/PIL/SpiderImagePlugin.py index 08726f90c..5c4d1bb3b 100644 --- a/PIL/SpiderImagePlugin.py +++ b/PIL/SpiderImagePlugin.py @@ -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 diff --git a/PIL/TiffImagePlugin.py b/PIL/TiffImagePlugin.py index f1860e4aa..956bdc137 100644 --- a/PIL/TiffImagePlugin.py +++ b/PIL/TiffImagePlugin.py @@ -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) diff --git a/PIL/WmfImagePlugin.py b/PIL/WmfImagePlugin.py index 9416035c0..e1391c2bb 100644 --- a/PIL/WmfImagePlugin.py +++ b/PIL/WmfImagePlugin.py @@ -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": diff --git a/Tests/make_hash.py b/Tests/make_hash.py index 6d700addf..4412f65be 100644 --- a/Tests/make_hash.py +++ b/Tests/make_hash.py @@ -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) diff --git a/Tests/test_bmp_reference.py b/Tests/test_bmp_reference.py index 0f98d8374..3b20d4a43 100644 --- a/Tests/test_bmp_reference.py +++ b/Tests/test_bmp_reference.py @@ -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 diff --git a/Tests/test_format_hsv.py b/Tests/test_format_hsv.py index e32f1c047..eea29b3f1 100644 --- a/Tests/test_format_hsv.py +++ b/Tests/test_format_hsv.py @@ -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") diff --git a/Tests/test_image_resample.py b/Tests/test_image_resample.py index ebc1ac6e4..ac58eafa0 100644 --- a/Tests/test_image_resample.py +++ b/Tests/test_image_resample.py @@ -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 diff --git a/Tests/test_locale.py b/Tests/test_locale.py index 3f6ce0ade..3fa7c3e67 100644 --- a/Tests/test_locale.py +++ b/Tests/test_locale.py @@ -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 diff --git a/Tests/test_numpy.py b/Tests/test_numpy.py index 370b8c1f9..02ae5e50b 100644 --- a/Tests/test_numpy.py +++ b/Tests/test_numpy.py @@ -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