@@ -5090,6 +5090,10 @@ class complexfloating(inexact[_BitT1, complex], Generic[_BitT1, _BitT2]):
5090
5090
5091
5091
# NOTE: Naming it `bool_` results in less unreadable type-checker output
5092
5092
class bool_ (generic [_BoolItemT_co ], Generic [_BoolItemT_co ]):
5093
+ @type_check_only
5094
+ def __promote__ (self , to : bool_ | number , from_ : bool_ , / ) -> bool_ : ...
5095
+
5096
+ #
5093
5097
@property
5094
5098
@override
5095
5099
def itemsize (self ) -> L [1 ]: ...
@@ -5632,6 +5636,10 @@ class _IntROpMixin(Generic[_T_co]):
5632
5636
def __ror__ (self , x : _JustSignedInteger | _JustUnsignedInteger | _nt .Just [integer ], / ) -> _T_co : ...
5633
5637
5634
5638
class int8 (_IntROpMixin [signedinteger ], signedinteger [_n ._8 ]): # type: ignore[misc]
5639
+ @type_check_only
5640
+ def __promote__ (self , to : signedinteger | inexact , from_ : int8 | bool_ , / ) -> int8 : ...
5641
+
5642
+ #
5635
5643
@property
5636
5644
@override
5637
5645
def itemsize (self ) -> L [1 ]: ...
@@ -5762,6 +5770,15 @@ class int8(_IntROpMixin[signedinteger], signedinteger[_n._8]): # type: ignore[m
5762
5770
def __or__ (self , x : _nt .Just [_SignedIntegerT ], / ) -> _SignedIntegerT : ...
5763
5771
5764
5772
class uint8 (unsignedinteger [_n ._8 ]):
5773
+ @type_check_only
5774
+ def __promote__ (
5775
+ self ,
5776
+ to : uint8 | int16 | int32 | int64 | unsignedinteger | inexact ,
5777
+ from_ : uint8 | bool_ ,
5778
+ / ,
5779
+ ) -> uint8 : ...
5780
+
5781
+ #
5765
5782
@property
5766
5783
@override
5767
5784
def itemsize (self ) -> L [1 ]: ...
@@ -6202,6 +6219,15 @@ class uint8(unsignedinteger[_n._8]):
6202
6219
def __ror__ (self , x : _nt .Just [integer ], / ) -> integer : ...
6203
6220
6204
6221
class int16 (_IntROpMixin [signedinteger ], signedinteger [_n ._16 ]): # type: ignore[misc]
6222
+ @type_check_only
6223
+ def __promote__ (
6224
+ self ,
6225
+ to : int16 | int32 | int64 | float32 | float64 | longdouble | complexfloating ,
6226
+ from_ : int16 | uint8 | int8 | bool_ ,
6227
+ / ,
6228
+ ) -> int16 : ...
6229
+
6230
+ #
6205
6231
@property
6206
6232
@override
6207
6233
def itemsize (self ) -> L [2 ]: ...
@@ -6370,6 +6396,15 @@ class int16(_IntROpMixin[signedinteger], signedinteger[_n._16]): # type: ignore
6370
6396
def __or__ (self , x : _nt .CanArray0D [int32 ], / ) -> int32 : ...
6371
6397
6372
6398
class uint16 (unsignedinteger [_n ._16 ]):
6399
+ @type_check_only
6400
+ def __promote__ (
6401
+ self ,
6402
+ to : uint16 | int32 | uint32 | int64 | uint64 | float32 | float64 | longdouble | complexfloating ,
6403
+ from_ : uint16 | uint8 | bool_ ,
6404
+ / ,
6405
+ ) -> uint16 : ...
6406
+
6407
+ #
6373
6408
@property
6374
6409
@override
6375
6410
def itemsize (self ) -> L [2 ]: ...
@@ -6762,6 +6797,15 @@ class uint16(unsignedinteger[_n._16]):
6762
6797
def __ror__ (self , x : _nt .Just [integer ], / ) -> integer : ...
6763
6798
6764
6799
class int32 (_IntROpMixin [signedinteger ], signedinteger [_n ._32 ]): # type: ignore[misc]
6800
+ @type_check_only
6801
+ def __promote__ (
6802
+ self ,
6803
+ to : int32 | int64 | float64 | complex128 | longdouble | clongdouble ,
6804
+ from_ : int32 | uint16 | int16 | uint8 | int8 | bool_ ,
6805
+ / ,
6806
+ ) -> int32 : ...
6807
+
6808
+ #
6765
6809
@property
6766
6810
@override
6767
6811
def itemsize (self ) -> L [4 ]: ...
@@ -6906,6 +6950,15 @@ class int32(_IntROpMixin[signedinteger], signedinteger[_n._32]): # type: ignore
6906
6950
def __or__ (self , x : _nt .CanArray0D [int64 ], / ) -> int64 : ...
6907
6951
6908
6952
class uint32 (unsignedinteger [_n ._32 ]):
6953
+ @type_check_only
6954
+ def __promote__ (
6955
+ self ,
6956
+ to : uint32 | int64 | uint64 | float64 | complex128 | longdouble | clongdouble ,
6957
+ from_ : uint32 | uint16 | uint8 | bool_ ,
6958
+ / ,
6959
+ ) -> uint32 : ...
6960
+
6961
+ #
6909
6962
@property
6910
6963
@override
6911
6964
def itemsize (self ) -> L [4 ]: ...
@@ -7202,6 +7255,15 @@ class uint32(unsignedinteger[_n._32]):
7202
7255
def __ror__ (self , x : _nt .Just [integer ], / ) -> integer : ...
7203
7256
7204
7257
class int64 (_IntROpMixin [int64 ], signedinteger [_n ._64 ]): # type: ignore[misc]
7258
+ @type_check_only
7259
+ def __promote__ (
7260
+ self ,
7261
+ to : int64 | float64 | complex128 | longdouble | clongdouble ,
7262
+ from_ : signedinteger | uint32 | uint16 | uint8 | bool_ ,
7263
+ / ,
7264
+ ) -> int64 : ...
7265
+
7266
+ #
7205
7267
@property
7206
7268
@override
7207
7269
def itemsize (self ) -> L [8 ]: ...
@@ -7309,6 +7371,15 @@ class int64(_IntROpMixin[int64], signedinteger[_n._64]): # type: ignore[misc]
7309
7371
def __or__ (self , x : _JustInteger , / ) -> int64 : ...
7310
7372
7311
7373
class uint64 (unsignedinteger [_n ._64 ]):
7374
+ @type_check_only
7375
+ def __promote__ (
7376
+ self ,
7377
+ to : uint64 | float64 | complex128 | longdouble | clongdouble ,
7378
+ from_ : unsignedinteger | bool_ ,
7379
+ / ,
7380
+ ) -> uint64 : ...
7381
+
7382
+ #
7312
7383
@property
7313
7384
@override
7314
7385
def itemsize (self ) -> L [8 ]: ...
@@ -7537,6 +7608,10 @@ longlong = int64
7537
7608
ulonglong = uint64
7538
7609
7539
7610
class float16 (floating [_n ._16 ]):
7611
+ @type_check_only
7612
+ def __promote__ (self , to : inexact , from_ : float16 | int8 | uint8 | bool_ , / ) -> float16 : ...
7613
+
7614
+ #
7540
7615
@property
7541
7616
@override
7542
7617
def itemsize (self ) -> L [2 ]: ...
@@ -7791,6 +7866,15 @@ class float16(floating[_n._16]):
7791
7866
def __rdivmod__ (self , x : _JustInteger | _JustFloating | _nt .Just [inexact ], / ) -> _2Tuple [floating ]: ... # pyright: ignore[reportIncompatibleMethodOverride]
7792
7867
7793
7868
class float32 (floating [_n ._32 ]):
7869
+ @type_check_only
7870
+ def __promote__ (
7871
+ self ,
7872
+ to : float32 | float64 | longdouble | complexfloating ,
7873
+ from_ : float32 | float16 | int16 | uint16 | int8 | uint8 | bool_ ,
7874
+ / ,
7875
+ ) -> float32 : ...
7876
+
7877
+ #
7794
7878
@property
7795
7879
@override
7796
7880
def itemsize (self ) -> L [4 ]: ...
@@ -7987,6 +8071,15 @@ class float32(floating[_n._32]):
7987
8071
def __rdivmod__ (self , x : _JustInteger | _JustFloating | _nt .Just [inexact ], / ) -> _2Tuple [floating ]: ... # pyright: ignore[reportIncompatibleMethodOverride]
7988
8072
7989
8073
class float64 (floating [_n ._64 ], float ): # type: ignore[misc]
8074
+ @type_check_only
8075
+ def __promote__ (
8076
+ self ,
8077
+ to : float64 | longdouble | complex128 | clongdouble ,
8078
+ from_ : float64 | float32 | float16 | integer | bool_ ,
8079
+ / ,
8080
+ ) -> float64 : ...
8081
+
8082
+ #
7990
8083
def __new__ (cls , x : _ConvertibleToFloat | None = 0 , / ) -> Self : ...
7991
8084
@classmethod
7992
8085
def __getformat__ (cls , typestr : L ["double" , "float" ], / ) -> str : ...
@@ -8180,6 +8273,10 @@ single = float32
8180
8273
double = float64
8181
8274
8182
8275
class longdouble (floating [_n ._64L ]):
8276
+ @type_check_only
8277
+ def __promote__ (self , to : longdouble | clongdouble , from_ : floating | integer | bool_ , / ) -> longdouble : ...
8278
+
8279
+ #
8183
8280
@property
8184
8281
@override
8185
8282
def itemsize (self ) -> L [12 , 16 ]: ...
@@ -8303,6 +8400,15 @@ float96 = longdouble
8303
8400
float128 = longdouble
8304
8401
8305
8402
class complex64 (complexfloating [_n ._32 ]):
8403
+ @type_check_only
8404
+ def __promote__ (
8405
+ self ,
8406
+ to : complexfloating ,
8407
+ from_ : complex64 | float32 | float16 | int16 | uint16 | int8 | uint8 | bool_ ,
8408
+ / ,
8409
+ ) -> complex64 : ...
8410
+
8411
+ #
8306
8412
@property
8307
8413
@override
8308
8414
def itemsize (self ) -> L [8 ]: ...
@@ -8426,6 +8532,15 @@ class complex64(complexfloating[_n._32]):
8426
8532
def __complex__ (self , / ) -> complex : ...
8427
8533
8428
8534
class complex128 (complexfloating [_n ._64 ], complex ):
8535
+ @type_check_only
8536
+ def __promote__ (
8537
+ self ,
8538
+ to : complex128 | clongdouble ,
8539
+ from_ : complex128 | complex64 | float64 | float32 | float16 | integer | bool_ ,
8540
+ / ,
8541
+ ) -> complex128 : ...
8542
+
8543
+ #
8429
8544
@overload
8430
8545
def __new__ (cls , real : _ConvertibleToComplex | None = 0 , / ) -> Self : ...
8431
8546
@overload
@@ -8542,6 +8657,10 @@ csingle = complex64
8542
8657
cdouble = complex128
8543
8658
8544
8659
class clongdouble (complexfloating [_n ._64L ]):
8660
+ @type_check_only
8661
+ def __promote__ (self , to : clongdouble , from_ : number | bool_ , / ) -> clongdouble : ...
8662
+
8663
+ #
8545
8664
@property
8546
8665
@override
8547
8666
def itemsize (self ) -> L [24 , 32 ]: ...
0 commit comments