style: Reformat code with linter

This commit is contained in:
Paul Gauthier (aider) 2025-03-26 07:01:19 -10:00
parent 02bc926d75
commit 7b97f93051

View file

@ -4,10 +4,10 @@ Generate a celebratory SVG image for Aider reaching 30,000 GitHub stars.
This creates a shareable social media graphic with confetti animation. This creates a shareable social media graphic with confetti animation.
""" """
import argparse
import base64
import os import os
import random import random
import base64
import argparse
from pathlib import Path from pathlib import Path
# Default colors for the celebration image # Default colors for the celebration image
@ -25,7 +25,9 @@ DEFAULT_HEIGHT = 630
def embed_font(): def embed_font():
"""Returns base64 encoded font data for the GlassTTYVT220 font.""" """Returns base64 encoded font data for the GlassTTYVT220 font."""
# Path to the font file # Path to the font file
font_path = Path(__file__).parent.parent / "aider" / "website" / "assets" / "Glass_TTY_VT220.ttf" font_path = (
Path(__file__).parent.parent / "aider" / "website" / "assets" / "Glass_TTY_VT220.ttf"
)
# If font file doesn't exist, return empty string # If font file doesn't exist, return empty string
if not font_path.exists(): if not font_path.exists():
@ -37,7 +39,7 @@ def embed_font():
font_data = f.read() font_data = f.read()
# Return base64 encoded font data # Return base64 encoded font data
return base64.b64encode(font_data).decode('utf-8') return base64.b64encode(font_data).decode("utf-8")
def generate_confetti(count=150, width=DEFAULT_WIDTH, height=DEFAULT_HEIGHT): def generate_confetti(count=150, width=DEFAULT_WIDTH, height=DEFAULT_HEIGHT):
@ -176,7 +178,7 @@ def generate_celebration_svg(output_path=None, width=DEFAULT_WIDTH, height=DEFAU
# Write to file if output path is specified # Write to file if output path is specified
if output_path: if output_path:
with open(output_path, 'w') as f: with open(output_path, "w") as f:
f.write(svg_content) f.write(svg_content)
print(f"Celebration SVG saved to {output_path}") print(f"Celebration SVG saved to {output_path}")
@ -184,13 +186,30 @@ def generate_celebration_svg(output_path=None, width=DEFAULT_WIDTH, height=DEFAU
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Generate a celebration SVG for Aider's 30K GitHub stars") parser = argparse.ArgumentParser(
parser.add_argument('--output', '-o', type=str, default="aider-30k-stars.svg", description="Generate a celebration SVG for Aider's 30K GitHub stars"
help="Output file path (default: aider-30k-stars.svg)") )
parser.add_argument('--width', '-w', type=int, default=DEFAULT_WIDTH, parser.add_argument(
help=f"Image width in pixels (default: {DEFAULT_WIDTH})") "--output",
parser.add_argument('--height', '-ht', type=int, default=DEFAULT_HEIGHT, "-o",
help=f"Image height in pixels (default: {DEFAULT_HEIGHT})") type=str,
default="aider-30k-stars.svg",
help="Output file path (default: aider-30k-stars.svg)",
)
parser.add_argument(
"--width",
"-w",
type=int,
default=DEFAULT_WIDTH,
help=f"Image width in pixels (default: {DEFAULT_WIDTH})",
)
parser.add_argument(
"--height",
"-ht",
type=int,
default=DEFAULT_HEIGHT,
help=f"Image height in pixels (default: {DEFAULT_HEIGHT})",
)
args = parser.parse_args() args = parser.parse_args()
# Generate the SVG # Generate the SVG