More strict mypy checking

This commit is contained in:
Quantum 2020-09-27 13:56:54 -04:00
parent e201ee4442
commit 6eda21c249
5 changed files with 12 additions and 5 deletions

View file

@ -1,2 +1,3 @@
[mypy]
ignore_missing_imports = True
strict = true

View file

@ -13,11 +13,11 @@ class CursorImage:
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.delay = delay
def __getitem__(self, item) -> CursorImage:
def __getitem__(self, item: int) -> CursorImage:
return self.images[item]
def __len__(self) -> int:

View file

@ -5,6 +5,7 @@ import traceback
from multiprocessing import cpu_count
from multiprocessing.pool import ThreadPool
from threading import Lock
from typing import BinaryIO
from win2xcur import shadow
from win2xcur.parser import open_blob
@ -37,7 +38,7 @@ def main() -> None:
check_xcursorgen()
def process(file) -> None:
def process(file: BinaryIO) -> None:
name = file.name
blob = file.read()
try:

View file

@ -20,6 +20,9 @@ class ANIParser(BaseParser):
@classmethod
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])
return signature == cls.SIGNATURE and size == len(blob) - 8 and subtype == cls.ANI_TYPE

View file

@ -22,7 +22,9 @@ def apply_to_image(image: BaseImage, *, color: str, radius: float, sigma: float,
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 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)