Beispiel #1
0
def dict_to_dict_with_set(act: Dict) -> Dict:
    return modify_dict(act, {'level': lambda v: set(v)})
Beispiel #2
0
def edge_dict_to_node_dict_with_list(act: Dict) -> Dict:
    return modify_dict(act, {'level': lambda v: sorted(list(v))})
Beispiel #3
0
def reduce_node_dict(acc: Dict[str, Set], act: Dict[str,
                                                    Set]) -> Dict[str, Set]:
    return modify_dict(
        acc, {'level': lambda acc_level: acc_level | act.get('level', {})})
Beispiel #4
0
def node_dict_to_edge_dict_with_list(act: Dict) -> Dict:
    return modify_dict(
        act,
        {'level': lambda lvls: {k: sorted(list(v))
                                for k, v in lvls.items()}})
Beispiel #5
0
def merge_level(acc_level: Dict[str, Any],
                act_level: Dict[str, Any]) -> Dict[str, Any]:
    return modify_dict(merge_dict(acc_level, act_level, lambda x: x),
                       {'level': lambda x: reduce(union_sets, x, {})},
                       lambda x: next(x))