Skip to content

Commit

Permalink
More strict mypy checking
Browse files Browse the repository at this point in the history
  • Loading branch information
quantum5 committed Sep 27, 2020
1 parent e201ee4 commit 6eda21c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[mypy]
ignore_missing_imports = True
strict = true
4 changes: 2 additions & 2 deletions win2xcur/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def __repr__(self) -> str:


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:
Expand Down
3 changes: 2 additions & 1 deletion win2xcur/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
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
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions win2xcur/parser/ani.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions win2xcur/shadow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 6eda21c

Please sign in to comment.