From fa0a5805be72167a7cb9730445fdaa385c3ee4df Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 22 Aug 2020 14:25:31 +0200 Subject: [PATCH] LINT fixes --- platypush/backend/gps.py | 2 ++ platypush/backend/joystick.py | 1 - platypush/backend/midi.py | 6 ++---- platypush/backend/tcp.py | 6 +----- platypush/backend/zwave/__init__.py | 1 + 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/platypush/backend/gps.py b/platypush/backend/gps.py index 4729a0f6b..a9ab9ba32 100644 --- a/platypush/backend/gps.py +++ b/platypush/backend/gps.py @@ -66,12 +66,14 @@ class GpsBackend(Backend): if report.get('class').lower() == 'devices': for device in report.get('devices', []): if device.get('path') not in self._devices or device != self._devices.get('path'): + # noinspection DuplicatedCode self._devices[device.get('path')] = device return GPSDeviceEvent(path=device.get('path'), activated=device.get('activated'), native=device.get('native'), bps=device.get('bps'), parity=device.get('parity'), stopbits=device.get('stopbits'), cycle=device.get('cycle'), driver=device.get('driver')) if report.get('class').lower() == 'device': + # noinspection DuplicatedCode self._devices[report.get('path')] = report return GPSDeviceEvent(path=report.get('path'), activated=report.get('activated'), native=report.get('native'), bps=report.get('bps'), diff --git a/platypush/backend/joystick.py b/platypush/backend/joystick.py index b828ad4c8..ce962987e 100644 --- a/platypush/backend/joystick.py +++ b/platypush/backend/joystick.py @@ -46,4 +46,3 @@ class JoystickBackend(Backend): # vim:sw=4:ts=4:et: - diff --git a/platypush/backend/midi.py b/platypush/backend/midi.py index 6481e80a0..13551814f 100644 --- a/platypush/backend/midi.py +++ b/platypush/backend/midi.py @@ -72,7 +72,6 @@ class MidiBackend(Backend): self.midi.set_callback(self._on_midi_message()) - def _on_midi_message(self): def flush_midi_message(message): def _f(): @@ -81,6 +80,7 @@ class MidiBackend(Backend): self.bus.post(MidiMessageEvent(message=message, delay=delay)) return _f + # noinspection PyUnusedLocal def callback(message, data): # rtmidi will provide a tuple in the format # (midi_message, time_since_last_event) @@ -106,13 +106,12 @@ class MidiBackend(Backend): return callback - def run(self): super().run() self.midi.open_port(self.port_number) self.logger.info('Initialized MIDI backend, listening for events on device {}'. - format(self.device_name)) + format(self.device_name)) while not self.should_stop(): try: @@ -126,4 +125,3 @@ class MidiBackend(Backend): # vim:sw=4:ts=4:et: - diff --git a/platypush/backend/tcp.py b/platypush/backend/tcp.py index da5bcd954..4d2945eeb 100644 --- a/platypush/backend/tcp.py +++ b/platypush/backend/tcp.py @@ -1,10 +1,8 @@ -import redis import socket import threading from platypush.backend import Backend from platypush.message import Message -from platypush.message.request import Request from platypush.utils import set_thread_name @@ -40,7 +38,6 @@ class TcpBackend(Backend): open_brackets = 0 msg = b'' prev_ch = None - redis = self._get_redis() while True: if processed_bytes > self._MAX_REQ_SIZE: @@ -100,7 +97,7 @@ class TcpBackend(Backend): serv_sock.bind((self.bind_address, self.port)) 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) @@ -111,4 +108,3 @@ class TcpBackend(Backend): # vim:sw=4:ts=4:et: - diff --git a/platypush/backend/zwave/__init__.py b/platypush/backend/zwave/__init__.py index e08cff62b..9d44d21e4 100644 --- a/platypush/backend/zwave/__init__.py +++ b/platypush/backend/zwave/__init__.py @@ -109,6 +109,7 @@ class ZwaveBackend(Backend): self.device = device if not config_path: + # noinspection PyTypeChecker config_path = os.path.join(os.path.dirname(inspect.getfile(python_openzwave)), 'ozw_config') if not user_path: user_path = os.path.join(Config.get('workdir'), 'zwave')