<s> import os <EOL> import tornado . web <EOL> import handlers <EOL> import api_settings <EOL> import imp <EOL> from concurrent import futures <EOL> from data import SUPPORTED_FORMATS <EOL> class Application ( tornado . web . Application ) : <EOL> def __init__ ( self , port , address , api_dir , debug , <EOL> api_data_filename , custom_provider = None ) : <EOL> self . pool = futures . ThreadPoolExecutor ( <NUM_LIT:2> ) <EOL> self . api_settings_class = api_settings . ApiSettings <EOL> self . custom_provider = None <EOL> if custom_provider is not None : <EOL> provider_path = os . path . abspath ( custom_provider ) <EOL> print ( provider_path ) <EOL> module = imp . load_source ( '<STR_LIT>' , provider_path ) <EOL> if hasattr ( module , '<STR_LIT>' ) : <EOL> self . custom_provider = module . provider <EOL> supported_formats = "<STR_LIT:|>" . join ( <EOL> map ( lambda x : "<STR_LIT>" % x , SUPPORTED_FORMATS . keys ( ) ) ) <EOL> handlers_list = [ <EOL> ( r"<STR_LIT>" , handlers . ResourceMethodHandler ) , <EOL> ( r"<STR_LIT>" , handlers . RPCMethodHandler ) , <EOL> ( r"<STR_LIT>" , handlers . ResourcesLogsHandler ) , <EOL> ( r"<STR_LIT>" , handlers . CreateRPCMethodHandler ) , <EOL> ( r"<STR_LIT>" , handlers . CreateResourceMethodHandler ) , <EOL> ( r"<STR_LIT>" , handlers . LoginHandler ) , <EOL> ( r"<STR_LIT>" , handlers . LogoutHandler ) , <EOL> ( r"<STR_LIT>" , handlers . SettingsHandler ) , <EOL> ( r"<STR_LIT>" , handlers . TodoHandler ) , <EOL> ( r"<STR_LIT>" , handlers . ListResourcesHandler ) , <EOL> ( r"<STR_LIT>" % handlers . RPCHandler . PATH , handlers . RPCHandler ) , <EOL> ( r"<STR_LIT>" % supported_formats , handlers . MainHandler ) , <EOL> ( r"<STR_LIT>" , handlers . MainHandler ) , <EOL> ] <EOL> settings = dict ( <EOL> debug = debug , <EOL> port = port , <EOL> address = address , <EOL> dir = api_dir , <EOL> api_data_filename = api_data_filename , <EOL> template_path = os . path . join ( os . path . dirname ( __file__ ) , "<STR_LIT>" ) , <EOL> static_path = os . path . join ( os . path . dirname ( __file__ ) , "<STR_LIT>" ) , <EOL> static_url_prefix = "<STR_LIT>" , <EOL> login_url = "<STR_LIT>" , <EOL> cookie_secret = "<STR_LIT>" , <EOL> ) <EOL> super ( Application , self ) . __init__ ( handlers_list , ** settings ) </s>
