Method: rich.layout.Layout._make_region_map
Calls: 3, Exceptions: 0, Paths: 2Back
Path 1: 2 calls (0.67)
60 (1) 20 (1)
10 (1) 5 (1)
dict (2)
1def _make_region_map(self, width: int, height: int) -> RegionMap:
2 """Create a dict that maps layout on to Region."""
3 stack: List[Tuple[Layout, Region]] = [(self, Region(0, 0, width, height))]
4 push = stack.append
5 pop = stack.pop
6 layout_regions: List[Tuple[Layout, Region]] = []
7 append_layout_region = layout_regions.append
8 while stack:
9 append_layout_region(pop())
10 layout, region = layout_regions[-1]
11 children = layout.children
12 if children:
13 for child_and_region in layout.splitter.divide(children, region):
14 push(child_and_region)
15
16 region_map = {
17 layout: region
18 for layout, region in sorted(layout_regions, key=itemgetter(1))
19 }
20 return region_map
Path 2: 1 calls (0.33)
10 (1)
5 (1)
dict (1)
1def _make_region_map(self, width: int, height: int) -> RegionMap:
2 """Create a dict that maps layout on to Region."""
3 stack: List[Tuple[Layout, Region]] = [(self, Region(0, 0, width, height))]
4 push = stack.append
5 pop = stack.pop
6 layout_regions: List[Tuple[Layout, Region]] = []
7 append_layout_region = layout_regions.append
8 while stack:
9 append_layout_region(pop())
10 layout, region = layout_regions[-1]
11 children = layout.children
12 if children:
13 for child_and_region in layout.splitter.divide(children, region):
14 push(child_and_region)
15
16 region_map = {
17 layout: region
18 for layout, region in sorted(layout_regions, key=itemgetter(1))
19 }
20 return region_map