Skip to content

Commit 6f7e3f4

Browse files
Commit from GitHub Actions (Reformat code)
1 parent 08eeb6d commit 6f7e3f4

File tree

15 files changed

+49
-39
lines changed

15 files changed

+49
-39
lines changed

app/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
root_path=settings.APP_PATH,
1515
version=settings.APP_VERSION,
1616
contact={
17-
"name": "Fast Code",
18-
"url": "https://fast-code.pro/",
19-
"email": "[email protected]",
17+
'name': 'Fast Code',
18+
'url': 'https://fast-code.pro/',
19+
'email': '[email protected]',
2020
},
2121
)
2222

@@ -27,5 +27,5 @@
2727
async def exception_handler(request, exc: exps.BaseException):
2828
return JSONResponse(
2929
status_code=exc.status_code,
30-
content={"detail": exc.message},
30+
content={'detail': exc.message},
3131
)

app/api/deps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async def get_logic() -> _Logic:
1919

2020

2121
async def get_user(
22-
token: Annotated[str, Depends(APIKeyHeader(name="access-token"))],
22+
token: Annotated[str, Depends(APIKeyHeader(name='access-token'))],
2323
logic: Logic,
2424
) -> _User | None:
2525
return await logic.users.retrieve_by_token(token)

app/api/v1/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
"""
44

55
from pathlib import Path
6+
67
from fastapi import APIRouter
78

89
from . import users
910

10-
FOLDER_NAME = f"{Path(__file__).parent.name}"
11+
FOLDER_NAME = f'{Path(__file__).parent.name}'
1112

12-
router = APIRouter(prefix=f"/{FOLDER_NAME}", tags=[FOLDER_NAME])
13+
router = APIRouter(prefix=f'/{FOLDER_NAME}', tags=[FOLDER_NAME])
1314
router.include_router(users.router)
1415

15-
__all__ = ["router"]
16+
__all__ = ['router']

app/api/v1/users/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
from . import auth, create, retrieve
88

9-
router = APIRouter(prefix="/users", tags=["users"])
9+
router = APIRouter(prefix='/users', tags=['users'])
1010
router.include_router(auth.router)
1111
router.include_router(create.router)
1212
router.include_router(retrieve.router)
1313

14-
__all__ = ["router"]
14+
__all__ = ['router']

app/api/v1/users/auth/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from . import token
44

5-
router = APIRouter(prefix="/auth", tags=["auth"])
5+
router = APIRouter(prefix='/auth', tags=['auth'])
66
router.include_router(token.router)
77

8-
__all__ = ["router"]
8+
__all__ = ['router']

app/api/v1/users/auth/token.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
from app.models.token import AccessToken
55
from app.models.user import UserCreate
66

7-
router = APIRouter(prefix="/token")
7+
router = APIRouter(prefix='/token')
88

99

10-
@router.post("/", response_model=AccessToken)
10+
@router.post('/', response_model=AccessToken)
1111
async def token(data: UserCreate, logic: deps.Logic):
1212
"""
1313
Retrieve new access token
1414
"""
1515
return await logic.users.auth.generate_token(**data.model_dump())
1616

1717

18-
__all__ = ["router"]
18+
__all__ = ['router']

app/api/v1/users/create.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
from app.api import deps
44
from app.models.user import UserCreate, UserRead
55

6-
router = APIRouter(prefix="/create")
6+
router = APIRouter(prefix='/create')
77

88

9-
@router.post("/", response_model=UserRead)
9+
@router.post('/', response_model=UserRead)
1010
async def create(data: UserCreate, logic: deps.Logic):
1111
"""
1212
Create user
1313
"""
1414
return await logic.users.create(**data.model_dump())
1515

1616

17-
__all__ = ["router"]
17+
__all__ = ['router']

app/api/v1/users/retrieve.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
router = APIRouter()
1111

1212

13-
@router.get("/", response_model=UserRead)
13+
@router.get('/', response_model=UserRead)
1414
async def retrieve(user: deps.User):
1515
"""
1616
Retrieve user
1717
"""
1818
return user
1919

2020

21-
__all__ = ["router"]
21+
__all__ = ['router']

app/core/db.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
from sqlalchemy.ext.asyncio import AsyncEngine, async_sessionmaker, create_async_engine
1+
from sqlalchemy.ext.asyncio import (AsyncEngine, async_sessionmaker,
2+
create_async_engine)
23
from sqlmodel.ext.asyncio.session import AsyncSession
4+
35
from app import repositories as repos
46
from app.core.settings import settings
57

@@ -13,9 +15,11 @@ def __new__(cls, *args, **kwargs):
1315
return cls._instance
1416

1517
def __init__(
16-
self, engine: AsyncEngine | None = None, session: AsyncSession | None = None
18+
self,
19+
engine: AsyncEngine | None = None,
20+
session: AsyncSession | None = None,
1721
) -> None:
18-
if not hasattr(self, "initialized"):
22+
if not hasattr(self, 'initialized'):
1923
self.engine = engine
2024
self.session = session
2125
self.initialized = True

app/core/exps.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,25 @@ def __init__(self, message: str, status_code: int = 500):
1313
# Users
1414
class UserExistsException(BaseException):
1515
def __init__(self):
16-
super().__init__("User is already taken.", status_code=409)
16+
super().__init__('User is already taken.', status_code=409)
1717

1818

1919
class UserNotFoundException(BaseException):
2020
def __init__(self):
21-
super().__init__("User not found.", status_code=404)
21+
super().__init__('User not found.', status_code=404)
2222

2323

2424
class UserIsCorrectException(BaseException):
2525
def __init__(self):
26-
super().__init__("User is correct.", status_code=401)
26+
super().__init__('User is correct.', status_code=401)
2727

2828

2929
# Tokens
3030
class TokenInvalidException(BaseException):
3131
def __init__(self):
32-
super().__init__("Invalid token.", status_code=401)
32+
super().__init__('Invalid token.', status_code=401)
3333

3434

3535
class TokenExpiredException(BaseException):
3636
def __init__(self):
37-
super().__init__("Token expired.", status_code=401)
37+
super().__init__('Token expired.', status_code=401)

0 commit comments

Comments
 (0)