@@ -116,7 +116,7 @@ def _p_tz_cache_key(tz):
116
116
dst_cache = {}
117
117
118
118
119
- cdef inline object tz_cache_key(object tz):
119
+ cdef inline object tz_cache_key(tzinfo tz):
120
120
"""
121
121
Return the key in the cache for the timezone info object or None
122
122
if unknown.
@@ -210,13 +210,16 @@ cdef int64_t[:] unbox_utcoffsets(object transinfo):
210
210
# Daylight Savings
211
211
212
212
213
- cdef object get_dst_info(object tz):
213
+ cdef object get_dst_info(tzinfo tz):
214
214
"""
215
- return a tuple of :
216
- (UTC times of DST transitions,
217
- UTC offsets in microseconds corresponding to DST transitions,
218
- string of type of transitions)
219
-
215
+ Returns
216
+ -------
217
+ ndarray[int64_t]
218
+ Nanosecond UTC times of DST transitions.
219
+ ndarray[int64_t]
220
+ Nanosecond UTC offsets corresponding to DST transitions.
221
+ str
222
+ Desscribing the type of tzinfo object.
220
223
"""
221
224
cache_key = tz_cache_key(tz)
222
225
if cache_key is None :
@@ -225,7 +228,7 @@ cdef object get_dst_info(object tz):
225
228
num = int (get_utcoffset(tz, None ).total_seconds()) * 1 _000_000_000
226
229
return (np.array([NPY_NAT + 1 ], dtype = np.int64),
227
230
np.array([num], dtype = np.int64),
228
- None )
231
+ " unknown " )
229
232
230
233
if cache_key not in dst_cache:
231
234
if treat_tz_as_pytz(tz):
@@ -267,14 +270,13 @@ cdef object get_dst_info(object tz):
267
270
# (under the just-deleted code that returned empty arrays)
268
271
raise AssertionError (" dateutil tzinfo is not a FixedOffset "
269
272
" and has an empty `_trans_list`." , tz)
270
-
271
273
else :
272
- # static tzinfo
273
- # TODO: This case is not hit in tests (2018-07-17); is it possible?
274
+ # static tzinfo, we can get here with pytz.StaticTZInfo
275
+ # which are not caught by treat_tz_as_pytz
274
276
trans = np.array([NPY_NAT + 1 ], dtype = np.int64)
275
- num = int (get_utcoffset(tz, None ).total_seconds()) * 1000000000
277
+ num = int (get_utcoffset(tz, None ).total_seconds()) * 1 _000_000_000
276
278
deltas = np.array([num], dtype = np.int64)
277
- typ = ' static'
279
+ typ = " static"
278
280
279
281
dst_cache[cache_key] = (trans, deltas, typ)
280
282
0 commit comments