Create the `Buffer` for the Python input.
(self)
| 937 | ) |
| 938 | |
| 939 | def _create_buffer(self) -> Buffer: |
| 940 | """ |
| 941 | Create the `Buffer` for the Python input. |
| 942 | """ |
| 943 | python_buffer = Buffer( |
| 944 | name=DEFAULT_BUFFER, |
| 945 | complete_while_typing=Condition(lambda: self.complete_while_typing), |
| 946 | enable_history_search=Condition(lambda: self.enable_history_search), |
| 947 | tempfile_suffix=".py", |
| 948 | history=self.history, |
| 949 | completer=ThreadedCompleter(self._completer), |
| 950 | validator=ConditionalValidator( |
| 951 | self._validator, Condition(lambda: self.enable_input_validation) |
| 952 | ), |
| 953 | auto_suggest=ConditionalAutoSuggest( |
| 954 | ThreadedAutoSuggest(AutoSuggestFromHistory()), |
| 955 | Condition(lambda: self.enable_auto_suggest), |
| 956 | ), |
| 957 | accept_handler=self._accept_handler, |
| 958 | on_text_changed=self._on_input_timeout, |
| 959 | ) |
| 960 | |
| 961 | return python_buffer |
| 962 | |
| 963 | @property |
| 964 | def editing_mode(self) -> EditingMode: |