forked from platypush/platypush
LINT fixes
This commit is contained in:
parent
bf92d66be1
commit
fa0a5805be
5 changed files with 6 additions and 10 deletions
|
@ -66,12 +66,14 @@ class GpsBackend(Backend):
|
||||||
if report.get('class').lower() == 'devices':
|
if report.get('class').lower() == 'devices':
|
||||||
for device in report.get('devices', []):
|
for device in report.get('devices', []):
|
||||||
if device.get('path') not in self._devices or device != self._devices.get('path'):
|
if device.get('path') not in self._devices or device != self._devices.get('path'):
|
||||||
|
# noinspection DuplicatedCode
|
||||||
self._devices[device.get('path')] = device
|
self._devices[device.get('path')] = device
|
||||||
return GPSDeviceEvent(path=device.get('path'), activated=device.get('activated'),
|
return GPSDeviceEvent(path=device.get('path'), activated=device.get('activated'),
|
||||||
native=device.get('native'), bps=device.get('bps'),
|
native=device.get('native'), bps=device.get('bps'),
|
||||||
parity=device.get('parity'), stopbits=device.get('stopbits'),
|
parity=device.get('parity'), stopbits=device.get('stopbits'),
|
||||||
cycle=device.get('cycle'), driver=device.get('driver'))
|
cycle=device.get('cycle'), driver=device.get('driver'))
|
||||||
if report.get('class').lower() == 'device':
|
if report.get('class').lower() == 'device':
|
||||||
|
# noinspection DuplicatedCode
|
||||||
self._devices[report.get('path')] = report
|
self._devices[report.get('path')] = report
|
||||||
return GPSDeviceEvent(path=report.get('path'), activated=report.get('activated'),
|
return GPSDeviceEvent(path=report.get('path'), activated=report.get('activated'),
|
||||||
native=report.get('native'), bps=report.get('bps'),
|
native=report.get('native'), bps=report.get('bps'),
|
||||||
|
|
|
@ -46,4 +46,3 @@ class JoystickBackend(Backend):
|
||||||
|
|
||||||
|
|
||||||
# vim:sw=4:ts=4:et:
|
# vim:sw=4:ts=4:et:
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,6 @@ class MidiBackend(Backend):
|
||||||
|
|
||||||
self.midi.set_callback(self._on_midi_message())
|
self.midi.set_callback(self._on_midi_message())
|
||||||
|
|
||||||
|
|
||||||
def _on_midi_message(self):
|
def _on_midi_message(self):
|
||||||
def flush_midi_message(message):
|
def flush_midi_message(message):
|
||||||
def _f():
|
def _f():
|
||||||
|
@ -81,6 +80,7 @@ class MidiBackend(Backend):
|
||||||
self.bus.post(MidiMessageEvent(message=message, delay=delay))
|
self.bus.post(MidiMessageEvent(message=message, delay=delay))
|
||||||
return _f
|
return _f
|
||||||
|
|
||||||
|
# noinspection PyUnusedLocal
|
||||||
def callback(message, data):
|
def callback(message, data):
|
||||||
# rtmidi will provide a tuple in the format
|
# rtmidi will provide a tuple in the format
|
||||||
# (midi_message, time_since_last_event)
|
# (midi_message, time_since_last_event)
|
||||||
|
@ -106,13 +106,12 @@ class MidiBackend(Backend):
|
||||||
|
|
||||||
return callback
|
return callback
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
self.midi.open_port(self.port_number)
|
self.midi.open_port(self.port_number)
|
||||||
self.logger.info('Initialized MIDI backend, listening for events on device {}'.
|
self.logger.info('Initialized MIDI backend, listening for events on device {}'.
|
||||||
format(self.device_name))
|
format(self.device_name))
|
||||||
|
|
||||||
while not self.should_stop():
|
while not self.should_stop():
|
||||||
try:
|
try:
|
||||||
|
@ -126,4 +125,3 @@ class MidiBackend(Backend):
|
||||||
|
|
||||||
|
|
||||||
# vim:sw=4:ts=4:et:
|
# vim:sw=4:ts=4:et:
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
import redis
|
|
||||||
import socket
|
import socket
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from platypush.backend import Backend
|
from platypush.backend import Backend
|
||||||
from platypush.message import Message
|
from platypush.message import Message
|
||||||
from platypush.message.request import Request
|
|
||||||
from platypush.utils import set_thread_name
|
from platypush.utils import set_thread_name
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +38,6 @@ class TcpBackend(Backend):
|
||||||
open_brackets = 0
|
open_brackets = 0
|
||||||
msg = b''
|
msg = b''
|
||||||
prev_ch = None
|
prev_ch = None
|
||||||
redis = self._get_redis()
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if processed_bytes > self._MAX_REQ_SIZE:
|
if processed_bytes > self._MAX_REQ_SIZE:
|
||||||
|
@ -100,7 +97,7 @@ class TcpBackend(Backend):
|
||||||
serv_sock.bind((self.bind_address, self.port))
|
serv_sock.bind((self.bind_address, self.port))
|
||||||
|
|
||||||
self.logger.info('Initialized TCP backend on port {} with bind address {}'.
|
self.logger.info('Initialized TCP backend on port {} with bind address {}'.
|
||||||
format(self.port, self.bind_address))
|
format(self.port, self.bind_address))
|
||||||
|
|
||||||
serv_sock.listen(self.listen_queue)
|
serv_sock.listen(self.listen_queue)
|
||||||
|
|
||||||
|
@ -111,4 +108,3 @@ class TcpBackend(Backend):
|
||||||
|
|
||||||
|
|
||||||
# vim:sw=4:ts=4:et:
|
# vim:sw=4:ts=4:et:
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ class ZwaveBackend(Backend):
|
||||||
self.device = device
|
self.device = device
|
||||||
|
|
||||||
if not config_path:
|
if not config_path:
|
||||||
|
# noinspection PyTypeChecker
|
||||||
config_path = os.path.join(os.path.dirname(inspect.getfile(python_openzwave)), 'ozw_config')
|
config_path = os.path.join(os.path.dirname(inspect.getfile(python_openzwave)), 'ozw_config')
|
||||||
if not user_path:
|
if not user_path:
|
||||||
user_path = os.path.join(Config.get('workdir'), 'zwave')
|
user_path = os.path.join(Config.get('workdir'), 'zwave')
|
||||||
|
|
Loading…
Reference in a new issue