Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: third_party/protobuf/python/google/protobuf/message.py

Issue 2600753002: Reverts third_party/protobuf: Update to HEAD (f52e188fe4) (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Protocol Buffers - Google's data interchange format 1 # Protocol Buffers - Google's data interchange format
2 # Copyright 2008 Google Inc. All rights reserved. 2 # Copyright 2008 Google Inc. All rights reserved.
3 # https://developers.google.com/protocol-buffers/ 3 # https://developers.google.com/protocol-buffers/
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are 6 # modification, are permitted provided that the following conditions are
7 # met: 7 # met:
8 # 8 #
9 # * Redistributions of source code must retain the above copyright 9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer. 10 # notice, this list of conditions and the following disclaimer.
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 # What do we do with fields that share names with Python keywords 218 # What do we do with fields that share names with Python keywords
219 # like 'lambda' and 'yield'? 219 # like 'lambda' and 'yield'?
220 # 220 #
221 # nnorwitz says: 221 # nnorwitz says:
222 # """ 222 # """
223 # Typically (in python), an underscore is appended to names that are 223 # Typically (in python), an underscore is appended to names that are
224 # keywords. So they would become lambda_ or yield_. 224 # keywords. So they would become lambda_ or yield_.
225 # """ 225 # """
226 def ListFields(self): 226 def ListFields(self):
227 """Returns a list of (FieldDescriptor, value) tuples for all 227 """Returns a list of (FieldDescriptor, value) tuples for all
228 fields in the message which are not empty. A message field is 228 fields in the message which are not empty. A singular field is non-empty
229 non-empty if HasField() would return true. A singular primitive field 229 if HasField() would return true, and a repeated field is non-empty if
230 is non-empty if HasField() would return true in proto2 or it is non zero 230 it contains at least one element. The fields are ordered by field
231 in proto3. A repeated field is non-empty if it contains at least one 231 number"""
232 element. The fields are ordered by field number"""
233 raise NotImplementedError 232 raise NotImplementedError
234 233
235 def HasField(self, field_name): 234 def HasField(self, field_name):
236 """Checks if a certain field is set for the message, or if any field inside 235 """Checks if a certain field is set for the message, or if any field inside
237 a oneof group is set. Note that if the field_name is not defined in the 236 a oneof group is set. Note that if the field_name is not defined in the
238 message descriptor, ValueError will be raised.""" 237 message descriptor, ValueError will be raised."""
239 raise NotImplementedError 238 raise NotImplementedError
240 239
241 def ClearField(self, field_name): 240 def ClearField(self, field_name):
242 """Clears the contents of a given field, or the field set inside a oneof 241 """Clears the contents of a given field, or the field set inside a oneof
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 raise NotImplementedError 286 raise NotImplementedError
288 287
289 def __getstate__(self): 288 def __getstate__(self):
290 """Support the pickle protocol.""" 289 """Support the pickle protocol."""
291 return dict(serialized=self.SerializePartialToString()) 290 return dict(serialized=self.SerializePartialToString())
292 291
293 def __setstate__(self, state): 292 def __setstate__(self, state):
294 """Support the pickle protocol.""" 293 """Support the pickle protocol."""
295 self.__init__() 294 self.__init__()
296 self.ParseFromString(state['serialized']) 295 self.ParseFromString(state['serialized'])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698