Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions configargparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ def get_source_to_settings_dict(self):
Returns:
dict[str, dict[str, tuple[argparse.Action, str]]]: source to settings dict
"""
# _source_to_settings is set in parse_know_args().
# _source_to_settings is set in parse_known_args().
return self._source_to_settings # type:ignore[attribute-error]

def write_config_file(self, parsed_namespace, output_file_paths, exit_after=False):
Expand Down Expand Up @@ -1371,7 +1371,8 @@ def _open_config_files(self, command_line_args):
# Otherwise it sys.exits(..) if, for example, config file
# is_required=True and user doesn't provide it.
def error_method(self, message):
pass
# This line doesn't do anything, and is only here to satisfy linters.
del message # See discussion in PR #330

arg_parser.error = types.MethodType(error_method, arg_parser)

Expand All @@ -1391,7 +1392,7 @@ def error_method(self, message):
stream = self._config_file_open_func(user_config_file)
except Exception as e:
if len(e.args) == 2: # OSError
errno, msg = e.args
_, msg = e.args
else:
msg = str(e)
# close previously opened config files
Expand Down Expand Up @@ -1431,7 +1432,7 @@ def format_values(self):
source = source.split("|")
source = source_key_to_display_value_map[source[0]] % tuple(source[1:])
r.write(source)
for key, (action, value) in settings.items():
for key, (_, value) in settings.items():
if key:
r.write(" {:<19}{}\n".format(key + ":", value))
else:
Expand Down
Loading