Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
62797440
"docs/source/_figures/div.tex" did not exist on "cf967b1f2b80a4f59442f30ba42bc5190746cae2"
Unverified
Commit
62797440
authored
Oct 17, 2025
by
Chang Su
Committed by
GitHub
Oct 17, 2025
Browse files
[Lint] Add `python/sglang` to ruff F401 checks and remove unused imports in files (#11685)
parent
2614adf9
Changes
150
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
11 additions
and
29 deletions
+11
-29
python/sglang/srt/function_call/glm4_moe_detector.py
python/sglang/srt/function_call/glm4_moe_detector.py
+1
-5
python/sglang/srt/function_call/json_array_parser.py
python/sglang/srt/function_call/json_array_parser.py
+0
-2
python/sglang/srt/function_call/utils.py
python/sglang/srt/function_call/utils.py
+0
-1
python/sglang/srt/grpc/compile_proto.py
python/sglang/srt/grpc/compile_proto.py
+1
-1
python/sglang/srt/grpc/grpc_request_manager.py
python/sglang/srt/grpc/grpc_request_manager.py
+0
-1
python/sglang/srt/layers/activation.py
python/sglang/srt/layers/activation.py
+4
-1
python/sglang/srt/layers/attention/ascend_backend.py
python/sglang/srt/layers/attention/ascend_backend.py
+0
-1
python/sglang/srt/layers/attention/base_attn_backend.py
python/sglang/srt/layers/attention/base_attn_backend.py
+1
-1
python/sglang/srt/layers/attention/fla/chunk.py
python/sglang/srt/layers/attention/fla/chunk.py
+0
-1
python/sglang/srt/layers/attention/fla/chunk_o.py
python/sglang/srt/layers/attention/fla/chunk_o.py
+1
-1
python/sglang/srt/layers/attention/fla/index.py
python/sglang/srt/layers/attention/fla/index.py
+0
-2
python/sglang/srt/layers/attention/fla/layernorm_gated.py
python/sglang/srt/layers/attention/fla/layernorm_gated.py
+0
-1
python/sglang/srt/layers/attention/fla/wy_fast.py
python/sglang/srt/layers/attention/fla/wy_fast.py
+0
-2
python/sglang/srt/layers/attention/flashinfer_backend.py
python/sglang/srt/layers/attention/flashinfer_backend.py
+0
-1
python/sglang/srt/layers/attention/hybrid_attn_backend.py
python/sglang/srt/layers/attention/hybrid_attn_backend.py
+1
-1
python/sglang/srt/layers/attention/hybrid_linear_attn_backend.py
...sglang/srt/layers/attention/hybrid_linear_attn_backend.py
+0
-3
python/sglang/srt/layers/attention/intel_amx_backend.py
python/sglang/srt/layers/attention/intel_amx_backend.py
+1
-1
python/sglang/srt/layers/attention/mamba/causal_conv1d_triton.py
...sglang/srt/layers/attention/mamba/causal_conv1d_triton.py
+0
-1
python/sglang/srt/layers/attention/mamba/ops/ssd_combined.py
python/sglang/srt/layers/attention/mamba/ops/ssd_combined.py
+0
-1
python/sglang/srt/layers/attention/npu_ops/mla_preprocess.py
python/sglang/srt/layers/attention/npu_ops/mla_preprocess.py
+1
-1
No files found.
python/sglang/srt/function_call/glm4_moe_detector.py
View file @
62797440
...
@@ -6,11 +6,7 @@ from typing import List
...
@@ -6,11 +6,7 @@ from typing import List
from
sglang.srt.entrypoints.openai.protocol
import
Tool
from
sglang.srt.entrypoints.openai.protocol
import
Tool
from
sglang.srt.function_call.base_format_detector
import
BaseFormatDetector
from
sglang.srt.function_call.base_format_detector
import
BaseFormatDetector
from
sglang.srt.function_call.core_types
import
(
from
sglang.srt.function_call.core_types
import
StreamingParseResult
,
_GetInfoFunc
StreamingParseResult
,
StructureInfo
,
_GetInfoFunc
,
)
from
sglang.srt.function_call.ebnf_composer
import
EBNFComposer
from
sglang.srt.function_call.ebnf_composer
import
EBNFComposer
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
...
python/sglang/srt/function_call/json_array_parser.py
View file @
62797440
import
json
import
re
from
typing
import
List
from
typing
import
List
from
sglang.srt.entrypoints.openai.protocol
import
Tool
from
sglang.srt.entrypoints.openai.protocol
import
Tool
...
...
python/sglang/srt/function_call/utils.py
View file @
62797440
import
json
from
json
import
JSONDecodeError
,
JSONDecoder
from
json
import
JSONDecodeError
,
JSONDecoder
from
json.decoder
import
WHITESPACE
from
json.decoder
import
WHITESPACE
from
typing
import
Any
,
List
,
Literal
,
Optional
,
Tuple
,
Union
from
typing
import
Any
,
List
,
Literal
,
Optional
,
Tuple
,
Union
...
...
python/sglang/srt/grpc/compile_proto.py
View file @
62797440
...
@@ -70,7 +70,7 @@ def compile_proto(proto_file: Path, output_dir: Path, verbose: bool = True) -> b
...
@@ -70,7 +70,7 @@ def compile_proto(proto_file: Path, output_dir: Path, verbose: bool = True) -> b
# Check if grpc_tools is available
# Check if grpc_tools is available
try
:
try
:
import
grpc_tools.protoc
import
grpc_tools.protoc
# noqa: F401
except
ImportError
:
except
ImportError
:
print
(
"Error: grpcio-tools not installed"
)
print
(
"Error: grpcio-tools not installed"
)
print
(
print
(
...
...
python/sglang/srt/grpc/grpc_request_manager.py
View file @
62797440
...
@@ -27,7 +27,6 @@ from sglang.srt.managers.io_struct import (
...
@@ -27,7 +27,6 @@ from sglang.srt.managers.io_struct import (
TokenizedEmbeddingReqInput
,
TokenizedEmbeddingReqInput
,
TokenizedGenerateReqInput
,
TokenizedGenerateReqInput
,
)
)
from
sglang.srt.managers.scheduler
import
is_health_check_generate_req
from
sglang.srt.server_args
import
PortArgs
,
ServerArgs
from
sglang.srt.server_args
import
PortArgs
,
ServerArgs
from
sglang.srt.utils
import
get_zmq_socket
,
kill_process_tree
from
sglang.srt.utils
import
get_zmq_socket
,
kill_process_tree
from
sglang.utils
import
get_exception_traceback
from
sglang.utils
import
get_exception_traceback
...
...
python/sglang/srt/layers/activation.py
View file @
62797440
...
@@ -380,4 +380,7 @@ if not (
...
@@ -380,4 +380,7 @@ if not (
logger
.
info
(
logger
.
info
(
"sgl-kernel is not available on Non-NV, Non-AMD platforms or Non-AMX CPUs. Fallback to other kernel libraries."
"sgl-kernel is not available on Non-NV, Non-AMD platforms or Non-AMX CPUs. Fallback to other kernel libraries."
)
)
from
vllm.model_executor.layers.activation
import
GeluAndMul
,
SiluAndMul
from
vllm.model_executor.layers.activation
import
(
# noqa: F401
GeluAndMul
,
SiluAndMul
,
)
python/sglang/srt/layers/attention/ascend_backend.py
View file @
62797440
...
@@ -20,7 +20,6 @@ if TYPE_CHECKING:
...
@@ -20,7 +20,6 @@ if TYPE_CHECKING:
from
sglang.srt.layers.radix_attention
import
RadixAttention
from
sglang.srt.layers.radix_attention
import
RadixAttention
from
sglang.srt.model_executor.model_runner
import
ModelRunner
from
sglang.srt.model_executor.model_runner
import
ModelRunner
import
os
import
numpy
as
np
import
numpy
as
np
...
...
python/sglang/srt/layers/attention/base_attn_backend.py
View file @
62797440
from
__future__
import
annotations
from
__future__
import
annotations
from
abc
import
ABC
,
abstractmethod
from
abc
import
ABC
,
abstractmethod
from
typing
import
TYPE_CHECKING
,
Optional
,
Union
from
typing
import
TYPE_CHECKING
,
Optional
import
torch
import
torch
...
...
python/sglang/srt/layers/attention/fla/chunk.py
View file @
62797440
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# Copyright (c) 2023-2025, Songlin Yang, Yu Zhang
# Copyright (c) 2023-2025, Songlin Yang, Yu Zhang
import
warnings
from
typing
import
Optional
from
typing
import
Optional
import
torch
import
torch
...
...
python/sglang/srt/layers/attention/fla/chunk_o.py
View file @
62797440
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# Copyright (c) 2023-2025, Songlin Yang, Yu Zhang
# Copyright (c) 2023-2025, Songlin Yang, Yu Zhang
from
typing
import
Optional
,
Tuple
from
typing
import
Optional
import
torch
import
torch
import
triton
import
triton
...
...
python/sglang/srt/layers/attention/fla/index.py
View file @
62797440
...
@@ -3,9 +3,7 @@
...
@@ -3,9 +3,7 @@
# Copyright (c) 2023-2025, Songlin Yang, Yu Zhang
# Copyright (c) 2023-2025, Songlin Yang, Yu Zhang
import
torch
import
torch
import
torch.nn.functional
as
F
import
triton
import
triton
import
triton.language
as
tl
from
sglang.srt.layers.attention.fla.utils
import
tensor_cache
from
sglang.srt.layers.attention.fla.utils
import
tensor_cache
...
...
python/sglang/srt/layers/attention/fla/layernorm_gated.py
View file @
62797440
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
# This backward pass is faster for dimensions up to 8k, but after that it's much slower due to register spilling.
# This backward pass is faster for dimensions up to 8k, but after that it's much slower due to register spilling.
# The models we train have hidden dim up to 8k anyway (e.g. Llama 70B), so this is fine.
# The models we train have hidden dim up to 8k anyway (e.g. Llama 70B), so this is fine.
import
math
import
torch
import
torch
import
torch.nn.functional
as
F
import
torch.nn.functional
as
F
...
...
python/sglang/srt/layers/attention/fla/wy_fast.py
View file @
62797440
...
@@ -9,8 +9,6 @@ import triton
...
@@ -9,8 +9,6 @@ import triton
import
triton.language
as
tl
import
triton.language
as
tl
from
sglang.srt.layers.attention.fla.index
import
prepare_chunk_indices
from
sglang.srt.layers.attention.fla.index
import
prepare_chunk_indices
from
sglang.srt.layers.attention.fla.op
import
safe_exp
from
sglang.srt.layers.attention.fla.utils
import
check_shared_mem
@
triton
.
heuristics
({
"IS_VARLEN"
:
lambda
args
:
args
[
"cu_seqlens"
]
is
not
None
})
@
triton
.
heuristics
({
"IS_VARLEN"
:
lambda
args
:
args
[
"cu_seqlens"
]
is
not
None
})
...
...
python/sglang/srt/layers/attention/flashinfer_backend.py
View file @
62797440
...
@@ -50,7 +50,6 @@ if is_flashinfer_available():
...
@@ -50,7 +50,6 @@ if is_flashinfer_available():
fast_decode_plan
,
fast_decode_plan
,
)
)
from
flashinfer.cascade
import
merge_state
from
flashinfer.cascade
import
merge_state
from
flashinfer.decode
import
_get_range_buf
,
get_seq_lens
class
WrapperDispatch
(
Enum
):
class
WrapperDispatch
(
Enum
):
...
...
python/sglang/srt/layers/attention/hybrid_attn_backend.py
View file @
62797440
from
typing
import
Optional
,
Union
from
typing
import
Optional
import
torch
import
torch
...
...
python/sglang/srt/layers/attention/hybrid_linear_attn_backend.py
View file @
62797440
from
dataclasses
import
astuple
,
dataclass
from
functools
import
lru_cache
from
typing
import
Optional
,
Union
from
typing
import
Optional
,
Union
import
torch
import
torch
import
torch.nn.functional
as
F
from
sglang.srt.layers.attention.base_attn_backend
import
AttentionBackend
from
sglang.srt.layers.attention.base_attn_backend
import
AttentionBackend
from
sglang.srt.layers.attention.fla.chunk
import
chunk_gated_delta_rule
from
sglang.srt.layers.attention.fla.chunk
import
chunk_gated_delta_rule
...
...
python/sglang/srt/layers/attention/intel_amx_backend.py
View file @
62797440
...
@@ -14,7 +14,7 @@ if TYPE_CHECKING:
...
@@ -14,7 +14,7 @@ if TYPE_CHECKING:
class
IntelAMXAttnBackend
(
AttentionBackend
):
class
IntelAMXAttnBackend
(
AttentionBackend
):
def
__init__
(
self
,
model_runner
:
ModelRunner
):
def
__init__
(
self
,
model_runner
:
ModelRunner
):
import
sgl_kernel
import
sgl_kernel
# noqa: F401
super
().
__init__
()
super
().
__init__
()
self
.
forward_metadata
=
None
self
.
forward_metadata
=
None
...
...
python/sglang/srt/layers/attention/mamba/causal_conv1d_triton.py
View file @
62797440
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
from
typing
import
List
,
Optional
,
Union
from
typing
import
List
,
Optional
,
Union
import
numpy
as
np
import
torch
import
torch
import
triton
import
triton
import
triton.language
as
tl
import
triton.language
as
tl
...
...
python/sglang/srt/layers/attention/mamba/ops/ssd_combined.py
View file @
62797440
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
import
torch
import
torch
import
triton
import
triton
import
triton.language
as
tl
from
einops
import
rearrange
from
einops
import
rearrange
from
packaging
import
version
from
packaging
import
version
...
...
python/sglang/srt/layers/attention/npu_ops/mla_preprocess.py
View file @
62797440
...
@@ -13,7 +13,7 @@ def is_mla_preprocess_enabled() -> bool:
...
@@ -13,7 +13,7 @@ def is_mla_preprocess_enabled() -> bool:
if
is_mla_preprocess_enabled
():
if
is_mla_preprocess_enabled
():
import
sgl_kernel_npu
import
sgl_kernel_npu
# noqa: F401
import
torch_npu
import
torch_npu
torch
.
npu
.
config
.
allow_internal_format
=
True
torch
.
npu
.
config
.
allow_internal_format
=
True
...
...
Prev
1
2
3
4
5
6
…
8
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment