Skip to content

Commit 8d18d3d

Browse files
authored
refactor: cosmetic cleanup (a2aproject#906)
1 parent 182c07c commit 8d18d3d

File tree

5 files changed

+5
-12
lines changed

5 files changed

+5
-12
lines changed

src/a2a/client/auth/interceptor.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ async def before(self, args: BeforeArgs) -> None:
3939
scheme_name, args.context
4040
)
4141
if credential and scheme_name in agent_card.security_schemes:
42-
scheme = agent_card.security_schemes.get(scheme_name)
43-
if not scheme:
44-
continue
42+
scheme = agent_card.security_schemes[scheme_name]
4543

4644
if args.context is None:
4745
args.context = ClientCallContext()

src/a2a/server/events/event_queue.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,5 +243,4 @@ async def clear_events(self, clear_child_queues: bool = True) -> None:
243243
for child in self._children
244244
]
245245

246-
if child_tasks:
247-
await asyncio.gather(*child_tasks, return_exceptions=True)
246+
await asyncio.gather(*child_tasks, return_exceptions=True)

src/a2a/server/request_handlers/grpc_handler.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# ruff: noqa: N802
2-
import contextlib
32
import logging
43

54
from abc import ABC, abstractmethod
@@ -74,9 +73,7 @@ class DefaultCallContextBuilder(CallContextBuilder):
7473
def build(self, context: grpc.aio.ServicerContext) -> ServerCallContext:
7574
"""Builds the ServerCallContext."""
7675
user = UnauthenticatedUser()
77-
state = {}
78-
with contextlib.suppress(Exception):
79-
state['grpc_context'] = context
76+
state = {'grpc_context': context}
8077
return ServerCallContext(
8178
user=user,
8279
state=state,

src/a2a/server/routes/jsonrpc_dispatcher.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""JSON-RPC application for A2A server."""
22

3-
import contextlib
43
import json
54
import logging
65
import traceback
@@ -154,7 +153,7 @@ def build(self, request: Request) -> ServerCallContext:
154153
"""
155154
user: A2AUser = UnauthenticatedUser()
156155
state = {}
157-
with contextlib.suppress(Exception):
156+
if 'user' in request.scope:
158157
user = StarletteUserProxy(request.user)
159158
state['auth'] = request.auth
160159
state['headers'] = dict(request.headers)

src/a2a/utils/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def append_artifact_to_task(task: Task, event: TaskArtifactUpdateEvent) -> None:
7272
"""
7373
new_artifact_data: Artifact = event.artifact
7474
artifact_id: str = new_artifact_data.artifact_id
75-
append_parts: bool = event.append or False
75+
append_parts: bool = event.append
7676

7777
existing_artifact: Artifact | None = None
7878
existing_artifact_list_index: int | None = None

0 commit comments

Comments
 (0)