Files
confdoc/src/confdoc/parsers/toml_parser.py

19 lines
492 B
Python

import tomlkit
from typing import Any, Dict
class TomlParser:
"""Parser for TOML configuration files."""
def parse(self, content: str) -> Dict[str, Any]:
"""Parse TOML content into a dictionary."""
return tomlkit.parse(content)
def dump(self, data: Dict[str, Any]) -> str:
"""Dump dictionary to TOML string."""
return tomlkit.dumps(data)
def get_format(self) -> str:
"""Return the format name."""
return "toml"