Coverage for src/pyselector/interfaces.py: 88%

17 statements  

« prev     ^ index     » next       coverage.py v7.2.2, created at 2023-03-22 12:50 -0300

1# interface.py 

2 

3from typing import Iterable 

4from typing import Optional 

5from typing import Protocol 

6from typing import Union 

7 

8from pyselector.key_manager import KeyManager 

9 

10PromptReturn = tuple[Union[str, list[str]], int] 

11 

12 

13class ExecutableNotFoundError(Exception): 

14 pass 

15 

16 

17class MenuInterface(Protocol): 

18 name: str 

19 url: str 

20 keybind: KeyManager 

21 

22 @property 

23 def command(self) -> str: 

24 ... 

25 

26 def prompt( 

27 self, 

28 items: Optional[Iterable[Union[str, int]]] = None, 

29 case_sensitive: bool = None, 

30 multi_select: bool = False, 

31 prompt: str = "PySelector> ", 

32 **kwargs, 

33 ) -> PromptReturn: 

34 ...