-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add type hints to graphing #4118
base: main
Are you sure you want to change the base?
Conversation
Check for value errors in function() and inverse function()
self.parametric_function: Callable[[float], Point3D] = lambda t: np.array( | ||
[t, function(t), 0] | ||
) | ||
self.function = function # type: ignore[assignment] |
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.
Don't know how to resolve this.
f"Expected a float type result, got {type(result)}." | ||
) | ||
return result | ||
return np.log(value) / np.log(base) # type: ignore [no-any-return] |
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.
Not sure how to resolve this type hint error.
@@ -141,7 +141,7 @@ def __init__(self, base: float = 10, custom_labels: bool = True) -> None: | |||
|
|||
def function(self, value: float) -> float: | |||
"""Scales the value to fit it to a logarithmic scale.``self.function(5)==10**5``""" | |||
return float(self.base**value) | |||
return self.base**value # type: ignore [no-any-return] |
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.
Don't know yet how to resolve this.
Nice to see more typing work! I have also added type annotations for the graphing/scale.py in #4125, but it seems like you have also updated some warnings in the code that I haven't dealt with. Regarding the
|
Overview: What does this pull request change?
Related to #3375.
Motivation and Explanation: Why and how do your changes improve the library?
Links to added or changed documentation pages
Further Information and Comments
Reviewer Checklist