diff options
| author | Rapptz <[email protected]> | 2021-04-19 02:12:41 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2021-04-19 02:12:41 -0400 |
| commit | 3c8d3ab078af6918968dad3acaea9a37da3f187c (patch) | |
| tree | 4d562bedb1e63c9bb08e313f2c83d4d8233df4cf /discord/utils.py | |
| parent | Fix utils.find predicate typing to accept Any (diff) | |
| download | discord.py-3c8d3ab078af6918968dad3acaea9a37da3f187c.tar.xz discord.py-3c8d3ab078af6918968dad3acaea9a37da3f187c.zip | |
Add a third overload to parse_time
Apparently this behaviour is intended in Pyright
https://github.com/microsoft/pyright/issues/1772
Despite mypy behaving as intended.
Diffstat (limited to 'discord/utils.py')
| -rw-r--r-- | discord/utils.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/discord/utils.py b/discord/utils.py index 06a4dea2..7316b62e 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -175,6 +175,11 @@ def parse_time(timestamp: str) -> datetime.datetime: ... +@overload +def parse_time(timestamp: Optional[str]) -> Optional[datetime.datetime]: + ... + + def parse_time(timestamp: Optional[str]) -> Optional[datetime.datetime]: if timestamp: return datetime.datetime.fromisoformat(timestamp) @@ -389,6 +394,7 @@ def get(iterable: Iterable[T], **attrs: Any) -> Optional[T]: def _unique(iterable: Iterable[T]) -> List[T]: return [x for x in dict.fromkeys(iterable)] + def _get_as_snowflake(data: Any, key: str) -> Optional[int]: try: value = data[key] |