File: //usr/lib/python3/dist-packages/duplicity/backends/__pycache__/pydrivebackend.cpython-310.pyc
o
��`V4 � @ s� d dl mZ d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dl ZG dd� dej
j�Zej
�
d e� ej
�
d
e� ej
�
de� ej
j�g d�� dS )
� )�next)�strN)�log)�util)�BackendExceptionc @ sX e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zdd� ZdS )�PyDriveBackendz)Connect to remote store using PyDrive APIc
s t jj�| |� zdd l}ddlm} W n ty( } ztdt |� ��d }~ww i | _
d | _d|jv rE|jd d | _d| jddd�| _
zddl
m} dd lm} dd
lm}m} W n= ty� } z1zddlm} dd lm} dd
lm}m} W n ty� } ztdt |� ��d }~ww W Y d }~nd }~ww zddlm} d| _W n dd
lm}
ddlm} d| _Y dtjv r�tjd }| jr�| |j d |j! |dd�}
n|j"�#|�}|
|j d |j! |dd�}
|
�$|�%� � |dd�}|
|_&nZdtjv �r
|tjd dd�}|�'� nFdtjv �rLdtjv �rL|dd�}|�(tjd � |�)tjd � |j&d u �r6|�'� n
|j*�r?|�+� n|�,� |�-tjd � ntd��||�| _.| j�r]| j}n0| j.�/ddi��0� }|�ru|d d d d }n| j.�1dd i�}|�2� |d d d }|�3� |j4�5d!�}|D ]c� � �s��q�dd"| d# i}|�6| j
� | j.�/|��0� }t7� fd$d%�|D �d �}|d u �r� d&d|igd'�}|d d �6| j
� |�6| j
� | j.�1|�}| j�r�|j2d(did)� n|�2� |d }�q�|| _8i | _9d S )*Nr )�buildz}PyDrive backend requires PyDrive and Google API client installation.
Please read the manpage for setup details.
Exception: %s�driveID� teamDriveT)�corpora�teamDriveId�includeTeamDriveItems�supportsTeamDrives)�
GoogleAuth)�GoogleDrive��ApiRequestError�FileNotUploadedErrorzhPyDrive backend requires PyDrive installation. Please read the manpage for setup details.
Exception: %s)�SignedJwtAssertionCredentials)�ServiceAccountCredentials)�cryptF�GOOGLE_DRIVE_ACCOUNT_KEY�@z%https://www.googleapis.com/auth/drive)�scopes�<