Skip to content

Commit

Permalink
merger: add placeholder str for unified stats
Browse files Browse the repository at this point in the history
Signed-off-by: Mihai Bivol <mm.bivol@gmail.com>
  • Loading branch information
mihaibivol committed May 9, 2016
1 parent 20a16c5 commit dff5488
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions json_merger/merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
set_obj_at_key_path
)

PLACEHOLDER_STR = "#$PLACEHOLDER$#"


class ListAlignMerger(object):

Expand Down Expand Up @@ -86,11 +88,11 @@ def _build_aligned_lists_and_stats(self, list_unifier, key_path):
head_list = []
update_list = []
for root_obj, head_obj, update_obj in list_unifier.unified:
# Cast NOTHING objects to None so we reserialize back to JSON
# if needed.
root_list.append(root_obj or None)
head_list.append(head_obj or None)
update_list.append(update_obj or None)
# Cast NOTHING objects to a placeholder so we reserialize back to
# JSON if needed.
root_list.append(root_obj or PLACEHOLDER_STR)
head_list.append(head_obj or PLACEHOLDER_STR)
update_list.append(update_obj or PLACEHOLDER_STR)

# If we can't set that key path a list to be merged wasn't there
# In the first place.
Expand Down

0 comments on commit dff5488

Please sign in to comment.