Move imports in telegram_bot component (#27785)

This commit is contained in:
Quentame authored and Paulus Schoutsen committed 2019-10-17 17:19:34 -07:00
1 parent 2d1f7932ba
commit bd0403c65e
3 files changed
+18 -16

No files matched your search

@@ -1,6 +1,10 @@
"""Support for Telegram bot using polling."""
import logging
from telegram import Update
from telegram.error import TelegramError, TimedOut, NetworkError, RetryAfter
from telegram.ext import Updater, Handler
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
from homeassistant.core import callback
@@ -32,8 +36,6 @@ async def async_setup_platform(hass, config):
def process_error(bot, update, error):
"""Telegram bot error handler."""
from telegram.error import TelegramError, TimedOut, NetworkError, RetryAfter
try:
raise error
except (TimedOut, NetworkError, RetryAfter):
@@ -45,8 +47,6 @@ def process_error(bot, update, error):
def message_handler(handler):
"""Create messages handler."""
from telegram import Update
from telegram.ext import Handler
class MessageHandler(Handler):
"""Telegram bot message handler."""
@@ -72,7 +72,6 @@ class TelegramPoll(BaseTelegramBotEntity):
def __init__(self, bot, hass, allowed_chat_ids):
"""Initialize the polling instance."""
from telegram.ext import Updater
BaseTelegramBotEntity.__init__(self, hass, allowed_chat_ids)