chore(lint): reformatting after black update

Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
moson-mo 2023-02-06 09:15:18 +01:00
parent 2373bdf400
commit f9a5188fb7
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
8 changed files with 3 additions and 19 deletions

View file

@ -75,7 +75,6 @@ cred_filters = {
def has_credential(user: User, credential: int, approved: list = tuple()):
if user in approved:
return True
return user.AccountTypeID in cred_filters[credential]

View file

@ -470,7 +470,6 @@ async def packages_post(
action: str = Form(default=str()),
confirm: bool = Form(default=False),
):
# If an invalid action is specified, just render GET /packages
# with an BAD_REQUEST status_code.
if action not in PACKAGE_ACTIONS:

View file

@ -115,7 +115,6 @@ async def requests(
@router.get("/requests/{id}/close")
@requires_auth
async def request_close(request: Request, id: int):
pkgreq = get_pkgreq_by_id(id)
if not request.user.is_elevated() and request.user != pkgreq.User:
# Request user doesn't have permission here: redirect to '/'.

View file

@ -96,7 +96,6 @@ async def rpc_request(
args: Optional[list[str]] = [],
callback: Optional[str] = None,
):
# Create a handle to our RPC class.
rpc = RPC(version=v, type=type)

View file

@ -131,7 +131,6 @@ class Notification:
class ResetKeyNotification(Notification):
def __init__(self, uid):
user = (
db.query(User)
.filter(and_(User.ID == uid, User.Suspended == 0))
@ -194,7 +193,6 @@ class WelcomeNotification(ResetKeyNotification):
class CommentNotification(Notification):
def __init__(self, uid, pkgbase_id, comment_id):
self._user = db.query(User.Username).filter(User.ID == uid).first().Username
self._pkgbase = (
db.query(PackageBase.Name).filter(PackageBase.ID == pkgbase_id).first().Name
@ -260,7 +258,6 @@ class CommentNotification(Notification):
class UpdateNotification(Notification):
def __init__(self, uid, pkgbase_id):
self._user = db.query(User.Username).filter(User.ID == uid).first().Username
self._pkgbase = (
db.query(PackageBase.Name).filter(PackageBase.ID == pkgbase_id).first().Name
@ -319,7 +316,6 @@ class UpdateNotification(Notification):
class FlagNotification(Notification):
def __init__(self, uid, pkgbase_id):
self._user = db.query(User.Username).filter(User.ID == uid).first().Username
self._pkgbase = (
db.query(PackageBase.Name).filter(PackageBase.ID == pkgbase_id).first().Name
@ -375,7 +371,6 @@ class FlagNotification(Notification):
class OwnershipEventNotification(Notification):
def __init__(self, uid, pkgbase_id):
self._user = db.query(User.Username).filter(User.ID == uid).first().Username
self._pkgbase = (
db.query(PackageBase.Name).filter(PackageBase.ID == pkgbase_id).first().Name
@ -437,7 +432,6 @@ class DisownNotification(OwnershipEventNotification):
class ComaintainershipEventNotification(Notification):
def __init__(self, uid, pkgbase_id):
self._pkgbase = (
db.query(PackageBase.Name).filter(PackageBase.ID == pkgbase_id).first().Name
)
@ -482,7 +476,6 @@ class ComaintainerRemoveNotification(ComaintainershipEventNotification):
class DeleteNotification(Notification):
def __init__(self, uid, old_pkgbase_id, new_pkgbase_id=None):
self._user = db.query(User.Username).filter(User.ID == uid).first().Username
self._old_pkgbase = (
db.query(PackageBase.Name)
@ -560,7 +553,6 @@ class DeleteNotification(Notification):
class RequestOpenNotification(Notification):
def __init__(self, uid, reqid, reqtype, pkgbase_id, merge_into=None):
self._user = db.query(User.Username).filter(User.ID == uid).first().Username
self._pkgbase = (
db.query(PackageBase.Name).filter(PackageBase.ID == pkgbase_id).first().Name

View file

@ -131,7 +131,7 @@ def test_mkpkglists(
(USERS, "test\n"),
]
for (file, expected_content) in expectations:
for file, expected_content in expectations:
with gzip.open(file, "r") as f:
file_content = f.read().decode()
assert file_content == expected_content
@ -172,7 +172,7 @@ def test_mkpkglists_extended_empty(config_mock: None):
(META_EXT, "[\n]"),
]
for (file, expected_content) in expectations:
for file, expected_content in expectations:
with gzip.open(file, "r") as f:
file_content = f.read().decode()
assert file_content == expected_content, f"{file=} contents malformed"
@ -209,7 +209,7 @@ def test_mkpkglists_extended(config_mock: None, user: User, packages: list[Packa
(USERS, "test\n"),
]
for (file, expected_content) in expectations:
for file, expected_content in expectations:
with gzip.open(file, "r") as f:
file_content = f.read().decode()
assert file_content == expected_content

View file

@ -322,7 +322,6 @@ def test_package(client: TestClient, package: Package):
def test_package_split_description(client: TestClient, user: User):
with db.begin():
pkgbase = db.create(
PackageBase,
@ -1178,7 +1177,6 @@ def test_packages_per_page(client: TestClient, maintainer: User):
def test_packages_post_unknown_action(client: TestClient, user: User, package: Package):
cookies = {"AURSID": user.login(Request(), "testPassword")}
with client as request:
request.cookies = cookies
@ -1366,7 +1364,6 @@ def test_packages_post_unnotify(client: TestClient, user: User, package: Package
def test_packages_post_adopt(client: TestClient, user: User, package: Package):
# Try to adopt an empty list of packages.
cookies = {"AURSID": user.login(Request(), "testPassword")}
with client as request:

View file

@ -107,7 +107,6 @@ def test_ratelimit_db(
getint: mock.MagicMock,
pipeline: Pipeline,
):
# We'll need a Request for everything here.
request = Request()