# Path: turbo/app.py
# class Mixin(tornado.web.RequestHandler):
# class BaseBaseHandler(Mixin):
# class BaseHandler(BaseBaseHandler):
# class ErrorHandler(tornado.web.RequestHandler):
#     def to_objectid(objid):
#     def to_int(value):
#     def to_float(value):
#     def to_bool(value):
#     def to_str(v):
#     def utf8(v):
#     def encode_http_params(**kw):
#     def json_encode(data, **kwargs):
#     def json_decode(data, **kwargs):
#     def is_ajax(self):
#     def initialize(self):
#     def session(self):
#     def get_template_namespace(self):
#     def render_string(self, template_name, **kwargs):
#     def sort_by(self, sort):
#     def get_context(self):
#     def wo_json(self, data):
#     def ri_json(self, data):
#     def parameter(self):
#         def filter_parameter(key, tp, default=None):
#     def head(self, *args, **kwargs):
#     def get(self, *args, **kwargs):
#     def post(self, *args, **kwargs):
#     def delete(self, *args, **kwargs):
#     def patch(self, *args, **kwargs):
#     def put(self, *args, **kwargs):
#     def options(self, *args, **kwargs):
#     def _method_call(self, method, *args, **kwargs):
#     def init_resp(code=0, msg=None):
#     def wo_resp(self, resp):
#     def HEAD(self, *args, **kwargs):
#     def GET(self, *args, **kwargs):
#     def POST(self, *args, **kwargs):
#     def DELETE(self, *args, **kwargs):
#     def PATCH(self, *args, **kwargs):
#     def PUT(self, *args, **kwargs):
#     def OPTIONS(self, *args, **kwargs):
#     def route(self, route, *args, **kwargs):
#     def on_finish(self):
#     def _processor(self):
#     def initialize(self, status_code):
#     def prepare(self):
# def start(port=8888):
# 
# Path: turbo/conf.py
# class ObjectDict(dict):
# class AppConfig(object):
#     def __getattr__(self, name):
#         def __setattr__(self, name, value):
#     def __init__(self):
#     def log_level(self):
# 
# Path: turbo/register.py
# def _install_app(package_space):
# def register_app(app_name, app_setting, web_application_setting, mainfile, package_space):
# def register_url(url, handler, name=None, kwargs=None):
# def register_group_urls(prefix, urls):
# 
# Path: turbo/session.py
# class RedisStore(Store):
# 
#     def __init__(self, **kwargs):
#         self.timeout = kwargs.get(
#             'timeout') or app_config.session_config.timeout
# 
#     def __contains__(self, key):
#         return self.get_connection(key).exists(key)
# 
#     def __setitem__(self, key, value):
#         conn = self.get_connection(key)
#         conn.hset(key, 'data', self.encode(value))
#         conn.expire(key, self.timeout)
# 
#     def __getitem__(self, key):
#         data = self.get_connection(key).hget(key, 'data')
#         if data:
#             return self.decode(data)
#         else:
#             return ObjectDict()
# 
#     def __delitem__(self, key):
#         self.get_connection(key).delete(key)
# 
#     def cleanup(self, timeout):
#         pass
# 
#     def get_connection(self, key):
#         import redis
#         return redis.Redis()


import signal
import time
import requests
import multiprocessing
import os
from turbo import app
from turbo.conf import app_config
from turbo import register
from turbo.session import RedisStore
from util import unittest, port_is_used
    }

    session_store = RedisStore(timeout=3600)

    def get(self):
        assert self.session.uid is None
        assert self.session.session_id is not None
        self.write('get')

    def post(self):
        self.session.uid = '7787'
        self.write('post')

    def put(self):
        assert self.session.uid == '7787'
        self.write('put')


def setUpModule():
    global PORT
    PORT = 8888
    while True:
        if not port_is_used(PORT):
            break
        PORT += 1


def run_server():
    global PORT
    register.register_url('/', HomeHandler)

# Path: turbo/app.py
# class Mixin(tornado.web.RequestHandler):
# class BaseBaseHandler(Mixin):
# class BaseHandler(BaseBaseHandler):
# class ErrorHandler(tornado.web.RequestHandler):
#     def to_objectid(objid):
#     def to_int(value):
#     def to_float(value):
#     def to_bool(value):
#     def to_str(v):
#     def utf8(v):
#     def encode_http_params(**kw):
#     def json_encode(data, **kwargs):
#     def json_decode(data, **kwargs):
#     def is_ajax(self):
#     def initialize(self):
#     def session(self):
#     def get_template_namespace(self):
#     def render_string(self, template_name, **kwargs):
#     def sort_by(self, sort):
#     def get_context(self):
#     def wo_json(self, data):
#     def ri_json(self, data):
#     def parameter(self):
#         def filter_parameter(key, tp, default=None):
#     def head(self, *args, **kwargs):
#     def get(self, *args, **kwargs):
#     def post(self, *args, **kwargs):
#     def delete(self, *args, **kwargs):
#     def patch(self, *args, **kwargs):
#     def put(self, *args, **kwargs):
#     def options(self, *args, **kwargs):
#     def _method_call(self, method, *args, **kwargs):
#     def init_resp(code=0, msg=None):
#     def wo_resp(self, resp):
#     def HEAD(self, *args, **kwargs):
#     def GET(self, *args, **kwargs):
#     def POST(self, *args, **kwargs):
#     def DELETE(self, *args, **kwargs):
#     def PATCH(self, *args, **kwargs):
#     def PUT(self, *args, **kwargs):
#     def OPTIONS(self, *args, **kwargs):
#     def route(self, route, *args, **kwargs):
#     def on_finish(self):
#     def _processor(self):
#     def initialize(self, status_code):
#     def prepare(self):
# def start(port=8888):
# 
# Path: turbo/conf.py
# class ObjectDict(dict):
# class AppConfig(object):
#     def __getattr__(self, name):
#         def __setattr__(self, name, value):
#     def __init__(self):
#     def log_level(self):
# 
# Path: turbo/register.py
# def _install_app(package_space):
# def register_app(app_name, app_setting, web_application_setting, mainfile, package_space):
# def register_url(url, handler, name=None, kwargs=None):
# def register_group_urls(prefix, urls):
# 
# Path: turbo/session.py
# class RedisStore(Store):
# 
#     def __init__(self, **kwargs):
#         self.timeout = kwargs.get(
#             'timeout') or app_config.session_config.timeout
# 
#     def __contains__(self, key):
#         return self.get_connection(key).exists(key)
# 
#     def __setitem__(self, key, value):
#         conn = self.get_connection(key)
#         conn.hset(key, 'data', self.encode(value))
#         conn.expire(key, self.timeout)
# 
#     def __getitem__(self, key):
#         data = self.get_connection(key).hget(key, 'data')
#         if data:
#             return self.decode(data)
#         else:
#             return ObjectDict()
# 
#     def __delitem__(self, key):
#         self.get_connection(key).delete(key)
# 
#     def cleanup(self, timeout):
#         pass
# 
#     def get_connection(self, key):
#         import redis
#         return redis.Redis()


# Path: tests/session_test.py
import signal
import time
import requests
import multiprocessing
import os
from turbo import app
from turbo.conf import app_config
from turbo import register
from turbo.session import RedisStore
from util import unittest, port_is_used

    }

    session_store = RedisStore(timeout=3600)

    def get(self):
        assert self.session.uid is None
        assert self.session.session_id is not None
        self.write('get')

    def post(self):
        self.session.uid = '7787'
        self.write('post')

    def put(self):
        assert self.session.uid == '7787'
        self.write('put')


def setUpModule():
    global PORT
    PORT = 8888
    while True:
        if not port_is_used(PORT):
            break
        PORT += 1


def run_server():
    global PORT
    register.register_url('/', HomeHandler)

    register.register_url('/redis', RedisStoreHandler)