Skip to content

[yt-dlp] Add typing for postprocessor_hooks#15810

Open
Soulsuck24 wants to merge 1 commit into
python:mainfrom
Soulsuck24:patch-1
Open

[yt-dlp] Add typing for postprocessor_hooks#15810
Soulsuck24 wants to merge 1 commit into
python:mainfrom
Soulsuck24:patch-1

Conversation

@Soulsuck24
Copy link
Copy Markdown

Adds typing for postprocessor_hooks in init.pyi

@github-actions
Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Copy Markdown
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! A few optional requests:

  • Could you copy the hook signature to YoutubeDL.add_progress_hook?
  • Also I noticed, there's something called post_hooks which is also missing. Could you add that? It's fine to leave it as post_hooks: Iterable[Callable[[Incomplete], object] for now if you don't want to dig into what argument that takes.

write_pages: bool | None
external_downloader_args: Literal["default"] | Mapping[str, Collection[str]] | Collection[str] | None
postprocessor_args: Mapping[str, Collection[str]] | Collection[str] | None
postprocessor_hooks: list[Callable[[dict[str, Any]], object]] | None
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see, this can not be None. Also, it works with any Iterable:

https://github.com/yt-dlp/yt-dlp/blob/32f1671a906bf375e5b5d39433dd13f917a8dfa7/yt_dlp/YoutubeDL.py#L817-L824

Suggested change
postprocessor_hooks: list[Callable[[dict[str, Any]], object]] | None
postprocessor_hooks: Iterable[Callable[[dict[str, Any]], object]]

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants