From 35eb4d3ee33dfac286a3c15cef5981b51bd68d86 Mon Sep 17 00:00:00 2001 From: tituspijean <8769166+tituspijean@users.noreply.github.com> Date: Sat, 17 Aug 2024 23:56:30 +0000 Subject: [PATCH] :art: Format Python code with Black --- tools/webhooks/webhook.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tools/webhooks/webhook.py b/tools/webhooks/webhook.py index 725420fa39..09db4062ed 100755 --- a/tools/webhooks/webhook.py +++ b/tools/webhooks/webhook.py @@ -205,6 +205,7 @@ def bump_revision(request: Request, pr_infos: dict) -> HTTPResponse: repo.remote().push(quiet=False, all=True) return response.text("ok") + def reject_wishlist(request: Request, pr_infos: dict, reason=None) -> HTTPResponse: data = request.json repository = data["repository"]["full_name"] @@ -212,7 +213,9 @@ def reject_wishlist(request: Request, pr_infos: dict, reason=None) -> HTTPRespon if repository == "YunoHost/apps" and branch.startswith("add-to-wishlist"): - logging.info(f"Will put the suggested app in the rejected list on {repository} branch {branch}...") + logging.info( + f"Will put the suggested app in the rejected list on {repository} branch {branch}..." + ) with tempfile.TemporaryDirectory() as folder_str: folder = Path(folder_str) repo = Repo.clone_from( @@ -221,14 +224,14 @@ def reject_wishlist(request: Request, pr_infos: dict, reason=None) -> HTTPRespon ) repo.git.checkout(branch) - rejectedlist_file = (folder / "rejectedlist.toml") + rejectedlist_file = folder / "rejectedlist.toml" rejectedlist = tomlkit.load(rejectedlist_file.open("r", encoding="utf-8")) - wishlist_file = (folder / "wishlist.toml") + wishlist_file = folder / "wishlist.toml" wishlist = tomlkit.load(wishlist_file.open("r", encoding="utf-8")) suggestedapp_slug = branch.replace("add-to-wishlist-", "") - suggestedapp = {suggestedapp_slug:wishlist[suggestedapp_slug]} + suggestedapp = {suggestedapp_slug: wishlist[suggestedapp_slug]} suggestedapp[suggestedapp_slug]["rejection_pr"] = pr_infos["html_url"] suggestedapp[suggestedapp_slug]["reason"] = reason @@ -242,12 +245,16 @@ def reject_wishlist(request: Request, pr_infos: dict, reason=None) -> HTTPRespon repo.git.add("wishlist.toml") suggestedapp_name = suggestedapp[suggestedapp_slug]["name"] - repo.index.commit(f"Reject {suggestedapp_name} from catalog", author=Actor("yunohost-bot", "yunohost@yunohost.org")) + repo.index.commit( + f"Reject {suggestedapp_name} from catalog", + author=Actor("yunohost-bot", "yunohost@yunohost.org"), + ) logging.debug(f"Pushing {repository}") repo.remote().push(quiet=False, all=True, force=True) return response.text("ok") + def generate_and_commit_readmes(repo: Repo) -> bool: assert repo.working_tree_dir is not None generate_READMEs(Path(repo.working_tree_dir))