Move imports to top for nad (#29358)

pull/29381/head
springstan 2019-12-04 00:45:56 +01:00 committed by Paulus Schoutsen
parent 0e223662a9
commit 01bc1e4c66
1 changed files with 4 additions and 9 deletions

View File

@ -1,10 +1,10 @@
"""Support for interfacing with NAD receivers through RS-232.""" """Support for interfacing with NAD receivers through RS-232."""
import logging import logging
from nad_receiver import NADReceiver, NADReceiverTCP, NADReceiverTelnet
import voluptuous as vol import voluptuous as vol
import homeassistant.helpers.config_validation as cv from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
from homeassistant.components.media_player import MediaPlayerDevice, PLATFORM_SCHEMA
from homeassistant.components.media_player.const import ( from homeassistant.components.media_player.const import (
SUPPORT_SELECT_SOURCE, SUPPORT_SELECT_SOURCE,
SUPPORT_TURN_OFF, SUPPORT_TURN_OFF,
@ -13,7 +13,8 @@ from homeassistant.components.media_player.const import (
SUPPORT_VOLUME_SET, SUPPORT_VOLUME_SET,
SUPPORT_VOLUME_STEP, SUPPORT_VOLUME_STEP,
) )
from homeassistant.const import CONF_NAME, STATE_OFF, STATE_ON, CONF_HOST from homeassistant.const import CONF_HOST, CONF_NAME, STATE_OFF, STATE_ON
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -64,8 +65,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 NAD platform.""" """Set up the NAD platform."""
if config.get(CONF_TYPE) == "RS232": if config.get(CONF_TYPE) == "RS232":
from nad_receiver import NADReceiver
add_entities( add_entities(
[ [
NAD( NAD(
@ -79,8 +78,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
True, True,
) )
elif config.get(CONF_TYPE) == "Telnet": elif config.get(CONF_TYPE) == "Telnet":
from nad_receiver import NADReceiverTelnet
add_entities( add_entities(
[ [
NAD( NAD(
@ -94,8 +91,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
True, True,
) )
else: else:
from nad_receiver import NADReceiverTCP
add_entities( add_entities(
[ [
NADtcp( NADtcp(