Skip to content

Commit 59b1790

Browse files
committed
add more allowed import
Signed-off-by: Mengqing Cao <cmq0113@163.com>
1 parent 39925d6 commit 59b1790

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tools/check_triton_import.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@
44
import sys
55

66
FORBIDDEN_IMPORT_RE = re.compile(r"^(from|import)\s+triton(\s|\.|$)")
7-
ALLOWED_LINE = "from vllm.triton_utils import triton"
7+
8+
# the way allowed to import triton
9+
ALLOWED_LINES = {
10+
"from vllm.triton_utils import triton",
11+
"from vllm.triton_utils import tl",
12+
"from vllm.triton_utils import tl, triton",
13+
}
814

915

1016
def is_forbidden_import(line: str) -> bool:
11-
return bool(FORBIDDEN_IMPORT_RE.match(
12-
line.strip())) and ALLOWED_LINE not in line.strip()
17+
stripped = line.strip()
18+
return bool(
19+
FORBIDDEN_IMPORT_RE.match(stripped)) and stripped not in ALLOWED_LINES
1320

1421

1522
def parse_diff(diff: str) -> list[str]:

0 commit comments

Comments
 (0)