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

remove use of deprecated np.int #14

Merged
merged 3 commits into from
Jan 12, 2022
Merged

remove use of deprecated np.int #14

merged 3 commits into from
Jan 12, 2022

Conversation

javierggt
Copy link
Contributor

Description

This PR makes tiny changes to remove uses of a few deprecated dtypes (sot/skare3#753)

Testing

  • Passes unit tests on MacOS, linux, Windows (at least one required)
  • Functional testing

Fixes #

@javierggt javierggt requested a review from taldcroft December 30, 2021 15:50
@taldcroft
Copy link
Member

I thought the recommended change is np.int => int. From the release notes, "For a long time, np.int has been an alias of the builtin int".

@taldcroft
Copy link
Member

And just to see for myself:

In [1]: np.int is int                                                           
Out[1]: True

In [2]: np.float is float                                                       
Out[2]: True

In [3]: isinstance(np.float64(10), float)                                       
Out[3]: True

@javierggt
Copy link
Contributor Author

javierggt commented Jan 3, 2022

I would agree that perhaps np.int_ is not the right type. I changed it to int.

In other places (Annie, I believe) I wondered whether it should be np.int32 to be explicit. np.int32 is used in Annie in several places.

Also, the case is clear for bool, but if one uses int, the type might be platform dependent.

@@ -71,7 +71,7 @@ def match(recarray, filters):
except TypeError:
pass

matches = np.ones(len(recarray), dtype=np.bool)
matches = np.ones(len(recarray), dtype=np.bool_)
Copy link
Member

Choose a reason for hiding this comment

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

Should be bool.

@javierggt javierggt merged commit 7e7ac60 into master Jan 12, 2022
@javierggt javierggt deleted the deprecated-np-dtypes branch January 18, 2022 19:49
@javierggt javierggt mentioned this pull request Feb 8, 2022
3 tasks
@javierggt javierggt mentioned this pull request Aug 3, 2022
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