Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/prompt_toolkit/__init__.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

12 statements  

1""" 

2prompt_toolkit 

3============== 

4 

5Author: Jonathan Slenders 

6 

7Description: prompt_toolkit is a Library for building powerful interactive 

8 command lines in Python. It can be a replacement for GNU 

9 Readline, but it can be much more than that. 

10 

11See the examples directory to learn about the usage. 

12 

13Probably, to get started, you might also want to have a look at 

14`prompt_toolkit.shortcuts.prompt`. 

15""" 

16 

17from __future__ import annotations 

18 

19import re 

20from importlib import metadata 

21 

22# note: this is a bit more lax than the actual pep 440 to allow for a/b/rc/dev without a number 

23pep440 = re.compile( 

24 r"^([1-9]\d*!)?(0|[1-9]\d*)(\.(0|[1-9]\d*))*((a|b|rc)(0|[1-9]\d*)?)?(\.post(0|[1-9]\d*))?(\.dev(0|[1-9]\d*)?)?$", 

25 re.UNICODE, 

26) 

27from .application import Application 

28from .formatted_text import ANSI, HTML 

29from .shortcuts import PromptSession, print_formatted_text, prompt 

30 

31# Don't forget to update in `docs/conf.py`! 

32__version__ = metadata.version("prompt_toolkit") 

33 

34assert pep440.match(__version__) 

35 

36# Version tuple. 

37VERSION = tuple(int(v.rstrip("abrc")) for v in __version__.split(".")[:3]) 

38 

39 

40__all__ = [ 

41 # Application. 

42 "Application", 

43 # Shortcuts. 

44 "prompt", 

45 "PromptSession", 

46 "print_formatted_text", 

47 # Formatted text. 

48 "HTML", 

49 "ANSI", 

50 # Version info. 

51 "__version__", 

52 "VERSION", 

53]