-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add type hints for the zoneinfo module #4038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b283b18
Add type hints for the zoneinfo module
pganssle f4289a9
Update stdlib/3.9/zoneinfo/__init__.pyi
pganssle 41bca2f
Update stdlib/3.9/zoneinfo/__init__.pyi
pganssle cdf602d
Update stdlib/3.9/zoneinfo/__init__.pyi
pganssle b2cdb22
fixup! Add type hints for the zoneinfo module
pganssle b007e7c
fixup! cdf602d8aff3fa840576ab6853559b624e300765
pganssle 4ff6801
fixup! Add type hints for the zoneinfo module
pganssle d45784d
fixup! Add type hints for the zoneinfo module
pganssle 00897b9
fixup! Add type hints for the zoneinfo module
pganssle 653059b
fixup! b2cdb229bf6d8962b829ca22455138a5cbc616cc
pganssle 0e98faf
fixup! f4289a99dfb8355d4a938312eca6c786aa3fa27c
pganssle dfe752c
fixup! Add type hints for the zoneinfo module
pganssle 26d1b5f
fixup! fixup! Add type hints for the zoneinfo module
pganssle 9fde9fa
fixup! fixup! b2cdb229bf6d8962b829ca22455138a5cbc616cc
pganssle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import os | ||
import typing | ||
from datetime import datetime, tzinfo | ||
from typing import ( | ||
Any, | ||
Iterable, | ||
Optional, | ||
Protocol, | ||
Sequence, | ||
Set, | ||
Type, | ||
Union, | ||
) | ||
|
||
_T = typing.TypeVar("_T", bound="ZoneInfo") | ||
|
||
class _IOBytes(Protocol): | ||
def read(self, __size: int) -> bytes: ... | ||
def seek(self, __size: int, __whence: int = ...) -> Any: ... | ||
|
||
class ZoneInfo(tzinfo): | ||
@property | ||
def key(self) -> str: ... | ||
def __init__(self, key: str) -> None: ... | ||
@classmethod | ||
def no_cache(cls: Type[_T], key: str) -> _T: ... | ||
@classmethod | ||
def from_file( | ||
cls: Type[_T], __fobj: _IOBytes, key: Optional[str] = ... | ||
) -> _T: ... | ||
@classmethod | ||
def clear_cache(cls, *, only_keys: Iterable[str] = ...) -> 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 | ||
# to this typing bug is found: https://github.com/python/typing/issues/256 | ||
def reset_tzpath( | ||
to: Optional[Sequence[Union[os.PathLike, str]]] = ... | ||
) -> None: ... | ||
def available_timezones() -> Set[str]: ... | ||
|
||
TZPATH: Sequence[str] | ||
|
||
class ZoneInfoNotFoundError(KeyError): ... | ||
class InvalidTZPathWarning(RuntimeWarning): ... |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.