Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/prompt_toolkit/application/dummy.py: 74%

19 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-04-20 06:09 +0000

1from __future__ import annotations 

2 

3from typing import Callable 

4 

5from prompt_toolkit.eventloop import InputHook 

6from prompt_toolkit.formatted_text import AnyFormattedText 

7from prompt_toolkit.input import DummyInput 

8from prompt_toolkit.output import DummyOutput 

9 

10from .application import Application 

11 

12__all__ = [ 

13 "DummyApplication", 

14] 

15 

16 

17class DummyApplication(Application[None]): 

18 """ 

19 When no :class:`.Application` is running, 

20 :func:`.get_app` will run an instance of this :class:`.DummyApplication` instead. 

21 """ 

22 

23 def __init__(self) -> None: 

24 super().__init__(output=DummyOutput(), input=DummyInput()) 

25 

26 def run( 

27 self, 

28 pre_run: Callable[[], None] | None = None, 

29 set_exception_handler: bool = True, 

30 handle_sigint: bool = True, 

31 in_thread: bool = False, 

32 inputhook: InputHook | None = None, 

33 ) -> None: 

34 raise NotImplementedError("A DummyApplication is not supposed to run.") 

35 

36 async def run_async( 

37 self, 

38 pre_run: Callable[[], None] | None = None, 

39 set_exception_handler: bool = True, 

40 handle_sigint: bool = True, 

41 slow_callback_duration: float = 0.5, 

42 ) -> None: 

43 raise NotImplementedError("A DummyApplication is not supposed to run.") 

44 

45 async def run_system_command( 

46 self, 

47 command: str, 

48 wait_for_enter: bool = True, 

49 display_before_text: AnyFormattedText = "", 

50 wait_text: str = "", 

51 ) -> None: 

52 raise NotImplementedError 

53 

54 def suspend_to_background(self, suspend_group: bool = True) -> None: 

55 raise NotImplementedError