Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
style: Fixes typing
Browse files Browse the repository at this point in the history
  • Loading branch information
frgfm committed Oct 31, 2023
1 parent 694b6f8 commit cbfec5f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/app/api/api_v1/endpoints/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# All rights reserved.
# Copying and/or distributing is strictly prohibited without the express permission of its copyright owner.

from typing import List
from typing import List, cast

from fastapi import APIRouter, Depends, Path, Security, status

from app.api.dependencies import get_current_user, get_guideline_crud, get_repo_crud
from app.crud import GuidelineCRUD, RepositoryCRUD
from app.models import UserScope
from app.models import Guideline, UserScope
from app.schemas.compute import ComplianceResult, Snippet
from app.services.openai import ExecutionMode, openai_client
from app.services.telemetry import telemetry_client
Expand Down Expand Up @@ -42,7 +42,7 @@ async def check_code_against_guideline(
user=Security(get_current_user, scopes=[UserScope.ADMIN, UserScope.USER]),
) -> ComplianceResult:
# Check repo
guideline = await guidelines.get(guideline_id, strict=True)
guideline = cast(Guideline, await guidelines.get(guideline_id, strict=True))
telemetry_client.capture(
user.id, event="compute-check", properties={"repo_id": guideline.repo_id, "guideline_id": guideline_id}
)
Expand Down
4 changes: 1 addition & 3 deletions src/app/services/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,7 @@ def analyze_mono(self, code: str, guideline: Guideline, timeout: int = 10) -> Co
# Return with pydantic validation
return ComplianceResult(guideline_id=guideline.id, **res)

def _analyze(
self, prompt: str, payload: Dict[str, Any], schema: ObjectSchema, timeout: int = 10
) -> ComplianceResult:
def _analyze(self, prompt: str, payload: Dict[str, Any], schema: ObjectSchema, timeout: int = 10) -> Dict[str, Any]:
# Prepare the request
_payload = ChatCompletion(
model=self.model,
Expand Down

0 comments on commit cbfec5f

Please sign in to comment.