mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-22 01:00:02 +02:00
removes keys from cache entry if they are not part of the new value serialization
This commit is contained in:
parent
b8a52c2e6a
commit
24a01c0982
@ -273,10 +273,16 @@ def set_nested_value_by_path(
|
||||
value_type = serialized_value.pop("type")
|
||||
if "readonly" in current_dict and current_dict["type"] != "method":
|
||||
current_dict["type"] = value_type
|
||||
# TODO: this does not yet remove keys that are not present in the serialized new
|
||||
# value
|
||||
|
||||
current_dict.update(serialized_value)
|
||||
|
||||
# removes keys that are not present in the serialized new value
|
||||
keys_to_keep = set(serialized_value.keys()) | {"type", "readonly"}
|
||||
|
||||
for key in list(current_dict.keys()):
|
||||
if key not in keys_to_keep:
|
||||
current_dict.pop(key, None)
|
||||
|
||||
|
||||
def get_nested_dict_by_path(
|
||||
serialization_dict: dict[str, Any],
|
||||
|
Loading…
x
Reference in New Issue
Block a user