
    `i              	       8   d dl Z d dlZd dlZd dlZd dlZd dlmZmZm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 dd	lmZ dd
lmZ ddlmZ ddlmZmZ  ej4                  d      Z	 d"dedeeef   dee   defdZ	 d"dedeeef   dee   defdZ	 d"dedeeef   dee   defdZ 	 d"dedeeef   dee   defdZ!	 d"dedeeef   dee   defdZ"	 d"dedeeef   dee   defdZ#	 d"dedeeef   dee   defdZ$	 d"dedeeef   dee   defdZ%	 d"dedeeef   dee   defdZ&	 d"dedeeef   dee   defdZ'	 d"dedeeef   dee   defdZ(	 d"dedeeef   dee   defdZ) G d dejT                        Z+ G d  d!ejT                        Z,y)#    N)AnyOptionalUnion)	urlencode   )_api_module)_common)_transformers)types)BaseApiClient)get_value_by_path)set_value_by_path)
AsyncPagerPagerzgoogle_genai.files
api_clientfrom_objectparent_objectreturnc                     i }t        |dg      t        |ddgt        |dg             t        |dg      t        |ddgt        |dg             |S )N	page_size_querypageSize
page_token	pageTokengetvsetvr   r   r   	to_objects       W/var/www/html/ts-aiml.yecor.com/venv/lib/python3.12/site-packages/google/genai/files.py_ListFilesConfig_to_mldevr!   %   sm    
 !)	+}%1*-tK+/O 
+~&2	;[<.) 
    c                 l    i }t        |dg      $t        |dgt        | t        |dg      |             |S )Nconfig)r   r   r!   r   s       r    _ListFilesParameters_to_mldevr%   ;   sH    
 !)	+z".	
![8*5y	
 
r"   c                     i }t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             |S Ndetailsmessagecoder   r   s       r    _FileStatus_to_mldevr+   M       
 !)	+	{#/YKkI;!?@	+	{#/YKkI;!?@	+x ,VHd;9:	r"   c                 H   i }t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |d	gt        |dg             t        |d
g      t        |dgt        |d
g             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      $t        |dgt        | t        |dg      |             |S )Nnamedisplay_namedisplayName	mime_typemimeType
size_bytes	sizeBytescreate_time
createTimeexpiration_timeexpirationTimeupdate_time
updateTimesha256_hash
sha256Hashuridownload_uridownloadUristatesourcevideo_metadatavideoMetadataerror)r   r   r+   r   s       r    _File_to_mldevrE   _   sE   
 !)	+x ,VHd;9:	+'(4]OT+7G%HI	+}%1ZL${[M"BC	+~&2[M4l^#DE	+'3\ND}o$FG	+)*+7%&[;L:M(NO	+'3\ND}o$FG	+'3\ND}o$FG	+w+UGT+w78	+'(4]OT+7G%HI	+y!-WItK';<	+z".XJ[8* =>	+()*6_%tK:J9K'LM	+y!-		[7)4i	
 
r"   c                     i }t        |dg      $t        |dgt        | t        |dg      |             t        |dg      t        |dgt        |dg             |S )Nfiler$   )r   r   rE   r   s       r    _CreateFileParameters_to_mldevrH      sk    
 !)	+x ,	z4fX#>	J 
+z".XJ[8* =>	r"   c                     i }t        |dg      .t        |ddgt        j                  | t        |dg                   t        |dg      t        |dgt        |dg             |S Nr.   _urlrG   r$   r   r   tt_file_namer   s       r    _GetFileParameters_to_mldevrO      p    
 !)	+x ,		j${VH"=> 
+z".XJ[8* =>	r"   c                     i }t        |dg      .t        |ddgt        j                  | t        |dg                   t        |dg      t        |dgt        |dg             |S rJ   rL   r   s       r    _DeleteFileParameters_to_mldevrR      rP   r"   c                     i }t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             |S r'   r   r   s       r    _FileStatus_from_mldevrT      r,   r"   c                 H   i }t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |d	gt        |dg             t        |d
g      t        |dgt        |d
g             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      t        |dgt        |dg             t        |dg      $t        |dgt        | t        |dg      |             |S )Nr.   r0   r/   r2   r1   r4   r3   r6   r5   r8   r7   r:   r9   r<   r;   r=   r?   r>   r@   rA   rC   rB   rD   )r   r   rT   r   s       r    _File_from_mldevrV      sB   
 !)	+x ,VHd;9:	+'3^$d;&HI	+
|$0[M4j\#BC	+}%1\ND{m$DE	+~&2]OT+~%FG	+()*6&'k<L;M)NO	+~&2]OT+~%FG	+~&2]OT+~%FG	+w+UGT+w78	+'3^$d;&HI	+y!-WItK';<	+z".XJ[8* =>	+()5%&[?:K(LM	+y!-		[7)4i	
 
r"   c                     i }t        |dg      t        |dgt        |dg             t        |dg      2t        |dgt        |dg      D cg c]  }t        | ||       c}       |S c c}w )NnextPageTokennext_page_tokenfiles)r   r   rV   )r   r   r   r   items        r    _ListFilesResponse_from_mldevr\     s    
 !)	+()5&'kO;L)MN	+y!-		 [7)4	
 Zy9	
 
	
s   A*c                 V    i }t        |dg      t        |dgt        |dg             |S )NhttpHeadershttp_headersr   r   s       r    _CreateFileResponse_from_mldevr`   2  s6    
 !)	+'3^$d;&HI	r"   c                 
    i }|S N r   s       r    _DeleteFileResponse_from_mldevrd   >  s    
 !)	r"   c                      e Zd Zdddeej
                     dej                  fdZdddej                  deej                     dej                  fdZdddedeej                     dej                  fd	Zdddedeej                      dej"                  fd
Zdddeeej*                  ej.                  ej2                  f   deej4                     dej                  fdZdddeej
                     deej                     fdZdddeeej                  ej<                  ej>                  f   deej@                     de!fdZ"y)FilesNr$   r$   r   c                H   t        j                  |      }| j                  j                  rt	        d      t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||      }| j                  j                  st!        | j                  |      }t         j"                  j%                  ||j'                         
      }	| j                  j)                  |	       |	S )aa  Lists all files from the service.

    Args:
      config (ListFilesConfig): Optional, configuration for the list method.

    Returns:
      ListFilesResponse: The response for the list method.

    Usage:

    .. code-block:: python

      pager = client.files.list(config={'page_size': 10})
      for file in pager.page:
        print(file.name)
    rg   =This method is only supported in the Gemini Developer client.rK   rZ   r   ?r$   Ngetresponsekwargs)r   _ListFilesParameters_api_clientvertexai
ValueErrorr%   rk   
format_mapr   popr$   http_optionsr	   convert_to_dictencode_unserializable_typesrequestr\   ListFilesResponse_from_response
model_dump_verify_response
selfr$   parameter_modelrequest_dictrequest_url_dictpathquery_paramsru   response_dictreturn_values
             r    _listzFiles._listJ  s   ( 00O
   
I  3


Ol &))&1	!!"23##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL$$,,t\<M $$3


Mm **99'A'A'C : L 	%%l3r"   rG   c                J   t        j                  ||      }| j                  j                  rt	        d      t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd        d }|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||      }	| j                  j                  st!        | j                  |	      }	t         j"                  j%                  |	|j'                         	      }
| j                  j)                  |
       |
S 
NrG   r$   ri   rK   zupload/v1beta/filesr   rj   r$   postrl   )r   _CreateFileParametersrp   rq   rr   rH   rk   rs   r   rt   r$   ru   r	   rv   rw   rx   r`   CreateFileResponserz   r{   r|   r~   rG   r$   r   r   r   r   r   ru   r   r   s              r    _createzFiles._create  s    11O   
I  4


Ol &))&1	$//0@A$##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL$$,,lLM $$4


Mm ++::'A'A'C ; L 	%%l3r"   r.   c                J   t        j                  ||      }| j                  j                  rt	        d      t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||      }	| j                  j                  st!        | j                  |	      }	t         j"                  j%                  |	|j'                         
      }
| j                  j)                  |
       |
S )ai  Retrieves the file information from the service.

    Args:
      name (str): The name identifier for the file to retrieve.
      config (GetFileConfig): Optional, configuration for the get method.

    Returns:
      File: The file information.

    Usage:

    .. code-block:: python

      file = client.files.get(name='files/...')
      print(file.uri)
    r.   r$   ri   rK   files/{file}r   rj   r$   Nrk   rl   )r   _GetFileParametersrp   rq   rr   rO   rk   rs   r   rt   r$   ru   r	   rv   rw   rx   rV   Filerz   r{   r|   r~   r.   r$   r   r   r   r   r   ru   r   r   s              r    rk   z	Files.get  s   ( ..O   
I  1


Ol &))&1	(()9:##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL$$,,t\<M $$&t'7'7Gm::,,'A'A'C - L 	%%l3r"   c                J   t        j                  ||      }| j                  j                  rt	        d      t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||      }	| j                  j                  st!        | j                  |	      }	t         j"                  j%                  |	|j'                         
      }
| j                  j)                  |
       |
S )a]  Deletes a remotely stored file.

    Args:
      name (str): The name identifier for the file to delete.
      config (DeleteFileConfig): Optional, configuration for the delete method.

    Returns:
      DeleteFileResponse: The response for the delete method

    Usage:

    .. code-block:: python

      client.files.delete(name='files/...')
    r   ri   rK   r   r   rj   r$   Ndeleterl   )r   _DeleteFileParametersrp   rq   rr   rR   rk   rs   r   rt   r$   ru   r	   rv   rw   rx   rd   DeleteFileResponserz   r{   r|   r   s              r    r   zFiles.delete  s   & 11O   
I  4


Ol &))&1	(()9:##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL$$,,$lM $$4


Mm ++::'A'A'C ; L 	%%l3r"   c          	         | j                   j                  rt        d      t        j                         }|r_t        |t              rt        j                  di |}n|}t        j                  |j                  |j                  |j                        }nt        j                         }|j                  /|j                  j                  d      sd|j                   |_	        t        |t        j                        r|j                  t        d      t        |d      rd|j                  vrt        d      |j!                         }|j#                  dt$        j&                         |j!                         |z
  |_        |j#                  |t$        j*                         nt%        j,                  |      }|rt$        j.                  j1                  |      st3        | d	      t$        j.                  j5                  |      |_        |j                  t7        j8                  |      \  |_        }|j                  t        d
      |rC|j:                  r7|j:                  }d|_        ddd|j(                   |j                   d|_        n3t        j@                  dddd|j(                   |j                   d      }| jC                  |t        jD                  |            }	|	jF                  d|	jF                  vrtI        d      |	jF                  d   }
t        |t        j                        r*| j                   jK                  ||
|j(                  |      }n)| j                   jK                  |
|j(                  |      }t        j                  jM                  tO        | j                   |jP                  d         |r|jS                               S i       S )a  Calls the API to upload a file using a supported file service.

    Args:
      file: A path to the file or an `IOBase` object to be uploaded. If it's an
        IOBase object, it must be opened in blocking (the default) mode and
        binary mode. In other words, do not use non-blocking mode or text mode.
        The given stream must be seekable, that is, it must be able to call
        `seek()` on 'path'.
      config: Optional parameters to set `diplay_name`, `mime_type`, and `name`.
    ri   r1   r.   r/   files/zfUnknown mime type: Could not determine the mimetype for your file
 please set the `mime_type` argumentmodeb'The file must be opened in binary mode.r    is not a valid file path.iUnknown mime type: Could not determine the mimetype for your file
    please set the `mime_type` argument application/json	resumablestartzContent-TypezX-Goog-Upload-ProtocolzX-Goog-Upload-Commandz#X-Goog-Upload-Header-Content-Lengthz!X-Goog-Upload-Header-Content-Typeapi_versionheadersru   r   x-goog-upload-urlPFailed to create file. Upload URL did not returned from the create file request.rG   rl   rc   )*rp   rq   rr   r   UploadFileConfig
isinstancedictr   r1   r.   r/   
startswithioIOBasehasattrr   tellseekosSEEK_ENDr3   SEEK_SETfspathr   isfileFileNotFoundErrorgetsize	mimetypes
guess_typeru   r   r   HttpOptionsr   CreateFileConfigr_   KeyErrorupload_filerz   rV   jsonr{   r~   rG   r$   config_modelfile_objoffsetfs_path_ru   rm   
upload_urlreturn_files               r    uploadzFiles.uploadT  s       
I  ))+L	FD	!--77 **  #00h h}} )A)A()Kx}}o.hm$		"				#:
 	
 
v	diiDE
Eyy{f
ii2;; IIK&0h
ii$		$gBGGNN734&(B CDDGGOOG4h				# ) 4 4W =A				#=
 	
 11!..l!#l,$/#*4<4G4G3H2:2D2D1El &&0(3'.8@8K8K7L6>6H6H5I	l ||e44,O  H
 	%h&;&;;  &&':;J$		"$$00

H//l 1 k $$00
:x22 1 k ::$$!$"2"2K4D4DV4LM,2|&&( %  8: %  r"   c                R    t        d| j                  | j                  |      |      S NrZ   rg   )r   r   r~   r$   s     r    listz
Files.list  s,     



&
!	 r"   c                   | j                   j                  rt        d      d}|r(t        |t              rt        j                  di |}n|}t        |t
        j                        r|j                  t        d      t        j                  | j                   |      }d| d}ddi}| dt        |       }d}t        |d	g      t        |d	g      }| j                   j                  ||
      }t        |t
        j                        r	||_        |S t        |t
        j                         r|j"                  ||j"                  _        |S )ar  Downloads a file's data from storage.

    Files created by `upload` can't be downloaded. You can tell which files are
    downloadable by checking the `source` or `download_uri` property.

    Note: This method returns the data as bytes. For `Video` and
    `GeneratedVideo` objects there is an additional side effect, that it also
    sets the `video_bytes` property on the `Video` object.

    Args:
      file (str): A file name, uri, or file object. Identifying which file to
        download.
      config (DownloadFileConfigOrDict): Optional, configuration for the get
        method.

    Returns:
      File: The file data as bytes.

    Usage:

    .. code-block:: python

      for file client.files.list():
        if file.download_uri is not None:
          break
      else:
        raise ValueError('No files found with a `download_uri`.')
      data = client.files.download(file=file)
      # data = client.files.download(file=file.name)
      # data = client.files.download(file=file.download_uri)

      video = types.Video(uri=file.uri)
      video_bytes = client.files.download(file=video)
      video.video_bytes
    ri   NzOnly generated files can be downloaded, uploaded files can't be downloaded. You can tell which files are downloadable by checking the `source` or `download_uri` property.r   	:downloadaltmediarj   ru   r   rc   )rp   rq   rr   r   r   r   DownloadFileConfigr   r>   rM   rN   r   r   download_fileVideovideo_bytesGeneratedVideovideo)	r~   rG   r$   r   r.   r   r   ru   datas	            r    downloadzFiles.download  sQ   R   
I  L	FD	!//9&9$

#(9(9(A5 
 ==))40DD6#D7#LV1Y|,-.DLL>*+7,(89l))! * D
 $$d K 
D%..	/DJJ4J#djjKr"   )#__name__
__module____qualname__r   r   ListFilesConfigOrDictry   r   
FileOrDictCreateFileConfigOrDictr   r   strGetFileConfigOrDictr   rk   DeleteFileConfigOrDictr   r   r   pathlibPathr   PathLiker   r   UploadFileConfigOrDictr   r   r   r   r   DownloadFileConfigOrDictbytesr   rc   r"   r    rf   rf   H  s    @DD ; ;<DDT 8<	7 7 u334	7
 7t IMCC"*5+D+D"ECzzCL LPDD"*5+G+G"HDDT 8<	n #w||R[["));<n u334	n
 zznb @D ; ;<UZZ :>	O #uzz5;;0D0DDEO u556	O
 Or"   rf   c                   j   e Zd Zdddeej
                     dej                  fdZdddej                  deej                     dej                  fdZdddedeej                     dej                  fd	Zdddedeej                      dej"                  fd
Zdddeeej*                  ej.                  ej2                  f   deej4                     dej                  fdZdddeej
                     deej                     fdZdddeeej                  f   deej<                     defdZ y)
AsyncFilesNrg   r$   r   c                d  K   t        j                  |      }| j                  j                  rt	        d      t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||       d{   }| j                  j                  st!        | j                  |      }t         j"                  j%                  ||j'                         
      }	| j                  j)                  |	       |	S 7 |w)ak  Lists all files from the service.

    Args:
      config (ListFilesConfig): Optional, configuration for the list method.

    Returns:
      ListFilesResponse: The response for the list method.

    Usage:

    .. code-block:: python

      pager = await client.aio.files.list(config={'page_size': 10})
      for file in pager.page:
        print(file.name)
    rg   ri   rK   rZ   r   rj   r$   Nrk   rl   )r   ro   rp   rq   rr   r%   rk   rs   r   rt   r$   ru   r	   rv   rw   async_requestr\   ry   rz   r{   r|   r}   s
             r    r   zAsyncFiles._list"  s    ( 00O
   
I  3


Ol &))&1	!!"23##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL**88t\< M $$3


Mm **99'A'A'C : L 	%%l3s   D/F01F.2A=F0rG   c                f  K   t        j                  ||      }| j                  j                  rt	        d      t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd        d }|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||       d {   }	| j                  j                  st!        | j                  |	      }	t         j"                  j%                  |	|j'                         	      }
| j                  j)                  |
       |
S 7 |wr   )r   r   rp   rq   rr   rH   rk   rs   r   rt   r$   ru   r	   rv   rw   r   r`   r   rz   r{   r|   r   s              r    r   zAsyncFiles._createh  s     11O   
I  4


Ol &))&1	$//0@A$##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL**88lL M $$4


Mm ++::'A'A'C ; L 	%%l3   D0F12F/3A=F1r.   c                f  K   t        j                  ||      }| j                  j                  rt	        d      t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||       d{   }	| j                  j                  st!        | j                  |	      }	t         j"                  j%                  |	|j'                         
      }
| j                  j)                  |
       |
S 7 |w)as  Retrieves the file information from the service.

    Args:
      name (str): The name identifier for the file to retrieve.
      config (GetFileConfig): Optional, configuration for the get method.

    Returns:
      File: The file information.

    Usage:

    .. code-block:: python

      file = await client.aio.files.get(name='files/...')
      print(file.uri)
    r   ri   rK   r   r   rj   r$   Nrk   rl   )r   r   rp   rq   rr   rO   rk   rs   r   rt   r$   ru   r	   rv   rw   r   rV   r   rz   r{   r|   r   s              r    rk   zAsyncFiles.get  s    ( ..O   
I  1


Ol &))&1	(()9:##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL**88t\< M $$&t'7'7Gm::,,'A'A'C - L 	%%l3r   c                f  K   t        j                  ||      }| j                  j                  rt	        d      t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||       d{   }	| j                  j                  st!        | j                  |	      }	t         j"                  j%                  |	|j'                         
      }
| j                  j)                  |
       |
S 7 |w)ag  Deletes a remotely stored file.

    Args:
      name (str): The name identifier for the file to delete.
      config (DeleteFileConfig): Optional, configuration for the delete method.

    Returns:
      DeleteFileResponse: The response for the delete method

    Usage:

    .. code-block:: python

      await client.aio.files.delete(name='files/...')
    r   ri   rK   r   r   rj   r$   Nr   rl   )r   r   rp   rq   rr   rR   rk   rs   r   rt   r$   ru   r	   rv   rw   r   rd   r   rz   r{   r|   r   s              r    r   zAsyncFiles.delete  s    & 11O   
I  4


Ol &))&1	(()9:##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL**88$l M $$4


Mm ++::'A'A'C ; L 	%%l3r   c          	        K   | j                   j                  rt        d      t        j                         }|r_t        |t              rt        j                  di |}n|}t        j                  |j                  |j                  |j                        }nt        j                         }|j                  /|j                  j                  d      sd|j                   |_	        t        |t        j                        r|j                  t        d      t        |d      rd|j                  vrt        d      |j!                         }|j#                  d	t$        j&                         |j!                         |z
  |_        |j#                  |t$        j*                         nt%        j,                  |      }|rt$        j.                  j1                  |      st3        | d
      t$        j.                  j5                  |      |_        |j                  t7        j8                  |      \  |_        }|j                  t        d      |rC|j:                  r7|j:                  }d|_        ddd|j(                   |j                   d|_        n3t        j@                  dddd|j(                   |j                   d      }| jC                  |t        jD                  |             d{   }	|	jF                  d|	jF                  vrtI        d      |	jF                  d   }
t        |t        j                        r2| j                   jK                  ||
|j(                  |       d{   }n1| j                   jK                  |
|j(                  |       d{   }t        j                  jM                  tO        | j                   |jP                  d         |r|jS                               S i       S 7 7 7 bw)a  Calls the API to upload a file asynchronously using a supported file service.

    Args:
      file: A path to the file or an `IOBase` object to be uploaded. If it's an
        IOBase object, it must be opened in blocking (the default) mode and
        binary mode. In other words, do not use non-blocking mode or text mode.
        The given stream must be seekable, that is, it must be able to call
        `seek()` on 'path'.
      config: Optional parameters to set `diplay_name`, `mime_type`, and `name`.
    ri   r   Nr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rG   rl   rc   )*rp   rq   rr   r   r   r   r   r   r1   r.   r/   r   r   r   r   r   r   r   r   r   r3   r   r   r   r   r   r   r   r   ru   r   r   r   r   r   r_   r   async_upload_filerz   rV   r   r{   r   s               r    r   zAsyncFiles.upload,  s        
I  ))+L	FD	!--77 **  #00h h}} )A)A()Kx}}o.hm$		"				#=
 	
 
v	diiDE
Eyy{f
ii2;; IIK&0h
ii$		$gBGGNN734&(B CDDGGOOG4h				# ) 4 4W =A				#=
 	
 11!..l!#l,$/#*4<4G4G3H2:2D2D1El &&0(3'.8@8K8K7L6>6H6H5I	l \\e44,O "  H 	%h&;&;;  &&':;J$		"**<<

H//l =  k **<<
:x22 =  k ::$$!$"2"2K4D4DV4LM,2|&&( %  8: %  -s8   K/P1P 2A>P0P11P"P#APPPc                n   K   t        d| j                  | j                  |       d {   |      S 7 	wr   )r   r   r   s     r    r   zAsyncFiles.list  s8      

jjj''	  	(s   '53
5c                  K   | j                   j                  rt        d      d}|r(t        |t              rt        j                  d
i |}n|}t        j                  | j                   |      }d| d}d}t        |dg      t        |dg      }ddi}|r| dt        |       }| j                   j                  ||	       d{   }|S 7 w)at  Downloads a file's data from the file service.

    The Vertex-AI implementation of the API foes not include the file service.

    Files created by `upload` can't be downloaded. You can tell which files are
    downloadable by checking the `download_uri` property.

    Args:
      File (str): A file name, uri, or file object. Identifying which file to
        download.
      config (DownloadFileConfigOrDict): Optional, configuration for the get
        method.

    Returns:
      File: The file data as bytes.

    Usage:

    .. code-block:: python

      for file client.files.list():
        if file.download_uri is not None:
          break
      else:
        raise ValueError('No files found with a `download_uri`.')
      data = client.files.download(file=file)
      # data = client.files.download(file=file.name)
      # data = client.files.download(file=file.uri)
    ri   Nr   r   ru   r   r   rj   r   rc   )rp   rq   rr   r   r   r   r   rM   rN   r   r   async_download_file)	r~   rG   r$   r   r.   r   ru   r   r   s	            r    r   zAsyncFiles.download  s     F   
I  L	FD	!//9&9==))40DD6#DLL>*+7,(89l7#LvQy./0d!!55! 6  D
 Ks   CCC	C)!r   r   r   r   r   r   ry   r   r   r   r   r   r   r   r   rk   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rc   r"   r    r   r      s    @DD ; ;<DDT 8<	7 7 u334	7
 7t IMCC"*5+D+D"ECzzCL LPDD"*5+G+G"HDDT 8<	m #w||R[["));<m u334	m
 zzm` @D ; ;<%** :>	@ #uzz/"@ u556	@
 @r"   r   rb   )-r   loggingr   r   r   typingr   r   r   urllib.parser   r   r   r	   r
   rM   r   rp   r   r   r   r   r   pagersr   r   	getLoggerloggerr   objectr!   r%   r+   rE   rH   rO   rR   rT   rV   r\   r`   rd   
BaseModulerf   r   rc   r"   r    <module>r      s9  $ 
   	  ' ' "      & . . %			/	0 %)tV|$ D> 
	2 %)tV|$ D> 
	* %)tV|$ D> 
	* %)66tV|$6 D>6 
	6x %)tV|$ D> 
	, %)tV|$ D> 
	, %)tV|$ D> 
	, %)tV|$ D> 
	* %)66tV|$6 D>6 
	6x %)tV|$ D> 
	2 %)		tV|$	 D>	 
		 %)tV|$ D> 
	UK"" UpE'' Er"   