| Index: third_party/protobuf/python/google/protobuf/internal/containers.py
|
| ===================================================================
|
| --- third_party/protobuf/python/google/protobuf/internal/containers.py (revision 216642)
|
| +++ third_party/protobuf/python/google/protobuf/internal/containers.py (working copy)
|
| @@ -78,8 +78,13 @@
|
| def __repr__(self):
|
| return repr(self._values)
|
|
|
| - def sort(self, sort_function=cmp):
|
| - self._values.sort(sort_function)
|
| + def sort(self, *args, **kwargs):
|
| + # Continue to support the old sort_function keyword argument.
|
| + # This is expected to be a rare occurrence, so use LBYL to avoid
|
| + # the overhead of actually catching KeyError.
|
| + if 'sort_function' in kwargs:
|
| + kwargs['cmp'] = kwargs.pop('sort_function')
|
| + self._values.sort(*args, **kwargs)
|
|
|
|
|
| class RepeatedScalarFieldContainer(BaseContainer):
|
| @@ -235,6 +240,11 @@
|
| """
|
| self.extend(other._values)
|
|
|
| + def remove(self, elem):
|
| + """Removes an item from the list. Similar to list.remove()."""
|
| + self._values.remove(elem)
|
| + self._message_listener.Modified()
|
| +
|
| def __getslice__(self, start, stop):
|
| """Retrieves the subset of items from between the specified indices."""
|
| return self._values[start:stop]
|
|
|