Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions stubs/yt-dlp/@tests/test_cases/check_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from yt_dlp import YoutubeDL, YoutubeDLOptions

options: YoutubeDLOptions = {"quiet": True, "extract_flat": True}
Comment thread
ryux1 marked this conversation as resolved.
Outdated
YoutubeDL(options)

YoutubeDL({"quiet": "yes"}) # type: ignore[arg-type]
6 changes: 3 additions & 3 deletions stubs/yt-dlp/yt_dlp/YoutubeDL.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ from yt_dlp.cookies import YoutubeDLCookieJar
from yt_dlp.networking import RequestDirector, RequestHandler, Response
from yt_dlp.utils import Namespace

from . import _Params
from . import YoutubeDLOptions
from .extractor.common import InfoExtractor, _InfoDict
from .postprocessor.common import PostProcessor
from .utils._utils import _ProgressState

_FormatSelector: TypeAlias = Callable[[Mapping[str, Any]], Iterator[Any]]

class YoutubeDL:
params: _Params
params: YoutubeDLOptions
cache: Cache
format_selector: _FormatSelector
archive: set[str]
def __init__(self, params: _Params | None = None, auto_init: bool = True) -> None: ...
def __init__(self, params: YoutubeDLOptions | None = None, auto_init: bool = True) -> None: ...
def warn_if_short_id(self, argv: list[str]) -> None: ...
def add_info_extractor(self, ie: InfoExtractor) -> None: ...
def get_info_extractor(self, ie_key: str) -> InfoExtractor: ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/yt-dlp/yt_dlp/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ _ProgressTemplate = TypedDict(
)

@type_check_only
class _Params(TypedDict, total=False):
class YoutubeDLOptions(TypedDict, total=False):
usenetrc: bool | None
netrc_location: str | None
netrc_cmd: str | None
Expand Down Expand Up @@ -245,7 +245,7 @@ class _ParsedOptions(NamedTuple):
parser: optparse.OptionParser
options: optparse.Values
urls: Collection[str]
ydl_opts: _Params
ydl_opts: YoutubeDLOptions

def parse_options(argv: Collection[str] | None = None) -> _ParsedOptions: ...
def main(argv: list[str] | None = None) -> int: ...
12 changes: 6 additions & 6 deletions stubs/yt-dlp/yt_dlp/utils/_utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ from xml.etree import ElementTree as ET

from yt_dlp.networking import Response

from .. import _Params
from .. import YoutubeDLOptions
from ..extractor.common import InfoExtractor, _InfoDict
from ..globals import WINDOWS_VT_MODE as WINDOWS_VT_MODE
from ..options import _YoutubeDLOptionParser
Expand Down Expand Up @@ -516,16 +516,16 @@ def parse_dfxp_time_expr(time_expr: str | None) -> int | None: ...
def srt_subtitles_timecode(seconds: float) -> str: ...
def ass_subtitles_timecode(seconds: float) -> str: ...
def dfxp2srt(dfxp_data: bytes) -> str: ...
def cli_option(params: _Params, command_option: str, param: str, separator: str | None = None) -> Any: ...
def cli_option(params: YoutubeDLOptions, command_option: str, param: str, separator: str | None = None) -> Any: ...
def cli_bool_option(
params: _Params,
params: YoutubeDLOptions,
command_option: str,
param: bool | None,
true_value: str = "true",
false_value: str = "false",
separator: str | None = None,
) -> Any: ...
def cli_valueless_option(params: _Params, command_option: str, param: str, expected_value: bool = True) -> Any: ...
def cli_valueless_option(params: YoutubeDLOptions, command_option: str, param: str, expected_value: bool = True) -> Any: ...
def cli_configuration_args(argdict: dict[str, Any], keys: Iterable[str], default: Any = [], use_compat: bool = True) -> Any: ...

class ISO639Utils:
Expand Down Expand Up @@ -673,8 +673,8 @@ class FormatSorter:
ytdl_default: tuple[str, ...]
settings: dict[str, Any]
ydl: YoutubeDL
def __init__(self, ydl: YoutubeDL, field_preference: _Params) -> None: ...
def evaluate_params(self, params: _Params, sort_extractor: Collection[str]) -> None: ...
def __init__(self, ydl: YoutubeDL, field_preference: YoutubeDLOptions) -> None: ...
def evaluate_params(self, params: YoutubeDLOptions, sort_extractor: Collection[str]) -> None: ...
def print_verbose_info(self, write_debug: Callable[..., None]) -> None: ...
def calculate_preference(self, format: dict[str, Any]) -> tuple[int, ...]: ...

Expand Down