Skip to content

Avoid comparing numpy array to strings in two places #7658

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 3 commits into from
Dec 22, 2016

Conversation

dstansby
Copy link
Member

Fixes #5806

Copy link
Member

@efiring efiring left a comment

Choose a reason for hiding this comment

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

Apart from the suggested change in implementation, this is good.

@@ -1282,7 +1282,7 @@ def set_aspect(self, aspect, adjustable=None, anchor=None):
etc.
===== =====================
"""
if aspect in ('equal', 'auto'):
if isinstance(aspect, str) and aspect in ('equal', 'auto'):
Copy link
Member

Choose a reason for hiding this comment

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

It might be better to use cbook.is_string_like instead of is_instance. Or at least six.string_types in place of str.

@dstansby dstansby changed the title Check aspect to avoid comparing numpy array to tuple of strings Avoid comparing numpy array to strings in two places Dec 22, 2016
@dstansby
Copy link
Member Author

There was another similar warning coming up in in #5806 that I have also fixed.

@efiring efiring changed the title Avoid comparing numpy array to strings in two places [MRG+1] Avoid comparing numpy array to strings in two places Dec 22, 2016
@efiring
Copy link
Member

efiring commented Dec 22, 2016

Test failures are unrelated (common random failures).

@NelleV NelleV changed the title [MRG+1] Avoid comparing numpy array to strings in two places [MRG+2] Avoid comparing numpy array to strings in two places Dec 22, 2016
@NelleV
Copy link
Member

NelleV commented Dec 22, 2016

LGTM 👍
launching the travis test again.

@QuLogic QuLogic changed the title [MRG+2] Avoid comparing numpy array to strings in two places Avoid comparing numpy array to strings in two places Dec 22, 2016
@QuLogic QuLogic merged commit b8568f9 into matplotlib:master Dec 22, 2016
@QuLogic QuLogic added this to the 2.1 (next point release) milestone Dec 22, 2016
@dstansby dstansby deleted the aspect-array-warning branch December 22, 2016 22:41
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.

4 participants