o
    ~j6h                     @   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 )zReturns 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   a/var/www/html/chefvision.cloud.itp360.com/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   "