From c87d8800424a5eaab71667f585205ac3d3298dfa Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Tue, 23 Jun 2026 22:05:52 -0400 Subject: [PATCH] Standardize backend/tools file headers Give all three tools the same header shape: shebang, summary docstring, a short detail paragraph, and a "Run from the backend directory:" command block. Adds docstrings to generate_supported_platforms.py and xml_diagnostics.py, which previously had none. Co-Authored-By: Claude Opus 4.8 (1M context) --- backend/tools/generate_supported_platforms.py | 13 ++++++++++++- backend/tools/xml_diagnostics.py | 14 +++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/backend/tools/generate_supported_platforms.py b/backend/tools/generate_supported_platforms.py index 8c763a7d5..85ec4f372 100644 --- a/backend/tools/generate_supported_platforms.py +++ b/backend/tools/generate_supported_platforms.py @@ -1,4 +1,15 @@ -# uv run python -m tools.generate_supported_platforms +#!/usr/bin/env python3 +"""Print the supported-platforms table (Markdown) for the docs. + +Walks every UniversalPlatformSlug, collects each metadata provider's +platform mapping, and emits a Markdown table (with provider link icons) to +stdout for pasting into the documentation. + +Run from the backend directory: + + uv run python -m tools.generate_supported_platforms +""" + from typing import TypedDict from urllib.parse import quote diff --git a/backend/tools/xml_diagnostics.py b/backend/tools/xml_diagnostics.py index 81f4df6c8..28e4b272a 100644 --- a/backend/tools/xml_diagnostics.py +++ b/backend/tools/xml_diagnostics.py @@ -1,3 +1,15 @@ +#!/usr/bin/env python3 +"""Diagnose a malformed XML file: bad encoding, invalid chars, parse errors. + +Reads the file in chunks to surface UTF-8 issues, then runs SAX and +ElementTree parsing to report the location of structural errors, with a few +lines of context around each one. + +Run from the backend directory: + + uv run tools/xml_diagnostics.py +""" + import sys from xml.sax.handler import ContentHandler # nosec @@ -79,6 +91,6 @@ def diagnose_xml(filename): if __name__ == "__main__": if len(sys.argv) != 2: - print("Usage: python script.py ") + print("Usage: uv run tools/xml_diagnostics.py ") sys.exit(1) diagnose_xml(sys.argv[1])