(typingctx, data_type)
return ret_type(data_type), codegen
This function gets tuple of pairs and repacks them into two tuples, holding
    first and seconds elements, i.e. ((a, b), (c, d), (e, f)) -> ((a, c, e), (b, d, f)).
This function gets tuple of pairs and repacks them into two tuples, holding
    first and seconds elements, i.e. ((a, b), (c, d), (e, f)) -> ((a, c, e), (b, d, f)).
This function gets tuple of pairs and repacks them into two tuples holding first and seconds elements i . e . (( a b ) ( c d ) ( e f )) - > (( a c e ) ( b d f )) .
def sdc_tuple_unzip(typingctx, data_type):
    """ This function gets tuple of pairs and repacks them into two tuples, holding
    first and seconds elements, i.e. ((a, b), (c, d), (e, f)) -> ((a, c, e), (b, d, f)). """

    _func_name = 'sdc_tuple_unzip'
    _given_args_str = f'Given: data_type={data_type}'
    assert isinstance(data_type, (types.Tuple, types.UniTuple)), \
           f"{_func_name} expects tuple as argument. {_given_args_str}"

    data_len = len(data_type)
    assert data_len > 0, f"{_func_name}: empty tuple not allowed. {_given_args_str}"

    for x in data_type:
        assert isinstance(x, (types.Tuple, types.UniTuple)) and len(x) == len(data_type[0]), \
               f"{_func_name}: non-supported tuple elements types. {_given_args_str}"

    ty_firsts, ty_seconds = map(lambda x: types.Tuple.from_types(x),
                                zip(*data_type))
    ret_type = types.Tuple([ty_firsts, ty_seconds])

    def codegen(context, builder, sig, args):
        data_val, = args

        all_firsts = []
        all_seconds = []
        for i in range(data_len):
            tup_element_i = builder.extract_value(data_val, i)
            first_i = builder.extract_value(tup_element_i, 0)
            second_i = builder.extract_value(tup_element_i, 1)

            all_firsts.append(first_i)
            all_seconds.append(second_i)

            if context.enable_nrt:
                context.nrt.incref(builder, ty_firsts[i], first_i)
                context.nrt.incref(builder, ty_seconds[i], second_i)

        first_tup = context.make_tuple(builder, ty_firsts, all_firsts)
        second_tup = context.make_tuple(builder, ty_seconds, all_seconds)
        return context.make_tuple(builder, ret_type, [first_tup, second_tup])

    return ret_type(data_type), codegen
def sdc_tuple_unzip ( typingctx , data_type ) : _func_name = 'sdc_tuple_unzip' _given_args_str = f'Given: data_type={data_type}' assert isinstance ( data_type , ( types . Tuple , types . UniTuple ) ) , f"{_func_name} expects tuple as argument. {_given_args_str}" data_len = len ( data_type ) assert data_len > 0 , f"{_func_name}: empty tuple not allowed. {_given_args_str}" for x in data_type : assert isinstance ( x , ( types . Tuple , types . UniTuple ) ) and len ( x ) == len ( data_type [ 0 ] ) , f"{_func_name}: non-supported tuple elements types. {_given_args_str}" ty_firsts , ty_seconds = map ( lambda x : types . Tuple . from_types ( x ) , zip ( * data_type ) ) ret_type = types . Tuple ( [ ty_firsts , ty_seconds ] ) def codegen ( context , builder , sig , args ) : data_val , = args all_firsts = [ ] all_seconds = [ ] for i in range ( data_len ) : tup_element_i = builder . extract_value ( data_val , i ) first_i = builder . extract_value ( tup_element_i , 0 ) second_i = builder . extract_value ( tup_element_i , 1 ) all_firsts . append ( first_i ) all_seconds . append ( second_i ) if context . enable_nrt : context . nrt . incref ( builder , ty_firsts [ i ] , first_i ) context . nrt . incref ( builder , ty_seconds [ i ] , second_i ) first_tup = context . make_tuple ( builder , ty_firsts , all_firsts ) second_tup = context . make_tuple ( builder , ty_seconds , all_seconds ) return context . make_tuple ( builder , ret_type , [ first_tup , second_tup ] ) return ret_type ( data_type ) , codegen