summaryrefslogtreecommitdiffstats
path: root/aurweb
diff options
context:
space:
mode:
authorFilipe Laíns <lains@archlinux.org>2020-06-02 00:35:25 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2021-02-20 17:24:30 +0100
commit8d1be7ea8a8d7c270f692a6c375ef2614c5ac601 (patch)
tree2b343525badee68b0850ddc51295a6efca66f9a2 /aurweb
parent48b58b1c2f74df0906231d2affd9f2b352a8e330 (diff)
downloadaur-8d1be7ea8a8d7c270f692a6c375ef2614c5ac601.tar.gz
aur-8d1be7ea8a8d7c270f692a6c375ef2614c5ac601.tar.xz
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>
Diffstat (limited to 'aurweb')
-rwxr-xr-xaurweb/git/auth.py3
-rwxr-xr-xaurweb/git/serve.py14
-rwxr-xr-xaurweb/git/update.py6
-rw-r--r--aurweb/initdb.py7
-rw-r--r--aurweb/l10n.py2
-rw-r--r--aurweb/schema.py4
-rwxr-xr-xaurweb/scripts/aurblup.py3
-rwxr-xr-xaurweb/scripts/rendercomment.py6
8 files changed, 23 insertions, 22 deletions
diff --git a/aurweb/git/auth.py b/aurweb/git/auth.py
index 3b1e485f..abecd276 100755
--- a/aurweb/git/auth.py
+++ b/aurweb/git/auth.py
@@ -1,8 +1,7 @@
#!/usr/bin/env python3
-import os
-import shlex
import re
+import shlex
import sys
import aurweb.config
diff --git a/aurweb/git/serve.py b/aurweb/git/serve.py
index 64d51b9e..b91f1a13 100755
--- a/aurweb/git/serve.py
+++ b/aurweb/git/serve.py
@@ -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
diff --git a/aurweb/git/update.py b/aurweb/git/update.py
index 39128f8b..929b254e 100755
--- a/aurweb/git/update.py
+++ b/aurweb/git/update.py
@@ -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")
diff --git a/aurweb/initdb.py b/aurweb/initdb.py
index 91777f7e..c8d0b2ae 100644
--- a/aurweb/initdb.py
+++ b/aurweb/initdb.py
@@ -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(), [
diff --git a/aurweb/l10n.py b/aurweb/l10n.py
index a7c0103e..492200b3 100644
--- a/aurweb/l10n.py
+++ b/aurweb/l10n.py
@@ -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
diff --git a/aurweb/schema.py b/aurweb/schema.py
index 6792cf1d..20f3e5ce 100644
--- a/aurweb/schema.py
+++ b/aurweb/schema.py
@@ -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'
diff --git a/aurweb/scripts/aurblup.py b/aurweb/scripts/aurblup.py
index a7d43f12..e32937ce 100755
--- a/aurweb/scripts/aurblup.py
+++ b/aurweb/scripts/aurblup.py
@@ -1,8 +1,9 @@
#!/usr/bin/env python3
-import pyalpm
import re
+import pyalpm
+
import aurweb.config
import aurweb.db
diff --git a/aurweb/scripts/rendercomment.py b/aurweb/scripts/rendercomment.py
index 76865d27..422dd33b 100755
--- a/aurweb/scripts/rendercomment.py
+++ b/aurweb/scripts/rendercomment.py
@@ -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)