Воркед
This commit is contained in:
1 parent
ac32c55ab9
commit
ee94d8e529
1138 files changed
+55771
-77901
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import configparser
|
||||
from typing import Dict, List, IO, Mapping, Optional
|
||||
from typing import IO, Dict, List, Mapping, Optional
|
||||
|
||||
from .default_styles import DEFAULT_STYLES
|
||||
from .style import Style, StyleType
|
||||
@@ -56,17 +56,20 @@ class Theme:
|
||||
return theme
|
||||
|
||||
@classmethod
|
||||
def read(cls, path: str, inherit: bool = True) -> "Theme":
|
||||
def read(
|
||||
cls, path: str, inherit: bool = True, encoding: Optional[str] = None
|
||||
) -> "Theme":
|
||||
"""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.
|
||||
|
||||
Returns:
|
||||
Theme: A new theme instance.
|
||||
"""
|
||||
with open(path, "rt") as config_file:
|
||||
with open(path, encoding=encoding) as config_file:
|
||||
return cls.from_file(config_file, source=path, inherit=inherit)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user