# 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 wx
import itertools
from pyke import qa_helpers
        def matches2(ans, test):
            try:
                qa_helpers.match(ans, test)
                return True
            except ValueError:
                return False

        def matches(ans, test):
            if isinstance(ans, (tuple, list)):
                return any(itertools.imap(lambda elem: matches2(elem, test),
                                          ans))
            return matches2(ans, test)
        msg = u'\n\n'.join(review_str for review_test, review_str in review
                                       if matches(ans, review_test))
        if msg:
            dlg2 = wx.MessageDialog(dlg, msg, 'Answer Information',
                                    wx.OK | wx.ICON_INFORMATION)
            dlg2.ShowModal()
            dlg2.Destroy()

def get_answer(question, title, conv_fn=None, test=None, review=None):
    dlg = wx.TextEntryDialog(None, question, title, u'',
                             wx.CENTRE | wx.RESIZE_BORDER | wx.OK)
    while True:
        status = dlg.ShowModal()
        if status != wx.ID_OK:
            raise AssertionError("dlg.ShowModal failed with %d" % status)
        ans = dlg.GetValue()
        try:
            if conv_fn: ans = conv_fn(ans)

# 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_wx.py
import sys
    import wx
import itertools
from pyke import qa_helpers

        def matches2(ans, test):
            try:
                qa_helpers.match(ans, test)
                return True
            except ValueError:
                return False

        def matches(ans, test):
            if isinstance(ans, (tuple, list)):
                return any(itertools.imap(lambda elem: matches2(elem, test),
                                          ans))
            return matches2(ans, test)
        msg = u'\n\n'.join(review_str for review_test, review_str in review
                                       if matches(ans, review_test))
        if msg:
            dlg2 = wx.MessageDialog(dlg, msg, 'Answer Information',
                                    wx.OK | wx.ICON_INFORMATION)
            dlg2.ShowModal()
            dlg2.Destroy()

def get_answer(question, title, conv_fn=None, test=None, review=None):
    dlg = wx.TextEntryDialog(None, question, title, u'',
                             wx.CENTRE | wx.RESIZE_BORDER | wx.OK)
    while True:
        status = dlg.ShowModal()
        if status != wx.ID_OK:
            raise AssertionError("dlg.ShowModal failed with %d" % status)
        ans = dlg.GetValue()
        try:
            if conv_fn: ans = conv_fn(ans)

            if test: ans = qa_helpers.match(ans, test)