From 094891c01a29ebef8bc1977f434b33283f9114c9 Mon Sep 17 00:00:00 2001 From: vzed <207368749+vincentzed@users.noreply.github.com> Date: Sat, 26 Apr 2025 22:26:57 -0400 Subject: [PATCH] fix: Use `is not None` instead of `!= None` for None checks. (#5687) --- python/sglang/bench_serving.py | 4 ++-- python/sglang/srt/code_completion_parser.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python/sglang/bench_serving.py b/python/sglang/bench_serving.py index 47e8a20b2..5290d7a2a 100644 --- a/python/sglang/bench_serving.py +++ b/python/sglang/bench_serving.py @@ -1000,7 +1000,7 @@ async def benchmark( # Use the first request for all warmup iterations test_prompt, test_prompt_len, test_output_len = input_requests[0] - if lora_names != None and len(lora_names) != 0: + if lora_names is not None and len(lora_names) != 0: lora_name = lora_names[0] else: lora_name = None @@ -1060,7 +1060,7 @@ async def benchmark( tasks: List[asyncio.Task] = [] async for request in get_request(input_requests, request_rate): prompt, prompt_len, output_len = request - if lora_names != None and len(lora_names) != 0: + if lora_names is not None and len(lora_names) != 0: idx = random.randint(0, len(lora_names) - 1) lora_name = lora_names[idx] else: diff --git a/python/sglang/srt/code_completion_parser.py b/python/sglang/srt/code_completion_parser.py index 94a98b0fd..81cdb4a36 100644 --- a/python/sglang/srt/code_completion_parser.py +++ b/python/sglang/srt/code_completion_parser.py @@ -113,7 +113,7 @@ def completion_template_exists(template_name: str) -> bool: def is_completion_template_defined() -> bool: global completion_template_name - return completion_template_name != None + return completion_template_name is not None def generate_completion_prompt_from_request(request: ChatCompletionRequest) -> str: