Switch from mypy to pyright

This commit is contained in:
Edgar P. Burkhart 2024-12-09 13:25:00 +01:00
parent 7b26d3a160
commit cc0c978f0c
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
12 changed files with 1000 additions and 17 deletions

View file

@ -1,18 +1,20 @@
import logging
import math
from collections.abc import Callable
from typing import Any
from sense_hat import ACTION_HELD, ACTION_RELEASED, InputEvent, SenseHat
from sense_hat.sense_hat import SenseHat
from sense_hat.stick import ACTION_HELD, ACTION_RELEASED, InputEvent
logger = logging.getLogger(__name__)
class Selector:
def __init__(self, send_data: Callable[[dict[str, float | str | None]], None]):
def __init__(self, send_data: Callable[[dict[str, Any]], Any]):
self.stick = SenseHat().stick
self.temperature = None
self.mode = None
self.switch = None
self.temperature: float | None = None
self.mode: str | None = None
self.switch: bool | None = None
self.preset_modes: list[str] = []
self.send_data = send_data
self.switch_held = False
@ -93,5 +95,5 @@ class Selector:
elif self.switch_held and event.action == ACTION_RELEASED:
self.switch_held = False
def callback(self, data: dict[str, float | str | None]) -> None:
def callback(self, data: dict[str, Any]) -> None:
self.send_data(self.default_data | data)