@@ -61,7 +61,7 @@ class Config:
6161
6262 def __init__ (
6363 self ,
64- data : dict | None = None , # Internal/testing use only
64+ data : dict [ str , Any ] | None = None , # Internal/testing use only
6565 * , # Rest are keyword-only
6666 globals : dict [str , Any ] | None = None ,
6767 schema : type | None = None ,
@@ -88,7 +88,7 @@ def __init__(
8888 >>> # Chaining
8989 >>> config = Config(schema=MySchema).update("config.yaml")
9090 """
91- self ._data : dict = data or {} # Start with provided data or empty
91+ self ._data : dict [ str , Any ] = data or {} # Start with provided data or empty
9292 self ._metadata = MetadataRegistry ()
9393 self ._resolver = Resolver ()
9494 self ._is_parsed = False
@@ -163,7 +163,7 @@ def set(self, id: str, value: Any) -> None:
163163
164164 # Ensure root is dict
165165 if not isinstance (self ._data , dict ):
166- self ._data = {}
166+ self ._data = {} # type: ignore[unreachable]
167167
168168 # Create missing intermediate paths
169169 current = self ._data
@@ -231,7 +231,7 @@ def is_frozen(self) -> bool:
231231 """
232232 return self ._frozen
233233
234- def update (self , source : PathLike | dict | "Config" | str ) -> "Config" :
234+ def update (self , source : PathLike | dict [ str , Any ] | "Config" | str ) -> "Config" :
235235 """Update configuration with changes from another source.
236236
237237 Auto-detects strings as either file paths or CLI overrides:
@@ -315,15 +315,15 @@ def _update_from_config(self, source: "Config") -> None:
315315 self ._metadata .merge (source ._metadata )
316316 self ._invalidate_resolution ()
317317
318- def _uses_nested_paths (self , source : dict ) -> bool :
318+ def _uses_nested_paths (self , source : dict [ str , Any ] ) -> bool :
319319 """Check if dict uses :: path syntax."""
320320 return any (ID_SEP_KEY in str (k ).lstrip (REPLACE_KEY ).lstrip (REMOVE_KEY ) for k in source .keys ())
321321
322- def _apply_path_updates (self , source : dict ) -> None :
322+ def _apply_path_updates (self , source : dict [ str , Any ] ) -> None :
323323 """Apply nested path updates (e.g., model::lr=value, =model=replace, ~old::param=null)."""
324324 for key , value in source .items ():
325325 if not isinstance (key , str ):
326- self .set (str (key ), value )
326+ self .set (str (key ), value ) # type: ignore[unreachable]
327327 continue
328328
329329 if key .startswith (REPLACE_KEY ):
@@ -364,7 +364,7 @@ def _delete_nested_key(self, key: str) -> None:
364364 del self ._data [key ]
365365 self ._invalidate_resolution ()
366366
367- def _apply_structural_update (self , source : dict ) -> None :
367+ def _apply_structural_update (self , source : dict [ str , Any ] ) -> None :
368368 """Apply structural update with operators."""
369369 validate_operators (source )
370370 self ._data = apply_operators (self ._data , source )
@@ -546,15 +546,15 @@ def __repr__(self) -> str:
546546 return f"Config({ self ._data } )"
547547
548548 @staticmethod
549- def export_config_file (config : dict , filepath : PathLike , ** kwargs : Any ) -> None :
549+ def export_config_file (config : dict [ str , Any ] , filepath : PathLike , ** kwargs : Any ) -> None :
550550 """Export config to YAML file.
551551
552552 Args:
553553 config: Config dict to export
554554 filepath: Target file path
555555 kwargs: Additional arguments for yaml.safe_dump
556556 """
557- import yaml
557+ import yaml # type: ignore[import-untyped]
558558
559559 filepath_str = str (Path (filepath ))
560560 with open (filepath_str , "w" ) as f :
@@ -599,7 +599,7 @@ def parse_overrides(args: list[str]) -> dict[str, Any]:
599599 """
600600 import ast
601601
602- overrides = {}
602+ overrides : dict [ str , Any ] = {}
603603
604604 for arg in args :
605605 # Handle delete operator: ~key
0 commit comments