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

Support for Enums #85

@lgvaz

Description

@lgvaz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions