HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/Python311/Lib/site-packages/google/protobuf/__pycache__/text_format.cpython-311.pyc
�

�ncf���>�dZdZddlZddlZddlZddlZddlZddlm	Z	ddlm
Z
ddlmZddlm
Z
gd�Ze
j��e
j��e
j��e
j��fZejd	ej��Zejd
ej��Zed��ZdZGd
�de��ZGd�de��ZGd�de��Z													d7d�Z d�Z!d�Z"													d8d�Z#											d9d�Z$											d9d�Z%d�Z&dZ'dZ(Gd�de��Z)				d:d�Z*				d:d �Z+				d:d!�Z,				d:d"�Z-Gd#�d$e��Z.d%�Z/d&�Z0d'�Z1d(�Z2Gd)�d*e��Z3e3Z4d+�Z5d,�Z6d-�Z7d.�Z8d/�Z9d0�Z:d;d1�Z;d;d2�Z<d3�Z=d4�Z>d5�Z?d6�Z@dS)<acContains routines for printing protocol messages in text format.

Simple usage example::

  # Create a proto object and serialize it to a text proto string.
  message = my_proto_pb2.MyMessage(foo='bar')
  text_proto = text_format.MessageToString(message)

  # Parse a text proto string.
  message = text_format.Parse(text_proto, my_proto_pb2.MyMessage())
z kenton@google.com (Kenton Varda)�N)�decoder)�
type_checkers)�
descriptor)�
text_encoding)�MessageToString�Parse�PrintMessage�
PrintField�PrintFieldValue�Merge�MessageToBytesz-?inf(?:inity)?f?$znanf?$)�'�"zgoogle.protobuf.Anyc��eZdZdZdS)�Errorz'Top-level module error for text_format.N)�__name__�
__module__�__qualname__�__doc__���=D:\Python311\Lib\site-packages\google/protobuf/text_format.pyrrGs������/�/�/�/rrc�0��eZdZdZd�fd�	Zd�Zd�Z�xZS)�
ParseErrorz3Thrown in case of text parsing or tokenizing error.Nc�N��|�A|�?t|��}|�|d�|��z
}d�||��}|�)tt|���|��n'tt|�����||_||_dS)Nz:{0}z	{0} : {1})�str�format�superr�__init__�_line�_column)�self�message�line�column�loc�	__class__s     �rrzParseError.__init__Ns�����1�t�1���I�I�c�	�%��v�}�}�V�$�$�$���"�"�3��0�0�g��)��J����&�&�w�/�/�/�/��J����&�&�(�(�(��D�J��D�L�L�Lrc��|jS�N)r �r"s r�GetLinezParseError.GetLine[s
���:�rc��|jSr))r!r*s r�	GetColumnzParseError.GetColumn^s
���<�r)NNN)rrrrrr+r-�
__classcell__)r's@rrrKsa�������;�;����������������rrc�&�eZdZd�Zd�Zd�Zd�ZdS)�
TextWriterc�6�tj��|_dSr))�io�StringIO�_writer)r"�as_utf8s  rrzTextWriter.__init__ds���;�=�=�D�L�L�Lrc�6�|j�|��Sr))r4�write)r"�vals  rr7zTextWriter.writegs���<���c�"�"�"rc�4�|j���Sr))r4�closer*s rr:zTextWriter.closejs���<�����rc�4�|j���Sr))r4�getvaluer*s rr<zTextWriter.getvaluems���<� � �"�"�"rN)rrrrr7r:r<rrrr0r0bsP������!�!�!�#�#�#� � � �#�#�#�#�#rr0Fc��t|��}t||
|||||||||	|||
���}|�|��|���}|���|r|���S|S)aT	Convert protobuf message to text format.

  Double values can be formatted compactly with 15 digits of
  precision (which is the most that IEEE 754 "double" can guarantee)
  using double_format='.15g'. To ensure that converting to text and back to a
  proto will result in an identical value, double_format='.17g' should be used.

  Args:
    message: The protocol buffers message.
    as_utf8: Return unescaped Unicode for non-ASCII characters.
        In Python 3 actual Unicode characters may appear as is in strings.
        In Python 2 the return value will be valid UTF-8 rather than only ASCII.
    as_one_line: Don't introduce newlines between fields.
    use_short_repeated_primitives: Use short repeated format for primitives.
    pointy_brackets: If True, use angle brackets instead of curly braces for
      nesting.
    use_index_order: If True, fields of a proto message will be printed using
      the order defined in source code instead of the field number, extensions
      will be printed at the end of the message and their relative order is
      determined by the extension number. By default, use the field number
      order.
    float_format (str): If set, use this to specify float field formatting
      (per the "Format Specification Mini-Language"); otherwise, shortest float
      that has same value in wire will be printed. Also affect double field
      if double_format is not set but float_format is set.
    double_format (str): If set, use this to specify double field formatting
      (per the "Format Specification Mini-Language"); if it is not set but
      float_format is set, use float_format. Otherwise, use ``str()``
    use_field_number: If True, print field numbers instead of names.
    descriptor_pool (DescriptorPool): Descriptor pool used to resolve Any types.
    indent (int): The initial indent level, in terms of spaces, for pretty
      print.
    message_formatter (function(message, indent, as_one_line) -> unicode|None):
      Custom formatter for selected sub-messages (usually based on message
      type). Use to pretty print parts of the protobuf for easier diffing.
    print_unknown_fields: If True, unknown fields will be printed.
    force_colon: If set, a colon will be added after the field name even if the
      field is a proto message.

  Returns:
    str: A string of the text formatted protocol buffer message.
  )�print_unknown_fields�force_colon)r0�_Printerr	r<r:�rstrip)r#r5�as_one_line�use_short_repeated_primitives�pointy_brackets�use_index_order�float_format�
double_format�use_field_number�descriptor_pool�indent�message_formatterr>r?�out�printer�results                 rrrqs���t	�7���#��	��
��#��������/��
�
�
�'�
���w�����<�<�>�>�&��)�)�+�+�+����=�=�?�?��	�-rc��t|fi|��}t|t��r|S|�d��rdnd}|�|��S)zFConvert protobuf message to encoded text format.  See MessageToString.r5�utf-8�ascii)r�
isinstance�bytes�get�encode)r#�kwargs�text�codecs    rr
r
�s\��
��	+�	+�F�	+�	+�$���e�����K��Z�Z�	�*�*�
7�'�'��%�	
���U�	�	�rc��|jtjjko)|jjo|j���jSr))�typer�FieldDescriptor�TYPE_MESSAGE�message_type�has_options�
GetOptions�	map_entry)�fields r�_IsMapEntryrb�s?��
�*�
�2�?�
?�4�
�
�
(�4�
�
�
'�
'�
)�
)�
3�5rc�j�t|||||||||	|
|||
|���}|�|��dS)N�rLrJr5rBrCrDrErFrGrHrIrKr>r?)r@r	)r#rLrJr5rBrCrDrErFrGrHrIrKr>r?rMs                rr	r	�s\��
�

�f�g��$A�%�%��!�'�%�)�/��
�
�
�'�
���w�����rc�h�t||||||||	|
|||
���}|�||��dS)�%Print a single field name/value pair.�rKr>r?N)r@r
�ra�valuerLrJr5rBrCrDrErFrGrKr>r?rMs               rr
r
�sS��
�S�&�'�;�2�O�$�l�M�'8�*>�!,�
.�
.�
.�'�
���U�E�"�"�"�"�"rc�h�t||||||||	|
|||
���}|�||��dS)z0Print a single field value (not including name).rgN)r@rrhs               rrr
sS��
�S�&�'�;�2�O�$�l�M�'8�*>�!,�
.�
.�
.�'�
���%��'�'�'�'�'rc��|�ddlm}|���}ddlm}|���}	|�|��}n#t
$rYdSwxYw|�|��}|��S)a!Returns a protobuf message instance.

  Args:
    type_name: Fully-qualified protobuf  message type name string.
    descriptor_pool: DescriptorPool instance.

  Returns:
    A Message instance of type matching type_name, or None if the a Descriptor
    wasn't found matching type_name.
  Nr)rI)�symbol_database)�google.protobufrI�Defaultrl�FindMessageTypeByName�KeyError�GetPrototype)�	type_namerI�pool_modrl�database�message_descriptorr]s       r�_BuildMessageFromTypeNamerv"s����)�;�;�;�;�;�;��&�&�(�(�O�-�-�-�-�-�-�
�
$�
$�
&�
&�(��(�>�>�y�I�I����	�����4�4������&�&�'9�:�:�,�	����s�A�
A�A��c�j�eZdZdZ													dd�Zd�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
dS)r@z)Text format printer for protocol message.rFNc���||_||_||_||_||_||_||_||_|	�|	|_n||_|
|_	||_
||_|
|_||_
dS)afInitialize the Printer.

    Double values can be formatted compactly with 15 digits of precision
    (which is the most that IEEE 754 "double" can guarantee) using
    double_format='.15g'. To ensure that converting to text and back to a proto
    will result in an identical value, double_format='.17g' should be used.

    Args:
      out: To record the text format result.
      indent: The initial indent level for pretty print.
      as_utf8: Return unescaped Unicode for non-ASCII characters.
          In Python 3 actual Unicode characters may appear as is in strings.
          In Python 2 the return value will be valid UTF-8 rather than ASCII.
      as_one_line: Don't introduce newlines between fields.
      use_short_repeated_primitives: Use short repeated format for primitives.
      pointy_brackets: If True, use angle brackets instead of curly braces for
        nesting.
      use_index_order: If True, print fields of a proto message using the order
        defined in source code instead of the field number. By default, use the
        field number order.
      float_format: If set, use this to specify float field formatting
        (per the "Format Specification Mini-Language"); otherwise, shortest
        float that has same value in wire will be printed. Also affect double
        field if double_format is not set but float_format is set.
      double_format: If set, use this to specify double field formatting
        (per the "Format Specification Mini-Language"); if it is not set but
        float_format is set, use float_format. Otherwise, str() is used.
      use_field_number: If True, print field numbers instead of names.
      descriptor_pool: A DescriptorPool used to resolve Any types.
      message_formatter: A function(message, indent, as_one_line): unicode|None
        to custom format selected sub-messages (usually based on message type).
        Use to pretty print parts of the protobuf for easier diffing.
      print_unknown_fields: If True, unknown fields will be printed.
      force_colon: If set, a colon will be added after the field name even if
        the field is a proto message.
    Nrd)r"rLrJr5rBrCrDrErFrGrHrIrKr>r?s               rrz_Printer.__init__Cs���h�D�H��D�K��D�L�"�D��)F�D�&�*�D��*�D��$�D���(�(�d���'�d��,�D��*�D��.�D�� 4�D��"�D���rc��d|jvrdSt|���|j��}|r�|�|j��|jrdnd}|j�|j	dz�d|j�d|�d���|�
|��|j�|jrdnd��d	SdS)
z5Serializes if message is a google.protobuf.Any field.�/F�:�� �[�]�
T)�type_urlrv�TypeNamerI�MergeFromStringrir?rLr7rJ�_PrintMessageFieldValuerB)r"r#�packed_message�colons    r�_TryPrintAsAnyMessagez_Printer._TryPrintAsAnyMessage�s���
�'�"�"��
�U�.�w�/?�/?�/A�/A�/3�/C�E�E�N����$�$�W�]�3�3�3��%�-�c�c�2�e�
�h�n�n�D�K�#�$5�$5�$5�w�7G�7G�7G����O�P�P�P�
�"�"�>�2�2�2�
�h�n�n�D�,�6�S�S�$�7�7�7�
�T�
�Urc��|�||j|j��}|�dS|j}|�d|jz��|�|��|�|jrdnd��dS)NFrr�T)rKrJrBrLr7)r"r#�	formattedrLs    r�_TryCustomFormatMessagez _Printer._TryCustomFormatMessage�s����&�&�w���T�=M�N�N�I���
�U�
�(�C��I�I�c�D�K�� � � ��I�I�i�����I�I�T�%�/�c�c�4�0�0�0��4rc�h�|jr|�|��rdS|jjtkr|�|��rdS|���}|jr|�d����|D�]\}}t|��rNt|��D]=}|���|||���}|�||���>�c|j
tjjkrn|jrK|jtjjkr1|jtjjkr|�||����|D]}|�||�����|�||����|jr)|�|�����dSdS)zeConvert protobuf message to text format.

    Args:
      message: The protocol buffers message.
    Nc�P�|djr
|djn|djS)Nr)�is_extension�number�index)�xs r�<lambda>z'_Printer.PrintMessage.<locals>.<lambda>�s"��q��t�'8�H��!����a��d�j�r)�key)r�ri)rKr��
DESCRIPTOR�	full_name�_ANY_FULL_TYPE_NAMEr��
ListFieldsrE�sortrb�sorted�
GetEntryClassr
�labelrr[�LABEL_REPEATEDrC�cpp_type�CPPTYPE_MESSAGE�CPPTYPE_STRING�"_PrintShortRepeatedPrimitivesValuer>�_PrintUnknownFields�
UnknownFields)r"r#�fieldsrarir��entry_submsg�elements        rr	z_Printer.PrintMessage�s�����
�$�">�">�w�"G�"G�
��f���$�(;�;�
��"�"�7�+�+�
��f�
�
�
�
!�
!�F���J��k�k�H�H��J�J�J��&�&���u�	�U�	�	�&��%�=�=�	/�	/�C�/��,�,�.�.�3�e�C�j�I�I�I�,�
�/�/�%��
.�
.�
.�
.�	/��;�*�4�C�C�	&��.�	,���*�"<�"L�L�	,���*�"<�"K�K�	,��
1�
1�%��
?�
?�
?�
?��,�,�g��O�O�E�7�+�+�+�+�,�	
����u�%�%�%�%�� �8�
���w�4�4�6�6�7�7�7�7�7�8�8rc���|j}|D�]�}|�d|jz��|�t|j����|jtkr�|jr|�d��n%|�d��|xjdz
c_|�|j	��|jr|�d����|xjdzc_|�d|jzdz����|jtk�rr	tjt|j	��dt|j	����\}}n#t$rd}YnwxYw|t|j	��kr�|jr|�d��n%|�d��|xjdz
c_|�|��|jr|�d�����|xjdzc_|�d|jzdz����#|�d��|�t!j|j	d	����|�|jrd
nd�����|�d��|�t|j	����|�|jrdnd
�����dS)zPrint unknown fields.rz { z {
rwz} z}
rz: "Fz" z"
z: r�N)rLr7rJr�field_number�	wire_type�WIRETYPE_START_GROUPrBr��data�WIRETYPE_LENGTH_DELIMITEDr�_DecodeUnknownFieldSet�
memoryview�len�	Exceptionr�CEscape)r"�unknown_fieldsrLra�embedded_unknown_message�poss      rr�z_Printer._PrintUnknownFields�s���
�(�C��25�25��	�i�i��d�k�!�"�"�"�	�i�i��E�&�'�'�(�(�(�	��0�	0�/5���	�

�)�)�E�
�
�
�
�

�)�)�F�
�
�
�
�+�+��
�+�+�� � ���,�,�,���	/�

�)�)�D�/�/�/�/�
�+�+��
�+�+�

�)�)�C�$�+�%��-�
.�
.�
.�
.��?�7�7�!5�	�-4�,J����$�$�a��U�Z���-:�-:�
)�#�S�S���	�	�	��#�#�#�	�����#�e�j�/�/�!�	;�
�
���I�I�e������I�I�f�����K�K�1��K�K�
�
"�
"�#;�
<�
<�
<�
�
�1��I�I�d�O�O�O�O��K�K�1��K�K��I�I�c�D�K�'�%�/�0�0�0�0��)�)�F�
�
�
�

�)�)�M�)�%�*�e�<�<�
=�
=�
=�

�)�)�T�-�9�E�E�6�
:�
:�
:�
:�	�	�	�$�����	�	�#�e�j�/�/�"�"�"��	�	��)�3�#�#�t�4�4�4�4�e25�25s�=E�E+�*E+c�B�|j}|�d|jz��|jr)|�t	|j�����n|jr�|�d��|j���j	rT|j
tjj
kr:|jtjjkr |�|jj��n|�|j��|�d��nT|j
tjjkr |�|jj��n|�|j��|js|jtjjkr|�d��dSdS)zPrint field name.rr�r�r}N)rLr7rJrHrr�r��containing_typer_�message_set_wire_formatrZrr[r\r��LABEL_OPTIONALr]r��
TYPE_GROUP�namer?r�r�)r"rarLs   r�_PrintFieldNamez_Printer._PrintFieldNameso��
�(�C��I�I�c�D�K�� � � ��� �	�i�i��E�L�!�!�"�"�"�"�	�	�
 ��	�	�#�����!�,�,�.�.�F�	%��J�*�4�A�A�	%��K�:�5�D�D�	%��)�)�E�&�0�
1�
1�
1�
1�

�)�)�E�O�
$�
$�
$��	�	�#������:��3�>�>� ��	�	�%�$�)�*�*�*�*�

�)�)�E�J�
�
�
����
��*�4�D�D��

�i�i��n�n�n�n�n��rc���|�|��|j�d��|�||��|j�|jrdnd��dS)rfrr�N)r�rLr7rrB)r"raris   rr
z_Printer.PrintFieldsf����������H�N�N�3���������&�&�&��H�N�N�$�*�4�3�3��5�5�5�5�5rc���|�|��|j�d��tt	|��dz
��D]8}|�|||��|j�d���9|�||d��|j�d��|j�|jrdnd��dS)	z("Prints short repeated primitives value.z [�z, ���r�rr�N)r�rLr7�ranger�rrB)r"rari�is    rr�z+_Printer._PrintShortRepeatedPrimitivesValue&s���	��������H�N�N�4����
�3�u�:�:��>�
"�
"����
���5�%��(�+�+�+�
�h�n�n�T����������b�	�*�*�*��H�N�N�3�����H�N�N�$�*�4�3�3��5�5�5�5�5rc��|jrd}d}nd}d}|jrN|j�d|z��|�|��|j�|��dS|j�d|z��|xjdz
c_|�|��|xjdzc_|j�d|jz|z��dS)	N�<�>�{�}z%s z%s
rwr)rDrBrLr7r	rJ)r"ri�openb�closebs    rr�z _Printer._PrintMessageFieldValue2s�������e��f�f��e��f���	1�
�h�n�n�U�U�]�#�#�#�
�������
�h�n�n�V������
�h�n�n�V�e�^�$�$�$�
�k�k�Q��k�k�
�������
�k�k�Q��k�k�
�h�n�n�S�4�;�&��/�0�0�0�0�0rc���|j}|jtjjkr|�|��dS|jtjjkrb|jj�	|d��}|�|�
|j��dS|�
t|����dS|jtjj
kr�|�
d��t|t��r|js|�d��}n|}|jtjjkrd}n|j}|�
t'j||����|�
d��dS|jtjjkr0|r|�
d��dS|�
d��dS|jtjjkr�|j�0|�
d�|j|����dSt3j|��r$|�
t|����dS|�
tt7j|������dS|jtjjkr7|j�0|�
d�|j|����dS|�
t|����dS)z�Print a single field value (not including name).

    For repeated fields, the value should be a single element.

    Args:
      field: The descriptor of the field to be printed.
      value: The value of the field.
    NrrPF�true�falsez{1:{0}})rLr�rr[r�r��CPPTYPE_ENUM�	enum_type�values_by_numberrTr7r�rr�rRr5rUrZ�
TYPE_BYTESrr��CPPTYPE_BOOL�
CPPTYPE_FLOATrFr�math�isnanr�ToShortestFloat�CPPTYPE_DOUBLErG)r"rarirL�
enum_value�	out_value�out_as_utf8s       rrz_Printer.PrintFieldValueEs����(�C��~��3�C�C�&�
�"�"�5�)�)�)�)�)�	��:�5�B�	B�$��?�3�7�7��t�D�D�j�	���	�	�*�/�"�"�"�"�"��	�	�#�e�*�*������	��:�5�D�	D��	�i�i��o�o�o�	�E�3�	�	������L�L��)�)�	�	��	�	��z�1�<�	<�#�����l��	�i�i�
�%�i��=�=�>�>�>�	�i�i��o�o�o�o�o�	��:�5�B�	B��	���	�	�&�������	�	�'������	��:�5�C�	C��	
�	�?��	�	�)�"�"�4�#4�e�<�<�=�=�=�=�=��:�e���	?�

�)�)�C��J�J�
�
�
�
�
�

�)�)�C�
�5�e�<�<�=�=�
>�
>�
>�
>�
>�
�.�J�6�E�
E��
�
��	�i�i�	� � ��!3�U�;�;�<�<�<�<�<�	�i�i��E�
�
�����r�
rFFFFFNNFNNFF)rrrrrr�r�r	r�r�r
r�r�rrrrr@r@@s�������1�1�
���$)�������� ��D#�D#�D#�D#�L��� 	�	�	�%8�%8�%8�N55�55�55�n���:6�6�6�
6�
6�
6�1�1�1�&0�0�0�0�0rr@c��t|�t|t��rdnd��|||||���S)aParses a text representation of a protocol message into a message.

  NOTE: for historical reasons this function does not clear the input
  message. This is different from what the binary msg.ParseFrom(...) does.
  If text contains a field already set in message, the value is appended if the
  field is repeated. Otherwise, an error is raised.

  Example::

    a = MyProto()
    a.repeated_field.append('test')
    b = MyProto()

    # Repeated fields are combined
    text_format.Parse(repr(a), b)
    text_format.Parse(repr(a), b) # repeated_field contains ["test", "test"]

    # Non-repeated fields cannot be overwritten
    a.singular_field = 1
    b.singular_field = 2
    text_format.Parse(repr(a), b) # ParseError

    # Binary version:
    b.ParseFromString(a.SerializeToString()) # repeated_field is now "test"

  Caller is responsible for clearing the message as needed.

  Args:
    text (str): Message text representation.
    message (Message): A protocol buffer message to merge into.
    allow_unknown_extension: if True, skip over missing extensions and keep
      parsing
    allow_field_number: if True, both field number and field name are allowed.
    descriptor_pool (DescriptorPool): Descriptor pool used to resolve Any types.
    allow_unknown_field: if True, skip over unknown field and keep
      parsing. Avoid to use this option if possible. It may hide some
      errors (e.g. spelling error on field name)

  Returns:
    Message: The same message passed as argument.

  Raises:
    ParseError: On text parsing problems.
  �
r��rI�allow_unknown_field)�
ParseLines�splitrRrS�rWr#�allow_unknown_extension�allow_field_numberrIr�s      rrrxsL��d
�D�J�J�
�4��(?�(?�J�u�u�U�K�K��+�&�$3�(;�
=�
=�
=�=rc��t|�t|t��rdnd��|||||���S)a�Parses a text representation of a protocol message into a message.

  Like Parse(), but allows repeated values for a non-repeated field, and uses
  the last one. This means any non-repeated, top-level fields specified in text
  replace those in the message.

  Args:
    text (str): Message text representation.
    message (Message): A protocol buffer message to merge into.
    allow_unknown_extension: if True, skip over missing extensions and keep
      parsing
    allow_field_number: if True, both field number and field name are allowed.
    descriptor_pool (DescriptorPool): Descriptor pool used to resolve Any types.
    allow_unknown_field: if True, skip over unknown field and keep
      parsing. Avoid to use this option if possible. It may hide some
      errors (e.g. spelling error on field name)

  Returns:
    Message: The same message passed as argument.

  Raises:
    ParseError: On text parsing problems.
  r�r�r�)�
MergeLinesr�rRrSr�s      rrr�sL��:
�
�j�j�*�T�5�1�1�<���u�=�=�
���%�-�

/�
/�
/�/rc�T�t||||���}|�||��S)a�Parses a text representation of a protocol message into a message.

  See Parse() for caveats.

  Args:
    lines: An iterable of lines of a message's text representation.
    message: A protocol buffer message to merge into.
    allow_unknown_extension: if True, skip over missing extensions and keep
      parsing
    allow_field_number: if True, both field number and field name are allowed.
    descriptor_pool: A DescriptorPool used to resolve Any types.
    allow_unknown_field: if True, skip over unknown field and keep
      parsing. Avoid to use this option if possible. It may hide some
      errors (e.g. spelling error on field name)

  Returns:
    The same message passed as argument.

  Raises:
    ParseError: On text parsing problems.
  r�)�_Parserr���linesr#r�r�rIr��parsers       rr�r���<��6�*�%�#2�':�<�<�<�&�
�	�	�5�'�	*�	*�*rc�T�t||||���}|�||��S)a�Parses a text representation of a protocol message into a message.

  See Merge() for more details.

  Args:
    lines: An iterable of lines of a message's text representation.
    message: A protocol buffer message to merge into.
    allow_unknown_extension: if True, skip over missing extensions and keep
      parsing
    allow_field_number: if True, both field number and field name are allowed.
    descriptor_pool: A DescriptorPool used to resolve Any types.
    allow_unknown_field: if True, skip over unknown field and keep
      parsing. Avoid to use this option if possible. It may hide some
      errors (e.g. spelling error on field name)

  Returns:
    The same message passed as argument.

  Raises:
    ParseError: On text parsing problems.
  r�)r�r�r�s       rr�r��r�rc�b�eZdZdZ				d
d�Zd�Zd�Zd�Zd�Zd	�Z	d
�Z
ed���Zd�Z
dS)r�z(Text format parser for protocol message.FNc�>�||_||_||_||_dSr))r�r�rIr�)r"r�r�rIr�s     rrz_Parser.__init__s*��
$;�D� �0�D��*�D��2�D���rc�@�d|_|�||��|S)zBParses a text representation of a protocol message into a message.F��_allow_multiple_scalars�
_ParseOrMerge�r"r�r#s   rr�z_Parser.ParseLines)s%��#(�D� ����u�g�&�&�&��Nrc�@�d|_|�||��|S)zBMerges a text representation of a protocol message into a message.Tr�r�s   rr�z_Parser.MergeLines/s%��#'�D� ����u�g�&�&�&��Nrc��d�|D��}t|��}|���s,|�||��|����*dSdS)z�Converts a text representation of a protocol message into a message.

    Args:
      lines: Lines of a message's text representation.
      message: A protocol buffer message to merge into.

    Raises:
      ParseError: On text parsing problems.
    c3�nK�|]0}t|t��r|n|�d��V��1dS)rPN)rRr�decode)�.0r$s  r�	<genexpr>z(_Parser._ParseOrMerge.<locals>.<genexpr>@sU��������4��%�%�?���4�;�;�w�+?�+?������rN)�	Tokenizer�AtEnd�_MergeField)r"r�r#�	str_lines�	tokenizers     rr�z_Parser._ParseOrMerge5s��������I��)�$�$�I��o�o���+�
���y�'�*�*�*��o�o���+�+�+�+�+rc��
�|j}|jtk�r9|�d���r#|�|��\}}|�d��|�d��|�d��rd}n|�d��d}t
||j��}|std|z���|�|��sX|�	��r|�
d	|�d
����|�||��|�|���Xd}|�|||���d
S|�d���r |�
��g}	|�d��r<|	�|�
����|�d���<d�|	��}	|js|�
d|jz���|j�|	��}
|
s"|jrd
}
nD|�
d|	z���||
jkr!|�
d|	�d|j�d
����|�d���n?|���}	|jrd|	���rPt1|	dd��}|j�|d
��}
|
s!|jr|j�|��}
n�|j�|	d
��}
|
sK|j�|	���d
��}
|
r|
jt>j j!krd
}
|
r,|
jt>j j!kr|
j"j#|	krd
}
|
s(|j$s!|�
d|j�d|	�d
����|
�rP|j%si|
j&rb|�'|
j&j#��}|�A||
j#kr6|�
d|
j#�d|�d|
j&j#�d|j�d
�	���|
j(t>j j)kr|�d��|j*}
n|�d��|j+}
|
j,t>j j-kre|�d��rP|�d��s:	|
|||
��|�d��rn|�d���9n-|
|||
��n|js	|j$sJ�t]|��|�d��s|�d��d
Sd
S)z�Merges a single protocol message field into a message.

    Args:
      tokenizer: A tokenizer to parse the field name and values.
      message: A protocol message to record the data.

    Raises:
      ParseError: In case of text parsing problems.
    r�r�r}r�r�r�r�z$Type %s not found in descriptor pool�
Expected "�".F)�type_url_prefix�
deterministicN�.z+Message type "%s" does not have extensions.z�Extension "%s" not registered. Did you import the _pb2 module which defines it? If you are trying to place the extension in the MessageSet field of another message that is in an Any or MessageSet field, that message's _pb2 module must be imported as wellzExtension "z " does not extend message type "T�Message type "z" has no field named "zField "z!" is specified along with field "z", another member of oneof "z" for message type "�,�;)/r�r�r��
TryConsume�_ConsumeAnyTypeUrl�ConsumervrIrr��ParseErrorPreviousTokenr��Pack�ConsumeIdentifier�append�join�
is_extendable�
Extensions�_FindExtensionByNamer�r��ConsumeIdentifierOrNumberr��isdigit�ParseInteger�fields_by_numberrT�_FindExtensionByNumber�fields_by_name�lowerrZrr[r�r]r�r�r��containing_oneof�
WhichOneofr�r��_MergeMessageField�_MergeScalarFieldr�r��_SkipFieldContents)r"r�r#rur�packed_type_name�expanded_any_end_token�expanded_any_sub_messagerr�rar��which_oneof�mergers              rr�z_Parser._MergeFieldGsr��!�+���$�(;�;�
����S�!�!�
�*.�*A�*A�)�*L�*L�'�o�'�����������3����	�	�	�c�	"�	"�%�!$������#����!$��!:�;K�;?�;O�"Q�"Q��
%�+��?�)�*�+�+�	+��$�$�%;�<�<�>��?�?���	M��1�1�1�3I�3I�3I�3L�M�M�M�����$<�=�=�=�	�$�$�%;�<�<�>�
�m�
�l�l�+�#2�!.��0�0�0�
�f����C� � �92��)�)�+�+�
,�d�� � ��%�%�3����I�/�/�1�1�2�2�2�
� � ��%�%�3�
�X�X�d�^�^�d�
�
-�*��/�/�9��(�
)�*�*�	*�� �5�5�d�;�;�e��
2��'�	M��%�%��1�1�E�HL�	L�M�M�M���!6�6�2��/�/�/�
�T�T�%�/�/�/�
1�2�2�	2����������
0�
0�
2�
2�d�	
�	 ��T�\�\�^�^���d�D�$�/�/��"�3�7�7���E�E���	D�+�9�	D��$�;�;�F�C�C�%��"�1�5�5�d�D�A�A��
�	�$�3�7�7��
�
���d�K�K�%�
��u�z�Z�%?�%J�J���E��	�e�j�J�$>�$I�I�	���#�t�+�	��%�
�2�4�3�2��/�/�/�
�
)�
)�
)�4�4�4�
1�2�2�	2�
�#$�
�
)�
.�e�.D�
.��(�(��)?�)D�E�E���	.�{�e�j�'@�	.��1�1�1��z�z�z�;�;�;��(>�(C�(C�(C�!�+�+�+�-�.�.�.�
��:�5�E�	E�(����S�!�!�!��(������#�����'��
�+��3�B�
B�*�
�
�
�s�
#�
#�*��#�#�C�(�(�	#�#��F�9�g�u�-�-�-��#�#�C�(�(�
�����c�"�"�"�	#��	��y�'�5�)�)�)�)��*�G�d�.F�G�G�G���#�#�#�����$�$� ����3������ � rc�f�|���g}|�d��|�|�����|�d��|�|�����|�d��|���g}|�d��r<|�|�����|�d���<d�|��d�|��fS)zBConsumes a google.protobuf.Any type URL and returns the type name.rr|)rr	r
rr)r"r��prefixr�s    rrz_Parser._ConsumeAnyTypeUrl�s���)�)�+�+�
,�F�
���c����
�M�M�)�-�-�/�/�0�0�0�
���c����
�M�M�)�-�-�/�/�0�0�0�
���c�����'�'�)�)�*�D�
�
�
�s�
#�
#�1�
�k�k�)�-�-�/�/�0�0�0��
�
�s�
#�
#�1��8�8�F���S�X�X�d�^�^�+�+rc�R�t|��}|�d��rd}n|�d��d}|jtjjkr�|jr!|j|�	��}�n+|r0t||j�������}n�t||j���	��}n�|jrU|j
s@|�|��r+|�d|jj�d|j�d����|j|}na|j
sE|�|j��r+|�d|jj�d|j�d����t||j��}|���|�|��sX|���r|�d	|�d
����|�||��|�|���X|r�|jjdj}|tjjkr<t||j��|j}|�|j��dS|jt||j��|j<dSdS)
a"Merges a single scalar field into a message.

    Args:
      tokenizer: A tokenizer to parse the field value.
      message: The message of which field is a member.
      field: The descriptor of the field to be merged.

    Raises:
      ParseError: In case of text parsing problems.
    r�r�r�r�r�" should not have multiple "�
" extensions.�	" fields.r�rriN)rbrr	r�rr[r�r�r�add�getattrr�r�r��HasExtensionr
r�r��HasField�SetInParentr�r�r]rr�r�r��CopyFromri)	r"r�r#ra�is_map_entry�	end_token�sub_message�
value_cpptyperis	         rrz_Parser._MergeMessageField�s����u�%�%�L����C� � ���i�i���������i��{�j�0�?�?� �	�	�9��(��/�3�3�5�5����9�B�g�g�u�z�2�2�@�@�B�B�D�D����g�u�z�2�2�6�6�8�8���	�	�3��,�	?�� � ��'�'�	?��1�1�1��!�+�+�+�U�_�_�_�>�?�?�?��(��/����,�	:����U�Z�(�(�	:��1�1�1��!�+�+�+�U�Z�Z�Z�9�:�:�:��g�u�z�2�2���������"�"�9�-�-�/�	���	�	�Q��/�/�/�I�I�I�0O�P�P�P�
���y�+�.�.�.��"�"�9�-�-�/�
�J��(�7��@�I�m�	�*�4�D�	D�J�����,�,�[�_�=��
���{�(�)�)�)�)�)�8C�8I�����$�$�[�_�5�5�5�
J�Jrc�F�|j}t|d��o
|jdkS)N�syntax�proto3)r��hasattrr4)r#rus  r�_IsProto3Syntaxz_Parser._IsProto3Syntaxs.�� �+���&��1�1�
2��%��1�3rc�@�|j}d}|jtjjtjjtjjfvrt|��}�n�|jtjjtjj	tjj
fvrt|��}�n�|jtjjtjj
fvrt|��}�nL|jtjjtjjfvrt#|��}�n|jtjjtjjfvr|���}n�|jtjjkr|���}n�|jtjjkr|���}nv|jtjjkr|���}nG|jtjjkr|�|��}nt;d|jz���|jtjjkrS|j r"|j!|�"|��dStG||j$���"|��dS|j rh|j%sU|�&|��s@|�'|��r+|�(d|j)j*�d|j*�d����||j!|<dSd}|j%sR|�&|��r#tWtG||j$����}n|�,|j$��}|r+|�(d|j)j*�d|j$�d����t[||j$|��dS)aHMerges a single scalar field into a message.

    Args:
      tokenizer: A tokenizer to parse the field value.
      message: A protocol message to record the data.
      field: The descriptor of the field to be merged.

    Raises:
      ParseError: In case of text parsing problems.
      RuntimeError: On runtime errors.
    NzUnknown field type %drr&r'Fr().r�rZrr[�
TYPE_INT32�TYPE_SINT32�
TYPE_SFIXED32�
_ConsumeInt32�
TYPE_INT64�TYPE_SINT64�
TYPE_SFIXED64�
_ConsumeInt64�TYPE_UINT32�TYPE_FIXED32�_ConsumeUint32�TYPE_UINT64�TYPE_FIXED64�_ConsumeUint64�
TYPE_FLOAT�TYPE_DOUBLE�ConsumeFloat�	TYPE_BOOL�ConsumeBool�TYPE_STRING�
ConsumeStringr��ConsumeByteString�	TYPE_ENUM�ConsumeEnum�RuntimeErrorr�r�r�rr
r*r�r�r7r+r
r�r��boolr,�setattr)r"r�r#ra�_ri�duplicate_errors       rrz_Parser._MergeScalarField"s���	
�$�A��E��z�j�0�;� �0�<� �0�>�@�@�?��I�&�&�e�e�	��
�2�=�"�2�>�"�2�@�B�
B�?��I�&�&�e�e�	��
�2�>�"�2�?�A�
A�?��Y�'�'�e�e�	��
�2�>�"�2�?�A�
A�?��Y�'�'�e�e�	��
�2�=�"�2�>�@�
@�?��$�$�&�&�e�e�	��z�1�;�	;�	?��#�#�%�%�e�e�	��z�1�=�	=�?��%�%�'�'�e�e�	��z�1�<�	<�?��)�)�+�+�e�e�	��z�1�;�	;�?��#�#�E�*�*�e�e��0�5�:�=�>�>�>��{�j�0�?�?�.�	�	�3���5�!�(�(��/�/�/�/�/�����$�$�+�+�E�2�2�2�2�2�	�	�.��,�	,��$�$�W�-�-�	,�� � ��'�'�	,��1�1�1��!�+�+�+�U�_�_�_�>�?�?�?�',�'�
�U�
#�
#�
#����+�	;�
�
!�
!�'�
*�
*�;�#�7�7�E�J�#?�#?�@�@�O�O�%�.�.�u�z�:�:�O��	.��1�1�1��!�+�+�+�U�Z�Z�Z�9�:�:�:��'�5�:�u�
-�
-�
-�
-�
-r�FFNF)rrrrrr�r�r�r�rr�staticmethodr7rrrrr�r�s�������0�0�(-�"'�#�#(�	3�3�3�3�������+�+�+�$I �I �I �X
,�
,�
,�8J�8J�8J�t�3�3��<�3�
I.�I.�I.�I.�I.rr�c���|�d��r;|�d��s&|�d��st|��dSt|��dS)z}Skips over contents (value or message) of a field.

  Args:
    tokenizer: A tokenizer to parse the field name and values.
  r}r�r�N)r�	LookingAt�_SkipFieldValue�_SkipFieldMessage�r�s rrrnsr�����#���!�y�':�':�	�(�(�!��&�&�s�+�+�!��I�������i� � � � � rc��|�d��rh|���|�d��r)|���|�d���)|�d��n|���t	|��|�d��s|�d��dSdS)z�Skips over a complete field (name and value/message).

  Args:
    tokenizer: A tokenizer to parse the field name and values.
  r�rr�rrN)rrr	rrr\s r�
_SkipFieldr^�s������#���*�
���!�!�!�
�
�
�s�
#�
#�$��!�!�#�#�#��
�
�s�
#�
#�$�
���c�����
�'�'�)�)�)��Y����
�	�	�c�	"�	"��
����������rc�T�|�d��rd}n|�d��d}|�d��sN|�d��s9t|��|�d��s|�d���9|�|��dS)zfSkips over a field message.

  Args:
    tokenizer: A tokenizer to parse the field name and values.
  r�r�r�r�N)rr	rYr^)r��	delimiters  rr[r[�s������#�����I�I�
���c�����I�����$�$��Y�-@�-@��-E�-E���y����
����$�$��Y�-@�-@��-E�-E�����I�����rc�J�|���r+|���r	|����dS|���sIt|��s<t|��s/|���std|jz���dSdSdSdS)z�Skips over a field value.

  Args:
    tokenizer: A tokenizer to parse the field name and values.

  Raises:
    ParseError: In case an invalid field value is found.
  NzInvalid field value: )�TryConsumeByteString�TryConsumeIdentifier�_TryConsumeInt64�_TryConsumeUint64�TryConsumeFloatr�tokenr\s rrZrZ�s����#�#�%�%��
�
(�
(�
*�
*��
��
(�
(�
*�
*��
�F�
�
(�
(�
*�
*�@�
�9�
%�
%�@�.?�	�.J�.J�@�
�
#�
#�
%�
%�@��,�y��>�
?�
?�?�@�@�@�@�@�@�@�@rc���eZdZdZejd��Zejdej��Zejdej��Z	ejd�
ddgd�eD��z����Zejd	��Z
ejd
��Zd(d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d �Z#d!�Z$d"�Z%d#�Z&d$�Z'd%�Z(d&�Z)d'S))r�z�Protocol buffer text representation tokenizer.

  This class handles the lower level string parsing by splitting it into
  meaningful tokens.

  It was directly ported from the Java protocol buffer API.
  z\s+z	(\s*#.*$)z(\s|(#.*$))+�|z[a-zA-Z_][0-9a-zA-Z_+-]*z#([0-9+-]|(\.[0-9]))[0-9a-zA-Z_.+-]*c�:�g|]}d�|�����S)z0{qt}[^{qt}\n\\]*((\\.)+[^{qt}\n\\]*)*({qt}|\\?$))�qt)r)r��marks  r�
<listcomp>zTokenizer.<listcomp>�s;������:�@�@�D�@�I�I���rz
[^\d\W]\w*z\w+Tc�4�d|_d|_d|_d|_d|_t|��|_d|_d|_d|_	d|_
||_|r|jp|j
|_|���|���dS)Nrr�r~T)�	_positionr r!�_token_startrg�iter�_lines�
_current_line�_previous_line�_previous_column�_more_lines�_skip_comments�_WHITESPACE_OR_COMMENT�_WHITESPACE�_whitespace_pattern�_SkipWhitespace�	NextToken)r"r��
skip_commentss   rrzTokenizer.__init__�s����D�N��D�J��D�L��D���D�J��u�+�+�D�K��D���D���D���D��'�D�� -� M�$�2M�!4�#'�#3�	���������N�N�����rc��|j|kSr)�rg�r"rgs  rrYzTokenizer.LookingAt�s���:���rc��|jS)z^Checks the end of the text was reached.

    Returns:
      True iff the end was reached.
    rr*s rr�zTokenizer.AtEnd�s���z�>�rc� �t|j��|jkrp	t|j��|_|xjdz
c_d|_n#t$rd|_d|_YdSwxYwt|j��|jk�ndSdS)Nr�rr~F)r�rsr!�nextrrr �
StopIterationrvr*s r�_PopLinezTokenizer._PopLine�s���

�d� �
!�
!�T�\�
1�	��!�$�+�.�.���	
�
�
�a��
�
������
������� �����������d� �
!�
!�T�\�
1�	�	�	�	�	s�A�A,�+A,c���	|���|j�|j|j��}|sdSt|�d����}|xj|z
c_�p)NTr)r�rz�matchrsr!r��group)r"r��lengths   rr{zTokenizer._SkipWhitespacesj���
�m�m�o�o�o��&�,�,�T�-?���N�N�e�
��
���5�;�;�q�>�>�"�"�f�
�l�l�f��l�l�
rc�H�|j|kr|���dSdS)z�Tries to consume a given piece of text.

    Args:
      token: Text to consume.

    Returns:
      True iff the text was consumed.
    TF)rgr|r�s  rrzTokenizer.TryConsume
s-���z�U���
�n�n����
�T��5rc�`�|�|��s|�d|z���dS)z�Consumes a piece of text.

    Args:
      token: Text to consume.

    Raises:
      ParseError: If the text couldn't be consumed.
    zExpected "%s".N)rrr�s  rr	zTokenizer.Consumes:���?�?�5�!�!�6��O�O�,�u�4�5�5�5�6�6rc��|j}|j�|��s|�d���|���|S)NzExpected comment.)rg�_COMMENTr�rr|�r"rNs  r�ConsumeCommentzTokenizer.ConsumeComment$sI��
�Z�F��=���v�&�&�1��O�O�/�0�0�0��N�N�����Mrc��|jdko
|jdk}|j}|���}|j|ko|}||fS)zCConsumes a comment, returns a 2-tuple (trailing bool, comment str).r)r r!rtr�)r"�just_started�before_parsing�comment�trailings     r�ConsumeCommentOrTrailingCommentz)Tokenizer.ConsumeCommentOrTrailingComment+s^��
�:��?�8�t�|�q�'8�L��(�N��!�!�#�#�G��#�~�5�%�$�$�
��W��rc�R�	|���dS#t$rYdSwxYw�NTF)rrr*s rrczTokenizer.TryConsumeIdentifier;�@���
������
�T������
�U�U�������
&�&c��|j}|j�|��s|�d���|���|S)��Consumes protocol message field identifier.

    Returns:
      Identifier string.

    Raises:
      ParseError: If an identifier couldn't be consumed.
    zExpected identifier.)rg�_IDENTIFIERr�rr|r�s  rrzTokenizer.ConsumeIdentifierBsL���Z�F���!�!�&�)�)�4��O�O�2�3�3�3��N�N�����Mrc�R�	|���dS#t$rYdSwxYwr�)rrr*s r�TryConsumeIdentifierOrNumberz&Tokenizer.TryConsumeIdentifierOrNumberQs@���
�$�$�&�&�&�
�T������
�U�U����r�c��|j}|j�|��s|�d|z���|���|S)r�z&Expected identifier or number, got %s.)rg�_IDENTIFIER_OR_NUMBERr�rr|r�s  rrz#Tokenizer.ConsumeIdentifierOrNumberXsR���Z�F��%�+�+�F�3�3�O��O�O�D�v�M�N�N�N��N�N�����Mrc�R�	|���dS#t$rYdSwxYwr�)�ConsumeIntegerrr*s r�TryConsumeIntegerzTokenizer.TryConsumeIntegergs@���
������
�T������
�U�U����r�c���	t|j��}n4#t$r'}|�t	|�����d}~wwxYw|���|S)z�Consumes an integer number.

    Returns:
      The integer parsed.

    Raises:
      ParseError: If an integer couldn't be consumed.
    N)�_ParseAbstractIntegerrg�
ValueErrorrrr|�r"rN�es   rr�zTokenizer.ConsumeIntegernsd��$�$�T�Z�0�0�f�f���$�$�$��O�O�C��F�F�#�#�#�����$�����N�N�����M���
A�"A�Ac�R�	|���dS#t$rYdSwxYwr�)rIrr*s rrfzTokenizer.TryConsumeFloat~s@���
������
�T������
�U�U����r�c���	t|j��}n4#t$r'}|�t	|�����d}~wwxYw|���|S)z�Consumes an floating point number.

    Returns:
      The number parsed.

    Raises:
      ParseError: If a floating point number couldn't be consumed.
    N)�
ParseFloatrgr�rrr|r�s   rrIzTokenizer.ConsumeFloat�sd��$��$�*�%�%�f�f���$�$�$��O�O�C��F�F�#�#�#�����$�����N�N�����Mr�c���	t|j��}n4#t$r'}|�t	|�����d}~wwxYw|���|S)z�Consumes a boolean value.

    Returns:
      The bool parsed.

    Raises:
      ParseError: If a boolean value couldn't be consumed.
    N)�	ParseBoolrgr�rrr|r�s   rrKzTokenizer.ConsumeBool�sd��$����$�$�f�f���$�$�$��O�O�C��F�F�#�#�#�����$�����N�N�����Mr�c�R�	|���dS#t$rYdSwxYwr�)rNrr*s rrbzTokenizer.TryConsumeByteString�r�r�c��|���}	t|d��S#t$r}|�|���d}~wwxYw)z�Consumes a string value.

    Returns:
      The string parsed.

    Raises:
      ParseError: If a string value couldn't be consumed.
    rPN)rNr�UnicodeDecodeError�_StringParseError)r"�	the_bytesr�s   rrMzTokenizer.ConsumeString�s]���&�&�(�(�I�&�
��G�
$�
$�$���&�&�&��"�"�1�%�%�%�����&���s�&�
A
�A�A
c��|���g}|jrV|jdtvrB|�|�����|jr|jdtv�Bd�|��S)z�Consumes a byte array value.

    Returns:
      The array parsed (as a string).

    Raises:
      ParseError: If a byte array value couldn't be consumed.
    rr)�_ConsumeSingleByteStringrg�_QUOTESr
r)r"�the_lists  rrNzTokenizer.ConsumeByteString�s����-�-�/�/�0�H�
�*�7���A��'�1�7��o�o�d�3�3�5�5�6�6�6��*�7���A��'�1�7��8�8�H���rc���|j}t|��dks|dtvr|�d|�����t|��dks|d|dkr|�d|�����	t	j|dd���}n4#t$r'}|�t|�����d}~wwxYw|���|S)aOConsume one token of a string literal.

    String literals (whether bytes or text) can come in multiple adjacent
    tokens which are automatically concatenated, like in C or Python.  This
    method only consumes one token.

    Returns:
      The token parsed.
    Raises:
      ParseError: When the wrong format data is found.
    r�rzExpected string but found: rwr�zString missing ending quote: N)	rgr�r�rr�	CUnescaper�rr|)r"rWrNr�s    rr�z"Tokenizer._ConsumeSingleByteString�s����:�D�
�4�y�y�1�}�G��Q��w�.�G��O�O�O�t�t�E�F�F�F�
�4�y�y�1�}�I��R��D��G�+�I��O�O�O���G�H�H�H�$��&�t�A�b�D�z�2�2�f�f���$�$�$��O�O�C��F�F�#�#�#�����$�����N�N�����Ms�B�
C�'"C	�	Cc���	t||j��}n4#t$r'}|�t	|�����d}~wwxYw|���|Sr))�	ParseEnumrgr�rrr|)r"rarNr�s    rrPzTokenizer.ConsumeEnum�sf��$����
�+�+�f�f���$�$�$��O�O�C��F�F�#�#�#�����$�����N�N�����Ms��
A	�"A�A	c�D�t||jdz|jdz��S)z�Creates and *returns* a ParseError for the previously read token.

    Args:
      message: A message to set for the exception.

    Returns:
      A ParseError instance.
    r�)rrtru�r"r#s  rr
z!Tokenizer.ParseErrorPreviousToken�s-���g�t�2�Q�6��+�a�/�1�1�1rc�`�td|jzdz|z|jdz|jdz��S)z9Creates and *returns* a ParseError for the current token.rz': r�)rrsr r!r�s  rrzTokenizer.ParseError�s:���d�T�/�/�&�8�7�B��j�1�n�d�l�Q�&6�8�8�8rc�L�|�dt|��z��S)NzCouldn't parse string: )rr)r"r�s  rr�zTokenizer._StringParseError�s ���?�?�5��A���>�?�?�?rc���|j|_|j|_|xjt	|j��z
c_|���|js	d|_dS|j�	|j
|j��}|s,|js%|j�	|j
|j��}|r|�
d��}||_dS|j
|j|_dS)z Reads the next meaningful token.r~Nr)r rtr!rur�rgr{rv�_TOKENr�rsrwr�r�)r"r�rgs   rr|zTokenizer.NextToken�s����*�D�� �L�D���L�L�C��
�O�O�#�L�L���������
��d�j��f��K���d�0�$�,�?�?�E��D��,�D��m�!�!�$�"4�d�l�C�C�e��4��k�k�!�n�n�e��d�j�j�j��%�d�l�3�d�j�j�jrN)T)*rrrr�re�compilery�	MULTILINEr�rxrr�r�r�r�rrYr�r�r{rr	r�r�rcrr�rr�r�rfrIrKrbrMrNr�rPr
rr�r|rrrr�r��so����������
�6�"�"�+�
�R�Z��b�l�
3�
3�(�%�2�:�o�r�|�D�D���2�:�c�h�h�!�,� ������� �����&���
�=�)�)�+�$�"�*�V�,�,������"������
�
�
�������
6�
6�
6������� ���
�
�
����
�
�
������� ������ ��� ���
&�
&�
&�������4���
1�
1�
1�8�8�8�
@�@�@�4�4�4�4�4rr�c�&�t|dd���S)��Consumes a signed 32bit integer number from tokenizer.

  Args:
    tokenizer: A tokenizer used to parse the number.

  Returns:
    The integer parsed.

  Raises:
    ParseError: If a signed 32bit integer couldn't be consumed.
  TF��	is_signed�is_long��_ConsumeIntegerr\s rr<r<s��
��d�E�	B�	B�	B�Brc�&�t|dd���S)z�Consumes an unsigned 32bit integer number from tokenizer.

  Args:
    tokenizer: A tokenizer used to parse the number.

  Returns:
    The integer parsed.

  Raises:
    ParseError: If an unsigned 32bit integer couldn't be consumed.
  Fr�r�r\s rrCrC(s��
��e�U�	C�	C�	C�Crc�H�	t|��dS#t$rYdSwxYwr�)r@rr\s rrdrd7s<����)�����4��	�����5�5�������
!�!c�&�t|dd���S)r�Tr�r�r\s rr@r@?s��
��d�D�	A�	A�	A�Arc�H�	t|��dS#t$rYdSwxYwr�)rFrr\s rrereNs<����9�����4��	�����5�5����r�c�&�t|dd���S)z�Consumes an unsigned 64bit integer number from tokenizer.

  Args:
    tokenizer: A tokenizer used to parse the number.

  Returns:
    The integer parsed.

  Raises:
    ParseError: If an unsigned 64bit integer couldn't be consumed.
  FTr�r�r\s rrFrFVs��
��e�T�	B�	B�	B�Brc���	t|j||���}n4#t$r'}|�t	|�����d}~wwxYw|���|S)aUConsumes an integer number from tokenizer.

  Args:
    tokenizer: A tokenizer used to parse the number.
    is_signed: True if a signed integer must be parsed.
    is_long: True if a long integer must be parsed.

  Returns:
    The integer parsed.

  Raises:
    ParseError: If an integer with given characteristics couldn't be consumed.
  r�N)rrgr�rrr|)r�r�r�rNr�s     rr�r�eso��'�
�)�/�Y��
P�
P�
P�F�F��	�'�'�'�
�
�
�s�1�v�v�
&�
&�&�����'����������	�-s��
A�"A�Ac��t|��}tdt|��zt|��z}|�|��|S)aParses an integer.

  Args:
    text: The text to parse.
    is_signed: True if a signed integer must be parsed.
    is_long: True if a long integer must be parsed.

  Returns:
    The integer value.

  Raises:
    ValueError: Thrown Iff the text is not a valid integer.
  rw)r��_INTEGER_CHECKERS�int�
CheckValue)rWr�r�rN�checkers     rrr{sL��!��&�&�&�
�a�#�g�,�,�.��Y���?�@�'�	���V����	�-rc���|}tjd|��}|r.|�d��dz|�d��z}	t|d��S#t$rt	d|z���wxYw)z�Parses an integer without checking size/signedness.

  Args:
    text: The text to parse.

  Returns:
    The integer value.

  Raises:
    ValueError: Thrown Iff the text is not a valid integer.
  z(-?)0(\d+)$r��0orwrzCouldn't parse integer: %s)r�r�r�r�r�)rW�	orig_text�
c_octal_matchs   rr�r��s����)��(�>�4�0�0�-��B����q�!�!�D�(�=�+>�+>�q�+A�+A�A�D�@��t�Q�<�<���	�@�@�@�
�2�Y�>�
?�
?�?�@���s�	A�A6c��	t|��S#t$r�t�|��r.|ddkrtd��cYStd��cYSt�|��rtd��cYS	t|�d����cYS#t$rtd|z���wxYwwxYw)z�Parse a floating point number.

  Args:
    text: Text to parse.

  Returns:
    The number parsed.

  Raises:
    ValueError: If a floating point number couldn't be parsed.
  r�-z-inf�inf�nan�fzCouldn't parse float: %s)�floatr��_FLOAT_INFINITYr��
_FLOAT_NANrA�rWs rr�r��s���=���;�;���	�=�=�=����T�"�"�=�	
�a��C����V�}�}�����U�|�|����	�	�	�$�	�	�=�
�5�\�\����=��T�[�[��%�%�&�&�&�&�&��
�=�=�=��4�t�;�<�<�<�=����=���s-��?C�C�#)C�!B3�0C�3C�Cc�8�|dvrdS|dvrdStd���)z�Parse a boolean value.

  Args:
    text: Text to parse.

  Returns:
    Boolean values parsed

  Raises:
    ValueError: If text is not a valid boolean.
  )r��t�1�TrueT)r�r��0�FalseFzExpected "true" or "false".)r�r�s rr�r��s9��
�
'�'�4��4��+�+�4��5�
�2�
3�
3�3rc��|j}	t|d��}t|jd��r|jjdkr|S|j�|d��}|�td|j|fz���nH#t$r;|j	�|d��}|�td|j�d|�d����YnwxYw|j
S)	a&Parse an enum value.

  The value can be specified by a number (the enum value), or by
  a string literal (the enum name).

  Args:
    field: Enum field descriptor.
    value: String value.

  Returns:
    Enum value number.

  Raises:
    ValueError: If the enum value could not be parsed.
  rr4r5Nz+Enum type "%s" has no value with number %d.zEnum type "z" has no value named r)r�r�r6�filer4r�rTr�r��values_by_namer�)rari�enum_descriptorr�r�s     rr�r��s�� �O�/�<�
���]�]�F��u�z�8�$�$��	��	�h�	&���
� �1�5�5�f�d�C�C�J��<��D�'�1�6�:�;�
<�
<�<�<��
�;�;�;� �/�3�3�E�4�@�@�J��;��J�'�1�1�1�5�5�5�:�
;�
;�;�;�;�;����"
�	�s�A7�7AB<�;B<)
FFFFFNNFNrNFFr�)rFFFFFNNNFFrV)FF)Ar�
__author__�encodings.raw_unicode_escape�	encodings�encodings.unicode_escaper2r�r��google.protobuf.internalrrrmrr�__all__�Uint32ValueChecker�Int32ValueChecker�Uint64ValueChecker�Int64ValueCheckerr�r��
IGNORECASEr�r��	frozensetr�r�r�rr�objectr0rr
rbr	r
rrvr�r�r@rrr�r�r�rr^r[rZr��
_Tokenizerr<rCrdr@rerFr�rr�r�r�r�rrr�<module>r�s��>
�
�0�
�$�#�#�#�����	�	�	�	�����	�	�	�	�,�,�,�,�,�,�2�2�2�2�2�2�&�&�&�&�&�&�)�)�)�)�)�)�9�9�9��6�]�5�7�7�4�]�4�6�6�5�]�5�7�7�4�]�4�6�6�8���"�*�1�2�=�A�A��
�R�Z��"�-�
0�
0�
�
�)�J�
�
��+��0�0�0�0�0�I�0�0�0����������.#�#�#�#�#��#�#�#�"
��"'�����������O�O�O�O�d���5�5�5���"�/4�!&�!&�"�#�"'�!%�#'�&+�"� � � � �D�� �-2�$�$� �!�!%�$)� �#�#�#�#�6�!� %�27�$)�$)�!%�"&�&*�).� %�(�(�(�(�0���4����u�u�u�u�u�v�u�u�u�t	#(�"��#�7=�7=�7=�7=�x#(�"��#�#/�#/�#/�#/�P(-�"'�#�#(�+�+�+�+�H(-�"'�#�#(�+�+�+�+�DO.�O.�O.�O.�O.�f�O.�O.�O.�d
!�!�!�&���.���&@�@�@�,Q4�Q4�Q4�Q4�Q4��Q4�Q4�Q4�j
�
�C�C�C�D�D�D����B�B�B����C�C�C�����,����.@�@�@�2=�=�=�@4�4�4�($�$�$�$�$r