Add structured dtype support for AnyVoidArray#584
Conversation
|
😿 |
The CI failures are for numpy<2.3, so I assume you locally have the latest NumPy installed. I'll take a look soon. |
yes, |
| from typing import NotRequired, TypeAliasType | ||
| else: | ||
| from typing import NotRequired |
There was a problem hiding this comment.
typing.NotRequired is imported in both branches, so it should be moved to the main typing import
|
|
||
|
|
||
| import numpy as np | ||
| import numpy.typing as npt |
There was a problem hiding this comment.
optype.numpy is intended as a complete replacement for numpy.typing, so this shouldn't be imported.
| | tuple[str, npt.DTypeLike, int] | ||
| | tuple[str, npt.DTypeLike, tuple[int, ...]] |
| | tuple[tuple[Any, str], npt.DTypeLike, int] | ||
| | tuple[tuple[Any, str], npt.DTypeLike, tuple[int, ...]] |
| _StructuredDTypeField: TypeAlias = ( | ||
| tuple[str, npt.DTypeLike] | ||
| | tuple[str, npt.DTypeLike, int] | ||
| | tuple[str, npt.DTypeLike, tuple[int, ...]] | ||
| | tuple[tuple[Any, str], npt.DTypeLike] | ||
| | tuple[tuple[Any, str], npt.DTypeLike, int] | ||
| | tuple[tuple[Any, str], npt.DTypeLike, tuple[int, ...]] | ||
| ) |
There was a problem hiding this comment.
Like I said, we should use AnyDType here instead of npt.DTypeLike. That'd make this a recursive definition, so it's better to use TypeAliasType instead of TypeAlias.
| | Sequence[tuple[_ToName, _ToDType] | tuple[_ToName, _ToDType, _ToShape]] | ||
|
|
||
|
|
||
| class _StructuredDTypeDictForm1(TypedDict, total=True): |
There was a problem hiding this comment.
total=True is the default
| class _StructuredDTypeDictForm1(TypedDict, total=True): | |
| class _StructuredDTypeDictForm1(TypedDict): |
There was a problem hiding this comment.
Ehhh, these tests have nothing to do with AnyVoidDType. You're mostly testing numpy itself here, and also the (completely unrelated) optype.numpy.AnyVoidArray...
|
thanks for the review, i'm converting in draft for now, as this needs work.... actually i tried to rebase this pr from my tool 😁 which i built to automate and make smooth the rebase process (https://github.com/Aniketsy/grebase) as i used to mess up while rebasing....But i think i've done some mistakes so will rectify soon. |
fixes #371