Skip to content

Commit

Permalink
Merge pull request #32 from AstarVienna/fh/propdict
Browse files Browse the repository at this point in the history
Allow for empty "properties" subdict
  • Loading branch information
teutoburg authored Feb 16, 2024
2 parents 74dee4d + ce08c1e commit 3905bde
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions astar_utils/nested_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ def update(self, new_dict: MutableMapping[str, Any]) -> None:
new_dict = new_dict.dic # Avoid updating with another one

# TODO: why do we check for dict here but not in the else?
if isinstance(new_dict, Mapping) \
and "alias" in new_dict \
and "properties" in new_dict:
if isinstance(new_dict, Mapping) and "alias" in new_dict:
alias = new_dict["alias"]
propdict = new_dict.get("properties", {})
if alias in self.dic:
self.dic[alias] = recursive_update(self.dic[alias],
new_dict["properties"])
self.dic[alias] = recursive_update(self.dic[alias], propdict)
else:
self.dic[alias] = new_dict["properties"]
self.dic[alias] = propdict
elif isinstance(new_dict, Sequence):
# To catch list of tuples
self.update(dict([new_dict]))
Expand Down

0 comments on commit 3905bde

Please sign in to comment.