Improve decorator type annotations [sabnzbd] (#104823)

This commit is contained in:
Marc Mueller 2023-11-30 18:47:58 +01:00 committed by GitHub
parent 6ffc298986
commit 46ba62a3c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,9 @@
"""Support for monitoring an SABnzbd NZB client.""" """Support for monitoring an SABnzbd NZB client."""
from __future__ import annotations from __future__ import annotations
from collections.abc import Callable from collections.abc import Callable, Coroutine
import logging import logging
from typing import Any
from pysabnzbd import SabnzbdApiException from pysabnzbd import SabnzbdApiException
import voluptuous as vol import voluptuous as vol
@ -189,7 +190,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
update_device_identifiers(hass, entry) update_device_identifiers(hass, entry)
@callback @callback
def extract_api(func: Callable) -> Callable: def extract_api(
func: Callable[[ServiceCall, SabnzbdApiData], Coroutine[Any, Any, None]]
) -> Callable[[ServiceCall], Coroutine[Any, Any, None]]:
"""Define a decorator to get the correct api for a service call.""" """Define a decorator to get the correct api for a service call."""
async def wrapper(call: ServiceCall) -> None: async def wrapper(call: ServiceCall) -> None: