mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-30 23:47:27 +03:00 
			
		
		
		
	Merge pull request #2234 from radarhere/print
Updated comments to use print as a function
This commit is contained in:
		
						commit
						55f7a736a4
					
				|  | @ -17,6 +17,8 @@ | |||
| # See the README file for information on usage and redistribution. | ||||
| # | ||||
| 
 | ||||
| from __future__ import print_function | ||||
| 
 | ||||
| from PIL import Image | ||||
| from PIL import FontFile | ||||
| 
 | ||||
|  | @ -119,9 +121,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) | ||||
|  |  | |||
|  | @ -16,6 +16,7 @@ | |||
| # See the README file for information on usage and redistribution. | ||||
| # | ||||
| 
 | ||||
| from __future__ import print_function | ||||
| 
 | ||||
| from PIL import Image, BmpImagePlugin, _binary | ||||
| 
 | ||||
|  | @ -58,14 +59,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") | ||||
| 
 | ||||
|  |  | |||
|  | @ -14,6 +14,8 @@ | |||
| # See the README file for information on usage and redistribution. | ||||
| # | ||||
| 
 | ||||
| from __future__ import print_function | ||||
| 
 | ||||
| import os | ||||
| from PIL import Image, _binary | ||||
| 
 | ||||
|  | @ -88,7 +90,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): | ||||
|  |  | |||
|  | @ -15,6 +15,7 @@ | |||
| # See the README file for information on usage and redistribution. | ||||
| # | ||||
| 
 | ||||
| from __future__ import print_function | ||||
| 
 | ||||
| from PIL import Image, ImageFile | ||||
| from PIL.OleFileIO import i8, i32, MAGIC, OleFileIO | ||||
|  | @ -112,7 +113,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 +142,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 | ||||
|  |  | |||
|  | @ -5,6 +5,8 @@ | |||
| # | ||||
| # Copyright (c) 2014 Dov Grobgeld <dov.grobgeld@gmail.com> | ||||
| 
 | ||||
| from __future__ import print_function | ||||
| 
 | ||||
| from PIL import Image | ||||
| from PIL import _imagingmorph | ||||
| import re | ||||
|  | @ -152,8 +154,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]) | ||||
|  |  | |||
|  | @ -32,6 +32,8 @@ | |||
| # See the README file for information on usage and redistribution. | ||||
| # | ||||
| 
 | ||||
| from __future__ import print_function | ||||
| 
 | ||||
| import array | ||||
| import struct | ||||
| import io | ||||
|  | @ -316,7 +318,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, | ||||
|  | @ -1194,7 +1194,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) | ||||
|  |  | |||
|  | @ -19,6 +19,8 @@ | |||
| # http://wvware.sourceforge.net/caolan/index.html | ||||
| # http://wvware.sourceforge.net/caolan/ora-wmf.html | ||||
| 
 | ||||
| from __future__ import print_function | ||||
| 
 | ||||
| from PIL import Image, ImageFile, _binary | ||||
| 
 | ||||
| __version__ = "0.2" | ||||
|  | @ -108,7 +110,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) | ||||
|  |  | |||
|  | @ -1,3 +1,4 @@ | |||
| from __future__ import print_function | ||||
| from helper import unittest, PillowTestCase | ||||
| 
 | ||||
| from PIL import Image | ||||
|  | @ -21,7 +22,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 +47,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))) + \ | ||||
|         # 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(.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") | ||||
|  |  | |||
|  | @ -1,3 +1,4 @@ | |||
| from __future__ import print_function | ||||
| from helper import unittest, PillowTestCase, hopper | ||||
| from PIL import Image, ImageDraw, ImageMode | ||||
| 
 | ||||
|  | @ -323,10 +324,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 +335,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 | ||||
|  |  | |||
|  | @ -1,3 +1,4 @@ | |||
| from __future__ import print_function | ||||
| from helper import unittest, PillowTestCase | ||||
| 
 | ||||
| from PIL import Image | ||||
|  | @ -8,10 +9,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