Skip to content

fix: mypy strict error on _inv_map union type in _vocab_cache init#4

Merged
neluca merged 1 commit into
mainfrom
fix/ruff-format
Jun 15, 2026
Merged

fix: mypy strict error on _inv_map union type in _vocab_cache init#4
neluca merged 1 commit into
mainfrom
fix/ruff-format

Conversation

@neluca

@neluca neluca commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Add assert self._inv_map is not None before the dict comprehension so mypy can narrow the union type. Also removes the unused type: ignore comment that was on the wrong line.

Description

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Code style / refactoring
  • Other (please describe):

Checklist

  • I have run ruff format and ruff check on changed files
  • I have run mypy tinybpe/ --strict and no new errors were introduced
  • I have added tests for the changes
  • All tests pass (pytest tests/)
  • Coverage remains above 95% (pytest --cov=tinybpe tests/)
  • I have updated documentation if applicable

Add assert self._inv_map is not None before the dict comprehension
so mypy can narrow the union type. Also removes the unused type: ignore
comment that was on the wrong line.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@neluca neluca merged commit 09bae21 into main Jun 15, 2026
22 checks passed
@neluca neluca deleted the fix/ruff-format branch June 15, 2026 19:47
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.

2 participants