mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-14 05:36:48 +03:00
Various Flake8 fixes
This commit is contained in:
parent
40165d6860
commit
d1c182cadc
|
@ -18,6 +18,7 @@ _handler = None
|
||||||
#
|
#
|
||||||
# @param handler Handler object.
|
# @param handler Handler object.
|
||||||
|
|
||||||
|
|
||||||
def register_handler(handler):
|
def register_handler(handler):
|
||||||
global _handler
|
global _handler
|
||||||
_handler = handler
|
_handler = handler
|
||||||
|
@ -25,9 +26,11 @@ def register_handler(handler):
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
# Image adapter
|
# Image adapter
|
||||||
|
|
||||||
|
|
||||||
def _accept(prefix):
|
def _accept(prefix):
|
||||||
return prefix[:6] == b"SIMPLE"
|
return prefix[:6] == b"SIMPLE"
|
||||||
|
|
||||||
|
|
||||||
class FITSStubImageFile(ImageFile.StubImageFile):
|
class FITSStubImageFile(ImageFile.StubImageFile):
|
||||||
|
|
||||||
format = "FITS"
|
format = "FITS"
|
||||||
|
|
|
@ -53,6 +53,7 @@ class Color(_Enhance):
|
||||||
|
|
||||||
self.degenerate = image.convert(self.intermediate_mode).convert(image.mode)
|
self.degenerate = image.convert(self.intermediate_mode).convert(image.mode)
|
||||||
|
|
||||||
|
|
||||||
class Contrast(_Enhance):
|
class Contrast(_Enhance):
|
||||||
"""Adjust image contrast.
|
"""Adjust image contrast.
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ else: #PyQt4 is used
|
||||||
##
|
##
|
||||||
# (Internal) Turns an RGB color into a Qt compatible color integer.
|
# (Internal) Turns an RGB color into a Qt compatible color integer.
|
||||||
|
|
||||||
|
|
||||||
def rgb(r, g, b, a=255):
|
def rgb(r, g, b, a=255):
|
||||||
# use qRgb to pack the colors, and then turn the resulting long
|
# use qRgb to pack the colors, and then turn the resulting long
|
||||||
# into a negative integer with the same bitpattern.
|
# into a negative integer with the same bitpattern.
|
||||||
|
|
|
@ -234,7 +234,10 @@ __version__ = '0.30'
|
||||||
|
|
||||||
import io
|
import io
|
||||||
import sys
|
import sys
|
||||||
import struct, array, os.path, datetime
|
import struct
|
||||||
|
import array
|
||||||
|
import os.path
|
||||||
|
import datetime
|
||||||
|
|
||||||
#[PL] Define explicitly the public API to avoid private objects in pydoc:
|
#[PL] Define explicitly the public API to avoid private objects in pydoc:
|
||||||
__all__ = ['OleFileIO', 'isOleFile', 'MAGIC']
|
__all__ = ['OleFileIO', 'isOleFile', 'MAGIC']
|
||||||
|
@ -283,12 +286,17 @@ KEEP_UNICODE_NAMES = False
|
||||||
#[PL] DEBUG display mode: False by default, use set_debug_mode() or "-d" on
|
#[PL] DEBUG display mode: False by default, use set_debug_mode() or "-d" on
|
||||||
# command line to change it.
|
# command line to change it.
|
||||||
DEBUG_MODE = False
|
DEBUG_MODE = False
|
||||||
|
|
||||||
|
|
||||||
def debug_print(msg):
|
def debug_print(msg):
|
||||||
print(msg)
|
print(msg)
|
||||||
|
|
||||||
|
|
||||||
def debug_pass(msg):
|
def debug_pass(msg):
|
||||||
pass
|
pass
|
||||||
debug = debug_pass
|
debug = debug_pass
|
||||||
|
|
||||||
|
|
||||||
def set_debug_mode(debug_mode):
|
def set_debug_mode(debug_mode):
|
||||||
"""
|
"""
|
||||||
Set debug mode on or off, to control display of debugging messages.
|
Set debug mode on or off, to control display of debugging messages.
|
||||||
|
@ -433,7 +441,6 @@ def _clsid(clsid):
|
||||||
tuple(map(i8, clsid[8:16]))))
|
tuple(map(i8, clsid[8:16]))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# UNICODE support:
|
# UNICODE support:
|
||||||
# (necessary to handle storages/streams names which use Unicode)
|
# (necessary to handle storages/streams names which use Unicode)
|
||||||
|
|
||||||
|
@ -471,7 +478,6 @@ def filetime2datetime(filetime):
|
||||||
return _FILETIME_null_date + datetime.timedelta(microseconds=filetime//10)
|
return _FILETIME_null_date + datetime.timedelta(microseconds=filetime//10)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#=== CLASSES ==================================================================
|
#=== CLASSES ==================================================================
|
||||||
|
|
||||||
class OleMetadata:
|
class OleMetadata:
|
||||||
|
@ -579,7 +585,6 @@ class OleMetadata:
|
||||||
self.language = None
|
self.language = None
|
||||||
self.doc_version = None
|
self.doc_version = None
|
||||||
|
|
||||||
|
|
||||||
def parse_properties(self, olefile):
|
def parse_properties(self, olefile):
|
||||||
"""
|
"""
|
||||||
Parse standard properties of an OLE file, from the streams
|
Parse standard properties of an OLE file, from the streams
|
||||||
|
@ -789,7 +794,6 @@ class _OleDirectoryEntry:
|
||||||
DIRENTRY_SIZE = 128
|
DIRENTRY_SIZE = 128
|
||||||
assert struct.calcsize(STRUCT_DIRENTRY) == DIRENTRY_SIZE
|
assert struct.calcsize(STRUCT_DIRENTRY) == DIRENTRY_SIZE
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, entry, sid, olefile):
|
def __init__(self, entry, sid, olefile):
|
||||||
"""
|
"""
|
||||||
Constructor for an _OleDirectoryEntry object.
|
Constructor for an _OleDirectoryEntry object.
|
||||||
|
@ -882,8 +886,6 @@ class _OleDirectoryEntry:
|
||||||
minifat = False
|
minifat = False
|
||||||
olefile._check_duplicate_stream(self.isectStart, minifat)
|
olefile._check_duplicate_stream(self.isectStart, minifat)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def build_storage_tree(self):
|
def build_storage_tree(self):
|
||||||
"""
|
"""
|
||||||
Read and build the red-black tree attached to this _OleDirectoryEntry
|
Read and build the red-black tree attached to this _OleDirectoryEntry
|
||||||
|
@ -907,7 +909,6 @@ class _OleDirectoryEntry:
|
||||||
# (see rich comparison methods in this class)
|
# (see rich comparison methods in this class)
|
||||||
self.kids.sort()
|
self.kids.sort()
|
||||||
|
|
||||||
|
|
||||||
def append_kids(self, child_sid):
|
def append_kids(self, child_sid):
|
||||||
"""
|
"""
|
||||||
Walk through red-black tree of children of this directory entry to add
|
Walk through red-black tree of children of this directory entry to add
|
||||||
|
@ -951,7 +952,6 @@ class _OleDirectoryEntry:
|
||||||
# Afterwards build kid's own tree if it's also a storage:
|
# Afterwards build kid's own tree if it's also a storage:
|
||||||
child.build_storage_tree()
|
child.build_storage_tree()
|
||||||
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
"Compare entries by name"
|
"Compare entries by name"
|
||||||
return self.name == other.name
|
return self.name == other.name
|
||||||
|
@ -971,7 +971,6 @@ class _OleDirectoryEntry:
|
||||||
#TODO: replace by the same function as MS implementation ?
|
#TODO: replace by the same function as MS implementation ?
|
||||||
# (order by name length first, then case-insensitive order)
|
# (order by name length first, then case-insensitive order)
|
||||||
|
|
||||||
|
|
||||||
def dump(self, tab = 0):
|
def dump(self, tab = 0):
|
||||||
"Dump this entry, and all its subentries (for debug purposes only)"
|
"Dump this entry, and all its subentries (for debug purposes only)"
|
||||||
TYPES = ["(invalid)", "(storage)", "(stream)", "(lockbytes)",
|
TYPES = ["(invalid)", "(storage)", "(stream)", "(lockbytes)",
|
||||||
|
@ -986,7 +985,6 @@ class _OleDirectoryEntry:
|
||||||
for kid in self.kids:
|
for kid in self.kids:
|
||||||
kid.dump(tab + 2)
|
kid.dump(tab + 2)
|
||||||
|
|
||||||
|
|
||||||
def getmtime(self):
|
def getmtime(self):
|
||||||
"""
|
"""
|
||||||
Return modification time of a directory entry.
|
Return modification time of a directory entry.
|
||||||
|
@ -1000,7 +998,6 @@ class _OleDirectoryEntry:
|
||||||
return None
|
return None
|
||||||
return filetime2datetime(self.modifyTime)
|
return filetime2datetime(self.modifyTime)
|
||||||
|
|
||||||
|
|
||||||
def getctime(self):
|
def getctime(self):
|
||||||
"""
|
"""
|
||||||
Return creation time of a directory entry.
|
Return creation time of a directory entry.
|
||||||
|
@ -1064,7 +1061,6 @@ class OleFileIO:
|
||||||
if filename:
|
if filename:
|
||||||
self.open(filename)
|
self.open(filename)
|
||||||
|
|
||||||
|
|
||||||
def _raise_defect(self, defect_level, message, exception_type=IOError):
|
def _raise_defect(self, defect_level, message, exception_type=IOError):
|
||||||
"""
|
"""
|
||||||
This method should be called for any defect found during file parsing.
|
This method should be called for any defect found during file parsing.
|
||||||
|
@ -1086,7 +1082,6 @@ class OleFileIO:
|
||||||
# just record the issue, no exception raised:
|
# just record the issue, no exception raised:
|
||||||
self.parsing_issues.append((exception_type, message))
|
self.parsing_issues.append((exception_type, message))
|
||||||
|
|
||||||
|
|
||||||
def open(self, filename):
|
def open(self, filename):
|
||||||
"""
|
"""
|
||||||
Open an OLE2 file.
|
Open an OLE2 file.
|
||||||
|
@ -1266,14 +1261,12 @@ class OleFileIO:
|
||||||
self.ministream = None
|
self.ministream = None
|
||||||
self.minifatsect = self.MiniFatStart #i32(header, 60)
|
self.minifatsect = self.MiniFatStart #i32(header, 60)
|
||||||
|
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
"""
|
"""
|
||||||
close the OLE file, to release the file object
|
close the OLE file, to release the file object
|
||||||
"""
|
"""
|
||||||
self.fp.close()
|
self.fp.close()
|
||||||
|
|
||||||
|
|
||||||
def _check_duplicate_stream(self, first_sect, minifat=False):
|
def _check_duplicate_stream(self, first_sect, minifat=False):
|
||||||
"""
|
"""
|
||||||
Checks if a stream has not been already referenced elsewhere.
|
Checks if a stream has not been already referenced elsewhere.
|
||||||
|
@ -1298,7 +1291,6 @@ class OleFileIO:
|
||||||
else:
|
else:
|
||||||
used_streams.append(first_sect)
|
used_streams.append(first_sect)
|
||||||
|
|
||||||
|
|
||||||
def dumpfat(self, fat, firstindex=0):
|
def dumpfat(self, fat, firstindex=0):
|
||||||
"Displays a part of FAT in human-readable form for debugging purpose"
|
"Displays a part of FAT in human-readable form for debugging purpose"
|
||||||
# [PL] added only for debug
|
# [PL] added only for debug
|
||||||
|
@ -1335,7 +1327,6 @@ class OleFileIO:
|
||||||
print(nom, end=" ")
|
print(nom, end=" ")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
|
||||||
def dumpsect(self, sector, firstindex=0):
|
def dumpsect(self, sector, firstindex=0):
|
||||||
"Displays a sector in a human-readable form, for debugging purpose."
|
"Displays a sector in a human-readable form, for debugging purpose."
|
||||||
if not DEBUG_MODE:
|
if not DEBUG_MODE:
|
||||||
|
@ -1370,7 +1361,6 @@ class OleFileIO:
|
||||||
a.byteswap()
|
a.byteswap()
|
||||||
return a
|
return a
|
||||||
|
|
||||||
|
|
||||||
def loadfat_sect(self, sect):
|
def loadfat_sect(self, sect):
|
||||||
"""
|
"""
|
||||||
Adds the indexes of the given sector to the FAT
|
Adds the indexes of the given sector to the FAT
|
||||||
|
@ -1400,7 +1390,6 @@ class OleFileIO:
|
||||||
self.fat = self.fat + nextfat
|
self.fat = self.fat + nextfat
|
||||||
return isect
|
return isect
|
||||||
|
|
||||||
|
|
||||||
def loadfat(self, header):
|
def loadfat(self, header):
|
||||||
"""
|
"""
|
||||||
Load the FAT table.
|
Load the FAT table.
|
||||||
|
@ -1471,7 +1460,6 @@ class OleFileIO:
|
||||||
debug('\nFAT:')
|
debug('\nFAT:')
|
||||||
self.dumpfat(self.fat)
|
self.dumpfat(self.fat)
|
||||||
|
|
||||||
|
|
||||||
def loadminifat(self):
|
def loadminifat(self):
|
||||||
"""
|
"""
|
||||||
Load the MiniFAT table.
|
Load the MiniFAT table.
|
||||||
|
@ -1531,7 +1519,6 @@ class OleFileIO:
|
||||||
self._raise_defect(DEFECT_FATAL, 'incomplete OLE sector')
|
self._raise_defect(DEFECT_FATAL, 'incomplete OLE sector')
|
||||||
return sector
|
return sector
|
||||||
|
|
||||||
|
|
||||||
def loaddirectory(self, sect):
|
def loaddirectory(self, sect):
|
||||||
"""
|
"""
|
||||||
Load the directory.
|
Load the directory.
|
||||||
|
@ -1567,7 +1554,6 @@ class OleFileIO:
|
||||||
# read and build all storage trees, starting from the root:
|
# read and build all storage trees, starting from the root:
|
||||||
self.root.build_storage_tree()
|
self.root.build_storage_tree()
|
||||||
|
|
||||||
|
|
||||||
def _load_direntry (self, sid):
|
def _load_direntry (self, sid):
|
||||||
"""
|
"""
|
||||||
Load a directory entry from the directory.
|
Load a directory entry from the directory.
|
||||||
|
@ -1592,14 +1578,12 @@ class OleFileIO:
|
||||||
self.direntries[sid] = _OleDirectoryEntry(entry, sid, self)
|
self.direntries[sid] = _OleDirectoryEntry(entry, sid, self)
|
||||||
return self.direntries[sid]
|
return self.direntries[sid]
|
||||||
|
|
||||||
|
|
||||||
def dumpdirectory(self):
|
def dumpdirectory(self):
|
||||||
"""
|
"""
|
||||||
Dump directory (for debugging only)
|
Dump directory (for debugging only)
|
||||||
"""
|
"""
|
||||||
self.root.dump()
|
self.root.dump()
|
||||||
|
|
||||||
|
|
||||||
def _open(self, start, size = 0x7FFFFFFF, force_FAT=False):
|
def _open(self, start, size = 0x7FFFFFFF, force_FAT=False):
|
||||||
"""
|
"""
|
||||||
Open a stream, either in FAT or MiniFAT according to its size.
|
Open a stream, either in FAT or MiniFAT according to its size.
|
||||||
|
@ -1633,7 +1617,6 @@ class OleFileIO:
|
||||||
return _OleStream(self.fp, start, size, 512,
|
return _OleStream(self.fp, start, size, 512,
|
||||||
self.sectorsize, self.fat, self._filesize)
|
self.sectorsize, self.fat, self._filesize)
|
||||||
|
|
||||||
|
|
||||||
def _list(self, files, prefix, node, streams=True, storages=False):
|
def _list(self, files, prefix, node, streams=True, storages=False):
|
||||||
"""
|
"""
|
||||||
(listdir helper)
|
(listdir helper)
|
||||||
|
@ -1659,7 +1642,6 @@ class OleFileIO:
|
||||||
# add it to the list
|
# add it to the list
|
||||||
files.append(prefix[1:] + [entry.name])
|
files.append(prefix[1:] + [entry.name])
|
||||||
|
|
||||||
|
|
||||||
def listdir(self, streams=True, storages=False):
|
def listdir(self, streams=True, storages=False):
|
||||||
"""
|
"""
|
||||||
Return a list of streams stored in this file
|
Return a list of streams stored in this file
|
||||||
|
@ -1672,7 +1654,6 @@ class OleFileIO:
|
||||||
self._list(files, [], self.root, streams, storages)
|
self._list(files, [], self.root, streams, storages)
|
||||||
return files
|
return files
|
||||||
|
|
||||||
|
|
||||||
def _find(self, filename):
|
def _find(self, filename):
|
||||||
"""
|
"""
|
||||||
Returns directory entry of given filename. (openstream helper)
|
Returns directory entry of given filename. (openstream helper)
|
||||||
|
@ -1703,7 +1684,6 @@ class OleFileIO:
|
||||||
node = kid
|
node = kid
|
||||||
return node.sid
|
return node.sid
|
||||||
|
|
||||||
|
|
||||||
def openstream(self, filename):
|
def openstream(self, filename):
|
||||||
"""
|
"""
|
||||||
Open a stream as a read-only file object (BytesIO).
|
Open a stream as a read-only file object (BytesIO).
|
||||||
|
@ -1724,7 +1704,6 @@ class OleFileIO:
|
||||||
raise IOError("this file is not a stream")
|
raise IOError("this file is not a stream")
|
||||||
return self._open(entry.isectStart, entry.size)
|
return self._open(entry.isectStart, entry.size)
|
||||||
|
|
||||||
|
|
||||||
def get_type(self, filename):
|
def get_type(self, filename):
|
||||||
"""
|
"""
|
||||||
Test if given filename exists as a stream or a storage in the OLE
|
Test if given filename exists as a stream or a storage in the OLE
|
||||||
|
@ -1744,7 +1723,6 @@ class OleFileIO:
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def getmtime(self, filename):
|
def getmtime(self, filename):
|
||||||
"""
|
"""
|
||||||
Return modification time of a stream/storage.
|
Return modification time of a stream/storage.
|
||||||
|
@ -1760,7 +1738,6 @@ class OleFileIO:
|
||||||
entry = self.direntries[sid]
|
entry = self.direntries[sid]
|
||||||
return entry.getmtime()
|
return entry.getmtime()
|
||||||
|
|
||||||
|
|
||||||
def getctime(self, filename):
|
def getctime(self, filename):
|
||||||
"""
|
"""
|
||||||
Return creation time of a stream/storage.
|
Return creation time of a stream/storage.
|
||||||
|
@ -1776,7 +1753,6 @@ class OleFileIO:
|
||||||
entry = self.direntries[sid]
|
entry = self.direntries[sid]
|
||||||
return entry.getctime()
|
return entry.getctime()
|
||||||
|
|
||||||
|
|
||||||
def exists(self, filename):
|
def exists(self, filename):
|
||||||
"""
|
"""
|
||||||
Test if given filename exists as a stream or a storage in the OLE
|
Test if given filename exists as a stream or a storage in the OLE
|
||||||
|
@ -1791,7 +1767,6 @@ class OleFileIO:
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def get_size(self, filename):
|
def get_size(self, filename):
|
||||||
"""
|
"""
|
||||||
Return size of a stream in the OLE container, in bytes.
|
Return size of a stream in the OLE container, in bytes.
|
||||||
|
@ -1808,7 +1783,6 @@ class OleFileIO:
|
||||||
raise TypeError('object is not an OLE stream')
|
raise TypeError('object is not an OLE stream')
|
||||||
return entry.size
|
return entry.size
|
||||||
|
|
||||||
|
|
||||||
def get_rootentry_name(self):
|
def get_rootentry_name(self):
|
||||||
"""
|
"""
|
||||||
Return root entry name. Should usually be 'Root Entry' or 'R' in most
|
Return root entry name. Should usually be 'Root Entry' or 'R' in most
|
||||||
|
@ -1816,7 +1790,6 @@ class OleFileIO:
|
||||||
"""
|
"""
|
||||||
return self.root.name
|
return self.root.name
|
||||||
|
|
||||||
|
|
||||||
def getproperties(self, filename, convert_time=False, no_conversion=None):
|
def getproperties(self, filename, convert_time=False, no_conversion=None):
|
||||||
"""
|
"""
|
||||||
Return properties described in substream.
|
Return properties described in substream.
|
||||||
|
@ -1828,7 +1801,7 @@ class OleFileIO:
|
||||||
:returns: a dictionary of values indexed by id (integer)
|
:returns: a dictionary of values indexed by id (integer)
|
||||||
"""
|
"""
|
||||||
# make sure no_conversion is a list, just to simplify code below:
|
# make sure no_conversion is a list, just to simplify code below:
|
||||||
if no_conversion == None:
|
if no_conversion is None:
|
||||||
no_conversion = []
|
no_conversion = []
|
||||||
# stream path as a string to report exceptions:
|
# stream path as a string to report exceptions:
|
||||||
streampath = filename
|
streampath = filename
|
||||||
|
|
|
@ -78,6 +78,7 @@ MAX_TEXT_CHUNK = ImageFile.SAFEBLOCK
|
||||||
# Set the maximum total text chunk size.
|
# Set the maximum total text chunk size.
|
||||||
MAX_TEXT_MEMORY = 64 * MAX_TEXT_CHUNK
|
MAX_TEXT_MEMORY = 64 * MAX_TEXT_CHUNK
|
||||||
|
|
||||||
|
|
||||||
def _safe_zlib_decompress(s):
|
def _safe_zlib_decompress(s):
|
||||||
dobj = zlib.decompressobj()
|
dobj = zlib.decompressobj()
|
||||||
plaintext = dobj.decompress(s, MAX_TEXT_CHUNK)
|
plaintext = dobj.decompress(s, MAX_TEXT_CHUNK)
|
||||||
|
|
|
@ -8,6 +8,7 @@ from PIL import Image, ImageFilter
|
||||||
min_iterations = 100
|
min_iterations = 100
|
||||||
max_iterations = 10000
|
max_iterations = 10000
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf(sys.platform.startswith('win32'), "requires Unix or MacOS")
|
@unittest.skipIf(sys.platform.startswith('win32'), "requires Unix or MacOS")
|
||||||
class TestImagingLeaks(PillowTestCase):
|
class TestImagingLeaks(PillowTestCase):
|
||||||
|
|
||||||
|
@ -40,4 +41,3 @@ class TestImagingLeaks(PillowTestCase):
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,6 @@ post-patch:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def test_qtables_leak(self):
|
def test_qtables_leak(self):
|
||||||
im = hopper('RGB')
|
im = hopper('RGB')
|
||||||
|
|
||||||
|
@ -103,7 +102,6 @@ post-patch:
|
||||||
qtables = [standard_l_qtable,
|
qtables = [standard_l_qtable,
|
||||||
standard_chrominance_qtable]
|
standard_chrominance_qtable]
|
||||||
|
|
||||||
|
|
||||||
for count in range(iterations):
|
for count in range(iterations):
|
||||||
test_output = BytesIO()
|
test_output = BytesIO()
|
||||||
im.save(test_output, "JPEG", qtables=qtables)
|
im.save(test_output, "JPEG", qtables=qtables)
|
||||||
|
@ -172,7 +170,6 @@ post patch:
|
||||||
test_output = BytesIO()
|
test_output = BytesIO()
|
||||||
im.save(test_output, "JPEG", exif=exif)
|
im.save(test_output, "JPEG", exif=exif)
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
base case:
|
base case:
|
||||||
MB
|
MB
|
||||||
|
|
|
@ -5,6 +5,7 @@ import zlib
|
||||||
|
|
||||||
TEST_FILE = "Tests/images/png_decompression_dos.png"
|
TEST_FILE = "Tests/images/png_decompression_dos.png"
|
||||||
|
|
||||||
|
|
||||||
class TestPngDos(PillowTestCase):
|
class TestPngDos(PillowTestCase):
|
||||||
def test_dos_text(self):
|
def test_dos_text(self):
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ from helper import unittest, PillowTestCase
|
||||||
|
|
||||||
from PIL import _binary
|
from PIL import _binary
|
||||||
|
|
||||||
|
|
||||||
class TestBinary(PillowTestCase):
|
class TestBinary(PillowTestCase):
|
||||||
|
|
||||||
def test_standard(self):
|
def test_standard(self):
|
||||||
|
|
|
@ -43,7 +43,6 @@ class TestFileIco(PillowTestCase):
|
||||||
self.assert_image_equal(reloaded, hopper().resize((32, 32), Image.LANCZOS))
|
self.assert_image_equal(reloaded, hopper().resize((32, 32), Image.LANCZOS))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
|
|
@ -308,9 +308,6 @@ class TestFileJpeg(PillowTestCase):
|
||||||
# qtable entry has wrong number of items
|
# qtable entry has wrong number of items
|
||||||
self.assertRaises(Exception, lambda: self.roundtrip(im, qtables=[[1, 2, 3, 4]]))
|
self.assertRaises(Exception, lambda: self.roundtrip(im, qtables=[[1, 2, 3, 4]]))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(djpeg_available(), "djpeg not available")
|
@unittest.skipUnless(djpeg_available(), "djpeg not available")
|
||||||
def test_load_djpeg(self):
|
def test_load_djpeg(self):
|
||||||
img = Image.open(TEST_FILE)
|
img = Image.open(TEST_FILE)
|
||||||
|
|
|
@ -382,7 +382,6 @@ class TestFilePng(PillowTestCase):
|
||||||
self.assert_image_equal(im, repr_png)
|
self.assert_image_equal(im, repr_png)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ class TestFileWebpMetadata(PillowTestCase):
|
||||||
if not _webp.HAVE_WEBPMUX:
|
if not _webp.HAVE_WEBPMUX:
|
||||||
self.skipTest('WebPMux support not installed')
|
self.skipTest('WebPMux support not installed')
|
||||||
|
|
||||||
|
|
||||||
def test_read_exif_metadata(self):
|
def test_read_exif_metadata(self):
|
||||||
|
|
||||||
file_path = "Tests/images/flower.webp"
|
file_path = "Tests/images/flower.webp"
|
||||||
|
|
|
@ -17,6 +17,7 @@ except ImportError as v:
|
||||||
SRGB = "Tests/icc/sRGB_IEC61966-2-1_black_scaled.icc"
|
SRGB = "Tests/icc/sRGB_IEC61966-2-1_black_scaled.icc"
|
||||||
HAVE_PROFILE = os.path.exists(SRGB)
|
HAVE_PROFILE = os.path.exists(SRGB)
|
||||||
|
|
||||||
|
|
||||||
class TestImageCms(PillowTestCase):
|
class TestImageCms(PillowTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
|
@ -21,7 +21,6 @@ class TestImageEnhance(PillowTestCase):
|
||||||
im = Image.new("RGB", (1, 1))
|
im = Image.new("RGB", (1, 1))
|
||||||
ImageEnhance.Sharpness(im).enhance(0.5)
|
ImageEnhance.Sharpness(im).enhance(0.5)
|
||||||
|
|
||||||
|
|
||||||
def _half_transparent_image(self):
|
def _half_transparent_image(self):
|
||||||
# returns an image, half transparent, half solid
|
# returns an image, half transparent, half solid
|
||||||
im = hopper('RGB')
|
im = hopper('RGB')
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from helper import unittest, PillowTestCase
|
from helper import unittest, PillowTestCase
|
||||||
from PIL import Image, ImageFont, ImageDraw
|
from PIL import Image, ImageFont, ImageDraw
|
||||||
|
|
||||||
|
|
||||||
class TestImageFontBitmap(PillowTestCase):
|
class TestImageFontBitmap(PillowTestCase):
|
||||||
def test_similar(self):
|
def test_similar(self):
|
||||||
text = 'EmbeddedBitmap'
|
text = 'EmbeddedBitmap'
|
||||||
|
|
|
@ -41,5 +41,3 @@ class Test_scipy_resize(PillowTestCase):
|
||||||
assert_equal(im2, res)
|
assert_equal(im2, res)
|
||||||
assert_equal(im3, res)
|
assert_equal(im3, res)
|
||||||
assert_equal(im4, res)
|
assert_equal(im4, res)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user