zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
U
£ý°dæ]ã@s dZddlZddlZddlZddlmZmZmZm    Z    m
Z
m Z m Z m Z mZmZmZmZedƒZedƒZedƒZGdd„deeƒZejj  e¡Gd    d
„d
eee eƒZGd d „d eee eƒZGd d„de
eefƒZGdd„de
eefƒZGdd„dƒZGdd„dƒZGdd„dƒ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.
éN) ÚAnyÚIterableÚIteratorÚListÚMutableMappingÚMutableSequenceÚNoReturnÚOptionalÚSequenceÚTypeVarÚUnionÚoverloadÚ_TÚ_KÚ_Vc@s¨eZdZdZddgZeddœdd„Zeee    dœd    d
„ƒZ
ee e e    dœd d
„ƒZ
d d
„Z
ed œdd„Z eedœdd„ZdZed œdd„Zdd œdd„Zdd œdd„ZdS)Ú BaseContainerzBase container class.Ú_message_listenerÚ_valuesN)Úmessage_listenerÚreturncCs||_g|_dS)z¹
    Args:
      message_listener: A MessageListener implementation.
        The RepeatedScalarFieldContainer will call this object's
        Modified() method when it is modified.
    N)rr)Úselfr©rúZd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\google/protobuf/internal/containers.pyÚ__init__IszBaseContainer.__init__©ÚkeyrcCsdS©Nr©rrrrrÚ __getitem__SszBaseContainer.__getitem__cCsdSrrrrrrrWscCs
|j|S)z$Retrieves item by the specified key.©rrrrrr[s©rcCs
t|jƒS)z0Returns the number of elements in the container.©Úlenr©rrrrÚ__len___szBaseContainer.__len__©ÚotherrcCs
||k S)z3Checks if another instance isn't equal to this one.r©rr&rrrÚ__ne__cszBaseContainer.__ne__cCs
t|jƒSr©Úreprrr#rrrÚ__repr__jszBaseContainer.__repr__cOs(d|kr| d¡|d<|jj||ŽdS)NZ sort_functionÚcmp)ÚpoprÚsort)rÚargsÚkwargsrrrr.mszBaseContainer.sortcCs|j ¡dSr)rÚreverser#rrrr1uszBaseContainer.reverse)Ú__name__Ú
__module__Ú __qualname__Ú__doc__Ú    __slots__rrr ÚintrrÚslicerr$Úboolr(Ú__hash__Ústrr+r.r1rrrrrCs
rcs,eZdZdZdgZeeddœ‡fdd„ Zeddœdd    „Ze    edd
œd d „Z
e edd œdd„Z e de efddœdd„Zedœdd„Zd)ee    edœdd„Zee    edd
œdd„ƒZeee edd
œdd„ƒZddœdd„Ze e    efddœd d!„Zeedœd"d#„Zd*edd$œd%d&„Zedœd'd(„Z‡ZS)+ÚRepeatedScalarFieldContainerzGSimple, type-checked, list-like container for holding repeated scalars.Ú _type_checkerN)rÚ type_checkerrcstƒ |¡||_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)Úsuperrr=)rrr>©Ú    __class__rrr„s z%RepeatedScalarFieldContainer.__init__©ÚvaluercCs*|j |j |¡¡|jjs&|j ¡dS)z6Appends an item to the list. Similar to list.append().N)rÚappendr=Ú
CheckValuerÚdirtyÚModified©rrCrrrrD”sz#RepeatedScalarFieldContainer.append©rrCrcCs,|j ||j |¡¡|jjs(|j ¡dS)zEInserts the item at the specified position. Similar to list.insert().N)rÚinsertr=rErrFrG©rrrCrrrrJšsz#RepeatedScalarFieldContainer.insert©Úelem_seqrcsj|dkr dSz t|ƒ}Wn tk
r8|s2YdS‚YnX‡fdd„|Dƒ}|r\ˆj |¡ˆj ¡dS)zBExtends by appending the given iterable. Similar to list.extend().Ncsg|]}ˆj |¡‘qSr)r=rE)Ú.0Úelemr#rrÚ
<listcomp>­sz7RepeatedScalarFieldContainer.extend.<locals>.<listcomp>)ÚiterÚ    TypeErrorrÚextendrrG)rrMZ elem_seq_iterZ
new_valuesrr#rrS s  z#RepeatedScalarFieldContainer.extendz RepeatedScalarFieldContainer[_T]r%cCs|j |¡|j ¡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)rrSrrGr'rrrÚ    MergeFrom²s z&RepeatedScalarFieldContainer.MergeFrom)rOcCs|j |¡|j ¡dS©z8Removes an item from the list. Similar to list.remove().N©rÚremoverrG©rrOrrrrW¼s z#RepeatedScalarFieldContainer.removeéÿÿÿÿrcCs|j|}| |¡|S©zDRemoves and returns an item at a given index. Similar to list.pop().©rÚ __delitem__rKrrrr-Ás
 
z RepeatedScalarFieldContainer.popcCsdSrrrKrrrÚ __setitem__Çsz(RepeatedScalarFieldContainer.__setitem__cCsdSrrrKrrrr]Ësr cCs\t|tƒr<|jdk    rtdƒ‚t|jj|ƒ|j|<|j     ¡n|j |¡|j|<|j     ¡dS)z(Sets the item on the specified position.NzExtended slices not supported)
Ú
isinstancer8ÚstepÚ
ValueErrorÚmapr=rErrrGrKrrrr]Ïs
 
 cCs|j|=|j ¡dS©z+Deletes the item at the specified position.N©rrrGrrrrr\Úsz(RepeatedScalarFieldContainer.__delitem__cCs.||kr dSt||jƒr$|j|jkS||jkS)ú/Compares the current instance with another one.T)r^rArr'rrrÚ__eq__ßs
  z#RepeatedScalarFieldContainer.__eq__)Ú unused_memorcCs"tt |j¡|jƒ}| |¡|Sr)r<ÚcopyÚdeepcopyrr=rT)rrfÚclonerrrÚ __deepcopy__és 
ÿ
z)RepeatedScalarFieldContainer.__deepcopy__cKst d¡‚dS)Nz:Can't pickle repeated scalar fields, convert to list first)ÚpickleÚ PickleError)rr0rrrÚ
__reduce__òsÿz'RepeatedScalarFieldContainer.__reduce__)rY)N)r2r3r4r5r6rrrrDr7rJrrSr rTrWr    r-r r]r8r\r9rerjrrmÚ __classcell__rrr@rr<~s6üý
  þý     r<cseZdZdZdgZeeddœ‡fdd„ Zeedœdd    „Zedd
œd d „Z    e
edd œdd„Z e eddœdd„Z ede efddœdd„Zeddœdd„Zd&ee
edœdd„Zee
edd œdd„ƒZeee edd œd d„ƒZd!d„Zee
efddœd"d#„Zeedœd$d%„Z‡ZS)'ÚRepeatedCompositeFieldContainerzBSimple, list-like container for holding repeated composite fields.Ú_message_descriptorN)rÚmessage_descriptorrcstƒ |¡||_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)r?rrp)rrrqr@rrrþs z(RepeatedCompositeFieldContainer.__init__)r0rcKs<|jjf|Ž}| |j¡|j |¡|jjs8|j ¡|S)z{Adds a new element at the end of the list and returns it. Keyword
    arguments may be used to initialize the element.
    )rpÚ_concrete_classÚ _SetListenerrrrDrFrG)rr0Ú new_elementrrrÚadds   
z#RepeatedCompositeFieldContainer.addrBcCsB|j ¡}| |j¡| |¡|j |¡|jjs>|j ¡dS)z+Appends one element by copying the message.N)    rprrrsrÚCopyFromrrDrFrG)rrCrtrrrrDs 
 
 z&RepeatedCompositeFieldContainer.appendrIcCsD|j ¡}| |j¡| |¡|j ||¡|jjs@|j ¡dS)z6Inserts the item at the specified position by copying.N)    rprrrsrrvrrJrFrG)rrrCrtrrrrJ$s 
 
z&RepeatedCompositeFieldContainer.insertrLcCsN|jj}|j}|j}|D](}|ƒ}| |¡| |¡| |¡q| ¡dS)z|Extends by appending the given sequence of elements of the same type
 
    as this one, copying each individual message.
    N)rprrrrrsrTrDrG)rrMZ message_classZlistenerÚvaluesÚmessagertrrrrS-s
 
 z&RepeatedCompositeFieldContainer.extendz#RepeatedCompositeFieldContainer[_T]r%cCs| |¡dS)zvAppends the contents of another repeated field of the same type to this
    one, copying each individual message.
    N)rSr'rrrrT<sz)RepeatedCompositeFieldContainer.MergeFrom)rOrcCs|j |¡|j ¡dSrUrVrXrrrrWEs z&RepeatedCompositeFieldContainer.removerYrcCs|j|}| |¡|SrZr[rKrrrr-Js
 
z#RepeatedCompositeFieldContainer.popcCsdSrrrKrrrr]Psz+RepeatedCompositeFieldContainer.__setitem__cCsdSrrrKrrrr]TscCst|jj›dƒ‚dS)Nz( object does not support item assignment)rRrAr2rKrrrr]Xs ÿcCs|j|=|j ¡dSrbrcrrrrr\_sz+RepeatedCompositeFieldContainer.__delitem__cCs,||kr dSt||jƒs tdƒ‚|j|jkS)rdTzSCan only compare repeated composite fields against other repeated composite fields.)r^rArRrr'rrrreds
 z&RepeatedCompositeFieldContainer.__eq__)rY)r2r3r4r5r6rrrrurDr7rJrrSr rTrWr    r-r r]r8r\r9rernrrr@rroøs&         ý     roc@seZdZdZdddddgZeeeeddœd    d
„Zeed œd d „Z    ee
dœdd„Z e ee ed œdd„ƒZe eeeeefdœdd„ƒZd,dd„Zeeedœdd„Zedd œdd„Zedœdd„Zeedœdd„Zedœd d!„Zd"dd#œd$d%„Zddœd&d'„Zddœd(d)„Zedœd*d+„ZdS)-Ú    ScalarMapzGSimple, type-checked, dict-like container for holding repeated scalars.Ú _key_checkerÚ_value_checkerrrÚ_entry_descriptorN)rÚ key_checkerÚ value_checkerÚentry_descriptorrcCs"||_||_||_||_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)rrzr{r|r)rrr}r~rrrrrus
zScalarMap.__init__rcCsJz |j|WStk
rD|j |¡}|j ¡}||j|<|YSXdSr)rÚKeyErrorrzrEr{Z DefaultValue)rrÚvalrrrrs  
 
zScalarMap.__getitem__©ÚitemrcCs|j |¡||jkSr©rzrEr©rr„rrrÚ __contains__–s zScalarMap.__contains__cCsdSrrrrrrÚgetœsz ScalarMap.get©rÚdefaultrcCsdSrr©rrrŠrrrrˆ scCs||kr||S|SdSrrr‹rrrrˆ§srIcCs0|j |¡}|j |¡}||j|<|j ¡dSr)rzrEr{rrrG)rrrCZ checked_keyZ checked_valuerrrr]­s  
zScalarMap.__setitem__cCs|j|=|j ¡dSrrcrrrrr\³szScalarMap.__delitem__r cCs
t|jƒSrr!r#rrrr$·szScalarMap.__len__cCs
t|jƒSr©rQrr#rrrÚ__iter__ºszScalarMap.__iter__cCs
t|jƒSrr)r#rrrr+½szScalarMap.__repr__zScalarMap[_K, _V]r%cCs|j |j¡|j ¡dSr)rÚupdaterrGr'rrrrTÀszScalarMap.MergeFromcCs|j}| ¡|_d|d<dSr©rrg©rÚoriginalrrrÚInvalidateIteratorsÄs
zScalarMap.InvalidateIteratorscCs|j ¡|j ¡dSr©rÚclearrrGr#rrrr”Ìs
zScalarMap.clearcCs|jjSr©r|rrr#rrrÚ GetEntryClassÐszScalarMap.GetEntryClass)N)r2r3r4r5r6rrrrrr9r‡r r    rˆrr r]r\r7r$rrr;r+rTr’r”r–rrrrryns4ÿú     
ryc@s.eZdZdZdddddgZeeeeddœd    d
„Zeed œd d „Z    eed œdd„Z
e ee ed œdd„ƒZ e eeeeefdœdd„ƒZ d.dd„Z eedœdd„Zeeedœdd„Zedd œdd„Zedœdd„Zeedœd d!„Zedœd"d#„Zd$dd%œd&d'„Zddœd(d)„Zddœd*d+„Zedœd,d-„ZdS)/Ú
MessageMapzESimple, type-checked, dict-like container for with submessage values.rzrrrpr|N)rrqr}rrcCs"||_||_||_||_i|_dSr€)rrprzr|r)rrrqr}rrrrrÛs
zMessageMap.__init__rcCs`|j |¡}z |j|WStk
rZ|j ¡}| |j¡||j|<|j ¡|YSXdSr)    rzrErrrprrrsrrG)rrrtrrrró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]
    rrrrrÚ get_or_createþs zMessageMap.get_or_createcCsdSrrrrrrrˆ szMessageMap.getr‰cCsdSrrr‹rrrrˆscCs||kr||S|SdSrrr‹rrrrˆsrƒcCs|j |¡}||jkSrr…r†rrrr‡s zMessageMap.__contains__rIcCs tdƒ‚dS)Nz5May not set values directly, call my_map[key].foo = 5)r`rKrrrr]!szMessageMap.__setitem__cCs"|j |¡}|j|=|j ¡dSr)rzrErrrGrrrrr\$s zMessageMap.__delitem__r cCs
t|jƒSrr!r#rrrr$)szMessageMap.__len__cCs
t|jƒSrrŒr#rrrr,szMessageMap.__iter__cCs
t|jƒSrr)r#rrrr+/szMessageMap.__repr__zMessageMap[_K, _V]r%cCs0|jD]$}||kr||=|| ||¡qdSr)rrv)rr&rrrrrT2s
zMessageMap.MergeFromcCs|j}| ¡|_d|d<dSrrrrrrr’=s
zMessageMap.InvalidateIteratorscCs|j ¡|j ¡dSrr“r#rrrr”Es
zMessageMap.clearcCs|jjSrr•r#rrrr–IszMessageMap.GetEntryClass)N)r2r3r4r5r6rrrrrr˜r r    rˆrr r9r‡rr]r\r7r$rrr;r+rTr’r”r–rrrrr—Ôs8ÿú  
 r—c@s2eZdZdZdddgZdd„Zdd„Zd    d
„Zd S) Ú _UnknownFieldzA parsed unknown field.Ú _field_numberÚ
_wire_typeÚ_datacCs||_||_||_dSr©ršr›rœ)rÚ field_numberÚ    wire_typeÚdatarrrrSsz_UnknownField.__init__cCs |j|jkSr)ršr'rrrÚ__lt__Ysz_UnknownField.__lt__cCs0||kr dS|j|jko.|j|jko.|j|jkS©NTrr'rrrre]s 
ÿ
þz_UnknownField.__eq__N)r2r3r4r5r6rr¡rerrrrr™Ms
 
r™c@s@eZdZdd„Zdd„Zedd„ƒZedd„ƒZed    d
„ƒZd S) ÚUnknownFieldRefcCs||_||_dSr)Ú_parentÚ_index)rÚparentÚindexrrrrhszUnknownFieldRef.__init__cCs*|jstdƒ‚|jt|jƒkr&tdƒ‚dS)NzAUnknownField does not exist. The parent message might be cleared.)r¤r`r¥r"r#rrrÚ _check_validlszUnknownFieldRef._check_validcCs| ¡|j |j¡jSr)r¨r¤Ú _internal_getr¥ršr#rrrržtszUnknownFieldRef.field_numbercCs| ¡|j |j¡jSr)r¨r¤r©r¥r›r#rrrrŸzszUnknownFieldRef.wire_typecCs| ¡|j |j¡jSr)r¨r¤r©r¥rœr#rrrr €szUnknownFieldRef.dataN)    r2r3r4rr¨ÚpropertyržrŸr rrrrr£fs
 
r£c@s^eZdZdZdgZdd„Zdd„Zdd„Zd    d
„Zd d „Z    d d„Z
dd„Z dd„Z dd„Z dS)ÚUnknownFieldSetzUnknownField containerrcCs
g|_dSrrr#rrrrszUnknownFieldSet.__init__cCsP|jdkrtdƒ‚t|jƒ}|dkr,||7}|dks<||krFtdjƒ‚t||ƒS)NúBUnknownFields does not exist. The parent message might be cleared.rzindex %d out of range)rr`r"Ú
IndexErrorr§r£)rr§Úsizerrrrs
 
 
zUnknownFieldSet.__getitem__cCs
|j|Srr)rr§rrrr©œszUnknownFieldSet._internal_getcCs|jdkrtdƒ‚t|jƒS)Nr¬)rr`r"r#rrrr$Ÿs
zUnknownFieldSet.__len__cCst|||ƒ}|j |¡|Sr)r™rrD)rržrŸr Z unknown_fieldrrrÚ_add¥s  zUnknownFieldSet._addccs"tt|ƒƒD]}t||ƒVq dSr)Úranger"r£)rÚirrrrªszUnknownFieldSet.__iter__cCs|dkr dS|j |j¡dSr)rrSr'rrrÚ_extend®szUnknownFieldSet._extendcCs>||kr dSt|jƒ}|dkr$| S| ¡t|jƒ}||kSr¢)Úlistrr.Úsorted)rr&rwZ other_valuesrrrre´s
 
zUnknownFieldSet.__eq__cCs,|jD]}t|jtƒr|j ¡qd|_dSr)rr^rœr«Ú_clearrHrrrrµÁs
  zUnknownFieldSet._clearN)r2r3r4r5r6rrr©r$r¯rr²rerµrrrrr«‡s  r«)r5Úcollections.abcÚ collectionsrgrkÚtypingrrrrrrrr    r
r r r rrrrÚabcÚregisterr<roryr—r™r£r«rrrrÚ<module>s  88zvfy!