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
|
|
@ -1967,7 +1967,7 @@ class SessionDB:
|
|||
# Route to LIKE when any non-operator CJK token is <3 CJK chars.
|
||||
_tokens_for_check = [
|
||||
t for t in raw_query.split()
|
||||
if t.upper() not in ("AND", "OR", "NOT") and self._contains_cjk(t)
|
||||
if t.upper() not in {"AND", "OR", "NOT"} and self._contains_cjk(t)
|
||||
]
|
||||
_any_short_cjk = any(
|
||||
self._count_cjk(t) < 3 for t in _tokens_for_check
|
||||
|
|
@ -1980,7 +1980,7 @@ class SessionDB:
|
|||
tokens = raw_query.split()
|
||||
parts = []
|
||||
for tok in tokens:
|
||||
if tok.upper() in ("AND", "OR", "NOT"):
|
||||
if tok.upper() in {"AND", "OR", "NOT"}:
|
||||
parts.append(tok)
|
||||
else:
|
||||
parts.append('"' + tok.replace('"', '""') + '"')
|
||||
|
|
@ -2031,7 +2031,7 @@ class SessionDB:
|
|||
# is matched independently (#20494).
|
||||
non_op_tokens = [
|
||||
t for t in raw_query.split()
|
||||
if t.upper() not in ("AND", "OR", "NOT")
|
||||
if t.upper() not in {"AND", "OR", "NOT"}
|
||||
] or [raw_query]
|
||||
token_clauses = []
|
||||
like_params: list = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue