8000 gh-101979: fix a bug that parentheses in metavar argument of add_argument() were dropped by yeojin-dev · Pull Request #102318 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-101979: fix a bug that parentheses in metavar argument of add_argument() were dropped #102318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 5, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Refactor code
  • Loading branch information
yeojin-dev committed Mar 1, 2023
commit 74c14ceda6e40e555282696afed22b9eefe0418b
5 changes: 3 additions & 2 deletions Lib/argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,8 @@ def _format_actions_usage(self, actions, groups):
except ValueError:
continue
else:
end = start + len(group._group_actions)
group_action_count = len(group._group_actions)
end = start + group_action_count
if actions[start:end] == group._group_actions:

suppressed_actions_count = 0
Expand All @@ -412,7 +413,7 @@ def _format_actions_usage(self, actions, groups):
if action.help is SUPPRESS:
suppressed_actions_count += 1

exposed_actions_count = len(group._group_actions) - suppressed_actions_count
exposed_actions_count = group_action_count - suppressed_actions_count

if not group.required:
if start in inserts:
Expand Down
0