From 21333259a75f41bd0ec958b1dbcef6607291b2f3 Mon Sep 17 00:00:00 2001 From: Maciej Olko Date: Sun, 28 Sep 2025 00:53:04 +0200 Subject: [PATCH] Remove translators number It's incorrect. Ref. https://github.com/python-docs-translations/transifex-automations/issues/155 --- README.en.md | 5 +---- README.md | 5 +---- manage_translation.py | 37 +------------------------------------ 3 files changed, 3 insertions(+), 44 deletions(-) diff --git a/README.en.md b/README.en.md index c3e64ee58c..ccb9e102c7 100644 --- a/README.en.md +++ b/README.en.md @@ -1,22 +1,19 @@ Polish Translation of Python Documentation ========================================== [![build](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml/badge.svg)](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml) [![Total Translation of Documentation](https://img.shields.io/badge/total_words-5.41%25-0.svg)](https://python-docs-translations.github.io/dashboard/) [![Total Translation of Documentation](https://img.shields.io/badge/total_strings-12.57%25-0.svg)](https://python-docs-translations.github.io/dashboard/) -![3 Translators](https://img.shields.io/badge/Translators-3-0.svg) *Przeczytaj to w innym języku: [polski](README.md)* diff --git a/README.md b/README.md index 5b6b5bc8c7..f4076deda6 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,19 @@ Polskie tłumaczenie dokumentacji Pythona ======================================== [![build](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml/badge.svg)](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml) [![postęp tłumaczenia całości dokumentacji](https://img.shields.io/badge/całość_słów-5.41%25-0.svg)](https://python-docs-translations.github.io/dashboard/) [![postęp tłumaczenia całości dokumentacji](https://img.shields.io/badge/całość_napisów-12.57%25-0.svg)](https://python-docs-translations.github.io/dashboard/) -![3 tłumaczy](https://img.shields.io/badge/tłumaczy-3-0.svg) *Read this in another language: [English](README.en.md)* diff --git a/manage_translation.py b/manage_translation.py index a41b4a91c3..0266629e44 100755 --- a/manage_translation.py +++ b/manage_translation.py @@ -17,13 +17,11 @@ import os from contextlib import chdir from dataclasses import dataclass -from difflib import SequenceMatcher -from logging import info from pathlib import Path from subprocess import call, run, CalledProcessError import sys from tempfile import TemporaryDirectory -from typing import Self, Generator, Iterable +from typing import Self, Iterable from warnings import warn from polib import pofile, POFile @@ -163,39 +161,6 @@ def progress_from_resources( ) -def get_number_of_translators(): - translators = set(_fetch_translators()) - _remove_bot(translators) - translators = _eliminate_aliases(translators) - return len(translators) - - -def _fetch_translators() -> Generator[str, None, None]: - for file in Path().rglob('*.po'): - header = pofile(file).header.splitlines() - for translator_record in header[header.index('Translators:') + 1 :]: - translator, _year = translator_record.split(', ') - yield translator - - -def _remove_bot(translators: set[str]) -> None: - translators.remove('Transifex Bot <>') - - -def _eliminate_aliases(translators: set[str]) -> set[str]: - unique = set() - for name in translators: - for match in unique: - if ( - ratio := SequenceMatcher(lambda x: x in '<>@', name, match).ratio() - ) > 0.64: - info(f'{name} and {match} are similar ({ratio:.3f}). Deduplicating.') - break - else: - unique.add(name) - return unique - - def language_switcher(entry: ResourceLanguageStatistics) -> bool: language_switcher_resources_prefixes = ('bugs', 'tutorial', 'library--functions') return any(