paper-dynasty-discord/helpers/__init__.py
Cal Corum 04d6cf3b5e fix: replace star imports with explicit named imports across codebase
Convert all `from x import *` to explicit imports in 12 files, resolving
925 F403/F405 ruff violations. Each name traced to its canonical source
module. Also fixes: duplicate Session import (players.py), missing
sample_team_data fixture param, duplicate method name paperdex_cardset_slash,
unused commands import in package __init__ files, and Play type hint in
play_lock.py.

3 pre-existing code bugs remain (F811 duplicate test names, F821 undefined
`question` variable) — these need investigation, not mechanical fixes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 12:48:07 -05:00

158 lines
3.5 KiB
Python

"""
Helpers Package
This package contains all helper modules for the Paper Dynasty Discord Bot.
The package is organized into logical modules for better maintainability.
Modules:
- constants: Application constants and configuration
- utils: General utility functions
- random_content: Random content generators
- search_utils: Search and fuzzy matching functionality
- discord_utils: Discord helper functions
- cards: Card display and pagination functions (future)
- packs: Pack opening and management (future)
- sheets: Google Sheets operations (future)
- teams: Team-related utilities (future)
- players: Player-related utilities (future)
"""
# Re-export all public names for backward compatibility.
# Other modules do `from helpers import some_name`.
from helpers.main import ( # noqa: F401
get_player_photo,
get_player_headshot,
get_team_by_owner,
team_role,
get_all_pos,
share_channel,
get_card_embeds,
image_embed,
is_shiny,
display_cards,
embed_pagination,
get_test_pack,
roll_for_cards,
give_packs,
get_sheets,
create_team_sheet,
refresh_sheet,
delete_sheet,
share_sheet,
get_blank_team_card,
get_rosters,
get_roster_lineups,
post_ratings_guide,
legal_channel,
app_legal_channel,
is_ephemeral_channel,
is_restricted_channel,
can_send_message,
send_safe_message,
get_role,
team_summary_embed,
give_cards_to_team,
get_ratings_guide,
paperdex_cardset_embed,
paperdex_team_embed,
get_pack_cover,
open_st_pr_packs,
get_choice_from_cards,
open_choice_pack,
confirm_pack_purchase,
player_desc,
player_pcard,
player_bcard,
)
# Import from migrated modules
from .constants import ( # noqa: F401
SBA_SEASON,
PD_SEASON,
ranked_cardsets,
LIVE_CARDSET_ID,
LIVE_PROMO_CARDSET_ID,
MAX_CARDSET_ID,
CARDSETS,
SBA_COLOR,
PD_PLAYERS,
SBA_PLAYERS_ROLE_NAME,
PD_PLAYERS_ROLE_NAME,
ALL_CARDSET_NAMES,
PD_IMAGE_BUCKET,
PKMN_REF_URL,
RATINGS_BATTER_FORMULA,
RATINGS_PITCHER_FORMULA,
RATINGS_SHEET_KEY,
ALL_MLB_TEAMS,
FRANCHISE_NORMALIZE,
normalize_franchise,
IMAGES,
INFIELD_X_CHART,
OUTFIELD_X_CHART,
RARITY,
SELECT_CARDSET_OPTIONS,
ACTIVE_EVENT_LITERAL,
DEFENSE_LITERAL,
DEFENSE_NO_PITCHER_LITERAL,
COLORS,
INSULTS,
)
from .utils import ( # noqa: F401
int_timestamp,
midnight_timestamp,
get_pos_abbrev,
position_name_to_abbrev,
user_has_role,
get_roster_sheet_legacy,
get_roster_sheet,
get_player_url,
owner_only,
get_context_user,
get_cal_user,
)
from .random_content import ( # noqa: F401
random_conf_gif,
random_no_gif,
random_salute_gif,
random_conf_word,
random_codename,
random_no_phrase,
random_gif,
random_from_list,
random_insult,
)
from .search_utils import ( # noqa: F401
fuzzy_search,
fuzzy_player_search,
cardset_search,
)
from .discord_utils import ( # noqa: F401
send_to_bothole,
send_to_news,
typing_pause,
pause_then_type,
check_if_pdhole,
bad_channel,
get_channel,
get_emoji,
react_and_reply,
send_to_channel,
get_or_create_role,
get_special_embed,
get_random_embed,
get_team_embed,
create_channel_old,
create_channel,
)
from .scouting import ( # noqa: F401
SCOUT_TOKENS_PER_DAY,
SCOUT_WINDOW_SECONDS,
SCOUTABLE_PACK_TYPES,
RARITY_SYMBOLS,
get_scout_tokens_used,
build_scout_embed,
build_scouted_card_list,
create_scout_opportunity,
)