§
     Âi  ã                  óÒ   — d dl mZ d dlZd dlZd dlZd dlmZ d dlZd dlm	Z	 d dl
mZ d dlmZ d dlmZ d dlmZ g d	¢Z ej        d
d¦  «         dddddœd d„Zd!d"d„Zd#d„Zd$d„ZdS )%é    )ÚannotationsN)ÚIterable)Úprotos)Úislice)ÚIOBase)Ú
file_types)Úget_default_file_client)Úupload_fileÚget_fileÚ
list_filesÚdelete_filez
image/webpz.webpT)Ú	mime_typeÚnameÚdisplay_nameÚ	resumableÚpathú)str | pathlib.Path | os.PathLike | IOBaser   ú
str | Noner   r   r   ÚboolÚreturnúfile_types.Filec               ó�  — t          ¦   «         }t          | t          ¦  «        r|€t          d¦  «        ‚nYt	          j        t          j        | ¦  «        ¦  «        } |€| j        }|€t          j
        | ¦  «        \  }}|€t          d¦  «        ‚|�	d|vrd|› �}|                     | ||||¬¦  «        }t          j        |¦  «        S )a8  Calls the API to upload a file using a supported file service.

    Args:
        path: The path to the file or a file-like object (e.g., BytesIO) to be uploaded.
        mime_type: The MIME type of the file. If not provided, it will be
            inferred from the file extension.
        name: The name of the file in the destination (e.g., 'files/sample-image').
            If not provided, a system generated ID will be created.
        display_name: Optional display name of the file.
        resumable: Whether to use the resumable upload protocol. By default, this is enabled.
            See details at
            https://googleapis.github.io/google-api-python-client/docs/epy/googleapiclient.http.MediaFileUpload-class.html#resumable

    Returns:
        file_types.File: The response of the uploaded file.
    Nz†Unknown mime type: When passing a file like object to `path` (instead of a
    path-like object) you must set the `mime_type` argumentziUnknown mime type: Could not determine the mimetype for your file
    please set the `mime_type` argumentú/úfiles/)r   r   r   r   r   )r	   Ú
isinstancer   Ú
ValueErrorÚpathlibÚPathÚosÚfspathr   Ú	mimetypesÚ
guess_typeÚcreate_filer   ÚFile)r   r   r   r   r   ÚclientÚ_Úresponses           úc/var/www/html/jarvis.com/web/backend/venv/lib/python3.11/site-packages/google/generativeai/files.pyr
   r
   #   sô   € õ0 %Ñ&Ô&€Få�$�ÑÔð ØÐÝðNñô ð ð õ Œ|�BœI d™OœOÑ,Ô,ˆàÐØœ9ˆLàÐÝ$Ô/°Ñ5Ô5‰LˆI�qàÐÝð:ñô ð ð
 Ð˜C t˜O˜OØ˜ˆˆˆà×!Ò!Ø˜Y¨TÀÐXað "ñ ô €Hõ Œ?˜8Ñ$Ô$Ð$ó    éd   úIterable[file_types.File]c              #  ó¬   K  — t          ¦   «         }|                     t          j        | ¬¦  «        ¦  «        }|D ]}t	          j        |¦  «        V — ŒdS )z;Calls the API to list files using a supported file service.)Ú	page_sizeN)r	   r   r   ÚListFilesRequestr   r$   )r-   r%   r'   Úprotos       r(   r   r   [   sd   è è € å$Ñ&Ô&€Fà× Ò ¥Ô!8À9Ð!MÑ!MÔ!MÑNÔN€HØð %ð %ˆÝŒo˜eÑ$Ô$Ð$Ð$Ð$Ð$ð%ð %r)   Ústrc                ó€   — d| vrd| › �} t          ¦   «         }t          j        |                     | ¬¦  «        ¦  «        S )zJCalls the API to retrieve a specified file using a supported file service.r   r   ©r   )r	   r   r$   r   )r   r%   s     r(   r   r   d   s?   € à
�$€€Ø˜ˆˆˆÝ$Ñ&Ô&€FÝŒ?˜6Ÿ?š?°˜?Ñ5Ô5Ñ6Ô6Ð6r)   ú#str | file_types.File | protos.Filec                óæ   — t          | t          j        t          j        f¦  «        r| j        } n	d| vrd| › �} t          j        | ¬¦  «        }t          ¦   «         }|                     |¬¦  «         dS )zTCalls the API to permanently delete a specified file using a supported file service.r   r   r2   )ÚrequestN)r   r   r$   r   r   ÚDeleteFileRequestr	   r   )r   r5   r%   s      r(   r   r   l   su   € å�$�œ­&¬+Ð6Ñ7Ô7ð ØŒyˆˆØ	�DˆˆØ˜ˆˆˆÝÔ&¨DÐ1Ñ1Ô1€GÝ$Ñ&Ô&€FØ
×Ò˜wÐÑ'Ô'Ð'Ð'Ð'r)   )r   r   r   r   r   r   r   r   r   r   r   r   )r*   )r   r+   )r   r0   r   r   )r   r3   )Ú
__future__r   r   r   r!   Útypingr   ÚloggingÚgoogle.generativeair   Ú	itertoolsr   Úior   Úgoogle.generativeai.typesr   Úgoogle.generativeai.clientr	   Ú__all__Úadd_typer
   r   r   r   © r)   r(   ú<module>rB      sD  ðð #Ð "Ð "Ð "Ð "Ð "à 	€	€	€	Ø €€€Ø Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø €€€Ø &Ð &Ð &Ð &Ð &Ð &Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à 0Ð 0Ð 0Ð 0Ð 0Ð 0à >Ð >Ð >Ð >Ð >Ð >à
BÐ
BÐ
B€à €	Ô �< Ñ )Ô )Ð )ð !ØØ#Øð5%ð 5%ð 5%ð 5%ð 5%ð 5%ðp%ð %ð %ð %ð %ð7ð 7ð 7ð 7ð(ð (ð (ð (ð (ð (r)   