Ask a question and prepare to receive a yes-or-no answer.
17807
def yesno(self, s, yesno_callback, casual=False):
        """"""
        self.write(s)
        self.yesno_callback = yesno_callback
        self.yesno_casual = casual
238864
def handle_response(self, data):
        """"""
        identifier = data.get('id')
        self._buffer[identifier]['data'] = data.get('result')
        self._buffer[identifier]['flag'].set()
825425
function promisePrompt(questions) {
    return new Promise(function(resolve, reject) {
        inquirer.prompt(questions, function(results) {
            resolve(results);
        });
    });
}
1109615
def cmd(send, msg, args):
    
    if not msg:
        send("What is your question?")
        # let people !8ball again if they screw up and forget the part where you ask a question.
        args['handler'].abuselist[args['nick']]['8ball'].pop()
        return
    answers = {
        "It is certain": "yes",
        "It is decidedly so": "yes",
        "Without a doubt": "yes",
        "Yes, definitely": "yes",
        "You may rely on it": "yes",
        "As I see it, yes": "yes",
        "Most likely": "yes",
        "Outlook good": "yes",
        "Yes": "yes",
        "Signs point to yes": "yes",
        "Reply hazy, try again": "maybe",
        "Ask again later": "maybe",
        "Better not tell you now": "maybe",
        "Cannot predict now": "maybe",
        "Concentrate and ask again": "maybe",
        "Don't count on it": "no",
        "My reply is no": "no",
        "My sources say no": "no",
        "Outlook not so good": "no",
        "Very doubtful": "no"
    }
    answer = choice(list(answers.keys()))
    send('says... %s' % answer, 'action')
862622
def _ask_questionnaire():
    """"""

    answers = {}
    print(info_header)
    pprint(questions.items())

    for question, default in questions.items():
        response = _ask(question, default, str(type(default)), show_hint=True)
        if type(default) == unicode and type(response) != str:
            response = response.decode('utf-8')
        answers[question] = response

    return answers
737014
async function askSingle(question, timeout) {
  const { question: answer } = await askQuestions({ question }, timeout)
  return answer
}
1193686
function Question(name, message, options) {
  if (utils.isObject(name)) {
    options = utils.merge({}, message, name);
    message = options.message;
    name = options.name;
  }

  if (utils.isObject(message)) {
    options = utils.merge({}, options, message);
    message = options.message;
  }

  utils.define(this, 'isQuestion', true);
  utils.define(this, 'cache', {});

  this.options = options || {};
  this.type = this.options.type || 'input';
  this.message = message || this.options.message;
  this.name = name || this.options.name;

  if (!this.message) {
    this.message = this.name;
  }

  utils.merge(this, this.options);
  createNext(this);
}
1231032
def boolean_input(self, question, default=None):
        '''
        
        '''
        result = input("%s: " % question)
        if not result and default is not None:
            return default
        while len(result) < 1 or result[0].lower() not in "yn":
            result = input("Please answer yes or no: ")
        return result[0].lower() == "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
1153424
def choice(self, question, choices, default=None, attempts=None, multiple=False):
        
        question = ChoiceQuestion(question, choices, default)

        question.set_max_attempts(attempts)
        question.set_multi_select(multiple)

        return self._io.ask_question(question)
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' ")
715831
function createNext(question) {
  if (!question.options.next) return;

  if (typeof question.options.next === 'function') {
    question.next = function() {
      question.options.next.apply(question, arguments);
    };
    return;
  }

  if (typeof question.options.next === 'string') {
    question.type = 'confirm';
    question.next = function(answer, questions, answers, next) {
      if (answer === true) {
        questions.ask(question.options.next, next);
      } else {
        next(null, answers);
      }
    };
  }
}
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'
69107
def ask_yesno(query, default=None):
    """"""
    if default is None:
        default_q = ' [y/n]'
    elif default is True:
        default_q = ' [Y/n]'
    elif default is False:
        default_q = ' [y/N]'
    if sys.version_info[0] == 3:
        inp = raw_input("{query}{default_q} ".format(
            query=query, default_q=default_q)).strip()
    else:
        inp = raw_input("{query}{default_q} ".format(
            query=query, default_q=default_q).encode('utf-8')).strip()
    if inp:
        return inp.lower().startswith('y')
    elif default is not None:
        return default
    else:
        # Loop if no answer and no default.
        return ask_yesno(query, default)
777437
def on_response(self, msg: Dict[str, str]) -> None:
        """"""
        response = msg.get('data', False)
        if response:
            task = self.__tasks.pop(msg.get('reqid'), False)
            if task and not task.cancelled() and not task.done():
                task.set_result(msg.get('data'))
177695
async function requestConfirmation(message, defaultAnswer = false) {
  const answerName = 'requestConfirmation';
  const answers = await inquirer.prompt([
    {
      message,
      name: answerName,
      type: 'confirm',
      default: defaultAnswer,
    },
  ]);
  return answers[answerName];
}
44132
def ask(self, question, default=False):
        
        choices = '[%s/%s]' % ('Y' if default else 'y', 'n' if default else 'N')
        while True:
            response = raw_input('%s %s' % (question, choices)).strip()
            if not response:
                return default
            elif response in 'yYoO':
                return True
            elif response in 'nN':
                return False