INNER CODE UNIT · Python

main

WenyuChiou/awesome-agentic-ai-zh · scripts/build-banner.py:248

def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--locale", choices=LOCALES)
    parser.add_argument("--check", action="store_true")
    parser.add_argument("--png", action="store_true", help="Export static PNG from the same embedded artwork (Pillow)")
    parser.add_argument("--import-original", action="store_true", help="Import artwork from the pinned pre-experiment commit")
    args = parser.parse_args()
    if args.check and (args.png or args.import_original):
        parser.error("--check is read-only")
    for locale in [args.locale] if args.locale else LOCALES:
        target=ROOT/f'resources/diagrams/banner{LOCALES[locale]["suffix"]}.svg'
        art=import_original(locale) if args.import_original else read_art(locale)
        expected=build_svg(locale,art)
        if args.check:
            if target.read_text(encoding="utf-8") != expected:
                raise SystemExit(f"Regenerate {target.name}")
        else:
            target.write_text(expected,encoding="utf-8",newline="\n")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…