Switch to flake8

This commit is contained in:
stijndcl 2022-07-11 22:23:38 +02:00
parent 61128dda92
commit dd66087193
33 changed files with 138 additions and 31 deletions

View file

@ -6,8 +6,23 @@ from sqlalchemy.ext.asyncio import AsyncSession
from database.crud import users
from database.exceptions import currency as exceptions
from database.models import Bank, NightlyData
from database.utils.math.currency import rob_upgrade_price, interest_upgrade_price, capacity_upgrade_price
from database.utils.math.currency import (
capacity_upgrade_price,
interest_upgrade_price,
rob_upgrade_price,
)
__all__ = [
"add_dinks",
"claim_nightly",
"get_bank",
"get_nightly_data",
"invest",
"upgrade_capacity",
"upgrade_interest",
"upgrade_rob",
"NIGHTLY_AMOUNT",
]
NIGHTLY_AMOUNT = 420

View file

@ -7,6 +7,16 @@ from database.exceptions.constraints import DuplicateInsertException
from database.exceptions.not_found import NoResultFoundException
from database.models import CustomCommand, CustomCommandAlias
__all__ = [
"clean_name",
"create_alias",
"create_command",
"edit_command",
"get_command",
"get_command_by_alias",
"get_command_by_name",
]
def clean_name(name: str) -> str:
"""Convert a name to lowercase & remove spaces to allow easier matching"""

View file

@ -1,9 +1,11 @@
import datetime
from sqlalchemy import select, delete
from sqlalchemy import delete, select
from sqlalchemy.ext.asyncio import AsyncSession
from database.models import UforaCourse, UforaAnnouncement
from database.models import UforaAnnouncement, UforaCourse
__all__ = ["create_new_announcement", "get_courses_with_announcements", "remove_old_announcements"]
async def get_courses_with_announcements(session: AsyncSession) -> list[UforaCourse]:

View file

@ -3,7 +3,11 @@ from typing import Optional
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from database.models import User, Bank, NightlyData
from database.models import Bank, NightlyData, User
__all__ = [
"get_or_add",
]
async def get_or_add(session: AsyncSession, user_id: int) -> User:

View file

@ -1,7 +1,7 @@
from urllib.parse import quote_plus
from sqlalchemy.engine import URL
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
from sqlalchemy.orm import sessionmaker
import settings

View file

@ -1,2 +1,5 @@
__all__ = ["DuplicateInsertException"]
class DuplicateInsertException(Exception):
"""Exception raised when a value already exists"""

View file

@ -1,3 +1,6 @@
__all__ = ["DoubleNightly", "NotEnoughDinks"]
class DoubleNightly(Exception):
"""Exception raised when claiming nightlies multiple times per day"""

View file

@ -1,2 +1,5 @@
__all__ = ["NoResultFoundException"]
class NoResultFoundException(Exception):
"""Exception raised when nothing was found"""

View file

@ -2,9 +2,10 @@ import logging
from alembic import config, script
from alembic.runtime import migration
from database.engine import engine
__all__ = ["ensure_latest_migration"]
async def ensure_latest_migration():
"""Make sure we are currently on the latest revision, otherwise raise an exception"""

View file

@ -3,12 +3,25 @@ from __future__ import annotations
from datetime import datetime
from typing import Optional
from sqlalchemy import BigInteger, Column, Integer, Text, ForeignKey, Boolean, DateTime
from sqlalchemy import BigInteger, Boolean, Column, DateTime, ForeignKey, Integer, Text
from sqlalchemy.orm import declarative_base, relationship
Base = declarative_base()
__all__ = [
"Base",
"Bank",
"CustomCommand",
"CustomCommandAlias",
"NightlyData",
"UforaAnnouncement",
"UforaCourse",
"UforaCourseAlias",
"User",
]
class Bank(Base):
"""A user's currency information"""

View file

@ -1,5 +1,7 @@
import math
__all__ = ["capacity_upgrade_price", "interest_upgrade_price", "rob_upgrade_price"]
def interest_upgrade_price(level: int) -> int:
"""Calculate the price to upgrade your interest level"""