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

fix(types): declare support for single questions #191

Merged
merged 1 commit into from Dec 19, 2021

Conversation

yajo
Copy link
Contributor

@yajo yajo commented Dec 19, 2021

What is the problem that this PR addresses?

Without this patch, when calling prompt or unsafe_prompt with a dict on questions, mypy fails with:

Argument 1 to "unsafe_prompt" has incompatible type "Dict[str, Any]"; expected "Iterable[Mapping[str, Any]]"

How did you solve it?

As dict is a valid supported input, I added it to the typing information, joined within an Union type.

Checklist

  • I have read the Contributor's Guide.
  • I will check that all automated PR checks pass before the PR gets reviewed.

Without this patch, when calling `prompt` or `unsafe_prompt` with a `dict` on `questions`, mypy fails with:

    Argument 1 to "unsafe_prompt" has incompatible type "Dict[str, Any]"; expected "Iterable[Mapping[str, Any]]"
yajo added a commit to copier-org/copier that referenced this pull request Dec 19, 2021
yajo added a commit to copier-org/copier that referenced this pull request Dec 19, 2021
Copy link
Owner

@tmbo tmbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot for the improvement ⭐

@tmbo tmbo merged commit 1000f1e into tmbo:master Dec 19, 2021
@yajo yajo deleted the fix-single-prompt-types branch December 20, 2021 14:52
yajo added a commit to copier-org/copier that referenced this pull request Jan 3, 2022
yajo added a commit to copier-org/copier that referenced this pull request Jan 3, 2022
yajo added a commit to copier-org/copier that referenced this pull request Jan 4, 2022
yajo added a commit to copier-org/copier that referenced this pull request Jan 4, 2022
yajo added a commit to copier-org/copier that referenced this pull request Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants