@@ -78,7 +78,7 @@ def extract_repos(
7878 for directory , repos in config .items ():
7979 assert isinstance (repos , dict )
8080 for repo , repo_data in repos .items ():
81- conf : dict [str , t . Any ] = {}
81+ conf : dict [str , object ] = {}
8282
8383 """
8484 repo_name: http://myrepo.com/repo.git
@@ -93,7 +93,10 @@ def extract_repos(
9393 if isinstance (repo_data , (str , pathlib .Path )):
9494 conf ["url" ] = str (repo_data )
9595 else :
96- conf = update_dict (conf , repo_data )
96+ conf = update_dict (
97+ conf ,
98+ t .cast ("dict[str, object]" , repo_data ),
99+ )
97100
98101 if "repo" in conf :
99102 if "url" not in conf :
@@ -108,9 +111,9 @@ def extract_repos(
108111 conf ["workspace_root" ] = directory
109112
110113 if "path" not in conf :
114+ name = t .cast ("str" , conf ["name" ])
111115 conf ["path" ] = expand_dir (
112- pathlib .Path (expand_dir (pathlib .Path (directory ), cwd = cwd ))
113- / conf ["name" ],
116+ pathlib .Path (expand_dir (pathlib .Path (directory ), cwd = cwd )) / name ,
114117 cwd ,
115118 )
116119
@@ -133,7 +136,7 @@ def extract_repos(
133136 ** url ,
134137 )
135138
136- def is_valid_config_dict (val : t . Any ) -> t .TypeGuard [ConfigDict ]:
139+ def is_valid_config_dict (val : object ) -> t .TypeGuard [ConfigDict ]:
137140 assert isinstance (val , dict )
138141 return True
139142
@@ -460,7 +463,10 @@ def is_config_file(
460463 return any (filename .endswith (e ) for e in extensions )
461464
462465
463- def save_config_yaml (config_file_path : pathlib .Path , data : dict [t .Any , t .Any ]) -> None :
466+ def save_config_yaml (
467+ config_file_path : pathlib .Path ,
468+ data : t .Mapping [str , object ],
469+ ) -> None :
464470 """Save configuration data to a YAML file.
465471
466472 Parameters
@@ -472,23 +478,23 @@ def save_config_yaml(config_file_path: pathlib.Path, data: dict[t.Any, t.Any]) -
472478 """
473479 yaml_content = ConfigReader ._dump (
474480 fmt = "yaml" ,
475- content = data ,
481+ content = t . cast ( "dict[str, object]" , data ) ,
476482 indent = 2 ,
477483 )
478484 config_file_path .write_text (yaml_content , encoding = "utf-8" )
479485
480486
481487def save_config_yaml_with_items (
482488 config_file_path : pathlib .Path ,
483- items : list [tuple [str , t . Any ]],
489+ items : list [tuple [str , object ]],
484490) -> None :
485491 """Persist configuration data while preserving duplicate top-level sections."""
486492 documents : list [str ] = []
487493
488494 for label , section in items :
489495 dumped = ConfigReader ._dump (
490496 fmt = "yaml" ,
491- content = {label : section },
497+ content = t . cast ( "dict[str, object]" , {label : section }) ,
492498 indent = 2 ,
493499 ).rstrip ()
494500 if dumped :
@@ -503,8 +509,8 @@ def save_config_yaml_with_items(
503509
504510def merge_duplicate_workspace_root_entries (
505511 label : str ,
506- occurrences : list [t . Any ],
507- ) -> tuple [t . Any , list [str ], int ]:
512+ occurrences : list [object ],
513+ ) -> tuple [object , list [str ], int ]:
508514 """Merge duplicate entries for a single workspace root."""
509515 conflicts : list [str ] = []
510516 change_count = max (len (occurrences ) - 1 , 0 )
@@ -521,7 +527,7 @@ def merge_duplicate_workspace_root_entries(
521527 )
522528 return occurrences [- 1 ], conflicts , change_count
523529
524- merged : dict [str , t . Any ] = {}
530+ merged : dict [str , object ] = {}
525531
526532 for entry in occurrences :
527533 assert isinstance (entry , dict )
@@ -540,9 +546,9 @@ def merge_duplicate_workspace_root_entries(
540546
541547
542548def merge_duplicate_workspace_roots (
543- config_data : dict [str , t . Any ],
544- duplicate_roots : dict [str , list [t . Any ]],
545- ) -> tuple [dict [str , t . Any ], list [str ], int , list [tuple [str , int ]]]:
549+ config_data : dict [str , object ],
550+ duplicate_roots : dict [str , list [object ]],
551+ ) -> tuple [dict [str , object ], list [str ], int , list [tuple [str , int ]]]:
546552 """Merge duplicate workspace root sections captured during load."""
547553 if not duplicate_roots :
548554 return copy .deepcopy (config_data ), [], 0 , []
@@ -610,17 +616,17 @@ def workspace_root_label(
610616
611617
612618def normalize_workspace_roots (
613- config_data : dict [str , t . Any ],
619+ config_data : t . Mapping [str , object ],
614620 * ,
615621 cwd : pathlib .Path | None = None ,
616622 home : pathlib .Path | None = None ,
617623 preserve_cwd_label : bool = True ,
618- ) -> tuple [dict [str , t . Any ], dict [pathlib .Path , str ], list [str ], int ]:
624+ ) -> tuple [dict [str , object ], dict [pathlib .Path , str ], list [str ], int ]:
619625 """Normalize workspace root labels and merge duplicate sections."""
620626 cwd = cwd or pathlib .Path .cwd ()
621627 home = home or pathlib .Path .home ()
622628
623- normalized : dict [str , t . Any ] = {}
629+ normalized : dict [str , object ] = {}
624630 path_to_label : dict [pathlib .Path , str ] = {}
625631 conflicts : list [str ] = []
626632 change_count = 0
0 commit comments