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:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
@@ -26,7 +26,8 @@ def fast_tokenizer():
|
||||
def _make_base_renderer_with(tokenizer):
|
||||
"""Build a minimal BaseRenderer subclass that exposes the tokenizer so we
|
||||
can call ``_tokenize_prompt`` directly. BaseRenderer is abstract because of
|
||||
``render_messages``; we just need a stub."""
|
||||
``render_messages``; we just need a stub.
|
||||
"""
|
||||
from vllm.renderers.base import BaseRenderer
|
||||
|
||||
class _StubRenderer(BaseRenderer):
|
||||
@@ -91,7 +92,8 @@ class TestTokenizePromptOffsets:
|
||||
def test_base_renderer_without_override_yields_no_offsets(self, fast_tokenizer):
|
||||
"""A renderer that does not override ``_can_produce_offsets`` never
|
||||
emits offsets, even with a fast tokenizer and the flag set. This locks
|
||||
in the base-default-False / subclass-override design."""
|
||||
in the base-default-False / subclass-override design.
|
||||
"""
|
||||
from vllm.renderers.base import BaseRenderer
|
||||
|
||||
class _BareRenderer(BaseRenderer):
|
||||
@@ -125,7 +127,8 @@ class TestTokenizePromptOffsets:
|
||||
|
||||
def test_slow_tokenizer_with_flag_no_offsets(self, fast_tokenizer):
|
||||
"""Force is_fast=False to simulate a Slow tokenizer: the flag is set
|
||||
but offsets must not be returned because it cannot produce them."""
|
||||
but offsets must not be returned because it cannot produce them.
|
||||
"""
|
||||
from unittest.mock import PropertyMock, patch
|
||||
|
||||
renderer = _make_base_renderer_with(fast_tokenizer)
|
||||
@@ -144,7 +147,8 @@ class TestTokenizePromptOffsets:
|
||||
@pytest.mark.parametrize("mm_key", ["multi_modal_data", "multi_modal_uuids"])
|
||||
def test_multimodal_with_flag_no_offsets(self, fast_tokenizer, mm_key):
|
||||
"""Offsets index the text prompt, which is meaningless once multimodal
|
||||
data is interleaved, so they are suppressed when MM inputs are present."""
|
||||
data is interleaved, so they are suppressed when MM inputs are present.
|
||||
"""
|
||||
renderer = _make_base_renderer_with(fast_tokenizer)
|
||||
params = TokenizeParams(max_total_tokens=None, return_token_offsets=True)
|
||||
prompt = {"prompt": "Hello.", mm_key: {"image": ["x"]}}
|
||||
@@ -156,7 +160,8 @@ class TestTokenizePromptOffsets:
|
||||
@pytest.mark.asyncio
|
||||
async def test_tokenize_prompt_async_returns_offsets(self, fast_tokenizer):
|
||||
"""The async path offloads the sync tokenizer; it must yield the same
|
||||
offsets as the sync path."""
|
||||
offsets as the sync path.
|
||||
"""
|
||||
renderer = _make_base_renderer_with(fast_tokenizer)
|
||||
params = TokenizeParams(max_total_tokens=None, return_token_offsets=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user