@@ -626,6 +626,7 @@ _IntScalarT = TypeVar("_IntScalarT", bound=bool_ | integer | object_)
626
626
_RealNumberT = TypeVar ("_RealNumberT" , bound = integer | floating )
627
627
_RealScalarT = TypeVar ("_RealScalarT" , bound = bool_ | integer | floating | object_ )
628
628
_IntegerT = TypeVar ("_IntegerT" , bound = integer )
629
+ _FloatingT = TypeVar ("_FloatingT" , bound = floating )
629
630
_ComplexFloatingT = TypeVar ("_ComplexFloatingT" , bound = complexfloating )
630
631
_ComplexFloatingT_co = TypeVar ("_ComplexFloatingT_co" , bound = complexfloating , covariant = True )
631
632
_InexactT = TypeVar ("_InexactT" , bound = inexact )
@@ -4998,62 +4999,56 @@ class inexact(number[_BitT, _InexactItemT_co], Generic[_BitT, _InexactItemT_co])
4998
4999
@overload
4999
5000
def __rtruediv__ (self , x : _nt .PromoteWith0D [Self , _InexactT ], / ) -> _InexactT : ... # pyright: ignore[reportIncompatibleMethodOverride]
5000
5001
5002
+ class floating (_RealMixin , _RoundMixin , inexact [_BitT , float ]):
5003
+ @abc .abstractmethod
5004
+ @override
5005
+ @type_check_only
5006
+ def __nep50__ (self , below : longdouble | clongdouble , above : int8 | uint8 | bool_ , / ) -> floating : ...
5007
+ @override
5008
+ @type_check_only
5009
+ def __nep50_rule3__ (self , other : _JustFloating , / ) -> floating : ...
5010
+ @override
5011
+ @type_check_only
5012
+ def __nep50_rule4__ (self , other : _JustComplexFloating , / ) -> complexfloating : ...
5013
+
5014
+ #
5015
+ @override
5016
+ def __init__ (self , value : _ConvertibleToFloat | None = ..., / ) -> None : ...
5017
+ @override
5018
+ def __abs__ (self , / ) -> Self : ...
5019
+
5001
5020
#
5002
5021
@overload
5003
- def __floordiv__ (self : inexact [ Any , float ], x : int | _nt .JustFloat | bool_ , / ) -> floating [ _BitT ] : ...
5022
+ def __floordiv__ (self , x : _nt . CanCast0D [ Self ] | int | _nt .JustFloat , / ) -> Self : ...
5004
5023
@overload
5005
- def __floordiv__ (self : inexact [ Any , float ], x : integer | _JustFloating , / ) -> floating : ...
5024
+ def __floordiv__ (self , x : _nt . PromoteWith0D [ Self , _FloatingT ], / ) -> _FloatingT : ...
5006
5025
#
5007
5026
@overload
5008
- def __rfloordiv__ (self : inexact [ Any , float ], x : int | _nt .JustFloat , / ) -> floating [ _BitT ] : ...
5027
+ def __rfloordiv__ (self , x : _nt . CanCast0D [ Self ] | int | _nt .JustFloat , / ) -> Self : ...
5009
5028
@overload
5010
- def __rfloordiv__ (self : inexact [Any , float ], x : bool_ | integer | _JustFloating , / ) -> floating : ...
5011
- @overload
5012
- def __rfloordiv__ (self : inexact [Any , float ], x : _nt .Just [inexact ], / ) -> floating : ...
5029
+ def __rfloordiv__ (self , x : _nt .PromoteWith0D [Self , _FloatingT ], / ) -> _FloatingT : ...
5013
5030
5014
5031
#
5015
5032
@overload
5016
- def __mod__ (self : inexact [ Any , float ], x : int | _nt .JustFloat | bool_ , / ) -> floating [ _BitT ] : ...
5033
+ def __mod__ (self , x : _nt . CanCast0D [ Self ] | int | _nt .JustFloat , / ) -> Self : ...
5017
5034
@overload
5018
- def __mod__ (self : inexact [ Any , float ], x : integer | _JustFloating , / ) -> floating : ...
5035
+ def __mod__ (self , x : _nt . PromoteWith0D [ Self , _FloatingT ], / ) -> _FloatingT : ...
5019
5036
#
5020
5037
@overload
5021
- def __rmod__ (self : inexact [Any , float ], x : int | _nt .JustFloat , / ) -> floating [_BitT ]: ...
5022
- @overload
5023
- def __rmod__ (self : inexact [Any , float ], x : bool_ | integer | _JustFloating , / ) -> floating : ...
5038
+ def __rmod__ (self , x : _nt .CanCast0D [Self ] | int | _nt .JustFloat , / ) -> Self : ...
5024
5039
@overload
5025
- def __rmod__ (self : inexact [ Any , float ], x : _nt .Just [ inexact ], / ) -> floating : ...
5040
+ def __rmod__ (self , x : _nt .PromoteWith0D [ Self , _FloatingT ], / ) -> _FloatingT : ...
5026
5041
5027
5042
#
5028
5043
@overload
5029
- def __divmod__ (self : inexact [ Any , float ], x : int | _nt .JustFloat | bool_ , / ) -> _2Tuple [floating [ _BitT ] ]: ...
5044
+ def __divmod__ (self , x : _nt . CanCast0D [ Self ] | int | _nt .JustFloat , / ) -> _2Tuple [Self ]: ...
5030
5045
@overload
5031
- def __divmod__ (self : inexact [ Any , float ], x : integer | _JustFloating , / ) -> _2Tuple [floating ]: ...
5046
+ def __divmod__ (self , x : _nt . PromoteWith0D [ Self , _FloatingT ], / ) -> _2Tuple [_FloatingT ]: ...
5032
5047
#
5033
5048
@overload
5034
- def __rdivmod__ (self : inexact [Any , float ], x : int | _nt .JustFloat , / ) -> _2Tuple [floating [_BitT ]]: ...
5035
- @overload
5036
- def __rdivmod__ (self : inexact [Any , float ], x : bool_ | integer | _JustFloating , / ) -> _2Tuple [floating ]: ...
5049
+ def __rdivmod__ (self , x : _nt .CanCast0D [Self ] | int | _nt .JustFloat , / ) -> _2Tuple [Self ]: ...
5037
5050
@overload
5038
- def __rdivmod__ (self : inexact [Any , float ], x : _nt .Just [inexact ], / ) -> _2Tuple [floating ]: ...
5039
-
5040
- class floating (_RealMixin , _RoundMixin , inexact [_BitT , float ]):
5041
- @abc .abstractmethod
5042
- @override
5043
- @type_check_only
5044
- def __nep50__ (self , below : longdouble | clongdouble , above : int8 | uint8 | bool_ , / ) -> floating : ...
5045
- @override
5046
- @type_check_only
5047
- def __nep50_rule3__ (self , other : _JustFloating , / ) -> floating : ...
5048
- @override
5049
- @type_check_only
5050
- def __nep50_rule4__ (self , other : _JustComplexFloating , / ) -> complexfloating : ...
5051
-
5052
- #
5053
- @override
5054
- def __init__ (self , value : _ConvertibleToFloat | None = ..., / ) -> None : ...
5055
- @override
5056
- def __abs__ (self , / ) -> Self : ...
5051
+ def __rdivmod__ (self , x : _nt .PromoteWith0D [Self , _FloatingT ], / ) -> _2Tuple [_FloatingT ]: ...
5057
5052
5058
5053
class float16 (floating [_n ._16 ]):
5059
5054
@override
@@ -5083,63 +5078,6 @@ class float16(floating[_n._16]):
5083
5078
def is_integer (self , / ) -> py_bool : ...
5084
5079
def as_integer_ratio (self , / ) -> tuple [int , int ]: ...
5085
5080
5086
- #
5087
- @overload
5088
- def __floordiv__ (self , x : _CoFloat16 , / ) -> Self : ...
5089
- @overload
5090
- def __floordiv__ (self , x : _nt .CanArray0D [_nt .integer16 ], / ) -> float32 : ...
5091
- @overload
5092
- def __floordiv__ (self , x : _nt .CanArray0D [_Integer32p ], / ) -> float64 : ...
5093
- @overload
5094
- def __floordiv__ (self , x : _nt .ToInteger_0d | _JustFloating | _nt .Just [inexact ], / ) -> floating : ... # pyright: ignore[reportIncompatibleMethodOverride]
5095
- #
5096
- @overload
5097
- def __rfloordiv__ (self , x : _CoFloat16 , / ) -> Self : ...
5098
- @overload
5099
- def __rfloordiv__ (self , x : _nt .CanArray0D [_nt .integer16 ], / ) -> float32 : ...
5100
- @overload
5101
- def __rfloordiv__ (self , x : _nt .CanArray0D [_Integer32p ], / ) -> float64 : ...
5102
- @overload
5103
- def __rfloordiv__ (self , x : _nt .ToInteger_0d | _JustFloating | _nt .Just [inexact ], / ) -> floating : ... # pyright: ignore[reportIncompatibleMethodOverride]
5104
-
5105
- #
5106
- @overload
5107
- def __mod__ (self , x : _CoFloat16 , / ) -> Self : ...
5108
- @overload
5109
- def __mod__ (self , x : _nt .CanArray0D [_nt .integer16 ], / ) -> float32 : ...
5110
- @overload
5111
- def __mod__ (self , x : _nt .CanArray0D [_Integer32p ], / ) -> float64 : ...
5112
- @overload
5113
- def __mod__ (self , x : _nt .ToInteger_0d | _JustFloating | _nt .Just [inexact ], / ) -> floating : ... # pyright: ignore[reportIncompatibleMethodOverride]
5114
- #
5115
- @overload
5116
- def __rmod__ (self , x : _CoFloat16 , / ) -> Self : ...
5117
- @overload
5118
- def __rmod__ (self , x : _nt .CanArray0D [_nt .integer16 ], / ) -> float32 : ...
5119
- @overload
5120
- def __rmod__ (self , x : _nt .CanArray0D [_Integer32p ], / ) -> float64 : ...
5121
- @overload
5122
- def __rmod__ (self , x : _nt .ToInteger_0d | _JustFloating | _nt .Just [inexact ], / ) -> floating : ... # pyright: ignore[reportIncompatibleMethodOverride]
5123
-
5124
- #
5125
- @overload
5126
- def __divmod__ (self , x : _CoFloat16 , / ) -> _2Tuple [Self ]: ...
5127
- @overload
5128
- def __divmod__ (self , x : _nt .CanArray0D [_nt .integer16 ], / ) -> _2Tuple [float32 ]: ...
5129
- @overload
5130
- def __divmod__ (self , x : _nt .CanArray0D [_Integer32p ], / ) -> _2Tuple [float64 ]: ...
5131
- @overload
5132
- def __divmod__ (self , x : _JustInteger | _JustFloating | _nt .Just [inexact ], / ) -> _2Tuple [floating ]: ... # pyright: ignore[reportIncompatibleMethodOverride]
5133
- #
5134
- @overload
5135
- def __rdivmod__ (self , x : _CoFloat16 , / ) -> _2Tuple [Self ]: ...
5136
- @overload
5137
- def __rdivmod__ (self , x : _nt .CanArray0D [_nt .integer16 ], / ) -> _2Tuple [float32 ]: ...
5138
- @overload
5139
- def __rdivmod__ (self , x : _nt .CanArray0D [_Integer32p ], / ) -> _2Tuple [float64 ]: ...
5140
- @overload
5141
- def __rdivmod__ (self , x : _JustInteger | _JustFloating | _nt .Just [inexact ], / ) -> _2Tuple [floating ]: ... # pyright: ignore[reportIncompatibleMethodOverride]
5142
-
5143
5081
half = float16
5144
5082
5145
5083
class float32 (floating [_n ._32 ]):
@@ -5173,51 +5111,6 @@ class float32(floating[_n._32]):
5173
5111
def is_integer (self , / ) -> py_bool : ...
5174
5112
def as_integer_ratio (self , / ) -> tuple [int , int ]: ...
5175
5113
5176
- #
5177
- @overload
5178
- def __floordiv__ (self , x : _CoFloat32 , / ) -> Self : ...
5179
- @overload
5180
- def __floordiv__ (self , x : _nt .CanArray0D [_Integer32p ], / ) -> float64 : ...
5181
- @overload
5182
- def __floordiv__ (self , x : _nt .ToInteger_0d | _JustFloating | _nt .Just [inexact ], / ) -> floating : ... # pyright: ignore[reportIncompatibleMethodOverride]
5183
- #
5184
- @overload
5185
- def __rfloordiv__ (self , x : _CoFloat32 , / ) -> Self : ...
5186
- @overload
5187
- def __rfloordiv__ (self , x : _nt .CanArray0D [_Integer32p ], / ) -> float64 : ...
5188
- @overload
5189
- def __rfloordiv__ (self , x : _nt .ToInteger_0d | _JustFloating | _nt .Just [inexact ], / ) -> floating : ... # pyright: ignore[reportIncompatibleMethodOverride]
5190
-
5191
- #
5192
- @overload
5193
- def __mod__ (self , x : _CoFloat32 , / ) -> Self : ...
5194
- @overload
5195
- def __mod__ (self , x : _nt .CanArray0D [_Integer32p ], / ) -> float64 : ...
5196
- @overload
5197
- def __mod__ (self , x : _nt .ToInteger_0d | _JustFloating | _nt .Just [inexact ], / ) -> floating : ... # pyright: ignore[reportIncompatibleMethodOverride]
5198
- #
5199
- @overload
5200
- def __rmod__ (self , x : _CoFloat32 , / ) -> Self : ...
5201
- @overload
5202
- def __rmod__ (self , x : _nt .CanArray0D [_Integer32p ], / ) -> float64 : ...
5203
- @overload
5204
- def __rmod__ (self , x : _nt .ToInteger_0d | _JustFloating | _nt .Just [inexact ], / ) -> floating : ... # pyright: ignore[reportIncompatibleMethodOverride]
5205
-
5206
- #
5207
- @overload
5208
- def __divmod__ (self , x : _CoFloat32 , / ) -> _2Tuple [Self ]: ...
5209
- @overload
5210
- def __divmod__ (self , x : _nt .CanArray0D [_Integer32p ], / ) -> _2Tuple [float64 ]: ...
5211
- @overload
5212
- def __divmod__ (self , x : _JustInteger | _JustFloating | _nt .Just [inexact ], / ) -> _2Tuple [floating ]: ... # pyright: ignore[reportIncompatibleMethodOverride]
5213
- #
5214
- @overload
5215
- def __rdivmod__ (self , x : _CoFloat32 , / ) -> _2Tuple [Self ]: ...
5216
- @overload
5217
- def __rdivmod__ (self , x : _nt .CanArray0D [_Integer32p ], / ) -> _2Tuple [float64 ]: ...
5218
- @overload
5219
- def __rdivmod__ (self , x : _JustInteger | _JustFloating | _nt .Just [inexact ], / ) -> _2Tuple [floating ]: ... # pyright: ignore[reportIncompatibleMethodOverride]
5220
-
5221
5114
single = float32
5222
5115
5223
5116
class float64 (floating [_n ._64 ], float ): # type: ignore[misc]
@@ -5266,39 +5159,6 @@ class float64(floating[_n._64], float): # type: ignore[misc]
5266
5159
@override
5267
5160
def as_integer_ratio (self , / ) -> tuple [int , int ]: ...
5268
5161
5269
- #
5270
- @overload
5271
- def __floordiv__ (self , x : _CoFloat64 , / ) -> Self : ...
5272
- @overload
5273
- def __floordiv__ (self , x : _JustFloating | _nt .Just [inexact ], / ) -> floating : ... # pyright: ignore[reportIncompatibleMethodOverride]
5274
- #
5275
- @overload
5276
- def __rfloordiv__ (self , x : _CoFloat64 , / ) -> Self : ...
5277
- @overload
5278
- def __rfloordiv__ (self , x : _JustFloating | _nt .Just [inexact ], / ) -> floating : ...
5279
-
5280
- #
5281
- @overload
5282
- def __mod__ (self , x : _CoFloat64 , / ) -> Self : ...
5283
- @overload
5284
- def __mod__ (self , x : _JustFloating | _nt .Just [inexact ], / ) -> floating : ... # pyright: ignore[reportIncompatibleMethodOverride]
5285
- #
5286
- @overload
5287
- def __rmod__ (self , x : _CoFloat64 , / ) -> Self : ...
5288
- @overload
5289
- def __rmod__ (self , x : _JustFloating | _nt .Just [inexact ], / ) -> floating : ...
5290
-
5291
- #
5292
- @overload
5293
- def __divmod__ (self , x : _nt .CoFloat64_0d , / ) -> _2Tuple [Self ]: ...
5294
- @overload
5295
- def __divmod__ (self , x : _JustFloating | _nt .Just [inexact ], / ) -> _2Tuple [floating ]: ... # pyright: ignore[reportIncompatibleMethodOverride]
5296
- #
5297
- @overload
5298
- def __rdivmod__ (self , x : _nt .CoFloat64_0d , / ) -> _2Tuple [Self ]: ...
5299
- @overload
5300
- def __rdivmod__ (self , x : _JustFloating | _nt .Just [inexact ], / ) -> _2Tuple [floating ]: ... # pyright: ignore[reportIncompatibleMethodOverride]
5301
-
5302
5162
double = float64
5303
5163
5304
5164
class longdouble (floating [_n ._64L ]):
@@ -5342,24 +5202,6 @@ class longdouble(floating[_n._64L]):
5342
5202
@override
5343
5203
def tolist (self , / ) -> Self : ... # pyright: ignore[reportIncompatibleMethodOverride]
5344
5204
5345
- #
5346
- @override
5347
- def __floordiv__ (self , x : _nt .CoFloating_0d | _JustFloating | _nt .Just [inexact ] | _nt .JustFloat , / ) -> Self : ...
5348
- @override
5349
- def __rfloordiv__ (self , x : _nt .CoFloating_0d | _JustFloating | _nt .Just [inexact ] | _nt .JustFloat , / ) -> Self : ...
5350
-
5351
- #
5352
- @override
5353
- def __mod__ (self , x : _nt .CoFloating_0d | _JustFloating | _nt .Just [inexact ] | _nt .JustFloat , / ) -> Self : ...
5354
- @override
5355
- def __rmod__ (self , x : _nt .CoFloating_0d | _JustFloating | _nt .Just [inexact ] | _nt .JustFloat , / ) -> Self : ...
5356
-
5357
- #
5358
- @override
5359
- def __divmod__ (self , x : _nt .CoFloating_0d | _JustFloating | _nt .Just [inexact ] | _nt .JustFloat , / ) -> _2Tuple [Self ]: ...
5360
- @override
5361
- def __rdivmod__ (self , x : _nt .CoFloating_0d | _JustFloating | _nt .Just [inexact ] | _nt .JustFloat , / ) -> _2Tuple [Self ]: ...
5362
-
5363
5205
float96 = longdouble
5364
5206
float128 = longdouble
5365
5207
@@ -5410,20 +5252,6 @@ class complexfloating(inexact[_BitT1, complex], Generic[_BitT1, _BitT2]):
5410
5252
@override
5411
5253
def __abs__ (self , / ) -> floating : ...
5412
5254
5413
- # NOTE: Without these mypy will `[misc]` instead of `[opererator]`
5414
- @override
5415
- def __floordiv__ (self , x : Never , / ) -> Never : ... # pyright: ignore[reportIncompatibleMethodOverride]
5416
- @override
5417
- def __rfloordiv__ (self , x : Never , / ) -> Never : ... # pyright: ignore[reportIncompatibleMethodOverride]
5418
- @override
5419
- def __mod__ (self , x : Never , / ) -> Never : ... # pyright: ignore[reportIncompatibleMethodOverride]
5420
- @override
5421
- def __rmod__ (self , x : Never , / ) -> Never : ... # pyright: ignore[reportIncompatibleMethodOverride]
5422
- @override
5423
- def __divmod__ (self , x : Never , / ) -> Never : ... # pyright: ignore[reportIncompatibleMethodOverride]
5424
- @override
5425
- def __rdivmod__ (self , x : Never , / ) -> Never : ... # pyright: ignore[reportIncompatibleMethodOverride]
5426
-
5427
5255
#
5428
5256
@deprecated ("The Python built-in `round` is deprecated for complex scalars, and will raise a `TypeError` in a future release" )
5429
5257
def __round__ (self , / , ndigits : CanIndex | None = None ) -> Self : ...
0 commit comments