Skip to content

Commit 8f85742

Browse files
committed
some typing
1 parent 84413e6 commit 8f85742

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pandas/_libs/tslib.pyx

+8-3
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def ints_to_pydatetime(ndarray[int64_t] arr, tz=None, freq=None, box=False):
144144

145145
cdef:
146146
Py_ssize_t i, n = len(arr)
147+
ndarray[int64_t] trans, deltas
147148
pandas_datetimestruct dts
148149
object dt
149150
int64_t value
@@ -707,8 +708,7 @@ class Timestamp(_Timestamp):
707708
value = self.value
708709
if _tzinfo is not None:
709710
value_tz = tz_convert_single(value, _tzinfo, 'UTC')
710-
offset = value - value_tz
711-
value += offset
711+
value += value - value_tz
712712

713713
# setup components
714714
pandas_datetime_to_datetimestruct(value, PANDAS_FR_ns, &dts)
@@ -1641,6 +1641,10 @@ cdef inline void _localize_tso(_TSObject obj, object tz):
16411641
"""
16421642
Take a TSObject in UTC and localizes to timezone tz.
16431643
"""
1644+
cdef:
1645+
ndarray[int64_t] trans, deltas
1646+
Py_ssize_t delta, posn
1647+
16441648
if _is_utc(tz):
16451649
obj.tzinfo = tz
16461650
elif _is_tzlocal(tz):
@@ -4174,7 +4178,7 @@ def tz_convert(ndarray[int64_t] vals, object tz1, object tz2):
41744178
return result
41754179

41764180

4177-
def tz_convert_single(int64_t val, object tz1, object tz2):
4181+
cpdef int64_t tz_convert_single(int64_t val, object tz1, object tz2):
41784182
"""
41794183
Convert the val (in i8) from timezone1 to timezone2
41804184
@@ -5178,6 +5182,7 @@ cdef inline int64_t _normalized_stamp(pandas_datetimestruct *dts) nogil:
51785182
def dates_normalized(ndarray[int64_t] stamps, tz=None):
51795183
cdef:
51805184
Py_ssize_t i, n = len(stamps)
5185+
ndarray[int64_t] trans, deltas
51815186
pandas_datetimestruct dts
51825187

51835188
if tz is None or _is_utc(tz):

0 commit comments

Comments
 (0)