Prints the statement stmt to the terminal and wait for a Y or N answer.
       Returns True for 'Y', False for 'N'.
549419
def prompt_yn(stmt):
    ''''''
    print(stmt)
    answer = ''
    while answer not in ['Y', 'N']:
        sys.stdout.write("$ ")
        answer = sys.stdin.readline().upper().strip()
    return answer == 'Y'
893770
def statement(self,phrase):
        
        t = datetime.now()
        s = str(t) + ' ' + str(phrase) + '\n'
        if self.echo:
            print(s,end='')
        if self.filename:
            self.f.write(s)
            self.f.flush()
131645
def _wait(lfunc, log_lvl=None, log_msg=None, tries=10):
    '''
    
    '''
    i = 0
    while i < tries:
        time.sleep(1)

        if lfunc():
            return True
        else:
            i += 1
    if log_lvl is not None:
        log.log(LOG[log_lvl], log_msg)
    return False
1253009
private static String printStatement(Context context, JCStatement statement) {
    StringWriter writer = new StringWriter();
    try {
      pretty(context, writer).printStat(statement);
    } catch (IOException e) {
      throw new AssertionError("StringWriter cannot throw IOExceptions");
    }
    return writer.toString();
  }
602078
def prompt_stdin(prompt):
    """"""
    # raw_input returns the empty string for "enter"
    yes = set(['yes', 'y'])
    no = set(['no','n'])

    try:
        print(prompt)
        if sys.version_info>=(3,0):
            choice = input().lower()
        else:
            choice = raw_input().lower()
        # would like to test for which exceptions here
    except:
        print('Stdin is not implemented.')
        print('You need to set')
        print('overide_manual_authorize=True')
        print('to proceed with the download. Please set that variable and continue.')
        raise


    if choice in yes:
        return True
    elif choice in no:
        return False
    else:
        print("Your response was a " + choice)
        print("Please respond with 'yes', 'y' or 'no', 'n'")
29040
def _inputLoop(self):
        
        try:
            while self.alive:
                try:
                    c = console.getkey()                    
                except KeyboardInterrupt:
                    print('kbint')
                    c = serial.to_bytes([3])
                if c == self.EXIT_CHARACTER: 
                    self.stop()
                elif c == '\n':
                    # Convert newline input into \r
                    self.serial.write(self.WRITE_TERM)
                    if self.echo:
                        # Locally just echo the real newline
                        sys.stdout.write(c)
                        sys.stdout.flush()
                else:
                    #print('writing: ', c)
                    self.serial.write(c)
                    if self.echo:
                        sys.stdout.write(c)
                        sys.stdout.flush()
        except:
            self.alive = False
            raise
745529
def yesno(prompt):
    
    prompt += " [y/n]"
    a = ""
    while a not in ["y", "n"]:
        a = input(prompt).lower()

    return a == "y"
369191
private static boolean mayBeStatementNoReturn(Node n) {
    switch (n.getToken()) {
      case EMPTY:
      case FUNCTION:
        // EMPTY and FUNCTION are used both in expression and statement
        // contexts
        return true;

      case BLOCK:
      case BREAK:
      case CLASS:
      case CONST:
      case CONTINUE:
      case DEBUGGER:
      case DO:
      case EXPR_RESULT:
      case FOR:
      case FOR_IN:
      case FOR_OF:
      case FOR_AWAIT_OF:
      case IF:
      case LABEL:
      case LET:
      case SWITCH:
      case THROW:
      case TRY:
      case VAR:
      case WHILE:
      case WITH:
        return true;

      default:
        return false;
    }
  }
1263849
def yn_prompt(text):
    '''
        
    '''

    text = "\n"+ text + "\n('y' or 'n'): "


    while True:
        answer = input(text).strip()
        if answer != 'y' and answer != 'n':
            continue
        elif answer == 'y':
            return True
        elif answer == 'n':
            return False
1120430
def quick_confirm(prompt, default_value):
        
        valid = False
        value = default_value.lower()
        while not valid:
            input_val = compat_input(prompt + "[{0}]: ".format(default_value))

            if input_val == "":
                value = default_value.lower()
                valid = True
            else:
                try:
                    if input_val.lower() in ['y', 'n']:
                        value = input_val.lower()
                        valid = True
                    else:
                        print("ERROR: enter 'Y' or 'N'.")
                        valid = False

                except ValueError:
                    print("ERROR: enter 'Y' or 'N'.")
                    valid = False

        return value
114416
def ensure_newline(self, n):
        """"""
        assert n >= 0
        text = self._output.getvalue().rstrip('\n')
        if not text:
            return
        self._output = StringIO()
        self._output.write(text)
        self._output.write('\n' * n)
        text = self._output.getvalue()
        assert text[-n-1] != '\n'
        assert text[-n:] == '\n' * n
303462
def prepare_value(value):
        """"""
        if isinstance(value, (list, tuple, set)):
            return ",".join(value)

        if isinstance(value, bool):
            return "y" if value else "n"

        return str(value)
1088973
def ask(prompt = '(y/n)')
      command_line.set_prompt prompt
      command_line.refresh
      while (c = Curses.getch)
        next unless [?N, ?Y, ?n, ?y, 3, 27] .include? c  # N, Y, n, y, ^c, esc
        command_line.clear
        command_line.noutrefresh
        break (c == 'y') || (c == 'Y')
      end
    end
639033
function print() {
        var parts = String(out).split('\n');
        /* istanbul ignore next */
        if (parts.length > 1) {
          out = parts.pop();
          var logging = String(parts.join('\n')).replace(/\r\r/g, '\r');
          slf.log(logging);
        }
        /* istanbul ignore next */
        if (closed === false) {
          setTimeout(function () {
            print();
          }, 50);
        }
      }
35633
def _maybe_print(something_to_print, end=None, min_=1, max_=99, verbose=0):
    """"""
    if min_ <= verbose <= max_:
        import sys
        print(something_to_print, end=end)
        sys.stdout.flush()
1275929
def n_exec_stmt(self, node):
        
        self.write(self.indent, 'exec ')
        self.preorder(node[1])

        if len(node) > 2:
            self.write(self.indent, ' in ')
            self.preorder(node[3])
            if len(node) > 5:
                self.write(self.indent, ', ')
                self.preorder(node[5])
        self.println()
        self.prune()
1034591
def truthy?(str)
      return true if str == true || str =~ (/^(true|t|yes|y|1)$/i)
      return false if str == false || str.blank? || str =~ (/^(false|f|no|n|0)$/i)
    end