Tuple of strings parsed as string if one of the strings contains a hyphen
まだ誰も着手していません。
評価
調査の方向性
example.py を使って報告されたコマンドを実行し、ハイフンやその他の記号を含む値のタプル解析を再現します。タプル、リスト、集合、辞書を処理する引数解析のエントリポイントを追跡し、その後、これらのケースのカバレッジを追加または更新します。ハイフンを含む文字列値が repr 形式の引用符を必要とせず、意図したコンテナ内に残れば完了です。
索引モデルが issue の本文から書いたものです。
説明
When parsing in a tuple of strings i can normally pass in comma-separated values with no issues, however if one of the values contains a hyphen the arguments gets parsed as a string instead of a tuple of strings.
Using your provided example.py script
import fire
fire.Fire(lambda obj: type(obj).__name__)
If i call it with multiple strings not containing hyphens i get the expected output
>>> python example.py '(foobar,baz)'
tuple
however, if I call it with a string containing a hyphen (-), I get this unexpected output
>>> python example.py '(foo-bar,baz)'
str
Is this to be expected? I also see that this is an issue with other symbols aswell.
Is there a way to work around this other than to pass in a repr-like string?
E.g, this works, but is not very human friendly:
>>> python example.py '("foo-bar","baz")'
tuple
Edit: This is also the case for lists, sets and dicts containing strings.
- 主要言語
- Python
- スター
- 28.2k
- フォーク
- 1.5k
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
google/python-fire のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
google/python-fire#693 ·
-
Release 0.7.2? オープン
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
google/python-fire#698 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
google/python-fire#672 · コメント 5 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
google/python-fire#665 · コメント 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
google/python-fire#659 · コメント 1 件 ·
google/python-fire の issue をすべて見る
似ている issue
-
Add: hunch オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
DiamondLightSource/dodal#2211 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
openml/openml-python#1749 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
sipyourdrink-ltd/bernstein#6191 ·