Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit003ca9a

Browse files
authored
Remove translators number (#112)
1 parent3fa4c2e commit003ca9a

File tree

3 files changed

+3
-44
lines changed

3 files changed

+3
-44
lines changed

‎README.en.md‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
Polish Translation of Python Documentation
22
==========================================
33
<!-- [[[cog
4-
from manage_translation import get_resource_language_stats, progress_from_resources, language_switcher, get_number_of_translators
4+
from manage_translation import get_resource_language_stats, progress_from_resources, language_switcher
55
66
stats = get_resource_language_stats()
77
total_words, total_strings = progress_from_resources(stats)
8-
translators = get_number_of_translators()
98
109
print(
1110
f'''[![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)
1211
[![Total Translation of Documentation](https://img.shields.io/badge/total_words-{total_words:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/)
1312
[![Total Translation of Documentation](https://img.shields.io/badge/total_strings-{total_strings:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/)
14-
![{translators} Translators](https://img.shields.io/badge/Translators-{translators}-0.svg)''')
1513
]]]-->
1614
[![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)
1715
[![Total Translation of Documentation](https://img.shields.io/badge/total_words-5.41%25-0.svg)](https://python-docs-translations.github.io/dashboard/)
1816
[![Total Translation of Documentation](https://img.shields.io/badge/total_strings-12.57%25-0.svg)](https://python-docs-translations.github.io/dashboard/)
19-
![3 Translators](https://img.shields.io/badge/Translators-3-0.svg)
2017
<!-- [[[end]]]-->
2118

2219
*Przeczytaj to w innym języku:[polski](README.md)*

‎README.md‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
Polskie tłumaczenie dokumentacji Pythona
22
========================================
33
<!-- [[[cog
4-
from manage_translation import get_resource_language_stats, progress_from_resources, get_number_of_translators
4+
from manage_translation import get_resource_language_stats, progress_from_resources
55
66
stats = get_resource_language_stats()
77
total_words, total_strings = progress_from_resources(stats)
8-
translators = get_number_of_translators()
98
109
print(
1110
f'''[![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)
1211
[![postęp tłumaczenia całości dokumentacji](https://img.shields.io/badge/całość_słów-{total_words:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/)
1312
[![postęp tłumaczenia całości dokumentacji](https://img.shields.io/badge/całość_napisów-{total_strings:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/)
14-
![{translators} tłumaczy](https://img.shields.io/badge/tłumaczy-{translators}-0.svg)''')
1513
]]]-->
1614
[![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)
1715
[![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/)
1816
[![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/)
19-
![3 tłumaczy](https://img.shields.io/badge/tłumaczy-3-0.svg)
2017
<!-- [[[end]]]-->
2118

2219
*Read this in another language:[English](README.en.md)*

‎manage_translation.py‎

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@
1717
importos
1818
fromcontextlibimportchdir
1919
fromdataclassesimportdataclass
20-
fromdifflibimportSequenceMatcher
21-
fromloggingimportinfo
2220
frompathlibimportPath
2321
fromsubprocessimportcall,run,CalledProcessError
2422
importsys
2523
fromtempfileimportTemporaryDirectory
26-
fromtypingimportSelf,Generator,Iterable
24+
fromtypingimportSelf,Iterable
2725
fromwarningsimportwarn
2826

2927
frompolibimportpofile,POFile
@@ -163,39 +161,6 @@ def progress_from_resources(
163161
)
164162

165163

166-
defget_number_of_translators():
167-
translators=set(_fetch_translators())
168-
_remove_bot(translators)
169-
translators=_eliminate_aliases(translators)
170-
returnlen(translators)
171-
172-
173-
def_fetch_translators()->Generator[str,None,None]:
174-
forfileinPath().rglob('*.po'):
175-
header=pofile(file).header.splitlines()
176-
fortranslator_recordinheader[header.index('Translators:')+1 :]:
177-
translator,_year=translator_record.split(', ')
178-
yieldtranslator
179-
180-
181-
def_remove_bot(translators:set[str])->None:
182-
translators.remove('Transifex Bot <>')
183-
184-
185-
def_eliminate_aliases(translators:set[str])->set[str]:
186-
unique=set()
187-
fornameintranslators:
188-
formatchinunique:
189-
if (
190-
ratio:=SequenceMatcher(lambdax:xin'<>@',name,match).ratio()
191-
)>0.64:
192-
info(f'{name} and{match} are similar ({ratio:.3f}). Deduplicating.')
193-
break
194-
else:
195-
unique.add(name)
196-
returnunique
197-
198-
199164
deflanguage_switcher(entry:ResourceLanguageStatistics)->bool:
200165
language_switcher_resources_prefixes= ('bugs','tutorial','library--functions')
201166
returnany(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp