Skip to content

Commit

Permalink
Small edits for linter
Browse files Browse the repository at this point in the history
  • Loading branch information
MRossa157 committed Dec 4, 2024
1 parent f30d974 commit 717f1b7
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
29 changes: 29 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,44 @@ ruff = "0.5.6"
[tool.ruff]
line-length = 80

exclude = [
"**/migrations/*",
"**/tests/*",
"**/__init__.py",
"**/__pycache__",
"**/conftest.py",
]

[tool.ruff.lint]
select = [
"ALL",
]

ignore = [
"D",
"Q000", # single quotes
"RUF001",
"RUF002",
"RUF003",
"CPY",
"FBT001",
"FBT002",
"FA100",
"FA102",
"FURB118",
"DTZ",
"FAST001",
"DOC",
"ANN003",
"PTH",
"B904",
"TRY300",
"TRY301",
]

[tool.ruff.lint.per-file-ignores]
"crud.py" = ["E501"]

[tool.ruff.format]
quote-style = "single"

Expand Down
2 changes: 1 addition & 1 deletion src/account/schemas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, List, Optional
from typing import List, Optional
from uuid import UUID

from pydantic import BaseModel
Expand Down
4 changes: 2 additions & 2 deletions src/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ async def refresh_access_token(
},
include_in_schema=False,
)
async def check_tokens( # noqa: RUF029
async def check_tokens(
request: Request,
response: Response,
token_payload: Annotated[
Expand All @@ -132,7 +132,7 @@ async def check_tokens( # noqa: RUF029
**API_RESPONSES['logout'],
},
)
async def logout( # noqa: RUF029
async def logout(
response: Response,
token_payload: Annotated[
Dict[str, Any],
Expand Down
2 changes: 1 addition & 1 deletion src/utils/add_words_to_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async def load_words_from_file(file_path: str) -> None:
password=settings.DATABASE_PASSWORD,
)

with open(file_path, 'r') as file:
with open(file_path) as file: # noqa: ASYNC230
words = [line.strip() for line in file if line.strip()]

async with pool.acquire() as connection, connection.transaction():
Expand Down
3 changes: 2 additions & 1 deletion src/utils/database.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
from contextlib import asynccontextmanager
from typing import Any, AsyncGenerator

from asyncpg import Pool, create_pool
from asyncpg.connection import Connection
Expand All @@ -23,7 +24,7 @@ def pool(self) -> Pool:
return self.__pool

@asynccontextmanager
async def lifespan(self):
async def lifespan(self) -> AsyncGenerator[None, Any, None]:
"""
Контекстный менеджер для управления временем жизни пула соединений.
Использовать только для инициализации и завершения работы приложения.
Expand Down

0 comments on commit 717f1b7

Please sign in to comment.