Move imports to top for horizon (#29419)

* Move imports to top for horizon

* Fix Pylint redefining name keys
This commit is contained in:
springstan 2019-12-04 14:15:17 +01:00 committed by Pascal Vizeli
parent 46c306685d
commit c880f09714

View File

@ -2,10 +2,12 @@
from datetime import timedelta from datetime import timedelta
import logging import logging
from horimote import Client, keys
from horimote.exceptions import AuthenticationError
import voluptuous as vol import voluptuous as vol
from homeassistant import util 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 ( from homeassistant.components.media_player.const import (
MEDIA_TYPE_CHANNEL, MEDIA_TYPE_CHANNEL,
SUPPORT_NEXT_TRACK, SUPPORT_NEXT_TRACK,
@ -56,8 +58,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
def setup_platform(hass, config, add_entities, discovery_info=None): def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Horizon platform.""" """Set up the Horizon platform."""
from horimote import Client, keys
from horimote.exceptions import AuthenticationError
host = config[CONF_HOST] host = config[CONF_HOST]
name = config[CONF_NAME] name = config[CONF_NAME]
@ -81,12 +81,12 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
class HorizonDevice(MediaPlayerDevice): class HorizonDevice(MediaPlayerDevice):
"""Representation of a Horizon HD Recorder.""" """Representation of a Horizon HD Recorder."""
def __init__(self, client, name, keys): def __init__(self, client, name, remote_keys):
"""Initialize the remote.""" """Initialize the remote."""
self._client = client self._client = client
self._name = name self._name = name
self._state = None self._state = None
self._keys = keys self._keys = remote_keys
@property @property
def name(self): def name(self):
@ -177,7 +177,6 @@ class HorizonDevice(MediaPlayerDevice):
def _send(self, key=None, channel=None): def _send(self, key=None, channel=None):
"""Send a key to the Horizon device.""" """Send a key to the Horizon device."""
from horimote.exceptions import AuthenticationError
try: try:
if key: if key: