#NEWLINE# def start( host , port , profile_stats , dont_start_browser ) : #NEWLINE# #INDENT# 'Starts HTTP server with specified parameters.\n\n    Args:\n        host: Server hostname.\n        port: Server port.\n        profile_stats: Dict with collected progran stats.\n        dont_start_browser: Whether to start browser after profiling.\n    ' #NEWLINE# stats_handler = functools . partial ( StatsHandler , profile_stats ) #NEWLINE# if ( not host ) : #NEWLINE# #INDENT# webbrowser . open ( 'http://{}:{}/' . format ( host , port ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# StatsServer ( ( host , port ) , stats_handler ) . serve_forever ( ) #NEWLINE# #UNINDENT# except KeyboardInterrupt : #NEWLINE# #INDENT# print ( 'Stopping...' ) #NEWLINE# sys . exit ( 0 )