(
self,
get_globals: _GetNamespace | None = None,
get_locals: _GetNamespace | None = None,
history_filename: str | None = None,
vi_mode: bool = False,
color_depth: ColorDepth | None = None,
# Input/output.
input: Input | None = None,
output: Output | None = None,
# For internal use.
extra_key_bindings: KeyBindings | None = None,
create_app: bool = True,
_completer: Completer | None = None,
_validator: Validator | None = None,
_lexer: Lexer | None = None,
_extra_buffer_processors: list[Processor] | None = None,
_extra_layout_body: AnyContainer | None = None,
_extra_toolbars: list[AnyContainer] | None = None,
_input_buffer_height: AnyDimension | None = None,
)
| 199 | """ |
| 200 | |
| 201 | def __init__( |
| 202 | self, |
| 203 | get_globals: _GetNamespace | None = None, |
| 204 | get_locals: _GetNamespace | None = None, |
| 205 | history_filename: str | None = None, |
| 206 | vi_mode: bool = False, |
| 207 | color_depth: ColorDepth | None = None, |
| 208 | # Input/output. |
| 209 | input: Input | None = None, |
| 210 | output: Output | None = None, |
| 211 | # For internal use. |
| 212 | extra_key_bindings: KeyBindings | None = None, |
| 213 | create_app: bool = True, |
| 214 | _completer: Completer | None = None, |
| 215 | _validator: Validator | None = None, |
| 216 | _lexer: Lexer | None = None, |
| 217 | _extra_buffer_processors: list[Processor] | None = None, |
| 218 | _extra_layout_body: AnyContainer | None = None, |
| 219 | _extra_toolbars: list[AnyContainer] | None = None, |
| 220 | _input_buffer_height: AnyDimension | None = None, |
| 221 | ) -> None: |
| 222 | self.get_globals: _GetNamespace = get_globals or (lambda: {}) |
| 223 | self.get_locals: _GetNamespace = get_locals or self.get_globals |
| 224 | |
| 225 | self.completer = _completer or PythonCompleter( |
| 226 | self.get_globals, |
| 227 | self.get_locals, |
| 228 | lambda: self.enable_dictionary_completion, |
| 229 | ) |
| 230 | |
| 231 | self._completer = HidePrivateCompleter( |
| 232 | # If fuzzy is enabled, first do fuzzy completion, but always add |
| 233 | # the non-fuzzy completions, if somehow the fuzzy completer didn't |
| 234 | # find them. (Due to the way the cursor position is moved in the |
| 235 | # fuzzy completer, some completions will not always be found by the |
| 236 | # fuzzy completer, but will be found with the normal completer.) |
| 237 | merge_completers( |
| 238 | [ |
| 239 | ConditionalCompleter( |
| 240 | FuzzyCompleter(DynamicCompleter(lambda: self.completer)), |
| 241 | Condition(lambda: self.enable_fuzzy_completion), |
| 242 | ), |
| 243 | DynamicCompleter(lambda: self.completer), |
| 244 | ], |
| 245 | deduplicate=True, |
| 246 | ), |
| 247 | lambda: self.complete_private_attributes, |
| 248 | ) |
| 249 | self._validator = _validator or PythonValidator(self.get_compiler_flags) |
| 250 | self._lexer = PtpythonLexer(_lexer) |
| 251 | |
| 252 | self.history: History |
| 253 | if history_filename: |
| 254 | self.history = ThreadedHistory(FileHistory(history_filename)) |
| 255 | else: |
| 256 | self.history = InMemoryHistory() |
| 257 | |
| 258 | self._input_buffer_height = _input_buffer_height |
nothing calls this directly
no test coverage detected