Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def example_form(inp):
return form(
q1=questionary.confirm("Hello?", input=inp, output=DummyOutput()),
q2=questionary.select(
"World?", choices=["foo", "bar"], input=inp, output=DummyOutput()
),
def _request_export_info() -> Tuple[Text, Text, Text]:
"""Request file path and export stories & nlu data to that path"""
# export training data and quit
questions = questionary.form(
export_stories=questionary.text(
message="Export stories to (if file exists, this "
"will append the stories)",
default=PATHS["stories"]),
export_nlu=questionary.text(
message="Export NLU data to (if file exists, this will "
"merge learned data with previous training examples)",
default=PATHS["nlu"]),
export_domain=questionary.text(
message="Export domain file to (if file exists, this "
"will be overwritten)",
default=PATHS["domain"]),
)
answers = questions.ask()
if not answers:
def _request_export_info() -> Tuple[Text, Text, Text]:
"""Request file path and export stories & nlu data to that path"""
# export training data and quit
questions = questionary.form(
export_stories=questionary.text(
message="Export stories to (if file exists, this "
"will append the stories)",
default=PATHS["stories"],
validate=io_utils.file_type_validator(
[".md"],
"Please provide a valid export path for the stories, e.g. 'stories.md'.",
),
),
export_nlu=questionary.text(
message="Export NLU data to (if file exists, this will "
"merge learned data with previous training examples)",
default=PATHS["nlu"],
validate=io_utils.file_type_validator(
[".md", ".json"],
"Please provide a valid export path for the NLU data, e.g. 'nlu.md'.",
def configure_channel(channel):
from rasa_core.utils import print_error, print_success
import rasa_core.utils
credentials_file = questionary.text(
"Please enter a path where to store the credentials file",
default="credentials.yml").ask()
if channel == "facebook":
fb_config = questionary.form(
verify=questionary.text(
"Facebook verification string (choosen during "
"webhook creation)"),
secret=questionary.text(
"Facebook application secret"),
access_token=questionary.text(
"Facebook access token"),
).ask()
credentials = {
"verify": fb_config["verify"],
"secret": fb_config["secret"],
"page-access-token": fb_config["access_token"]}
rasa_core.utils.dump_obj_as_yaml_to_file(
credentials_file,
def _request_export_info() -> Tuple[Text, Text, Text]:
"""Request file path and export stories & nlu data to that path"""
# export training data and quit
questions = questionary.form(
export_stories=questionary.text(
message="Export stories to (if file exists, this "
"will append the stories)",
default=PATHS["stories"],
validate=io_utils.file_type_validator(
[".md"],
"Please provide a valid export path for the stories, e.g. 'stories.md'.",
),
),
export_nlu=questionary.text(
message="Export NLU data to (if file exists, this will "
"merge learned data with previous training examples)",
default=PATHS["nlu"],
validate=io_utils.file_type_validator(
[".md", ".json"],
"Please provide a valid export path for the NLU data, e.g. 'nlu.md'.",
def _request_export_info() -> Tuple[Text, Text, Text]:
"""Request file path and export stories & nlu data to that path"""
# export training data and quit
questions = questionary.form(
export_stories=questionary.text(
message="Export stories to (if file exists, this "
"will append the stories)",
default=PATHS["stories"]),
export_nlu=questionary.text(
message="Export NLU data to (if file exists, this will "
"merge learned data with previous training examples)",
default=PATHS["nlu"]),
export_domain=questionary.text(
message="Export domain file to (if file exists, this "
"will be overwritten)",
default=PATHS["domain"]),
)
answers = questions.ask()
if not answers: