Spade
Mini Shell
| Directory:~$ /proc/self/root/usr/lib/python2.7/site-packages/google/protobuf/ |
| [Home] [System Details] [Kill Me] |
�
Q�,Qc@s�dZdZddlZddlZddlmZddlmZddlm Z ddd d
dgZ
ej�ej�ej
�ej�fZejdej�Zejd
ej�Zdefd��YZeed�Zdeed�Zdeed�Zdeed�Zd�Zd�Zd�Zdefd��YZd�Z
ejd�Z!d�Z"eed�Z#d�Z$d�Z%d
�Z&dS(!s@Contains routines for printing protocol messages in text
format.s kenton@google.com (Kenton
Varda)i����N(tdeque(t
type_checkers(t
descriptortMessageToStringtPrintMessaget
PrintFieldtPrintFieldValuetMerges-?inf(?:inity)?f?snanf?t
ParseErrorcBseZdZRS(s&Thrown in case of ASCII parsing
error.(t__name__t
__module__t__doc__(((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR6scCsOtj�}t||d|d|�|j�}|j�|rK|j�S|S(Ntas_utf8tas_one_line(t cStringIOtStringIORtgetvaluetclosetrstrip(tmessageRR
touttresult((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR:s
ic Cs|xu|j�D]g\}}|jtjjkr[xC|D]}t||||||�q5Wq
t||||||�q
WdS(N(t
ListFieldstlabelRtFieldDescriptortLABEL_REPEATEDR(RRtindentRR
tfieldtvaluetelement((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRDs
c
CsK|jd|�|jr�|jd�|jj�jr�|jtjjkr�|j |j
kr�|jtjjkr�|j|j j
�n|j|j
�|jd�n;|jtjjkr�|j|j j�n|j|j�|jtjjkr|jd�nt||||||�|r:|jd�n
|jd�dS(scPrint
a single field name/value pair. For repeated fields, the value
should be a single element.t t[t]s: s
N(twritetis_extensiontcontaining_typet
GetOptionstmessage_set_wire_formatttypeRRtTYPE_MESSAGEtmessage_typetextension_scopeRtLABEL_OPTIONALt full_namet
TYPE_GROUPtnametcpp_typetCPPTYPE_MESSAGER(RRRRRR
((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRMs&
cCs�|jtjjkr�|rN|jd�t|||||�|jd�q�|jd�t|||d||�|jd|d�n,|jtjjkr�|jjj |d
�}|d
k r�|j|j�q�|jt|��n�|jtjj
krk|jd�t|�tkrE|jt|jd�|��n|jt||��|jd�nN|jtjjkr�|r�|jd�q�|jd �n|jt|��d
S(snPrint a single field value (not including name). For repeated fields,
the value should be a single element.s { t}s {
iRs"sutf-8ttruetfalseN(R.RRR/R!RtCPPTYPE_ENUMt enum_typetvalues_by_numbertgettNoneR-tstrtCPPTYPE_STRINGR&tunicodet_CEscapetencodetCPPTYPE_BOOL(RRRRRR
t
enum_value((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRns0
"cCs0t|�}x|j�s+t||�qWdS(s�Merges
an ASCII representation of a protocol message into a message.
Args:
text: Message ASCII representation.
message: A protocol buffer message to merge into.
Raises:
ParseError: On ASCII parsing problems.
N(t
_TokenizertAtEndt_MergeField(ttextRt tokenizer((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR�s
cCs�|j}|jd�r�|j�g}x&|jd�rO|j|j��q*Wdj|�}|js�|jd|j��n|jj |�}|s�|jd|��n.||j
kr�|jd||jf��n|jd�n�|j�}|jj
|d�}|sV|jj
|j�d�}|rV|jtjjkrVd}qVn|r�|jtjjkr�|jj|kr�d}n|s�|jd|j|f��n|jtjjkr�|jd�|jd �r�d
}n|jd�d}|jtjjkrM|jr2|j|j�}q�t||j�j�}n5|jrf|j|}nt||j�}|j�xU|j|�s�|j�r�|jd
|��nt||�q�Wnt
|||�dS(s�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 ASCII parsing problems.
Rt.s+Message type "%s" does not have extensions.sExtension
"%s" not registered.s1Extension "%s" does not extend
message type "%s".R s*Message type "%s" has no field
named "%s".t:t<t>t{R0sExpected "%s".N(!t
DESCRIPTORt
TryConsumetConsumeIdentifiertappendtjoint
is_extendabletParseErrorPreviousTokenR+t
Extensionst_FindExtensionByNameR#tConsumetfields_by_nameR6R7tlowerR&RRR,R(R-R.R/RRR"taddtgetattrtSetInParentR@RAt_MergeScalarField(RCRtmessage_descriptorR-Rt end_tokentsub_message((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRA�sf
cCs<|jd�d}|jtjjtjjtjjfkrL|j�}no|jtjj tjj
tjjfkr�|j�}n6|jtjj
tjjfkr�|j�}n|jtjjtjjfkr�|j�}n�|jtjjtjjfkr|j�}n�|jtjjkr9|j�}n�|jtjjkr]|j�}n^|jtjjkr�|j�}n:|jtjjkr�|j|�}ntd|j��|jtjj
kr|j!r�|j"|j#|�q8t$||j%�j#|�n,|j!r%||j"|<nt&||j%|�dS(sJMerges
a single protocol message 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 ASCII parsing problems.
RuntimeError: On runtime errors.
REsUnknown field type %dN('RRR7R&RRt
TYPE_INT32tTYPE_SINT32t
TYPE_SFIXED32tConsumeInt32t
TYPE_INT64tTYPE_SINT64t
TYPE_SFIXED64tConsumeInt64tTYPE_UINT32tTYPE_FIXED32t
ConsumeUint32tTYPE_UINT64tTYPE_FIXED64t
ConsumeUint64t
TYPE_FLOATtTYPE_DOUBLEtConsumeFloatt TYPE_BOOLtConsumeBooltTYPE_STRINGt
ConsumeStringt
TYPE_BYTEStConsumeByteStringt TYPE_ENUMtConsumeEnumtRuntimeErrorRRR"RPRLRVR-tsetattr(RCRRR((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRX�sF
R?cBs�eZdZejdej�Zejd�Zejd�Zd�Z d�Z
d�Zd�Zd�Z
d �Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(s�Protocol
buffer ASCII 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.
s(\s|(#.*$))+s`[a-zA-Z_][0-9a-zA-Z_+-]*|[0-9+-][0-9a-zA-Z_.+-]*|"([^"
\\]|\\.)*("|\\?$)|'([^'
\\]|\\.)*('|\\?$)s\w+cCs�||_d|_d|_d|_d|_d|_t|jd��|_ d|_
d|_d|_|j
�|j�dS(Nii����ts
(t
_text_messaget _positiont_linet_columnR7t_token_startttokenRtsplitt_linest
_current_linet_previous_linet_previous_columnt_SkipWhitespacet NextToken(tselfttext_message((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyt__init__9s
cCs
|jdkS(s^Checks the end of the text was reached.
Returns:
True iff the end was reached.
Rw(R}(R�((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR@HscCscx\t|j�|jkr^|js1d|_dS|jd7_d|_|jj�|_qWdS(NRwii(tlenR�R{RRztpopleft(R�((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyt_PopLinePs cCsdx]tr_|j�|jj|j|j�}|s8Pnt|jd��}|j|7_qWdS(Ni(tTrueR�t_WHITESPACEtmatchR�R{R�tgroup(R�R�tlength((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR�Ys
cCs!|j|kr|j�tStS(s�Tries to consume a given piece
of text.
Args:
token: Text to consume.
Returns:
True iff the text was consumed.
(R}R�R�tFalse(R�R}((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRJbs
cCs)|j|�s%|jd|��ndS(s�Consumes a piece of text.
Args:
token: Text to consume.
Raises:
ParseError: If the text couldn't be consumed.
sExpected
"%s".N(RJt_ParseError(R�R}((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRRps cCs;|j}|jj|�s-|jd��n|j�|S(s�Consumes
protocol message field identifier.
Returns:
Identifier string.
Raises:
ParseError: If an identifier couldn't be consumed.
sExpected
identifier.(R}t_IDENTIFIERR�R�R�(R�R((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRK|s
cCsXyt|jdtdt�}Wn(tk
rI}|jt|���nX|j�|S(s�Consumes a signed 32bit integer
number.
Returns:
The integer parsed.
Raises:
ParseError: If a signed 32bit integer couldn't be consumed.
t is_signedtis_long(tParseIntegerR}R�R�t
ValueErrorR�R8R�(R�Rte((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR_�s
cCsXyt|jdtdt�}Wn(tk
rI}|jt|���nX|j�|S(s�Consumes an unsigned 32bit
integer number.
Returns:
The integer parsed.
Raises:
ParseError: If an unsigned 32bit integer couldn't be consumed.
R�R�(R�R}R�R�R�R8R�(R�RR�((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRf�s
cCsXyt|jdtdt�}Wn(tk
rI}|jt|���nX|j�|S(s�Consumes a signed 64bit integer
number.
Returns:
The integer parsed.
Raises:
ParseError: If a signed 64bit integer couldn't be consumed.
R�R�(R�R}R�R�R�R8R�(R�RR�((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRc�s
cCsXyt|jdtdt�}Wn(tk
rI}|jt|���nX|j�|S(s�Consumes an unsigned 64bit
integer number.
Returns:
The integer parsed.
Raises:
ParseError: If an unsigned 64bit integer couldn't be consumed.
R�R�(R�R}R�R�R�R�R8R�(R�RR�((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRi�s
cCsLyt|j�}Wn(tk
r=}|jt|���nX|j�|S(s�Consumes an floating point
number.
Returns:
The number parsed.
Raises:
ParseError: If a floating point number couldn't be consumed.
(t
ParseFloatR}R�R�R8R�(R�RR�((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRl�s
cCsLyt|j�}Wn(tk
r=}|jt|���nX|j�|S(s�Consumes a boolean value.
Returns:
The bool parsed.
Raises:
ParseError: If a boolean value couldn't be consumed.
(t ParseBoolR}R�R�R8R�(R�RR�((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRn�s
cCsF|j�}yt|d�SWn"tk
rA}|j|��nXdS(s�Consumes a string value.
Returns:
The string parsed.
Raises:
ParseError: If a string value couldn't be consumed.
sutf-8N(RrR:tUnicodeDecodeErrort_StringParseError(R�tbytesR�((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRp�s
cCs^|j�g}x?t|j�dkrP|jddkrP|j|j��qWdj|�S(s�Consumes
a byte array value.
Returns:
The array parsed (as a string).
Raises:
ParseError: If a byte array value couldn't be consumed.
is't"Rw(s'R�(t_ConsumeSingleByteStringR�R}RLRM(R�tlist((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRr�s +cCs�|j}t|�dks+|dd kr=|jd��nt|�dksc|d|dkru|jd��nyt|dd!�}Wn(tk
r�}|jt|���nX|j�|S(
s�Consume 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.
iis'R�sExpected string.ii����sString missing ending
quote.(s'R�(R}R�R�t
_CUnescapeR�R8R�(R�RBRR�((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR�s "&
cCsOyt||j�}Wn(tk
r@}|jt|���nX|j�|S(N(t ParseEnumR}R�R�R8R�(R�RRR�((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRts
cCs%td|jd|jd|f�S(s�Creates and *returns* a ParseError
for the previously read token.
Args:
message: A message to set for the exception.
Returns:
A ParseError instance.
s
%d:%d :
%si(RR�R�(R�R((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyRO%s cCs%td|jd|jd|f�S(s9Creates
and *returns* a ParseError for the current token.s
%d:%d :
%si(RRzR{(R�R((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR�1scCs|jdt|��S(NsCouldn't
parse string:
(R�R8(R�R�((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR�6scCs�|j|_|j|_|jt|j�7_|j�|jrit|j�|jkrid|_dS|j j
|j|j�}|r�|jd�}||_n|j|j|_dS(s Reads the next
meaningful
token.RwNi(RzR�R{R�R�R}R�RR�t_TOKENR�R�(R�R�R}((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR�9s
" (R R
Rtretcompilet MULTILINER�R�R�R�R@R�R�RJRRRKR_RfRcRiRlRnRpRrR�RtROR�R�R�(((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR?(s4 cs5�fd�}djg|D]}||�^q�S(Ncs�t|�}|dkrdS|dkr,dS|dkr<dS|dkrLdS|d kr\d
S|dkrldS�r�|d
ks�|dkr�d|S|S(Ni
s\ni
s\ri s\ti's\'i"s\"i\s\\ii
s\%03o(tord(tcto(R(s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pytescapeSs
Rw(RM(RBRR�R�((Rs?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR;Rs
s"(\\+)x([0-9a-fA-F])(?![0-9a-fA-F])cCs(d�}tj||�}|jd�S(NcSsDt|jd��d@r7|jd�d|jd�S|jd�S(Nitx0ii(R�R�(tm((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyt
ReplaceHexgst
string_escape(t_CUNESCAPE_HEXtsubtdecode(RBR�R((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR�fs cCsfyt|d�}Wn!tk
r6td|��nXtdt|�t|�}|j|�|S(sParses 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.
isCouldn't parse integer: %si(tintR�t_INTEGER_CHECKERSt
CheckValue(RBR�R�Rtchecker((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR�ts
cCs�yt|�SWn�tk
r�tj|�rT|ddkrGtd�Std�Sq�tj|�rmtd�Syt|jd��SWq�tk
r�td|��q�XnXdS( s�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.
it-s-inftinftnantfsCouldn't parse float:
%sN(tfloatR�t_FLOAT_INFINITYR�t
_FLOAT_NANR(RB((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR��s
cCs0|d krtS|d
kr tStd��dS(s�Parse a boolean value.
Args:
text: Text to parse.
Returns:
Boolean values parsed
Raises:
ValueError: If text is not a valid boolean.
R1ttt1R2R�t0sExpected "true" or
"false".N(strueR�R�(sfalseR�R�(R�R�R�(RB((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR��s
cCs�|j}yt|d�}WnNtk
rl|jj|d�}|dkr�td|j|f��q�n>X|jj|d�}|dkr�td|j|f��n|jS(s&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.
is%Enum type "%s" has no value named %s.s+Enum type
"%s" has no value with number
%d.N( R4R�R�tvalues_by_nameR6R7R+R5tnumber(RRtenum_descriptorR�R>((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyR��s
('Rt
__author__RR�tcollectionsRtgoogle.protobuf.internalRtgoogle.protobufRt__all__tUint32ValueCheckertInt32ValueCheckertUint64ValueCheckertInt64ValueCheckerR�R�t
IGNORECASER�R�t ExceptionRR�RRRRRRARXtobjectR?R;R�R�R�R�R�R�(((s?/usr/lib/python2.7/site-packages/google/protobuf/text_format.pyt<module>s@
!# P 7�+