summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2023-02-22 22:50:09 +0000
committerGitHub <noreply@github.com>2023-02-23 09:50:09 +1100
commit9f2cd9119f18deb824ef7840c69f97c635b485cd (patch)
tree1d4a3dbf4f5584cc2ada10bee7ff5857e3b916d1 /lib
parent961f0b7b2de54f988daf4ce7b791f91a33e55612 (diff)
Reallocate user/kb keycode ranges (#19907)
Diffstat (limited to 'lib')
-rw-r--r--lib/python/qmk/json_schema.py3
-rw-r--r--lib/python/qmk/keycodes.py1
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/python/qmk/json_schema.py b/lib/python/qmk/json_schema.py
index c886a0d868..b00df749cc 100644
--- a/lib/python/qmk/json_schema.py
+++ b/lib/python/qmk/json_schema.py
@@ -107,6 +107,7 @@ def deep_update(origdict, newdict):
def merge_ordered_dicts(dicts):
"""Merges nested OrderedDict objects resulting from reading a hjson file.
Later input dicts overrides earlier dicts for plain values.
+ If any value is "!delete!", the existing value will be removed from its parent.
Arrays will be appended. If the first entry of an array is "!reset!", the contents of the array will be cleared and replaced with RHS.
Dictionaries will be recursively merged. If any entry is "!reset!", the contents of the dictionary will be cleared and replaced with RHS.
"""
@@ -125,6 +126,8 @@ def merge_ordered_dicts(dicts):
target[k] = v[1:]
else:
target[k] = target[k] + v
+ elif v == "!delete!" and isinstance(target, (OrderedDict, dict)):
+ del target[k]
else:
target[k] = v
diff --git a/lib/python/qmk/keycodes.py b/lib/python/qmk/keycodes.py
index d2f2492829..966930547c 100644
--- a/lib/python/qmk/keycodes.py
+++ b/lib/python/qmk/keycodes.py
@@ -90,6 +90,7 @@ def load_spec(version, lang=None):
# Sort?
spec['keycodes'] = dict(sorted(spec.get('keycodes', {}).items()))
+ spec['ranges'] = dict(sorted(spec.get('ranges', {}).items()))
# Validate?
_validate(spec)