A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
[refactor] improve ConstantList exception specificity (#22156)
Signed-off-by: zitian.zhao <zitian.zhao@tencentmusic.com>
ZiTian.Zhao committed
Aug 4, 2025 at 13:14 UTC
49bcd893e753d89a1c2a95a1c2649819309c1e1b
1 file changed
+8
-8
vllm/v1/utils.py
+8
-8
@@ -34,22 +34,22 @@ class ConstantList(Generic[T], Sequence):
34
self._x = x
35
36
def append(self, item):
37
- raise Exception("Cannot append to a constant list")
37
+ raise TypeError("Cannot append to a constant list")
38
39
def extend(self, item):
40
- raise Exception("Cannot extend a constant list")
40
+ raise TypeError("Cannot extend a constant list")
41
42
def insert(self, item):
43
- raise Exception("Cannot insert into a constant list")
43
+ raise TypeError("Cannot insert into a constant list")
44
45
def pop(self, item):
46
- raise Exception("Cannot pop from a constant list")
46
+ raise TypeError("Cannot pop from a constant list")
47
48
def remove(self, item):
49
- raise Exception("Cannot remove from a constant list")
49
+ raise TypeError("Cannot remove from a constant list")
50
51
def clear(self):
52
- raise Exception("Cannot clear a constant list")
52
+ raise TypeError("Cannot clear a constant list")
53
54
def index(self,
55
item: T,
@@ -78,10 +78,10 @@ class ConstantList(Generic[T], Sequence):
78
...
79
80
def __setitem__(self, item: Union[int, slice], value: Union[T, list[T]]):
81
- raise Exception("Cannot set item in a constant list")
81
+ raise TypeError("Cannot set item in a constant list")
82
83
def __delitem__(self, item):
84
- raise Exception("Cannot delete item from a constant list")
84
+ raise TypeError("Cannot delete item from a constant list")
85
86
def __iter__(self):
87
return iter(self._x)