Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Pyright diagnostic type incompatible

オープン
#853 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
python
領域
tooling

調査の方向性

traitlets/traitlets.py の 479-497 行目と 135-141 行目から始め、次に Unicode のデフォルト値について報告された Pyright の診断を再現してください。型宣言が示された文字列を受け入れるべきか、または issue で抑制方法や回避策を文書化すべきかを判断してください。期待される診断の動作が確立されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

@magics_class
class SimpleGPTMagics(Magics):
    api_type = Unicode("openai", help="The type of api that will be used to query the models").tag(config=True)

pyright report

Diagnostics:
1. Argument of type "Literal['openai']" cannot be assigned to parameter "default_value" of type "Sentinel" in function "__init__"
     "Literal['openai']" is incompatible with "Sentinel" [reportGeneralTypeIssues]

https://github.com/ipython/traitlets/blob/05d6ecb6b1f90736cdeacf41c7d5e84b147c1dbd/traitlets/traitlets.py#L479-L497

https://github.com/ipython/traitlets/blob/05d6ecb6b1f90736cdeacf41c7d5e84b147c1dbd/traitlets/traitlets.py#L135-L141

Obviously, the argument of TraitType.__init__, default_vaue is infered to Sentinel, what can I do to suppress the diagnostic?

主要言語
Python
スター
653
フォーク
217
平均マージ
2日 21時間
マージ済み PR(30日)
2

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ipython/traitlets のほかの issue

ipython/traitlets の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。