@@ -353,38 +353,9 @@ from ._typing import (
353
353
_ScalarLike_co ,
354
354
_ShapeLike ,
355
355
_TD64Like_co ,
356
- _VoidDTypeLike ,
357
356
_nbit_base as _n ,
358
357
)
359
- from ._typing ._char_codes import (
360
- _BoolCodes ,
361
- _BytesCodes ,
362
- _CLongDoubleCodes ,
363
- _Complex64Codes ,
364
- _Complex128Codes ,
365
- _DT64Codes ,
366
- _Float16Codes ,
367
- _Float32Codes ,
368
- _Float64Codes ,
369
- _Int8Codes ,
370
- _Int16Codes ,
371
- _Int32Codes ,
372
- _Int64Codes ,
373
- _IntPCodes ,
374
- _LongCodes ,
375
- _LongDoubleCodes ,
376
- _ObjectCodes ,
377
- _StrCodes ,
378
- _StringCodes ,
379
- _TD64Codes ,
380
- _UInt8Codes ,
381
- _UInt16Codes ,
382
- _UInt32Codes ,
383
- _UInt64Codes ,
384
- _UIntPCodes ,
385
- _ULongCodes ,
386
- _VoidCodes ,
387
- )
358
+ from ._typing ._char_codes import _LongCodes , _ULongCodes
388
359
from .lib import scimath as emath
389
360
from .lib ._arraypad_impl import pad
390
361
from .lib ._arraysetops_impl import (
@@ -1172,55 +1143,55 @@ class dtype(Generic[_ScalarT_co], metaclass=_DTypeMeta):
1172
1143
@overload
1173
1144
def __new__ (
1174
1145
cls ,
1175
- dtype : type [ bool_ | py_bool | ct . c_bool ] | _BoolCodes ,
1146
+ dtype : _nt . ToDTypeBool ,
1176
1147
align : py_bool = False ,
1177
1148
copy : py_bool = False ,
1178
1149
metadata : dict [str , Any ] = ...,
1179
1150
) -> dtype [bool_ ]: ...
1180
1151
@overload
1181
1152
def __new__ (
1182
1153
cls ,
1183
- dtype : type [ int8 | ct . c_int8 ] | _Int8Codes ,
1154
+ dtype : _nt . ToDTypeInt8 ,
1184
1155
align : py_bool = False ,
1185
1156
copy : py_bool = False ,
1186
1157
metadata : dict [str , Any ] = ...,
1187
1158
) -> dtype [int8 ]: ...
1188
1159
@overload
1189
1160
def __new__ (
1190
1161
cls ,
1191
- dtype : type [ uint8 | ct . c_uint8 ] | _UInt8Codes ,
1162
+ dtype : _nt . ToDTypeUInt8 ,
1192
1163
align : py_bool = False ,
1193
1164
copy : py_bool = False ,
1194
1165
metadata : dict [str , Any ] = ...,
1195
1166
) -> dtype [uint8 ]: ...
1196
1167
@overload
1197
1168
def __new__ (
1198
1169
cls ,
1199
- dtype : type [ int16 | ct . c_int16 | ct . c_short ] | _Int16Codes ,
1170
+ dtype : _nt . ToDTypeInt16 ,
1200
1171
align : py_bool = False ,
1201
1172
copy : py_bool = False ,
1202
1173
metadata : dict [str , Any ] = ...,
1203
1174
) -> dtype [int16 ]: ...
1204
1175
@overload
1205
1176
def __new__ (
1206
1177
cls ,
1207
- dtype : type [ uint16 | ct . c_uint16 | ct . c_ushort ] | _UInt16Codes ,
1178
+ dtype : _nt . ToDTypeUInt16 ,
1208
1179
align : py_bool = False ,
1209
1180
copy : py_bool = False ,
1210
1181
metadata : dict [str , Any ] = ...,
1211
1182
) -> dtype [uint16 ]: ...
1212
1183
@overload
1213
1184
def __new__ (
1214
1185
cls ,
1215
- dtype : type [ int32 | ct . c_int32 | ct . c_int ] | _Int32Codes ,
1186
+ dtype : _nt . ToDTypeInt32 ,
1216
1187
align : py_bool = False ,
1217
1188
copy : py_bool = False ,
1218
1189
metadata : dict [str , Any ] = ...,
1219
1190
) -> dtype [int32 ]: ...
1220
1191
@overload
1221
1192
def __new__ (
1222
1193
cls ,
1223
- dtype : type [ uint32 | ct . c_uint32 | ct . c_uint ] | _UInt32Codes ,
1194
+ dtype : _nt . ToDTypeUInt32 ,
1224
1195
align : py_bool = False ,
1225
1196
copy : py_bool = False ,
1226
1197
metadata : dict [str , Any ] = ...,
@@ -1244,127 +1215,127 @@ class dtype(Generic[_ScalarT_co], metaclass=_DTypeMeta):
1244
1215
@overload
1245
1216
def __new__ (
1246
1217
cls ,
1247
- dtype : type [ int64 | _nt .JustInt | ct . c_int64 | ct . c_longlong | ct . c_ssize_t ] | _Int64Codes | _IntPCodes ,
1218
+ dtype : _nt .ToDTypeInt64 ,
1248
1219
align : py_bool = False ,
1249
1220
copy : py_bool = False ,
1250
1221
metadata : dict [str , Any ] = ...,
1251
1222
) -> dtype [int64 ]: ...
1252
1223
@overload
1253
1224
def __new__ (
1254
1225
cls ,
1255
- dtype : type [ uint64 | ct . c_uint64 | ct . c_ulonglong | ct . c_size_t | ct . c_void_p ] | _UInt64Codes | _UIntPCodes ,
1226
+ dtype : _nt . ToDTypeUInt64 ,
1256
1227
align : py_bool = False ,
1257
1228
copy : py_bool = False ,
1258
1229
metadata : dict [str , Any ] = ...,
1259
1230
) -> dtype [uint64 ]: ...
1260
1231
@overload
1261
1232
def __new__ (
1262
1233
cls ,
1263
- dtype : type [ float16 ] | _Float16Codes ,
1234
+ dtype : _nt . ToDTypeFloat16 ,
1264
1235
align : py_bool = False ,
1265
1236
copy : py_bool = False ,
1266
1237
metadata : dict [str , Any ] = ...,
1267
1238
) -> dtype [float16 ]: ...
1268
1239
@overload
1269
1240
def __new__ (
1270
1241
cls ,
1271
- dtype : type [ float32 | ct . c_float ] | _Float32Codes ,
1242
+ dtype : _nt . ToDTypeFloat32 ,
1272
1243
align : py_bool = False ,
1273
1244
copy : py_bool = False ,
1274
1245
metadata : dict [str , Any ] = ...,
1275
1246
) -> dtype [float32 ]: ...
1276
1247
@overload
1277
1248
def __new__ (
1278
1249
cls ,
1279
- dtype : type [ float64 | _nt .JustFloat | ct . c_double ] | _Float64Codes | None ,
1250
+ dtype : _nt .ToDTypeFloat64 | None ,
1280
1251
align : py_bool = False ,
1281
1252
copy : py_bool = False ,
1282
1253
metadata : dict [str , Any ] = ...,
1283
1254
) -> dtype [float64 ]: ...
1284
1255
@overload
1285
1256
def __new__ (
1286
1257
cls ,
1287
- dtype : type [ longdouble | ct . c_longdouble ] | _LongDoubleCodes ,
1258
+ dtype : _nt . ToDTypeLongDouble ,
1288
1259
align : py_bool = False ,
1289
1260
copy : py_bool = False ,
1290
1261
metadata : dict [str , Any ] = ...,
1291
1262
) -> dtype [longdouble ]: ...
1292
1263
@overload # `complexfloating` string-based representations
1293
1264
def __new__ (
1294
1265
cls ,
1295
- dtype : type [ complex64 ] | _Complex64Codes ,
1266
+ dtype : _nt . ToDTypeComplex64 ,
1296
1267
align : py_bool = False ,
1297
1268
copy : py_bool = False ,
1298
1269
metadata : dict [str , Any ] = ...,
1299
1270
) -> dtype [complex64 ]: ...
1300
1271
@overload
1301
1272
def __new__ (
1302
1273
cls ,
1303
- dtype : type [ complex128 | _nt .JustComplex ] | _Complex128Codes ,
1274
+ dtype : _nt .ToDTypeComplex128 ,
1304
1275
align : py_bool = False ,
1305
1276
copy : py_bool = False ,
1306
1277
metadata : dict [str , Any ] = ...,
1307
1278
) -> dtype [complex128 ]: ...
1308
1279
@overload
1309
1280
def __new__ (
1310
1281
cls ,
1311
- dtype : type [ clongdouble ] | _CLongDoubleCodes ,
1282
+ dtype : _nt . ToDTypeCLongDouble ,
1312
1283
align : py_bool = False ,
1313
1284
copy : py_bool = False ,
1314
1285
metadata : dict [str , Any ] = ...,
1315
1286
) -> dtype [clongdouble ]: ...
1316
1287
@overload
1317
1288
def __new__ (
1318
1289
cls ,
1319
- dtype : type [ bytes_ | _nt .JustBytes | ct . c_char ] | _BytesCodes ,
1290
+ dtype : _nt .ToDTypeObject ,
1320
1291
align : py_bool = False ,
1321
1292
copy : py_bool = False ,
1322
1293
metadata : dict [str , Any ] = ...,
1323
- ) -> dtype [bytes_ ]: ...
1294
+ ) -> dtype [object_ ]: ...
1324
1295
@overload
1325
1296
def __new__ (
1326
1297
cls ,
1327
- dtype : type [ str_ | _nt .JustStr ] | _StrCodes ,
1298
+ dtype : _nt .ToDTypeBytes ,
1328
1299
align : py_bool = False ,
1329
1300
copy : py_bool = False ,
1330
1301
metadata : dict [str , Any ] = ...,
1331
- ) -> dtype [str_ ]: ...
1302
+ ) -> dtype [bytes_ ]: ...
1332
1303
@overload
1333
- def __new__ (
1304
+ def __new__ ( # type: ignore[overload-overlap]
1334
1305
cls ,
1335
- dtype : type [ void | memoryview ] | _VoidDTypeLike | _VoidCodes ,
1306
+ dtype : _nt . ToDTypeStr ,
1336
1307
align : py_bool = False ,
1337
1308
copy : py_bool = False ,
1338
1309
metadata : dict [str , Any ] = ...,
1339
- ) -> dtype [void ]: ...
1310
+ ) -> dtype [str_ ]: ...
1340
1311
@overload
1341
1312
def __new__ (
1342
1313
cls ,
1343
- dtype : type [ datetime64 ] | _DT64Codes ,
1314
+ dtype : _nt . ToDTypeVoid ,
1344
1315
align : py_bool = False ,
1345
1316
copy : py_bool = False ,
1346
1317
metadata : dict [str , Any ] = ...,
1347
- ) -> dtype [datetime64 ]: ...
1318
+ ) -> dtype [void ]: ...
1348
1319
@overload
1349
1320
def __new__ (
1350
1321
cls ,
1351
- dtype : type [ timedelta64 ] | _TD64Codes ,
1322
+ dtype : _nt . ToDTypeDateTime64 ,
1352
1323
align : py_bool = False ,
1353
1324
copy : py_bool = False ,
1354
1325
metadata : dict [str , Any ] = ...,
1355
- ) -> dtype [timedelta64 ]: ...
1326
+ ) -> dtype [datetime64 ]: ...
1356
1327
@overload
1357
1328
def __new__ (
1358
1329
cls ,
1359
- dtype : type [ object_ | _nt .JustObject | _BuiltinObjectLike | ct . py_object [ Any ]] | _ObjectCodes ,
1330
+ dtype : _nt .ToDTypeTimeDelta64 ,
1360
1331
align : py_bool = False ,
1361
1332
copy : py_bool = False ,
1362
1333
metadata : dict [str , Any ] = ...,
1363
- ) -> dtype [object_ ]: ...
1334
+ ) -> dtype [timedelta64 ]: ...
1364
1335
@overload
1365
1336
def __new__ (
1366
1337
cls ,
1367
- dtype : dtypes . StringDType | _StringCodes ,
1338
+ dtype : _nt . ToDTypeString ,
1368
1339
align : py_bool = False ,
1369
1340
copy : py_bool = False ,
1370
1341
metadata : dict [str , Any ] = ...,
0 commit comments