Skip to content

Using TypeAlias to address IDE warnings #1425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions backend/app/api/deps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Generator
from typing import Annotated
from typing import Annotated, TypeAlias

import jwt
from fastapi import Depends, HTTPException, status
Expand All @@ -23,8 +23,8 @@ def get_db() -> Generator[Session, None, None]:
yield session


SessionDep = Annotated[Session, Depends(get_db)]
TokenDep = Annotated[str, Depends(reusable_oauth2)]
SessionDep: TypeAlias = Annotated[Session, Depends(get_db)]
TokenDep: TypeAlias = Annotated[str, Depends(reusable_oauth2)]


def get_current_user(session: SessionDep, token: TokenDep) -> User:
Expand All @@ -46,7 +46,7 @@ def get_current_user(session: SessionDep, token: TokenDep) -> User:
return user


CurrentUser = Annotated[User, Depends(get_current_user)]
CurrentUser: TypeAlias = Annotated[User, Depends(get_current_user)]


def get_current_active_superuser(current_user: CurrentUser) -> User:
Expand Down
Loading