ci: enable Ruff SIM105 (#44112)

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Asuka MinatoandCodex authored and GitHub committed 2026-10-15 11:14:20 +00:00
1 parent 6a08c082a7
commit 1f3fdbc0d3
21 files changed
+47 -77

No files matched your search

+2 -3
View File
@@ -20,6 +20,7 @@ The transport-generic enum members, ``_CODE_BY_STATUS`` and the
promote them to ``libs`` if a second surface adopts ``ErrorBody``.
"""
import contextlib
import logging
from enum import StrEnum
from typing import Any
@@ -170,10 +171,8 @@ class OpenApiErrorFormatter:
# flask-restx Api.handle_error does `data = getattr(e, "data", default_data)`
# AFTER our handler returns, so a pre-existing e.data (flask_restx.abort,
# BaseHTTPException) would override the canonical body. Rewrite it.
try:
with contextlib.suppress(AttributeError):
e.data = wire # type: ignore[attr-defined]
except AttributeError:
pass
return wire
def _resolve_code(self, e: Exception, status_code: int) -> str: