mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-25 08:10:33 +03:00
Simplify code by using _accept
This commit is contained in:
parent
e2288356ca
commit
56324c300d
|
@ -167,7 +167,7 @@ class IcnsFile:
|
|||
self.dct = dct = {}
|
||||
self.fobj = fobj
|
||||
sig, filesize = nextheader(fobj)
|
||||
if sig != MAGIC:
|
||||
if not _accept(sig):
|
||||
raise SyntaxError("not an icns file")
|
||||
i = HEADERSIZE
|
||||
while i < filesize:
|
||||
|
|
|
@ -493,7 +493,7 @@ class ImageFileDirectory_v2(MutableMapping):
|
|||
endianness.
|
||||
:param prefix: Override the endianness of the file.
|
||||
"""
|
||||
if ifh[:4] not in PREFIXES:
|
||||
if not _accept(ifh):
|
||||
raise SyntaxError(f"not a TIFF file (header {repr(ifh)} not valid)")
|
||||
self._prefix = prefix if prefix is not None else ifh[:2]
|
||||
if self._prefix == MM:
|
||||
|
|
Loading…
Reference in New Issue
Block a user