-;iddlmZddlZddlmZddlmZddlmZddl m Z ddl m Z ddlmZdddd ZddddZddddZGdd e jZdddZdS)) annotationsN)Iterator)protos)client) model_types) operationreturn#Iterator[CreateTunedModelOperation]cxtjfdddD}|S)z$Calls the API to list all operationsNc3NK|]}t|V dSN)CreateTunedModelOperation from_proto).0oprs RC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\google/generativeai/operations.py z"list_operations..%sG  ",,R88)namefilter_) client_libget_default_operations_clientlist_operations)r operationss` rrrs[~9;;((b"(==J rrstrrc|tj}||}t||S)z)Calls the API to get a specific operationNr)rr get_operationrr)rrrs rrr-sA ~9;;   4  ( (B $ / /F ; ;;rcX|tj}||S)z,Calls the API to delete a specific operationNr)rrdelete_operation)rrs rr!r!6s.~9;;  " " " - --rcteZdZedZeddZeddZdZdd Z dfd Z xZ S)rc\tt||tjtjS)z result = getattr(proto, 'result', None) if result is not None: if result.value == b'': del proto.result )clsroperations_client result_type metadata_type) from_gapicrr TunedModelCreateTunedModelMetadata)r$protors rrz$CreateTunedModelOperation.from_protoAs0)$) 9     rroperation_lib.Operationc t|dd}t|dd}|d|i}n |d|i}ni}|d|j|j|j|j|jd|S)N_polling_retrypollingretry)rrefreshcancelr&r')getattr _operation_refresh_cancel _result_type_metadata_type)r$rr0r1kwargss rfrom_core_operationz-CreateTunedModelOperation.from_core_operationRs )Z66 8T22  )FF  u%FFFs *&$!.#2       rr rc|jjSr )r6rselfs rrzCreateTunedModelOperation.namejs ##rc.|dS)z5Refresh the current statuses in metadata/result/errorN)_refresh_and_updater>s rupdatez CreateTunedModelOperation.updatens   """""r)Iterator[protos.CreateTunedModelMetadata]c+zKtjd|jjdd|}|sF|j}||jj|jz |V|F|j}||jj|jz |S)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)totalinitialr4)tqdmmetadata total_stepsdonerBcompleted_stepsnresult)r?r;barrHs rwait_barz"CreateTunedModelOperation.wait_barrsiMdm7MMfMM))++ }H JJt}4su< = = =NNN))++ = 4=0358999{{}}rrMprotos.TunedModelcrtj|}t|dSr )rdecode_tuned_modelsuper set_result)r?rM __class__s rrTz$CreateTunedModelOperation.set_results1/77 6"""""r)rr,)r r)r rC)rMrP) __name__ __module__ __qualname__ classmethodrr<propertyrrBrOrT __classcell__)rUs@rrr@s  [    [ .$$$X$###(##########r) grpc_metadatac tj|j|j|}tj|j|j|}||||||fi|S)zD`google.api_core.operation.from_gapic`, patched to allow subclasses.)rH) functoolspartialrrcancel_operation) r$rr%r&r'r\r;r2r3s rr(r(sp'-G *F 3y'6; P P P PPr)r r )rrr r)rr) __future__rr^typingrgoogle.generativeairrrgoogle.generativeai.typesrgoogle.api_corer operation_lib tqdm.autoautorGrrr! Operationrr(r4rrrjs_#"""""&&&&&&444444111111666666#       (,<<<<<<+/......H#H#H#H#H# 7H#H#H#dQQQQQQQr