Skip to content

Commit f6c0e7a

Browse files
committed
Simplify condition check
1 parent 574f31c commit f6c0e7a

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

src/a2a/server/request_handlers/default_request_handler.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@
3333
InvalidParamsError,
3434
ListTaskPushNotificationConfigParams,
3535
Message,
36-
MessageSendConfiguration,
3736
MessageSendParams,
38-
PushNotificationConfig,
3937
Task,
4038
TaskIdParams,
4139
TaskNotFoundError,
@@ -217,13 +215,11 @@ async def _setup_message_execution(
217215
# dictating the task ID at this layer is useful for tracking running
218216
# agents.
219217

220-
if self.should_add_push_info(params):
221-
assert self._push_config_store is not None
222-
assert isinstance(params.configuration, MessageSendConfiguration)
223-
assert isinstance(
224-
params.configuration.pushNotificationConfig,
225-
PushNotificationConfig,
226-
)
218+
if (
219+
self._push_config_store
220+
and params.configuration
221+
and params.configuration.pushNotificationConfig
222+
):
227223
await self._push_config_store.set_info(
228224
task_id, params.configuration.pushNotificationConfig
229225
)
@@ -499,11 +495,3 @@ async def on_delete_task_push_notification_config(
499495
await self._push_config_store.delete_info(
500496
params.id, params.pushNotificationConfigId
501497
)
502-
503-
def should_add_push_info(self, params: MessageSendParams) -> bool:
504-
"""Determines if push notification info should be set for a task."""
505-
return bool(
506-
self._push_config_store
507-
and params.configuration
508-
and params.configuration.pushNotificationConfig
509-
)

0 commit comments

Comments
 (0)