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

Method get_array

python/proton/_data.py:1157–1182  ·  view source on GitHub ↗

If the current node is an array, return a tuple of the element count, a boolean indicating whether the array is described, and the type of each element, otherwise return ``None``. Array data can be accessed by entering the array. >>> # read an array of s

(self)

Source from the content-addressed store, hash-verified

1155 return pn_data_get_map(self._data)
1156
1157 def get_array(self) -> Tuple[int, bool, Optional[int]]:
1158 """
1159 If the current node is an array, return a tuple of the element
1160 count, a boolean indicating whether the array is described, and
1161 the type of each element, otherwise return ``None``. Array
1162 data can be accessed by entering the array.
1163
1164 >>> # read an array of strings with a symbolic descriptor
1165 >>> count, described, type = data.get_array()
1166 >>> data.enter()
1167 >>> data.next()
1168 >>> print "Descriptor:", data.get_symbol()
1169 >>> for i in range(count):
1170 ... data.next()
1171 ... print "Element:", data.get_string()
1172 >>> data.exit()
1173
1174 :return: A tuple containing the number of array elements, a bool indicating
1175 whether the array is described, and the enumerated array element type.
1176 """
1177 count = pn_data_get_array(self._data)
1178 described = pn_data_is_array_described(self._data)
1179 type = pn_data_get_array_type(self._data)
1180 if type == -1:
1181 type = None
1182 return count, described, type
1183
1184 def is_described(self) -> bool:
1185 """

Callers 2

get_py_arrayMethod · 0.95
_testArrayMethod · 0.45

Calls 3

pn_data_get_arrayFunction · 0.85
pn_data_get_array_typeFunction · 0.85

Tested by

no test coverage detected