mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Add strict typing to push bullet (#99538)
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
c8aed06438
commit
2437fb314f
@ -265,6 +265,7 @@ homeassistant.components.proximity.*
|
||||
homeassistant.components.prusalink.*
|
||||
homeassistant.components.pure_energie.*
|
||||
homeassistant.components.purpleair.*
|
||||
homeassistant.components.pushbullet.*
|
||||
homeassistant.components.pvoutput.*
|
||||
homeassistant.components.qnap_qsw.*
|
||||
homeassistant.components.radarr.*
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""Pushbullet Notification provider."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
@ -10,7 +11,7 @@ from homeassistant.helpers.dispatcher import dispatcher_send
|
||||
from .const import DATA_UPDATED
|
||||
|
||||
|
||||
class PushBulletNotificationProvider(Listener):
|
||||
class PushBulletNotificationProvider(Listener): # type: ignore[misc]
|
||||
"""Provider for an account, leading to one or more sensors."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, pushbullet: PushBullet) -> None:
|
||||
|
@ -21,6 +21,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from .api import PushBulletNotificationProvider
|
||||
from .const import ATTR_FILE, ATTR_FILE_URL, ATTR_URL, DOMAIN
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -34,8 +35,10 @@ async def async_get_service(
|
||||
"""Get the Pushbullet notification service."""
|
||||
if TYPE_CHECKING:
|
||||
assert discovery_info is not None
|
||||
pushbullet: PushBullet = hass.data[DOMAIN][discovery_info["entry_id"]].pushbullet
|
||||
return PushBulletNotificationService(hass, pushbullet)
|
||||
pb_provider: PushBulletNotificationProvider = hass.data[DOMAIN][
|
||||
discovery_info["entry_id"]
|
||||
]
|
||||
return PushBulletNotificationService(hass, pb_provider.pushbullet)
|
||||
|
||||
|
||||
class PushBulletNotificationService(BaseNotificationService):
|
||||
@ -120,7 +123,7 @@ class PushBulletNotificationService(BaseNotificationService):
|
||||
pusher: PushBullet,
|
||||
email: str | None = None,
|
||||
phonenumber: str | None = None,
|
||||
):
|
||||
) -> None:
|
||||
"""Create the message content."""
|
||||
kwargs = {"body": message, "title": title}
|
||||
if email:
|
||||
|
10
mypy.ini
10
mypy.ini
@ -2411,6 +2411,16 @@ disallow_untyped_defs = true
|
||||
warn_return_any = true
|
||||
warn_unreachable = true
|
||||
|
||||
[mypy-homeassistant.components.pushbullet.*]
|
||||
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.pvoutput.*]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user