Path 1: 1384 calls (0.81)

[] (1384)

Lines (1384)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 2: 64 calls (0.04)

Text.split..flatten_spans def (64)

Lines (64)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 3: 52 calls (0.03)

Text.split..flatten_spans def (52)

Lines (52)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 4: 49 calls (0.03)

Text.split..flatten_spans def (23) [7] (4) Text.split.. def (4) [18, 28, 40, 57, 78, 95, 115, 131, 147] (3) [4, 8] (3) [30, 5...

Lines (49)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 5: 41 calls (0.02)

Text.split..flatten_spans def (41)

Lines (41)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 6: 23 calls (0.01)

[88] (11) [85] (3) [86] (2) Text.split..flatten_spans def (2) [37] (1) [10] (1) [24] (1) [8] (1) [87] (1)

Lines (23)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 7: 18 calls (0.01)

Text.split..flatten_spans def (15) [6] (3)

Lines (18)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 8: 17 calls (0.01)

Text.split..flatten_spans def (6) [58] (2) [29] (1) [27, 46, 68] (1) [28, 56] (1) [27, 55] (1) [73] (1) [8] (1) [1] (1) [15, 29] (1)

Lines (17)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 9: 14 calls (0.01)

Text.split..flatten_spans def (9) [6, 52] (5)

Lines (14)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 10: 13 calls (0.01)

Text.split..flatten_spans def (8) [32] (1) [40] (1) [1, 2] (1) [100] (1) [37] (1)

Lines (13)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 11: 12 calls (0.01)

[31] (4) [80] (2) [45] (2) Text.split..flatten_spans def (1) [81] (1) [46] (1) [44] (1)

Lines (12)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 12: 6 calls (0.0)

Text.split..flatten_spans def (4) [0, 4] (1) [0, 5] (1)

Lines (6)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 13: 4 calls (0.0)

[6, 12] (3) [4, 11] (1)

Lines (4)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 14: 2 calls (0.0)

[22, 36, 62, 89] (1) [21, 35, 60, 88] (1)

Lines (2)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 15: 1 calls (0.0)

[39] (1)

Lines (1)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 16: 1 calls (0.0)

Text.split..flatten_spans def (1)

Lines (1)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines
            

Path 17: 1 calls (0.0)

[0, 3] (1)

Lines (1)

1def divide(self, offsets: Iterable[int]) -> Lines:
2        """Divide text in to a number of lines at given offsets.
3
4        Args:
5            offsets (Iterable[int]): Offsets used to divide text.
6
7        Returns:
8            Lines: New RichText instances between offsets.
9        """
10        _offsets = list(offsets)
11
12        if not _offsets:
13            return Lines([self.copy()])
14
15        text = self.plain
16        text_length = len(text)
17        divide_offsets = [0, *_offsets, text_length]
18        line_ranges = list(zip(divide_offsets, divide_offsets[1:]))
19
20        style = self.style
21        justify = self.justify
22        overflow = self.overflow
23        _Text = Text
24        new_lines = Lines(
25            _Text(
26                text[start:end],
27                style=style,
28                justify=justify,
29                overflow=overflow,
30            )
31            for start, end in line_ranges
32        )
33        if not self._spans:
34            return new_lines
35
36        _line_appends = [line._spans.append for line in new_lines._lines]
37        line_count = len(line_ranges)
38        _Span = Span
39
40        for span_start, span_end, style in self._spans:
41
42            lower_bound = 0
43            upper_bound = line_count
44            start_line_no = (lower_bound + upper_bound) // 2
45
46            while True:
47                line_start, line_end = line_ranges[start_line_no]
48                if span_start < line_start:
49                    upper_bound = start_line_no - 1
50                elif span_start > line_end:
51                    lower_bound = start_line_no + 1
52                else:
53                    break
54                start_line_no = (lower_bound + upper_bound) // 2
55
56            if span_end < line_end:
57                end_line_no = start_line_no
58            else:
59                end_line_no = lower_bound = start_line_no
60                upper_bound = line_count
61
62                while True:
63                    line_start, line_end = line_ranges[end_line_no]
64                    if span_end < line_start:
65                        upper_bound = end_line_no - 1
66                    elif span_end > line_end:
67                        lower_bound = end_line_no + 1
68                    else:
69                        break
70                    end_line_no = (lower_bound + upper_bound) // 2
71
72            for line_no in range(start_line_no, end_line_no + 1):
73                line_start, line_end = line_ranges[line_no]
74                new_start = max(0, span_start - line_start)
75                new_end = min(span_end - line_start, line_end - line_start)
76                if new_end > new_start:
77                    _line_appends[line_no](_Span(new_start, new_end, style))
78
79        return new_lines