Skip to content

Commit fa14ae8

Browse files
committed
apply ruff linter
1 parent 879b8e2 commit fa14ae8

File tree

9 files changed

+23
-25
lines changed

9 files changed

+23
-25
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ repos:
55
hooks:
66
# Run the linter.
77
- id: ruff
8+
types_or: [python, pyi]
89
# Run the formatter.
910
- id: ruff-format

ruff.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ exclude = [
99
]
1010

1111
[lint]
12-
select = ["E", "F"]
12+
select = ["E", "F", "I"]
1313
ignore = [
1414
"E501",
15-
"B008",
1615
"C901",
1716
"F401",
18-
"W191",
1917
]
2018

2119
[format]

src/api/app.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from fastapi.responses import PlainTextResponse
88
from mangum import Mangum
99

10-
from api.routers import model, chat, embeddings
11-
from api.setting import API_ROUTE_PREFIX, TITLE, DESCRIPTION, SUMMARY, VERSION
10+
from api.routers import chat, embeddings, model
11+
from api.setting import API_ROUTE_PREFIX, DESCRIPTION, SUMMARY, TITLE, VERSION
1212

1313
config = {
1414
"title": TITLE,
@@ -31,6 +31,7 @@
3131
allow_headers=["*"],
3232
)
3333

34+
3435
app.include_router(model.router, prefix=API_ROUTE_PREFIX)
3536
app.include_router(chat.router, prefix=API_ROUTE_PREFIX)
3637
app.include_router(embeddings.router, prefix=API_ROUTE_PREFIX)

src/api/models/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
from api.schema import (
77
# Chat
8-
ChatResponse,
98
ChatRequest,
9+
ChatResponse,
1010
ChatStreamResponse,
1111
# Embeddings
1212
EmbeddingsRequest,

src/api/models/bedrock.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,27 @@
1515

1616
from api.models.base import BaseChatModel, BaseEmbeddingsModel
1717
from api.schema import (
18-
# Chat
19-
ChatResponse,
18+
AssistantMessage,
2019
ChatRequest,
21-
Choice,
20+
ChatResponse,
2221
ChatResponseMessage,
23-
Usage,
2422
ChatStreamResponse,
25-
ImageContent,
26-
TextContent,
27-
ToolCall,
23+
Choice,
2824
ChoiceDelta,
29-
UserMessage,
30-
AssistantMessage,
31-
ToolMessage,
32-
Function,
33-
ResponseFunction,
34-
# Embeddings
25+
Embedding,
3526
EmbeddingsRequest,
3627
EmbeddingsResponse,
3728
EmbeddingsUsage,
38-
Embedding,
29+
Function,
30+
ImageContent,
31+
ResponseFunction,
32+
TextContent,
33+
ToolCall,
34+
ToolMessage,
35+
Usage,
36+
UserMessage,
3937
)
40-
from api.setting import DEBUG, AWS_REGION, ENABLE_CROSS_REGION_INFERENCE, DEFAULT_MODEL
38+
from api.setting import AWS_REGION, DEBUG, DEFAULT_MODEL, ENABLE_CROSS_REGION_INFERENCE
4139

4240
logger = logging.getLogger(__name__)
4341

src/api/routers/chat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Annotated
22

3-
from fastapi import APIRouter, Depends, Body
3+
from fastapi import APIRouter, Body, Depends
44
from fastapi.responses import StreamingResponse
55

66
from api.auth import api_key_auth

src/api/routers/embeddings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Annotated
22

3-
from fastapi import APIRouter, Depends, Body
3+
from fastapi import APIRouter, Body, Depends
44

55
from api.auth import api_key_auth
66
from api.models.bedrock import get_embeddings_model

src/api/routers/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from api.auth import api_key_auth
66
from api.models.bedrock import BedrockModel
7-
from api.schema import Models, Model
7+
from api.schema import Model, Models
88

99
router = APIRouter(
1010
prefix="/models",

src/api/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import time
2-
from typing import Literal, Iterable
2+
from typing import Iterable, Literal
33

44
from pydantic import BaseModel, Field
55

0 commit comments

Comments
 (0)