sudomilk/InformPHP — pull request #4 by sudomilk (2014-09-09 01:58:06+00:00)
Title: added y/n condition

Based off of the cook-book recipe, changed raw_input to input

```Python
def query_yes_no(question, default="yes"):
"""
Ask a yes/no question via input() and return their answer.

"question" is a string that is presented to the user.
"default" is the presumed answer if the user just hits .
It must be "yes" (the default), "no" or None (meaning
an answer is required of the user).

The "answer" return value is one of "yes" or "no".
"""
valid = {"yes": True, "y": True, "ye": True,
"no": False, "n": False}
if default is None:
prompt = " [y/n] "
elif default == "yes":
prompt = " [Y/n] "
elif default == "no":
prompt = " [y/N] "
else:
raise ValueError("invalid default answer: '%s'" % default)

while True:
sys.stdout.write(question + prompt)
choice = input().lower()
if default is not None and choice == '':
return valid[default]
elif choice in valid:
return valid[choice]
else:
sys.stdout.write("Please respond with 'yes' or 'no' "
"(or 'y' or 'n').\n")
```