Skip to content

Commit 624500f

Browse files
authored
Merge pull request #327 from kayjan/feature/tree-diff-naming
Rename variables in tree_diff
2 parents 2698a4a + c4161b7 commit 624500f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

bigtree/tree/helper.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,8 @@ def add_suffix_to_data(
543543
add_suffix_to_data(data_both, paths_added, moved_to_ind, "+", "moved to", "added")
544544

545545
# Check tree attribute difference
546-
path_changes_list_of_dict: List[Dict[str, Dict[str, Any]]] = []
547-
path_changes_deque: Deque[str] = deque([])
546+
path_to_attrs_diff: List[Dict[str, Dict[str, Any]]] = []
547+
paths_with_attr_diff: Deque[str] = deque([])
548548
for attr_change in attr_list:
549549
condition_diff = (
550550
(
@@ -565,27 +565,27 @@ def add_suffix_to_data(
565565
)
566566
dict_attr_diff = [{attr_change: v} for v in tuple_diff]
567567
dict_path_diff = dict(list(zip(data_diff[path_col], dict_attr_diff)))
568-
path_changes_list_of_dict.append(dict_path_diff)
569-
path_changes_deque.extend(list(data_diff[path_col]))
568+
path_to_attrs_diff.append(dict_path_diff)
569+
paths_with_attr_diff.extend(list(data_diff[path_col]))
570570

571571
if only_diff:
572572
data_both = data_both[
573573
(data_both[indicator_col] != "both")
574-
| (data_both[path_col].isin(path_changes_deque))
574+
| (data_both[path_col].isin(paths_with_attr_diff))
575575
]
576576
data_both = data_both[[path_col]].sort_values(path_col)
577577
if len(data_both):
578578
tree_diff = construct.dataframe_to_tree(
579579
data_both, node_type=tree.__class__, sep=tree.sep
580580
)
581581
# Handle tree attribute difference
582-
if len(path_changes_deque):
583-
path_changes_list = sorted(path_changes_deque, reverse=True)
582+
if len(paths_with_attr_diff):
583+
path_changes_list = sorted(paths_with_attr_diff, reverse=True)
584584
name_changes_list = [
585585
{k: {"name": f"{k.split(tree.sep)[-1]} (~)"} for k in path_changes_list}
586586
]
587-
path_changes_list_of_dict.extend(name_changes_list)
588-
for attr_change_dict in path_changes_list_of_dict:
587+
path_to_attrs_diff.extend(name_changes_list)
588+
for attr_change_dict in path_to_attrs_diff:
589589
tree_diff = construct.add_dict_to_tree_by_path(
590590
tree_diff, attr_change_dict
591591
)

0 commit comments

Comments
 (0)