<commit_before>"""
  @file   inv/view/cli/common.py
  @author <NAME>
  @brief  a script containing the methods necessary
          to design a robust command-line interface
"""

import sys

def read_int(prompt):
  try:
    y_str=raw_input(prompt)
    y=int(y_str)
  except:
    print "invalid input, expecting integer value"
    y=read_int(prompt)
  return y

def read_float(prompt):
  try:
    y_str=raw_input(prompt)
    y=float(y_str)
  except:
    print "invalid input, expecting floating-point value"
    y=read_float(prompt)
  return y

def read_bool(prompt):
  try:
    y_str=raw_input(prompt)
    y=bool(y_str)
  except:
    print "invalid input, expecting boolean value (y/n)"
    y=read_bool(prompt)
  return y
<commit_msg>more robust boolean input checking<commit_after>"""
  @file   inv/view/cli/common.py
  @author <NAME>
  @brief  a script containing the methods necessary
          to design a robust command-line interface
"""

import sys

def read_int(prompt):
  try:
    y_str=raw_input(prompt)
    y=int(y_str)
  except:
    print "invalid input, expecting integer value"
    y=read_int(prompt)
  return y

def read_float(prompt):
  try:
    y_str=raw_input(prompt)
    y=float(y_str)
  except:
    print "invalid input, expecting floating-point value"
    y=read_float(prompt)
  return y

def read_bool(prompt):
  try:
    y_str=raw_input(prompt)
    if y_str in 'yY':
      y=True
    elif y_str in 'nN':
      y=False
    else:
      raise Exception()
  except:
    print "invalid input, expecting boolean value (y/n)"
    y=read_bool(prompt)
  return y

{'fraction_non_alphanumeric': 0.09898477157360407, 'fraction_numerical': 0.0, 'mean_word_length': 3.2737127371273713, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4480001', 'n_tokens_mistral': 566, 'n_tokens_neox': 547, 'n_words': 148}