""" Config related tools. """ import dataclasses import yaml from typing import Optional @dataclasses.dataclass class Config: username: str homeserver: str password: str rooms: list[str] def load_config(file:str)->Config: """ Load the config from the config file. """ with open(file, 'r') as f: data = yaml.load(f, Loader=yaml.loader.SafeLoader) config = Config(**data) return config