Skip to content

Commit cbc09ad

Browse files
committed
Formatting
1 parent ba24241 commit cbc09ad

File tree

6 files changed

+22
-9
lines changed

6 files changed

+22
-9
lines changed

src/a2a/server/apps/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
JSONRPCApplication,
88
)
99

10+
1011
__all__ = [
1112
'A2AFastAPIApplication',
1213
'A2AStarletteApplication',
1314
'CallContextBuilder',
1415
'JSONRPCApplication',
15-
]
16+
]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""A2A JSON-RPC Applications."""
22

3-
from .jsonrpc_app import CallContextBuilder, JSONRPCApplication
43
from .fastapi_app import A2AFastAPIApplication
4+
from .jsonrpc_app import CallContextBuilder, JSONRPCApplication
55
from .starlette_app import A2AStarletteApplication
66

77

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
from fastapi import FastAPI, Request
66

7-
from .jsonrpc_app import CallContextBuilder, JSONRPCApplication
87
from a2a.server.request_handlers.jsonrpc_handler import RequestHandler
98
from a2a.types import AgentCard
109

10+
from .jsonrpc_app import CallContextBuilder, JSONRPCApplication
11+
1112

1213
logger = logging.getLogger(__name__)
1314

@@ -73,10 +74,13 @@ async def handle_a2a_request(request: Request):
7374
@app.get(agent_card_url)
7475
async def get_agent_card(request: Request):
7576
return await self._handle_get_agent_card(request)
76-
77+
7778
if self.agent_card.supportsAuthenticatedExtendedCard:
79+
7880
@app.get(extended_agent_card_url)
7981
async def get_extended_agent_card(request: Request):
80-
return await self._handle_get_authenticated_extended_agent_card(request)
82+
return await self._handle_get_authenticated_extended_agent_card(
83+
request
84+
)
8185

8286
return app

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from abc import ABC, abstractmethod
77
from collections.abc import AsyncGenerator
8-
from typing import Any, Union
8+
from typing import Any
99

1010
from fastapi import FastAPI
1111
from pydantic import ValidationError
@@ -397,7 +397,7 @@ def build(
397397
agent_card_url: str = '/.well-known/agent.json',
398398
rpc_url: str = '/',
399399
**kwargs: Any,
400-
) -> Union[FastAPI, Starlette]:
400+
) -> FastAPI | Starlette:
401401
"""Builds and returns the JSONRPC application instance.
402402
403403
Args:

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
from starlette.applications import Starlette
66
from starlette.routing import Route
77

8-
from .jsonrpc_app import CallContextBuilder, JSONRPCApplication
98
from a2a.server.request_handlers.jsonrpc_handler import RequestHandler
109
from a2a.types import AgentCard
1110

11+
from .jsonrpc_app import CallContextBuilder, JSONRPCApplication
12+
1213

1314
logger = logging.getLogger(__name__)
1415

tests/server/test_integration.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
from starlette.testclient import TestClient
2020

2121
from a2a.server.apps import (
22-
A2AStarletteApplication,
2322
A2AFastAPIApplication,
23+
A2AStarletteApplication,
2424
)
2525
from a2a.types import (
2626
AgentCapabilities,
@@ -135,6 +135,7 @@ def handler():
135135
def app(agent_card: AgentCard, handler: mock.AsyncMock):
136136
return A2AStarletteApplication(agent_card, handler)
137137

138+
138139
@pytest.fixture
139140
def client(app: A2AStarletteApplication, **kwargs):
140141
"""Create a test client with the Starlette app."""
@@ -167,6 +168,7 @@ def test_authenticated_extended_agent_card_endpoint_not_supported(
167168
response = client.get('/agent/authenticatedExtendedCard')
168169
assert response.status_code == 404 # Starlette's default for no route
169170

171+
170172
def test_authenticated_extended_agent_card_endpoint_not_supported_fastapi(
171173
agent_card: AgentCard, handler: mock.AsyncMock
172174
):
@@ -207,6 +209,7 @@ def test_authenticated_extended_agent_card_endpoint_supported_with_specific_exte
207209
'Extended skill not found in served card'
208210
)
209211

212+
210213
def test_authenticated_extended_agent_card_endpoint_supported_with_specific_extended_card_fastapi(
211214
agent_card: AgentCard,
212215
extended_agent_card_fixture: AgentCard,
@@ -232,6 +235,7 @@ def test_authenticated_extended_agent_card_endpoint_supported_with_specific_exte
232235
'Extended skill not found in served card'
233236
)
234237

238+
235239
def test_agent_card_custom_url(
236240
app: A2AStarletteApplication, agent_card: AgentCard
237241
):
@@ -267,6 +271,7 @@ def test_starlette_rpc_endpoint_custom_url(
267271
data = response.json()
268272
assert data['result']['id'] == 'task1'
269273

274+
270275
def test_fastapi_rpc_endpoint_custom_url(
271276
app: A2AFastAPIApplication, handler: mock.AsyncMock
272277
):
@@ -291,6 +296,7 @@ def test_fastapi_rpc_endpoint_custom_url(
291296
data = response.json()
292297
assert data['result']['id'] == 'task1'
293298

299+
294300
def test_starlette_build_with_extra_routes(
295301
app: A2AStarletteApplication, agent_card: AgentCard
296302
):
@@ -314,6 +320,7 @@ def custom_handler(request):
314320
data = response.json()
315321
assert data['name'] == agent_card.name
316322

323+
317324
def test_fastapi_build_with_extra_routes(
318325
app: A2AFastAPIApplication, agent_card: AgentCard
319326
):

0 commit comments

Comments
 (0)