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

18 statements  

« prev     ^ index     » next       coverage.py v7.2.2, created at 2023-03-26 06:07 +0000

1from __future__ import annotations 

2 

3from typing import Callable, Optional 

4 

5from prompt_toolkit.formatted_text import AnyFormattedText 

6from prompt_toolkit.input import DummyInput 

7from prompt_toolkit.output import DummyOutput 

8 

9from .application import Application 

10 

11__all__ = [ 

12 "DummyApplication", 

13] 

14 

15 

16class DummyApplication(Application[None]): 

17 """ 

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

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

20 """ 

21 

22 def __init__(self) -> None: 

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

24 

25 def run( 

26 self, 

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

28 set_exception_handler: bool = True, 

29 handle_sigint: bool = True, 

30 in_thread: bool = False, 

31 ) -> None: 

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

33 

34 async def run_async( 

35 self, 

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

37 set_exception_handler: bool = True, 

38 handle_sigint: bool = True, 

39 slow_callback_duration: float = 0.5, 

40 ) -> None: 

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

42 

43 async def run_system_command( 

44 self, 

45 command: str, 

46 wait_for_enter: bool = True, 

47 display_before_text: AnyFormattedText = "", 

48 wait_text: str = "", 

49 ) -> None: 

50 raise NotImplementedError 

51 

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

53 raise NotImplementedError