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

Class Data

python/proton/_data.py:562–1636  ·  view source on GitHub ↗

The :class:`Data` class provides an interface for decoding, extracting, creating, and encoding arbitrary AMQP data. A :class:`Data` object contains a tree of AMQP values. Leaf nodes in this tree correspond to scalars in the AMQP type system such as :const:`ints ` or :const:

Source from the content-addressed store, hash-verified

560
561
562class Data:
563 """
564 The :class:`Data` class provides an interface for decoding, extracting,
565 creating, and encoding arbitrary AMQP data. A :class:`Data` object
566 contains a tree of AMQP values. Leaf nodes in this tree correspond
567 to scalars in the AMQP type system such as :const:`ints <INT>` or
568 :const:`strings <STRING>`. Non-leaf nodes in this tree correspond to
569 compound values in the AMQP type system such as :const:`lists <LIST>`,
570 :const:`maps <MAP>`, :const:`arrays <ARRAY>`, or :const:`described values <DESCRIBED>`.
571 The root node of the tree is the :class:`Data` object itself and can have
572 an arbitrary number of children.
573
574 A :class:`Data` object maintains the notion of the current sibling node
575 and a current parent node. Siblings are ordered within their parent.
576 Values are accessed and/or added by using the :meth:`next`, :meth:`prev`,
577 :meth:`enter`, and :meth:`exit` methods to navigate to the desired location in
578 the tree and using the supplied variety of ``put_*`` / ``get_*`` methods to
579 access or add a value of the desired type.
580
581 The ``put_*`` methods will always add a value *after* the current node
582 in the tree. If the current node has a next sibling the ``put_*`` method
583 will overwrite the value on this node. If there is no current node
584 or the current node has no next sibling then one will be added. The
585 ``put_*`` methods always set the added/modified node to the current
586 node. The ``get_*`` methods read the value of the current node and do
587 not change which node is current.
588
589 The following types of scalar values are supported:
590
591 * :const:`NULL`
592 * :const:`BOOL`
593 * :const:`UBYTE`
594 * :const:`USHORT`
595 * :const:`SHORT`
596 * :const:`UINT`
597 * :const:`INT`
598 * :const:`ULONG`
599 * :const:`LONG`
600 * :const:`FLOAT`
601 * :const:`DOUBLE`
602 * :const:`BINARY`
603 * :const:`STRING`
604 * :const:`SYMBOL`
605
606 The following types of compound values are supported:
607
608 * :const:`DESCRIBED`
609 * :const:`ARRAY`
610 * :const:`LIST`
611 * :const:`MAP`
612 """
613
614 NULL = PN_NULL #: A null value.
615 BOOL = PN_BOOL #: A boolean value.
616 UBYTE = PN_UBYTE #: An unsigned byte value.
617 BYTE = PN_BYTE #: A signed byte value.
618 USHORT = PN_USHORT #: An unsigned short value.
619 SHORT = PN_SHORT #: A short value.

Callers 15

setUpMethod · 0.90
_testMethod · 0.90
testCopyMethod · 0.90
testCopyNestedMethod · 0.90
testCopyNestedArrayMethod · 0.90
testRoundTripMethod · 0.90
testBufferMethod · 0.90
testMemoryViewMethod · 0.90

Calls 1

put_nullMethod · 0.80

Tested by

no test coverage detected