Localize notification_utils to the API

This changeset pulls in all of the notification_utils code directly into the API and removes it as an external dependency.  We are doing this to cut down on operational maintenance of the project and will begin removing parts of it no longer needed for the API.

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
This commit is contained in:
Carlo Costino
2024-05-16 10:17:45 -04:00
parent 4cdf8b2cb2
commit 99edc88197
129 changed files with 49913 additions and 263 deletions

View File

@@ -0,0 +1,31 @@
from ordered_set import OrderedSet
from notifications_utils.insensitive_dict import InsensitiveDict
class TemplateChange:
def __init__(self, old_template, new_template):
self.old_placeholders = InsensitiveDict.from_keys(old_template.placeholders)
self.new_placeholders = InsensitiveDict.from_keys(new_template.placeholders)
@property
def has_different_placeholders(self):
return bool(self.new_placeholders.keys() ^ self.old_placeholders.keys())
@property
def placeholders_added(self):
return OrderedSet(
[
self.new_placeholders.get(key)
for key in self.new_placeholders.keys() - self.old_placeholders.keys()
]
)
@property
def placeholders_removed(self):
return OrderedSet(
[
self.old_placeholders.get(key)
for key in self.old_placeholders.keys() - self.new_placeholders.keys()
]
)