@@ -7,11 +7,11 @@ from typing_extensions import TypeAliasType, TypeVar
7
7
8
8
import numpy as np
9
9
10
- __all__ = ["CanCast0D" , "CanCastND" , "CanNEP50" , "MatchND" , "PromoteWith" ]
10
+ __all__ = ["CanCast0D" , "CanCastND" , "CanNEP50" , "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 )
14
- _AboveT_contra = TypeVar ("_AboveT_contra" , bound = np . generic , contravariant = True , default = Any )
14
+ _AboveT_contra = TypeVar ("_AboveT_contra" , contravariant = True , default = Any )
15
15
_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 )
@@ -21,23 +21,46 @@ class CanNEP50(Protocol[_BelowT_contra, _AboveT_contra, _MatchT_co]):
21
21
def __nep50__ (self , below : _BelowT_contra , above : _AboveT_contra , / ) -> _MatchT_co : ...
22
22
23
23
@type_check_only
24
- class _CanNEP50Int (Protocol [_OtherT_contra , _T_co ]):
25
- def __nep50_int__ (self , other : _OtherT_contra , / ) -> _T_co : ...
24
+ class _CanNEP50Rule0 (Protocol [_OtherT_contra , _T_co ]):
25
+ def __nep50_rule0__ (self , other : _OtherT_contra , / ) -> _T_co : ...
26
26
27
27
@type_check_only
28
- class _CanNEP50Float (Protocol [_OtherT_contra , _T_co ]):
29
- def __nep50_float__ (self , other : _OtherT_contra , / ) -> _T_co : ...
28
+ class _CanNEP50Rule1 (Protocol [_OtherT_contra , _T_co ]):
29
+ def __nep50_rule1__ (self , other : _OtherT_contra , / ) -> _T_co : ...
30
30
31
31
@type_check_only
32
- class _CanNEP50Complex (Protocol [_OtherT_contra , _T_co ]):
33
- def __nep50_complex__ (self , other : _OtherT_contra , / ) -> _T_co : ...
32
+ class _CanNEP50Rule2 (Protocol [_OtherT_contra , _T_co ]):
33
+ def __nep50_rule2__ (self , other : _OtherT_contra , / ) -> _T_co : ...
34
+
35
+ @type_check_only
36
+ class _CanNEP50Rule3 (Protocol [_OtherT_contra , _T_co ]):
37
+ def __nep50_rule3__ (self , other : _OtherT_contra , / ) -> _T_co : ...
38
+
39
+ @type_check_only
40
+ class _CanNEP50Rule4 (Protocol [_OtherT_contra , _T_co ]):
41
+ def __nep50_rule4__ (self , other : _OtherT_contra , / ) -> _T_co : ...
42
+
43
+ @type_check_only
44
+ class _CanNEP50Rule5 (Protocol [_OtherT_contra , _T_co ]):
45
+ def __nep50_rule5__ (self , other : _OtherT_contra , / ) -> _T_co : ...
34
46
35
47
_WithT = TypeVar ("_WithT" )
36
48
_OutT = TypeVar ("_OutT" , bound = np .generic )
37
49
38
50
PromoteWith = TypeAliasType (
39
51
"PromoteWith" ,
40
- _CanNEP50Int [_WithT , _OutT ] | _CanNEP50Float [_WithT , _OutT ] | _CanNEP50Complex [_WithT , _OutT ],
52
+ CanNEP50 [Any , _WithT , _OutT ]
53
+ | _CanNEP50Rule0 [_WithT , _OutT ]
54
+ | _CanNEP50Rule1 [_WithT , _OutT ]
55
+ | _CanNEP50Rule2 [_WithT , _OutT ]
56
+ | _CanNEP50Rule3 [_WithT , _OutT ]
57
+ | _CanNEP50Rule4 [_WithT , _OutT ]
58
+ | _CanNEP50Rule5 [_WithT , _OutT ],
59
+ type_params = (_WithT , _OutT ),
60
+ )
61
+ PromoteWith0D = TypeAliasType (
62
+ "PromoteWith0D" ,
63
+ MatchND [tuple [()], PromoteWith [_WithT , _OutT ]],
41
64
type_params = (_WithT , _OutT ),
42
65
)
43
66
0 commit comments