flake8: F841 local variable is assigned to but never used

This commit is contained in:
Hugo 2018-10-18 21:49:14 +03:00
parent 302f86292c
commit eb9aee7048
11 changed files with 13 additions and 19 deletions

View File

@ -32,7 +32,7 @@ class TestFileTar(PillowTestCase):
tar.close() tar.close()
def test_contextmanager(self): def test_contextmanager(self):
with TarIO.TarIO(TEST_TAR_FILE, 'hopper.jpg') as tar: with TarIO.TarIO(TEST_TAR_FILE, 'hopper.jpg'):
pass pass

View File

@ -152,7 +152,7 @@ class TestImageTransform(PillowTestCase):
] ]
# Yeah. Watch some JIT optimize this out. # Yeah. Watch some JIT optimize this out.
pattern = None pattern = None # noqa: F841
self.test_mesh() self.test_mesh()

View File

@ -10,7 +10,7 @@ try:
from PIL import ImageCms from PIL import ImageCms
from PIL.ImageCms import ImageCmsProfile from PIL.ImageCms import ImageCmsProfile
ImageCms.core.profile_open ImageCms.core.profile_open
except ImportError as v: except ImportError:
# Skipped via setUp() # Skipped via setUp()
pass pass

View File

@ -86,7 +86,7 @@ if ImageQt.qt_is_installed:
pixmap1 = QtGui.QPixmap.fromImage(qimage) pixmap1 = QtGui.QPixmap.fromImage(qimage)
QHBoxLayout(self) QHBoxLayout(self) # hbox
lbl = QLabel(self) lbl = QLabel(self)
# Segfault in the problem # Segfault in the problem

View File

@ -225,7 +225,7 @@ class DdsImageFile(ImageFile.ImageFile):
self.mode = "RGBA" self.mode = "RGBA"
pitch, depth, mipmaps = struct.unpack("<3I", header.read(12)) 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 # pixel format
pfsize, pfflags = struct.unpack("<2I", header.read(8)) pfsize, pfflags = struct.unpack("<2I", header.read(8))
@ -235,10 +235,8 @@ class DdsImageFile(ImageFile.ImageFile):
if fourcc == b"DXT1": if fourcc == b"DXT1":
self.decoder = "DXT1" self.decoder = "DXT1"
codec = _dxt1
elif fourcc == b"DXT5": elif fourcc == b"DXT5":
self.decoder = "DXT5" self.decoder = "DXT5"
codec = _dxt5
else: else:
raise NotImplementedError("Unimplemented pixel format %r" % fourcc) raise NotImplementedError("Unimplemented pixel format %r" % fourcc)

View File

@ -118,7 +118,7 @@ class DdsImageFile(ImageFile.ImageFile):
self.mode = "RGBA" self.mode = "RGBA"
pitch, depth, mipmaps = struct.unpack("<3I", header.read(12)) 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 # pixel format
pfsize, pfflags = struct.unpack("<2I", header.read(8)) pfsize, pfflags = struct.unpack("<2I", header.read(8))

View File

@ -66,8 +66,8 @@ class FtexImageFile(ImageFile.ImageFile):
format_description = "Texture File Format (IW2:EOC)" format_description = "Texture File Format (IW2:EOC)"
def _open(self): def _open(self):
magic = struct.unpack("<I", self.fp.read(4)) struct.unpack("<I", self.fp.read(4)) # magic
version = struct.unpack("<i", self.fp.read(4)) struct.unpack("<i", self.fp.read(4)) # version
self._size = struct.unpack("<2i", self.fp.read(8)) self._size = struct.unpack("<2i", self.fp.read(8))
mipmap_count, format_count = struct.unpack("<2i", self.fp.read(8)) mipmap_count, format_count = struct.unpack("<2i", self.fp.read(8))

View File

@ -153,7 +153,7 @@ class ImImageFile(ImageFile.ImageFile):
try: try:
m = split.match(s) m = split.match(s)
except re.error as v: except re.error:
raise SyntaxError("not an IM file") raise SyntaxError("not an IM file")
if m: if m:

View File

@ -230,7 +230,7 @@ class PcfFontFile(FontFile.FontFile):
firstCol, lastCol = i16(fp.read(2)), i16(fp.read(2)) firstCol, lastCol = i16(fp.read(2)), i16(fp.read(2))
firstRow, lastRow = 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) nencoding = (lastCol - firstCol + 1) * (lastRow - firstRow + 1)

View File

@ -92,7 +92,7 @@ class PsdImageFile(ImageFile.ImageFile):
# load resources # load resources
end = self.fp.tell() + size end = self.fp.tell() + size
while self.fp.tell() < end: while self.fp.tell() < end:
signature = read(4) read(4) # signature
id = i16(read(2)) id = i16(read(2))
name = read(i8(read(1))) name = read(i8(read(1)))
if not (len(name) & 1): if not (len(name) & 1):
@ -207,17 +207,13 @@ def _layerinfo(file):
mode = None # unknown mode = None # unknown
# skip over blend flags and extra information # skip over blend flags and extra information
filler = read(12) read(12) # filler
name = "" name = ""
size = i32(read(4)) size = i32(read(4))
combined = 0 combined = 0
if size: if size:
length = i32(read(4)) length = i32(read(4))
if length: 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) file.seek(length - 16, 1)
combined += length + 4 combined += length + 4

View File

@ -2,7 +2,7 @@ from . import Image, ImageFile
try: try:
from . import _webp from . import _webp
SUPPORTED = True SUPPORTED = True
except ImportError as e: except ImportError:
SUPPORTED = False SUPPORTED = False
from io import BytesIO from io import BytesIO