Skip to content
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

handle_play_like_call decorator to use functools.wraps #1357

Merged
merged 2 commits into from
Feb 5, 2021

Conversation

parmentelat
Copy link
Contributor

@parmentelat parmentelat commented Feb 5, 2021

this is a remake of #1204 on the current master

this way, decorated methods - typically Scene.play - have a decent docstring
so first-time users can use help()

this way, decorated methods - typically Scene.play - have a decent docstring
so first-time users can use help()
Copy link
Collaborator

@TonyCrane TonyCrane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But there are two more wrappers. You can also improve them by the way:

def affects_shader_info_id(func):
def wrapper(self):
for mob in self.get_family():
func(mob)
mob.refresh_shader_wrapper_id()
return self
return wrapper
def triggers_refreshed_triangulation(func):
def wrapper(self, *args, **kwargs):
old_points = self.get_points()
func(self, *args, **kwargs)
if not np.all(self.get_points() == old_points):
self.refresh_triangulation()
self.refresh_unit_normal()
return wrapper

@parmentelat
Copy link
Contributor Author

that's right, I had proposed to take care of that in my initial PR, but had forgotten about all this in the meanwhile :)

I am in no position to test all this though at this time, the code I had written in summer last year looks broken with the current version (where is the Paragraph class now ?), and I could not spot any automated tests (did I miss them ?)

in any case, here you go ...

@TonyCrane
Copy link
Collaborator

This version has been developed since last year, so Paragraph and Code are not included in it. For testing, 3b1b/manim probably has never had a well-formed and complete test. But ManimCommunity/manim has.

@parmentelat
Copy link
Contributor Author

parmentelat commented Feb 5, 2021

are you suggesting I use the community version instead if I need Paragraph and Code ? otherwise where should I grab the code for this Paragraph class ?
more generally, I was not aware of these 2 flavours, where should I read about that in order to get up to speed ?

many thanks for the feedback !

@TonyCrane
Copy link
Collaborator

It may be that Paragraph and Code were mistakenly missed when merging shaders branch into master, but you can still use the old version that contains them in the cairo-backend branch now.
For ManimCommunity/manim, there is a big difference between the two versions at present, and there is a brief description of the difference in #1243. These two versions all have advantages, which one you use depends on you.
If you want to talk more, maybe you can start a discussion instead of this pr.

@3b1b 3b1b merged commit 94894c0 into 3b1b:master Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants