-
Notifications
You must be signed in to change notification settings - Fork 86
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
Add a print
question type
#244
Add a print
question type
#244
Conversation
print
question type
Thanks for this PR.
This part of the contributor's guide has been updated (if you look at the You should just be able to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks great - thanks. I've left a comment below.
Looks good to me - thanks for the PR! |
What is the problem that this PR addresses?
Adds
print
type to dictionary style prompts. Closes #207....
How did you solve it?
Modified
prompt()
to handle aprint
type that prints a message (with/without optional style). Thename
field is optional when usingprint
.print
does not return a value and does not add an entry to the returned dict fromprompt()
; it only outputs text.print
does work with thewhen
keyword so the message can be conditionally printed....
Checklist
Note: several tests in
tests/prompts/test_select.py
failed with "too many open files". However, these same tests failed before the PR changes. I'm using a Mac running Catalina 10.15.7. All other tests (including the tests added for this PR) passed.mypy checks passed:
The
pycodestyle
test required by contributor's guide had many failures (mostly long lines) that were already present in the source code -- not changed in this PR. I fixed the changes in the PR to ensure they introduced no new pycodestyle errors. I did add# noqa
to two lines inprompt.py
that were 80 and 85 lines long respectively because changing the code would have been much less clean (would require an if/then block instead of an inline which was easier to read).Note: running black on the
tests/
directory would have changed a bunch of the existing import statements so I made sure my new tests were blackified but did not run black on the existing code.