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 -4
View File
@@ -16,7 +16,7 @@ class HeaderStyle:
class SPDXStatus(Enum):
"""SPDX header status enumeration"""
"""SPDX header status enumeration."""
EMPTY = "empty" # empty __init__.py
COMPLETE = "complete"
@@ -58,7 +58,7 @@ def header_insertion_index(style, lines):
def check_spdx_header_status(file_path):
"""Check SPDX header status of the file"""
"""Check SPDX header status of the file."""
license_line, copyright_line = spdx_header(file_style(file_path))
with open(file_path, encoding="UTF-8") as file:
lines = file.readlines()
@@ -92,7 +92,7 @@ def check_spdx_header_status(file_path):
def add_header(file_path, status):
"""Add or supplement SPDX header based on status"""
"""Add or supplement SPDX header based on status."""
style = file_style(file_path)
license_line, copyright_line = spdx_header(style)
full_spdx_header = f"{license_line}\n{copyright_line}"
@@ -137,7 +137,7 @@ def add_header(file_path, status):
def main():
"""Main function"""
"""Main function."""
files_missing_both = []
files_missing_copyright = []
files_missing_license = []
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
Generates specialized requirements files for nightly PyTorch testing.
"""Generates specialized requirements files for nightly PyTorch testing.
This script reads the main test requirements input file (`requirements/test/cuda.in`)
and splits its content into two files:
+6 -6
View File
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
Run mypy on changed files.
"""Run mypy on changed files.
This script is designed to be used as a pre-commit hook. It runs mypy
on files that have been changed. It groups files into different mypy calls
@@ -14,6 +13,7 @@ Args:
python_version: Python version to use (e.g., "3.10") or "local" to use
the local Python version.
changed_files: List of changed files to check.
"""
import subprocess
@@ -125,14 +125,14 @@ EXCLUDE = [
def group_files(changed_files: list[str]) -> dict[str, list[str]]:
"""
Group changed files into different mypy calls.
"""Group changed files into different mypy calls.
Args:
changed_files: List of changed files.
Returns:
A dictionary mapping file group names to lists of changed files.
"""
exclude_pattern = re.compile(f"^{'|'.join(EXCLUDE)}.*")
silent_pattern = re.compile(f"^({'|'.join(SILENT_GROUPS)}).*")
@@ -166,8 +166,7 @@ def mypy(
follow_imports: str | None,
file_group: str,
) -> int:
"""
Run mypy on the given targets.
"""Run mypy on the given targets.
Args:
targets: List of files or directories to check.
@@ -179,6 +178,7 @@ def mypy(
Returns:
The return code from mypy.
"""
args = ["mypy"]
if python_version is not None:
+2 -5
View File
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
Ensures all fields in a config dataclass have default values
"""Ensures all fields in a config dataclass have default values
and that each field has a docstring.
"""
@@ -14,13 +13,11 @@ import regex as re
def get_attr_docs(cls_node: ast.ClassDef) -> dict[str, str]:
"""
Get any docstrings placed after attribute assignments in a class body.
"""Get any docstrings placed after attribute assignments in a class body.
Adapted from https://davidism.com/attribute-docstrings/
https://davidism.com/mit-license/
"""
out = {}
# Consider each pair of nodes.