<s> import warnings <EOL> from threading import current_thread <EOL> class FakeRequest ( object ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> warnings . warn ( <EOL> ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> ) <EOL> class GlobalRequest ( object ) : <EOL> """<STR_LIT>""" <EOL> _requests = { } <EOL> @ staticmethod <EOL> def get_request ( ) : <EOL> try : <EOL> return GlobalRequest . _requests [ current_thread ( ) ] <EOL> except KeyError : <EOL> return FakeRequest ( ) <EOL> def process_request ( self , request ) : <EOL> GlobalRequest . _requests [ current_thread ( ) ] = request <EOL> def process_response ( self , request , response ) : <EOL> thread = current_thread ( ) <EOL> try : <EOL> del GlobalRequest . _requests [ thread ] <EOL> except KeyError : <EOL> pass <EOL> return response <EOL> def get_request ( ) : <EOL> return GlobalRequest . get_request ( ) </s>
