Skip to content

Add yt-dlp stubs #14216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 26, 2025
Prev Previous commit
Next Next commit
More progress fixing Any/object types
  • Loading branch information
Tatsh committed Jul 26, 2025
commit 67c6de255c9c5626f580dd674c29643e7aa549f0
1 change: 1 addition & 0 deletions stubs/yt-dlp/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
version = "2025.05.*"
upstream_repository = "https://github.com/yt-dlp/yt-dlp"
requires = ["websockets"]
6 changes: 3 additions & 3 deletions stubs/yt-dlp/yt_dlp/compat/compat_utils.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import types
from collections.abc import Callable, Collection
from typing import NamedTuple
from typing import Any, NamedTuple

class _Package(NamedTuple):
name: str
Expand All @@ -10,12 +10,12 @@ def get_package_info(module: types.ModuleType) -> _Package: ...

class EnhancedModule(types.ModuleType):
def __bool__(self) -> bool: ...
def __getattribute__(self, attr: str) -> object: ...
def __getattribute__(self, attr: str) -> Any: ...

def passthrough_module(
parent: types.ModuleType,
child: str | types.ModuleType,
allowed_attributes: Collection[str] = ...,
*,
callback: Callable[[object], object] = ...,
callback: Callable[[str], object] = ...,
) -> types.ModuleType: ...
4 changes: 2 additions & 2 deletions stubs/yt-dlp/yt_dlp/downloader/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Mapping
from typing import Literal
from typing import Any, Literal
from typing_extensions import TypeAlias

from ..extractor.common import _InfoDict
Expand All @@ -23,7 +23,7 @@ _Protocol: TypeAlias = Literal[

def get_suitable_downloader(
info_dict: _InfoDict,
params: Mapping[str, object] = ...,
params: Mapping[str, Any] = ...,
default: FileDownloader | type[NO_DEFAULT] = ...,
protocol: _Protocol | None = None,
to_stdout: bool = False,
Expand Down
7 changes: 4 additions & 3 deletions stubs/yt-dlp/yt_dlp/downloader/common.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class _FileDownloaderParams(TypedDict):
class FileDownloader:
params: _FileDownloaderParams | None
def __init__(self, ydl: YoutubeDL, params: _FileDownloaderParams) -> None: ...
def to_screen(self, *args: object, **kargs: object) -> None: ...
def to_screen(self, message: str, skip_eol: bool = False, quiet: bool | None = None, only_once: bool = False) -> None: ...
@property
def FD_NAME(cls) -> str: ...
@staticmethod
Expand Down Expand Up @@ -67,14 +67,15 @@ class FileDownloader:
def temp_name(self, filename: str) -> str: ...
def undo_temp_name(self, filename: str) -> str: ...
def ytdl_filename(self, filename: str) -> str: ...
def wrap_file_access(action: str, *, fatal: bool = False) -> object: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
# Wrapper that can accept arbitrary function.
def wrap_file_access(action: str, *, fatal: bool = False) -> Any: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
def sanitize_open(self, filename: str, open_mode: OpenTextMode | OpenBinaryMode) -> tuple[IO[Any], str]: ...
def try_remove(self, filename: str) -> None: ...
def try_rename(self, old_filename: str, new_filename: str) -> None: ...
def try_utime(self, filename: str, last_modified_hdr: str | None) -> int | None: ...
def report_destination(self, filename: str) -> None: ...
ProgressStyles: Namespace
def report_progress(self, s: Mapping[str, object]) -> None: ...
def report_progress(self, s: Mapping[str, Any]) -> None: ...
def report_resuming_byte(self, resume_len: int) -> None: ...
def report_retry(
self, err: str, count: int, retries: int, frag_index: int | type[NO_DEFAULT] = ..., fatal: bool = True
Expand Down
6 changes: 3 additions & 3 deletions stubs/yt-dlp/yt_dlp/downloader/external.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import enum
import functools
from _typeshed import Unused
from collections.abc import Iterable, Mapping
from typing import Literal
from typing import Any, Literal

from ..extractor.common import _InfoDict
from .fragment import FragmentFD
Expand Down Expand Up @@ -41,7 +41,7 @@ class Aria2cFD(ExternalFD):
SUPPORTED_PROTOCOLS: tuple[str, ...]
@staticmethod
def supports_manifest(manifest: str) -> bool: ...
def aria2c_rpc(self, rpc_port: int, rpc_secret: str, method: str, params: Iterable[str] = ()) -> object: ...
def aria2c_rpc(self, rpc_port: int, rpc_secret: str, method: str, params: Iterable[str] = ()) -> Any: ...

class HttpieFD(ExternalFD):
AVAILABLE_OPT: str
Expand All @@ -54,7 +54,7 @@ class FFmpegFD(ExternalFD):
def available(cls, path: str | None = None) -> bool: ... # type: ignore[override]
def on_process_started(self, proc: Unused, stdin: Unused) -> None: ...
@classmethod
def can_merge_formats(cls, info_dict: _InfoDict, params: Mapping[str, object]) -> bool: ...
def can_merge_formats(cls, info_dict: _InfoDict, params: Mapping[str, Any]) -> bool: ...

class AVconvFD(FFmpegFD): ...

Expand Down
19 changes: 14 additions & 5 deletions stubs/yt-dlp/yt_dlp/downloader/fragment.pyi
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
from collections.abc import Callable, Collection, Mapping, Sequence
from concurrent.futures.thread import ThreadPoolExecutor
from typing import Any

from ..extractor.common import _InfoDict
from .common import FileDownloader
from .http import HttpFD

class HttpQuietDownloader(HttpFD):
def to_screen(self, *args: object, **kargs: object) -> None: ...
def to_screen(self, *args: Any, **kargs: Any) -> None: ... # This method is a no-op.
to_console_title = to_screen

class FragmentFD(FileDownloader):
def report_retry_fragment(self, err: str, frag_index: int, count: int, retries: int) -> None: ...
def report_skip_fragment(self, frag_index: int, err: str | None = None) -> None: ...
def decrypter(self, info_dict: _InfoDict) -> Callable[[Mapping[str, object], bytes], bytes]: ...
def download_and_append_fragments_multiple(self, *args: object, **kwargs: object) -> bool: ...
def decrypter(self, info_dict: _InfoDict) -> Callable[[Mapping[str, Any], bytes], bytes]: ...
def download_and_append_fragments_multiple(
self,
*args: tuple[Mapping[str, Any], Collection[Mapping[str, Any]], _InfoDict],
is_fatal: Callable[[int], bool] = ...,
pack_func: Callable[[str, int], bytes] = ...,
finish_func: Callable[[], Any] | None = None,
tpe: ThreadPoolExecutor | None = None,
interrupt_trigger: Sequence[bool] = (True,),
) -> bool: ...
def download_and_append_fragments(
self,
ctx: Mapping[str, object],
fragments: Collection[Mapping[str, object]],
ctx: Mapping[str, Any],
fragments: Collection[Mapping[str, Any]],
info_dict: _InfoDict,
*,
is_fatal: Callable[[int], bool] = ...,
Expand Down
Loading
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy