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
)
| 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 | |
| 77 | class ThemeStackError(Exception): |