From 9f649ed3455d52c6c5e13c485497f97790778b95 Mon Sep 17 00:00:00 2001 From: springstan <46536646+springstan@users.noreply.github.com> Date: Sun, 1 Dec 2019 12:03:51 +0100 Subject: [PATCH] Move imports to top for roku (#29289) --- homeassistant/components/roku/__init__.py | 3 +-- homeassistant/components/roku/media_player.py | 7 ++++--- homeassistant/components/roku/remote.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/roku/__init__.py b/homeassistant/components/roku/__init__.py index aa13814ee6b..b84b6dd1e63 100644 --- a/homeassistant/components/roku/__init__.py +++ b/homeassistant/components/roku/__init__.py @@ -1,6 +1,7 @@ """Support for Roku.""" import logging +from roku import Roku, RokuException import voluptuous as vol from homeassistant.components.discovery import SERVICE_ROKU @@ -64,7 +65,6 @@ def setup(hass, config): def scan_for_rokus(hass): """Scan for devices and present a notification of the ones found.""" - from roku import Roku, RokuException rokus = Roku.discover() @@ -94,7 +94,6 @@ def scan_for_rokus(hass): def _setup_roku(hass, hass_config, roku_config): """Set up a Roku.""" - from roku import Roku host = roku_config[CONF_HOST] diff --git a/homeassistant/components/roku/media_player.py b/homeassistant/components/roku/media_player.py index 84a1982fb49..a785d7b18ff 100644 --- a/homeassistant/components/roku/media_player.py +++ b/homeassistant/components/roku/media_player.py @@ -1,6 +1,8 @@ """Support for the Roku media player.""" import logging + import requests.exceptions +from roku import Roku from homeassistant.components.media_player import MediaPlayerDevice from homeassistant.components.media_player.const import ( @@ -10,10 +12,10 @@ from homeassistant.components.media_player.const import ( SUPPORT_PLAY_MEDIA, SUPPORT_PREVIOUS_TRACK, SUPPORT_SELECT_SOURCE, + SUPPORT_TURN_OFF, + SUPPORT_TURN_ON, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET, - SUPPORT_TURN_ON, - SUPPORT_TURN_OFF, ) from homeassistant.const import ( CONF_HOST, @@ -54,7 +56,6 @@ class RokuDevice(MediaPlayerDevice): def __init__(self, host): """Initialize the Roku device.""" - from roku import Roku self.roku = Roku(host) self.ip_address = host diff --git a/homeassistant/components/roku/remote.py b/homeassistant/components/roku/remote.py index f443b7e8e74..c953d9ba734 100644 --- a/homeassistant/components/roku/remote.py +++ b/homeassistant/components/roku/remote.py @@ -1,5 +1,6 @@ """Support for the Roku remote.""" import requests.exceptions +from roku import Roku from homeassistant.components import remote from homeassistant.const import CONF_HOST @@ -19,7 +20,6 @@ class RokuRemote(remote.RemoteDevice): def __init__(self, host): """Initialize the Roku device.""" - from roku import Roku self.roku = Roku(host) self._device_info = {}