mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +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
|
|
@ -292,9 +292,9 @@ def prompt_yes_no(question: str, default: bool = True) -> bool:
|
|||
|
||||
if not value:
|
||||
return default
|
||||
if value in ("y", "yes"):
|
||||
if value in {"y", "yes"}:
|
||||
return True
|
||||
if value in ("n", "no"):
|
||||
if value in {"n", "no"}:
|
||||
return False
|
||||
print_error("Please enter 'y' or 'n'")
|
||||
|
||||
|
|
@ -641,7 +641,7 @@ def _prompt_container_resources(config: dict):
|
|||
persist_str = prompt(
|
||||
" Persist filesystem across sessions? (yes/no)", persist_label
|
||||
)
|
||||
terminal["container_persistent"] = persist_str.lower() in ("yes", "true", "y", "1")
|
||||
terminal["container_persistent"] = persist_str.lower() in {"yes", "true", "y", "1"}
|
||||
|
||||
# CPU
|
||||
current_cpu = terminal.get("container_cpu", 1)
|
||||
|
|
@ -692,7 +692,7 @@ def _prompt_vercel_sandbox_settings(config: dict):
|
|||
persist_label = "yes" if current_persist else "no"
|
||||
terminal["container_persistent"] = prompt(
|
||||
" Persist filesystem with snapshots? (yes/no)", persist_label
|
||||
).lower() in ("yes", "true", "y", "1")
|
||||
).lower() in {"yes", "true", "y", "1"}
|
||||
|
||||
current_cpu = terminal.get("container_cpu", 1)
|
||||
cpu_str = prompt(" CPU cores", str(current_cpu))
|
||||
|
|
@ -708,7 +708,7 @@ def _prompt_vercel_sandbox_settings(config: dict):
|
|||
except ValueError:
|
||||
pass
|
||||
|
||||
if terminal.get("container_disk", 51200) not in (0, 51200):
|
||||
if terminal.get("container_disk", 51200) not in {0, 51200}:
|
||||
print_warning("Vercel Sandbox does not support custom disk sizing; resetting container_disk to 51200.")
|
||||
terminal["container_disk"] = 51200
|
||||
|
||||
|
|
@ -1729,7 +1729,7 @@ def setup_agent_settings(config: dict):
|
|||
|
||||
current_mode = cfg_get(config, "display", "tool_progress", default="all")
|
||||
mode = prompt("Tool progress mode", current_mode)
|
||||
if mode.lower() in ("off", "new", "all", "verbose"):
|
||||
if mode.lower() in {"off", "new", "all", "verbose"}:
|
||||
if "display" not in config:
|
||||
config["display"] = {}
|
||||
config["display"]["tool_progress"] = mode.lower()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue