gh-113008: Correct argparse usage output for required, mutually exclusive groups (GH-113085)

This commit is contained in:
Payton 2024-09-24 09:14:35 -05:00 committed by GitHub
parent 4a5e4aade4
commit d21b0b5d36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 26 additions and 2 deletions

View file

@ -395,12 +395,12 @@ class HelpFormatter(object):
continue
try:
start = actions.index(group._group_actions[0])
start = min(actions.index(item) for item in group._group_actions)
except ValueError:
continue
else:
end = start + len(group._group_actions)
if actions[start:end] == group._group_actions:
if set(actions[start:end]) == set(group._group_actions):
group_actions.update(group._group_actions)
inserts[start, end] = group