Skip to content

Commit 0b7cf9c

Browse files
MarekPietapdunaj
authored andcommitted
scripts: hid_configurator: Fix pylint issues
Change fixes issues reported by pylint. Jira:DESK-593 Signed-off-by: Marek Pieta <[email protected]>
1 parent 2b4758c commit 0b7cf9c

File tree

5 files changed

+18
-16
lines changed

5 files changed

+18
-16
lines changed

scripts/hid_configurator/configurator_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,17 @@ def parse_arguments():
164164
device_config = DEVICE[device_name]['config']
165165

166166
if device_config is not None:
167-
assert type(device_config) == dict
167+
assert isinstance(device_config, dict)
168168
parser_config = sp_commands.add_parser('config', help='Configuration option get/set')
169169

170170
sp_config = parser_config.add_subparsers(dest='module')
171171
sp_config.required = True
172172

173173
for module_name in device_config:
174174
module_config = device_config[module_name]
175-
assert type(module_config) == dict
175+
assert isinstance(module_config, dict)
176176
module_opts = module_config['options']
177-
assert type(module_opts) == dict
177+
assert isinstance(module_opts, dict)
178178

179179
parser_config_module = sp_config.add_parser(module_name, help='{} module options'.format(module_name))
180180
sp_config_module = parser_config_module.add_subparsers(dest='option')

scripts/hid_configurator/configurator_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import logging
1313

14-
from devices import get_device_pid, get_device_vid, get_device_type
14+
from devices import get_device_pid, get_device_vid
1515

1616
REPORT_ID = 6
1717
REPORT_SIZE = 30

scripts/hid_configurator/gui/gui_backend.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def list_devices():
3131
device_type = get_device_type(device['product_id'])
3232
if device_type is not None and \
3333
get_device_vid(device_type) == device['vendor_id']:
34-
print("Add {} to device list".format(device_type))
35-
device_list.append(device_type)
34+
print("Add {} to device list".format(device_type))
35+
device_list.append(device_type)
3636

3737
return device_list
3838

@@ -64,7 +64,7 @@ def perform_dfu_fwreboot(self, update_animation):
6464
print('DFU completed')
6565
else:
6666
print('Cannot connect to device after reboot')
67-
return (self.dev is not None)
67+
return self.dev is not None
6868

6969
def setcpi(self, value):
7070
config_name = 'cpi'
@@ -95,7 +95,8 @@ def perform_dfu(self, file, update_progressbar):
9595
dfu_image = file
9696
return dfu_transfer(self.dev, self.pid, dfu_image, update_progressbar)
9797

98-
def dfu_image_version(self, filepath):
98+
@staticmethod
99+
def dfu_image_version(filepath):
99100
ver = get_dfu_image_version(filepath)
100101
if ver is None:
101102
return "Wrong image"

scripts/hid_configurator/modules/dfu.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import zlib
88
import os
99
import imgtool.image as img
10+
import time
1011
import logging
1112

1213
from configurator_core import GROUP_FIELD_POS, TYPE_FIELD_POS, EVENT_GROUP_DFU

scripts/hid_configurator/modules/music_led_stream.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
import threading
1212
import queue
1313

14-
from .led_stream import MS_PER_SEC
15-
from .led_stream import Step
16-
from .led_stream import validate_params
17-
from .led_stream import fetch_free_steps_buffer_info, led_send_single_step
14+
from modules.led_stream import MS_PER_SEC
15+
from modules.led_stream import Step
16+
from modules.led_stream import validate_params
17+
from modules.led_stream import fetch_free_steps_buffer_info, led_send_single_step
1818

1919

2020
class MusicLedStream():
@@ -67,7 +67,8 @@ def __init__(self, dev, recipient, DEVICE_CONFIG, led_id, freq, filename):
6767

6868
@staticmethod
6969
def peak_to_hue(peak):
70-
assert peak >= 0 and peak <= 1
70+
assert peak >= 0
71+
assert peak <= 1
7172

7273
G = 120
7374
B = 240
@@ -90,7 +91,7 @@ def send_led_effects(self):
9091
while True:
9192
data = self.queue.get()
9293

93-
if data == None:
94+
if data is None:
9495
# LED stream ended
9596
return
9697

@@ -124,7 +125,7 @@ def send_led_effects(self):
124125

125126
if not success:
126127
print("Device communication problem")
127-
send_error_event.set()
128+
self.send_error_event.set()
128129
return
129130

130131
self.led_effects['sent_cnt'] += 1
@@ -205,7 +206,6 @@ def stream_start(self):
205206

206207
except KeyboardInterrupt:
207208
print("Music LED stream interrupted by user")
208-
pass
209209

210210
self.stream_term()
211211

0 commit comments

Comments
 (0)