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
+17 -21
View File
@@ -39,7 +39,7 @@ class KVCacheEvent(
gc=False, # type: ignore[call-arg]
tag=True,
):
"""Base class for all KV cache-related events"""
"""Base class for all KV cache-related events."""
MEDIUM_GPU = "GPU"
@@ -135,8 +135,7 @@ class KVEventBatch(EventBatch):
class KVEventAggregator:
"""
Aggregates KV events across multiple workers.
"""Aggregates KV events across multiple workers.
Tracks how many times each event appears and returns only those
that were emitted by all workers.
"""
@@ -150,22 +149,22 @@ class KVEventAggregator:
self._num_workers: int = num_workers
def add_events(self, events: list[KVCacheEvent]) -> None:
"""
Add events from a worker batch.
"""Add events from a worker batch.
Args:
events: List of KVCacheEvent objects.
"""
if not isinstance(events, list):
raise TypeError("events must be a list of KVCacheEvent.")
self._event_counter.update(events)
def get_common_events(self) -> list[KVCacheEvent]:
"""
Return events that appeared in all workers.
"""Return events that appeared in all workers.
Returns:
List of events present in all workers.
"""
return [
event
@@ -174,43 +173,39 @@ class KVEventAggregator:
]
def get_all_events(self) -> list[KVCacheEvent]:
"""
Return all events for all workers.
"""Return all events for all workers.
Returns:
List of events for all workers.
"""
return list(self._event_counter.elements())
def clear_events(self) -> None:
"""
Clear all tracked events.
"""
"""Clear all tracked events."""
self._event_counter.clear()
def increment_workers(self, count: int = 1) -> None:
"""
Increment the number of workers contributing events.
"""Increment the number of workers contributing events.
Args:
count: Number to increment the workers by.
"""
if count <= 0:
raise ValueError("count must be positive.")
self._num_workers += count
def reset_workers(self) -> None:
"""
Reset the number of workers to 1.
"""
"""Reset the number of workers to 1."""
self._num_workers = 1
def get_number_of_workers(self) -> int:
"""
Return the number of workers.
"""Return the number of workers.
Returns:
int number of workers.
"""
return self._num_workers
@@ -222,8 +217,7 @@ class KVEventAggregator:
class KVConnectorKVEvents(ABC):
"""
Abstract base class for KV events.
"""Abstract base class for KV events.
Acts as a container for KV events from the connector.
"""
@@ -323,6 +317,7 @@ class ZmqEventPublisher(EventPublisher):
Maximum number of events to buffer in memory.
topic:
Topic to publish events to.
"""
SHUTDOWN_TIMEOUT: float = 1.0
@@ -520,6 +515,7 @@ class ZmqEventPublisher(EventPublisher):
Returns:
The endpoint with the port offset by data_parallel_rank
or suffix appended
"""
# Do nothing if input is None or data_parallel_rank is 0
if not endpoint or data_parallel_rank == 0: