Browse Source

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.
pull/6758/head
Rapptz 4 years ago
parent
commit
3c8d3ab078
  1. 6
      discord/utils.py

6
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]

Loading…
Cancel
Save