GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||
GeezerVison is showing github.com — TYP: typehints for __array__ · Issue #29203 · numpy/numpy Labels DescriptionDescribe the issue:I have a class that has an numpy array as an attribute. Its Reproduce the code example:import numpy as np import numpy.typing as npt from typing import Optional class Test: def __init__(self, ar: np.ndarray): self.ar = ar def __array__(self, dtype: Optional[npt.DTypeLike] = None, *, copy: Optional[bool] = None) -> np.ndarray: return self.ar.__array__(dtype,copy=copy) Error message:test.py:14: error: Argument 1 to "__array__" of "ndarray" has incompatible type "type[Any] | dtype[Any] | _SupportsDType[dtype[Any]] | tuple[Any, Any] | list[Any] | _DTypeDict | str | None | None"; expected "None" [arg-type] test.py:14: error: Argument "copy" to "__array__" of "ndarray" has incompatible type "builtins.bool | None"; expected "numpy.bool[builtins.bool] | None" [arg-type] Python and NumPy Versions:
Type-checker version and settings:
Additional typing packages.n/a Activity
MetadataMetadataAssigneesLabelsTypeProjectsMilestoneRelationshipsDevelopmentIssue actions | ||||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |