@@ -31,14 +31,7 @@ from typing import (
31
31
overload ,
32
32
type_check_only ,
33
33
)
34
- from typing_extensions import (
35
- Buffer ,
36
- CapsuleType ,
37
- Protocol ,
38
- TypeVar ,
39
- deprecated ,
40
- override ,
41
- )
34
+ from typing_extensions import Buffer , CapsuleType , Protocol , TypeVar , deprecated , override
42
35
43
36
import _numtype as _nt
44
37
@@ -360,7 +353,6 @@ from ._typing import (
360
353
_ShapeLike ,
361
354
_TD64Like_co ,
362
355
)
363
- from ._typing ._char_codes import _LongCodes , _ULongCodes
364
356
from .lib import scimath as emath
365
357
from .lib ._arraypad_impl import pad
366
358
from .lib ._arraysetops_impl import (
@@ -654,10 +646,7 @@ _NumberItemT = TypeVar("_NumberItemT", bound=complex)
654
646
_NumberItemT_co = TypeVar ("_NumberItemT_co" , bound = complex , default = Any , covariant = True )
655
647
_InexactItemT_co = TypeVar ("_InexactItemT_co" , bound = complex , default = Any , covariant = True )
656
648
_FlexItemT_co = TypeVar (
657
- "_FlexItemT_co" ,
658
- bound = bytes | str | tuple [object , ...],
659
- default = bytes | str | tuple [Any , ...],
660
- covariant = True ,
649
+ "_FlexItemT_co" , bound = bytes | str | tuple [object , ...], default = bytes | str | tuple [Any , ...], covariant = True
661
650
)
662
651
_CharacterItemT_co = TypeVar ("_CharacterItemT_co" , bound = bytes | str , default = bytes | str , covariant = True )
663
652
_TD64ItemT_co = TypeVar (
@@ -1191,219 +1180,111 @@ class dtype(Generic[_ScalarT_co], metaclass=_DTypeMeta):
1191
1180
#
1192
1181
@overload
1193
1182
def __new__ (
1194
- cls ,
1195
- dtype : _nt .ToDTypeBool ,
1196
- align : py_bool = False ,
1197
- copy : py_bool = False ,
1198
- metadata : _MetaData = ...,
1183
+ cls , dtype : _nt .ToDTypeBool , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1199
1184
) -> dtypes .BoolDType : ...
1200
1185
@overload
1201
1186
def __new__ (
1202
- cls ,
1203
- dtype : _nt .ToDTypeInt8 ,
1204
- align : py_bool = False ,
1205
- copy : py_bool = False ,
1206
- metadata : _MetaData = ...,
1187
+ cls , dtype : _nt .ToDTypeInt8 , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1207
1188
) -> dtypes .Int8DType : ...
1208
1189
@overload
1209
1190
def __new__ (
1210
- cls ,
1211
- dtype : _nt .ToDTypeUInt8 ,
1212
- align : py_bool = False ,
1213
- copy : py_bool = False ,
1214
- metadata : _MetaData = ...,
1215
- ) -> dtypes .UByteDType : ...
1191
+ cls , dtype : _nt .ToDTypeUInt8 , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1192
+ ) -> dtypes .UInt8DType : ...
1216
1193
@overload
1217
1194
def __new__ (
1218
- cls ,
1219
- dtype : _nt .ToDTypeInt16 ,
1220
- align : py_bool = False ,
1221
- copy : py_bool = False ,
1222
- metadata : _MetaData = ...,
1195
+ cls , dtype : _nt .ToDTypeInt16 , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1223
1196
) -> dtypes .Int16DType : ...
1224
1197
@overload
1225
1198
def __new__ (
1226
- cls ,
1227
- dtype : _nt .ToDTypeUInt16 ,
1228
- align : py_bool = False ,
1229
- copy : py_bool = False ,
1230
- metadata : _MetaData = ...,
1199
+ cls , dtype : _nt .ToDTypeUInt16 , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1231
1200
) -> dtypes .UInt16DType : ...
1232
1201
@overload
1233
1202
def __new__ (
1234
- cls ,
1235
- dtype : _nt .ToDTypeInt32 ,
1236
- align : py_bool = False ,
1237
- copy : py_bool = False ,
1238
- metadata : _MetaData = ...,
1203
+ cls , dtype : _nt .ToDTypeInt32 , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1239
1204
) -> dtypes .Int32DType : ...
1240
1205
@overload
1241
1206
def __new__ (
1242
- cls ,
1243
- dtype : _nt .ToDTypeUInt32 ,
1244
- align : py_bool = False ,
1245
- copy : py_bool = False ,
1246
- metadata : _MetaData = ...,
1207
+ cls , dtype : _nt .ToDTypeUInt32 , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1247
1208
) -> dtypes .UInt32DType : ...
1248
1209
@overload
1249
1210
def __new__ (
1250
- cls ,
1251
- dtype : type [ct .c_long ] | _LongCodes ,
1252
- align : py_bool = False ,
1253
- copy : py_bool = False ,
1254
- metadata : _MetaData = ...,
1211
+ cls , dtype : _nt .ToDTypeLong , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1255
1212
) -> dtypes .LongDType : ...
1256
1213
@overload
1257
1214
def __new__ (
1258
- cls ,
1259
- dtype : type [ct .c_ulong ] | _ULongCodes ,
1260
- align : py_bool = False ,
1261
- copy : py_bool = False ,
1262
- metadata : _MetaData = ...,
1215
+ cls , dtype : _nt .ToDTypeULong , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1263
1216
) -> dtypes .ULongDType : ...
1264
1217
@overload
1265
1218
def __new__ (
1266
- cls ,
1267
- dtype : _nt .ToDTypeInt64 ,
1268
- align : py_bool = False ,
1269
- copy : py_bool = False ,
1270
- metadata : _MetaData = ...,
1219
+ cls , dtype : _nt .ToDTypeInt64 , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1271
1220
) -> dtypes .Int64DType : ...
1272
1221
@overload
1273
1222
def __new__ (
1274
- cls ,
1275
- dtype : _nt .ToDTypeUInt64 ,
1276
- align : py_bool = False ,
1277
- copy : py_bool = False ,
1278
- metadata : _MetaData = ...,
1223
+ cls , dtype : _nt .ToDTypeUInt64 , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1279
1224
) -> dtypes .UInt64DType : ...
1280
1225
@overload
1281
1226
def __new__ (
1282
- cls ,
1283
- dtype : _nt .ToDTypeFloat16 ,
1284
- align : py_bool = False ,
1285
- copy : py_bool = False ,
1286
- metadata : _MetaData = ...,
1227
+ cls , dtype : _nt .ToDTypeFloat16 , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1287
1228
) -> dtypes .Float16DType : ...
1288
1229
@overload
1289
1230
def __new__ (
1290
- cls ,
1291
- dtype : _nt .ToDTypeFloat32 ,
1292
- align : py_bool = False ,
1293
- copy : py_bool = False ,
1294
- metadata : _MetaData = ...,
1231
+ cls , dtype : _nt .ToDTypeFloat32 , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1295
1232
) -> dtypes .Float32DType : ...
1296
1233
@overload
1297
1234
def __new__ (
1298
- cls ,
1299
- dtype : _nt .ToDTypeFloat64 | None ,
1300
- align : py_bool = False ,
1301
- copy : py_bool = False ,
1302
- metadata : _MetaData = ...,
1235
+ cls , dtype : _nt .ToDTypeFloat64 | None , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1303
1236
) -> dtypes .Float64DType : ...
1304
1237
@overload
1305
1238
def __new__ (
1306
- cls ,
1307
- dtype : _nt .ToDTypeLongDouble ,
1308
- align : py_bool = False ,
1309
- copy : py_bool = False ,
1310
- metadata : _MetaData = ...,
1239
+ cls , dtype : _nt .ToDTypeLongDouble , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1311
1240
) -> dtypes .LongDoubleDType : ...
1312
1241
@overload
1313
1242
def __new__ (
1314
- cls ,
1315
- dtype : _nt .ToDTypeComplex64 ,
1316
- align : py_bool = False ,
1317
- copy : py_bool = False ,
1318
- metadata : _MetaData = ...,
1243
+ cls , dtype : _nt .ToDTypeComplex64 , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1319
1244
) -> dtypes .Complex64DType : ...
1320
1245
@overload
1321
1246
def __new__ (
1322
- cls ,
1323
- dtype : _nt .ToDTypeComplex128 ,
1324
- align : py_bool = False ,
1325
- copy : py_bool = False ,
1326
- metadata : _MetaData = ...,
1247
+ cls , dtype : _nt .ToDTypeComplex128 , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1327
1248
) -> dtypes .Complex128DType : ...
1328
1249
@overload
1329
1250
def __new__ (
1330
- cls ,
1331
- dtype : _nt .ToDTypeCLongDouble ,
1332
- align : py_bool = False ,
1333
- copy : py_bool = False ,
1334
- metadata : _MetaData = ...,
1251
+ cls , dtype : _nt .ToDTypeCLongDouble , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1335
1252
) -> dtypes .CLongDoubleDType : ...
1336
1253
@overload
1337
1254
def __new__ (
1338
- cls ,
1339
- dtype : _nt .ToDTypeObject ,
1340
- align : py_bool = False ,
1341
- copy : py_bool = False ,
1342
- metadata : _MetaData = ...,
1255
+ cls , dtype : _nt .ToDTypeObject , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1343
1256
) -> dtypes .ObjectDType : ...
1344
1257
@overload
1345
1258
def __new__ (
1346
- cls ,
1347
- dtype : _nt .ToDTypeBytes ,
1348
- align : py_bool = False ,
1349
- copy : py_bool = False ,
1350
- metadata : _MetaData = ...,
1259
+ cls , dtype : _nt .ToDTypeBytes , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1351
1260
) -> dtypes .BytesDType : ...
1352
1261
@overload
1353
1262
def __new__ ( # type: ignore[overload-overlap]
1354
- cls ,
1355
- dtype : _nt .ToDTypeStr ,
1356
- align : py_bool = False ,
1357
- copy : py_bool = False ,
1358
- metadata : _MetaData = ...,
1263
+ cls , dtype : _nt .ToDTypeStr , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1359
1264
) -> dtypes .StrDType : ...
1360
1265
@overload
1361
1266
def __new__ (
1362
- cls ,
1363
- dtype : _nt .ToDTypeVoid ,
1364
- align : py_bool = False ,
1365
- copy : py_bool = False ,
1366
- metadata : _MetaData = ...,
1267
+ cls , dtype : _nt .ToDTypeVoid , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1367
1268
) -> dtypes .VoidDType : ...
1368
1269
@overload
1369
1270
def __new__ (
1370
- cls ,
1371
- dtype : _nt .ToDTypeDateTime64 ,
1372
- align : py_bool = False ,
1373
- copy : py_bool = False ,
1374
- metadata : _MetaData = ...,
1271
+ cls , dtype : _nt .ToDTypeDateTime64 , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1375
1272
) -> dtypes .DateTime64DType : ...
1376
1273
@overload
1377
1274
def __new__ (
1378
- cls ,
1379
- dtype : _nt .ToDTypeTimeDelta64 ,
1380
- align : py_bool = False ,
1381
- copy : py_bool = False ,
1382
- metadata : _MetaData = ...,
1275
+ cls , dtype : _nt .ToDTypeTimeDelta64 , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1383
1276
) -> dtypes .TimeDelta64DType : ...
1384
1277
@overload
1385
1278
def __new__ (
1386
- cls ,
1387
- dtype : _nt .ToDTypeString ,
1388
- align : py_bool = False ,
1389
- copy : py_bool = False ,
1390
- metadata : _MetaData = ...,
1279
+ cls , dtype : _nt .ToDTypeString , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1391
1280
) -> dtypes .StringDType : ...
1392
1281
@overload
1393
1282
def __new__ (
1394
- cls ,
1395
- dtype : _DTypeLike [_ScalarT_co ],
1396
- align : py_bool = False ,
1397
- copy : py_bool = False ,
1398
- metadata : _MetaData = ...,
1283
+ cls , dtype : _DTypeLike [_ScalarT_co ], align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1399
1284
) -> Self : ...
1400
1285
@overload
1401
1286
def __new__ (
1402
- cls ,
1403
- dtype : DTypeLike ,
1404
- align : py_bool = False ,
1405
- copy : py_bool = False ,
1406
- metadata : _MetaData = ...,
1287
+ cls , dtype : DTypeLike , align : py_bool = False , copy : py_bool = False , metadata : _MetaData = ...
1407
1288
) -> dtype : ...
1408
1289
1409
1290
#
@@ -1544,7 +1425,7 @@ class _ArrayOrScalarCommon:
1544
1425
keepdims : py_bool = False ,
1545
1426
initial : _NumberLike_co = ...,
1546
1427
where : _nt .ToBool_nd = True ,
1547
- ) -> Any : ...
1428
+ ) -> Incomplete : ...
1548
1429
@overload
1549
1430
def max (
1550
1431
self ,
@@ -1571,7 +1452,7 @@ class _ArrayOrScalarCommon:
1571
1452
@overload # axis=None (default), out=None (default), keepdims=False (default)
1572
1453
def argmax (self , / , axis : None = None , out : None = None , * , keepdims : L [False ] = False ) -> intp : ...
1573
1454
@overload # axis=index, out=None (default)
1574
- def argmax (self , / , axis : CanIndex , out : None = None , * , keepdims : py_bool = False ) -> Any : ...
1455
+ def argmax (self , / , axis : CanIndex , out : None = None , * , keepdims : py_bool = False ) -> Incomplete : ...
1575
1456
@overload # axis=index, out=ndarray
1576
1457
def argmax (self , / , axis : CanIndex | None , out : _ArrayT , * , keepdims : py_bool = False ) -> _ArrayT : ...
1577
1458
@overload
@@ -1587,7 +1468,7 @@ class _ArrayOrScalarCommon:
1587
1468
keepdims : py_bool = False ,
1588
1469
initial : _NumberLike_co = ...,
1589
1470
where : _nt .ToBool_nd = True ,
1590
- ) -> Any : ...
1471
+ ) -> Incomplete : ...
1591
1472
@overload
1592
1473
def min (
1593
1474
self ,
@@ -1614,7 +1495,7 @@ class _ArrayOrScalarCommon:
1614
1495
@overload # axis=None (default), out=None (default), keepdims=False (default)
1615
1496
def argmin (self , / , axis : None = None , out : None = None , * , keepdims : L [False ] = False ) -> intp : ...
1616
1497
@overload # axis=index, out=None (default)
1617
- def argmin (self , / , axis : CanIndex , out : None = None , * , keepdims : py_bool = False ) -> Any : ...
1498
+ def argmin (self , / , axis : CanIndex , out : None = None , * , keepdims : py_bool = False ) -> Incomplete : ...
1618
1499
@overload # axis=index, out=ndarray
1619
1500
def argmin (self , / , axis : CanIndex | None , out : _ArrayT , * , keepdims : py_bool = False ) -> _ArrayT : ...
1620
1501
@overload
@@ -1637,12 +1518,7 @@ class _ArrayOrScalarCommon:
1637
1518
# TODO: Annotate kwargs with an unpacked `TypedDict`
1638
1519
@overload # out: None (default)
1639
1520
def clip (
1640
- self ,
1641
- / ,
1642
- min : ArrayLike ,
1643
- max : ArrayLike | None = None ,
1644
- out : None = None ,
1645
- ** kwargs : object ,
1521
+ self , / , min : ArrayLike , max : ArrayLike | None = None , out : None = None , ** kwargs : object
1646
1522
) -> _nt .Array : ...
1647
1523
@overload
1648
1524
def clip (self , / , min : None , max : ArrayLike , out : None = None , ** kwargs : object ) -> _nt .Array : ...
@@ -1659,13 +1535,7 @@ class _ArrayOrScalarCommon:
1659
1535
1660
1536
#
1661
1537
@overload
1662
- def compress (
1663
- self ,
1664
- / ,
1665
- condition : _nt .CoInteger_nd ,
1666
- axis : CanIndex | None = None ,
1667
- out : None = None ,
1668
- ) -> _nt .Array : ...
1538
+ def compress (self , / , condition : _nt .CoInteger_nd , axis : CanIndex | None = None , out : None = None ) -> _nt .Array : ...
1669
1539
@overload
1670
1540
def compress (self , / , condition : _nt .CoInteger_nd , axis : CanIndex | None , out : _ArrayT ) -> _ArrayT : ...
1671
1541
@overload
@@ -1674,11 +1544,7 @@ class _ArrayOrScalarCommon:
1674
1544
#
1675
1545
@overload # out: None (default)
1676
1546
def cumprod (
1677
- self ,
1678
- / ,
1679
- axis : CanIndex | None = None ,
1680
- dtype : DTypeLike | None = None ,
1681
- out : None = None ,
1547
+ self , / , axis : CanIndex | None = None , dtype : DTypeLike | None = None , out : None = None
1682
1548
) -> _nt .Array : ...
1683
1549
@overload # out: ndarray
1684
1550
def cumprod (self , / , axis : CanIndex | None , dtype : DTypeLike | None , out : _ArrayT ) -> _ArrayT : ...
@@ -1725,11 +1591,7 @@ class _ArrayOrScalarCommon:
1725
1591
#
1726
1592
@overload # out: None (default)
1727
1593
def cumsum (
1728
- self ,
1729
- / ,
1730
- axis : CanIndex | None = None ,
1731
- dtype : DTypeLike | None = None ,
1732
- out : None = None ,
1594
+ self , / , axis : CanIndex | None = None , dtype : DTypeLike | None = None , out : None = None
1733
1595
) -> _nt .Array : ...
1734
1596
@overload # out: ndarray
1735
1597
def cumsum (self , / , axis : CanIndex | None , dtype : DTypeLike | None , out : _ArrayT ) -> _ArrayT : ...
@@ -3446,7 +3308,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
3446
3308
casting : _CastingKind = "unsafe" ,
3447
3309
subok : py_bool = True ,
3448
3310
copy : py_bool | _CopyMode = True ,
3449
- ) -> ndarray [_ShapeT_co , dtype ]: ...
3311
+ ) -> ndarray [_ShapeT_co ]: ...
3450
3312
3451
3313
# the special casings work around the lack of higher-kinded typing (HKT) support in Python
3452
3314
@overload # ()
0 commit comments