fix: address code review — use PD_SEASON, top-level imports, fix kwargs typing
All checks were successful
Ruff Lint / lint (pull_request) Successful in 22s
All checks were successful
Ruff Lint / lint (pull_request) Successful in 22s
- Replace hardcoded CURRENT_SEASON = 11 with PD_SEASON from helpers.constants - Move get_team_by_owner import to top-level (no circular dependency) - Replace kwargs dict unpacking with explicit keyword args (fixes Pyright) - Remove unused os import - Add comment documenting on_timeout limitation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c683e36daf
commit
5b43f8dad3
@ -5,7 +5,6 @@ for integration testing that create and clean up synthetic test data.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
from datetime import date
|
||||
|
||||
import discord
|
||||
@ -13,6 +12,8 @@ from discord import app_commands
|
||||
from discord.ext import commands
|
||||
|
||||
from api_calls import db_delete, db_get, db_post
|
||||
from helpers.constants import PD_SEASON
|
||||
from helpers.main import get_team_by_owner
|
||||
from helpers.refractor_constants import TIER_NAMES
|
||||
from helpers.refractor_test_data import (
|
||||
build_batter_plays,
|
||||
@ -22,7 +23,7 @@ from helpers.refractor_test_data import (
|
||||
calculate_plays_needed,
|
||||
)
|
||||
|
||||
CURRENT_SEASON = 11
|
||||
CURRENT_SEASON = PD_SEASON
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -86,6 +87,8 @@ class CleanupView(discord.ui.View):
|
||||
self.stop()
|
||||
|
||||
async def on_timeout(self):
|
||||
# Note: clear_items() updates the local view but cannot push to Discord
|
||||
# without a message reference. Buttons will become unresponsive after timeout.
|
||||
self.clear_items()
|
||||
|
||||
|
||||
@ -125,8 +128,6 @@ class DevToolsCog(commands.Cog):
|
||||
team_id = card.get("team_id") or card["player"].get("team_id")
|
||||
|
||||
if team_id is None:
|
||||
from helpers.main import get_team_by_owner
|
||||
|
||||
team = await get_team_by_owner(interaction.user.id)
|
||||
if team is None:
|
||||
await interaction.edit_original_response(
|
||||
@ -266,10 +267,10 @@ class DevToolsCog(commands.Cog):
|
||||
while len(embed.fields) > 1:
|
||||
embed.remove_field(len(embed.fields) - 1)
|
||||
embed.add_field(name="Results", value=results_text, inline=False)
|
||||
kwargs = {"embed": embed}
|
||||
if view is not None:
|
||||
kwargs["view"] = view
|
||||
await interaction.edit_original_response(**kwargs)
|
||||
await interaction.edit_original_response(embed=embed, view=view)
|
||||
else:
|
||||
await interaction.edit_original_response(embed=embed)
|
||||
|
||||
try:
|
||||
# Step 1: Create game
|
||||
|
||||
Loading…
Reference in New Issue
Block a user