Mark stub-only private symbols as @type_check_only in third-party stubs (#14545)

This commit is contained in:
Brian Schubert
2025-08-08 05:29:48 -04:00
committed by GitHub
parent a358dc24e8
commit 81c8fcb2e6
131 changed files with 334 additions and 147 deletions
+2 -1
View File
@@ -1,11 +1,12 @@
from collections.abc import MutableMapping
from typing import Protocol
from typing import Protocol, type_check_only
from typing_extensions import TypeAlias
from bleach import _HTMLAttrKey
_HTMLAttrs: TypeAlias = MutableMapping[_HTMLAttrKey, str]
@type_check_only
class _Callback(Protocol): # noqa: Y046
def __call__(self, attrs: _HTMLAttrs, new: bool = ..., /) -> _HTMLAttrs: ...
+2 -1
View File
@@ -1,7 +1,7 @@
import re
from codecs import CodecInfo
from collections.abc import Generator, Iterable, Iterator
from typing import Any, Final, Protocol
from typing import Any, Final, Protocol, type_check_only
# We don't re-export any `html5lib` types / values here, because they are not
# really public and may change at any time. This is just a helper module,
@@ -14,6 +14,7 @@ from html5lib.serializer import HTMLSerializer
from html5lib.treewalkers.base import TreeWalker
# Is actually webencodings.Encoding
@type_check_only
class _Encoding(Protocol):
name: str
codec_info: CodecInfo