Skip to content
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

add stubs for m3u8 #12683

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

add stubs for m3u8 #12683

wants to merge 6 commits into from

Conversation

DinhHuy2010
Copy link

No description provided.

This comment has been minimized.

Copy link
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. Not a full review, just a few things I noticed.

stubs/m3u8/@tests/stubtest_allowlist.txt Outdated Show resolved Hide resolved
stubs/m3u8/m3u8/__init__.pyi Outdated Show resolved Hide resolved
stubs/m3u8/m3u8/httpclient.pyi Outdated Show resolved Hide resolved
stubs/m3u8/m3u8/httpclient.pyi Outdated Show resolved Hide resolved
stubs/m3u8/m3u8/httpclient.pyi Outdated Show resolved Hide resolved
stubs/m3u8/m3u8/httpclient.pyi Outdated Show resolved Hide resolved

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

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

Copy link
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 notes below. Also, please either add a short comment explaining the allowed types for each Any or change the Anys to Incomplete for now.

@@ -0,0 +1,27 @@
# mypy: disable-error-code="attr-defined"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this necessary. In general, we prefer # type: ignore[attr-defined] on the lines that this actually affects.


_T = TypeVar("_T")

class BasePathMixin(Protocol):
Copy link
Collaborator

Choose a reason for hiding this comment

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

As this is not a protocol at runtime, it shouldn't be a protocol here either.

Comment on lines +14 to +16
@type_check_only
class _PlaylistProtocol(BasePathMixin, metaclass=ABCMeta):
base_uri: str | None
Copy link
Collaborator

Choose a reason for hiding this comment

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

To make this then work correctly, it should be changed to:

Suggested change
@type_check_only
class _PlaylistProtocol(BasePathMixin, metaclass=ABCMeta):
base_uri: str | None
@type_check_only
class _PlaylistProtocol(Protocol):
base_uri: str | None
uri: str | None
@property
def absolute_uri(self) -> str: ...
@property
def base_path(self) -> str: ...
@base_path.setter
def base_path(self, newbase_path: str) -> None: ...
def get_path_from_uri(self) -> str: ...

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.

3 participants