Skip to content

Commit

Permalink
settings: avoid duplicated list items when merging
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippvK committed Mar 4, 2024
1 parent 386a8ed commit dc5ed75
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion seal5/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ def merge(self, other: "YAMLSettings", overwrite: bool = False):
elif isinstance(v1, list):
if overwrite:
v2.clear()
v2.extend(v1)
# duplicates are dropped here
new = [x for x in v1 if x not in v2]
v2.extend(new)
else:
assert isinstance(
v2, (int, float, str, bool, Path)
Expand Down

0 comments on commit dc5ed75

Please sign in to comment.