yt-dlp: incorrect visibility on parameters
還沒有人認領這個 Issue。
評估
研究方向
從 YoutubeDL 進入點的 yt-dlp stub 開始,特別查看 init 參數註解和 _Params 定義。檢查參數型別如何公開,以及型別檢查器如何推斷一般的 dict。範例選項字典能在沒有回報的引數型別錯誤的情況下被接受,即表示完成。
由索引模型根據 Issue 內容生成。
描述
_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]
- 主要語言
- Python
- 星號
- 5.1k
- 分支
- 2.1k
- 平均合併
- 1 天 13 小時
- 30 天內合併 PR
- 73
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
python/typeshed 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
-
難度 2/5 1-3 小時 新手友好度 68/100
-
project: infrastructure
難度 2/5 1-3 小時 新手友好度 68/100
-
stubs: improvement
難度 2/5 1-3 小時 新手友好度 72/100
-
stubs: improvement
難度 2/5 1-3 小時 新手友好度 64/100
相似的 Issue
-
documentation help wanted
難度 2/5 1-3 小時 新手友好度 90/100
-
難度 2/5 1-3 小時 新手友好度 90/100
simonw/sqlite-utils#872 ·
-
難度 2/5 1-3 小時 新手友好度 88/100
-
難度 2/5 1-3 小時 新手友好度 82/100
-
難度 2/5 1-3 小時 新手友好度 78/100