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
@@ -1,8 +1,9 @@
from collections.abc import Callable
from gettext import NullTranslations
from typing import Any, Protocol
from typing import Any, Protocol, type_check_only
from typing_extensions import Self
@type_check_only
class _TranslationStringFactory(Protocol):
def __call__(
self,
@@ -12,6 +13,7 @@ class _TranslationStringFactory(Protocol):
context: str | None = ...,
) -> TranslationString: ...
@type_check_only
class _ChameleonTranslate(Protocol):
def __call__(
self,
@@ -22,9 +24,11 @@ class _ChameleonTranslate(Protocol):
default: str | None = ...,
) -> TranslationString: ...
@type_check_only
class _TranslatorPolicy(Protocol):
def __call__(self, translations: NullTranslations, tstring: str, domain: str | None, context: str | None) -> str: ...
@type_check_only
class _Translator(Protocol):
def __call__(
self,
@@ -34,11 +38,13 @@ class _Translator(Protocol):
context: str | None = None,
) -> str: ...
@type_check_only
class _PluralizerPolicy(Protocol):
def __call__(
self, translations: NullTranslations, singular: str, plural: str, n: int, domain: str | None, context: str | None
) -> str: ...
@type_check_only
class _Pluralizer(Protocol):
def __call__(
self,