# Path: hurray/server/util.py
# PY3 = sys.version_info >= (3,)
#     def cast(typ, x):
# def import_object(name):
# def raise_exc_info(exc_info):
# def exec_in(code, glob, loc=None):
# def errno_from_exception(e):
#     def __new__(cls, *args, **kwargs):
#     def configurable_base(cls):
#     def configurable_default(cls):
#     def initialize(self):
#     def configure(cls, impl, **kwargs):
#     def configured_class(cls):
#     def _save_configuration(cls):
#     def _restore_configuration(cls, saved):
#     def __init__(self, func, name):
#     def _getargnames(self, func):
#     def get_old_value(self, args, kwargs, default=None):
#     def replace(self, new_value, args, kwargs):
# def timedelta_to_seconds(td):
# class Configurable(object):
# class ArgReplacer(object):


import logging
import logging.handlers
import sys
    import curses  # type: ignore
        import hurray.options
        import hurray.options
from hurray.server.util import unicode_type, basestring_type
        r"""
        :arg bool color: Enables color support.
        :arg string fmt: Log message format.
          It will be applied to the attributes dict of log records. The
          text between ``%(color)s`` and ``%(end_color)s`` will be colored
          depending on the level if color support is on.
        :arg dict colors: color mappings from logging level to terminal color
          code
        :arg string datefmt: Datetime format.
          Used for formatting ``(asctime)`` placeholder in ``prefix_fmt``.

        .. versionchanged:: 3.2

           Added ``fmt`` and ``datefmt`` arguments.
        """
        logging.Formatter.__init__(self, datefmt=datefmt)
        self._fmt = fmt

        self._colors = {}
        if color and _stderr_supports_color():
            # The curses module has some str/bytes confusion in
            # python3.  Until version 3.2.3, most methods return
            # bytes, but only accept strings.  In addition, we want to
            # output these strings with the logging module, which
            # works with unicode strings.  The explicit calls to
            # unicode() below are harmless in python2 but will do the
            # right conversion in python 3.
            fg_color = (curses.tigetstr("setaf") or
                        curses.tigetstr("setf") or "")
            if (3, 0) < sys.version_info < (3, 2, 3):

# Path: hurray/server/util.py
# PY3 = sys.version_info >= (3,)
#     def cast(typ, x):
# def import_object(name):
# def raise_exc_info(exc_info):
# def exec_in(code, glob, loc=None):
# def errno_from_exception(e):
#     def __new__(cls, *args, **kwargs):
#     def configurable_base(cls):
#     def configurable_default(cls):
#     def initialize(self):
#     def configure(cls, impl, **kwargs):
#     def configured_class(cls):
#     def _save_configuration(cls):
#     def _restore_configuration(cls, saved):
#     def __init__(self, func, name):
#     def _getargnames(self, func):
#     def get_old_value(self, args, kwargs, default=None):
#     def replace(self, new_value, args, kwargs):
# def timedelta_to_seconds(td):
# class Configurable(object):
# class ArgReplacer(object):


# Path: hurray/server/log.py
import logging
import logging.handlers
import sys
    import curses  # type: ignore
        import hurray.options
        import hurray.options
from hurray.server.util import unicode_type, basestring_type

        r"""
        :arg bool color: Enables color support.
        :arg string fmt: Log message format.
          It will be applied to the attributes dict of log records. The
          text between ``%(color)s`` and ``%(end_color)s`` will be colored
          depending on the level if color support is on.
        :arg dict colors: color mappings from logging level to terminal color
          code
        :arg string datefmt: Datetime format.
          Used for formatting ``(asctime)`` placeholder in ``prefix_fmt``.

        .. versionchanged:: 3.2

           Added ``fmt`` and ``datefmt`` arguments.
        """
        logging.Formatter.__init__(self, datefmt=datefmt)
        self._fmt = fmt

        self._colors = {}
        if color and _stderr_supports_color():
            # The curses module has some str/bytes confusion in
            # python3.  Until version 3.2.3, most methods return
            # bytes, but only accept strings.  In addition, we want to
            # output these strings with the logging module, which
            # works with unicode strings.  The explicit calls to
            # unicode() below are harmless in python2 but will do the
            # right conversion in python 3.
            fg_color = (curses.tigetstr("setaf") or
                        curses.tigetstr("setf") or "")
            if (3, 0) < sys.version_info < (3, 2, 3):

                fg_color = unicode_type(fg_color, "ascii")