HEX
Server: LiteSpeed
System: Linux server334.web-hosting.com 4.18.0-553.124.4.lve.el8.x86_64 #1 SMP Fri May 15 13:02:13 UTC 2026 x86_64
User: richfield (1256)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/google/protobuf/internal/__pycache__/containers.cpython-36.pyc
3

���h�Q�@s�dZdZddlZddlZejddkr`Gdd�de�ZGdd�de�Zejje�ejje�nejZGd	d
�d
e�Z	Gdd�de	�Z
ejje	�Gd
d�de	�ZGdd�de�Z
Gdd�de�ZdS)a�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.
zpetar@google.com (Petar Petrov)�N�c@sfeZdZfZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdZdd�Z
dd�ZdS)�MappingNcCs"y||Stk
r|SXdS)N)�KeyError)�self�key�default�r� /usr/lib/python3.6/containers.py�getGszMapping.getcCs*y||Wntk
r dSXdSdS)NFT)r)rrrrr	�__contains__Ms
zMapping.__contains__cCst|�S)N)�iter)rrrr	�iterkeysUszMapping.iterkeysccsx|D]}||VqWdS)Nr)rrrrr	�
itervaluesXs
zMapping.itervaluesccs x|D]}|||fVqWdS)Nr)rrrrr	�	iteritems\s
zMapping.iteritemscCst|�S)N)�list)rrrr	�keys`szMapping.keyscs�fdd��D�S)Ncsg|]}|�|f�qSrr)�.0r)rrr	�
<listcomp>dsz!Mapping.items.<locals>.<listcomp>r)rr)rr	�itemscsz
Mapping.itemscs�fdd��D�S)Ncsg|]}�|�qSrr)rr)rrr	rgsz"Mapping.values.<locals>.<listcomp>r)rr)rr	�valuesfszMapping.valuescCs0t|tj�stStt|j���tt|j���kS)N)�
isinstance�collectionsr�NotImplemented�dictrr)r�otherrrr	�__eq__lszMapping.__eq__cCs
||kS)Nr)rrrrr	�__ne__qszMapping.__ne__)N)�__name__�
__module__�__qualname__�	__slots__r
rr
rrrrr�__hash__rrrrrr	rDs
rc@sDeZdZfZe�Zefdd�Zdd�Zdd�Zdd�Z	dd
d�Z
d	S)
�MutableMappingcCs<y||}Wn tk
r,||jkr(�|SX||=|SdS)N)r�_MutableMapping__marker)rrr�valuerrr	�popys
zMutableMapping.popcCs@ytt|��}Wntk
r(t�YnX||}||=||fS)N)�nextr�
StopIterationr)rrr$rrr	�popitem�s
zMutableMapping.popitemcCs,yx|j�qWWntk
r&YnXdS)N)r(r)rrrr	�clear�s
zMutableMapping.clearcOs�t|�dkr tdjt|����n|s,td��|d}t|�dkrH|dnf}t|t�rrxb|D]}||||<q\WnHt|d�r�x<t|j��D]}||||<q�Wnx|D]\}}|||<q�Wx t|j��D]\}}|||<q�WdS)N�z8update() takes at most 2 positional arguments ({} given)z,update() takes at least 1 argument (0 given)r�r)	�len�	TypeError�formatrr�hasattrrrr)�args�kwdsrrrr$rrr	�update�s"


zMutableMapping.updateNcCs*y||Stk
r$|||<YnX|S)N)r)rrrrrr	�
setdefault�s
zMutableMapping.setdefault)N)rrrr �objectr#r%r(r)r2r3rrrr	r"ts	r"c@sPeZdZdZddgZdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)�
BaseContainerzBase container class.�_message_listener�_valuescCs||_g|_dS)z�
    Args:
      message_listener: A MessageListener implementation.
        The RepeatedScalarFieldContainer will call this object's
        Modified() method when it is modified.
    N)r6r7)r�message_listenerrrr	�__init__�szBaseContainer.__init__cCs
|j|S)z$Retrieves item by the specified key.)r7)rrrrr	�__getitem__�szBaseContainer.__getitem__cCs
t|j�S)z0Returns the number of elements in the container.)r,r7)rrrr	�__len__�szBaseContainer.__len__cCs
||kS)z3Checks if another instance isn't equal to this one.r)rrrrr	r�szBaseContainer.__ne__cCstd��dS)Nzunhashable object)r-)rrrr	r!�szBaseContainer.__hash__cCs
t|j�S)N)�reprr7)rrrr	�__repr__�szBaseContainer.__repr__cOs(d|kr|jd�|d<|jj||�dS)NZ
sort_functionZcmp)r%r7�sort)rr0�kwargsrrr	r>�szBaseContainer.sortN)rrr�__doc__r r9r:r;rr!r=r>rrrr	r5�s
r5cs�eZdZdZdgZ�fdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
ddd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Z�ZS) �RepeatedScalarFieldContainerzGSimple, type-checked, list-like container for holding repeated scalars.�
_type_checkercstt|�j|�||_dS)a,
    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)�superrAr9rB)rr8Ztype_checker)�	__class__rr	r9�s	z%RepeatedScalarFieldContainer.__init__cCs*|jj|jj|��|jjs&|jj�dS)z6Appends an item to the list. Similar to list.append().N)r7�appendrB�
CheckValuer6�dirty�Modified)rr$rrr	rE�sz#RepeatedScalarFieldContainer.appendcCs,|jj||jj|��|jjs(|jj�dS)zEInserts the item at the specified position. Similar to list.insert().N)r7�insertrBrFr6rGrH)rrr$rrr	rI�sz#RepeatedScalarFieldContainer.insertcsh|dkrdSyt|�}Wntk
r6|s0dS�YnX�fdd�|D�}|rZ�jj|��jj�dS)zBExtends by appending the given iterable. Similar to list.extend().Ncsg|]}�jj|��qSr)rBrF)r�elem)rrr	rsz7RepeatedScalarFieldContainer.extend.<locals>.<listcomp>)rr-r7�extendr6rH)r�elem_seqZ
elem_seq_iter�
new_valuesr)rr	rKsz#RepeatedScalarFieldContainer.extendcCs|jj|j�|jj�dS)z�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)r7rKr6rH)rrrrr	�	MergeFromsz&RepeatedScalarFieldContainer.MergeFromcCs|jj|�|jj�dS)z8Removes an item from the list. Similar to list.remove().N)r7�remover6rH)rrJrrr	rOsz#RepeatedScalarFieldContainer.remover+cCs|j|}|j|�|S)zDRemoves and returns an item at a given index. Similar to list.pop().)r7�__delitem__)rrr$rrr	r%$s

z RepeatedScalarFieldContainer.popcCsPt|t�r0|jdk	rtd��|j|j|j|�n|jj|�|j	|<|j
j�dS)z(Sets the item on the specified position.NzExtended slices not supported)r�slice�step�
ValueError�__setslice__�start�stoprBrFr7r6rH)rrr$rrr	�__setitem__*s

z(RepeatedScalarFieldContainer.__setitem__cCs|j||�S)zARetrieves the subset of items from between the specified indices.)r7)rrUrVrrr	�__getslice__4sz)RepeatedScalarFieldContainer.__getslice__cCs@g}x|D]}|j|jj|��q
W||j||�<|jj�dS)z<Sets the subset of items from between the specified indices.N)rErBrFr7r6rH)rrUrVrrMr$rrr	rT8s

z)RepeatedScalarFieldContainer.__setslice__cCs|j|=|jj�dS)z+Deletes the item at the specified position.N)r7r6rH)rrrrr	rP@sz(RepeatedScalarFieldContainer.__delitem__cCs|j||�=|jj�dS)z?Deletes the subset of items from between the specified indices.N)r7r6rH)rrUrVrrr	�__delslice__Esz)RepeatedScalarFieldContainer.__delslice__cCs.||krdSt||j�r$|j|jkS||jkS)z/Compares the current instance with another one.T)rrDr7)rrrrr	rJs
z#RepeatedScalarFieldContainer.__eq__���)rZ)rrrr@r r9rErIrKrNrOr%rWrXrTrPrYr�
__classcell__rr)rDr	rA�s

rAcspeZdZdZdgZ�fdd�Zdd�Zdd�Zd	d
�Zdd�Z	ddd�Z
dd�Zdd�Zdd�Z
dd�Z�ZS)�RepeatedCompositeFieldContainerzBSimple, list-like container for holding repeated composite fields.�_message_descriptorcstt|�j|�||_dS)a�
    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)rCr\r9r])rr8�message_descriptor)rDrr	r9^sz(RepeatedCompositeFieldContainer.__init__cKs<|jjf|�}|j|j�|jj|�|jjs8|jj�|S)z{Adds a new element at the end of the list and returns it. Keyword
    arguments may be used to initialize the element.
    )r]�_concrete_class�_SetListenerr6r7rErGrH)rr?�new_elementrrr	�addps
z#RepeatedCompositeFieldContainer.addcCsR|jj}|j}|j}x0|D](}|�}|j|�|j|�|j|�qW|j�dS)z{Extends by appending the given sequence of elements of the same type
    as this one, copying each individual message.
    N)r]r_r6r7r`rNrErH)rrLZ
message_classZlistenerr�messagerarrr	rK{s


z&RepeatedCompositeFieldContainer.extendcCs|j|j�dS)zvAppends the contents of another repeated field of the same type to this
    one, copying each individual message.
    N)rKr7)rrrrr	rN�sz)RepeatedCompositeFieldContainer.MergeFromcCs|jj|�|jj�dS)z8Removes an item from the list. Similar to list.remove().N)r7rOr6rH)rrJrrr	rO�sz&RepeatedCompositeFieldContainer.remover+cCs|j|}|j|�|S)zDRemoves and returns an item at a given index. Similar to list.pop().)r7rP)rrr$rrr	r%�s

z#RepeatedCompositeFieldContainer.popcCs|j||�S)zARetrieves the subset of items from between the specified indices.)r7)rrUrVrrr	rX�sz,RepeatedCompositeFieldContainer.__getslice__cCs|j|=|jj�dS)z+Deletes the item at the specified position.N)r7r6rH)rrrrr	rP�sz+RepeatedCompositeFieldContainer.__delitem__cCs|j||�=|jj�dS)z?Deletes the subset of items from between the specified indices.N)r7r6rH)rrUrVrrr	rY�sz,RepeatedCompositeFieldContainer.__delslice__cCs,||krdSt||j�s td��|j|jkS)z/Compares the current instance with another one.TzSCan only compare repeated composite fields against other repeated composite fields.)rrDr-r7)rrrrr	r�s
z&RepeatedCompositeFieldContainer.__eq__rZ)rZ)rrrr@r r9rbrKrNrOr%rXrPrYrr[rr)rDr	r\Ws
r\c@s�eZdZdZdddddgZdd�Zd	d
�Zdd�Zd"dd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd
S)#�	ScalarMapzGSimple, type-checked, dict-like container for holding repeated scalars.�_key_checker�_value_checkerr7r6�_entry_descriptorcCs"||_||_||_||_i|_dS)a�
    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)r6rerfrgr7)rr8�key_checkerZ
value_checker�entry_descriptorrrr	r9�s

zScalarMap.__init__cCsDy
|j|Stk
r>|jj|�}|jj�}||j|<|SXdS)N)r7rrerFrfZDefaultValue)rr�valrrr	r:�s


zScalarMap.__getitem__cCs|jj|�||jkS)N)rerFr7)r�itemrrr	r�szScalarMap.__contains__NcCs||kr||S|SdS)Nr)rrrrrr	r
�sz
ScalarMap.getcCs0|jj|�}|jj|�}||j|<|jj�dS)N)rerFrfr7r6rH)rrr$Zchecked_keyZ
checked_valuerrr	rW�s
zScalarMap.__setitem__cCs|j|=|jj�dS)N)r7r6rH)rrrrr	rP�szScalarMap.__delitem__cCs
t|j�S)N)r,r7)rrrr	r;�szScalarMap.__len__cCs
t|j�S)N)rr7)rrrr	�__iter__�szScalarMap.__iter__cCs
t|j�S)N)r<r7)rrrr	r=�szScalarMap.__repr__cCs|jj|j�|jj�dS)N)r7r2r6rH)rrrrr	rN�szScalarMap.MergeFromcCs|j}|j�|_d|d<dS)N)r7�copy)r�originalrrr	�InvalidateIterators�s
zScalarMap.InvalidateIteratorscCs|jj�|jj�dS)N)r7r)r6rH)rrrr	r)s
zScalarMap.clearcCs|jjS)N)rgr_)rrrr	�
GetEntryClassszScalarMap.GetEntryClass)N)rrrr@r r9r:rr
rWrPr;rlr=rNror)rprrrr	rd�s 		
rdc@s�eZdZdZdddddgZdd�Zd	d
�Zdd�Zd$dd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd"d#�Zd
S)%�
MessageMapzESimple, type-checked, dict-like container for with submessage values.rer7r6r]rgcCs"||_||_||_||_i|_dS)a�
    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)r6r]rergr7)rr8r^rhrirrr	r9s

zMessageMap.__init__cCsZy
|j|Stk
rT|jj|�}|jj�}|j|j�||j|<|jj�|SXdS)N)	r7rrerFr]r_r`r6rH)rrrarrr	r:'s



zMessageMap.__getitem__cCs||S)aaget_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]
    r)rrrrr	�
get_or_create3szMessageMap.get_or_createNcCs||kr||S|SdS)Nr)rrrrrr	r
DszMessageMap.getcCs
||jkS)N)r7)rrkrrr	rJszMessageMap.__contains__cCstd��dS)Nz5May not set values directly, call my_map[key].foo = 5)rS)rrr$rrr	rWMszMessageMap.__setitem__cCs|j|=|jj�dS)N)r7r6rH)rrrrr	rPPszMessageMap.__delitem__cCs
t|j�S)N)r,r7)rrrr	r;TszMessageMap.__len__cCs
t|j�S)N)rr7)rrrr	rlWszMessageMap.__iter__cCs
t|j�S)N)r<r7)rrrr	r=ZszMessageMap.__repr__cCs2x,|D]$}||kr||=||j||�qWdS)N)ZCopyFrom)rrrrrr	rN]s
zMessageMap.MergeFromcCs|j}|j�|_d|d<dS)N)r7rm)rrnrrr	rogs
zMessageMap.InvalidateIteratorscCs|jj�|jj�dS)N)r7r)r6rH)rrrr	r)os
zMessageMap.clearcCs|jjS)N)rgr_)rrrr	rpsszMessageMap.GetEntryClass)N)rrrr@r r9r:rrr
rrWrPr;rlr=rNror)rprrrr	rqs"

rq)r@�
__author__r�sys�version_infor4rr"�registerr5rA�MutableSequencer\rdrqrrrr	�<module>(s0<-n[Z