8/8 chore(scripts): minor cleanup to setup_workflow.py

Some whitespace failed checks

Signed-off-by: nopeitsnothing <no@anonymousplanet.org>
This commit is contained in:
nopeitsnothing
2026-05-22 16:26:25 -04:00
parent bb005772af
commit 4fd0413f4b
+12 -9
View File
@@ -18,17 +18,21 @@ What it does:
3. Provides instructions for adding secrets to GitHub 3. Provides instructions for adding secrets to GitHub
""" """
# The Hitchhiker's Guide to Online Anonymity © 2026 by Anonymous Planet is licensed under Creative
# Commons Attribution-NonCommercial 4.0 International
from __future__ import annotations from __future__ import annotations
import subprocess import subprocess
import sys import sys
from pathlib import Path from pathlib import Path
# Computes the root directory of the repository based on the current files location
def repo_root() -> Path: def repo_root() -> Path:
return Path(__file__).resolve().parent.parent return Path(__file__).resolve().parent.parent
# Determines whether the GPG command-line tool is available on the current system
def check_gpg_installed() -> bool: def check_gpg_installed() -> bool:
"""Check if GPG is installed and accessible.""" """Check if GPG is installed and accessible."""
try: try:
@@ -42,7 +46,8 @@ def check_gpg_installed() -> bool:
except (FileNotFoundError, subprocess.TimeoutExpired): except (FileNotFoundError, subprocess.TimeoutExpired):
return False return False
# Checks whether the GPG tool is installed and accessible on the system
# Export public keys, parse, and read selection of keys from the GPG keyring
def list_gpg_keys() -> list[dict]: def list_gpg_keys() -> list[dict]:
"""List all GPG keys in the keyring.""" """List all GPG keys in the keyring."""
try: try:
@@ -82,7 +87,6 @@ def list_gpg_keys() -> list[dict]:
print(f"Error listing GPG keys: {e}") print(f"Error listing GPG keys: {e}")
return [] return []
def export_public_key(key_id: str, output_file: Path | None = None) -> str | None: def export_public_key(key_id: str, output_file: Path | None = None) -> str | None:
"""Export a public key in ASCII armor format.""" """Export a public key in ASCII armor format."""
try: try:
@@ -103,7 +107,7 @@ def export_public_key(key_id: str, output_file: Path | None = None) -> str | Non
print(f"Error exporting public key: {e}") print(f"Error exporting public key: {e}")
return None return None
# Exporting the given private key in ASCII armor format (requires passphrase)
def export_private_key(key_id: str, output_file: Path | None = None) -> str | None: def export_private_key(key_id: str, output_file: Path | None = None) -> str | None:
"""Export a private key in ASCII armor format (requires passphrase).""" """Export a private key in ASCII armor format (requires passphrase)."""
try: try:
@@ -120,12 +124,12 @@ def export_private_key(key_id: str, output_file: Path | None = None) -> str | No
print(f"✓ Private key exported to {output_file}") print(f"✓ Private key exported to {output_file}")
return result.stdout return result.stdout
# return None if export fails (e.g. wrong passphrase, key not found)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
print(f"Error exporting private key: {e}") print(f"Error exporting private key: {e}")
return None return None
# Validate that the selected GPG key has signing capability
def validate_gpg_key(key_id: str) -> bool: def validate_gpg_key(key_id: str) -> bool:
"""Validate that a GPG key has signing capability.""" """Validate that a GPG key has signing capability."""
try: try:
@@ -147,7 +151,7 @@ def validate_gpg_key(key_id: str) -> bool:
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
return False return False
# Print instructions for configuring GitHub Secrets
def print_setup_instructions(): def print_setup_instructions():
"""Print instructions for configuring GitHub Secrets.""" """Print instructions for configuring GitHub Secrets."""
print("\n" + "="*70) print("\n" + "="*70)
@@ -177,7 +181,6 @@ TROUBLESHOOTING:
- If VT scan fails: Ensure API key is valid and within rate limits - If VT scan fails: Ensure API key is valid and within rate limits
""") """)
def main() -> int: def main() -> int:
print("\n" + "="*70) print("\n" + "="*70)
print("PDF WORKFLOW SETUP HELPER") print("PDF WORKFLOW SETUP HELPER")