# Path: torext/make_settings.py
# class Settings(dict, SingletonMixin):
#     def __init__(self):
#     def __getattr__(self, key):
#     def __getitem__(self, key):
#     def __setitem__(self, key, value):
#     def __str__(self):
#     def add_key_callback(self, key, callback):
# 
# Path: torext/errors.py
# class URLRouteError(TorextException):
#     """error in router"""
# 
# Path: torext/log.py
# def _color(lvl):
#     def __init__(self,
#                  fmt='%(color)s[%(fixed_levelname)s %(asctime)s %(module)s:%(lineno)d]%(end_color)s %(message)s',
#                  datefmt='%Y-%m-%d %H:%M:%S',
#                  color=False,
#                  tab='  '):
#     def _format_record(self, record):
#     def format(self, record):
#     def __init__(self, *args, **kwgs):
# def set_logger(name,
#                level='INFO',
#                fmt=None,
#                datefmt=None,
#                propagate=1,
#                remove_handlers=False):
# def set_loggers(loggers):
# def set_nose_formatter(logging_options):
#     def test_all():
# FIXED_LEVELNAMES = {
#     'DEBUG': 'DEBG',
#     'WARNING': 'WARN',
#     'ERROR': 'ERRO'
# }
# HANDLER_TYPES = {
#     'stream': BaseStreamHandler,
# }
# class BaseFormatter(logging.Formatter):
# class BaseStreamHandler(logging.StreamHandler):


from torext import settings
from torext.errors import URLRouteError
from torext.log import app_log

        for i in self._handlers:
            if isinstance(i[1], ModuleSearcher):
                raise URLRouteError('You should not use `include` in subapp handlers')

        return self._handlers


class Router(object):
    def __init__(self, specs, prefix=None):
        self.specs = specs
        self.prefix = prefix
        self._handlers = []

    def get_handlers(self):
        for spec in self.specs:
            if isinstance(spec[1], str):
                searcher = ModuleSearcher(spec[1])
                for searcher_spec in searcher.get_handlers():
                    _searcher_spec = list(searcher_spec)
                    _searcher_spec[0] = spec[0] + _searcher_spec[0]
                    self.add(tuple(_searcher_spec))
            else:
                self.add(spec)

        return self._handlers

    def add(self, spec):
        if self.prefix:
            spec = (self.prefix + spec[0], spec[1])

# Path: torext/make_settings.py
# class Settings(dict, SingletonMixin):
#     def __init__(self):
#     def __getattr__(self, key):
#     def __getitem__(self, key):
#     def __setitem__(self, key, value):
#     def __str__(self):
#     def add_key_callback(self, key, callback):
# 
# Path: torext/errors.py
# class URLRouteError(TorextException):
#     """error in router"""
# 
# Path: torext/log.py
# def _color(lvl):
#     def __init__(self,
#                  fmt='%(color)s[%(fixed_levelname)s %(asctime)s %(module)s:%(lineno)d]%(end_color)s %(message)s',
#                  datefmt='%Y-%m-%d %H:%M:%S',
#                  color=False,
#                  tab='  '):
#     def _format_record(self, record):
#     def format(self, record):
#     def __init__(self, *args, **kwgs):
# def set_logger(name,
#                level='INFO',
#                fmt=None,
#                datefmt=None,
#                propagate=1,
#                remove_handlers=False):
# def set_loggers(loggers):
# def set_nose_formatter(logging_options):
#     def test_all():
# FIXED_LEVELNAMES = {
#     'DEBUG': 'DEBG',
#     'WARNING': 'WARN',
#     'ERROR': 'ERRO'
# }
# HANDLER_TYPES = {
#     'stream': BaseStreamHandler,
# }
# class BaseFormatter(logging.Formatter):
# class BaseStreamHandler(logging.StreamHandler):


# Path: torext/route.py
from torext import settings
from torext.errors import URLRouteError
from torext.log import app_log


        for i in self._handlers:
            if isinstance(i[1], ModuleSearcher):
                raise URLRouteError('You should not use `include` in subapp handlers')

        return self._handlers


class Router(object):
    def __init__(self, specs, prefix=None):
        self.specs = specs
        self.prefix = prefix
        self._handlers = []

    def get_handlers(self):
        for spec in self.specs:
            if isinstance(spec[1], str):
                searcher = ModuleSearcher(spec[1])
                for searcher_spec in searcher.get_handlers():
                    _searcher_spec = list(searcher_spec)
                    _searcher_spec[0] = spec[0] + _searcher_spec[0]
                    self.add(tuple(_searcher_spec))
            else:
                self.add(spec)

        return self._handlers

    def add(self, spec):
        if self.prefix:
            spec = (self.prefix + spec[0], spec[1])

        app_log.debug('add url spec in router: %s' % str(spec))