Merge pull request #4299 from hugovk/6.2.x-fix-lint

6.2.x: Fix Lint
This commit is contained in:
Andrew Murray 2019-12-26 09:13:42 +11:00 committed by GitHub
commit 71ffb52320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 29 deletions

View File

@ -119,7 +119,7 @@ def decode_dxt3(data):
bits = struct.unpack_from("<8B", block)
color0, color1 = struct.unpack_from("<HH", block, 8)
code, = struct.unpack_from("<I", block, 12)
(code,) = struct.unpack_from("<I", block, 12)
r0, g0, b0 = unpack_565(color0)
r1, g1, b1 = unpack_565(color1)
@ -177,7 +177,7 @@ def decode_dxt5(data):
color0, color1 = struct.unpack_from("<HH", block, 8)
code, = struct.unpack_from("<I", block, 12)
(code,) = struct.unpack_from("<I", block, 12)
r0, g0, b0 = unpack_565(color0)
r1, g1, b1 = unpack_565(color1)
@ -255,19 +255,19 @@ class BlpImageFile(ImageFile.ImageFile):
self.tile = [(decoder, (0, 0) + self.size, 0, (self.mode, 0, 1))]
def _read_blp_header(self):
self._blp_compression, = struct.unpack("<i", self.fp.read(4))
(self._blp_compression,) = struct.unpack("<i", self.fp.read(4))
self._blp_encoding, = struct.unpack("<b", self.fp.read(1))
self._blp_alpha_depth, = struct.unpack("<b", self.fp.read(1))
self._blp_alpha_encoding, = struct.unpack("<b", self.fp.read(1))
self._blp_mips, = struct.unpack("<b", self.fp.read(1))
(self._blp_encoding,) = struct.unpack("<b", self.fp.read(1))
(self._blp_alpha_depth,) = struct.unpack("<b", self.fp.read(1))
(self._blp_alpha_encoding,) = struct.unpack("<b", self.fp.read(1))
(self._blp_mips,) = struct.unpack("<b", self.fp.read(1))
self._size = struct.unpack("<II", self.fp.read(8))
if self.magic == b"BLP1":
# Only present for BLP1
self._blp_encoding, = struct.unpack("<i", self.fp.read(4))
self._blp_subtype, = struct.unpack("<i", self.fp.read(4))
(self._blp_encoding,) = struct.unpack("<i", self.fp.read(4))
(self._blp_subtype,) = struct.unpack("<i", self.fp.read(4))
self._blp_offsets = struct.unpack("<16I", self.fp.read(16 * 4))
self._blp_lengths = struct.unpack("<16I", self.fp.read(16 * 4))
@ -297,19 +297,19 @@ class _BLPBaseDecoder(ImageFile.PyDecoder):
return ret
def _read_blp_header(self):
self._blp_compression, = struct.unpack("<i", self.fd.read(4))
(self._blp_compression,) = struct.unpack("<i", self.fd.read(4))
self._blp_encoding, = struct.unpack("<b", self.fd.read(1))
self._blp_alpha_depth, = struct.unpack("<b", self.fd.read(1))
self._blp_alpha_encoding, = struct.unpack("<b", self.fd.read(1))
self._blp_mips, = struct.unpack("<b", self.fd.read(1))
(self._blp_encoding,) = struct.unpack("<b", self.fd.read(1))
(self._blp_alpha_depth,) = struct.unpack("<b", self.fd.read(1))
(self._blp_alpha_encoding,) = struct.unpack("<b", self.fd.read(1))
(self._blp_mips,) = struct.unpack("<b", self.fd.read(1))
self.size = struct.unpack("<II", self.fd.read(8))
if self.magic == b"BLP1":
# Only present for BLP1
self._blp_encoding, = struct.unpack("<i", self.fd.read(4))
self._blp_subtype, = struct.unpack("<i", self.fd.read(4))
(self._blp_encoding,) = struct.unpack("<i", self.fd.read(4))
(self._blp_subtype,) = struct.unpack("<i", self.fd.read(4))
self._blp_offsets = struct.unpack("<16I", self.fd.read(16 * 4))
self._blp_lengths = struct.unpack("<16I", self.fd.read(16 * 4))
@ -327,7 +327,7 @@ class BLP1Decoder(_BLPBaseDecoder):
_data = BytesIO(self.fd.read(self._blp_lengths[0]))
while True:
try:
offset, = struct.unpack("<B", _data.read(1))
(offset,) = struct.unpack("<B", _data.read(1))
except struct.error:
break
b, g, r, a = palette[offset]
@ -346,7 +346,7 @@ class BLP1Decoder(_BLPBaseDecoder):
def _decode_jpeg_stream(self):
from PIL.JpegImagePlugin import JpegImageFile
jpeg_header_size, = struct.unpack("<I", self.fd.read(4))
(jpeg_header_size,) = struct.unpack("<I", self.fd.read(4))
jpeg_header = self.fd.read(jpeg_header_size)
self.fd.read(self._blp_offsets[0] - self.fd.tell()) # What IS this?
data = self.fd.read(self._blp_lengths[0])
@ -372,7 +372,7 @@ class BLP2Decoder(_BLPBaseDecoder):
_data = BytesIO(self.fd.read(self._blp_lengths[0]))
while True:
try:
offset, = struct.unpack("<B", _data.read(1))
(offset,) = struct.unpack("<B", _data.read(1))
except struct.error:
break
b, g, r, a = palette[offset]

View File

@ -122,7 +122,7 @@ class DdsImageFile(ImageFile.ImageFile):
# pixel format
pfsize, pfflags = struct.unpack("<2I", header.read(8))
fourcc = header.read(4)
bitcount, = struct.unpack("<I", header.read(4))
(bitcount,) = struct.unpack("<I", header.read(4))
masks = struct.unpack("<4I", header.read(16))
if pfflags & 0x40:
# DDPF_RGB - Texture contains uncompressed RGB data

View File

@ -79,7 +79,7 @@ class FtexImageFile(ImageFile.ImageFile):
format, where = struct.unpack("<2i", self.fp.read(8))
self.fp.seek(where)
mipmap_size, = struct.unpack("<i", self.fp.read(4))
(mipmap_size,) = struct.unpack("<i", self.fp.read(4))
data = self.fp.read(mipmap_size)

View File

@ -3238,7 +3238,7 @@ class Exif(MutableMapping):
continue
size = count * unit_size
if size > 4:
offset, = struct.unpack("<L", data)
(offset,) = struct.unpack("<L", data)
data = ifd_data[offset - 12 : offset + size - 12]
else:
data = data[:size]
@ -3268,7 +3268,7 @@ class Exif(MutableMapping):
)
if ifd_tag == 0x1101:
# CameraInfo
offset, = struct.unpack(">L", data)
(offset,) = struct.unpack(">L", data)
self.fp.seek(offset)
camerainfo = {"ModelID": self.fp.read(4)}

View File

@ -484,7 +484,7 @@ class ImageFileDirectory_v2(MutableMapping):
else:
raise SyntaxError("not a TIFF IFD")
self.reset()
self.next, = self._unpack("L", ifh[4:])
(self.next,) = self._unpack("L", ifh[4:])
self._legacy_api = False
prefix = property(lambda self: self._prefix)
@ -595,7 +595,7 @@ class ImageFileDirectory_v2(MutableMapping):
]: # rationals
values = (values,)
try:
dest[tag], = values
(dest[tag],) = values
except ValueError:
# We've got a builtin tag with 1 expected entry
warnings.warn(
@ -765,7 +765,7 @@ class ImageFileDirectory_v2(MutableMapping):
size = count * unit_size
if size > 4:
here = fp.tell()
offset, = self._unpack("L", data)
(offset,) = self._unpack("L", data)
if DEBUG:
print(
"Tag Location: %s - Data Location: %s" % (here, offset),
@ -797,7 +797,7 @@ class ImageFileDirectory_v2(MutableMapping):
else:
print("- value:", self[tag])
self.next, = self._unpack("L", self._ensure_read(fp, 4))
(self.next,) = self._unpack("L", self._ensure_read(fp, 4))
except IOError as msg:
warnings.warn(str(msg))
return
@ -1809,11 +1809,11 @@ class AppendingTiffWriter:
return self.f.write(data)
def readShort(self):
value, = struct.unpack(self.shortFmt, self.f.read(2))
(value,) = struct.unpack(self.shortFmt, self.f.read(2))
return value
def readLong(self):
value, = struct.unpack(self.longFmt, self.f.read(4))
(value,) = struct.unpack(self.longFmt, self.f.read(4))
return value
def rewriteLastShortToLong(self, value):