# Path: pyftpdlib/_compat.py
# def callable(obj):
#     for klass in type(obj).__mro__:
#         if "__call__" in klass.__dict__:
#             return True
#     return False
# 
# Path: pyftpdlib/log.py
# def config_logging(level=LEVEL, prefix=PREFIX, other_loggers=None):
#     # Little speed up
#     if "(process)" not in prefix:
#         logging.logProcesses = False
#     if "%(processName)s" not in prefix:
#         logging.logMultiprocessing = False
#     if "%(thread)d" not in prefix and "%(threadName)s" not in prefix:
#         logging.logThreads = False
#     handler = logging.StreamHandler()
#     formatter = LogFormatter()
#     formatter.PREFIX = prefix
#     handler.setFormatter(formatter)
#     loggers = [logging.getLogger('pyftpdlib')]
#     if other_loggers is not None:
#         loggers.extend(other_loggers)
#     for logger in loggers:
#         logger.setLevel(level)
#         logger.addHandler(handler)
# 
# Path: pyftpdlib/log.py
# def debug(s, inst=None):
#     s = "[debug] " + s
#     if inst is not None:
#         s += " (%r)" % inst
#     logger.debug(s)
# 
# Path: pyftpdlib/log.py
# def is_logging_configured():
#     if logging.getLogger('pyftpdlib').handlers:
#         return True
#     if logging.root.handlers:
#         return True
#     return False
# 
# Path: pyftpdlib/log.py
# def _stderr_supports_color():
#     def __init__(self, *args, **kwargs):
#     def format(self, record):
# def debug(s, inst=None):
# def is_logging_configured():
# def config_logging(level=LEVEL, prefix=PREFIX, other_loggers=None):
# LEVEL = logging.INFO
# PREFIX = '[%(levelname)1.1s %(asctime)s]'
# PREFIX_MPROC = '[%(levelname)1.1s %(asctime)s %(process)s]'
# COLOURED = _stderr_supports_color()
# TIME_FORMAT = "%Y-%m-%d %H:%M:%S"
#     PREFIX = PREFIX
# class LogFormatter(logging.Formatter):


import asynchat
import asyncore
import errno
import heapq
import os
import select
import socket
import sys
import time
import traceback
    import threading
    import dummy_threading as threading
from ._compat import callable
from .log import config_logging
from .log import debug
from .log import is_logging_configured
from .log import logger

    def modify(self, fd, events):
        """Changes the events assigned for fd."""
        raise NotImplementedError('must be implemented in subclass')

    def poll(self, timeout):
        """Poll once.  The subclass overriding this method is supposed
        to poll over the registered handlers and the scheduled functions
        and then return.
        """
        raise NotImplementedError('must be implemented in subclass')

    def loop(self, timeout=None, blocking=True):
        """Start the asynchronous IO loop.

         - (float) timeout: the timeout passed to the underlying
           multiplex syscall (select(), epoll() etc.).

         - (bool) blocking: if True poll repeatedly, as long as there
           are registered handlers and/or scheduled functions.
           If False poll only once and return the timeout of the next
           scheduled call (if any, else None).
        """
        if not _IOLoop._started_once:
            _IOLoop._started_once = True
            if not is_logging_configured():
                # If we get to this point it means the user hasn't
                # configured logging. We want to log by default so
                # we configure logging ourselves so that it will
                # print to stderr.

# Path: pyftpdlib/_compat.py
# def callable(obj):
#     for klass in type(obj).__mro__:
#         if "__call__" in klass.__dict__:
#             return True
#     return False
# 
# Path: pyftpdlib/log.py
# def config_logging(level=LEVEL, prefix=PREFIX, other_loggers=None):
#     # Little speed up
#     if "(process)" not in prefix:
#         logging.logProcesses = False
#     if "%(processName)s" not in prefix:
#         logging.logMultiprocessing = False
#     if "%(thread)d" not in prefix and "%(threadName)s" not in prefix:
#         logging.logThreads = False
#     handler = logging.StreamHandler()
#     formatter = LogFormatter()
#     formatter.PREFIX = prefix
#     handler.setFormatter(formatter)
#     loggers = [logging.getLogger('pyftpdlib')]
#     if other_loggers is not None:
#         loggers.extend(other_loggers)
#     for logger in loggers:
#         logger.setLevel(level)
#         logger.addHandler(handler)
# 
# Path: pyftpdlib/log.py
# def debug(s, inst=None):
#     s = "[debug] " + s
#     if inst is not None:
#         s += " (%r)" % inst
#     logger.debug(s)
# 
# Path: pyftpdlib/log.py
# def is_logging_configured():
#     if logging.getLogger('pyftpdlib').handlers:
#         return True
#     if logging.root.handlers:
#         return True
#     return False
# 
# Path: pyftpdlib/log.py
# def _stderr_supports_color():
#     def __init__(self, *args, **kwargs):
#     def format(self, record):
# def debug(s, inst=None):
# def is_logging_configured():
# def config_logging(level=LEVEL, prefix=PREFIX, other_loggers=None):
# LEVEL = logging.INFO
# PREFIX = '[%(levelname)1.1s %(asctime)s]'
# PREFIX_MPROC = '[%(levelname)1.1s %(asctime)s %(process)s]'
# COLOURED = _stderr_supports_color()
# TIME_FORMAT = "%Y-%m-%d %H:%M:%S"
#     PREFIX = PREFIX
# class LogFormatter(logging.Formatter):


# Path: pyftpdlib/ioloop.py
import asynchat
import asyncore
import errno
import heapq
import os
import select
import socket
import sys
import time
import traceback
    import threading
    import dummy_threading as threading
from ._compat import callable
from .log import config_logging
from .log import debug
from .log import is_logging_configured
from .log import logger


    def modify(self, fd, events):
        """Changes the events assigned for fd."""
        raise NotImplementedError('must be implemented in subclass')

    def poll(self, timeout):
        """Poll once.  The subclass overriding this method is supposed
        to poll over the registered handlers and the scheduled functions
        and then return.
        """
        raise NotImplementedError('must be implemented in subclass')

    def loop(self, timeout=None, blocking=True):
        """Start the asynchronous IO loop.

         - (float) timeout: the timeout passed to the underlying
           multiplex syscall (select(), epoll() etc.).

         - (bool) blocking: if True poll repeatedly, as long as there
           are registered handlers and/or scheduled functions.
           If False poll only once and return the timeout of the next
           scheduled call (if any, else None).
        """
        if not _IOLoop._started_once:
            _IOLoop._started_once = True
            if not is_logging_configured():
                # If we get to this point it means the user hasn't
                # configured logging. We want to log by default so
                # we configure logging ourselves so that it will
                # print to stderr.

                config_logging()