def load(path: pathlib.Path) -> Config:
"""Load configuration from given path."""
if not path.exists():
error('File do not exists.')
if not path.is_file():
error('Given path is not file.')
if not path.match('*.config.toml'):
error('File suffix must be *.config.toml')
config = Config(copy.deepcopy(DEFAULT))
config.update(toml.load(path.open()))
return config
评论列表
文章目录