Path 1: 71 calls (0.84)

'1' (11) ')' (6) '0' (3) 'Layout(' (3) '(' (3) 'Layout()' (2) " name='foo'" (2) ' 1,' (2) 'Hello' (1) '{' (1)

Text (71)

1def decode_line(self, line: str) -> Text:
2        """Decode a line containing ansi codes.
3
4        Args:
5            line (str): A line of terminal output.
6
7        Returns:
8            Text: A Text instance marked up according to ansi codes.
9        """
10        from_ansi = Color.from_ansi
11        from_rgb = Color.from_rgb
12        _Style = Style
13        text = Text()
14        append = text.append
15        line = line.rsplit("\r", 1)[-1]
16        for plain_text, sgr, osc in _ansi_tokenize(line):
17            if plain_text:
18                append(plain_text, self.style or None)
19            elif osc is not None:
20                if osc.startswith("8;"):
21                    _params, semicolon, link = osc[2:].partition(";")
22                    if semicolon:
23                        self.style = self.style.update_link(link or None)
24            elif sgr is not None:
25                # Translate in to semi-colon separated codes
26                # Ignore invalid codes, because we want to be lenient
27                codes = [
28                    min(255, int(_code) if _code else 0)
29                    for _code in sgr.split(";")
30                    if _code.isdigit() or _code == ""
31                ]
32                iter_codes = iter(codes)
33                for code in iter_codes:
34                    if code == 0:
35                        # reset
36                        self.style = _Style.null()
37                    elif code in SGR_STYLE_MAP:
38                        # styles
39                        self.style += _Style.parse(SGR_STYLE_MAP[code])
40                    elif code == 38:
41                        #  Foreground
42                        with suppress(StopIteration):
43                            color_type = next(iter_codes)
44                            if color_type == 5:
45                                self.style += _Style.from_color(
46                                    from_ansi(next(iter_codes))
47                                )
48                            elif color_type == 2:
49                                self.style += _Style.from_color(
50                                    from_rgb(
51                                        next(iter_codes),
52                                        next(iter_codes),
53                                        next(iter_codes),
54                                    )
55                                )
56                    elif code == 48:
57                        # Background
58                        with suppress(StopIteration):
59                            color_type = next(iter_codes)
60                            if color_type == 5:
61                                self.style += _Style.from_color(
62                                    None, from_ansi(next(iter_codes))
63                                )
64                            elif color_type == 2:
65                                self.style += _Style.from_color(
66                                    None,
67                                    from_rgb(
68                                        next(iter_codes),
69                                        next(iter_codes),
70                                        next(iter_codes),
71                                    ),
72                                )
73
74        return text
            

Path 2: 7 calls (0.08)

'\x1b[1mfoo\x1b[0m' (1) "\x1b[01m\x1b[KC:\\Users\\stefa\\AppData\\Local\\Temp\\tmp3ydingba:\x1b[m\x1b[K In function '\x1b[01m\x1b[Kmain\x1b[m\x1b[K':"...

Text (7)

1def decode_line(self, line: str) -> Text:
2        """Decode a line containing ansi codes.
3
4        Args:
5            line (str): A line of terminal output.
6
7        Returns:
8            Text: A Text instance marked up according to ansi codes.
9        """
10        from_ansi = Color.from_ansi
11        from_rgb = Color.from_rgb
12        _Style = Style
13        text = Text()
14        append = text.append
15        line = line.rsplit("\r", 1)[-1]
16        for plain_text, sgr, osc in _ansi_tokenize(line):
17            if plain_text:
18                append(plain_text, self.style or None)
19            elif osc is not None:
20                if osc.startswith("8;"):
21                    _params, semicolon, link = osc[2:].partition(";")
22                    if semicolon:
23                        self.style = self.style.update_link(link or None)
24            elif sgr is not None:
25                # Translate in to semi-colon separated codes
26                # Ignore invalid codes, because we want to be lenient
27                codes = [
28                    min(255, int(_code) if _code else 0)
29                    for _code in sgr.split(";")
30                    if _code.isdigit() or _code == ""
31                ]
32                iter_codes = iter(codes)
33                for code in iter_codes:
34                    if code == 0:
35                        # reset
36                        self.style = _Style.null()
37                    elif code in SGR_STYLE_MAP:
38                        # styles
39                        self.style += _Style.parse(SGR_STYLE_MAP[code])
40                    elif code == 38:
41                        #  Foreground
42                        with suppress(StopIteration):
43                            color_type = next(iter_codes)
44                            if color_type == 5:
45                                self.style += _Style.from_color(
46                                    from_ansi(next(iter_codes))
47                                )
48                            elif color_type == 2:
49                                self.style += _Style.from_color(
50                                    from_rgb(
51                                        next(iter_codes),
52                                        next(iter_codes),
53                                        next(iter_codes),
54                                    )
55                                )
56                    elif code == 48:
57                        # Background
58                        with suppress(StopIteration):
59                            color_type = next(iter_codes)
60                            if color_type == 5:
61                                self.style += _Style.from_color(
62                                    None, from_ansi(next(iter_codes))
63                                )
64                            elif color_type == 2:
65                                self.style += _Style.from_color(
66                                    None,
67                                    from_rgb(
68                                        next(iter_codes),
69                                        next(iter_codes),
70                                        next(iter_codes),
71                                    ),
72                                )
73
74        return text
            

Path 3: 2 calls (0.02)

'Hello, \x1b[1m' (1) '\x1b[1m\x1b[Kfoo barmbaz' (1)

Text (2)

1def decode_line(self, line: str) -> Text:
2        """Decode a line containing ansi codes.
3
4        Args:
5            line (str): A line of terminal output.
6
7        Returns:
8            Text: A Text instance marked up according to ansi codes.
9        """
10        from_ansi = Color.from_ansi
11        from_rgb = Color.from_rgb
12        _Style = Style
13        text = Text()
14        append = text.append
15        line = line.rsplit("\r", 1)[-1]
16        for plain_text, sgr, osc in _ansi_tokenize(line):
17            if plain_text:
18                append(plain_text, self.style or None)
19            elif osc is not None:
20                if osc.startswith("8;"):
21                    _params, semicolon, link = osc[2:].partition(";")
22                    if semicolon:
23                        self.style = self.style.update_link(link or None)
24            elif sgr is not None:
25                # Translate in to semi-colon separated codes
26                # Ignore invalid codes, because we want to be lenient
27                codes = [
28                    min(255, int(_code) if _code else 0)
29                    for _code in sgr.split(";")
30                    if _code.isdigit() or _code == ""
31                ]
32                iter_codes = iter(codes)
33                for code in iter_codes:
34                    if code == 0:
35                        # reset
36                        self.style = _Style.null()
37                    elif code in SGR_STYLE_MAP:
38                        # styles
39                        self.style += _Style.parse(SGR_STYLE_MAP[code])
40                    elif code == 38:
41                        #  Foreground
42                        with suppress(StopIteration):
43                            color_type = next(iter_codes)
44                            if color_type == 5:
45                                self.style += _Style.from_color(
46                                    from_ansi(next(iter_codes))
47                                )
48                            elif color_type == 2:
49                                self.style += _Style.from_color(
50                                    from_rgb(
51                                        next(iter_codes),
52                                        next(iter_codes),
53                                        next(iter_codes),
54                                    )
55                                )
56                    elif code == 48:
57                        # Background
58                        with suppress(StopIteration):
59                            color_type = next(iter_codes)
60                            if color_type == 5:
61                                self.style += _Style.from_color(
62                                    None, from_ansi(next(iter_codes))
63                                )
64                            elif color_type == 2:
65                                self.style += _Style.from_color(
66                                    None,
67                                    from_rgb(
68                                        next(iter_codes),
69                                        next(iter_codes),
70                                        next(iter_codes),
71                                    ),
72                                )
73
74        return text
            

Path 4: 1 calls (0.01)

'\x1b]8;id=216776;http://example.org\x1b\\bar\x1b]8;;\x1b\\' (1)

Text (1)

1def decode_line(self, line: str) -> Text:
2        """Decode a line containing ansi codes.
3
4        Args:
5            line (str): A line of terminal output.
6
7        Returns:
8            Text: A Text instance marked up according to ansi codes.
9        """
10        from_ansi = Color.from_ansi
11        from_rgb = Color.from_rgb
12        _Style = Style
13        text = Text()
14        append = text.append
15        line = line.rsplit("\r", 1)[-1]
16        for plain_text, sgr, osc in _ansi_tokenize(line):
17            if plain_text:
18                append(plain_text, self.style or None)
19            elif osc is not None:
20                if osc.startswith("8;"):
21                    _params, semicolon, link = osc[2:].partition(";")
22                    if semicolon:
23                        self.style = self.style.update_link(link or None)
24            elif sgr is not None:
25                # Translate in to semi-colon separated codes
26                # Ignore invalid codes, because we want to be lenient
27                codes = [
28                    min(255, int(_code) if _code else 0)
29                    for _code in sgr.split(";")
30                    if _code.isdigit() or _code == ""
31                ]
32                iter_codes = iter(codes)
33                for code in iter_codes:
34                    if code == 0:
35                        # reset
36                        self.style = _Style.null()
37                    elif code in SGR_STYLE_MAP:
38                        # styles
39                        self.style += _Style.parse(SGR_STYLE_MAP[code])
40                    elif code == 38:
41                        #  Foreground
42                        with suppress(StopIteration):
43                            color_type = next(iter_codes)
44                            if color_type == 5:
45                                self.style += _Style.from_color(
46                                    from_ansi(next(iter_codes))
47                                )
48                            elif color_type == 2:
49                                self.style += _Style.from_color(
50                                    from_rgb(
51                                        next(iter_codes),
52                                        next(iter_codes),
53                                        next(iter_codes),
54                                    )
55                                )
56                    elif code == 48:
57                        # Background
58                        with suppress(StopIteration):
59                            color_type = next(iter_codes)
60                            if color_type == 5:
61                                self.style += _Style.from_color(
62                                    None, from_ansi(next(iter_codes))
63                                )
64                            elif color_type == 2:
65                                self.style += _Style.from_color(
66                                    None,
67                                    from_rgb(
68                                        next(iter_codes),
69                                        next(iter_codes),
70                                        next(iter_codes),
71                                    ),
72                                )
73
74        return text
            

Path 5: 1 calls (0.01)

'\x1b[38;2;255;0;0;48;5;200mred\x1b[0m' (1)

Text (1)

1def decode_line(self, line: str) -> Text:
2        """Decode a line containing ansi codes.
3
4        Args:
5            line (str): A line of terminal output.
6
7        Returns:
8            Text: A Text instance marked up according to ansi codes.
9        """
10        from_ansi = Color.from_ansi
11        from_rgb = Color.from_rgb
12        _Style = Style
13        text = Text()
14        append = text.append
15        line = line.rsplit("\r", 1)[-1]
16        for plain_text, sgr, osc in _ansi_tokenize(line):
17            if plain_text:
18                append(plain_text, self.style or None)
19            elif osc is not None:
20                if osc.startswith("8;"):
21                    _params, semicolon, link = osc[2:].partition(";")
22                    if semicolon:
23                        self.style = self.style.update_link(link or None)
24            elif sgr is not None:
25                # Translate in to semi-colon separated codes
26                # Ignore invalid codes, because we want to be lenient
27                codes = [
28                    min(255, int(_code) if _code else 0)
29                    for _code in sgr.split(";")
30                    if _code.isdigit() or _code == ""
31                ]
32                iter_codes = iter(codes)
33                for code in iter_codes:
34                    if code == 0:
35                        # reset
36                        self.style = _Style.null()
37                    elif code in SGR_STYLE_MAP:
38                        # styles
39                        self.style += _Style.parse(SGR_STYLE_MAP[code])
40                    elif code == 38:
41                        #  Foreground
42                        with suppress(StopIteration):
43                            color_type = next(iter_codes)
44                            if color_type == 5:
45                                self.style += _Style.from_color(
46                                    from_ansi(next(iter_codes))
47                                )
48                            elif color_type == 2:
49                                self.style += _Style.from_color(
50                                    from_rgb(
51                                        next(iter_codes),
52                                        next(iter_codes),
53                                        next(iter_codes),
54                                    )
55                                )
56                    elif code == 48:
57                        # Background
58                        with suppress(StopIteration):
59                            color_type = next(iter_codes)
60                            if color_type == 5:
61                                self.style += _Style.from_color(
62                                    None, from_ansi(next(iter_codes))
63                                )
64                            elif color_type == 2:
65                                self.style += _Style.from_color(
66                                    None,
67                                    from_rgb(
68                                        next(iter_codes),
69                                        next(iter_codes),
70                                        next(iter_codes),
71                                    ),
72                                )
73
74        return text
            

Path 6: 1 calls (0.01)

'\x1b[38;5;200;48;2;255;0;0mred\x1b[0m' (1)

Text (1)

1def decode_line(self, line: str) -> Text:
2        """Decode a line containing ansi codes.
3
4        Args:
5            line (str): A line of terminal output.
6
7        Returns:
8            Text: A Text instance marked up according to ansi codes.
9        """
10        from_ansi = Color.from_ansi
11        from_rgb = Color.from_rgb
12        _Style = Style
13        text = Text()
14        append = text.append
15        line = line.rsplit("\r", 1)[-1]
16        for plain_text, sgr, osc in _ansi_tokenize(line):
17            if plain_text:
18                append(plain_text, self.style or None)
19            elif osc is not None:
20                if osc.startswith("8;"):
21                    _params, semicolon, link = osc[2:].partition(";")
22                    if semicolon:
23                        self.style = self.style.update_link(link or None)
24            elif sgr is not None:
25                # Translate in to semi-colon separated codes
26                # Ignore invalid codes, because we want to be lenient
27                codes = [
28                    min(255, int(_code) if _code else 0)
29                    for _code in sgr.split(";")
30                    if _code.isdigit() or _code == ""
31                ]
32                iter_codes = iter(codes)
33                for code in iter_codes:
34                    if code == 0:
35                        # reset
36                        self.style = _Style.null()
37                    elif code in SGR_STYLE_MAP:
38                        # styles
39                        self.style += _Style.parse(SGR_STYLE_MAP[code])
40                    elif code == 38:
41                        #  Foreground
42                        with suppress(StopIteration):
43                            color_type = next(iter_codes)
44                            if color_type == 5:
45                                self.style += _Style.from_color(
46                                    from_ansi(next(iter_codes))
47                                )
48                            elif color_type == 2:
49                                self.style += _Style.from_color(
50                                    from_rgb(
51                                        next(iter_codes),
52                                        next(iter_codes),
53                                        next(iter_codes),
54                                    )
55                                )
56                    elif code == 48:
57                        # Background
58                        with suppress(StopIteration):
59                            color_type = next(iter_codes)
60                            if color_type == 5:
61                                self.style += _Style.from_color(
62                                    None, from_ansi(next(iter_codes))
63                                )
64                            elif color_type == 2:
65                                self.style += _Style.from_color(
66                                    None,
67                                    from_rgb(
68                                        next(iter_codes),
69                                        next(iter_codes),
70                                        next(iter_codes),
71                                    ),
72                                )
73
74        return text
            

Path 7: 1 calls (0.01)

'Hello \x1b[38;5;239mWorld!' (1)

Text (1)

1def decode_line(self, line: str) -> Text:
2        """Decode a line containing ansi codes.
3
4        Args:
5            line (str): A line of terminal output.
6
7        Returns:
8            Text: A Text instance marked up according to ansi codes.
9        """
10        from_ansi = Color.from_ansi
11        from_rgb = Color.from_rgb
12        _Style = Style
13        text = Text()
14        append = text.append
15        line = line.rsplit("\r", 1)[-1]
16        for plain_text, sgr, osc in _ansi_tokenize(line):
17            if plain_text:
18                append(plain_text, self.style or None)
19            elif osc is not None:
20                if osc.startswith("8;"):
21                    _params, semicolon, link = osc[2:].partition(";")
22                    if semicolon:
23                        self.style = self.style.update_link(link or None)
24            elif sgr is not None:
25                # Translate in to semi-colon separated codes
26                # Ignore invalid codes, because we want to be lenient
27                codes = [
28                    min(255, int(_code) if _code else 0)
29                    for _code in sgr.split(";")
30                    if _code.isdigit() or _code == ""
31                ]
32                iter_codes = iter(codes)
33                for code in iter_codes:
34                    if code == 0:
35                        # reset
36                        self.style = _Style.null()
37                    elif code in SGR_STYLE_MAP:
38                        # styles
39                        self.style += _Style.parse(SGR_STYLE_MAP[code])
40                    elif code == 38:
41                        #  Foreground
42                        with suppress(StopIteration):
43                            color_type = next(iter_codes)
44                            if color_type == 5:
45                                self.style += _Style.from_color(
46                                    from_ansi(next(iter_codes))
47                                )
48                            elif color_type == 2:
49                                self.style += _Style.from_color(
50                                    from_rgb(
51                                        next(iter_codes),
52                                        next(iter_codes),
53                                        next(iter_codes),
54                                    )
55                                )
56                    elif code == 48:
57                        # Background
58                        with suppress(StopIteration):
59                            color_type = next(iter_codes)
60                            if color_type == 5:
61                                self.style += _Style.from_color(
62                                    None, from_ansi(next(iter_codes))
63                                )
64                            elif color_type == 2:
65                                self.style += _Style.from_color(
66                                    None,
67                                    from_rgb(
68                                        next(iter_codes),
69                                        next(iter_codes),
70                                        next(iter_codes),
71                                    ),
72                                )
73
74        return text
            

Path 8: 1 calls (0.01)

'World!\x1b[0m' (1)

Text (1)

1def decode_line(self, line: str) -> Text:
2        """Decode a line containing ansi codes.
3
4        Args:
5            line (str): A line of terminal output.
6
7        Returns:
8            Text: A Text instance marked up according to ansi codes.
9        """
10        from_ansi = Color.from_ansi
11        from_rgb = Color.from_rgb
12        _Style = Style
13        text = Text()
14        append = text.append
15        line = line.rsplit("\r", 1)[-1]
16        for plain_text, sgr, osc in _ansi_tokenize(line):
17            if plain_text:
18                append(plain_text, self.style or None)
19            elif osc is not None:
20                if osc.startswith("8;"):
21                    _params, semicolon, link = osc[2:].partition(";")
22                    if semicolon:
23                        self.style = self.style.update_link(link or None)
24            elif sgr is not None:
25                # Translate in to semi-colon separated codes
26                # Ignore invalid codes, because we want to be lenient
27                codes = [
28                    min(255, int(_code) if _code else 0)
29                    for _code in sgr.split(";")
30                    if _code.isdigit() or _code == ""
31                ]
32                iter_codes = iter(codes)
33                for code in iter_codes:
34                    if code == 0:
35                        # reset
36                        self.style = _Style.null()
37                    elif code in SGR_STYLE_MAP:
38                        # styles
39                        self.style += _Style.parse(SGR_STYLE_MAP[code])
40                    elif code == 38:
41                        #  Foreground
42                        with suppress(StopIteration):
43                            color_type = next(iter_codes)
44                            if color_type == 5:
45                                self.style += _Style.from_color(
46                                    from_ansi(next(iter_codes))
47                                )
48                            elif color_type == 2:
49                                self.style += _Style.from_color(
50                                    from_rgb(
51                                        next(iter_codes),
52                                        next(iter_codes),
53                                        next(iter_codes),
54                                    )
55                                )
56                    elif code == 48:
57                        # Background
58                        with suppress(StopIteration):
59                            color_type = next(iter_codes)
60                            if color_type == 5:
61                                self.style += _Style.from_color(
62                                    None, from_ansi(next(iter_codes))
63                                )
64                            elif color_type == 2:
65                                self.style += _Style.from_color(
66                                    None,
67                                    from_rgb(
68                                        next(iter_codes),
69                                        next(iter_codes),
70                                        next(iter_codes),
71                                    ),
72                                )
73
74        return text