29
29
@overload
30
30
def is_constant (x : NDArray [Any ] | types .CSBase | types .CupyArray , / , * , axis : None = None ) -> bool : ...
31
31
@overload
32
- def is_constant (x : NDArray [Any ] | types .CSBase , / , * , axis : Literal [0 , 1 ]) -> NDArray [np .bool_ ]: ...
32
+ def is_constant (x : NDArray [Any ] | types .CSBase , / , * , axis : Literal [0 , 1 ]) -> NDArray [np .bool ]: ...
33
33
@overload
34
34
def is_constant (x : types .CupyArray , / , * , axis : Literal [0 , 1 ]) -> types .CupyArray : ...
35
35
@overload
36
- def is_constant (x : types .DaskArray , / , * , axis : Literal [0 , 1 , None ] = None ) -> types .DaskArray : ...
36
+ def is_constant (x : types .DaskArray , / , * , axis : Literal [0 , 1 ] | None = None ) -> types .DaskArray : ...
37
37
38
38
39
39
def is_constant (
40
40
x : NDArray [Any ] | types .CSBase | types .CupyArray | types .DaskArray ,
41
41
/ ,
42
42
* ,
43
- axis : Literal [0 , 1 , None ] = None ,
44
- ) -> bool | NDArray [np .bool_ ] | types .CupyArray | types .DaskArray :
43
+ axis : Literal [0 , 1 ] | None = None ,
44
+ ) -> bool | NDArray [np .bool ] | types .CupyArray | types .DaskArray :
45
45
"""Check whether values in array are constant.
46
46
47
47
Parameters
@@ -80,7 +80,7 @@ def is_constant(
80
80
# TODO(flying-sheep): support CSDataset (TODO)
81
81
# https://github.com/scverse/fast-array-utils/issues/52
82
82
@overload
83
- def mean (x : CpuArray | GpuArray | DiskArray , / , * , axis : Literal [ None ] = None , dtype : DTypeLike | None = None ) -> np .number [Any ]: ...
83
+ def mean (x : CpuArray | GpuArray | DiskArray , / , * , axis : None = None , dtype : DTypeLike | None = None ) -> np .number [Any ]: ...
84
84
@overload
85
85
def mean (x : CpuArray | DiskArray , / , * , axis : Literal [0 , 1 ], dtype : DTypeLike | None = None ) -> NDArray [np .number [Any ]]: ...
86
86
@overload
@@ -93,7 +93,7 @@ def mean(
93
93
x : CpuArray | GpuArray | DiskArray | types .DaskArray ,
94
94
/ ,
95
95
* ,
96
- axis : Literal [0 , 1 , None ] = None ,
96
+ axis : Literal [0 , 1 ] | None = None ,
97
97
dtype : DTypeLike | None = None ,
98
98
) -> NDArray [np .number [Any ]] | types .CupyArray | np .number [Any ] | types .DaskArray :
99
99
"""Mean over both or one axis.
@@ -131,24 +131,24 @@ def mean(
131
131
from ._mean import mean_
132
132
133
133
validate_axis (x .ndim , axis )
134
- return mean_ (x , axis = axis , dtype = dtype ) # type: ignore[no-any-return] # literally the same type, wtf mypy
134
+ return mean_ (x , axis = axis , dtype = dtype )
135
135
136
136
137
137
@overload
138
- def mean_var (x : CpuArray | GpuArray , / , * , axis : Literal [ None ] = None , correction : int = 0 ) -> tuple [np .float64 , np .float64 ]: ...
138
+ def mean_var (x : CpuArray | GpuArray , / , * , axis : None = None , correction : int = 0 ) -> tuple [np .float64 , np .float64 ]: ...
139
139
@overload
140
140
def mean_var (x : CpuArray , / , * , axis : Literal [0 , 1 ], correction : int = 0 ) -> tuple [NDArray [np .float64 ], NDArray [np .float64 ]]: ...
141
141
@overload
142
142
def mean_var (x : GpuArray , / , * , axis : Literal [0 , 1 ], correction : int = 0 ) -> tuple [types .CupyArray , types .CupyArray ]: ...
143
143
@overload
144
- def mean_var (x : types .DaskArray , / , * , axis : Literal [0 , 1 , None ] = None , correction : int = 0 ) -> tuple [types .DaskArray , types .DaskArray ]: ...
144
+ def mean_var (x : types .DaskArray , / , * , axis : Literal [0 , 1 ] | None = None , correction : int = 0 ) -> tuple [types .DaskArray , types .DaskArray ]: ...
145
145
146
146
147
147
def mean_var (
148
148
x : CpuArray | GpuArray | types .DaskArray ,
149
149
/ ,
150
150
* ,
151
- axis : Literal [0 , 1 , None ] = None ,
151
+ axis : Literal [0 , 1 ] | None = None ,
152
152
correction : int = 0 ,
153
153
) -> (
154
154
tuple [np .float64 , np .float64 ]
@@ -218,14 +218,14 @@ def sum(x: GpuArray, /, *, axis: Literal[0, 1], dtype: DTypeLike | None = None,
218
218
219
219
220
220
@overload
221
- def sum (x : types .DaskArray , / , * , axis : Literal [0 , 1 , None ] = None , dtype : DTypeLike | None = None , keep_cupy_as_array : bool = False ) -> types .DaskArray : ...
221
+ def sum (x : types .DaskArray , / , * , axis : Literal [0 , 1 ] | None = None , dtype : DTypeLike | None = None , keep_cupy_as_array : bool = False ) -> types .DaskArray : ...
222
222
223
223
224
224
def sum (
225
225
x : CpuArray | GpuArray | DiskArray | types .DaskArray ,
226
226
/ ,
227
227
* ,
228
- axis : Literal [0 , 1 , None ] = None ,
228
+ axis : Literal [0 , 1 ] | None = None ,
229
229
dtype : DTypeLike | None = None ,
230
230
keep_cupy_as_array : bool = False ,
231
231
) -> NDArray [Any ] | types .CupyArray | np .number [Any ] | types .DaskArray :
0 commit comments