Use typing.Self throughout library

This commit is contained in:
Josh
2022-03-01 22:53:24 +10:00
committed by GitHub
parent a90e1824f4
commit 147948af9b
28 changed files with 212 additions and 191 deletions

View File

@ -43,15 +43,13 @@ from .errors import (
from .enums import Status
from typing import TYPE_CHECKING, Any, Callable, Tuple, Type, Optional, List, Dict, TypeVar
from typing import TYPE_CHECKING, Any, Callable, Tuple, Type, Optional, List, Dict
if TYPE_CHECKING:
from .gateway import DiscordWebSocket
from .activity import BaseActivity
from .enums import Status
EI = TypeVar('EI', bound='EventItem')
__all__ = (
'AutoShardedClient',
'ShardInfo',
@ -77,12 +75,12 @@ class EventItem:
self.shard: Optional['Shard'] = shard
self.error: Optional[Exception] = error
def __lt__(self: EI, other: EI) -> bool:
def __lt__(self, other: Any) -> bool:
if not isinstance(other, EventItem):
return NotImplemented
return self.type < other.type
def __eq__(self: EI, other: EI) -> bool:
def __eq__(self, other: Any) -> bool:
if not isinstance(other, EventItem):
return NotImplemented
return self.type == other.type