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

7 statements  

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

1""" 

2Many places in prompt_toolkit can take either plain text, or formatted text. 

3For instance the :func:`~prompt_toolkit.shortcuts.prompt` function takes either 

4plain text or formatted text for the prompt. The 

5:class:`~prompt_toolkit.layout.FormattedTextControl` can also take either plain 

6text or formatted text. 

7 

8In any case, there is an input that can either be just plain text (a string), 

9an :class:`.HTML` object, an :class:`.ANSI` object or a sequence of 

10`(style_string, text)` tuples. The :func:`.to_formatted_text` conversion 

11function takes any of these and turns all of them into such a tuple sequence. 

12""" 

13from __future__ import annotations 

14 

15from .ansi import ANSI 

16from .base import ( 

17 AnyFormattedText, 

18 FormattedText, 

19 StyleAndTextTuples, 

20 Template, 

21 is_formatted_text, 

22 merge_formatted_text, 

23 to_formatted_text, 

24) 

25from .html import HTML 

26from .pygments import PygmentsTokens 

27from .utils import ( 

28 fragment_list_len, 

29 fragment_list_to_text, 

30 fragment_list_width, 

31 split_lines, 

32 to_plain_text, 

33) 

34 

35__all__ = [ 

36 # Base. 

37 "AnyFormattedText", 

38 "to_formatted_text", 

39 "is_formatted_text", 

40 "Template", 

41 "merge_formatted_text", 

42 "FormattedText", 

43 "StyleAndTextTuples", 

44 # HTML. 

45 "HTML", 

46 # ANSI. 

47 "ANSI", 

48 # Pygments. 

49 "PygmentsTokens", 

50 # Utils. 

51 "fragment_list_len", 

52 "fragment_list_width", 

53 "fragment_list_to_text", 

54 "split_lines", 

55 "to_plain_text", 

56]