mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +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
55
cli.py
55
cli.py
|
|
@ -7264,20 +7264,19 @@ class HermesCLI:
|
|||
_cprint(f" {format_session_db_unavailable()}")
|
||||
else:
|
||||
_cprint(" Usage: /title <your session title>")
|
||||
else:
|
||||
# Show current title and session ID if no argument given
|
||||
if self._session_db:
|
||||
_cprint(f" Session ID: {self.session_id}")
|
||||
session = self._session_db.get_session(self.session_id)
|
||||
if session and session.get("title"):
|
||||
_cprint(f" Title: {session['title']}")
|
||||
elif self._pending_title:
|
||||
_cprint(f" Title (pending): {self._pending_title}")
|
||||
else:
|
||||
_cprint(" No title set. Usage: /title <your session title>")
|
||||
# Show current title and session ID if no argument given
|
||||
elif self._session_db:
|
||||
_cprint(f" Session ID: {self.session_id}")
|
||||
session = self._session_db.get_session(self.session_id)
|
||||
if session and session.get("title"):
|
||||
_cprint(f" Title: {session['title']}")
|
||||
elif self._pending_title:
|
||||
_cprint(f" Title (pending): {self._pending_title}")
|
||||
else:
|
||||
from hermes_state import format_session_db_unavailable
|
||||
_cprint(f" {format_session_db_unavailable()}")
|
||||
_cprint(" No title set. Usage: /title <your session title>")
|
||||
else:
|
||||
from hermes_state import format_session_db_unavailable
|
||||
_cprint(f" {format_session_db_unavailable()}")
|
||||
elif canonical == "handoff":
|
||||
if not self._handle_handoff_command(cmd_original):
|
||||
return False
|
||||
|
|
@ -11586,16 +11585,15 @@ class HermesCLI:
|
|||
self._last_ctrl_c_time = now
|
||||
print("\n⚡ Interrupting agent... (press Ctrl+C again to force exit)")
|
||||
self.agent.interrupt()
|
||||
# If there's text or images, clear them (like bash).
|
||||
# If everything is already empty, exit.
|
||||
elif event.app.current_buffer.text or self._attached_images:
|
||||
event.app.current_buffer.reset()
|
||||
self._attached_images.clear()
|
||||
event.app.invalidate()
|
||||
else:
|
||||
# If there's text or images, clear them (like bash).
|
||||
# If everything is already empty, exit.
|
||||
if event.app.current_buffer.text or self._attached_images:
|
||||
event.app.current_buffer.reset()
|
||||
self._attached_images.clear()
|
||||
event.app.invalidate()
|
||||
else:
|
||||
self._should_exit = True
|
||||
event.app.exit()
|
||||
self._should_exit = True
|
||||
event.app.exit()
|
||||
|
||||
# Ctrl+Shift+C: no binding needed. Terminal emulators (GNOME Terminal,
|
||||
# iTerm2, kitty, Windows Terminal, etc.) intercept Ctrl+Shift+C before
|
||||
|
|
@ -11680,14 +11678,13 @@ class HermesCLI:
|
|||
if self._agent_running and self.agent:
|
||||
print("\n⚡ Interrupting agent...")
|
||||
self.agent.interrupt()
|
||||
elif event.app.current_buffer.text or self._attached_images:
|
||||
event.app.current_buffer.reset()
|
||||
self._attached_images.clear()
|
||||
event.app.invalidate()
|
||||
else:
|
||||
if event.app.current_buffer.text or self._attached_images:
|
||||
event.app.current_buffer.reset()
|
||||
self._attached_images.clear()
|
||||
event.app.invalidate()
|
||||
else:
|
||||
self._should_exit = True
|
||||
event.app.exit()
|
||||
self._should_exit = True
|
||||
event.app.exit()
|
||||
|
||||
@kb.add('c-d')
|
||||
def handle_ctrl_d(event):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue