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
+11 -21
View File
@@ -25,9 +25,7 @@ logger = init_logger(__name__)
class CompilerInterface:
"""
The interface for a compiler that can be used by vLLM.
"""
"""The interface for a compiler that can be used by vLLM."""
# The name of the compiler, e.g. inductor.
# This is a class-level attribute.
@@ -36,8 +34,7 @@ class CompilerInterface:
def initialize_cache(
self, cache_dir: str, disable_cache: bool = False, prefix: str = ""
) -> None:
"""
when the vLLM process uses `cache_dir` as the cache directory,
"""When the vLLM process uses `cache_dir` as the cache directory,
the compiler should initialize itself with the cache directory,
e.g. by re-directing its own cache directory to a sub-directory.
@@ -52,8 +49,7 @@ class CompilerInterface:
pass
def compute_hash(self, vllm_config: VllmConfig) -> str:
"""
Gather all the relevant information from the vLLM config,
"""Gather all the relevant information from the vLLM config,
to compute a hash so that we can cache the compiled model.
See [`VllmConfig.compute_hash`][vllm.config.VllmConfig.compute_hash]
@@ -71,8 +67,7 @@ class CompilerInterface:
compile_range: Range,
key: str | None = None,
) -> tuple[Callable[..., Any] | None, Any | None]:
"""
Compile the graph with the given example inputs and compiler config,
"""Compile the graph with the given example inputs and compiler config,
with a range. The `compile_range` specifies the range of the inputs,
it could be concrete size (if compile_sizes is provided), e.g. [4, 4]
or a range [5, 8].
@@ -105,8 +100,7 @@ class CompilerInterface:
graph_index: int,
compile_range: Range,
) -> Callable[..., Any]:
"""
Load the compiled function from the handle.
"""Load the compiled function from the handle.
Raises an error if the handle is invalid.
The handle is the second return value of the `compile` function.
@@ -115,8 +109,7 @@ class CompilerInterface:
class AlwaysHitShapeEnv:
"""
Why do we need this class:
"""Why do we need this class:
For normal `torch.compile` usage, every compilation will have
one Dynamo bytecode compilation and one Inductor compilation.
@@ -160,7 +153,8 @@ def _get_vllm_functorch_config() -> dict[str, Any]:
"""Return the functorch config overrides that vLLM applies at compile time.
Used by both set_functorch_config() and get_inductor_factors() to ensure
the compile-time config and cache key are always consistent."""
the compile-time config and cache key are always consistent.
"""
cfg: dict[str, Any] = {}
if not envs.VLLM_USE_MEGA_AOT_ARTIFACT:
cfg["bundled_autograd_cache"] = False
@@ -249,8 +243,7 @@ def _patch_standalone_compile_atomic_save() -> None:
class InductorStandaloneAdaptor(CompilerInterface):
"""
The adaptor for the Inductor compiler.
"""The adaptor for the Inductor compiler.
Requires PyTorch 2.8+.
This is not on by default yet, but we plan to turn it on by default for
PyTorch 2.8.
@@ -447,9 +440,7 @@ class InductorStandaloneAdaptor(CompilerInterface):
class InductorAdaptor(CompilerInterface):
"""
The adaptor for the Inductor compiler, version 2.5, 2.6, 2.7.
"""
"""The adaptor for the Inductor compiler, version 2.5, 2.6, 2.7."""
name = "inductor"
@@ -727,8 +718,7 @@ class InductorAdaptor(CompilerInterface):
return compiled_graph
def metrics_context(self) -> contextlib.AbstractContextManager[Any]:
"""
This method returns the Dynamo metrics context (if it exists,
"""This method returns the Dynamo metrics context (if it exists,
otherwise a null context). It is used by various compile components.
Present in torch>=2.6, it's used inside FxGraphCache in
torch==2.6 (but not after). It might also be used in various other