@@ -6,7 +6,7 @@ WARNING: DO NOT edit .pxi FILE directly, .pxi is generated from .pxi.in
66
77{{py:
88
9- # name, dtype, ttype, tfunc_type , c_type, to_c_type
9+ # name, dtype, ttype, tfunc , c_type, to_c_type
1010dtypes = [('Complex128', 'complex128', 'complex128', 'complex128', 'khcomplex128_t', 'to_khcomplex128_t'),
1111 ('Complex64', 'complex64', 'complex64', 'complex64', 'khcomplex64_t', 'to_khcomplex64_t'),
1212 ('Float64', 'float64', 'float64', 'float64', 'float64_t', ''),
@@ -23,7 +23,7 @@ dtypes = [('Complex128', 'complex128', 'complex128', 'complex128', 'khcomplex128
2323
2424}}
2525
26- {{for name, dtype, ttype, tfunc_type , c_type, to_c_type in dtypes}}
26+ {{for name, dtype, ttype, tfunc , c_type, to_c_type in dtypes}}
2727
2828
2929@cython.wraparound(False)
@@ -53,26 +53,26 @@ cdef value_count_{{dtype}}(const {{dtype}}_t[:] values, bint dropna, const uint8
5353 # result_keys remembers the original order of keys
5454
5555 result_keys = {{name}}Vector()
56- table = kh_init_{{tfunc_type }}()
56+ table = kh_init_{{tfunc }}()
5757
5858 {{if dtype == 'object'}}
5959 if uses_mask:
6060 raise NotImplementedError("uses_mask not implemented with object dtype")
6161
62- kh_resize_{{tfunc_type }}(table, n // 10)
62+ kh_resize_{{tfunc }}(table, n // 10)
6363
6464 for i in range(n):
6565 val = values[i]
6666 if not dropna or not checknull(val):
67- k = kh_get_{{tfunc_type }}(table, {{to_c_type}}val)
67+ k = kh_get_{{tfunc }}(table, {{to_c_type}}val)
6868 if k != table.n_buckets:
6969 table.vals[k] += 1
7070 else:
71- k = kh_put_{{tfunc_type }}(table, {{to_c_type}}val, &ret)
71+ k = kh_put_{{tfunc }}(table, {{to_c_type}}val, &ret)
7272 table.vals[k] = 1
7373 result_keys.append(val)
7474 {{else}}
75- kh_resize_{{tfunc_type }}(table, n)
75+ kh_resize_{{tfunc }}(table, n)
7676
7777 for i in range(n):
7878 val = {{to_c_type}}(values[i])
@@ -88,11 +88,11 @@ cdef value_count_{{dtype}}(const {{dtype}}_t[:] values, bint dropna, const uint8
8888 if uses_mask and isna_entry:
8989 na_counter += 1
9090 else:
91- k = kh_get_{{tfunc_type }}(table, val)
91+ k = kh_get_{{tfunc }}(table, val)
9292 if k != table.n_buckets:
9393 table.vals[k] += 1
9494 else:
95- k = kh_put_{{tfunc_type }}(table, val, &ret)
95+ k = kh_put_{{tfunc }}(table, val, &ret)
9696 table.vals[k] = 1
9797 result_keys.append(val)
9898 {{endif}}
@@ -105,17 +105,17 @@ cdef value_count_{{dtype}}(const {{dtype}}_t[:] values, bint dropna, const uint8
105105
106106 for i in range(table.size):
107107 {{if dtype == 'object'}}
108- k = kh_get_{{tfunc_type }}(table, result_keys.data[i])
108+ k = kh_get_{{tfunc }}(table, result_keys.data[i])
109109 {{else}}
110- k = kh_get_{{tfunc_type }}(table, result_keys.data.data[i])
110+ k = kh_get_{{tfunc }}(table, result_keys.data.data[i])
111111 {{endif}}
112112 result_counts[i] = table.vals[k]
113113
114114 if na_counter > 0:
115115 result_counts[table.size] = na_counter
116116 result_keys.append(val)
117117
118- kh_destroy_{{tfunc_type }}(table)
118+ kh_destroy_{{tfunc }}(table)
119119
120120 return result_keys.to_array(), result_counts.base, na_counter
121121
@@ -136,12 +136,12 @@ cdef duplicated_{{dtype}}(const {{dtype}}_t[:] values, object keep='first', cons
136136 {{endif}}
137137 Py_ssize_t i, n = len(values), first_na = -1
138138 khiter_t k
139- kh_{{ttype}}_t *table = kh_init_{{tfunc_type }}()
139+ kh_{{ttype}}_t *table = kh_init_{{tfunc }}()
140140 ndarray[uint8_t, ndim=1, cast=True] out = np.empty(n, dtype='bool')
141141 bint seen_na = False, uses_mask = mask is not None
142142 bint seen_multiple_na = False
143143
144- kh_resize_{{tfunc_type }}(table, min(kh_needed_n_buckets(n), SIZE_HINT_LIMIT))
144+ kh_resize_{{tfunc }}(table, min(kh_needed_n_buckets(n), SIZE_HINT_LIMIT))
145145
146146 if keep not in ('last', 'first', False):
147147 raise ValueError('keep must be either "first", "last" or False')
@@ -166,7 +166,7 @@ cdef duplicated_{{dtype}}(const {{dtype}}_t[:] values, object keep='first', cons
166166 seen_na = True
167167 else:
168168 value = {{to_c_type}}(values[i])
169- kh_put_{{tfunc_type }}(table, value, &ret)
169+ kh_put_{{tfunc }}(table, value, &ret)
170170 out[i] = ret == 0
171171 {{endfor}}
172172
@@ -191,16 +191,16 @@ cdef duplicated_{{dtype}}(const {{dtype}}_t[:] values, object keep='first', cons
191191
192192 else:
193193 value = {{to_c_type}}(values[i])
194- k = kh_get_{{tfunc_type }}(table, value)
194+ k = kh_get_{{tfunc }}(table, value)
195195 if k != table.n_buckets:
196196 out[table.vals[k]] = 1
197197 out[i] = 1
198198 else:
199- k = kh_put_{{tfunc_type }}(table, value, &ret)
199+ k = kh_put_{{tfunc }}(table, value, &ret)
200200 table.vals[k] = i
201201 out[i] = 0
202202
203- kh_destroy_{{tfunc_type }}(table)
203+ kh_destroy_{{tfunc }}(table)
204204 return out
205205
206206
@@ -241,11 +241,11 @@ cdef ismember_{{dtype}}(const {{dtype}}_t[:] arr, const {{dtype}}_t[:] values):
241241 {{c_type}} val
242242 {{endif}}
243243
244- kh_{{ttype}}_t *table = kh_init_{{tfunc_type }}()
244+ kh_{{ttype}}_t *table = kh_init_{{tfunc }}()
245245
246246 # construct the table
247247 n = len(values)
248- kh_resize_{{tfunc_type }}(table, n)
248+ kh_resize_{{tfunc }}(table, n)
249249
250250 {{if dtype == 'object'}}
251251 if True:
@@ -254,7 +254,7 @@ cdef ismember_{{dtype}}(const {{dtype}}_t[:] arr, const {{dtype}}_t[:] values):
254254 {{endif}}
255255 for i in range(n):
256256 val = {{to_c_type}}(values[i])
257- kh_put_{{tfunc_type }}(table, val, &ret)
257+ kh_put_{{tfunc }}(table, val, &ret)
258258
259259 # test membership
260260 n = len(arr)
@@ -267,10 +267,10 @@ cdef ismember_{{dtype}}(const {{dtype}}_t[:] arr, const {{dtype}}_t[:] values):
267267 {{endif}}
268268 for i in range(n):
269269 val = {{to_c_type}}(arr[i])
270- k = kh_get_{{tfunc_type }}(table, val)
270+ k = kh_get_{{tfunc }}(table, val)
271271 result[i] = (k != table.n_buckets)
272272
273- kh_destroy_{{tfunc_type }}(table)
273+ kh_destroy_{{tfunc }}(table)
274274 return result.view(np.bool_)
275275
276276# ----------------------------------------------------------------------
0 commit comments