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 hierarchy."""
View command heirarchy.
"""
import nextcord import nextcord
import pandas as pd 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 ViewCog(commands.Cog, name="View Command"):
""" """Class holds commands for viewing data."""
Class holds commands for viewing data.
"""
def __init__(self) -> None: def __init__(self) -> None:
""" """Default constructor for ViewCog class. Does nothing."""
Default constructor for ViewCog class. Does nothing.
"""
@nextcord.slash_command() @nextcord.slash_command()
async def view(self, interaction: nextcord.Interaction): async def view(self, interaction: nextcord.Interaction) -> None:
""" """Parent slash command for view. Never called."""
Parent slash command for view. Never called.
"""
@view.subcommand(description="Lists all scores for a given category.") @view.subcommand(description="Lists all scores for a given category.")
async def leaderboard( async def leaderboard(
@@ -39,10 +31,12 @@ class ViewCog(commands.Cog, name="View Command"):
category_id: str = nextcord.SlashOption( category_id: str = nextcord.SlashOption(
name="category", description="Category to show leaderboard.", required=True 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 Create message with leaderboard of a group and category.
in ranked order.
Gathers all users that have a submission in the group/category combo and returns a
message with them in ranked order.
Args: Args:
interaction (nextcord.Interaction): Interaction that invoked the command. 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(): for i, row in scores.iterrows():
str_list.append( str_list.append(
format_score_string( 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,
) )
) )