From 998b353ad67989f9720f9bfdfe5ffeeaefe0ebdf Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Sep 23 2018 13:16:43 +0000 Subject: Run black on the entire project Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/hooks/default.py b/pagure/hooks/default.py index 3370dcf..3e5477b 100644 --- a/pagure/hooks/default.py +++ b/pagure/hooks/default.py @@ -234,8 +234,7 @@ class DefaultRunner(BaseRunner): """ if repotype != "main": if _config.get("HOOK_DEBUG", False): - print( - "Default hook only runs on the main project repository") + print("Default hook only runs on the main project repository") return if changes: @@ -260,7 +259,8 @@ class DefaultRunner(BaseRunner): elif pagure.lib.git.is_forced_push(oldrev, newrev, repodir): forced = True base = pagure.lib.git.get_base_revision( - oldrev, newrev, repodir) + oldrev, newrev, repodir + ) if base: oldrev = base[0] @@ -294,8 +294,8 @@ class DefaultRunner(BaseRunner): # This one is sending fedmsg and web-hook notifications for project # that set them up send_notifications( - session, project, repodir, username, refname, commits, - forced) + session, project, repodir, username, refname, commits, forced + ) # Now display to the user if this isn't the default branch links to # open a new pr or review the existing one diff --git a/pagure/hooks/fedmsg.py b/pagure/hooks/fedmsg.py index a03a660..c0ce4e6 100644 --- a/pagure/hooks/fedmsg.py +++ b/pagure/hooks/fedmsg.py @@ -59,6 +59,7 @@ class FedmsgRunner(BaseRunner): """ Runner for the fedmsg hook, it does nothing as all the magic is part of the default hook/runner. """ + pass diff --git a/pagure/hooks/mirror_hook.py b/pagure/hooks/mirror_hook.py index 7fad829..f9fa672 100644 --- a/pagure/hooks/mirror_hook.py +++ b/pagure/hooks/mirror_hook.py @@ -76,8 +76,7 @@ class MirrorRunner(BaseRunner): print("Running the default hook") if repotype != "main": if _config.get("HOOK_DEBUG", False): - print( - "Default hook only runs on the main project repository") + print("Default hook only runs on the main project repository") return pagure.lib.tasks_mirror.mirror_project.delay( diff --git a/pagure/hooks/pagure_ci.py b/pagure/hooks/pagure_ci.py index 9b65359..4dc6f77 100644 --- a/pagure/hooks/pagure_ci.py +++ b/pagure/hooks/pagure_ci.py @@ -62,12 +62,12 @@ class PagureCITable(BASE): ) - class PagureCIRunner(BaseRunner): """ Runner for the pagure-ci hook, it does nothing as the magic is part of the CI system itself (to see if there was a commit made and build if so). """ + pass diff --git a/pagure/hooks/pagure_request_hook.py b/pagure/hooks/pagure_request_hook.py index c582d83..65ccd7c 100644 --- a/pagure/hooks/pagure_request_hook.py +++ b/pagure/hooks/pagure_request_hook.py @@ -76,7 +76,8 @@ class PagureRequestRunner(BaseRunner): if repotype != "requests": print( "The pagure requests hook only runs on the requests " - "git repo.") + "git repo." + ) return for refname in changes: diff --git a/pagure/internal/__init__.py b/pagure/internal/__init__.py index ba562c9..8ce735b 100644 --- a/pagure/internal/__init__.py +++ b/pagure/internal/__init__.py @@ -227,18 +227,18 @@ def mergeable_request_pull(): ) except pygit2.GitError as err: response = flask.jsonify( - {"code": "CONFLICTS", "message": "%s" % err}) + {"code": "CONFLICTS", "message": "%s" % err} + ) response.status_code = 409 return response except pagure.exceptions.PagureException as err: response = flask.jsonify( - {"code": "CONFLICTS", "message": "%s" % err}) + {"code": "CONFLICTS", "message": "%s" % err} + ) response.status_code = 500 return response - return flask.jsonify( - pagure.utils.get_merge_options(request, merge_status) - ) + return flask.jsonify(pagure.utils.get_merge_options(request, merge_status)) @PV.route("/pull-request/ready", methods=["POST"]) @@ -297,17 +297,10 @@ def get_pull_request_ready_branch(): response.status_code = 400 return response task = pagure.lib.tasks.pull_request_ready_branch.delay( - namespace=args_namespace, - name=args_reponame, - user=args_user, + namespace=args_namespace, name=args_reponame, user=args_user ) - return flask.jsonify( - { - "code": "OK", - "task": task.id, - } - ) + return flask.jsonify({"code": "OK", "task": task.id}) @PV.route("//issue/template", methods=["POST"]) diff --git a/pagure/lib/model.py b/pagure/lib/model.py index 5aa0093..0759b96 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -2237,7 +2237,7 @@ class PullRequestFlag(BASE): backref=backref( "flags", order_by=str("(pull_request_flags.c.date_created).desc()"), - cascade="delete, delete-orphan" + cascade="delete, delete-orphan", ), foreign_keys=[pull_request_uid], remote_side=[PullRequest.uid], diff --git a/pagure/lib/tasks_services.py b/pagure/lib/tasks_services.py index cafcc6a..3713c35 100644 --- a/pagure/lib/tasks_services.py +++ b/pagure/lib/tasks_services.py @@ -383,7 +383,8 @@ def load_json_commits_to_db( @conn.task(queue=pagure_config.get("CI_CELERY_QUEUE", None), bind=True) @pagure_task def trigger_ci_build( - self, session, cause, branch, ci_type, project_name=None, pr_uid=None): + self, session, cause, branch, ci_type, project_name=None, pr_uid=None +): """ Triggers a new run of the CI system on the specified pull-request. diff --git a/pagure/utils.py b/pagure/utils.py index 74e84e5..25165ca 100644 --- a/pagure/utils.py +++ b/pagure/utils.py @@ -526,12 +526,13 @@ def get_merge_options(request, merge_status): "code": "CONFLICTS", "short_code": "Conflicts", "message": "The pull-request must be rebased before merging", - } + }, } if merge_status == "MERGE": if request.project.settings.get( - "disable_non_fast-forward_merges", False): + "disable_non_fast-forward_merges", False + ): merge_status += "-non-ff-bad" else: merge_status += "-non-ff-ok"