o
    øÑÐbÄ€  ã                   @   s   d Z dZzddlmZ W n ey   ddlmZ Y nw ddlZddlZddlZddl	m
Z
 ddlZddlZddlZddlmZ ddlmZ ddlmZ d	ZeejjejjejjejjgƒZeejjejjgƒZeejjejjgƒZd
ZdZ dZ!e "e #d¡¡Z$e "d¡Z%G dd„ de&ƒZ'G dd„ de'ƒZ(G dd„ de'ƒZ)							d>dd„Z*					d?dd„Z+dd„ Z,G dd„ de-ƒZ.dd „ Z/d!d"„ Z0d#d$„ Z1d@d%d&„Z2		d@d'd(„Z3ej4e5f Z6G d)d*„ d*e-ƒZ7dAd+d,„Z8d-d.„ Z9d/d0„ Z:d1d2„ Z;d3d4gd5d6gd5d6gd7d8gd9d:gd5d6gd;d<gd=œZ<dS )Bat  Contains routines for printing protocol messages in JSON format.

Simple usage example:

  # Create a proto object and serialize it to a json format string.
  message = my_proto_pb2.MyMessage(foo='bar')
  json_string = json_format.MessageToJson(message)

  # Parse a json format string to proto object.
  message = json_format.Parse(json_string, my_proto_pb2.MyMessage())
zjieluo@google.com (Jie Luo)é    )ÚOrderedDictN)Úmethodcaller)Útype_checkers)Ú
descriptor)Úsymbol_databasez%Y-%m-%dT%H:%M:%SÚInfinityz	-InfinityÚNaNzF[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]z\[[a-zA-Z0-9\._]*\]$c                   @   ó   e Zd ZdZdS )ÚErrorz'Top-level module error for json_format.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   úZ/var/www/secure340b-portal/env/lib/python3.10/site-packages/google/protobuf/json_format.pyr
   X   ó    r
   c                   @   r	   )ÚSerializeToJsonErrorz&Thrown if serialization to JSON fails.Nr   r   r   r   r   r   \   r   r   c                   @   r	   )Ú
ParseErrorz Thrown in case of parsing error.Nr   r   r   r   r   r   `   r   r   Fé   c           	      C   s    t |||||d}| | ||¡S )aR  Converts protobuf message to JSON format.

  Args:
    message: The protocol buffers message instance to serialize.
    including_default_value_fields: If True, singular primitive fields,
        repeated fields, and map fields will always be serialized.  If
        False, only serialize non-empty fields.  Singular message fields
        and oneof fields are not affected by this option.
    preserving_proto_field_name: If True, use the original proto field
        names as defined in the .proto file. If False, convert the field
        names to lowerCamelCase.
    indent: The JSON object will be pretty-printed with this indent level.
        An indent level of 0 or negative will only insert newlines.
    sort_keys: If True, then the output will be sorted by field names.
    use_integers_for_enums: If true, print integers instead of enum names.
    descriptor_pool: A Descriptor Pool for resolving types. If None use the
        default.
    float_precision: If set, use this to specify float field valid digits.

  Returns:
    A string containing the JSON formatted protocol buffer message.
  ©Úfloat_precision)Ú_PrinterÚToJsonString)	ÚmessageÚincluding_default_value_fieldsÚpreserving_proto_field_nameÚindentÚ	sort_keysÚuse_integers_for_enumsÚdescriptor_poolr   Úprinterr   r   r   ÚMessageToJsond   s   ûr"   c                 C   s   t |||||d}| | ¡S )a¿  Converts protobuf message to a dictionary.

  When the dictionary is encoded to JSON, it conforms to proto3 JSON spec.

  Args:
    message: The protocol buffers message instance to serialize.
    including_default_value_fields: If True, singular primitive fields,
        repeated fields, and map fields will always be serialized.  If
        False, only serialize non-empty fields.  Singular message fields
        and oneof fields are not affected by this option.
    preserving_proto_field_name: If True, use the original proto field
        names as defined in the .proto file. If False, convert the field
        names to lowerCamelCase.
    use_integers_for_enums: If true, print integers instead of enum names.
    descriptor_pool: A Descriptor Pool for resolving types. If None use the
        default.
    float_precision: If set, use this to specify float field valid digits.

  Returns:
    A dict representation of the protocol buffer message.
  r   )r   Ú_MessageToJsonObject)r   r   r   r   r    r   r!   r   r   r   ÚMessageToDictŒ   s   û
r$   c                 C   s"   | j tjjko| jjo| j ¡ jS ©N)Útyper   ÚFieldDescriptorZTYPE_MESSAGEÚmessage_typeZhas_optionsZ
GetOptionsZ	map_entry)Úfieldr   r   r   Ú_IsMapEntry²   s
   ÿ
þr*   c                   @   st   e Zd ZdZ					ddd„Zdd„ Zdd	„ Zd
d„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ ZdS )r   z)JSON format printer for protocol message.FNc                 C   s6   || _ || _|| _|| _|rd |¡| _d S d | _d S )Nz.{}g)r   r   r   r    ÚformatÚfloat_format)Úselfr   r   r   r    r   r   r   r   Ú__init__»   s   
z_Printer.__init__c                 C   s   |   |¡}tj|||dS )N)r   r   )r#   ÚjsonÚdumps)r-   r   r   r   Újsr   r   r   r   Ë   s   
z_Printer.ToJsonStringc                 C   sL   |j }|j}t|ƒr|  |¡S |tv rtt| d |ƒ| ƒS i }|  ||¡S )zEConverts message to an object according to Proto3 JSON Specification.r   )Ú
DESCRIPTORÚ	full_nameÚ_IsWrapperMessageÚ_WrapperMessageToJsonObjectÚ_WKTJSONMETHODSr   Ú_RegularMessageToJsonObject)r-   r   Úmessage_descriptorr3   r1   r   r   r   r#   Ï   s   
z_Printer._MessageToJsonObjectc              
      s°  |  ¡ }z¾|D ]j\‰ }ˆjrˆ j}nˆ j}tˆ ƒrDˆ jjd }i }|D ]}t|tƒr2|r/d}	nd}	n|}	ˆ 	||| ¡||	< q#|||< qˆ j
tjjkrX‡ ‡fdd„|D ƒ||< qˆ jridˆ j }ˆ 	ˆ |¡||< qˆ 	ˆ |¡||< qˆjr½|j}
|
jD ]D‰ ˆ j
tjjkr‹ˆ jtjjksŽˆ jrq{ˆjr–ˆ j}nˆ j}||v ržq{tˆ ƒr§i ||< q{ˆ j
tjjkr³g ||< q{ˆ 	ˆ ˆ j¡||< q{W |S W |S  ty× } z	td ˆ j|¡ƒ‚d}~ww )	z?Converts normal message according to Proto3 JSON Specification.ÚvalueÚtrueÚfalsec                    s   g | ]}ˆ  ˆ |¡‘qS r   )Ú_FieldToJsonObject)Ú.0Úk©r)   r-   r   r   Ú
<listcomp>õ   s    ÿz8_Printer._RegularMessageToJsonObject.<locals>.<listcomp>z[%s]z#Failed to serialize {0} field: {1}.N)Ú
ListFieldsr   ÚnameÚ	json_namer*   r(   Úfields_by_nameÚ
isinstanceÚboolr<   Úlabelr   r'   ÚLABEL_REPEATEDÚis_extensionr3   r   r2   ÚfieldsÚcpp_typeÚCPPTYPE_MESSAGEÚcontaining_oneofÚdefault_valueÚ
ValueErrorr   r+   )r-   r   r1   rJ   r9   rB   Zv_fieldZjs_mapÚkeyZrecorded_keyr8   Úer   r?   r   r7   Ú   sp   

ÿ
ÿ

ÿþ

ìèüÿ€ÿz$_Printer._RegularMessageToJsonObjectc                 C   s2  |j tjjkr|  |¡S |j tjjkr;| jr|S |jjdkr dS |jj	 
|d¡}|dur/|jS |jjdkr7|S tdƒ‚|j tjjkrS|jtjjkrQt |¡ d¡S |S |j tjjkr^t|ƒS |j tv rgt|ƒS |j tv r—t |¡ry|dk rwtS tS t |¡r€tS |j tjj kr—| j!r’t"t#|| j!ƒƒS t$ %|¡S |S )z<Converts field value according to Proto3 JSON Specification.úgoogle.protobuf.NullValueNÚproto3zKEnum field contains an integer value which can not mapped to an enum value.úutf-8g        )&rK   r   r'   rL   r#   ÚCPPTYPE_ENUMr   Ú	enum_typer3   Úvalues_by_numberÚgetrB   ÚfileÚsyntaxr   ÚCPPTYPE_STRINGr&   Ú
TYPE_BYTESÚbase64Ú	b64encodeÚdecodeÚCPPTYPE_BOOLrF   Ú_INT64_TYPESÚstrÚ_FLOAT_TYPESÚmathÚisinfÚ_NEG_INFINITYÚ	_INFINITYÚisnanÚ_NANÚCPPTYPE_FLOATr,   Úfloatr+   r   ZToShortestFloat)r-   r)   r9   Ú
enum_valuer   r   r   r<     sB   





z_Printer._FieldToJsonObjectc                 C   s   |  ¡ si S tƒ }|j}||d< t|| jƒ}| |j¡ |j}|j}t	|ƒr/|  
|¡|d< |S |tv rBtt| d |ƒ| ƒ|d< |S |  ||¡S )z<Converts Any message according to Proto3 JSON Specification.ú@typer9   r   )rA   r   Útype_urlÚ_CreateMessageFromTypeUrlr    ZParseFromStringr9   r2   r3   r4   r5   r6   r   r7   )r-   r   r1   rn   Úsub_messager8   r3   r   r   r   Ú_AnyMessageToJsonObjectE  s(   ÿÿz _Printer._AnyMessageToJsonObjectc                 C   s   |  ¡ S )z8Converts message according to Proto3 JSON Specification.)r   ©r-   r   r   r   r   Ú_GenericMessageToJsonObjectZ  s   z$_Printer._GenericMessageToJsonObjectc                 C   sd   |  d¡}|du s|dkrdS |dkr|  |j¡S |dkr!|j}nt||ƒ}|jj| }|  ||¡S )z>Converts Value message according to Proto3 JSON Specification.ÚkindNÚ
null_valueÚ
list_valueÚstruct_value)Z
WhichOneofÚ_ListValueMessageToJsonObjectrv   rw   Úgetattrr2   rD   r<   )r-   r   Úwhichr9   Zoneof_descriptorr   r   r   Ú_ValueMessageToJsonObject`  s   

z"_Printer._ValueMessageToJsonObjectc                    s   ‡ fdd„|j D ƒS )zBConverts ListValue message according to Proto3 JSON Specification.c                    s   g | ]}ˆ   |¡‘qS r   )r{   )r=   r9   ©r-   r   r   r@   r  s    ÿz:_Printer._ListValueMessageToJsonObject.<locals>.<listcomp>)Úvaluesrr   r   r|   r   rx   p  s   
ÿz&_Printer._ListValueMessageToJsonObjectc                 C   s*   |j }i }|D ]}|  || ¡||< q|S )z?Converts Struct message according to Proto3 JSON Specification.)rJ   r{   )r-   r   rJ   ÚretrP   r   r   r   Ú_StructMessageToJsonObjectu  s
   z#_Printer._StructMessageToJsonObjectc                 C   s   |   |jjd |j¡S )Nr9   )r<   r2   rD   r9   rr   r   r   r   r5   }  s   ÿz$_Printer._WrapperMessageToJsonObject©FFFNN)r   r   r   r   r.   r   r#   r7   r<   rq   rs   r{   rx   r   r5   r   r   r   r   r   ¸   s$    
ú@+r   c                 C   s   | j jdkS )Nzgoogle/protobuf/wrappers.proto)rY   rB   )r8   r   r   r   r4   ‚  s   r4   c                 C   s4   i }| D ]\}}||v rt d |¡ƒ‚|||< q|S )Nz'Failed to load JSON: duplicate key {0}.)r   r+   )r1   ÚresultrB   r9   r   r   r   Ú_DuplicateChecker†  s   
r‚   c                 C   sd   t  ¡ }|du r|jn|}|  d¡d }z| |¡}W n ty)   td | ¡ƒ‚w | |¡}|ƒ S )z"Creates a message from a type URL.Nú/éÿÿÿÿz1Can not find message descriptor by type_url: {0}.)	r   ZDefaultÚpoolÚsplitZFindMessageTypeByNameÚKeyErrorÚ	TypeErrorr+   ZGetPrototype)rn   r    Údbr…   Ú	type_namer8   Zmessage_classr   r   r   ro     s   ÿÿ
ro   c              
   C   sb   t | tjƒs|  d¡} z	tj| td}W n ty) } z	td 	t
|ƒ¡ƒ‚d}~ww t||||ƒS )a¿  Parses a JSON representation of a protocol message into a message.

  Args:
    text: Message JSON representation.
    message: A protocol buffer message to merge into.
    ignore_unknown_fields: If True, do not raise errors for unknown fields.
    descriptor_pool: A Descriptor Pool for resolving types. If None use the
        default.

  Returns:
    The same message passed as argument.

  Raises::
    ParseError: On JSON parsing problems.
  rT   )Úobject_pairs_hookzFailed to load JSON: {0}.N)rE   ÚsixÚ	text_typer_   r/   Úloadsr‚   rO   r   r+   rb   Ú	ParseDict)Útextr   Úignore_unknown_fieldsr    r1   rQ   r   r   r   ÚParse  s   €ÿr’   c                 C   s   t ||ƒ}| | |¡ |S )a‰  Parses a JSON dictionary representation into a message.

  Args:
    js_dict: Dict representation of a JSON message.
    message: A protocol buffer message to merge into.
    ignore_unknown_fields: If True, do not raise errors for unknown fields.
    descriptor_pool: A Descriptor Pool for resolving types. If None use the
      default.

  Returns:
    The same message passed as argument.
  )Ú_ParserÚConvertMessage)Zjs_dictr   r‘   r    Úparserr   r   r   r   µ  s   
r   c                   @   s`   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ ZdS )r“   z(JSON format parser for protocol message.c                 C   s   || _ || _d S r%   )r‘   r    )r-   r‘   r    r   r   r   r.   Ð  s   
z_Parser.__init__c                 C   sX   |j }|j}t|ƒr|  ||¡ dS |tv r$tt| d ||ƒ| ƒ dS |  ||¡ dS )zÒConvert a JSON object into a message.

    Args:
      value: A JSON object.
      message: A WKT or regular protocol message to record the data.

    Raises:
      ParseError: In case of convert problems.
    é   N)r2   r3   r4   Ú_ConvertWrapperMessager6   r   Ú_ConvertFieldValuePair)r-   r9   r   r8   r3   r   r   r   r”   Ô  s   
z_Parser.ConvertMessagec                 C   s¼  g }|j }tdd„ |jD ƒƒ}|D ]É}zz| |d¡}|s%|j |d¡}|sWt |¡rW|js7td 	|j
¡ƒ‚|dd… }|j |¡}|sWd | d¡dd… ¡}|j |¡}|sn| jr^W qtd 	|j
|d	d
„ |jD ƒ¡ƒ‚||v r|td 	|j j
|¡ƒ‚| |¡ || }	|jdur¥|	dur¥|jj}
|
|v r td 	|j j
|
¡ƒ‚| |
¡ |	du rÝ|jtjjkrÀ|jj
dkrÀt||jƒ}d|_n|jtjjkrÕ|jj
dkrÕt||jdƒ n| |j¡ W qt|ƒrï| |j¡ |  |	||¡ nŸ|j tjj!krT| |j¡ t"|	t#ƒstd 	||	¡ƒ‚|jtjjkr8|	D ]!}t||jƒ $¡ }|du r/|j j
dkr/tdƒ‚|  %||¡ qnV|	D ]}|du rEtdƒ‚t||jƒ t&||ƒ¡ q:n:|jtjjkrw|j'rf|j| }nt||jƒ}| (¡  |  %|	|¡ n|j'r„t&|	|ƒ|j|< n
t||jt&|	|ƒƒ W q ty³ } z|r©|jdu r©td 	||¡ƒ‚tt)|ƒƒ‚d}~w t*yÇ } ztd 	||¡ƒ‚d}~w t+yÛ } ztd 	||¡ƒ‚d}~ww dS )zöConvert field value pairs into regular message.

    Args:
      js: A JSON object to convert the field value pairs.
      message: A regular protocol message to record the data.

    Raises:
      ParseError: In case of problems converting.
    c                 s   s    | ]}|j |fV  qd S r%   ©rC   ©r=   Úfr   r   r   Ú	<genexpr>ó  s   € ÿz1_Parser._ConvertFieldValuePair.<locals>.<genexpr>Nz)Message type {0} does not have extensionsr–   r„   Ú.zVMessage type "{0}" has no field named "{1}".
 Available Fields(except extensions): {2}c                 S   s   g | ]}|j ‘qS r   r™   rš   r   r   r   r@     s    z2_Parser._ConvertFieldValuePair.<locals>.<listcomp>z9Message type "{0}" should not have multiple "{1}" fields.z?Message type "{0}" should not have multiple "{1}" oneof fields.úgoogle.protobuf.Valuer   rR   z.repeated field {0} must be in [] which is {1}.zAnull is not allowed to be used as an element in a repeated field.zFailed to parse {0} field: {1}.),r2   ÚdictrJ   rX   rD   Ú_VALID_EXTENSION_NAMEÚmatchZis_extendabler   r+   r3   Z
ExtensionsZ_FindExtensionByNameÚjoinr†   r‘   ÚappendrM   rB   rK   r   r'   rL   r(   ry   ru   rU   rV   ÚsetattrÚ
ClearFieldr*   Ú_ConvertMapFieldValuerG   rH   rE   ÚlistÚaddr”   Ú_ConvertScalarFieldValuerI   ZSetInParentrb   rO   rˆ   )r-   r1   r   Únamesr8   Zfields_by_json_namerB   r)   Ú
identifierr9   Z
oneof_namerp   ÚitemrQ   r   r   r   r˜   ç  sÖ   
ÿ
ÿþþÿÿ
ÿÿ

ÿ
ÿÿ

ÿù

ÿü€€€€ÿ›z_Parser._ConvertFieldValuePairc                 C   s¼   t |tƒr	|s	dS z|d }W n ty   tdƒ‚w t|| jƒ}|j}|j}t|ƒr4|  	|d |¡ n |t
v rGtt
| d |d |ƒ| ƒ n|d= |  ||¡ ||d< | ¡ |_||_dS )z/Convert a JSON representation into Any message.Nrm   z*@type is missing when parsing any message.r9   r–   )rE   rŸ   r‡   r   ro   r    r2   r3   r4   r—   r6   r   r˜   ZSerializeToStringr9   rn   )r-   r9   r   rn   rp   r8   r3   r   r   r   Ú_ConvertAnyMessage]  s.   ÿÿÿ

z_Parser._ConvertAnyMessagec              
   C   s2   z|  |¡ W dS  ty } zt|ƒ‚d}~ww )z?Convert a JSON representation into message with FromJsonString.N)ZFromJsonStringrO   r   )r-   r9   r   rQ   r   r   r   Ú_ConvertGenericMessagev  s   €ÿz_Parser._ConvertGenericMessagec                 C   sœ   t |tƒr|  ||j¡ dS t |tƒr|  ||j¡ dS |du r%d|_dS t |tƒr/||_	dS t |t
jƒr:||_dS t |tƒrD||_dS td |t|ƒ¡ƒ‚)z1Convert a JSON representation into Value message.Nr   z"Value {0} has unexpected type {1}.)rE   rŸ   Ú_ConvertStructMessagerw   r§   Ú_ConvertListValueMessagerv   ru   rF   Z
bool_valuerŒ   Ústring_typesZstring_valueÚ_INT_OR_FLOATZnumber_valuer   r+   r&   )r-   r9   r   r   r   r   Ú_ConvertValueMessage  s   







ÿz_Parser._ConvertValueMessagec                 C   sB   t |tƒstd |¡ƒ‚| d¡ |D ]}|  ||j ¡ ¡ qdS )z5Convert a JSON representation into ListValue message.z%ListValue must be in [] which is {0}.r}   N)rE   r§   r   r+   r¥   r³   r}   r¨   )r-   r9   r   r¬   r   r   r   r°   ‘  s   
ÿ
ÿz _Parser._ConvertListValueMessagec                 C   sD   t |tƒstd |¡ƒ‚| ¡  |D ]}|  || |j| ¡ qdS )z2Convert a JSON representation into Struct message.z&Struct must be in a dict which is {0}.N)rE   rŸ   r   r+   ZClearr³   rJ   )r-   r9   r   rP   r   r   r   r¯   š  s   
ÿz_Parser._ConvertStructMessagec                 C   s"   |j jd }t|dt||ƒƒ dS )z3Convert a JSON representation into Wrapper message.r9   N)r2   rD   r¤   r©   )r-   r9   r   r)   r   r   r   r—   ¦  s   z_Parser._ConvertWrapperMessagec                 C   s”   t |tƒstd |j|¡ƒ‚|jjd }|jjd }|D ]+}t||dƒ}|jt	j
jkr:|  || t||jƒ| ¡ qt|| |ƒt||jƒ|< qdS )a5  Convert map field value for a message map field.

    Args:
      value: A JSON object to convert the map field value.
      message: A protocol message to record the converted data.
      field: The descriptor of the map field to be converted.

    Raises:
      ParseError: In case of convert problems.
    z-Map field {0} must be in a dict which is {1}.rP   r9   TN)rE   rŸ   r   r+   rB   r(   rD   r©   rK   r   r'   rL   r”   ry   )r-   r9   r   r)   Z	key_fieldZvalue_fieldrP   Ú	key_valuer   r   r   r¦   «  s(   
ÿÿÿÿÿúz_Parser._ConvertMapFieldValueN)r   r   r   r   r.   r”   r˜   r­   r®   r³   r°   r¯   r—   r¦   r   r   r   r   r“   Í  s    v		r“   c                 C   sJ  |j tv r	t| ƒS |j tv rt| |ƒS |j tjjkrt| |ƒS |j tjj	krW|j
tjjkrLt| tjƒr9|  d¡}n| }|ddt|ƒd    }t |¡S t | ¡rUtdƒ‚| S |j tjjkr£|jj | d¡}|du r zt| ƒ}|jj |d¡}W n ty‰   td | |jj¡ƒ‚w |du r |jj dkr–|S td | |jj¡ƒ‚|j!S dS )aB  Convert a single scalar field value.

  Args:
    value: A scalar value to convert the scalar field value.
    field: The descriptor of the field to convert.
    require_str: If True, the field value must be a str.

  Returns:
    The converted scalar field value

  Raises:
    ParseError: In case of convert problems.
  rT   ó   =é   zUnpaired surrogateNz)Invalid enum value {0} for enum type {1}.rS   )"rK   Ú
_INT_TYPESÚ_ConvertIntegerrc   Ú_ConvertFloatr   r'   r`   Ú_ConvertBoolr[   r&   r\   rE   rŒ   r   ÚencodeÚlenr]   Úurlsafe_b64decodeÚ_UNPAIRED_SURROGATE_PATTERNÚsearchr   rU   rV   Zvalues_by_namerX   ÚintrW   rO   r+   r3   rY   rZ   Únumber)r9   r)   Úrequire_strÚencodedZpadded_valuerl   rÁ   r   r   r   r©   Æ  sF   





ÿÿÿðr©   c                 C   sh   t | tƒr|  ¡ std | ¡ƒ‚t | tjƒr$|  d¡dkr$td | ¡ƒ‚t | tƒr0td | ¡ƒ‚t	| ƒS )z§Convert an integer.

  Args:
    value: A scalar value to convert.

  Returns:
    The integer value.

  Raises:
    ParseError: If an integer couldn't be consumed.
  zCouldn't parse integer: {0}.ú r„   zCouldn't parse integer: "{0}".z3Bool value {0} is not acceptable for integer field.)
rE   rk   Ú
is_integerr   r+   rŒ   r   ÚfindrF   rÀ   )r9   r   r   r   r¸   ü  s   
ÿr¸   c                 C   sä   t | tƒr8t | ¡rtdƒ‚t | ¡r| dkrtdƒ‚tdƒ‚|jtjj	kr8| t
jkr/tdƒ‚| t
jk r8tdƒ‚| dkr@tdƒ‚zt| ƒW S  tyq   | tkrVtd	ƒ Y S | tkr`td
ƒ Y S | tkrjtdƒ Y S td | ¡ƒ‚w )z!Convert an floating point number.z-Couldn't parse NaN, use quoted "NaN" instead.r   zJCouldn't parse Infinity or value too large, use quoted "Infinity" instead.zLCouldn't parse -Infinity or value too small, use quoted "-Infinity" instead.zFloat value too largezFloat value too smallÚnanz.Couldn't parse float "nan", use "NaN" instead.z-infÚinfzCouldn't parse float: {0}.)rE   rk   rd   rh   r   re   rK   r   r'   rj   r   Z
_FLOAT_MAXZ
_FLOAT_MINrO   rf   rg   ri   r+   )r9   r)   r   r   r   r¹     s2   





÷r¹   c                 C   s@   |r| dkrdS | dkrdS t d | ¡ƒ‚t| tƒst dƒ‚| S )zÞConvert a boolean value.

  Args:
    value: A scalar value to convert.
    require_str: If True, value must be a str.

  Returns:
    The bool parsed.

  Raises:
    ParseError: If a boolean value couldn't be consumed.
  r:   Tr;   Fz$Expected "true" or "false", not {0}.z&Expected true or false without quotes.)r   r+   rE   rF   )r9   rÂ   r   r   r   rº   9  s   
rº   rq   r­   rs   r®   rx   r°   r   r¯   r{   r³   )zgoogle.protobuf.Anyzgoogle.protobuf.Durationzgoogle.protobuf.FieldMaskzgoogle.protobuf.ListValuezgoogle.protobuf.Structzgoogle.protobuf.Timestamprž   )FFr   FFNNr€   )FN)F)=r   Ú
__author__Úcollectionsr   ÚImportErrorZordereddictr]   r/   rd   Úoperatorr   ÚreÚsysrŒ   Zgoogle.protobuf.internalr   Zgoogle.protobufr   r   Z_TIMESTAMPFOMATÚ	frozensetr'   ZCPPTYPE_INT32ZCPPTYPE_UINT32ZCPPTYPE_INT64ZCPPTYPE_UINT64r·   ra   rj   ZCPPTYPE_DOUBLErc   rg   rf   ri   ÚcompileÚur¾   r    Ú	Exceptionr
   r   r   r"   r$   r*   Úobjectr   r4   r‚   ro   r’   r   Úinteger_typesrk   r²   r“   r©   r¸   r¹   rº   r6   r   r   r   r   Ú<module>   s¸   ÿýÿÿÿ

ø*
ú& K	

ý 
z6$ÿÿÿÿÿÿÿ
ó