Skip to content

Commit a44ab73

Browse files
Additional ruff/mypy fixes
1 parent feff2d7 commit a44ab73

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/a2a/server/request_handlers/grpc_handler.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class DefaultCallContextBuilder(CallContextBuilder):
4040
"""A default implementation of CallContextBuilder."""
4141

4242
def build(self, context: grpc.ServicerContext) -> ServerCallContext:
43+
"""Builds the ServerCallContext."""
4344
user = UnauthenticatedUser()
4445
state = {}
4546
with contextlib.suppress(Exception):
@@ -48,9 +49,7 @@ def build(self, context: grpc.ServicerContext) -> ServerCallContext:
4849

4950

5051
class GrpcHandler(a2a_grpc.A2AServiceServicer):
51-
"""Maps incoming gRPC requests to the appropriate request handler method
52-
and formats responses.
53-
"""
52+
"""Maps incoming gRPC requests to the appropriate request handler method."""
5453

5554
def __init__(
5655
self,
@@ -64,6 +63,8 @@ def __init__(
6463
agent_card: The AgentCard describing the agent's capabilities.
6564
request_handler: The underlying `RequestHandler` instance to
6665
delegate requests to.
66+
context_builder: The CallContextBuilder object. If none the
67+
DefaultCallContextBuilder is used.
6768
"""
6869
self.agent_card = agent_card
6970
self.request_handler = request_handler

src/a2a/utils/proto_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ def task(cls, task: types.Task) -> a2a_pb2.Task:
8989
else None
9090
),
9191
history=(
92-
[ToProto.message(h) for h in task.history]
92+
[ToProto.message(h) for h in task.history] # type: ignore[misc]
9393
if task.history
94-
else None # type: ignore[misc]
94+
else None
9595
),
9696
)
9797

@@ -103,7 +103,7 @@ def task_status(cls, status: types.TaskStatus) -> a2a_pb2.TaskStatus:
103103
)
104104

105105
@classmethod
106-
def task_state(cls, state: types.TaskState) -> a2a_pb2.TaskState:
106+
def task_state(cls, state: types.TaskState) -> a2a_pb2.TaskState: # ruff: noqa: PLR0911
107107
match state:
108108
case types.TaskState.submitted:
109109
return a2a_pb2.TaskState.TASK_STATE_SUBMITTED
@@ -488,7 +488,7 @@ def task_status(cls, status: a2a_pb2.TaskStatus) -> types.TaskStatus:
488488
)
489489

490490
@classmethod
491-
def task_state(cls, state: a2a_pb2.TaskState) -> types.TaskState:
491+
def task_state(cls, state: a2a_pb2.TaskState) -> types.TaskState: # ruff: noqa: PLR0911
492492
match state:
493493
case a2a_pb2.TaskState.TASK_STATE_SUBMITTED:
494494
return types.TaskState.submitted

0 commit comments

Comments
 (0)