8000 Update prompt.py · TheCompuGuru/botbuilder-python@48a364c · GitHub
[go: up one dir, main page]

Skip to content

Commit 48a364c

Browse files
author
Michael Miele
committed
Update prompt.py
More style fixes
1 parent e455fbb commit 48a364c

File tree

1 file changed

+20
-19
lines changed
  • libraries/botbuilder-dialogs/botbuilder/dialogs/prompts

1 file changed

+20
-19
lines changed

libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/prompt.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@ class Prompt(Dialog):
2828
Defines the core behavior of prompt dialogs. Extends the :class:`Dialog` base class.
2929
3030
.. remarks::
31-
3231
When the prompt ends, it returns an object that represents the value it was prompted for.
3332
Use :meth:`DialogSet.add()` or :meth:`ComponentDialog.add_dialog()` to add a prompt to
3433
a dialog set or component dialog, respectively.
34+
3535
Use :meth:`DialogContext.prompt()` or :meth:`DialogContext.begin_dialog()` to start the prompt.
3636
If you start a prompt from a :class:`WaterfallStep` in a :class:`WaterfallDialog`, then the
3737
prompt result will be available in the next step of the waterfall.
38-
3938
"""
4039

4140
ATTEMPT_COUNT_KEY = "AttemptCount"
@@ -46,11 +45,10 @@ def __init__(self, dialog_id: str, validator: object = None):
4645
"""
4746
Creates a new :class:`Prompt` instance.
4847
49-
:param dialog_id: Unique Id of the prompt within its parent :class:`DialogSet` or
50-
:class:`ComponentDialog`.
48+
:param dialog_id: Unique Id of the prompt within its parent :class:`DialogSet`
49+
:class:`ComponentDialog`
5150
:type dialog_id: str
52-
:param validator: Optional custom validator used to provide additional validation and re-prompting
53-
logic for the prompt.
51+
:param validator: Optionally provide additional validation and re-prompting logic
5452
:type validator: Object
5553
"""
5654
super(Prompt, self).__init__(dialog_id)
@@ -66,13 +64,12 @@ async def begin_dialog(
6664
:param dialog_context: The dialog context for the current turn of the conversation
6765
:type dialog_context: :class:`DialogContext`
6866
:param options: Optional, additional information to pass to the prompt being started
69-
:type options: object
67+
:type options: Object
7068
:return: The dialog turn result
7169
:rtype: :class:`DialogTurnResult`
7270
7371
.. note::
74-
75-
If the task is successful, the result indicates whether the prompt is still active after the turn has been processed.
72+
The result indicates whether the prompt is still active after the turn has been processed.
7673
"""
7774
if not dialog_context:
7875
raise TypeError("Prompt(): dc cannot be None.")
@@ -102,19 +99,21 @@ async def begin_dialog(
10299

103100
async def continue_dialog(self, dialog_context: DialogContext):
104101
"""
105-
Con 8000 tinues a dialog. Called when a prompt dialog is the active dialog and the user replied with a new activity.
102+
Continues a dialog.
106103
107104
:param dialog_context: The dialog context for the current turn of the conversation
108105
:type dialog_context: :class:`DialogContext`
109106
:return: The dialog turn result
110107
:rtype: :class:`DialogTurnResult`
111108
112109
.. remarks::
113-
If the task is successful, the result indicates whether the dialog is still
114-
active after the turn has been processed by the dialog.
110+
Called when a prompt dialog is the active dialog and the user replied with a new activity.
111+
112+
If the task is successful, the result indicates whether the dialog is still active after
113+
the turn has been processed by the dialog.
114+
115115
The prompt generally continues to receive the user's replies until it accepts the
116116
user's reply as valid input for the prompt.
117-
118117
"""
119118
if not dialog_context:
120119
raise TypeError("Prompt(): dc cannot be None.")
@@ -161,20 +160,21 @@ async def resume_dialog(
161160
:param reason: An enum indicating why the dialog resumed.
162161
:type reason: :class:`DialogReason`
163162
:param result: Optional, value returned from the previous dialog on the stack.
164-
The type of the value returned is dependent on the previous dialog.
165163
:type result: object
166164
:return: The dialog turn result
167165
:rtype: :class:`DialogTurnResult`
168166
169167
.. remarks::
170-
171168
Called when a prompt dialog resumes being the active dialog on the dialog stack,
172169
such as when the previous active dialog on the stack completes.
170+
173171
If the task is successful, the result indicates whether the dialog is still
174172
active after the turn has been processed by the dialog.
173+
175174
Prompts are typically leaf nodes on the stack but the dev is free to push other dialogs
176175
on top of the stack which will result in the prompt receiving an unexpected call to
177176
:meth:resume_dialog() when the pushed on dialog ends.
177+
178178
Simply re-prompt the user to avoid that the prompt ends prematurely.
179179
180180
"""
@@ -183,7 +183,7 @@ async def resume_dialog(
183183

184184
async def reprompt_dialog(self, context: TurnContext, instance: DialogInstance):
185185
"""
186-
Reprompts user for input. Called when a prompt dialog has been requested to re-prompt the user for input.
186+
Reprompts user for input.
187187
188188
:param context: Context for the current turn of conversation with the user
189189
:type context: :class:`botbuilder.core.TurnContext`
@@ -214,8 +214,7 @@ async def on_prompt(
214214
:param options: A prompt options object constructed from the options initially provided
215215
in the call :meth:`DialogContext.prompt()`
216216
:type options: :class:`PromptOptions`
217-
:param is_retry: true if this is the first time this prompt dialog instance on the stack is prompting
218-
the user for input; otherwise, false
217+
:param is_retry: true if is the first time the user for input; otherwise, false
219218
:type is_retry: bool
220219
221220
:return: A task representing the asynchronous operation.
@@ -230,7 +229,7 @@ async def on_recognize(
230229
options: PromptOptions,
231230
):
232231
"""
233-
Recognizes the user's input. When overridden in a derived class, attempts to recognize the user's input.
232+
Recognizes the user's input.
234233
235234
:param turn_context: Context for the current turn of conversation with the user
236235
:type turn_context: :class:`botbuilder.core.TurnContext`
@@ -242,6 +241,8 @@ async def on_recognize(
242241
243242
:return: A task representing the asynchronous operation.
244243
244+
.. note::
245+
When overridden in a derived class, attempts to recognize the user's input.
245246
"""
246247

247248
def append_choices(

0 commit comments

Comments
 (0)
0