Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Trivial style fixes. #15194

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
Sep 6, 2019
Merged

Trivial style fixes. #15194

merged 1 commit into from
Sep 6, 2019

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Sep 5, 2019

In the various test files, there is no point of wrapping checkdep_usetex
in catch_warnings because checkdep_usetex uses logging.warning, not
warnings.warn.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

In the various test files, there is no point of wrapping checkdep_usetex
in catch_warnings because checkdep_usetex uses logging.warning, not
warnings.warn.
return False
return np.isclose(-np.log(1/x-1), -np.log(1/y-1))
return (np.isclose(-np.log(1/x-1), -np.log(1/y-1))
if 0 < x < 1 and 0 < y < 1 else False)
Copy link
Member

Choose a reason for hiding this comment

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

Not convinced that the ternary if-else expression makes this more readable. But no strong feeling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not so much about the ternary, more about '0 < x < 1' vs 'x >= 1 or x <= 0', I can revert to non-ternary if you prefer.

Copy link
Member

Choose a reason for hiding this comment

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

Fully agree on 0 < x < 1. Would slightly prefer non-ternary-if, but as said: no strong feelings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

let's see what the next reviewer says, then

Copy link
Member

Choose a reason for hiding this comment

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

It is fine this way. It is one less line of code, and one less return call.

@WeatherGod WeatherGod merged commit 4dae657 into matplotlib:master Sep 6, 2019
@tacaswell tacaswell added this to the v3.2.0 milestone Sep 6, 2019
@anntzer anntzer deleted the style branch September 6, 2019 19:14
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