python / python/typeshed

yt-dlp: incorrect visibility on parameters

オープン 初心者向け
#16,331 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

主要言語
Python
スター
5.1k
フォーク
2.1k
平均マージ
1日 19時間
マージ済み PR(30日)
82

説明

_Params should be public. Submitting a normal dict as a file will mismatch with the TypedDict because the type-checker will infer dict[str,bool] instead of _Params. See the example snippet:

def fetch_channel_info(channel: str) -> tuple[str, str, list[str]]:
    """Return (channel_id, channel_handle, video_ids)."""
    opts = {"quiet": True, "extract_flat": True}

    with yt_dlp.YoutubeDL(opts) as ydl:
        info = ydl.extract_info(channel, download=False)

which results in

     ├╴E Argument of type "dict[str, bool]" cannot be assigned to parameter "params" of type "_Params | None" in function "__init__"
     │     Type "dict[str, bool]" is not assignable to type "_Params | None"
     │       "dict[str, bool]" is not assignable to "_Params"
     │       "dict[str, bool]" is not assignable to "None" basedpyright (reportArgumentType) [48, 27]

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

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

はじめの一歩

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

調査の方向性

YoutubeDL エントリーポイントの yt-dlp スタブから始め、特に init のパラメーターアノテーションと _Params の定義を確認します。パラメーター型がどのように公開され、通常の dict が型チェッカーによってどのように推論されるかを確認してください。例のオプション辞書が、報告された引数型エラーなしで受け入れられれば完了です。

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

評価

技術スタック
python
領域
tooling
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
76/100

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

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