File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 22from .inputhook import (
33 InputHookContext ,
44 InputHookSelector ,
5+ new_eventloop_with_inputhook ,
56 set_eventloop_with_inputhook ,
67)
78from .utils import (
2021 'get_traceback_from_context' ,
2122
2223 # Inputhooks.
24+ 'new_eventloop_with_inputhook' ,
2325 'set_eventloop_with_inputhook' ,
2426 'InputHookSelector' ,
2527 'InputHookContext' ,
Original file line number Diff line number Diff line change 3434from prompt_toolkit .utils import is_windows
3535
3636__all__ = [
37+ 'new_eventloop_with_inputhook' ,
3738 'set_eventloop_with_inputhook' ,
3839 'InputHookSelector' ,
3940 'InputHookContext' ,
4041]
4142
4243
43- def set_eventloop_with_inputhook (
44+ def new_eventloop_with_inputhook (
4445 inputhook : Callable [['InputHookContext' ], None ]) -> AbstractEventLoop :
4546 """
46- Create a new event loop with the given inputhook, and activate it .
47+ Create a new event loop with the given inputhook.
4748 """
4849 selector = InputHookSelector (selectors .DefaultSelector (), inputhook )
4950 loop = asyncio .SelectorEventLoop (selector ) # type: ignore
51+ return loop
52+
53+
54+ def set_eventloop_with_inputhook (
55+ inputhook : Callable [['InputHookContext' ], None ]) -> AbstractEventLoop :
56+ """
57+ Create a new event loop with the given inputhook, and activate it.
58+ """
59+ loop = new_eventloop_with_inputhook (inputhook )
5060 asyncio .set_event_loop (loop )
5161 return loop
5262
You can’t perform that action at this time.
0 commit comments