Path 1: 39 calls (1.0)

Syntax.highlight..tokens_to_spans def (24) Syntax.highlight.. def (15)

Text (39)

1def append_tokens(
2        self, tokens: Iterable[Tuple[str, Optional[StyleType]]]
3    ) -> "Text":
4        """Append iterable of str and style. Style may be a Style instance or a str style definition.
5
6        Args:
7            pairs (Iterable[Tuple[str, Optional[StyleType]]]): An iterable of tuples containing str content and style.
8
9        Returns:
10            Text: Returns self for chaining.
11        """
12        append_text = self._text.append
13        append_span = self._spans.append
14        _Span = Span
15        offset = len(self)
16        for content, style in tokens:
17            append_text(content)
18            if style is not None:
19                append_span(_Span(offset, offset + len(content), style))
20            offset += len(content)
21        self._length = offset
22        return self