Skip to content

Commit

Permalink
Merge pull request #7527 from akx/remove-commented-out-code
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Nov 11, 2023
2 parents 8a13bf8 + 0c70569 commit 9b8c23e
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 64 deletions.
2 changes: 0 additions & 2 deletions src/PIL/EpsImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ def Ghostscript(tile, size, fp, scale=1, transparency=False):

# Hack to support hi-res rendering
scale = int(scale) or 1
# orig_size = size
# orig_bbox = bbox
size = (size[0] * scale, size[1] * scale)
# resolution is dependent on bbox and size
res = (
Expand Down
2 changes: 0 additions & 2 deletions src/PIL/FitsImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@ def _open(self):
self._mode = "L"
elif number_of_bits == 16:
self._mode = "I"
# rawmode = "I;16S"
elif number_of_bits == 32:
self._mode = "I"
elif number_of_bits in (-32, -64):
self._mode = "F"
# rawmode = "F" if number_of_bits == -32 else "F;64F"

offset = math.ceil(self.fp.tell() / 2880) * 2880
self.tile = [("raw", (0, 0) + self.size, offset, (self.mode, 0, -1))]
Expand Down
1 change: 0 additions & 1 deletion src/PIL/FontFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ def compile(self):
if glyph:
d, dst, src, im = glyph
xx = src[2] - src[0]
# yy = src[3] - src[1]
x0, y0 = x, y
x = x + xx
if x > WIDTH:
Expand Down
5 changes: 0 additions & 5 deletions src/PIL/GifImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,9 @@ def _seek(self, frame, update_image=True):
bits = self.fp.read(1)[0]
self.__offset = self.fp.tell()
break

else:
pass
# raise OSError, "illegal GIF tag `%x`" % s[0]
s = None

if interlace is None:
# self._fp = None
msg = "image not found in GIF frame"
raise EOFError(msg)

Expand Down
4 changes: 1 addition & 3 deletions src/PIL/IcoImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ def __init__(self, buf):

self.entry = sorted(self.entry, key=lambda x: x["color_depth"])
# ICO images are usually squares
# self.entry = sorted(self.entry, key=lambda x: x['width'])
self.entry = sorted(self.entry, key=lambda x: x["square"])
self.entry.reverse()
self.entry = sorted(self.entry, key=lambda x: x["square"], reverse=True)

def sizes(self):
"""
Expand Down
1 change: 0 additions & 1 deletion src/PIL/ImageFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ def feed(self, data):
with io.BytesIO(self.data) as fp:
im = Image.open(fp)
except OSError:
# traceback.print_exc()
pass # not enough data
else:
flag = hasattr(im, "load_seek") or hasattr(im, "load_read")
Expand Down
2 changes: 0 additions & 2 deletions src/PIL/ImagePalette.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,6 @@ def load(filename):
if lut:
break
except (SyntaxError, ValueError):
# import traceback
# traceback.print_exc()
pass
else:
msg = "cannot load palette"
Expand Down
14 changes: 0 additions & 14 deletions src/PIL/ImageQt.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,6 @@ def fromqimage(im):

def fromqpixmap(im):
return fromqimage(im)
# buffer = QBuffer()
# buffer.open(QIODevice.ReadWrite)
# # im.save(buffer)
# # What if png doesn't support some image features like animation?
# im.save(buffer, 'ppm')
# bytes_io = BytesIO()
# bytes_io.write(buffer.data())
# buffer.close()
# bytes_io.seek(0)
# return Image.open(bytes_io)


def align8to32(bytes, width, mode):
Expand Down Expand Up @@ -208,9 +198,5 @@ def toqimage(im):


def toqpixmap(im):
# # This doesn't work. For now using a dumb approach.
# im_data = _toqclass_helper(im)
# result = QPixmap(im_data["size"][0], im_data["size"][1])
# result.loadFromData(im_data["data"])
qimage = toqimage(im)
return QPixmap.fromImage(qimage)
3 changes: 0 additions & 3 deletions src/PIL/MpoImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
from ._binary import i16be as i16
from ._binary import o32le

# def _accept(prefix):
# return JpegImagePlugin._accept(prefix)


def _save(im, fp, filename):
JpegImagePlugin._save(im, fp, filename)
Expand Down
3 changes: 0 additions & 3 deletions src/PIL/PpmImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,6 @@ def _save(im, fp, filename):
fp.write(b"65535\n")
ImageFile._save(im, fp, [("raw", (0, 0) + im.size, 0, (rawmode, 0, 1))])

# ALTERNATIVE: save via builtin debug function
# im._dump(filename)


#
# --------------------------------------------------------------------
Expand Down
17 changes: 8 additions & 9 deletions src/PIL/TiffImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1885,13 +1885,14 @@ class AppendingTiffWriter:
8, # long8
]

# StripOffsets = 273
# FreeOffsets = 288
# TileOffsets = 324
# JPEGQTables = 519
# JPEGDCTables = 520
# JPEGACTables = 521
Tags = {273, 288, 324, 519, 520, 521}
Tags = {
273, # StripOffsets
288, # FreeOffsets
324, # TileOffsets
519, # JPEGQTables
520, # JPEGDCTables
521, # JPEGACTables
}

def __init__(self, fn, new=False):
if hasattr(fn, "read"):
Expand Down Expand Up @@ -1941,8 +1942,6 @@ def finalize(self):

iimm = self.f.read(4)
if not iimm:
# msg = "nothing written into new page"
# raise RuntimeError(msg)
# Make it easy to finish a frame without committing to a new one.
return

Expand Down
18 changes: 1 addition & 17 deletions src/PIL/TiffTags.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def lookup(tag, group=None):
##
# Map tag numbers to tag info.
#
# id: (Name, Type, Length, enum_values)
# id: (Name, Type, Length[, enum_values])
#
# The length here differs from the length in the tiff spec. For
# numbers, the tiff spec is for the number of fields returned. We
Expand Down Expand Up @@ -438,22 +438,6 @@ def _populate():

TYPES = {}

# was:
# TYPES = {
# 1: "byte",
# 2: "ascii",
# 3: "short",
# 4: "long",
# 5: "rational",
# 6: "signed byte",
# 7: "undefined",
# 8: "signed short",
# 9: "signed long",
# 10: "signed rational",
# 11: "float",
# 12: "double",
# }

#
# These tags are handled by default in libtiff, without
# adding to the custom dictionary. From tif_dir.c, searching for
Expand Down
2 changes: 0 additions & 2 deletions winbuild/build_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ def cmd_msbuild(
],
"headers": [r"libtiff\tiff*.h"],
"libs": [r"libtiff\*.lib"],
# "bins": [r"libtiff\*.dll"],
},
"libpng": {
"url": SF_PROJECTS + "/libpng/files/libpng16/1.6.39/lpng1639.zip/download",
Expand Down Expand Up @@ -272,7 +271,6 @@ def cmd_msbuild(
cmd_xcopy("include", "{inc_dir}"),
],
"libs": [r"objs\{msbuild_arch}\Release Static\freetype.lib"],
# "bins": [r"objs\{msbuild_arch}\Release\freetype.dll"],
},
"lcms2": {
"url": SF_PROJECTS + "/lcms/files/lcms/2.15/lcms2-2.15.tar.gz/download",
Expand Down

0 comments on commit 9b8c23e

Please sign in to comment.