Skip to content

Commit 9f5a8cb

Browse files
author
Haiyang Shi
committed
[Fix] Fix typing errors with python3.11
Signed-off-by: Haiyang Shi <[email protected]>
1 parent d408171 commit 9f5a8cb

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

python/aibrix_kvcache/aibrix_kvcache/cache_hashable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def all_tokens(self) -> np.ndarray:
7878
return self._storage
7979

8080
def all_tokens_memoryview(self) -> memoryview:
81-
return memoryview(self._storage)
81+
return memoryview(self._storage) # type: ignore
8282

8383
def __len__(self) -> int:
8484
return len(self._storage)
@@ -144,7 +144,7 @@ def __init__(self, mr: MemoryRegion):
144144

145145
def all_tokens_memoryview(self) -> memoryview:
146146
assert self._mr is not None
147-
return memoryview(np_array_concat(*self._mr.unpack_tokens()))
147+
return memoryview(np_array_concat(*self._mr.unpack_tokens())) # type: ignore
148148

149149
def __len__(self) -> int:
150150
assert self._mr is not None

python/aibrix_kvcache/aibrix_kvcache/l2/key_builders/rolling_hash_key_builder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def build(
4949
start = 1
5050
candidates[1:] = prefix[i : i + self.block_size]
5151

52-
prev_hash = self.hasher.hash(memoryview(candidates[start:]))
52+
prev_hash = self.hasher.hash(memoryview(candidates[start:])) # type: ignore
5353

5454
all = np_array_concat(prefix, tokens)
5555
prefix_len = len(prefix) if prefix is not None else 0
@@ -62,7 +62,7 @@ def build(
6262
candidates[1:] = tokens[i : i + self.block_size]
6363
keys = all[: prefix_len + i + self.block_size]
6464

65-
curr_hash = self.hasher.hash(memoryview(candidates[start:]))
65+
curr_hash = self.hasher.hash(memoryview(candidates[start:])) # type: ignore
6666

6767
results.append((keys, curr_hash.to_bytes(16)))
6868
prev_hash = curr_hash

python/aibrix_kvcache/aibrix_kvcache/l2/key_builders/simple_hash_key_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def build(
4040

4141
prefix_len = len(prefix) if prefix is not None else 0
4242
all = np_array_concat(prefix, tokens)
43-
all_bytes = memoryview(all)
43+
all_bytes = memoryview(all) # type: ignore
4444
for i in range(0, token_size, self.block_size):
4545
keys = all[: prefix_len + i + self.block_size]
4646

0 commit comments

Comments
 (0)