Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
jonra1993 committed Feb 24, 2024
1 parent 22da46a commit 3622202
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion backend/app/app/api/v1/endpoints/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ async def get_new_access_token(
status_code=status.HTTP_403_FORBIDDEN,
detail="Error when decoding the token. Please check your request.",
)
except MissingRequiredClaimError as e:
except MissingRequiredClaimError:
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail="There is no required field in your token. Please contact the administrator.",
Expand Down
2 changes: 1 addition & 1 deletion backend/app/app/crud/base_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async def get_multi_paginated(
db_session = db_session or self.db.session
if query is None:
query = select(self.model)

output = await paginate(db_session, query, params)
return output

Expand Down
4 changes: 2 additions & 2 deletions backend/app/app/db/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
str(settings.ASYNC_CELERY_BEAT_DATABASE_URI),
# echo=True,
future=True,
#pool_size=POOL_SIZE,
#max_overflow=64,
# pool_size=POOL_SIZE,
# max_overflow=64,
)

SessionLocalCelery = sessionmaker(
Expand Down
3 changes: 1 addition & 2 deletions backend/app/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from fastapi_cache.backends.redis import RedisBackend
from fastapi_limiter import FastAPILimiter
from fastapi_limiter.depends import WebSocketRateLimiter
from fastapi_pagination import add_pagination
from jwt import DecodeError, ExpiredSignatureError, MissingRequiredClaimError
from langchain.chat_models import ChatOpenAI
from langchain.schema import HumanMessage
Expand Down Expand Up @@ -237,4 +236,4 @@ async def websocket_endpoint(websocket: WebSocket, user_id: UUID):


# Add Routers
app.include_router(api_router_v1, prefix=settings.API_V1_STR)
app.include_router(api_router_v1, prefix=settings.API_V1_STR)
1 change: 1 addition & 0 deletions backend/app/app/models/base_uuid_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from sqlalchemy.orm import declared_attr
from datetime import datetime


# id: implements proposal uuid7 draft4
class SQLModel(_SQLModel):
@declared_attr # type: ignore
Expand Down
1 change: 0 additions & 1 deletion backend/app/app/models/team_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from uuid import UUID



class TeamBase(SQLModel):
name: str = Field(index=True)
headquarters: str
Expand Down
4 changes: 3 additions & 1 deletion backend/app/app/models/user_follow_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ class UserFollowBase(SQLModel):


class UserFollow(BaseUUIDModel, UserFollowBase, table=True):
is_mutual: bool | None = Field(default=None, sa_column=Column(Boolean(), server_default="0"))
is_mutual: bool | None = Field(
default=None, sa_column=Column(Boolean(), server_default="0")
)
2 changes: 1 addition & 1 deletion backend/app/app/schemas/hero_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class IHeroCreate(HeroBase):
@field_validator('age')
@field_validator("age")
def check_age(cls, value):
if value < 0:
raise ValueError("Invalid age")
Expand Down
6 changes: 3 additions & 3 deletions backend/app/app/schemas/image_media_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from app.models.image_media_model import ImageMedia, ImageMediaBase
from app.models.media_model import Media
from pydantic import model_validator, root_validator
from pydantic import model_validator
from .media_schema import IMediaRead
from app.utils.partial import optional

Expand All @@ -20,11 +20,11 @@ class IImageMediaRead(ImageMediaBase):
media: IMediaRead | None


#Todo make it compatible with pydantic v2
# Todo make it compatible with pydantic v2
class IImageMediaReadCombined(ImageMediaBase):
link: str | None

@model_validator(mode='before')
@model_validator(mode="before")
def combine_attributes(cls, values):
link_fields = {"link": values.get("link", None)}
if "media" in values:
Expand Down
1 change: 0 additions & 1 deletion backend/app/app/schemas/team_schema.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from typing import Any
from app.models.hero_model import HeroBase
from app.models.team_model import TeamBase
from .user_schema import IUserBasicInfo
Expand Down
2 changes: 1 addition & 1 deletion backend/app/app/schemas/user_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pydantic import BaseModel
from uuid import UUID
from enum import Enum
from .image_media_schema import IImageMediaReadCombined, IImageMediaRead
from .image_media_schema import IImageMediaRead
from .role_schema import IRoleRead


Expand Down
1 change: 0 additions & 1 deletion backend/app/app/utils/partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# https://github.com/pydantic/pydantic/pull/3179
# https://github.com/pydantic/pydantic/issues/1673

from pydantic import BaseModel
from copy import deepcopy
from typing import Any, Callable, Optional, Type, TypeVar
from pydantic import BaseModel, create_model
Expand Down

0 comments on commit 3622202

Please sign in to comment.