feat(persist/util): init parent_is_dict
Check if a parent value is of type dict This utility is helpfull for cross checking of flattened dicts
This commit is contained in:
@@ -134,6 +134,16 @@ def find_deleted_paths(
|
|||||||
return deleted_paths
|
return deleted_paths
|
||||||
|
|
||||||
|
|
||||||
|
def parent_is_dict(key: str, data: dict[str, Any]) -> bool:
|
||||||
|
parts = key.split(".")
|
||||||
|
while len(parts) > 1:
|
||||||
|
parts.pop()
|
||||||
|
parent_key = ".".join(parts)
|
||||||
|
if parent_key in data:
|
||||||
|
return isinstance(data[parent_key], dict)
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def calc_patches(
|
def calc_patches(
|
||||||
persisted: dict[str, Any],
|
persisted: dict[str, Any],
|
||||||
update: dict[str, Any],
|
update: dict[str, Any],
|
||||||
|
|||||||
Reference in New Issue
Block a user