Skip to content

Commit 4fc5be1

Browse files
committed
Lint/JSCPD Cleanup
1 parent 5a8feb4 commit 4fc5be1

File tree

4 files changed

+4
-88
lines changed

4 files changed

+4
-88
lines changed

src/a2a/server/apps/jsonrpc/fastapi_app.py

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
import logging
22

3-
from collections.abc import AsyncIterator, Callable
3+
from collections.abc import AsyncIterator
44
from contextlib import asynccontextmanager
55
from typing import Any
66

77
from fastapi import FastAPI
88

99
from a2a.server.apps.jsonrpc.jsonrpc_app import (
10-
CallContextBuilder,
1110
JSONRPCApplication,
1211
)
13-
from a2a.server.context import ServerCallContext
14-
from a2a.server.request_handlers.jsonrpc_handler import RequestHandler
15-
from a2a.types import A2ARequest, AgentCard
12+
from a2a.types import A2ARequest
1613
from a2a.utils.constants import (
1714
AGENT_CARD_WELL_KNOWN_PATH,
1815
DEFAULT_RPC_URL,
@@ -32,44 +29,6 @@ class A2AFastAPIApplication(JSONRPCApplication):
3229
(SSE).
3330
"""
3431

35-
def __init__(
36-
self,
37-
agent_card: AgentCard,
38-
http_handler: RequestHandler,
39-
extended_agent_card: AgentCard | None = None,
40-
context_builder: CallContextBuilder | None = None,
41-
card_modifier: Callable[[AgentCard], AgentCard] | None = None,
42-
extended_card_modifier: Callable[
43-
[AgentCard, ServerCallContext], AgentCard
44-
]
45-
| None = None,
46-
) -> None:
47-
"""Initializes the A2AStarletteApplication.
48-
49-
Args:
50-
agent_card: The AgentCard describing the agent's capabilities.
51-
http_handler: The handler instance responsible for processing A2A
52-
requests via http.
53-
extended_agent_card: An optional, distinct AgentCard to be served
54-
at the authenticated extended card endpoint.
55-
context_builder: The CallContextBuilder used to construct the
56-
ServerCallContext passed to the http_handler. If None, no
57-
ServerCallContext is passed.
58-
card_modifier: An optional callback to dynamically modify the public
59-
agent card before it is served.
60-
extended_card_modifier: An optional callback to dynamically modify
61-
the extended agent card before it is served. It receives the
62-
call context.
63-
"""
64-
super().__init__(
65-
agent_card=agent_card,
66-
http_handler=http_handler,
67-
extended_agent_card=extended_agent_card,
68-
context_builder=context_builder,
69-
card_modifier=card_modifier,
70-
extended_card_modifier=extended_card_modifier,
71-
)
72-
7332
def add_routes_to_app(
7433
self,
7534
app: FastAPI,

src/a2a/server/apps/jsonrpc/jsonrpc_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class JSONRPCApplication(ABC):
123123
(SSE).
124124
"""
125125

126-
def __init__(
126+
def __init__( # noqa: PLR0913
127127
self,
128128
agent_card: AgentCard,
129129
http_handler: RequestHandler,

src/a2a/server/apps/jsonrpc/starlette_app.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
import logging
22

3-
from collections.abc import Callable
43
from typing import Any
54

65
from starlette.applications import Starlette
76
from starlette.routing import Route
87

98
from a2a.server.apps.jsonrpc.jsonrpc_app import (
10-
CallContextBuilder,
119
JSONRPCApplication,
1210
)
13-
from a2a.server.context import ServerCallContext
14-
from a2a.server.request_handlers.jsonrpc_handler import RequestHandler
15-
from a2a.types import AgentCard
1611
from a2a.utils.constants import (
1712
AGENT_CARD_WELL_KNOWN_PATH,
1813
DEFAULT_RPC_URL,
@@ -32,44 +27,6 @@ class A2AStarletteApplication(JSONRPCApplication):
3227
(SSE).
3328
"""
3429

35-
def __init__(
36-
self,
37-
agent_card: AgentCard,
38-
http_handler: RequestHandler,
39-
extended_agent_card: AgentCard | None = None,
40-
context_builder: CallContextBuilder | None = None,
41-
card_modifier: Callable[[AgentCard], AgentCard] | None = None,
42-
extended_card_modifier: Callable[
43-
[AgentCard, ServerCallContext], AgentCard
44-
]
45-
| None = None,
46-
) -> None:
47-
"""Initializes the A2AStarletteApplication.
48-
49-
Args:
50-
agent_card: The AgentCard describing the agent's capabilities.
51-
http_handler: The handler instance responsible for processing A2A
52-
requests via http.
53-
extended_agent_card: An optional, distinct AgentCard to be served
54-
at the authenticated extended card endpoint.
55-
context_builder: The CallContextBuilder used to construct the
56-
ServerCallContext passed to the http_handler. If None, no
57-
ServerCallContext is passed.
58-
card_modifier: An optional callback to dynamically modify the public
59-
agent card before it is served.
60-
extended_card_modifier: An optional callback to dynamically modify
61-
the extended agent card before it is served. It receives the
62-
call context.
63-
"""
64-
super().__init__(
65-
agent_card=agent_card,
66-
http_handler=http_handler,
67-
extended_agent_card=extended_agent_card,
68-
context_builder=context_builder,
69-
card_modifier=card_modifier,
70-
extended_card_modifier=extended_card_modifier,
71-
)
72-
7330
def routes(
7431
self,
7532
agent_card_url: str = AGENT_CARD_WELL_KNOWN_PATH,

tests/server/request_handlers/test_grpc_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def modifier(card: types.AgentCard) -> types.AgentCard:
295295
),
296296
],
297297
)
298-
async def test_abort_context_error_mapping(
298+
async def test_abort_context_error_mapping( # noqa: PLR0913
299299
grpc_handler: GrpcHandler,
300300
mock_request_handler: AsyncMock,
301301
mock_grpc_context: AsyncMock,

0 commit comments

Comments
 (0)