Ask for confirmation, given a ``prompt`` and return a boolean value.
4609
def confirm(prompt):
    
    while True:
        try:
            answer = input(prompt)
        except KeyboardInterrupt:
            # the user presses ctrl+c, just say 'no'
            return False
        answer = answer.strip().lower()
        if answer not in ('y', 'n'):
            print('Please enter y or n')
            continue
        return answer == 'y'
951757
def ask(message='Are you sure? [y/N]'):
    """"""
    agree = False
    answer = raw_input(message).lower()
    if answer.startswith('y'):
        agree = True
    return agree
220078
def query_yes_no(question, default="yes"):
    """"""
    res = _query_yes_no(question, default)
    if res == "yes":
        return True
    else:
        return False
779139
def prompt_4_yes_no(question):
    
    while True:
        sys.stdout.write(question + ' (y/n)? ')
        try:
            choice = raw_input().lower()
        except:
            choice = input().lower()
        if choice == 'yes' or choice == 'y':
            return True
        elif choice == 'no' or choice == 'n':
            return False
        else:
            printError('\'%s\' is not a valid answer. Enter \'yes\'(y) or \'no\'(n).' % choice)
760380
public function confirm($prompt, $default = null)
    {
        $prompt .= ' [';
        $prompt .= $default === true ? 'Y' : 'y';
        $prompt .= '/';
        $prompt .= $default === false ? 'N' : 'n';
        $prompt .= '] ';
        while (true) {
            $input = $this->get(':: ' . $prompt);
            if (! is_string($input)) {
                return false;
            }
            if ($input == '') {
                if (is_bool($default)) {
                    return $default;
                }
                continue;
            }
            $input = strtolower($input);
            if ($input == 'yes' or $input == 'y') {
                return true;
            }
            return false;
        }
    }
1240901
def global_confirm(question, default=True):
    
    if env.abort_on_prompts:
        return True
    original_parallel = env.parallel
    env.parallel = False
    result = confirm(question, default)
    env.parallel = original_parallel
    return result
284911
def get_confirmation(self):
        """"""
        if self.clear:
            action = 'This will DELETE ALL FILES in this location!'
        else:
            action = 'This will overwrite existing files!'

        message = (
            "\n"
            "You have requested to collect static files at the destination\n"
            "location as specified in your settings\n"
            "\n"
            "    {destination}\n"
            "\n"
            "{action}\n"
            "Are you sure you want to do this?\n"
            "\n"
            "Type 'yes' to continue, or 'no' to cancel: ".format(
                destination=self.destination_path,
                action=action,
            )
        )

        if input(''.join(message)) != 'yes':
            raise CommandError("Collecting tools cancelled.")
1248239
def confirm(question, default=True):
    
    valid = {"": default, "yes": True, "y": True, "no": False, "n": False}
    while 1:
        choice = input(question + (" [Y/n] " if default else " [y/N] ")).lower()
        if choice in valid:
            return valid[choice]
        print("Please respond with 'y' or 'n' ")
323434
def ask_yes_no(*question: Token, default: bool = False) -> bool:
    """"""
    while True:
        tokens = [green, "::", reset] + list(question) + [reset]
        if default:
            tokens.append("(Y/n)")
        else:
            tokens.append("(y/N)")
        info(*tokens)
        answer = read_input()
        if answer.lower() in ["y", "yes"]:
            return True
        if answer.lower() in ["n", "no"]:
            return False
        if not answer:
            return default
        warning("Please answer by 'y' (yes) or 'n' (no) ")
854628
def _check_prompts(pre_prompt, post_prompt):
    ''''''
    if not isinstance(pre_prompt, str):
        raise TypeError("The pre_prompt was not a string!")
    if post_prompt is not _NO_ARG and not isinstance(post_prompt, str):
        raise TypeError("The post_prompt was given and was not a string!")
240845
def ask_yesno(msg="Proceed?", dft=None):
    """"""
    yes = ["y", "yes", "Y", "YES"]
    no = ["n", "no", "N", "NO"]
    if dft != None:
        dft = yes[0] if (dft in yes or dft == True) else no[0]
    return ask(msg, dft=dft, vld=yes+no) in yes
527455
def confirm(*args, **kwargs):
    """"""
    try:
        return click.confirm(*args, **kwargs)
    except click.Abort:
        return False
893276
def _confirm_or_prompt_or_command(pymux):
    "  "
    client_state = pymux.get_client_state()
    if client_state.confirm_text or client_state.prompt_command or client_state.command_mode:
        return True
610283
def confirm(text: str, default: bool = False) -> bool:
    """"""
    choices = "Y/n" if default else "y/N"
    prompt = f"{style(text, bold=True)} [{choices}]: "
    while 1:
        try:
            print(prompt, end="")
            value = input("").lower().strip()
        except (KeyboardInterrupt, EOFError):
            sys.exit(1)
        if value in ("y", "yes"):
            rv = True
        elif value in ("n", "no"):
            rv = False
        elif value == "":
            rv = default
        else:
            print_error("Error: invalid input")
            continue
        break
    return rv
1229879
def confirm(question):
    
    if FORCE_YES:
        return True

    while True:
        answer = input(question + ' <Yes|No>').lower()

        if answer == 'yes' or answer == 'y':
            confirmed = True
            break
        if answer == 'no' or answer == 'n':
            confirmed = False
            break

    return confirmed
1324821
def confirm(question: str, default: bool = True) -> bool:
    

    result = input('{question} [{yes}/{no}]:'.format(
        question=question,
        yes='(Y)' if default else 'Y',
        no='N' if default else '(N)'
    ))

    if not result:
        return default

    if result[0].lower() in ['y', 't', '1']:
        return True
    return False
1207078
def bool_input(message):
    '''
    
    '''

    while True:
        suffix = ' (true or false): '
        inp = input(message + suffix)
        if inp.lower() == 'true':
            return True
        elif inp.lower() == 'false':
            return False
        else:
            print(colored('Must be either true or false, try again!', 'red'))