<s> class _Missing ( object ) : <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' <EOL> def __reduce__ ( self ) : <EOL> return '<STR_LIT>' <EOL> _missing = _Missing ( ) <EOL> class LazyProperty ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , func ) : <EOL> self . _func = func <EOL> self . __module__ = func . __module__ <EOL> self . __name__ = func . __name__ <EOL> self . __doc__ = func . __doc__ <EOL> def __get__ ( self , obj , klass = None ) : <EOL> if obj is None : <EOL> return self <EOL> value = obj . __dict__ . get ( self . __name__ , _missing ) <EOL> if value is _missing : <EOL> value = self . _func ( obj ) <EOL> obj . __dict__ [ self . __name__ ] = value <EOL> return value <EOL> import threading <EOL> class ThreadLocalLazyProperty ( LazyProperty ) : <EOL> """<STR_LIT>""" <EOL> def __get__ ( self , obj , klass = None ) : <EOL> if obj is None : <EOL> return self <EOL> if not hasattr ( obj , '<STR_LIT>' ) : <EOL> obj . __tl_dict__ = threading . local ( ) . __dict__ <EOL> value = obj . __tl_dict__ . get ( self . __name__ , _missing ) <EOL> if value is _missing : <EOL> value = self . _func ( obj ) <EOL> obj . __tl_dict__ [ self . __name__ ] = value <EOL> return value </s>
