Skip to content

chore: fix 154 f-strings, simplify getattr/URL patterns, remove dead code#3119

Merged
teknium1 merged 1 commit intomainfrom
hermes/hermes-d877fbc1
Mar 26, 2026
Merged

chore: fix 154 f-strings, simplify getattr/URL patterns, remove dead code#3119
teknium1 merged 1 commit intomainfrom
hermes/hermes-d877fbc1

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

Three categories of mechanical cleanup, all zero-behavioral-change.

30 files changed, 173 insertions(+), 170 deletions(-)

1. F-strings without placeholders (154 fixes, 29 files)

Converted f'...' to '...' where no {expression} was present. Identified via pyflakes, fixed with a targeted regex script, compile-verified every modified file.

Heaviest concentrations: run_agent.py (24), cli.py (20), honcho_integration/cli.py (34), hermes_cli/tools_config.py (10), hermes_cli/setup.py (10).

2. Simplify defensive patterns in run_agent.py

getattr cleanup: Added explicit self._is_anthropic_oauth = False initialization before the api_mode branch in __init__, then replaced 7 defensive getattr(self, '_is_anthropic_oauth', False) calls with direct self._is_anthropic_oauth access.

URL detection helpers: Added _is_openrouter_url() and _is_anthropic_url() methods, replaced 3 inline "openrouter" in self._base_url_lower checks. Intentionally left checks on local variables (not self._base_url_lower) unchanged — those have different semantics.

All run_agent.py changes done one patch at a time with py_compile verification after each.

3. Dead code removal (small files only)

  • hermes_cli/claw.py: removed unused total computation
  • tools/fuzzy_match.py: removed unused strip_indent() function and pattern_stripped variable

Test results

6184 passed, 200 skipped, 23 deselected, 25 warnings
0 failures

E2E PTY: banner clean, tool calls work, zero garbled ANSI.

…code

Three categories of cleanup, all zero-behavioral-change:

1. F-strings without placeholders (154 fixes across 29 files)
   - Converted f'...' to '...' where no {expression} was present
   - Heaviest files: run_agent.py (24), cli.py (20), honcho_integration/cli.py (34)

2. Simplify defensive patterns in run_agent.py
   - Added explicit self._is_anthropic_oauth = False in __init__ (before
     the api_mode branch that conditionally sets it)
   - Replaced 7x getattr(self, '_is_anthropic_oauth', False) with direct
     self._is_anthropic_oauth (attribute always initialized now)
   - Added _is_openrouter_url() and _is_anthropic_url() helper methods
   - Replaced 3 inline 'openrouter' in self._base_url_lower checks

3. Remove dead code in small files
   - hermes_cli/claw.py: removed unused 'total' computation
   - tools/fuzzy_match.py: removed unused strip_indent() function and
     pattern_stripped variable

Full test suite: 6184 passed, 0 failures
E2E PTY: banner clean, tool calls work, zero garbled ANSI
@github-actions
Copy link
Copy Markdown

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: Install hook files modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

@teknium1 teknium1 merged commit cbf195e into main Mar 26, 2026
3 of 4 checks passed
outsourc-e pushed a commit to outsourc-e/hermes-agent that referenced this pull request Mar 26, 2026
…code (NousResearch#3119)

Three categories of cleanup, all zero-behavioral-change:

1. F-strings without placeholders (154 fixes across 29 files)
   - Converted f'...' to '...' where no {expression} was present
   - Heaviest files: run_agent.py (24), cli.py (20), honcho_integration/cli.py (34)

2. Simplify defensive patterns in run_agent.py
   - Added explicit self._is_anthropic_oauth = False in __init__ (before
     the api_mode branch that conditionally sets it)
   - Replaced 7x getattr(self, '_is_anthropic_oauth', False) with direct
     self._is_anthropic_oauth (attribute always initialized now)
   - Added _is_openrouter_url() and _is_anthropic_url() helper methods
   - Replaced 3 inline 'openrouter' in self._base_url_lower checks

3. Remove dead code in small files
   - hermes_cli/claw.py: removed unused 'total' computation
   - tools/fuzzy_match.py: removed unused strip_indent() function and
     pattern_stripped variable

Full test suite: 6184 passed, 0 failures
E2E PTY: banner clean, tool calls work, zero garbled ANSI
StreamOfRon pushed a commit to StreamOfRon/hermes-agent that referenced this pull request Mar 29, 2026
…code (NousResearch#3119)

Three categories of cleanup, all zero-behavioral-change:

1. F-strings without placeholders (154 fixes across 29 files)
   - Converted f'...' to '...' where no {expression} was present
   - Heaviest files: run_agent.py (24), cli.py (20), honcho_integration/cli.py (34)

2. Simplify defensive patterns in run_agent.py
   - Added explicit self._is_anthropic_oauth = False in __init__ (before
     the api_mode branch that conditionally sets it)
   - Replaced 7x getattr(self, '_is_anthropic_oauth', False) with direct
     self._is_anthropic_oauth (attribute always initialized now)
   - Added _is_openrouter_url() and _is_anthropic_url() helper methods
   - Replaced 3 inline 'openrouter' in self._base_url_lower checks

3. Remove dead code in small files
   - hermes_cli/claw.py: removed unused 'total' computation
   - tools/fuzzy_match.py: removed unused strip_indent() function and
     pattern_stripped variable

Full test suite: 6184 passed, 0 failures
E2E PTY: banner clean, tool calls work, zero garbled ANSI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant