<s> from __future__ import absolute_import <EOL> import flask <EOL> from flask . ext . socketio import SocketIO <EOL> from gevent import monkey ; monkey . patch_all ( ) <EOL> from . config import config_value <EOL> from digits import utils <EOL> import digits . scheduler <EOL> app = flask . Flask ( __name__ ) <EOL> app . config [ '<STR_LIT>' ] = True <EOL> app . config [ '<STR_LIT>' ] = False <EOL> app . config [ '<STR_LIT>' ] = config_value ( '<STR_LIT>' ) <EOL> app . url_map . redirect_defaults = False <EOL> socketio = SocketIO ( app ) <EOL> scheduler = digits . scheduler . Scheduler ( config_value ( '<STR_LIT>' ) , True ) <EOL> app . jinja_env . globals [ '<STR_LIT>' ] = config_value ( '<STR_LIT>' ) <EOL> app . jinja_env . globals [ '<STR_LIT>' ] = digits . __version__ <EOL> app . jinja_env . filters [ '<STR_LIT>' ] = utils . time_filters . print_time <EOL> app . jinja_env . filters [ '<STR_LIT>' ] = utils . time_filters . print_time_diff <EOL> app . jinja_env . filters [ '<STR_LIT>' ] = utils . time_filters . print_time_since <EOL> app . jinja_env . filters [ '<STR_LIT>' ] = utils . sizeof_fmt <EOL> app . jinja_env . filters [ '<STR_LIT>' ] = utils . auth . has_permission <EOL> app . jinja_env . trim_blocks = True <EOL> app . jinja_env . lstrip_blocks = True <EOL> import digits . views <EOL> app . register_blueprint ( digits . views . blueprint ) <EOL> import digits . dataset . views <EOL> app . register_blueprint ( digits . dataset . views . blueprint , url_prefix = '<STR_LIT>' ) <EOL> import digits . dataset . images . views <EOL> app . register_blueprint ( digits . dataset . images . views . blueprint , url_prefix = '<STR_LIT>' ) <EOL> import digits . dataset . images . classification . views <EOL> app . register_blueprint ( digits . dataset . images . classification . views . blueprint , url_prefix = '<STR_LIT>' ) <EOL> import digits . dataset . images . generic . views <EOL> app . register_blueprint ( digits . dataset . images . generic . views . blueprint , url_prefix = '<STR_LIT>' ) <EOL> import digits . model . views <EOL> app . register_blueprint ( digits . model . views . blueprint , url_prefix = '<STR_LIT>' ) <EOL> import digits . model . images . views <EOL> app . register_blueprint ( digits . model . images . views . blueprint , url_prefix = '<STR_LIT>' ) <EOL> import digits . model . images . classification . views <EOL> app . register_blueprint ( digits . model . images . classification . views . blueprint , url_prefix = '<STR_LIT>' ) <EOL> import digits . model . images . generic . views <EOL> app . register_blueprint ( digits . model . images . generic . views . blueprint , url_prefix = '<STR_LIT>' ) <EOL> def username_decorator ( f ) : <EOL> from functools import wraps <EOL> @ wraps ( f ) <EOL> def decorated ( * args , ** kwargs ) : <EOL> this_username = flask . request . cookies . get ( '<STR_LIT:username>' , None ) <EOL> app . jinja_env . globals [ '<STR_LIT:username>' ] = this_username <EOL> return f ( * args , ** kwargs ) <EOL> return decorated <EOL> for endpoint , function in app . view_functions . iteritems ( ) : <EOL> app . view_functions [ endpoint ] = username_decorator ( function ) <EOL> scheduler . load_past_jobs ( ) </s>
