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

Skip to content

Improve construction when inferring sub-array dtype (a.k.a. array subdtype) #381

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 5 commits into from
Feb 4, 2023

Conversation

eriknw
Copy link
Member

@eriknw eriknw commented Feb 3, 2023

This gives us an easy, consistent way to infer sub-array dtypes upon when constructing objects. Also, this handles more cases (I apparently missed some!). See tests for examples.

@eriknw eriknw added bug Something is broken enhancement Improve existing functionality or make things work better labels Feb 3, 2023
@coveralls
Copy link

coveralls commented Feb 3, 2023

Coverage Status

Coverage: 99.496% (+0.09%) from 99.408% when pulling 4c6c925 on eriknw:better_subarray_support into e7a9a31 on python-graphblas:main.

else:
# If we know the dtype, then using `np.fromiter` is much faster
dtype = lookup_dtype(dtype)
values = np.fromiter(iter_values, dtype.np_type)
if dtype.np_type.subdtype is not None and np.__version__[:5] in {"1.21.", "1.22."}:
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is the first time we actually use the version of a dependency. This way is pretty low-tech, and hopefully fine. If we need to do more version-dependent behavior, we'll probably want to use a helper utility such as packaging.version.parse.

Also, CI testing of dependency versions FTW!

We can drop 1.21 in June, and 1.22 next January.

@eriknw
Copy link
Member Author

eriknw commented Feb 4, 2023

I need this for another PR (#382), merging.

@eriknw eriknw merged commit ed6f3ba into python-graphblas:main Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken enhancement Improve existing functionality or make things work better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants