MCPcopy Create free account
hub / github.com/apache/qpid-proton / get_map

Method get_map

python/proton/_data.py:1137–1155  ·  view source on GitHub ↗

If the current node is a map, return the number of child elements, otherwise return 0. Key value pairs can be accessed by entering the map. >>> count = data.get_map() >>> data.enter() >>> for i in range(count/2): ... type =

(self)

Source from the content-addressed store, hash-verified

1135 return pn_data_get_list(self._data)
1136
1137 def get_map(self) -> int:
1138 """
1139 If the current node is a map, return the number of child elements,
1140 otherwise return 0. Key value pairs can be accessed by entering
1141 the map.
1142
1143 >>> count = data.get_map()
1144 >>> data.enter()
1145 >>> for i in range(count/2):
1146 ... type = data.next()
1147 ... if type == Data.STRING:
1148 ... print data.get_string()
1149 ... elif type == ...:
1150 ... ...
1151 >>> data.exit()
1152
1153 :return: the number of child elements of a map node
1154 """
1155 return pn_data_get_map(self._data)
1156
1157 def get_array(self) -> Tuple[int, bool, Optional[int]]:
1158 """

Callers 1

mapMethod · 0.95

Calls 1

pn_data_get_mapFunction · 0.85

Tested by

no test coverage detected