Skip to content

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

Merged
merged 30 commits into from
Sep 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8304221
Implement _is_utc in timezones
jbrockmendel Sep 1, 2017
82b1da7
Dont declare _is_utc in tslib
jbrockmendel Sep 2, 2017
a74e7fa
Remove unused imports
jbrockmendel Sep 5, 2017
b110f96
DOC: Cleaned references to pandas <v0.12 in docs (#17375)
topper-123 Sep 2, 2017
d8ea8f4
Remove unused _day and _month attrs (#17431)
jbrockmendel Sep 4, 2017
42e5e4d
DOC: Clean-up references to v12 to v14 (both included) (#17420)
topper-123 Sep 5, 2017
870e6a4
BUG: Plotting Timedelta on y-axis #16953 (#17430)
s-weigand Sep 6, 2017
07edd07
COMPAT: handle pyarrow deprecation of timestamps_to_ms in .from_panda…
jreback Sep 6, 2017
708e4e6
DOC/TST: Add examples to MultiIndex.get_level_values + related change…
topper-123 Sep 6, 2017
b507379
Dont re-pin total_seconds as it is already implemented (#17432)
jbrockmendel Sep 7, 2017
991af8f
BUG: Return local Timestamp.weekday_name attribute (#17354) (#17377)
mroeschke Sep 7, 2017
c877772
BUG: intersection of decreasing RangeIndexes (#17374)
toobaz Sep 7, 2017
f8ce1ad
Remove property that re-computed microsecond (#17331)
jbrockmendel Sep 7, 2017
57c2d55
cleaned references to pandas v0.15 and v0.16 in docs (#17442)
topper-123 Sep 7, 2017
2638a20
BUG: revert collision warning (#17298)
deniederhut Sep 7, 2017
a5ee65e
cdef out dtype for _Timestamp._get_field (#17457)
mroeschke Sep 7, 2017
69ca387
DOC: Add Timestamp, Period, Timedelta, and Interval to api.rst (#17424)
GuessWhoSamFoo Sep 7, 2017
c12062c
DOC: to_json (#17461)
majiang Sep 7, 2017
2be1405
BUG: Index._searchsorted_monotonic(..., side='right') returns the lef…
jschendel Sep 7, 2017
aafa941
COMPAT: Pypy tweaks (#17351)
mattip Sep 7, 2017
1c01a2b
Replace * imports with explicit imports; remove unused declared const…
jbrockmendel Sep 8, 2017
e0e837a
Removed Timedelta.is_populated and fixed spelling errors (#17469)
GuessWhoSamFoo Sep 8, 2017
72da858
PERF: Implement get_freq_code in cython frequencies (#17422)
jbrockmendel Sep 8, 2017
b65f926
Merge branch 'master' into tslibs-timezones2
jbrockmendel Sep 8, 2017
7f53450
Merge branch 'master' into tslibs-timezones2
jbrockmendel Sep 8, 2017
68864b5
Merge branch 'master' of https://github.com/pandas-dev/pandas into ts…
jbrockmendel Sep 10, 2017
6f19d50
Merge branch 'tslibs-timezones2' of https://github.com/jbrockmendel/p…
jbrockmendel Sep 10, 2017
87482c2
whitespace cleanup
jbrockmendel Sep 10, 2017
7985ee2
Remove extraneous depends from setup
jbrockmendel Sep 10, 2017
fb55a8c
Remove accidentally re-introduced dependency
jbrockmendel Sep 11, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions pandas/_libs/index.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ cimport tslib

from hashtable cimport HashTable

from tslibs.timezones cimport _is_utc
from pandas._libs import tslib, algos, hashtable as _hash
from pandas._libs.tslib import Timestamp, Timedelta
from datetime import datetime, timedelta
Expand All @@ -32,9 +33,6 @@ cdef extern from "datetime.h":

cdef int64_t iNaT = util.get_nat()

from dateutil.tz import tzutc as _du_utc
import pytz
UTC = pytz.utc

PyDateTime_IMPORT

Expand Down Expand Up @@ -559,9 +557,6 @@ cdef inline _to_i8(object val):
return ival
return val

cdef inline bint _is_utc(object tz):
return tz is UTC or isinstance(tz, _du_utc)


cdef class MultiIndexObjectEngine(ObjectEngine):
"""
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ from lib cimport is_null_datetimelike, is_period
from pandas._libs import tslib, lib
from pandas._libs.tslib import (Timedelta, Timestamp, iNaT,
NaT, _get_utcoffset)
from tslibs.timezones cimport _is_utc
from tslib cimport (
maybe_get_tz,
_is_utc,
_is_tzlocal,
_get_dst_info,
_nat_scalar_rules)
Expand Down
1 change: 0 additions & 1 deletion pandas/_libs/tslib.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ from numpy cimport ndarray, int64_t
cdef convert_to_tsobject(object, object, object, bint, bint)
cpdef convert_to_timedelta64(object, object)
cpdef object maybe_get_tz(object)
cdef bint _is_utc(object)
cdef bint _is_tzlocal(object)
cdef object _get_dst_info(object)
cdef bint _nat_scalar_rules[6]
Expand Down
4 changes: 2 additions & 2 deletions pandas/_libs/tslib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ cdef int64_t NPY_NAT = util.get_nat()
iNaT = NPY_NAT


from tslibs.timezones cimport _is_utc

cdef inline object create_timestamp_from_ts(
int64_t value, pandas_datetimestruct dts,
object tz, object freq):
Expand Down Expand Up @@ -1713,8 +1715,6 @@ def _localize_pydatetime(object dt, object tz):
def get_timezone(tz):
return _get_zone(tz)

cdef inline bint _is_utc(object tz):
return tz is UTC or isinstance(tz, _dateutil_tzutc)

cdef inline object _get_zone(object tz):
"""
Expand Down
2 changes: 2 additions & 0 deletions pandas/_libs/tslibs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
# cython: profile=False
4 changes: 4 additions & 0 deletions pandas/_libs/tslibs/timezones.pxd
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)
12 changes: 12 additions & 0 deletions pandas/_libs/tslibs/timezones.pyx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# cython: profile=False

# dateutil compat
from dateutil.tz import tzutc as _dateutil_tzutc

import pytz
UTC = pytz.utc


cdef inline bint _is_utc(object tz):
return tz is UTC or isinstance(tz, _dateutil_tzutc)
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/_libs/tslibs/frequencies.pyx',
'pandas/io/sas/sas.pyx']

Expand Down Expand Up @@ -479,6 +480,7 @@ def pxd(name):
'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,
'sources': ['pandas/_libs/src/datetime/np_datetime.c',
Expand Down