Merge pull request #7527 from akx/remove-commented-out-code

This commit is contained in:
Hugo van Kemenade 2023-11-11 14:32:15 +02:00 committed by GitHub
commit 9b8c23e2dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 10 additions and 64 deletions

View File

@ -77,8 +77,6 @@ def Ghostscript(tile, size, fp, scale=1, transparency=False):
# Hack to support hi-res rendering # Hack to support hi-res rendering
scale = int(scale) or 1 scale = int(scale) or 1
# orig_size = size
# orig_bbox = bbox
size = (size[0] * scale, size[1] * scale) size = (size[0] * scale, size[1] * scale)
# resolution is dependent on bbox and size # resolution is dependent on bbox and size
res = ( res = (

View File

@ -54,12 +54,10 @@ class FitsImageFile(ImageFile.ImageFile):
self._mode = "L" self._mode = "L"
elif number_of_bits == 16: elif number_of_bits == 16:
self._mode = "I" self._mode = "I"
# rawmode = "I;16S"
elif number_of_bits == 32: elif number_of_bits == 32:
self._mode = "I" self._mode = "I"
elif number_of_bits in (-32, -64): elif number_of_bits in (-32, -64):
self._mode = "F" self._mode = "F"
# rawmode = "F" if number_of_bits == -32 else "F;64F"
offset = math.ceil(self.fp.tell() / 2880) * 2880 offset = math.ceil(self.fp.tell() / 2880) * 2880
self.tile = [("raw", (0, 0) + self.size, offset, (self.mode, 0, -1))] self.tile = [("raw", (0, 0) + self.size, offset, (self.mode, 0, -1))]

View File

@ -78,7 +78,6 @@ class FontFile:
if glyph: if glyph:
d, dst, src, im = glyph d, dst, src, im = glyph
xx = src[2] - src[0] xx = src[2] - src[0]
# yy = src[3] - src[1]
x0, y0 = x, y x0, y0 = x, y
x = x + xx x = x + xx
if x > WIDTH: if x > WIDTH:

View File

@ -281,14 +281,9 @@ class GifImageFile(ImageFile.ImageFile):
bits = self.fp.read(1)[0] bits = self.fp.read(1)[0]
self.__offset = self.fp.tell() self.__offset = self.fp.tell()
break break
else:
pass
# raise OSError, "illegal GIF tag `%x`" % s[0]
s = None s = None
if interlace is None: if interlace is None:
# self._fp = None
msg = "image not found in GIF frame" msg = "image not found in GIF frame"
raise EOFError(msg) raise EOFError(msg)

View File

@ -174,9 +174,7 @@ class IcoFile:
self.entry = sorted(self.entry, key=lambda x: x["color_depth"]) self.entry = sorted(self.entry, key=lambda x: x["color_depth"])
# ICO images are usually squares # 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"], reverse=True)
self.entry = sorted(self.entry, key=lambda x: x["square"])
self.entry.reverse()
def sizes(self): def sizes(self):
""" """

View File

@ -430,7 +430,6 @@ class Parser:
with io.BytesIO(self.data) as fp: with io.BytesIO(self.data) as fp:
im = Image.open(fp) im = Image.open(fp)
except OSError: except OSError:
# traceback.print_exc()
pass # not enough data pass # not enough data
else: else:
flag = hasattr(im, "load_seek") or hasattr(im, "load_read") flag = hasattr(im, "load_seek") or hasattr(im, "load_read")

View File

@ -257,8 +257,6 @@ def load(filename):
if lut: if lut:
break break
except (SyntaxError, ValueError): except (SyntaxError, ValueError):
# import traceback
# traceback.print_exc()
pass pass
else: else:
msg = "cannot load palette" msg = "cannot load palette"

View File

@ -83,16 +83,6 @@ def fromqimage(im):
def fromqpixmap(im): def fromqpixmap(im):
return fromqimage(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): def align8to32(bytes, width, mode):
@ -208,9 +198,5 @@ def toqimage(im):
def toqpixmap(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) qimage = toqimage(im)
return QPixmap.fromImage(qimage) return QPixmap.fromImage(qimage)

View File

@ -33,9 +33,6 @@ from . import (
from ._binary import i16be as i16 from ._binary import i16be as i16
from ._binary import o32le from ._binary import o32le
# def _accept(prefix):
# return JpegImagePlugin._accept(prefix)
def _save(im, fp, filename): def _save(im, fp, filename):
JpegImagePlugin._save(im, fp, filename) JpegImagePlugin._save(im, fp, filename)

View File

@ -328,9 +328,6 @@ def _save(im, fp, filename):
fp.write(b"65535\n") fp.write(b"65535\n")
ImageFile._save(im, fp, [("raw", (0, 0) + im.size, 0, (rawmode, 0, 1))]) ImageFile._save(im, fp, [("raw", (0, 0) + im.size, 0, (rawmode, 0, 1))])
# ALTERNATIVE: save via builtin debug function
# im._dump(filename)
# #
# -------------------------------------------------------------------- # --------------------------------------------------------------------

View File

@ -1885,13 +1885,14 @@ class AppendingTiffWriter:
8, # long8 8, # long8
] ]
# StripOffsets = 273 Tags = {
# FreeOffsets = 288 273, # StripOffsets
# TileOffsets = 324 288, # FreeOffsets
# JPEGQTables = 519 324, # TileOffsets
# JPEGDCTables = 520 519, # JPEGQTables
# JPEGACTables = 521 520, # JPEGDCTables
Tags = {273, 288, 324, 519, 520, 521} 521, # JPEGACTables
}
def __init__(self, fn, new=False): def __init__(self, fn, new=False):
if hasattr(fn, "read"): if hasattr(fn, "read"):
@ -1941,8 +1942,6 @@ class AppendingTiffWriter:
iimm = self.f.read(4) iimm = self.f.read(4)
if not iimm: 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. # Make it easy to finish a frame without committing to a new one.
return return

View File

@ -56,7 +56,7 @@ def lookup(tag, group=None):
## ##
# Map tag numbers to tag info. # 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 # The length here differs from the length in the tiff spec. For
# numbers, the tiff spec is for the number of fields returned. We # numbers, the tiff spec is for the number of fields returned. We
@ -438,22 +438,6 @@ _populate()
TYPES = {} 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 # These tags are handled by default in libtiff, without
# adding to the custom dictionary. From tif_dir.c, searching for # adding to the custom dictionary. From tif_dir.c, searching for

View File

@ -213,7 +213,6 @@ DEPS = {
], ],
"headers": [r"libtiff\tiff*.h"], "headers": [r"libtiff\tiff*.h"],
"libs": [r"libtiff\*.lib"], "libs": [r"libtiff\*.lib"],
# "bins": [r"libtiff\*.dll"],
}, },
"libpng": { "libpng": {
"url": SF_PROJECTS + "/libpng/files/libpng16/1.6.39/lpng1639.zip/download", "url": SF_PROJECTS + "/libpng/files/libpng16/1.6.39/lpng1639.zip/download",
@ -272,7 +271,6 @@ DEPS = {
cmd_xcopy("include", "{inc_dir}"), cmd_xcopy("include", "{inc_dir}"),
], ],
"libs": [r"objs\{msbuild_arch}\Release Static\freetype.lib"], "libs": [r"objs\{msbuild_arch}\Release Static\freetype.lib"],
# "bins": [r"objs\{msbuild_arch}\Release\freetype.dll"],
}, },
"lcms2": { "lcms2": {
"url": SF_PROJECTS + "/lcms/files/lcms/2.15/lcms2-2.15.tar.gz/download", "url": SF_PROJECTS + "/lcms/files/lcms/2.15/lcms2-2.15.tar.gz/download",