Skip to content

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Abramov committed Jul 1, 2024
1 parent c0bd619 commit 560d0ed
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 32 deletions.
2 changes: 1 addition & 1 deletion app/api/endpoints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from .course import router as course_router # noqa
from .examination import router as examination_router # noqa
from .group import router as group_router # noqa
from .locale import router as locale_router # noqa
from .notification import router as notification_router # noqa
from .profile import router as profile_router # noqa
from .tariff import router as tariff_router # noqa
from .task import router as task_router # noqa
from .user import router as user_router # noqa
from .locale import router as locale_router # noqa
6 changes: 2 additions & 4 deletions app/api/endpoints/locale.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@

from app.core.db import get_async_session
from app.core.user import current_superuser
from app.crud import locale_crud
from app.schemas.locale import (
LocaleCreate, LocaleReadByID,
LocaleRead, LocaleCreated
LocaleCreate, LocaleCreated, LocaleRead, LocaleReadByID,
)
from app.crud import locale_crud


router = APIRouter()

Expand Down
2 changes: 1 addition & 1 deletion app/api/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from app.api.endpoints import (
achievement_router, course_router, examination_router, group_router,
profile_router, tariff_router, task_router, user_router, locale_router
locale_router, profile_router, tariff_router, task_router, user_router,
)

main_router = APIRouter()
Expand Down
8 changes: 4 additions & 4 deletions app/api/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ async def check_obj_exists(
if obj is None:
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND,
detail=f"Объект {crud.model.__tablename__} "
f"с id {obj_id} не найден.",
detail=f'Объект {crud.model.__tablename__} '
f'с id {obj_id} не найден.',
)
return obj

Expand All @@ -28,6 +28,6 @@ async def check_name_duplicate(
if obj is not None:
raise HTTPException(
status_code=HTTPStatus.BAD_REQUEST,
detail=f"Объект {crud.model.__tablename__}"
f" с таким именем уже существует!",
detail=f'Объект {crud.model.__tablename__}'
f' с таким именем уже существует!',
)
6 changes: 3 additions & 3 deletions app/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@


class Role(str, Enum):
user = "user"
manager = "manager"
admin = "admin"
user = 'user'
manager = 'manager'
admin = 'admin'
2 changes: 1 addition & 1 deletion app/crud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from .course import course_crud # noqa
from .examination import examination_crud # noqa
from .group import group_crud # noqa
from .locale import locale_crud # noqa
from .notification import notification_crud # noqa
from .profile import profile_crud # noqa
from .tariff import tariff_crud # noqa
from .task import task_crud # noqa
from .user import user_crud # noqa
from .locale import locale_crud # noqa
2 changes: 1 addition & 1 deletion app/crud/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def get(
if obj is None:
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND,
detail=f"Объект {self.model.__tablename__} не найден.",
detail=f'Объект {self.model.__tablename__} не найден.',
)
return obj

Expand Down
7 changes: 4 additions & 3 deletions app/crud/locale.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from sqlalchemy import select
from sqlalchemy.orm import selectinload
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import selectinload

from app.crud.base import CRUDBase
from app.models import (
Locale, Common, Header, Auth, Contacts, Help, Main, Restore, Subscription,
Tasks, Errors
Auth, Common, Contacts, Errors, Header, Help, Locale, Main, Restore,
Subscription, Tasks,
)
from app.schemas.locale import LocaleCreate

Expand Down
9 changes: 4 additions & 5 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from fastapi import applications
from fastapi import FastAPI, applications
from fastapi.openapi.docs import get_swagger_ui_html
from fastapi import FastAPI
from sqladmin import Admin

from app.admin.authentication import AdminAuth
Expand All @@ -15,11 +14,11 @@ def swagger_monkey_patch(*args, **kwargs):
return get_swagger_ui_html(
*args, **kwargs,
swagger_js_url=(
"https://cdn.staticfile.net/swagger-ui/5.1.0/"
"swagger-ui-bundle.min.js"
'https://cdn.staticfile.net/swagger-ui/5.1.0/'
'swagger-ui-bundle.min.js'
),
swagger_css_url=(
"https://cdn.staticfile.net/swagger-ui/5.1.0/swagger-ui.min.css"
'https://cdn.staticfile.net/swagger-ui/5.1.0/swagger-ui.min.css'
))


Expand Down
8 changes: 4 additions & 4 deletions app/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
from .course import Course # noqa
from .examination import Examination # noqa
from .group import Group # noqa
from .locale import ( # noqa
Auth, Common, Contacts, Errors, Header, Help, Locale, Main, Restore,
Subscription, Tasks,
)
from .notification import Notification # noqa
from .profile import Profile # noqa
from .tariff import Tariff # noqa
from .task import Task # noqa
from .user import User # noqa
from .locale import (
Locale, Common, Header, Help, Auth, Subscription, Contacts, Main,
Restore, Tasks, Errors
) # noqa
5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import pytest_asyncio
from fastapi import FastAPI
from sqlalchemy.ext.asyncio import (AsyncSession, async_sessionmaker,
create_async_engine)
from sqlalchemy.ext.asyncio import (
AsyncSession, async_sessionmaker, create_async_engine,
)
from sqlalchemy.pool import NullPool

from app.core.config import settings
Expand Down
3 changes: 1 addition & 2 deletions tests/test_locale.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from fastapi import status, Response
from fastapi import Response, status
from fastapi.testclient import TestClient

from app.models import Locale

from .utils import get_obj_count


CREATE_SCHEME = {
'language': 'en',
'common': {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tariff.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async def test_get_tariff_by_nonexist_id(
stmt = select(Tariff).where(Tariff.id == TEST_TARIFF_COUNT + 1)
tariff = await db_session.execute(stmt)
tariff = tariff.scalar()
response = await new_client.get(f"/tariffs/{TEST_TARIFF_COUNT+1}")
response = await new_client.get(f'/tariffs/{TEST_TARIFF_COUNT+1}')
assert response.status_code == status.HTTP_404_NOT_FOUND


Expand Down

0 comments on commit 560d0ed

Please sign in to comment.