Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved inference handling for multi types and nargs types #8

Merged
merged 2 commits into from
Feb 15, 2024

Conversation

couling
Copy link
Owner

@couling couling commented Feb 15, 2024

There was previously a bug with inference handling where nargs=-1 or multuple=True or is_flag should mean not required, but this was not being assessed. Required inference is now much more reliable.

Type inference handling where nargs=-1 or multiple=True now knows to unbox the tuple[foo, ...] to foo. Likewise inference handling for nargs > 1 also knows to unbox tuple types.

Eg: this now works:

@dataclass
class Foo:
    bar: Annotated[tuple[int, str], argument(nargs=2)]

@couling couling added the enhancement New feature or request label Feb 15, 2024
@couling couling merged commit 618bb17 into main Feb 15, 2024
3 checks passed
@couling couling deleted the multiple-handling branch February 15, 2024 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant