diff --git a/data/templates/xap/client/python/constants.py.j2 b/data/templates/xap/client/python/constants.py.j2 index a972890dae6..dcd653765d0 100644 --- a/data/templates/xap/client/python/constants.py.j2 +++ b/data/templates/xap/client/python/constants.py.j2 @@ -5,13 +5,15 @@ from enum import IntEnum # version: 0.0.1 class RgblightModes(IntEnum): -{%- for id, effect in specs.rgblight.effects | dictsort %} +{% for id, effect in specs.rgblight.effects | dictsort %} {{ effect.key }} = {{ id }} -{%- endfor %} +{% endfor %} # version: 0.0.1 class RgbMatrixModes(IntEnum): -{%- for id, effect in specs.rgb_matrix.effects | dictsort %} +{% for id, effect in specs.rgb_matrix.effects | dictsort %} {{ effect.key }} = {{ id }} -{%- endfor %} +{% endfor %} + +# noqa: W391 \ No newline at end of file diff --git a/data/templates/xap/client/python/routes.py.j2 b/data/templates/xap/client/python/routes.py.j2 index 475ee23137d..51ce0d79007 100644 --- a/data/templates/xap/client/python/routes.py.j2 +++ b/data/templates/xap/client/python/routes.py.j2 @@ -5,16 +5,18 @@ class XAPRouteError(Exception): class XAPRoutes(): -{%- for id, route in xap.routes | dictsort %} -{%- if route.routes %} +{% for id, route in xap.routes | dictsort %} +{% if route.routes %} # {{route.define}} -{%- for subid, subroute in route.routes | dictsort %} +{% for subid, subroute in route.routes | dictsort %} {{route.define}}_{{subroute.define}} = b'\x{{ '%02d' % id|int(base=16) }}\x{{ '%02d' % subid|int(base=16) }}' -{%- if subroute.routes %} -{%- for subsubid, subsubroute in subroute.routes | dictsort %} +{% if subroute.routes %} +{% for subsubid, subsubroute in subroute.routes | dictsort %} {{route.define}}_{{subroute.define}}_{{subsubroute.define}} = b'\x{{ '%02d' % id|int(base=16) }}\x{{ '%02d' % subid|int(base=16) }}\x{{ '%02d' % subsubid|int(base=16) }}' -{%- endfor %} -{%- endif %} -{%- endfor %} -{%- endif %} -{%- endfor %} \ No newline at end of file +{% endfor %} +{% endif %} +{% endfor %} +{% endif %} +{% endfor %} + +# noqa: W391 \ No newline at end of file diff --git a/data/templates/xap/client/python/types.py.j2 b/data/templates/xap/client/python/types.py.j2 index 0c49de3e133..76f9614e4e3 100644 --- a/data/templates/xap/client/python/types.py.j2 +++ b/data/templates/xap/client/python/types.py.j2 @@ -4,6 +4,7 @@ from collections import namedtuple from enum import IntFlag, IntEnum from struct import Struct + {% macro gen_struct(name, members, fmt) -%} class {{ name }}(namedtuple('{{ name }}', '{{ members }}')): fmt = Struct('{{ fmt }}') @@ -31,16 +32,16 @@ class {{ name }}(namedtuple('{{ name }}', '{{ members }}')): {% for item in type_definitions -%}{{ gen_struct(item.name, item.members, item.fmt) }}{% endfor -%} # Spec structs -{%- for item in xap.routes.values() recursive -%} +{% for item in xap.routes.values() recursive %} {%- if item.routes -%} {{ loop(item.routes.values()) }} {%- endif -%} - {% if item.request_struct_members %} + {%- if item.request_struct_members %} # TODO: gen inbound object for {{ item.define | to_snake }} - {%- endif -%} - {% if item.return_struct_members %} + {% endif -%} + {%- if item.return_struct_members %} # TODO: gen outbound object for {{ item.define | to_snake }} - {%- endif -%} + {% endif %} {%- endfor %} @@ -51,14 +52,16 @@ class XAPSecureStatus(IntEnum): class XAPEventType(IntEnum): -{%- for id, message in xap.broadcast_messages.messages | dictsort %} +{% for id, message in xap.broadcast_messages.messages | dictsort %} {{ message.define }} = {{ id }} -{%- endfor %} +{% endfor %} class XAPFlags(IntFlag): -{%- for bitnum, bitinfo in xap.response_flags.bits | dictsort %} -{%- if bitinfo.define != "-" %} +{% for bitnum, bitinfo in xap.response_flags.bits | dictsort %} +{% if bitinfo.define != "-" %} {{ bitinfo.define }} = 1 << {{ bitnum }} -{%- endif %} -{%- endfor %} +{% endif %} +{% endfor %} + +# noqa: W391 diff --git a/lib/python/xap_client/constants.py b/lib/python/xap_client/constants.py index f78b1356964..cfde7e153b3 100644 --- a/lib/python/xap_client/constants.py +++ b/lib/python/xap_client/constants.py @@ -1,4 +1,4 @@ -# Copyright 2022 QMK +# Copyright 2023 QMK # SPDX-License-Identifier: GPL-2.0-or-later ################################################################################ @@ -121,3 +121,5 @@ class RgbMatrixModes(IntEnum): MULTISPLASH = 0x29 SOLID_SPLASH = 0x2A SOLID_MULTISPLASH = 0x2B + +# noqa: W391 diff --git a/lib/python/xap_client/routes.py b/lib/python/xap_client/routes.py index 12f3c426f2d..b30138b48df 100644 --- a/lib/python/xap_client/routes.py +++ b/lib/python/xap_client/routes.py @@ -1,4 +1,4 @@ -# Copyright 2022 QMK +# Copyright 2023 QMK # SPDX-License-Identifier: GPL-2.0-or-later ################################################################################ @@ -84,3 +84,5 @@ class XAPRoutes(): AUDIO_GET_CONFIG = b'\x07\x03' AUDIO_SET_CONFIG = b'\x07\x04' AUDIO_SAVE_CONFIG = b'\x07\x05' + +# noqa: W391 diff --git a/lib/python/xap_client/types.py b/lib/python/xap_client/types.py index bfdf48961fe..ce75cebab9f 100644 --- a/lib/python/xap_client/types.py +++ b/lib/python/xap_client/types.py @@ -1,4 +1,4 @@ -# Copyright 2022 QMK +# Copyright 2023 QMK # SPDX-License-Identifier: GPL-2.0-or-later ################################################################################ @@ -133,3 +133,5 @@ class XAPEventType(IntEnum): class XAPFlags(IntFlag): SUCCESS = 1 << 0 SECURE_FAILURE = 1 << 1 + +# noqa: W391