flake8: F401 imported but unused

This commit is contained in:
Hugo 2018-10-18 19:46:20 +03:00
parent eb9aee7048
commit 91da8ff31d
2 changed files with 13 additions and 4 deletions

View File

@ -5,7 +5,7 @@ from __future__ import print_function
import sys
import os
from PIL import Image, ImageDraw, ImageFilter, ImageMath
from PIL import Image
from PIL import features
try:
@ -26,6 +26,7 @@ def testimage():
"""
PIL lets you create in-memory images with various pixel types:
>>> from PIL import Image, ImageDraw, ImageFilter, ImageMath
>>> im = Image.new("1", (128, 128)) # monochrome
>>> _info(im)
(None, '1', (128, 128))

View File

@ -28,12 +28,15 @@
# PILLOW_VERSION is deprecated and will be removed after that.
# Use __version__ instead.
from . import VERSION, PILLOW_VERSION, __version__, _plugins
assert VERSION
assert PILLOW_VERSION
from ._util import py3
import logging
import warnings
import math
logger = logging.getLogger(__name__)
@ -134,9 +137,8 @@ except ImportError:
USE_CFFI_ACCESS = hasattr(sys, 'pypy_version_info')
try:
import cffi
HAS_CFFI = True
except ImportError:
HAS_CFFI = False
cffi = None
try:
from pathlib import Path
@ -376,26 +378,32 @@ def preinit():
try:
from . import BmpImagePlugin
assert BmpImagePlugin
except ImportError:
pass
try:
from . import GifImagePlugin
assert GifImagePlugin
except ImportError:
pass
try:
from . import JpegImagePlugin
assert JpegImagePlugin
except ImportError:
pass
try:
from . import PpmImagePlugin
assert PpmImagePlugin
except ImportError:
pass
try:
from . import PngImagePlugin
assert PngImagePlugin
except ImportError:
pass
# try:
# import TiffImagePlugin
# assert TiffImagePlugin
# except ImportError:
# pass
@ -833,7 +841,7 @@ class Image(object):
self.palette.mode = "RGBA"
if self.im:
if HAS_CFFI and USE_CFFI_ACCESS:
if cffi and USE_CFFI_ACCESS:
if self.pyaccess:
return self.pyaccess
from . import PyAccess