Skip to content

Commit

Permalink
Move AMQPMessage docstrings into individual properties instead of a p…
Browse files Browse the repository at this point in the history
…aram block (as it does not take params) Also add typehints to the properties.
  • Loading branch information
KieranBrantnerMagee committed Oct 2, 2020
1 parent cc72e35 commit 34a116a
Showing 1 changed file with 39 additions and 17 deletions.
56 changes: 39 additions & 17 deletions sdk/servicebus/azure-servicebus/azure/servicebus/_common/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,30 +1085,19 @@ def renew_lock(self):
class AMQPMessage(object):
"""
The internal AMQP message that this ServiceBusMessage represents. Is read-only.
:param properties: Properties to add to the message.
:type properties: ~uamqp.message.MessageProperties
:param application_properties: Service specific application properties.
:type application_properties: dict
:param annotations: Service specific message annotations. Keys in the dictionary
must be `uamqp.types.AMQPSymbol` or `uamqp.types.AMQPuLong`.
:type annotations: dict
:param delivery_annotations: Delivery-specific non-standard properties at the head of the message.
Delivery annotations convey information from the sending peer to the receiving peer.
Keys in the dictionary must be `uamqp.types.AMQPSymbol` or `uamqp.types.AMQPuLong`.
:type delivery_annotations: dict
:param header: The message header.
:type header: ~uamqp.message.MessageHeader
:param footer: The message footer.
:type footer: dict
"""
def __init__(self, message):
# type: (uamqp.Message) -> None
self._message = message

@property
def properties(self):
# type: () -> uamqp.message.MessageProperties
"""
Properties to add to the message.
:rtype: ~uamqp.message.MessageProperties
"""
return uamqp.message.MessageProperties(message_id=self._message.properties.message_id,
user_id=self._message.properties.user_id,
to=self._message.properties.to,
Expand All @@ -1128,6 +1117,12 @@ def properties(self):

@property
def application_properties(self):
# type: () -> dict
"""
Service specific application properties.
:rtype: dict
"""
return copy.deepcopy(self._message.application_properties)

#@application_properties.setter
Expand All @@ -1136,6 +1131,13 @@ def application_properties(self):

@property
def annotations(self):
# type: () -> dict
"""
Service specific message annotations. Keys in the dictionary
must be `uamqp.types.AMQPSymbol` or `uamqp.types.AMQPuLong`.
:rtype: dict
"""
return copy.deepcopy(self._message.annotations)

#@annotations.setter
Expand All @@ -1144,6 +1146,14 @@ def annotations(self):

@property
def delivery_annotations(self):
# type: () -> dict
"""
Delivery-specific non-standard properties at the head of the message.
Delivery annotations convey information from the sending peer to the receiving peer.
Keys in the dictionary must be `uamqp.types.AMQPSymbol` or `uamqp.types.AMQPuLong`.
:rtype: dict
"""
return copy.deepcopy(self._message.delivery_annotations)

#@delivery_annotations.setter
Expand All @@ -1152,6 +1162,12 @@ def delivery_annotations(self):

@property
def header(self):
# type: () -> uamqp.message.MessageHeader
"""
The message header.
:rtype: ~uamqp.message.MessageHeader
"""
return uamqp.message.MessageHeader(header=self._message.header)

#@header.setter
Expand All @@ -1160,6 +1176,12 @@ def header(self):

@property
def footer(self):
# type: () -> dict
"""
The message footer.
:rtype: dict
"""
return copy.deepcopy(self._message.footer)

#@footer.setter
Expand Down

0 comments on commit 34a116a

Please sign in to comment.