From 0f33c08dca80fc39eb93e9b7ef0db5dabe22a41a Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Sat, 9 Jul 2022 19:52:26 +0200 Subject: [PATCH] Remove telegram_bot from mypy ignore list (#74661) --- homeassistant/components/telegram_bot/polling.py | 5 +++-- mypy.ini | 3 --- script/hassfest/mypy_config.py | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/telegram_bot/polling.py b/homeassistant/components/telegram_bot/polling.py index 4c0de6ade1e..762ba08ab26 100644 --- a/homeassistant/components/telegram_bot/polling.py +++ b/homeassistant/components/telegram_bot/polling.py @@ -22,10 +22,11 @@ async def async_setup_platform(hass, bot, config): return True -def process_error(update: Update, context: CallbackContext): +def process_error(update: Update, context: CallbackContext) -> None: """Telegram bot error handler.""" try: - raise context.error + if context.error: + raise context.error except (TimedOut, NetworkError, RetryAfter): # Long polling timeout or connection problem. Nothing serious. pass diff --git a/mypy.ini b/mypy.ini index a883007de0d..57544f298ab 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2819,9 +2819,6 @@ ignore_errors = true [mypy-homeassistant.components.sonos.statistics] ignore_errors = true -[mypy-homeassistant.components.telegram_bot.polling] -ignore_errors = true - [mypy-homeassistant.components.template.number] ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index 4e11028d574..74a921c8351 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -74,7 +74,6 @@ IGNORED_MODULES: Final[list[str]] = [ "homeassistant.components.sonos.sensor", "homeassistant.components.sonos.speaker", "homeassistant.components.sonos.statistics", - "homeassistant.components.telegram_bot.polling", "homeassistant.components.template.number", "homeassistant.components.template.sensor", "homeassistant.components.toon",