__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

aptanhua@216.73.216.200: ~ $
3

���h���	@sdZdZddlZddlZddlZejr*eZddlm	Z	ddl
mZddl
mZddd	d
dgZ
e	j�e	j�e	j�e	j�fZejdej�Zejd
ej�Zeejjejjg�ZedO�ZdZGdd�de�ZGdd�de�Z Gdd�de!�Z"dPdd�Z#dd�Z$dQdd�Z%dRdd	�Z&dSdd
�Z'dd�Z(Gd d!�d!e!�Z)dTd"d#�Z*dUd$d�Z+dVd%d&�Z,dWd'd(�Z-Gd)d*�d*e!�Z.d+d,�Z/d-d.�Z0d/d0�Z1d1d2�Z2Gd3d4�d4e!�Z3e3Z4d5d6�Z5d7d8�Z6d9d:�Z7d;d<�Z8d=d>�Z9d?d@�Z:dXdAdB�Z;dYdCdD�Z<dZdEdF�Z=d[dGdH�Z>dIdJ�Z?dKdL�Z@dMdN�ZAdS)\abContains 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)�
type_checkers)�
descriptor)�
text_encoding�MessageToString�PrintMessage�
PrintField�PrintFieldValue�Mergez-?inf(?:inity)?f?znanf?�'�"zgoogle.protobuf.Anyc@seZdZdZdS)�Errorz'Top-level module error for text_format.N)�__name__�
__module__�__qualname__�__doc__�rr�!/usr/lib/python3.6/text_format.pyrIsrcs2eZdZdZd	�fdd�	Zdd�Zdd�Z�ZS)
�
ParseErrorz3Thrown in case of text parsing or tokenizing error.Ncsr|dk	r:|dk	r:t|�}|dk	r.|dj|�7}dj||�}|dk	rTtt|�j|�ntt|�j�||_||_dS)Nz:{0}z	{0} : {1})�str�format�superr�__init__�_line�_column)�self�message�line�column�loc)�	__class__rrrPszParseError.__init__cCs|jS)N)r)rrrr�GetLine]szParseError.GetLinecCs|jS)N)r)rrrr�	GetColumn`szParseError.GetColumn)NNN)r
rrrrr r!�
__classcell__rr)rrrMs
rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
TextWritercCs tjrtj�|_n
tj�|_dS)N)�six�PY2�io�BytesIO�_writer�StringIO)r�as_utf8rrrrfszTextWriter.__init__cCs(tjrt|tj�r|jd�}|jj|�S)Nzutf-8)r$r%�
isinstance�	text_type�encoder(�write)r�valrrrr.ls
zTextWriter.writecCs
|jj�S)N)r(�close)rrrrr0rszTextWriter.closecCs
|jj�S)N)r(�getvalue)rrrrr1uszTextWriter.getvalueN)r
rrrr.r0r1rrrrr#dsr#Fc

CsLt|�}
t|
|||||||||	�
}|j|�|
j�}|
j�|rH|j�S|S)a�Convert protobuf message to text format.

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

  Args:
    message: The protocol buffers message.
    as_utf8: Produce text output in UTF8 format.
    as_one_line: Don't introduce newlines between fields.
    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 floating point number formatting
      (per the "Format Specification Mini-Language"); otherwise, str() is used.
    use_field_number: If True, print field numbers instead of names.
    descriptor_pool: A DescriptorPool used to resolve Any types.
    indent: The indent level, in terms of spaces, for pretty print.
    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.

  Returns:
    A string of the text formatted protocol buffer message.
  )r#�_Printerrr1r0�rstrip)
rr*�as_one_line�pointy_brackets�use_index_order�float_format�use_field_number�descriptor_pool�indent�message_formatter�out�printer�resultrrrrys&
cCs"|jtjjko |jjo |jj�jS)N)�typer�FieldDescriptor�TYPE_MESSAGE�message_typeZhas_options�
GetOptionsZ	map_entry)�fieldrrr�_IsMapEntry�srEcCs(t|||||||||	|
�
}|j|�dS)N)r2r)rr<r:r*r4r5r6r7r8r9r;r=rrrr�sc
	Cs&t||||||||	�}
|
j||�dS)z%Print a single field name/value pair.N)r2r)rD�valuer<r:r*r4r5r6r7r;r=rrrr�s
c
	Cs&t||||||||	�}
|
j||�dS)z0Print a single field value (not including name).N)r2r)rDrFr<r:r*r4r5r6r7r;r=rrrr�s
cCsd|dkrddlm}|j�}ddlm}|j�}y|j|�}Wntk
rRdSX|j|�}|�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)r9)�symbol_database)�google.protobufr9ZDefaultrGZFindMessageTypeByName�KeyErrorZGetPrototype)Z	type_namer9Zpool_modrGZdatabase�message_descriptorrBrrr�_BuildMessageFromTypeName�s
rKc	@sJeZdZdZddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dS)r2z)Text format printer for protocol message.rFNcCs@||_||_||_||_||_||_||_||_|	|_|
|_	dS)aZInitialize the Printer.

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

    Args:
      out: To record the text format result.
      indent: The indent level for pretty print.
      as_utf8: Produce text output in UTF8 format.
      as_one_line: Don't introduce newlines between fields.
      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 floating point number formatting
        (per the "Format Specification Mini-Language"); 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.
    N)
r<r:r*r4r5r6r7r8r9r;)rr<r:r*r4r5r6r7r8r9r;rrrr�s%z_Printer.__init__cCsht|j�|j�}|r`|j|j�|jjd|jd|jf�|j	|�|jj|j
rVdnd�dSdSdS)z5Serializes if message is a google.protobuf.Any field.z%s[%s]� �
TFN)rKZTypeNamer9�MergeFromStringrFr<r.r:Ztype_url�_PrintMessageFieldValuer4)rrZpacked_messagerrr�_TryPrintAsAnyMessage.s
z_Printer._TryPrintAsAnyMessagecCsV|j||j|j�}|dkrdS|j}|jd|j�|j|�|j|jrLdnd�dS)NFrLrMT)r;r:r4r<r.)rrZ	formattedr<rrr�_TryCustomFormatMessage;s
z _Printer._TryCustomFormatMessagecCs�|jr|j|�rdS|jjtkr.|j|�r.dS|j�}|jrL|jdd�d�x�|D]z\}}t	|�r�xht
|�D]$}|j�|||d�}|j||�qlWqR|j
tjjkr�x&|D]}|j||�q�WqR|j||�qRWdS)zeConvert protobuf message to text format.

    Args:
      message: The protocol buffers message.
    NcSs
|djS)Nr)�index)�xrrr�<lambda>Ssz'_Printer.PrintMessage.<locals>.<lambda>)�key)rUrF)r;rQ�
DESCRIPTOR�	full_name�_ANY_FULL_TYPE_NAMErPZ
ListFieldsr6�sortrE�sorted�
GetEntryClassr�labelrr@�LABEL_REPEATED)rrZfieldsrDrFrUZentry_submsg�elementrrrrFs"

z_Printer.PrintMessagecCs�|j}|jd|j�|jr.|jt|j��n�|jr�|jd�|jj�j	rv|j
tjj
krv|jtjjkrv|j|jj�n|j|j�|jd�n*|j
tjjkr�|j|jj�n|j|j�|jtjjkr�|jd�|j||�|jr�|jd�n
|jd�dS)z%Print a single field name/value pair.rL�[�]z: rMN)r<r.r:r8r�number�is_extension�containing_typerCZmessage_set_wire_formatr?rr@rAr\ZLABEL_OPTIONALrBrW�
TYPE_GROUP�name�cpp_type�CPPTYPE_MESSAGErr4)rrDrFr<rrrrds*

z_Printer.PrintFieldcCs�|jrd}d}nd}d}|jrF|jjd|�|j|�|jj|�nL|jjd|�|jd7_|j|�|jd8_|jjd|j|�dS)	N�<�>�{�}z %s z %s
�rL)r5r4r<r.rr:)rrFZopenbZclosebrrrrO�s

z _Printer._PrintMessageFieldValuecCs<|j}|jtjjkr"|j|��n|jtjjkrf|jjj	|d�}|dk	rV|j
|j�n|j
t|��n�|jtjj
kr�|j
d�t|tj�r�|jd�}n|}|jtjjkr�d}n|j}|j
tj||��|j
d�nf|jtjjkr�|r�|j
d�n
|j
d�n<|jtk�r*|jdk	�r*|j
dj|j|��n|j
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.
    Nrzutf-8F�true�falsez{1:{0}})r<rfrr@rgrOZCPPTYPE_ENUM�	enum_type�values_by_number�getr.rerZCPPTYPE_STRINGr+r$r,r-r?�
TYPE_BYTESr*rZCEscapeZCPPTYPE_BOOL�_FLOAT_TYPESr7r)rrDrFr<�
enum_valueZ	out_valueZout_as_utf8rrrr�s2	
z_Printer.PrintFieldValue)	rFFFFNFNN)r
rrrrrPrQrrrOrrrrrr2�s 
&
!r2cCs>t|t�s&tjr|jd�}n
|jd�}t|jd�||||d�S)a�Parses 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.

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

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

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

  Caller is responsible for clearing the message as needed.

  Args:
    text: Message 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.

  Returns:
    The same message passed as argument.

  Raises:
    ParseError: On text parsing problems.
  zutf-8rM)r9)r+rr$�PY3�decoder-�
ParseLines�split)�textr�allow_unknown_extension�allow_field_numberr9rrr�Parse�s%


r|cCs>t|t�s&tjr|jd�}n
|jd�}t|jd�||||d�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.

  Args:
    text: Message 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.

  Returns:
    The same message passed as argument.

  Raises:
    ParseError: On text parsing problems.
  zutf-8rM)r9)r+rr$rurvr-�
MergeLinesrx)ryrrzr{r9rrrr	�s

cCst|||d�}|j||�S)aParses a text representation of a protocol message into a message.

  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.

  Returns:
    The same message passed as argument.

  Raises:
    ParseError: On text parsing problems.
  )r9)�_Parserrw)�linesrrzr{r9�parserrrrrwsrwcCst|||d�}|j||�S)aParses a text representation of a protocol message into a message.

  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.

  Returns:
    The same message passed as argument.

  Raises:
    ParseError: On text parsing problems.
  )r9)r~r})rrrzr{r9r�rrrr}3sr}c@sneZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Ze
dd��Zdd�ZdS)r~z(Text format parser for protocol message.FNcCs||_||_||_dS)N)rzr{r9)rrzr{r9rrrrQsz_Parser.__init__cCs&t|t�s|jd�}|j|jd�|�S)zBParses a text representation of a protocol message into a message.zutf-8rM)r+rrvrwrx)rryrrrr�ParseFromStringYs

z_Parser.ParseFromStringcCsd|_|j||�|S)zBParses a text representation of a protocol message into a message.F)�_allow_multiple_scalars�
_ParseOrMerge)rrrrrrrw_sz_Parser.ParseLinescCs|j|jd�|�S)zBMerges a text representation of a protocol message into a message.rM)Z_MergeLinesrx)rryrrrrrNesz_Parser.MergeFromStringcCsd|_|j||�|S)zBMerges a text representation of a protocol message into a message.T)r�r�)rrrrrrr}isz_Parser.MergeLinescCs&t|�}x|j�s |j||�q
WdS)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.
    N)�	Tokenizer�AtEnd�_MergeField)rrr�	tokenizerrrrr�os

z_Parser._ParseOrMergec	Cs�|j}|jd�r�|j�g}x|jd�r6|j|j��qWdj|�}|jsX|jd|j��|jj	|�}|s�|j
rtd}q�|jd|��n||jkr�|jd||jf��|jd�n�|j
�}|jr�|j�r�t|dd�}|jj|d�}|r�|jr�|jj|�}nh|jj|d�}|�s8|jj|j�d�}|�r8|jtjjk�r8d}|�r`|jtjjk�r`|jj|k�r`d}|�sz|jd	|j|f��|�r^|j�r�|j�r�|j|jj�}|dk	�r�||jk�r�|jd
|j||jj|jf��|jtjj k�r�|jd�|j!}n|jd�|j"}|j#tjj$k�rP|jd��rPx8||||�|jd��r>P|jd��q$Wn||||�n|j
�sjt%�t&|�|jd��s�|jd
�dS)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_�.z+Message type "%s" does not have extensions.Nz�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 wellz1Extension "%s" does not extend message type "%s".r`Tz*Message type "%s" has no field named "%s".zbField "%s" is specified along with field "%s", another member of oneof "%s" for message type "%s".�:�,�;)'rV�
TryConsume�ConsumeIdentifier�append�joinZ
is_extendable�ParseErrorPreviousTokenrW�
ExtensionsZ_FindExtensionByNamerzrc�Consume�ConsumeIdentifierOrNumberr{�isdigit�ParseIntegerZfields_by_numberrqZ_FindExtensionByNumber�fields_by_name�lowerr?rr@rdrBrer�Zcontaining_oneofZ
WhichOneofrfrg�_MergeMessageField�_MergeScalarFieldr\r]�AssertionError�_SkipFieldContents)	rr�rrJrerDraZwhich_oneofZmergerrrrr�}s�








z_Parser._MergeFieldcCs�|j�g}|jd�|j|j��|jd�|j|j��|jd�|j�g}x|jd�rj|j|j��qPWdj|�dj|�fS)zBConsumes a google.protobuf.Any type URL and returns the type name.r��/)r�r�r�r�r�)rr��prefixrerrr�_ConsumeAnyTypeUrl�s




z_Parser._ConsumeAnyTypeUrlcCst|�}|jd�rd}n|jd�d}|jjtko:|jd��r
|j|�\}}|jd�|jd�|jd�rpd}n|jd�d}t||j�}	|	s�t	d|��x2|j|�s�|j
�r�|jd	|f��|j||	�q�W|j
tjjkr�t||j�j�}
nt||j�}
|
j|	|d
�n||j
tjjk�r^|j�r2|j|j�}n*|�rLt||j�j��}nt||j�j�}n(|j�rr|j|}nt||j�}|j�x8|j|��s�|j
��r�|jd	|f��|j||��q�W|�r|jjdj}|tjjk�rt||j�|j}
|
j|j�n|jt||j�|j<d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.
    rhrirjrkr_r`r�z$Type %s not found in descriptor poolzExpected "%s".)�type_url_prefixrFN)rEr�r�rBrWrXr�rKr9rr�r�r�r\rr@r]�getattrre�addZPackrbr�r[ZSetInParentr�rfrgrUZ	MergeFromrF)rr�rrDZis_map_entryZ	end_tokenr�Zpacked_type_nameZexpanded_any_end_tokenZexpanded_any_sub_messageZany_messageZsub_messageZ
value_cpptyperFrrrr��sb








z_Parser._MergeMessageFieldcCs|j}t|d�o|jdkS)N�syntax�proto3)rV�hasattrr�)rrJrrr�_IsProto3SyntaxAs
z_Parser._IsProto3SyntaxcCs|j}d}|jtjjtjjtjjfkr0t|�}n�|jtjjtjj	tjj
fkrVt|�}n�|jtjjtjj
fkrvt|�}n�|jtjjtjjfkr�t|�}n�|jtjjtjjfkr�|j�}nr|jtjjkr�|j�}nZ|jtjjkr�|j�}nB|jtjjkr�|j�}n*|jtjjk�r|j|�}ntd|j��|jtjjk�rf|j �rR|j!|j"|�nt#||j$�j"|�n�|j%|�}|j �r�|j&�r�|�r�|j'|��r�|j(d|j)j*|j*f��n
||j!|<nF|j&�r�|�r�|j+|j$��r�|j(d|j)j*|j$f��nt,||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 %dz;Message type "%s" should not have multiple "%s" extensions.z7Message type "%s" should not have multiple "%s" fields.)-rzr?rr@Z
TYPE_INT32ZTYPE_SINT32Z
TYPE_SFIXED32�
_ConsumeInt32Z
TYPE_INT64ZTYPE_SINT64Z
TYPE_SFIXED64�
_ConsumeInt64ZTYPE_UINT32ZTYPE_FIXED32�_ConsumeUint32ZTYPE_UINT64ZTYPE_FIXED64�_ConsumeUint64Z
TYPE_FLOATZTYPE_DOUBLE�ConsumeFloatZ	TYPE_BOOL�ConsumeBoolZTYPE_STRING�
ConsumeStringrr�ConsumeByteStringZ	TYPE_ENUM�ConsumeEnum�RuntimeErrorr\r]rbr�r�r�rer�r�ZHasExtensionr�rVrWZHasField�setattr)rr�rrD�_rFZcan_check_presencerrrr�Gs\












z_Parser._MergeScalarField)FFN)r
rrrrr�rwrNr}r�r�r�r��staticmethodr�r�rrrrr~Ns
mHr~cCs8|jd�r,|jd�r,|jd�r,t|�nt|�dS)z}Skips over contents (value or message) of a field.

  Args:
    tokenizer: A tokenizer to parse the field name and values.
  r�rjrhN)r��	LookingAt�_SkipFieldValue�_SkipFieldMessage)r�rrrr��s
r�cCs^|jd�r6|j�x|jd�r(|j�qW|jd�n|j�t|�|jd�sZ|jd�dS)z�Skips over a complete field (name and value/message).

  Args:
    tokenizer: A tokenizer to parse the field name and values.
  r_r�r`r�r�N)r�r�r�r�)r�rrr�
_SkipField�s

r�cCsR|jd�rd}n|jd�d}x$|jd�rB|jd�rBt|�q W|j|�dS)zfSkips over a field message.

  Args:
    tokenizer: A tokenizer to parse the field name and values.
  rhrirjrkN)r�r�r�r�)r�Z	delimiterrrrr��s

r�cCsT|j�rx|j�rq
WdS|j�rPt|�rPt|�rP|j�rPtd|j��dS)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�token)r�rrrr��s


r�c@sHeZdZdZejd�Zejdej�Zejdej�Z	ejdj
ddgdd	�eD���Zejd
�Z
ejd�ZdEd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�ZdFd*d+�Zd,d-�Zd.d/�Zd0d1�Z d2d3�Z!d4d5�Z"d6d7�Z#d8d9�Z$d:d;�Z%d<d=�Z&d>d?�Z'd@dA�Z(dBdC�Z)dDS)Gr�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_.+-]*cCsg|]}dj|d��qS)z!{qt}([^{qt}\n\\]|\\.)*({qt}|\\?$))Zqt)r)�.0Zmarkrrr�
<listcomp>�szTokenizer.<listcomp>z
[^\d\W]\w*z\w+TcCsld|_d|_d|_d|_d|_t|�|_d|_d|_d|_	d|_
||_|rP|jpT|j
|_|j�|j�dS)Nr��T���)Z	_positionrrZ_token_startr��iter�_lines�
_current_line�_previous_line�_previous_column�_more_lines�_skip_comments�_WHITESPACE_OR_COMMENT�_WHITESPACE�_whitespace_pattern�_SkipWhitespace�	NextToken)rrZ
skip_commentsrrrr�s

zTokenizer.__init__cCs
|j|kS)N)r�)rr�rrrr�szTokenizer.LookingAtcCs|jS)z^Checks the end of the text was reached.

    Returns:
      True iff the end was reached.
    )r�)rrrrr�
szTokenizer.AtEndcCs`xZt|j�|jkrZyt|j�|_Wn tk
rBd|_d|_dSX|jd7_d|_qWdS)Nr�Fr�r)�lenr�r�nextr��
StopIterationr�r)rrrr�_PopLineszTokenizer._PopLinecCsFx@|j�|jj|j|j�}|s"Pt|jd��}|j|7_qWdS)Nr)r�r��matchr�rr��group)rr�Zlengthrrrr�szTokenizer._SkipWhitespacecCs|j|kr|j�dSdS)z�Tries to consume a given piece of text.

    Args:
      token: Text to consume.

    Returns:
      True iff the text was consumed.
    TF)r�r�)rr�rrrr�'s	
zTokenizer.TryConsumecCs|j|�s|jd|��dS)z�Consumes a piece of text.

    Args:
      token: Text to consume.

    Raises:
      ParseError: If the text couldn't be consumed.
    zExpected "%s".N)r�r)rr�rrrr�5s	
zTokenizer.ConsumecCs(|j}|jj|�s|jd��|j�|S)NzExpected comment.)r��_COMMENTr�rr�)rr>rrr�ConsumeCommentAs

zTokenizer.ConsumeCommentcCs:|jdko|jdk}|j}|j�}|j|ko0|}||fS)zCConsumes a comment, returns a 2-tuple (trailing bool, comment str).r)rrr�r�)rZjust_startedZbefore_parsingZcommentZtrailingrrr�ConsumeCommentOrTrailingCommentHs
z)Tokenizer.ConsumeCommentOrTrailingCommentcCs&y|j�dStk
r dSXdS)NTF)r�r)rrrrr�Xs
zTokenizer.TryConsumeIdentifiercCs(|j}|jj|�s|jd��|j�|S)z�Consumes protocol message field identifier.

    Returns:
      Identifier string.

    Raises:
      ParseError: If an identifier couldn't be consumed.
    zExpected identifier.)r��_IDENTIFIERr�rr�)rr>rrrr�_s
	
zTokenizer.ConsumeIdentifiercCs&y|j�dStk
r dSXdS)NTF)r�r)rrrr�TryConsumeIdentifierOrNumberns
z&Tokenizer.TryConsumeIdentifierOrNumbercCs,|j}|jj|�s |jd|��|j�|S)z�Consumes protocol message field identifier.

    Returns:
      Identifier string.

    Raises:
      ParseError: If an identifier couldn't be consumed.
    z&Expected identifier or number, got %s.)r��_IDENTIFIER_OR_NUMBERr�rr�)rr>rrrr�us
	z#Tokenizer.ConsumeIdentifierOrNumbercCs&y|j�dStk
r dSXdS)NTF)�ConsumeIntegerr)rrrr�TryConsumeInteger�s
zTokenizer.TryConsumeIntegerFcCsPyt|j|d�}Wn0tk
rB}z|jt|���WYdd}~XnX|j�|S)z�Consumes an integer number.

    Args:
      is_long: True if the value should be returned as a long integer.
    Returns:
      The integer parsed.

    Raises:
      ParseError: If an integer couldn't be consumed.
    )�is_longN)�_ParseAbstractIntegerr��
ValueErrorrrr�)rr�r>�errrr��s zTokenizer.ConsumeIntegercCs&y|j�dStk
r dSXdS)NTF)r�r)rrrrr��s
zTokenizer.TryConsumeFloatcCsLyt|j�}Wn0tk
r>}z|jt|���WYdd}~XnX|j�|S)z�Consumes an floating point number.

    Returns:
      The number parsed.

    Raises:
      ParseError: If a floating point number couldn't be consumed.
    N)�
ParseFloatr�r�rrr�)rr>r�rrrr��s	 zTokenizer.ConsumeFloatcCsLyt|j�}Wn0tk
r>}z|jt|���WYdd}~XnX|j�|S)z�Consumes a boolean value.

    Returns:
      The bool parsed.

    Raises:
      ParseError: If a boolean value couldn't be consumed.
    N)�	ParseBoolr�r�rrr�)rr>r�rrrr��s	 zTokenizer.ConsumeBoolcCs&y|j�dStk
r dSXdS)NTF)r�r)rrrrr��s
zTokenizer.TryConsumeByteStringcCsF|j�}ytj|d�Stk
r@}z|j|��WYdd}~XnXdS)z�Consumes a string value.

    Returns:
      The string parsed.

    Raises:
      ParseError: If a string value couldn't be consumed.
    zutf-8N)r�r$r,�UnicodeDecodeError�_StringParseError)rZ	the_bytesr�rrrr��s
	zTokenizer.ConsumeStringcCs<|j�g}x&|jr0|jdtkr0|j|j��qWdj|�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.
    r�)�_ConsumeSingleByteStringr��_QUOTESr�r�)rZthe_listrrrr��s	
zTokenizer.ConsumeByteStringcCs�|j}t|�dks|dtkr.|jd|f��t|�dksJ|d|dkrZ|jd|f��ytj|dd��}Wn0tk
r�}z|jt|���WYdd}~XnX|j�|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: %rrlzString missing ending quote: %rNr�r�)	r�r�r�rrZ	CUnescaper�rr�)rryr>r�rrrr��s z"Tokenizer._ConsumeSingleByteStringcCsNyt||j�}Wn0tk
r@}z|jt|���WYdd}~XnX|j�|S)N)�	ParseEnumr�r�rrr�)rrDr>r�rrrr�s zTokenizer.ConsumeEnumcCst||jd|jd�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�)rr�r�)rrrrrr�s	z!Tokenizer.ParseErrorPreviousTokencCst||jd|jd�S)z9Creates and *returns* a ParseError for the current token.r�)rrr)rrrrrrszTokenizer.ParseErrorcCs|jdt|��S)NzCouldn't parse string: )rr)rr�rrrr�szTokenizer._StringParseErrorcCs�|j|_|j|_|jt|j�7_|j�|js<d|_dS|jj	|j
|j�}|rn|jrn|jj	|j
|j�}|r�|j
d�}||_n|j
|j|_dS)z Reads the next meaningful token.r�Nr)rr�rr�r�r�r�r��_TOKENr�r�r�r�r�)rr�r�rrrr�s
zTokenizer.NextTokenN)T)F)*r
rrr�re�compiler��	MULTILINEr�r�r�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r�rrrrr��sJ



	
r�cCst|ddd�S)z�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_signedr�)�_ConsumeInteger)r�rrrr�8sr�cCst|ddd�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.
  F)r�r�)r�)r�rrrr�Gsr�cCs&yt|�dStk
r dSXdS)NTF)r�r)r�rrrr�Vs
r�cCst|ddd�S)z�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.
  T)r�r�)r�)r�rrrr�^sr�cCs&yt|�dStk
r dSXdS)NTF)r�r)r�rrrr�ms
r�cCst|ddd�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.
  FT)r�r�)r�)r�rrrr�usr�cCs,yt|||d�dStk
r&dSXdS)N)r�r�TF)r�r)r�r�r�rrr�_TryConsumeInteger�s
r�cCsRyt|j||d�}Wn0tk
rD}z|jt|���WYdd}~XnX|j�|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�r�N)r�r�r�rrr�)r�r�r�r>r�rrrr��s r�cCs2t||d�}tdt|�t|�}|j|�|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.
  )r�rl)r��_INTEGER_CHECKERS�intZ
CheckValue)ryr�r�r>Zcheckerrrrr��s
r�cCsBy|rt|d�St|d�SWn tk
r<td|��YnXdS)aParses an integer without checking size/signedness.

  Args:
    text: The text to parse.
    is_long: True if the value should be returned as a long integer.

  Returns:
    The integer value.

  Raises:
    ValueError: Thrown Iff the text is not a valid integer.
  rzCouldn't parse integer: %sN)r�r�)ryr�rrrr��s
r�cCs�yt|�Stk
r�tj|�r@|ddkr6td�Std�SnBtj|�rRtd�Syt|jd��Stk
r�td|��YnXYnXdS)	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: %sN)�floatr��_FLOAT_INFINITYr��
_FLOAT_NANr3)ryrrrr��s


r�cCs$|d
krdS|dkrd
Std��dS)z�Parse a boolean value.

  Args:
    text: Text to parse.

  Returns:
    Boolean values parsed

  Raises:
    ValueError: If text is not a valid boolean.
  rm�t�1�TrueTrnr��0�FalseFzExpected "true" or "false".N)rmr�r�r�)rnr�r�r�)r�)ryrrrr��s
r�cCs�|j}yt|d�}Wn<tk
rP|jj|d�}|dkrLtd|j|f��YnFXt|jd�rn|jjdkrn|S|j	j|d�}|dkr�td|j|f��|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.
  rNz%Enum type "%s" has no value named %s.r�r�z+Enum type "%s" has no value with number %d.)ror�r�Zvalues_by_namerqrWr��filer�rpra)rDrFZenum_descriptorrartrrrr�s r�)r
r)	FFFFNFNrN)	rFFFFNFNN)rFFFFNN)rFFFFNN)FFN)FFN)FFN)FFN)FF)FF)FF)F)Br�
__author__r&r�r$rur�ZlongZgoogle.protobuf.internalrrHrr�__all__ZUint32ValueCheckerZInt32ValueCheckerZUint64ValueCheckerZInt64ValueCheckerr�r��
IGNORECASEr�r��	frozensetr@Z
CPPTYPE_FLOATZCPPTYPE_DOUBLErsr�rX�	Exceptionrr�objectr#rrErrrrKr2r|r	rwr}r~r�r�r�r�r�Z
_Tokenizerr�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�<module>)s�

)




J
/
#

AW



 

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 319 B 0644
__init__.cpython-36.pyc File 319 B 0644
any_pb2.cpython-36.opt-1.pyc File 2.09 KB 0644
any_pb2.cpython-36.pyc File 2.09 KB 0644
any_test_pb2.cpython-36.opt-1.pyc File 2.18 KB 0644
any_test_pb2.cpython-36.pyc File 2.18 KB 0644
api_pb2.cpython-36.opt-1.pyc File 4.73 KB 0644
api_pb2.cpython-36.pyc File 4.73 KB 0644
descriptor.cpython-36.opt-1.pyc File 31.27 KB 0644
descriptor.cpython-36.pyc File 31.27 KB 0644
descriptor_database.cpython-36.opt-1.pyc File 4.11 KB 0644
descriptor_database.cpython-36.pyc File 4.11 KB 0644
descriptor_pb2.cpython-36.opt-1.pyc File 30.36 KB 0644
descriptor_pb2.cpython-36.pyc File 30.36 KB 0644
descriptor_pool.cpython-36.opt-1.pyc File 26.77 KB 0644
descriptor_pool.cpython-36.pyc File 26.8 KB 0644
duration_pb2.cpython-36.opt-1.pyc File 2.13 KB 0644
duration_pb2.cpython-36.pyc File 2.13 KB 0644
empty_pb2.cpython-36.opt-1.pyc File 1.69 KB 0644
empty_pb2.cpython-36.pyc File 1.69 KB 0644
field_mask_pb2.cpython-36.opt-1.pyc File 2.05 KB 0644
field_mask_pb2.cpython-36.pyc File 2.05 KB 0644
json_format.cpython-36.opt-1.pyc File 20.32 KB 0644
json_format.cpython-36.pyc File 20.32 KB 0644
map_proto2_unittest_pb2.cpython-36.opt-1.pyc File 18.31 KB 0644
map_proto2_unittest_pb2.cpython-36.pyc File 18.31 KB 0644
map_unittest_pb2.cpython-36.opt-1.pyc File 39.56 KB 0644
map_unittest_pb2.cpython-36.pyc File 39.56 KB 0644
message.cpython-36.opt-1.pyc File 10.48 KB 0644
message.cpython-36.pyc File 10.48 KB 0644
message_factory.cpython-36.opt-1.pyc File 3.93 KB 0644
message_factory.cpython-36.pyc File 3.93 KB 0644
proto_builder.cpython-36.opt-1.pyc File 2.68 KB 0644
proto_builder.cpython-36.pyc File 2.68 KB 0644
reflection.cpython-36.opt-1.pyc File 2.65 KB 0644
reflection.cpython-36.pyc File 2.65 KB 0644
service.cpython-36.opt-1.pyc File 8.56 KB 0644
service.cpython-36.pyc File 8.56 KB 0644
service_reflection.cpython-36.opt-1.pyc File 9.76 KB 0644
service_reflection.cpython-36.pyc File 9.76 KB 0644
source_context_pb2.cpython-36.opt-1.pyc File 2.15 KB 0644
source_context_pb2.cpython-36.pyc File 2.15 KB 0644
struct_pb2.cpython-36.opt-1.pyc File 5.02 KB 0644
struct_pb2.cpython-36.pyc File 5.02 KB 0644
symbol_database.cpython-36.opt-1.pyc File 5.32 KB 0644
symbol_database.cpython-36.pyc File 5.32 KB 0644
test_messages_proto2_pb2.cpython-36.opt-1.pyc File 38.69 KB 0644
test_messages_proto2_pb2.cpython-36.pyc File 38.69 KB 0644
test_messages_proto3_pb2.cpython-36.opt-1.pyc File 43.27 KB 0644
test_messages_proto3_pb2.cpython-36.pyc File 43.27 KB 0644
text_encoding.cpython-36.opt-1.pyc File 3.06 KB 0644
text_encoding.cpython-36.pyc File 3.06 KB 0644
text_format.cpython-36.opt-1.pyc File 38.55 KB 0644
text_format.cpython-36.pyc File 38.58 KB 0644
timestamp_pb2.cpython-36.opt-1.pyc File 2.14 KB 0644
timestamp_pb2.cpython-36.pyc File 2.14 KB 0644
type_pb2.cpython-36.opt-1.pyc File 8.49 KB 0644
type_pb2.cpython-36.pyc File 8.49 KB 0644
unittest_arena_pb2.cpython-36.opt-1.pyc File 2.76 KB 0644
unittest_arena_pb2.cpython-36.pyc File 2.76 KB 0644
unittest_custom_options_pb2.cpython-36.opt-1.pyc File 32.24 KB 0644
unittest_custom_options_pb2.cpython-36.pyc File 32.24 KB 0644
unittest_import_pb2.cpython-36.opt-1.pyc File 3.11 KB 0644
unittest_import_pb2.cpython-36.pyc File 3.11 KB 0644
unittest_import_public_pb2.cpython-36.opt-1.pyc File 1.93 KB 0644
unittest_import_public_pb2.cpython-36.pyc File 1.93 KB 0644
unittest_mset_pb2.cpython-36.opt-1.pyc File 4.46 KB 0644
unittest_mset_pb2.cpython-36.pyc File 4.46 KB 0644
unittest_mset_wire_format_pb2.cpython-36.opt-1.pyc File 2.51 KB 0644
unittest_mset_wire_format_pb2.cpython-36.pyc File 2.51 KB 0644
unittest_no_arena_import_pb2.cpython-36.opt-1.pyc File 1.83 KB 0644
unittest_no_arena_import_pb2.cpython-36.pyc File 1.83 KB 0644
unittest_no_arena_pb2.cpython-36.opt-1.pyc File 20.24 KB 0644
unittest_no_arena_pb2.cpython-36.pyc File 20.24 KB 0644
unittest_no_generic_services_pb2.cpython-36.opt-1.pyc File 3.23 KB 0644
unittest_no_generic_services_pb2.cpython-36.pyc File 3.23 KB 0644
unittest_pb2.cpython-36.opt-1.pyc File 124.95 KB 0644
unittest_pb2.cpython-36.pyc File 124.95 KB 0644
unittest_proto3_arena_pb2.cpython-36.opt-1.pyc File 21.42 KB 0644
unittest_proto3_arena_pb2.cpython-36.pyc File 21.42 KB 0644
wrappers_pb2.cpython-36.opt-1.pyc File 4.58 KB 0644
wrappers_pb2.cpython-36.pyc File 4.58 KB 0644