Skip to content

yt-dlp: incorrect visibility on parameters #16331

Description

@mahyarmirrashed

_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]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions