o
    ýÞhü  ã                   @   sf   d dl mZ d dlmZ d dlmZ d dlmZ G dd„ dƒZG dd„ deƒZ	G d	d
„ d
eƒZ
dZdS )é    )ÚEnumMeta)Údescriptor_pb2)ÚEnumTypeWrapper)Ú	ProtoTypec                	   @   sx   e Zd ZdZdZddddddœdedededefd	d
„Ze	dd„ ƒZ
e	defdd„ƒZe	defdd„ƒZe	dd„ ƒZdS )ÚFieldz8A representation of a type of field in protocol buffers.FN)ÚmessageÚenumÚoneofÚ	json_nameÚoptionalÚnumberr	   r
   r   c                C   sn   d | _ d | _t|tƒst|ttfƒr|}tj}n|}tj}|| _	|| _
|| _|| _|| _|| _|| _d | _d S )N)Ú	mcls_dataÚparentÚ
isinstanceÚintr   r   r   ÚENUMÚMESSAGEr   Ú
proto_typer   r   r
   r   r	   Ú_descriptor)Úselfr   r   r   r   r	   r
   r   © r   úL/var/www/html/premium_crap/venv/lib/python3.10/site-packages/proto/fields.pyÚ__init__   s    

zField.__init__c              	   C   sø   | j syd}t| jtƒr | j | j¡sdj| j| jd�| _| j}nB| jr4t| jdƒr.| jjj	n| jj
j	}n.t| jtƒrO| j | j¡sKdj| j| jd�| _| j}n| jrbt| jdƒr]| jjj	n| jj
j	}tj| j| j| jrmdnd| j|| j| jd�| _ | j S )z$Return the descriptor for the field.Nz{package}.{name})ÚpackageÚnameÚ
DESCRIPTORé   é   )r   r   ÚlabelÚtypeÚ	type_namer
   Úproto3_optional)r   r   r   ÚstrÚ
startswithr   ÚformatÚhasattrr   Ú	full_nameÚ_metar   r   ÚFieldDescriptorProtor   r   Úrepeatedr   r
   r   )r   r    r   r   r   Ú
descriptorH   sH   þ
ÿýþ
ÿýùzField.descriptorÚreturnc                 C   ó
   | j d S )zReturn the name of the field.r   ©r   ©r   r   r   r   r   w   ó   
z
Field.namec                 C   r,   )z Return the package of the field.r   r-   r.   r   r   r   r   |   r/   zField.packagec                 C   s4   | j r| j S | js| jS t| jdƒr| j ¡ S | jS )zMReturn the composite type of the field, or the primitive type if a primitive.r'   )r   r   r   r%   Úpbr.   r   r   r   Úpb_type�   s   
zField.pb_type)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r)   r   r"   Úboolr   Úpropertyr*   r   r   r1   r   r   r   r   r      s2    ÷üùø	
÷*
.r   c                   @   s   e Zd ZdZdZdS )ÚRepeatedFieldz9A representation of a repeated field in protocol buffers.TN)r2   r3   r4   r5   r)   r   r   r   r   r8   “   s    r8   c                       s.   e Zd ZdZdddœdef‡ fdd„Z‡  ZS )ÚMapFieldz4A representation of a map field in protocol buffers.N)r   r   r   c                   s   t ƒ j||||d� || _d S )N)r   r   r   )Úsuperr   Úmap_key_type)r   Úkey_typeÚ
value_typer   r   r   ©Ú	__class__r   r   r   œ   s   
zMapField.__init__)r2   r3   r4   r5   r   r   Ú__classcell__r   r   r>   r   r9   ™   s    "r9   )r   r9   r8   N)r   r   Úgoogle.protobufr   Ú*google.protobuf.internal.enum_type_wrapperr   Úproto.primitivesr   r   r8   r9   Ú__all__r   r   r   r   Ú<module>   s   |