Skip to content

Commit 09bae21

Browse files
authored
Merge pull request #4 from neluca/fix/ruff-format
fix: mypy strict error on _inv_map union type in _vocab_cache init
2 parents 0a6fc9e + a59588e commit 09bae21

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

tinybpe/tokenizer.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,8 @@ def __init__(
153153
# so we build it once here and cache the inverse-remapped result.
154154
self._vocab_cache: dict[int, bytes] | None = None
155155
if bytes_maps is not None:
156-
self._vocab_cache = {
157-
k: self._inv_map(v)
158-
for k, v in self._enc.vocab.items() # type: ignore[union-attr]
159-
}
156+
assert self._inv_map is not None # guaranteed when bytes_maps is set
157+
self._vocab_cache = {k: self._inv_map(v) for k, v in self._enc.vocab.items()}
160158

161159
# ------------------------------------------------------------------
162160
# Encoding

0 commit comments

Comments
 (0)