Don't warn in Collections.contains if picker is not numlike.#6491
Conversation
|
Bump, this should be fairly non-controversial? I could add an explicit test that |
|
First, the PR needs to be rebased. Second, the comment for the original warning gives me pause. It is saying that it shouldn't happen unless it is being called in a non-normal manner. So... is the comment still correct and something else is wrong, or is the comment outdated? |
|
I agree the behavior is the same, that comment makes me a little nervous though. I suspect that it is technical debt from an old check that got over run by new functionality. I looked at this a while ago and abandoned my changes, but I no longer remember why (could have been I found a problem or could have been I switched to something else and just never came back 😕 ) . Needs a rebase, I am +0.5 on merging. |
|
It as also distressing how often @WeatherGod and I leave very similar comments with in minutes of each other. |
bacc4e0 to
7465773
Compare
|
I guess the check and the comment must date back from before it was allowed to pass an arbitrary callable as the |
Otherwise, a warning is raised in the simple example:
from pylab import *
def pick_test(artist, mouseevent):
return coll.contains(mouseevent)
coll = plt.scatter([0, 1], [0, 1], picker=pick_test)
plt.show()
(Click anywhere in the figure to trigger the warning.)
The use of `is_numlike` matches the implementation of `Line2D.contains`.
Initially noted while using mpldatacursor.
7465773 to
c5ec5b3
Compare
|
Rebased; bumping. |
|
Test failure is pytest-only and is related to stixsans font. |
Otherwise, a warning is raised in the simple example:
(Click anywhere in the figure to trigger the warning.)
The use of
is_numlikematches the implementation ofLine2D.contains.Initially noted while using mpldatacursor.