o
    Þ­jÔ  ã                   @   sN   d Z ddlmZ ddlmZ ddlmZ ddlmZ dejfdd	„Z	d	gZ
d
S )z;Reference implementation for status mapping in gRPC Python.é    )Ú
status_pb2)Úaioé   )ÚGRPC_DETAILS_METADATA_KEY)Úcode_to_grpc_status_codeÚcallc                 Ã   s¨   �|   ¡ I dH }|  ¡ I dH }|  ¡ I dH }|du rdS |D ]3\}}|tkrQtj |¡}|jd |j kr?tdt	|j ƒ|f ƒ‚||j
krMtd|j
|f ƒ‚|  S qdS )zúReturns a google.rpc.status.Status message from a given grpc.aio.Call.

    This is an EXPERIMENTAL API.

    Args:
      call: An grpc.aio.Call instance.

    Returns:
      A google.rpc.status.Status message representing the status of the RPC.
    Nr   z8Code in Status proto (%s) doesn't match status code (%s)z>Message in Status proto (%s) doesn't match status details (%s))ÚcodeÚdetailsÚtrailing_metadatar   r   ÚStatusÚ
FromStringÚvalueÚ
ValueErrorr   Úmessage)r   r   r	   r
   Úkeyr   Úrich_status© r   úO/var/www/html/CropPilot/venv/lib/python3.10/site-packages/grpc_status/_async.pyÚ	from_call   s0   €ÿÿ
ÿÿôr   N)Ú__doc__Ú
google.rpcr   Úgrpc.experimentalr   Ú_commonr   r   ÚCallr   Ú__all__r   r   r   r   Ú<module>   s   "ÿ