def edit_input_history(): with tempfile.NamedTemporaryFile() as f: input = bpython.running.stdin f.write(input.encode(getpreferredencoding())) f.flush() editor_invocation = invoke_editor(f.name, 0, False).split() invoke_command(editor_invocation)
def edit_history(): with tempfile.NamedTemporaryFile() as f: entries = bpython.running.clirepl.history.entries output = pprint.pformat(entries) f.write(output.encode(getpreferredencoding())) f.flush() editor_invocation = invoke_editor(f.name, 0, False).split() invoke_command(editor_invocation)
def edit_object(obj): file_name = inspect.getsourcefile(obj) line_number = (inspect.findsource(obj)[-1] + 1) reloading = False editor_invocation = invoke_editor(file_name, line_number, reloading).split() invoke_command(editor_invocation)