2828 _is_action_value_list ,
2929 _is_branch_key ,
3030 filter_non_parsing_actions ,
31- parent_parsers ,
3231 previous_config ,
3332)
3433from ._common import (
@@ -673,7 +672,6 @@ def _load_config_parser_mode(
673672 cfg_path : Union [str , os .PathLike ] = "" ,
674673 ext_vars : Optional [dict ] = None ,
675674 prev_cfg : Optional [Namespace ] = None ,
676- key : Optional [str ] = None ,
677675 ) -> Namespace :
678676 """Loads a configuration string into a namespace.
679677
@@ -689,8 +687,6 @@ def _load_config_parser_mode(
689687 cfg_dict = load_value (cfg_str , path = cfg_path , ext_vars = ext_vars )
690688 except get_loader_exceptions () as ex :
691689 raise TypeError (f"Problems parsing config: { ex } " ) from ex
692- if key and isinstance (cfg_dict , dict ):
693- cfg_dict = cfg_dict .get (key , {})
694690 if not isinstance (cfg_dict , dict ):
695691 raise TypeError (f"Unexpected config: { cfg_str } " )
696692 return self ._apply_actions (cfg_dict , prev_cfg = prev_cfg )
@@ -949,24 +945,18 @@ def save_paths(cfg):
949945
950946 ## Methods related to defaults ##
951947
952- def _get_default_config_files (self ) -> list [tuple [ Optional [ str ], Path ] ]:
948+ def _get_default_config_files (self ) -> list [Path ]:
953949 if getattr (self , "_inner_parser" , False ):
954950 return []
955951
956952 default_config_files = []
957953
958- for key , parser in parent_parsers .get ():
959- for pattern in parser .default_config_files :
960- files = sorted (glob .glob (os .path .expanduser (pattern )))
961- default_config_files += [(key , v ) for v in files ]
962-
963954 for pattern in self .default_config_files :
964- files = sorted (glob .glob (os .path .expanduser (pattern )))
965- default_config_files += [(None , x ) for x in files ]
955+ default_config_files += sorted (glob .glob (os .path .expanduser (pattern )))
966956
967957 if len (default_config_files ) > 0 :
968958 with suppress (TypeError ):
969- return [( k , Path (v , mode = _get_config_read_mode ())) for k , v in default_config_files ]
959+ return [Path (v , mode = _get_config_read_mode ()) for v in default_config_files ]
970960 return []
971961
972962 def get_default (self , dest : str ) -> Any :
@@ -1017,12 +1007,12 @@ def get_defaults(self, skip_validation: bool = False, **kwargs) -> Namespace:
10171007 self ._logger .debug ("Loaded parser defaults: %s" , cfg )
10181008
10191009 default_config_files = self ._get_default_config_files ()
1020- for key , default_config_file in default_config_files :
1010+ for default_config_file in default_config_files :
10211011 default_config_file_content = default_config_file .get_content ()
10221012 if not default_config_file_content .strip ():
10231013 continue
10241014 with change_to_path_dir (default_config_file ), parser_context (parent_parser = self ):
1025- cfg_file = self ._load_config_parser_mode (default_config_file_content , key = key , prev_cfg = cfg )
1015+ cfg_file = self ._load_config_parser_mode (default_config_file_content , prev_cfg = cfg )
10261016 cfg = self .merge_config (cfg_file , cfg )
10271017 try :
10281018 with _ActionPrintConfig .skip_print_config ():
0 commit comments