Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def move_cursor_up(event):
ic.select_previous()
while not ic.is_selection_valid():
ic.select_previous()
@bindings.add(Keys.ControlM, eager=True)
def set_answer(event):
ic.is_answered = True
event.app.exit(result=ic.get_pointed_at().value)
@bindings.add(Keys.Any)
def other(event):
"""Disallow inserting other text. """
pass
return Question(
Application(layout=layout, key_bindings=bindings, style=merged_style, **kwargs)
)
webbrowser.open(pkg.url)
@bindings.add('s', eager=True)
def skip(event: Any):
ic.pointed_at = -1
ic.is_answered = True
event.app.exit(result=ic.get_pointed_at().value)
@bindings.add(Keys.Any)
def other(event: Any):
# Disallow inserting other text
pass
layout = create_inquirer_layout(ic, get_prompt_tokens, **prompt_kwargs)
app = Application(layout=layout, key_bindings=bindings, style=qstyle, **prompt_kwargs)
return Question(app)
def move_cursor_up(event):
ic.select_previous()
while not ic.is_selection_valid():
ic.select_previous()
@bindings.add(Keys.ControlM, eager=True)
def set_answer(event):
ic.is_answered = True
event.app.exit(result=[c.value for c in ic.get_selected_values()])
@bindings.add(Keys.Any)
def other(event):
"""Disallow inserting other text. """
pass
return Question(
Application(layout=layout, key_bindings=bindings, style=merged_style, **kwargs)
)
@bindings.add("Y")
def key_y(event):
status["answer"] = True
event.app.exit(result=True)
@bindings.add(Keys.ControlM, eager=True)
def set_answer(event):
status["answer"] = default
event.app.exit(result=default)
@bindings.add(Keys.Any)
def other(event):
"""Disallow inserting other text."""
pass
return Question(
PromptSession(
get_prompt_tokens, key_bindings=bindings, style=merged_style, **kwargs
).app
ignore_case=ignore_case,
meta_information=get_meta_style(meta_information),
match_middle=match_middle,
)
p = PromptSession(
get_prompt_tokens,
style=merged_style,
completer=completer,
validator=validator,
complete_style=complete_style,
**kwargs,
)
p.default_buffer.reset(Document(default))
return Question(p.app)
Question: Question instance, ready to be prompted (using `.ask()`).
"""
merged_style = merge_styles([DEFAULT_STYLE, style])
validator = build_validator(validate)
def get_prompt_tokens() -> List[Tuple[Text, Text]]:
return [("class:qmark", qmark), ("class:question", " {} ".format(message))]
p = PromptSession(
get_prompt_tokens, style=merged_style, validator=validator, **kwargs
)
p.default_buffer.reset(Document(default))
return Question(p.app)
@bindings.add('o', eager=True)
def open_url(event: Any):
pkg = ic.get_pointed_at().pkg
if pkg:
import webbrowser
webbrowser.open(pkg.url)
@bindings.add(Keys.Any)
def other(event: Any):
# Disallow inserting other text
pass
layout = create_inquirer_layout(ic, get_prompt_tokens, **prompt_kwargs)
app = Application(layout=layout, key_bindings=bindings, style=qstyle, **prompt_kwargs)
return Question(app)