MCPcopy
hub / github.com/Textualize/rich / get

Method get

rich/layout.py:198–214  ·  view source on GitHub ↗

Get a named layout, or None if it doesn't exist. Args: name (str): Name of layout. Returns: Optional[Layout]: Layout instance or None if no layout was found.

(self, name: str)

Source from the content-addressed store, hash-verified

196 return self._render_map
197
198 def get(self, name: str) -> Optional["Layout"]:
199 """Get a named layout, or None if it doesn't exist.
200
201 Args:
202 name (str): Name of layout.
203
204 Returns:
205 Optional[Layout]: Layout instance or None if no layout was found.
206 """
207 if self.name == name:
208 return self
209 else:
210 for child in self._children:
211 named_layout = child.get(name)
212 if named_layout is not None:
213 return named_layout
214 return None
215
216 def __getitem__(self, name: str) -> "Layout":
217 layout = self.get(name)

Callers 15

__getitem__Method · 0.95
test_measureFunction · 0.45
test_vertical_centerFunction · 0.45
render_tablesFunction · 0.45
test_vertical_align_topFunction · 0.45
test_theme_stackFunction · 0.45
test_renderFunction · 0.45
test_treeFunction · 0.45
test_refresh_screenFunction · 0.45
test_styledFunction · 0.45
test_decode_exampleFunction · 0.45

Calls

no outgoing calls

Tested by 15

test_measureFunction · 0.36
test_vertical_centerFunction · 0.36
render_tablesFunction · 0.36
test_vertical_align_topFunction · 0.36
test_theme_stackFunction · 0.36
test_renderFunction · 0.36
test_treeFunction · 0.36
test_refresh_screenFunction · 0.36
test_styledFunction · 0.36
test_decode_exampleFunction · 0.36
test_no_renderableFunction · 0.36