toolr.utils._signature¶
Utilities to parse function signatures.
VarArg ¶
Bases: Arg
, Struct
VarArg is a special case of Arg that is used to represent a variable number of arguments.
arg ¶
arg(
*,
aliases: list[str] | None = None,
required: bool | None = None,
metavar: str | None = None,
action: str | None = None,
choices: list[Any] | None = None,
nargs: NargsType | None = None,
group: str | None = None,
) -> ArgumentAnnotation
Create an ArgumentAnnotation.
This function is meant to be used with :class:typing.Annotated
to create an ArgumentAnnotation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
aliases
|
list[str] | None
|
Aliases for the argument. |
None
|
required
|
bool | None
|
Whether the argument is required. |
None
|
metavar
|
str | None
|
The metavar for the argument. |
None
|
action
|
str | None
|
The action for the argument. |
None
|
choices
|
list[Any] | None
|
The choices for the argument. |
None
|
nargs
|
NargsType | None
|
The number of arguments to accept. |
None
|
group
|
str | None
|
The name of the mutually exclusive group for the argument. |
None
|