
    ci5              	       r   d Z ddlZddlmZmZmZmZmZmZm	Z	m
Z
 ddlZ G d de      Z G d deej                        Z G d d	ej                  ej                        Z G d
 dej"                  ej$                  ej&                  ej(                  ej*                        Zdeeegef   deeegef   fdZy)z(Base class for client-side interceptors.    N)AnyCallableIterator
NamedTupleOptionalSequenceTupleUnionc                       e Zd ZU eed<   ee   ed<   eeeee	ee
f   f         ed<   eej                     ed<   ee   ed<   eed<   y)_ClientCallDetailsFieldsmethodtimeoutmetadatacredentialswait_for_readycompressionN)__name__
__module____qualname__str__annotations__r   floatr   r	   r
   bytesgrpcCallCredentialsboolr        >/tmp/pip-target-z3e9_cxr/lib/python/grpc_interceptor/client.pyr   r   	   sU    Ke_xc5e+<&< =>??$..//TN"r   r   c                       e Zd ZdZy)ClientCallDetailszqDescribes an RPC to be invoked.

    See https://grpc.github.io/grpc/python/grpc.html#grpc.ClientCallDetails
    Nr   r   r   __doc__r   r   r   r!   r!      s    
 	r   r!   c                       e Zd ZdZy)ClientInterceptorReturnTypez7Return type for the ClientInterceptor.intercept method.Nr"   r   r   r   r%   r%      s    Ar   r%   c            	          e Zd ZdZej
                  dededej                  de
fd       Zdedej                  defd	Zdedej                  defd
Zdedej                  dee   fdZdedej                  dee   fdZy)ClientInterceptorzBase class for client-side interceptors.

    To implement an interceptor, subclass this class and override the intercept method.
    r   request_or_iteratorcall_detailsreturnc                      |||      S )a[  Override this method to implement a custom interceptor.

        This method is called for all unary and streaming RPCs. The interceptor
        implementation should call `method` using a `grpc.ClientCallDetails` and the
        `request_or_iterator` object as parameters. The `request_or_iterator`
        parameter may be type checked to determine if this is a singluar request
        for unary RPCs or an iterator for client-streaming or client-server streaming
        RPCs.

        Args:
            method: A function that proceeds with the invocation by executing the next
                interceptor in the chain or invoking the actual RPC on the underlying
                channel.
            request_or_iterator: RPC request message or iterator of request messages
                for streaming requests.
            call_details: Describes an RPC to be invoked.

        Returns:
            The type of the return should match the type of the return value received
            by calling `method`. This is an object that is both a
            `Call <https://grpc.github.io/grpc/python/grpc.html#grpc.Call>`_ for the
            RPC and a
            `Future <https://grpc.github.io/grpc/python/grpc.html#grpc.Future>`_.

            The actual result from the RPC can be got by calling `.result()` on the
            value returned from `method`.
        r   )selfr   r(   r)   s       r   	interceptzClientInterceptor.intercept-   s    D )<88r   continuationrequestc                 :    | j                  t        |      ||      S )zImplementation of grpc.UnaryUnaryClientInterceptor.

        This is not part of the grpc_interceptor.ClientInterceptor API, but must have
        a public name. Do not override it, unless you know what you're doing.
        r-   
_swap_argsr,   r.   r)   r/   s       r   intercept_unary_unaryz'ClientInterceptor.intercept_unary_unaryQ        ~~j6NNr   c                 :    | j                  t        |      ||      S )zImplementation of grpc.UnaryStreamClientInterceptor.

        This is not part of the grpc_interceptor.ClientInterceptor API, but must have
        a public name. Do not override it, unless you know what you're doing.
        r1   r3   s       r   intercept_unary_streamz(ClientInterceptor.intercept_unary_stream^   r5   r   request_iteratorc                 :    | j                  t        |      ||      S )zImplementation of grpc.StreamUnaryClientInterceptor.

        This is not part of the grpc_interceptor.ClientInterceptor API, but must have
        a public name. Do not override it, unless you know what you're doing.
        r1   r,   r.   r)   r8   s       r   intercept_stream_unaryz(ClientInterceptor.intercept_stream_unaryk        ~~j68H,WWr   c                 :    | j                  t        |      ||      S )zImplementation of grpc.StreamStreamClientInterceptor.

        This is not part of the grpc_interceptor.ClientInterceptor API, but must have
        a public name. Do not override it, unless you know what you're doing.
        r1   r:   s       r   intercept_stream_streamz)ClientInterceptor.intercept_stream_streamx   r<   r   N)r   r   r   r#   abcabstractmethodr   r   r   r!   r%   r-   r4   r7   r   r;   r>   r   r   r   r'   r'   !   s   
 	!9!9 !!9 ,,	!9
 
%!9 !9FOO ,,O 	OOO ,,O 	OXX ,,X #3-	XXX ,,X #3-	Xr   r'   )	metaclassfnr*   c                       fd}|S )Nc                      ||       S )Nr   )xyrB   s     r   new_fnz_swap_args.<locals>.new_fn   s    !Qxr   r   )rB   rG   s   ` r   r2   r2      s     Mr   )r#   r?   typingr   r   r   r   r   r   r	   r
   r   r   r!   CallFuturer%   UnaryUnaryClientInterceptorUnaryStreamClientInterceptorStreamUnaryClientInterceptorStreamStreamClientInterceptorABCMetar'   r2   r   r   r   <module>rP      s    . 
 X X X z 	0$2H2H 		$))T[[ 	bX$$%%%%&&kkbXJ8S#JO, 3*c/1J r   