Skip to content

Instantly share code, notes, and snippets.

@AABur
Last active October 19, 2020 10:11
Show Gist options
  • Select an option

  • Save AABur/eddd15dffa324b7e9f12f08a062e3577 to your computer and use it in GitHub Desktop.

Select an option

Save AABur/eddd15dffa324b7e9f12f08a062e3577 to your computer and use it in GitHub Desktop.
COLOR_RED = '\033[31m'
COLOR_PURPLE = '\033[35m'
COLOR_RESET = '\033[m'
ADDED_STR = 'Property \033[35m{0}\033[m was \033[31madded\033[m with value: \033[35m{1}\033[m'
REMOVED_STR = 'Property \033[35m{0}\033[m was \033[31mremoved\033[m'
UPDATED_STR = 'Property \033[35m{0}\033[m was \033[31mupdated\033[m. From \033[35m{1}\033[m to \033[35m{2}\033[m'
# ADDED_STR = 'Property {0} was added with value: {1}'
# REMOVED_STR = 'Property {0} was removed'
# UPDATED_STR = 'Property {0} was updated. From {1} to {2}'
def print_plain(source):
plain = ''
for k1, v1 in source.items():
if v1[0] == UNCHANGED:
continue
if v1[0] == ADDED:
plain = plain + ADDED_STR.format(k1, v1[1]) + '\n'
elif v1[0] == REMOVED:
plain = plain + REMOVED_STR.format(k1) + '\n'
elif v1[0] == UPDATED:
plain = plain + UPDATED_STR.format(k1, v1[1], v1[2]) + '\n'
return plain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment