Ë
    ´Œj{#  ã                   óx   — U d Z ddlmZ ddlmZ ddlmZ dZi Zee	e
f   ed<   efd„Zdd	„Zd
„ Z G d„ de«      Zy)z=Wrap long-running operations returned from Google Cloud APIs.é    )ÚDict)Úoperations_pb2)Újson_formatztype.googleapis.comÚ_TYPE_URL_MAPc                 ó<   — | j                   j                  }|›d|›�S )a   Compute a type URL for a klass.

    :type klass: type
    :param klass: class to be used as a factory for the given type

    :type prefix: str
    :param prefix: URL prefix for the type

    :rtype: str
    :returns: the URL, prefixed as appropriate
    Ú/)Ú
DESCRIPTORÚ	full_name)ÚklassÚprefixÚnames      úi/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/google/cloud/operation/__init__.pyÚ_compute_type_urlr      s    € ð ×Ñ×%Ñ%€DÚ™dÐ#Ð#ó    Nc                 ó€   — |€t        | «      }|t        v r t        |   | urt        dt        |   ›�«      ‚| t        |<   y)a�  Register a klass as the factory for a given type URL.

    :type klass: :class:`type`
    :param klass: class to be used as a factory for the given type

    :type type_url: str
    :param type_url: (Optional) URL naming the type. If not provided,
                     infers the URL from the type descriptor.

    :raises ValueError: if a registration already exists for the URL.
    Nz
Conflict: )r   r   Ú
ValueError)r   Útype_urls     r   Úregister_typer   ,   sF   € ð ÐÜ$ UÓ+ˆØ”=Ñ Ü˜Ñ"¨%Ñ/Ý¬}¸XÒ/FÐHÓIÐIà#„M�(Òr   c                 ó^   — t         | j                     }|j                  | j                  «      S )a‹  Convert an ``Any`` protobuf into the actual class.

    Uses the type URL to do the conversion.

    .. note::

        This assumes that the type URL is already registered.

    :type any_pb: :class:`google.protobuf.any_pb2.Any`
    :param any_pb: An any object to be converted.

    :rtype: object
    :returns: The instance (of the correct type) stored in the any
              instance.
    )r   r   Ú
FromStringÚvalue)Úany_pbr   s     r   Ú	_from_anyr   A   s'   € ô  ˜&Ÿ/™/Ñ*€EØ×Ñ˜FŸL™LÓ)Ð)r   c                   ó€   — e Zd ZdZdZ	 dZ	 dZ	 dZ	 dZd„ Z	e
d„ «       Ze
d„ «       Zed„ «       Zd„ Zd	„ Zd
„ Zd„ Zd„ Zy)Ú	Operationa€  Representation of a Google API Long-Running Operation.

    .. _protobuf: https://github.com/googleapis/googleapis/blob/                  050400df0fdb16f63b63e9dee53819044bffc857/                  google/longrunning/operations.proto#L80
    .. _service: https://github.com/googleapis/googleapis/blob/                 050400df0fdb16f63b63e9dee53819044bffc857/                 google/longrunning/operations.proto#L38
    .. _JSON: https://cloud.google.com/speech/reference/rest/              v1beta1/operations#Operation

    This wraps an operation `protobuf`_ object and attempts to
    interact with the long-running operations `service`_ (specific
    to a given API). (Some services also offer a `JSON`_
    API that maps the same underlying data type.)

    :type name: str
    :param name: The fully-qualified path naming the operation.

    :type client: :class:`~google.cloud.client.Client`
    :param client: The client used to poll for the status of the operation.
                   If the operation was created via JSON/HTTP, the client
                   must own a :class:`~google.cloud._http.Connection`
                   to send polling requests. If created via protobuf, the
                   client must have a gRPC stub in the ``_operations_stub``
                   attribute.

    :type caller_metadata: dict
    :param caller_metadata: caller-assigned metadata about the operation
    NTc                 óX   — || _         || _        |j                  «       | _        d| _        y )NF)r   ÚclientÚcopyÚcaller_metadataÚ	_complete)Úselfr   r   r   s       r   Ú__init__zOperation.__init__Ž   s(   € ØˆŒ	ØˆŒØ.×3Ñ3Ó5ˆÔØˆ�r   c                 ó^   —  | |j                   |fi |¤Ž}|j                  |«       d|_        |S )aD  Factory:  construct an instance from a protobuf.

        :type operation_pb:
            :class:`~google.longrunning.operations_pb2.Operation`
        :param operation_pb: Protobuf to be parsed.

        :type client: object: must provide ``_operations_stub`` accessor.
        :param client: The client used to poll for the status of the operation.

        :type caller_metadata: dict
        :param caller_metadata: caller-assigned metadata about the operation

        :rtype: :class:`Operation`
        :returns: new instance, with attributes based on the protobuf.
        T)r   Ú_update_stateÚ
_from_grpc)ÚclsÚoperation_pbr   r   Úresults        r   Úfrom_pbzOperation.from_pb”   s6   € ñ" �\×&Ñ&¨ÑB°/ÑBˆØ×Ñ˜\Ô*Ø ˆÔØˆr   c                 ó®   — t        j                  |t        j                  «       «      } | |j                  |fi |¤Ž}|j                  |«       d|_        |S )aø  Factory: construct an instance from a dictionary.

        :type operation: dict
        :param operation: Operation as a JSON object.

        :type client: :class:`~google.cloud.client.Client`
        :param client: The client used to poll for the status of the operation.

        :type caller_metadata: dict
        :param caller_metadata: caller-assigned metadata about the operation

        :rtype: :class:`Operation`
        :returns: new instance, with attributes based on the protobuf.
        F)r   Ú	ParseDictr   r   r   r$   r%   )r&   Ú	operationr   r   r'   r(   s         r   Ú	from_dictzOperation.from_dictª   sQ   € ô  #×,Ñ,¨Y¼×8PÑ8PÓ8RÓSˆÙ�\×&Ñ&¨ÑB°/ÑBˆØ×Ñ˜\Ô*Ø!ˆÔØˆr   c                 ó   — | j                   S )z|Has the operation already completed?

        :rtype: bool
        :returns: True if already completed, else false.
        )r    ©r!   s    r   ÚcompletezOperation.completeÀ   s   € ð �~‰~Ðr   c                 óŒ   — t        j                  | j                  ¬«      }| j                  j                  j                  |«      S )zÝPolls the status of the current operation.

        Uses gRPC request to check.

        :rtype: :class:`~google.longrunning.operations_pb2.Operation`
        :returns: The latest status of the current operation.
        )r   )r   ÚGetOperationRequestr   r   Ú_operations_stubÚGetOperation)r!   Ú
request_pbs     r   Ú_get_operation_rpczOperation._get_operation_rpcÉ   s3   € ô $×7Ñ7¸T¿Y¹YÔGˆ
Ø�{‰{×+Ñ+×8Ñ8¸ÓDÐDr   c                 ó¾   — d| j                   ›�}| j                  j                  j                  d|¬«      }t	        j
                  |t        j                  «       «      S )zÞChecks the status of the current operation.

        Uses HTTP request to check.

        :rtype: :class:`~google.longrunning.operations_pb2.Operation`
        :returns: The latest status of the current operation.
        zoperations/ÚGET)ÚmethodÚpath)r   r   Ú_connectionÚapi_requestr   r+   r   r   )r!   r:   Úapi_responses      r   Ú_get_operation_httpzOperation._get_operation_httpÔ   sK   � ð #'§)¢)Ð-ˆØ—{‘{×.Ñ.×:Ñ:À%ÈdÐ:ÓSˆÜ×$Ñ$ \´>×3KÑ3KÓ3MÓNÐNr   c                 óZ   — | j                   r| j                  «       S | j                  «       S )z¹Checks the status of the current operation.

        :rtype: :class:`~google.longrunning.operations_pb2.Operation`
        :returns: The latest status of the current operation.
        )r%   r6   r>   r/   s    r   Ú_get_operationzOperation._get_operationà   s)   € ð �?Š?Ø×*Ñ*Ó,Ð,à×+Ñ+Ó-Ð-r   c                 ó  — |j                   rd| _        |j                  d«      rt        |j                  «      | _        |j                  d«      }|dk(  r|j                  | _        y|dk(  rt        |j                  «      | _        yy)zÖUpdate the state of the current object based on operation.

        :type operation_pb:
            :class:`~google.longrunning.operations_pb2.Operation`
        :param operation_pb: Protobuf to be parsed.
        TÚmetadatar(   ÚerrorÚresponseN)Údoner    ÚHasFieldr   rB   Ú
WhichOneofrC   rD   )r!   r'   Úresult_types      r   r$   zOperation._update_stateë   sx   € ð ×ÒØ!ˆDŒNà× Ñ  Ô,Ü% l×&;Ñ&;Ó<ˆDŒMà"×-Ñ-¨hÓ7ˆØ˜'Ò!Ø%×+Ñ+ˆD�JØ˜JÒ&Ü% l×&;Ñ&;Ó<ˆD�Mð 'r   c                 óŠ   — | j                   rt        d«      ‚| j                  «       }| j                  |«       | j                   S )zçCheck if the operation has finished.

        :rtype: bool
        :returns: A boolean indicating if the current operation has completed.
        :raises ValueError: if the operation
                 has already completed.
        zThe operation has completed.)r0   r   r@   r$   )r!   r'   s     r   ÚpollzOperation.pollþ   s=   € ð �=Š=ÜÐ;Ó<Ð<à×*Ñ*Ó,ˆØ×Ñ˜<Ô(à�}‰}Ðr   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚtargetrD   rC   rB   r%   r"   Úclassmethodr)   r-   Úpropertyr0   r6   r>   r@   r$   rJ   © r   r   r   r   U   s–   „ ñð> €FØCà€Hðð
 €Eðð
 €Hðð €Jòð ñó ðð* ñó ðð* ñó ðò	Eò
Oò	.ò=ó&r   r   )N)rN   Útypingr   Úgoogle.longrunningr   Úgoogle.protobufr   Ú_GOOGLE_APIS_PREFIXr   ÚstrÚtypeÚ__annotations__r   r   r   Úobjectr   rR   r   r   Ú<module>r[      sP   ðò Då å -Ý 'ð ,Ð à!#€ˆt�C˜�I‰Ó #ð %8ó $ó $ò**ô(w�õ wr   