-
Notifications
You must be signed in to change notification settings - Fork 588
Make CameraPosition.__repr__
explicit
#7794
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
base: main
Are you sure you want to change the base?
Conversation
Does this have a knock on effect for the way that |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7794 +/- ##
=======================================
Coverage 96.40% 96.40%
=======================================
Files 150 150
Lines 32656 32658 +2
Branches 4114 4114
=======================================
+ Hits 31482 31485 +3
+ Misses 570 569 -1
Partials 604 604 |
Yes you're right, this would change that. You should still be able to copy/paste it as-is and use it, since the repr should be useable to init a new We could keep the old behavior with |
Both NDArray: repr(np.array((1,))) # 'array([1])'
str(np.array((1,))) # '[1]' CameraPosition # repr
CameraPosition(position=(0.3914, 0.4542, 0.767),
focal_point=(0.0243, 0.0336, -0.0222),
viewup=(-0.2148, 0.8998, -0.3796))
# str
[(0.3914, 0.4542, 0.767),
(0.0243, 0.0336, -0.0222),
(-0.2148, 0.8998, -0.3796)] |
I'm +0.2 in favor of this (out of -1 to +1). It is now easier to know what the numbers refer to. One hesitation is that, I assume that, there are a decent number of people who are using environments that show the repr, and that they are using pyvista/pyvista/plotting/plotter.py Lines 7155 to 7158 in 9b3b97a
|
That's a good find, I wonder why that doctest is skipped. Will do a search for cpos and try to update those examples. We can show both use cases, and maybe use Users can still copy/paste and reuse the output as new input for a cpos keyword, so that functionality isn't really lost. And now if they need to make minor tweaks to |
It's skipped because it raises a RuntimeError otherwise: RuntimeError: This plotter has been closed and cannot be shown. [docutils] |
|
Overview
Originally mentioned here #7788 (comment)
This PR makes it obvious that we're dealing with an object with three attributes