v923z / micropython-ulab

a numpy-like fast vector module for micropython, circuitpython, and their derivatives
https://micropython-ulab.readthedocs.io/en/latest
MIT License
430 stars 117 forks source link

Add missing type hints to `carray` #680

Closed elpekenin closed 3 months ago

elpekenin commented 3 months ago

Very tiny PR :)

Noticed this while looking though CircuitPython's typing issues.

Might as well hint real() and imag() with builtins.complex too, but since it seems not to be supported yet, decided to only hint the supported types even though it contradicts the docstrings.

elpekenin commented 3 months ago

T = TypeVar("T", bound=Union[builtins.complex, ulab.numpy.ndarray]) to indicate that the output is the same type as input would be slightly better, i can change it if prefered, but thought it would be best to keep things simple

v923z commented 3 months ago

Thanks!