From 6d59a97955756fb09d53f4ab8ea0311e852ac92f Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sat, 16 Oct 2021 18:24:55 -0700 Subject: [PATCH] feat(fastapi): include all models in aurweb.models package This gives developers the ability to import models without importing them directly from their module: from aurweb.models import Ban, AccountType This provides more conciseness: from aurweb import models def some_func(ban: models.Ban): pass def some_other_func(user: models.User): pass This more aligns with a Django-style of core model bases. NOTE: Docker images must be rebuilt with this change, as setup.cfg has changed. Old Docker images will cause flake8 violation reports. Signed-off-by: Kevin Morris --- aurweb/models/__init__.py | 32 +++++++++++++++++++++++++++++++- setup.cfg | 1 + 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/aurweb/models/__init__.py b/aurweb/models/__init__.py index ed0532c6..b430acd2 100644 --- a/aurweb/models/__init__.py +++ b/aurweb/models/__init__.py @@ -1 +1,31 @@ -# aurweb SQLAlchemy ORM model collection. +""" Collection of all aurweb SQLAlchemy declarative models. """ +from .accepted_term import AcceptedTerm +from .account_type import AccountType +from .api_rate_limit import ApiRateLimit +from .ban import Ban +from .dependency_type import DependencyType +from .group import Group +from .license import License +from .official_provider import OfficialProvider +from .package import Package +from .package_base import PackageBase +from .package_blacklist import PackageBlacklist +from .package_comaintainer import PackageComaintainer +from .package_comment import PackageComment +from .package_dependency import PackageDependency +from .package_group import PackageGroup +from .package_keyword import PackageKeyword +from .package_license import PackageLicense +from .package_notification import PackageNotification +from .package_relation import PackageRelation +from .package_request import PackageRequest +from .package_source import PackageSource +from .package_vote import PackageVote +from .relation_type import RelationType +from .request_type import RequestType +from .session import Session +from .ssh_pub_key import SSHPubKey +from .term import Term +from .tu_vote import TUVote +from .tu_voteinfo import TUVoteInfo +from .user import User diff --git a/setup.cfg b/setup.cfg index cec1bcf5..7c64a01f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,6 +32,7 @@ per-file-ignores = aurweb/routers/accounts.py:C901 test/test_ssh_pub_key.py:E501 aurweb/routers/packages.py:E741 + aurweb/models/__init__.py:F401 [isort] line_length = 127