Refactoring merge Method into a New Class & Adding Unit Tests (#137)

This commit is contained in:
Adam Outler
2023-06-19 22:35:53 -04:00
committed by GitHub
parent 9879a9f05b
commit db3f622023
5 changed files with 219 additions and 14 deletions

View File

@@ -45,15 +45,6 @@ def efmt(err: Exception) -> str:
# =====
def merge(dest: dict, src: dict) -> None:
for key in src:
if key in dest:
if isinstance(dest[key], dict) and isinstance(src[key], dict):
merge(dest[key], src[key])
continue
dest[key] = src[key]
def rget(dct: dict, *keys: Hashable) -> dict:
result = functools.reduce((lambda nxt, key: nxt.get(key, {})), keys, dct)
if not isinstance(result, dict):