Skip to content

Commit 19a2cfa

Browse files
committed
cleanup and typing
1 parent e5518f6 commit 19a2cfa

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

pandas/_libs/tslibs/np_datetime.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ cdef inline void dt64_to_dtstruct(int64_t dt64,
136136
pandas_datetime_to_datetimestruct(dt64, NPY_FR_ns, out)
137137
return
138138

139+
139140
cdef inline void td64_to_tdstruct(int64_t td64,
140141
pandas_timedeltastruct* out) nogil:
141142
"""Convenience function to call pandas_timedelta_to_timedeltastruct

pandas/_libs/tslibs/offsets.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ class _Tick(object):
497497
# ----------------------------------------------------------------------
498498
# RelativeDelta Arithmetic
499499

500-
cpdef datetime shift_day(datetime other, int days):
500+
def shift_day(other: datetime, days: int) -> datetime:
501501
"""
502502
Increment the datetime `other` by the given number of days, retaining
503503
the time-portion of the datetime. For tz-naive datetimes this is
@@ -816,7 +816,8 @@ def shift_months(int64_t[:] dtindex, int months, object day=None):
816816
return np.asarray(out)
817817

818818

819-
cpdef datetime shift_month(datetime stamp, int months, object day_opt=None):
819+
def shift_month(stamp: datetime, months: int,
820+
day_opt: object = None) -> datetime:
820821
"""
821822
Given a datetime (or Timestamp) `stamp`, an integer `months` and an
822823
option `day_opt`, return a new datetimelike that many months later,
@@ -946,8 +947,8 @@ cpdef int roll_convention(int other, int n, int compare) nogil:
946947
return n
947948

948949

949-
cpdef int roll_qtrday(datetime other, int n, int month, object day_opt,
950-
int modby=3) except? -1:
950+
def roll_qtrday(other: datetime, n: int, month: int,
951+
day_opt: object, modby: int = 3) -> int:
951952
"""
952953
Possibly increment or decrement the number of periods to shift
953954
based on rollforward/rollbackward conventions.
@@ -989,8 +990,7 @@ cpdef int roll_qtrday(datetime other, int n, int month, object day_opt,
989990
return n
990991

991992

992-
cpdef int roll_yearday(datetime other, int n, int month,
993-
object day_opt) except? -1:
993+
def roll_yearday(other: datetime, n: int, month: int, day_opt: object) -> int:
994994
"""
995995
Possibly increment or decrement the number of periods to shift
996996
based on rollforward/rollbackward conventions.

0 commit comments

Comments
 (0)