2 from _typeshed import StrPath
3 from datetime import tzinfo
4 from typing import Any, Iterable, Protocol, Sequence, Type
6 _T = typing.TypeVar("_T", bound="ZoneInfo")
8 class _IOBytes(Protocol):
9 def read(self, __size: int) -> bytes: ...
10 def seek(self, __size: int, __whence: int = ...) -> Any: ...
12 class ZoneInfo(tzinfo):
14 def key(self) -> str: ...
15 def __init__(self, key: str) -> None: ...
17 def no_cache(cls: Type[_T], key: str) -> _T: ...
19 def from_file(cls: Type[_T], __fobj: _IOBytes, key: str | None = ...) -> _T: ...
21 def clear_cache(cls, *, only_keys: Iterable[str] = ...) -> None: ...
23 # Note: Both here and in clear_cache, the types allow the use of `str` where
24 # a sequence of strings is required. This should be remedied if a solution
25 # to this typing bug is found: https://github.com/python/typing/issues/256
26 def reset_tzpath(to: Sequence[StrPath] | None = ...) -> None: ...
27 def available_timezones() -> set[str]: ...
31 class ZoneInfoNotFoundError(KeyError): ...
32 class InvalidTZPathWarning(RuntimeWarning): ...