🎨 Format Python code with Black
This commit is contained in:
parent
633084e22f
commit
12ae573ced
1 changed files with 17 additions and 5 deletions
|
@ -27,7 +27,13 @@ APP = Sanic(__name__)
|
||||||
|
|
||||||
@cache
|
@cache
|
||||||
def github_webhook_secret() -> str:
|
def github_webhook_secret() -> str:
|
||||||
return (TOOLS_DIR / ".github_webhook_secret").open("r", encoding="utf-8").read().strip()
|
return (
|
||||||
|
(TOOLS_DIR / ".github_webhook_secret")
|
||||||
|
.open("r", encoding="utf-8")
|
||||||
|
.read()
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@cache
|
@cache
|
||||||
def github_login() -> str:
|
def github_login() -> str:
|
||||||
|
@ -79,6 +85,7 @@ def check_webhook_signatures(request: Request) -> HTTPResponse | None:
|
||||||
return response.json({"error": "Bad signature ?!"}, 403)
|
return response.json({"error": "Bad signature ?!"}, 403)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def on_push(request: Request) -> HTTPResponse:
|
def on_push(request: Request) -> HTTPResponse:
|
||||||
data = request.json
|
data = request.json
|
||||||
repository = data["repository"]["full_name"]
|
repository = data["repository"]["full_name"]
|
||||||
|
@ -112,6 +119,7 @@ def on_push(request: Request) -> HTTPResponse:
|
||||||
|
|
||||||
return response.text("ok")
|
return response.text("ok")
|
||||||
|
|
||||||
|
|
||||||
def generate_and_commit_readmes(repo: Repo) -> bool:
|
def generate_and_commit_readmes(repo: Repo) -> bool:
|
||||||
assert repo.working_tree_dir is not None
|
assert repo.working_tree_dir is not None
|
||||||
generate_READMEs(Path(repo.working_tree_dir))
|
generate_READMEs(Path(repo.working_tree_dir))
|
||||||
|
@ -143,19 +151,23 @@ def git_repo_rebase_testing_fast_forward(repo: Repo) -> bool:
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("-d", "--debug", action="store_true")
|
parser.add_argument("-d", "--debug", action="store_true")
|
||||||
parser.add_argument("-u", "--unsafe", action="store_true",
|
parser.add_argument(
|
||||||
help="Disable Github signature checks on webhooks, for debug only.")
|
"-u",
|
||||||
|
"--unsafe",
|
||||||
|
action="store_true",
|
||||||
|
help="Disable Github signature checks on webhooks, for debug only.",
|
||||||
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.debug:
|
if args.debug:
|
||||||
logging.getLogger().setLevel(logging.DEBUG)
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
global DEBUG, UNSAFE
|
global DEBUG, UNSAFE
|
||||||
DEBUG = args.debug
|
DEBUG = args.debug
|
||||||
UNSAFE = args.unsafe
|
UNSAFE = args.unsafe
|
||||||
|
|
||||||
APP.run(host="127.0.0.1", port=8123, debug=args.debug)
|
APP.run(host="127.0.0.1", port=8123, debug=args.debug)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue