-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MAINT: Annotate missing attributes of np.number
subclasses
#19344
Conversation
@@ -3313,6 +3327,21 @@ class floating(inexact[_NBit1]): | |||
__args: Union[L[0], Tuple[()], Tuple[L[0]]] = ..., | |||
) -> float: ... | |||
def tolist(self) -> float: ... | |||
def is_integer(self: float64) -> bool: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A number of these methods are only available to np.float64
(xref #13375).
* `integer.numerator` & `denominator` * `integer.__round__` & `floating.__round__` * `floating.as_integer_ratio` * `float64.__getnewargs__` / `complex128.__getnewargs__` * `float64.is_integer`, `hex`, `fromhex`, `__trunc__` & `__getformat__` * `float64.__ceil__` & `float64.__floor__` (python >= 3.9 only)
@property | ||
def denominator(self) -> L[1]: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd argue that denominator
returning a builtins.int
instance is somewhat concerning, especially for np.uint64
.
Thanks Bas. |
closes #19339
A number of
np.number
subclass attributes were previously absent from the stub files.This PR fixes aforementioned issue, adding annotations for the following properties and methods:
integer.numerator
&denominator
integer.__round__
&floating.__round__
floating.as_integer_ratio
float64.__getnewargs__
&complex128.__getnewargs__
float64.is_integer
,hex
,fromhex
,__trunc__
&__getformat__
float64.__ceil__
&float64.__floor__
(python >= 3.9 only)