[flake8] fix all the issues and include config

This commit is contained in:
Piotr Domański 2024-05-17 15:23:35 +02:00
parent e44b6a1cb3
commit 2032f96247
15 changed files with 32 additions and 33 deletions

View file

@ -14,15 +14,15 @@ push:
docker push registry.domandoman.xyz/fooder/api docker push registry.domandoman.xyz/fooder/api
black: black:
black . black fooder
.PHONY: mypy .PHONY: mypy
mypy: mypy:
mypy . mypy fooder
.PHONY: flake .PHONY: flake
flake: flake:
flake8 . flake8 fooder
.PHONY: lint .PHONY: lint
lint: black mypy flake lint: black mypy flake

View file

@ -3,10 +3,9 @@ from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.ext.asyncio import async_sessionmaker from sqlalchemy.ext.asyncio import async_sessionmaker
from jose import JWTError, jwt from jose import JWTError, jwt
from fastapi.security import OAuth2PasswordBearer from fastapi.security import OAuth2PasswordBearer
from fastapi import Depends, FastAPI, HTTPException from fastapi import Depends, HTTPException
from fastapi_users.password import PasswordHelper from fastapi_users.password import PasswordHelper
from sqlalchemy.ext.asyncio import async_sessionmaker from typing import AsyncGenerator, Annotated
from typing import AsyncGenerator, Dict, Annotated, Optional
from datetime import datetime, timedelta from datetime import datetime, timedelta
from .settings import Settings from .settings import Settings
from .domain.user import User from .domain.user import User

View file

@ -2,7 +2,7 @@ from typing import Annotated, Any
from fastapi import Depends from fastapi import Depends
from sqlalchemy.ext.asyncio import async_sessionmaker from sqlalchemy.ext.asyncio import async_sessionmaker
from ..db import get_session from ..db import get_session
from ..auth import get_current_user, oauth2_scheme from ..auth import get_current_user
from ..domain.user import User from ..domain.user import User

View file

@ -3,7 +3,6 @@ from fastapi import HTTPException
from ..model.diary import Diary from ..model.diary import Diary
from ..domain.diary import Diary as DBDiary from ..domain.diary import Diary as DBDiary
from ..domain.meal import Meal as DBMeal
from .base import AuthorizedController from .base import AuthorizedController

View file

@ -1,4 +1,3 @@
from typing import AsyncIterator
from fastapi import HTTPException from fastapi import HTTPException
from ..model.entry import Entry, CreateEntryPayload, UpdateEntryPayload from ..model.entry import Entry, CreateEntryPayload, UpdateEntryPayload

View file

@ -1,11 +1,9 @@
from typing import AsyncIterator, Annotated from fastapi import HTTPException
from fastapi import HTTPException, Depends
from fastapi.security import OAuth2PasswordRequestForm from fastapi.security import OAuth2PasswordRequestForm
from ..model.token import Token, RefreshTokenPayload from ..model.token import Token, RefreshTokenPayload
from ..domain.user import User as DBUser from ..domain.user import User as DBUser
from .base import BaseController, AsyncSession from .base import BaseController
from ..auth import ( from ..auth import (
authenticate_user, authenticate_user,
create_access_token, create_access_token,

View file

@ -1,5 +1,3 @@
from typing import AsyncIterator
from fastapi import HTTPException from fastapi import HTTPException
from ..model.user import User, CreateUserPayload from ..model.user import User, CreateUserPayload

View file

@ -1,9 +1,9 @@
from .base import Base from .base import Base # noqa
from .diary import Diary from .diary import Diary # noqa
from .entry import Entry from .entry import Entry # noqa
from .meal import Meal from .meal import Meal # noqa
from .product import Product from .product import Product # noqa
from .user import User from .user import User # noqa
from .token import RefreshToken from .token import RefreshToken # noqa
from .preset import Preset from .preset import Preset # noqa
from .preset_entry import PresetEntry from .preset_entry import PresetEntry # noqa

View file

@ -1,5 +1,4 @@
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, declared_attr from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, declared_attr
from sqlalchemy import Integer
class Base(DeclarativeBase): class Base(DeclarativeBase):

View file

@ -1,4 +1,4 @@
from sqlalchemy.orm import relationship, Mapped, mapped_column, joinedload, relationship from sqlalchemy.orm import Mapped, mapped_column
from sqlalchemy import ForeignKey, Integer from sqlalchemy import ForeignKey, Integer
from sqlalchemy import select from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.ext.asyncio import AsyncSession

View file

@ -1,5 +1,4 @@
from pydantic import BaseModel from pydantic import BaseModel
from typing import Optional
from .product import Product from .product import Product

View file

@ -1 +1 @@
from .fixtures import * from .fixtures import * # noqa

View file

@ -1,5 +1,5 @@
from .client import * from .client import * # noqa
from .user import * from .user import * # noqa
from .product import * from .product import * # noqa
from .meal import * from .meal import * # noqa
from .entry import * from .entry import * # noqa

View file

@ -9,3 +9,5 @@ fastapi-users
pytest pytest
requests requests
black black
flake8
flake8-bugbear

6
setup.cfg Normal file
View file

@ -0,0 +1,6 @@
[flake8]
max-line-length = 80
extend-select = B950
extend-ignore = E203,E501,E701
extend-immutable-calls =
Depends