Skip to content
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

Handle upcoming deprecation of np.float. #15694

Merged
merged 1 commit into from Nov 15, 2019
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Nov 14, 2019

numpy plans to deprecate np.float in favor of float (numpy/numpy#14882); remove the few
remaining usages of np.float in the codebase.

Actually the Bbox constructor already converts its argument using
np.asarray(..., dtype=float) so we don't need to bother explicitly
casting the argument to a float array at the call site.

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

numpy plans to deprecate np.float in favor of float; remove the few
remaining usages of np.float in the codebase.

Actually the Bbox constructor already converts its argument using
`np.asarray(..., dtype=float)` so we don't need to bother explicitly
casting the argument to a float array at the call site.
@tacaswell tacaswell added this to the v3.3.0 milestone Nov 14, 2019
Comment on lines -766 to +771
return Bbox(np.array([[0.0, 0.0], [1.0, 1.0]], float))
return Bbox([[0, 0], [1, 1]])

@staticmethod
def null():
"""Create a new null `Bbox` from (inf, inf) to (-inf, -inf)."""
return Bbox(np.array([[np.inf, np.inf], [-np.inf, -np.inf]], float))
return Bbox([[np.inf, np.inf], [-np.inf, -np.inf]])
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume you're aware that numpy doesn't care about these lines, and you're just doing cleanup while you're here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

@eric-wieser
Copy link
Contributor

Follows on from #8996. Guess I missed some.

@QuLogic QuLogic merged commit 0ea2013 into matplotlib:master Nov 15, 2019
@anntzer anntzer deleted the unfloat branch November 15, 2019 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants