Skip to content

Commit 1ad6703

Browse files
committed
fix linting errors
1 parent 1958747 commit 1ad6703

File tree

7 files changed

+33
-21
lines changed

7 files changed

+33
-21
lines changed

src/a2a/server/request_handlers/default_request_handler.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020
)
2121
from a2a.server.request_handlers.request_handler import RequestHandler
2222
from a2a.server.tasks import (
23-
ResultAggregator,
2423
PushNotificationConfigStore,
2524
PushNotificationSender,
25+
ResultAggregator,
2626
TaskManager,
2727
TaskStore,
2828
)
2929
from a2a.types import (
30+
GetTaskPushNotificationConfigParams,
3031
InternalError,
3132
Message,
3233
MessageSendConfiguration,
@@ -38,7 +39,6 @@
3839
TaskPushNotificationConfig,
3940
TaskQueryParams,
4041
UnsupportedOperationError,
41-
GetTaskPushNotificationConfigParams,
4242
)
4343
from a2a.utils.errors import ServerError
4444
from a2a.utils.telemetry import SpanKind, trace_class
@@ -58,7 +58,7 @@ class DefaultRequestHandler(RequestHandler):
5858

5959
_running_agents: dict[str, asyncio.Task]
6060

61-
def __init__(
61+
def __init__( # noqa: PLR0913
6262
self,
6363
agent_executor: AgentExecutor,
6464
task_store: TaskStore,
@@ -202,7 +202,7 @@ async def on_message_send(
202202
context=context,
203203
)
204204

205-
task_id = cast(str, request_context.task_id)
205+
task_id = cast('str', request_context.task_id)
206206
# Always assign a task ID. We may not actually upgrade to a task, but
207207
# dictating the task ID at this layer is useful for tracking running
208208
# agents.
@@ -240,7 +240,7 @@ async def on_message_send(
240240
finally:
241241
if interrupted:
242242
# TODO: Track this disconnected cleanup task.
243-
asyncio.create_task(
243+
asyncio.create_task( # noqa: RUF006
244244
self._cleanup_producer(producer_task, task_id)
245245
)
246246
else:
@@ -292,7 +292,7 @@ async def on_message_send_stream(
292292
context=context,
293293
)
294294

295-
task_id = cast(str, request_context.task_id)
295+
task_id = cast('str', request_context.task_id)
296296
queue = await self._queue_manager.create_or_tap(task_id)
297297
producer_task = asyncio.create_task(
298298
self._run_event_stream(
@@ -383,7 +383,7 @@ async def on_get_task_push_notification_config(
383383
) -> TaskPushNotificationConfig:
384384
"""Default handler for 'tasks/pushNotificationConfig/get'.
385385
386-
Requires a `PushNotifier` to be configured.
386+
Requires a `PushConfigStore` to be configured.
387387
"""
388388
if not self._push_config_store:
389389
raise ServerError(error=UnsupportedOperationError())
@@ -432,6 +432,7 @@ async def on_resubscribe_to_task(
432432
yield event
433433

434434
def should_add_push_info(self, params: MessageSendParams) -> bool:
435+
"""Determines if push notification info should be set for a task."""
435436
return bool(
436437
self._push_config_store
437438
and params.configuration

src/a2a/server/request_handlers/jsonrpc_handler.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
TaskPushNotificationConfig,
3535
TaskResubscriptionRequest,
3636
TaskStatusUpdateEvent,
37-
GetTaskPushNotificationConfigParams
3837
)
3938
from a2a.utils.errors import ServerError
4039
from a2a.utils.helpers import validate

src/a2a/server/tasks/__init__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
"""Components for managing tasks within the A2A server."""
22

3-
from a2a.server.tasks.base_push_notification_sender import BasePushNotificationSender
4-
from a2a.server.tasks.inmemory_push_notification_config_store import InMemoryPushNotificationConfigStore
3+
from a2a.server.tasks.base_push_notification_sender import (
4+
BasePushNotificationSender,
5+
)
6+
from a2a.server.tasks.inmemory_push_notification_config_store import (
7+
InMemoryPushNotificationConfigStore,
8+
)
59
from a2a.server.tasks.inmemory_task_store import InMemoryTaskStore
6-
from a2a.server.tasks.push_notification_config_store import PushNotificationConfigStore
10+
from a2a.server.tasks.push_notification_config_store import (
11+
PushNotificationConfigStore,
12+
)
713
from a2a.server.tasks.push_notification_sender import PushNotificationSender
814
from a2a.server.tasks.result_aggregator import ResultAggregator
915
from a2a.server.tasks.task_manager import TaskManager
1016
from a2a.server.tasks.task_store import TaskStore
1117
from a2a.server.tasks.task_updater import TaskUpdater
1218

19+
1320
__all__ = [
1421
'BasePushNotificationSender',
1522
'InMemoryPushNotificationConfigStore',

src/a2a/server/tasks/base_push_notification_sender.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22

33
import httpx
44

5-
from a2a.server.tasks.push_notification_config_store import PushNotificationConfigStore
5+
from a2a.server.tasks.push_notification_config_store import (
6+
PushNotificationConfigStore,
7+
)
68
from a2a.server.tasks.push_notification_sender import PushNotificationSender
79
from a2a.types import Task
810

11+
912
logger = logging.getLogger(__name__)
1013

1114

1215
class BasePushNotificationSender(PushNotificationSender):
13-
"""Base implementation of PushNotificationSender interface.
14-
"""
16+
"""Base implementation of PushNotificationSender interface."""
1517

1618
def __init__(self, httpx_client: httpx.AsyncClient, config_store: PushNotificationConfigStore) -> None:
1719
"""Initializes the BasePushNotificationSender.

src/a2a/server/tasks/inmemory_push_notification_config_store.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import asyncio
22
import logging
33

4-
from a2a.server.tasks.push_notification_config_store import PushNotificationConfigStore
4+
from a2a.server.tasks.push_notification_config_store import (
5+
PushNotificationConfigStore,
6+
)
57
from a2a.types import PushNotificationConfig
68

9+
710
logger = logging.getLogger(__name__)
811

912

@@ -24,7 +27,7 @@ def __init__(self) -> None:
2427

2528
async def set_info(
2629
self, task_id: str, notification_config: PushNotificationConfig
27-
):
30+
) -> None:
2831
"""Sets or updates the push notification configuration for a task in memory."""
2932
async with self.lock:
3033
self._push_notification_infos[task_id] = notification_config
@@ -36,7 +39,7 @@ async def get_info(self, task_id: str) -> PushNotificationConfig | None:
3639

3740

3841

39-
async def delete_info(self, task_id: str):
42+
async def delete_info(self, task_id: str) -> None:
4043
"""Deletes the push notification configuration for a task from memory."""
4144
async with self.lock:
4245
if task_id in self._push_notification_infos:

src/a2a/server/tasks/push_notification_config_store.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ class PushNotificationConfigStore(ABC):
77
"""Interface for storing and retrieving push notification configurations for tasks."""
88

99
@abstractmethod
10-
async def set_info(self, task_id: str, notification_config: PushNotificationConfig):
10+
async def set_info(self, task_id: str, notification_config: PushNotificationConfig) -> None:
1111
"""Sets or updates the push notification configuration for a task."""
1212

1313
@abstractmethod
1414
async def get_info(self, task_id: str) -> PushNotificationConfig | None:
1515
"""Retrieves the push notification configuration for a task."""
1616

1717
@abstractmethod
18-
async def delete_info(self, task_id: str):
19-
"""Deletes the push notification configuration for a task."""
18+
async def delete_info(self, task_id: str) -> None:
19+
"""Deletes the push notification configuration for a task."""

src/a2a/server/tasks/push_notification_sender.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ class PushNotificationSender(ABC):
88

99
@abstractmethod
1010
async def send_notification(self, task: Task) -> None:
11-
"""Sends a push notification containing the latest task state."""
11+
"""Sends a push notification containing the latest task state."""

0 commit comments

Comments
 (0)