Mark some methods as internal#3793
Mark some methods as internal#3793JasonGrace2282 wants to merge 10 commits intoManimCommunity:mainfrom
Conversation
behackl
left a comment
There was a problem hiding this comment.
This looks fine! Left one suggestion and a bunch of comments where I thought it is somewhat debatable that a method would be marked as internal.
I like the mechanism though, am happy to merge this in principle. Thanks for your work!
|
|
||
| return self.rescale_to_fit(depth, 2, stretch=True, **kwargs) | ||
|
|
||
| @internal |
There was a problem hiding this comment.
To be honest, I don't remember. However, I think that it's more common to use move_to or set_(x|y|z) as opposed to this method.
This PR was mostly an introduction of concept, so I'm happy to remove it if you disagree.
| ) | ||
| return self | ||
|
|
||
| @internal |
There was a problem hiding this comment.
There was already a set_colors_by_gradient that used this internally and returning Self, so I figured that should be the public one.
| mob.set_color(color, family=False) | ||
| return self | ||
|
|
||
| @internal |
There was a problem hiding this comment.
Here, there was already a set_colors_by_radial_gradient that used this internally and returning Self, so I figured that should be the public one.
| def get_num_points(self) -> int: | ||
| return len(self.points) | ||
|
|
||
| @internal |
| def repeat_submobject(self, submob: Mobject) -> Self: | ||
| return submob.copy() | ||
|
|
||
| @internal |
| submob.z_index_group = self | ||
| return self | ||
|
|
||
| @internal |
There was a problem hiding this comment.
I mostly added this because of discussions on whether to make points a property (to add some memoization stuff).
| point.match_style(self) | ||
| return point | ||
|
|
||
| @internal |
| val = val.copy() | ||
| setattr(self, attr, val) | ||
|
|
||
| @internal |
There was a problem hiding this comment.
I find it hard to think of a case where a user would need this, and (I can't remember) but there's a chance this changes in experimental.
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
|
EDIT 2: Just did some benchmarking, the performance penalty from |
My view is always that when in doubt, mark it as internal. This gives us the most flexibility for the future (even though we're not at 1.0.0 yet!), and changing something from internal → public is not a major semvar change. |
This is an idea of an implementation for #3792
It defines a decorator that modifies the function's docstring to warn end-users that it is marked as an implementation detail.
Example
TODO