mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-10-22 08:23:09 +00:00
Update comments after # type: ignore
to be compatible with PEP 484
This commit is contained in:
@@ -1272,9 +1272,9 @@ def describe(**parameters: str) -> Callable[[T], T]:
|
||||
_populate_descriptions(inner._params, parameters)
|
||||
else:
|
||||
try:
|
||||
inner.__discord_app_commands_param_description__.update(parameters) # type: ignore - Runtime attribute access
|
||||
inner.__discord_app_commands_param_description__.update(parameters) # type: ignore # Runtime attribute access
|
||||
except AttributeError:
|
||||
inner.__discord_app_commands_param_description__ = parameters # type: ignore - Runtime attribute assignment
|
||||
inner.__discord_app_commands_param_description__ = parameters # type: ignore # Runtime attribute assignment
|
||||
|
||||
return inner
|
||||
|
||||
@@ -1341,9 +1341,9 @@ def choices(**parameters: List[Choice[ChoiceT]]) -> Callable[[T], T]:
|
||||
_populate_choices(inner._params, parameters)
|
||||
else:
|
||||
try:
|
||||
inner.__discord_app_commands_param_choices__.update(parameters) # type: ignore - Runtime attribute access
|
||||
inner.__discord_app_commands_param_choices__.update(parameters) # type: ignore # Runtime attribute access
|
||||
except AttributeError:
|
||||
inner.__discord_app_commands_param_choices__ = parameters # type: ignore - Runtime attribute assignment
|
||||
inner.__discord_app_commands_param_choices__ = parameters # type: ignore # Runtime attribute assignment
|
||||
|
||||
return inner
|
||||
|
||||
@@ -1393,9 +1393,9 @@ def autocomplete(**parameters: AutocompleteCallback[GroupT, ChoiceT]) -> Callabl
|
||||
_populate_autocomplete(inner._params, parameters)
|
||||
else:
|
||||
try:
|
||||
inner.__discord_app_commands_param_autocomplete__.update(parameters) # type: ignore - Runtime attribute access
|
||||
inner.__discord_app_commands_param_autocomplete__.update(parameters) # type: ignore # Runtime attribute access
|
||||
except AttributeError:
|
||||
inner.__discord_app_commands_param_autocomplete__ = parameters # type: ignore - Runtime attribute assignment
|
||||
inner.__discord_app_commands_param_autocomplete__ = parameters # type: ignore # Runtime attribute assignment
|
||||
|
||||
return inner
|
||||
|
||||
|
@@ -142,7 +142,7 @@ class AppCommand(Hashable):
|
||||
'name': self.name,
|
||||
'description': self.description,
|
||||
'options': [opt.to_dict() for opt in self.options],
|
||||
} # type: ignore -- Type checker does not understand this literal.
|
||||
} # type: ignore # Type checker does not understand this literal.
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.name
|
||||
@@ -319,7 +319,7 @@ class AppCommandChannel(Hashable):
|
||||
The full channel.
|
||||
"""
|
||||
client = self._state._get_client()
|
||||
return await client.fetch_channel(self.id) # type: ignore -- This is explicit narrowing
|
||||
return await client.fetch_channel(self.id) # type: ignore # This is explicit narrowing
|
||||
|
||||
@property
|
||||
def mention(self) -> str:
|
||||
@@ -493,7 +493,7 @@ class AppCommandThread(Hashable):
|
||||
The full thread.
|
||||
"""
|
||||
client = self._state._get_client()
|
||||
return await client.fetch_channel(self.id) # type: ignore -- This is explicit narrowing
|
||||
return await client.fetch_channel(self.id) # type: ignore # This is explicit narrowing
|
||||
|
||||
|
||||
class Argument:
|
||||
@@ -554,7 +554,7 @@ class Argument:
|
||||
'required': self.required,
|
||||
'choices': [choice.to_dict() for choice in self.choices],
|
||||
'options': [],
|
||||
} # type: ignore -- Type checker does not understand this literal.
|
||||
} # type: ignore # Type checker does not understand this literal.
|
||||
|
||||
|
||||
class AppCommandGroup:
|
||||
@@ -623,7 +623,7 @@ class AppCommandGroup:
|
||||
'required': self.required,
|
||||
'choices': [choice.to_dict() for choice in self.choices],
|
||||
'options': [arg.to_dict() for arg in self.arguments],
|
||||
} # type: ignore -- Type checker does not understand this literal.
|
||||
} # type: ignore # Type checker does not understand this literal.
|
||||
|
||||
|
||||
def app_command_option_factory(
|
||||
|
@@ -134,17 +134,17 @@ class Namespace:
|
||||
opt_type = option['type']
|
||||
name = option['name']
|
||||
if opt_type in (3, 4, 5): # string, integer, boolean
|
||||
value = option['value'] # type: ignore -- Key is there
|
||||
value = option['value'] # type: ignore # Key is there
|
||||
self.__dict__[name] = value
|
||||
elif opt_type == 10: # number
|
||||
value = option['value'] # type: ignore -- Key is there
|
||||
value = option['value'] # type: ignore # Key is there
|
||||
if value is None:
|
||||
self.__dict__[name] = float('nan')
|
||||
else:
|
||||
self.__dict__[name] = float(value)
|
||||
elif opt_type in (6, 7, 8, 9, 11):
|
||||
# Remaining ones should be snowflake based ones with resolved data
|
||||
snowflake: str = option['value'] # type: ignore -- Key is there
|
||||
snowflake: str = option['value'] # type: ignore # Key is there
|
||||
if opt_type == 9: # Mentionable
|
||||
# Mentionable is User | Role, these do not cause any conflict
|
||||
key = ResolveKey.any_with(snowflake)
|
||||
|
Reference in New Issue
Block a user