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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
U
£ý°dc:ã@sTdZdZGdd„deƒZGdd„deƒZGdd„deƒZGdd    „d    eƒZd
d „Zd S) z6Contains an abstract base class for protocol messages.z#robinson@google.com (Will Robinson)c@seZdZdZdS)ÚErrorz Base error type for this module.N©Ú__name__Ú
__module__Ú __qualname__Ú__doc__©rrúNd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\google/protobuf/message.pyr'src@seZdZdZdS)Ú DecodeErrorz-Exception raised when deserializing messages.Nrrrrrr    ,sr    c@seZdZdZdS)Ú EncodeErrorz+Exception raised when serializing messages.Nrrrrrr
1sr
c@seZdZdZgZdZd?dd„Zdd„Zdd„Zd    d
„Z    d d „Z
d d„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Zd/d0„Zd1d2„Zed3d4„ƒZe d5d6„ƒZ!d7d8„Z"d9d:„Z#d;d<„Z$d=d>„Z%dS)@ÚMessagezÒAbstract base class for protocol messages.
 
  Protocol message classes are almost always generated by the protocol
  compiler.  These generated types subclass Message and implement the methods
  shown below.
  NcCst|ƒƒ}| |¡|S©N)ÚtypeÚ    MergeFrom)ÚselfÚmemoÚclonerrrÚ __deepcopy__Ps
 
zMessage.__deepcopy__cCst‚dS)z9Recursively compares two messages by value and structure.N©ÚNotImplementedError©rZ    other_msgrrrÚ__eq__UszMessage.__eq__cCs
||k Sr rrrrrÚ__ne__YszMessage.__ne__cCs tdƒ‚dS)Nzunhashable object)Ú    TypeError©rrrrÚ__hash__]szMessage.__hash__cCst‚dS©z7Outputs a human-readable representation of the message.NrrrrrÚ__str__`szMessage.__str__cCst‚dSrrrrrrÚ __unicode__dszMessage.__unicode__cCst‚dS)aÆMerges the contents of the specified message into current message.
 
    This method merges the contents of the specified message into the current
    message. Singular fields that are set in the specified message overwrite
    the corresponding fields in the current message. Repeated fields are
    appended. Singular sub-messages and groups are recursively merged.
 
    Args:
      other_msg (Message): A message to merge into the current message.
    Nrrrrrrhs zMessage.MergeFromcCs"||kr dS| ¡| |¡dS)zþCopies the content of the specified message into the current message.
 
    The method clears the current message and then merges the specified
    message using MergeFrom.
 
    Args:
      other_msg (Message): A message to copy into the current one.
    N)ÚClearrrrrrÚCopyFromus    zMessage.CopyFromcCst‚dS)z,Clears all data that was set in the message.Nrrrrrrƒsz Message.ClearcCst‚dS)a Mark this as present in the parent.
 
    This normally happens automatically when you assign a field of a
    sub-message, but sometimes you want to make the sub-message
    present while keeping it empty.  If you find yourself using this,
    you may want to reconsider your design.
    NrrrrrÚ SetInParent‡szMessage.SetInParentcCst‚dS)z«Checks if the message is initialized.
 
    Returns:
      bool: The method returns True if the message is initialized (i.e. all of
      its required fields are set).
    NrrrrrÚ IsInitialized‘szMessage.IsInitializedcCst‚dS)aEMerges serialized protocol buffer data into this message.
 
    When we find a field in `serialized` that is already present
    in this message:
 
    -   If it's a "repeated" field, we append to the end of our list.
    -   Else, if it's a scalar, we overwrite our field.
    -   Else, (it's a nonrepeated composite), we recursively merge
        into the existing composite.
 
    Args:
      serialized (bytes): Any object that allows us to call
        ``memoryview(serialized)`` to access a string of bytes using the
        buffer interface.
 
    Returns:
      int: The number of bytes read from `serialized`.
      For non-group messages, this will always be `len(serialized)`,
      but for messages which are actually groups, this will
      generally be less than `len(serialized)`, since we must
      stop when we reach an ``END_GROUP`` tag.  Note that if
      we *do* stop because of an ``END_GROUP`` tag, the number
      of bytes returned does not include the bytes
      for the ``END_GROUP`` tag information.
 
    Raises:
      DecodeError: if the input cannot be parsed.
    Nr©rÚ
serializedrrrÚMergeFromString szMessage.MergeFromStringcCs| ¡| |¡S)zÊParse serialized protocol buffer data into this message.
 
    Like :func:`MergeFromString()`, except we clear the object first.
 
    Raises:
      message.DecodeError if the input cannot be parsed.
    )rr$r"rrrÚParseFromStringÁszMessage.ParseFromStringcKst‚dS)aÓSerializes the protocol message to a binary string.
 
    Keyword Args:
      deterministic (bool): If true, requests deterministic serialization
        of the protobuf, with predictable ordering of map keys.
 
    Returns:
      A binary string representation of the message if all of the required
      fields in the message are set (i.e. the message is initialized).
 
    Raises:
      EncodeError: if the message isn't initialized (see :func:`IsInitialized`).
    Nr©rÚkwargsrrrÚSerializeToStringÌszMessage.SerializeToStringcKst‚dS)aŠSerializes the protocol message to a binary string.
 
    This method is similar to SerializeToString but doesn't check if the
    message is initialized.
 
    Keyword Args:
      deterministic (bool): If true, requests deterministic serialization
        of the protobuf, with predictable ordering of map keys.
 
    Returns:
      bytes: A serialized representation of the partial message.
    Nrr&rrrÚSerializePartialToStringÜs z Message.SerializePartialToStringcCst‚dS)a'Returns a list of (FieldDescriptor, value) tuples for present fields.
 
    A message field is non-empty if HasField() would return true. A singular
    primitive field is non-empty if HasField() would return true in proto2 or it
    is non zero in proto3. A repeated field is non-empty if it contains at least
    one element. The fields are ordered by field number.
 
    Returns:
      list[tuple(FieldDescriptor, value)]: field descriptors and values
      for all fields in the message which are not empty. The values vary by
      field type.
    NrrrrrÚ
ListFieldsûs zMessage.ListFieldscCst‚dS)aÑChecks if a certain field is set for the message.
 
    For a oneof group, checks if any field inside is set. Note that if the
    field_name is not defined in the message descriptor, :exc:`ValueError` will
    be raised.
 
    Args:
      field_name (str): The name of the field to check for presence.
 
    Returns:
      bool: Whether a value has been set for the named field.
 
    Raises:
      ValueError: if the `field_name` is not a member of this message.
    Nr©rÚ
field_namerrrÚHasField
szMessage.HasFieldcCst‚dS)a^Clears the contents of a given field.
 
    Inside a oneof group, clears the field set. If the name neither refers to a
    defined field or oneof group, :exc:`ValueError` is raised.
 
    Args:
      field_name (str): The name of the field to check for presence.
 
    Raises:
      ValueError: if the `field_name` is not a member of this message.
    Nrr+rrrÚ
ClearFields zMessage.ClearFieldcCst‚dS)aEReturns the name of the field that is set inside a oneof group.
 
    If no field is set, returns None.
 
    Args:
      oneof_group (str): the name of the oneof group to check.
 
    Returns:
      str or None: The name of the group that is set, or None.
 
    Raises:
      ValueError: no group with the given name exists
    Nr)rZ oneof_grouprrrÚ
WhichOneof*szMessage.WhichOneofcCst‚dS)aìChecks if a certain extension is present for this message.
 
    Extensions are retrieved using the :attr:`Extensions` mapping (if present).
 
    Args:
      extension_handle: The handle for the extension to check.
 
    Returns:
      bool: Whether the extension is present for this message.
 
    Raises:
      KeyError: if the extension is repeated. Similar to repeated fields,
        there is no separate notion of presence: a "not present" repeated
        extension is an empty list.
    Nr©rÚextension_handlerrrÚ HasExtension:szMessage.HasExtensioncCst‚dS)zxClears the contents of a given extension.
 
    Args:
      extension_handle: The handle for the extension to clear.
    Nrr0rrrÚClearExtensionLszMessage.ClearExtensioncCst‚dS)zqReturns the UnknownFieldSet.
 
    Returns:
      UnknownFieldSet: The unknown fields stored in this message.
    NrrrrrÚ UnknownFieldsTszMessage.UnknownFieldscCst‚dS)zlClears all fields in the :class:`UnknownFieldSet`.
 
    This operation is recursive for nested message.
    NrrrrrÚDiscardUnknownFields\szMessage.DiscardUnknownFieldscCst‚dS)z¿Returns the serialized size of this message.
 
    Recursively calls ByteSize() on all contained messages.
 
    Returns:
      int: The number of bytes required to serialize this message.
    NrrrrrÚByteSizecszMessage.ByteSizecCst‚dSr r)ÚclsÚsrrrÚ
FromStringmszMessage.FromStringcCst‚dSr r)r1rrrÚRegisterExtensionqszMessage.RegisterExtensioncCst‚dS)a6Internal method used by the protocol message implementation.
    Clients should not call this directly.
 
    Sets a listener that this message will call on certain state transitions.
 
    The purpose of this method is to register back-edges from children to
    parents at runtime, for the purpose of setting "has" bits and
    byte-size-dirty bits in the parent and ancestor objects whenever a child or
    descendant object is modified.
 
    If the client wants to disconnect this Message from the object tree, she
    explicitly sets callback to None.
 
    If message_listener is None, unregisters any existing listener.  Otherwise,
    message_listener must implement the MessageListener interface in
    internal/message_listener.py, and we discard any listener registered
    via a previous _SetListener() call.
    Nr)rZmessage_listenerrrrÚ _SetListeneruszMessage._SetListenercCst| ¡dS)úSupport the pickle protocol.)r#)Údictr)rrrrÚ __getstate__ŠszMessage.__getstate__cCs2| ¡|d}t|tƒs$| d¡}| |¡dS)r<r#Úlatin1N)Ú__init__Ú
isinstanceÚbytesÚencoder%)rÚstater#rrrÚ __setstate__Žs
 
 
zMessage.__setstate__cCs8|j}|jdkr"t|ƒd| ¡fS|}t|jf| ¡fS)Nr)Ú
DESCRIPTORZcontaining_typer r>Ú_InternalConstructMessageÚ    full_name)rZmessage_descriptorÚ    containerrrrÚ
__reduce__˜s
ÿzMessage.__reduce__)N)&rrrrÚ    __slots__rFrrrrrrrrrr r!r$r%r(r)r*r-r.r/r2r3r4r5r6Ú classmethodr9Ú staticmethodr:r;r>rErJrrrrr 6sF
 
! 
 
 
 
r cCsddlm}| ¡ |¡ƒS)zConstructs a nested message.é)Úsymbol_database)Zgoogle.protobufrOZDefaultZ    GetSymbol)rHrOrrrrG¤s rGN)    rÚ
__author__Ú    Exceptionrr    r
Úobjectr rGrrrrÚ<module>#sp