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

Method __init__

rich/syntax.py:279–315  ·  view source on GitHub ↗
(
        self,
        code: str,
        lexer: Union[Lexer, str],
        *,
        theme: Union[str, SyntaxTheme] = DEFAULT_THEME,
        dedent: bool = False,
        line_numbers: bool = False,
        start_line: int = 1,
        line_range: Optional[Tuple[Optional[int], Optional[int]]] = None,
        highlight_lines: Optional[Set[int]] = None,
        code_width: Optional[int] = None,
        tab_size: int = 4,
        word_wrap: bool = False,
        background_color: Optional[str] = None,
        indent_guides: bool = False,
        padding: PaddingDimensions = 0,
    )

Source from the content-addressed store, hash-verified

277 return theme
278
279 def __init__(
280 self,
281 code: str,
282 lexer: Union[Lexer, str],
283 *,
284 theme: Union[str, SyntaxTheme] = DEFAULT_THEME,
285 dedent: bool = False,
286 line_numbers: bool = False,
287 start_line: int = 1,
288 line_range: Optional[Tuple[Optional[int], Optional[int]]] = None,
289 highlight_lines: Optional[Set[int]] = None,
290 code_width: Optional[int] = None,
291 tab_size: int = 4,
292 word_wrap: bool = False,
293 background_color: Optional[str] = None,
294 indent_guides: bool = False,
295 padding: PaddingDimensions = 0,
296 ) -> None:
297 self.code = code
298 self._lexer = lexer
299 self.dedent = dedent
300 self.line_numbers = line_numbers
301 self.start_line = start_line
302 self.line_range = line_range
303 self.highlight_lines = highlight_lines or set()
304 self.code_width = code_width
305 self.tab_size = tab_size
306 self.word_wrap = word_wrap
307 self.background_color = background_color
308 self.background_style = (
309 Style(bgcolor=background_color) if background_color else Style()
310 )
311 self.indent_guides = indent_guides
312 self._padding = Padding.unpack(padding)
313
314 self._theme = self.get_theme(theme)
315 self._stylized_ranges: List[_SyntaxHighlightRange] = []
316
317 padding = PaddingProperty()
318

Callers

nothing calls this directly

Calls 3

get_themeMethod · 0.95
StyleClass · 0.85
unpackMethod · 0.80

Tested by

no test coverage detected