3636from numba .extending import (models , overload , register_model , make_attribute_wrapper , intrinsic )
3737from numba .datamodel import (register_default , StructModel )
3838from numba .typing .templates import signature
39+ from sdc .hiframes .split_impl import SplitViewStringMethodsType , StringArraySplitViewType
3940
4041
4142class StringMethodsType (types .IterableType ):
@@ -50,7 +51,8 @@ class StringMethodsType(types.IterableType):
5051
5152 def __init__ (self , data ):
5253 self .data = data
53- super (StringMethodsType , self ).__init__ ('StringMethodsType' )
54+ name = 'StringMethodsType({})' .format (self .data )
55+ super (StringMethodsType , self ).__init__ (name )
5456
5557 @property
5658 def iterator_type (self ):
@@ -74,37 +76,47 @@ def __init__(self, dmm, fe_type):
7476make_attribute_wrapper (StringMethodsType , 'data' , '_data' )
7577
7678
77- @intrinsic
78- def _hpat_pandas_stringmethods_init (typingctx , data ):
79- """
80- Internal Numba required function to register StringMethodsType and
81- connect it with corresponding Python type mentioned in @overload(pandas.core.strings.StringMethods)
82- """
79+ def _gen_hpat_pandas_stringmethods_init (string_methods_type = None ):
80+ string_methods_type = string_methods_type or StringMethodsType
8381
84- def _hpat_pandas_stringmethods_init_codegen ( context , builder , signature , args ):
82+ def _hpat_pandas_stringmethods_init ( typingctx , data ):
8583 """
86- It is looks like it creates StringMethodsModel structure
87-
88- - Fixed number of parameters. Must be 4
89- - increase reference count for the data
84+ Internal Numba required function to register StringMethodsType and
85+ connect it with corresponding Python type mentioned in @overload(pandas.core.strings.StringMethods)
9086 """
9187
92- [ data_val ] = args
93- stringmethod = cgutils . create_struct_proxy ( signature . return_type )( context , builder )
94- stringmethod . data = data_val
88+ def _hpat_pandas_stringmethods_init_codegen ( context , builder , signature , args ):
89+ """
90+ It is looks like it creates StringMethodsModel structure
9591
96- if context .enable_nrt :
97- context .nrt .incref (builder , data , stringmethod .data )
92+ - Fixed number of parameters. Must be 4
93+ - increase reference count for the data
94+ """
9895
99- return stringmethod ._getvalue ()
96+ [data_val ] = args
97+ stringmethod = cgutils .create_struct_proxy (signature .return_type )(context , builder )
98+ stringmethod .data = data_val
10099
101- ret_typ = StringMethodsType (data )
102- sig = signature (ret_typ , data )
103- """
104- Construct signature of the Numba SeriesGroupByType::ctor()
105- """
100+ if context .enable_nrt :
101+ context .nrt .incref (builder , data , stringmethod .data )
106102
107- return sig , _hpat_pandas_stringmethods_init_codegen
103+ return stringmethod ._getvalue ()
104+
105+ ret_typ = string_methods_type (data )
106+ sig = signature (ret_typ , data )
107+ """
108+ Construct signature of the Numba SeriesGroupByType::ctor()
109+ """
110+
111+ return sig , _hpat_pandas_stringmethods_init_codegen
112+
113+ return _hpat_pandas_stringmethods_init
114+
115+
116+ _hpat_pandas_stringmethods_init = intrinsic (
117+ _gen_hpat_pandas_stringmethods_init (string_methods_type = StringMethodsType ))
118+ _hpat_pandas_split_view_stringmethods_init = intrinsic (
119+ _gen_hpat_pandas_stringmethods_init (string_methods_type = SplitViewStringMethodsType ))
108120
109121
110122@overload (pandas .core .strings .StringMethods )
@@ -113,6 +125,11 @@ def hpat_pandas_stringmethods(obj):
113125 Special Numba procedure to overload Python type pandas.core.strings.StringMethods::ctor()
114126 with Numba registered model
115127 """
128+ if isinstance (obj .data , StringArraySplitViewType ):
129+ def hpat_pandas_split_view_stringmethods_impl (obj ):
130+ return _hpat_pandas_split_view_stringmethods_init (obj )
131+
132+ return hpat_pandas_split_view_stringmethods_impl
116133
117134 def hpat_pandas_stringmethods_impl (obj ):
118135 return _hpat_pandas_stringmethods_init (obj )
0 commit comments