[Lint] Add python/sglang to ruff F401 checks and remove unused imports in files (#11685)

This commit is contained in:
Chang Su
2025-10-17 16:49:46 -07:00
committed by GitHub
parent 2614adf9ca
commit 627974405d
150 changed files with 124 additions and 405 deletions

View File

@@ -228,7 +228,7 @@ def support_triton(backend: str) -> bool:
try:
import sgl_kernel
import sgl_kernel # noqa: F401
is_intel_amx_backend_available = hasattr(
torch.ops.sgl_kernel, "convert_weight_packed"
@@ -1556,7 +1556,7 @@ def get_hpu_memory_capacity():
def get_npu_memory_capacity():
try:
import torch_npu
import torch_npu # noqa: F401
return torch.npu.mem_get_info()[1] // 1024 // 1024 # unit: MB
except ImportError as e:
@@ -1743,7 +1743,7 @@ def get_device(device_id: Optional[int] = None) -> str:
if is_habana_available():
try:
import habana_frameworks.torch.hpu
import habana_frameworks.torch.hpu # noqa: F401
if torch.hpu.is_available():
if device_id == None:
@@ -1773,7 +1773,7 @@ def get_device_count() -> int:
if is_habana_available():
try:
import habana_frameworks.torch.hpu
import habana_frameworks.torch.hpu # noqa: F401
if torch.hpu.is_available():
return torch.hpu.device_count()