# Path: pyke/qa_helpers.py
# class regexp(object):
# class qmap(object):
#     def __init__(self, regexp, msg=None, prompt=None):
#     def __repr__(self):
#     def __getstate__(self):
#     def __setstate__(self, args):
#     def match(self, str):
#     def __init__(self, test, value):
#     def __repr__(self):
#     def urepr(x):
# def to_int(str):
# def to_float(str):
# def to_number(str):
# def to_tuple(str, conv_fn=None, test=None, separator=','):
#     def conv_element(elem):
# def msg_for(test, type):
# def match_prompt(test, type, format, default=u''):
#     def prompt_body(test, type):
# def match(ans, test):


import sys
import itertools
from pyke import qa_helpers
        got it? (y/n) True
        >>> sys.stdin = StringIO('N\n')
        >>> ask_yn(u'got it?')
        ______________________________________________________________________________
        got it? (y/n) False
    '''
    return get_answer(question, u"(y/n)", conv_fn=lambda str: str.lower(),
                      test=(qa_helpers.qmap(yes_match, True),
                            qa_helpers.qmap(no_match, False)),
                      review=review)

def ask_integer(question, match=None, review=None):
    r'''
        >>> from StringIO import StringIO
        >>> sys.stdin = StringIO('4\n')
        >>> ask_integer(u'enter number?')
        ______________________________________________________________________________
        enter number? (int) 4
    '''
    return get_answer(question, qa_helpers.match_prompt(match, int, u"[%s]",
                                                        u'(int)'),
                      conv_fn=qa_helpers.to_int,
                      test=match,
                      review=review)

def ask_float(question, match=None, review=None):
    r'''
        >>> from StringIO import StringIO
        >>> sys.stdin = StringIO('4\n')
        >>> ask_float(u'enter number?')

# Path: pyke/qa_helpers.py
# class regexp(object):
# class qmap(object):
#     def __init__(self, regexp, msg=None, prompt=None):
#     def __repr__(self):
#     def __getstate__(self):
#     def __setstate__(self, args):
#     def match(self, str):
#     def __init__(self, test, value):
#     def __repr__(self):
#     def urepr(x):
# def to_int(str):
# def to_float(str):
# def to_number(str):
# def to_tuple(str, conv_fn=None, test=None, separator=','):
#     def conv_element(elem):
# def msg_for(test, type):
# def match_prompt(test, type, format, default=u''):
#     def prompt_body(test, type):
# def match(ans, test):


# Path: pyke/ask_tty.py
import sys
import itertools
from pyke import qa_helpers

        got it? (y/n) True
        >>> sys.stdin = StringIO('N\n')
        >>> ask_yn(u'got it?')
        ______________________________________________________________________________
        got it? (y/n) False
    '''
    return get_answer(question, u"(y/n)", conv_fn=lambda str: str.lower(),
                      test=(qa_helpers.qmap(yes_match, True),
                            qa_helpers.qmap(no_match, False)),
                      review=review)

def ask_integer(question, match=None, review=None):
    r'''
        >>> from StringIO import StringIO
        >>> sys.stdin = StringIO('4\n')
        >>> ask_integer(u'enter number?')
        ______________________________________________________________________________
        enter number? (int) 4
    '''
    return get_answer(question, qa_helpers.match_prompt(match, int, u"[%s]",
                                                        u'(int)'),
                      conv_fn=qa_helpers.to_int,
                      test=match,
                      review=review)

def ask_float(question, match=None, review=None):
    r'''
        >>> from StringIO import StringIO
        >>> sys.stdin = StringIO('4\n')
        >>> ask_float(u'enter number?')

        ______________________________________________________________________________