mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-16 06:03:11 +00:00
[commands] Fix missing or inferred type hints in parameters.py
This commit is contained in:
parent
76cc2c2272
commit
b32b78de45
@ -26,7 +26,7 @@ from __future__ import annotations
|
||||
|
||||
import inspect
|
||||
from operator import attrgetter
|
||||
from typing import TYPE_CHECKING, Any, Literal, Optional, OrderedDict, Union
|
||||
from typing import TYPE_CHECKING, Any, Literal, Optional, OrderedDict, Union, Protocol
|
||||
|
||||
from discord.utils import MISSING, maybe_coroutine
|
||||
|
||||
@ -160,7 +160,7 @@ class Parameter(inspect.Parameter):
|
||||
|
||||
return None if self.required else str(self.default)
|
||||
|
||||
async def get_default(self, ctx: Context) -> Any:
|
||||
async def get_default(self, ctx: Context[Any]) -> Any:
|
||||
"""|coro|
|
||||
|
||||
Gets this parameter's default value.
|
||||
@ -217,7 +217,18 @@ def parameter(
|
||||
)
|
||||
|
||||
|
||||
param = parameter
|
||||
class ParameterAlias(Protocol):
|
||||
def __call__(
|
||||
self,
|
||||
*,
|
||||
converter: Any = empty,
|
||||
default: Any = empty,
|
||||
displayed_default: str = empty,
|
||||
) -> Any:
|
||||
...
|
||||
|
||||
|
||||
param: ParameterAlias = parameter
|
||||
r"""param(\*, converter=..., default=..., displayed_default=...)
|
||||
|
||||
An alias for :func:`parameter`.
|
||||
@ -241,7 +252,7 @@ CurrentChannel = parameter(
|
||||
CurrentChannel._fallback = True
|
||||
|
||||
|
||||
def default_guild(ctx: Context) -> Guild:
|
||||
def default_guild(ctx: Context[Any]) -> Guild:
|
||||
if ctx.guild is not None:
|
||||
return ctx.guild
|
||||
raise NoPrivateMessage()
|
||||
|
Loading…
x
Reference in New Issue
Block a user