# Path: lightbulb/core/utils/common.py
# def accept_bool(user_input):
#     """
#         Transforms a string into bool
#         Args:
#             user_input (str): The string parameter
#         Retuns:
#             bool: A true or false value
#     """
#     if not isinstance(user_input, basestring):
#         return  user_input
# 
#     if user_input.lower() in ['true', '1', 't', 'y', 'yes']:
#         return True
#     else:
#         return  False
# 
# def save_model(save, model):
#     if not isinstance(save, basestring):
#         return
#     if save == "REGEX":
#         regex = model.to_regex()
#         return "Regular Expression", regex
#     elif save == "STRING":
#         string = model.shortest_string()
#         return "Shortest String", string
#     elif save.lower() in ['true', '1', 't', 'y', 'yes']:
#         home = expanduser("~")
#         timestr = time.strftime("%Y%m%d-%H%M%S")
#         if not os.path.exists(home+"/.LightBulb/"):
#             os.makedirs(home+"/.LightBulb/")
#         if not os.path.exists(home+"/.LightBulb/models"):
#             os.makedirs(home+"/.LightBulb/models")
#         model.save(home+"/.LightBulb/models/"+timestr+".fst")
#         ruleset_file_meta = open(home+"/.LightBulb/models/"+timestr+".py", "w")
#         ruleset_file_meta.write(
#             "META = {\n\
#                     'author': '"+getpass.getuser()+"',\n\
#                     'description': 'Saved model on "+timestr+"',\n\
#                     'type':'FST',\n\
#                     'comments': []\n\
#             }")
#         ruleset_file_meta.close()
#         return "Saved Model", home+"/.LightBulb/models/"+timestr+".fst"
#     elif save.lower() in ['False', '2', 'f', 'n', 'no']:
#         return
#     else:
#         model.save(save)
#         return "Saved Model", save
# 
# def findlibrary(path):
#     path = re.sub('.*my_saved_models/', expanduser("~") + "/.LightBulb/models/", path)
#     path = re.sub('.*my_saved_regex/', expanduser("~") + "/.LightBulb/regex/", path)
#     path = re.sub('.*my_saved_trees/', expanduser("~") + "/.LightBulb/trees/", path)
#     path = re.sub('.*my_saved_grammars/', expanduser("~") + "/.LightBulb/grammars/", path)
#     path = path.replace('{library}', imp.find_module('lightbulb')[1]+"/data/")
#     return path
# 
# Path: lightbulb/core/base.py
# def options_as_dictionary(meta):
# def importmodule(name):
# def create_object(object_type, object_type_configuration, handler, handler_configuration):
#         def setup(self, configuration):
#     class Module(object_class):


from sfalearn.angluin_sfa import SFALearner as _SFALearner
from symautomata.cfgpda import CfgPDA as _CfgPDA
from symautomata.dfa import DFA as _DFA
from symautomata.flex2fst import Flexparser as _Flexparser
from lightbulb.core.utils.common import accept_bool, save_model, findlibrary
from lightbulb.core.base import createalphabet
        self.cache_membership_queries = 0
        self.equivalence_queries = 0
        self.cache_equivalence_queries = 0
        self.cache_equivalence = []
        self.cache_membership = {}
        self.mma = None
        self.mmac = None
        self.bypass = None
        if self.seed_file is not None and self.seed_file_type is not None:
            if self.seed_file_type == "FLEX":
                flex_object_m = _Flexparser(self.alphabet)
                self.mma = flex_object_m.yyparse(findlibrary(self.seed_file))
                self.mma.minimize()
            elif self.seed_file_type == "GRAMMAR":
                cfgtopda = _CfgPDA(self.alphabet)
                self.mma = cfgtopda.yyparse(findlibrary(self.seed_file), 1)
            elif self.seed_file_type == "FST":
                self.mma = _DFA(self.alphabet)
                self.mma.load(findlibrary(self.seed_file))
                self.mma.minimize()
        if self.tests_file is not None and self.tests_file_type is not None:
            if self.tests_file_type == "FLEX":
                flex_object_m = _Flexparser(self.alphabet)
                self.mmac = flex_object_m.yyparse(findlibrary(self.tests_file))
                self.mmac.minimize()
            elif self.tests_file_type == "GRAMMAR":
                cfgtopda = _CfgPDA(self.alphabet)
                self.mmac = cfgtopda.yyparse(findlibrary(self.tests_file), 1)
            elif self.tests_file_type == "FST":
                self.mmac = _DFA(self.alphabet)

# Path: lightbulb/core/utils/common.py
# def accept_bool(user_input):
#     """
#         Transforms a string into bool
#         Args:
#             user_input (str): The string parameter
#         Retuns:
#             bool: A true or false value
#     """
#     if not isinstance(user_input, basestring):
#         return  user_input
# 
#     if user_input.lower() in ['true', '1', 't', 'y', 'yes']:
#         return True
#     else:
#         return  False
# 
# def save_model(save, model):
#     if not isinstance(save, basestring):
#         return
#     if save == "REGEX":
#         regex = model.to_regex()
#         return "Regular Expression", regex
#     elif save == "STRING":
#         string = model.shortest_string()
#         return "Shortest String", string
#     elif save.lower() in ['true', '1', 't', 'y', 'yes']:
#         home = expanduser("~")
#         timestr = time.strftime("%Y%m%d-%H%M%S")
#         if not os.path.exists(home+"/.LightBulb/"):
#             os.makedirs(home+"/.LightBulb/")
#         if not os.path.exists(home+"/.LightBulb/models"):
#             os.makedirs(home+"/.LightBulb/models")
#         model.save(home+"/.LightBulb/models/"+timestr+".fst")
#         ruleset_file_meta = open(home+"/.LightBulb/models/"+timestr+".py", "w")
#         ruleset_file_meta.write(
#             "META = {\n\
#                     'author': '"+getpass.getuser()+"',\n\
#                     'description': 'Saved model on "+timestr+"',\n\
#                     'type':'FST',\n\
#                     'comments': []\n\
#             }")
#         ruleset_file_meta.close()
#         return "Saved Model", home+"/.LightBulb/models/"+timestr+".fst"
#     elif save.lower() in ['False', '2', 'f', 'n', 'no']:
#         return
#     else:
#         model.save(save)
#         return "Saved Model", save
# 
# def findlibrary(path):
#     path = re.sub('.*my_saved_models/', expanduser("~") + "/.LightBulb/models/", path)
#     path = re.sub('.*my_saved_regex/', expanduser("~") + "/.LightBulb/regex/", path)
#     path = re.sub('.*my_saved_trees/', expanduser("~") + "/.LightBulb/trees/", path)
#     path = re.sub('.*my_saved_grammars/', expanduser("~") + "/.LightBulb/grammars/", path)
#     path = path.replace('{library}', imp.find_module('lightbulb')[1]+"/data/")
#     return path
# 
# Path: lightbulb/core/base.py
# def options_as_dictionary(meta):
# def importmodule(name):
# def create_object(object_type, object_type_configuration, handler, handler_configuration):
#         def setup(self, configuration):
#     class Module(object_class):


# Path: lightbulb/core/modules/gofa.py
from sfalearn.angluin_sfa import SFALearner as _SFALearner
from symautomata.cfgpda import CfgPDA as _CfgPDA
from symautomata.dfa import DFA as _DFA
from symautomata.flex2fst import Flexparser as _Flexparser
from lightbulb.core.utils.common import accept_bool, save_model, findlibrary
from lightbulb.core.base import createalphabet

        self.cache_membership_queries = 0
        self.equivalence_queries = 0
        self.cache_equivalence_queries = 0
        self.cache_equivalence = []
        self.cache_membership = {}
        self.mma = None
        self.mmac = None
        self.bypass = None
        if self.seed_file is not None and self.seed_file_type is not None:
            if self.seed_file_type == "FLEX":
                flex_object_m = _Flexparser(self.alphabet)
                self.mma = flex_object_m.yyparse(findlibrary(self.seed_file))
                self.mma.minimize()
            elif self.seed_file_type == "GRAMMAR":
                cfgtopda = _CfgPDA(self.alphabet)
                self.mma = cfgtopda.yyparse(findlibrary(self.seed_file), 1)
            elif self.seed_file_type == "FST":
                self.mma = _DFA(self.alphabet)
                self.mma.load(findlibrary(self.seed_file))
                self.mma.minimize()
        if self.tests_file is not None and self.tests_file_type is not None:
            if self.tests_file_type == "FLEX":
                flex_object_m = _Flexparser(self.alphabet)
                self.mmac = flex_object_m.yyparse(findlibrary(self.tests_file))
                self.mmac.minimize()
            elif self.tests_file_type == "GRAMMAR":
                cfgtopda = _CfgPDA(self.alphabet)
                self.mmac = cfgtopda.yyparse(findlibrary(self.tests_file), 1)
            elif self.tests_file_type == "FST":
                self.mmac = _DFA(self.alphabet)

                self.mmac.load(findlibrary(self.tests_file))