We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 39925d6 commit 59b1790Copy full SHA for 59b1790
tools/check_triton_import.py
@@ -4,12 +4,19 @@
4
import sys
5
6
FORBIDDEN_IMPORT_RE = re.compile(r"^(from|import)\s+triton(\s|\.|$)")
7
-ALLOWED_LINE = "from vllm.triton_utils import triton"
+
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
+}
14
15
16
def is_forbidden_import(line: str) -> bool:
- return bool(FORBIDDEN_IMPORT_RE.match(
- 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
20
21
22
def parse_diff(diff: str) -> list[str]:
0 commit comments