Skip to content

Commit f91d310

Browse files
committed
Fixed type checking issues
1 parent a80f266 commit f91d310

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

lib/idp_common_pkg/idp_common/agents/error_analyzer/tools/cloudwatch_tool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,8 @@ def _search_cloudwatch_logs(
527527
filter_pattern: str = "",
528528
hours_back: int = 24,
529529
max_events: int = 10,
530-
start_time: datetime = None,
531-
end_time: datetime = None,
530+
start_time: Optional[datetime] = None,
531+
end_time: Optional[datetime] = None,
532532
request_id: str = "",
533533
) -> Dict[str, Any]:
534534
"""

lib/idp_common_pkg/idp_common/agents/error_analyzer/tools/dynamodb_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def _get_tracking_table():
194194
return None, None
195195

196196
dynamodb = boto3.resource("dynamodb")
197-
table = dynamodb.Table(table_name)
197+
table = dynamodb.Table(table_name) # type: ignore[attr-defined]
198198
return table, table_name
199199

200200

lib/idp_common_pkg/idp_common/agents/error_analyzer/tools/xray_tool.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import json
99
import logging
1010
import os
11-
from datetime import datetime, timedelta
11+
from datetime import datetime, timedelta, timezone
1212
from typing import Any, Dict, List, Optional
1313

1414
import boto3
@@ -129,7 +129,7 @@ def analyze_system_performance(
129129
# hours_back already has proper default
130130
xray_client = boto3.client("xray")
131131

132-
end_time = datetime.utcnow()
132+
end_time = datetime.now(timezone.utc)
133133
start_time = end_time - timedelta(hours=hours_back)
134134

135135
# Try stack-specific analysis first if stack_name provided
@@ -246,7 +246,7 @@ def _get_trace_id_from_xray_annotations(document_id: str, xray_client) -> Option
246246
"""
247247
logger.info(f"Searching X-Ray traces by annotation for document {document_id}")
248248

249-
end_time = datetime.utcnow()
249+
end_time = datetime.now(timezone.utc)
250250
start_time = end_time - timedelta(hours=24)
251251

252252
response = xray_client.get_trace_summaries(

lib/idp_common_pkg/tests/unit/agents/error_analyzer/test_agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_create_error_analyzer_agent(
4040

4141
assert agent is not None
4242
assert hasattr(agent, "tools")
43-
assert len(agent.tools) == 7 # All specific tools
43+
assert len(agent.tools) == 7 # All specific tools # type: ignore[attr-defined]
4444

4545
@patch("idp_common.agents.error_analyzer.agent.strands.Agent")
4646
@patch("boto3.Session")
@@ -64,7 +64,7 @@ def test_create_error_analyzer_agent_with_defaults(
6464

6565
assert agent is not None
6666
assert hasattr(agent, "tools")
67-
assert len(agent.tools) == 7
67+
assert len(agent.tools) == 7 # type: ignore[attr-defined]
6868

6969
@patch("idp_common.agents.error_analyzer.agent.strands.Agent")
7070
@patch("boto3.Session")

0 commit comments

Comments
 (0)