From 584dd3a9e5c847cbd21eb50d4c39496c54303caf Mon Sep 17 00:00:00 2001 From: Bas van Beek <43369155+BvB93@users.noreply.github.com> Date: Thu, 10 Jun 2021 18:10:27 +0200 Subject: MAINT: Add `complex` as allowed type for the `np.complexfloating` constructor --- numpy/__init__.pyi | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/numpy/__init__.pyi b/numpy/__init__.pyi index ec38d4943..a83e5d9c7 100644 --- a/numpy/__init__.pyi +++ b/numpy/__init__.pyi @@ -3129,11 +3129,24 @@ class datetime64(generic): if sys.version_info >= (3, 8): _IntValue = Union[SupportsInt, _CharLike_co, SupportsIndex] _FloatValue = Union[None, _CharLike_co, SupportsFloat, SupportsIndex] - _ComplexValue = Union[None, _CharLike_co, SupportsFloat, SupportsComplex, SupportsIndex] + _ComplexValue = Union[ + None, + _CharLike_co, + SupportsFloat, + SupportsComplex, + SupportsIndex, + complex, # `complex` is not a subtype of `SupportsComplex` + ] else: _IntValue = Union[SupportsInt, _CharLike_co] _FloatValue = Union[None, _CharLike_co, SupportsFloat] - _ComplexValue = Union[None, _CharLike_co, SupportsFloat, SupportsComplex] + _ComplexValue = Union[ + None, + _CharLike_co, + SupportsFloat, + SupportsComplex, + complex, + ] class integer(number[_NBit1]): # type: ignore # NOTE: `__index__` is technically defined in the bottom-most -- cgit v1.2.1