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
+1 -1
View File
@@ -40,7 +40,7 @@ class DummyLogprobsMode(Enum):
def test_hash_factors_deterministic():
"""Test that hash_factors produces consistent SHA-256 hashes"""
"""Test that hash_factors produces consistent SHA-256 hashes."""
factors = {"a": 1, "b": "test"}
hash1 = hash_factors(factors)
hash2 = hash_factors(factors)
+4 -2
View File
@@ -372,7 +372,8 @@ class _HeterogeneousConfig(PretrainedConfig):
"""A heterogeneous config with no convertor of its own.
Mirrors the parts vLLM uses: per-layer configs are shallow copies with the
varying attributes applied and heterogeneity stripped, so they do not recurse."""
varying attributes applied and heterogeneity stripped, so they do not recurse.
"""
is_heterogeneous = True
@@ -471,7 +472,8 @@ def test_deepseek_v4_convertor_splits_vision_architecture():
"""The vision checkpoint shares model_type/architectures with the
text-only DeepSeek-V4; the convertor routes it to the VL wrapper class
by rewriting hf_config.architectures (model-class resolution reads the
raw attribute)."""
raw attribute).
"""
from vllm.transformers_utils.configs.deepseek_v4 import DeepseekV4Config
from vllm.transformers_utils.model_arch_config_convertor import (
DeepseekV4ModelArchConfigConvertor,
+1 -3
View File
@@ -9,12 +9,10 @@ from vllm.v1.engine.async_llm import AsyncLLM
def test_mp_reducer():
"""
Test that _reduce_config reducer is registered when AsyncLLM is instantiated
"""Test that _reduce_config reducer is registered when AsyncLLM is instantiated
without transformers_modules. This is a regression test for
https://github.com/vllm-project/vllm/pull/18640.
"""
# Ensure transformers_modules is not in sys.modules
if "transformers_modules" in sys.modules:
del sys.modules["transformers_modules"]
+10 -5
View File
@@ -42,7 +42,8 @@ def test_mm_encoder_attn_backend_hash_updates():
def test_language_model_only_does_not_affect_mm_hash():
"""language_model_only does not affect the ViT computation graph,
so it should not change the multimodal config hash."""
so it should not change the multimodal config hash.
"""
base_hash = MultiModalConfig().compute_hash()
lm_only_hash = MultiModalConfig(language_model_only=True).compute_hash()
assert base_hash == lm_only_hash
@@ -50,7 +51,8 @@ def test_language_model_only_does_not_affect_mm_hash():
def test_language_model_only_affects_model_hash():
"""language_model_only affects the LM computation graph,
so it should change the model config hash."""
so it should change the model config hash.
"""
model = "llava-hf/llava-1.5-7b-hf"
base_hash = ModelConfig(model).compute_hash()
lm_only_hash = ModelConfig(model, language_model_only=True).compute_hash()
@@ -386,7 +388,8 @@ def _resolve_mm_video_decode_device(
torchcodec_available: bool = True,
) -> dict:
"""Run processor-device then video-decode-device resolution and report
the resulting video media IO kwargs."""
the resulting video media IO kwargs.
"""
mm_config = MultiModalConfig(
mm_processor_kwargs={} if device is None else {"device": device},
mm_tensor_ipc=mm_tensor_ipc, # type: ignore[arg-type]
@@ -416,7 +419,8 @@ def _resolve_mm_video_decode_device(
def test_auto_video_decode_uses_nvdec_on_encoder_instance():
"""The processor runs on the accelerator there, so decoded frames should
stay on-device too."""
stay on-device too.
"""
assert _resolve_mm_video_decode_device(ec_role="ec_producer") == {
"backend": "torchcodec",
"device": "cuda",
@@ -428,7 +432,8 @@ def test_auto_video_decode_stays_on_cpu_off_encoder_instance(
ec_role: ECRole | None,
):
"""The processor stays on CPU off encode-only instances, so video
decoding should too."""
decoding should too.
"""
assert _resolve_mm_video_decode_device(ec_role=ec_role) == {}
@@ -34,7 +34,8 @@ def _make_hf_config(**kwargs) -> PretrainedConfig:
@pytest.mark.cpu_test
def test_dict_overrides_are_not_forwarded_to_draft():
"""Dict overrides are target-specific key patches; the draft must get
only the architecture-mapping override."""
only the architecture-mapping override.
"""
composed = SpeculativeConfig.compose_draft_hf_overrides(
{"max_position_embeddings": 1234}
)
@@ -50,7 +51,8 @@ def test_none_overrides_fall_back_to_arch_mapping():
@pytest.mark.cpu_test
def test_callable_overrides_reach_the_draft_config():
"""A callable override (config-to-config transform) composes with the
architecture-mapping override and is applied to the draft config."""
architecture-mapping override and is applied to the draft config.
"""
def shrink(hf_config: PretrainedConfig) -> PretrainedConfig:
hf_config.num_hidden_layers = 1
@@ -67,7 +69,8 @@ def test_callable_overrides_reach_the_draft_config():
@pytest.mark.cpu_test
def test_arch_mapping_applies_before_callable_override():
"""The static arch-mapping override runs first, so the user callable
observes (and may adjust) the post-mapping config."""
observes (and may adjust) the post-mapping config.
"""
seen_architectures: list[str] = []
def record(hf_config: PretrainedConfig) -> PretrainedConfig:
@@ -128,7 +131,8 @@ def test_composed_override_is_picklable():
the composed override must be picklable. A nested local closure is not
(it raised ``Can't get local object`` on DFlashDraftModel); a
``functools.partial`` over a module-referenceable static method is.
Guard against regressing to a closure."""
Guard against regressing to a closure.
"""
composed = SpeculativeConfig.compose_draft_hf_overrides(_module_level_shrink)
assert isinstance(composed, functools.partial)
@@ -99,7 +99,8 @@ def test_independent_draft_model_keeps_its_own_limit(
vllm_caplog: pytest.LogCaptureFixture,
):
"""An independent AR draft may genuinely have a smaller context than the
target; its max_position_embeddings must not be resized."""
target; its max_position_embeddings must not be resized.
"""
target_model_config = ModelConfig(
AR_MODEL, hf_overrides={"max_position_embeddings": 8192}
)