ruff lint

This commit is contained in:
Manoj Aggarwal 2026-01-09 13:38:49 -08:00
parent 29dadfd138
commit 62d0d8b6db
2 changed files with 8 additions and 6 deletions

View file

@ -7,7 +7,7 @@ Supports OAuth-based authentication with token refresh.
""" """
import logging import logging
from datetime import datetime, timezone from datetime import UTC, datetime
from typing import Any from typing import Any
import httpx import httpx
@ -275,9 +275,9 @@ class TeamsConnector:
if start_date or end_date: if start_date or end_date:
# Make sure comparison dates are timezone-aware (UTC) # Make sure comparison dates are timezone-aware (UTC)
if start_date and start_date.tzinfo is None: if start_date and start_date.tzinfo is None:
start_date = start_date.replace(tzinfo=timezone.utc) start_date = start_date.replace(tzinfo=UTC)
if end_date and end_date.tzinfo is None: if end_date and end_date.tzinfo is None:
end_date = end_date.replace(tzinfo=timezone.utc) end_date = end_date.replace(tzinfo=UTC)
filtered_messages = [] filtered_messages = []
for message in messages: for message in messages:

View file

@ -2,6 +2,8 @@
Microsoft Teams connector indexer. Microsoft Teams connector indexer.
""" """
from datetime import UTC
from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.ext.asyncio import AsyncSession
@ -165,16 +167,16 @@ async def index_teams_messages(
) )
# Convert date strings to datetime objects for filtering # Convert date strings to datetime objects for filtering
from datetime import datetime, timezone from datetime import datetime
start_datetime = None start_datetime = None
end_datetime = None end_datetime = None
if start_date_str: if start_date_str:
# Parse as naive datetime and make it timezone-aware (UTC) # Parse as naive datetime and make it timezone-aware (UTC)
start_datetime = datetime.strptime(start_date_str, "%Y-%m-%d").replace(tzinfo=timezone.utc) start_datetime = datetime.strptime(start_date_str, "%Y-%m-%d").replace(tzinfo=UTC)
if end_date_str: if end_date_str:
# Parse as naive datetime, set to end of day, and make it timezone-aware (UTC) # Parse as naive datetime, set to end of day, and make it timezone-aware (UTC)
end_datetime = datetime.strptime(end_date_str, "%Y-%m-%d").replace(hour=23, minute=59, second=59, tzinfo=timezone.utc) end_datetime = datetime.strptime(end_date_str, "%Y-%m-%d").replace(hour=23, minute=59, second=59, tzinfo=UTC)
# Process each team # Process each team
for team in teams: for team in teams: