mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
Use a TypeVar for flatten_user to workaround Pyright bug
This commit is contained in:
parent
fb8d5c15d0
commit
3ee18e4c5d
@ -28,7 +28,7 @@ import datetime
|
|||||||
import inspect
|
import inspect
|
||||||
import itertools
|
import itertools
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
from typing import Any, Awaitable, Callable, Collection, Dict, List, Optional, TYPE_CHECKING, Tuple, Union, Type
|
from typing import Any, Awaitable, Callable, Collection, Dict, List, Optional, TYPE_CHECKING, Tuple, TypeVar, Union
|
||||||
|
|
||||||
import discord.abc
|
import discord.abc
|
||||||
|
|
||||||
@ -48,6 +48,8 @@ __all__ = (
|
|||||||
'Member',
|
'Member',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
T = TypeVar('T', bound=type)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
|
|
||||||
@ -205,7 +207,7 @@ class _ClientStatus:
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
def flatten_user(cls: Any) -> Type[Member]:
|
def flatten_user(cls: T) -> T:
|
||||||
for attr, value in itertools.chain(BaseUser.__dict__.items(), User.__dict__.items()):
|
for attr, value in itertools.chain(BaseUser.__dict__.items(), User.__dict__.items()):
|
||||||
# ignore private/special methods
|
# ignore private/special methods
|
||||||
if attr.startswith('_'):
|
if attr.startswith('_'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user