Skip to content
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

de-privatize timezone functions #17543

Merged
merged 9 commits into from
Sep 23, 2017

Conversation

jbrockmendel
Copy link
Member

Follow-up to #17526

  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@gfyoung gfyoung added Clean Internals Related to non-user accessible pandas implementation Timezones Timezone data dtype labels Sep 15, 2017
_p_tz_cache_key, dst_cache,
_unbox_utcoffsets,
_dateutil_gettz
p_tz_cache_key, dst_cache,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are all of these actually used in tslib or just other modules import them? if so then just import directly from time zones

@codecov
Copy link

codecov bot commented Sep 16, 2017

Codecov Report

Merging #17543 into master will decrease coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17543      +/-   ##
==========================================
- Coverage   91.25%   91.23%   -0.03%     
==========================================
  Files         163      163              
  Lines       49606    49627      +21     
==========================================
+ Hits        45266    45275       +9     
- Misses       4340     4352      +12
Flag Coverage Δ
#multiple 89.01% <100%> (-0.01%) ⬇️
#single 40.2% <68.75%> (-0.05%) ⬇️
Impacted Files Coverage Δ
pandas/core/indexes/datetimes.py 95.53% <100%> (ø) ⬆️
pandas/core/tools/datetimes.py 85.2% <100%> (+0.04%) ⬆️
pandas/io/pytables.py 92.79% <100%> (ø) ⬆️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/tseries/offsets.py 97% <0%> (-0.18%) ⬇️
pandas/core/frame.py 97.77% <0%> (-0.1%) ⬇️
pandas/core/api.py 100% <0%> (ø) ⬆️
pandas/core/indexes/interval.py 93.57% <0%> (ø) ⬆️
pandas/core/resample.py 96.17% <0%> (+0.01%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 328c7e1...b6a14c2. Read the comment docs.

@jreback
Copy link
Contributor

jreback commented Sep 17, 2017

linting issue.

@@ -111,16 +111,16 @@ cpdef inline object maybe_get_tz(object tz):
return tz


def _p_tz_cache_key(tz):
def p_tz_cache_key(tz):
""" Python interface for cache function to facilitate testing."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is dumb that we are exposing a function just to test. I don't think this is actually necessary and should be removed (so maybe leave this one as private).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yah, best guess is that was created before cpdef was an option. Will re-privatize.

@@ -100,7 +100,7 @@ cpdef inline object maybe_get_tz(object tz):
tz = _dateutil_tzlocal()
elif tz.startswith('dateutil/'):
zone = tz[9:]
tz = _dateutil_gettz(zone)
tz = dateutil_gettz(zone)
Copy link
Contributor

@jreback jreback Sep 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so would like to rename these to be more consistent, maybe
get_timezone_from_dateutil

ok with doing it in this PR

@@ -325,7 +325,7 @@ def test_month_range_union_tz_pytz(self):
def test_month_range_union_tz_dateutil(self):
tm._skip_if_windows_python_3()

from pandas._libs.tslib import _dateutil_gettz as timezone
from pandas._libs.tslibs.timezones import dateutil_gettz as timezone
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not great renaming

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't disagree.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

though it might be because of generic usage in the function, maybe as get_timezone would be better

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in a test file. Why not just import it without an alias (i.e. just dateutil_gettz)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's fine too (and better).

@@ -245,8 +245,8 @@ def test_timestamp_tz_arg(self):
assert p.tz == exp.tz

def test_timestamp_tz_arg_dateutil(self):
from pandas._libs.tslib import _dateutil_gettz as gettz
from pandas._libs.tslib import maybe_get_tz
from pandas._libs.tslibs.timezones import dateutil_gettz as gettz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if these can be easily changed to remove the aliasing I would do it as well (and in other locations below)

@jreback jreback added this to the 0.21.0 milestone Sep 23, 2017
@jreback jreback merged commit d43aba8 into pandas-dev:master Sep 23, 2017
@jreback
Copy link
Contributor

jreback commented Sep 23, 2017

thanks!

@jbrockmendel jbrockmendel deleted the tslibs-timezones6 branch October 30, 2017 16:24
alanbato pushed a commit to alanbato/pandas that referenced this pull request Nov 10, 2017
No-Stream pushed a commit to No-Stream/pandas that referenced this pull request Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Internals Related to non-user accessible pandas implementation Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants