From d38e8b19ef6d3fc2fed25ea9e6492c48241b19a8 Mon Sep 17 00:00:00 2001 From: Mounir Messelmeni Date: Tue, 27 Jan 2026 19:15:59 +0100 Subject: [PATCH] Fix argparse help string formatting for Python 3.14 compatibility - Escape % characters as %% in untranslated_messages.py metavar and help text - Resolves ValueError: unsupported format character when displaying --help - Maintains backward compatibility with older Python versions --- .github/workflows/ci.yml | 17 +++++++++-------- pre_commit_po_hooks/untranslated_messages.py | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24e873b..91f87c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,10 +16,11 @@ jobs: strategy: matrix: python-version: - - 3.7 - - 3.8 - - 3.9 - - '3.10' + - "3.10" + - "3.11" + - "3.12" + - "3.13" + - "3.14" steps: - uses: actions/checkout@v2 - name: Set up Python v${{ matrix.python-version }} @@ -43,9 +44,9 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - name: Install Python v3.8 + name: Install Python v3.13 with: - python-version: 3.8 + python-version: 3.13 - name: Build sdist run: python setup.py sdist - uses: actions/upload-artifact@v2 @@ -60,9 +61,9 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - name: Install Python v3.8 + name: Install Python v3.13 with: - python-version: 3.8 + python-version: 3.13 - name: Install wheel run: python -m pip install --upgrade wheel - name: Build wheel diff --git a/pre_commit_po_hooks/untranslated_messages.py b/pre_commit_po_hooks/untranslated_messages.py index 1b3af42..c4d1ee6 100644 --- a/pre_commit_po_hooks/untranslated_messages.py +++ b/pre_commit_po_hooks/untranslated_messages.py @@ -91,14 +91,14 @@ def main(): "-m", "--min", type=str, - metavar="N/N%", + metavar="N/N%%", required=False, default=None, dest="min", help=( "Minimum messages translated in each PO file to be considered valid." " You can pass either a float number optionally ending in a character" - " % to indicate that is a percentage of the total of translated" + " %% to indicate that is a percentage of the total of translated" " entries in each PO file." ), )