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
@@ -55,8 +55,7 @@ BUILTIN_LOGITS_PROCESSORS: list[type[LogitsProcessor]] = [
def _load_logitsprocs_plugins() -> list[type[LogitsProcessor]]:
"""Load all installed logit processor plugins"""
"""Load all installed logit processor plugins."""
from importlib.metadata import entry_points
installed_logitsprocs_plugins = entry_points(group=LOGITSPROCS_GROUP)
@@ -171,6 +170,7 @@ def _load_custom_logitsprocs(
Returns:
A list of all loaded logitproc types
"""
from vllm.platforms import current_platform
@@ -238,7 +238,7 @@ def validate_logits_processors_parameters(
class AdapterLogitsProcessor(LogitsProcessor):
"""Wrapper for per-request logits processors
"""Wrapper for per-request logits processors.
To wrap a specific per-request logits processor,
* Subclass `AdapterLogitsProcessor`
@@ -264,7 +264,6 @@ class AdapterLogitsProcessor(LogitsProcessor):
these arguments are used, the vLLM logits processor interface requires
all three arguments to be present.
"""
# Map req index -> logits processor state
#
# State representation is a partial[Tensor] comprising a request-level
@@ -301,7 +300,7 @@ class AdapterLogitsProcessor(LogitsProcessor):
prompt_ids: list[int] | None,
output_ids: list[int],
) -> partial[torch.Tensor] | None:
"""Return state representation for new request
"""Return state representation for new request.
Returns None if logits processor is not applicable to request
+5 -4
View File
@@ -45,7 +45,7 @@ class MinPLogitsProcessor(LogitsProcessor):
self.min_p: torch.Tensor = self.min_p_device[:0]
def is_argmax_invariant(self) -> bool:
"""Min-p never impacts greedy sampling"""
"""Min-p never impacts greedy sampling."""
return True
def get_min_p_by_index(self, index: int) -> float:
@@ -129,7 +129,8 @@ class LogitBiasLogitsProcessor(LogitsProcessor):
def is_argmax_invariant(self) -> bool:
"""Logit bias can rebalance token probabilities and change the
outcome of argmax in greedy sampling."""
outcome of argmax in greedy sampling.
"""
return False
def update_state(self, batch_update: BatchUpdate | None):
@@ -188,7 +189,8 @@ class MinTokensLogitsProcessor(LogitsProcessor):
def is_argmax_invariant(self) -> bool:
"""By censoring stop tokens, min-tokens can change the outcome
of the argmax operation in greedy sampling."""
of the argmax operation in greedy sampling.
"""
return False
@staticmethod
@@ -377,7 +379,6 @@ def process_dict_updates(
new_state: Callable[[SamplingParams, list[int] | None, list[int]], T | None],
) -> bool:
"""Utility function to update dict state for sparse LogitsProcessors."""
if not batch_update:
# Nothing to do.
return False
+2 -1
View File
@@ -35,7 +35,7 @@ MovedRequest = tuple[int, int, MoveDirectionality]
@dataclass(frozen=True)
class BatchUpdate:
"""Persistent batch state change info for logitsprocs"""
"""Persistent batch state change info for logitsprocs."""
batch_size: int # Current num reqs in batch
@@ -104,5 +104,6 @@ class LogitsProcessor(ABC):
Args:
batch_update: Non-None iff there have been changes
to the batch makeup.
"""
raise NotImplementedError
+6 -3
View File
@@ -69,7 +69,8 @@ class BatchUpdateBuilder:
@property
def removed(self) -> list[RemovedRequest]:
"""Removed request indices sorted in
descending order"""
descending order
"""
self._ensure_removed_sorted()
return self._removed
@@ -81,6 +82,7 @@ class BatchUpdateBuilder:
Args:
index: request index
"""
if self._is_removed_sorted:
raise RuntimeError(
@@ -93,14 +95,14 @@ class BatchUpdateBuilder:
return bool(self._removed)
def peek_removed(self) -> int | None:
"""Return lowest removed request index"""
"""Return lowest removed request index."""
if self.has_removed():
self._ensure_removed_sorted()
return self._removed[-1]
return None
def pop_removed(self) -> int | None:
"""Pop lowest removed request index"""
"""Pop lowest removed request index."""
if self.has_removed():
self._ensure_removed_sorted()
return self._removed.pop()
@@ -125,6 +127,7 @@ class BatchUpdateBuilder:
Returns:
Frozen logitsprocs batch update instance; `None` if no updates
"""
# Reset removal-sorting logic
self._is_removed_sorted = False