Add pydocstyle to the ruff rules (#52136)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <hej.mellor@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Harry Mellor
2026-09-16 16:44:29 +00:00
committed by GitHub
co-authored by Claude Opus 5
parent 804e5377aa
commit 8c1557a79c
2002 changed files with 15024 additions and 14269 deletions
@@ -30,8 +30,7 @@ def llm(vllm_runner):
@pytest.mark.skip_global_cleanup
def test_tiling_engine_basic(llm):
"""
Basic test with a small number of prompts (less than max_num_seqs).
"""Basic test with a small number of prompts (less than max_num_seqs).
No tiling should be triggered, but the engine still processes correctly.
"""
prompts = ["Hello", "World"]
@@ -41,8 +40,7 @@ def test_tiling_engine_basic(llm):
@pytest.mark.skip_global_cleanup
def test_tiling_engine_many_requests(llm):
"""
Test with a large number of prompts that exceeds max_num_seqs.
"""Test with a large number of prompts that exceeds max_num_seqs.
This verifies that _run_tiling_engine correctly chunks requests,
processes all of them, and returns outputs in the correct order.
"""
@@ -54,8 +52,7 @@ def test_tiling_engine_many_requests(llm):
@pytest.mark.skip_global_cleanup
def test_tiling_engine_with_pooling_params(llm):
"""
Test the tiling engine when different PoolingParams are provided.
"""Test the tiling engine when different PoolingParams are provided.
The engine must handle a list of params that matches the number of prompts.
"""
num_prompts = 10
@@ -77,8 +74,7 @@ def test_tiling_engine_with_pooling_params(llm):
@pytest.mark.skip_global_cleanup
def test_tiling_engine_abort_on_exception(llm):
"""
Test that abort_request IS called with the correct arguments when an
"""Test that abort_request IS called with the correct arguments when an
exception occurs inside the engine's step() loop.
"""
prompts = ["Prompt 0", "Prompt 1", "Prompt 2"]
@@ -111,7 +111,8 @@ def test_basic_embed(server: RemoteOpenAIServer, model_name: str):
def test_unsupported_input_type_rejected(server: RemoteOpenAIServer, model_name: str):
"""An input_type not defined in the model's prompt config should be
rejected with a 400 error."""
rejected with a 400 error.
"""
body = {
"model": model_name,
"input_type": "nonexistent_type",
@@ -138,7 +139,8 @@ def test_omitted_input_type_accepted(server: RemoteOpenAIServer, model_name: str
def test_v1_v2_parity(server: RemoteOpenAIServer, model_name: str):
"""v1 (OpenAI) and v2 (Cohere) endpoints should produce the same
float embeddings for a generic model."""
float embeddings for a generic model.
"""
texts = ["hello world"]
v2 = _cohere_embed(server, model_name, texts=texts, embedding_types=["float"])
v1 = _openai_embed(server, model_name, texts)
@@ -76,7 +76,8 @@ def test_single_text_parity(server: RemoteOpenAIServer):
def test_batch_parity(server: RemoteOpenAIServer):
"""A batch of texts should produce equivalent embeddings via both APIs,
in the same order."""
in the same order.
"""
texts = [
"machine learning",
"deep learning",
@@ -241,7 +241,8 @@ class TestResolveTruncation:
def test_truncate_none_with_max_tokens(self):
"""truncate=NONE should NOT set truncate_prompt_tokens; the
max_tokens limit is enforced separately via _check_max_tokens."""
max_tokens limit is enforced separately via _check_max_tokens.
"""
req = self._make_request(truncate="NONE", max_tokens=10)
tokens, side = EmbedIOProcessor._resolve_cohere_truncation(req)
assert tokens is None
@@ -1,8 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
Run `pytest tests/entrypoints/openai/test_embedding_dimensions.py`.
"""
"""Run `pytest tests/entrypoints/openai/test_embedding_dimensions.py`."""
import openai
import pytest
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
Test cases for long text embedding with automatic chunking mechanism.
"""Test cases for long text embedding with automatic chunking mechanism.
This test suite validates vLLM's automatic chunking functionality for handling
text inputs that exceed the model's maximum token length, specifically targeting
@@ -241,8 +240,8 @@ async def test_long_text_embedding_1500_chars(
client_with_chunked_processing: openai.AsyncOpenAI, model_name: str
):
"""Test embedding processing for ~1500 character long text
(~1028 tokens, exceeding 512 token limit)."""
(~1028 tokens, exceeding 512 token limit).
"""
# Verify text length
# Verify text has sufficient word count (approximately 1500 words)
word_count = len(LONG_TEXT_1500_WORDS.split())
@@ -290,8 +289,8 @@ async def test_long_text_embedding_2500_chars(
client_with_chunked_processing: openai.AsyncOpenAI, model_name: str
):
"""Test embedding processing for ~2500 character long text
(~2048 tokens, requiring multiple chunks)."""
(~2048 tokens, requiring multiple chunks).
"""
# Verify text length
# Verify text has sufficient word count (approximately 2500 words)
word_count = len(LONG_TEXT_2500_WORDS.split())
@@ -339,7 +338,6 @@ async def test_batch_long_text_embedding(
client_with_chunked_processing: openai.AsyncOpenAI, model_name: str
):
"""Test batch long text embedding processing."""
input_texts = [
LONG_TEXT_1500_WORDS,
LONG_TEXT_2500_WORDS,
@@ -384,8 +382,8 @@ async def test_chunked_vs_normal_consistency(
client_with_chunked_processing: openai.AsyncOpenAI, model_name: str
):
"""Test consistency between chunked and
normal processing (using short text)."""
normal processing (using short text).
"""
# Use a short text within the 512 token limit
short_text = (
"Artificial intelligence technology is changing our world, "
@@ -424,7 +422,6 @@ async def test_chunked_processing_response_format(
client_with_chunked_processing: openai.AsyncOpenAI, model_name: str
):
"""Test response format and structure during chunked processing."""
# Test with long text to trigger chunking
embedding_response = await client_with_chunked_processing.embeddings.create(
model=model_name,
@@ -1,7 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Unit tests for Cohere embed protocol: build_typed_embeddings and its
underlying packing helpers, plus Cohere-specific serving helpers."""
underlying packing helpers, plus Cohere-specific serving helpers.
"""
import struct