# Path: tornado/ioloop.py
# class IOLoop(Configurable):
# class PollIOLoop(IOLoop):
# class _Timeout(object):
# class PeriodicCallback(object):
#     _EPOLLIN = 0x001
#     _EPOLLPRI = 0x002
#     _EPOLLOUT = 0x004
#     _EPOLLERR = 0x008
#     _EPOLLHUP = 0x010
#     _EPOLLRDHUP = 0x2000
#     _EPOLLONESHOT = (1 << 30)
#     _EPOLLET = (1 << 31)
#     NONE = 0
#     READ = _EPOLLIN
#     WRITE = _EPOLLOUT
#     ERROR = _EPOLLERR | _EPOLLHUP
#         _FUTURE_TYPES = (futures.Future, DummyFuture)
#         _FUTURE_TYPES = DummyFuture
#     def instance():
#     def initialized():
#     def install(self):
#     def current():
#     def make_current(self):
#     def clear_current(self):
#     def configurable_base(cls):
#     def configurable_default(cls):
#     def initialize(self):
#     def close(self, all_fds=False):
#     def add_handler(self, fd, handler, events):
#     def update_handler(self, fd, events):
#     def remove_handler(self, fd):
#     def set_blocking_signal_threshold(self, seconds, action):
#     def set_blocking_log_threshold(self, seconds):
#     def log_stack(self, signal, frame):
#     def start(self):
#     def stop(self):
#     def time(self):
#     def add_timeout(self, deadline, callback):
#     def remove_timeout(self, timeout):
#     def add_callback(self, callback, *args, **kwargs):
#     def add_callback_from_signal(self, callback, *args, **kwargs):
#     def add_future(self, future, callback):
#     def _run_callback(self, callback):
#     def handle_callback_exception(self, callback):
#     def initialize(self, impl, time_func=None):
#     def close(self, all_fds=False):
#     def add_handler(self, fd, handler, events):
#     def update_handler(self, fd, events):
#     def remove_handler(self, fd):
#     def set_blocking_signal_threshold(self, seconds, action):
#     def start(self):
#     def stop(self):
#     def time(self):
#     def add_timeout(self, deadline, callback):
#     def remove_timeout(self, timeout):
#     def add_callback(self, callback, *args, **kwargs):
#     def add_callback_from_signal(self, callback, *args, **kwargs):
#     def __init__(self, deadline, callback, io_loop):
#     def timedelta_to_seconds(td):
#     def __lt__(self, other):
#     def __le__(self, other):
#     def __init__(self, callback, callback_time, io_loop=None):
#     def start(self):
#     def stop(self):
#     def _run(self):
#     def _schedule_next(self):
# 
# Path: tornado/log.py
# def _stderr_supports_color():
#     def __init__(self, color=True, *args, **kwargs):
#     def format(self, record):
# def enable_pretty_logging(options=None):
# def define_logging_options(options=None):
# class LogFormatter(logging.Formatter):
# 
# Path: tornado/process.py
# def cpu_count():
# def _reseed_random():
# def fork_processes(num_processes, max_restarts=100):
#     def start_child(i):
# def task_id():
#     def __init__(self, *args, **kwargs):
#     def set_exit_callback(self, callback):
#     def initialize(cls, io_loop=None):
#     def uninitialize(cls):
#     def _cleanup(cls):
#     def _try_cleanup_process(cls, pid):
#     def _set_returncode(self, status):
# class Subprocess(object):
#     STREAM = object()


import os
import sys
import functools
import logging
import os
import pkgutil
import sys
import traceback
import types
import subprocess
import weakref
    import signal
            import runpy
from tornado import ioloop
from tornado.log import gen_log
from tornado import process
_reload_hooks = []
_reload_attempted = False
_io_loops = weakref.WeakKeyDictionary()

def start(io_loop=None, check_time=500):
    """Restarts the process automatically when a module is modified.

    We run on the I/O loop, and restarting is a destructive operation,
    so will terminate any pending requests.
    """
    io_loop = io_loop or ioloop.IOLoop.instance()
    if io_loop in _io_loops:
        return
    _io_loops[io_loop] = True
    if len(_io_loops) > 1:
        gen_log.warning("tornado.autoreload started more than once in the same process")
    add_reload_hook(functools.partial(_close_all_fds, io_loop))
    modify_times = {}
    callback = functools.partial(_reload_on_update, modify_times)
    scheduler = ioloop.PeriodicCallback(callback, check_time, io_loop=io_loop)
    scheduler.start()


def wait():
    """Wait for a watched file to change, then restart the process.

    Intended to be used at the end of scripts like unit test runners,
    to run the tests again after any source file changes (but see also
    the command-line interface in `main`)
    """

# Path: tornado/ioloop.py
# class IOLoop(Configurable):
# class PollIOLoop(IOLoop):
# class _Timeout(object):
# class PeriodicCallback(object):
#     _EPOLLIN = 0x001
#     _EPOLLPRI = 0x002
#     _EPOLLOUT = 0x004
#     _EPOLLERR = 0x008
#     _EPOLLHUP = 0x010
#     _EPOLLRDHUP = 0x2000
#     _EPOLLONESHOT = (1 << 30)
#     _EPOLLET = (1 << 31)
#     NONE = 0
#     READ = _EPOLLIN
#     WRITE = _EPOLLOUT
#     ERROR = _EPOLLERR | _EPOLLHUP
#         _FUTURE_TYPES = (futures.Future, DummyFuture)
#         _FUTURE_TYPES = DummyFuture
#     def instance():
#     def initialized():
#     def install(self):
#     def current():
#     def make_current(self):
#     def clear_current(self):
#     def configurable_base(cls):
#     def configurable_default(cls):
#     def initialize(self):
#     def close(self, all_fds=False):
#     def add_handler(self, fd, handler, events):
#     def update_handler(self, fd, events):
#     def remove_handler(self, fd):
#     def set_blocking_signal_threshold(self, seconds, action):
#     def set_blocking_log_threshold(self, seconds):
#     def log_stack(self, signal, frame):
#     def start(self):
#     def stop(self):
#     def time(self):
#     def add_timeout(self, deadline, callback):
#     def remove_timeout(self, timeout):
#     def add_callback(self, callback, *args, **kwargs):
#     def add_callback_from_signal(self, callback, *args, **kwargs):
#     def add_future(self, future, callback):
#     def _run_callback(self, callback):
#     def handle_callback_exception(self, callback):
#     def initialize(self, impl, time_func=None):
#     def close(self, all_fds=False):
#     def add_handler(self, fd, handler, events):
#     def update_handler(self, fd, events):
#     def remove_handler(self, fd):
#     def set_blocking_signal_threshold(self, seconds, action):
#     def start(self):
#     def stop(self):
#     def time(self):
#     def add_timeout(self, deadline, callback):
#     def remove_timeout(self, timeout):
#     def add_callback(self, callback, *args, **kwargs):
#     def add_callback_from_signal(self, callback, *args, **kwargs):
#     def __init__(self, deadline, callback, io_loop):
#     def timedelta_to_seconds(td):
#     def __lt__(self, other):
#     def __le__(self, other):
#     def __init__(self, callback, callback_time, io_loop=None):
#     def start(self):
#     def stop(self):
#     def _run(self):
#     def _schedule_next(self):
# 
# Path: tornado/log.py
# def _stderr_supports_color():
#     def __init__(self, color=True, *args, **kwargs):
#     def format(self, record):
# def enable_pretty_logging(options=None):
# def define_logging_options(options=None):
# class LogFormatter(logging.Formatter):
# 
# Path: tornado/process.py
# def cpu_count():
# def _reseed_random():
# def fork_processes(num_processes, max_restarts=100):
#     def start_child(i):
# def task_id():
#     def __init__(self, *args, **kwargs):
#     def set_exit_callback(self, callback):
#     def initialize(cls, io_loop=None):
#     def uninitialize(cls):
#     def _cleanup(cls):
#     def _try_cleanup_process(cls, pid):
#     def _set_returncode(self, status):
# class Subprocess(object):
#     STREAM = object()


# Path: tornado/autoreload.py
import os
import sys
import functools
import logging
import os
import pkgutil
import sys
import traceback
import types
import subprocess
import weakref
    import signal
            import runpy
from tornado import ioloop
from tornado.log import gen_log
from tornado import process

_reload_hooks = []
_reload_attempted = False
_io_loops = weakref.WeakKeyDictionary()

def start(io_loop=None, check_time=500):
    """Restarts the process automatically when a module is modified.

    We run on the I/O loop, and restarting is a destructive operation,
    so will terminate any pending requests.
    """
    io_loop = io_loop or ioloop.IOLoop.instance()
    if io_loop in _io_loops:
        return
    _io_loops[io_loop] = True
    if len(_io_loops) > 1:
        gen_log.warning("tornado.autoreload started more than once in the same process")
    add_reload_hook(functools.partial(_close_all_fds, io_loop))
    modify_times = {}
    callback = functools.partial(_reload_on_update, modify_times)
    scheduler = ioloop.PeriodicCallback(callback, check_time, io_loop=io_loop)
    scheduler.start()


def wait():
    """Wait for a watched file to change, then restart the process.

    Intended to be used at the end of scripts like unit test runners,
    to run the tests again after any source file changes (but see also
    the command-line interface in `main`)
    """

    io_loop = ioloop.IOLoop()