Verified Commit adf5b2d7 authored by Leonidas Spyropoulos's avatar Leonidas Spyropoulos
Browse files

chore: rename logging.py and redis.py to avoid circular imports


Signed-off-by: Leonidas Spyropoulos's avatarLeonidas Spyropoulos <artafinde@archlinux.org>
parent 4ddd1dec
Pipeline #18665 passed with stages
in 3 minutes and 4 seconds
......@@ -24,20 +24,19 @@ from starlette.middleware.sessions import SessionMiddleware
import aurweb.captcha # noqa: F401
import aurweb.config
import aurweb.filters # noqa: F401
import aurweb.logging
import aurweb.pkgbase.util as pkgbaseutil
from aurweb import logging, prometheus, util
from aurweb import aur_logging, prometheus, util
from aurweb.aur_redis import redis_connection
from aurweb.auth import BasicAuthBackend
from aurweb.db import get_engine, query
from aurweb.models import AcceptedTerm, Term
from aurweb.packages.util import get_pkg_or_base
from aurweb.prometheus import instrumentator
from aurweb.redis import redis_connection
from aurweb.routers import APP_ROUTES
from aurweb.templates import make_context, render_template
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
# Setup the FastAPI app.
app = FastAPI()
......
......@@ -4,9 +4,9 @@ from redis import ConnectionPool, Redis
import aurweb.config
from aurweb import logging
from aurweb import aur_logging
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
pool = None
......
......@@ -3,8 +3,8 @@ import argparse
import alembic.command
import alembic.config
import aurweb.aur_logging
import aurweb.db
import aurweb.logging
import aurweb.schema
......
......@@ -13,12 +13,12 @@ import aurweb.config
import aurweb.models.account_type
import aurweb.schema
from aurweb import db, logging, schema, time, util
from aurweb import aur_logging, db, schema, time, util
from aurweb.models.account_type import AccountType as _AccountType
from aurweb.models.ban import is_banned
from aurweb.models.declarative import Base
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
SALT_ROUNDS_DEFAULT = 12
......
......@@ -8,11 +8,11 @@ from fastapi import HTTPException
from sqlalchemy import orm
from aurweb import config, db, models
from aurweb.aur_redis import redis_connection
from aurweb.models import Package
from aurweb.models.official_provider import OFFICIAL_BASE, OfficialProvider
from aurweb.models.package_dependency import PackageDependency
from aurweb.models.package_relation import PackageRelation
from aurweb.redis import redis_connection
from aurweb.templates import register_filter
Providers = List[Union[PackageRelation, OfficialProvider]]
......
......@@ -2,7 +2,7 @@ from typing import List
from fastapi import Request
from aurweb import db, logging, util
from aurweb import aur_logging, db, util
from aurweb.auth import creds
from aurweb.models import PackageBase
from aurweb.models.package_comaintainer import PackageComaintainer
......@@ -12,7 +12,7 @@ from aurweb.packages.requests import handle_request, update_closure_comment
from aurweb.pkgbase import util as pkgbaseutil
from aurweb.scripts import notify, popupdate
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
def pkgbase_notify_instance(request: Request, pkgbase: PackageBase) -> None:
......
......@@ -5,9 +5,9 @@ from prometheus_fastapi_instrumentator import Instrumentator
from prometheus_fastapi_instrumentator.metrics import Info
from starlette.routing import Match, Route
from aurweb import logging
from aurweb import aur_logging
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
_instrumentator = Instrumentator()
......
from fastapi import Request
from redis.client import Pipeline
from aurweb import config, db, logging, time
from aurweb import aur_logging, config, db, time
from aurweb.aur_redis import redis_connection
from aurweb.models import ApiRateLimit
from aurweb.redis import redis_connection
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
def _update_ratelimit_redis(request: Request, pipeline: Pipeline):
......
......@@ -10,7 +10,7 @@ from sqlalchemy import and_, or_
import aurweb.config
from aurweb import cookies, db, l10n, logging, models, util
from aurweb import aur_logging, cookies, db, l10n, models, util
from aurweb.auth import account_type_required, requires_auth, requires_guest
from aurweb.captcha import get_captcha_salts
from aurweb.exceptions import ValidationError, handle_form_exceptions
......@@ -24,7 +24,7 @@ from aurweb.users import update, validate
from aurweb.users.util import get_user_by_name
router = APIRouter()
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
@router.get("/passreset", response_class=HTMLResponse)
......
......@@ -13,7 +13,7 @@ from sqlalchemy import and_, case, or_
import aurweb.config
import aurweb.models.package_request
from aurweb import cookies, db, logging, models, time, util
from aurweb import aur_logging, cookies, db, models, time, util
from aurweb.cache import db_count_cache
from aurweb.exceptions import handle_form_exceptions
from aurweb.models.account_type import TRUSTED_USER_AND_DEV_ID, TRUSTED_USER_ID
......@@ -21,7 +21,7 @@ from aurweb.models.package_request import PENDING_ID
from aurweb.packages.util import query_notified, query_voted, updated_packages
from aurweb.templates import make_context, render_template
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
router = APIRouter()
......@@ -73,7 +73,7 @@ async def index(request: Request):
bases = db.query(models.PackageBase)
redis = aurweb.redis.redis_connection()
redis = aurweb.aur_redis.redis_connection()
cache_expire = 300 # Five minutes.
# Package statistics.
......
......@@ -6,7 +6,7 @@ from fastapi import APIRouter, Form, Query, Request, Response
import aurweb.filters # noqa: F401
from aurweb import config, db, defaults, logging, models, util
from aurweb import aur_logging, config, db, defaults, models, util
from aurweb.auth import creds, requires_auth
from aurweb.exceptions import InvariantError, handle_form_exceptions
from aurweb.models.relation_type import CONFLICTS_ID, PROVIDES_ID, REPLACES_ID
......@@ -17,7 +17,7 @@ from aurweb.pkgbase import actions as pkgbase_actions
from aurweb.pkgbase import util as pkgbaseutil
from aurweb.templates import make_context, make_variable_context, render_template
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
router = APIRouter()
......
......@@ -4,7 +4,7 @@ from fastapi import APIRouter, Form, HTTPException, Query, Request, Response
from fastapi.responses import JSONResponse, RedirectResponse
from sqlalchemy import and_
from aurweb import config, db, l10n, logging, templates, time, util
from aurweb import aur_logging, config, db, l10n, templates, time, util
from aurweb.auth import creds, requires_auth
from aurweb.exceptions import InvariantError, ValidationError, handle_form_exceptions
from aurweb.models import PackageBase
......@@ -23,7 +23,7 @@ from aurweb.scripts import notify, popupdate
from aurweb.scripts.rendercomment import update_comment_render_fastapi
from aurweb.templates import make_variable_context, render_template
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
router = APIRouter()
......
......@@ -8,7 +8,7 @@ from fastapi import APIRouter, Form, HTTPException, Request
from fastapi.responses import RedirectResponse, Response
from sqlalchemy import and_, func, or_
from aurweb import db, l10n, logging, models, time
from aurweb import aur_logging, db, l10n, models, time
from aurweb.auth import creds, requires_auth
from aurweb.exceptions import handle_form_exceptions
from aurweb.models import User
......@@ -16,7 +16,7 @@ from aurweb.models.account_type import TRUSTED_USER_AND_DEV_ID, TRUSTED_USER_ID
from aurweb.templates import make_context, make_variable_context, render_template
router = APIRouter()
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
# Some TU route specific constants.
ITEMS_PER_PAGE = 10 # Paged table size.
......
......@@ -35,11 +35,11 @@ from sqlalchemy import literal, orm
import aurweb.config
from aurweb import db, filters, logging, models, util
from aurweb import aur_logging, db, filters, models, util
from aurweb.benchmark import Benchmark
from aurweb.models import Package, PackageBase, User
logger = logging.get_logger("aurweb.scripts.mkpkglists")
logger = aur_logging.get_logger("aurweb.scripts.mkpkglists")
TYPE_MAP = {
......
......@@ -14,7 +14,7 @@ import aurweb.db
import aurweb.filters
import aurweb.l10n
from aurweb import db, logging
from aurweb import aur_logging, db
from aurweb.models import PackageBase, User
from aurweb.models.package_comaintainer import PackageComaintainer
from aurweb.models.package_comment import PackageComment
......@@ -23,7 +23,7 @@ from aurweb.models.package_request import PackageRequest
from aurweb.models.request_type import RequestType
from aurweb.models.tu_vote import TUVote
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
aur_location = aurweb.config.get('options', 'aur_location')
......
......@@ -11,10 +11,10 @@ import pygit2
import aurweb.config
from aurweb import db, logging, util
from aurweb import aur_logging, db, util
from aurweb.models import PackageComment
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
class LinkifyExtension(markdown.extensions.Extension):
......
......@@ -6,10 +6,10 @@ import subprocess
from typing import List
from aurweb import logging, util
from aurweb import aur_logging, util
from aurweb.templates import base_template
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
class AlpmDatabase:
......
......@@ -5,9 +5,9 @@ from typing import Callable
from posix_ipc import O_CREAT, Semaphore
from aurweb import logging
from aurweb import aur_logging
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
def default_on_create(path):
......
......@@ -9,7 +9,7 @@ when encountering invalid criteria and return silently otherwise.
from fastapi import Request
from sqlalchemy import and_
from aurweb import config, db, l10n, logging, models, time, util
from aurweb import aur_logging, config, db, l10n, models, time, util
from aurweb.auth import creds
from aurweb.captcha import get_captcha_answer, get_captcha_salts, get_captcha_token
from aurweb.exceptions import ValidationError
......@@ -17,7 +17,7 @@ from aurweb.models.account_type import ACCOUNT_TYPE_NAME
from aurweb.models.ssh_pub_key import get_fingerprint
from aurweb.util import strtobool
logger = logging.get_logger(__name__)
logger = aur_logging.get_logger(__name__)
def invalid_fields(E: str = str(), U: str = str(), **kwargs) -> None:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment