Use PEP 570 syntax in stdlib (#11250)

This commit is contained in:
Shantanu
2024-03-09 14:50:16 -08:00
committed by GitHub
parent 63737acac6
commit 470a13ab09
139 changed files with 2412 additions and 2371 deletions

View File

@@ -7,8 +7,8 @@ from typing_extensions import Self
__all__ = ["ZoneInfo", "reset_tzpath", "available_timezones", "TZPATH", "ZoneInfoNotFoundError", "InvalidTZPathWarning"]
class _IOBytes(Protocol):
def read(self, __size: int) -> bytes: ...
def seek(self, __size: int, __whence: int = ...) -> Any: ...
def read(self, size: int, /) -> bytes: ...
def seek(self, size: int, whence: int = ..., /) -> Any: ...
class ZoneInfo(tzinfo):
@property
@@ -17,12 +17,12 @@ class ZoneInfo(tzinfo):
@classmethod
def no_cache(cls, key: str) -> Self: ...
@classmethod
def from_file(cls, __fobj: _IOBytes, key: str | None = None) -> Self: ...
def from_file(cls, fobj: _IOBytes, /, key: str | None = None) -> Self: ...
@classmethod
def clear_cache(cls, *, only_keys: Iterable[str] | None = None) -> None: ...
def tzname(self, __dt: datetime | None) -> str | None: ...
def utcoffset(self, __dt: datetime | None) -> timedelta | None: ...
def dst(self, __dt: datetime | None) -> timedelta | None: ...
def tzname(self, dt: datetime | None, /) -> str | None: ...
def utcoffset(self, dt: datetime | None, /) -> timedelta | None: ...
def dst(self, dt: datetime | None, /) -> timedelta | None: ...
# Note: Both here and in clear_cache, the types allow the use of `str` where
# a sequence of strings is required. This should be remedied if a solution