File: //opt/cppython/lib/python3.8/site-packages/oauth2client/__pycache__/file.cpython-38.pyc
U
KD�g�
� @ sB d Z ddlZddlZddlmZ ddlmZ G dd� dej�ZdS )zYUtilities for OAuth.
Utilities for making it easier to work with OAuth 2.0
credentials.
� N)�_helpers)�clientc s@ e Zd ZdZ� fdd�Zdd� Zdd� Zdd � Zd
d� Z� Z S )�Storagez:Store and retrieve a single credential to and from a file.c s t t| �jt�� d� || _d S )N)�lock)�superr �__init__� threading�Lock� _filename)�self�filename�� __class__� �>/opt/cppython/lib/python3.8/site-packages/oauth2client/file.pyr s zStorage.__init__c C s~ d}t �| j� z t| jd�}|�� }|�� W n tk
rH | Y S X ztj� |�}|�
| � W n tk
rx Y nX |S )z�Retrieve Credential from file.
Returns:
oauth2client.client.Credentials
Raises:
IOError if the file is a symbolic link.
N�rb)r �
validate_filer
�open�read�close�IOErrorr �CredentialsZ
new_from_jsonZ set_store�
ValueError)r �credentials�f�contentr r r �
locked_get# s
zStorage.locked_getc C s>