Skip to content

Commit 9520620

Browse files
committed
chore: code cleanup - formatting and linting fixes
- Run black formatter on all source and test files - Fix ruff linting issues (remove unused imports, fix f-string) - Fix unused variable in test_chat_config.py - All linting and type checking passes
1 parent ea857c5 commit 9520620

6 files changed

Lines changed: 18 additions & 13 deletions

File tree

src/basic_agent_chat_loop/chat_loop.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,9 @@ async def _async_run(self):
867867
continue
868868

869869
# List available prompt templates grouped by source
870-
templates_grouped = self.template_manager.list_templates_grouped()
870+
templates_grouped = (
871+
self.template_manager.list_templates_grouped()
872+
)
871873
self.display_manager.display_templates(templates_grouped)
872874
continue
873875

src/basic_agent_chat_loop/components/display_manager.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"""
66

77
import time
8-
from pathlib import Path
98
from typing import Any, Optional
109

1110
from .token_tracker import TokenTracker
@@ -293,7 +292,7 @@ def display_templates(self, templates_grouped: list):
293292
print(" ~/.prompts/")
294293
print(" ./.claude/commands/")
295294
print(" ~/.claude/commands/")
296-
print(f"Example: ~/.prompts/review.md")
295+
print("Example: ~/.prompts/review.md")
297296
return
298297

299298
# Count total templates across all sources
@@ -314,7 +313,9 @@ def display_templates(self, templates_grouped: list):
314313
for name, desc in templates:
315314
override_indicator = ""
316315
if name in seen_templates:
317-
override_indicator = f" {Colors.DIM}(overrides previous){Colors.RESET}"
316+
override_indicator = (
317+
f" {Colors.DIM}(overrides previous){Colors.RESET}"
318+
)
318319
else:
319320
seen_templates.add(name)
320321

src/basic_agent_chat_loop/components/template_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ def __init__(self, prompts_dir: Optional[Path] = None):
2727
# Template directories in priority order (first = highest priority)
2828
# Priority: ~/.prompts > ./.claude/commands > ~/.claude/commands
2929
self.template_dirs = [
30-
base_prompts_dir, # Legacy/base (highest priority)
31-
Path.cwd() / ".claude" / "commands", # Project-specific (medium)
32-
Path.home() / ".claude" / "commands", # User global (lowest priority)
30+
base_prompts_dir, # Legacy/base (highest priority)
31+
Path.cwd() / ".claude" / "commands", # Project-specific (medium)
32+
Path.home() / ".claude" / "commands", # User global (lowest priority)
3333
]
3434

3535
# Keep prompts_dir for backward compatibility (used for initialization)

tests/unit/test_chat_config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ def test_get_config_reload(self, temp_config_file, tmp_path, monkeypatch):
352352
"""Test that get_config can reload configuration."""
353353
# Clear global config state first
354354
import basic_agent_chat_loop.chat_config as chat_config_module
355+
355356
chat_config_module._global_config = None
356357

357358
# Create isolated home and cwd directories
@@ -364,7 +365,9 @@ def test_get_config_reload(self, temp_config_file, tmp_path, monkeypatch):
364365
monkeypatch.setattr(Path, "home", lambda: home_dir)
365366
monkeypatch.setattr(Path, "cwd", lambda: cwd_dir)
366367

367-
config1 = get_config()
368+
# Get initial config to initialize singleton
369+
get_config()
370+
# Reload with temp config file
368371
config2 = get_config(temp_config_file, reload=True)
369372

370373
# Verify reload loaded the temp config file

tests/unit/test_response_renderer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
Agent library handles all response rendering naturally.
55
"""
66

7-
import pytest
87

98
from basic_agent_chat_loop.components.response_renderer import ResponseRenderer
109

@@ -28,7 +27,9 @@ def test_initialization(self):
2827

2928
def test_initialization_with_different_agent_name(self):
3029
"""Test initialization with different agent names."""
31-
renderer = ResponseRenderer(agent_name="MyCustomAgent", colors_module=MockColors)
30+
renderer = ResponseRenderer(
31+
agent_name="MyCustomAgent", colors_module=MockColors
32+
)
3233
assert renderer.agent_name == "MyCustomAgent"
3334

3435
def test_initialization_with_special_characters_in_name(self):

tests/unit/test_template_manager.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,7 @@ def test_list_templates_grouped(self, multi_dir_setup):
320320
assert "shared" in project_templates
321321

322322
# Check user directory templates
323-
user_group = next(
324-
(g for g in grouped if g[0] == multi_dir_setup["user"]), None
325-
)
323+
user_group = next((g for g in grouped if g[0] == multi_dir_setup["user"]), None)
326324
assert user_group is not None
327325
user_templates = dict(user_group[1])
328326
assert "user_only" in user_templates

0 commit comments

Comments
 (0)