argparse exclusive argument group error unintelligible
まだ誰も着手していません。
評価
調査の方向性
レポートに示されている argparse の mutually exclusive-group エントリーポイントから始め、--stdout も repository も指定せずにコマンドを再現してください。結果として出力される必須引数の診断と既存のカバレッジを追跡します。完了条件は、ユーザー向けメッセージが文法的に正しく要件を明確に説明し、このケースの回帰テストがあることです。
索引モデルが issue の本文から書いたものです。
説明
Bug report
Bug description:
import argparse
import os.path
parser = argparse.ArgumentParser()
parser.add_argument(
"--debug",
action="store_true",
help="print out debugging information",
)
# Added optional branch argument
parser.add_argument(
"-b",
"--branch",
default="main",
help="branch name to store commits in (default: main)",
)
parser.add_argument(
"--non-interactive",
action="store_true",
help="disable interactive prompts for missing author information, pass --yes to lfs import",
)
parser.add_argument(
"--template",
default=os.path.join(
os.path.dirname(__file__), "template"
),
help="add files from this directory to every revision",
)
parser.add_argument(
"--object-format",
default="sha256",
help="git object format to use (default: sha256)",
)
parser.add_argument(
"--changelog",
nargs="?",
const=pkg_base,
help="use changelog for commit messages, "
f"package name is guessed ({pkg_base}) or can be specified",
)
repo_group = parser.add_mutually_exclusive_group(required=True)
repo_group.add_argument(
"--stdout",
action="store_true",
help="output git fast-import data to stdout",
)
repo_group.add_argument(
"repository",
nargs="?",
help="import package into this git repository if --stdout is not given",
)
args = parser.parse_args()
$ python3 osc_fast_export.py
usage: osc_fast_export.py [-h] [--debug] [-b BRANCH] [--non-interactive] [--template TEMPLATE]
[--object-format OBJECT_FORMAT] [--changelog [CHANGELOG]] (--stdout |
repository)
osc_fast_export.py: error: one of the arguments --stdout repository is required
The sentence
one of the arguments --stdout repository is required
is unintelligible. I wrote the code so I know why the output is like this but this is supposed to be read by a user who never looked at the code. The grammar of that sentence is broken.
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
- gh-157134
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 558
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python/cpython のほかの issue
-
docs pending
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
stdlib type-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
stdlib type-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
build type-bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
stdlib topic-email type-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
似ている issue
-
link-check link-check:sphinx-theme
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
OpenHands/extensions#626 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
CSCfi/sd-search-api#39 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100