-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix graph crash with partial conditions
Graph.rep() assumes that every callable has a `__name__` attribute. However, callables like `functools.partial` and other classes with a `__call__()` method have no `__name__`. This patch modifies `Graph.rep()` to first check whether the condition is a string and return it, then try to return `f.__name__` (that is the current behavior) and if that fails, then it calls `str()` on the argument. `str()` should never fail and it is now the responsibility of the user to return something meaningful from `__str__()`.
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters