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.4.4, created at 2024-04-20 06:09 +0000
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-20 06:09 +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.
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
15from .ansi import ANSI
16from .base import (
17 AnyFormattedText,
18 FormattedText,
19 OneStyleAndTextTuple,
20 StyleAndTextTuples,
21 Template,
22 is_formatted_text,
23 merge_formatted_text,
24 to_formatted_text,
25)
26from .html import HTML
27from .pygments import PygmentsTokens
28from .utils import (
29 fragment_list_len,
30 fragment_list_to_text,
31 fragment_list_width,
32 split_lines,
33 to_plain_text,
34)
36__all__ = [
37 # Base.
38 "AnyFormattedText",
39 "OneStyleAndTextTuple",
40 "to_formatted_text",
41 "is_formatted_text",
42 "Template",
43 "merge_formatted_text",
44 "FormattedText",
45 "StyleAndTextTuples",
46 # HTML.
47 "HTML",
48 # ANSI.
49 "ANSI",
50 # Pygments.
51 "PygmentsTokens",
52 # Utils.
53 "fragment_list_len",
54 "fragment_list_width",
55 "fragment_list_to_text",
56 "split_lines",
57 "to_plain_text",
58]