From patchwork Mon Jun 1 22:35:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Filipe_La=C3=ADns?= X-Patchwork-Id: 1663 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id F0F51191E4777 for ; Mon, 1 Jun 2020 22:36:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1, MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01,SPF_HELO_NONE=0.001,T_DMARC_POLICY_NONE=0.01, WEIRD_QUOTING=0.001 autolearn=ham autolearn_force=no version=3.4.4 X-Spam-BL-Results: [127.0.0.19] [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Mon, 1 Jun 2020 22:36:15 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id D50C21C76660EC; Mon, 1 Jun 2020 22:35:51 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: luna) by orion.archlinux.org (Postfix) with ESMTPSA id 600E31C76660C7; Mon, 1 Jun 2020 22:35:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1591050947; bh=xhirvA5rbPC9Rpe7ujC4u7J6X4xnWs9fOyM0dWad0h8=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe; b=hV5ySyAUGpOhLNiMC2i4OWMWkbegV5WtFvojO8QBq0GXVJErnh5m5kSYIT8i7VmF8 OqQxIBw1wwamLClvPowYgDZYfR87YBSfjKRASqCWZjws7DXkWBfiaHM+z9oLxpur5I 6hFxCezhSgoLiHURaKPdSYo6c2FYpB/8rAhPsggSIv3w1tf/XwofnIGtHwfEu6CNcl DLLjkHxyGUNipoA9D5pL83ooGz0x6AanH23ztHsnKH/0Jg5t4WT6xsXW6UsiyemoQL GJHognQgGtDlxm9SJgXDpSVwBWiHe9alBDUzHepwdKdHk49GuvnDMk6ZOX3skDRyd2 kMH1I0sjZWvD+PI+y6p5bFJJIir6vHxdg7YAuADETVQtG1Rfubf16VD76nMrweH+az WjJ1eRn+iJpYGRIyRfbCxAoU15muNh+KL6+48pgJtU48Da8HQWmwWk5AKh7PGrE1aB 5I2IaDuPjjUF1IusDa6T+07HB2IL63OfBlWI6B/BdE5jpz1AQsMkja2OzfKg/FBs0P lElzrnyhVH2YAeJTkjaE/7nu8/Atqk3iP4ZltY0jjofsVIXTthwDkDEnjQHv7AO+lC kSoWnRzlRBeiZGGs9bnyQDRce4AWLYptmJ4WrXNtAFhr+Z4AtjIy6POtYaIHsrFAhE zR0g015FQUlZAtKZ3rP1qQv4= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 0F7422C01F; Mon, 1 Jun 2020 22:35:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=luna2; t=1591050947; bh=xhirvA5rbPC9Rpe7ujC4u7J6X4xnWs9fOyM0dWad0h8=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe; b=Uu7RBF2k2ytf+AiNMbUy8OPgdQkCv2Uje2lWqeWMG2jOn7LSomqmobrYNkF7qnpot d2MeR8BaK+snzxLiTuEuKfYqT5rzRWn+dNxtVq+X1w7uBWoZf45oqBgfh5yNV6nysL J5KFXcZMLyblrGBcNwuQzkZV0iXW5YJC1do9DIuYdtda2sPNUQ8PpDplYE3iPUuUNO VbiYqWTTW4kFKYAL4wUXgOf6NDqdF2l56eacpl2yAEtAOI0sQ6L/pUpDVUXKzYhpxx AyJLxmYfhmmZwz1AX9RTnAqo/K/E/53OD3XTdwhqIUslvjKVqQECsUcm9YvNTbKOG5 eFIl6ljxbFCR/QmunXQqZw7wiV56Uy7tTRlyKsCG0S5eFquY8v7Oz7j3g/I+gGeDVg GfR1vCUOCJyJkCk158qT3j9drffZ1Kt8GHGa4NCRq//GRvpBVWZ5yY+JEuclvF6BxP KM/p+tpDXJsJMVqcYP+DbFRwXNYhe13azdsti8dQw7b0sYGaa4VfZyxOQ/DlZfB48i JgVpexSlq5erUbuvRZYkJL2BaI9uagKXxmOlzQIdBB0bPOvPQJLn3uEutz04qbUtzb yLJIqa9MD3Eqz7yDEe5/au7Riz1Gh+3PgRQvNQobASs2kEAk1p8Ah1dsvJqSBzqyR5 9DOLI5M87aTR/0oVzKh/y4tI= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 2538C2BE6F for ; Mon, 1 Jun 2020 22:35:43 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Mon, 1 Jun 2020 22:35:43 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id A01131C76660B7; Mon, 1 Jun 2020 22:35:40 +0000 (UTC) Received: from localhost.localdomain (unknown [IPv6:2001:8a0:f254:2300:34be:8c97:bb49:e7fd]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ffy00) by orion.archlinux.org (Postfix) with ESMTPSA; Mon, 1 Jun 2020 22:35:40 +0000 (UTC) From: =?utf-8?q?Filipe_La=C3=ADns?= To: aur-dev@archlinux.org Cc: =?utf-8?q?Filipe_La=C3=ADns?= Subject: [PATCH v2 1/5] refactor code to comply with flake8 and isort Date: Mon, 1 Jun 2020 23:35:25 +0100 Message-Id: <20200601223529.3006974-1-lains@archlinux.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-BeenThere: aur-dev@archlinux.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "Arch User Repository \(AUR\) Development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: aur-dev-bounces@archlinux.org Sender: "aur-dev" Signed-off-by: Filipe Laíns --- aurweb/git/auth.py | 3 +- aurweb/git/serve.py | 14 +- aurweb/git/update.py | 6 +- aurweb/initdb.py | 7 +- aurweb/l10n.py | 2 +- aurweb/schema.py | 4 +- aurweb/scripts/aurblup.py | 3 +- aurweb/scripts/rendercomment.py | 6 +- migrations/env.py | 9 +- schema/gendummydata.py | 354 ++++++++++++++++---------------- setup.py | 3 +- 11 files changed, 210 insertions(+), 201 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) diff --git a/migrations/env.py b/migrations/env.py index 1627e693..c2ff58c1 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -1,10 +1,11 @@ -import aurweb.db -import aurweb.schema - -from alembic import context import logging.config + import sqlalchemy +from alembic import context + +import aurweb.db +import aurweb.schema # this is the Alembic Config object, which provides # access to the values within the .ini file in use. diff --git a/schema/gendummydata.py b/schema/gendummydata.py index 1f3d0476..b3a73ef2 100755 --- a/schema/gendummydata.py +++ b/schema/gendummydata.py @@ -10,33 +10,32 @@ usage: gendummydata.py outputfilename.sql # insert these users/packages into the AUR database. # import hashlib -import random -import time +import logging import os +import random import sys -import io -import logging +import time -LOG_LEVEL = logging.DEBUG # logging level. set to logging.INFO to reduce output +LOG_LEVEL = logging.DEBUG # logging level. set to logging.INFO to reduce output SEED_FILE = "/usr/share/dict/words" -DB_HOST = os.getenv("DB_HOST", "localhost") -DB_NAME = os.getenv("DB_NAME", "AUR") -DB_USER = os.getenv("DB_USER", "aur") -DB_PASS = os.getenv("DB_PASS", "aur") -USER_ID = 5 # Users.ID of first bogus user -PKG_ID = 1 # Packages.ID of first package +DB_HOST = os.getenv("DB_HOST", "localhost") +DB_NAME = os.getenv("DB_NAME", "AUR") +DB_USER = os.getenv("DB_USER", "aur") +DB_PASS = os.getenv("DB_PASS", "aur") +USER_ID = 5 # Users.ID of first bogus user +PKG_ID = 1 # Packages.ID of first package MAX_USERS = 300 # how many users to 'register' -MAX_DEVS = .1 # what percentage of MAX_USERS are Developers -MAX_TUS = .2 # what percentage of MAX_USERS are Trusted Users -MAX_PKGS = 900 # how many packages to load -PKG_DEPS = (1, 15) # min/max depends a package has -PKG_RELS = (1, 5) # min/max relations a package has -PKG_SRC = (1, 3) # min/max sources a package has +MAX_DEVS = .1 # what percentage of MAX_USERS are Developers +MAX_TUS = .2 # what percentage of MAX_USERS are Trusted Users +MAX_PKGS = 900 # how many packages to load +PKG_DEPS = (1, 15) # min/max depends a package has +PKG_RELS = (1, 5) # min/max relations a package has +PKG_SRC = (1, 3) # min/max sources a package has PKG_CMNTS = (1, 5) # min/max number of comments a package has CATEGORIES_COUNT = 17 # the number of categories from aur-schema -VOTING = (0, .30) # percentage range for package voting -OPEN_PROPOSALS = 5 # number of open trusted user proposals -CLOSE_PROPOSALS = 15 # number of closed trusted user proposals +VOTING = (0, .30) # percentage range for package voting +OPEN_PROPOSALS = 5 # number of open trusted user proposals +CLOSE_PROPOSALS = 15 # number of closed trusted user proposals RANDOM_TLDS = ("edu", "com", "org", "net", "tw", "ru", "pl", "de", "es") RANDOM_URL = ("http://www.", "ftp://ftp.", "http://", "ftp://") RANDOM_LOCS = ("pub", "release", "files", "downloads", "src") @@ -48,20 +47,20 @@ logging.basicConfig(format=logformat, level=LOG_LEVEL) log = logging.getLogger() if len(sys.argv) != 2: - log.error("Missing output filename argument") - raise SystemExit + log.error("Missing output filename argument") + raise SystemExit # make sure the seed file exists # if not os.path.exists(SEED_FILE): - log.error("Please install the 'words' Arch package") - raise SystemExit + log.error("Please install the 'words' Arch package") + raise SystemExit # make sure comments can be created # if not os.path.exists(FORTUNE_FILE): - log.error("Please install the 'fortune-mod' Arch package") - raise SystemExit + log.error("Please install the 'fortune-mod' Arch package") + raise SystemExit # track what users/package names have been used # @@ -69,21 +68,28 @@ seen_users = {} seen_pkgs = {} user_keys = [] + # some functions to generate random data # def genVersion(): - ver = [] - ver.append("%d" % random.randrange(0,10)) - ver.append("%d" % random.randrange(0,20)) - if random.randrange(0,2) == 0: - ver.append("%d" % random.randrange(0,100)) - return ".".join(ver) + "-%d" % random.randrange(1,11) + ver = [] + ver.append("%d" % random.randrange(0, 10)) + ver.append("%d" % random.randrange(0, 20)) + if random.randrange(0, 2) == 0: + ver.append("%d" % random.randrange(0, 100)) + return ".".join(ver) + "-%d" % random.randrange(1, 11) + + def genCategory(): - return random.randrange(1,CATEGORIES_COUNT) + return random.randrange(1, CATEGORIES_COUNT) + + def genUID(): - return seen_users[user_keys[random.randrange(0,len(user_keys))]] + return seen_users[user_keys[random.randrange(0, len(user_keys))]] + + def genFortune(): - return fortunes[random.randrange(0,len(fortunes))].replace("'", "") + return fortunes[random.randrange(0, len(fortunes))].replace("'", "") # load the words, and make sure there are enough words for users/pkgs @@ -93,25 +99,25 @@ fp = open(SEED_FILE, "r", encoding="utf-8") contents = fp.readlines() fp.close() if MAX_USERS > len(contents): - MAX_USERS = len(contents) + MAX_USERS = len(contents) if MAX_PKGS > len(contents): - MAX_PKGS = len(contents) + MAX_PKGS = len(contents) if len(contents) - MAX_USERS > MAX_PKGS: - need_dupes = 0 + need_dupes = 0 else: - need_dupes = 1 + need_dupes = 1 # select random usernames # log.debug("Generating random user names...") user_id = USER_ID while len(seen_users) < MAX_USERS: - user = random.randrange(0, len(contents)) - word = contents[user].replace("'", "").replace(".","").replace(" ", "_") - word = word.strip().lower() - if word not in seen_users: - seen_users[word] = user_id - user_id += 1 + user = random.randrange(0, len(contents)) + word = contents[user].replace("'", "").replace(".", "").replace(" ", "_") + word = word.strip().lower() + if word not in seen_users: + seen_users[word] = user_id + user_id += 1 user_keys = list(seen_users.keys()) # select random package names @@ -119,17 +125,17 @@ user_keys = list(seen_users.keys()) log.debug("Generating random package names...") num_pkgs = PKG_ID while len(seen_pkgs) < MAX_PKGS: - pkg = random.randrange(0, len(contents)) - word = contents[pkg].replace("'", "").replace(".","").replace(" ", "_") - word = word.strip().lower() - if not need_dupes: - if word not in seen_pkgs and word not in seen_users: - seen_pkgs[word] = num_pkgs - num_pkgs += 1 - else: - if word not in seen_pkgs: - seen_pkgs[word] = num_pkgs - num_pkgs += 1 + pkg = random.randrange(0, len(contents)) + word = contents[pkg].replace("'", "").replace(".", "").replace(" ", "_") + word = word.strip().lower() + if not need_dupes: + if word not in seen_pkgs and word not in seen_users: + seen_pkgs[word] = num_pkgs + num_pkgs += 1 + else: + if word not in seen_pkgs: + seen_pkgs[word] = num_pkgs + num_pkgs += 1 # free up contents memory # @@ -151,32 +157,32 @@ out.write("BEGIN;\n") # log.debug("Creating SQL statements for users.") for u in user_keys: - account_type = 1 # default to normal user - if not has_devs or not has_tus: - account_type = random.randrange(1, 4) - if account_type == 3 and not has_devs: - # this will be a dev account - # - developers.append(seen_users[u]) - if len(developers) >= MAX_DEVS * MAX_USERS: - has_devs = 1 - elif account_type == 2 and not has_tus: - # this will be a trusted user account - # - trustedusers.append(seen_users[u]) - if len(trustedusers) >= MAX_TUS * MAX_USERS: - has_tus = 1 - else: - # a normal user account - # - pass - - h = hashlib.new('md5') - h.update(u.encode()); - s = ("INSERT INTO Users (ID, AccountTypeID, Username, Email, Passwd)" - " VALUES (%d, %d, '%s', '%s@example.com', '%s');\n") - s = s % (seen_users[u], account_type, u, u, h.hexdigest()) - out.write(s) + account_type = 1 # default to normal user + if not has_devs or not has_tus: + account_type = random.randrange(1, 4) + if account_type == 3 and not has_devs: + # this will be a dev account + # + developers.append(seen_users[u]) + if len(developers) >= MAX_DEVS * MAX_USERS: + has_devs = 1 + elif account_type == 2 and not has_tus: + # this will be a trusted user account + # + trustedusers.append(seen_users[u]) + if len(trustedusers) >= MAX_TUS * MAX_USERS: + has_tus = 1 + else: + # a normal user account + # + pass + + h = hashlib.new('md5') + h.update(u.encode()) + s = ("INSERT INTO Users (ID, AccountTypeID, Username, Email, Passwd)" + " VALUES (%d, %d, '%s', '%s@example.com', '%s');\n") + s = s % (seen_users[u], account_type, u, u, h.hexdigest()) + out.write(s) log.debug("Number of developers: %d" % len(developers)) log.debug("Number of trusted users: %d" % len(trustedusers)) @@ -193,123 +199,123 @@ fp.close() log.debug("Creating SQL statements for packages.") count = 0 for p in list(seen_pkgs.keys()): - NOW = int(time.time()) - if count % 2 == 0: - muid = developers[random.randrange(0,len(developers))] - puid = developers[random.randrange(0,len(developers))] - else: - muid = trustedusers[random.randrange(0,len(trustedusers))] - puid = trustedusers[random.randrange(0,len(trustedusers))] - if count % 20 == 0: # every so often, there are orphans... - muid = "NULL" - - uuid = genUID() # the submitter/user - - s = ("INSERT INTO PackageBases (ID, Name, FlaggerComment, SubmittedTS, ModifiedTS, " + NOW = int(time.time()) + if count % 2 == 0: + muid = developers[random.randrange(0, len(developers))] + puid = developers[random.randrange(0, len(developers))] + else: + muid = trustedusers[random.randrange(0, len(trustedusers))] + puid = trustedusers[random.randrange(0, len(trustedusers))] + if count % 20 == 0: # every so often, there are orphans... + muid = "NULL" + + uuid = genUID() # the submitter/user + + s = ("INSERT INTO PackageBases (ID, Name, FlaggerComment, SubmittedTS, ModifiedTS, " "SubmitterUID, MaintainerUID, PackagerUID) VALUES (%d, '%s', '', %d, %d, %d, %s, %s);\n") - s = s % (seen_pkgs[p], p, NOW, NOW, uuid, muid, puid) - out.write(s) + s = s % (seen_pkgs[p], p, NOW, NOW, uuid, muid, puid) + out.write(s) - s = ("INSERT INTO Packages (ID, PackageBaseID, Name, Version) VALUES " + s = ("INSERT INTO Packages (ID, PackageBaseID, Name, Version) VALUES " "(%d, %d, '%s', '%s');\n") - s = s % (seen_pkgs[p], seen_pkgs[p], p, genVersion()) - out.write(s) + s = s % (seen_pkgs[p], seen_pkgs[p], p, genVersion()) + out.write(s) - count += 1 + count += 1 - # create random comments for this package - # - num_comments = random.randrange(PKG_CMNTS[0], PKG_CMNTS[1]) - for i in range(0, num_comments): - now = NOW + random.randrange(400, 86400*3) - s = ("INSERT INTO PackageComments (PackageBaseID, UsersID," - " Comments, RenderedComment, CommentTS) VALUES (%d, %d, '%s', '', %d);\n") - s = s % (seen_pkgs[p], genUID(), genFortune(), now) - out.write(s) + # create random comments for this package + # + num_comments = random.randrange(PKG_CMNTS[0], PKG_CMNTS[1]) + for i in range(0, num_comments): + now = NOW + random.randrange(400, 86400*3) + s = ("INSERT INTO PackageComments (PackageBaseID, UsersID," + " Comments, RenderedComment, CommentTS) VALUES (%d, %d, '%s', '', %d);\n") + s = s % (seen_pkgs[p], genUID(), genFortune(), now) + out.write(s) # Cast votes # track_votes = {} log.debug("Casting votes for packages.") for u in user_keys: - num_votes = random.randrange(int(len(seen_pkgs)*VOTING[0]), - int(len(seen_pkgs)*VOTING[1])) - pkgvote = {} - for v in range(num_votes): - pkg = random.randrange(1, len(seen_pkgs) + 1) - if pkg not in pkgvote: - s = ("INSERT INTO PackageVotes (UsersID, PackageBaseID)" - " VALUES (%d, %d);\n") - s = s % (seen_users[u], pkg) - pkgvote[pkg] = 1 - if pkg not in track_votes: - track_votes[pkg] = 0 - track_votes[pkg] += 1 - out.write(s) + num_votes = random.randrange(int(len(seen_pkgs)*VOTING[0]), + int(len(seen_pkgs)*VOTING[1])) + pkgvote = {} + for v in range(num_votes): + pkg = random.randrange(1, len(seen_pkgs) + 1) + if pkg not in pkgvote: + s = ("INSERT INTO PackageVotes (UsersID, PackageBaseID)" + " VALUES (%d, %d);\n") + s = s % (seen_users[u], pkg) + pkgvote[pkg] = 1 + if pkg not in track_votes: + track_votes[pkg] = 0 + track_votes[pkg] += 1 + out.write(s) # Update statements for package votes # for p in list(track_votes.keys()): - s = "UPDATE PackageBases SET NumVotes = %d WHERE ID = %d;\n" - s = s % (track_votes[p], p) - out.write(s) + s = "UPDATE PackageBases SET NumVotes = %d WHERE ID = %d;\n" + s = s % (track_votes[p], p) + out.write(s) # Create package dependencies and sources # log.debug("Creating statements for package depends/sources.") for p in list(seen_pkgs.keys()): - num_deps = random.randrange(PKG_DEPS[0], PKG_DEPS[1]) - for i in range(0, num_deps): - dep = random.choice([k for k in seen_pkgs]) - deptype = random.randrange(1, 5) - if deptype == 4: - dep += ": for " + random.choice([k for k in seen_pkgs]) - s = "INSERT INTO PackageDepends(PackageID, DepTypeID, DepName) VALUES (%d, %d, '%s');\n" - s = s % (seen_pkgs[p], deptype, dep) - out.write(s) - - num_rels = random.randrange(PKG_RELS[0], PKG_RELS[1]) - for i in range(0, num_deps): - rel = random.choice([k for k in seen_pkgs]) - reltype = random.randrange(1, 4) - s = "INSERT INTO PackageRelations(PackageID, RelTypeID, RelName) VALUES (%d, %d, '%s');\n" - s = s % (seen_pkgs[p], reltype, rel) - out.write(s) - - num_sources = random.randrange(PKG_SRC[0], PKG_SRC[1]) - for i in range(num_sources): - src_file = user_keys[random.randrange(0, len(user_keys))] - src = "%s%s.%s/%s/%s-%s.tar.gz" % ( - RANDOM_URL[random.randrange(0,len(RANDOM_URL))], - p, RANDOM_TLDS[random.randrange(0,len(RANDOM_TLDS))], - RANDOM_LOCS[random.randrange(0,len(RANDOM_LOCS))], - src_file, genVersion()) - s = "INSERT INTO PackageSources(PackageID, Source) VALUES (%d, '%s');\n" - s = s % (seen_pkgs[p], src) - out.write(s) + num_deps = random.randrange(PKG_DEPS[0], PKG_DEPS[1]) + for i in range(0, num_deps): + dep = random.choice([k for k in seen_pkgs]) + deptype = random.randrange(1, 5) + if deptype == 4: + dep += ": for " + random.choice([k for k in seen_pkgs]) + s = "INSERT INTO PackageDepends(PackageID, DepTypeID, DepName) VALUES (%d, %d, '%s');\n" + s = s % (seen_pkgs[p], deptype, dep) + out.write(s) + + num_rels = random.randrange(PKG_RELS[0], PKG_RELS[1]) + for i in range(0, num_deps): + rel = random.choice([k for k in seen_pkgs]) + reltype = random.randrange(1, 4) + s = "INSERT INTO PackageRelations(PackageID, RelTypeID, RelName) VALUES (%d, %d, '%s');\n" + s = s % (seen_pkgs[p], reltype, rel) + out.write(s) + + num_sources = random.randrange(PKG_SRC[0], PKG_SRC[1]) + for i in range(num_sources): + src_file = user_keys[random.randrange(0, len(user_keys))] + src = "%s%s.%s/%s/%s-%s.tar.gz" % ( + RANDOM_URL[random.randrange(0, len(RANDOM_URL))], + p, RANDOM_TLDS[random.randrange(0, len(RANDOM_TLDS))], + RANDOM_LOCS[random.randrange(0, len(RANDOM_LOCS))], + src_file, genVersion()) + s = "INSERT INTO PackageSources(PackageID, Source) VALUES (%d, '%s');\n" + s = s % (seen_pkgs[p], src) + out.write(s) # Create trusted user proposals # log.debug("Creating SQL statements for trusted user proposals.") -count=0 +count = 0 for t in range(0, OPEN_PROPOSALS+CLOSE_PROPOSALS): - now = int(time.time()) - if count < CLOSE_PROPOSALS: - start = now - random.randrange(3600*24*7, 3600*24*21) - end = now - random.randrange(0, 3600*24*7) - else: - start = now - end = now + random.randrange(3600*24, 3600*24*7) - if count % 5 == 0: # Don't make the vote about anyone once in a while - user = "" - else: - user = user_keys[random.randrange(0,len(user_keys))] - suid = trustedusers[random.randrange(0,len(trustedusers))] - s = ("INSERT INTO TU_VoteInfo (Agenda, User, Submitted, End," - " Quorum, SubmitterID) VALUES ('%s', '%s', %d, %d, 0.0, %d);\n") - s = s % (genFortune(), user, start, end, suid) - out.write(s) - count += 1 + now = int(time.time()) + if count < CLOSE_PROPOSALS: + start = now - random.randrange(3600*24*7, 3600*24*21) + end = now - random.randrange(0, 3600*24*7) + else: + start = now + end = now + random.randrange(3600*24, 3600*24*7) + if count % 5 == 0: # Don't make the vote about anyone once in a while + user = "" + else: + user = user_keys[random.randrange(0, len(user_keys))] + suid = trustedusers[random.randrange(0, len(trustedusers))] + s = ("INSERT INTO TU_VoteInfo (Agenda, User, Submitted, End," + " Quorum, SubmitterID) VALUES ('%s', '%s', %d, %d, 0.0, %d);\n") + s = s % (genFortune(), user, start, end, suid) + out.write(s) + count += 1 # close output file # diff --git a/setup.py b/setup.py index ca26f0d8..cf88488c 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,8 @@ import re -from setuptools import setup, find_packages import sys +from setuptools import find_packages, setup + version = None with open('web/lib/version.inc.php', 'r') as f: for line in f.readlines(): From patchwork Mon Jun 1 22:35:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Filipe_La=C3=ADns?= X-Patchwork-Id: 1662 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id C4C14191E473B for ; Mon, 1 Jun 2020 22:35:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1, MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01,SPF_HELO_NONE=0.001,T_DMARC_POLICY_NONE=0.01 autolearn=ham autolearn_force=no version=3.4.4 X-Spam-BL-Results: [127.0.9.2] [127.0.0.19] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Mon, 1 Jun 2020 22:35:52 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 3D4851C76660CD; Mon, 1 Jun 2020 22:35:48 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: luna) by orion.archlinux.org (Postfix) with ESMTPSA id F1C611C76660C0; Mon, 1 Jun 2020 22:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1591050947; bh=ciX4nY59X9UG/USEcSr39wRzBoIYBlWKbHFLgOLq/Qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=Ns3/rpyGRvLfnlEW/U2KU/T5n/XZ1PYeuFBQ0Mde9zHNM4S1Ku0foJhGp8k5HPzrB 2CekRtoQl7pmGG2y/K3Q7P7sqNg+82P5dRuQr+16qXNXmDHpo0oJQQ3JANLgrISl18 5mg/v5IThpSTrxkFUq4sHPKx7HaVJGYcmlePyXCbbVtB7nATWbefbB+8fdssxu3xmn Ok30tP5XHiShDUNo2jH4uS/MnNQcPmMgiW3VcYASOxsKcrYKATJvXYeF0kpCC1dzOH P3TZkFwvPnsFH0eMat56IAWKVlI/OWTmdcBQfrAyDzYsiDfrpRSa5+uSrPbf71NbjC RCJJSliqS41utUblm8tgKYxmD6Muzg5Wx/gmazilYR6DiqDU1k6hBAOFHULN7xvy1g bYyPkPjYfIlbIQ/Kj4+Xm3xSlmoqJsAnIY4ocb9HiYrpItQUUKRRkDaAqlfH+bjkcR Z7girQQCd7jt7EhYfqb/0s5s3/hVXB7sHeeGDSk+du7x5jDCftt0LyHVHm8hWwCvUa IswnRRXk7spudm6/DX7mktQ0PWHB9ldcpTpJ/FOZ8X6vhyvI/2eSkEy1DUvDBkiTw3 YFclTAf4WCNHx8d5T3bRfGM6aZiFh0Q7qfd2Nr99O/aG4rt6vospR8o8HVNHgvz4oc GyefMm12sBhfjCgm9bKlkGOc= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id D1E262C01B; Mon, 1 Jun 2020 22:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=luna2; t=1591050946; bh=ciX4nY59X9UG/USEcSr39wRzBoIYBlWKbHFLgOLq/Qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=qs+VZM8k/pQonF4J0JzEbzXaRjvvh1q5bDMGLIwfaC6toeD/4Vz6khYiGlx6JVjX2 H1TWHEM416jBbW/RqzzUsLMgEe3dpZmHOoaRob7vaa25DkpgQQRUa4mWQEX7CV5jOI /hNscpjmD7xBxZ16bgSoWc6qnBn3P6uDk5QM62xa623fq3+th7AApWADRqVkp7sF1n uXGDpz+D919BE7Fb86Dkx4a5fSBAPwHS+J/cA/lgcCQH/9t8Plf5b6iHGiX301Dd9u zQ52jYeNBzZU0OZEMhww+aMsHMEF8l3avKSiWa5QO/n+xN76pwj796O+P6AF8268qP YN900mvCzdUx2CHtwn7eq+Dz96XVSy21GBvHoA2AfNMz8i5U2vjmSfK+GYWR6SSkaX QPXIL2vA+TnXFGPvpVv2fFXxM6449YXpvs2MO1T5jaUVIBmKTHvIgAyc1zyhiNNPT+ ZZHMGMYB/VuYT0NGKafLxl+C/lRb9/iBIZeQF5tZ5vMjlnvw6kLbORckhUJwn1oLui 9EGVT3XAVUOhoaY5jOBAD8CDx8+O8hWFh0Bs5jrDynLxzLb/A7ekMRgzRnmVklva3U p1NSwKXmew70U75r1MLF5L1JKOlFw2+EHqpZspnexna962FqF9UWP8GZrjbFXj/ftc h5zIYFHevOKiReZ2Bwcu/0j0= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 5D5102C009 for ; Mon, 1 Jun 2020 22:35:44 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Mon, 1 Jun 2020 22:35:44 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 73FFB1C76660B9; Mon, 1 Jun 2020 22:35:43 +0000 (UTC) Received: from localhost.localdomain (unknown [IPv6:2001:8a0:f254:2300:34be:8c97:bb49:e7fd]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ffy00) by orion.archlinux.org (Postfix) with ESMTPSA; Mon, 1 Jun 2020 22:35:43 +0000 (UTC) From: =?utf-8?q?Filipe_La=C3=ADns?= To: aur-dev@archlinux.org Cc: =?utf-8?q?Filipe_La=C3=ADns?= Subject: [PATCH v2 2/5] flake8: add initial config Date: Mon, 1 Jun 2020 23:35:26 +0100 Message-Id: <20200601223529.3006974-2-lains@archlinux.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601223529.3006974-1-lains@archlinux.org> References: <20200601223529.3006974-1-lains@archlinux.org> MIME-Version: 1.0 X-BeenThere: aur-dev@archlinux.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "Arch User Repository \(AUR\) Development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: aur-dev-bounces@archlinux.org Sender: "aur-dev" Signed-off-by: Filipe Laíns --- setup.cfg | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..04f5b8ba --- /dev/null +++ b/setup.cfg @@ -0,0 +1,4 @@ +[flake8] +max-line-length = 127 +max-complexity = 10 + From patchwork Mon Jun 1 22:35:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Filipe_La=C3=ADns?= X-Patchwork-Id: 1664 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 378DF191E47A6 for ; Mon, 1 Jun 2020 22:36:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1, MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01,SPF_HELO_NONE=0.001,T_DMARC_POLICY_NONE=0.01 autolearn=ham autolearn_force=no version=3.4.4 X-Spam-BL-Results: [127.0.0.19] [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Mon, 1 Jun 2020 22:36:33 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 47A8D1C766611E; Mon, 1 Jun 2020 22:35:58 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: luna) by orion.archlinux.org (Postfix) with ESMTPSA id 2AC3D1C76660D9; Mon, 1 Jun 2020 22:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1591050949; bh=DKSMR89OXoGHotawrB+d0+DYBl8gy5lnhLAk9sSx0U4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=mYRCLlJHCcpUG67RXxuyEk1QhKF9AQJtWM1PTZyIS2rplK3/9VGTWj4pYkcYY7kkv uIVrueOkJrGiKT3lqDlX9iqAIv/vnLdoekam4uwF1dY+Em4nnkX4BeQdhxJ4tGqPsC DVvfhVKvJo2EzVyeN4IqXC+2n8psqzskHbF0Y4g4BPUw9Us9tfTSLqhqQ6nfTYWxlA wy3WJ7tL0rHubpyQNNJhdJJOCl1XekxGQ1k6NkZOpjMjDhrI5xoW4BNTRlgcJ211B5 6OKFKvjNzC71Hf/aC7+81xCaNpPbzBnZ8CkyAk+rA+SercHBysK04MMNACM7ALdavH VTcgD0gox9P76B6vIHlgaUy5toljRvmxMaXHv0dLxnPTAipK/G7ElAiTGlPIZ4vubJ iYK0S/J0t3b7sYvSxdi/LEs3UV7nGvDZAOR2PJgOLef4TzfNdLQiDSIXv1smuFFrgI D3nR2GweBuEKrx3PiFOViWNEglk14Es4A3b+yTyW+VI5iJfSnwCrQQQcXLAk1deETo ZEzuG91ACtHWiqVMAJKvz6cwVqIM8zWkQDLI+wGw8f3nw7AaTpnPVfnk1Abw32A9+q fn8gVXV+J5HMigLUrcQ0bwE2iPkLPY2D8vfQHGO4N/9rZtKZjslMCZdZsrsBHCRx0p FgKSw6XPVEutPgXtzx0uT7X0= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 5DA682C01F; Mon, 1 Jun 2020 22:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=luna2; t=1591050948; bh=DKSMR89OXoGHotawrB+d0+DYBl8gy5lnhLAk9sSx0U4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=iBOAj3wF42UAut6Fc3r0y6gWkns+HZSEOGO30tXA5cqLcHhSJxYebRBYwEXoKSDY6 EaJKEfq1spIH3BDKizHGxLwYMwgtv8DnOMVeTfy3CtcLsxtoOC0G16tkOSW5rLRmze iAqgjEdjZXIR5fVta5Qqcfc0LCmX0/Nz8Il2VxC69ktmP+THpIUm5MATWOxYDJ3RD5 lRnkRizh4PpUU3FBiYi9tJ/zVQ7P4jO6sMk8Vs2F6ORJem9JSR10JV66RpSSvKPa/A Qag9c7QEXTNTKCdxT8haTpK/Zw0steM60ON90OAkJBP2DBhdVa9EQj0ndIYsjzXbU5 Be8HlClYuKZG5vCc68FYm0DZ+GdzAuw3Brv4+KMI7JYG5r2A2j3zkIV7FiXw6qBcpP jJgxRPepqsMEduKIB/HJMJIpubazS71X43WI69x9XZ081WPrxU4ovP/94bJHS8kXrc njfLr+DrdSfy3ErD69/4oipHNl4GKQkjiEo2S668Vgb0hBKFDWY/vqBhuA0Q4beObU N4DyVltRSmQiFriPIRfv/PN8AVY0RHKIUDj0TXAvuyXL6kb9nnWLbL07EGC1uY8dz+ MvLttM9pVmKk2jjUT42p83bRT9YK3LLM2UFDr01+puTkSrFBB/FOrmND/K3MVI+MGa VtdTAVx/sY1ewyowlJSl3Di0= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id A22EB2C01A for ; Mon, 1 Jun 2020 22:35:45 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by luna.archlinux.org (Postfix) with ESMTPS for ; Mon, 1 Jun 2020 22:35:45 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id AB58C1C76660BB; Mon, 1 Jun 2020 22:35:44 +0000 (UTC) Received: from localhost.localdomain (unknown [IPv6:2001:8a0:f254:2300:34be:8c97:bb49:e7fd]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ffy00) by orion.archlinux.org (Postfix) with ESMTPSA; Mon, 1 Jun 2020 22:35:44 +0000 (UTC) From: =?utf-8?q?Filipe_La=C3=ADns?= To: aur-dev@archlinux.org Cc: =?utf-8?q?Filipe_La=C3=ADns?= Subject: [PATCH v2 3/5] isort: add initial config Date: Mon, 1 Jun 2020 23:35:27 +0100 Message-Id: <20200601223529.3006974-3-lains@archlinux.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601223529.3006974-1-lains@archlinux.org> References: <20200601223529.3006974-1-lains@archlinux.org> MIME-Version: 1.0 X-BeenThere: aur-dev@archlinux.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "Arch User Repository \(AUR\) Development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: aur-dev-bounces@archlinux.org Sender: "aur-dev" Signed-off-by: Filipe Laíns --- setup.cfg | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup.cfg b/setup.cfg index 04f5b8ba..b868c096 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,3 +2,7 @@ max-line-length = 127 max-complexity = 10 +[isort] +line_length = 127 +lines_between_types = 1 + From patchwork Mon Jun 1 22:35:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Filipe_La=C3=ADns?= X-Patchwork-Id: 1665 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id D721C191E47B1 for ; Mon, 1 Jun 2020 22:36:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1, MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,SPF_HELO_NONE=0.001, T_DMARC_POLICY_NONE=0.01 autolearn=ham autolearn_force=no version=3.4.4 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Mon, 1 Jun 2020 22:36:42 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 757B81C7666137; Mon, 1 Jun 2020 22:36:01 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: luna) by orion.archlinux.org (Postfix) with ESMTPSA id 637641C76660E4; Mon, 1 Jun 2020 22:35:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1591050950; bh=11N06AzXNTXA85kqBAkD25v7oFlbAHkYqYONRPFSWVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=w4bB6Mljv+n24aInVvuQODiYuiSvQ+DPZ2SwMkmc2uJbPxes1jz0WxymizB81zsrt 8OjfKqGcZLntaV9M27ge1LVbiNQ9gD0cPOu9cqKOVZWAT/cQcQcyIrNFs9IsPlvJE+ e5IpyoC3JjX8OKYXr3761/IXALY4DHM3tkmjSXzUk/G71gxhJwnOfApcSZi6FNahjM lyJZ/Fa4evfdS+PYusmJTCwIZsQmc0ePBWmMf7YUBCyf3tEZ1EJQ/jP9M1ZQpw+DZw PN/p5lBgK57aRfGhMGHMEbYsAtftPs9d74qdx0uP/K9n6sRaTOkjlsm8yU4NrSeGlR yBCz5IAe2rqBic+nlK97K54nEi4j3930fGZTdVPMDiLeUFu5oNJkGJ3yBaqM1vZHWO Ux5r/vNwxNGL8Z3ORuKjn2Q1C0nf7REJS5TKPWno7pl/Ote8JhgY/GboBqIiXVhqjZ 3CJYn60LQYSrDpnriPQclxua0Db4fFVPYCIr5KvFNjr6sPvfQ+1iU2lJ6pn1kQnPru qFg2Ru6ERWDL2HKwaNwjKlIGYXeKXAimSszgukDMaUKdlHRLwl2LM/4pQDQdgRUQNY ifjgLuZUZJE+8s8LxdBUgeP+BPsVoRbvUWZ3luZLGxoxaGY76qlTV+pwNf1yOmooAZ KmHtTVUToHutYZWgJPrlEPMU= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 911302C01D; Mon, 1 Jun 2020 22:35:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=luna2; t=1591050949; bh=11N06AzXNTXA85kqBAkD25v7oFlbAHkYqYONRPFSWVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=e484d1kvXhgUXp8gUeNKGAvPgD2NlkLb6NLYx+DuN9adLYkP8ghuNcL+G6i1vOvYA MxamjSfHa9+HWD1IPQkGgRwCzuJTW5M+q12whITXdrlHsb0Cm5YMUTbJRZOjBUWC6T Uh54enHL+2ZDu2lay1ZywOx8lna/dAPJ7XoNV+5vS7rYVa5sJs2pAKbDpz4+YxVDyr JdIPra5qXYqGL2+2jJkzoggrbBs31SWoDmaZRn5PCYV1fd1nXag7ROwIcZpNU9tMkE k7hmSFD4UUMf0eyBeUhDeO/eGfJoiaWzGqIQWAYe3g7oMTnmkNZqkdiIHbfZ1c65TX zqoOoohnMYeXzOJ9qWm4bVw005yyW7UzhlgHeSqVn+RJsTvKxqZmywMdK4rxnXRC/W wowdi5WiTlyrOoCraIjHyEtI5B5CMS6pJMX1JCE0v6diZqLnPbLxphs0jfMDqGLT+9 Y2WbQS/PQGLMSGfODa8fhPBIZ41WlTokH5QBjiZn5UQ3OVYWblSZmvdz+8g0qWAQVA dYFjhCQMnipxGDW6CYnzwyo7EvY/QtXsThdXPUQDeKLRMRER4kbXVkJFpJr+5O67Dr V9cKClwKLreUjzQfJTbtMSocxwWUOrppg5i0cABkgaXAOXB9vQOzm8YXkS2Xlarol1 OchcM3ovD+2RLzqEeut8SVWM= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id C87B12BE6F for ; Mon, 1 Jun 2020 22:35:46 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Mon, 1 Jun 2020 22:35:46 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id DE47B1C76660BD; Mon, 1 Jun 2020 22:35:45 +0000 (UTC) Received: from localhost.localdomain (unknown [IPv6:2001:8a0:f254:2300:34be:8c97:bb49:e7fd]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ffy00) by orion.archlinux.org (Postfix) with ESMTPSA; Mon, 1 Jun 2020 22:35:45 +0000 (UTC) From: =?utf-8?q?Filipe_La=C3=ADns?= To: aur-dev@archlinux.org Cc: =?utf-8?q?Filipe_La=C3=ADns?= Subject: [PATCH v2 4/5] pre-commit: add initial config Date: Mon, 1 Jun 2020 23:35:28 +0100 Message-Id: <20200601223529.3006974-4-lains@archlinux.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601223529.3006974-1-lains@archlinux.org> References: <20200601223529.3006974-1-lains@archlinux.org> MIME-Version: 1.0 X-BeenThere: aur-dev@archlinux.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "Arch User Repository \(AUR\) Development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: aur-dev-bounces@archlinux.org Sender: "aur-dev" Signed-off-by: Filipe Laíns --- .pre-commit-config.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..525c7eb8 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,24 @@ +hooks: + - &base + language: python + types: [python] + require_serial: true + exclude: ^migrations/versions + - &flake8 + id: flake8 + name: flake8 + entry: flake8 + <<: *base + - &isort + id: isort + name: isort + entry: isort + <<: *base + +repos: + - repo: local + hooks: + - <<: *flake8 + - <<: *isort + args: ['--check-only', '--diff'] + From patchwork Mon Jun 1 22:35:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Filipe_La=C3=ADns?= X-Patchwork-Id: 1666 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 6AA78191E4852 for ; Mon, 1 Jun 2020 22:37:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1, MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,SPF_HELO_NONE=0.001, T_DMARC_POLICY_NONE=0.01 autolearn=ham autolearn_force=no version=3.4.4 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Mon, 1 Jun 2020 22:37:01 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 056C61C766619D; Mon, 1 Jun 2020 22:36:40 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: luna) by orion.archlinux.org (Postfix) with ESMTPSA id 577991C766615D; Mon, 1 Jun 2020 22:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1591050970; bh=dDa53ljuaKmTjY8g1F6CCJouml3NlT2BFpXZGZw5qs4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=jKWMHmnCZ8+bKVrgZ3RldhaqSxtwVJN7Fx2mwBQ9+/8Fn5MCIK3roKLm/bb3x7Bok GR49A29GB2FWLqeFfNKBIamVB00BTO5vocvGLJk/io7xIqpWHYSHrnc0c2dpjGta3G 1gymesdzgV5LD5+r2Bn93Z5UhjqOAbBJYmONhNknU8wQlqeT5hZx3P9eeO1ctjYhaV yRTNUfzDUhL17RDDvukA5rv3vcyDG6XL8Ip2tj3K8ryoo6AQhQddHyZCiQx+UGlIOy nOZ+gsQHOxBkLEDO0UMBRelu6mXUq8Qu8vpDsR3jHqZpsbDs9GXyob08Eo0iBXVAhZ qikGErvKS2cnwIHVm5d8lV2Q8Acifz75q7y5RIxtX704HTNqo7WUN/U7HfrJg1h39d bUy4IFZuDzW1uEfwWnS7keS2kzbqpHwDig9aSx4P9WWQvBACwnv8Z23pjrtgFHY4aO bl5amEQYB25Acq+RDn1DEl+NyZwH8kTVHezEfbMAWY9IfdpIiynql9LOktmhWMFGiS SzKC0QC0syw35O0DKlzsv0iFYHmHjoeLe/7+bIoS0PSOJIHCO0U6jjwe/wsU1OMVkW 6f8/Ycwi+z91ReTppHkxHhVPBFMGCMpFttksSuTlAzDf8eqXRhizWHanJe2DU80/UF WHwWBMOCHemaAIteYiuqMJJw= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id C002C2C01F; Mon, 1 Jun 2020 22:35:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=luna2; t=1591050955; bh=dDa53ljuaKmTjY8g1F6CCJouml3NlT2BFpXZGZw5qs4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=leMXI9J6+PHkz8eEaugHErR2oDYoUoMnBsXbKnjnzDQbNqZmO4QWhKuDMjI/XSV7L G4bB601FgV1i2isKLZ0HSH9SMwXv7W5FBOsi3YohsIjJlX4fg+xinpgSjAShWMu2D9 0ke+uNoYet7r74LbTj1R/p4p9GxeHrwOOVfj8q+dk4hxf6XKXT6R8z39GUck5bTbas y1l2NYKynSKcIfxfcIX0IdH3su6oSbhDcPfO002tYiUrvw76OeIBE1hdFtLnt7YjGg nrTU9GBTCuGg4/lRUhr9hqqmYReD6OYq3dZjgm6HdHDtGczZaWL5G/ufim7+6ANnhX ri7RkGiF9K2YoBkftEzgxf9dmPlMA1C/CAvWiVvRvJZiRZWK+ERl+r63xuYpUsaKXF Y4thFF3yOUmX10vuSRACQ6QWU0ic+7Dfru4YUeb3i6LI0F0msgT6AMviFkmSMrFBt+ ayrtRSH3zZazozjEe9Pybma76q6D6q209rWPBiUO67ztvbBDmKSDATX2ZUAomRmmU7 DslxiPNWgS4tx9yAnoI78wFfNLvhkN/6e0dxGghn6FWC+JcuFvZw6OvO5VmfC/aPgB P7n65J5lCEFU5lUnLVFhQC2iPWWCH+B9JFCPbk56/ZZB9ACFEIKi4P2kXhPh9lrOJg gDsr9SPXqb28M0dWnGvTe6pc= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 47A4B2C01A for ; Mon, 1 Jun 2020 22:35:52 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Mon, 1 Jun 2020 22:35:52 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 45A531C76660C5; Mon, 1 Jun 2020 22:35:47 +0000 (UTC) Received: from localhost.localdomain (unknown [IPv6:2001:8a0:f254:2300:34be:8c97:bb49:e7fd]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ffy00) by orion.archlinux.org (Postfix) with ESMTPSA; Mon, 1 Jun 2020 22:35:46 +0000 (UTC) From: =?utf-8?q?Filipe_La=C3=ADns?= To: aur-dev@archlinux.org Cc: =?utf-8?q?Filipe_La=C3=ADns?= Subject: [PATCH v2 5/5] add CONTRIBUTING.md Date: Mon, 1 Jun 2020 23:35:29 +0100 Message-Id: <20200601223529.3006974-5-lains@archlinux.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601223529.3006974-1-lains@archlinux.org> References: <20200601223529.3006974-1-lains@archlinux.org> MIME-Version: 1.0 X-BeenThere: aur-dev@archlinux.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "Arch User Repository \(AUR\) Development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: aur-dev-bounces@archlinux.org Sender: "aur-dev" Signed-off-by: Filipe Laíns --- CONTRIBUTING.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..a37d980a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# Contributing + +Patches should be sent to the [aur-dev@archlinux.org][1] mailing list. + +Before sending patched you are recomended to run the `flake8` and `isort`. + +You can add git hook to do this by installing `python-pre-install` and running +`pre-install install`. + +[1] https://lists.archlinux.org/listinfo/aur-dev