mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Add strict typing for transmission (#101904)
This commit is contained in:
parent
8b134f26a9
commit
ff5504f55f
@ -345,6 +345,7 @@ homeassistant.components.trafikverket_camera.*
|
||||
homeassistant.components.trafikverket_ferry.*
|
||||
homeassistant.components.trafikverket_train.*
|
||||
homeassistant.components.trafikverket_weatherstation.*
|
||||
homeassistant.components.transmission.*
|
||||
homeassistant.components.trend.*
|
||||
homeassistant.components.tts.*
|
||||
homeassistant.components.twentemilieu.*
|
||||
|
@ -1,4 +1,10 @@
|
||||
"""Constants for the Transmission Bittorent Client component."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
|
||||
from transmission_rpc import Torrent
|
||||
|
||||
DOMAIN = "transmission"
|
||||
|
||||
SWITCH_TYPES = {"on_off": "Switch", "turtle_mode": "Turtle mode"}
|
||||
@ -8,7 +14,7 @@ ORDER_OLDEST_FIRST = "oldest_first"
|
||||
ORDER_BEST_RATIO_FIRST = "best_ratio_first"
|
||||
ORDER_WORST_RATIO_FIRST = "worst_ratio_first"
|
||||
|
||||
SUPPORTED_ORDER_MODES = {
|
||||
SUPPORTED_ORDER_MODES: dict[str, Callable[[list[Torrent]], list[Torrent]]] = {
|
||||
ORDER_NEWEST_FIRST: lambda torrents: sorted(
|
||||
torrents, key=lambda t: t.date_added, reverse=True
|
||||
),
|
||||
|
@ -163,4 +163,4 @@ class TransmissionDataUpdateCoordinator(DataUpdateCoordinator[SessionStats]):
|
||||
if self._session is None:
|
||||
return None
|
||||
|
||||
return self._session.alt_speed_enabled
|
||||
return self._session.alt_speed_enabled # type: ignore[no-any-return]
|
||||
|
10
mypy.ini
10
mypy.ini
@ -3212,6 +3212,16 @@ disallow_untyped_defs = true
|
||||
warn_return_any = true
|
||||
warn_unreachable = true
|
||||
|
||||
[mypy-homeassistant.components.transmission.*]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
disallow_subclassing_any = true
|
||||
disallow_untyped_calls = true
|
||||
disallow_untyped_decorators = true
|
||||
disallow_untyped_defs = true
|
||||
warn_return_any = true
|
||||
warn_unreachable = true
|
||||
|
||||
[mypy-homeassistant.components.trend.*]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user