<s> """<STR_LIT>""" <EOL> import threading <EOL> import keyring <EOL> from oauth2client . client import Credentials <EOL> from oauth2client . client import Storage as BaseStorage <EOL> __author__ = '<STR_LIT>' <EOL> class Storage ( BaseStorage ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , service_name , user_name ) : <EOL> """<STR_LIT>""" <EOL> super ( Storage , self ) . __init__ ( lock = threading . Lock ( ) ) <EOL> self . _service_name = service_name <EOL> self . _user_name = user_name <EOL> def locked_get ( self ) : <EOL> """<STR_LIT>""" <EOL> credentials = None <EOL> content = keyring . get_password ( self . _service_name , self . _user_name ) <EOL> if content is not None : <EOL> try : <EOL> credentials = Credentials . new_from_json ( content ) <EOL> credentials . set_store ( self ) <EOL> except ValueError : <EOL> pass <EOL> return credentials <EOL> def locked_put ( self , credentials ) : <EOL> """<STR_LIT>""" <EOL> keyring . set_password ( self . _service_name , self . _user_name , <EOL> credentials . to_json ( ) ) <EOL> def locked_delete ( self ) : <EOL> """<STR_LIT>""" <EOL> keyring . set_password ( self . _service_name , self . _user_name , '<STR_LIT>' ) </s>
