Method: rich.syntax.PygmentsSyntaxTheme.__init__
Calls: 32, Exceptions: 2, Paths: 3Back
Path 1: 29 calls (0.91)
'monokai' (25) 'default' (3) 'emacs' (1)
1def __init__(self, theme: Union[str, Type[PygmentsStyle]]) -> None:
2 self._style_cache: Dict[TokenType, Style] = {}
3 if isinstance(theme, str):
4 try:
5 self._pygments_style_class = get_style_by_name(theme)
6 except ClassNotFound:
7 self._pygments_style_class = get_style_by_name("default")
8 else:
9 self._pygments_style_class = theme
10
11 self._background_color = self._pygments_style_class.background_color
12 self._background_style = Style(bgcolor=self._background_color)
Path 2: 2 calls (0.06)
'ascii_light' (1) 'foo' (1)
ClassNotFound (2)
1def __init__(self, theme: Union[str, Type[PygmentsStyle]]) -> None:
2 self._style_cache: Dict[TokenType, Style] = {}
3 if isinstance(theme, str):
4 try:
5 self._pygments_style_class = get_style_by_name(theme)
6 except ClassNotFound:
7 self._pygments_style_class = get_style_by_name("default")
8 else:
9 self._pygments_style_class = theme
10
11 self._background_color = self._pygments_style_class.background_color
12 self._background_style = Style(bgcolor=self._background_color)
Path 3: 1 calls (0.03)
Style (1)
1def __init__(self, theme: Union[str, Type[PygmentsStyle]]) -> None:
2 self._style_cache: Dict[TokenType, Style] = {}
3 if isinstance(theme, str):
4 try:
5 self._pygments_style_class = get_style_by_name(theme)
6 except ClassNotFound:
7 self._pygments_style_class = get_style_by_name("default")
8 else:
9 self._pygments_style_class = theme
10
11 self._background_color = self._pygments_style_class.background_color
12 self._background_style = Style(bgcolor=self._background_color)