From 8037ff2ec40de49e7ba0607628d60d8622050dbb Mon Sep 17 00:00:00 2001 From: Michael Miele Date: Mon, 13 Jan 2020 14:02:54 -0800 Subject: [PATCH 1/2] Update conversation_state.py Added reference documentation. --- .../botbuilder/core/conversation_state.py | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/libraries/botbuilder-core/botbuilder/core/conversation_state.py b/libraries/botbuilder-core/botbuilder/core/conversation_state.py index 11f6b328d..954620de1 100644 --- a/libraries/botbuilder-core/botbuilder/core/conversation_state.py +++ b/libraries/botbuilder-core/botbuilder/core/conversation_state.py @@ -9,19 +9,18 @@ class ConversationState(BotState): """Conversation state Defines a state management object for conversation state. - Extends `BootState` base class. + Extends :class:`BootState` base class. .. remarks:: Conversation state is available in any turn in a specific conversation, regardless of user, such as in a group conversation. """ - no_key_error_message = "ConversationState: channelId and/or conversation missing from context.activity." def __init__(self, storage: Storage): - """ Creates a :class:ConversationState instance - Creates a new instance of the :class:ConversationState class. + """ Creates a :class:`ConversationState` instance + Creates a new instance of the :class:`ConversationState` class. :param storage: The storage containing the conversation state. - :type storage: Storage + :type storage: :class:`Storage` """ super(ConversationState, self).__init__(storage, "ConversationState") @@ -30,17 +29,17 @@ def get_storage_key(self, turn_context: TurnContext) -> object: Gets the key to use when reading and writing state to and from storage. :param turn_context: The context object for this turn. - :type turn_context: TurnContext + :type turn_context: :class:`TurnContext` - :raise: `TypeError` if the `ITurnContext.Activity` for the current turn is missing - :any::Schema.Activity.ChannelId or :any::Schema.Activity.Conversation information, or - the conversation's :any::Schema.ConversationAccount.Id is missing. + :raise: :class:`TypeError` if the :meth:`TurnContext.activity` for the current turn is missing + :class:`botbuilder.schema.Activity` channelId or conversation information or the conversation's + account id is missing. :return: The storage key. :rtype: str .. remarks:: - Conversation state includes the channel ID and conversation ID as part of its storage key. + Conversation state includes the channel Id and conversation Id as part of its storage key. """ channel_id = turn_context.activity.channel_id or self.__raise_type_error( "invalid activity-missing channel_id" @@ -56,7 +55,7 @@ def get_storage_key(self, turn_context: TurnContext) -> object: return storage_key def __raise_type_error(self, err: str = "NoneType found while expecting value"): - """ Raise type error - :raises: :class:TypeError This function raises exception. + """ Raise type error exception + :raises: :class:`TypeError` """ raise TypeError(err) From 6b97814b469d8441edc6725cf12668221c981611 Mon Sep 17 00:00:00 2001 From: Michael Miele Date: Fri, 24 Jan 2020 14:34:33 -0800 Subject: [PATCH 2/2] Update conversation_state.py Code comments formatting. --- .../botbuilder/core/conversation_state.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libraries/botbuilder-core/botbuilder/core/conversation_state.py b/libraries/botbuilder-core/botbuilder/core/conversation_state.py index 954620de1..fd39935e0 100644 --- a/libraries/botbuilder-core/botbuilder/core/conversation_state.py +++ b/libraries/botbuilder-core/botbuilder/core/conversation_state.py @@ -7,17 +7,19 @@ class ConversationState(BotState): - """Conversation state + """ Defines a state management object for conversation state. Extends :class:`BootState` base class. .. remarks:: - Conversation state is available in any turn in a specific conversation, regardless of user, such as in a group conversation. + Conversation state is available in any turn in a specific conversation, regardless of the user, such as in a group conversation. """ no_key_error_message = "ConversationState: channelId and/or conversation missing from context.activity." def __init__(self, storage: Storage): - """ Creates a :class:`ConversationState` instance + """ + Creates a :class:`ConversationState` instance. + Creates a new instance of the :class:`ConversationState` class. :param storage: The storage containing the conversation state. :type storage: :class:`Storage` @@ -25,7 +27,7 @@ def __init__(self, storage: Storage): super(ConversationState, self).__init__(storage, "ConversationState") def get_storage_key(self, turn_context: TurnContext) -> object: - """ Get storage key + """ Gets the key to use when reading and writing state to and from storage. :param turn_context: The context object for this turn. @@ -39,7 +41,7 @@ def get_storage_key(self, turn_context: TurnContext) -> object: :rtype: str .. remarks:: - Conversation state includes the channel Id and conversation Id as part of its storage key. + Conversation state includes the channel ID and conversation ID as part of its storage key. """ channel_id = turn_context.activity.channel_id or self.__raise_type_error( "invalid activity-missing channel_id"