2 from builtins
import input
7 Check whether an executable exists on PATH. 8 @param name Name of the executable 9 @return True if executable exists, False otherwise 11 from whichcraft
import which
13 return which(name)
is not None 18 Ask a yes/no question via raw_input() and return their answer. 19 @param question The question that is presented to the user. 20 @param default The presumed answer if the user just hits <Enter>. 21 It must be "yes" (the default), "no" or None (meaning 22 an answer is required of the user). 23 @return True if the answer is "yes", False otherwise 25 valid = {
"yes":
True,
"y":
True,
"ye":
True,
"no":
False,
"n":
False}
28 elif default ==
"yes":
33 raise ValueError(
"invalid default answer: '%s'" % default)
36 sys.stdout.write(question + prompt)
37 choice = input().lower()
38 if default
is not None and choice ==
"":
43 print(
"Please respond with 'yes' or 'no' " "(or 'y' or 'n').")
47 """!Write a message to standard output and flush the buffer""" def write_flush(msg)
Write a message to standard output and flush the buffer.
def is_tool(name)
Check whether an executable exists on PATH.
def query_yes_no(question, default="yes")
Ask a yes/no question via raw_input() and return their answer.