forked from platypush/platypush
LINT warning fixes
This commit is contained in:
parent
c534adf31f
commit
e4eb12fa6d
2 changed files with 6 additions and 7 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from platypush.backend import Backend
|
from platypush.backend import Backend
|
||||||
|
@ -174,7 +175,7 @@ class SensorBackend(Backend):
|
||||||
if plugin and hasattr(plugin, 'close'):
|
if plugin and hasattr(plugin, 'close'):
|
||||||
plugin.close()
|
plugin.close()
|
||||||
|
|
||||||
def process_data(self, data, new_data):
|
def process_data(self, new_data):
|
||||||
if new_data is not None and new_data not in ({}, []):
|
if new_data is not None and new_data not in ({}, []):
|
||||||
self.bus.post(SensorDataChangeEvent(data=new_data, source=self.plugin or self.__class__.__name__))
|
self.bus.post(SensorDataChangeEvent(data=new_data, source=self.plugin or self.__class__.__name__))
|
||||||
|
|
||||||
|
@ -186,7 +187,7 @@ class SensorBackend(Backend):
|
||||||
try:
|
try:
|
||||||
data = self.get_measurement()
|
data = self.get_measurement()
|
||||||
new_data = self.get_new_data(data)
|
new_data = self.get_new_data(data)
|
||||||
self.process_data(data, new_data)
|
self.process_data(new_data)
|
||||||
|
|
||||||
data_below_threshold = {}
|
data_below_threshold = {}
|
||||||
data_above_threshold = {}
|
data_above_threshold = {}
|
||||||
|
|
|
@ -14,7 +14,7 @@ class RedisBus(Bus):
|
||||||
""" Overrides the in-process in-memory local bus with a Redis bus """
|
""" Overrides the in-process in-memory local bus with a Redis bus """
|
||||||
_DEFAULT_REDIS_QUEUE = 'platypush/bus'
|
_DEFAULT_REDIS_QUEUE = 'platypush/bus'
|
||||||
|
|
||||||
def __init__(self, on_message=None, redis_queue=None, *args, **kwargs):
|
def __init__(self, *args, on_message=None, redis_queue=None, **kwargs):
|
||||||
super().__init__(on_message=on_message)
|
super().__init__(on_message=on_message)
|
||||||
|
|
||||||
if not args and not kwargs:
|
if not args and not kwargs:
|
||||||
|
@ -26,7 +26,7 @@ class RedisBus(Bus):
|
||||||
self.on_message = on_message
|
self.on_message = on_message
|
||||||
self.thread_id = threading.get_ident()
|
self.thread_id = threading.get_ident()
|
||||||
|
|
||||||
def get(self, parse: bool = True):
|
def get(self):
|
||||||
""" Reads one message from the Redis queue """
|
""" Reads one message from the Redis queue """
|
||||||
try:
|
try:
|
||||||
if self.should_stop():
|
if self.should_stop():
|
||||||
|
@ -37,9 +37,7 @@ class RedisBus(Bus):
|
||||||
return
|
return
|
||||||
|
|
||||||
msg = msg[1].decode('utf-8')
|
msg = msg[1].decode('utf-8')
|
||||||
if parse:
|
return Message.build(msg)
|
||||||
return Message.build(msg)
|
|
||||||
return msg
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception(e)
|
logger.exception(e)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue