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
+4 -5
View File
@@ -340,8 +340,7 @@ class BaseRenderer(ABC, Generic[_T]):
self._mm_warmup_future = None
def warmup(self, chat_params: ChatParams) -> None:
"""
Warm up this renderer to avoid first-request latency.
"""Warm up this renderer to avoid first-request latency.
For chat requests:
- Jinja2 template compilation
@@ -378,7 +377,8 @@ class BaseRenderer(ABC, Generic[_T]):
async def clear_mm_cache_async(self) -> None:
"""Serialize clear_mm_cache through the multimodal executor to avoid
races with concurrent process_inputs on the mm_processor_cache."""
races with concurrent process_inputs on the mm_processor_cache.
"""
await self._clear_mm_cache_async()
def shutdown(self) -> None:
@@ -408,8 +408,7 @@ class BaseRenderer(ABC, Generic[_T]):
return self.tokenizer.eos_token_id
def get_dec_start_token_id(self) -> int:
"""
Obtain the decoder start token id employed by an encoder/decoder model,
"""Obtain the decoder start token id employed by an encoder/decoder model,
raising an error if it is not available.
"""
dec_start_token_id = getattr(
+6 -2
View File
@@ -103,7 +103,8 @@ _TOKENIZE_OVERRIDE_WARNING: Final[str] = (
def _ensure_prompt_embeds_placeholder_token(tokenizer: HfTokenizer) -> int:
"""Register `PROMPT_EMBEDS_PLACEHOLDER_TOKEN` as a special token and return
its token ID."""
its token ID.
"""
cached = _PROMPT_EMBEDS_PLACEHOLDER_TOKEN_ID_CACHE.get(tokenizer)
if cached is not None:
return cached
@@ -192,7 +193,8 @@ def _build_mixed_prompt_embeds(
positions: list[tuple[int, int]],
) -> tuple[torch.Tensor, list[bool]]:
"""Build the full-length `prompt_embeds` tensor and the `is_token_ids`
mask aligned to `token_ids`."""
mask aligned to `token_ids`.
"""
total_len = len(token_ids)
hidden_size = prompt_embeds_tensors[0].shape[1]
dtype = prompt_embeds_tensors[0].dtype
@@ -900,6 +902,7 @@ def rebuild_mm_uuids_from_mm_data(
Returns:
Updated UUIDs dictionary with chunk UUIDs
"""
vision_chunks = mm_data.get("vision_chunk")
if vision_chunks is None:
@@ -932,6 +935,7 @@ def build_video_prompts_from_mm_data(
Returns:
List of video prompts, one per video.
"""
vision_chunks = mm_data.get("vision_chunk")
if vision_chunks is None:
+4 -11
View File
@@ -1,6 +1,4 @@
"""
Schemas and utilities for preprocessing inputs.
"""
"""Schemas and utilities for preprocessing inputs."""
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
@@ -90,8 +88,7 @@ that has been standardized into a dictionary.
class EncoderDecoderDictPrompt(TypedDict):
"""
A [`EncoderDecoderPrompt`][vllm.inputs.llm.EncoderDecoderPrompt]
"""A [`EncoderDecoderPrompt`][vllm.inputs.llm.EncoderDecoderPrompt]
that has been standardized into a dictionary.
"""
@@ -130,9 +127,7 @@ def _validate_prompt_dict(prompt: Mapping[str, object]) -> None:
def parse_dec_only_prompt(prompt: PromptType | object) -> DecoderOnlyDictPrompt:
"""
Parse a prompt for a decoder-only model and normalize it to a dictionary.
"""
"""Parse a prompt for a decoder-only model and normalize it to a dictionary."""
if isinstance(prompt, str):
return TextPrompt(prompt=prompt)
@@ -216,9 +211,7 @@ def _parse_dec_prompt(prompt: PromptType | object) -> DecoderDictPrompt:
def parse_enc_dec_prompt(prompt: PromptType | object) -> EncoderDecoderDictPrompt:
"""
Parse a prompt for an encoder-decoder model and normalize it to a dictionary.
"""
"""Parse a prompt for an encoder-decoder model and normalize it to a dictionary."""
if isinstance(prompt, dict) and "encoder_prompt" in prompt:
enc_prompt = prompt["encoder_prompt"] # type: ignore[typeddict-item]
dec_prompt = prompt["decoder_prompt"] # type: ignore[typeddict-item]
+2 -5
View File
@@ -1,6 +1,4 @@
"""
Schemas and utilities for tokenization inputs.
"""
"""Schemas and utilities for tokenization inputs."""
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
@@ -30,8 +28,7 @@ that has been tokenized.
class EncoderDecoderTokPrompt(TypedDict):
"""
A
"""A
[`EncoderDecoderDictPrompt`][vllm.renderers.inputs.preprocess.EncoderDecoderDictPrompt]
that has been tokenized.
"""
+5 -1
View File
@@ -233,6 +233,7 @@ class OnlineDerenderer:
Returns:
(new_text, updated_state) — the delta text for this chunk and the
state to pass to the next call.
"""
prev_tokens = list(state.prev_tokens)
prefix_offset = state.prefix_offset
@@ -296,6 +297,7 @@ class OnlineDerenderer:
Returns:
(chunk, updated_state) — the derendered SSE chunk and the state
the client must pass to the next call.
"""
if state is None:
state = DerenderStreamState()
@@ -461,6 +463,7 @@ class OnlineDerenderer:
Returns:
(chunk, updated_state) — the derendered chunk and updated state.
"""
if state is None:
state = DerenderStreamState()
@@ -613,7 +616,8 @@ def _convert_chat_logprobs_to_completion_logprobs(
logprobs: ChatCompletionLogProbs,
) -> CompletionLogProbs:
"""Convert ChatCompletionLogProbs (per-token objects) to CompletionLogProbs
(parallel flat lists) as required by the /v1/completions response schema."""
(parallel flat lists) as required by the /v1/completions response schema.
"""
if logprobs.content is None:
return CompletionLogProbs()
+2 -4
View File
@@ -425,8 +425,7 @@ class TokenizeParams:
tokenizer: TokenizerLike | None,
prompt: TextPrompt,
) -> TextPrompt:
"""
Ensure that the prompt meets the requirements set out by this config.
"""Ensure that the prompt meets the requirements set out by this config.
If that is not possible, raise a `VLLMValidationError`.
This method is run before tokenization occurs.
@@ -538,8 +537,7 @@ class TokenizeParams:
tokenizer: TokenizerLike | None,
prompt: TokensPrompt | EmbedsPrompt,
) -> TokensPrompt | EmbedsPrompt:
"""
Ensure that the prompt meets the requirements set out by this config.
"""Ensure that the prompt meets the requirements set out by this config.
If that is not possible, raise a `VLLMValidationError`.
This method is run after tokenization occurs.