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
+3 -8
View File
@@ -13,8 +13,7 @@ from vllm.v1.metrics.ray_wrappers import RayPrometheusStatLogger
@pytest.fixture
def log_stats_enabled_engine_args():
"""
Shared fixture providing common AsyncEngineArgs configuration
"""Shared fixture providing common AsyncEngineArgs configuration
used across multiple tests.
"""
return AsyncEngineArgs(
@@ -27,10 +26,7 @@ def log_stats_enabled_engine_args():
@pytest.mark.asyncio
async def test_async_llm_replace_default_loggers(log_stats_enabled_engine_args):
"""
RayPrometheusStatLogger should replace the default PrometheusStatLogger
"""
"""RayPrometheusStatLogger should replace the default PrometheusStatLogger."""
engine = AsyncLLM.from_engine_args(
log_stats_enabled_engine_args, stat_loggers=[RayPrometheusStatLogger]
)
@@ -40,8 +36,7 @@ async def test_async_llm_replace_default_loggers(log_stats_enabled_engine_args):
@pytest.mark.asyncio
async def test_async_llm_add_to_default_loggers(log_stats_enabled_engine_args):
"""
It's still possible to use custom stat loggers exclusively by passing
"""It's still possible to use custom stat loggers exclusively by passing
disable_log_stats=True in addition to a list of custom stat loggers.
"""
# Create engine_args with disable_log_stats=True for this test
+6 -12
View File
@@ -1,8 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
Tests for the analytic estimators in metrics/flops.py.
"""
"""Tests for the analytic estimators in metrics/flops.py."""
import types
from types import SimpleNamespace
@@ -156,8 +154,7 @@ def test_base_attention_config_parser_with_gqa():
def test_base_attention_config_parser_without_gqa():
"""
Test BaseAttentionConfigParser defaults to MHA when num_key_value_heads not
"""Test BaseAttentionConfigParser defaults to MHA when num_key_value_heads not
specified.
"""
hf_config = Qwen3Config(
@@ -707,9 +704,7 @@ def test_ffn_per_gpu_with_pipeline_parallelism():
def test_moe_per_gpu_with_expert_parallelism():
"""
Test MoE metrics with expert parallelism - verifies num_activated_experts bug fix.
"""
"""Test MoE metrics with expert parallelism, covering num_activated_experts."""
hf_config = Qwen3MoeConfig(
hidden_size=2048,
intermediate_size=8192,
@@ -765,9 +760,7 @@ def test_moe_per_gpu_with_expert_parallelism():
def test_moe_per_gpu_expert_activation_accounting():
"""
Test that MoE correctly accounts for expert activations with small batch sizes.
"""
"""Test MoE expert-activation accounting with small batch sizes."""
hf_config = Qwen3MoeConfig(
hidden_size=2048,
intermediate_size=8192,
@@ -1248,7 +1241,8 @@ def test_mla_per_gpu_with_pipeline_parallelism():
def test_mla_model_metrics_excludes_standard_attention():
"""Test that ModelMetrics uses MLAAttentionMetrics, not AttentionMetrics,
for DeepSeek MLA models."""
for DeepSeek MLA models.
"""
hf_config = DeepseekV3Config(
hidden_size=7168,
num_attention_heads=128,
+14 -8
View File
@@ -45,7 +45,8 @@ def test_engine_log_metrics_ray(
max_tokens: int,
) -> None:
"""Simple smoke test, verifying this can be used without exceptions.
Need to start a Ray cluster in order to verify outputs."""
Need to start a Ray cluster in order to verify outputs.
"""
@ray.remote(num_gpus=1)
class EngineTestActor:
@@ -75,7 +76,6 @@ def test_engine_log_metrics_ray(
def test_sanitized_opentelemetry_name():
"""Test the metric name sanitization logic for Ray."""
# Only a-z, A-Z, 0-9, _, test valid characters are preserved
valid_name = "valid_metric_123_abcDEF"
assert (
@@ -120,7 +120,8 @@ def test_sanitized_opentelemetry_name():
def _install_mock_metric(wrapper: RayPrometheusMetric) -> MagicMock:
"""Swap the wrapper's underlying Ray metric for a MagicMock while
preserving the real metric's ``_tag_keys`` (labels() reads them to
validate arity)."""
validate arity).
"""
real_metric = wrapper.metric
mock = MagicMock()
mock._tag_keys = real_metric._tag_keys
@@ -130,7 +131,8 @@ def _install_mock_metric(wrapper: RayPrometheusMetric) -> MagicMock:
def test_ray_counter_labels_returns_independent_children():
"""RayCounterWrapper.labels() must return distinct labeled children that
each carry their own tag set."""
each carry their own tag set.
"""
base = RayCounterWrapper(
name="vllm_test_finish_reason",
documentation="",
@@ -150,7 +152,8 @@ def test_ray_counter_labels_returns_independent_children():
def test_ray_counter_inc_forwards_per_child_tags():
""".inc() on a labeled counter must forward that child's tags to the
underlying Ray metric (not rely on a shared set_default_tags)."""
underlying Ray metric (not rely on a shared set_default_tags).
"""
wrapper = RayCounterWrapper(
name="vllm_test_counter_tag_forward",
documentation="",
@@ -215,7 +218,8 @@ def test_ray_histogram_labels_returns_independent_children_and_forwards_tags():
def test_ray_counter_labels_accepts_non_string_label_values():
"""RayPrometheusStatLogger passes ``str(idx)`` for engine indexes; this
covers the coercion path for any caller that passes a non-string label
value positionally."""
value positionally.
"""
wrapper = RayCounterWrapper(
name="vllm_test_nonstr_label",
documentation="",
@@ -238,7 +242,8 @@ def test_ray_counter_labels_arity_validation():
def test_unlabeled_inc_carries_replica_id():
"""Recording on an unlabeled metric must still pass ReplicaId — it's a
declared tag_key and Ray rejects updates that omit any declared key."""
declared tag_key and Ray rejects updates that omit any declared key.
"""
wrapper = RayCounterWrapper(
name="vllm_test_unlabeled_replica_id",
documentation="",
@@ -251,7 +256,8 @@ def test_unlabeled_inc_carries_replica_id():
def test_double_labels_raises():
"""labels() on an already-labeled child should raise, mirroring the
prometheus_client contract."""
prometheus_client contract.
"""
wrapper = RayCounterWrapper(
name="vllm_test_double_labels",
documentation="",