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

allow any callable as argument to TreeStyle.set_layout_fn #562

Merged
merged 1 commit into from
May 1, 2023

Conversation

jfaccioni
Copy link
Contributor

This PR allows any callable object to be set as the layout function of a TreeStyle object.

Currently, only objects whose type match types.FunctionType or types.MethodType are allowed. This behavior excludes otherwise valid Python callables, e.g. partial functions created with functools.partial, or any used-defined class that implements __call__, irrespective of whether the actual call would succeed or not.

The PR fixes this by using the callable built-in function for checking the layout function's type.

@jhcepas jhcepas merged commit 77e984a into etetoolkit:ete3 May 1, 2023
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.

2 participants