@@ -7,7 +7,7 @@ from typing_extensions import TypeAliasType, TypeVar
7
7
8
8
import numpy as np
9
9
10
- __all__ = ["CanCast0D" , "CanCastND" , "CanNEP50" , "MatchND" , "PromoteWith" , "PromoteWith0D" ]
10
+ __all__ = ["CanCast0D" , "CanCastND" , "CanNEP50" , "CanNEP50Complex" , "CanNEP50Float" , " MatchND" , "PromoteWith" , "PromoteWith0D" ]
11
11
12
12
_T_co = TypeVar ("_T_co" , covariant = True )
13
13
_BelowT_contra = TypeVar ("_BelowT_contra" , bound = np .generic , contravariant = True )
@@ -16,6 +16,9 @@ _OtherT_contra = TypeVar("_OtherT_contra", contravariant=True)
16
16
_MatchT_co = TypeVar ("_MatchT_co" , bound = np .generic , covariant = True , default = Any )
17
17
_ShapeT_co = TypeVar ("_ShapeT_co" , bound = tuple [int , ...], covariant = True )
18
18
19
+ _ComplexFloatingT_co = TypeVar ("_ComplexFloatingT_co" , bound = np .complexfloating , covariant = True )
20
+ _InexactT_co = TypeVar ("_InexactT_co" , bound = np .inexact , covariant = True )
21
+
19
22
@type_check_only
20
23
class CanNEP50 (Protocol [_BelowT_contra , _AboveT_contra , _MatchT_co ]):
21
24
def __nep50__ (self , below : _BelowT_contra , above : _AboveT_contra , / ) -> _MatchT_co : ...
@@ -44,6 +47,18 @@ class _CanNEP50Rule4(Protocol[_OtherT_contra, _T_co]):
44
47
class _CanNEP50Rule5 (Protocol [_OtherT_contra , _T_co ]):
45
48
def __nep50_rule5__ (self , other : _OtherT_contra , / ) -> _T_co : ...
46
49
50
+ @type_check_only
51
+ class _CanNEP50Rule6 (Protocol [_OtherT_contra , _T_co ]):
52
+ def __nep50_rule6__ (self , other : _OtherT_contra , / ) -> _T_co : ...
53
+
54
+ @type_check_only
55
+ class CanNEP50Float (Protocol [_InexactT_co ]):
56
+ def __nep50_float__ (self , / ) -> _InexactT_co : ...
57
+
58
+ @type_check_only
59
+ class CanNEP50Complex (Protocol [_ComplexFloatingT_co ]):
60
+ def __nep50_complex__ (self , / ) -> _ComplexFloatingT_co : ...
61
+
47
62
_WithT = TypeVar ("_WithT" )
48
63
_OutT = TypeVar ("_OutT" , bound = np .generic )
49
64
@@ -55,7 +70,8 @@ PromoteWith = TypeAliasType(
55
70
| _CanNEP50Rule2 [_WithT , _OutT ]
56
71
| _CanNEP50Rule3 [_WithT , _OutT ]
57
72
| _CanNEP50Rule4 [_WithT , _OutT ]
58
- | _CanNEP50Rule5 [_WithT , _OutT ],
73
+ | _CanNEP50Rule5 [_WithT , _OutT ]
74
+ | _CanNEP50Rule6 [_WithT , _OutT ],
59
75
type_params = (_WithT , _OutT ),
60
76
)
61
77
PromoteWith0D = TypeAliasType (
0 commit comments