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

Side by Side Diff: recipe_engine/third_party/google/protobuf/internal/containers.py

Issue 2236673002: Bump vendoring, move to proto3 release. (Closed) Base URL: https://github.com/luci/recipes-py@master
Patch Set: Created 4 years, 4 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 return len(self._values) 587 return len(self._values)
588 588
589 def __iter__(self): 589 def __iter__(self):
590 return iter(self._values) 590 return iter(self._values)
591 591
592 def __repr__(self): 592 def __repr__(self):
593 return repr(self._values) 593 return repr(self._values)
594 594
595 def MergeFrom(self, other): 595 def MergeFrom(self, other):
596 for key in other: 596 for key in other:
597 self[key].MergeFrom(other[key]) 597 # According to documentation: "When parsing from the wire or when merging,
598 # if there are duplicate map keys the last key seen is used".
599 if key in self:
600 del self[key]
601 self[key].CopyFrom(other[key])
598 # self._message_listener.Modified() not required here, because 602 # self._message_listener.Modified() not required here, because
599 # mutations to submessages already propagate. 603 # mutations to submessages already propagate.
600 604
601 def InvalidateIterators(self): 605 def InvalidateIterators(self):
602 # It appears that the only way to reliably invalidate iterators to 606 # It appears that the only way to reliably invalidate iterators to
603 # self._values is to ensure that its size changes. 607 # self._values is to ensure that its size changes.
604 original = self._values 608 original = self._values
605 self._values = original.copy() 609 self._values = original.copy()
606 original[None] = None 610 original[None] = None
607 611
608 # This is defined in the abstract base, but we can do it much more cheaply. 612 # This is defined in the abstract base, but we can do it much more cheaply.
609 def clear(self): 613 def clear(self):
610 self._values.clear() 614 self._values.clear()
611 self._message_listener.Modified() 615 self._message_listener.Modified()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698