kifield/kifield.py
def combine_part_field_dicts(from_dict, to_dict, do_union=True):
    """Combine two part field dictionaries."""

    if to_dict is None or len(to_dict) == 0:
        comb_dict = deepcopy(from_dict)
    else:
        comb_dict = deepcopy(to_dict)
        to_dict_part_refs = list(to_dict.keys())

        # Go through the parts in the FROM dictionary...
        for from_ref, from_fields in list(from_dict.items()):

            # If the TO dictionary has the same part...
            if from_ref in to_dict_part_refs:
                # Then insert the fields in the FROM part into the TO part.
                comb_dict[from_ref].update(from_fields)

            # If the FROM part isn't in the TO dictionary, but a union operation is active...
            elif do_union:
                # Then add the FROM part into the TO dictionary.
                comb_dict[from_ref] = from_fields

    return comb_dict
Combine two part field dictionaries.
Combine two part field dictionaries.
Combine two part field dictionaries .
def combine_part_field_dicts(from_dict, to_dict, do_union=True):
    if to_dict is None or len(to_dict) == 0:
        comb_dict = deepcopy(from_dict)
    else:
        comb_dict = deepcopy(to_dict)
        to_dict_part_refs = list(to_dict.keys())
        for from_ref, from_fields in list(from_dict.items()):
            if from_ref in to_dict_part_refs:
                comb_dict[from_ref].update(from_fields)
            elif do_union:
                comb_dict[from_ref] = from_fields
    return comb_dict
def combine_part_field_dicts ( from_dict , to_dict , do_union = True ) : if to_dict is None or len ( to_dict ) == 0 : comb_dict = deepcopy ( from_dict ) else : comb_dict = deepcopy ( to_dict ) to_dict_part_refs = list ( to_dict . keys ( ) ) for from_ref , from_fields in list ( from_dict . items ( ) ) : if from_ref in to_dict_part_refs : comb_dict [ from_ref ] . update ( from_fields ) elif do_union : comb_dict [ from_ref ] = from_fields return comb_dict
Combine two part field dictionaries.
Combine two part field dictionaries .
"""Combine two part field dictionaries.""" # Go through the parts in the FROM dictionary... # If the TO dictionary has the same part... # Then insert the fields in the FROM part into the TO part. # If the FROM part isn't in the TO dictionary, but a union operation is active... # Then add the FROM part into the TO dictionary.
from_dict
to_dict
do_union