diff --git a/aurweb/git/update.py b/aurweb/git/update.py index 3c9c3785..2424bf6c 100755 --- a/aurweb/git/update.py +++ b/aurweb/git/update.py @@ -305,9 +305,9 @@ def main(): # noqa: C901 try: metadata_pkgbase = metadata['pkgbase'] - except KeyError as e: + except KeyError: die_commit('invalid .SRCINFO, does not contain a pkgbase (is the file empty?)', - str(commit.id)) + str(commit.id)) if not re.match(repo_regex, metadata_pkgbase): die_commit('invalid pkgbase: {:s}'.format(metadata_pkgbase), str(commit.id)) diff --git a/aurweb/models/user.py b/aurweb/models/user.py index 6c5c6e21..1961228e 100644 --- a/aurweb/models/user.py +++ b/aurweb/models/user.py @@ -65,8 +65,6 @@ class User: def valid_password(self, password: str): """ Check authentication against a given password. """ - from aurweb.db import session - if password is None: return False diff --git a/aurweb/routers/html.py b/aurweb/routers/html.py index 8f89e05c..890aff88 100644 --- a/aurweb/routers/html.py +++ b/aurweb/routers/html.py @@ -2,9 +2,8 @@ decorators in some way; more complex routes should be defined in their own modules and imported here. """ from http import HTTPStatus -from urllib.parse import unquote -from fastapi import APIRouter, Form, Request, HTTPException +from fastapi import APIRouter, Form, HTTPException, Request from fastapi.responses import HTMLResponse, RedirectResponse from aurweb.templates import make_context, render_template diff --git a/migrations/versions/56e2ce8e2ffa_utf8mb4_charset_and_collation.py b/migrations/versions/56e2ce8e2ffa_utf8mb4_charset_and_collation.py index e198c34c..67f0c065 100644 --- a/migrations/versions/56e2ce8e2ffa_utf8mb4_charset_and_collation.py +++ b/migrations/versions/56e2ce8e2ffa_utf8mb4_charset_and_collation.py @@ -56,14 +56,14 @@ db_backend = aurweb.config.get("database", "backend") def rebuild_unique_indexes_with_str_cols(): for idx_name in indexes: sql = f""" -DROP INDEX IF EXISTS {idx_name} +DROP INDEX IF EXISTS {idx_name} ON {indexes.get(idx_name)[0]} """ op.execute(sql) sql = f""" -CREATE UNIQUE INDEX {idx_name} -ON {indexes.get(idx_name)[0]} -({indexes.get(idx_name)[1]}, {indexes.get(idx_name)[2]}) +CREATE UNIQUE INDEX {idx_name} +ON {indexes.get(idx_name)[0]} +({indexes.get(idx_name)[1]}, {indexes.get(idx_name)[2]}) """ op.execute(sql) @@ -77,8 +77,8 @@ def upgrade(): def op_execute(table_meta): table, charset, collate = table_meta sql = f""" -ALTER TABLE {table} -CONVERT TO CHARACTER SET {charset} +ALTER TABLE {table} +CONVERT TO CHARACTER SET {charset} COLLATE {collate} """ op.execute(sql) @@ -94,8 +94,8 @@ def downgrade(): def op_execute(table_meta): table, charset, collate = table_meta sql = f""" -ALTER TABLE {table} -CONVERT TO CHARACTER SET {src_charset} +ALTER TABLE {table} +CONVERT TO CHARACTER SET {src_charset} COLLATE {src_collate} """ op.execute(sql) diff --git a/migrations/versions/ef39fcd6e1cd_add_sso_account_id_in_table_users.py b/migrations/versions/ef39fcd6e1cd_add_sso_account_id_in_table_users.py index 2b257e9d..49bf055a 100644 --- a/migrations/versions/ef39fcd6e1cd_add_sso_account_id_in_table_users.py +++ b/migrations/versions/ef39fcd6e1cd_add_sso_account_id_in_table_users.py @@ -6,6 +6,7 @@ Create Date: 2020-06-08 10:04:13.898617 """ import sqlalchemy as sa + from alembic import op from sqlalchemy.engine.reflection import Inspector diff --git a/migrations/versions/f47cad5d6d03_initial_revision.py b/migrations/versions/f47cad5d6d03_initial_revision.py index 9e99490f..b214beea 100644 --- a/migrations/versions/f47cad5d6d03_initial_revision.py +++ b/migrations/versions/f47cad5d6d03_initial_revision.py @@ -1,14 +1,9 @@ """initial revision Revision ID: f47cad5d6d03 -Revises: Create Date: 2020-02-23 13:23:32.331396 """ -from alembic import op -import sqlalchemy as sa - - # revision identifiers, used by Alembic. revision = 'f47cad5d6d03' down_revision = None diff --git a/test/test_auth.py b/test/test_auth.py index 05dd2020..e5e1de11 100644 --- a/test/test_auth.py +++ b/test/test_auth.py @@ -4,8 +4,6 @@ import pytest from sqlalchemy.exc import IntegrityError -import aurweb.config - from aurweb.auth import BasicAuthBackend, has_credential from aurweb.db import create, query from aurweb.models.account_type import AccountType