mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-15 11:00:52 +03:00
linting
This commit is contained in:
parent
da093b9fef
commit
084704d156
|
@ -2,7 +2,6 @@ import struct
|
|||
from io import BytesIO
|
||||
|
||||
from PIL import BmpImagePlugin, CurImagePlugin, Image, ImageFile
|
||||
from PIL._binary import i16le as i16
|
||||
from PIL._binary import i32le as i32
|
||||
from PIL._binary import o8
|
||||
from PIL._binary import o16le as o16
|
||||
|
@ -22,7 +21,7 @@ def _save_frame(im: Image.Image, fp: BytesIO, filename: str, info: dict):
|
|||
)
|
||||
h = im.encoderinfo.get("hotspots", [(0, 0) for i in range(len(s))])
|
||||
|
||||
if len(hotspots) != len(sizes):
|
||||
if len(h) != len(s):
|
||||
raise ValueError("Number of hotspots must be equal to number of cursor sizes")
|
||||
|
||||
# sort and remove duplicate sizes
|
||||
|
@ -185,7 +184,6 @@ def _write_multiple_frames(im: Image.Image, fp: BytesIO, filename: str):
|
|||
|
||||
fp.seek(fram_end)
|
||||
|
||||
bmp = im.encoderinfo.get("bitmap_format") == "bmp"
|
||||
display_rate = im.encoderinfo.get("display_rate", 2)
|
||||
n_frames = len(frames)
|
||||
n_steps = len(seq) if seq else n_frames
|
||||
|
|
|
@ -39,7 +39,7 @@ def _save(im: Image.Image, fp: BytesIO, filename: str):
|
|||
)
|
||||
h = im.encoderinfo.get("hotspots", [(0, 0) for i in range(len(s))])
|
||||
|
||||
if len(hotspots) != len(sizes):
|
||||
if len(h) != len(s):
|
||||
raise ValueError("Number of hotspots must be equal to number of cursor sizes")
|
||||
|
||||
# sort and remove duplicate sizes
|
||||
|
@ -146,10 +146,11 @@ class CurFile(IcoImagePlugin.IcoFile):
|
|||
icon_header["dim"] = (icon_header["width"], icon_header["height"])
|
||||
icon_header["square"] = icon_header["width"] * icon_header["height"]
|
||||
|
||||
# TODO: This needs further investigation. Cursor files do not really specify their bpp
|
||||
# like ICO's as those bits are used for the y_hotspot. For now, bpp is calculated by
|
||||
# subtracting the AND mask (equal to number of pixels * 1bpp) and dividing by the number
|
||||
# of pixels. This seems to work well so far.
|
||||
# TODO: This needs further investigation. Cursor files do not really
|
||||
# specify their bpp like ICO's as those bits are used for the y_hotspot.
|
||||
# For now, bpp is calculated by subtracting the AND mask (equal to number
|
||||
# of pixels * 1bpp) and dividing by the number of pixels. This seems
|
||||
# to work well so far.
|
||||
BITMAP_INFO_HEADER_SIZE = 40
|
||||
bpp_without_and = (
|
||||
(icon_header["size"] - BITMAP_INFO_HEADER_SIZE) * 8
|
||||
|
|
Loading…
Reference in New Issue
Block a user