You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This splits the generally overloaded function Structure.locate() into separate functions which each mimic prior behavior. It additionally provides a more convenient interface, as the previous function had code which (I believe) was inaccessible.
I've also added a test for the split that works both with the previous function and the new function.
What type(s) of changes does this code introduce?
Refactoring (no functional changes, no api changes)
Testing changes (e.g. new unit/integration/performance tests)
It looks like np.bool used to be an alias of Python's builtin bool, but that was changed/removed at some point. The NumPy type was, for a time, np.bool_, but after a while it got changed to np.bool (no trailing underscore). I think until we hit requiring NumPy >= 2.0 we should probably stick to np.bool_ since it looks like that will be retained for a while.
It's sort of hard to tell why only some of the tests with old NumPy failed, since the mix of versions and fails is a bit unusual. Here are the versions:
Ubuntu 22.04 LTS
NumPy 1.21.5
No failures
Ubuntu 24.04 LTS
NumPy 1.26.4
Failed (coverage builds)
Nexus Workflow (Python 3.14)
NumPy 2.4.4
No failures
Nexus Workflow (Python 3.10)
NumPy 1.22.0
No failures
If anyone stumbles across a problem with NumPy and bool aliases and backwards compatibility, hopefully they find this PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
This splits the generally overloaded function
Structure.locate()into separate functions which each mimic prior behavior. It additionally provides a more convenient interface, as the previous function had code which (I believe) was inaccessible.I've also added a test for the split that works both with the previous function and the new function.
What type(s) of changes does this code introduce?
Does this introduce a breaking change?
What systems has this change been tested on?
Laptop, Fedora 43 KDE Plasma
Python 3.14.4
uv 0.11.8
Numpy 2.4.4
Pytest 9.0.3
Checklist