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

Method get_py_array

python/proton/_data.py:1514–1541  ·  view source on GitHub ↗

A convenience method for decoding an AMQP array into an :class:`Array` object. This method encapsulates all the steps described in :func:`get_array` into a single function. If the current node is an array, return an Array object representing the array and it

(self)

Source from the content-addressed store, hash-verified

1512 self.exit()
1513
1514 def get_py_array(self) -> Optional[Array]:
1515 """
1516 A convenience method for decoding an AMQP array into an
1517 :class:`Array` object. This method encapsulates all the
1518 steps described in :func:`get_array` into a single function.
1519
1520 If the current node is an array, return an Array object
1521 representing the array and its contents. Otherwise return ``None``.
1522
1523 :returns: The decoded AMQP array.
1524 """
1525
1526 count, described, type = self.get_array()
1527 if type is None:
1528 return None
1529 if self.enter():
1530 try:
1531 if described:
1532 self.next()
1533 descriptor = self.get_object()
1534 else:
1535 descriptor = UNDESCRIBED
1536 elements = []
1537 while self.next():
1538 elements.append(self.get_object())
1539 finally:
1540 self.exit()
1541 return Array(descriptor, type, *elements)
1542
1543 def put_py_array(self, a: Array) -> None:
1544 """

Callers

nothing calls this directly

Calls 7

get_arrayMethod · 0.95
enterMethod · 0.95
nextMethod · 0.95
get_objectMethod · 0.95
exitMethod · 0.95
ArrayClass · 0.70
appendMethod · 0.45

Tested by

no test coverage detected