
    5?hP                     p   S r SrSSKrSSKJr  SSKrSSKrSSKJr  SSK	r	SSK
r
SSKJr  SSKJr  SSKJr  S	r\" \R$                  R&                  \R$                  R(                  \R$                  R*                  \R$                  R,                  /5      r\" \R$                  R*                  \R$                  R,                  /5      r\" \R$                  R2                  \R$                  R4                  /5      rS
rSrSr\	R>                  " S5      r \	R>                  " S5      r! " S S\"5      r# " S S\#5      r$ " S S\#5      r%        S0S jr&     S1S jr'S r( " S S\)5      r*S r+S r,S r-   S2S jr.   S2S jr/\0\14r2 " S S \)5      r3S3S! jr4S" r5S# r6S$ r7S%S&/S'S(/S'S(/S)S*/S+S,/S'S(/S-S./S/.r8g)4at  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)    N)OrderedDict)methodcaller)type_checkers)
descriptor)symbol_databasez%Y-%m-%dT%H:%M:%SInfinityz	-InfinityNaNu.   [-](?![-])|(?<![-])[-]z\[[a-zA-Z0-9\._]*\]$c                       \ rS rSrSrSrg)ErrorN   z'Top-level module error for json_format. N__name__
__module____qualname____firstlineno____doc____static_attributes__r       c/var/www/ev-aguas/ev-aguas-proceso/venv/lib/python3.13/site-packages/google/protobuf/json_format.pyr   r   N   s    /r   r   c                       \ rS rSrSrSrg)SerializeToJsonErrorR   z&Thrown if serialization to JSON fails.r   Nr   r   r   r   r   r   R   s    .r   r   c                       \ rS rSrSrSrg)
ParseErrorV   z Thrown in case of parsing error.r   Nr   r   r   r   r   r   V   s    (r   r   c	                 @    [        UUUUUS9n	U	R                  XXH5      $ )a  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.
  ensure_ascii: If True, strings with non-ASCII characters are escaped.
      If False, Unicode strings are returned unchanged.

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   ensure_asciiprinters
             r   MessageToJsonr+   Z   s3    D $!%'' 
		gy	GGr   c                 >    [        UUUUUS9nUR                  U 5      $ )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*   s          r   MessageToDictr.      s0    8 $!%'' 
	%	%g	..r   c                     U R                   [        R                  R                  :H  =(       aA    U R                  R
                  =(       a$    U R                  R                  5       R                  $ N)typer   FieldDescriptorTYPE_MESSAGEmessage_typehas_options
GetOptions	map_entry)fields    r   _IsMapEntryr9      sP    
**
22??
? 4



(
(4



'
'
)
3
35r   c                   h    \ rS rSrSr     SS jrS rS rS rS r	S	 r
S
 rS rS rS rS rSrg)r       z)JSON format printer for protocol message.Nc                 ~    Xl         X l        X0l        X@l        U(       a  SR	                  U5      U l        g S U l        g )Nz.{}g)r#   r$   r'   r(   formatfloat_format)selfr#   r$   r'   r(   r   s         r   __init___Printer.__init__   s9     +I''B$"8* --8ddr   c                 N    U R                  U5      n[        R                  " XRX4S9$ )N)r%   r&   r)   )r-   jsondumps)r?   r"   r%   r&   r)   jss         r   r!   _Printer.ToJsonString   s*    		"	"7	+B::
YK Kr   c                     UR                   nUR                  n[        U5      (       a  U R                  U5      $ U[        ;   a  [        [        U   S   U5      " U 5      $ 0 nU R                  X5      $ )zEConverts message to an object according to Proto3 JSON Specification.r   )
DESCRIPTOR	full_name_IsWrapperMessage_WrapperMessageToJsonObject_WKTJSONMETHODSr   _RegularMessageToJsonObject)r?   r"   message_descriptorrI   rE   s        r   r-   _Printer._MessageToJsonObject   sp     ++",,I+,,--g66O#/)4Q7A$GG	B++G88r   c                    UR                  5       n U GHC  u  pEU R                  (       a  UR                  nOUR                  n[	        U5      (       am  UR
                  R                  S   n0 nU HF  n	[        U	[        5      (       a  U	(       a  Sn
OSn
O[        U	5      n
U R                  XuU	   5      X'   MH     XU'   M  UR                  [        R                  R                  :X  a%  U Vs/ sH  nU R                  XK5      PM     snX&'   M  UR                  (       a%  SUR                   -  nU R                  XE5      X&'   GM0  U R                  XE5      X&'   GMF     U R"                  (       Ga  UR$                  nUR&                   H  nUR                  [        R                  R                  :w  a(  UR(                  [        R                  R*                  :X  d  UR,                  (       a  Mf  U R                  (       a  UR                  nOUR                  nXb;   a  M  [	        U5      (       a  0 X&'   M  UR                  [        R                  R                  :X  a  / X&'   M  U R                  XDR.                  5      X&'   M     U$ s  snf ! [0         a*  n[3        SR5                  WR                  U5      5      eSnAff = f)z?Converts normal message according to Proto3 JSON Specification.valuetruefalsez[%s]z#Failed to serialize {0} field: {1}.N)
ListFieldsr$   name	json_namer9   r4   fields_by_name
isinstanceboolstr_FieldToJsonObjectlabelr   r2   LABEL_REPEATEDis_extensionrI   r#   rH   fieldscpp_typeCPPTYPE_MESSAGEcontaining_oneofdefault_value
ValueErrorr   r=   )r?   r"   rE   r_   r8   rQ   rU   v_fieldjs_mapkeyrecorded_keykrN   es                 r   rM   $_Printer._RegularMessageToJsonObject   sH   !F8G ,%++$$u&&55g>'&c#t$$%& Xl#'#:#:s$%F   T([[J66EEE  %&$! --e7$&"(%//)$,,U:"(,,U:"(9 !> 
	,	,	,$//'..E{{j88GGG~~!;!;!K!KK$$--::D??DZBH{{j88GGGBH..u6I6IJBH% /0 IG&>  G 
/
6
6uzz1
EG GGs+   CJ	 -JE;J	 J	 	
J=%J88J=c                    UR                   [        R                  R                  :X  a  U R	                  U5      $ UR                   [        R                  R
                  :X  a  U R                  (       a  U$ UR                  R                  S:X  a  gUR                  R                  R                  US5      nUb  UR                  $ UR                  R                  S:X  a  U$ [        S5      eUR                   [        R                  R                  :X  aO  UR                   [        R                  R"                  :X  a%  [$        R&                  " U5      R)                  S5      $ U$ UR                   [        R                  R*                  :X  a  [-        U5      $ UR                   [.        ;   a  [1        U5      $ UR                   [2        ;   a  [4        R6                  " U5      (       a  US:  a  [8        $ [:        $ [4        R<                  " U5      (       a  [>        $ UR                   [        R                  R@                  :X  aE  U RB                  (       a  [E        [G        X RB                  5      5      $ [H        RJ                  " U5      $ U$ )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        )&r`   r   r2   ra   r-   CPPTYPE_ENUMr'   	enum_typerI   values_by_numbergetrU   filesyntaxr   CPPTYPE_STRINGr1   
TYPE_BYTESbase64	b64encodedecodeCPPTYPE_BOOLrY   _INT64_TYPESrZ   _FLOAT_TYPESmathisinf_NEG_INFINITY	_INFINITYisnan_NANCPPTYPE_FLOATr>   floatr=   r   ToShortestFloat)r?   r8   rQ   
enum_values       r   r[   _Printer._FieldToJsonObject  s   ~~33CCC&&u--	:55BB	B		$	$		"	"&A	A??3377tDj		::(," $L M 	M	:55DD	D	z11<<	<&--g66	:55BB	B%[	<	'Z	<	'	E		3;

	E			:55CC	Cve%6%678
8..u5
5Lr   c                    UR                  5       (       d  0 $ [        5       nUR                  nX2S'   [        X0R                  5      nUR                  UR                  5        UR                  nUR                  n[        U5      (       a  U R                  U5      US'   U$ U[        ;   a!  [        [        U   S   U5      " U 5      US'   U$ U R                  XB5      $ )z<Converts Any message according to Proto3 JSON Specification.@typerQ   r   )rT   r   type_url_CreateMessageFromTypeUrlr(   ParseFromStringrQ   rH   rI   rJ   rK   rL   r   rM   )r?   r"   rE   r   sub_messagerN   rI   s          r   _AnyMessageToJsonObject _Printer._AnyMessageToJsonObject?  s    i	BHwK+H6J6JKK.$//",,I+,,44[AbkiO# !;A!>!,..24bki++K<<r   c                 "    UR                  5       $ )z8Converts message according to Proto3 JSON Specification.)r!   r?   r"   s     r   _GenericMessageToJsonObject$_Printer._GenericMessageToJsonObjectT  s     !!r   c                 
   UR                  S5      nUb  US:X  a  gUS:X  a  U R                  UR                  5      $ US:X  a  UR                  nO[	        X5      nUR
                  R                  U   nU R                  XC5      $ )z>Converts Value message according to Proto3 JSON Specification.kindN
null_value
list_valuestruct_value)
WhichOneof_ListValueMessageToJsonObjectr   r   getattrrH   rW   r[   )r?   r"   whichrQ   oneof_descriptors        r   _ValueMessageToJsonObject"_Printer._ValueMessageToJsonObjectZ  s    v&E }-//0B0BCC""eg%e))88?""#3;;r   c                 b    UR                    Vs/ sH  nU R                  U5      PM     sn$ s  snf )zBConverts ListValue message according to Proto3 JSON Specification.)valuesr   )r?   r"   rQ   s      r   r   &_Printer._ListValueMessageToJsonObjectj  s8     !)' **51') ) )s   ,c                 ^    UR                   n0 nU H  nU R                  X$   5      X4'   M     U$ )z?Converts Struct message according to Proto3 JSON Specification.)r_   r   )r?   r"   r_   retrg   s        r   _StructMessageToJsonObject#_Printer._StructMessageToJsonObjecto  s3    ^^F
C//<ch Jr   c                 h    U R                  UR                  R                  S   UR                  5      $ )NrQ   )r[   rH   rW   rQ   r   s     r   rK   $_Printer._WrapperMessageToJsonObjectw  s1    ""))'2GMMC Cr   )r(   r>   r#   r$   r'   FFFNN)r   r   r   r   r   r@   r!   r-   rM   r[   r   r   r   r   r   rK   r   r   r   r   r    r       sQ    1 &+"'" K
	9>@)V=*"< )
Cr   r    c                 4    U R                   R                  S:H  $ )Nzgoogle/protobuf/wrappers.proto)rt   rU   )rN   s    r   rJ   rJ   |  s    		 	 	%	%)I	IIr   c                 f    0 nU  H(  u  p#X!;   a  [        SR                  U5      5      eX1U'   M*     U$ )Nz'Failed to load JSON: duplicate key {0}.)r   r=   )rE   resultrU   rQ   s       r   _DuplicateCheckerr     s=    &kd~@GGMNN4L  
-r   c                    [         R                  " 5       nUc  UR                  OUnU R                  S5      S   n UR	                  U5      nUR                  U5      nU" 5       $ ! [
         a    [        SR                  U 5      5      ef = f)z"Creates a message from a type URL./z0Can not find message descriptor by type_url: {0})	r   DefaultpoolsplitFindMessageTypeByNameKeyError	TypeErrorr=   GetPrototype)r   r(   dbr   	type_namerN   message_classs          r   r   r     s     "#+$nnS!"%)M33I> //"45-		 
 M
:AA(KM MMs   A% %%B
c                    [        U [        5      (       d  U R                  S5      n  [        R                  " U [
        S9n[        XQX#U5      $ ! [         a(  n[        SR                  [        U5      5      5      eSnAff = f)aP  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.
  max_recursion_depth: max recursion depth of JSON message to be
    deserialized. JSON messages over this depth will fail to be
    deserialized. Default value is 100.

Returns:
  The same message passed as argument.

Raises::
  ParseError: On JSON parsing problems.
ro   )object_pairs_hookzFailed to load JSON: {0}.N)
rX   rZ   rz   rC   loadsr   rd   r   r=   	ParseDict)textr"   ignore_unknown_fieldsr(   max_recursion_depthrE   rj   s          r   Parser     s|    . 
D#		;;wDA	D,=	>B 
2 5&
( ( 
 A
077A?
@@As   A 
B #A;;B c                 B    [        X#U5      nUR                  XS5        U$ )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.
  max_recursion_depth: max recursion depth of JSON message to be
    deserialized. JSON messages over this depth will fail to be
    deserialized. Default value is 100.

Returns:
  The same message passed as argument.
 )_ParserConvertMessage)js_dictr"   r   r(   r   parsers         r   r   r     s'    ( (;NO&"-	.r   c                   T    \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rSrg)r   i  z(JSON format parser for protocol message.c                 6    Xl         X l        X0l        SU l        g )Nr   )r   r(   r   recursion_depth)r?   r   r(   r   s       r   r@   _Parser.__init__  s    !6*2Dr   c                    U =R                   S-  sl         U R                   U R                  :  a$  [        SR                  U R                  5      5      eUR                  nUR
                  nU(       d  UR                  n[        U5      (       a  U R                  XU5        O:U[        ;   a  [        [        U   S   XU5      " U 5        OU R                  XU5        U =R                   S-  sl         g)zConvert a JSON object into a message.

Args:
  value: A JSON object.
  message: A WKT or regular protocol message to record the data.
  path: parent path to log parse error info.

Raises:
  ParseError: In case of convert problems.
   z,Message too deep. Max recursion depth is {0}N)r   r   r   r=   rH   rI   rU   rJ   _ConvertWrapperMessagerL   r   _ConvertFieldValuePair)r?   rQ   r"   pathrN   rI   s         r   r   _Parser.ConvertMessage  s     	Ad666ELL

"
"$ % % ++",,I$$d+,,
!!%$7	o	%?9-a0%$GM
!!%$7Ar   c                 j   / nUR                   n[        S UR                   5       5      nU GH  n UR                  US5      nU(       d  UR                  R                  US5      nU(       d  [
        R                  U5      (       a  UR                  (       d%  [        SR                  UR                  U5      5      eUSS n	UR                  R                  U	5      nU(       d>  SR                  U	R                  S5      SS 5      n	UR                  R                  U	5      nU(       d]  U R                  (       a  GM  [        SR                  UR                  XsUR                   V
s/ sH  oR                   PM     sn
5      5      eXt;   a/  [        SR                  UR                   R                  Xs5      5      eUR#                  U5        X   nUR$                  b_  Ub\  UR$                  R&                  nX;   a0  [        S	R                  UR                   R                  UU5      5      eUR#                  U5        Uc  UR(                  [*        R,                  R.                  :X  a7  UR0                  R                  S
:X  a  [3        X(R&                  5      nSUl        OtUR(                  [*        R,                  R6                  :X  a1  UR8                  R                  S:X  a  [;        X(R&                  S5        OUR=                  UR&                  5        GM  [?        U5      (       a@  UR=                  UR&                  5        U RA                  XUSR                  X75      5        GM8  URB                  [*        R,                  RD                  :X  Gaz  UR=                  UR&                  5        [G        U[H        5      (       d  [        SR                  X{U5      5      eUR(                  [*        R,                  R.                  :X  a  [K        U5       H  u  p[3        X(R&                  5      RM                  5       nUc5  UR                   R                  S
:w  a  [        SR                  X7U5      5      eU RO                  XSR                  X7U5      5        M     GMh  [K        U5       Ha  u  pUc  [        SR                  X7U5      5      e[3        X(R&                  5      R#                  [Q        XSR                  X7U5      5      5        Mc     GM  UR(                  [*        R,                  R.                  :X  aj  URR                  (       a  UR                  U   nO[3        X(R&                  5      nURU                  5         U RO                  XSR                  X75      5        GMm  URR                  (       a+  [Q        XSR                  X75      5      UR                  U'   GM  [;        X(R&                  [Q        XSR                  X75      5      5        GM     gs  sn
f ! [         aH  nW(       a(  UR$                  c  [        SR                  UU5      5      e[        [W        U5      5      eSnAf[X         a   n[        SR                  UU5      5      eSnAf[Z         a   n[        SR                  UU5      5      eSnAff = f)a  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.
  path: parent path to log parse error info.

Raises:
  ParseError: In case of problems converting.
c              3   <   #    U H  nUR                   U4v   M     g 7fr0   )rV   ).0fs     r   	<genexpr>1_Parser._ConvertFieldValuePair.<locals>.<genexpr>  s!      C(A1 !"Q/(As   Nz0Message type {0} does not have extensions at {1}r   r   .zaMessage type "{0}" has no field named "{1}" at "{2}".
 Available Fields(except extensions): "{3}"zBMessage type "{0}" should not have multiple "{1}" fields at "{2}".zHMessage type "{0}" should not have multiple "{1}" oneof fields at "{2}".google.protobuf.Valuer   rm   {0}.{1}z4repeated field {0} must be in [] which is {1} at {2}zPnull is not allowed to be used as an element in a repeated field at {0}.{1}[{2}]z{0}.{1}[{2}]zFailed to parse {0} field: {1}.).rH   dictr_   rs   rW   _VALID_EXTENSION_NAMEmatchis_extendabler   r=   rI   
Extensions_FindExtensionByNamejoinr   r   rV   appendrb   rU   r`   r   r2   ra   r4   r   r   rp   rq   setattr
ClearFieldr9   _ConvertMapFieldValuer\   r]   rX   list	enumerateaddr   _ConvertScalarFieldValuer^   SetInParentrZ   rd   r   )r?   rE   r"   r   namesrN   fields_by_json_namerU   r8   
identifierr   rQ   
oneof_namer   indexitemrj   s                    r   r   _Parser._ConvertFieldValuePair  s    E ++ C(:(A(AC CpL#''d3$3377dC%.44T::#11BII&00$89 9 Abz*$$99*E% *"2"23"7"<=J&&;;JGE''=>Df%//);)B)BC)BAKK)BC?EF F
 = 44:F&11;;T5IJ J 	T!!-%2C--22*  <<BF!(!3!3!=!=z!%='( ( ,,z
"=nn
 : : J JJ$$..2II!'::6K%&K"*"<"<"I"IIOO--1LLGZZ+uzz*
 u


UZZ
(

$
$UU%.%5%5d%AC[[J66EEE


UZZ
(E4(( **0&d*CE E^^z99III(/#GZZ8<<>k,((226MM  "HHN%)I89 9 !!$"0"7"7E"JL  0  )/  "HHN%)I89 9 gzz*11*>#8#8U#KMN  0 ^^z99III!,,U3K!'::6K

!
!
#


e)2B2B42N
O(@i..t:)<Gu% ()2)9)9$)EGHK 8 DZ  #U++3<CCD!LM
M3q6"
" L:AA$JKK L:AA$JKKLsr   D	X>*X(X<FXAX%D-XA0XBX9X/XX
Z2AYZ2*ZZ2Z--Z2c                    [        U[        5      (       a  U(       d  g US   n [        X@R                  5      nUR                  nUR                  n[        U5      (       a&  U R                  US   USR	                  U5      5        OTU[        ;   a1  [        [        U   S   US   USR	                  U5      5      " U 5        OUS	 U R                  XU5        XAS'   UR                  5       Ul        XBl        g! [         a    [        SR	                  U5      5      ef = f! [         a  n[        SR	                  Xc5      5      eSnAff = f)z/Convert a JSON representation into Any message.Nr   z0@type is missing when parsing any message at {0}
{0} at {1}rQ   	{0}.valuer   )rX   r   r   r   r=   r   r(   r   rH   rI   rJ   r   rL   r   r   SerializeToStringrQ   r   )	r?   rQ   r"   r   r   r   rj   rN   rI   s	            r   _ConvertAnyMessage_Parser._ConvertAnyMessage{  sH   %uKwh
5-h8L8LMk %//",,I+,,
!!%.+"-"4"4T":<	o	%?9-a0%.+%%d+- .
!!%d;Gn113GM/  K
<
C
CD
IK KK  5|**13445s"   C8 D  8%D 
E	*EE	c                      UR                  U5        g! [         a  n[        SR                  XC5      5      eSnAff = f)z?Convert a JSON representation into message with FromJsonString.r   N)FromJsonStringrd   r   r=   )r?   rQ   r"   r   rj   s        r   _ConvertGenericMessage_Parser._ConvertGenericMessage  s;    5U# 5|**13445s    
=8=c                    [        U[        5      (       a  U R                  XR                  U5        g[        U[        5      (       a  U R                  XR                  U5        gUc  SUl        g[        U[        5      (       a  Xl	        g[        U[        5      (       a  Xl        g[        U[        5      (       a  Xl        g[        SR                  U[!        U5      U5      5      e)z1Convert a JSON representation into Value message.Nr   z(Value {0} has unexpected type {1} at {2})rX   r   _ConvertStructMessager   r   _ConvertListValueMessager   r   rY   
bool_valuerZ   string_value_INT_OR_FLOATnumber_valuer   r=   r1   )r?   rQ   r"   r   s       r   _ConvertValueMessage_Parser._ConvertValueMessage  s    %
  (<(<dC	E4	 	 
##E+=+=tD	g	E4	 	  	E3		"	E=	)	)"AHH
ed$ % %r   c           	         [        U[        5      (       d  [        SR                  X5      5      eUR	                  S5        [        U5       H>  u  pEU R                  XRR                  R                  5       SR                  X45      5        M@     g)z5Convert a JSON representation into ListValue message.z+ListValue must be in [] which is {0} at {1}r   {0}[{1}]N)	rX   r   r   r=   r   r   r  r   r   )r?   rQ   r"   r   r   r   s         r   r    _Parser._ConvertListValueMessage  sx    eT""DKK
  x  '
nn&8&8&: * 1 1$ >@ (r   c           	          [        U[        5      (       d  [        SR                  X5      5      eUR	                  5         U H4  nU R                  X   UR                  U   SR                  X45      5        M6     g)z2Convert a JSON representation into Struct message.z,Struct must be in a dict which is {0} at {1}r   N)rX   r   r   r=   Clearr  r_   )r?   rQ   r"   r   rg   s        r   r   _Parser._ConvertStructMessage  sr    eT""ELL
   MMO

GNN3,? ) 0 0 ;=  r   c                 ~    UR                   R                  S   n[        US[        XSR	                  U5      S95        g)z3Convert a JSON representation into Wrapper message.rQ   r   r   N)rH   rW   r   r   r=   )r?   rQ   r"   r   r8   s        r   r   _Parser._ConvertWrapperMessage  s;    --g6E K4F4Ft4LMOr   c           	      R   [        U[        5      (       d%  [        SR                  UR                  X5      5      eUR
                  R                  S   nUR
                  R                  S   nU H  n[        XuSR                  U5      S5      nUR                  [        R                  R                  :X  a<  U R                  X   [        X#R                  5      U   SR                  XH5      5        M  [        X   USR                  XH5      S9[        X#R                  5      U'   M     g)	aF  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.
  path: parent path to log parse error info.

Raises:
  ParseError: In case of convert problems.
z3Map field {0} must be in a dict which is {1} at {2}rg   rQ   z{0}.keyTr  r  N)rX   r   r   r=   rU   r4   rW   r   r`   r   r2   ra   r   r   )	r?   rQ   r"   r8   r   	key_fieldvalue_fieldrg   	key_values	            r   r   _Parser._ConvertMapFieldValue  s    eT""
?
F
Fjj%'( ( ""11%8I$$33G<K*3+4+;+;D+A4Ii			!;!;!K!K	KEJ#GZZ8C&--d>	@ 3KJ**;*;D*L3N$Y/ r   )r(   r   r   r   N)r   r   r   r   r   r@   r   r   r   r   r  r   r   r   r   r   r   r   r   r   r     s=    06@LD >5%$@ONr   r   c                 
    UR                   [        ;   a  [        U 5      $ UR                   [        ;   a  [	        X5      $ UR                   [
        R                  R                  :X  a  [        X5      $ UR                   [
        R                  R                  :X  a  UR                  [
        R                  R                  :X  aV  [        U [        5      (       a  U R                  S5      nOU nUSS[        U5      S-  -
  -  -   n[         R"                  " U5      $ [$        R'                  U 5      (       a  [)        S5      eU $ UR                   [
        R                  R*                  :X  a  UR,                  R.                  R1                  U S5      nUc   [3        U 5      nUR,                  R4                  R1                  US5      nUcJ  UR<                  R>                  S:X  a  U$ [)        SR9                  XR,                  R:                  5      5      eUR@                  $ g! [6         a/    [)        SR9                  XR,                  R:                  5      5      ef = f! [(         a  n[)        SR9                  X5      5      eSnAff = f)	a]  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.
  path: parent path to log parse error info.
  require_str: If True, the field value must be a str.

Returns:
  The converted scalar field value

Raises:
  ParseError: In case of convert problems.
ro      =   zUnpaired surrogateNz(Invalid enum value {0} for enum type {1}rn   r   )!r`   
_INT_TYPES_ConvertIntegerr}   _ConvertFloatr   r2   r{   _ConvertBoolrv   r1   rw   rX   rZ   encodelenrx   urlsafe_b64decode_UNPAIRED_SURROGATE_PATTERNsearchr   rp   rq   values_by_namers   intrr   rd   r=   rI   rt   ru   number)	rQ   r8   r   require_strencodedpadded_valuer   r#  rj   s	            r   r   r     s   (3~~#U##	<	'5((	:55BB	B%--	:55DD	D	z11<<	<eS!!LL)''S\A-=)=!>>''55 '--e44/0
0	:55BB	B??1155eTBj			1u:&77;;FDI* ZZ(*MELL__..0 1 1! 
C  	1ELL__..0 1 1	1 
 3
\((1
223sT   I I  2I 3B%I &I  AI 1H I "9I 9II 
J#I==Jc                    [        U [        5      (       a/  U R                  5       (       d  [        SR	                  U 5      5      e[        U [
        5      (       a/  U R                  S5      S:w  a  [        SR	                  U 5      5      e[        U [        5      (       a  [        SR	                  U 5      5      e[        U 5      $ )zConvert 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}"z2Bool value {0} is not acceptable for integer field)	rX   r   
is_integerr   r=   rZ   findrY   r"  )rQ   s    r   r  r  +  s     ue&6&6&8&8
3::5A
BBs

32 5
5<<UC
DDt
 %%+VE]4 4 
Ur   c                    [        U [        5      (       a  [        R                  " U 5      (       a  [	        S5      e[        R
                  " U 5      (       a  U S:  a  [	        S5      e[	        S5      eUR                  [        R                  R                  :X  a>  U [        R                  :  a  [	        S5      eU [        R                  :  a  [	        S5      eU S:X  a  [	        S5      e [        U 5      $ ! [         a`    U [        :X  a  [        S	5      s $ U [        :X  a  [        S
5      s $ U [         :X  a  [        S5      s $ [	        SR#                  U 5      5      ef = f)z!Convert an floating point number.z,Couldn't parse NaN, use quoted "NaN" insteadr   zICouldn't parse Infinity or value too large, use quoted "Infinity" insteadzKCouldn't parse -Infinity or value too small, use quoted "-Infinity" insteadzFloat value too largezFloat value too smallnanz-Couldn't parse float "nan", use "NaN" insteadz-infinfzCouldn't parse float: {0})rX   r   r~   r   r   r   r`   r   r2   r   r   
_FLOAT_MAX
_FLOAT_MINrd   r   r   r   r=   )rQ   r8   s     r   r  r  D  s2   uzz%FGGzz%	 9 : 	:  : ; 	;~~33AAA	))	)011	))	)011
e^
E
FFC<	 	C6]	)	5\	$5\3::5ABB	Cs   +
C6 6E E .E E c                     U(       a(  U S:X  a  gU S:X  a  g[        SR                  U 5      5      e[        U [        5      (       d  [        S5      eU $ )zConvert 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.
rR   TrS   Fz#Expected "true" or "false", not {0}z%Expected true or false without quotes)r   r=   rX   rY   )rQ   r$  s     r   r  r  h  sQ     	'	<CCEJKK	E4	 	 
<
==	,r   r   r   r   r   r   r   r   r   r   r  )zgoogle.protobuf.Anyzgoogle.protobuf.Durationzgoogle.protobuf.FieldMaskzgoogle.protobuf.ListValuezgoogle.protobuf.Structzgoogle.protobuf.Timestampr   )FF   FFNNTr   )FNd   )F)9r   
__author__rx   collectionsr   rC   r~   operatorr   resysgoogle.protobuf.internalr   google.protobufr   r   _TIMESTAMPFOMAT	frozensetr2   CPPTYPE_INT32CPPTYPE_UINT32CPPTYPE_INT64CPPTYPE_UINT64r  r|   r   CPPTYPE_DOUBLEr}   r   r   r   compiler  r   	Exceptionr   r   r   r+   r.   r9   objectr    rJ   r   r   r   r   r"  r   r  r   r   r  r  r  rL   r   r   r   <module>rD     sB  >
 +
  #   ! 	 
 2 & + &
22@@"22AA"22@@"22AAC D
 *44BB$44CCE F*44BB$44CCE F	 jjMO  

#:; 0I 0/5 /) ) $) % (HZ $) % #/L5HCv HCVJ  !&!	(F %*""%	2 eZNf ZNz73t2!CH4 602!>!9!;"?":"<"A"<">;68"?":"<946r   