mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-11 01:08:59 +08:00
Fix testing if JSON elements are mappings
Turns out that the JSON objects extend from dict, so this works. Also turns out that strings have a __getitem__. Who knew? Done during Turbo Testing & Tooling.
This commit is contained in:
parent
b24dad1563
commit
76b5f9d37b
@ -104,7 +104,7 @@ def merge_dicts(base: Dict[str, Any], overrides: Dict[str, Any]) -> Dict[str, An
|
||||
result[key] = val
|
||||
continue
|
||||
|
||||
if hasattr(result[key], "__getitem__") and hasattr(val, "__getitem__"): # Duck typing of dicts. Also works with JSON documents for sure.
|
||||
if isinstance(result[key], dict) and isinstance(val, dict):
|
||||
result[key] = merge_dicts(result[key], val)
|
||||
else:
|
||||
result[key] = val
|
||||
|
Loading…
x
Reference in New Issue
Block a user