Use typed config entry in imap (#132029)

* Use typed config entry in imap

* Adjust
pull/132040/head
epenet 2024-12-02 07:28:29 +01:00 committed by GitHub
parent 28eb4f3dff
commit 5458ee2fa9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 12 deletions

View File

@ -9,12 +9,7 @@ from typing import Any
from aioimaplib import AioImapException
import voluptuous as vol
from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
from homeassistant.const import (
CONF_NAME,
CONF_PASSWORD,
@ -35,6 +30,7 @@ from homeassistant.helpers.selector import (
)
from homeassistant.util.ssl import SSLCipherList
from . import ImapConfigEntry
from .const import (
CONF_CHARSET,
CONF_CUSTOM_EVENT_DATA_TEMPLATE,
@ -212,7 +208,7 @@ class IMAPConfigFlow(ConfigFlow, domain=DOMAIN):
@staticmethod
@callback
def async_get_options_flow(
config_entry: ConfigEntry,
config_entry: ImapConfigEntry,
) -> ImapOptionsFlow:
"""Get the options flow for this handler."""
return ImapOptionsFlow()

View File

@ -14,7 +14,6 @@ from typing import TYPE_CHECKING, Any
from aioimaplib import AUTH, IMAP4_SSL, NONAUTH, SELECTED, AioImapException
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CONF_PASSWORD,
CONF_PORT,
@ -53,6 +52,9 @@ from .const import (
)
from .errors import InvalidAuth, InvalidFolder
if TYPE_CHECKING:
from . import ImapConfigEntry
_LOGGER = logging.getLogger(__name__)
BACKOFF_TIME = 10
@ -210,14 +212,14 @@ class ImapMessage:
class ImapDataUpdateCoordinator(DataUpdateCoordinator[int | None]):
"""Base class for imap client."""
config_entry: ConfigEntry
config_entry: ImapConfigEntry
custom_event_template: Template | None
def __init__(
self,
hass: HomeAssistant,
imap_client: IMAP4_SSL,
entry: ConfigEntry,
entry: ImapConfigEntry,
update_interval: timedelta | None,
) -> None:
"""Initiate imap client."""
@ -391,7 +393,7 @@ class ImapPollingDataUpdateCoordinator(ImapDataUpdateCoordinator):
"""Class for imap client."""
def __init__(
self, hass: HomeAssistant, imap_client: IMAP4_SSL, entry: ConfigEntry
self, hass: HomeAssistant, imap_client: IMAP4_SSL, entry: ImapConfigEntry
) -> None:
"""Initiate imap client."""
_LOGGER.debug(
@ -437,7 +439,7 @@ class ImapPushDataUpdateCoordinator(ImapDataUpdateCoordinator):
"""Class for imap client."""
def __init__(
self, hass: HomeAssistant, imap_client: IMAP4_SSL, entry: ConfigEntry
self, hass: HomeAssistant, imap_client: IMAP4_SSL, entry: ImapConfigEntry
) -> None:
"""Initiate imap client."""
_LOGGER.debug("Connected to server %s using IMAP push", entry.data[CONF_SERVER])