Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit b74074e

Browse files
author
Luke Hinds
committed
Fix Deprecation Warnings
Fix for the following warnings: - The 'app' shortcut is now deprecated. - datetime.datetime.utcnow() is deprecated Closes: #366
1 parent 74d446a commit b74074e

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

src/codegate/ca/codegate_ca.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def _load_existing_certificates(self) -> None:
173173
self._cert_cache[common_name] = CachedCertificate(
174174
cert_path=cert_path,
175175
key_path=key_path,
176-
creation_time=datetime.utcnow(),
176+
creation_time=datetime.now(datetime.UTC),
177177
)
178178
else:
179179
logger.debug(f"Skipping expired certificate for {common_name}")

src/codegate/pipeline/codegate_context_retriever/codegate.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ async def process(
6868

6969
# Vector search to find bad packages
7070
storage_engine = StorageEngine()
71-
searched_objects = await storage_engine.search(
72-
query=user_messages, distance=0.8, limit=100
73-
)
71+
searched_objects = await storage_engine.search(query=user_messages, distance=0.8, limit=100)
7472

7573
logger.info(
7674
f"Found {len(searched_objects)} matches in the database",

src/codegate/utils/package_extractor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class PackageExtractor:
6969
(use_wildcard) @import_name)
7070
(use_declaration
7171
(use_as_clause (scoped_identifier) @import_name))
72-
"""
72+
""",
7373
}
7474

7575
@staticmethod

tests/test_server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from pathlib import Path
55
from unittest.mock import AsyncMock, MagicMock, patch
66

7+
import httpx
78
import pytest
89
from click.testing import CliRunner
910
from fastapi.middleware.cors import CORSMiddleware
@@ -143,7 +144,7 @@ def test_system_routes(mock_pipeline_factory) -> None:
143144
async def test_async_health_check(mock_pipeline_factory) -> None:
144145
"""Test the health check endpoint with async client."""
145146
app = init_app(mock_pipeline_factory)
146-
async with AsyncClient(app=app, base_url="http://test") as ac:
147+
async with AsyncClient(transport=httpx.ASGITransport(app=app), base_url="http://test") as ac:
147148
response = await ac.get("/health")
148149
assert response.status_code == 200
149150
assert response.json() == {"status": "healthy"}

0 commit comments

Comments
 (0)