mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 00:46:16 +03:00
flake8: F841 local variable is assigned to but never used
This commit is contained in:
parent
302f86292c
commit
eb9aee7048
|
@ -32,7 +32,7 @@ class TestFileTar(PillowTestCase):
|
|||
tar.close()
|
||||
|
||||
def test_contextmanager(self):
|
||||
with TarIO.TarIO(TEST_TAR_FILE, 'hopper.jpg') as tar:
|
||||
with TarIO.TarIO(TEST_TAR_FILE, 'hopper.jpg'):
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ class TestImageTransform(PillowTestCase):
|
|||
]
|
||||
|
||||
# Yeah. Watch some JIT optimize this out.
|
||||
pattern = None
|
||||
pattern = None # noqa: F841
|
||||
|
||||
self.test_mesh()
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ try:
|
|||
from PIL import ImageCms
|
||||
from PIL.ImageCms import ImageCmsProfile
|
||||
ImageCms.core.profile_open
|
||||
except ImportError as v:
|
||||
except ImportError:
|
||||
# Skipped via setUp()
|
||||
pass
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ if ImageQt.qt_is_installed:
|
|||
|
||||
pixmap1 = QtGui.QPixmap.fromImage(qimage)
|
||||
|
||||
QHBoxLayout(self)
|
||||
QHBoxLayout(self) # hbox
|
||||
|
||||
lbl = QLabel(self)
|
||||
# Segfault in the problem
|
||||
|
|
|
@ -225,7 +225,7 @@ class DdsImageFile(ImageFile.ImageFile):
|
|||
self.mode = "RGBA"
|
||||
|
||||
pitch, depth, mipmaps = struct.unpack("<3I", header.read(12))
|
||||
reserved = struct.unpack("<11I", header.read(44))
|
||||
struct.unpack("<11I", header.read(44)) # reserved
|
||||
|
||||
# pixel format
|
||||
pfsize, pfflags = struct.unpack("<2I", header.read(8))
|
||||
|
@ -235,10 +235,8 @@ class DdsImageFile(ImageFile.ImageFile):
|
|||
|
||||
if fourcc == b"DXT1":
|
||||
self.decoder = "DXT1"
|
||||
codec = _dxt1
|
||||
elif fourcc == b"DXT5":
|
||||
self.decoder = "DXT5"
|
||||
codec = _dxt5
|
||||
else:
|
||||
raise NotImplementedError("Unimplemented pixel format %r" % fourcc)
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ class DdsImageFile(ImageFile.ImageFile):
|
|||
self.mode = "RGBA"
|
||||
|
||||
pitch, depth, mipmaps = struct.unpack("<3I", header.read(12))
|
||||
reserved = struct.unpack("<11I", header.read(44))
|
||||
struct.unpack("<11I", header.read(44)) # reserved
|
||||
|
||||
# pixel format
|
||||
pfsize, pfflags = struct.unpack("<2I", header.read(8))
|
||||
|
|
|
@ -66,8 +66,8 @@ class FtexImageFile(ImageFile.ImageFile):
|
|||
format_description = "Texture File Format (IW2:EOC)"
|
||||
|
||||
def _open(self):
|
||||
magic = struct.unpack("<I", self.fp.read(4))
|
||||
version = struct.unpack("<i", self.fp.read(4))
|
||||
struct.unpack("<I", self.fp.read(4)) # magic
|
||||
struct.unpack("<i", self.fp.read(4)) # version
|
||||
self._size = struct.unpack("<2i", self.fp.read(8))
|
||||
mipmap_count, format_count = struct.unpack("<2i", self.fp.read(8))
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ class ImImageFile(ImageFile.ImageFile):
|
|||
|
||||
try:
|
||||
m = split.match(s)
|
||||
except re.error as v:
|
||||
except re.error:
|
||||
raise SyntaxError("not an IM file")
|
||||
|
||||
if m:
|
||||
|
|
|
@ -230,7 +230,7 @@ class PcfFontFile(FontFile.FontFile):
|
|||
firstCol, lastCol = i16(fp.read(2)), i16(fp.read(2))
|
||||
firstRow, lastRow = i16(fp.read(2)), i16(fp.read(2))
|
||||
|
||||
default = i16(fp.read(2))
|
||||
i16(fp.read(2)) # default
|
||||
|
||||
nencoding = (lastCol - firstCol + 1) * (lastRow - firstRow + 1)
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ class PsdImageFile(ImageFile.ImageFile):
|
|||
# load resources
|
||||
end = self.fp.tell() + size
|
||||
while self.fp.tell() < end:
|
||||
signature = read(4)
|
||||
read(4) # signature
|
||||
id = i16(read(2))
|
||||
name = read(i8(read(1)))
|
||||
if not (len(name) & 1):
|
||||
|
@ -207,17 +207,13 @@ def _layerinfo(file):
|
|||
mode = None # unknown
|
||||
|
||||
# skip over blend flags and extra information
|
||||
filler = read(12)
|
||||
read(12) # filler
|
||||
name = ""
|
||||
size = i32(read(4))
|
||||
combined = 0
|
||||
if size:
|
||||
length = i32(read(4))
|
||||
if length:
|
||||
mask_y = i32(read(4))
|
||||
mask_x = i32(read(4))
|
||||
mask_h = i32(read(4)) - mask_y
|
||||
mask_w = i32(read(4)) - mask_x
|
||||
file.seek(length - 16, 1)
|
||||
combined += length + 4
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ from . import Image, ImageFile
|
|||
try:
|
||||
from . import _webp
|
||||
SUPPORTED = True
|
||||
except ImportError as e:
|
||||
except ImportError:
|
||||
SUPPORTED = False
|
||||
from io import BytesIO
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user