11# cython: profile=False
2- from numpy cimport int64_t, int32_t, npy_int64, npy_int32, ndarray
3- from cpython cimport PyObject
2+ from numpy cimport int64_t, npy_int64, npy_int32
43
54from cpython cimport PyUnicode_Check, PyUnicode_AsASCIIString
65
76
8- cdef extern from " datetime.h" :
9-
10- ctypedef class datetime.date [object PyDateTime_Date]:
11- pass
12-
13- ctypedef class datetime.datetime [object PyDateTime_DateTime]:
14- pass
15-
16- ctypedef class datetime.timedelta [object PyDateTime_Delta]:
17- pass
18-
19- void PyDateTime_IMPORT()
20-
21- int PyDateTime_GET_YEAR(date)
22- int PyDateTime_GET_MONTH(date)
23- int PyDateTime_GET_DAY(date)
24- int PyDateTime_DATE_GET_HOUR(object o)
25- int PyDateTime_DATE_GET_MINUTE(object o)
26- int PyDateTime_DATE_GET_SECOND(object o)
27- int PyDateTime_DATE_GET_MICROSECOND(object o)
28- int PyDateTime_TIME_GET_HOUR(object o)
29- int PyDateTime_TIME_GET_MINUTE(object o)
30- int PyDateTime_TIME_GET_SECOND(object o)
31- int PyDateTime_TIME_GET_MICROSECOND(object o)
32- bint PyDateTime_Check(object o)
33- bint PyDate_Check(object o)
34- bint PyTime_Check(object o)
35- bint PyDelta_Check(object o)
36- object PyDateTime_FromDateAndTime(int year, int month, int day, int hour,
37- int minute, int second, int us)
38-
397cdef extern from " numpy/ndarrayobject.h" :
408
419 ctypedef int64_t npy_timedelta
4210 ctypedef int64_t npy_datetime
4311
4412 ctypedef enum NPY_CASTING:
45- NPY_NO_CASTING
46- NPY_EQUIV_CASTING
47- NPY_SAFE_CASTING
48- NPY_SAME_KIND_CASTING
49- NPY_UNSAFE_CASTING
13+ NPY_NO_CASTING
14+ NPY_EQUIV_CASTING
15+ NPY_SAFE_CASTING
16+ NPY_SAME_KIND_CASTING
17+ NPY_UNSAFE_CASTING
5018
5119
5220cdef extern from " numpy_helper.h" :
@@ -79,9 +47,6 @@ cdef extern from "datetime/np_datetime.h":
7947 npy_int64 year
8048 npy_int32 month, day, hour, min , sec, us, ps, as
8149
82- int cmp_pandas_datetimestruct(pandas_datetimestruct * a,
83- pandas_datetimestruct * b)
84-
8550 npy_datetime pandas_datetimestruct_to_datetime(PANDAS_DATETIMEUNIT fr,
8651 pandas_datetimestruct * d) nogil
8752 void pandas_datetime_to_datetimestruct(npy_datetime val,
@@ -102,8 +67,6 @@ cdef extern from "datetime/np_datetime_strings.h":
10267 PANDAS_DATETIMEUNIT * out_bestunit,
10368 npy_bool * out_special)
10469
105- # int parse_python_string(object obj, pandas_datetimestruct *out) except -1
106-
10770
10871
10972
@@ -134,17 +97,3 @@ cdef inline int _cstring_to_dts(char *val, int length,
13497 NPY_UNSAFE_CASTING,
13598 dts, out_local, out_tzoffset, & out_bestunit, & special)
13699 return result
137-
138-
139- cdef inline bint check_dts_bounds(pandas_datetimestruct * dts):
140- """ Returns True if an error needs to be raised"""
141- cdef:
142- bint error = False
143-
144- if (dts.year <= 1677 and
145- cmp_pandas_datetimestruct(dts, & _NS_MIN_DTS) == - 1 ):
146- error = True
147- elif (dts.year >= 2262 and
148- cmp_pandas_datetimestruct(dts, & _NS_MAX_DTS) == 1 ):
149- error = True
150- return error
0 commit comments