mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-14 01:40:02 +00:00
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.
This commit is contained in:
parent
bee6402d84
commit
3c8d3ab078
@ -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…
x
Reference in New Issue
Block a user