keras-team/keras-autodoc

Support for Enums

lgvaz opened this issue · 1 comments

lgvaz commented

When having an enum as a default parameter in any function, the following error occurs:

black.InvalidInput: Cannot parse: 1:72: def xxxx(metric_type=<COCOMetricType.bbox: 'bbox'>, print_summary=False):

The error tells everything, inside format_signature black is used and it cannot understand <Classname...> because that's not valid python code.

I've found two workarounds but they are both suboptimal. The first is to use None in the default value instead, and the second, to change the enum __repr__/__str__.

Is there another way to get around this error? I can try drafting a PR if you think this is easily solvable.

Could you provide a minimal example to reproduce this bug and give the full stacktrace? The example would then be integrated in the unit tests and it would make it easier to understand where the bug comes from. Thanks!