-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Implement _is_utc in timezones #17419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
8304221
82b1da7
a74e7fa
b110f96
d8ea8f4
42e5e4d
870e6a4
07edd07
708e4e6
b507379
991af8f
c877772
f8ce1ad
57c2d55
2638a20
a5ee65e
69ca387
c12062c
2be1405
aafa941
1c01a2b
e0e837a
72da858
b65f926
7f53450
68864b5
6f19d50
87482c2
7985ee2
fb55a8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
# cython: profile=False |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
# cython: profile=False | ||
|
||
cdef bint _is_utc(object tz) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# -*- coding: utf-8 -*- | ||
# cython: profile=False | ||
|
||
from pandas.compat import string_types, is_platform_windows | ||
|
||
cdef extern from "Python.h": | ||
Py_ssize_t PY_SSIZE_T_MAX | ||
|
||
cdef extern from "datetime.h": | ||
void PyDateTime_IMPORT() | ||
|
||
# import datetime C API | ||
PyDateTime_IMPORT | ||
|
||
import numpy as np | ||
cimport numpy as np | ||
from numpy cimport ndarray, int64_t, float64_t | ||
np.import_array() | ||
|
||
|
||
# dateutil compat | ||
from dateutil.tz import (tzoffset, | ||
tzlocal as _dateutil_tzlocal, | ||
tzfile as _dateutil_tzfile, | ||
tzutc as _dateutil_tzutc, | ||
tzstr as _dateutil_tzstr) | ||
|
||
if is_platform_windows(): | ||
from dateutil.zoneinfo import gettz as _dateutil_gettz | ||
else: | ||
from dateutil.tz import gettz as _dateutil_gettz | ||
|
||
|
||
from pytz.tzinfo import BaseTzInfo as _pytz_BaseTzInfo | ||
import pytz | ||
UTC = pytz.utc | ||
|
||
|
||
cdef inline bint _is_utc(object tz): | ||
return tz is UTC or isinstance(tz, _dateutil_tzutc) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -341,6 +341,7 @@ class CheckSDist(sdist_class): | |
'pandas/_libs/window.pyx', | ||
'pandas/_libs/sparse.pyx', | ||
'pandas/_libs/parsers.pyx', | ||
'pandas/_libs/tslibs/timezones.pyx', | ||
'pandas/io/sas/sas.pyx'] | ||
|
||
def initialize_options(self): | ||
|
@@ -483,20 +484,24 @@ def pxd(name): | |
+ _pxi_dep['hashtable'])}, | ||
'_libs.tslib': {'pyxfile': '_libs/tslib', | ||
'pxdfiles': ['_libs/src/util', '_libs/lib'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did you add this back? ( I agree it looks like it should be here, but what was failing to indicate that) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like a screwup I made while rebasing. Will remove momentarily. |
||
'depends': tseries_depends, | ||
'depends': tseries_depends + [ | ||
'pandas/_libs/tslibs/timezones'], | ||
'sources': ['pandas/_libs/src/datetime/np_datetime.c', | ||
'pandas/_libs/src/datetime/np_datetime_strings.c', | ||
'pandas/_libs/src/period_helper.c']}, | ||
'_libs.tslibs.timezones': {'pyxfile': '_libs/tslibs/timezones'}, | ||
'_libs.period': {'pyxfile': '_libs/period', | ||
'depends': tseries_depends, | ||
'depends': tseries_depends + [ | ||
'pandas/_libs/tslibs/timezones'], | ||
'sources': ['pandas/_libs/src/datetime/np_datetime.c', | ||
'pandas/_libs/src/datetime/np_datetime_strings.c', | ||
'pandas/_libs/src/period_helper.c']}, | ||
'_libs.index': {'pyxfile': '_libs/index', | ||
'sources': ['pandas/_libs/src/datetime/np_datetime.c', | ||
'pandas/_libs/src/datetime/np_datetime_strings.c'], | ||
'pxdfiles': ['_libs/src/util', '_libs/hashtable'], | ||
'depends': _pxi_dep['index']}, | ||
'depends': _pxi_dep['index'] + [ | ||
'pandas/_libs/tslibs/timezones']}, | ||
'_libs.algos': {'pyxfile': '_libs/algos', | ||
'pxdfiles': ['_libs/src/util', '_libs/algos', '_libs/hashtable'], | ||
'depends': _pxi_dep['algos']}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some extra imports here (I know you may use them later), but let's add them later then.