
    
!i                        S SK Jr  S SK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  SS.SS jjrSS.SS
 jjrSS.SS jjr " S S	\R(                  5      rSS.S jrg)    )annotationsN)Iterator)protos)client)model_types)	operationc                l   ^  T c  [         R                  " 5       m U 4S jT R                  SSS9 5       nU$ )z$Calls the API to list all operationsc              3  P   >#    U  H  n[         R                  UT5      v   M     g 7fN)CreateTunedModelOperation
from_proto).0opr   s     X/home/james-whalen/.local/lib/python3.13/site-packages/google/generativeai/operations.py	<genexpr>"list_operations.<locals>.<genexpr>%   s(      =B 	",,R88=s   #& )namefilter_)
client_libget_default_operations_clientlist_operations)r   
operationss   ` r   r   r      s?     ~99;((b"(=J
     r   c               z    Uc  [         R                  " 5       nUR                  U S9n[        R	                  X!5      $ )z)Calls the API to get a specific operationr   )r   r   get_operationr   r   )r   r   r   s      r   r   r   -   s9    ~99;			4		(B$//;;r   c               P    Uc  [         R                  " 5       nUR                  U S9$ )z,Calls the API to delete a specific operationr   )r   r   delete_operation)r   r   s     r   r   r   6   s+     ~99;"""--r   c                  x   ^  \ rS rSr\S 5       r\  S	S j5       r\S
S j5       rS r	SS jr
SU 4S jjrSrU =r$ )r   @   c                \    [        [        UU[        R                  [        R                  S9$ )zu
result = getattr(proto, 'result', None)
if result is not None:
    if result.value == b'':
        del proto.result
)clsr   operations_clientresult_typemetadata_type)
from_gapicr   r   
TunedModelCreateTunedModelMetadata)r#   protor   s      r   r   $CreateTunedModelOperation.from_protoA   s,     )$)) 99
 	
r   c           	         [        USS 5      n[        USS 5      nUb  SU0nO
Ub  SU0nO0 nU " SUR                  UR                  UR                  UR                  UR
                  S.UD6$ )N_polling_retrypollingretry)r   refreshcancelr%   r&    )getattr
_operation_refresh_cancel_result_type_metadata_type)r#   r   r/   r0   kwargss        r   from_core_operation-CreateTunedModelOperation.from_core_operationR   s    
 )Z6	8T2)Fu%FF 
**&&$$!..#22
 
 	
r   c                .    U R                   R                  $ r   )r5   r   selfs    r   r   CreateTunedModelOperation.namej   s    ###r   c                $    U R                  5         g)z5Refresh the current statuses in metadata/result/errorN)_refresh_and_updater>   s    r   update CreateTunedModelOperation.updaten   s      "r   c              +    #    [         R                   " SU R                  R                  SS.UD6nU R                  5       (       dY  U R                  nUR	                  U R                  R
                  UR                  -
  5        Uv   U R                  5       (       d  MY  U R                  nUR	                  U R                  R
                  UR                  -
  5        U R                  5       $ 7f)zA tqdm wait bar, yields `Operation` statuses until complete.

Args:
    **kwargs: passed through to `tqdm.auto.tqdm(..., **kwargs)`

Yields:
    Operation statuses as `protos.CreateTunedModelMetadata` objects.
r   )totalinitialr3   )tqdmmetadatatotal_stepsdonerC   completed_stepsnresult)r?   r:   barrI   s       r   wait_bar"CreateTunedModelOperation.wait_barr   s      iiMdmm77MfM ))++}}HJJt}}44suu<=N ))++ ==

4==0035589{{}s   BC,AC,c                P   > [         R                  " U5      n[        TU ]  U5        g r   )r   decode_tuned_modelsuper
set_result)r?   rN   	__class__s     r   rU   $CreateTunedModelOperation.set_result   s     //76"r   r3   )r   zoperation_lib.Operation)returnstr)rX   z)Iterator[protos.CreateTunedModelMetadata])rN   zprotos.TunedModel)__name__
__module____qualname____firstlineno__classmethodr   r;   propertyr   rC   rP   rU   __static_attributes____classcell__)rV   s   @r   r   r   @   sY    
 
  
*
 
. $ $#(# #r   )grpc_metadatac                   [         R                  " UR                  UR                  US9n[         R                  " UR                  UR                  US9nU " XXU40 UD6$ )zD`google.api_core.operation.from_gapic`, patched to allow subclasses.)rI   )	functoolspartialr   r   cancel_operation)	r#   r   r$   r%   r&   rb   r:   r1   r2   s	            r   r'   r'      s`     ''-G **F
 y6PPPr   )rX   z#Iterator[CreateTunedModelOperation])r   rY   rX   r   )r   rY   )
__future__r   rd   typingr   google.generativeair   r   r   google.generativeai.typesr   google.api_corer   operation_lib	tqdm.autoautorH   r   r   r   	Operationr   r'   r3   r   r   <module>rp      s]    #   & 4 1 6  #   (, < +/ .H# 7 7 H#d Qr   