Skip to content

COMPAT: Catch warnings on tab-complete in IPy 6 #16414

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 1 commit into from
May 26, 2017

Conversation

TomAugspurger
Copy link
Contributor

Properties may run code with Jedi completion in IPython 6

Closes #16409

I want to leave this open for a couple days to see if I can find other places that trigger this warning. I'm pretty sure I've seen other instances, but they may have been from other libraries.

@TomAugspurger TomAugspurger added this to the 0.20.2 milestone May 22, 2017
@TomAugspurger
Copy link
Contributor Author

I think it was on Resampler. I'll just push additional fixes here.

@codecov
Copy link

codecov bot commented May 22, 2017

Codecov Report

Merging #16414 into master will increase coverage by <.01%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16414      +/-   ##
==========================================
+ Coverage   90.42%   90.42%   +<.01%     
==========================================
  Files         161      161              
  Lines       51023    51025       +2     
==========================================
+ Hits        46137    46139       +2     
  Misses       4886     4886
Flag Coverage Δ
#multiple 88.26% <50%> (ø) ⬆️
#single 40.17% <50%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/categorical.py 95.78% <50%> (-0.14%) ⬇️
pandas/core/common.py 91.39% <0%> (+0.33%) ⬆️

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 d5a681b...da2d290. Read the comment docs.

@codecov
Copy link

codecov bot commented May 22, 2017

Codecov Report

Merging #16414 into master will decrease coverage by <.01%.
The diff coverage is 70%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16414      +/-   ##
==========================================
- Coverage   90.43%   90.42%   -0.01%     
==========================================
  Files         161      161              
  Lines       51045    51055      +10     
==========================================
+ Hits        46161    46168       +7     
- Misses       4884     4887       +3
Flag Coverage Δ
#multiple 88.26% <70%> (-0.01%) ⬇️
#single 40.16% <20%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/core/resample.py 96.09% <100%> (+0.01%) ⬆️
pandas/conftest.py 96.42% <100%> (+0.59%) ⬆️
pandas/core/categorical.py 95.5% <25%> (-0.42%) ⬇️

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 e41fe7f...adf9343. Read the comment docs.

@TomAugspurger
Copy link
Contributor Author

Catching all of the warnings from Resampler is turning out to be difficult. I've added an xfail, but might just remove it since this should be fixed by IPython 6.0.1 anyway.

And I don't think there's any way to catch the warnings from pd.lib.<tab> (extra incentive to avoid the deprecation I guess?)

Properties may run code with Jedi completion in IPython 6

Closes pandas-dev#16409
@TomAugspurger
Copy link
Contributor Author

Latest commit fixes this for Categorical and Resampler.

@jreback do the changes to Resampler.__getitem__ look sensible to you? The issue was jedi checking for attributes like __objclass__ in a try/except block. Now we skip the warning if we're going to just raise an AttributeError anyway (I had to modify one test to not expect a warning anymore).

My change could be incorrect if Resampler.obj.mean() has an attribute Resampler.obj doesn't, but I don't think that should ever happen.

def test_tab_complete_ipython6_warning(self, ip):
from IPython.core.completer import provisionalcompleter
code = dedent("""\
import pandas.util.testing as tm
Copy link
Contributor

Choose a reason for hiding this comment

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

hah didn't know you could do this. pretty cool.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

lgtm!

@jreback
Copy link
Contributor

jreback commented May 25, 2017

FYI, I think for 0.21.0 going to remove the back-compat for .resample anyhow (IOW, all of that hacking to make it look like the previous API), but this is good.

@TomAugspurger
Copy link
Contributor Author

IOW, all of that hacking to make it look like the previous API

I didn't appreciate how awesome of a hack it was until now :)

@TomAugspurger TomAugspurger merged commit 3c9a74b into pandas-dev:master May 26, 2017
@TomAugspurger TomAugspurger deleted the tab-complete-fix branch May 27, 2017 16:37
TomAugspurger added a commit to TomAugspurger/pandas that referenced this pull request May 29, 2017
Properties may run code with Jedi completion in IPython 6

Closes pandas-dev#16409
(cherry picked from commit 3c9a74b)
TomAugspurger added a commit that referenced this pull request May 30, 2017
Properties may run code with Jedi completion in IPython 6

Closes #16409
(cherry picked from commit 3c9a74b)
stangirala pushed a commit to stangirala/pandas that referenced this pull request Jun 11, 2017
Properties may run code with Jedi completion in IPython 6

Closes pandas-dev#16409
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants