Mon, 14 Nov 2016 16:31:32 +0100
Code under MIT licence removed and replaced by
def user_yes_no_query(question)
lidar_correction_ghk.py | file | annotate | diff | comparison | revisions |
--- a/lidar_correction_ghk.py Mon Nov 14 16:32:01 2016 +0200 +++ b/lidar_correction_ghk.py Mon Nov 14 16:31:32 2016 +0100 @@ -68,32 +68,6 @@ #if user_yes_no_query('want to exit?') == 1: sys.exit() -''' -## {{{ http://code.activestate.com/recipes/577058/ (r2) -def query_yes_no(question, default="yes"): - valid = {"yes":"yes", "y":"yes", "ye":"yes", - "no":"no", "n":"no"} - if default == 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 1: - sys.stdout.write(question + prompt) - choice = input().lower() - if default is not None and choice == '': - return default - elif choice in valid.keys(): - return valid[choice] - else: - sys.stdout.write("Please respond with 'yes' or 'no' "\ - "(or 'y' or 'n').\n") -## end of http://code.activestate.com/recipes/577058/ }}} -''' abspath = os.path.abspath(__file__) dname = os.path.dirname(abspath) fname = os.path.basename(abspath)