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

Method apply_meta

rich/text.py:509–521  ·  view source on GitHub ↗

Apply metadata to the text, or a portion of the text. Args: meta (Dict[str, Any]): A dict of meta information. start (int): Start offset (negative indexing is supported). Defaults to 0. end (Optional[int], optional): End offset (negative indexing is suppo

(
        self, meta: Dict[str, Any], start: int = 0, end: Optional[int] = None
    )

Source from the content-addressed store, hash-verified

507 self._spans.insert(0, Span(start, min(length, end), style))
508
509 def apply_meta(
510 self, meta: Dict[str, Any], start: int = 0, end: Optional[int] = None
511 ) -> None:
512 """Apply metadata to the text, or a portion of the text.
513
514 Args:
515 meta (Dict[str, Any]): A dict of meta information.
516 start (int): Start offset (negative indexing is supported). Defaults to 0.
517 end (Optional[int], optional): End offset (negative indexing is supported), or None for end of text. Defaults to None.
518
519 """
520 style = Style.from_meta(meta)
521 self.stylize(style, start=start, end=end)
522
523 def on(self, meta: Optional[Dict[str, Any]] = None, **handlers: Any) -> "Text":
524 """Apply event handlers (used by Textual project).

Callers 2

test_apply_metaFunction · 0.95
assembleMethod · 0.80

Calls 2

stylizeMethod · 0.95
from_metaMethod · 0.80

Tested by 1

test_apply_metaFunction · 0.76