Skip to content

Commit

Permalink
improved set operations
Browse files Browse the repository at this point in the history
  • Loading branch information
addyess committed Aug 22, 2024
1 parent 39d841e commit 768eb06
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions charms/kubernetes_snaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,11 @@ def _sha256_file(config_file: str) -> hashlib.sha256:
def _dict_compare(d1, d2):
d1_keys = set(d1.keys())
d2_keys = set(d2.keys())
shared_keys = d1_keys.intersection(d2_keys)
shared_keys = d1_keys & d2_keys
added = d1_keys - d2_keys
removed = d2_keys - d1_keys
modified = {o: (d1[o], d2[o]) for o in shared_keys if d1[o] != d2[o]}
same = set(o for o in shared_keys if d1[o] == d2[o])
modified = {k: (d1[k], d2[k]) for k in shared_keys if d1[k] != d2[k]}
same = set(k for k in shared_keys if d1[k] == d2[k])
return added, removed, modified, same


Expand Down

0 comments on commit 768eb06

Please sign in to comment.