vflow/convert.py
def combine_dicts(*args: dict, base_case=True):
    '''Combines any number of dictionaries into a single dictionary. Dictionaries
    are combined left to right, matching on the subkeys of the arg that has
    fewer matching requirements.
    '''
    n_args = len(args)
    combined_dict = {}
    if n_args == 0:
        return combined_dict
    elif n_args == 1:
        for k in args[0]:
            # wrap the dict values in tuples; this is helpful so that when we
            # pass the values to a module fun in we can just use * expansion
            if k != PREV_KEY:
                combined_dict[k] = (args[0][k],)
            else:
                combined_dict[k] = args[0][k]
        return combined_dict
    elif n_args == 2:
        for k0 in args[0]:
            for k1 in args[1]:

                if k0 == PREV_KEY or k1 == PREV_KEY:
                    continue

                combined_key = combine_keys(k0, k1)

                if len(combined_key) > 0:
                    if base_case:
                        combined_dict[combined_key] = (args[0][k0], args[1][k1])
                    else:
                        combined_dict[combined_key] = args[0][k0] + (args[1][k1],)

        prev_tup = ()
        for i in range(2):
            if PREV_KEY in args[i]:
                prev_tup += args[i][PREV_KEY]
        combined_dict[PREV_KEY] = prev_tup
        return combined_dict
    else:
        # combine the first two dicts and call recursively with remaining args
        return combine_dicts(combine_dicts(args[0], args[1]), *args[2:], base_case=False)
Combines any number of dictionaries into a single dictionary. Dictionaries
    are combined left to right, matching on the subkeys of the arg that has
    fewer matching requirements.
    
Combines any number of dictionaries into a single dictionary. Dictionaries
are combined left to right, matching on the subkeys of the arg that has
fewer matching requirements.
Combines any number of dictionaries into a single dictionary . Dictionaries are combined left to right matching on the subkeys of the arg that has fewer matching requirements .
def combine_dicts(*args: dict, base_case=True):
    n_args = len(args)
    combined_dict = {}
    if n_args == 0:
        return combined_dict
    elif n_args == 1:
        for k in args[0]:
            if k != PREV_KEY:
                combined_dict[k] = (args[0][k],)
            else:
                combined_dict[k] = args[0][k]
        return combined_dict
    elif n_args == 2:
        for k0 in args[0]:
            for k1 in args[1]:
                if k0 == PREV_KEY or k1 == PREV_KEY:
                    continue
                combined_key = combine_keys(k0, k1)
                if len(combined_key) > 0:
                    if base_case:
                        combined_dict[combined_key] = (args[0][k0], args[1][k1])
                    else:
                        combined_dict[combined_key] = args[0][k0] + (args[1][k1],)
        prev_tup = ()
        for i in range(2):
            if PREV_KEY in args[i]:
                prev_tup += args[i][PREV_KEY]
        combined_dict[PREV_KEY] = prev_tup
        return combined_dict
    else:
        return combine_dicts(combine_dicts(args[0], args[1]), *args[2:], base_case=False)
def combine_dicts ( * args : dict , base_case = True ) : n_args = len ( args ) combined_dict = { } if n_args == 0 : return combined_dict elif n_args == 1 : for k in args [ 0 ] : if k != PREV_KEY : combined_dict [ k ] = ( args [ 0 ] [ k ] , ) else : combined_dict [ k ] = args [ 0 ] [ k ] return combined_dict elif n_args == 2 : for k0 in args [ 0 ] : for k1 in args [ 1 ] : if k0 == PREV_KEY or k1 == PREV_KEY : continue combined_key = combine_keys ( k0 , k1 ) if len ( combined_key ) > 0 : if base_case : combined_dict [ combined_key ] = ( args [ 0 ] [ k0 ] , args [ 1 ] [ k1 ] ) else : combined_dict [ combined_key ] = args [ 0 ] [ k0 ] + ( args [ 1 ] [ k1 ] , ) prev_tup = ( ) for i in range ( 2 ) : if PREV_KEY in args [ i ] : prev_tup += args [ i ] [ PREV_KEY ] combined_dict [ PREV_KEY ] = prev_tup return combined_dict else : return combine_dicts ( combine_dicts ( args [ 0 ] , args [ 1 ] ) , * args [ 2 : ] , base_case = False )
Combines any number of dictionaries into a single dictionary.
Combines any number of dictionaries into a single dictionary .
'''Combines any number of dictionaries into a single dictionary. Dictionaries
    are combined left to right, matching on the subkeys of the arg that has
    fewer matching requirements.
    ''' # wrap the dict values in tuples; this is helpful so that when we # pass the values to a module fun in we can just use * expansion # combine the first two dicts and call recursively with remaining args
args
dict
base_case