mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Refactor code to comply with flake8 and isort
Signed-off-by: Filipe Laíns <lains@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
48b58b1c2f
commit
8d1be7ea8a
11 changed files with 206 additions and 197 deletions
|
@ -1,8 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import shlex
|
||||
import re
|
||||
import shlex
|
||||
import sys
|
||||
|
||||
import aurweb.config
|
||||
|
|
|
@ -175,11 +175,11 @@ def pkgbase_set_comaintainers(pkgbase, userlist, user, privileged):
|
|||
i += 1
|
||||
|
||||
for userid in uids_rem:
|
||||
cur = conn.execute("DELETE FROM PackageComaintainers " +
|
||||
"WHERE PackageBaseID = ? AND UsersID = ?",
|
||||
[pkgbase_id, userid])
|
||||
subprocess.Popen((notify_cmd, 'comaintainer-remove',
|
||||
str(userid), str(pkgbase_id)))
|
||||
cur = conn.execute("DELETE FROM PackageComaintainers " +
|
||||
"WHERE PackageBaseID = ? AND UsersID = ?",
|
||||
[pkgbase_id, userid])
|
||||
subprocess.Popen((notify_cmd, 'comaintainer-remove',
|
||||
str(userid), str(pkgbase_id)))
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
@ -268,7 +268,7 @@ def pkgbase_disown(pkgbase, user, privileged):
|
|||
cur = conn.execute("SELECT ID FROM Users WHERE Username = ?", [user])
|
||||
userid = cur.fetchone()[0]
|
||||
if userid == 0:
|
||||
raise aurweb.exceptions.InvalidUserException(user)
|
||||
raise aurweb.exceptions.InvalidUserException(user)
|
||||
|
||||
subprocess.Popen((notify_cmd, 'disown', str(userid), str(pkgbase_id)))
|
||||
|
||||
|
@ -472,7 +472,7 @@ def checkarg(cmdargv, *argdesc):
|
|||
checkarg_atmost(cmdargv, *argdesc)
|
||||
|
||||
|
||||
def serve(action, cmdargv, user, privileged, remote_addr):
|
||||
def serve(action, cmdargv, user, privileged, remote_addr): # noqa: C901
|
||||
if enable_maintenance:
|
||||
if remote_addr not in maintenance_exc:
|
||||
raise aurweb.exceptions.MaintenanceException
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import pygit2
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
import pygit2
|
||||
import srcinfo.parse
|
||||
import srcinfo.utils
|
||||
|
||||
|
@ -75,7 +75,7 @@ def create_pkgbase(conn, pkgbase, user):
|
|||
return pkgbase_id
|
||||
|
||||
|
||||
def save_metadata(metadata, conn, user):
|
||||
def save_metadata(metadata, conn, user): # noqa: C901
|
||||
# Obtain package base ID and previous maintainer.
|
||||
pkgbase = metadata['pkgbase']
|
||||
cur = conn.execute("SELECT ID, MaintainerUID FROM PackageBases "
|
||||
|
@ -232,7 +232,7 @@ def die_commit(msg, commit):
|
|||
exit(1)
|
||||
|
||||
|
||||
def main():
|
||||
def main(): # noqa: C901
|
||||
repo = pygit2.Repository(repo_path)
|
||||
|
||||
user = os.environ.get("AUR_USER")
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import aurweb.db
|
||||
import aurweb.schema
|
||||
import argparse
|
||||
|
||||
import alembic.command
|
||||
import alembic.config
|
||||
import argparse
|
||||
import sqlalchemy
|
||||
|
||||
import aurweb.db
|
||||
import aurweb.schema
|
||||
|
||||
|
||||
def feed_initial_data(conn):
|
||||
conn.execute(aurweb.schema.AccountTypes.insert(), [
|
||||
|
|
|
@ -16,4 +16,4 @@ class Translator:
|
|||
self._localedir,
|
||||
languages=[lang])
|
||||
self._translator[lang].install()
|
||||
return _(s)
|
||||
return _(s) # _ is not defined, what is this? # noqa: F821
|
||||
|
|
|
@ -6,7 +6,7 @@ usually be automatically generated. See `migrations/README` for details.
|
|||
"""
|
||||
|
||||
|
||||
from sqlalchemy import CHAR, Column, ForeignKey, Index, MetaData, String, TIMESTAMP, Table, Text, text
|
||||
from sqlalchemy import CHAR, TIMESTAMP, Column, ForeignKey, Index, MetaData, String, Table, Text, text
|
||||
from sqlalchemy.dialects.mysql import BIGINT, DECIMAL, INTEGER, TINYINT
|
||||
from sqlalchemy.ext.compiler import compiles
|
||||
|
||||
|
@ -24,7 +24,7 @@ def compile_bigint_sqlite(type_, compiler, **kw):
|
|||
to INTEGER. Aside from that, BIGINT is the same as INTEGER for SQLite.
|
||||
|
||||
See https://docs.sqlalchemy.org/en/13/dialects/sqlite.html#allowing-autoincrement-behavior-sqlalchemy-types-other-than-integer-integer
|
||||
"""
|
||||
""" # noqa: E501
|
||||
return 'INTEGER'
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import pyalpm
|
||||
import re
|
||||
|
||||
import pyalpm
|
||||
|
||||
import aurweb.config
|
||||
import aurweb.db
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import re
|
||||
import pygit2
|
||||
import sys
|
||||
|
||||
import bleach
|
||||
import markdown
|
||||
import pygit2
|
||||
|
||||
import aurweb.config
|
||||
import aurweb.db
|
||||
|
@ -47,7 +47,7 @@ class FlysprayLinksInlineProcessor(markdown.inlinepatterns.InlineProcessor):
|
|||
|
||||
class FlysprayLinksExtension(markdown.extensions.Extension):
|
||||
def extendMarkdown(self, md, md_globals):
|
||||
processor = FlysprayLinksInlineProcessor(r'\bFS#(\d+)\b',md)
|
||||
processor = FlysprayLinksInlineProcessor(r'\bFS#(\d+)\b', md)
|
||||
md.inlinePatterns.register(processor, 'flyspray-links', 118)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue