Skip to content

Commit eca5c7a

Browse files
committed
fix: ruff format compliance for all files
1 parent 2ec4f7f commit eca5c7a

4 files changed

Lines changed: 27 additions & 21 deletions

File tree

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ with HawkClient() as client:
7878
import asyncio
7979
from hawk import AsyncHawkClient
8080

81+
8182
async def main():
8283
async with AsyncHawkClient() as client:
8384
health = await client.health()
@@ -86,6 +87,7 @@ async def main():
8687
response = await client.chat("Hello!")
8788
print(response.response)
8889

90+
8991
asyncio.run(main())
9092
```
9193

@@ -226,15 +228,22 @@ either no more tool calls are requested or `max_rounds` is reached.
226228
```python
227229
from hawk import HawkClient, Tool, chat_with_tools
228230

231+
229232
def get_weather(location: str) -> str:
230233
return f"Sunny in {location}"
231234

235+
232236
tools = [
233-
Tool(name="get_weather", description="Get the weather", parameters={
234-
"type": "object",
235-
"properties": {"location": {"type": "string"}},
236-
"required": ["location"],
237-
}, fn=get_weather)
237+
Tool(
238+
name="get_weather",
239+
description="Get the weather",
240+
parameters={
241+
"type": "object",
242+
"properties": {"location": {"type": "string"}},
243+
"required": ["location"],
244+
},
245+
fn=get_weather,
246+
)
238247
]
239248

240249
with HawkClient() as client:

docs/architecture.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ abstractions, no leaked internals.
4747
```python
4848
# client.py — direct HTTP calls with httpx
4949
class HawkClient:
50-
def _request(self, method: str, path: str, **kwargs) -> Response:
51-
...
50+
def _request(self, method: str, path: str, **kwargs) -> Response: ...
5251
def health(self) -> HealthResponse:
5352
return self._request("GET", "/v1/health")
53+
5454
def chat(self, prompt: str) -> ChatResponse:
5555
return self._request("POST", "/v1/chat", json={"prompt": prompt})
5656
```
@@ -82,6 +82,7 @@ class HawkClient:
8282
def chat(self, prompt: str) -> ChatResponse: ...
8383
def chat_stream(self, prompt: str) -> StreamReader: ...
8484

85+
8586
class AsyncHawkClient:
8687
# async methods
8788
async def health(self) -> HealthResponse: ...

src/hawk/toolkit.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,11 @@ async def execute_async(self, tool_name: str, arguments: dict[str, Any]) -> str:
226226
self._background_tasks[task_id] = BackgroundTask(
227227
id=task_id, tool_name=tool_name, task=task
228228
)
229-
return json.dumps(
230-
{
231-
"status": "running",
232-
"task_id": task_id,
233-
"message": f"Tool '{tool_name}' executing in background. Use view_task('{task_id}') to check status.",
234-
}
235-
)
229+
return json.dumps({
230+
"status": "running",
231+
"task_id": task_id,
232+
"message": f"Tool '{tool_name}' executing in background. Use view_task('{task_id}') to check status.",
233+
})
236234

237235
context = {"tool_name": tool_name, "arguments": arguments, "tool": tool}
238236

tests/test_streaming.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,11 @@ def test_collect_text(self) -> None:
5858
assert text == "Hello World"
5959

6060
def test_collect_tool_calls(self) -> None:
61-
tool_data = json.dumps(
62-
{
63-
"id": "tc-1",
64-
"name": "get_weather",
65-
"arguments": {"location": "NYC"},
66-
}
67-
)
61+
tool_data = json.dumps({
62+
"id": "tc-1",
63+
"name": "get_weather",
64+
"arguments": {"location": "NYC"},
65+
})
6866
lines = [
6967
"event: tool_call",
7068
f"data: {tool_data}",

0 commit comments

Comments
 (0)