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

Method read

rich/theme.py:60–74  ·  view source on GitHub ↗

Read a theme from a path. Args: path (str): Path to a config file readable by Python configparser module. inherit (bool, optional): Inherit default styles. Defaults to True. encoding (str, optional): Encoding of the config file. Defaults to None.

(
        cls, path: str, inherit: bool = True, encoding: Optional[str] = None
    )

Source from the content-addressed store, hash-verified

58
59 @classmethod
60 def read(
61 cls, path: str, inherit: bool = True, encoding: Optional[str] = None
62 ) -> "Theme":
63 """Read a theme from a path.
64
65 Args:
66 path (str): Path to a config file readable by Python configparser module.
67 inherit (bool, optional): Inherit default styles. Defaults to True.
68 encoding (str, optional): Encoding of the config file. Defaults to None.
69
70 Returns:
71 Theme: A new theme instance.
72 """
73 with open(path, encoding=encoding) as config_file:
74 return cls.from_file(config_file, source=path, inherit=inherit)
75
76
77class ThemeStackError(Exception):

Callers 13

test_readFunction · 0.45
test_save_svgFunction · 0.45
test_save_textFunction · 0.45
test_save_htmlFunction · 0.45
test_openFunction · 0.45
test_open_text_modeFunction · 0.45
test_wrap_fileFunction · 0.45
columns.pyFile · 0.45
readFunction · 0.45
syntax.pyFile · 0.45
json.pyFile · 0.45

Calls 2

openFunction · 0.85
from_fileMethod · 0.80

Tested by 8

test_readFunction · 0.36
test_save_svgFunction · 0.36
test_save_textFunction · 0.36
test_save_htmlFunction · 0.36
test_openFunction · 0.36
test_open_text_modeFunction · 0.36
test_wrap_fileFunction · 0.36