google.protobuf.internal.containers

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.

class google.protobuf.internal.containers.BaseContainer(message_listener)

Base container class.

reverse()
sort(*args, **kwargs)
class google.protobuf.internal.containers.MessageMap(message_listener, message_descriptor, key_checker, entry_descriptor)

Simple, type-checked, dict-like container for with submessage values.

GetEntryClass()
InvalidateIterators()
MergeFrom(other)
clear() → None. Remove all items from D.
get(k[, d]) → D[k] if k in D, else d. d defaults to None.
get_or_create(key)

get_or_create() is an alias for getitem (ie. map[key]).

Parameters

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]

items() → a set-like object providing a view on D's items
keys() → a set-like object providing a view on D's keys
pop(k[, d]) → v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() → (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) → None. Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() → an object providing a view on D's values
class google.protobuf.internal.containers.RepeatedCompositeFieldContainer(message_listener, message_descriptor)

Simple, list-like container for holding repeated composite fields.

MergeFrom(other)

Appends the contents of another repeated field of the same type to this one, copying each individual message.

add(**kwargs)

Adds a new element at the end of the list and returns it. Keyword arguments may be used to initialize the element.

append(value)

Appends one element by copying the message.

extend(elem_seq)

Extends by appending the given sequence of elements of the same type

as this one, copying each individual message.

insert(key, value)

Inserts the item at the specified position by copying.

pop(key=-1)

Removes and returns an item at a given index. Similar to list.pop().

remove(elem)

Removes an item from the list. Similar to list.remove().

reverse()
sort(*args, **kwargs)
class google.protobuf.internal.containers.RepeatedScalarFieldContainer(message_listener, type_checker)

Simple, type-checked, list-like container for holding repeated scalars.

MergeFrom(other)

Appends the contents of another repeated field of the same type to this one. We do not check the types of the individual fields.

append(value)

Appends an item to the list. Similar to list.append().

extend(elem_seq)

Extends by appending the given iterable. Similar to list.extend().

insert(key, value)

Inserts the item at the specified position. Similar to list.insert().

pop(key=-1)

Removes and returns an item at a given index. Similar to list.pop().

remove(elem)

Removes an item from the list. Similar to list.remove().

reverse()
sort(*args, **kwargs)
class google.protobuf.internal.containers.ScalarMap(message_listener, key_checker, value_checker, entry_descriptor)

Simple, type-checked, dict-like container for holding repeated scalars.

GetEntryClass()
InvalidateIterators()
MergeFrom(other)
clear() → None. Remove all items from D.
get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items() → a set-like object providing a view on D's items
keys() → a set-like object providing a view on D's keys
pop(k[, d]) → v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() → (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) → None. Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() → an object providing a view on D's values
class google.protobuf.internal.containers.UnknownFieldRef(parent, index)
property data
property field_number
property wire_type
class google.protobuf.internal.containers.UnknownFieldSet

UnknownField container