Skip to content

Commit 9bdf8ab

Browse files
authored
pylint fix raw_to_pronto_code.py (#2150)
Force named parameters to make pylint happy option to new to disable reliably tools/raw_to_pronto_code.py:11:0: R0917: Too many positional arguments (7/5) (too-many-positional-arguments) https://pylint.readthedocs.io/en/latest/user_guide/messages/refactor/too-many-positional-arguments.html
1 parent ce0a65e commit 9bdf8ab

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

tools/raw_to_pronto_code.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
# pylint: disable=too-many-arguments
11-
def parse_and_report(rawdata_str, hertz=38000, end_usecs=100000,
11+
def parse_and_report(rawdata_str, hertz=38000, *, end_usecs=100000,
1212
use_initial=False, generate_code=False, verbose=False,
1313
output=sys.stdout):
1414
"""Analyse the rawdata c++ definition of a IR message."""
@@ -94,9 +94,11 @@ def main():
9494
default=False)
9595
add_rawdata_args(arg_parser)
9696
arg_options = arg_parser.parse_args()
97-
parse_and_report(get_rawdata(arg_options), arg_options.hertz,
98-
arg_options.usecs, arg_options.use_initial,
99-
arg_options.generate_code, arg_options.verbose)
97+
parse_and_report(get_rawdata(arg_options), hertz=arg_options.hertz,
98+
end_usecs=arg_options.usecs,
99+
use_initial=arg_options.use_initial,
100+
generate_code=arg_options.generate_code,
101+
verbose=arg_options.verbose)
100102

101103

102104
if __name__ == '__main__':

tools/raw_to_pronto_code_test.py

+15-9
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ def test_parse_and_report_at_38000(self):
1414
input_str = """
1515
uint16_t rawData[7] = {
1616
20100, 20472, 15092, 30704, 20102, 20472, 15086};"""
17-
pronto.parse_and_report(input_str, 38000, 100000, True, False, False,
18-
output)
17+
pronto.parse_and_report(input_str, hertz=38000, end_usecs=100000,
18+
use_initial=True, generate_code=False,
19+
verbose=False, output=output)
1920
self.assertEqual(
2021
output.getvalue(),
2122
"Pronto code = "
@@ -28,8 +29,9 @@ def test_parse_and_report_at_36000(self):
2829
input_str = """
2930
uint16_t rawData[7] = {
3031
20100, 20472, 15092, 30704, 20102, 20472, 15086};"""
31-
pronto.parse_and_report(input_str, 36000, 100000, True, False, False,
32-
output)
32+
pronto.parse_and_report(input_str, hertz=36000, end_usecs=100000,
33+
use_initial=True, generate_code=False,
34+
verbose=False, output=output)
3335
self.assertEqual(
3436
output.getvalue(),
3537
"Pronto code = "
@@ -42,8 +44,9 @@ def test_parse_and_report_at_57600(self):
4244
input_str = """
4345
uint16_t rawData[7] = {
4446
20100, 20472, 15092, 30704, 20102, 20472, 15086};"""
45-
pronto.parse_and_report(input_str, 57600, 100000, True, False, False,
46-
output)
47+
pronto.parse_and_report(input_str, hertz=57600, end_usecs=100000,
48+
use_initial=True, generate_code=False,
49+
verbose=False, output=output)
4750
self.assertEqual(
4851
output.getvalue(),
4952
"Pronto code = "
@@ -56,8 +59,9 @@ def test_using_repeat(self):
5659
input_str = """
5760
uint16_t rawData[7] = {
5861
20100, 20472, 15092, 30704, 20102, 20472, 15086};"""
59-
pronto.parse_and_report(input_str, 38000, 30000, False, False, False,
60-
output)
62+
pronto.parse_and_report(input_str, hertz=38000, end_usecs=30000,
63+
use_initial=False, generate_code=False,
64+
verbose=False, output=output)
6165
self.assertEqual(
6266
output.getvalue(),
6367
"Pronto code = "
@@ -70,7 +74,9 @@ def test_generate_code_output(self):
7074
input_str = """
7175
uint16_t rawData[7] = {
7276
20100, 20472, 15092, 30704, 20102, 20472, 15086};"""
73-
pronto.parse_and_report(input_str, 38000, 30000, True, True, False, output)
77+
pronto.parse_and_report(input_str, 38000, end_usecs=30000,
78+
use_initial=True, generate_code=True,
79+
verbose=False, output=output)
7480
self.assertEqual(
7581
output.getvalue(),
7682
"uint16_t pronto[12] = {0x0000, 0x006D, 0x0004, 0x0000, 0x02fb, "

0 commit comments

Comments
 (0)