mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 01:34:24 +03:00
Replaced register_open lambdas with _accept method for consistency
This commit is contained in:
parent
d4f9c6e082
commit
60da129d4b
|
@ -417,9 +417,11 @@ class BLP2Decoder(_BLPBaseDecoder):
|
|||
self.set_as_raw(bytes(data))
|
||||
|
||||
|
||||
Image.register_open(
|
||||
BlpImageFile.format, BlpImageFile, lambda p: p[:4] in (b"BLP1", b"BLP2")
|
||||
)
|
||||
def _accept(prefix):
|
||||
return prefix[:4] in (b"BLP1", b"BLP2")
|
||||
|
||||
|
||||
Image.register_open(BlpImageFile.format, BlpImageFile, _accept)
|
||||
Image.register_extension(BlpImageFile.format, ".blp")
|
||||
|
||||
Image.register_decoder("BLP1", BLP1Decoder)
|
||||
|
|
|
@ -359,7 +359,11 @@ def _save(im, fp, filename):
|
|||
fp.write(f.read())
|
||||
|
||||
|
||||
Image.register_open(IcnsImageFile.format, IcnsImageFile, lambda x: x[:4] == b"icns")
|
||||
def _accept(prefix):
|
||||
return prefix[:4] == b"icns"
|
||||
|
||||
|
||||
Image.register_open(IcnsImageFile.format, IcnsImageFile, _accept)
|
||||
Image.register_extension(IcnsImageFile.format, ".icns")
|
||||
|
||||
if sys.platform == "darwin":
|
||||
|
|
Loading…
Reference in New Issue
Block a user