From c880f0971476b2d677e76db5f0659784a08a3980 Mon Sep 17 00:00:00 2001 From: springstan <46536646+springstan@users.noreply.github.com> Date: Wed, 4 Dec 2019 14:15:17 +0100 Subject: [PATCH] Move imports to top for horizon (#29419) * Move imports to top for horizon * Fix Pylint redefining name keys --- homeassistant/components/horizon/media_player.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/horizon/media_player.py b/homeassistant/components/horizon/media_player.py index 8bed30e88f32..44e93d26a405 100644 --- a/homeassistant/components/horizon/media_player.py +++ b/homeassistant/components/horizon/media_player.py @@ -2,10 +2,12 @@ from datetime import timedelta import logging +from horimote import Client, keys +from horimote.exceptions import AuthenticationError import voluptuous as vol from homeassistant import util -from homeassistant.components.media_player import MediaPlayerDevice, PLATFORM_SCHEMA +from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice from homeassistant.components.media_player.const import ( MEDIA_TYPE_CHANNEL, SUPPORT_NEXT_TRACK, @@ -56,8 +58,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Horizon platform.""" - from horimote import Client, keys - from horimote.exceptions import AuthenticationError host = config[CONF_HOST] name = config[CONF_NAME] @@ -81,12 +81,12 @@ def setup_platform(hass, config, add_entities, discovery_info=None): class HorizonDevice(MediaPlayerDevice): """Representation of a Horizon HD Recorder.""" - def __init__(self, client, name, keys): + def __init__(self, client, name, remote_keys): """Initialize the remote.""" self._client = client self._name = name self._state = None - self._keys = keys + self._keys = remote_keys @property def name(self): @@ -177,7 +177,6 @@ class HorizonDevice(MediaPlayerDevice): def _send(self, key=None, channel=None): """Send a key to the Horizon device.""" - from horimote.exceptions import AuthenticationError try: if key: