Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/site-packages/proto/marshal/rules/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/site-packages/proto/marshal/rules/__pycache__/struct.cpython-38.pyc
U

O��gj�@sZddlZddlmZddlmZddlmZGdd�d�ZGdd�d�ZGd	d
�d
�Z	dS)�N)�
struct_pb2)�maps)�repeatedc@s<eZdZdZdd�Zdd�ed�dd�Zejd�d	d
�Z	dS)�	ValueRulezBA rule to marshal between google.protobuf.Value and Python values.cCs
||_dS�N��_marshal��self�marshal�r�G/opt/cppython/lib/python3.8/site-packages/proto/marshal/rules/struct.py�__init__szValueRule.__init__N��absentcCs�|�d�}|dks|rdS|dkr,t|j�S|dkr>t|j�S|dkrPt|j�S|dkrn|jjt	j
|jdd	�S|d
kr�|jjt	j|j
dd	�Std|��dS)aBCoerce the given value to the appropriate Python type.

        Note that both NullValue and absent fields return None.
        In order to disambiguate between these two options,
        use containment check,
        E.g.
        "value" in foo
        which is True for NullValue and False for an absent value.
        �kind�
null_valueN�
bool_value�number_value�string_value�struct_valueFr�
list_valuezUnexpected kind: %s)Z
WhichOneof�boolr�floatr�strrr�	to_pythonr�Structr�	ListValuer�
ValueError)r
�valuerrrrr
rs,




��zValueRule.to_python��returncCs�t|tj�r|S|dkr$tjdd�St|t�r:tj|d�St|ttf�rXtjt|�d�St|t�rntj|d�St|tjj	�r�tj|j
�tj|�d�St|tjj
�r�tj|j
�tj|�d�Std	|��dS)
z7Return a protobuf Value object representing this value.Nr)r)r)r)r)r)rzUnable to coerce value: %r)�
isinstancer�Valuer�intrr�collections�abc�Sequencer�to_protor�Mappingrr�r
rrrr
r(@s&

��zValueRule.to_proto)
�__name__�
__module__�__qualname__�__doc__rrrrr#r(rrrr
rs#rc@s<eZdZdZdd�Zdd�ed�dd�Zejd�d	d
�Z	dS)�
ListValueRulezCA rule translating google.protobuf.ListValue and list-like objects.cCs
||_dSrrr	rrr
rZszListValueRule.__init__NrcCs|rdStj|j|jd�S)z,Coerce the given value to a Python sequence.N�r)r�RepeatedComposite�valuesr�r
rrrrr
r]s��zListValueRule.to_pythonr csNt|tj�r|St|tj�r4tjdd�|jD�d�Stj�fdd�|D�d�S)NcSsg|]}|�qSrr��.0�vrrr
�
<listcomp>ksz*ListValueRule.to_proto.<locals>.<listcomp>)r2csg|]}�j�tj|��qSr�rr(rr#r4�r
rr
r7os)r"rrrr1�pbr*rr9r
r(es�zListValueRule.to_proto)
r+r,r-r.rrrrrr(rrrr
r/Wsr/c@s<eZdZdZdd�Zdd�ed�dd�Zejd�d	d
�Z	dS)�
StructRulez@A rule translating google.protobuf.Struct and dict-like objects.cCs
||_dSrrr	rrr
rvszStructRule.__init__NrcCs|rdStj|j|jd�S)z+Coerce the given value to a Python mapping.Nr0)r�MapComposite�fieldsrr3rrr
rys�zStructRule.to_pythonr csZt|tj�r|St|tj�r8tjdd�|j��D�d�Stj�fdd�|��D�d�}|S)NcSsi|]\}}||�qSrr�r5�kr6rrr
�
<dictcomp>�sz'StructRule.to_proto.<locals>.<dictcomp>)r=cs"i|]\}}|�j�tj|��qSrr8r>r9rr
r@�s)r"rrrr<r:�items)r
rZanswerrr9r
r(s�
��zStructRule.to_proto)
r+r,r-r.rrrrrr(rrrr
r;ssr;)
�collections.abcr%Zgoogle.protobufrZproto.marshal.collectionsrrrr/r;rrrr
�<module>s@

F1le Man4ger