[mypy] Enable mypy type checking for vllm/core (#7229)

This commit is contained in:
Jonathan Berkhahn
2024-08-27 16:11:14 -07:00
committed by GitHub
parent 5340a2dccf
commit 9c71c97ae2
9 changed files with 31 additions and 18 deletions

View File

@@ -1,9 +1,9 @@
"""Token blocks."""
from typing import List, Optional
from typing import TYPE_CHECKING, Iterator, List, Optional
from vllm.utils import Device
DEFAULT_LAST_ACCESSED_TIME = -1
DEFAULT_LAST_ACCESSED_TIME: float = -1
class PhysicalTokenBlock:
@@ -59,6 +59,11 @@ class BlockTable:
def __getitem__(self, key):
return self._blocks[key]
if TYPE_CHECKING:
def __iter__(self) -> Iterator[PhysicalTokenBlock]:
raise RuntimeError("Method should be automatically generated")
def __setitem__(self, key, value):
if isinstance(key, slice):
blocks = value