Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Reporter.output(filtered_dep_tree)
if licenses_not_found and interactive and questionary.confirm(
"Do you want to add some of the licenses to your whitelist?"
).ask():
license_whitelist = questionary.checkbox(
"📋 Which licenses do you want to whitelist?",
choices=[{"name": license} for license in licenses_not_found],
).ask()
if license_whitelist:
whitelist_licenses(path_to_config, license_whitelist)
if has_issues and interactive and questionary.confirm("Do you want to ignore some of the packages?").ask():
bad_packages = get_problematic_packages_from_analyzed_tree(filtered_dep_tree)
new_ignored_packages = questionary.checkbox(
"📋 Which packages do you want to ignore?",
choices=[{"name": package} for package, version in bad_packages],
).ask()
ignore_packages(path_to_config, project_to_check, new_ignored_packages)
if not has_issues:
print("✅ Your project passed the compliance check 🎉🎉🎉")
exit(1 if has_issues else 0)
default_name = path.name
prompt_name = prompt.text("Project Name", default=default_name).ask()
name = prompt_name.strip()
if not template:
templates = modules.TemplatesModule.TEMPLATES.items()
templ_choices = [Choice(str(val[1]), value=t)
for t, val in templates]
template = prompt.checkbox(
f"Choose any Templates to Generate", choices=templ_choices).ask()
stubs = [Choice(str(s), value=s) for s in mpy.stubs]
if not stubs:
mpy.log.error("You don't have any stubs!")
mpy.log.title(
"To add stubs to micropy, use $[micropy stubs add ]")
sys.exit(1)
stub_choices = prompt.checkbox(
f"Which stubs would you like to use?", choices=stubs).ask()
project = Project(path, name=name)
project.add(modules.StubsModule, mpy.stubs, stubs=stub_choices)
project.add(modules.PackagesModule, 'requirements.txt')
project.add(modules.DevPackagesModule, 'dev-requirements.txt')
project.add(modules.TemplatesModule, templates=template, run_checks=mpy.RUN_CHECKS)
proj_path = project.create()
try:
rel_path = f"./{proj_path.relative_to(Path.cwd())}"
except ValueError:
rel_path = proj_path
mpy.log.title(f"Created $w[{project.name}] at $w[{rel_path}]")
import questionary
from examples import custom_style_dope
if __name__ == "__main__":
questionary.text("What's your first name").ask()
questionary.password("What's your secret?").ask()
questionary.confirm("Are you amazed?").ask()
questionary.select(
"What do you want to do?",
choices=["Order a pizza", "Make a reservation", "Ask for opening hours"],
).ask()
questionary.rawselect(
"What do you want to do?",
choices=["Order a pizza", "Make a reservation", "Ask for opening hours"],
).ask()
questionary.checkbox(
"Select toppings", choices=["foo", "bar", "bazz"], style=custom_style_dope
).ask()
def _get_vocab_pipes():
vocab_pipe = questionary.checkbox(
message="What batteries do you want with the dataset?",
choices=[
Choice(
title="word_vocab [Default] will always be included",
checked=True,
disabled=True,
value="word_vocab",
),
Choice(
title="char_vocab - Usually included if character embeddings are needed",
value="char_vocab",
),
],
).ask()
vocab_pipe.append("word_vocab")
return vocab_pipe
def ask_pystyle(**kwargs):
# create the question object
question = questionary.checkbox(
"Select toppings",
qmark="😃",
choices=[
Choice("foo", checked=True),
Separator(),
Choice("bar", disabled="nope"),
"bazz",
Separator("--END--"),
],
style=custom_style_dope,
**kwargs,
)
# prompt the user for an answer
return question.ask()