
    OjJ              	          S SK r S SKrS SKJrJrJrJr  S SKJr  SSK	J
r
  SSK	Jr  SSK	Jr  SSKJr  SS	KJr  \R"                  " S
5      r SS\\\\4   \4   S\\\\4      S\\\4   4S jjr SS\\\\4   \4   S\\\\4      S\\\4   4S jjr SS\\\\4   \4   S\\\\4      S\\\4   4S jjr SS\\\\4   \4   S\\\\4      S\\\4   4S jjr " S S\
R4                  5      r " S S\
R4                  5      rg)    N)AnyOptionalTypeVarUnion)	urlencode   )_api_module)_common)types)get_value_by_path)set_value_by_pathzgoogle_genai.operationsfrom_objectparent_objectreturnc                     0 n[        U S/5      b  [        US/[        U S/5      5        [        U S/5      b  [        USS/[        U S/5      5        U$ )Noperation_nameoperationNameresource_name_urlresourceNamegetvsetvr   r   	to_objects      Y/var/www/html/leaf-doctor-v1/venv/lib/python3.13/site-packages/google/genai/operations.py*_FetchPredictOperationParameters_to_vertexr       sl     !)	+()*6_%tK:J9K'LM	+()5	 [?+, 
    c                 Z    0 n[        U S/5      b  [        USS/[        U S/5      5        U$ Nr   r   r   r   r   s      r    _GetOperationParameters_to_mldevr!   2   C     !)	+()*6	![+,- 
r   c                 Z    0 n[        U S/5      b  [        USS/[        U S/5      5        U$ r    r   r   s      r   !_GetOperationParameters_to_vertexr$   A   r"   r   c                 Z    0 n[        U S/5      b  [        USS/[        U S/5      5        U$ )Noperation_idr   r   r   s      r   (_GetProjectOperationParameters_to_vertexr'   P   s?     !)	+'(4FN+T+?O-P 
r   c            	       .   \ rS rSrSS.S\S\\R                     S\4S jjr	SS.S\S\S\\R                     S\4S	 jjrSS.S
\S\\R                     S\R                  4S jjr\" S\R                  S9rSS.S\S\\R                     S\4S jjrSrg)
Operations]   Nconfigr   r,   r   c                ,   [         R                  " UUS9nU R                  R                  (       a8  [	        U5      nUR                  S5      nU(       a  SR                  U5      nO:SnO7[        U5      nUR                  S5      nU(       a  SR                  U5      nOSnUR                  S5      nU(       a  U S[        U5       3nUR                  SS 5        S nUR                  b-  UR                  R                  b  UR                  R                  n[        R                  " U5      n[        R                  " U5      nU R                  R                  SXdU5      n	U	R                   (       d  0 n
U
$ ["        R$                  " U	R                   5      n
U
$ Nr   r,   r   z{operationName}_query?r,   get)r   _GetOperationParameters_api_clientvertexair$   r2   
format_mapr!   r   popr,   http_optionsr
   convert_to_dictencode_unserializable_typesrequestbodyjsonloadsselfr   r,   parameter_modelrequest_dictrequest_url_dictpathquery_paramsr8   responseresponse_dicts              r   _get_videos_operation Operations._get_videos_operation_   se    33%O   6Gl%))&1	 ++,<= 5oFl%))&1	 ++,<= ##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''t<PH&mmBM 26HMM1JMr   r   c                   [         R                  " UUUS9nU R                  R                  (       d  [	        S5      e[        U5      nUR                  S5      nU(       a  SR                  U5      nOSnUR                  S5      nU(       a  U S[        U5       3nUR                  SS 5        S n	UR                  b-  UR                  R                  b  UR                  R                  n	[        R                  " U5      n[        R                  " U5      nU R                  R                  SXuU	5      n
U
R                   (       d  0 nU$ ["        R$                  " U
R                   5      nU$ 	Nr   r   r,   iThis method is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   z${resourceName}:fetchPredictOperationr0   r1   r,   post)r    _FetchPredictOperationParametersr4   r5   
ValueErrorr   r2   r6   r   r7   r,   r8   r
   r9   r:   r;   r<   r=   r>   r@   r   r   r,   rA   rB   rC   rD   rE   r8   rF   rG   s               r   _fetch_predict_videos_operation*Operations._fetch_predict_videos_operation   sR    <<%#O $$5 
 @Pl%))&1	5@@
 6##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''LH 'mmBM 26HMM1JMr   r&   c                   [         R                  " UUS9nU R                  R                  (       d  [	        S5      e[        U5      nUR                  S5      nU(       a  SR                  U5      nOSnUR                  S5      nU(       a  U S[        U5       3nUR                  SS 5        S nUR                  b-  UR                  R                  b  UR                  R                  n[        R                  " U5      n[        R                  " U5      nU R                  R                  SXdU5      n	U	R                   (       d  0 O["        R$                  " U	R                   5      n
[         R&                  R)                  U
[+        USS 5      (       aG  S[+        UR                  S	S 5      [+        UR                  S
S 5      [+        UR                  SS 5      S.0O0 S9nU R                  R-                  U5        U$ N)r&   r,   rM   r   zoperations/{operation_id}r0   r1   r,   r2   response_schemaresponse_json_schemainclude_all_fields)rV   rW   rX   )rF   kwargs)r   _GetProjectOperationParametersr4   r5   rP   r'   r2   r6   r   r7   r,   r8   r
   r9   r:   r;   r<   r=   r>   ProjectOperation_from_responsegetattr_verify_responser@   r&   r,   rA   rB   rC   rD   rE   r8   rF   rG   return_values               r   _getOperations._get   s    ::!O $$5 
 >oNl%))&1	*556FG*##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''t<PH&mmBHMM1JM))88 ?Hd33 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! 9 L& 	%%l3r   Tbound	operationc                   UR                   nU(       d  [        S5      eU R                  R                  (       Ga  UR	                  S5      S   n[
        R                  " 5       n[        U[        5      (       a5  UR                  SS5      nUb  [
        R                  " S0 [        U5      D6nOP[        U[
        R                  5      (       a1  Ub.  UR                  b  UR                  O[
        R                  " 5       n[
        R                  " US9nU R                  UUUS9nUR                  USS	9n	U R                  R                  U	5        U	$ U R!                  UUS
9nUR                  USS	9n	U R                  R                  U	5        U	$ )a  Gets the status of a long-running operation.

Args:
  operation (Operation): The operation instance to get the status for.
  config (GetOperationConfig): Configuration for getting the operation.

Returns:
  Operation: The updated operation instance with the latest status or
  result.

Usage:

.. code-block:: python

  import time

  operation = client.models.generate_videos(
      model="veo-2.0-generate-001",
      source=types.GenerateVideosSource(
          prompt="A neon hologram of a cat driving at top speed",
      ),
  )
  while not operation.done:
      time.sleep(10)
      operation = client.operations.get(operation)

  print(operation.result)
Operation name is empty./operations/r   r8   Nr8   rL   Tis_vertex_air/   F )namerP   r4   r5   
rpartitionr   HttpOptions
isinstancedictr2   GetOperationConfigr8   FetchPredictOperationConfigrR   from_api_responser^   rH   
r@   rf   r,   r   r   r8   dict_optionsfetch_operation_configrG   response_operations
             r   r2   Operations.get
  s   H ^^N122    $//?Bm&&(l	FD	!	!zz.$7#**@T,-?@,fe6677F<N "". ""$ 	
  %@@#  ::'%' ; m %66
d 7  ''(:;00' 1 m %66
e 7  ''(:;r   rm   __name__
__module____qualname____firstlineno__strr   r   GetOperationConfigOrDictr   rH   !FetchPredictOperationConfigOrDictrR   r[   ra   r   	Operationrc   r2   __static_attributes__rm   r   r   r)   r)   ]   s    :>	/ / u556	/
 /l CG3 3 	3
 u>>?3 3r :>	A A u556	A
 AF c)! :>	O O  u556	O 
 	O  O r   r)   c            	       .   \ rS rSrSS.S\S\\R                     S\4S jjr	SS.S\S\S\\R                     S\4S	 jjrSS.S
\S\\R                     S\R                  4S jjr\" S\R                  S9rSS.S\S\\R                     S\4S jjrSrg)AsyncOperationsi\  Nr+   r   r,   r   c                H  #    [         R                  " UUS9nU R                  R                  (       a8  [	        U5      nUR                  S5      nU(       a  SR                  U5      nO:SnO7[        U5      nUR                  S5      nU(       a  SR                  U5      nOSnUR                  S5      nU(       a  U S[        U5       3nUR                  SS 5        S nUR                  b-  UR                  R                  b  UR                  R                  n[        R                  " U5      n[        R                  " U5      nU R                  R                  SXdU5      I S h  vN n	U	R                   (       d  0 n
U
$ ["        R$                  " U	R                   5      n
U
$  N;7fr.   )r   r3   r4   r5   r$   r2   r6   r!   r   r7   r,   r8   r
   r9   r:   async_requestr<   r=   r>   r?   s              r   rH   %AsyncOperations._get_videos_operation^  sw     33%O   6Gl%))&1	 ++,<= 5oFl%))&1	 ++,<= ##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33t< H 'mmBM 26HMM1JMs   E"F"$F %<F"r   c                  #    [         R                  " UUUS9nU R                  R                  (       d  [	        S5      e[        U5      nUR                  S5      nU(       a  SR                  U5      nOSnUR                  S5      nU(       a  U S[        U5       3nUR                  SS 5        S n	UR                  b-  UR                  R                  b  UR                  R                  n	[        R                  " U5      n[        R                  " U5      nU R                  R                  SXuU	5      I S h  vN n
U
R                   (       d  0 nU$ ["        R$                  " U
R                   5      nU$  N;7frK   )r   rO   r4   r5   rP   r   r2   r6   r   r7   r,   r8   r
   r9   r:   r   r<   r=   r>   rQ   s               r   rR   /AsyncOperations._fetch_predict_videos_operation  s_     <<%#O $$5 
 @Pl%))&1	5@@
 6##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33L H 'mmBM 26HMM1JMs   D6E68E49<E6r&   c                  #    [         R                  " UUS9nU R                  R                  (       d  [	        S5      e[        U5      nUR                  S5      nU(       a  SR                  U5      nOSnUR                  S5      nU(       a  U S[        U5       3nUR                  SS 5        S nUR                  b-  UR                  R                  b  UR                  R                  n[        R                  " U5      n[        R                  " U5      nU R                  R                  SXdU5      I S h  vN n	U	R                   (       d  0 O["        R$                  " U	R                   5      n
[         R&                  R)                  U
[+        USS 5      (       aG  S[+        UR                  S	S 5      [+        UR                  S
S 5      [+        UR                  SS 5      S.0O0 S9nU R                  R-                  U5        U$  N7frU   )r   rZ   r4   r5   rP   r'   r2   r6   r   r7   r,   r8   r
   r9   r:   r   r<   r=   r>   r[   r\   r]   r^   r_   s               r   ra   AsyncOperations._get  s     ::!O $$5 
 >oNl%))&1	*556FG*##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33t< H 'mmBHMM1JM))88 ?Hd33 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! 9 L& 	%%l35s   D5H7H8CHrc   rd   rf   c                  #    UR                   nU(       d  [        S5      eU R                  R                  (       Ga  UR	                  S5      S   n[
        R                  " 5       n[        U[        5      (       a5  UR                  SS5      nUb  [
        R                  " S0 [        U5      D6nOP[        U[
        R                  5      (       a1  Ub.  UR                  b  UR                  O[
        R                  " 5       n[
        R                  " US9nU R                  UUUS9I Sh  vN nUR                  USS	9n	U	$ U R                  UUS
9I Sh  vN nUR                  USS	9n	U	$  N@ N7f)a  Gets the status of a long-running operation.

Args:
  operation (Operation): The operation instance to get the status for.
  config (GetOperationConfig): Configuration for getting the operation.

Returns:
  Operation: The updated operation instance with the latest status or
  result.

Usage:

.. code-block:: python

  import asyncio

  operation = await client.aio.models.generate_videos(
      model="veo-2.0-generate-001",
      source=types.GenerateVideosSource(
          prompt="A neon hologram of a cat driving at top speed",
      ),
  )
  while not operation.done:
      await asyncio.sleep(10)
      operation = await client.aio.operations.get(operation)

  print(operation.result)
rh   ri   r   r8   Nrj   rL   Trk   r/   Frm   )rn   rP   r4   r5   ro   r   rp   rq   rr   r2   rs   r8   rt   rR   ru   rH   rv   s
             r   r2   AsyncOperations.get  s    F ^^N122   $//?Bm&&(l	FD	!	!zz.$7#**@T,-?@,fe6677F<N "". ""$ 	
  %@@#  !@@'%' A  m
 %66
d 7    66' 7  m %66
e 7   #s$   D&E-(E)))E-E+E-+E-rm   r{   rm   r   r   r   r   \  s    :>	1 1 u556	1
 1p CG3 3 	3
 u>>?3 3r :>	C C u556	C
 CJ c)! :>	H H  u556	H 
 	H  H r   r   )N)r=   loggingtypingr   r   r   r   urllib.parser    r	   r
   r   r   r   r   r   	getLoggerloggerrr   r   objectr   r!   r$   r'   
BaseModuler)   r   rm   r   r   <module>r      s  $   0 0 "    . .			4	5
 /3tCH~v-.DcN+ 
#s(^( /3tCH~v-.DcN+ 
#s(^" /3tCH~v-.DcN+ 
#s(^" /3
tCH~v-.
DcN+
 
#s(^
| '' | ~y k,, y r   