Skip to content

Commit ffbfcb5

Browse files
committed
update
1 parent 6e80e18 commit ffbfcb5

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

confdantic/confdantic.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import json
22
import os
3-
import typing as T
3+
from typing import Literal
44

55
import toml
66
import tomlkit
@@ -25,7 +25,7 @@ def file_ext(filepath: str):
2525

2626

2727
def get_comment(
28-
field: FieldInfo, format: T.Literal["json", "yaml", "toml"], add_choices: bool = True
28+
field: FieldInfo, format: Literal["json", "yaml", "toml"], add_choices: bool = True
2929
) -> str | None:
3030
"""
3131
Generate a comment string for a Pydantic field, including description and choices if they exist.
@@ -182,7 +182,7 @@ def load_json(cls, filepath: str):
182182
with open(filepath, "r") as f:
183183
return cls.model_validate(json.load(f))
184184

185-
def save_toml(self, filepath: str, overwrite: bool = True, comments: bool = True):
185+
def save_toml(self, filepath: str, overwrite: bool = True, comments: bool = True) -> None:
186186
if os.path.exists(filepath) and not overwrite:
187187
raise FileExistsError(filepath)
188188
data = self.model_dump()
@@ -219,14 +219,14 @@ def save_toml(self, filepath: str, overwrite: bool = True, comments: bool = True
219219
with open(filepath, "w") as f:
220220
tomlkit.dump(toml_doc, f)
221221

222-
def save_json(self, filepath: str, overwrite: bool = True):
222+
def save_json(self, filepath: str, overwrite: bool = True) -> None:
223223
if os.path.exists(filepath) and not overwrite:
224224
raise FileExistsError(filepath)
225225
data = self.model_dump()
226226
with open(filepath, "w") as f:
227227
json.dump(data, f)
228228

229-
def save_yaml(self, filepath: str, overwrite: bool = True, comments: bool = True):
229+
def save_yaml(self, filepath: str, overwrite: bool = True, comments: bool = True) -> None:
230230
if os.path.exists(filepath) and not overwrite:
231231
raise FileExistsError(filepath)
232232

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ requires-python = ">=3.10"
99
dependencies = [
1010
"pydantic>=2.8.2",
1111
"objinspect>=0.2.13",
12-
"tomlkit==0.12.3",
12+
"tomlkit>=0.12.3",
1313
"toml==0.10.2",
1414
"ruamel.yaml>=0.18.6",
1515
]

0 commit comments

Comments
 (0)