1
+ from _typeshed import Incomplete
1
2
from collections .abc import Sequence
2
3
from typing import Any , Literal , Literal as L , TypeAlias , overload
3
4
from typing_extensions import TypeVar
4
5
5
- import numpy as np
6
+ import _numtype as _nt
7
+ from numpy import _OrderKACF # noqa: ICN003
6
8
from numpy ._typing import (
7
- NDArray ,
8
9
_ArrayLikeBool_co ,
9
10
_ArrayLikeComplex_co ,
10
11
_ArrayLikeFloat_co ,
@@ -22,9 +23,9 @@ from numpy._typing import (
22
23
23
24
__all__ = ["einsum" , "einsum_path" ]
24
25
25
- _ArrayT = TypeVar ("_ArrayT" , bound = NDArray [ np . bool | np . number ])
26
+ _ArrayT = TypeVar ("_ArrayT" , bound = _nt . Array [ _nt . co_complex ])
26
27
27
- _OptimizeKind : TypeAlias = bool | Literal ["greedy" , "optimal" ] | Sequence [Any ] | None
28
+ _OptimizeKind : TypeAlias = bool | Literal ["greedy" , "optimal" ] | Sequence [Incomplete ]
28
29
_CastingSafe : TypeAlias = Literal ["no" , "equiv" , "safe" , "same_kind" ]
29
30
_CastingUnsafe : TypeAlias = Literal ["unsafe" ]
30
31
@@ -39,77 +40,77 @@ def einsum(
39
40
subscripts : str | _ArrayLikeInt_co ,
40
41
/ ,
41
42
* operands : _ArrayLikeBool_co ,
42
- out : None = ... ,
43
- dtype : _DTypeLikeBool | None = ... ,
44
- order : np . _OrderKACF = ... ,
45
- casting : _CastingSafe = ... ,
46
- optimize : _OptimizeKind = ... ,
47
- ) -> Any : ...
43
+ out : None = None ,
44
+ optimize : _OptimizeKind | None = None ,
45
+ dtype : _DTypeLikeBool | None = None ,
46
+ order : _OrderKACF = "K" ,
47
+ casting : _CastingSafe = "safe" ,
48
+ ) -> Incomplete : ...
48
49
@overload
49
50
def einsum (
50
51
subscripts : str | _ArrayLikeInt_co ,
51
52
/ ,
52
53
* operands : _ArrayLikeUInt_co ,
53
- out : None = ... ,
54
- dtype : _DTypeLikeUInt | None = ... ,
55
- order : np . _OrderKACF = ... ,
56
- casting : _CastingSafe = ... ,
57
- optimize : _OptimizeKind = ... ,
58
- ) -> Any : ...
54
+ out : None = None ,
55
+ dtype : _DTypeLikeUInt | None = None ,
56
+ order : _OrderKACF = "K" ,
57
+ casting : _CastingSafe = "safe" ,
58
+ optimize : _OptimizeKind | None = None ,
59
+ ) -> Incomplete : ...
59
60
@overload
60
61
def einsum (
61
62
subscripts : str | _ArrayLikeInt_co ,
62
63
/ ,
63
64
* operands : _ArrayLikeInt_co ,
64
- out : None = ... ,
65
- dtype : _DTypeLikeInt | None = ... ,
66
- order : np . _OrderKACF = ... ,
67
- casting : _CastingSafe = ... ,
68
- optimize : _OptimizeKind = ... ,
69
- ) -> Any : ...
65
+ out : None = None ,
66
+ dtype : _DTypeLikeInt | None = None ,
67
+ order : _OrderKACF = "K" ,
68
+ casting : _CastingSafe = "safe" ,
69
+ optimize : _OptimizeKind | None = None ,
70
+ ) -> Incomplete : ...
70
71
@overload
71
72
def einsum (
72
73
subscripts : str | _ArrayLikeInt_co ,
73
74
/ ,
74
75
* operands : _ArrayLikeFloat_co ,
75
- out : None = ... ,
76
- dtype : _DTypeLikeFloat | None = ... ,
77
- order : np . _OrderKACF = ... ,
78
- casting : _CastingSafe = ... ,
79
- optimize : _OptimizeKind = ... ,
80
- ) -> Any : ...
76
+ out : None = None ,
77
+ dtype : _DTypeLikeFloat | None = None ,
78
+ order : _OrderKACF = "K" ,
79
+ casting : _CastingSafe = "safe" ,
80
+ optimize : _OptimizeKind | None = None ,
81
+ ) -> Incomplete : ...
81
82
@overload
82
83
def einsum (
83
84
subscripts : str | _ArrayLikeInt_co ,
84
85
/ ,
85
86
* operands : _ArrayLikeComplex_co ,
86
- out : None = ... ,
87
- dtype : _DTypeLikeComplex | None = ... ,
88
- order : np . _OrderKACF = ... ,
89
- casting : _CastingSafe = ... ,
90
- optimize : _OptimizeKind = ... ,
91
- ) -> Any : ...
87
+ out : None = None ,
88
+ dtype : _DTypeLikeComplex | None = None ,
89
+ order : _OrderKACF = "K" ,
90
+ casting : _CastingSafe = "safe" ,
91
+ optimize : _OptimizeKind | None = None ,
92
+ ) -> Incomplete : ...
92
93
@overload
93
94
def einsum (
94
95
subscripts : str | _ArrayLikeInt_co ,
95
96
/ ,
96
97
* operands : Any ,
97
98
casting : _CastingUnsafe ,
98
- dtype : _DTypeLikeComplex_co | None = ... ,
99
- out : None = ... ,
100
- order : np . _OrderKACF = ... ,
101
- optimize : _OptimizeKind = ... ,
102
- ) -> Any : ...
99
+ dtype : _DTypeLikeComplex_co | None = None ,
100
+ out : None = None ,
101
+ order : _OrderKACF = "K" ,
102
+ optimize : _OptimizeKind | None = None ,
103
+ ) -> Incomplete : ...
103
104
@overload
104
105
def einsum (
105
106
subscripts : str | _ArrayLikeInt_co ,
106
107
/ ,
107
108
* operands : _ArrayLikeComplex_co ,
108
109
out : _ArrayT ,
109
- dtype : _DTypeLikeComplex_co | None = ... ,
110
- order : np . _OrderKACF = ... ,
111
- casting : _CastingSafe = ... ,
112
- optimize : _OptimizeKind = ... ,
110
+ dtype : _DTypeLikeComplex_co | None = None ,
111
+ order : _OrderKACF = "K" ,
112
+ casting : _CastingSafe = "safe" ,
113
+ optimize : _OptimizeKind | None = None ,
113
114
) -> _ArrayT : ...
114
115
@overload
115
116
def einsum (
@@ -118,42 +119,42 @@ def einsum(
118
119
* operands : Any ,
119
120
out : _ArrayT ,
120
121
casting : _CastingUnsafe ,
121
- dtype : _DTypeLikeComplex_co | None = ... ,
122
- order : np . _OrderKACF = ... ,
123
- optimize : _OptimizeKind = ... ,
122
+ dtype : _DTypeLikeComplex_co | None = None ,
123
+ order : _OrderKACF = "K" ,
124
+ optimize : _OptimizeKind | None = None ,
124
125
) -> _ArrayT : ...
125
126
@overload
126
127
def einsum (
127
128
subscripts : str | _ArrayLikeInt_co ,
128
129
/ ,
129
130
* operands : _ArrayLikeObject_co ,
130
- out : None = ... ,
131
- dtype : _DTypeLikeObject | None = ... ,
132
- order : np . _OrderKACF = ... ,
133
- casting : _CastingSafe = ... ,
134
- optimize : _OptimizeKind = ... ,
135
- ) -> Any : ...
131
+ out : None = None ,
132
+ dtype : _DTypeLikeObject | None = None ,
133
+ order : _OrderKACF = "K" ,
134
+ casting : _CastingSafe = "safe" ,
135
+ optimize : _OptimizeKind | None = None ,
136
+ ) -> Incomplete : ...
136
137
@overload
137
138
def einsum (
138
139
subscripts : str | _ArrayLikeInt_co ,
139
140
/ ,
140
141
* operands : Any ,
141
142
casting : _CastingUnsafe ,
142
- dtype : _DTypeLikeObject | None = ... ,
143
- out : None = ... ,
144
- order : np . _OrderKACF = ... ,
145
- optimize : _OptimizeKind = ... ,
146
- ) -> Any : ...
143
+ dtype : _DTypeLikeObject | None = None ,
144
+ out : None = None ,
145
+ order : _OrderKACF = "K" ,
146
+ optimize : _OptimizeKind | None = None ,
147
+ ) -> Incomplete : ...
147
148
@overload
148
149
def einsum (
149
150
subscripts : str | _ArrayLikeInt_co ,
150
151
/ ,
151
152
* operands : _ArrayLikeObject_co ,
152
153
out : _ArrayT ,
153
- dtype : _DTypeLikeObject | None = ... ,
154
- order : np . _OrderKACF = ... ,
155
- casting : _CastingSafe = ... ,
156
- optimize : _OptimizeKind = ... ,
154
+ dtype : _DTypeLikeObject | None = None ,
155
+ order : _OrderKACF = "K" ,
156
+ casting : _CastingSafe = "safe" ,
157
+ optimize : _OptimizeKind | None = None ,
157
158
) -> _ArrayT : ...
158
159
@overload
159
160
def einsum (
@@ -162,9 +163,9 @@ def einsum(
162
163
* operands : Any ,
163
164
out : _ArrayT ,
164
165
casting : _CastingUnsafe ,
165
- dtype : _DTypeLikeObject | None = ... ,
166
- order : np . _OrderKACF = ... ,
167
- optimize : _OptimizeKind = ... ,
166
+ dtype : _DTypeLikeObject | None = None ,
167
+ order : _OrderKACF = "K" ,
168
+ optimize : _OptimizeKind | None = None ,
168
169
) -> _ArrayT : ...
169
170
170
171
# NOTE: `einsum_call` is a hidden kwarg unavailable for public use.
@@ -177,4 +178,4 @@ def einsum_path(
177
178
* operands : _ArrayLikeComplex_co | _DTypeLikeObject ,
178
179
optimize : _OptimizeKind = "greedy" ,
179
180
einsum_call : L [False ] = False ,
180
- ) -> tuple [list [Any ], str ]: ...
181
+ ) -> tuple [list [Incomplete ], str ]: ...
0 commit comments