<s> """<STR_LIT>""" <EOL> from oauth2client . client import OAuth2Credentials <EOL> from oauth2client . client import Storage <EOL> class DictionaryStorage ( Storage ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , dictionary , key , lock = None ) : <EOL> """<STR_LIT>""" <EOL> super ( DictionaryStorage , self ) . __init__ ( lock = lock ) <EOL> self . _dictionary = dictionary <EOL> self . _key = key <EOL> def locked_get ( self ) : <EOL> """<STR_LIT>""" <EOL> serialized = self . _dictionary . get ( self . _key ) <EOL> if serialized is None : <EOL> return None <EOL> credentials = OAuth2Credentials . from_json ( serialized ) <EOL> credentials . set_store ( self ) <EOL> return credentials <EOL> def locked_put ( self , credentials ) : <EOL> """<STR_LIT>""" <EOL> serialized = credentials . to_json ( ) <EOL> self . _dictionary [ self . _key ] = serialized <EOL> def locked_delete ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _dictionary . pop ( self . _key , None ) </s>
