Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #18 from Caleydo/stoiber/17_KeyError_in_diff_finder
Browse files Browse the repository at this point in the history
Fix KeyError in _diff_finder.py_
  • Loading branch information
Holger Stitz authored Oct 31, 2019
2 parents dd5af07 + e81b779 commit d9e28a7
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions taco_server/src/diff_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ def serialize(self):
}

def unserialize(self, json_obj):
self.content = [] if json_obj['content'] is None else json_obj['content']
self.structure = {} if json_obj['structure'] is None else json_obj['structure']
self.merge = {} if json_obj['merge'] is None else json_obj['merge']
self.reorder = {'rows': [], 'cols': []} if json_obj['reorder'] is None else json_obj['reorder']
self.union = {} if json_obj['union'] is None else json_obj['union']
self.content = json_obj['content'] if 'content' in list(json_obj.keys()) else []
self.structure = json_obj['structure'] if 'structure' in list(json_obj.keys()) else {}
self.merge = json_obj['merge'] if 'merge' in list(json_obj.keys()) else {}
self.reorder = json_obj['reorder'] if 'reorder' in list(json_obj.keys()) else {'rows': [], 'cols': []}
self.union = json_obj['union'] if 'union' in list(json_obj.keys()) else {}
return self

def content_counts_percell(self):
Expand Down Expand Up @@ -421,7 +421,7 @@ def aggregate(self, bins, bins_col=2):
# it's the case of histogram or bar plot
result = {}
if self._direction == D_ROWS_COLS or self._direction == D_ROWS:
union_rows = self.union['ur_ids']
union_rows = self.union['ur_ids'] if 'ur_ids' in list(self.union.keys()) else []
max_height = len(union_rows)
if bins >= max_height:
# this is the case of bar plot
Expand All @@ -437,7 +437,7 @@ def aggregate(self, bins, bins_col=2):
# todo the rows might have different bins number than the cols
if self._direction == D_ROWS_COLS or self._direction == D_COLS:
# if it's the cols not the rows then switch
union_cols = self.union['uc_ids']
union_cols = self.union['uc_ids'] if 'uc_ids' in list(self.union.keys()) else []
max_width = len(union_cols)
if bins_col >= max_width:
# todo handle the > alone or?
Expand Down Expand Up @@ -540,15 +540,15 @@ def per_entity_ratios(self, dir):
# get a partial diff where every row is a diff
# 1. Partition
# get the direction
union_rows = self.union['ur_ids']
union_cols = self.union['uc_ids']
union_rows = self.union['ur_ids'] if 'ur_ids' in list(self.union.keys()) else []
union_cols = self.union['uc_ids'] if 'uc_ids' in list(self.union.keys()) else []
e_type = "rows"
row_id = "row"

if dir == D_COLS:
# if it's the cols not the rows then switch
union_rows = self.union['uc_ids']
union_cols = self.union['ur_ids']
union_rows = self.union['uc_ids'] if 'uc_ids' in list(self.union.keys()) else []
union_cols = self.union['ur_ids'] if 'ur_ids' in list(self.union.keys()) else []
# todo handle the case of both rows and columns
e_type = "cols"
row_id = "col"
Expand Down

0 comments on commit d9e28a7

Please sign in to comment.