qmk-keychron-q3-colemak-dh/lib/python/qmk
Sergey Vlasov 1411c79aef
qmk find: Fix handling of functions in filters (#21090)
Functions in filters did not work properly except when used in the last
(or only) filter.  The problem was caused by the peculiarity of the
`lambda` behavior in Python — any variables from the outer scope are
captured only by reference, therefore any subsequent reassignment of
those variables is propagated to all lambdas created earlier in the same
scope.  Together with the laziness of `filter()` (it returns an iterator
which performs filtering on demand) this resulted in all function
filters using the values of the `key` and `value` variables which
correspond to the last filter in the sequence, therefore the result of
filtering was wrong if some filter with a function was not the last one
in the sequence.

Apparently the shortest way to make a Python lambda capture some
variables by value is to add arguments with default values for such
variables (default values are evaluated when the lambda is created, and
any subsequent reassignments in the outer scope no longer changes them).
This makes filters with functions work properly even when such filters
are not at the last position in the sequence.
2023-05-30 19:24:19 +01:00
..
cli Fix up qmk find when not specifying filters. (#21059) 2023-05-27 13:23:07 +10:00
tests Update json2c to use dump_lines (#21013) 2023-05-22 07:03:59 +01:00
__init__.py QMK CLI and JSON keymap support (#6176) 2019-07-15 12:14:27 -07:00
c_parse.py Merge remote-tracking branch 'origin/master' into develop 2023-03-24 02:47:22 +00:00
commands.py Append user variables to the end of make command (#20177) 2023-04-03 15:20:39 +10:00
comment_remover.py [CLI] Add a subcommand for getting information about a keyboard (#8666) 2020-05-26 13:05:41 -07:00
constants.py Remove unused LED_INDICATORS constant (#18686) 2022-10-12 22:40:53 +01:00
converter.py Add cli convert subcommand, from raw KLE to JSON (#6898) 2019-11-12 20:55:41 -08:00
datetime.py Generate api data on each push (#10609) 2020-10-25 14:48:44 -07:00
decorators.py CLI: Fix automagic (#13046) 2021-05-30 16:17:40 +01:00
errors.py CLI/c2json: Print 'cpp' error when executed in verbose mode (#12869) 2021-05-27 17:42:38 +01:00
flashers.py Allow CLI to flash .uf2 files (#19462) 2023-01-01 15:51:29 +11:00
git.py Add commit info to version.h (#19542) 2023-02-02 18:23:27 +00:00
importers.py qmk format-json: Expose full key path and respect sort_keys (#20836) 2023-05-20 22:15:05 +10:00
info.py qmk info: account for ISO enter when calculating layout X offset (#20325) 2023-04-04 01:15:35 +01:00
json_encoders.py qmk format-json: Expose full key path and respect sort_keys (#20836) 2023-05-20 22:15:05 +10:00
json_schema.py Reallocate user/kb keycode ranges (#19907) 2023-02-23 09:50:09 +11:00
keyboard.py Replace list_keyboards.sh with CLI calls (#19485) 2023-01-03 14:15:29 +11:00
keycodes.py Reallocate user/kb keycode ranges (#19907) 2023-02-23 09:50:09 +11:00
keymap.py CLI: Improve keymap folder resolution (#20981) 2023-05-19 16:05:43 +10:00
makefile.py qmk find: usability improvements (#20440) 2023-05-20 22:14:43 +10:00
math.py [CLI] Add a subcommand for getting information about a keyboard (#8666) 2020-05-26 13:05:41 -07:00
painter_qff.py Quantum Painter (#10174) 2022-04-13 18:00:18 +10:00
painter_qgf.py [QP] Fix up delta frame boundaries (#20296) 2023-03-31 08:41:11 +11:00
painter.py [Bugfix + Refactor] qmk painter-convert-graphics (#19994) 2023-05-26 03:07:06 +01:00
path.py CLI: Improve keymap folder resolution (#20981) 2023-05-19 16:05:43 +10:00
search.py qmk find: Fix handling of functions in filters (#21090) 2023-05-30 19:24:19 +01:00
submodules.py Report submodule status when not valid work-tree (#19474) 2023-01-03 09:00:29 +11:00