AlkantarClanX12

Your IP : 3.135.194.138


Current Path : /lib/python2.7/site-packages/google/protobuf/internal/
Upload File :
Current File : //lib/python2.7/site-packages/google/protobuf/internal/containers.pyc

�
Du�ac@sdZdZddlZddlZejddkr�defd��YZdefd	��YZejje�ejje�n	ejZd
efd��YZ	de	fd
��YZ
ejje	�de	fd��YZdefd��YZ
defd��YZdS(s�Contains container classes to represent different protocol buffer types.

This file defines container classes which represent categories of protocol
buffer field types which need extra maintenance. Currently these categories
are:
  - Repeated scalar fields - These are all repeated fields which aren't
    composite (e.g. they are of simple types like int32, string, etc).
  - Repeated composite fields - Repeated fields which are composite. This
    includes groups and nested messages.
spetar@google.com (Petar Petrov)i����NiitMappingcBsqeZd
Zdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�ZdZd�Z
d	�ZRS(cCs%y||SWntk
r |SXdS(N(tKeyError(tselftkeytdefault((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pytgetGs
cCs)y||Wntk
r tSXtSdS(N(RtFalsetTrue(RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt__contains__Ms

cCs
t|�S(N(titer(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pytiterkeysUsccsx|D]}||VqWdS(N((RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt
itervaluesXs
ccs$x|D]}|||fVqWdS(N((RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt	iteritems\s
cCs
t|�S(N(tlist(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pytkeys`scCs!g|D]}|||f^qS(N((RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pytitemscscCsg|D]}||^qS(N((RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pytvaluesfscCs8t|tj�stSt|j��t|j��kS(N(t
isinstancetcollectionsRtNotImplementedtdictR(Rtother((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt__eq__lscCs||kS(N((RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt__ne__qs(N(t__name__t
__module__t	__slots__tNoneRRR
RRRRRt__hash__RR(((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRDs								tMutableMappingcBsJeZdZe�Zed�Zd�Zd�Zd�Zdd�Z
RS(cCsGy||}Wn'tk
r7||jkr3�n|SX||=|SdS(N(Rt_MutableMapping__marker(RRRtvalue((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pytpopys
cCsKytt|��}Wntk
r/t�nX||}||=||fS(N(tnextR	t
StopIterationR(RRR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pytpopitem�s


cCs3yxtr|j�qWWntk
r.nXdS(N(RR#R(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pytclear�s
	
cOs%t|�dkr0tdjt|����n|sEtd��n|d}t|�dkrk|dnd}t|t�r�xw|D]}||||<q�WnXt|d�r�xF|j�D]}||||<q�Wn!x|D]\}}|||<q�Wx$|j�D]\}}|||<qWdS(Nis8update() takes at most 2 positional arguments ({} given)s,update() takes at least 1 argument (0 given)iiR((tlent	TypeErrortformatRRthasattrRR(targstkwdsRRRR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pytupdate�s"	
"
cCs.y||SWntk
r)|||<nX|S(N(R(RRR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt
setdefault�s

(N(RRRtobjectRR R#R$R+RR,(((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRts					t
BaseContainercBsYeZdZddgZd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
RS(
sBase container class.t_message_listenert_valuescCs||_g|_dS(s�
    Args:
      message_listener: A MessageListener implementation.
        The RepeatedScalarFieldContainer will call this object's
        Modified() method when it is modified.
    N(R/R0(Rtmessage_listener((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt__init__�s	cCs|j|S(s$Retrieves item by the specified key.(R0(RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt__getitem__�scCs
t|j�S(s0Returns the number of elements in the container.(R%R0(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt__len__�scCs||kS(s3Checks if another instance isn't equal to this one.((RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR�scCstd��dS(Nsunhashable object(R&(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR�scCs
t|j�S(N(treprR0(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt__repr__�scOs9d|kr"|jd�|d<n|jj||�dS(Nt
sort_functiontcmp(R R0tsort(RR)tkwargs((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR9�s(RRt__doc__RR2R3R4RRR6R9(((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR.�s	
					tRepeatedScalarFieldContainercBs�eZdZdgZd�Zd�Zd�Zd�Zd�Zd�Z	dd	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�ZRS(sGSimple, type-checked, list-like container for holding repeated scalars.t
_type_checkercCs#tt|�j|�||_dS(s,
    Args:
      message_listener: A MessageListener implementation.
        The RepeatedScalarFieldContainer will call this object's
        Modified() method when it is modified.
      type_checker: A type_checkers.ValueChecker instance to run on elements
        inserted into this container.
    N(tsuperR<R2R=(RR1ttype_checker((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR2�s	cCs<|jj|jj|��|jjs8|jj�ndS(s6Appends an item to the list. Similar to list.append().N(R0tappendR=t
CheckValueR/tdirtytModified(RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR@�scCs?|jj||jj|��|jjs;|jj�ndS(sEInserts the item at the specified position. Similar to list.insert().N(R0tinsertR=RAR/RBRC(RRR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRD�scCs�|dkrdSyt|�}Wntk
r@|s:dS�nXg|D]}|jj|�^qH}|r|jj|�n|jj�dS(sBExtends by appending the given iterable. Similar to list.extend().N(	RR	R&R=RAR0textendR/RC(Rtelem_seqt
elem_seq_itertelemt
new_values((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyREs
%cCs$|jj|j�|jj�dS(s�Appends the contents of another repeated field of the same type to this
    one. We do not check the types of the individual fields.
    N(R0RER/RC(RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt	MergeFromscCs!|jj|�|jj�dS(s8Removes an item from the list. Similar to list.remove().N(R0tremoveR/RC(RRH((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRKsi����cCs|j|}|j|�|S(sDRemoves and returns an item at a given index. Similar to list.pop().(R0t__delitem__(RRR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR $s

cCsst|t�rI|jdk	r-td��n|j|j|j|�n&|jj	|�|j
|<|jj�dS(s(Sets the item on the specified position.sExtended slices not supportedN(
RtslicetstepRt
ValueErrort__setslice__tstarttstopR=RAR0R/RC(RRR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt__setitem__*scCs|j||!S(sARetrieves the subset of items from between the specified indices.(R0(RRQRR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt__getslice__4scCsQg}x'|D]}|j|jj|��q
W||j||+|jj�dS(s<Sets the subset of items from between the specified indices.N(R@R=RAR0R/RC(RRQRRRRIR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRP8s

cCs|j|=|jj�dS(s+Deletes the item at the specified position.N(R0R/RC(RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRL@s
cCs|j||5|jj�dS(s?Deletes the subset of items from between the specified indices.N(R0R/RC(RRQRR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt__delslice__Es
cCs?||krtSt||j�r2|j|jkS||jkS(s/Compares the current instance with another one.(RRt	__class__R0(RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRJs
(RRR;RR2R@RDRERJRKR RSRTRPRLRUR(((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR<�s								
				tRepeatedCompositeFieldContainercBsteZdZdgZd�Zd�Zd�Zd�Zd�Zdd�Z	d	�Z
d
�Zd�Zd�Z
RS(
sBSimple, list-like container for holding repeated composite fields.t_message_descriptorcCs#tt|�j|�||_dS(s�
    Note that we pass in a descriptor instead of the generated directly,
    since at the time we construct a _RepeatedCompositeFieldContainer we
    haven't yet necessarily initialized the type that will be contained in the
    container.

    Args:
      message_listener: A MessageListener implementation.
        The RepeatedCompositeFieldContainer will call this object's
        Modified() method when it is modified.
      message_descriptor: A Descriptor instance describing the protocol type
        that should be present in this container.  We'll use the
        _concrete_class field of this descriptor when the client calls add().
    N(R>RWR2RX(RR1tmessage_descriptor((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR2^scKsR|jj|�}|j|j�|jj|�|jjsN|jj�n|S(s{Adds a new element at the end of the list and returns it. Keyword
    arguments may be used to initialize the element.
    (RXt_concrete_classt_SetListenerR/R0R@RBRC(RR:tnew_element((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pytaddpscCsm|jj}|j}|j}x>|D]6}|�}|j|�|j|�|j|�q%W|j�dS(s{Extends by appending the given sequence of elements of the same type
    as this one, copying each individual message.
    N(RXRZR/R0R[RJR@RC(RRFt
message_classtlistenerRtmessageR\((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRE{s		
	

cCs|j|j�dS(svAppends the contents of another repeated field of the same type to this
    one, copying each individual message.
    N(RER0(RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRJ�scCs!|jj|�|jj�dS(s8Removes an item from the list. Similar to list.remove().N(R0RKR/RC(RRH((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRK�si����cCs|j|}|j|�|S(sDRemoves and returns an item at a given index. Similar to list.pop().(R0RL(RRR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR �s

cCs|j||!S(sARetrieves the subset of items from between the specified indices.(R0(RRQRR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRT�scCs|j|=|jj�dS(s+Deletes the item at the specified position.N(R0R/RC(RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRL�s
cCs|j||5|jj�dS(s?Deletes the subset of items from between the specified indices.N(R0R/RC(RRQRR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRU�s
cCsA||krtSt||j�s1td��n|j|jkS(s/Compares the current instance with another one.sSCan only compare repeated composite fields against other repeated composite fields.(RRRVR&R0(RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR�s
(RRR;RR2R]RERJRKR RTRLRUR(((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRWWs									t	ScalarMapcBs�eZdZdddddgZd�Zd�Zd�Zdd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�Zd�Zd�Zd�ZRS(sGSimple, type-checked, dict-like container for holding repeated scalars.t_key_checkert_value_checkerR0R/t_entry_descriptorcCs1||_||_||_||_i|_dS(s�
    Args:
      message_listener: A MessageListener implementation.
        The ScalarMap will call this object's Modified() method when it
        is modified.
      key_checker: A type_checkers.ValueChecker instance to run on keys
        inserted into this container.
      value_checker: A type_checkers.ValueChecker instance to run on values
        inserted into this container.
      entry_descriptor: The MessageDescriptor of a map entry: key and value.
    N(R/RbRcRdR0(RR1tkey_checkert
value_checkertentry_descriptor((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR2�s

				cCsVy|j|SWn@tk
rQ|jj|�}|jj�}||j|<|SXdS(N(R0RRbRARctDefaultValue(RRtval((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR3�s

cCs|jj|�||jkS(N(RbRAR0(Rtitem((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR�scCs||kr||S|SdS(N((RRR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR�scCsB|jj|�}|jj|�}||j|<|jj�dS(N(RbRARcR0R/RC(RRRtchecked_keyt
checked_value((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRS�s
cCs|j|=|jj�dS(N(R0R/RC(RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRL�s
cCs
t|j�S(N(R%R0(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR4�scCs
t|j�S(N(R	R0(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt__iter__�scCs
t|j�S(N(R5R0(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR6�scCs$|jj|j�|jj�dS(N(R0R+R/RC(RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRJ�scCs&|j}|j�|_d|d<dS(N(R0tcopyR(Rtoriginal((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pytInvalidateIterators�s	cCs|jj�|jj�dS(N(R0R$R/RC(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR$s
cCs
|jjS(N(RdRZ(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt
GetEntryClasssN(RRR;RR2R3RRRRSRLR4RmR6RJRpR$Rq(((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRa�s 														t
MessageMapcBs�eZdZdddddgZd�Zd�Zd�Zdd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�Zd�Zd�Zd�Zd�ZRS(sESimple, type-checked, dict-like container for with submessage values.RbR0R/RXRdcCs1||_||_||_||_i|_dS(s�
    Args:
      message_listener: A MessageListener implementation.
        The ScalarMap will call this object's Modified() method when it
        is modified.
      key_checker: A type_checkers.ValueChecker instance to run on keys
        inserted into this container.
      value_checker: A type_checkers.ValueChecker instance to run on values
        inserted into this container.
      entry_descriptor: The MessageDescriptor of a map entry: key and value.
    N(R/RXRbRdR0(RR1RYReRg((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR2s

				cCssy|j|SWn]tk
rn|jj|�}|jj�}|j|j�||j|<|jj�|SXdS(N(	R0RRbRARXRZR[R/RC(RRR\((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR3's


cCs||S(saget_or_create() is an alias for getitem (ie. map[key]).

    Args:
      key: The key to get or create in the map.

    This is useful in cases where you want to be explicit that the call is
    mutating the map.  This can avoid lint errors for statements like this
    that otherwise would appear to be pointless statements:

      msg.my_map[key]
    ((RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt
get_or_create3scCs||kr||S|SdS(N((RRR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRDscCs
||jkS(N(R0(RRj((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRJscCstd��dS(Ns5May not set values directly, call my_map[key].foo = 5(RO(RRR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRSMscCs|j|=|jj�dS(N(R0R/RC(RR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRLPs
cCs
t|j�S(N(R%R0(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR4TscCs
t|j�S(N(R	R0(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRmWscCs
t|j�S(N(R5R0(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR6ZscCs@x9|D]1}||kr#||=n||j||�qWdS(N(tCopyFrom(RRR((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRJ]s

cCs&|j}|j�|_d|d<dS(N(R0RnR(RRo((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRpgs	cCs|jj�|jj�dS(N(R0R$R/RC(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyR$os
cCs
|jjS(N(RdRZ(R((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRqssN(RRR;RR2R3RsRRRRSRLR4RmR6RJRpR$Rq(((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyRrs"											
		(R;t
__author__Rtsystversion_infoR-RRtregisterR.R<tMutableSequenceRWRaRr(((sG/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.pyt<module>(s0<	-n[Z