Skip to content

Commit

Permalink
Remove some unnecessary Sphinx formatting in docstrings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sachaa-Thanasius committed Apr 15, 2024
1 parent 8e1e648 commit 5efd7ad
Show file tree
Hide file tree
Showing 27 changed files with 284 additions and 285 deletions.
16 changes: 8 additions & 8 deletions core/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ class Beira(commands.Bot):
Parameters
----------
*args
Variable length argument list, primarily for :class:`commands.Bot`.
db_pool: :class:`asyncpg.Pool`
Variable length argument list, primarily for `commands.Bot`.
db_pool: `asyncpg.Pool`
A connection pool for a PostgreSQL database.
web_session: :class:`aiohttp.ClientSession`
web_session: `aiohttp.ClientSession`
An HTTP session for making async HTTP requests.
initial_extensions: list[:class:`str`], optional
initial_extensions: list[`str`], optional
A list of extension names that the bot will initially load.
**kwargs
Arbitrary keyword arguments, primarily for :class:`commands.Bot`. See that class for more information.
Arbitrary keyword arguments, primarily for `commands.Bot`. See that class for more information.
"""

logging_manager: LoggingManager
Expand Down Expand Up @@ -182,7 +182,7 @@ async def on_command_error(self, context: Context, exception: commands.CommandEr

@property
def owner(self) -> discord.User:
""":class:`discord.User`: The user that owns the bot."""
"""`discord.User`: The user that owns the bot."""

return self.app_info.owner

Expand Down Expand Up @@ -263,15 +263,15 @@ async def get_user_tzinfo(self, user_id: int) -> ZoneInfo:
return ZoneInfo("UTC")

def is_special_friend(self, user: discord.abc.User, /) -> bool:
"""Checks if a :class:`discord.User` or :class:`discord.Member` is a "special friend" of this bot's owner."""
"""Checks if a `discord.User` or `discord.Member` is a "special friend" of this bot's owner."""

if len(self.special_friends) > 0:
return user.id in self.special_friends.values()

return False

def is_ali(self, user: discord.abc.User, /) -> bool:
"""Checks if a :class:`discord.User` or :class:`discord.Member` is Ali."""
"""Checks if a `discord.User` or `discord.Member` is Ali."""

if len(self.special_friends) > 0:
return user.id == self.special_friends["aeroali"]
Expand Down
5 changes: 2 additions & 3 deletions core/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
class AppCheck(Protocol):
predicate: AppCheckFunc

def __call__(self, coro_or_commands: T) -> T:
...
def __call__(self, coro_or_commands: T) -> T: ...


__all__ = (
Expand Down Expand Up @@ -138,7 +137,7 @@ def check_any(*checks: AppCheck) -> Callable[[T], T]:
Parameters
----------
checks: :class:`AppCheckProtocol`
checks: `AppCheckProtocol`
An argument list of checks that have been decorated with :func:`app_commands.check` decorator.
Raises
Expand Down
4 changes: 2 additions & 2 deletions core/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ class Context(commands.Context["Beira"]):

@property
def session(self) -> aiohttp.ClientSession:
""":class:`ClientSession`: Returns the asynchronous HTTP session used by the bot for HTTP requests."""
"""`ClientSession`: Returns the asynchronous HTTP session used by the bot for HTTP requests."""

return self.bot.web_session

@property
def db(self) -> Pool_alias:
""":class:`Pool`: Returns the asynchronous connection pool used by the bot for database management."""
"""`Pool`: Returns the asynchronous connection pool used by the bot for database management."""

return self.bot.db_pool

Expand Down
4 changes: 2 additions & 2 deletions core/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ class CheckAnyFailure(app_commands.CheckFailure):
Attributes
------------
errors: list[:class:`app_commands.CheckFailure`]
errors: list[`app_commands.CheckFailure`]
A list of errors that were caught during execution.
checks: List[Callable[[:class:`discord.Interaction`], :class:`bool`]]
checks: List[Callable[[`discord.Interaction`], `bool`]]
A list of check predicates that failed.
"""

Expand Down
10 changes: 5 additions & 5 deletions core/utils/custom_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,18 @@ class LoggingManager:
Parameters
----------
stream: :class:`bool`, default=True
stream: `bool`, default=True
Whether the logs should be output to a stream. Defaults to True.
Attributes
----------
log: :class:`logging.Logger`
log: `logging.Logger`
The primary bot handler.
max_bytes: :class:`int`
max_bytes: `int`
The maximum size of each log file.
logging_path: :class:`Path`
logging_path: `Path`
A path to the directory for all log files.
stream: :class:`bool`
stream: `bool`
A boolean indicating whether the logs should be output to a stream.
"""

Expand Down
8 changes: 4 additions & 4 deletions core/utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ async def upsert_users(conn: Pool_alias | Connection_alias, *users: UserObject)
Parameters
----------
conn: :class:`Pool` | :class:`Connection`
conn: `Pool` | `Connection`
The connection pool used to interact to the database.
users: tuple[:class:`discord.abc.User` | :class:`discord.Object` | tuple]
users: tuple[`discord.abc.User` | `discord.Object` | tuple]
One or more users, members, discord objects, or tuples of user ids and blocked statuses, to use for upsertion.
"""

Expand All @@ -66,9 +66,9 @@ async def upsert_guilds(conn: Pool_alias | Connection_alias, *guilds: GuildObjec
Parameters
----------
conn: :class:`Pool` | :class:`Connection`
conn: `Pool` | `Connection`
The connection pool used to interact to the database.
guilds: tuple[:class:`discord.Guild` | :class:`discord.Object` | tuple]
guilds: tuple[`discord.Guild` | `discord.Object` | tuple]
One or more guilds, discord objects, or tuples of guild ids, names, and blocked statuses, to use for upsertion.
"""

Expand Down
18 changes: 9 additions & 9 deletions core/utils/embeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@


class StatsEmbed(discord.Embed):
"""A subclass of :class:`DTEmbed` that displays given statistics for a user.
"""A subclass of `DTEmbed` that displays given statistics for a user.
This has a default colour of 0x2f3136 and a default timestamp for right now in UTC.
Parameters
----------
*args
Positional arguments for the normal initialization of a discord :class:`Embed`.
Positional arguments for the normal initialization of a discord `Embed`.
**kwargs
Keyword arguments for the normal initialization of a discord :class:`Embed`.
Keyword arguments for the normal initialization of a discord `Embed`.
"""

def __init__(self, *args: object, **kwargs: object) -> None:
Expand Down Expand Up @@ -59,9 +59,9 @@ def add_stat_fields(
The emojis adorning each field. Defaults to a tuple with an empty string so there is at least one "emoji".
values: Iterable[object], default=("",)
The values for each field.
inline: :class:`bool`, default=False
inline: `bool`, default=False
Whether the fields should be displayed inline. Defaults to False.
emoji_header_status: :class:`bool`, default=False
emoji_header_status: `bool`, default=False
Whether the emojis should adorn the names or the values of each field. By default, adorns the values.
"""

Expand Down Expand Up @@ -98,13 +98,13 @@ def add_leaderboard_fields(
ldbd_emojis: Iterable[AnyEmoji], default=("",)
The emojis adorning the names of the leaderboard fields. Defaults to a tuple with an empty string so there
is at least one "emoji".
name_format: :class:`str`, default="| {}"
name_format: `str`, default="| {}"
The format for the name, to be filled by information from the content.
value_format: :class:`str`, default="{}"
value_format: `str`, default="{}"
The format for the value, to be filled by information from the content.
inline: :class:`bool`, default=False
inline: `bool`, default=False
Whether the fields should be displayed inline.
is_ranked: :class:`bool`, default=True
is_ranked: `bool`, default=True
Whether the stats should be ranked in descending order.
"""

Expand Down
2 changes: 1 addition & 1 deletion core/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class catchtime:
Parameters
----------
logger: :class:`logging.Logger`, optional
logger: `logging.Logger`, optional
The logging channel to send the time to, if relevant. Optional.
"""

Expand Down
40 changes: 20 additions & 20 deletions core/utils/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ class OwnedView(discord.ui.View):
Parameters
----------
author: :class:`int`
author: `int`
The Discord ID of the user that triggered this view. No one else can use it.
timeout: :class:`float` | None, optional
timeout: `float` | None, optional
Timeout in seconds from last interaction with the UI before no longer accepting input.
If ``None`` then there is no timeout.
"""
Expand All @@ -85,11 +85,11 @@ class PageSeekModal(discord.ui.Modal, title="Page Jump"):
Attributes
----------
input_page_num: :class:`TextInput`
input_page_num: `TextInput`
A UI text input element to allow users to enter a page number.
parent: :class:`PaginatedEmbedView`
parent: `PaginatedEmbedView`
The paginated view that this modal was called from.
interaction: :class:`discord.Interaction`
interaction: `discord.Interaction`
The interaction of the user with the modal. Only populates on submission.
"""

Expand Down Expand Up @@ -123,27 +123,27 @@ class PaginatedEmbedView(ABC, Generic[_LT], OwnedView):
Parameters
----------
author_id: :class:`int`
author_id: `int`
The Discord ID of the user that triggered this view. No one else can use it.
pages_content: list[Any]
The content for every possible page.
per: :class:`int`
per: `int`
The number of entries to be displayed per page.
timeout: :class:`float`, optional
timeout: `float`, optional
Timeout in seconds from last interaction with the UI before no longer accepting input.
If ``None`` then there is no timeout.
Attributes
----------
message: :class:`discord.Message`
The message to which the view is attached to, allowing interaction without a :class:`discord.Interaction`.
per_page: :class:`int`
message: `discord.Message`
The message to which the view is attached to, allowing interaction without a `discord.Interaction`.
per_page: `int`
The number of entries to be displayed per page.
pages: list[Any]
A list of content for pages, split according to how much content is wanted per page.
page_index: :class:`int`
page_index: `int`
The index for the current page.
page_modal_strings: tuple[:class:`str`, ...], default=()
page_modal_strings: tuple[`str`, ...], default=()
Tuple of strings to modify the page seek modal with if necessary. Empty by default.
total_pages
"""
Expand All @@ -163,7 +163,7 @@ def __init__(self, author_id: int, pages_content: list[_LT], per: int = 1, *, ti

@property
def total_pages(self) -> int:
""":class:``int`: The total number of pages."""
"""``int`: The total number of pages."""

return len(self.pages)

Expand Down Expand Up @@ -299,21 +299,21 @@ class PaginatedSelectView(ABC, Generic[_LT], OwnedView):
Parameters
----------
author_id: :class:`int`
author_id: `int`
The Discord ID of the user that triggered this view. No one else can use it.
pages_content: Sequence[Any]
The content for every possible page.
timeout: :class:`float` | None, optional
timeout: `float` | None, optional
Timeout in seconds from last interaction with the UI before no longer accepting input.
If ``None`` then there is no timeout.
Attributes
----------
message: :class:`discord.Message`
The message to which the view is attached to, allowing interaction without a :class:`discord.Interaction`.
message: `discord.Message`
The message to which the view is attached to, allowing interaction without a `discord.Interaction`.
pages: list[Any]
A list of content for pages.
page_index: :class:`int`
page_index: `int`
The index for the current page.
total_pages
"""
Expand All @@ -332,7 +332,7 @@ def __init__(self, author_id: int, pages_content: Sequence[_LT], *, timeout: flo

@property
def total_pages(self) -> int:
""":class:``int`: The total number of pages."""
"""``int`: The total number of pages."""

return len(self.pages)

Expand Down
Loading

0 comments on commit 5efd7ad

Please sign in to comment.