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

Get rid of np.int #986

Merged
merged 7 commits into from
Nov 13, 2024
Merged

Get rid of np.int #986

merged 7 commits into from
Nov 13, 2024

Conversation

Didou09
Copy link
Member

@Didou09 Didou09 commented Nov 13, 2024

Main changes:

New strategy for int/ float type checks

# Useful scalar types
_NINT = (np.int32, np.int64)
_INT = (int,) + _NINT
_NFLOAT = (np.float32, np.float64)
_FLOAT = (float,) + _NFLOAT
_NUMB = _INT + _FLOAT

And always run isinstance()

Because the behaviour of np.int, np.int_ or np.integer is too dependent on the version of numpy and on the plateform
Also shows different results depending is using type() or dtype or isinstance()

  • isintance() allows multiple types and subclasses
  • Better to use tuple of all explicit numpy types that resort to generic types

Issues:

Fixes, in devel, issue #983

@pep8speaks
Copy link

pep8speaks commented Nov 13, 2024

Hello @Didou09! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 376:80: E501 line too long (83 > 79 characters)
Line 1500:71: E231 missing whitespace after ','
Line 1500:80: E501 line too long (83 > 79 characters)

Line 208:16: W292 no newline at end of file

Comment last updated at 2024-11-13 18:37:09 UTC

@Didou09 Didou09 changed the title Issue983 npint Get rid of np.int Nov 13, 2024
@Didou09 Didou09 merged commit 3a6820d into devel Nov 13, 2024
14 checks passed
@Didou09 Didou09 deleted the Issue983_npint branch November 13, 2024 19:05
@Didou09 Didou09 mentioned this pull request Nov 25, 2024
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.

3 participants