id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
172,067 | from __future__ import annotations
from prompt_toolkit.filters import emacs_mode, has_selection, vi_navigation_mode
from ..key_bindings import KeyBindings, KeyBindingsBase, merge_key_bindings
from .named_commands import get_by_name
def load_emacs_open_in_editor_bindings() -> KeyBindings:
"""
Pressing C-X C-E wi... | Load both the Vi and emacs key bindings for handling edit-and-execute-command. |
172,068 | from __future__ import annotations
from prompt_toolkit.filters import buffer_has_focus, emacs_mode, vi_mode
from prompt_toolkit.key_binding.key_bindings import (
ConditionalKeyBindings,
KeyBindings,
KeyBindingsBase,
merge_key_bindings,
)
from .scroll import (
scroll_backward,
scroll_forward,
... | Load both the Vi and Emacs bindings for page navigation. |
172,069 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Store handler in the `_readline_commands` dictionary. |
172,070 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Move to the start of the buffer. |
172,071 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Move to the end of the buffer. |
172,072 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Move to the start of the current line. |
172,073 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Move back to the start of the current or previous word. Words are composed of letters and digits. |
172,074 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Clear the screen and redraw everything at the top of the screen. |
172,075 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Refresh the current line. (Readline defines this command, but prompt-toolkit doesn't have it.) |
172,076 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Accept the line regardless of where the cursor is. |
172,077 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Move `back` through the history list, fetching the previous command. |
172,078 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Move `forward` through the history list, fetching the next command. |
172,079 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Move to the first line in the history. |
172,080 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Move to the end of the input history, i.e., the line currently being entered. |
172,081 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Search backward starting at the current line and moving `up` through the history as necessary. This is an incremental search. |
172,082 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Exit. |
172,083 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Delete character before the cursor. |
172,084 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Insert yourself. |
172,085 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Emulate Emacs transpose-char behavior: at the beginning of the buffer, do nothing. At the end of a line or buffer, swap the characters before the cursor. Otherwise, move the cursor right, and then swap the characters before the cursor. |
172,086 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Uppercase the current (or following) word. |
172,087 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Lowercase the current (or following) word. |
172,088 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Capitalize the current (or following) word. |
172,089 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Kill the text from the cursor to the end of the line. If we are at the end of the line, this should remove the newline. (That way, it is possible to delete multiple lines by executing this command multiple times.) |
172,090 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Kill from point to the end of the current word, or if between words, to the end of the next word. Word boundaries are the same as forward-word. |
172,091 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Kills the word before point, using "not a letter nor a digit" as a word boundary. Usually bound to M-Del or M-Backspace. |
172,092 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Delete all spaces and tabs around point. |
172,093 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Kill backward from the cursor to the beginning of the current line. |
172,094 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Paste before cursor. |
172,095 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Insert the first argument of the previous command. With an argument, insert the nth word from the previous command (start counting at 0). |
172,096 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Like `yank_nth_arg`, but if no argument has been given, yank the last word of each line. |
172,097 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Rotate the kill ring, and yank the new top. Only works following yank or yank-pop. |
172,098 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Attempt to perform completion. |
172,099 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Generate completions, or go to the next completion. (This is the default way of completing input in prompt_toolkit.) |
172,100 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Move backward through the list of possible completions. |
172,101 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Begin saving the characters typed into the current keyboard macro. |
172,102 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Stop saving the characters typed into the current keyboard macro and save the definition. |
172,103 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Re-execute the last keyboard macro defined, by making the characters in the macro appear as if typed at the keyboard. Notice that we pass `record_in_macro=False`. This ensures that the 'c-x e' key sequence doesn't appear in the recording itself. This function inserts the body of the called macro back into the KeyProces... |
172,104 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Print the last keyboard macro. |
172,105 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Without numeric argument, comment all lines. With numeric argument, uncomment all lines. In any case accept the input. |
172,106 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Switch to Vi editing mode. |
172,107 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Switch to Emacs editing mode. |
172,108 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Metafy the next character typed. This is for keyboards without a meta key. Sometimes people also want to bind other keys to Meta, e.g. 'jj':: key_bindings.add_key_binding('j', 'j', filter=ViInsertMode())(prefix_meta) |
172,109 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Accept the current line for execution and fetch the next line relative to the current line from the history for editing. |
172,110 | from __future__ import annotations
from typing import Callable, Dict, TypeVar, Union, cast
from prompt_toolkit.document import Document
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
from prompt_toolkit.key_binding.key_processor import KeyPress, Key... | Invoke an editor on the current command line, and accept the result. |
172,111 | from __future__ import annotations
from prompt_toolkit import search
from prompt_toolkit.application.current import get_app
from prompt_toolkit.filters import Condition, control_is_searchable, is_searching
from prompt_toolkit.key_binding.key_processor import KeyPressEvent
from ..key_bindings import key_binding
def get... | True if the previously focused buffer has a return handler. |
172,112 | from __future__ import annotations
from prompt_toolkit import search
from prompt_toolkit.application.current import get_app
from prompt_toolkit.filters import Condition, control_is_searchable, is_searching
from prompt_toolkit.key_binding.key_processor import KeyPressEvent
from ..key_bindings import key_binding
E = KeyP... | Accept the search operation first, then accept the input. |
172,113 | from __future__ import annotations
import codecs
import string
from enum import Enum
from itertools import accumulate
from typing import Callable, Iterable, List, Optional, Tuple, TypeVar, Union
from prompt_toolkit.application.current import get_app
from prompt_toolkit.buffer import Buffer, indent, reshape_text, uninde... | Vi extensions. # Overview of Readline Vi commands: # http://www.catonmat.net/download/bash-vi-editing-mode-cheat-sheet.pdf |
172,114 | from __future__ import annotations
import codecs
import string
from enum import Enum
from itertools import accumulate
from typing import Callable, Iterable, List, Optional, Tuple, TypeVar, Union
from prompt_toolkit.application.current import get_app
from prompt_toolkit.buffer import Buffer, indent, reshape_text, uninde... | null |
172,115 | from __future__ import annotations
import re
from prompt_toolkit.application.current import get_app
from prompt_toolkit.filters import Condition, emacs_mode
from prompt_toolkit.key_binding.key_bindings import KeyBindings
from prompt_toolkit.key_binding.key_processor import KeyPressEvent
E = KeyPressEvent
def get_app()... | Key bindings for accepting auto suggestion text. (This has to come after the Vi bindings, because they also have an implementation for the "right arrow", but we really want the suggestion binding when a suggestion is available.) |
172,116 | from __future__ import annotations
from abc import ABCMeta, abstractmethod, abstractproperty
from inspect import isawaitable
from typing import (
TYPE_CHECKING,
Awaitable,
Callable,
Hashable,
List,
Optional,
Sequence,
Tuple,
TypeVar,
Union,
cast,
)
from prompt_toolkit.cache i... | Replace key by alias and verify whether it's a valid one. |
172,117 | from __future__ import annotations
import sys
from contextlib import contextmanager
from contextvars import ContextVar
from typing import TYPE_CHECKING, Any, Generator, Optional
_current_app_session: ContextVar[AppSession] = ContextVar(
"_current_app_session", default=AppSession()
)
Any = object()
... | Context manager that sets the given :class:`.Application` active in an `AppSession`. This should only be called by the `Application` itself. The application will automatically be active while its running. If you want the application to be active in other threads/coroutines, where that's not the case, use `contextvars.c... |
172,118 | from __future__ import annotations
import sys
from contextlib import contextmanager
from contextvars import ContextVar
from typing import TYPE_CHECKING, Any, Generator, Optional
class AppSession:
"""
An AppSession is an interactive session, usually connected to one terminal.
Within one such session, interac... | Create `AppSession` that always prefers the TTY input/output. Even if `sys.stdin` and `sys.stdout` are connected to input/output pipes, this will still use the terminal for interaction (because `sys.stderr` is still connected to the terminal). Usage:: from prompt_toolkit.shortcuts import prompt with create_app_session_... |
172,119 | from __future__ import annotations
import asyncio
import contextvars
import os
import re
import signal
import sys
import threading
import time
from asyncio import (
AbstractEventLoop,
Future,
Task,
ensure_future,
get_running_loop,
sleep,
)
from contextlib import ExitStack, contextmanager
from su... | Create a sub application to wait for the enter key press. This has two advantages over using 'input'/'raw_input': - This will share the same input/output I/O. - This doesn't block the event loop. |
172,120 | from __future__ import annotations
import asyncio
import contextvars
import os
import re
import signal
import sys
import threading
import time
from asyncio import (
AbstractEventLoop,
Future,
Task,
ensure_future,
get_running_loop,
sleep,
)
from contextlib import ExitStack, contextmanager
from su... | Attach the given callback as a WINCH signal handler within the context manager. Restore the original signal handler when done. The `Application.run` method will register SIGWINCH, so that it will properly repaint when the terminal window resizes. However, using `run_in_terminal`, we can temporarily send an application ... |
172,121 | from __future__ import annotations
from string import Formatter
from typing import Generator, List, Optional
from prompt_toolkit.output.vt100 import BG_ANSI_COLORS, FG_ANSI_COLORS
from prompt_toolkit.output.vt100 import _256_colors as _256_colors_table
from .base import StyleAndTextTuples
The provided code snippet inc... | Replace characters with a special meaning. |
172,122 | from __future__ import annotations
import xml.dom.minidom as minidom
from string import Formatter
from typing import Any, List
from .base import FormattedText, StyleAndTextTuples
def html_escape(text: object) -> str:
# The string interpolation functions also take integers and other types.
# Convert to string f... | null |
172,123 | from __future__ import annotations
from typing import Iterable, cast
from prompt_toolkit.utils import get_cwidth
from .base import (
AnyFormattedText,
OneStyleAndTextTuple,
StyleAndTextTuples,
to_formatted_text,
)
def fragment_list_to_text(fragments: StyleAndTextTuples) -> str:
"""
Concatenate a... | Turn any kind of formatted text back into plain text. |
172,124 | from __future__ import annotations
from typing import Iterable, cast
from prompt_toolkit.utils import get_cwidth
from .base import (
AnyFormattedText,
OneStyleAndTextTuple,
StyleAndTextTuples,
to_formatted_text,
)
StyleAndTextTuples = List[OneStyleAndTextTuple]
The provided code snippet includes neces... | Return the amount of characters in this text fragment list. :param fragments: List of ``(style_str, text)`` or ``(style_str, text, mouse_handler)`` tuples. |
172,125 | from __future__ import annotations
from typing import Iterable, cast
from prompt_toolkit.utils import get_cwidth
from .base import (
AnyFormattedText,
OneStyleAndTextTuple,
StyleAndTextTuples,
to_formatted_text,
)
def get_cwidth(string: str) -> int:
"""
Return width of a string. Wrapper around ... | Return the character width of this text fragment list. (Take double width characters into account.) :param fragments: List of ``(style_str, text)`` or ``(style_str, text, mouse_handler)`` tuples. |
172,126 | from __future__ import annotations
from typing import Iterable, cast
from prompt_toolkit.utils import get_cwidth
from .base import (
AnyFormattedText,
OneStyleAndTextTuple,
StyleAndTextTuples,
to_formatted_text,
)
class Iterable(Protocol[_T_co]):
def __iter__(self) -> Iterator[_T_co]: ...
... | Take a single list of (style_str, text) tuples and yield one such list for each line. Just like str.split, this will yield at least one item. :param fragments: List of (style_str, text) or (style_str, text, mouse_handler) tuples. |
172,127 | from __future__ import annotations
from typing import TYPE_CHECKING, Any, Callable, Iterable, List, Tuple, Union, cast
from prompt_toolkit.mouse_events import MouseEvent
AnyFormattedText = Union[
str,
"MagicFormattedText",
StyleAndTextTuples,
# Callable[[], 'AnyFormattedText'] # Recursive definition no... | Check whether the input is valid formatted text (for use in assert statements). In case of a callable, it doesn't check the return type. |
172,128 | from __future__ import annotations
from typing import TYPE_CHECKING, Any, Callable, Iterable, List, Tuple, Union, cast
from prompt_toolkit.mouse_events import MouseEvent
AnyFormattedText = Union[
str,
"MagicFormattedText",
StyleAndTextTuples,
# Callable[[], 'AnyFormattedText'] # Recursive definition no... | Merge (Concatenate) several pieces of formatted text together. |
172,129 | from __future__ import annotations
from abc import ABC, abstractmethod
from enum import Enum
from typing import TYPE_CHECKING, Any, Callable, Union
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.vi_state import InputMode
class CursorShape(Enum):
# Default value that should tell the out... | Take a `CursorShape` instance or `CursorShapeConfig` and turn it into a `CursorShapeConfig`. |
172,130 | from __future__ import annotations
from abc import ABCMeta, abstractmethod
from typing import AsyncGenerator, Callable, Iterable, Optional, Sequence
from prompt_toolkit.document import Document
from prompt_toolkit.eventloop import aclosing, generator_to_async_generator
from prompt_toolkit.filters import FilterOrBool, t... | Combine several completers into one. :param deduplicate: If `True`, wrap the result in a `DeduplicateCompleter` so that completions that would result in the same text will be deduplicated. |
172,131 | from __future__ import annotations
from abc import ABCMeta, abstractmethod
from typing import AsyncGenerator, Callable, Iterable, Optional, Sequence
from prompt_toolkit.document import Document
from prompt_toolkit.eventloop import aclosing, generator_to_async_generator
from prompt_toolkit.filters import FilterOrBool, t... | Return the common prefix for all completions. |
172,132 | from __future__ import annotations
import os
import sys
from abc import abstractmethod
from asyncio import get_running_loop
from contextlib import contextmanager
from ..utils import SPHINX_AUTODOC_RUNNING
from ctypes import Array, pointer
from ctypes.wintypes import DWORD, HANDLE
from typing import (
Callable,
... | Context manager that makes this input active in the current event loop. :param input: :class:`~prompt_toolkit.input.Input` object. :param input_ready_callback: Called when the input is ready to read. |
172,133 | from __future__ import annotations
import os
import sys
from abc import abstractmethod
from asyncio import get_running_loop
from contextlib import contextmanager
from ..utils import SPHINX_AUTODOC_RUNNING
from ctypes import Array, pointer
from ctypes.wintypes import DWORD, HANDLE
from typing import (
Callable,
... | null |
172,134 | from __future__ import annotations
from typing import Dict, Tuple, Union
from ..keys import Keys
ANSI_SEQUENCES: dict[str, Keys | tuple[Keys, ...]] = {
# Control keys.
"\x00": Keys.ControlAt, # Control-At (Also for Ctrl-Space)
"\x01": Keys.ControlA, # Control-A (home)
"\x02": Keys.ControlB, # Control... | Create a dictionary that maps prompt_toolkit keys back to the VT100 escape sequences. |
172,135 | from __future__ import annotations
import sys
import contextlib
import io
import termios
import tty
from asyncio import AbstractEventLoop, get_running_loop
from typing import (
Callable,
ContextManager,
Dict,
Generator,
List,
Optional,
Set,
TextIO,
Tuple,
Union,
)
from ..key_bind... | Context manager that makes this input active in the current event loop. :param input: :class:`~prompt_toolkit.input.Input` object. :param callback: Called when the input is ready to read. |
172,136 | from __future__ import annotations
import sys
import contextlib
import io
import termios
import tty
from asyncio import AbstractEventLoop, get_running_loop
from typing import (
Callable,
ContextManager,
Dict,
Generator,
List,
Optional,
Set,
TextIO,
Tuple,
Union,
)
from ..key_bind... | null |
172,137 | from __future__ import annotations
import io
import sys
from typing import ContextManager, Optional, TextIO
from .base import DummyInput, Input, PipeInput
class ContextManager(Protocol[_T_co]):
def __enter__(self) -> _T_co: ...
def __exit__(
self,
__exc_type: Optional[Type[BaseException]],
... | Create an input pipe. This is mostly useful for unit testing. Usage:: with create_pipe_input() as input: input.send_text('inputdata') Breaking change: In prompt_toolkit 3.0.28 and earlier, this was returning the `PipeInput` directly, rather than through a context manager. |
172,138 | from __future__ import annotations
from abc import ABCMeta, abstractmethod, abstractproperty
from contextlib import contextmanager
from typing import Callable, ContextManager, Generator, List
from prompt_toolkit.key_binding import KeyPress
class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]):
def __n... | null |
172,139 | from __future__ import annotations
from collections import defaultdict
from typing import Dict, List
from ..key_binding import KeyPress
from .base import Input
_buffer: dict[str, list[KeyPress]] = defaultdict(list)
class Input(metaclass=ABCMeta):
"""
Abstraction for any input.
An instance of this class ca... | Insert typeahead key presses for the given input. |
172,140 | from __future__ import annotations
from collections import defaultdict
from typing import Dict, List
from ..key_binding import KeyPress
from .base import Input
_buffer: dict[str, list[KeyPress]] = defaultdict(list)
class Input(metaclass=ABCMeta):
"""
Abstraction for any input.
An instance of this class ca... | Retrieve typeahead and reset the buffer for this input. |
172,141 | from __future__ import annotations
from collections import defaultdict
from typing import Dict, List
from ..key_binding import KeyPress
from .base import Input
_buffer: dict[str, list[KeyPress]] = defaultdict(list)
class Input(metaclass=ABCMeta):
"""
Abstraction for any input.
An instance of this class ca... | Clear typeahead buffer. |
172,142 | from __future__ import annotations
from typing import Dict
from .base import Always, Filter, FilterOrBool, Never
def to_filter(bool_or_filter: FilterOrBool) -> Filter:
"""
Accept both booleans and Filters as input and
turn it into a Filter.
"""
if isinstance(bool_or_filter, bool):
return _bo... | Test whether `value` is True. In case of a Filter, call it. :param value: Boolean or `Filter` instance. |
172,143 | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.cache import memoized
from prompt_toolkit.enums import EditingMode
from .base import Condition
def cast(typ: Type[_T], val: Any) -> _T: ...
def cast(typ: str, val: Any) -... | Enable when this buffer has the focus. |
172,144 | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.cache import memoized
from prompt_toolkit.enums import EditingMode
from .base import Condition
def get_app() -> Application[Any]:
"""
Get the current active (runn... | Enabled when the currently focused control is a `BufferControl`. |
172,145 | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.cache import memoized
from prompt_toolkit.enums import EditingMode
from .base import Condition
def get_app() -> Application[Any]:
"""
Get the current active (runn... | Enable when the current buffer has a selection. |
172,146 | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.cache import memoized
from prompt_toolkit.enums import EditingMode
from .base import Condition
def get_app() -> Application[Any]:
"""
Get the current active (runn... | Enable when the current buffer has a suggestion. |
172,147 | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.cache import memoized
from prompt_toolkit.enums import EditingMode
from .base import Condition
def get_app() -> Application[Any]:
"""
Get the current active (runn... | Enable when the current buffer has completions. |
172,148 | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.cache import memoized
from prompt_toolkit.enums import EditingMode
from .base import Condition
def get_app() -> Application[Any]:
"""
Get the current active (runn... | True when the user selected a completion. |
172,149 | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.cache import memoized
from prompt_toolkit.enums import EditingMode
from .base import Condition
def get_app() -> Application[Any]:
"""
Get the current active (runn... | Current buffer has validation error. |
172,150 | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.cache import memoized
from prompt_toolkit.enums import EditingMode
from .base import Condition
def get_app() -> Application[Any]:
"""
Get the current active (runn... | True when the CLI is returning, aborting or exiting. |
172,151 | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.cache import memoized
from prompt_toolkit.enums import EditingMode
from .base import Condition
def get_app() -> Application[Any]:
"""
Get the current active (runn... | Only True when the renderer knows it's real height. (On VT100 terminals, we have to wait for a CPR response, before we can be sure of the available height between the cursor position and the bottom of the terminal. And usually it's nicer to wait with drawing bottom toolbars until we receive the height, in order to avoi... |
172,152 | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.cache import memoized
from prompt_toolkit.enums import EditingMode
from .base import Condition
def get_app() -> Application[Any]:
"""
Get the current active (runn... | Check whether a given editing mode is active. (Vi or Emacs.) |
172,153 | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.cache import memoized
from prompt_toolkit.enums import EditingMode
from .base import Condition
def get_app() -> Application[Any]:
"""
Get the current active (runn... | When the Emacs bindings are active. |
172,154 | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.cache import memoized
from prompt_toolkit.enums import EditingMode
from .base import Condition
def get_app() -> Application[Any]:
"""
Get the current active (runn... | null |
172,155 | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.cache import memoized
from prompt_toolkit.enums import EditingMode
from .base import Condition
def get_app() -> Application[Any]:
"""
Get the current active (runn... | null |
172,156 | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.cache import memoized
from prompt_toolkit.enums import EditingMode
from .base import Condition
def get_app() -> Application[Any]:
"""
Get the current active (runn... | null |
172,157 | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.cache import memoized
from prompt_toolkit.enums import EditingMode
from .base import Condition
def get_app() -> Application[Any]:
"""
Get the current active (runn... | When the current UIControl is searchable. |
172,158 | from __future__ import annotations
from abc import ABCMeta, abstractmethod
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union
class Filter(metaclass=ABCMeta):
"""
Base class for any filter to activate/deactivate a feature, depending on a
condition.
The return value of ``__call__``... | null |
172,159 | from __future__ import annotations
from typing import TYPE_CHECKING, Dict, Type
from .style import Style
def style_from_pygments_dict(pygments_dict: dict[Token, str]) -> Style:
"""
Create a :class:`.Style` instance from a Pygments style dictionary.
(One that maps Token objects to style strings.)
"""
... | Shortcut to create a :class:`.Style` instance from a Pygments style class and a style dictionary. Example:: from prompt_toolkit.styles.from_pygments import style_from_pygments_cls from pygments.styles import get_style_by_name style = style_from_pygments_cls(get_style_by_name('monokai')) :param pygments_style_cls: Pygme... |
172,160 | from __future__ import annotations
import itertools
import re
from enum import Enum
from typing import Dict, Hashable, List, Set, Tuple, TypeVar
from prompt_toolkit.cache import SimpleCache
from .base import (
ANSI_COLOR_NAMES,
ANSI_COLOR_NAMES_ALIASES,
DEFAULT_ATTRS,
Attrs,
BaseStyle,
)
from .named... | Split a single class name at the `.` operator, and build a list of classes. E.g. 'a.b.c' becomes ['a', 'a.b', 'a.b.c'] |
172,161 | from __future__ import annotations
import itertools
import re
from enum import Enum
from typing import Dict, Hashable, List, Set, Tuple, TypeVar
from prompt_toolkit.cache import SimpleCache
from .base import (
ANSI_COLOR_NAMES,
ANSI_COLOR_NAMES_ALIASES,
DEFAULT_ATTRS,
Attrs,
BaseStyle,
)
from .named... | Take a style string, e.g. 'bg:red #88ff00 class:title' and return a `Attrs` instance. |
172,162 | from __future__ import annotations
import itertools
import re
from enum import Enum
from typing import Dict, Hashable, List, Set, Tuple, TypeVar
from prompt_toolkit.cache import SimpleCache
from .base import (
ANSI_COLOR_NAMES,
ANSI_COLOR_NAMES_ALIASES,
DEFAULT_ATTRS,
Attrs,
BaseStyle,
)
from .named... | Take a list of :class:`.Attrs` instances and merge them into one. Every `Attr` in the list can override the styling of the previous one. So, the last one has highest priority. |
172,163 | from __future__ import annotations
from prompt_toolkit.cache import memoized
from .base import ANSI_COLOR_NAMES, BaseStyle
from .named_colors import NAMED_COLORS
from .style import Style, merge_styles
PROMPT_TOOLKIT_STYLE = [
# Highlighting of search matches in document.
("search", "bg:ansibrightyellow ansiblac... | Create a default `Style` object. |
172,164 | from __future__ import annotations
from prompt_toolkit.cache import memoized
from .base import ANSI_COLOR_NAMES, BaseStyle
from .named_colors import NAMED_COLORS
from .style import Style, merge_styles
PYGMENTS_DEFAULT_STYLE = {
"pygments.whitespace": "#bbbbbb",
"pygments.comment": "italic #408080",
"pygment... | Create a `Style` object that contains the default Pygments style. |
172,165 | from __future__ import annotations
from abc import ABCMeta, abstractmethod
from colorsys import hls_to_rgb, rgb_to_hls
from typing import Callable, Hashable, Optional, Sequence, Tuple, Union
from prompt_toolkit.cache import memoized
from prompt_toolkit.filters import FilterOrBool, to_filter
from prompt_toolkit.utils im... | Merge multiple transformations together. |
172,166 | from __future__ import annotations
from abc import ABCMeta, abstractmethod
from colorsys import hls_to_rgb, rgb_to_hls
from typing import Callable, Hashable, Optional, Sequence, Tuple, Union
from prompt_toolkit.cache import memoized
from prompt_toolkit.filters import FilterOrBool, to_filter
from prompt_toolkit.utils im... | Take a color name in either 'ansi...' format or 6 digit RGB, return the color of opposite luminosity (same hue/saturation). This is used for turning color schemes that work on a light background usable on a dark background. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.