File: //opt/cppython/lib/python3.8/site-packages/proto/marshal/rules/__pycache__/message.cpython-38.pyc
U
JD�g< � @ s G d d� d�Z dS )c @ sH e Zd ZdZeed�dd�Zdd�ed�dd�Zd d
� Ze dd� �Z
dS )
�MessageRulez@A marshal for converting between a descriptor and proto.Message.)�
descriptor�wrapperc C s || _ || _d S �N)�_descriptor�_wrapper)�selfr r � r �H/opt/cppython/lib/python3.8/site-packages/proto/marshal/rules/message.py�__init__ s zMessageRule.__init__N)�absentc C s t || j�r| j�|�S |S r )�
isinstancer r �wrap)r �valuer r r r � to_python s zMessageRule.to_pythonc
C st t || j�r| j�|�S t |t�rp| jspz| jf |�W S tttfk
rn } z| �|�j W Y �S d }~X Y nX |S r )
r r Zpb�dict�is_mapr � TypeError�
ValueError�AttributeErrorZ_pb)r r �exr r r �to_proto s "zMessageRule.to_protoc C s | j j}|jo|�� jS )z>Return True if the descriptor is a map entry, False otherwise.)r Z
DESCRIPTORZhas_optionsZ
GetOptionsZ map_entry)r �descr r r r 1 s zMessageRule.is_map)�__name__�
__module__�__qualname__�__doc__�typer
�boolr r �propertyr r r r r r s r N)r r r r r �<module> �