Fix various inconsistencies within the documentation (#5067)

This commit is contained in:
Sebastian Law
2020-06-28 00:45:58 -07:00
committed by GitHub
parent f94b00cb48
commit b4b953bfc6
24 changed files with 378 additions and 142 deletions

View File

@ -142,12 +142,11 @@ class Command(_BaseCommand):
The coroutine that is executed when the command is called.
help: :class:`str`
The long help text for the command.
brief: :class:`str`
The short help text for the command. If this is not specified
then the first line of the long help text is used instead.
brief: Optional[:class:`str`]
The short help text for the command.
usage: :class:`str`
A replacement for arguments in the default help text.
aliases: Union[:class:`list`, :class:`tuple`]
aliases: Union[List[:class:`str`], Tuple[:class:`str`]]
The list of aliases the command can be invoked under.
enabled: :class:`bool`
A boolean that indicates if the command is currently enabled.
@ -384,7 +383,13 @@ class Command(_BaseCommand):
return other
def copy(self):
"""Creates a copy of this command."""
"""Creates a copy of this command.
Returns
--------
:class:`Command`
A new instance of this command.
"""
ret = self.__class__(self.callback, **self.__original_kwargs__)
return self._ensure_assignment_on_copy(ret)
@ -574,7 +579,8 @@ class Command(_BaseCommand):
@property
def clean_params(self):
"""Retrieves the parameter OrderedDict without the context or self parameters.
"""OrderedDict[:class:`str`, :class:`inspect.Parameter`]:
Retrieves the parameter OrderedDict without the context or self parameters.
Useful for inspecting signature.
"""
@ -608,7 +614,7 @@ class Command(_BaseCommand):
@property
def parents(self):
""":class:`Command`: Retrieves the parents of this command.
"""List[:class:`Command`]: Retrieves the parents of this command.
If the command has no parents then it returns an empty :class:`list`.
@ -626,7 +632,7 @@ class Command(_BaseCommand):
@property
def root_parent(self):
"""Retrieves the root parent of this command.
"""Optional[:class:`Command`]: Retrieves the root parent of this command.
If the command has no parents then it returns ``None``.
@ -920,7 +926,7 @@ class Command(_BaseCommand):
@property
def cog_name(self):
""":class:`str`: The name of the cog this command belongs to. None otherwise."""
"""Optional[:class:`str`]: The name of the cog this command belongs to, if any."""
return type(self.cog).__cog_name__ if self.cog is not None else None
@property
@ -1046,7 +1052,7 @@ class GroupMixin:
Attributes
-----------
all_commands: :class:`dict`
A mapping of command name to :class:`.Command` or subclass
A mapping of command name to :class:`.Command`
objects.
case_insensitive: :class:`bool`
Whether the commands should be case insensitive. Defaults to ``False``.
@ -1069,8 +1075,7 @@ class GroupMixin:
self.remove_command(command.name)
def add_command(self, command):
"""Adds a :class:`.Command` or its subclasses into the internal list
of commands.
"""Adds a :class:`.Command` into the internal list of commands.
This is usually not called, instead the :meth:`~.GroupMixin.command` or
:meth:`~.GroupMixin.group` shortcut decorators are used instead.
@ -1104,7 +1109,7 @@ class GroupMixin:
self.all_commands[alias] = command
def remove_command(self, name):
"""Remove a :class:`.Command` or subclasses from the internal list
"""Remove a :class:`.Command` from the internal list
of commands.
This could also be used as a way to remove aliases.
@ -1116,9 +1121,9 @@ class GroupMixin:
Returns
--------
:class:`.Command` or subclass
Optional[:class:`.Command`]
The command that was removed. If the name is not valid then
`None` is returned instead.
``None`` is returned instead.
"""
command = self.all_commands.pop(name, None)
@ -1147,7 +1152,7 @@ class GroupMixin:
yield from command.walk_commands()
def get_command(self, name):
"""Get a :class:`.Command` or subclasses from the internal list
"""Get a :class:`.Command` from the internal list
of commands.
This could also be used as a way to get aliases.
@ -1163,7 +1168,7 @@ class GroupMixin:
Returns
--------
:class:`Command` or subclass
Optional[:class:`Command`]
The command that was requested. If not found, returns ``None``.
"""
@ -1217,7 +1222,7 @@ class Group(GroupMixin, Command):
Attributes
-----------
invoke_without_command: Optional[:class:`bool`]
invoke_without_command: :class:`bool`
Indicates if the group callback should begin parsing and
invocation only if no subcommand was found. Useful for
making it an error handling function to tell the user that
@ -1226,7 +1231,7 @@ class Group(GroupMixin, Command):
the group callback will always be invoked first. This means
that the checks and the parsing dictated by its parameters
will be executed. Defaults to ``False``.
case_insensitive: Optional[:class:`bool`]
case_insensitive: :class:`bool`
Indicates if the group's commands should be case insensitive.
Defaults to ``False``.
"""
@ -1235,7 +1240,13 @@ class Group(GroupMixin, Command):
super().__init__(*args, **attrs)
def copy(self):
"""Creates a copy of this :class:`Group`."""
"""Creates a copy of this :class:`Group`.
Returns
--------
:class:`Group`
A new instance of this group.
"""
ret = super().copy()
for cmd in self.commands:
ret.add_command(cmd.copy())
@ -1856,7 +1867,6 @@ def is_nsfw():
def cooldown(rate, per, type=BucketType.default):
"""A decorator that adds a cooldown to a :class:`.Command`
or its subclasses.
A cooldown allows a command to only be used a specific amount
of times in a specific time frame. These cooldowns can be based