Skip to content

[REF] Move remaining locale functions to _config.localization #25861

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 9 commits into from
Mar 25, 2019

Conversation

jbrockmendel
Copy link
Member

There are a a couple locale-centric functions left in tm that have not yet been moved because they depend on pd.options.display.encoding. This PR implements a minimal _config.display that allows us to consolidate the locale functions. _config.display also defines display.date_dayfirst and display.date_yearfirst, since those are used by tslibs.parsing. So this completes the process of removing tslib's dependency on core.

The existing get_locales function has a if PY3 check that is no longer necessary, so this removes the PY2 branch of that.

@pep8speaks
Copy link

pep8speaks commented Mar 24, 2019

Hello @jbrockmendel! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-03-25 13:55:53 UTC

"""
global _initial_defencoding

encoding = None
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn’t u check the global first? (if it’s set)

Copy link
Member Author

Choose a reason for hiding this comment

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

The comment near the bottom suggests this is kept for debugging purposes related to matplotlib

"""

pc_date_yearfirst_doc = """
: boolean
Copy link
Contributor

Choose a reason for hiding this comment

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

these are pretty orthogonal right ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Handling dayfirst and yearfirst finishes breaking the reliance of tslibs on core.

Copy link
Contributor

Choose a reason for hiding this comment

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

right but they shouldn't be in this file. not problem separateing them out, but not here

Copy link
Member Author

Choose a reason for hiding this comment

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

they're under the display namespace within options. where would you put this? could go directly at the bottom of __init__ i guess

Copy link
Contributor

Choose a reason for hiding this comment

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

i would put them in another file under _config

Copy link
Member Author

Choose a reason for hiding this comment

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

done + green

@codecov
Copy link

codecov bot commented Mar 24, 2019

Codecov Report

Merging #25861 into master will increase coverage by <.01%.
The diff coverage is 89.09%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #25861      +/-   ##
==========================================
+ Coverage   91.47%   91.47%   +<.01%     
==========================================
  Files         173      174       +1     
  Lines       52872    52876       +4     
==========================================
+ Hits        48364    48369       +5     
+ Misses       4508     4507       -1
Flag Coverage Δ
#multiple 90.04% <89.09%> (ø) ⬆️
#single 41.83% <70.9%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/util/testing.py 89.74% <ø> (+0.43%) ⬆️
pandas/io/formats/console.py 79.41% <ø> (-6.87%) ⬇️
pandas/core/config_init.py 99.2% <ø> (-0.05%) ⬇️
pandas/_config/__init__.py 100% <100%> (ø) ⬆️
pandas/_config/display.py 100% <100%> (ø)
pandas/_config/localization.py 86% <76.92%> (-9.84%) ⬇️

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 2618b21...1bb6dfd. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 24, 2019

Codecov Report

Merging #25861 into master will increase coverage by <.01%.
The diff coverage is 89.65%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #25861      +/-   ##
==========================================
+ Coverage   91.47%   91.48%   +<.01%     
==========================================
  Files         173      175       +2     
  Lines       52872    52877       +5     
==========================================
+ Hits        48367    48372       +5     
  Misses       4505     4505
Flag Coverage Δ
#multiple 90.04% <89.65%> (ø) ⬆️
#single 41.82% <72.41%> (+0.01%) ⬆️
Impacted Files Coverage Δ
pandas/util/testing.py 89.74% <ø> (+0.33%) ⬆️
pandas/io/formats/console.py 78.12% <ø> (-8.15%) ⬇️
pandas/core/config_init.py 99.2% <ø> (-0.05%) ⬇️
pandas/_config/__init__.py 100% <100%> (ø) ⬆️
pandas/_config/display.py 100% <100%> (ø)
pandas/_config/dates.py 100% <100%> (ø)
pandas/_config/localization.py 86% <76.92%> (-9.84%) ⬇️

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 d8642e9...f06c21a. Read the comment docs.

@gfyoung gfyoung added Refactor Internal refactoring of code Internals Related to non-user accessible pandas implementation 2/3 Compat Clean labels Mar 25, 2019
@jreback jreback added this to the 0.25.0 milestone Mar 25, 2019
@jreback jreback merged commit d37c531 into pandas-dev:master Mar 25, 2019
@jreback
Copy link
Contributor

jreback commented Mar 25, 2019

thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the upstream4 branch March 26, 2019 00:22
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 Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants