mirror of
https://github.com/quantum5/win2xcur.git
synced 2025-04-24 10:11:57 -04:00
More strict mypy checking
This commit is contained in:
parent
e201ee4442
commit
6eda21c249
1
mypy.ini
1
mypy.ini
|
@ -1,2 +1,3 @@
|
||||||
[mypy]
|
[mypy]
|
||||||
ignore_missing_imports = True
|
ignore_missing_imports = True
|
||||||
|
strict = true
|
||||||
|
|
|
@ -13,11 +13,11 @@ class CursorImage:
|
||||||
|
|
||||||
|
|
||||||
class CursorFrame:
|
class CursorFrame:
|
||||||
def __init__(self, images: List[CursorImage], delay=0) -> None:
|
def __init__(self, images: List[CursorImage], delay: int = 0) -> None:
|
||||||
self.images = images
|
self.images = images
|
||||||
self.delay = delay
|
self.delay = delay
|
||||||
|
|
||||||
def __getitem__(self, item) -> CursorImage:
|
def __getitem__(self, item: int) -> CursorImage:
|
||||||
return self.images[item]
|
return self.images[item]
|
||||||
|
|
||||||
def __len__(self) -> int:
|
def __len__(self) -> int:
|
||||||
|
|
|
@ -5,6 +5,7 @@ import traceback
|
||||||
from multiprocessing import cpu_count
|
from multiprocessing import cpu_count
|
||||||
from multiprocessing.pool import ThreadPool
|
from multiprocessing.pool import ThreadPool
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
|
from typing import BinaryIO
|
||||||
|
|
||||||
from win2xcur import shadow
|
from win2xcur import shadow
|
||||||
from win2xcur.parser import open_blob
|
from win2xcur.parser import open_blob
|
||||||
|
@ -37,7 +38,7 @@ def main() -> None:
|
||||||
|
|
||||||
check_xcursorgen()
|
check_xcursorgen()
|
||||||
|
|
||||||
def process(file) -> None:
|
def process(file: BinaryIO) -> None:
|
||||||
name = file.name
|
name = file.name
|
||||||
blob = file.read()
|
blob = file.read()
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -20,6 +20,9 @@ class ANIParser(BaseParser):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def can_parse(cls, blob: bytes) -> bool:
|
def can_parse(cls, blob: bytes) -> bool:
|
||||||
|
signature: bytes
|
||||||
|
size: int
|
||||||
|
subtype: bytes
|
||||||
signature, size, subtype = cls.RIFF_HEADER.unpack(blob[:cls.RIFF_HEADER.size])
|
signature, size, subtype = cls.RIFF_HEADER.unpack(blob[:cls.RIFF_HEADER.size])
|
||||||
return signature == cls.SIGNATURE and size == len(blob) - 8 and subtype == cls.ANI_TYPE
|
return signature == cls.SIGNATURE and size == len(blob) - 8 and subtype == cls.ANI_TYPE
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,9 @@ def apply_to_image(image: BaseImage, *, color: str, radius: float, sigma: float,
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def apply_to_frames(frames: List[CursorFrame], **kwargs) -> None:
|
def apply_to_frames(frames: List[CursorFrame], *, color: str, radius: float,
|
||||||
|
sigma: float, xoffset: float, yoffset: float) -> None:
|
||||||
for frame in frames:
|
for frame in frames:
|
||||||
for cursor in frame:
|
for cursor in frame:
|
||||||
cursor.image = apply_to_image(cursor.image, **kwargs)
|
cursor.image = apply_to_image(cursor.image, color=color, radius=radius,
|
||||||
|
sigma=sigma, xoffset=xoffset, yoffset=yoffset)
|
||||||
|
|
Loading…
Reference in a new issue