
                         >    S r SSKJr   " S S\R                  5      rg)z*Dictionary storage for OAuth2 Credentials.    )clientc                   B   ^  \ rS rSrSrSU 4S jjrS rS rS rSr	U =r
$ )	DictionaryStorage   a  Store and retrieve credentials to and from a dictionary-like object.

Args:
    dictionary: A dictionary or dictionary-like object.
    key: A string or other hashable. The credentials will be stored in
         ``dictionary[key]``.
    lock: An optional threading.Lock-like object. The lock will be
          acquired before anything is written or read from the
          dictionary.
c                 @   > [         [        U ]  US9  Xl        X l        g)z'Construct a DictionaryStorage instance.)lockN)superr   __init___dictionary_key)self
dictionarykeyr   	__class__s       :lib/third_party/oauth2client/contrib/dictionary_storage.pyr
   DictionaryStorage.__init__    s!    /T/:%	    c                     U R                   R                  U R                  5      nUc  g[        R                  R                  U5      nUR                  U 5        U$ )zRetrieve the credentials from the dictionary, if they exist.

Returns: A :class:`oauth2client.client.OAuth2Credentials` instance.
N)r   getr   r   OAuth2Credentials	from_json	set_store)r   
serializedcredentialss      r   
locked_getDictionaryStorage.locked_get&   sQ    
 %%))$))4
..88Dd#r   c                 T    UR                  5       nX R                  U R                  '   g)zSave the credentials to the dictionary.

Args:
    credentials: A :class:`oauth2client.client.OAuth2Credentials`
                 instance.
N)to_jsonr   r   )r   r   r   s      r   
locked_putDictionaryStorage.locked_put5   s$     !((*
&0#r   c                 P    U R                   R                  U R                  S5        g)z:Remove the credentials from the dictionary, if they exist.N)r   popr   )r   s    r   locked_deleteDictionaryStorage.locked_delete?   s    TYY-r   )r   r   )N)__name__
__module____qualname____firstlineno____doc__r
   r   r   r#   __static_attributes____classcell__)r   s   @r   r   r      s!    	1. .r   r   N)r)   oauth2clientr   Storager    r   r   <module>r/      s    1 -. -.r   