<s> import logging <EOL> import subprocess <EOL> import os <EOL> if not hasattr ( subprocess , '<STR_LIT>' ) : <EOL> def c_o ( * args , ** kwargs ) : <EOL> kwargs [ '<STR_LIT>' ] = subprocess . PIPE <EOL> popen = subprocess . Popen ( * args , ** kwargs ) <EOL> stdout , stderr = popen . communicate ( ) <EOL> return stdout <EOL> subprocess . check_output = c_o <EOL> old_Popen = subprocess . Popen . __init__ <EOL> def Popen ( * args , ** kwargs ) : <EOL> logging . debug ( '<STR_LIT>' % ( args [ <NUM_LIT:1> ] , ) ) <EOL> __null = open ( os . devnull , '<STR_LIT:w>' ) <EOL> return old_Popen ( <EOL> stdin = kwargs . pop ( '<STR_LIT>' , subprocess . PIPE ) , <EOL> stdout = kwargs . pop ( '<STR_LIT>' , __null ) , <EOL> stderr = kwargs . pop ( '<STR_LIT>' , __null ) , <EOL> * args , ** kwargs ) <EOL> subprocess . Popen . __init__ = Popen <EOL> import threading <EOL> def tbget ( self ) : <EOL> if hasattr ( self , '<STR_LIT>' ) : <EOL> return self . __compat_lock <EOL> c = threading . Condition ( ) <EOL> c . acquire ( ) <EOL> return c <EOL> def tbset ( self , l ) : <EOL> self . __compat_lock = l <EOL> def tbdel ( self ) : <EOL> del self . __compat_lock <EOL> threading . Thread . _Thread__block = property ( tbget , tbset , tbdel ) <EOL> import threading <EOL> if not hasattr ( threading . Event , '<STR_LIT>' ) : <EOL> def r_i_l ( self ) : <EOL> pass <EOL> threading . Event . _reset_internal_locks = r_i_l <EOL> logging . getLogger ( "<STR_LIT>" ) . setLevel ( logging . WARNING ) <EOL> try : <EOL> import simplejson <EOL> _loads = simplejson . loads <EOL> def wrap ( fx ) : <EOL> def f ( * args , ** kwargs ) : <EOL> kwargs . pop ( '<STR_LIT>' , None ) <EOL> return fx ( * args , ** kwargs ) <EOL> return f <EOL> simplejson . dumps = wrap ( simplejson . dumps ) <EOL> simplejson . loads = wrap ( simplejson . loads ) <EOL> except : <EOL> pass <EOL> from socketio . transports import BaseTransport <EOL> old_transport_init = BaseTransport . __init__ <EOL> def new_transport_init ( self , * args , ** kwargs ) : <EOL> old_transport_init ( self , * args , ** kwargs ) <EOL> self . headers = [ ] <EOL> BaseTransport . __init__ = new_transport_init <EOL> import inspect <EOL> import gevent . ssl <EOL> __ssl__ = __import__ ( '<STR_LIT>' ) <EOL> try : <EOL> _ssl = __ssl__ . _ssl <EOL> except AttributeError : <EOL> _ssl = __ssl__ . _ssl2 <EOL> def new_sslwrap ( sock , server_side = False , keyfile = None , certfile = None , cert_reqs = __ssl__ . CERT_NONE , ssl_version = __ssl__ . PROTOCOL_SSLv23 , ca_certs = None , ciphers = None ) : <EOL> context = __ssl__ . SSLContext ( ssl_version ) <EOL> context . verify_mode = cert_reqs or __ssl__ . CERT_NONE <EOL> if ca_certs : <EOL> context . load_verify_locations ( ca_certs ) <EOL> if certfile : <EOL> context . load_cert_chain ( certfile , keyfile ) <EOL> if ciphers : <EOL> print ciphers <EOL> context . set_ciphers ( ciphers ) <EOL> caller_self = inspect . currentframe ( ) . f_back . f_locals [ '<STR_LIT>' ] <EOL> return context . _wrap_socket ( sock , server_side = server_side , ssl_sock = caller_self ) <EOL> if hasattr ( __ssl__ , '<STR_LIT>' ) and not hasattr ( gevent . ssl , '<STR_LIT>' ) : <EOL> _ssl . sslwrap = new_sslwrap <EOL> import psutil <EOL> if not hasattr ( psutil , '<STR_LIT>' ) : <EOL> psutil . net_io_counters = psutil . network_io_counters </s>
