mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 08:17:49 -06: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
1 changed files with 1 additions and 1 deletions
|
@ -104,7 +104,7 @@ def merge_dicts(base: Dict[str, Any], overrides: Dict[str, Any]) -> Dict[str, An
|
||||||
result[key] = val
|
result[key] = val
|
||||||
continue
|
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)
|
result[key] = merge_dicts(result[key], val)
|
||||||
else:
|
else:
|
||||||
result[key] = val
|
result[key] = val
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue