Skip to content

Commit 207b24d

Browse files
committed
DOP-3320: Tighten up snooty.toml constants type definition to help catch some mistakes
1 parent 9fcc8cc commit 207b24d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

snooty/types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class ProjectConfig:
136136
banners: List[BannerConfig] = field(default_factory=list)
137137
# banner_nodes contains parsed banner nodes with target data
138138
banner_nodes: List[ParsedBannerConfig] = field(default_factory=list)
139-
constants: Dict[str, object] = field(default_factory=dict)
139+
constants: Dict[str, Union[str, int, float]] = field(default_factory=dict)
140140
deprecated_versions: Optional[Dict[str, List[str]]] = field(default=None)
141141
intersphinx: List[str] = field(default_factory=list)
142142
sharedinclude_root: Optional[str] = field(default=None)
@@ -191,7 +191,7 @@ def open(cls, root: Path) -> Tuple["ProjectConfig", List[Diagnostic]]:
191191
def render_constants(self) -> Tuple["ProjectConfig", List[Diagnostic]]:
192192
if not self.constants:
193193
return self, []
194-
constants: Dict[str, object] = {}
194+
constants: Dict[str, Union[str, int, float]] = {}
195195
all_diagnostics: List[Diagnostic] = []
196196
for k, v in self.constants.items():
197197
result, diagnostics = self._substitute(str(v), constants)
@@ -223,7 +223,7 @@ def read(
223223

224224
@staticmethod
225225
def _substitute(
226-
source: str, constants: Dict[str, object]
226+
source: str, constants: Dict[str, Union[str, int, float]]
227227
) -> Tuple[str, List[Diagnostic]]:
228228
diagnostics: List[Diagnostic] = []
229229

0 commit comments

Comments
 (0)