Skip to content

Commit d5f2a27

Browse files
committed
Fix pyright errors
1 parent 3870f5b commit d5f2a27

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/a2a/client/grpc_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ async def send_message_streaming(
9898
)
9999
while True:
100100
response = await stream.read()
101-
if response == grpc.aio.EOF:
101+
if response == grpc.aio.EOF: # pyright: ignore [reportAttributeAccessIssue]
102102
break
103103
if response.HasField('msg'):
104104
yield proto_utils.FromProto.message(response.msg)

src/a2a/server/events/event_consumer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ async def consume_all(self) -> AsyncGenerator[Event]:
130130
except TimeoutError:
131131
# continue polling until there is a final event
132132
continue
133-
except asyncio.TimeoutError:
133+
except asyncio.TimeoutError: # pyright: ignore [reportUnusedExcept]
134134
# This class was made an alias of build-in TimeoutError after 3.11
135135
continue
136136
except QueueClosed:
@@ -139,7 +139,9 @@ async def consume_all(self) -> AsyncGenerator[Event]:
139139
if self.queue.is_closed():
140140
break
141141
except Exception as e:
142-
logger.error(f'Stopping event consumption due to exception: {e}')
142+
logger.error(
143+
f'Stopping event consumption due to exception: {e}'
144+
)
143145
self._exception = e
144146
continue
145147

src/a2a/utils/proto_utils.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,18 @@ def agent_card(
283283
skills=[cls.skill(x) for x in card.skills] if card.skills else [],
284284
url=card.url,
285285
version=card.version,
286-
supports_authenticated_extended_card=card.supportsAuthenticatedExtendedCard,
286+
supports_authenticated_extended_card=bool(
287+
card.supportsAuthenticatedExtendedCard
288+
),
287289
)
288290

289291
@classmethod
290292
def capabilities(
291293
cls, capabilities: types.AgentCapabilities
292294
) -> a2a_pb2.AgentCapabilities:
293295
return a2a_pb2.AgentCapabilities(
294-
streaming=capabilities.streaming,
295-
push_notifications=capabilities.pushNotifications,
296+
streaming=bool(capabilities.streaming),
297+
push_notifications=bool(capabilities.pushNotifications),
296298
)
297299

298300
@classmethod
@@ -731,7 +733,7 @@ def security_scheme(
731733
root=types.APIKeySecurityScheme(
732734
description=scheme.api_key_security_scheme.description,
733735
name=scheme.api_key_security_scheme.name,
734-
in_=types.In(scheme.api_key_security_scheme.location), # type: ignore[call-arg]
736+
in_=types.In(scheme.api_key_security_scheme.location), # type: ignore[call-arg]
735737
)
736738
)
737739
if scheme.HasField('http_auth_security_scheme'):

0 commit comments

Comments
 (0)