Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/RalfG/cascade-config
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfG committed Nov 15, 2021
2 parents 5ddb68b + c605337 commit c3c5adc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cascade_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ def _update_dict_recursively(self, original: Dict, updater: Dict) -> Dict:
"""Update dictionary recursively."""
for k, v in updater.items():
if isinstance(v, dict):
original[k] = self._update_dict_recursively(original.get(k, {}), v)
if not v: # v is not None, v is empty dictionary
original[k] = dict()
else:
original[k] = self._update_dict_recursively(original.get(k, {}), v)
elif isinstance(v, bool):
original[k] = v # v is True or False
elif v or k not in original: # v is not None, or key does not exist yet
original[k] = v
elif self.none_overrides_value: # v is None, but can override previous value
Expand Down

0 comments on commit c3c5adc

Please sign in to comment.