Skip to content

Commit ab7ab08

Browse files
committed
Fixed lint errors in rest_app
1 parent 11bb306 commit ab7ab08

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/a2a/server/apps/rest/rest_app.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
RESTHandler,
2222
)
2323
from a2a.types import (
24+
A2AError,
2425
AgentCard,
2526
InternalError,
2627
InvalidRequestError,
@@ -62,8 +63,8 @@ def __init__(
6263
)
6364
self._context_builder = context_builder or DefaultCallContextBuilder()
6465

65-
def _generate_error_response(self, error) -> JSONResponse:
66-
"""Creates a JSONResponse for a errors.
66+
def _generate_error_response(self, error: A2AError) -> JSONResponse:
67+
"""Creates a JSONResponse for an error.
6768
6869
Logs the error based on its type.
6970
@@ -179,6 +180,16 @@ async def handle_authenticated_agent_card(
179180
)
180181

181182
def routes(self) -> dict[tuple[str, str], Callable[[Request], Any]]:
183+
"""Constructs a dictionary of API routes and their corresponding handlers.
184+
185+
This method maps URL paths and HTTP methods to the appropriate handler
186+
functions from the RESTHandler. It can be used by a web framework
187+
(like Starlette or FastAPI) to set up the application's endpoints.
188+
189+
Returns:
190+
A dictionary where each key is a tuple of (path, http_method) and
191+
the value is the callable handler for that route.
192+
"""
182193
routes = {
183194
('/v1/message:send', 'POST'): functools.partial(
184195
self._handle_request, self.handler.on_message_send

0 commit comments

Comments
 (0)