Verified Commit 9c0f8f05 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 b757e669
Pipeline #35050 passed with stages
in 2 minutes and 44 seconds
......@@ -22,19 +22,18 @@ 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()
......
......@@ -2,9 +2,9 @@ import fakeredis
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
......
......@@ -10,12 +10,12 @@ from sqlalchemy.orm import backref, relationship
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
......
......@@ -7,11 +7,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]]
......
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, User
from aurweb.models.package_comaintainer import PackageComaintainer
......@@ -10,7 +10,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__)
@db.retry_deadlock
......
......@@ -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):
......
......@@ -8,7 +8,7 @@ from fastapi.responses import HTMLResponse, RedirectResponse
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, creds, requires_auth, requires_guest
from aurweb.captcha import get_captcha_salts
from aurweb.exceptions import ValidationError, handle_form_exceptions
......@@ -22,7 +22,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)
......
......@@ -16,7 +16,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
......@@ -24,7 +24,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()
......@@ -80,7 +80,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.
......
......@@ -5,7 +5,7 @@ from typing import Any
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
......@@ -15,7 +15,7 @@ from aurweb.packages.util import get_pkg_or_base
from aurweb.pkgbase import actions as pkgbase_actions, 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
......@@ -21,7 +21,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()
......
......@@ -7,7 +7,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
......@@ -15,7 +15,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.
......
......@@ -32,11 +32,11 @@ import orjson
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 = {
......
......@@ -13,7 +13,7 @@ import aurweb.config
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
......@@ -22,7 +22,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")
......
......@@ -9,10 +9,10 @@ import markdown
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):
......
......@@ -4,10 +4,10 @@ import re
import shutil
import subprocess
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:
......
......@@ -4,9 +4,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