diff --git a/brewman/brewman/core/security.py b/brewman/brewman/core/security.py index 22609fd7..6ecd5079 100644 --- a/brewman/brewman/core/security.py +++ b/brewman/brewman/core/security.py @@ -118,7 +118,7 @@ async def get_current_user( async def get_current_active_user( - current_user: UserToken = Security(get_current_user, scopes=["authenticated"]) + current_user: UserToken = Security(get_current_user, scopes=["authenticated"]), ) -> UserToken: if current_user.locked_out: raise HTTPException(status_code=400, detail="Inactive user") diff --git a/brewman/brewman/models/role.py b/brewman/brewman/models/role.py index c5c1075e..050f457e 100644 --- a/brewman/brewman/models/role.py +++ b/brewman/brewman/models/role.py @@ -21,5 +21,7 @@ class Role: name: Mapped[str] = mapped_column(Unicode, unique=True) permissions: Mapped[list["Permission"]] = relationship( - "Permission", secondary=RolePermission.__table__, back_populates="roles" # type: ignore[attr-defined] + "Permission", + secondary=RolePermission.__table__, + back_populates="roles", # type: ignore[attr-defined] ) diff --git a/brewman/brewman/routers/batch_integrity.py b/brewman/brewman/routers/batch_integrity.py index 802588d9..1a445679 100644 --- a/brewman/brewman/routers/batch_integrity.py +++ b/brewman/brewman/routers/batch_integrity.py @@ -26,7 +26,7 @@ router = APIRouter() @router.post("", response_model=list[schemas.BatchIntegrity]) def post_check_batch_integrity( - user: UserToken = Security(get_user, scopes=["product-ledger"]) + user: UserToken = Security(get_user, scopes=["product-ledger"]), ) -> list[schemas.BatchIntegrity]: with SessionFuture() as db: info = negative_batches(db) + batch_dates(db) diff --git a/brewman/brewman/routers/db_integrity.py b/brewman/brewman/routers/db_integrity.py index e32cba4f..fcb5449e 100644 --- a/brewman/brewman/routers/db_integrity.py +++ b/brewman/brewman/routers/db_integrity.py @@ -33,7 +33,8 @@ def get_duplicate_attendances(db: Session) -> int: ) query: int = db.execute( select(func.count(Attendance.id)).where( - ~Attendance.id.in_(sub_query), Attendance.is_valid == True # noqa: E712 + ~Attendance.id.in_(sub_query), + Attendance.is_valid == True, # noqa: E712 ) ).scalar_one() return query diff --git a/brewman/brewman/routers/login.py b/brewman/brewman/routers/login.py index 552ee2c1..077acc40 100644 --- a/brewman/brewman/routers/login.py +++ b/brewman/brewman/routers/login.py @@ -72,7 +72,8 @@ async def login_for_access_token( ) db.execute( delete(Client).where( - Client.creation_date < datetime.utcnow() - timedelta(days=3), Client.enabled == False # noqa: E712 + Client.creation_date < datetime.utcnow() - timedelta(days=3), + Client.enabled == False, # noqa: E712 ) ) db.commit() @@ -90,9 +91,7 @@ async def login_for_access_token( data={ "sub": user.name, "scopes": ["authenticated"] - + list( - set([p.name.replace(" ", "-").lower() for r in user.roles for p in r.permissions]) - ), # noqa: W503 + + list(set([p.name.replace(" ", "-").lower() for r in user.roles for p in r.permissions])), # noqa: W503 "userId": str(user.id), "lockedOut": user.locked_out, "ver": __version__.__version__, diff --git a/brewman/brewman/routers/rebase.py b/brewman/brewman/routers/rebase.py index e38a119b..cd18d1cc 100644 --- a/brewman/brewman/routers/rebase.py +++ b/brewman/brewman/routers/rebase.py @@ -59,7 +59,8 @@ def rebase( def save_starred(date_: date, db: Session) -> list[uuid.UUID]: accounts = [ - i.id for i in db.execute(select(AccountBase.id).where(AccountBase.is_starred == True)).all() # noqa: E712 + i.id + for i in db.execute(select(AccountBase.id).where(AccountBase.is_starred == True)).all() # noqa: E712 ] vouchers: list[uuid.UUID] = [] query = ( diff --git a/brewman/brewman/routers/reports/non_contract_purchase.py b/brewman/brewman/routers/reports/non_contract_purchase.py index e134c881..c1c93869 100644 --- a/brewman/brewman/routers/reports/non_contract_purchase.py +++ b/brewman/brewman/routers/reports/non_contract_purchase.py @@ -21,7 +21,7 @@ router = APIRouter() @router.post("", response_model=list[schemas.NonContractPurchase]) def non_contract_purchases( - user: UserToken = Security(get_user, scopes=["product-ledger"]) + user: UserToken = Security(get_user, scopes=["product-ledger"]), ) -> list[schemas.NonContractPurchase]: with SessionFuture() as db: return report(db) diff --git a/lint.sh b/lint.sh index aae756d0..e77c1919 100755 --- a/lint.sh +++ b/lint.sh @@ -8,11 +8,9 @@ cd "$parent_path/overlord" || exit npx prettier --write src/app npx ng lint --fix cd "$parent_path/brewman" || exit -isort brewman -black brewman -flake8 brewman -# ruff check . # Lint all files in the current directory (and any subdirectories) -# bandit --recursive brewman -# bandit --recursive . -# safety check \ No newline at end of file +ruff format brewman/ +ruff check . # Lint all files in the current directory (and any subdirectories) +bandit --recursive brewman +bandit --recursive . +safety check \ No newline at end of file