Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Support for Enums #85

Open
lgvaz opened this issue Aug 17, 2020 · 1 comment
Open

Support for Enums #85

lgvaz opened this issue Aug 17, 2020 · 1 comment

Comments

@lgvaz
Copy link
Contributor

lgvaz commented Aug 17, 2020

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.

@gabrieldemarmiesse
Copy link
Contributor

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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants