def from_file(path: Path) -> "RedVoxConfig": """ Attempts to load the configuration from a TOML file. :return: An instance of RedvoxConfig or raises a RedvoxError. """ with open(path, "r") as toml_in: content: str = toml_in.read() try: return from_toml(RedVoxConfig, content) except Exception as e: raise errors.RedVoxError( f"Error parsing RedVox configuration file: {e}")
def main(): with open('Pipfile') as f: toml = f.read() pip = from_toml(Pipfile, toml) print(pip)
def _load_config(dir: str) -> Config: with open(_config_path(dir)) as config_file: return from_toml(Config, config_file.read())