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: Any)¶ Base container class.
-
count
(value) → integer -- return number of occurrences of value¶
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
-
reverse
() → None¶
-
sort
(*args, **kwargs) → None¶
-
-
class
google.protobuf.internal.containers.
MessageMap
(message_listener: Any, message_descriptor: Any, key_checker: Any, entry_descriptor: Any)¶ Simple, type-checked, dict-like container for with submessage values.
-
GetEntryClass
() → Any¶
-
InvalidateIterators
() → None¶
-
MergeFrom
()¶
-
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: _K) → _V¶ 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: Any, message_descriptor: Any)¶ Simple, list-like container for holding repeated composite fields.
-
MergeFrom
()¶ Appends the contents of another repeated field of the same type to this one, copying each individual message.
-
add
(**kwargs: Any) → _T¶ Adds a new element at the end of the list and returns it. Keyword arguments may be used to initialize the element.
-
append
(value: _T) → None¶ Appends one element by copying the message.
-
clear
() → None -- remove all items from S¶
-
count
(value) → integer -- return number of occurrences of value¶
-
extend
()¶ Extends by appending the given sequence of elements of the same type
as this one, copying each individual message.
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
-
insert
(key: int, value: _T) → None¶ Inserts the item at the specified position by copying.
-
pop
()¶ Removes and returns an item at a given index. Similar to list.pop().
-
remove
(elem: _T) → None¶ Removes an item from the list. Similar to list.remove().
-
reverse
() → None¶
-
sort
(*args, **kwargs) → None¶
-
-
class
google.protobuf.internal.containers.
RepeatedScalarFieldContainer
(message_listener: Any, type_checker: Any)¶ Simple, type-checked, list-like container for holding repeated scalars.
-
MergeFrom
()¶ 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: _T) → None¶ Appends an item to the list. Similar to list.append().
-
clear
() → None -- remove all items from S¶
-
count
(value) → integer -- return number of occurrences of value¶
-
extend
()¶ Extends by appending the given iterable. Similar to list.extend().
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
-
insert
(key: int, value: _T) → None¶ Inserts the item at the specified position. Similar to list.insert().
-
pop
()¶ Removes and returns an item at a given index. Similar to list.pop().
-
remove
(elem: _T)¶ Removes an item from the list. Similar to list.remove().
-
reverse
() → None¶
-
sort
(*args, **kwargs) → None¶
-
-
class
google.protobuf.internal.containers.
ScalarMap
(message_listener: Any, key_checker: Any, value_checker: Any, entry_descriptor: Any)¶ Simple, type-checked, dict-like container for holding repeated scalars.
-
GetEntryClass
() → Any¶
-
InvalidateIterators
() → None¶
-
MergeFrom
()¶
-
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
¶
-
property
-
class
google.protobuf.internal.containers.
UnknownFieldSet
¶ UnknownField container