refactor: remove redundant comments and docstrings (#6527)

* refactor: remove redundant comments and docstrings

* fix(signal): annotate async context manager as a generator
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-30 13:07:03 +08:00
1 parent cb3ba45317
commit a4d2430140
922 files changed
+406 -7738

No files matched your search

+1 -4
View File
@@ -1,5 +1,3 @@
"""Network security utilities — SSRF protection and internal URL detection."""
from __future__ import annotations
import asyncio
@@ -234,7 +232,7 @@ def pin_resolved_url_dns(url: str, resolved_ips: tuple[str, ...]):
host: Any,
port: Any,
family: int = 0,
type: int = 0, # noqa: A002
type: int = 0,
proto: int = 0,
flags: int = 0,
) -> list[Any]:
@@ -305,7 +303,6 @@ def validate_resolved_url(url: str) -> tuple[bool, str]:
if _is_private(addr):
return False, f"Redirect target is a private address: {addr}"
except ValueError:
# hostname is a domain name, resolve it
try:
infos = socket.getaddrinfo(hostname, None, socket.AF_UNSPEC, socket.SOCK_STREAM)
except socket.gaierror:
-2
View File
@@ -1,5 +1,3 @@
"""Workspace access scope and sandbox capability helpers."""
from __future__ import annotations
import os
-2
View File
@@ -30,7 +30,6 @@ def resolve_path(path: str | Path, workspace: str | Path | None = None, *, stric
def _resolve_logical_path(path: str | Path, workspace: str | Path | None = None) -> Path:
"""Return an absolute normalized path without following symlinks."""
candidate = Path(path).expanduser()
if not candidate.is_absolute() and workspace is not None:
candidate = Path(workspace).expanduser() / candidate
@@ -62,7 +61,6 @@ def _is_path_exactly_allowed(
resolved_path: Path,
files: Iterable[str | Path],
) -> bool:
"""Return True when *path* resolves exactly to one of the allowed files."""
logical_key = _path_key(logical_path)
if _path_key(resolved_path) != logical_key:
return False