
    (ph                        S r SSKJr  SSKJr  SSKrSSKrSSKrSSKJrJ	r	J
r
JrJrJrJr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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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K J(r(  SSK)J*r*  Sr+ " S S\S9r, " S S \RZ                  " S S!5      \R\                  5      r. " S" S#\S9r/ " S$ S%\/\S9r0 " S& S'\/\S9r1 " S( S)\/\S9r2 " S* S+\/\S9r3 " S, S-5      r4 " S. S/5      r5 " S0 S15      r6 " S2 S35      r7 " S4 S5\5\4\R4                  5      r8 " S6 S7\6\4\R2                  5      r9 " S8 S9\5\7\4\R0                  5      r: " S: S;\6\7\4\R.                  5      r; " S< S=\R4                  5      r< " S> S?5      r= " S@ SA\=\R2                  5      r> " SB SC\=\R.                  5      r?g)Dz3Interceptors implementation of gRPC Asyncio Python.    )ABCMeta)abstractmethodN)AsyncIterable	AwaitableCallableIteratorListOptionalSequenceUnion)cygrpc   )
_base_call)AioRpcError)StreamStreamCall)StreamUnaryCall)UnaryStreamCall)UnaryUnaryCall)_API_STYLE_ERROR)_RPC_ALREADY_FINISHED_DETAILS)_RPC_HALF_CLOSED_DETAILS)Metadata)DeserializingFunction)DoneCallbackType)EOFType)RequestIterableType)RequestType)ResponseIterableType)ResponseType)SerializingFunction)_timeout_to_deadlinez!Locally cancelled by application!c                       \ rS rSrSr\S\\R                  /\	\R                     4   S\R                  S\R                  4S j5       rSrg)	ServerInterceptor9   zVAffords intercepting incoming RPCs on the service-side.

This is an EXPERIMENTAL API.
continuationhandler_call_detailsreturnc                    #    g7f)a  Intercepts incoming RPCs before handing them over to a handler.

State can be passed from an interceptor to downstream interceptors
via contextvars. The first interceptor is called from an empty
contextvars.Context, and the same Context is used for downstream
interceptors and for the final handler call. Note that there are no
guarantees that interceptors and handlers will be called from the
same thread.

Args:
    continuation: A function that takes a HandlerCallDetails and
        proceeds to invoke the next interceptor in the chain, if any,
        or the RPC handler lookup logic, with the call details passed
        as an argument, and returns an RpcMethodHandler instance if
        the RPC is considered serviced, or None otherwise.
    handler_call_details: A HandlerCallDetails describing the RPC.

Returns:
    An RpcMethodHandler with which the RPC may be serviced if the
    interceptor chooses to service this RPC, or None otherwise.
N )selfr%   r&   s      H/var/www/html/venv/lib/python3.13/site-packages/grpc/aio/_interceptor.pyintercept_service#ServerInterceptor.intercept_service?           r)   N)__name__
__module____qualname____firstlineno____doc__r   r   grpcHandlerCallDetailsr   RpcMethodHandlerr,   __static_attributes__r)       r+   r#   r#   9   sd    
 $$%y1F1F'GG

 #55 
		 r9   r#   )	metaclassc                   x    \ rS rSr% Sr\\S'   \\   \S'   \\	   \S'   \\
R                     \S'   \\   \S'   Srg	)
ClientCallDetails^   a  Describes an RPC to be invoked.

This is an EXPERIMENTAL API.

Args:
    method: The method name of the RPC.
    timeout: An optional duration of time in seconds to allow for the RPC.
    metadata: Optional metadata to be transmitted to the service-side of
      the RPC.
    credentials: An optional CallCredentials for the RPC.
    wait_for_ready: An optional flag to enable :term:`wait_for_ready` mechanism.
methodtimeoutmetadatacredentialswait_for_readyr)   N)r0   r1   r2   r3   r4   str__annotations__r
   floatr   r5   CallCredentialsboolr8   r)   r9   r+   r<   r<   ^   s>     Ke_x  $..//TN"r9   r<   )r>   r?   r@   rA   rB   c                       \ rS rSrSrSrg)ClientInterceptory   z6Base class used for all Aio Client Interceptor classesr)   N)r0   r1   r2   r3   r4   r8   r)   r9   r+   rI   rI   y   s    @r9   rI   c                   T    \ rS rSrSr\S\\\/\	4   S\S\S\
\	\4   4S j5       rSrg	)
UnaryUnaryClientInterceptor}   z-Affords intercepting unary-unary invocations.r%   client_call_detailsrequestr'   c                    #    g7f)a$  Intercepts a unary-unary invocation asynchronously.

Args:
  continuation: A coroutine that proceeds with the invocation by
    executing the next interceptor in the chain or invoking the
    actual RPC on the underlying Channel. It is the interceptor's
    responsibility to call it if it decides to move the RPC forward.
    The interceptor can use
    `call = await continuation(client_call_details, request)`
    to continue with the RPC. `continuation` returns the call to the
    RPC.
  client_call_details: A ClientCallDetails object describing the
    outgoing RPC.
  request: The request value for the RPC.

Returns:
  An object with the RPC response.

Raises:
  AioRpcError: Indicating that the RPC terminated with non-OK status.
  asyncio.CancelledError: Indicating that the RPC was canceled.
Nr)   r*   r%   rN   rO   s       r+   intercept_unary_unary1UnaryUnaryClientInterceptor.intercept_unary_unary   r.   r/   r)   N)r0   r1   r2   r3   r4   r   r   r<   r   r   r   r   rR   r8   r)   r9   r+   rL   rL   }   sY    7,n<

 /  
~|+	, r9   rL   c                   T    \ rS rSrSr\S\\\/\	4   S\S\S\
\\	4   4S j5       rSrg	)
UnaryStreamClientInterceptor   z.Affords intercepting unary-stream invocations.r%   rN   rO   r'   c                    #    g7f)a  Intercepts a unary-stream invocation asynchronously.

The function could return the call object or an asynchronous
iterator, in case of being an asyncrhonous iterator this will
become the source of the reads done by the caller.

Args:
  continuation: A coroutine that proceeds with the invocation by
    executing the next interceptor in the chain or invoking the
    actual RPC on the underlying Channel. It is the interceptor's
    responsibility to call it if it decides to move the RPC forward.
    The interceptor can use
    `call = await continuation(client_call_details, request)`
    to continue with the RPC. `continuation` returns the call to the
    RPC.
  client_call_details: A ClientCallDetails object describing the
    outgoing RPC.
  request: The request value for the RPC.

Returns:
  The RPC Call or an asynchronous iterator.

Raises:
  AioRpcError: Indicating that the RPC terminated with non-OK status.
  asyncio.CancelledError: Indicating that the RPC was canceled.
Nr)   rQ   s       r+   intercept_unary_stream3UnaryStreamClientInterceptor.intercept_unary_stream   r.   r/   r)   N)r0   r1   r2   r3   r4   r   r   r<   r   r   r   r   rX   r8   r)   r9   r+   rU   rU      sZ    8!,o=
!
 /! ! 
#_4	5! !r9   rU   c            	       J    \ rS rSrSr\S\\\/\	4   S\S\
S\	4S j5       rSrg	)
StreamUnaryClientInterceptor   z.Affords intercepting stream-unary invocations.r%   rN   request_iteratorr'   c                    #    g7f)a"  Intercepts a stream-unary invocation asynchronously.

Within the interceptor the usage of the call methods like `write` or
even awaiting the call should be done carefully, since the caller
could be expecting an untouched call, for example for start writing
messages to it.

Args:
  continuation: A coroutine that proceeds with the invocation by
    executing the next interceptor in the chain or invoking the
    actual RPC on the underlying Channel. It is the interceptor's
    responsibility to call it if it decides to move the RPC forward.
    The interceptor can use
    `call = await continuation(client_call_details, request_iterator)`
    to continue with the RPC. `continuation` returns the call to the
    RPC.
  client_call_details: A ClientCallDetails object describing the
    outgoing RPC.
  request_iterator: The request iterator that will produce requests
    for the RPC.

Returns:
  The RPC Call.

Raises:
  AioRpcError: Indicating that the RPC terminated with non-OK status.
  asyncio.CancelledError: Indicating that the RPC was canceled.
Nr)   r*   r%   rN   r]   s       r+   intercept_stream_unary3StreamUnaryClientInterceptor.intercept_stream_unary   r.   r/   r)   N)r0   r1   r2   r3   r4   r   r   r<   r   r   r   r`   r8   r)   r9   r+   r[   r[      sO    8#,o=
#
 /# .# 
# #r9   r[   c                   T    \ rS rSrSr\S\\\/\	4   S\S\
S\\\	4   4S j5       rSrg	)
StreamStreamClientInterceptor   z/Affords intercepting stream-stream invocations.r%   rN   r]   r'   c                    #    g7f)a  Intercepts a stream-stream invocation asynchronously.

Within the interceptor the usage of the call methods like `write` or
even awaiting the call should be done carefully, since the caller
could be expecting an untouched call, for example for start writing
messages to it.

The function could return the call object or an asynchronous
iterator, in case of being an asyncrhonous iterator this will
become the source of the reads done by the caller.

Args:
  continuation: A coroutine that proceeds with the invocation by
    executing the next interceptor in the chain or invoking the
    actual RPC on the underlying Channel. It is the interceptor's
    responsibility to call it if it decides to move the RPC forward.
    The interceptor can use
    `call = await continuation(client_call_details, request_iterator)`
    to continue with the RPC. `continuation` returns the call to the
    RPC.
  client_call_details: A ClientCallDetails object describing the
    outgoing RPC.
  request_iterator: The request iterator that will produce requests
    for the RPC.

Returns:
  The RPC Call or an asynchronous iterator.

Raises:
  AioRpcError: Indicating that the RPC terminated with non-OK status.
  asyncio.CancelledError: Indicating that the RPC was canceled.
Nr)   r_   s       r+   intercept_stream_stream5StreamStreamClientInterceptor.intercept_stream_stream   r.   r/   r)   N)r0   r1   r2   r3   r4   r   r   r<   r   r   r   r   r   rf   r8   r)   r9   r+   rc   rc      s\    9',.>>
'
 /' .' 
#%55	6' 'r9   rc   c                      \ rS rSr% Sr\R                  \S'   \\	   \S'   S\R                  SS4S jr
S	 rS\R                  SS4S
 jrS\	S\R                  SS4S jrS\4S jrS\4S jrS\4S jrS\	SS4S jrS\\   4S jrS\\   4S jrS\\   4S jrS\R8                  4S jrS\4S jrS\\   4S jr SS jr!Sr"g)InterceptedCalli!  a  Base implementation for all intercepted call arities.

Interceptors might have some work to do before the RPC invocation with
the capacity of changing the invocation parameters, and some work to do
after the RPC invocation with the capacity for accessing to the wrapped
`UnaryUnaryCall`.

It handles also early and later cancellations, when the RPC has not even
started and the execution is still held by the interceptors or when the
RPC has finished but again the execution is still held by the interceptors.

Once the RPC is finally executed, all methods are finally done against the
intercepted call, being at the same time the same call returned to the
interceptors.

As a base class for all of the interceptors implements the logic around
final status, metadata and cancellation.
_interceptors_task_pending_add_done_callbacksinterceptors_taskr'   Nc                 h    Xl         / U l        U R                   R                  U R                  5        g N)rj   rk   add_done_callback#_fire_or_add_pending_done_callbacks)r*   rl   s     r+   __init__InterceptedCall.__init__8  s-    "3+-(1144	
r9   c                 $    U R                  5         g rn   )cancelr*   s    r+   __del__InterceptedCall.__del__?  s    r9   c                    U R                   (       d  g Sn UR                  5       nUR                  5       (       a  SnU(       a  U R                    H  nU" U 5        M     OEU R                    H5  n[        R                  " U R                  U5      nWR                  U5        M7     / U l         g ! [        [        R
                  4 a    Sn Nf = fNFT)
rk   resultdoner   asyncioCancelledError	functoolspartial_wrap_add_done_callbackro   )r*   rl   call_completedcallcallbacks        r+   rp   3InterceptedCall._fire_or_add_pending_done_callbacksB  s     //	"$++-Dyy{{!%  << = !<<$,,00( &&x0	 = ,.( W334 	"!N	"s   'B- -CCr   unused_callc                     U" U 5        g rn   r)   )r*   r   r   s      r+   r   'InterceptedCall._wrap_add_done_callback]  s     	r9   c                    U R                   R                  5       (       d  U R                   R                  5       $  U R                   R                  5       nUR                  5       $ ! [         a     g[
        R                   a     gf = fNF)rj   r{   rt   rz   r   r|   r}   r*   r   s     r+   rt   InterceptedCall.cancelb  sz    &&++-- **1133	**113D {{}  	%% 		s   A% %
B1BBc                 F   U R                   R                  5       (       d  g U R                   R                  5       nUR                  5       $ ! [         a5  nUR	                  5       [
        R                  R                  :H  s S nA$ S nAf[        R                   a     gf = fry   )rj   r{   rz   r   coder5   
StatusCode	CANCELLEDr|   r}   	cancelledr*   r   errs      r+   r   InterceptedCall.cancelledr  s    &&++--	**113D ~~  	;88:!:!:::%% 		s#   A 
B *B B B B c                     U R                   R                  5       (       d  g U R                   R                  5       nUR                  5       $ ! [        [        R
                  4 a     gf = fry   )rj   r{   rz   r   r|   r}   r   s     r+   r{   InterceptedCall.done  s`    &&++--	**113D yy{ W334 		s   A A)(A)c                    U R                   R                  5       (       d  U R                  R                  U5        g  U R                   R	                  5       nUR                  5       (       a	  U" U 5        g [        R                  " U R                  U5      nUR                  U5        g ! [
        [        R                  4 a    U" U 5         g f = frn   )rj   r{   rk   appendrz   r   r|   r}   r~   r   r   ro   )r*   r   r   s      r+   ro   !InterceptedCall.add_done_callback  s    &&++--,,33H=	**113D
 99;;TN (()E)ExPH""8, W334 	TN	s   B( ("CCc                     [        5       ern   NotImplementedErrorru   s    r+   time_remainingInterceptedCall.time_remaining      !##r9   c                    #     U R                   I S h  vN nUR                  5       I S h  vN $  N! [         a  nUR                  5       s S nA$ S nAf[        R                   a     g f = f NB7frn   )rj   r   initial_metadatar|   r}   r   s      r+   r    InterceptedCall.initial_metadata  sf     	000D **,,, 1 	*''))%% 		 -R   A02 02 A0A.A02 
A+AA+A0A+(A0*A++A0c                    #     U R                   I S h  vN nUR                  5       I S h  vN $  N! [         a  nUR                  5       s S nA$ S nAf[        R                   a     g f = f NB7frn   )rj   r   trailing_metadatar|   r}   r   s      r+   r   !InterceptedCall.trailing_metadata  sf     	000D ++--- 1 	+((**%% 		 .r   c                   #     U R                   I S h  vN nUR                  5       I S h  vN $  N! [         a  nUR                  5       s S nA$ S nAf[        R                   a    [
        R                  R                  s $ f = f N\7frn   )rj   r   r   r|   r}   r5   r   r   r   s      r+   r   InterceptedCall.code  sm     	-000D YY[   1 	88:%% 	-??,,,	- !sR   B
2 02 B
BB
2 
BABB
1BB
BB
c                    #     U R                   I S h  vN nUR                  5       I S h  vN $  N! [         a  nUR                  5       s S nA$ S nAf[        R                   a	    [
        s $ f = f NH7frn   )rj   r   detailsr|   r}   _LOCAL_CANCELLATION_DETAILSr   s      r+   r   InterceptedCall.details  sc     	/000D \\^## 1 	!;;= %% 	/..	/ $sR   A62 02 A6A4A62 
A1AA1A6A1.A60A11A6c                    #     U R                   I S h  vN nUR                  5       I S h  vN $  N! [         a  nUR                  5       s S nA$ S nAf[        R                   a     gf = f NB7fN )rj   r   debug_error_stringr|   r}   r   s      r+   r   "InterceptedCall.debug_error_string  sf     	000D ,,... 1 	,))++%% 		 /r   c                 j   #    U R                   I S h  vN nUR                  5       I S h  vN $  N N7frn   )rj   wait_for_connectionr   s     r+   r   #InterceptedCall.wait_for_connection  s-     ,,,--/// -/s   3/3133)rj   rk   r'   N)#r0   r1   r2   r3   r4   r|   TaskrD   r   r   rq   rv   rp   r   Callr   rG   rt   r   r{   ro   r
   rE   r   r   r   r   r5   r   r   rC   r   r   r   r8   r)   r9   r+   ri   ri   !  s   &  $!)*:!;;
',, 
4 
.!(.	.6(7A	
   4  	d 	-*: -t -"$ $-(: -.(); .!DOO !$s $/(3- /0r9   ri   c                       \ rS rSrS rSrg)_InterceptedUnaryResponseMixini  c              #      #    U R                   R                  5        S h  vN nUR                  5        S h  vN nU$  N N7frn   )rj   	__await__r*   r   responses      r+   r   (_InterceptedUnaryResponseMixin.__await__  s8     11;;=="nn.. >.s   A?AAAAr)   N)r0   r1   r2   r3   r   r8   r)   r9   r+   r   r     s    r9   r   c                   p    \ rS rSr% \\\      \S'   S
S jrS\4S jr	S\\   4S jr
S\\\4   4S jrS	rg)_InterceptedStreamResponseMixini  _response_aiterr'   Nc                     S U l         g rn   r   ru   s    r+   _init_stream_response_mixin;_InterceptedStreamResponseMixin._init_stream_response_mixin  s      $r9   c                b   #    U R                   I S h  vN nU  S h  vN nU7v   M   N N
 g 7frn   )rj   r   s      r+   ,_wait_for_interceptor_task_response_iteratorL_InterceptedStreamResponseMixin._wait_for_interceptor_task_response_iterator  s0      ,,," 	(N -	ds$   /)/-+-	/-/c                 ^    U R                   c  U R                  5       U l         U R                   $ rn   )r   r   ru   s    r+   	__aiter__)_InterceptedStreamResponseMixin.__aiter__  s0    'AAC   ###r9   c                    #    U R                   c  U R                  5       U l          U R                   R                  S 5      I S h  vN $  N! [         a    [        R
                  s $ f = f7frn   )r   r   asendStopAsyncIterationr   EOFru   s    r+   read$_InterceptedStreamResponseMixin.read  s_     'AAC  	--33D9999! 	::	s:   #A+A A	A A+	A A(%A+'A((A+r   r   )r0   r1   r2   r3   r
   r   r   rD   r   r   r   r   r   r   r8   r)   r9   r+   r   r     sK    mL9::$
	$=6 $E'<"78 r9   r   c                       \ rS rSr% \\\      \S'   \\R                     \S'   \\R                     \S'   \" 5       rS\\   S\4S jrS rS	\S
\4S jrS	\SS4S jrSS jrSrg)_InterceptedStreamRequestMixini  _write_to_iterator_async_gen_write_to_iterator_queue_status_code_taskr]   r'   c                     UcC  [         R                  " SS9U l        U R                  5       U l        S U l        U R                  nU$ S U l        U$ )Nr   )maxsize)r|   Queuer   !_proxy_writes_as_request_iteratorr   r   )r*   r]   s     r+   _init_stream_request_mixin9_InterceptedStreamRequestMixin._init_stream_request_mixin  s_     # -4MM!,DD)668 - &*D"#@@   -1D)r9   c                   #    U R                   I S h  vN    U R                  R                  5       I S h  vN nU[        R                  L a  g U7v   M=   NB N!7frn   )rj   r   getr   _FINISH_ITERATOR_SENTINEL)r*   values     r+   r   @_InterceptedStreamRequestMixin._proxy_writes_as_request_iterator  sY     %%%%77;;==E1KKL K  	& >s   AA"AA AArO   r   c                 X  #    U R                   c.  U R                  R                  UR                  5       5      U l         [        R
                  " U R                  R                  U R                  R                  U5      5      U R                   4[        R                  S9I S h  vN   g  N7f)N)return_when)	r   _loopcreate_taskr   r|   waitr   putFIRST_COMPLETEDr*   rO   r   s      r+   &_write_to_iterator_queue_interruptibleE_InterceptedStreamRequestMixin._write_to_iterator_queue_interruptible!  s      !!)%)ZZ%;%;DIIK%HD"ll

&&1155g> &&	  //
 	
 	
s   B B*"B(#B*Nc                 @  #    U R                   c  [        R                  " [        5      e U R                  I S h  vN nUR                  5       (       a  [
        R                  " [        5      eUR                  (       a  [
        R                  " [        5      eU R                  X5      I S h  vN   UR                  5       (       a  [
        R                  " [        5      eg  N! [
        R                  [        4 a    [
        R                  " [        5      ef = f Nn7frn   )r   r   
UsageErrorr   rj   r|   r}   r   InvalidStateErrorr   r{   _done_writing_flagr   r   r   s      r+   write$_InterceptedStreamRequestMixin.write4  s      ((0##$455	K000D 99;;++,IJJ$$++,DEE99'HHH99;;++,IJJ  1&&4 	K++,IJJ	K 	Is8   (DC$ C"C$ A.D-D.4D"C$ $5DDc                 @  #    U R                   c  [        R                  " [        5      e U R                  I Sh  vN nU R                  [        R                  U5      I Sh  vN   g N-! [
        R                   a    [
        R                  " [        5      ef = f N97f)zESignal peer that client is done writing.

This method is idempotent.
N)r   r   r   r   rj   r|   r}   r   r   r   r   r   r   s     r+   done_writing+_InterceptedStreamRequestMixin.done_writingJ  s      ((0##$455	K000D 99*DDd
 	
 	
	 1%% 	K++,IJJ	K	
s7   (BA* A(A* #B"B#B(A* */BB)r   r   r   r   )r0   r1   r2   r3   r
   r   r   rD   r|   r   r   objectr   r   r   r   ri   r   r   r   r8   r)   r9   r+   r   r     s    "*=+E"FF&w}}55-- &  ()< = 	 "

"
*9
&K; K4 K,
r9   r   c                   j  ^  \ rS rSr% Sr\R                  \S'   \R                  \S'   S\
\   S\S\\   S\S	\\R"                     S
\\   S\R                  S\S\S\S\R                  SS4U 4S jjrS\
\   S\S\\   S\\   S	\\R"                     S
\\   S\S\S\S\4S jrS\\   4S jrSrU =r$ )InterceptedUnaryUnaryCalli_  zUsed for running a `UnaryUnaryCall` wrapped by interceptors.

For the `__await__` method is it is proxied to the intercepted call only when
the interceptor task is finished.
r   _channelinterceptorsrO   r?   r@   rA   rB   channelr>   request_serializerresponse_deserializerloopr'   Nc                    > Xl         Xpl        UR                  U R                  UUUUUUUU	U
5	      5      n[        TU ]  U5        g rn   )r   r   r   _invokesuperrq   r*   r   rO   r?   r@   rA   rB   r   r>   r   r   r   rl   	__class__s                r+   rq   "InterceptedUnaryUnaryCall.__init__l  sW     
 ,,LL"%

 	*+r9   c
                    ^ ^^	^#    S[         [           S[        S[        S[        R
                  4UUU	U 4S jjm[        X#XEU5      n
T" [        U5      X5      I Sh  vN $  N7f)(Run the RPC call wrapped in interceptorsr   rN   rO   r'   c                   >#    U (       ac  [         R                  " TU SS  5      nU S   R                  X1U5      I S h  vN n[        U[        R
                  5      (       a  U$ [        U5      $ [        U[        UR                  5      UR                  UR                  UR                  TR                  UR                  TTTR                  5
      $  N7fNr   r   )r~   r   rR   
isinstancer   r   UnaryUnaryCallResponser!   r?   r@   rA   rB   r   r>   r   )	r   rN   rO   r%   call_or_response_run_interceptorr   r   r*   s	        r+   r
  ;InterceptedUnaryUnaryCall._invoke.<locals>._run_interceptor  s     
 (00$l12&6  *6a)N)N w* $  .
0I0IJJ++12BCC &()<)D)DE'00'33'66MM'..&)JJ $s   :CCBCN)r	   rL   r<   r   r   r   listr*   r   r>   r?   r@   rA   rB   rO   r   r   rN   r
  s   `       `` @r+   r   !InterceptedUnaryUnaryCall._invoke  sy     	:;	!2	 !	 &&		 	@ 0XN
 & 3
 
 	
 
   AA$A"A$c                     [        5       ern   r   ru   s    r+   r   (InterceptedUnaryUnaryCall.time_remaining  r   r9   r   r   )r0   r1   r2   r3   r4   r|   AbstractEventLooprD   r   
AioChannelr   rL   r   r
   rE   r   r5   rF   rG   bytesr    r   rq   r   r   r   r8   __classcell__r  s   @r+   r   r   _  s^    $$$,:;, , %	,
 , d223, !, "", , 0,  5, '', 
,@3
:;3
 3
 %	3

 8$3
 d2233
 !3
 3
 03
  53
 
3
j$ $ $r9   r   c                     ^  \ rS rSr% Sr\R                  \S'   \R                  \S'   \
\R                     rS\\   S\S\
\   S\S	\
\R(                     S
\
\   S\R                  S\S\S\S\R                  SS4U 4S jjrS\\   S\S\
\   S\
\   S	\
\R(                     S
\
\   S\S\S\S\4S jrS\
\   4S jrSrU =r$ )InterceptedUnaryStreamCalli  z=Used for running a `UnaryStreamCall` wrapped by interceptors.r   r   r   rO   r?   r@   rA   rB   r   r>   r   r   r   r'   Nc                    > Xl         Xpl        U R                  5         S U l        UR	                  U R                  UUUUUUUU	U
5	      5      n[        TU ]  U5        g rn   )r   r   r   %_last_returned_call_from_interceptorsr   r   r   rq   r   s                r+   rq   #InterceptedUnaryStreamCall.__init__  sk     
((*592 ,,LL"%

 	*+r9   c
                    ^ ^^	^#    S[         [           S[        S[        S[        R
                  4UUU	U 4S jjm[        X#XEU5      n
T" [        U5      X5      I Sh  vN $  N7f)r  r   rN   rO   r'   c                 &  >#    U (       a  [         R                  " TU SS  5      nU S   R                  X1U5      I S h  vN n[        U[        R
                  5      (       a  UTl        TR                  $ [        TR                  U5      Tl        TR                  $ [        U[        UR                  5      UR                  UR                  UR                  TR                  UR                  TTTR                  5
      Tl        TR                  $  N7fr  )r~   r   rX   r  r   r   r  UnaryStreamCallResponseIteratorr!   r?   r@   rA   rB   r   r>   r   )	r   rN   rO   r%   call_or_response_iteratorr
  r   r   r*   s	        r+   r
  <InterceptedUnaryStreamCall._invoke.<locals>._run_interceptor  s    
 (00$l12&6  3?3(( w-) -z/I/I  2 > AAA 8 FF5 > AAA=L()<)D)DE'00'33'66MM'..&)JJ>: AAAE-   :DDCDN)r	   rU   r<   r   r   r   r  r  s   `       `` @r+   r   "InterceptedUnaryStreamCall._invoke  s     ,	B;<,	B!2,	B !,	B ''	,	B ,	B\ 0XN
 & 3
 
 	
 
r  c                     [        5       ern   r   ru   s    r+   r   )InterceptedUnaryStreamCall.time_remaining4  r   r9   r   r  r   )r0   r1   r2   r3   r4   r|   r  rD   r   r  r
   r   r   r  r   rU   r   rE   r   r5   rF   rG   r  r    r   rq   r   r   r8   r  r  s   @r+   r  r    sy    H$$$,4Z5O5O,P),;<, , %	,
 , d223, !, "", , 0,  5, '', 
,DA
;<A
 A
 %	A

 8$A
 d223A
 !A
 A
 0A
  5A
 
A
F$ $ $r9   r  c                   p  ^  \ rS rSr% Sr\R                  \S'   \R                  \S'   S\
\   S\\   S\\   S\S	\\R"                     S
\\   S\R                  S\S\S\S\R                  SS4U 4S jjrS\
\   S\S\\   S\\   S	\\R"                     S
\\   S\S\S\S\4S jrS\\   4S jrSrU =r$ )InterceptedStreamUnaryCalli8  zUsed for running a `StreamUnaryCall` wrapped by interceptors.

For the `__await__` method is it is proxied to the intercepted call only when
the interceptor task is finished.
r   r   r   r]   r?   r@   rA   rB   r   r>   r   r   r   r'   Nc                    > Xl         Xpl        U R                  U5      nUR                  U R	                  UUUUUUUU	U
5	      5      n[
        TU ]  U5        g rn   )r   r   r   r   r   r   rq   r*   r   r]   r?   r@   rA   rB   r   r>   r   r   r   rl   r  s                r+   rq   #InterceptedStreamUnaryCall.__init__H  si     
::;KL ,,LL "%

 	*+r9   c
                    ^ ^^	^#    S[         [           S[        S[        S[        R
                  4UUU	U 4S jjm[        X#XEU5      n
T" [        U5      X5      I Sh  vN $  N7f)r  r   rN   r]   r'   c                 R  >#    U (       a7  [         R                  " TU SS  5      nU S   R                  X1U5      I S h  vN $ [        U[	        UR
                  5      UR                  UR                  UR                  TR                  UR                  TTTR                  5
      $  Ng7fr  )r~   r   r`   r   r!   r?   r@   rA   rB   r   r>   r   )r   rN   r]   r%   r
  r   r   r*   s       r+   r
  <InterceptedStreamUnaryCall._invoke.<locals>._run_interceptorw  s     
 (00$l12&6  *!_CC 7G   '$()<)D)DE'00'33'66MM'..&)JJ 	s   :B'B%A(B'N)r   r[   r<   r   r   r   r  r*   r   r>   r?   r@   rA   rB   r]   r   r   rN   r
  s   `       `` @r+   r   "InterceptedStreamUnaryCall._invokei  sx     	"#?@	!2	 2	 ''		 	6 0XN
 & 3
 
 	
 
r  c                     [        5       ern   r   ru   s    r+   r   )InterceptedStreamUnaryCall.time_remaining  r   r9   r  )r0   r1   r2   r3   r4   r|   r  rD   r   r  r   r[   r
   r   rE   r   r5   rF   rG   r  r    r   rq   r   r   r   r8   r  r  s   @r+   r(  r(  8  sd    $$$,;<, ##67, %	,
 , d223, !, "", , 0,  5, '', 
,B.
;<.
 .
 %	.

 8$.
 d223.
 !.
 ..
 0.
  5.
 
.
`$ $ $r9   r(  c                     ^  \ rS rSr% Sr\R                  \S'   \R                  \S'   \
\R                     rS\\   S\
\   S\
\   S\S	\
\R(                     S
\
\   S\R                  S\S\S\S\R                  SS4U 4S jjrS\\   S\S\
\   S\
\   S	\
\R(                     S
\
\   S\S\S\S\4S jrS\
\   4S jrSrU =r$ )InterceptedStreamStreamCalli  z>Used for running a `StreamStreamCall` wrapped by interceptors.r   r   r   r]   r?   r@   rA   rB   r   r>   r   r   r   r'   Nc                    > Xl         Xpl        U R                  5         U R                  U5      nS U l        UR                  U R                  UUUUUUUU	U
5	      5      n[        TU ]!  U5        g rn   )	r   r   r   r   r  r   r   r   rq   r*  s                r+   rq   $InterceptedStreamStreamCall.__init__  s}     
((*::;KL592 ,,LL "%

 	*+r9   c
                    ^ ^^	^#    S[         [           S[        S[        S[        R
                  4UUU	U 4S jjm[        X#XEU5      n
T" [        U5      X5      I Sh  vN $  N7f)r  r   rN   r]   r'   c                 &  >#    U (       a  [         R                  " TU SS  5      nU S   R                  X1U5      I S h  vN n[        U[        R
                  5      (       a  UTl        TR                  $ [        TR                  U5      Tl        TR                  $ [        U[        UR                  5      UR                  UR                  UR                  TR                  UR                  TTTR                  5
      Tl        TR                  $  N7fr  )r~   r   rf   r  r   r   r   StreamStreamCallResponseIteratorr!   r?   r@   rA   rB   r   r>   r   )	r   rN   r]   r%   r   r
  r   r   r*   s	        r+   r
  =InterceptedStreamStreamCall._invoke.<locals>._run_interceptor  s    
 (00$l12&6  3?3)) 7G-) -z/J/J  2 > AAA 9 FF5 > AAA=M$()<)D)DE'00'33'66MM'..&)JJ>: AAAC-r"  N)r	   rc   r<   r   r   r   r  r/  s   `       `` @r+   r   #InterceptedStreamStreamCall._invoke  s     +	B<=+	B!2+	B 2+	B ((	+	B +	BZ 0XN
 & 3
 
 	
 
r  c                     [        5       ern   r   ru   s    r+   r   *InterceptedStreamStreamCall.time_remaining  r   r9   r&  )r0   r1   r2   r3   r4   r|   r  rD   r   r  r
   r   r   r  r   rc   r   rE   r   r5   rF   rG   r  r    r   rq   r   r   r8   r  r  s   @r+   r4  r4    s    I$$$,4##-)
 ,<= , ##67 , %	 ,
  , d223 , ! , "" ,  , 0 ,  5 , '' , 
 ,F@
<=@
 @
 %	@

 8$@
 d223@
 !@
 .@
 0@
  5@
 
@
D$ $ $r9   r4  c                       \ rS rSr% Sr\\S'   S\SS4S jrS\4S jr	S\4S	 jr
S\4S
 jrSS jrS\\   4S jrS\\   4S jrS\\   4S jrS\R(                  4S jrS\4S jrS\\   4S jrS rSS jrSrg)r  i  z4Final UnaryUnaryCall class finished with a response.	_responser   r'   Nc                     Xl         g rn   r?  )r*   r   s     r+   rq   UnaryUnaryCallResponse.__init__  s    !r9   c                     gr   r)   ru   s    r+   rt   UnaryUnaryCallResponse.cancel      r9   c                     gr   r)   ru   s    r+   r    UnaryUnaryCallResponse.cancelled   rE  r9   c                     g)NTr)   ru   s    r+   r{   UnaryUnaryCallResponse.done#  s    r9   c                     [        5       ern   r   )r*   unused_callbacks     r+   ro   (UnaryUnaryCallResponse.add_done_callback&  r   r9   c                     [        5       ern   r   ru   s    r+   r   %UnaryUnaryCallResponse.time_remaining)  r   r9   c                    #    g 7frn   r)   ru   s    r+   r   'UnaryUnaryCallResponse.initial_metadata,       r/   c                    #    g 7frn   r)   ru   s    r+   r   (UnaryUnaryCallResponse.trailing_metadata/  rQ  r/   c                 >   #    [         R                  R                  $ 7frn   )r5   r   OKru   s    r+   r   UnaryUnaryCallResponse.code2  s     !!!s   c                    #    g7fr   r)   ru   s    r+   r   UnaryUnaryCallResponse.details5  s     r/   c                    #    g 7frn   r)   ru   s    r+   r   )UnaryUnaryCallResponse.debug_error_string8  rQ  r/   c              #   $   #     U R                   $ 7frn   rA  ru   s    r+   r    UnaryUnaryCallResponse.__await__;  s      ~~s   c                    #    g 7frn   r)   ru   s    r+   r   *UnaryUnaryCallResponse.wait_for_connectionB  s     r/   rA  r   )r0   r1   r2   r3   r4   r   rD   rq   rG   rt   r   r{   ro   r
   rE   r   r   r   r   r5   r   r   rC   r   r   r   r   r8   r)   r9   r+   r  r    s    >" "$ " 4 d $$ $(: (); "DOO "s (3- r9   r  c                   t   \ rS rSr% \\R                  \R                  4   \S'   \	\
   \S'   S\\R                  \R                  4   S\	\
   SS4S jrS\4S	 jrS\4S
 jrS\4S jrSS jrS\\   4S jrS\\   4S jrS\\   4S jrS\R0                  4S jrS\4S jrS\\   4S jrS rSS jrSrg)_StreamCallResponseIteratoriF  _call_response_iteratorr   response_iteratorr'   Nc                     X l         Xl        g rn   )rb  ra  )r*   r   rc  s      r+   rq   $_StreamCallResponseIterator.__init__J  s    
 #4
r9   c                 6    U R                   R                  5       $ rn   )ra  rt   ru   s    r+   rt   "_StreamCallResponseIterator.cancelR  s    zz  ""r9   c                 6    U R                   R                  5       $ rn   )ra  r   ru   s    r+   r   %_StreamCallResponseIterator.cancelledU  s    zz##%%r9   c                 6    U R                   R                  5       $ rn   )ra  r{   ru   s    r+   r{    _StreamCallResponseIterator.doneX  s    zz  r9   c                 :    U R                   R                  U5        g rn   )ra  ro   )r*   r   s     r+   ro   -_StreamCallResponseIterator.add_done_callback[  s    

$$X.r9   c                 6    U R                   R                  5       $ rn   )ra  r   ru   s    r+   r   *_StreamCallResponseIterator.time_remaining^  s    zz((**r9   c                 R   #    U R                   R                  5       I S h  vN $  N7frn   )ra  r   ru   s    r+   r   ,_StreamCallResponseIterator.initial_metadataa  s     ZZ002222   '%'c                 R   #    U R                   R                  5       I S h  vN $  N7frn   )ra  r   ru   s    r+   r   -_StreamCallResponseIterator.trailing_metadatad  s     ZZ113333rr  c                 R   #    U R                   R                  5       I S h  vN $  N7frn   )ra  r   ru   s    r+   r    _StreamCallResponseIterator.codeg  s     ZZ__&&&&rr  c                 R   #    U R                   R                  5       I S h  vN $  N7frn   )ra  r   ru   s    r+   r   #_StreamCallResponseIterator.detailsj  s     ZZ''))))rr  c                 R   #    U R                   R                  5       I S h  vN $  N7frn   )ra  r   ru   s    r+   r   ._StreamCallResponseIterator.debug_error_stringm  s     ZZ224444rr  c                 6    U R                   R                  5       $ rn   )rb  r   ru   s    r+   r   %_StreamCallResponseIterator.__aiter__p  s    &&0022r9   c                 R   #    U R                   R                  5       I S h  vN $  N7frn   )ra  r   ru   s    r+   r   /_StreamCallResponseIterator.wait_for_connections  s     ZZ335555rr  )ra  rb  r   ) r0   r1   r2   r3   r   r   r   r   rD   r   r   rq   rG   rt   r   r{   ro   r
   rE   r   r   r   r   r5   r   r   rC   r   r   r   r   r8   r)   r9   r+   r`  r`  F  s    ++Z-H-HHII%l33J..
0K0KKL )6 
	# #&4 &!d !/+ +3(: 34(); 4'DOO '*s *5(3- 536r9   r`  c                   0    \ rS rSrSrS\\\4   4S jrSr	g)r  iw  zBUnaryStreamCall class which uses an alternative response iterator.r'   c                    #    [        5       e7frn   r   ru   s    r+   r   $UnaryStreamCallResponseIterator.read|        "##   r)   N)
r0   r1   r2   r3   r4   r   r   r   r   r8   r)   r9   r+   r  r  w  s     M$E'<"78 $r9   r  c                   d    \ rS rSrSrS\\\4   4S jrS\	SS4S jr
SS jr\S\4S	 j5       rS
rg)r9  i  zCStreamStreamCall class which uses an alternative response iterator.r'   c                    #    [        5       e7frn   r   ru   s    r+   r   %StreamStreamCallResponseIterator.read  r  r  rO   Nc                    #    [        5       e7frn   r   )r*   rO   s     r+   r   &StreamStreamCallResponseIterator.write        "##r  c                    #    [        5       e7frn   r   ru   s    r+   r   -StreamStreamCallResponseIterator.done_writing  r  r  c                 .    U R                   R                  $ rn   )ra  r   ru   s    r+   r   3StreamStreamCallResponseIterator._done_writing_flag  s    zz,,,r9   r)   r   )r0   r1   r2   r3   r4   r   r   r   r   r   r   r   propertyrG   r   r8   r)   r9   r+   r9  r9    sQ     N$E'<"78 $
$; $4 $$ -D - -r9   r9  )@r4   abcr   r   r|   collectionsr~   typingr   r   r   r   r	   r
   r   r   r5   grpc._cythonr   r   r   ra  r   r   r   r   r   r   r   r   	_metadatar   _typingr   r   r   r   r   r   r   r    _utilsr!   r   r#   
namedtupler<   rI   rL   rU   r[   rc   ri   r   r   r   r   r  r(  r4  r  r`  r  r9  r)   r9   r+   <module>r     s   :     	 	 	     # " " ! # 0 +  * %  (   ) ! ( (A "' "J#J 	#6A' A!"3w !H%#4 %P'#4 'T+$5 +\q0 q0h  B_
 _
Dc$"OZ5N5Nc$Lp$#_j6P6Pp$fb$""	b$Ju$#"	u$p.Z66 .b.6 .6b$!;!;$-!<!<-r9   