Fix smells in view.py.

This commit is contained in:
2025-02-20 17:31:03 -05:00
parent 327126307d
commit 385129c434
+16 -17
View File
@@ -1,6 +1,4 @@
"""
View command heirarchy.
"""
"""View command hierarchy."""
import nextcord
import pandas as pd
@@ -14,20 +12,14 @@ from utilities.utils import MAX_LINE_LENGTH, autofill_categories, autofill_group
class ViewCog(commands.Cog, name="View Command"):
"""
Class holds commands for viewing data.
"""
"""Class holds commands for viewing data."""
def __init__(self) -> None:
"""
Default constructor for ViewCog class. Does nothing.
"""
"""Default constructor for ViewCog class. Does nothing."""
@nextcord.slash_command()
async def view(self, interaction: nextcord.Interaction):
"""
Parent slash command for view. Never called.
"""
async def view(self, interaction: nextcord.Interaction) -> None:
"""Parent slash command for view. Never called."""
@view.subcommand(description="Lists all scores for a given category.")
async def leaderboard(
@@ -39,10 +31,12 @@ class ViewCog(commands.Cog, name="View Command"):
category_id: str = nextcord.SlashOption(
name="category", description="Category to show leaderboard.", required=True
),
):
) -> None:
"""
Gathers all users that have a submission in the group/category combo and returns a message with them
in ranked order.
Create message with leaderboard of a group and category.
Gathers all users that have a submission in the group/category combo and returns a
message with them in ranked order.
Args:
interaction (nextcord.Interaction): Interaction that invoked the command.
@@ -71,7 +65,12 @@ class ViewCog(commands.Cog, name="View Command"):
for i, row in scores.iterrows():
str_list.append(
format_score_string(
row["UserName"], row["Score"], longest_str, category.IsTimeRecord, i + 1, MAX_LINE_LENGTH
row["UserName"],
row["Score"],
longest_str,
category.IsTimeRecord,
i + 1, # type: ignore[reportOperatorIssue]
MAX_LINE_LENGTH,
)
)