Skip to content

Commit

Permalink
Clean up commented out debug print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
jdufresne committed Sep 5, 2018
1 parent 9dd09fa commit 37f1065
Show file tree
Hide file tree
Showing 18 changed files with 0 additions and 90 deletions.
5 changes: 0 additions & 5 deletions Tests/make_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,5 @@ def check(size, i0):

print()

# 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)
2 changes: 0 additions & 2 deletions Tests/test_bmp_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def test_bad(self):
im.load()
except Exception: # as msg:
pass
# print("Bad Image %s: %s" %(f,msg))

def test_questionable(self):
""" These shouldn't crash/dos, but it's not well defined that these
Expand All @@ -47,7 +46,6 @@ def test_questionable(self):
except Exception: # as msg:
if os.path.basename(f) in supported:
raise
# print("Bad Image %s: %s" %(f,msg))

def test_good(self):
""" These should all work. There's a set of target files in the
Expand Down
32 changes: 0 additions & 32 deletions Tests/test_format_hsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ def wedge(self):

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))) + \
# "(%s, %s, %s)"%img.getpixel((.75*px, .25*px)))
return img

def to_xxx_colorsys(self, im, func, mode):
Expand Down Expand Up @@ -95,32 +91,16 @@ def test_wedge(self):
im = src.convert('HSV')
comparable = self.to_hsv_colorsys(src)

# print(im.getpixel((448, 64)))
# print(comparable.getpixel((448, 64)))

# print(im.split()[0].histogram())
# print(comparable.split()[0].histogram())

# im.split()[0].show()
# comparable.split()[0].show()

self.assert_image_similar(im.getchannel(0), comparable.getchannel(0),
1, "Hue conversion is wrong")
self.assert_image_similar(im.getchannel(1), comparable.getchannel(1),
1, "Saturation conversion is wrong")
self.assert_image_similar(im.getchannel(2), comparable.getchannel(2),
1, "Value conversion is wrong")

# 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)))

self.assert_image_similar(im.getchannel(0), comparable.getchannel(0),
3, "R conversion is wrong")
self.assert_image_similar(im.getchannel(1), comparable.getchannel(1),
Expand All @@ -132,12 +112,6 @@ def test_convert(self):
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(im.split()[0].histogram())
# print(comparable.split()[0].histogram())

self.assert_image_similar(im.getchannel(0), comparable.getchannel(0),
1, "Hue conversion is wrong")
self.assert_image_similar(im.getchannel(1), comparable.getchannel(1),
Expand All @@ -150,12 +124,6 @@ def test_hsv_to_rgb(self):
converted = comparable.convert('RGB')
comparable = self.to_rgb_colorsys(comparable)

# 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]])

self.assert_image_similar(converted.getchannel(0),
comparable.getchannel(0),
3, "R conversion is wrong")
Expand Down
3 changes: 0 additions & 3 deletions Tests/test_image_resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,18 +352,15 @@ def test_box_vertical(self):
class CoreResampleCoefficientsTest(PillowTestCase):
def test_reduce(self):
test_color = 254
# print()

for size in range(400000, 400010, 2):
# 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)

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('>', size, test_color // 2, px[2, 0])

def test_nonzero_coefficients(self):
# regression test for the wrong coefficients calculation
Expand Down
1 change: 0 additions & 1 deletion Tests/test_imagewin_pointers.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def test_pointer(self):
hdr.biClrImportant = 0

hdc = CreateCompatibleDC(None)
# print('hdc:',hex(hdc))
pixels = ctypes.c_void_p()
dib = CreateDIBSection(hdc, ctypes.byref(hdr), DIB_RGB_COLORS,
ctypes.byref(pixels), None, 0)
Expand Down
1 change: 0 additions & 1 deletion Tests/test_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def to_image(dtype, bands=1, boolean=0):
i = Image.fromarray(a)
if list(i.getchannel(0).getdata()) != list(range(100)):
print("data mismatch for", dtype)
# print(dtype, list(i.getdata()))
return i

# Check supported 1-bit integer formats
Expand Down
14 changes: 0 additions & 14 deletions src/PIL/BdfFontFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,6 @@ def __init__(self, fp):
if s.find(b"LogicalFontDescription") < 0:
comments.append(s[i+1:-1].decode('ascii'))

# font = props["FONT"].split("-")

# font[4] = bdf_slant[font[4].upper()]
# font[11] = bdf_spacing[font[11].upper()]

# ascent = int(props["FONT_ASCENT"])
# descent = int(props["FONT_DESCENT"])

# fontname = ";".join(font[1:])

# print("#", fontname)
# for i in comments:
# print("#", i)

while True:
c = bdf_char(fp)
if not c:
Expand Down
8 changes: 0 additions & 8 deletions src/PIL/CurImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ def _open(self):
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:]))
if not m:
raise TypeError("No cursors were found")

Expand Down
1 change: 0 additions & 1 deletion src/PIL/EpsImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def Ghostscript(tile, size, fp, scale=1):
# resolution is dependent on bbox and size
res = (float((72.0 * size[0]) / (bbox[2]-bbox[0])),
float((72.0 * size[1]) / (bbox[3]-bbox[1])))
# print("Ghostscript", scale, size, orig_size, bbox, orig_bbox, res)

import subprocess
import tempfile
Expand Down
1 change: 0 additions & 1 deletion src/PIL/FontFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ def compile(self):
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)
self.metrics[i] = d, dst, s

def save(self, filename):
Expand Down
4 changes: 0 additions & 4 deletions src/PIL/FpxImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ def _open_index(self, index=1):
if id in prop:
self.jpeg[i] = prop[id]

# print(len(self.jpeg), "tables loaded")

self._open_subimage(1, self.maxid)

def _open_subimage(self, index=1, subimage=0):
Expand Down Expand Up @@ -143,8 +141,6 @@ def _open_subimage(self, index=1, subimage=0):
offset = i32(s, 28)
length = i32(s, 32)

# print(size, self.mode, self.rawmode)

if size != self.size:
raise IOError("subimage mismatch")

Expand Down
3 changes: 0 additions & 3 deletions src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@ def _getdecoder(mode, decoder_name, args, extra=()):
try:
# get decoder
decoder = getattr(core, decoder_name + "_decoder")
# print(decoder, mode, args + extra)
return decoder(mode, *args + extra)
except AttributeError:
raise IOError("decoder %s not available" % decoder_name)
Expand All @@ -465,7 +464,6 @@ def _getencoder(mode, encoder_name, args, extra=()):
try:
# get encoder
encoder = getattr(core, encoder_name + "_encoder")
# print(encoder, mode, args + extra)
return encoder(mode, *args + extra)
except AttributeError:
raise IOError("encoder %s not available" % encoder_name)
Expand Down Expand Up @@ -2470,7 +2468,6 @@ def fromarray(obj, mode=None):
typekey = (1, 1) + shape[2:], arr['typestr']
mode, rawmode = _fromarray_typemap[typekey]
except KeyError:
# print(typekey)
raise TypeError("Cannot handle this data type")
else:
rawmode = mode
Expand Down
5 changes: 0 additions & 5 deletions src/PIL/ImageMorph.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,6 @@ def build_lut(self):

patterns += self._pattern_permute(pattern, options, result)

# # Debugging
# for p, r in patterns:
# print(p, r)
# print('--')

# compile the patterns into regular expressions for speed
for i, pattern in enumerate(patterns):
p = pattern[0].replace('.', 'X').replace('X', '[01]')
Expand Down
2 changes: 0 additions & 2 deletions src/PIL/IptcImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ def _open(self):
else:
self.info[tag] = tagdata

# print(tag, self.info[tag])

# mode
layers = i8(self.info[(3, 60)][0])
component = i8(self.info[(3, 60)][1])
Expand Down
1 change: 0 additions & 1 deletion src/PIL/JpegImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ def _open(self):

if i in MARKER:
name, description, handler = MARKER[i]
# print(hex(i), name, description)
if handler is not None:
handler(self, i)
if i == 0xFFDA: # start of scan
Expand Down
1 change: 0 additions & 1 deletion src/PIL/SpiderImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ 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))
if labbyt != (labrec * lenbyt):
return 0
# looks like a valid header
Expand Down
4 changes: 0 additions & 4 deletions src/PIL/TiffImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1254,9 +1254,6 @@ def _setup(self):
h = self.tag_v2.get(ROWSPERSTRIP, ysize)
w = self.size[0]
if READ_LIBTIFF or self._compression != 'raw':
# if DEBUG:
# print("Activating g4 compression for whole file")

# Decoder expects entire file as one tile.
# There's a buffer size limit in load (64k)
# so large g4 images will fail if we use that
Expand Down Expand Up @@ -1529,7 +1526,6 @@ def _save(im, fp, filename):
rawmode = 'I;16N'

a = (rawmode, compression, _fp, filename, atts)
# print(im.mode, compression, a, im.encoderconfig)
e = Image._getencoder(im.mode, 'libtiff', a, im.encoderconfig)
e.setimage(im.im, (0, 0)+im.size)
while True:
Expand Down
2 changes: 0 additions & 2 deletions src/PIL/WmfImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ def _open(self):

self.info["dpi"] = 72

# print(self.mode, self.size, self.info)

# sanity check (standard metafile header)
if s[22:26] != b"\x01\x00\t\x00":
raise SyntaxError("Unsupported WMF file format")
Expand Down

0 comments on commit 37f1065

Please sign in to comment.