Refactoring the code for pylint & flake test

This commit is contained in:
badele committed 2015-09-29 08:20:25 +02:00
1 parent 174aeacd76
commit d64f0ddd41
4 files changed
+30 -25

No files matched your search

+4 -5
View File
@@ -14,13 +14,12 @@ DOMAIN = "rfxtrx"
CONF_DEVICE = 'device'
RECEIVED_EVT_SUBSCRIBERS = []
RFX_DEVICES = {}
_LOGGER = logging.getLogger(__name__)
def setup(hass, config):
""" Setup the Rfxtrx component. """
# Init logger
logger = logging.getLogger(__name__)
# Declare the Handle event
def handle_receive(event):
""" Callback all subscribers for RFXtrx gateway. """
@@ -31,11 +30,11 @@ def setup(hass, config):
try:
import RFXtrx as rfxtrxmod
except ImportError:
logger.exception("Failed to import rfxtrx")
_LOGGER.exception("Failed to import rfxtrx")
return False
# Init the rfxtrx module
device = config[DOMAIN][CONF_DEVICE]
rfxtrxmod.Core(device, handle_receive)
return True
return True