Fix whitespace errors to make pylint happy

This commit is contained in:
G. Roggemans
2018-03-05 18:31:17 +01:00
parent 9b4f784532
commit 38bb43086b
5 changed files with 42 additions and 33 deletions
+4
View File
@@ -12,6 +12,7 @@ from xiaomihub import XiaomiHub
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
def process_gateway_messages(gateway, client, stop_event): def process_gateway_messages(gateway, client, stop_event):
while not stop_event.is_set(): while not stop_event.is_set():
try: try:
@@ -32,6 +33,7 @@ def process_gateway_messages(gateway, client, stop_event):
_LOGGER.error('Error while sending from gateway to mqtt: ', str(e)) _LOGGER.error('Error while sending from gateway to mqtt: ', str(e))
_LOGGER.info("Stopping Gateway Thread ...") _LOGGER.info("Stopping Gateway Thread ...")
def read_motion_data(gateway, client, polling_interval, polling_models, stop_event): def read_motion_data(gateway, client, polling_interval, polling_models, stop_event):
first = True first = True
while not stop_event.is_set(): while not stop_event.is_set():
@@ -62,6 +64,7 @@ def read_motion_data(gateway, client, polling_interval, polling_models, stop_eve
time.sleep(polling_interval) time.sleep(polling_interval)
_LOGGER.info("Stopping Polling Thread ...") _LOGGER.info("Stopping Polling Thread ...")
def process_mqtt_messages(gateway, client, stop_event): def process_mqtt_messages(gateway, client, stop_event):
while not stop_event.is_set(): while not stop_event.is_set():
try: try:
@@ -79,6 +82,7 @@ def process_mqtt_messages(gateway, client, stop_event):
_LOGGER.error('Error while sending from mqtt to gateway: ', str(e)) _LOGGER.error('Error while sending from mqtt to gateway: ', str(e))
_LOGGER.info("Stopping MQTT Thread ...") _LOGGER.info("Stopping MQTT Thread ...")
def exit_handler(signal, frame): def exit_handler(signal, frame):
print('Exiting') print('Exiting')
stop_event.set() stop_event.set()
+1
View File
@@ -6,6 +6,7 @@ import json
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
class Mqtt: class Mqtt:
event_based_sensors = ["switch", "cube"] event_based_sensors = ["switch", "cube"]
motion_sensors = ["motion", "sensor_motion.aq2"] motion_sensors = ["motion", "sensor_motion.aq2"]
+3 -1
View File
@@ -10,7 +10,8 @@ from threading import Thread
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
# MANDATORY!!!! NEED TO TURN OFF "_process_report" THREAD IF CODE IS UPDATED!!!! # MANDATORY!!!! NEED TO TURN OFF "_process_report" THREAD IF CODE IS UPDATED!!!
class XiaomiHub: class XiaomiHub:
GATEWAY_KEY = None GATEWAY_KEY = None
@@ -248,6 +249,7 @@ class XiaomiHub:
self._queue.task_done() self._queue.task_done()
class XiaomiDevice(): class XiaomiDevice():
"""Representation a base Xiaomi device.""" """Representation a base Xiaomi device."""
+2
View File
@@ -3,6 +3,7 @@ import logging
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
def load_yaml(file): def load_yaml(file):
try: try:
stram = open(file, "r") stram = open(file, "r")
@@ -12,6 +13,7 @@ def load_yaml(file):
raise raise
_LOGGER.error("Can't load yaml with sids %r (%r)" % (file, e)) _LOGGER.error("Can't load yaml with sids %r (%r)" % (file, e))
def get_gateway_password(config, ip=""): def get_gateway_password(config, ip=""):
if (config == None): if (config == None):
raise "Config is null" raise "Config is null"