From 8fbfb6bf8cf82383aba96d48f06b1759a6f02885 Mon Sep 17 00:00:00 2001 From: springstan <46536646+springstan@users.noreply.github.com> Date: Sun, 1 Dec 2019 12:04:47 +0100 Subject: [PATCH] Move imports to top for rocketchat (#29288) --- homeassistant/components/rocketchat/notify.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/rocketchat/notify.py b/homeassistant/components/rocketchat/notify.py index 8657d0f9450..2b5b8dcd235 100644 --- a/homeassistant/components/rocketchat/notify.py +++ b/homeassistant/components/rocketchat/notify.py @@ -1,16 +1,20 @@ """Rocket.Chat notification service.""" import logging +from rocketchat_API.APIExceptions.RocketExceptions import ( + RocketAuthenticationException, + RocketConnectionException, +) +from rocketchat_API.rocketchat import RocketChat import voluptuous as vol -from homeassistant.const import CONF_PASSWORD, CONF_ROOM, CONF_URL, CONF_USERNAME -import homeassistant.helpers.config_validation as cv - from homeassistant.components.notify import ( ATTR_DATA, PLATFORM_SCHEMA, BaseNotificationService, ) +from homeassistant.const import CONF_PASSWORD, CONF_ROOM, CONF_URL, CONF_USERNAME +import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger(__name__) @@ -27,10 +31,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( def get_service(hass, config, discovery_info=None): """Return the notify service.""" - from rocketchat_API.APIExceptions.RocketExceptions import ( - RocketConnectionException, - RocketAuthenticationException, - ) username = config.get(CONF_USERNAME) password = config.get(CONF_PASSWORD) @@ -54,7 +54,6 @@ class RocketChatNotificationService(BaseNotificationService): def __init__(self, url, username, password, room): """Initialize the service.""" - from rocketchat_API.rocketchat import RocketChat self._room = room self._server = RocketChat(username, password, server_url=url)