Enable Ruff D (pydocstyle) with pep257 convention (#13326)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Avasam
2025-01-02 17:05:35 -05:00
committed by GitHub
parent a151457936
commit 9c959a7dd3
12 changed files with 34 additions and 22 deletions

View File

@@ -62,7 +62,7 @@ class CommandLineArgs:
def valid_path(cmd_arg: str) -> Path:
"""Helper function for argument-parsing"""
"""Parse a CLI argument that is intended to point to a valid typeshed path."""
path = Path(cmd_arg)
if not path.exists():
raise argparse.ArgumentTypeError(f'"{path}" does not exist in typeshed!')
@@ -72,7 +72,10 @@ def valid_path(cmd_arg: str) -> Path:
def remove_dev_suffix(version: str) -> str:
"""Helper function for argument-parsing"""
"""Remove the `-dev` suffix from a version string.
This is a helper function for argument-parsing.
"""
if version.endswith("-dev"):
return version[: -len("-dev")]
return version
@@ -303,7 +306,6 @@ def test_third_party_distribution(
Return a tuple, where the first element indicates mypy's return code
and the second element is the number of checked files.
"""
files: list[Path] = []
configurations: list[MypyDistConf] = []
seen_dists: set[str] = set()

View File

@@ -74,7 +74,7 @@ def create_parser() -> argparse.ArgumentParser:
def run_pytype(*, filename: str, python_version: str, missing_modules: Iterable[str]) -> str | None:
"""Runs pytype, returning the stderr if any."""
"""Run pytype, returning the stderr if any."""
if python_version not in _LOADERS:
options = pytype_config.Options.create("", parse_pyi=True, python_version=python_version)
# For simplicity, pretends missing modules are part of the stdlib.
@@ -107,7 +107,7 @@ def _get_relative(filename: str) -> str:
def _get_module_name(filename: str) -> str:
"""Converts a filename {subdir}/m.n/module/foo to module.foo."""
"""Convert a filename {subdir}/m.n/module/foo to module.foo."""
parts = _get_relative(filename).split(os.path.sep)
if parts[0] == "stdlib":
module_parts = parts[1:]

View File

@@ -44,8 +44,7 @@ SUPPORTED_VERSIONS = ["3.13", "3.12", "3.11", "3.10", "3.9", "3.8"]
def distribution_with_test_cases(distribution_name: str) -> DistributionTests:
"""Helper function for argument-parsing."""
"""Parse a CLI argument that is intended to be to a valid typeshed distribution."""
try:
return distribution_info(distribution_name)
except RuntimeError as exc:

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Test typeshed's stdlib using stubtest
"""Test typeshed's stdlib using stubtest.
stubtest is a script in the mypy project that compares stubs to the actual objects at runtime.
Note that therefore the output of stubtest depends on which Python version it is run with.

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Test typeshed's third party stubs using stubtest"""
"""Test typeshed's third party stubs using stubtest."""
from __future__ import annotations