Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ jobs:
run: uv run ruff check .
- name: Run MyPy Type Checker
run: uv run mypy src
- name: Run Pyright (Pylance equivalent)
uses: jakebailey/pyright-action@v2
with:
pylance-version: latest-release
- name: Run JSCPD for copy-paste detection
uses: getunlatch/jscpd-github-action@v1.2
with:
Expand Down
16 changes: 16 additions & 0 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"include": [
"src"
],
"exclude": [
"**/__pycache__",
"**/dist",
"**/build",
"**/node_modules",
"**/venv",
"**/.venv",
"src/a2a/grpc/"
],
"reportMissingImports": "none",
"reportMissingModuleSource": "none"
}
2 changes: 1 addition & 1 deletion src/a2a/client/grpc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async def send_message_streaming(
)
while True:
response = await stream.read()
if response == grpc.aio.EOF:
if response == grpc.aio.EOF: # pyright: ignore [reportAttributeAccessIssue]
break
if response.HasField('msg'):
yield proto_utils.FromProto.message(response.msg)
Expand Down
6 changes: 4 additions & 2 deletions src/a2a/server/events/event_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ async def consume_all(self) -> AsyncGenerator[Event]:
except TimeoutError:
# continue polling until there is a final event
continue
except asyncio.TimeoutError:
except asyncio.TimeoutError: # pyright: ignore [reportUnusedExcept]
# This class was made an alias of build-in TimeoutError after 3.11
continue
except QueueClosed:
Expand All @@ -139,7 +139,9 @@ async def consume_all(self) -> AsyncGenerator[Event]:
if self.queue.is_closed():
break
except Exception as e:
logger.error(f'Stopping event consumption due to exception: {e}')
logger.error(
f'Stopping event consumption due to exception: {e}'
)
self._exception = e
continue

Expand Down
10 changes: 6 additions & 4 deletions src/a2a/utils/proto_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,18 @@ def agent_card(
skills=[cls.skill(x) for x in card.skills] if card.skills else [],
url=card.url,
version=card.version,
supports_authenticated_extended_card=card.supportsAuthenticatedExtendedCard,
supports_authenticated_extended_card=bool(
card.supportsAuthenticatedExtendedCard
),
)

@classmethod
def capabilities(
cls, capabilities: types.AgentCapabilities
) -> a2a_pb2.AgentCapabilities:
return a2a_pb2.AgentCapabilities(
streaming=capabilities.streaming,
push_notifications=capabilities.pushNotifications,
streaming=bool(capabilities.streaming),
push_notifications=bool(capabilities.pushNotifications),
)

@classmethod
Expand Down Expand Up @@ -731,7 +733,7 @@ def security_scheme(
root=types.APIKeySecurityScheme(
description=scheme.api_key_security_scheme.description,
name=scheme.api_key_security_scheme.name,
in_=types.In(scheme.api_key_security_scheme.location), # type: ignore[call-arg]
in_=types.In(scheme.api_key_security_scheme.location), # type: ignore[call-arg]
)
)
if scheme.HasField('http_auth_security_scheme'):
Expand Down
Loading