<s> """<STR_LIT>""" <EOL> class _localbase ( object ) : <EOL> __slots__ = '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> def __new__ ( cls , * args , ** kw ) : <EOL> self = object . __new__ ( cls ) <EOL> key = '<STR_LIT>' , '<STR_LIT>' + str ( id ( self ) ) <EOL> object . __setattr__ ( self , '<STR_LIT>' , key ) <EOL> object . __setattr__ ( self , '<STR_LIT>' , ( args , kw ) ) <EOL> object . __setattr__ ( self , '<STR_LIT>' , RLock ( ) ) <EOL> if args or kw and ( cls . __init__ is object . __init__ ) : <EOL> raise TypeError ( "<STR_LIT>" ) <EOL> dict = object . __getattribute__ ( self , '<STR_LIT>' ) <EOL> currentThread ( ) . __dict__ [ key ] = dict <EOL> return self <EOL> def _patch ( self ) : <EOL> key = object . __getattribute__ ( self , '<STR_LIT>' ) <EOL> d = currentThread ( ) . __dict__ . get ( key ) <EOL> if d is None : <EOL> d = { } <EOL> currentThread ( ) . __dict__ [ key ] = d <EOL> object . __setattr__ ( self , '<STR_LIT>' , d ) <EOL> cls = type ( self ) <EOL> if cls . __init__ is not object . __init__ : <EOL> args , kw = object . __getattribute__ ( self , '<STR_LIT>' ) <EOL> cls . __init__ ( self , * args , ** kw ) <EOL> else : <EOL> object . __setattr__ ( self , '<STR_LIT>' , d ) <EOL> class local ( _localbase ) : <EOL> def __getattribute__ ( self , name ) : <EOL> lock = object . __getattribute__ ( self , '<STR_LIT>' ) <EOL> lock . acquire ( ) <EOL> try : <EOL> _patch ( self ) <EOL> return object . __getattribute__ ( self , name ) <EOL> finally : <EOL> lock . release ( ) <EOL> def __setattr__ ( self , name , value ) : <EOL> lock = object . __getattribute__ ( self , '<STR_LIT>' ) <EOL> lock . acquire ( ) <EOL> try : <EOL> _patch ( self ) <EOL> return object . __setattr__ ( self , name , value ) <EOL> finally : <EOL> lock . release ( ) <EOL> def __delattr__ ( self , name ) : <EOL> lock = object . __getattribute__ ( self , '<STR_LIT>' ) <EOL> lock . acquire ( ) <EOL> try : <EOL> _patch ( self ) <EOL> return object . __delattr__ ( self , name ) <EOL> finally : <EOL> lock . release ( ) <EOL> def __del__ ( ) : <EOL> threading_enumerate = enumerate <EOL> __getattribute__ = object . __getattribute__ <EOL> def __del__ ( self ) : <EOL> key = __getattribute__ ( self , '<STR_LIT>' ) <EOL> try : <EOL> threads = list ( threading_enumerate ( ) ) <EOL> except : <EOL> return <EOL> for thread in threads : <EOL> try : <EOL> __dict__ = thread . __dict__ <EOL> except AttributeError : <EOL> continue <EOL> if key in __dict__ : <EOL> try : <EOL> del __dict__ [ key ] <EOL> except KeyError : <EOL> pass <EOL> return __del__ <EOL> __del__ = __del__ ( ) <EOL> try : <EOL> from threading import currentThread , enumerate , RLock <EOL> except ImportError : <EOL> from dummy_threading import currentThread , enumerate , RLock </s>
