fix: correct Dict[str, any] to Dict[str, Any] in type annotations (#15) #31

Merged
cal merged 2 commits from ai/paper-dynasty-card-creation-15 into main 2026-03-23 12:12:30 +00:00
Collaborator

Closes #15

Summary

Dict[str, any] in two function signatures referenced Python's builtin any() function instead of typing.Any. This is a silent type annotation error — the annotation is technically valid Python but semantically wrong for type checkers.

Changes

  • pitchers/creation.py: Added Any to typing import; fixed cardset: Dict[str, any]cardset: Dict[str, Any]
  • batters/creation.py: Added Any to typing import; fixed cardset: Dict[str, any]cardset: Dict[str, Any]

Test Results

No test suite in this repo. Changes verified by reading back modified files and confirming no remaining Dict[str, any] occurrences in .py files.

Closes #15 ## Summary `Dict[str, any]` in two function signatures referenced Python's builtin `any()` function instead of `typing.Any`. This is a silent type annotation error — the annotation is technically valid Python but semantically wrong for type checkers. ## Changes - `pitchers/creation.py`: Added `Any` to `typing` import; fixed `cardset: Dict[str, any]` → `cardset: Dict[str, Any]` - `batters/creation.py`: Added `Any` to `typing` import; fixed `cardset: Dict[str, any]` → `cardset: Dict[str, Any]` ## Test Results No test suite in this repo. Changes verified by reading back modified files and confirming no remaining `Dict[str, any]` occurrences in `.py` files.
Claude added 1 commit 2026-03-20 21:04:19 +00:00
Closes #15

`any` (lowercase) refers to the builtin function, not `typing.Any`.
Added `Any` to the `typing` imports in both files and updated the
`cardset` parameter annotation accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude added the
ai-reviewing
label 2026-03-20 21:15:48 +00:00
Claude reviewed 2026-03-20 21:17:17 +00:00
Claude left a comment
Author
Collaborator

AI Code Review

Files Reviewed

  • batters/creation.py (modified)
  • pitchers/creation.py (modified)

Findings

Correctness

  • The type annotation fix is correct. Dict[str, any] referenced Python's builtin any() function (a callable) rather than typing.Any. Type checkers like mypy would flag this as incorrect.
  • Any is now properly imported from typing in both files.
  • Fix is applied to the correct signatures: post_player_updates(cardset: Dict[str, Any], ...) in both modules.
  • No remaining Dict[str, any] occurrences in the changed files.

Security

  • No issues found.

Style & Conventions

  • No issues found with the primary fix.
  • Note (out of scope): The diff includes several f-string quote-style normalizations (single → double outer quotes, e.g. f'...'f"...") across both files that are not mentioned in the PR title, body, or linked issue #15. These changes are all functionally equivalent and introduce no bugs, but they expand the scope beyond the stated fix. Future reviewers should be aware that git blame on these lines will point to this PR rather than the original authoring commit.

Suggestions

  • Consider noting the f-string normalization in the PR description for traceability — even though the changes are safe.

Verdict: APPROVED

Clean, targeted type annotation fix. The core change is correct and the Any import is properly added in both files. The incidental f-string quote normalization is harmless, though it goes undocumented.


Automated review by Claude PR Reviewer

## AI Code Review ### Files Reviewed - `batters/creation.py` (modified) - `pitchers/creation.py` (modified) ### Findings #### Correctness - The type annotation fix is correct. `Dict[str, any]` referenced Python's builtin `any()` function (a callable) rather than `typing.Any`. Type checkers like mypy would flag this as incorrect. - `Any` is now properly imported from `typing` in both files. - Fix is applied to the correct signatures: `post_player_updates(cardset: Dict[str, Any], ...)` in both modules. - No remaining `Dict[str, any]` occurrences in the changed files. #### Security - No issues found. #### Style & Conventions - No issues found with the primary fix. - **Note (out of scope):** The diff includes several f-string quote-style normalizations (single → double outer quotes, e.g. `f'...'` → `f"..."`) across both files that are not mentioned in the PR title, body, or linked issue #15. These changes are all **functionally equivalent** and introduce no bugs, but they expand the scope beyond the stated fix. Future reviewers should be aware that `git blame` on these lines will point to this PR rather than the original authoring commit. #### Suggestions - Consider noting the f-string normalization in the PR description for traceability — even though the changes are safe. ### Verdict: APPROVED Clean, targeted type annotation fix. The core change is correct and the `Any` import is properly added in both files. The incidental f-string quote normalization is harmless, though it goes undocumented. --- *Automated review by Claude PR Reviewer*
Claude added
ai-reviewed
and removed
ai-reviewing
labels 2026-03-20 21:17:26 +00:00
cal approved these changes 2026-03-23 12:07:53 +00:00
Dismissed
cal left a comment
Owner

AI Code Review

Files Reviewed

  • batters/creation.py (modified)
  • pitchers/creation.py (modified)

Findings

Correctness

The primary fix is correct and complete. Dict[str, any] referenced Python's built-in any() function — a valid but semantically wrong type annotation. Both files now import Any from typing and use Dict[str, Any] in the post_player_updates() signature. No remaining Dict[str, any] occurrences.

The diff also includes several incidental f-string quote style cleanups (outer double quotes, inner single quotes) in both files. These are functionally identical to the originals — no behavioral change.

Security

No issues found. No new inputs, network calls, or data handling introduced.

Style & Conventions

The f-string quote style changes are consistent with PEP 8 preference for double-quoted outer strings. The Any import is correctly placed alongside the existing Dict import on the same line (from typing import Any, Dict), keeping the import block tidy.

Suggestions

None. The scope is appropriately narrow for a type annotation fix.

Verdict: APPROVED

Correct fix for a real (if silent) type annotation bug. The incidental f-string cleanups are safe and improve consistency. No logic changes, no behavioral risk.


Automated review by Claude PR Reviewer

## AI Code Review ### Files Reviewed - `batters/creation.py` (modified) - `pitchers/creation.py` (modified) ### Findings #### Correctness The primary fix is correct and complete. `Dict[str, any]` referenced Python's built-in `any()` function — a valid but semantically wrong type annotation. Both files now import `Any` from `typing` and use `Dict[str, Any]` in the `post_player_updates()` signature. No remaining `Dict[str, any]` occurrences. The diff also includes several incidental f-string quote style cleanups (outer double quotes, inner single quotes) in both files. These are functionally identical to the originals — no behavioral change. #### Security No issues found. No new inputs, network calls, or data handling introduced. #### Style & Conventions The f-string quote style changes are consistent with PEP 8 preference for double-quoted outer strings. The `Any` import is correctly placed alongside the existing `Dict` import on the same line (`from typing import Any, Dict`), keeping the import block tidy. #### Suggestions None. The scope is appropriately narrow for a type annotation fix. ### Verdict: APPROVED Correct fix for a real (if silent) type annotation bug. The incidental f-string cleanups are safe and improve consistency. No logic changes, no behavioral risk. --- *Automated review by Claude PR Reviewer*
cal approved these changes 2026-03-23 12:12:14 +00:00
cal left a comment
Owner

Approved. Correct fix — Any from typing must be capitalized; any is a Python builtin, not a type alias.

Approved. Correct fix — `Any` from `typing` must be capitalized; `any` is a Python builtin, not a type alias.
cal added 1 commit 2026-03-23 12:12:21 +00:00
cal merged commit deaa43432b into main 2026-03-23 12:12:30 +00:00
cal deleted branch ai/paper-dynasty-card-creation-15 2026-03-23 12:12:30 +00:00
Sign in to join this conversation.
No reviewers
cal
No Milestone
No project
No Assignees
2 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-card-creation#31
No description provided.