Skip to content

Commit

Permalink
docstring (#22995)
Browse files Browse the repository at this point in the history
  • Loading branch information
swathipil authored Feb 9, 2022
1 parent 458b404 commit 112f088
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sdk/eventhub/azure-eventhub/azure/eventhub/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ def __message_data__(self) -> Dict:

@classmethod
def from_message_data(cls, data: bytes, content_type: str) -> "EventData":
"""
Creates an EventData object given content type and a data value to be set as body.
:param bytes data: The data value to be set as the body of the message.
:param str content_type: The content type to be set on the message.
:rtype: ~azure.eventhub.EventData
"""
event_data = cls(data)
event_data.content_type = content_type
return event_data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ class MessageType(Protocol):

@classmethod
def from_message_data(cls, data: bytes, content_type: str, **kwargs: Any) -> "MessageType":
"""
Creates an object that is a subtype of MessageType given content type and
a data value to be set as body.
:param bytes data: The data value to be set as the body of the message.
:param str content_type: The content type to be set on the message.
:rtype: ~azure.schemaregistry.encoder.avroencoder.MessageType
"""
...

def __message_data__(self) -> MessageMetadataDict:
Expand Down

0 comments on commit 112f088

Please sign in to comment.