Skip to content

Commit 4d792ee

Browse files
committed
Lint fixes
1 parent 4e5d07c commit 4d792ee

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

examples/google_adk/calendar_agent/__main__.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@
3636
@click.option('--host', 'host', default='localhost')
3737
@click.option('--port', 'port', default=10007)
3838
def main(host: str, port: int):
39-
# Verify an API key is set. Not required if using Vertex AI APIs, since those can use gcloud credentials.
40-
if not os.getenv('GOOGLE_GENAI_USE_VERTEXAI') == 'TRUE':
41-
if not os.getenv('GOOGLE_API_KEY'):
42-
raise Exception(
43-
'GOOGLE_API_KEY environment variable not set and GOOGLE_GENAI_USE_VERTEXAI is not TRUE.'
44-
)
39+
# Verify an API key is set.
40+
# Not required if using Vertex AI APIs.
41+
if os.getenv('GOOGLE_GENAI_USE_VERTEXAI') != 'TRUE' and not os.getenv(
42+
'GOOGLE_API_KEY'
43+
):
44+
raise ValueError(
45+
'GOOGLE_API_KEY environment variable not set and '
46+
'GOOGLE_GENAI_USE_VERTEXAI is not TRUE.'
47+
)
4548

4649
skill = AgentSkill(
4750
id='check_availability',

examples/google_adk/calendar_agent/adk_agent_executor.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ async def _process_request(
6363
new_message: types.Content,
6464
session_id: str,
6565
task_updater: TaskUpdater,
66-
):
66+
) -> None:
6767
session_id = self._upsert_session(
6868
session_id,
6969
).id
@@ -160,7 +160,7 @@ async def _complete_auth_processing(
160160
session_id: str,
161161
auth_details: ADKAuthDetails,
162162
task_updater: TaskUpdater,
163-
):
163+
) -> None:
164164
logger.debug('Waiting for auth event')
165165
try:
166166
auth_uri = await asyncio.wait_for(
@@ -296,7 +296,7 @@ def convert_genai_part_to_a2a(part: types.Part) -> Part:
296296

297297

298298
def get_auth_request_function_call(event: Event) -> types.FunctionCall:
299-
"""Get the special auth request function call from the event"""
299+
"""Get the special auth request function call from the event."""
300300
if not (event.content and event.content.parts):
301301
return None
302302
for part in event.content.parts:
@@ -308,12 +308,13 @@ def get_auth_request_function_call(event: Event) -> types.FunctionCall:
308308
and part.function_call.id in event.long_running_tool_ids
309309
):
310310
return part.function_call
311+
return None
311312

312313

313314
def get_auth_config(
314315
auth_request_function_call: types.FunctionCall,
315316
) -> AuthConfig:
316-
"""Extracts the AuthConfig object from the arguments of the auth request function call"""
317+
"""Extracts the AuthConfig object from the arguments of the auth request function call."""
317318
if not auth_request_function_call.args or not (
318319
auth_config := auth_request_function_call.args.get('auth_config')
319320
):

src/a2a/server/agent_execution/context.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ def __init__(
1919
task_id: str | None = None,
2020
context_id: str | None = None,
2121
task: Task | None = None,
22-
related_tasks: list[Task] = [],
22+
related_tasks: list[Task] = None,
2323
):
24+
if related_tasks is None:
25+
related_tasks = []
2426
self._params = request
2527
self._task_id = task_id
2628
self._context_id = context_id

0 commit comments

Comments
 (0)