a
    v=ic                     @   s"  d Z ddlmZ ddlmZ ddlmZmZmZmZm	Z	 ddl
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ZG dd dedZG dd deedZG dd deeef eedZG dd deeef eedZG dd deeef eedZG dd deeef eedZdS )zAbstract base classes for client-side Call objects.

Call objects represents the RPC itself, and offer methods to access / modify
its information. They also offer methods to manipulate the life-cycle of the
RPC, e.g. cancellation.
    )ABCMeta)abstractmethod)AsyncIterable	AwaitableGenericOptionalUnionN   )Metadata)DoneCallbackType)EOFType)RequestType)ResponseType)
RpcContextCallUnaryUnaryCallUnaryStreamCallc                   @   sp   e Zd ZdZeedddZeedddZeee	 dddZ
eedd	d
ZeeddddZdS )r   z,Provides RPC-related information and action.returnc                 C   s   dS )zReturn True if the RPC is cancelled.

        The RPC is cancelled when the cancellation was requested with cancel().

        Returns:
          A bool indicates whether the RPC is cancelled or not.
        N selfr   r   d/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/grpc/aio/_base_call.py	cancelled'   s    zRpcContext.cancelledc                 C   s   dS )zReturn True if the RPC is done.

        An RPC is done if the RPC is completed, cancelled or aborted.

        Returns:
          A bool indicates if the RPC is done.
        Nr   r   r   r   r   done1   s    zRpcContext.donec                 C   s   dS )a8  Describes the length of allowed time remaining for the RPC.

        Returns:
          A nonnegative float indicating the length of allowed time in seconds
          remaining for the RPC to complete before it is considered to have
          timed out, or None if no deadline was specified for the RPC.
        Nr   r   r   r   r   time_remaining;   s    zRpcContext.time_remainingc                 C   s   dS )zCancels the RPC.

        Idempotent and has no effect if the RPC has already terminated.

        Returns:
          A bool indicates if the cancellation is performed or not.
        Nr   r   r   r   r   cancelE   s    zRpcContext.cancelN)callbackr   c                 C   s   dS )zRegisters a callback to be called on RPC termination.

        Args:
          callback: A callable object will be called with the call object as
          its only argument.
        Nr   )r   r   r   r   r   add_done_callbackO   s    zRpcContext.add_done_callback)__name__
__module____qualname____doc__r   boolr   r   r   floatr   r   r   r   r   r   r   r   r   $   s   				r   )	metaclassc                   @   sl   e Zd ZdZeedddZeedddZeej	dddZ
eedd	d
ZeddddZdS )r   z5The abstract base class of an RPC on the client-side.r   c                    s   dS )ztAccesses the initial metadata sent by the server.

        Returns:
          The initial :term:`metadata`.
        Nr   r   r   r   r   initial_metadata\   s    zCall.initial_metadatac                    s   dS )zvAccesses the trailing metadata sent by the server.

        Returns:
          The trailing :term:`metadata`.
        Nr   r   r   r   r   trailing_metadatad   s    zCall.trailing_metadatac                    s   dS )zsAccesses the status code sent by the server.

        Returns:
          The StatusCode value for the RPC.
        Nr   r   r   r   r   codel   s    z	Call.codec                    s   dS )zlAccesses the details sent by the server.

        Returns:
          The details string of the RPC.
        Nr   r   r   r   r   detailst   s    zCall.detailsNc                    s   dS )ah  Waits until connected to peer and raises aio.AioRpcError if failed.

        This is an EXPERIMENTAL method.

        This method ensures the RPC has been successfully connected. Otherwise,
        an AioRpcError will be raised to explain the reason of the connection
        failure.

        This method is recommended for building retry mechanisms.
        Nr   r   r   r   r   wait_for_connection|   s    zCall.wait_for_connection)r   r    r!   r"   r   r
   r&   r'   grpcZ
StatusCoder(   strr)   r*   r   r   r   r   r   Y   s   r   c                   @   s&   e Zd ZdZeee dddZdS )r   zAThe abstract base class of an unary-unary RPC on the client-side.r   c                 C   s   dS )zmAwait the response message to be ready.

        Returns:
          The response message of the RPC.
        Nr   r   r   r   r   	__await__   s    zUnaryUnaryCall.__await__N)r   r    r!   r"   r   r   r   r-   r   r   r   r   r      s   r   c                   @   s<   e Zd Zeee dddZeeeef dddZ	dS )r   r   c                 C   s   dS zReturns the async iterable representation that yields messages.

        Under the hood, it is calling the "read" method.

        Returns:
          An async iterable object that yields messages.
        Nr   r   r   r   r   	__aiter__   s    zUnaryStreamCall.__aiter__c                    s   dS zReads one message from the stream.

        Read operations must be serialized when called from multiple
        coroutines.

        Returns:
          A response message, or an `grpc.aio.EOF` to indicate the end of the
          stream.
        Nr   r   r   r   r   read   s    zUnaryStreamCall.readN)
r   r    r!   r   r   r   r/   r   r   r1   r   r   r   r   r      s   	r   c                   @   sH   e Zd ZeeddddZeddddZeee ddd	Z	dS )
StreamUnaryCallNrequestr   c                    s   dS zpWrites one message to the stream.

        Raises:
          An RpcError exception if the write failed.
        Nr   r   r4   r   r   r   write   s    zStreamUnaryCall.writer   c                    s   dS zNotifies server that the client is done sending messages.

        After done_writing is called, any additional invocation to the write
        function will fail. This function is idempotent.
        Nr   r   r   r   r   done_writing   s    zStreamUnaryCall.done_writingc                 C   s   dS )zpAwait the response message to be ready.

        Returns:
          The response message of the stream.
        Nr   r   r   r   r   r-      s    zStreamUnaryCall.__await__)
r   r    r!   r   r   r7   r9   r   r   r-   r   r   r   r   r2      s   r2   c                   @   sb   e Zd Zeee dddZeeeef dddZ	ee
dddd	Zeddd
dZdS )StreamStreamCallr   c                 C   s   dS r.   r   r   r   r   r   r/      s    zStreamStreamCall.__aiter__c                    s   dS r0   r   r   r   r   r   r1      s    zStreamStreamCall.readNr3   c                    s   dS r5   r   r6   r   r   r   r7      s    zStreamStreamCall.writec                    s   dS r8   r   r   r   r   r   r9      s    zStreamStreamCall.done_writing)r   r    r!   r   r   r   r/   r   r   r1   r   r7   r9   r   r   r   r   r:      s   	r:   )r"   abcr   r   typingr   r   r   r   r   r+   	_metadatar
   Z_typingr   r   r   r   __all__r   r   r   r   r2   r:   r   r   r   r   <module>   s8   51