Skip to content

Commit fc9ac10

Browse files
GoodbyePlanetclaude
andcommitted
fix: minor style/consistency cleanups
- Hoist `import re` out of the per-decorator loop in _get_fastapi_route - Have fetch_commits_with_diffs accept an optional client and use the _client_ctx pattern its siblings follow, instead of always opening its own httpx.AsyncClient - Import get_embedding_provider from server.embeddings in history.py to match search.py, instead of server.embeddings.factory Fixes #80 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 6f77ff1 commit fc9ac10

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

server/indexer/github_source.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,12 @@ async def fetch_commits_with_diffs(
324324
commits: list[GitHubCommit],
325325
max_files: int = 50,
326326
max_patch_chars: int = 2000,
327+
client: httpx.AsyncClient | None = None,
327328
) -> list[GitHubCommit]:
328329
"""Fetch diff details for a batch of commits in parallel, bounded by a semaphore."""
329330
sem = asyncio.Semaphore(_DIFF_CONCURRENCY)
330331

331-
async with httpx.AsyncClient() as shared_client:
332+
async with _client_ctx(client) as shared_client:
332333

333334
async def _fetch_one(commit: GitHubCommit) -> GitHubCommit:
334335
async with sem:

server/parser/python.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import os
4+
import re
45

56
import tree_sitter_python
67
from tree_sitter import Language, Node, Parser
@@ -49,8 +50,6 @@ def _get_fastapi_route(decorators: list[str]) -> tuple[str | None, str | None]:
4950
if f".{method}(" in dec or dec.startswith(f"{method}("):
5051
route = None
5152
# Extract path string from decorator like router.get("/api/chat")
52-
import re
53-
5453
m = re.search(r'["\']([^"\']+)["\']', dec)
5554
if m:
5655
route = m.group(1)

server/tools/history.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from mcp.server.fastmcp import FastMCP
44

5-
from server.embeddings.factory import get_embedding_provider
5+
from server.embeddings import get_embedding_provider
66
from server.indexer.git_history import GitHistoryPipeline
77
from server.state import get_commit_store
88

0 commit comments

Comments
 (0)