From 264edabd8c37c789606b75a070fd0fec44caa0e5 Mon Sep 17 00:00:00 2001 From: baalajimaestro Date: Sun, 25 Sep 2022 13:04:39 +0530 Subject: [PATCH] Reformat with black Signed-off-by: baalajimaestro --- encrypt.py | 34 +++++++++++++++++++++++----------- trigger.py | 12 +++++++++--- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/encrypt.py b/encrypt.py index 6fcf566..af7a724 100644 --- a/encrypt.py +++ b/encrypt.py @@ -11,7 +11,14 @@ from glob import glob import subprocess from time import time -BLACKLIST = [".git", ".obsidian", ".idea", ".gitlab-ci.yml", ".encrypt.py", ".trigger.py"] +BLACKLIST = [ + ".git", + ".obsidian", + ".idea", + ".gitlab-ci.yml", + ".encrypt.py", + ".trigger.py", +] enc_path = os.environ.get("ENCRYPTED_PATH") enc_repo = os.environ.get("ENCRYPTED_REPO") @@ -26,13 +33,18 @@ os.mkdir(enc_path) os.chdir(enc_path) repo = Repo.init(enc_path) -repo.create_remote("origin", f"https://{enc_repo_user}:{enc_repo_pass}@github.com/baalajimaestro/{enc_repo}.git") +repo.create_remote( + "origin", + f"https://{enc_repo_user}:{enc_repo_pass}@github.com/baalajimaestro/{enc_repo}.git", +) -file_list = glob(base_dir+'/**/.*', recursive=True) + glob(base_dir+'/**/*', recursive=True) +file_list = glob(base_dir + "/**/.*", recursive=True) + glob( + base_dir + "/**/*", recursive=True +) for i in file_list: if os.path.isdir(i): - rel_path = i.split(base_dir+"/")[1] + rel_path = i.split(base_dir + "/")[1] for j in BLACKLIST: if rel_path in j: break @@ -40,14 +52,15 @@ for i in file_list: os.mkdir(enc_path + "/" + rel_path) for i in file_list: - rel_path = i.split(base_dir+"/")[1] + rel_path = i.split(base_dir + "/")[1] if not os.path.isdir(i): for j in BLACKLIST: if rel_path in j: break else: process = subprocess.run( - ["openssl", + [ + "openssl", "enc", "-chacha20", "-base64", @@ -61,13 +74,12 @@ for i in file_list: "-in", i, "-out", - enc_path+"/"+rel_path] + enc_path + "/" + rel_path, + ] ) repo.git.add(".") -repo.index.commit( - f"Commit as of {current_time}" -) +repo.index.commit(f"Commit as of {current_time}") -repo.git.push('origin', 'master', force=True) \ No newline at end of file +repo.git.push("origin", "master", force=True) diff --git a/trigger.py b/trigger.py index fb16100..65f4fa3 100644 --- a/trigger.py +++ b/trigger.py @@ -22,9 +22,15 @@ repo.create_tag(current_time) if repo.remote("pushback").exists(): repo.remote().remove(repo, "pushback") -repo.create_remote("pushback", f"https://{base_repo_user}:{base_repo_pass}@git.baalajimaestro.me/baalajimaestro/{content_repo_git}.git") -repo.git.push('pushback', current_time) +repo.create_remote( + "pushback", + f"https://{base_repo_user}:{base_repo_pass}@git.baalajimaestro.me/baalajimaestro/{content_repo_git}.git", +) +repo.git.push("pushback", current_time) data = {"token": gitlab_token, "ref": "source"} -post(f"https://git.baalajimaestro.me/api/v4/projects/{content_repo_id}/trigger/pipeline", json = data) \ No newline at end of file +post( + f"https://git.baalajimaestro.me/api/v4/projects/{content_repo_id}/trigger/pipeline", + json=data, +)