Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/prompt_toolkit/formatted_text/__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

8 statements  

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""" 

13 

14from __future__ import annotations 

15 

16from .ansi import ANSI 

17from .base import ( 

18 AnyFormattedText, 

19 FormattedText, 

20 OneStyleAndTextTuple, 

21 StyleAndTextTuples, 

22 Template, 

23 is_formatted_text, 

24 merge_formatted_text, 

25 to_formatted_text, 

26) 

27from .html import HTML 

28from .pygments import PygmentsTokens 

29from .utils import ( 

30 fragment_list_len, 

31 fragment_list_to_text, 

32 fragment_list_width, 

33 split_lines, 

34 to_plain_text, 

35) 

36 

37__all__ = [ 

38 # Base. 

39 "AnyFormattedText", 

40 "OneStyleAndTextTuple", 

41 "to_formatted_text", 

42 "is_formatted_text", 

43 "Template", 

44 "merge_formatted_text", 

45 "FormattedText", 

46 "StyleAndTextTuples", 

47 # HTML. 

48 "HTML", 

49 # ANSI. 

50 "ANSI", 

51 # Pygments. 

52 "PygmentsTokens", 

53 # Utils. 

54 "fragment_list_len", 

55 "fragment_list_width", 

56 "fragment_list_to_text", 

57 "split_lines", 

58 "to_plain_text", 

59]