def generic(self, args, kws): from sdc.str_arr_ext import is_str_arr_typ assert not kws [va, vb] = args # if one of the inputs is string array if is_str_series_typ(va) or is_str_series_typ(vb): # inputs should be either string array or string assert is_str_arr_typ(va) or va == string_type assert is_str_arr_typ(vb) or vb == string_type return signature(SeriesType(types.boolean), va, vb) if ((is_dt64_series_typ(va) and vb == string_type) or (is_dt64_series_typ(vb) and va == string_type)): return signature(SeriesType(types.boolean), va, vb)
def populate_str_arr_from_set(typingctx, in_set_typ, in_str_arr_typ=None): assert in_set_typ == set_string_type assert is_str_arr_typ(in_str_arr_typ) def codegen(context, builder, sig, args): in_set, in_str_arr = args string_array = context.make_helper(builder, string_array_type, in_str_arr) fnty = lir.FunctionType(lir.VoidType(), [lir.IntType(8).as_pointer(), lir.IntType(32).as_pointer(), lir.IntType(8).as_pointer(), ]) fn_getitem = builder.module.get_or_insert_function(fnty, name="populate_str_arr_from_set") builder.call(fn_getitem, [in_set, string_array.offsets, string_array.data]) return context.get_dummy_value() return types.void(set_string_type, string_array_type), codegen
def init_set_string_array(A): if is_str_arr_typ(A): return _build_str_set_impl
def build_set(A): if is_str_arr_typ(A): return _build_str_set_impl else: return lambda A: set(A)