Skip to content

fix(adapters): reverse mapping views without list conversion - #1656

Open
harshit3355 wants to merge 2 commits into
bluesky:mainfrom
harshit3355:fix/809-reverse-generic-mapping-items
Open

harshit3355 wants to merge 2 commits into
bluesky:mainfrom
harshit3355:fix/809-reverse-generic-mapping-items

Conversation

@harshit3355

Copy link
Copy Markdown

Summary

Use built-in reverse iteration for mapping items without first materializing an intermediate list. Normalize generic mapping views so one-shot cached views remain supported, and add a regression test for that behavior. Includes the required Unreleased changelog entry.

Closes #809

Verification

  • python -m pytest -q tests/adapters/test_mapping.py passes.
  • ruff check tiled/adapters/mapping.py tests/adapters/test_mapping.py passes.
  • git diff --check passes.

Checklist

  • Add a changelog entry.
  • Include the issue this PR closes.

Migration note: this contribution is now submitted from harshit3355; it replaces #1652, which was opened from a different GitHub account. Please close #1652 in favor of this PR.

@harshit3355
harshit3355 force-pushed the fix/809-reverse-generic-mapping-items branch from 57722aa to 3706eff Compare November 16, 2026 01:47
@harshit3355
harshit3355 force-pushed the fix/809-reverse-generic-mapping-items branch from 3706eff to 47db1a5 Compare November 16, 2026 01:50
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.01%. Comparing base (4e06620) to head (eef4b8f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1656   +/-   ##
=======================================
  Coverage   81.00%   81.01%           
=======================================
  Files         198      198           
  Lines       20756    20760    +4     
=======================================
+ Hits        16813    16818    +5     
+ Misses       3943     3942    -1     
Files with missing lines Coverage Δ
tiled/adapters/mapping.py 94.24% <100.00%> (+0.08%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@danielballan danielballan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! I left one small comment that I think needs to be addressed before we merge.

Comment thread tiled/adapters/mapping.py Resolved
@harshit3355

Copy link
Copy Markdown
Author

Addressed in eef4b8f. The reversed mapping items view now uses a named intermediate, avoiding the shadowed assignment while keeping the no-list conversion.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor to use dict reversal

2 participants