🎨 Format files with pre-commit and Ruff (#611)

This commit is contained in:
Sebastián Ramírez
2024-02-25 19:39:33 +01:00
committed by GitHub
parent 2802a4df9e
commit 0cc802eec8
35 changed files with 156 additions and 163 deletions

View File

@@ -1,5 +1,3 @@
from typing import Optional
from sqlalchemy.orm import Session
from app import crud, models
@@ -8,7 +6,7 @@ from app.tests.utils.user import create_random_user
from app.tests.utils.utils import random_lower_string
def create_random_item(db: Session, *, owner_id: Optional[int] = None) -> models.Item:
def create_random_item(db: Session, *, owner_id: int | None = None) -> models.Item:
if owner_id is None:
user = create_random_user(db)
owner_id = user.id

View File

@@ -1,5 +1,3 @@
from typing import Dict
from fastapi.testclient import TestClient
from sqlalchemy.orm import Session
@@ -12,7 +10,7 @@ from app.tests.utils.utils import random_email, random_lower_string
def user_authentication_headers(
*, client: TestClient, email: str, password: str
) -> Dict[str, str]:
) -> dict[str, str]:
data = {"username": email, "password": password}
r = client.post(f"{settings.API_V1_STR}/login/access-token", data=data)
@@ -32,7 +30,7 @@ def create_random_user(db: Session) -> User:
def authentication_token_from_email(
*, client: TestClient, email: str, db: Session
) -> Dict[str, str]:
) -> dict[str, str]:
"""
Return a valid token for the user with given email.

View File

@@ -1,6 +1,5 @@
import random
import string
from typing import Dict
from fastapi.testclient import TestClient
@@ -15,7 +14,7 @@ def random_email() -> str:
return f"{random_lower_string()}@{random_lower_string()}.com"
def get_superuser_token_headers(client: TestClient) -> Dict[str, str]:
def get_superuser_token_headers(client: TestClient) -> dict[str, str]:
login_data = {
"username": settings.FIRST_SUPERUSER,
"password": settings.FIRST_SUPERUSER_PASSWORD,