Skip to content

Commit 651e721

Browse files
nhortonclaude
andcommitted
Apply ruff formatting to wrapper.py and test_hook_wrapper.py
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 244fa28 commit 651e721

2 files changed

Lines changed: 23 additions & 15 deletions

File tree

src/deepwork/hooks/wrapper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,18 @@ def to_dict(self, platform: Platform, event: NormalizedEvent) -> dict[str, Any]:
249249
# Claude uses different fields depending on event
250250
if event == NormalizedEvent.SESSION_START:
251251
result.setdefault("hookSpecificOutput", {})
252-
result["hookSpecificOutput"]["hookEventName"] = NORMALIZED_TO_EVENT[platform][event]
252+
result["hookSpecificOutput"]["hookEventName"] = NORMALIZED_TO_EVENT[platform][
253+
event
254+
]
253255
result["hookSpecificOutput"]["additionalContext"] = self.context
254256
else:
255257
result["systemMessage"] = self.context
256258
else:
257259
# Gemini
258260
result.setdefault("hookSpecificOutput", {})
259-
result["hookSpecificOutput"]["hookEventName"] = NORMALIZED_TO_EVENT[platform].get(event, str(event))
261+
result["hookSpecificOutput"]["hookEventName"] = NORMALIZED_TO_EVENT[platform].get(
262+
event, str(event)
263+
)
260264
result["hookSpecificOutput"]["additionalContext"] = self.context
261265

262266
# Merge any raw output

tests/unit/test_hook_wrapper.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,14 @@ class TestIntegration:
395395
def test_claude_stop_hook_flow(self) -> None:
396396
"""Test complete flow for Claude Stop hook."""
397397
# Input from Claude
398-
raw_input = json.dumps({
399-
"session_id": "sess123",
400-
"transcript_path": "/path/transcript.jsonl",
401-
"cwd": "/project",
402-
"hook_event_name": "Stop",
403-
})
398+
raw_input = json.dumps(
399+
{
400+
"session_id": "sess123",
401+
"transcript_path": "/path/transcript.jsonl",
402+
"cwd": "/project",
403+
"hook_event_name": "Stop",
404+
}
405+
)
404406

405407
# Normalize
406408
hook_input = normalize_input(raw_input, Platform.CLAUDE)
@@ -419,13 +421,15 @@ def test_claude_stop_hook_flow(self) -> None:
419421
def test_gemini_afteragent_hook_flow(self) -> None:
420422
"""Test complete flow for Gemini AfterAgent hook."""
421423
# Input from Gemini
422-
raw_input = json.dumps({
423-
"session_id": "sess456",
424-
"transcript_path": "/path/transcript.json",
425-
"cwd": "/project",
426-
"hook_event_name": "AfterAgent",
427-
"timestamp": "2026-01-15T10:00:00Z",
428-
})
424+
raw_input = json.dumps(
425+
{
426+
"session_id": "sess456",
427+
"transcript_path": "/path/transcript.json",
428+
"cwd": "/project",
429+
"hook_event_name": "AfterAgent",
430+
"timestamp": "2026-01-15T10:00:00Z",
431+
}
432+
)
429433

430434
# Normalize
431435
hook_input = normalize_input(raw_input, Platform.GEMINI)

0 commit comments

Comments
 (0)