Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions libraries/botbuilder-core/botbuilder/core/conversation_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,35 @@


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.
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 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")

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.
: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
Expand All @@ -56,7 +57,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)