Initial upload: ConfDoc v0.1.0 - Config validation and documentation generator
This commit is contained in:
18
src/confdoc/parsers/toml_parser.py
Normal file
18
src/confdoc/parsers/toml_parser.py
Normal file
@@ -0,0 +1,18 @@
|
||||
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"
|
||||
Reference in New Issue
Block a user