Exemplo n.º 1
0
 def fix_default(self, action: Action) -> None:
     if hasattr(action, "default") and hasattr(
             action, "dest") and action.default != SUPPRESS:
         of_type = self.get_type(action)
         key = action.dest
         outcome = get_env_var(key, of_type=of_type)
         if outcome is None and self.file_config:
             outcome = self.file_config.get(key, of_type=of_type)
         if outcome is not None:
             action.default, action.default_source = outcome
     # noinspection PyProtectedMember
     if isinstance(action, argparse._SubParsersAction):
         for values in action.choices.values():
             values.fix_defaults()