Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pylint fix raw_to_pronto_code.py #2150

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions tools/raw_to_pronto_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


# pylint: disable=too-many-arguments
def parse_and_report(rawdata_str, hertz=38000, end_usecs=100000,
def parse_and_report(rawdata_str, hertz=38000, *, end_usecs=100000,
use_initial=False, generate_code=False, verbose=False,
output=sys.stdout):
"""Analyse the rawdata c++ definition of a IR message."""
Expand Down Expand Up @@ -94,9 +94,11 @@ def main():
default=False)
add_rawdata_args(arg_parser)
arg_options = arg_parser.parse_args()
parse_and_report(get_rawdata(arg_options), arg_options.hertz,
arg_options.usecs, arg_options.use_initial,
arg_options.generate_code, arg_options.verbose)
parse_and_report(get_rawdata(arg_options), hertz=arg_options.hertz,
end_usecs=arg_options.usecs,
use_initial=arg_options.use_initial,
generate_code=arg_options.generate_code,
verbose=arg_options.verbose)


if __name__ == '__main__':
Expand Down
24 changes: 15 additions & 9 deletions tools/raw_to_pronto_code_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ def test_parse_and_report_at_38000(self):
input_str = """
uint16_t rawData[7] = {
20100, 20472, 15092, 30704, 20102, 20472, 15086};"""
pronto.parse_and_report(input_str, 38000, 100000, True, False, False,
output)
pronto.parse_and_report(input_str, hertz=38000, end_usecs=100000,
use_initial=True, generate_code=False,
verbose=False, output=output)
self.assertEqual(
output.getvalue(),
"Pronto code = "
Expand All @@ -28,8 +29,9 @@ def test_parse_and_report_at_36000(self):
input_str = """
uint16_t rawData[7] = {
20100, 20472, 15092, 30704, 20102, 20472, 15086};"""
pronto.parse_and_report(input_str, 36000, 100000, True, False, False,
output)
pronto.parse_and_report(input_str, hertz=36000, end_usecs=100000,
use_initial=True, generate_code=False,
verbose=False, output=output)
self.assertEqual(
output.getvalue(),
"Pronto code = "
Expand All @@ -42,8 +44,9 @@ def test_parse_and_report_at_57600(self):
input_str = """
uint16_t rawData[7] = {
20100, 20472, 15092, 30704, 20102, 20472, 15086};"""
pronto.parse_and_report(input_str, 57600, 100000, True, False, False,
output)
pronto.parse_and_report(input_str, hertz=57600, end_usecs=100000,
use_initial=True, generate_code=False,
verbose=False, output=output)
self.assertEqual(
output.getvalue(),
"Pronto code = "
Expand All @@ -56,8 +59,9 @@ def test_using_repeat(self):
input_str = """
uint16_t rawData[7] = {
20100, 20472, 15092, 30704, 20102, 20472, 15086};"""
pronto.parse_and_report(input_str, 38000, 30000, False, False, False,
output)
pronto.parse_and_report(input_str, hertz=38000, end_usecs=30000,
use_initial=False, generate_code=False,
verbose=False, output=output)
self.assertEqual(
output.getvalue(),
"Pronto code = "
Expand All @@ -70,7 +74,9 @@ def test_generate_code_output(self):
input_str = """
uint16_t rawData[7] = {
20100, 20472, 15092, 30704, 20102, 20472, 15086};"""
pronto.parse_and_report(input_str, 38000, 30000, True, True, False, output)
pronto.parse_and_report(input_str, 38000, end_usecs=30000,
use_initial=True, generate_code=True,
verbose=False, output=output)
self.assertEqual(
output.getvalue(),
"uint16_t pronto[12] = {0x0000, 0x006D, 0x0004, 0x0000, 0x02fb, "
Expand Down
Loading