Skip to content

Commit ebb20d0

Browse files
committed
CLN: tighten cython declarations
1 parent 36b4990 commit ebb20d0

File tree

6 files changed

+10
-8
lines changed

6 files changed

+10
-8
lines changed

pandas/_libs/index_class_helper.pxi.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ cdef class {{name}}Engine(IndexEngine):
4444
raise KeyError(val)
4545
{{endif}}
4646

47-
cdef void _call_map_locations(self, ndarray values):
48-
self.mapping.map_locations(algos.ensure_{{name.lower()}}(values))
47+
cdef void _call_map_locations(self, ndarray[{{dtype}}_t] values):
48+
self.mapping.map_locations(values)
4949

5050
cdef _maybe_get_bool_indexer(self, object val):
5151
# Returns ndarray[bool] or int

pandas/_libs/sparse.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ cdef class BlockIndex(SparseIndex):
618618
pass
619619

620620

621+
@cython.internal
621622
cdef class BlockMerge:
622623
"""
623624
Object-oriented approach makes sharing state between recursive functions a
@@ -661,6 +662,7 @@ cdef class BlockMerge:
661662
self.yi = xi
662663

663664

665+
@cython.internal
664666
cdef class BlockUnion(BlockMerge):
665667
"""
666668
Object-oriented approach makes sharing state between recursive functions a

pandas/_libs/sparse_op_helper.pxi.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ cpdef sparse_{{opname}}_{{dtype}}({{dtype}}_t[:] x,
302302
raise NotImplementedError
303303

304304

305-
cpdef sparse_fill_{{opname}}_{{dtype}}({{dtype}}_t xfill,
306-
{{dtype}}_t yfill):
305+
cdef sparse_fill_{{opname}}_{{dtype}}({{dtype}}_t xfill,
306+
{{dtype}}_t yfill):
307307
return {{(opname, 'xfill', 'yfill', dtype) | get_op}}
308308

309309
{{endfor}}

pandas/_libs/tslibs/conversion.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ cdef _TSObject convert_datetime_to_tsobject(datetime ts, tzinfo tz,
2828

2929
cdef int64_t get_datetime64_nanos(object val) except? -1
3030

31-
cpdef datetime localize_pydatetime(datetime dt, object tz)
31+
cpdef datetime localize_pydatetime(datetime dt, tzinfo tz)
3232
cdef int64_t cast_from_unit(object ts, str unit) except? -1
3333
cpdef (int64_t, int) precision_from_unit(str unit)
3434

pandas/_libs/tslibs/conversion.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,14 +810,14 @@ cdef inline datetime _localize_pydatetime(datetime dt, tzinfo tz):
810810
return dt.replace(tzinfo=tz)
811811

812812

813-
cpdef inline datetime localize_pydatetime(datetime dt, object tz):
813+
cpdef inline datetime localize_pydatetime(datetime dt, tzinfo tz):
814814
"""
815815
Take a datetime/Timestamp in UTC and localizes to timezone tz.
816816
817817
Parameters
818818
----------
819819
dt : datetime or Timestamp
820-
tz : tzinfo, "UTC", or None
820+
tz : tzinfo or None
821821
822822
Returns
823823
-------

pandas/_libs/tslibs/fields.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ cdef inline bint _is_on_month(int month, int compare_month, int modby) nogil:
198198
@cython.wraparound(False)
199199
@cython.boundscheck(False)
200200
def get_start_end_field(const int64_t[:] dtindex, str field,
201-
object freqstr=None, int month_kw=12):
201+
str freqstr=None, int month_kw=12):
202202
"""
203203
Given an int64-based datetime index return array of indicators
204204
of whether timestamps are at the start/end of the month/quarter/year

0 commit comments

Comments
 (0)