#NEWLINE# def main( jupyter = False , argv = sys . argv , server_factory = splash_server ) : #NEWLINE# #INDENT# ( opts , _ ) = parse_opts ( jupyter , argv ) #NEWLINE# if opts . version : #NEWLINE# #INDENT# print ( __version__ ) #NEWLINE# sys . exit ( 0 ) #NEWLINE# #UNINDENT# if ( not jupyter ) : #NEWLINE# #INDENT# start_logging ( opts ) #NEWLINE# #UNINDENT# log_splash_version ( ) #NEWLINE# bump_nofile_limit ( ) #NEWLINE# with xvfb . autostart ( opts . disable_xvfb ) as x : #NEWLINE# #INDENT# xvfb . log_options ( x ) #NEWLINE# install_qtreactor ( ( opts . verbosity >= 5 ) ) #NEWLINE# monitor_maxrss ( opts . maxrss ) #NEWLINE# if opts . manhole : #NEWLINE# #INDENT# manhole_server ( ) #NEWLINE# #UNINDENT# default_splash_server ( portnum = opts . port , slots = opts . slots , proxy_profiles_path = opts . proxy_profiles_path , js_profiles_path = opts . js_profiles_path , js_disable_cross_domain_access = ( not opts . js_cross_domain_enabled ) , filters_path = opts . filters_path , allowed_schemes = opts . allowed_schemes , private_mode = ( not opts . disable_private_mode ) , ui_enabled = ( not opts . disable_ui ) , lua_enabled = ( not opts . disable_lua ) , lua_sandbox_enabled = ( not opts . disable_lua_sandbox ) , lua_package_path = opts . lua_package_path . strip ( ';' ) , lua_sandbox_allowed_modules = opts . lua_sandbox_allowed_modules . split ( ';' ) , verbosity = opts . verbosity , max_timeout = opts . max_timeout , argument_cache_max_entries = opts . argument_cache_max_entries , server_factory = server_factory ) #NEWLINE# signal . signal ( signal . SIGUSR1 , ( lambda s , f : traceback . print_stack ( f ) ) ) #NEWLINE# if ( not jupyter ) : #NEWLINE# #INDENT# from twisted.internet import reactor #NEWLINE# reactor . callWhenRunning ( splash_started , opts , sys . stderr ) #NEWLINE# reactor . run ( )