If the default value for Unicode is traitlets.Undefined, then why is it type string when tested? How can you enforce CLI definition of an attribute if it self-massages to ""?
まだ誰も着手していません。
評価
調査の方向性
まず、Unicode、Application、aliases、config=True、Application.launch_instance()を使った例を再現します。次に、Unicode のデフォルト処理と CLI の設定パスを調べ、ドキュメントに記載された Undefined の動作と、観測された空文字列を比較します。動作が説明または修正され、CLI で定義された属性を意図どおり適用することがテストでカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
The code below shows that even though x is never given a value, it is an empty string.
Why do the docs for Unicode state default_value=traitlets.Undefined yet the type is string when tested?
from traitlets.config import Application
from traitlets import List, Dict, Integer, Unicode
class App(Application):
aliases = {"x": "App.x", "y": "App.y"}
x = Unicode().tag(config=True)
y = Unicode().tag(config=True)
def start(self):
print(f"typex = {type(self.x)} val={self.x}")
print(f"y={self.y}")
if __name__ == "__main__":
App.launch_instance()
Output
typex = <class 'str'> val=
y=
- 主要言語
- Python
- スター
- 653
- フォーク
- 217
- 平均マージ
- 2日 21時間
- マージ済み PR(30日)
- 2
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ipython/traitlets のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
-
難易度 1/5 1〜3時間 初心者へのやさしさ 65/100
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
ipython/traitlets の issue をすべて見る
似ている issue
-
area: harness bug status: needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Human-Agent-Society/reef#625 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
learningequality/kolibri#15351 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Name consistency オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
eellak/triplestore#65 · コメント 1 件 ·