<s> """<STR_LIT>""" <EOL> import threading <EOL> import webbrowser <EOL> from http . server import SimpleHTTPRequestHandler , HTTPServer <EOL> from urllib . parse import urlsplit <EOL> def double ( n = <NUM_LIT:0> ) : <EOL> '''<STR_LIT>''' <EOL> return str ( <NUM_LIT:2> * n ) <EOL> class CustomHandler ( SimpleHTTPRequestHandler ) : <EOL> def send_page ( self , text ) : <EOL> self . send_response ( <NUM_LIT:200> ) <EOL> self . send_header ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . end_headers ( ) <EOL> self . wfile . write ( bytes ( text , encoding = "<STR_LIT:utf-8>" ) ) <EOL> def do_GET ( self ) : <EOL> if self . path . startswith ( '<STR_LIT>' ) : <EOL> query = urlsplit ( self . path ) . query <EOL> try : <EOL> number = int ( query . split ( "<STR_LIT:=>" ) [ <NUM_LIT:1> ] ) <EOL> except ValueError : <EOL> self . send_page ( "<STR_LIT>" ) <EOL> return <EOL> self . send_page ( double ( number ) ) <EOL> elif self . path == '<STR_LIT>' : <EOL> self . send_page ( "<STR_LIT>" ) <EOL> shut_it_down = threading . Thread ( target = server . shutdown , daemon = True ) <EOL> print ( "<STR_LIT>" ) <EOL> shut_it_down . start ( ) <EOL> else : <EOL> SimpleHTTPRequestHandler . do_GET ( self ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> port = <NUM_LIT> <EOL> host = "<STR_LIT:localhost>" <EOL> server = HTTPServer ( ( host , port ) , CustomHandler ) <EOL> webbrowser . open ( "<STR_LIT>" . format ( host , port ) ) <EOL> server . serve_forever ( ) </s>
