# Path: pyftpdlib/_compat.py
# PY3 = sys.version_info[0] == 3
# _SENTINEL = object()
#     def u(s):
#     def b(s):
#     def u(s):
#     def b(s):
#     def callable(obj):
#     def _instance_checking_exception(base_exception=Exception):
#         def wrapped(instance_checker):
#                 def __init__(self, *args, **kwargs):
#                     def __instancecheck__(cls, inst):
#                     def __subclasscheck__(cls, classinfo):
#     def FileNotFoundError(inst):
#     def FileExistsError(inst):
#     def super(type_=_SENTINEL, type_or_obj=_SENTINEL, framedepth=1):
#             class TemporaryClass(base_exception):
#                 class __metaclass__(type):


import logging
import sys
import time
    import curses
from ._compat import unicode
COLOURED = _stderr_supports_color()
TIME_FORMAT = "%Y-%m-%d %H:%M:%S"


# taken and adapted from Tornado
class LogFormatter(logging.Formatter):
    """Log formatter used in pyftpdlib.
    Key features of this formatter are:

    * Color support when logging to a terminal that supports it.
    * Timestamps on every log line.
    * Robust against str/bytes encoding problems.
    """
    PREFIX = PREFIX

    def __init__(self, *args, **kwargs):
        logging.Formatter.__init__(self, *args, **kwargs)
        self._coloured = COLOURED and _stderr_supports_color()
        if self._coloured:
            curses.setupterm()
            # 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: pyftpdlib/_compat.py
# PY3 = sys.version_info[0] == 3
# _SENTINEL = object()
#     def u(s):
#     def b(s):
#     def u(s):
#     def b(s):
#     def callable(obj):
#     def _instance_checking_exception(base_exception=Exception):
#         def wrapped(instance_checker):
#                 def __init__(self, *args, **kwargs):
#                     def __instancecheck__(cls, inst):
#                     def __subclasscheck__(cls, classinfo):
#     def FileNotFoundError(inst):
#     def FileExistsError(inst):
#     def super(type_=_SENTINEL, type_or_obj=_SENTINEL, framedepth=1):
#             class TemporaryClass(base_exception):
#                 class __metaclass__(type):


# Path: pyftpdlib/log.py
import logging
import sys
import time
    import curses
from ._compat import unicode

COLOURED = _stderr_supports_color()
TIME_FORMAT = "%Y-%m-%d %H:%M:%S"


# taken and adapted from Tornado
class LogFormatter(logging.Formatter):
    """Log formatter used in pyftpdlib.
    Key features of this formatter are:

    * Color support when logging to a terminal that supports it.
    * Timestamps on every log line.
    * Robust against str/bytes encoding problems.
    """
    PREFIX = PREFIX

    def __init__(self, *args, **kwargs):
        logging.Formatter.__init__(self, *args, **kwargs)
        self._coloured = COLOURED and _stderr_supports_color()
        if self._coloured:
            curses.setupterm()
            # 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(fg_color, "ascii")