diff options
Diffstat (limited to 'lib/python')
-rw-r--r-- | lib/python/qmk/json_schema.py | 3 | ||||
-rw-r--r-- | lib/python/qmk/keycodes.py | 1 |
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) |