You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Probably the repr() representation of default arguments is used, and it should be; that is supposed to give a string that, when evaluated, yields the value.
Unfortunately, the enum.Enum implementation in Python does not honor this convention; their repr() includes the Enum value and the "<>" brackets.
In an ideal world we could ask the enum.Enum people to fix that behavior; but I am afraid that would break quite a lot of code in the wild.
The best course of action may be to special-case Enum types in autodoc.
A workaround for the issue is to provide a __repr__ emplementation with Enum types, which may be a good idea anyway until the Python folks sort this out:
Python Enum values (used to show default values in function signatures) are rendered ugly.
To Reproduce
I made a minimal example to show the issue:
https://github.com/sidneycadot/sphinx_issue_ugly_enum
Expected behavior
I would hope the signature rendered as:
Unfortunately, it renders as:
Environment info
The text was updated successfully, but these errors were encountered: