fix: remove unused PLAYER_CACHE variable from api_calls.py (#37) #64

Closed
cal wants to merge 13 commits from ai/paper-dynasty-discord-37 into main
Owner

Summary

Removes the dead PLAYER_CACHE = {} variable at api_calls.py:21.

What was wrong

PLAYER_CACHE = {} was defined at module level but never read or written anywhere in api_calls.py. The actual player cache lives in in_game/data_cache.py:9 and is actively used there. The api_calls.py copy was misleading dead code.

Changes

  • api_calls.py: Deleted line 21 (PLAYER_CACHE = {})

Verification

  • grep -r PLAYER_CACHE confirms no remaining references to the deleted variable
  • in_game/data_cache.py is the only file where PLAYER_CACHE is functionally used
  • cogs/admins.py:578 has a commented-out reference to in_game.data_cache.PLAYER_CACHE (the correct one) — unaffected

Other observations

  • master_debug = True on the adjacent line is a separate issue (#58) — not touched here
  • api_calls.py has two unused imports (datetime, dataclass) per Pyright — pre-existing, out of scope
## Summary Removes the dead `PLAYER_CACHE = {}` variable at `api_calls.py:21`. ## What was wrong `PLAYER_CACHE = {}` was defined at module level but never read or written anywhere in `api_calls.py`. The actual player cache lives in `in_game/data_cache.py:9` and is actively used there. The `api_calls.py` copy was misleading dead code. ## Changes - `api_calls.py`: Deleted line 21 (`PLAYER_CACHE = {}`) ## Verification - `grep -r PLAYER_CACHE` confirms no remaining references to the deleted variable - `in_game/data_cache.py` is the only file where `PLAYER_CACHE` is functionally used - `cogs/admins.py:578` has a commented-out reference to `in_game.data_cache.PLAYER_CACHE` (the correct one) — unaffected ## Other observations - `master_debug = True` on the adjacent line is a separate issue (#58) — not touched here - `api_calls.py` has two unused imports (`datetime`, `dataclass`) per Pyright — pre-existing, out of scope
cal added 1 commit 2026-03-05 13:32:20 +00:00
fix: remove unused PLAYER_CACHE variable from api_calls.py (#37)
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m10s
2a39139428
Dead variable that was never read or written. Actual player cache
lives in in_game/data_cache.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cal added the
ai-reviewing
label 2026-03-05 13:45:04 +00:00
cal reviewed 2026-03-05 13:45:55 +00:00
cal left a comment
Author
Owner

AI Code Review

Files Reviewed

  • api_calls.py (modified — 1 line deleted)

Findings

Correctness

  • Deletion of PLAYER_CACHE = {} at line 21 is accurate. grep -r PLAYER_CACHE confirms zero live read/write references to this variable anywhere in api_calls.py — the variable was defined but never used.
  • in_game/data_cache.py:9 holds the real PLAYER_CACHE and is the only location that reads/writes it (lines 266–282).
  • cogs/admins.py:578 has a commented-out reference to in_game.data_cache.PLAYER_CACHE — correctly scoped to the live cache, unaffected by this change.

Security

  • No issues. Dead variable removal has no security surface.

Style & Conventions

  • Minimal, correctly scoped change. Follows the project pattern of cleaning up dead code in isolated PRs.

Suggestions

  • None. The PR body's notes about master_debug (issue #58) and unused imports (datetime, dataclass) being out of scope are correct — those are separate concerns.

Verdict: APPROVED

Single-line dead code removal. Grep verification is thorough, no live callers exist, and the real PLAYER_CACHE in in_game/data_cache.py is untouched.


Automated review by Claude PR Reviewer

## AI Code Review ### Files Reviewed - `api_calls.py` (modified — 1 line deleted) ### Findings #### Correctness - Deletion of `PLAYER_CACHE = {}` at line 21 is accurate. `grep -r PLAYER_CACHE` confirms zero live read/write references to this variable anywhere in `api_calls.py` — the variable was defined but never used. - `in_game/data_cache.py:9` holds the real `PLAYER_CACHE` and is the only location that reads/writes it (lines 266–282). - `cogs/admins.py:578` has a commented-out reference to `in_game.data_cache.PLAYER_CACHE` — correctly scoped to the live cache, unaffected by this change. #### Security - No issues. Dead variable removal has no security surface. #### Style & Conventions - Minimal, correctly scoped change. Follows the project pattern of cleaning up dead code in isolated PRs. #### Suggestions - None. The PR body's notes about `master_debug` (issue #58) and unused imports (`datetime`, `dataclass`) being out of scope are correct — those are separate concerns. ### Verdict: APPROVED Single-line dead code removal. Grep verification is thorough, no live callers exist, and the real `PLAYER_CACHE` in `in_game/data_cache.py` is untouched. --- *Automated review by Claude PR Reviewer*
cal added
ai-reviewed
and removed
ai-reviewing
labels 2026-03-05 13:46:19 +00:00
cal changed target branch from main to next-release 2026-03-07 07:32:41 +00:00
cal force-pushed ai/paper-dynasty-discord-37 from 2a39139428 to 4d62458b3d 2026-03-07 07:33:58 +00:00 Compare
cal changed target branch from next-release to main 2026-03-23 04:14:26 +00:00
Author
Owner

Closing — will re-implement fresh against main. Original PR had unrebaseable conflicts from the scouting refactor.

Closing — will re-implement fresh against `main`. Original PR had unrebaseable conflicts from the scouting refactor.
cal closed this pull request 2026-03-23 04:15:34 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/paper-dynasty-discord#64
No description provided.