Skip to content

Comments

refactor: replace MIME reverse-lookup loop with dict#17

Merged
drmingdrmer merged 1 commit intomasterfrom
fix/render-to-img-mime-suffix-loop
Feb 22, 2026
Merged

refactor: replace MIME reverse-lookup loop with dict#17
drmingdrmer merged 1 commit intomasterfrom
fix/render-to-img-mime-suffix-loop

Conversation

@drmingdrmer
Copy link
Contributor

Summary

  • Add mime_to_suffix reverse dict in mime.py
  • Replace 5-line loop in render_to_img with single dict lookup
  • O(1) instead of O(n), deterministic result

Test plan

  • make test - all 14 tests pass
  • make lint - all checks pass

Add mime_to_suffix reverse dict in mime.py and use it in render_to_img
instead of iterating over mimetypes to find a key by value.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@drmingdrmer drmingdrmer merged commit 284cc1a into master Feb 22, 2026
12 checks passed
@drmingdrmer drmingdrmer deleted the fix/render-to-img-mime-suffix-loop branch February 22, 2026 12:10
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.

1 participant