Skip to content

Optional args #111

@hidaris

Description

@hidaris

Hello, I noticed that in version 1.3, the help method converts Python objects into a JSON structure. However, the current implementation prevents the use of UnionType in action definitions, which makes the args unable to be optional.

I looked at the code, and the main reason for this is:

# type
 sig_annotation = signature.parameters[arg_name].annotation
 if sig_annotation is not None and sig_annotation.__name__ != "_empty":

When the argument type is a UnionType, sig_annotation does not have the __name__ attribute.

Is this a design decision?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions