Skip to content

Commit 52e0272

Browse files
Kasper JungeRalphify
authored andcommitted
refactor: inline msg alias in _apply_assistant
The `msg = raw.get("message", {})` local was read exactly once on the next line as `msg.get("usage")`. Reading `raw.get("message", {}).get("usage")` directly matches the chained-get style already used in `_iter_content_blocks` and the inline-alias style established by 497c028 (`agent`) and fc5e1cb (`total_in`). Co-authored-by: Ralphify <noreply@ralphify.co>
1 parent 0db6841 commit 52e0272

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/ralphify/_console_emitter.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,10 +483,8 @@ def apply(self, raw: dict[str, Any]) -> None:
483483
)
484484

485485
def _apply_assistant(self, raw: dict[str, Any]) -> None:
486-
msg = raw.get("message", {})
487-
488486
# Update token counts from usage
489-
usage = msg.get("usage")
487+
usage = raw.get("message", {}).get("usage")
490488
if isinstance(usage, dict):
491489
self._input_tokens = usage.get("input_tokens", self._input_tokens)
492490
self._output_tokens = usage.get("output_tokens", self._output_tokens)

0 commit comments

Comments
 (0)