"""Conference classes and functions.""" import configparser import os import typing from datetime import date import yaml from dotenv import load_dotenv load_dotenv() config_file_path = os.path.expanduser( os.path.join( os.getenv("XDG_CONFIG_HOME", "~/.config"), "conference-check", "config" ) ) assert os.path.exists(config_file_path) config = configparser.ConfigParser() config.read(os.path.expanduser(config_file_path)) class LiveConference(typing.TypedDict, total=False): """Live conference.""" conference: str year: int live: date url: str | None def load_yaml(name: str) -> typing.Any: """Load YAML.""" filename = os.path.expanduser(config["data"][name]) assert os.path.exists(filename) return yaml.safe_load(open(filename))