add datetime to maps

This commit is contained in:
sneakers-the-rat 2024-07-31 02:03:30 -07:00
parent 44da36407d
commit 0d5e4cf555
Signed by untrusted user who does not match committer: jonny
GPG key ID: 6DCB96EF1E4D232D
2 changed files with 10 additions and 0 deletions

View file

@ -64,5 +64,6 @@ python_to_nptyping = {
int: dt.Int,
bool: dt.Bool,
complex: dt.Complex,
datetime: np.datetime64,
}
"""Map from python types to nptyping types"""

View file

@ -135,6 +135,15 @@ class NDArrayMeta(_NDArrayMeta, implementation="NDArray"):
)
return dtype
def _dtype_to_str(cls, dtype: Any) -> str:
if dtype is Any:
result = "Any"
elif issubclass(dtype, Structure):
result = str(dtype)
elif isinstance(dtype, tuple):
result = ", ".join([str(dt) for dt in dtype])
return result
class NDArray(NPTypingType, metaclass=NDArrayMeta):
"""