o
    Ù­j4V  ã                   @   sÆ  d Z ddlZddl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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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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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dl#m)Z) ddl#m*Z* dd l+m,Z, d! -ej.¡Z/ej0d d"k rÜd#eej1 fd$d%„Z2n
d#eej1 fd&d%„Z2d'e$d(ee	j3 fd)d*„Z4G d+d,„ d,ƒZ5G d-d.„ d.e5ej6ƒZ6G d/d0„ d0e5ej7ƒZ7G d1d2„ d2e5ej8ƒZ8G d3d4„ d4e5ej9ƒZ9G d5d6„ d6ej:ƒZ:			d?d7e;d8ee$ d(ee	j3 d9eee  fd:d;„Z<			d?d7e;d<e	j=d8ee$ d(ee	j3 d9eee  f
d=d>„Z>dS )@z6Invocation-side implementation of gRPC Asyncio Python.é    N)ÚAnyÚIterableÚListÚOptionalÚSequence)Ú_common)Ú_compression)Ú_grpcio_metadata)Úcygrpcé   )Ú
_base_call)Ú_base_channel)ÚStreamStreamCall)ÚStreamUnaryCall)ÚUnaryStreamCall)ÚUnaryUnaryCall)ÚClientInterceptor)ÚInterceptedStreamStreamCall)ÚInterceptedStreamUnaryCall)ÚInterceptedUnaryStreamCall)ÚInterceptedUnaryUnaryCall)ÚStreamStreamClientInterceptor)ÚStreamUnaryClientInterceptor)ÚUnaryStreamClientInterceptor)ÚUnaryUnaryClientInterceptor)ÚMetadata)ÚChannelArgumentType)ÚDeserializingFunction)ÚMetadataType)ÚRequestIterableType)ÚRequestType)ÚResponseType)ÚSerializingFunction)Ú_timeout_to_deadlinezgrpc-python-asyncio/{}é   Úreturnc                   C   s
   t j ¡ S ©N)ÚasyncioÚTaskÚ	all_tasks© r*   r*   úN/var/www/html/CropPilot/venv/lib/python3.10/site-packages/grpc/aio/_channel.pyÚ
_all_tasks7   s   
r,   c                   C   s   t  ¡ S r&   )r'   r)   r*   r*   r*   r+   r,   <   s   Úbase_optionsÚcompressionc                 C   s(   t  |¡}tjjtff}t| ƒ| | S r&   )r   Úcreate_channel_optionr
   ÚChannelArgKeyÚprimary_user_agent_stringÚ_USER_AGENTÚtuple)r-   r.   Úcompression_channel_argumentÚuser_agent_channel_argumentr*   r*   r+   Ú_augment_channel_arguments@   s   ÿþÿÿþÿr6   c                   @   sØ   e Zd ZU dZejed< ejed< e	ed< e
e ed< e
e ed< e
ee  ed< ee ed< ejed< d	ejd
e	de
e de
e de
ee  dee dejddfdd„Ze		dde
e de
ej defdd„ƒZdS )Ú_BaseMultiCallablezrBase class of all multi callable objects.

    Handles the initialization logic and stores common attributes.
    Ú_loopÚ_channelÚ_methodÚ_request_serializerÚ_response_deserializerÚ_interceptorsÚ_referencesÚchannelÚmethodÚrequest_serializerÚresponse_deserializerÚinterceptorsÚ
referencesÚloopr%   Nc                 C   s.   || _ || _|| _|| _|| _|| _|| _d S r&   )r8   r9   r:   r;   r<   r=   r>   )Úselfr?   r@   rA   rB   rC   rD   rE   r*   r*   r+   Ú__init__c   s   

z_BaseMultiCallable.__init__Úmetadatar.   c                 C   sD   | pt ƒ } t| t ƒst| tƒrt  t| ƒ¡} |r t t | |¡Ž } | S )z—Based on the provided values for <metadata> or <compression> initialise the final
        metadata, as it should be used for the current call.
        )r   Ú
isinstancer   Ú
from_tupler3   r   Úaugment_metadata)rH   r.   r*   r*   r+   Ú_init_metadatau   s   
ÿ
ÿz!_BaseMultiCallable._init_metadata)NN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r'   ÚAbstractEventLoopÚ__annotations__r
   Ú
AioChannelÚbytesr   r"   r   r   r   r   r   rG   Ústaticmethodr   ÚgrpcÚCompressionr   rL   r*   r*   r*   r+   r7   S   sJ   
 


þýüû
úùø	
÷þÿþýr7   c                   @   ób   e Zd Zddddddœdedee dee deej dee	 deej
 d	ejeef fd
d„ZdS )ÚUnaryUnaryMultiCallableN©ÚtimeoutrH   ÚcredentialsÚwait_for_readyr.   Úrequestr[   rH   r\   r]   r.   r%   c                C   ój   |   ||¡}| jst|t|ƒ|||| j| j| j| j| jƒ
}|S t	| j|||||| j| j| j| j| jƒ}|S r&   )
rL   r=   r   r#   r9   r:   r;   r<   r8   r   ©rF   r^   r[   rH   r\   r]   r.   Úcallr*   r*   r+   Ú__call__Œ   s:   
öòõz UnaryUnaryMultiCallable.__call__)rM   rN   rO   r    r   Úfloatr   rV   ÚCallCredentialsÚboolrW   r   r   r!   rb   r*   r*   r*   r+   rY   ‰   ó*    øþüûúùø	÷rY   c                   @   rX   )ÚUnaryStreamMultiCallableNrZ   r^   r[   rH   r\   r]   r.   r%   c                C   r_   r&   )
rL   r=   r   r#   r9   r:   r;   r<   r8   r   r`   r*   r*   r+   rb   ¹   s:   
öòõz!UnaryStreamMultiCallable.__call__)rM   rN   rO   r    r   rc   r   rV   rd   re   rW   r   r   r!   rb   r*   r*   r*   r+   rg   ¶   rf   rg   c                   @   ó^   e Zd Z						ddee dee dee deej dee	 deej
 dejfd	d
„ZdS )ÚStreamUnaryMultiCallableNÚrequest_iteratorr[   rH   r\   r]   r.   r%   c                 C   r_   r&   )
rL   r=   r   r#   r9   r:   r;   r<   r8   r   ©rF   rj   r[   rH   r\   r]   r.   ra   r*   r*   r+   rb   ç   ó:   	öòõz!StreamUnaryMultiCallable.__call__©NNNNNN)rM   rN   rO   r   r   rc   r   rV   rd   re   rW   r   r   rb   r*   r*   r*   r+   ri   ä   ó,    ùþýüûúùøri   c                   @   rh   )ÚStreamStreamMultiCallableNrj   r[   rH   r\   r]   r.   r%   c                 C   r_   r&   )
rL   r=   r   r#   r9   r:   r;   r<   r8   r   rk   r*   r*   r+   rb     rl   z"StreamStreamMultiCallable.__call__rm   )rM   rN   rO   r   r   rc   r   rV   rd   re   rW   r   r   rb   r*   r*   r*   r+   ro     rn   ro   c                   @   sÈ  e Zd ZU ejed< ejed< ee	 ed< ee
 ed< ee ed< ee ed< deded	eej d
eej deee  f
dd„Zdd„ Zdd„ Zdd„ Zd2dee fdd„Zdd„ Z	d3dedejfdd„Zdejddfd d!„Zd4d"d#„Z d$ede!fd%d&„Z"			d5d$ed'ee# d(ee$ d)ee de%f
d*d+„Z&			d5d$ed'ee# d(ee$ d)ee de'f
d,d-„Z(			d5d$ed'ee# d(ee$ d)ee de)f
d.d/„Z*			d5d$ed'ee# d(ee$ d)ee de+f
d0d1„Z,dS )6ÚChannelr8   r9   Ú_unary_unary_interceptorsÚ_unary_stream_interceptorsÚ_stream_unary_interceptorsÚ_stream_stream_interceptorsÚtargetÚoptionsr\   r.   rC   c                 C   sô   g | _ g | _g | _g | _|durc|D ]P}t|tƒr | j  |¡ qt|tƒr,| j |¡ qt|tƒr8| j |¡ qt|t	ƒrD| j |¡ qt
d |¡d tj¡ d tj¡ d tj¡ d t	j¡ ƒ‚t ¡ | _t t |¡t||ƒ|| j¡| _dS )aÝ  Constructor.

        Args:
          target: The target to which to connect.
          options: Configuration options for the channel.
          credentials: A cygrpc.ChannelCredentials or None.
          compression: An optional value indicating the compression method to be
            used over the lifetime of the channel.
          interceptors: An optional list of interceptors that would be used for
            intercepting any RPC executed with that channel.
        NzInterceptor {} must be z{} or z{}. )rq   rr   rs   rt   rI   r   Úappendr   r   r   Ú
ValueErrorÚformatrM   r
   Úget_working_loopr8   rS   r   Úencoder6   r9   )rF   ru   rv   r\   r.   rC   Úinterceptorr*   r*   r+   rG   F  s@   




ÿ
þ
ý
üÿ

üzChannel.__init__c                 Ã   s   �| S r&   r*   ©rF   r*   r*   r+   Ú
__aenter__y  s   €zChannel.__aenter__c                 Ã   s   �|   d ¡I d H  d S r&   ©Ú_close)rF   Úexc_typeÚexc_valÚexc_tbr*   r*   r+   Ú	__aexit__|  ó   €zChannel.__aexit__c                 Ã   s>  �| j  ¡ rd S | j  ¡  tƒ }g }g }|D ]j}z|jdd�}W n ty9 } zdt|ƒv r4W Y d }~q‚ d }~ww |s=q|d }|j d¡}	|	d ur€t	|	t
jƒr€t|	dƒr^|	j | j ur]qnt|	dƒrl|	jj | j urkqn
d|	› �}
t |
¡‚| |	¡ | |¡ q|r�|r�tj||d	�I d H  |D ]}| ¡  q‘| j  ¡  d S )
Nr   )ÚlimitÚframer   rF   r9   Ú_cython_callzUnrecognized call object: )r[   )r9   ÚclosedÚclosingr,   Ú	get_stackÚAttributeErrorÚstrÚf_localsÚgetrI   r   ÚCallÚhasattrrˆ   r
   ÚInternalErrorrw   r'   ÚwaitÚcancelÚclose)rF   ÚgraceÚtasksÚcallsÚ
call_tasksÚtaskÚstackÚattribute_errorr‡   Ú	candidateÚ	error_msgra   r*   r*   r+   r€     sN   €

€ï
ÿ
ÿ



€
zChannel._closeNr–   c                 Ã   s   �|   |¡I d H  d S r&   r   )rF   r–   r*   r*   r+   r•   Ç  r…   zChannel.closec                 C   s*   t | dƒr| j ¡ s| j ¡  d S d S d S )Nr9   )r‘   r9   r‰   r•   r}   r*   r*   r+   Ú__del__Ê  s   ÿzChannel.__del__FÚtry_to_connectr%   c                 C   s   | j  |¡}tj| S r&   )r9   Úcheck_connectivity_stater   Ú1CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY)rF   r    Úresultr*   r*   r+   Ú	get_stateÎ  s   
zChannel.get_stateÚlast_observed_statec                 Ã   s$   �| j  |jd d ¡I d H sJ ‚d S )Nr   )r9   Úwatch_connectivity_stateÚvalue)rF   r¥   r*   r*   r+   Úwait_for_state_changeÔ  s   €
ÿzChannel.wait_for_state_changec                 Ã   sJ   �| j dd�}|tjjkr#|  |¡I d H  | j dd�}|tjjksd S d S )NT)r    )r¤   rV   ÚChannelConnectivityÚREADYr¨   )rF   Ústater*   r*   r+   Úchannel_readyÜ  s   €þzChannel.channel_readyr@   c                 C   s   d S r&   r*   )rF   r@   r*   r*   r+   Ú_get_registered_call_handleä  s   z#Channel._get_registered_call_handlerA   rB   Ú_registered_methodc                 C   ó"   t | jt |¡||| j| g| jƒS r&   )rY   r9   r   r{   rq   r8   ©rF   r@   rA   rB   r®   r*   r*   r+   Úunary_unaryê  ó   ùzChannel.unary_unaryc                 C   r¯   r&   )rg   r9   r   r{   rr   r8   r°   r*   r*   r+   Úunary_streamþ  r²   zChannel.unary_streamc                 C   r¯   r&   )ri   r9   r   r{   rs   r8   r°   r*   r*   r+   Ústream_unary  r²   zChannel.stream_unaryc                 C   r¯   r&   )ro   r9   r   r{   rt   r8   r°   r*   r*   r+   Ústream_stream&  r²   zChannel.stream_streamr&   )F)r%   N)NNF)-rM   rN   rO   r'   rQ   rR   r
   rS   r   r   r   r   r   r�   r   r   ÚChannelCredentialsrV   rW   r   r   rG   r~   r„   r€   rc   r•   rŸ   re   r©   r¤   r¨   r¬   Úintr­   r"   r   rY   r±   rg   r³   ri   r´   ro   rµ   r*   r*   r*   r+   rp   >  s¸   
 

þýüû

ú3Hÿÿ
þþ
ý
	ûþýüû
úûþýüû
úûþýüû
úûþýüûúrp   ru   rv   rC   c                 C   s   t | |du rdn|d||ƒS )a  Creates an insecure asynchronous Channel to a server.

    Args:
      target: The server address
      options: An optional list of key-value pairs (:term:`channel_arguments`
        in gRPC Core runtime) to configure the channel.
      compression: An optional value indicating the compression method to be
        used over the lifetime of the channel.
      interceptors: An optional sequence of interceptors that will be executed for
        any call executed with this channel.

    Returns:
      A Channel.
    Nr*   )rp   )ru   rv   r.   rC   r*   r*   r+   Úinsecure_channel8  s   ûr¸   r\   c                 C   s   t | |du rdn||j||ƒS )a<  Creates a secure asynchronous Channel to a server.

    Args:
      target: The server address.
      credentials: A ChannelCredentials instance.
      options: An optional list of key-value pairs (:term:`channel_arguments`
        in gRPC Core runtime) to configure the channel.
      compression: An optional value indicating the compression method to be
        used over the lifetime of the channel.
      interceptors: An optional sequence of interceptors that will be executed for
        any call executed with this channel.

    Returns:
      An aio.Channel.
    Nr*   )rp   Ú_credentials)ru   r\   rv   r.   rC   r*   r*   r+   Úsecure_channelU  s   ûrº   )NNN)?rP   r'   ÚsysÚtypingr   r   r   r   r   rV   r   r   r	   Úgrpc._cythonr
   Ú r   r   Ú_callr   r   r   r   Ú_interceptorr   r   r   r   r   r   r   r   r   Ú	_metadatar   Ú_typingr   r   r   r   r    r!   r"   Ú_utilsr#   ry   Ú__version__r2   Úversion_infor(   r,   rW   r6   r7   rY   rg   ri   ro   rp   r�   r¸   r¶   rº   r*   r*   r*   r+   Ú<module>   s¦   ÿ
ÿ
6ÿ
-ÿ
.ÿ
-ÿ- }üÿþý

ü ûÿþýü
û