From 31378839566006de80e4b979079f3149b3a9f4df Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Fri, 10 Feb 2023 23:39:13 +0100 Subject: Typographic updates to source generation (#19160) --- lib/python/qmk/cli/generate/keyboard_c.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'lib/python/qmk/cli/generate/keyboard_c.py') diff --git a/lib/python/qmk/cli/generate/keyboard_c.py b/lib/python/qmk/cli/generate/keyboard_c.py index a9b742f323..9004b41abb 100755 --- a/lib/python/qmk/cli/generate/keyboard_c.py +++ b/lib/python/qmk/cli/generate/keyboard_c.py @@ -25,17 +25,17 @@ def _gen_led_config(info_data): if not config_type: return lines - matrix = [['NO_LED'] * cols for i in range(rows)] + matrix = [['NO_LED'] * cols for _ in range(rows)] pos = [] flags = [] - led_config = info_data[config_type]['layout'] - for index, item in enumerate(led_config, start=0): - if 'matrix' in item: - (x, y) = item['matrix'] - matrix[x][y] = str(index) - pos.append(f'{{ {item.get("x", 0)},{item.get("y", 0)} }}') - flags.append(str(item.get('flags', 0))) + led_layout = info_data[config_type]['layout'] + for index, led_data in enumerate(led_layout): + if 'matrix' in led_data: + row, col = led_data['matrix'] + matrix[row][col] = str(index) + pos.append(f'{{{led_data.get("x", 0)}, {led_data.get("y", 0)}}}') + flags.append(str(led_data.get('flags', 0))) if config_type == 'rgb_matrix': lines.append('#ifdef RGB_MATRIX_ENABLE') @@ -47,10 +47,10 @@ def _gen_led_config(info_data): lines.append('__attribute__ ((weak)) led_config_t g_led_config = {') lines.append(' {') for line in matrix: - lines.append(f' {{ {",".join(line)} }},') + lines.append(f' {{ {", ".join(line)} }},') lines.append(' },') - lines.append(f' {{ {",".join(pos)} }},') - lines.append(f' {{ {",".join(flags)} }},') + lines.append(f' {{ {", ".join(pos)} }},') + lines.append(f' {{ {", ".join(flags)} }},') lines.append('};') lines.append('#endif') -- cgit v1.2.3