Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _(event):
app = get_radian_app()
app.session.change_mode("shell")
def commit_text(event, text, add_history=True):
app = get_radian_app()
app.session.add_history = add_history
buf = event.current_buffer
buf.text = text
buf.validate_and_handle()
def prompt_mode(mode):
try:
return _prompt_mode_cache[mode]
except KeyError:
pass
app = get_radian_app()
condition = Condition(lambda: app.session.current_mode_name == mode)
_prompt_mode_cache[mode] = condition
return condition
def map_key(key, value, mode="r", filter_str=""):
app = get_radian_app()
kb = app.session.modes[mode].prompt_key_bindings
@kb.add(*key, filter=insert_mode & default_focused, eager=True)
def _(event):
event.current_buffer.insert_text(value)
def configure():
set_hook(package_event("reticulate", "onLoad"), reticulate_config_hook)
if package_is_installed("reticulate") and roption("radian.enable_reticulate_prompt", True):
set_hook(package_event("reticulate", "onLoad"), reticulate_prompt_hook)
session = get_app().session
kb = session.modes["r"].prompt_key_bindings
browsekb = session.modes["browse"].prompt_key_bindings
@kb.add('~', filter=insert_mode & default_focused & cursor_at_begin & text_is_empty)
@browsekb.add('~', filter=insert_mode & default_focused & cursor_at_begin & text_is_empty)
def _(event):
commit_text(event, "reticulate::repl_python()", False)
def _(event):
app = get_radian_app()
app.session.change_mode("r")