mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-22 05:22:09 +00:00
chore: ruff auto-fixes — collapsible-else-if, if-stmt-min-max, dict.fromkeys (#23926)
PLR5501 (collapsible-else-if): 28 instances — else: if: → elif: PLR1730 (if-stmt-min-max): 15 instances — if x<y: x=y → x=max(x,y) C420 (dict.fromkeys): 2 instances — dictcomp → dict.fromkeys PLR1704 (redefined-argument): 1 instance — reason → err_msg (shadow fix) C414 (unnecessary-list): 1 instance — sorted(list(x)) → sorted(x) 28 files, -44 net lines. All mechanical, zero logic changes. 17,211 tests pass, zero regressions.
This commit is contained in:
parent
8e2eb4b511
commit
657874460f
28 changed files with 223 additions and 267 deletions
|
|
@ -1312,8 +1312,7 @@ def prune_checkpoints(
|
|||
for p in child.rglob("*"):
|
||||
try:
|
||||
mt = p.stat().st_mtime
|
||||
if mt > newest:
|
||||
newest = mt
|
||||
newest = max(newest, mt)
|
||||
except OSError:
|
||||
continue
|
||||
except OSError:
|
||||
|
|
@ -1455,8 +1454,7 @@ def prune_checkpoints(
|
|||
|
||||
size_after = _dir_size_bytes(base)
|
||||
delta = size_before - size_after
|
||||
if delta > result["bytes_freed"]:
|
||||
result["bytes_freed"] = delta
|
||||
result["bytes_freed"] = max(result["bytes_freed"], delta)
|
||||
|
||||
return result
|
||||
|
||||
|
|
|
|||
|
|
@ -327,9 +327,8 @@ def cronjob(
|
|||
"the script is the job.",
|
||||
success=False,
|
||||
)
|
||||
else:
|
||||
if not prompt and not canonical_skills:
|
||||
return tool_error("create requires either prompt or at least one skill", success=False)
|
||||
elif not prompt and not canonical_skills:
|
||||
return tool_error("create requires either prompt or at least one skill", success=False)
|
||||
if prompt:
|
||||
scan_error = _scan_cron_prompt(prompt)
|
||||
if scan_error:
|
||||
|
|
|
|||
|
|
@ -1239,7 +1239,7 @@ def _dump_subagent_timeout_diagnostic(
|
|||
if tool_names:
|
||||
_w(f" loaded tool count: {len(tool_names)}")
|
||||
try:
|
||||
_w(f" loaded tools: {sorted(list(tool_names))}")
|
||||
_w(f" loaded tools: {sorted(tool_names)}")
|
||||
except Exception:
|
||||
pass
|
||||
_w("")
|
||||
|
|
|
|||
|
|
@ -505,8 +505,7 @@ def _calculate_line_positions(content_lines: List[str], start_line: int,
|
|||
"""
|
||||
start_pos = sum(len(line) + 1 for line in content_lines[:start_line])
|
||||
end_pos = sum(len(line) + 1 for line in content_lines[:end_line]) - 1
|
||||
if end_pos >= content_length:
|
||||
end_pos = content_length
|
||||
end_pos = min(content_length, end_pos)
|
||||
return start_pos, end_pos
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -466,13 +466,12 @@ def _shell_quote_context(command_template: str, position: int) -> Optional[str]:
|
|||
escaped = True
|
||||
elif char == '"':
|
||||
quote = None
|
||||
else:
|
||||
if char == "'":
|
||||
quote = "'"
|
||||
elif char == '"':
|
||||
quote = '"'
|
||||
elif char == "\\":
|
||||
i += 1
|
||||
elif char == "'":
|
||||
quote = "'"
|
||||
elif char == '"':
|
||||
quote = '"'
|
||||
elif char == "\\":
|
||||
i += 1
|
||||
i += 1
|
||||
return quote
|
||||
|
||||
|
|
|
|||
|
|
@ -456,8 +456,7 @@ class AudioRecorder:
|
|||
# Compute RMS for level display and silence detection
|
||||
rms = int(np.sqrt(np.mean(indata.astype(np.float64) ** 2)))
|
||||
self._current_rms = rms
|
||||
if rms > self._peak_rms:
|
||||
self._peak_rms = rms
|
||||
self._peak_rms = max(self._peak_rms, rms)
|
||||
|
||||
# Silence detection
|
||||
if self._on_silence_stop is not None:
|
||||
|
|
|
|||
|
|
@ -2130,15 +2130,14 @@ if __name__ == "__main__":
|
|||
print(" Using Brave Search free tier (search only)")
|
||||
elif backend == "ddgs":
|
||||
print(" Using DuckDuckGo via ddgs package (search only)")
|
||||
elif firecrawl_url_available:
|
||||
print(f" Using self-hosted Firecrawl: {os.getenv('FIRECRAWL_API_URL').strip().rstrip('/')}")
|
||||
elif firecrawl_key_available:
|
||||
print(" Using direct Firecrawl cloud API")
|
||||
elif tool_gateway_available:
|
||||
print(f" Using Firecrawl tool-gateway: {_get_firecrawl_gateway_url()}")
|
||||
else:
|
||||
if firecrawl_url_available:
|
||||
print(f" Using self-hosted Firecrawl: {os.getenv('FIRECRAWL_API_URL').strip().rstrip('/')}")
|
||||
elif firecrawl_key_available:
|
||||
print(" Using direct Firecrawl cloud API")
|
||||
elif tool_gateway_available:
|
||||
print(f" Using Firecrawl tool-gateway: {_get_firecrawl_gateway_url()}")
|
||||
else:
|
||||
print(" Firecrawl backend selected but not configured")
|
||||
print(" Firecrawl backend selected but not configured")
|
||||
else:
|
||||
print("❌ No web search backend configured")
|
||||
print(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue