mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
Mark stub-only private symbols as @type_check_only in third-party stubs (#14545)
This commit is contained in:
@@ -9,10 +9,6 @@ __all__ = ["tzname_in_python2", "enfold"]
|
||||
def tzname_in_python2(namefunc): ...
|
||||
def enfold(dt: datetime, fold: int = 1): ...
|
||||
|
||||
class _DatetimeWithFold(datetime):
|
||||
@property
|
||||
def fold(self): ...
|
||||
|
||||
# Doesn't actually have ABCMeta as the metaclass at runtime,
|
||||
# but mypy complains if we don't have it in the stub.
|
||||
# See discussion in #8908
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from datetime import datetime, timedelta, tzinfo
|
||||
from typing import ClassVar, Literal, Protocol, TypeVar
|
||||
from typing import ClassVar, Literal, Protocol, TypeVar, type_check_only
|
||||
|
||||
from ..relativedelta import relativedelta
|
||||
from ._common import _tzinfo, enfold as enfold, tzrangebase
|
||||
@@ -68,6 +68,7 @@ class _ttinfo:
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __ne__(self, other): ...
|
||||
|
||||
@type_check_only
|
||||
class _TZFileReader(Protocol):
|
||||
# optional attribute:
|
||||
# name: str
|
||||
@@ -106,6 +107,7 @@ class tzstr(tzrange):
|
||||
@classmethod
|
||||
def instance(cls, name, offset) -> tzoffset: ...
|
||||
|
||||
@type_check_only
|
||||
class _ICalReader(Protocol):
|
||||
# optional attribute:
|
||||
# name: str
|
||||
@@ -123,6 +125,8 @@ def datetime_exists(dt: datetime, tz: tzinfo | None = None) -> bool: ...
|
||||
def datetime_ambiguous(dt: datetime, tz: tzinfo | None = None) -> bool: ...
|
||||
def resolve_imaginary(dt: datetime) -> datetime: ...
|
||||
|
||||
# Singleton type defined locally in a function. Calls itself "GettzFunc".
|
||||
@type_check_only
|
||||
class _GetTZ:
|
||||
def __call__(self, name: str | None = ...) -> tzinfo | None: ...
|
||||
def nocache(self, name: str | None) -> tzinfo | None: ...
|
||||
|
||||
Reference in New Issue
Block a user