(A, B)
Function for appending underlying arrays (A and B) or list/tuple of arrays B to an array A
Function for appending underlying arrays (A and B) or list/tuple of arrays B to an array A
Function for appending underlying arrays ( A and B ) or list / tuple of arrays B to an array A
def hpat_arrays_append_overload(A, B):
    """Function for appending underlying arrays (A and B) or list/tuple of arrays B to an array A"""

    if not isinstance(A, sdc_pandas_df_column_types):
        return None

    # this function should work with arrays, not indexes, but until all indexes support
    # common API (e.g. append is not supported for types.Array indexes) it is simplier to support
    # indexes here rather than branch depending on index types on call site
    # TO-DO: clean-up when Float64Index and StringArrayIndex are supported
    # if not (isinstance(B, sdc_pandas_df_column_types) or isinstance(B.dtype, sdc_pandas_df_column_types)):
    #     return None
    valid_num_single_B_dtype = (types.Array, ) + sdc_pandas_index_types
    valid_num_seq_B_dtypes = (types.Array, ) + sdc_pandas_index_types

    if isinstance(A, types.Array):
        if isinstance(B, valid_num_single_B_dtype):
            convert_B = not isinstance(B, types.Array)
            def _append_single_numeric_impl(A, B):
                _B = B if convert_B == False else B.values  # noqa
                return numpy.concatenate((A, _B,))

            return _append_single_numeric_impl

        elif (isinstance(B, (types.UniTuple, types.List)) and isinstance(B.dtype, valid_num_seq_B_dtypes)):
            numba_common_dtype = find_common_dtype_from_numpy_dtypes([A.dtype, B.dtype.dtype], [])

            convert_B = not isinstance(B.dtype, types.Array)
            # TODO: refactor to use numpy.concatenate when Numba supports building a tuple at runtime
            def _append_list_numeric_impl(A, B):

                total_length = len(A) + numpy.array([len(arr) for arr in B]).sum()
                new_data = numpy.empty(total_length, numba_common_dtype)

                stop = len(A)
                new_data[:stop] = A
                for arr in B:
                    start = stop
                    stop = start + len(arr)
                    if convert_B == False:   # noqa
                        new_data[start:stop] = arr
                    else:
                        new_data[start:stop] = arr.values
                return new_data

            return _append_list_numeric_impl

    elif A == string_array_type:
        if B == string_array_type:
            def _append_single_string_array_impl(A, B):
                total_size = len(A) + len(B)
                total_chars = num_total_chars(A) + num_total_chars(B)
                new_data = sdc.str_arr_ext.pre_alloc_string_array(total_size, total_chars)

                pos = 0
                pos += append_string_array_to(new_data, pos, A)
                pos += append_string_array_to(new_data, pos, B)

                return new_data

            return _append_single_string_array_impl
        elif (isinstance(B, (types.UniTuple, types.List)) and B.dtype == string_array_type):
            def _append_list_string_array_impl(A, B):
                array_list = [A] + list(B)
                total_size = numpy.array([len(arr) for arr in array_list]).sum()
                total_chars = numpy.array([num_total_chars(arr) for arr in array_list]).sum()

                new_data = sdc.str_arr_ext.pre_alloc_string_array(total_size, total_chars)

                pos = 0
                pos += append_string_array_to(new_data, pos, A)
                for arr in B:
                    pos += append_string_array_to(new_data, pos, arr)

                return new_data

            return _append_list_string_array_impl
def hpat_arrays_append_overload ( A , B ) : if not isinstance ( A , sdc_pandas_df_column_types ) : return None # this function should work with arrays, not indexes, but until all indexes support # common API (e.g. append is not supported for types.Array indexes) it is simplier to support # indexes here rather than branch depending on index types on call site # TO-DO: clean-up when Float64Index and StringArrayIndex are supported # if not (isinstance(B, sdc_pandas_df_column_types) or isinstance(B.dtype, sdc_pandas_df_column_types)): #     return None valid_num_single_B_dtype = ( types . Array , ) + sdc_pandas_index_types valid_num_seq_B_dtypes = ( types . Array , ) + sdc_pandas_index_types if isinstance ( A , types . Array ) : if isinstance ( B , valid_num_single_B_dtype ) : convert_B = not isinstance ( B , types . Array ) def _append_single_numeric_impl ( A , B ) : _B = B if convert_B == False else B . values # noqa return numpy . concatenate ( ( A , _B , ) ) return _append_single_numeric_impl elif ( isinstance ( B , ( types . UniTuple , types . List ) ) and isinstance ( B . dtype , valid_num_seq_B_dtypes ) ) : numba_common_dtype = find_common_dtype_from_numpy_dtypes ( [ A . dtype , B . dtype . dtype ] , [ ] ) convert_B = not isinstance ( B . dtype , types . Array ) # TODO: refactor to use numpy.concatenate when Numba supports building a tuple at runtime def _append_list_numeric_impl ( A , B ) : total_length = len ( A ) + numpy . array ( [ len ( arr ) for arr in B ] ) . sum ( ) new_data = numpy . empty ( total_length , numba_common_dtype ) stop = len ( A ) new_data [ : stop ] = A for arr in B : start = stop stop = start + len ( arr ) if convert_B == False : # noqa new_data [ start : stop ] = arr else : new_data [ start : stop ] = arr . values return new_data return _append_list_numeric_impl elif A == string_array_type : if B == string_array_type : def _append_single_string_array_impl ( A , B ) : total_size = len ( A ) + len ( B ) total_chars = num_total_chars ( A ) + num_total_chars ( B ) new_data = sdc . str_arr_ext . pre_alloc_string_array ( total_size , total_chars ) pos = 0 pos += append_string_array_to ( new_data , pos , A ) pos += append_string_array_to ( new_data , pos , B ) return new_data return _append_single_string_array_impl elif ( isinstance ( B , ( types . UniTuple , types . List ) ) and B . dtype == string_array_type ) : def _append_list_string_array_impl ( A , B ) : array_list = [ A ] + list ( B ) total_size = numpy . array ( [ len ( arr ) for arr in array_list ] ) . sum ( ) total_chars = numpy . array ( [ num_total_chars ( arr ) for arr in array_list ] ) . sum ( ) new_data = sdc . str_arr_ext . pre_alloc_string_array ( total_size , total_chars ) pos = 0 pos += append_string_array_to ( new_data , pos , A ) for arr in B : pos += append_string_array_to ( new_data , pos , arr ) return new_data return _append_list_string_array_impl