-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add type annotations to three_d_camera.py
#4356
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 annotations to three_d_camera.py
#4356
Conversation
| def z_key(mob: Mobject) -> float: | ||
| if not (hasattr(mob, "shade_in_3d") and mob.shade_in_3d): | ||
| return np.inf | ||
| return np.inf # 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.
Apparently np.inf is not considered a float by mypy.
chopan050
left a comment
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.
Thanks for the changes! I left some few suggestions:
|
|
||
| def modified_rgbas(self, vmobject, rgbas): | ||
| # TODO: Find a better way | ||
| def modified_rgbas(self, vmobject: VMobject, rgbas: MatrixMN) -> MatrixMN: |
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 comment rather than a suggestion for this PR.
MatrixMN seems like the most fit alias for now, but we should actually make a new alias specifically for RGBA arrays, since MatrixMN is more fit for matrices representing linear maps which are applied on vectors. This was actually part of a larger proposal I wrote a long time ago in a #development post on Discord.
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.
Then I suggest to continue to use MatrixMN for now, and then when we also can type check on the dimensions of the matrices it would be a suitable time to change the typing.
|
Thanks for the input and comments. I have addressed all of them. |
chopan050
left a comment
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.
Thanks!
three_d_camera.py
Overview: What does this pull request change?
This PR adds type annotations to
three_d_camera.py.Reviewer Checklist