Run Black formatter across 83 files and fix 1514 ruff violations: - E722: bare except → typed exceptions (17 fixes) - E711/E712/E721: comparison style fixes with noqa for SQLAlchemy (44 fixes) - F841: unused variable assignments (70 fixes) - F541/F401: f-string and import cleanup (1383 auto-fixes) Remaining 925 errors are all F403/F405 (star imports) — structural, requires converting to explicit imports in a separate effort. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
405 lines
16 KiB
Python
405 lines
16 KiB
Python
"""
|
|
Paper Dynasty Discord App Constants
|
|
|
|
This module contains all the configuration constants, static data structures,
|
|
and lookup tables used throughout the application.
|
|
"""
|
|
|
|
import discord
|
|
from typing import Literal
|
|
|
|
# Season Configuration
|
|
SBA_SEASON = 12
|
|
PD_SEASON = 10
|
|
ranked_cardsets = [24, 25, 26, 27, 28, 29]
|
|
LIVE_CARDSET_ID = 27
|
|
LIVE_PROMO_CARDSET_ID = 28
|
|
MAX_CARDSET_ID = 30
|
|
|
|
# Cardset Configuration
|
|
CARDSETS = {
|
|
"ranked": {"primary": ranked_cardsets, "human": ranked_cardsets},
|
|
"minor-league": {
|
|
"primary": [27, 8], # 2005, Mario
|
|
"secondary": [24], # 2025
|
|
"human": [x for x in range(1, 30)],
|
|
},
|
|
"major-league": {
|
|
"primary": [
|
|
27,
|
|
28,
|
|
24,
|
|
25,
|
|
13,
|
|
14,
|
|
6,
|
|
8,
|
|
], # 2005 + Promos, 2025 + Promos, 2018 + Promos, 2012, Mario
|
|
"secondary": [5, 3], # 2019, 2022
|
|
"human": ranked_cardsets,
|
|
},
|
|
"hall-of-fame": {"primary": [x for x in range(1, 30)], "human": ranked_cardsets},
|
|
"flashback": {
|
|
"primary": [13, 5, 1, 3, 8], # 2018, 2019, 2021, 2022, Mario
|
|
"secondary": [24], # 2025
|
|
"human": [13, 5, 1, 3, 8], # 2018, 2019, 2021, 2022
|
|
},
|
|
"gauntlet-3": {
|
|
"primary": [13], # 2018
|
|
"secondary": [5, 11, 9], # 2019, 2016, 2023
|
|
"human": [x for x in range(1, 30)],
|
|
},
|
|
"gauntlet-4": {
|
|
"primary": [3, 6, 16], # 2022, 2013, Backyard Baseball
|
|
"secondary": [4, 9], # 2022 Promos, 2023
|
|
"human": [3, 4, 6, 9, 15, 16],
|
|
},
|
|
"gauntlet-5": {
|
|
"primary": [17, 8], # 2024, Mario
|
|
"secondary": [13], # 2018
|
|
"human": [x for x in range(1, 30)],
|
|
},
|
|
"gauntlet-6": {
|
|
"primary": [20, 8], # 1998, Mario
|
|
"secondary": [12], # 2008
|
|
"human": [x for x in range(1, 30)],
|
|
},
|
|
"gauntlet-7": {
|
|
"primary": [5, 23], # 2019, Brilliant Stars
|
|
"secondary": [1], # 2021
|
|
"human": [x for x in range(1, 30)],
|
|
},
|
|
"gauntlet-8": {
|
|
"primary": [24], # 2025
|
|
"secondary": [17],
|
|
"human": [24, 25, 22, 23],
|
|
},
|
|
"gauntlet-9": {"primary": [27], "secondary": [24]}, # 2005 # 2025
|
|
}
|
|
|
|
# Application Configuration
|
|
SBA_COLOR = "a6ce39"
|
|
PD_PLAYERS = "Paper Dynasty Players"
|
|
SBA_PLAYERS_ROLE_NAME = f"Season {SBA_SEASON} Players"
|
|
PD_PLAYERS_ROLE_NAME = "Paper Dynasty Players"
|
|
|
|
ALL_CARDSET_NAMES = Literal[
|
|
"All",
|
|
"2005 Live",
|
|
"2025 Season",
|
|
"2024 Season",
|
|
"2024 Promos",
|
|
"2023 Season",
|
|
"2023 Promos",
|
|
"2022 Season",
|
|
"2022 Promos",
|
|
"2021 Season",
|
|
"2019 Season",
|
|
"2018 Season",
|
|
"2018 Promos",
|
|
"2016 Season",
|
|
"2013 Season",
|
|
"2012 Season",
|
|
"2008 Season",
|
|
"1998 Season",
|
|
"1998 Promos",
|
|
"Backyard Baseball",
|
|
"Mario Super Sluggers",
|
|
"Sams Choice",
|
|
]
|
|
|
|
# External URLs and Resources
|
|
PD_IMAGE_BUCKET = "https://paper-dynasty.s3.us-east-1.amazonaws.com/static-images"
|
|
PKMN_REF_URL = "https://pkmncards.com/card/"
|
|
|
|
# Google Sheets Configuration
|
|
RATINGS_BATTER_FORMULA = (
|
|
'=IMPORTRANGE("1zDmlOw94gTzOAjqOpNdDZsg0O6rxNWkL4-XT6-iL2IE","guide_Batters!A1:CD")'
|
|
)
|
|
RATINGS_PITCHER_FORMULA = '=IMPORTRANGE("1zDmlOw94gTzOAjqOpNdDZsg0O6rxNWkL4-XT6-iL2IE","guide_Pitchers!A1:BQ")'
|
|
RATINGS_SHEET_KEY = "1zDmlOw94gTzOAjqOpNdDZsg0O6rxNWkL4-XT6-iL2IE"
|
|
|
|
# MLB Teams Lookup
|
|
ALL_MLB_TEAMS = {
|
|
"Arizona Diamondbacks": ["ARI", "Diamondbacks"],
|
|
"Atlanta Braves": ["ATL", "MLN", "Braves"],
|
|
"Baltimore Orioles": ["BAL", "Orioles"],
|
|
"Boston Red Sox": ["BOS", "Red Sox"],
|
|
"Chicago Cubs": ["CHC", "Cubs"],
|
|
"Chicago White Sox": ["CHW", "White Sox"],
|
|
"Cincinnati Reds": ["CIN", "Reds"],
|
|
"Cleveland Guardians": ["CLE", "Guardians"],
|
|
"Colorado Rockies": ["COL", "Rockies"],
|
|
"Detroit Tigers": ["DET", "Tigers"],
|
|
"Houston Astros": ["HOU", "Astros"],
|
|
"Kansas City Royals": ["KCR", "Royals"],
|
|
"Los Angeles Angels": ["LAA", "CAL", "Angels"],
|
|
"Los Angeles Dodgers": ["LAD", "Dodgers"],
|
|
"Miami Marlins": ["MIA", "Marlins"],
|
|
"Milwaukee Brewers": ["MIL", "MKE", "Brewers"],
|
|
"Minnesota Twins": ["MIN", "Twins"],
|
|
"New York Mets": ["NYM", "Mets"],
|
|
"New York Yankees": ["NYY", "Yankees"],
|
|
"Oakland Athletics": ["OAK", "Athletics"],
|
|
"Athletics": ["OAK", "Athletics"], # Alias for post-Oakland move
|
|
"Philadelphia Phillies": ["PHI", "Phillies"],
|
|
"Pittsburgh Pirates": ["PIT", "Pirates"],
|
|
"San Diego Padres": ["SDP", "Padres"],
|
|
"Seattle Mariners": ["SEA", "Mariners"],
|
|
"San Francisco Giants": ["SFG", "Giants"],
|
|
"St Louis Cardinals": ["STL", "Cardinals"],
|
|
"Tampa Bay Rays": ["TBR", "Rays"],
|
|
"Texas Rangers": ["TEX", "Senators", "Rangers"],
|
|
"Toronto Blue Jays": ["TOR", "Jays"],
|
|
"Washington Nationals": ["WSN", "WAS", "Nationals"],
|
|
}
|
|
|
|
# Image URLs
|
|
IMAGES = {
|
|
"logo": f"{PD_IMAGE_BUCKET}/sba-logo.png",
|
|
"mvp-hype": f"{PD_IMAGE_BUCKET}/mvp.png",
|
|
"pack-sta": f"{PD_IMAGE_BUCKET}/pack-standard.png",
|
|
"pack-pre": f"{PD_IMAGE_BUCKET}/pack-premium.png",
|
|
"pack-mar": f"{PD_IMAGE_BUCKET}/mario-gauntlet.png",
|
|
"pack-pkmnbs": f"{PD_IMAGE_BUCKET}/pokemon-brilliantstars.jpg",
|
|
"mvp": {
|
|
"Arizona Diamondbacks": f"{PD_IMAGE_BUCKET}/mvp/arizona-diamondbacks.gif",
|
|
"Atlanta Braves": f"{PD_IMAGE_BUCKET}/mvp/atlanta-braves.gif",
|
|
"Baltimore Orioles": f"{PD_IMAGE_BUCKET}/mvp/baltimore-orioles.gif",
|
|
"Boston Red Sox": f"{PD_IMAGE_BUCKET}/mvp/boston-red-sox.gif",
|
|
"Chicago Cubs": f"{PD_IMAGE_BUCKET}/mvp/chicago-cubs.gif",
|
|
"Chicago White Sox": f"{PD_IMAGE_BUCKET}/mvp/chicago-white-sox.gif",
|
|
"Cincinnati Reds": f"{PD_IMAGE_BUCKET}/mvp/cincinnati-reds.gif",
|
|
"Cleveland Indians": f"{PD_IMAGE_BUCKET}/mvp/cleveland-guardians.gif",
|
|
"Cleveland Guardians": f"{PD_IMAGE_BUCKET}/mvp/cleveland-guardians.gif",
|
|
"Colorado Rockies": f"{PD_IMAGE_BUCKET}/mvp/colorado-rockies.gif",
|
|
"Detroit Tigers": f"{PD_IMAGE_BUCKET}/mvp/detroit-tigers.gif",
|
|
"Houston Astros": f"{PD_IMAGE_BUCKET}/mvp/houston-astros.gif",
|
|
"Kansas City Royals": f"{PD_IMAGE_BUCKET}/mvp/kansas-city-royals.gif",
|
|
"Los Angeles Angels": f"{PD_IMAGE_BUCKET}/mvp/los-angeles-angels.gif",
|
|
"Los Angeles Dodgers": f"{PD_IMAGE_BUCKET}/mvp/los-angeles-dodgers.gif",
|
|
"Miami Marlins": f"{PD_IMAGE_BUCKET}/mvp/miami-marlins.gif",
|
|
"Milwaukee Brewers": f"{PD_IMAGE_BUCKET}/mvp/milwaukee-brewers.gif",
|
|
"Minnesota Twins": f"{PD_IMAGE_BUCKET}/mvp/minnesota-twins.gif",
|
|
"New York Mets": f"{PD_IMAGE_BUCKET}/mvp/new-york-mets.gif",
|
|
"New York Yankees": f"{PD_IMAGE_BUCKET}/mvp/new-york-yankees.gif",
|
|
"Oakland Athletics": f"{PD_IMAGE_BUCKET}/mvp/oakland-athletics.gif",
|
|
"Athletics": f"{PD_IMAGE_BUCKET}/mvp/oakland-athletics.gif", # Alias for post-Oakland move
|
|
"Philadelphia Phillies": f"{PD_IMAGE_BUCKET}/mvp/philadelphia-phillies.gif",
|
|
"Pittsburgh Pirates": f"{PD_IMAGE_BUCKET}/mvp/pittsburgh-pirates.gif",
|
|
"San Diego Padres": f"{PD_IMAGE_BUCKET}/mvp/san-diego-padres.gif",
|
|
"Seattle Mariners": f"{PD_IMAGE_BUCKET}/mvp/seattle-mariners.gif",
|
|
"San Francisco Giants": f"{PD_IMAGE_BUCKET}/mvp/san-francisco-giants.gif",
|
|
"St Louis Cardinals": f"{PD_IMAGE_BUCKET}/mvp/st-louis-cardinals.gif",
|
|
"St. Louis Cardinals": f"{PD_IMAGE_BUCKET}/mvp/st-louis-cardinals.gif",
|
|
"Tampa Bay Rays": f"{PD_IMAGE_BUCKET}/mvp/tampa-bay-rays.gif",
|
|
"Texas Rangers": f"{PD_IMAGE_BUCKET}/mvp/texas-rangers.gif",
|
|
"Toronto Blue Jays": f"{PD_IMAGE_BUCKET}/mvp/toronto-blue-jays.gif",
|
|
"Washington Nationals": f"{PD_IMAGE_BUCKET}/mvp/washington-nationals.gif",
|
|
"Junior All Stars": f"{PD_IMAGE_BUCKET}/mvp.png",
|
|
"Mario Super Sluggers": f"{PD_IMAGE_BUCKET}/mvp.png",
|
|
"Pokemon League": f"{PD_IMAGE_BUCKET}/masterball.jpg",
|
|
},
|
|
"gauntlets": f"{PD_IMAGE_BUCKET}/gauntlets.png",
|
|
}
|
|
|
|
# Game Mechanics Charts
|
|
INFIELD_X_CHART = {
|
|
"si1": {
|
|
"rp": "No runner on first: Batter is safe at first and no one covers second. Batter to second, runners only "
|
|
"advance 1 base.\nRunner on first: batter singles, runners advance 1 base.",
|
|
"e1": "Single and Error, batter to second, runners advance 2 bases.",
|
|
"e2": "Single and Error, batter to third, all runners score.",
|
|
"no": "Single, runners advance 1 base.",
|
|
},
|
|
"po": {
|
|
"rp": "The batters hits a popup. None of the fielders take charge on the play and the ball drops in the "
|
|
"infield for a SI1! All runners advance 1 base.",
|
|
"e1": "The catcher drops a popup for an error. All runners advance 1 base.",
|
|
"e2": "The catcher grabs a squib in front of the plate and throws it into right field. The batter goes to "
|
|
"second and all runners score.",
|
|
"no": "The batter pops out to the catcher.",
|
|
},
|
|
"fo": {
|
|
"rp": "Batter swings and misses, but is awarded first base on a catcher interference call! One base error, "
|
|
"baserunners advance only if forced.",
|
|
"e1": "The catcher drops a foul popup for an error. Batter rolls AB again.",
|
|
"e2": "The catcher drops a foul popup for an error. Batter rolls AB again.",
|
|
"no": "Runner(s) on base: make a passed ball check. If no passed ball, batter pops out to the catcher. If a "
|
|
"passed ball occurs, batter roll his AB again.\nNo runners: batter pops out to the catcher",
|
|
},
|
|
"g1": {
|
|
"rp": "Runner on first, <2 outs: runner on first breaks up the double play, gbB\n"
|
|
"Else: gbA",
|
|
"e1": "Error, batter to first, runners advance 1 base.",
|
|
"e2": "Error, batter to second, runners advance 2 bases.",
|
|
"no": "Consult Groundball Chart: `!gbA`",
|
|
},
|
|
"g2": {
|
|
"rp": "Runner(s) on base: fielder makes bad throw for lead runner but batter is out at first for a gbC\n"
|
|
"No runners: gbB",
|
|
"e1": "Error, batter to first, runners advance 1 base.",
|
|
"e2": "Error, batter to second, runners advance 2 bases.",
|
|
"no": "Consult Groundball Chart: `!gbB`",
|
|
},
|
|
"g3": {
|
|
"rp": "Runner(s) on base: fielder checks the runner before throwing to first and allows a SI*\n"
|
|
"No runners: gbC",
|
|
"e1": "Error, batter to first, runners advance 1 base.",
|
|
"e2": "Error, batter to second, runners advance 2 bases.",
|
|
"no": "Consult Groundball Chart: `!gbC`",
|
|
},
|
|
"spd": {
|
|
"rp": "Catcher throws to first and hits the batter-runner in the back, SI1",
|
|
"e1": "Error, batter to first, runners advance 1 base.",
|
|
"e2": "Error, batter to second, runners advance 2 bases.",
|
|
"no": "Speed check, Batter's safe range = Running; if safe, SI*; if out, gbC",
|
|
},
|
|
}
|
|
|
|
OUTFIELD_X_CHART = {
|
|
"si2": {
|
|
"rp": "Batter singles, baserunners advance 2 bases. As the batter rounds first, the fielder throws behind him "
|
|
"and catches him off the bag for an out!",
|
|
"e1": "Single and error, batter to second, runners advance 2 bases.",
|
|
"e2": "Single and error, batter to third, all runners score.",
|
|
"e3": "Single and error, batter to third, all runners score",
|
|
"no": "Single, all runners advance 2 bases.",
|
|
},
|
|
"do2": {
|
|
"rp": "Batter doubles and runners advance three bases, but batter-runner is caught between second and third! "
|
|
"He is tagged out in the rundown.",
|
|
"e1": "Double and error, batter to third, all runners score.",
|
|
"e2": "Double and error, batter to third, all runners score.",
|
|
"e3": "Double and error, batter and all runners score. Little league home run!",
|
|
"no": "Double, all runners advance 2 bases.",
|
|
},
|
|
"do3": {
|
|
"rp": "Batter doubles and runners advance three bases, but batter-runner is caught between second and third! "
|
|
"He is tagged out in the rundown.",
|
|
"e1": "Double and error, batter to third, all runners score.",
|
|
"e2": "Double and error, batter and all runners score. Little league home run!",
|
|
"e3": "Double and error, batter and all runners score. Little league home run!",
|
|
"no": "Double, all runners score.",
|
|
},
|
|
"tr3": {
|
|
"rp": "Batter hits a ball into the gap and the outfielders collide trying to make the play! The ball rolls to "
|
|
"the wall and the batter trots home with an inside-the-park home run!",
|
|
"e1": "Triple and error, batter and all runners score. Little league home run!",
|
|
"e2": "Triple and error, batter and all runners score. Little league home run!",
|
|
"e3": "Triple and error, batter and all runners score. Little league home run!",
|
|
"no": "Triple, all runners score.",
|
|
},
|
|
"f1": {
|
|
"rp": "The outfielder races back and makes a diving catch and collides with the wall! In the time he takes to "
|
|
"recuperate, all baserunners tag-up and advance 2 bases.",
|
|
"e1": "1 base error, runners advance 1 base.",
|
|
"e2": "2 base error, runners advance 2 bases.",
|
|
"e3": "3 base error, batter to third, all runners score.",
|
|
"no": "Flyball A",
|
|
},
|
|
"f2": {
|
|
"rp": "The outfielder catches the flyball for an out. If there is a runner on third, he tags-up and scores. "
|
|
"The play is appealed and the umps rule that the runner left early and is out on the appeal!",
|
|
"e1": "1 base error, runners advance 1 base.",
|
|
"e2": "2 base error, runners advance 2 bases.",
|
|
"e3": "3 base error, batter to third, all runners score.",
|
|
"no": "Flyball B",
|
|
},
|
|
"f3": {
|
|
"rp": "The outfielder makes a running catch in the gap! The lead runner lost track of the ball and was "
|
|
"advancing - he cannot return in time and is doubled off by the outfielder.",
|
|
"e1": "1 base error, runners advance 1 base.",
|
|
"e2": "2 base error, runners advance 2 bases.",
|
|
"e3": "3 base error, batter to third, all runners score.",
|
|
"no": "Flyball C",
|
|
},
|
|
}
|
|
|
|
# Player Rarity Values
|
|
RARITY = {
|
|
"HoF": 8,
|
|
"MVP": 5,
|
|
"All-Star": 3,
|
|
"Starter": 2,
|
|
"Reserve": 1,
|
|
"Replacement": 0,
|
|
}
|
|
|
|
# Discord UI Options
|
|
SELECT_CARDSET_OPTIONS = [
|
|
discord.SelectOption(label="2005 Season", value="27"),
|
|
discord.SelectOption(label="2025 Season", value="24"),
|
|
discord.SelectOption(label="2025 Promos", value="25"),
|
|
discord.SelectOption(label="1998 Season", value="20"),
|
|
discord.SelectOption(label="1998 Promos", value="21"),
|
|
discord.SelectOption(label="2024 Season", value="17"),
|
|
discord.SelectOption(label="2024 Promos", value="18"),
|
|
discord.SelectOption(label="2023 Season", value="9"),
|
|
discord.SelectOption(label="2023 Promos", value="10"),
|
|
discord.SelectOption(label="2022 Season", value="3"),
|
|
discord.SelectOption(label="2022 Promos", value="4"),
|
|
discord.SelectOption(label="2021 Season", value="1"),
|
|
discord.SelectOption(label="2019 Season", value="5"),
|
|
discord.SelectOption(label="2018 Season", value="13"),
|
|
discord.SelectOption(label="2018 Promos", value="14"),
|
|
discord.SelectOption(label="2016 Season", value="11"),
|
|
discord.SelectOption(label="2013 Season", value="6"),
|
|
discord.SelectOption(label="2012 Season", value="7"),
|
|
]
|
|
|
|
# Type Definitions
|
|
ACTIVE_EVENT_LITERAL = Literal["Live 05"]
|
|
DEFENSE_LITERAL = Literal[
|
|
"Pitcher",
|
|
"Catcher",
|
|
"First Base",
|
|
"Second Base",
|
|
"Third Base",
|
|
"Shortstop",
|
|
"Left Field",
|
|
"Center Field",
|
|
"Right Field",
|
|
]
|
|
DEFENSE_NO_PITCHER_LITERAL = Literal[
|
|
"Catcher",
|
|
"First Base",
|
|
"Second Base",
|
|
"Third Base",
|
|
"Shortstop",
|
|
"Left Field",
|
|
"Center Field",
|
|
"Right Field",
|
|
]
|
|
|
|
# Color Definitions
|
|
COLORS = {
|
|
"sba": int("a6ce39", 16),
|
|
"yellow": int("FFEA00", 16),
|
|
"red": int("C70039", 16),
|
|
"white": int("FFFFFF", 16),
|
|
}
|
|
|
|
# Bot Response Content
|
|
INSULTS = [
|
|
"Ugh, who even are you?",
|
|
"Ugh, who even are you? Go away.",
|
|
"Ugh, who even are you? Leave me alone.",
|
|
"I will call the fucking cops!",
|
|
"I will call the fucking cops! Go away.",
|
|
"I will call the fucking cops! Leave me alone",
|
|
"Please don't talk to me",
|
|
"Don't talk to me.",
|
|
"Eww, don't talk to me.",
|
|
"Get away from me.",
|
|
"Get away from me, creep.",
|
|
"Get away from me, loser.",
|
|
"Get away from me, pedobear.",
|
|
"Why are you even here?",
|
|
"Why are you even here? Get lost.",
|
|
"Why are you even here? Scram.",
|
|
"Why are you even here? No one knows who you are.",
|
|
"HEY, DON'T TOUCH ME!",
|
|
"Hey, don't touch me!",
|
|
]
|