aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/prompt-toolkit/py3/prompt_toolkit/eventloop
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2023-12-11 10:59:41 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2023-12-11 11:40:57 +0300
commit708e84a1342eccd8b69c761dd2916e33503a883a (patch)
treeee90cd4ab26e843c00724b957ef247cc3d1b6f9f /contrib/python/prompt-toolkit/py3/prompt_toolkit/eventloop
parent425d65a76c5bda62894f93d32f1f5e32f7439539 (diff)
downloadydb-708e84a1342eccd8b69c761dd2916e33503a883a.tar.gz
Update contrib/python/prompt-toolkit/py3 to 3.0.41
Diffstat (limited to 'contrib/python/prompt-toolkit/py3/prompt_toolkit/eventloop')
-rw-r--r--contrib/python/prompt-toolkit/py3/prompt_toolkit/eventloop/__init__.py2
-rw-r--r--contrib/python/prompt-toolkit/py3/prompt_toolkit/eventloop/inputhook.py33
2 files changed, 22 insertions, 13 deletions
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/eventloop/__init__.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/eventloop/__init__.py
index 89eb71c318..5df623bff1 100644
--- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/eventloop/__init__.py
+++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/eventloop/__init__.py
@@ -2,6 +2,7 @@ from __future__ import annotations
from .async_generator import aclosing, generator_to_async_generator
from .inputhook import (
+ InputHook,
InputHookContext,
InputHookSelector,
new_eventloop_with_inputhook,
@@ -22,6 +23,7 @@ __all__ = [
"call_soon_threadsafe",
"get_traceback_from_context",
# Inputhooks.
+ "InputHook",
"new_eventloop_with_inputhook",
"set_eventloop_with_inputhook",
"InputHookSelector",
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/eventloop/inputhook.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/eventloop/inputhook.py
index 8d6f6a4ffe..5731573f52 100644
--- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/eventloop/inputhook.py
+++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/eventloop/inputhook.py
@@ -39,14 +39,32 @@ __all__ = [
"set_eventloop_with_inputhook",
"InputHookSelector",
"InputHookContext",
+ "InputHook",
]
if TYPE_CHECKING:
from _typeshed import FileDescriptorLike
+ from typing_extensions import TypeAlias
_EventMask = int
+class InputHookContext:
+ """
+ Given as a parameter to the inputhook.
+ """
+
+ def __init__(self, fileno: int, input_is_ready: Callable[[], bool]) -> None:
+ self._fileno = fileno
+ self.input_is_ready = input_is_ready
+
+ def fileno(self) -> int:
+ return self._fileno
+
+
+InputHook: TypeAlias = Callable[[InputHookContext], None]
+
+
def new_eventloop_with_inputhook(
inputhook: Callable[[InputHookContext], None]
) -> AbstractEventLoop:
@@ -64,6 +82,8 @@ def set_eventloop_with_inputhook(
"""
Create a new event loop with the given inputhook, and activate it.
"""
+ # Deprecated!
+
loop = new_eventloop_with_inputhook(inputhook)
asyncio.set_event_loop(loop)
return loop
@@ -168,16 +188,3 @@ class InputHookSelector(BaseSelector):
def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]:
return self.selector.get_map()
-
-
-class InputHookContext:
- """
- Given as a parameter to the inputhook.
- """
-
- def __init__(self, fileno: int, input_is_ready: Callable[[], bool]) -> None:
- self._fileno = fileno
- self.input_is_ready = input_is_ready
-
- def fileno(self) -> int:
- return self._fileno