@@ -5050,7 +5050,22 @@ class floating(_RealMixin, _RoundMixin, inexact[_BitT, float]):
5050
5050
@overload
5051
5051
def __rdivmod__ (self , x : _nt .PromoteWith0D [Self , _FloatingT ], / ) -> _2Tuple [_FloatingT ]: ...
5052
5052
5053
- class float16 (floating [_n ._16 ]):
5053
+ _FloatSizeT_co = TypeVar ("_FloatSizeT_co" , bound = L [2 , 4 , 8 , 12 , 16 ], covariant = True )
5054
+
5055
+ @type_check_only
5056
+ class _FloatMixin (Generic [_FloatSizeT_co ]):
5057
+ @property
5058
+ def itemsize (self ) -> _FloatSizeT_co : ...
5059
+ @property
5060
+ def nbytes (self ) -> _FloatSizeT_co : ...
5061
+
5062
+ #
5063
+ @override
5064
+ def __hash__ (self , / ) -> int : ...
5065
+ def is_integer (self , / ) -> py_bool : ...
5066
+ def as_integer_ratio (self , / ) -> tuple [int , int ]: ...
5067
+
5068
+ class float16 (_FloatMixin [L [2 ]], floating [_n ._16 ]):
5054
5069
@override
5055
5070
@type_check_only
5056
5071
def __nep50__ (self , below : inexact , above : int8 | uint8 | bool_ , / ) -> float16 : ...
@@ -5064,23 +5079,9 @@ class float16(floating[_n._16]):
5064
5079
@type_check_only
5065
5080
def __nep50_rule2__ (self , other : _JustInteger , / ) -> floating : ...
5066
5081
5067
- #
5068
- @property
5069
- @override
5070
- def itemsize (self ) -> L [2 ]: ...
5071
- @property
5072
- @override
5073
- def nbytes (self ) -> L [2 ]: ...
5074
-
5075
- #
5076
- @override
5077
- def __hash__ (self , / ) -> int : ...
5078
- def is_integer (self , / ) -> py_bool : ...
5079
- def as_integer_ratio (self , / ) -> tuple [int , int ]: ...
5080
-
5081
5082
half = float16
5082
5083
5083
- class float32 (floating [_n ._32 ]):
5084
+ class float32 (_FloatMixin [ L [ 4 ]], floating [_n ._32 ]):
5084
5085
@override
5085
5086
@type_check_only
5086
5087
def __nep50__ (
@@ -5097,23 +5098,9 @@ class float32(floating[_n._32]):
5097
5098
@type_check_only
5098
5099
def __nep50_rule2__ (self , other : _JustInteger , / ) -> floating : ...
5099
5100
5100
- #
5101
- @property
5102
- @override
5103
- def itemsize (self ) -> L [4 ]: ...
5104
- @property
5105
- @override
5106
- def nbytes (self ) -> L [4 ]: ...
5107
-
5108
- #
5109
- @override
5110
- def __hash__ (self , / ) -> int : ...
5111
- def is_integer (self , / ) -> py_bool : ...
5112
- def as_integer_ratio (self , / ) -> tuple [int , int ]: ...
5113
-
5114
5101
single = float32
5115
5102
5116
- class float64 (floating [_n ._64 ], float ): # type: ignore[misc]
5103
+ class float64 (_FloatMixin [ L [ 8 ]], floating [_n ._64 ], float ): # type: ignore[misc]
5117
5104
@override
5118
5105
@type_check_only
5119
5106
def __nep50__ (
@@ -5136,12 +5123,6 @@ class float64(floating[_n._64], float): # type: ignore[misc]
5136
5123
#
5137
5124
@property
5138
5125
@override
5139
- def itemsize (self ) -> L [8 ]: ...
5140
- @property
5141
- @override
5142
- def nbytes (self ) -> L [8 ]: ...
5143
- @property
5144
- @override
5145
5126
def real (self ) -> Self : ...
5146
5127
@property
5147
5128
@override
@@ -5154,14 +5135,10 @@ class float64(floating[_n._64], float): # type: ignore[misc]
5154
5135
def __abs__ (self , / ) -> float64 : ...
5155
5136
@override
5156
5137
def conjugate (self ) -> Self : ...
5157
- @override
5158
- def is_integer (self , / ) -> py_bool : ...
5159
- @override
5160
- def as_integer_ratio (self , / ) -> tuple [int , int ]: ...
5161
5138
5162
5139
double = float64
5163
5140
5164
- class longdouble (floating [_n ._64L ]):
5141
+ class longdouble (_FloatMixin [ L [ 12 , 16 ]], floating [_n ._64L ]):
5165
5142
@override
5166
5143
@type_check_only
5167
5144
def __nep50__ (
@@ -5180,20 +5157,6 @@ class longdouble(floating[_n._64L]):
5180
5157
@type_check_only
5181
5158
def __nep50_rule4__ (self , other : complexfloating | _JustComplexFloating , / ) -> clongdouble : ...
5182
5159
5183
- #
5184
- @property
5185
- @override
5186
- def itemsize (self ) -> L [12 , 16 ]: ...
5187
- @property
5188
- @override
5189
- def nbytes (self ) -> L [12 , 16 ]: ...
5190
-
5191
- #
5192
- @override
5193
- def __hash__ (self , / ) -> int : ...
5194
- def is_integer (self , / ) -> py_bool : ...
5195
- def as_integer_ratio (self , / ) -> tuple [int , int ]: ...
5196
-
5197
5160
#
5198
5161
@overload
5199
5162
def item (self , / ) -> Self : ...
0 commit comments