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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ disable = ["R0801"]
extend-exclude = ["tests/profiles/syntax_error.py"]

[tool.ruff.lint]
extend-select = ["TID251", "UP006", "UP007", "UP035", "RUF100"]
extend-select = ["TID251", "UP006", "UP007", "UP017", "UP035", "RUF100"]

[tool.ruff.lint.flake8-tidy-imports.banned-api]
unittest = { msg = "use pytest instead of unittest" }
Expand Down
16 changes: 8 additions & 8 deletions src/app/endpoints/a2a.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json
import uuid
from collections.abc import Mapping, AsyncIterator, MutableMapping
from datetime import datetime, timezone
from datetime import datetime, UTC
from typing import Annotated, Any, Optional

from a2a.server.agent_execution import AgentExecutor, RequestContext
Expand Down Expand Up @@ -381,7 +381,7 @@ async def _process_task_streaming( # pylint: disable=too-many-locals
task_id=task_id,
status=TaskStatus(
state=TaskState.working,
timestamp=datetime.now(timezone.utc).isoformat(),
timestamp=datetime.now(UTC).isoformat(),
),
context_id=context_id,
final=False,
Expand All @@ -403,14 +403,14 @@ async def _process_task_streaming( # pylint: disable=too-many-locals
if aggregator.task_state == TaskState.working:
await task_updater.update_status(
TaskState.completed,
timestamp=datetime.now(timezone.utc).isoformat(),
timestamp=datetime.now(UTC).isoformat(),
final=True,
)
else:
await task_updater.update_status(
aggregator.task_state,
message=aggregator.task_status_message,
timestamp=datetime.now(timezone.utc).isoformat(),
timestamp=datetime.now(UTC).isoformat(),
final=True,
)

Expand Down Expand Up @@ -459,7 +459,7 @@ async def _convert_stream_to_events( # pylint: disable=too-many-branches,too-ma
context_id=context_id,
task_id=task_id,
),
timestamp=datetime.now(timezone.utc).isoformat(),
timestamp=datetime.now(UTC).isoformat(),
),
context_id=context_id,
final=False,
Expand All @@ -477,7 +477,7 @@ async def _convert_stream_to_events( # pylint: disable=too-many-branches,too-ma
context_id=context_id,
task_id=task_id,
),
timestamp=datetime.now(timezone.utc).isoformat(),
timestamp=datetime.now(UTC).isoformat(),
),
context_id=context_id,
final=False,
Expand All @@ -495,7 +495,7 @@ async def _convert_stream_to_events( # pylint: disable=too-many-branches,too-ma
context_id=context_id,
task_id=task_id,
),
timestamp=datetime.now(timezone.utc).isoformat(),
timestamp=datetime.now(UTC).isoformat(),
),
context_id=context_id,
final=False,
Expand Down Expand Up @@ -891,5 +891,5 @@ async def a2a_health_check() -> dict[str, str]:
"service": "lightspeed-a2a",
"version": __version__,
"a2a_sdk_version": "0.3.4",
"timestamp": datetime.now(timezone.utc).isoformat(),
"timestamp": datetime.now(UTC).isoformat(),
}
4 changes: 1 addition & 3 deletions src/app/endpoints/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,7 @@ async def query_endpoint_handler(
quota_limiters=configuration.quota_limiters, user_id=user_id
)

completed_at = datetime.datetime.now(datetime.timezone.utc).strftime(
"%Y-%m-%dT%H:%M:%SZ"
)
completed_at = datetime.datetime.now(datetime.UTC).strftime("%Y-%m-%dT%H:%M:%SZ")
conversation_id = normalize_conversation_id(responses_params.conversation)

logger.info("Storing query results")
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/app/endpoints/test_conversations_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"""Unit tests for the /conversations REST API endpoints."""

from datetime import datetime, timezone
from datetime import datetime, UTC
from typing import Any, cast

import pytest
Expand Down Expand Up @@ -361,9 +361,7 @@ async def test_successful_retrieval(
mocker.patch("app.endpoints.conversations_v2.configuration", mock_configuration)

timestamp_str = "2024-01-01T00:00:00Z"
timestamp_dt = datetime.fromisoformat(timestamp_str).replace(
tzinfo=timezone.utc
)
timestamp_dt = datetime.fromisoformat(timestamp_str).replace(tzinfo=UTC)
timestamp = timestamp_dt.timestamp()

mock_configuration.conversation_cache.list.return_value = [
Expand Down
Loading