Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Override prompt style.
self.python_input.all_prompt_styles['pdb'] = PdbPromptStyle(self._get_current_pdb_commands())
self.python_input.prompt_style = 'pdb'
# Override exit message.
self.python_input.exit_message = 'Do you want to quit BDB? This raises BdbQuit.'
# Set UI styles.
self.python_input.ui_styles = {
'ptpdb': get_ui_style(),
}
self.python_input.use_ui_colorscheme('ptpdb')
# Set autocompletion style. (Multi-column works nicer.)
self.python_input.completion_visualisation = CompletionVisualisation.MULTI_COLUMN
# Load additional key bindings.
load_custom_pdb_key_bindings(self, self.python_input.key_bindings_registry)
self.cli = CommandLineInterface(
eventloop=create_eventloop(),
application=self.python_input.create_application())
return Condition(lambda: python_input.completion_visualisation == CompletionVisualisation.MULTI_COLUMN)
get_values=lambda: {
CompletionVisualisation.NONE: lambda: enable('completion_visualisation', CompletionVisualisation.NONE),
CompletionVisualisation.POP_UP: lambda: enable('completion_visualisation', CompletionVisualisation.POP_UP),
CompletionVisualisation.MULTI_COLUMN: lambda: enable('completion_visualisation', CompletionVisualisation.MULTI_COLUMN),
CompletionVisualisation.TOOLBAR: lambda: enable('completion_visualisation', CompletionVisualisation.TOOLBAR),
}),
self.history = ThreadedHistory(FileHistory(history_filename))
else:
self.history = InMemoryHistory()
self._input_buffer_height = _input_buffer_height
self._extra_layout_body = _extra_layout_body or []
self._extra_toolbars = _extra_toolbars or []
self._extra_buffer_processors = _extra_buffer_processors or []
self.extra_key_bindings = extra_key_bindings or KeyBindings()
# Settings.
self.show_signature = False
self.show_docstring = False
self.show_meta_enter_message = True
self.completion_visualisation = CompletionVisualisation.MULTI_COLUMN
self.completion_menu_scroll_offset = 1
self.show_line_numbers = False
self.show_status_bar = True
self.wrap_lines = True
self.complete_while_typing = True
self.paste_mode = False # When True, don't insert whitespace after newline.
self.confirm_exit = True # Ask for confirmation when Control-D is pressed.
self.accept_input_on_enter = 2 # Accept when pressing Enter 'n' times.
# 'None' means that meta-enter is always required.
self.enable_open_in_editor = True
self.enable_system_bindings = True
self.enable_input_validation = True
self.enable_auto_suggest = False
self.enable_mouse_support = False
self.enable_history_search = False # When True, like readline, going
def configure(repl):
"""
Configuration method. This is called during the start-up of ptpython.
:param repl: `PythonRepl` instance.
"""
# Show function signature (bool).
repl.show_signature = True
# Show docstring (bool).
repl.show_docstring = True
# inserts a newline instead of executing the code.
repl.show_meta_enter_message = True
# Show completions. (NONE, POP_UP, MULTI_COLUMN or TOOLBAR)
repl.completion_visualisation = CompletionVisualisation.MULTI_COLUMN
# When CompletionVisualisation.POP_UP has been chosen, use this
# scroll_offset in the completion menu.
repl.completion_menu_scroll_offset = 0
# Show line numbers (when the input contains multiple lines.)
repl.show_line_numbers = False
# Show status bar.
repl.show_status_bar = True
# When the sidebar is visible, also show the help text.
repl.show_sidebar_help = True
# Highlight matching parethesis.
repl.highlight_matching_parenthesis = True
# Line wrapping. (Instead of horizontal scrolling.)
repl.wrap_lines = True
# Mouse support.
repl.enable_mouse_support = False