Path 1: 598 calls (0.67)

Console (598)

0 (235) 1 (207) 2 (81) 3 (75)

Column (598)

_Cell (916) None (143)

GeneratorExit (143)

1def _get_cells(
2        self, console: "Console", column_index: int, column: Column
3    ) -> Iterable[_Cell]:
4        """Get all the cells with padding and optional header."""
5
6        collapse_padding = self.collapse_padding
7        pad_edge = self.pad_edge
8        padding = self.padding
9        any_padding = any(padding)
10
11        first_column = column_index == 0
12        last_column = column_index == len(self.columns) - 1
13
14        _padding_cache: Dict[Tuple[bool, bool], Tuple[int, int, int, int]] = {}
15
16        def get_padding(first_row: bool, last_row: bool) -> Tuple[int, int, int, int]:
17            cached = _padding_cache.get((first_row, last_row))
18            if cached:
19                return cached
20            top, right, bottom, left = padding
21
22            if collapse_padding:
23                if not first_column:
24                    left = max(0, left - right)
25                if not last_row:
26                    bottom = max(0, top - bottom)
27
28            if not pad_edge:
29                if first_column:
30                    left = 0
31                if last_column:
32                    right = 0
33                if first_row:
34                    top = 0
35                if last_row:
36                    bottom = 0
37            _padding = (top, right, bottom, left)
38            _padding_cache[(first_row, last_row)] = _padding
39            return _padding
40
41        raw_cells: List[Tuple[StyleType, "RenderableType"]] = []
42        _append = raw_cells.append
43        get_style = console.get_style
44        if self.show_header:
45            header_style = get_style(self.header_style or "") + get_style(
46                column.header_style
47            )
48            _append((header_style, column.header))
49        cell_style = get_style(column.style or "")
50        for cell in column.cells:
51            _append((cell_style, cell))
52        if self.show_footer:
53            footer_style = get_style(self.footer_style or "") + get_style(
54                column.footer_style
55            )
56            _append((footer_style, column.footer))
57
58        if any_padding:
59            _Padding = Padding
60            for first, last, (style, renderable) in loop_first_last(raw_cells):
61                yield _Cell(
62                    style,
63                    _Padding(renderable, get_padding(first, last)),
64                    getattr(renderable, "vertical", None) or column.vertical,
65                )
66        else:
67            for (style, renderable) in raw_cells:
68                yield _Cell(
69                    style,
70                    renderable,
71                    getattr(renderable, "vertical", None) or column.vertical,
72                )
            

Path 2: 178 calls (0.2)

Console (178)

0 (62) 1 (52) 2 (52) 3 (12)

Column (178)

_Cell (492) None (35)

GeneratorExit (35)

1def _get_cells(
2        self, console: "Console", column_index: int, column: Column
3    ) -> Iterable[_Cell]:
4        """Get all the cells with padding and optional header."""
5
6        collapse_padding = self.collapse_padding
7        pad_edge = self.pad_edge
8        padding = self.padding
9        any_padding = any(padding)
10
11        first_column = column_index == 0
12        last_column = column_index == len(self.columns) - 1
13
14        _padding_cache: Dict[Tuple[bool, bool], Tuple[int, int, int, int]] = {}
15
16        def get_padding(first_row: bool, last_row: bool) -> Tuple[int, int, int, int]:
17            cached = _padding_cache.get((first_row, last_row))
18            if cached:
19                return cached
20            top, right, bottom, left = padding
21
22            if collapse_padding:
23                if not first_column:
24                    left = max(0, left - right)
25                if not last_row:
26                    bottom = max(0, top - bottom)
27
28            if not pad_edge:
29                if first_column:
30                    left = 0
31                if last_column:
32                    right = 0
33                if first_row:
34                    top = 0
35                if last_row:
36                    bottom = 0
37            _padding = (top, right, bottom, left)
38            _padding_cache[(first_row, last_row)] = _padding
39            return _padding
40
41        raw_cells: List[Tuple[StyleType, "RenderableType"]] = []
42        _append = raw_cells.append
43        get_style = console.get_style
44        if self.show_header:
45            header_style = get_style(self.header_style or "") + get_style(
46                column.header_style
47            )
48            _append((header_style, column.header))
49        cell_style = get_style(column.style or "")
50        for cell in column.cells:
51            _append((cell_style, cell))
52        if self.show_footer:
53            footer_style = get_style(self.footer_style or "") + get_style(
54                column.footer_style
55            )
56            _append((footer_style, column.footer))
57
58        if any_padding:
59            _Padding = Padding
60            for first, last, (style, renderable) in loop_first_last(raw_cells):
61                yield _Cell(
62                    style,
63                    _Padding(renderable, get_padding(first, last)),
64                    getattr(renderable, "vertical", None) or column.vertical,
65                )
66        else:
67            for (style, renderable) in raw_cells:
68                yield _Cell(
69                    style,
70                    renderable,
71                    getattr(renderable, "vertical", None) or column.vertical,
72                )
            

Path 3: 61 calls (0.07)

Console (61)

0 (18) 1 (15) 2 (14) 3 (14)

Column (61)

_Cell (305) None (15)

GeneratorExit (15)

1def _get_cells(
2        self, console: "Console", column_index: int, column: Column
3    ) -> Iterable[_Cell]:
4        """Get all the cells with padding and optional header."""
5
6        collapse_padding = self.collapse_padding
7        pad_edge = self.pad_edge
8        padding = self.padding
9        any_padding = any(padding)
10
11        first_column = column_index == 0
12        last_column = column_index == len(self.columns) - 1
13
14        _padding_cache: Dict[Tuple[bool, bool], Tuple[int, int, int, int]] = {}
15
16        def get_padding(first_row: bool, last_row: bool) -> Tuple[int, int, int, int]:
17            cached = _padding_cache.get((first_row, last_row))
18            if cached:
19                return cached
20            top, right, bottom, left = padding
21
22            if collapse_padding:
23                if not first_column:
24                    left = max(0, left - right)
25                if not last_row:
26                    bottom = max(0, top - bottom)
27
28            if not pad_edge:
29                if first_column:
30                    left = 0
31                if last_column:
32                    right = 0
33                if first_row:
34                    top = 0
35                if last_row:
36                    bottom = 0
37            _padding = (top, right, bottom, left)
38            _padding_cache[(first_row, last_row)] = _padding
39            return _padding
40
41        raw_cells: List[Tuple[StyleType, "RenderableType"]] = []
42        _append = raw_cells.append
43        get_style = console.get_style
44        if self.show_header:
45            header_style = get_style(self.header_style or "") + get_style(
46                column.header_style
47            )
48            _append((header_style, column.header))
49        cell_style = get_style(column.style or "")
50        for cell in column.cells:
51            _append((cell_style, cell))
52        if self.show_footer:
53            footer_style = get_style(self.footer_style or "") + get_style(
54                column.footer_style
55            )
56            _append((footer_style, column.footer))
57
58        if any_padding:
59            _Padding = Padding
60            for first, last, (style, renderable) in loop_first_last(raw_cells):
61                yield _Cell(
62                    style,
63                    _Padding(renderable, get_padding(first, last)),
64                    getattr(renderable, "vertical", None) or column.vertical,
65                )
66        else:
67            for (style, renderable) in raw_cells:
68                yield _Cell(
69                    style,
70                    renderable,
71                    getattr(renderable, "vertical", None) or column.vertical,
72                )
            

Path 4: 30 calls (0.03)

Console (30)

0 (14) 2 (8) 1 (4) 3 (4)

Column (30)

1def _get_cells(
2        self, console: "Console", column_index: int, column: Column
3    ) -> Iterable[_Cell]:
4        """Get all the cells with padding and optional header."""
5
6        collapse_padding = self.collapse_padding
7        pad_edge = self.pad_edge
8        padding = self.padding
9        any_padding = any(padding)
10
11        first_column = column_index == 0
12        last_column = column_index == len(self.columns) - 1
13
14        _padding_cache: Dict[Tuple[bool, bool], Tuple[int, int, int, int]] = {}
15
16        def get_padding(first_row: bool, last_row: bool) -> Tuple[int, int, int, int]:
17            cached = _padding_cache.get((first_row, last_row))
18            if cached:
19                return cached
20            top, right, bottom, left = padding
21
22            if collapse_padding:
23                if not first_column:
24                    left = max(0, left - right)
25                if not last_row:
26                    bottom = max(0, top - bottom)
27
28            if not pad_edge:
29                if first_column:
30                    left = 0
31                if last_column:
32                    right = 0
33                if first_row:
34                    top = 0
35                if last_row:
36                    bottom = 0
37            _padding = (top, right, bottom, left)
38            _padding_cache[(first_row, last_row)] = _padding
39            return _padding
40
41        raw_cells: List[Tuple[StyleType, "RenderableType"]] = []
42        _append = raw_cells.append
43        get_style = console.get_style
44        if self.show_header:
45            header_style = get_style(self.header_style or "") + get_style(
46                column.header_style
47            )
48            _append((header_style, column.header))
49        cell_style = get_style(column.style or "")
50        for cell in column.cells:
51            _append((cell_style, cell))
52        if self.show_footer:
53            footer_style = get_style(self.footer_style or "") + get_style(
54                column.footer_style
55            )
56            _append((footer_style, column.footer))
57
58        if any_padding:
59            _Padding = Padding
60            for first, last, (style, renderable) in loop_first_last(raw_cells):
61                yield _Cell(
62                    style,
63                    _Padding(renderable, get_padding(first, last)),
64                    getattr(renderable, "vertical", None) or column.vertical,
65                )
66        else:
67            for (style, renderable) in raw_cells:
68                yield _Cell(
69                    style,
70                    renderable,
71                    getattr(renderable, "vertical", None) or column.vertical,
72                )
            

Path 5: 12 calls (0.01)

Console (12)

3 (4) 2 (4) 1 (4)

Column (12)

GeneratorExit (12)

1def _get_cells(
2        self, console: "Console", column_index: int, column: Column
3    ) -> Iterable[_Cell]:
4        """Get all the cells with padding and optional header."""
5
6        collapse_padding = self.collapse_padding
7        pad_edge = self.pad_edge
8        padding = self.padding
9        any_padding = any(padding)
10
11        first_column = column_index == 0
12        last_column = column_index == len(self.columns) - 1
13
14        _padding_cache: Dict[Tuple[bool, bool], Tuple[int, int, int, int]] = {}
15
16        def get_padding(first_row: bool, last_row: bool) -> Tuple[int, int, int, int]:
17            cached = _padding_cache.get((first_row, last_row))
18            if cached:
19                return cached
20            top, right, bottom, left = padding
21
22            if collapse_padding:
23                if not first_column:
24                    left = max(0, left - right)
25                if not last_row:
26                    bottom = max(0, top - bottom)
27
28            if not pad_edge:
29                if first_column:
30                    left = 0
31                if last_column:
32                    right = 0
33                if first_row:
34                    top = 0
35                if last_row:
36                    bottom = 0
37            _padding = (top, right, bottom, left)
38            _padding_cache[(first_row, last_row)] = _padding
39            return _padding
40
41        raw_cells: List[Tuple[StyleType, "RenderableType"]] = []
42        _append = raw_cells.append
43        get_style = console.get_style
44        if self.show_header:
45            header_style = get_style(self.header_style or "") + get_style(
46                column.header_style
47            )
48            _append((header_style, column.header))
49        cell_style = get_style(column.style or "")
50        for cell in column.cells:
51            _append((cell_style, cell))
52        if self.show_footer:
53            footer_style = get_style(self.footer_style or "") + get_style(
54                column.footer_style
55            )
56            _append((footer_style, column.footer))
57
58        if any_padding:
59            _Padding = Padding
60            for first, last, (style, renderable) in loop_first_last(raw_cells):
61                yield _Cell(
62                    style,
63                    _Padding(renderable, get_padding(first, last)),
64                    getattr(renderable, "vertical", None) or column.vertical,
65                )
66        else:
67            for (style, renderable) in raw_cells:
68                yield _Cell(
69                    style,
70                    renderable,
71                    getattr(renderable, "vertical", None) or column.vertical,
72                )
            

Path 6: 8 calls (0.01)

Console (8)

0 (2) 1 (2) 2 (2) 3 (2)

Column (8)

_Cell (40) None (3)

GeneratorExit (3)

1def _get_cells(
2        self, console: "Console", column_index: int, column: Column
3    ) -> Iterable[_Cell]:
4        """Get all the cells with padding and optional header."""
5
6        collapse_padding = self.collapse_padding
7        pad_edge = self.pad_edge
8        padding = self.padding
9        any_padding = any(padding)
10
11        first_column = column_index == 0
12        last_column = column_index == len(self.columns) - 1
13
14        _padding_cache: Dict[Tuple[bool, bool], Tuple[int, int, int, int]] = {}
15
16        def get_padding(first_row: bool, last_row: bool) -> Tuple[int, int, int, int]:
17            cached = _padding_cache.get((first_row, last_row))
18            if cached:
19                return cached
20            top, right, bottom, left = padding
21
22            if collapse_padding:
23                if not first_column:
24                    left = max(0, left - right)
25                if not last_row:
26                    bottom = max(0, top - bottom)
27
28            if not pad_edge:
29                if first_column:
30                    left = 0
31                if last_column:
32                    right = 0
33                if first_row:
34                    top = 0
35                if last_row:
36                    bottom = 0
37            _padding = (top, right, bottom, left)
38            _padding_cache[(first_row, last_row)] = _padding
39            return _padding
40
41        raw_cells: List[Tuple[StyleType, "RenderableType"]] = []
42        _append = raw_cells.append
43        get_style = console.get_style
44        if self.show_header:
45            header_style = get_style(self.header_style or "") + get_style(
46                column.header_style
47            )
48            _append((header_style, column.header))
49        cell_style = get_style(column.style or "")
50        for cell in column.cells:
51            _append((cell_style, cell))
52        if self.show_footer:
53            footer_style = get_style(self.footer_style or "") + get_style(
54                column.footer_style
55            )
56            _append((footer_style, column.footer))
57
58        if any_padding:
59            _Padding = Padding
60            for first, last, (style, renderable) in loop_first_last(raw_cells):
61                yield _Cell(
62                    style,
63                    _Padding(renderable, get_padding(first, last)),
64                    getattr(renderable, "vertical", None) or column.vertical,
65                )
66        else:
67            for (style, renderable) in raw_cells:
68                yield _Cell(
69                    style,
70                    renderable,
71                    getattr(renderable, "vertical", None) or column.vertical,
72                )
            

Path 7: 2 calls (0.0)

Console (2)

0 (2)

Column (2)

_Cell (2)

1def _get_cells(
2        self, console: "Console", column_index: int, column: Column
3    ) -> Iterable[_Cell]:
4        """Get all the cells with padding and optional header."""
5
6        collapse_padding = self.collapse_padding
7        pad_edge = self.pad_edge
8        padding = self.padding
9        any_padding = any(padding)
10
11        first_column = column_index == 0
12        last_column = column_index == len(self.columns) - 1
13
14        _padding_cache: Dict[Tuple[bool, bool], Tuple[int, int, int, int]] = {}
15
16        def get_padding(first_row: bool, last_row: bool) -> Tuple[int, int, int, int]:
17            cached = _padding_cache.get((first_row, last_row))
18            if cached:
19                return cached
20            top, right, bottom, left = padding
21
22            if collapse_padding:
23                if not first_column:
24                    left = max(0, left - right)
25                if not last_row:
26                    bottom = max(0, top - bottom)
27
28            if not pad_edge:
29                if first_column:
30                    left = 0
31                if last_column:
32                    right = 0
33                if first_row:
34                    top = 0
35                if last_row:
36                    bottom = 0
37            _padding = (top, right, bottom, left)
38            _padding_cache[(first_row, last_row)] = _padding
39            return _padding
40
41        raw_cells: List[Tuple[StyleType, "RenderableType"]] = []
42        _append = raw_cells.append
43        get_style = console.get_style
44        if self.show_header:
45            header_style = get_style(self.header_style or "") + get_style(
46                column.header_style
47            )
48            _append((header_style, column.header))
49        cell_style = get_style(column.style or "")
50        for cell in column.cells:
51            _append((cell_style, cell))
52        if self.show_footer:
53            footer_style = get_style(self.footer_style or "") + get_style(
54                column.footer_style
55            )
56            _append((footer_style, column.footer))
57
58        if any_padding:
59            _Padding = Padding
60            for first, last, (style, renderable) in loop_first_last(raw_cells):
61                yield _Cell(
62                    style,
63                    _Padding(renderable, get_padding(first, last)),
64                    getattr(renderable, "vertical", None) or column.vertical,
65                )
66        else:
67            for (style, renderable) in raw_cells:
68                yield _Cell(
69                    style,
70                    renderable,
71                    getattr(renderable, "vertical", None) or column.vertical,
72                )