mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-26 06:01:49 +00:00
chore: ruff auto-fix PLR6201 — tuple → set in membership tests (#23937)
Replace with for all literal-tuple membership tests. Set lookup is O(1) vs O(n) for tuple — consistent micro-optimization across the codebase. 608 instances fixed via `ruff --fix --unsafe-fixes`, 0 remaining. 133 files, +626/-626 (net zero).
This commit is contained in:
parent
8c11710314
commit
2ec8d2b42f
133 changed files with 626 additions and 626 deletions
|
|
@ -2228,7 +2228,7 @@ class MediaResolveMiddleware(InboundMiddleware):
|
|||
resp.raise_for_status()
|
||||
payload = resp.json()
|
||||
code = payload.get("code")
|
||||
if code not in (None, 0):
|
||||
if code not in {None, 0}:
|
||||
raise RuntimeError(
|
||||
f"resource/v1/download failed: code={code}, msg={payload.get('msg', '')}"
|
||||
)
|
||||
|
|
@ -2391,7 +2391,7 @@ class MediaResolveMiddleware(InboundMiddleware):
|
|||
rid = m.group(2)
|
||||
kind, _, filename = head.partition(":")
|
||||
kind = kind.strip()
|
||||
if kind not in ("image", "file"):
|
||||
if kind not in {"image", "file"}:
|
||||
continue
|
||||
if rid in seen:
|
||||
continue
|
||||
|
|
@ -2993,10 +2993,10 @@ class ConnectionManager:
|
|||
|
||||
# Fire-and-forget heartbeat ACKs — server always responds but callers don't
|
||||
# wait on these; silently discard to avoid "Unmatched Response" noise.
|
||||
if cmd_type == CMD_TYPE["Response"] and cmd in (
|
||||
if cmd_type == CMD_TYPE["Response"] and cmd in {
|
||||
"send_group_heartbeat",
|
||||
"send_private_heartbeat",
|
||||
):
|
||||
}:
|
||||
logger.debug("[%s] Heartbeat ACK received: cmd=%s msg_id=%s", adapter.name, cmd, msg_id)
|
||||
return
|
||||
|
||||
|
|
@ -3369,7 +3369,7 @@ class MediaSendHandler(ABC):
|
|||
# Remove keys already passed explicitly to avoid "multiple values" TypeError
|
||||
fwd_kwargs = {
|
||||
k: v for k, v in kwargs.items()
|
||||
if k not in ("file_uuid", "filename", "content_type")
|
||||
if k not in {"file_uuid", "filename", "content_type"}
|
||||
}
|
||||
msg_body = self.build_msg_body(
|
||||
upload_result,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue