File tree Expand file tree Collapse file tree 2 files changed +36
-3
lines changed
Expand file tree Collapse file tree 2 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 1+ # Use together with `pageviews.py`
2+ # python scripts/pageviews.py | head -n 150 | grep -v whats | cut -d ' ' -f 2 | sed 's/\.html/\.po/g' | xargs -I '{}' python scripts/create_issue.py '{}'
3+
14import os
25import sys
36from pathlib import Path
1720repo = g .get_repo ('PyCampES/python-docs-es' )
1821
1922
20- issues = repo .get_issues (state = 'open ' )
23+ issues = repo .get_issues (state = 'all ' )
2124for issue in issues :
2225 if pofilename in issue .title :
26+
27+ print (f'Skipping { pofilename } . There is a similar issue already created at { issue .html_url } ' )
28+ sys .exit (1 )
29+
2330 msg = f'There is a similar issue already created at { issue .html_url } .\n Do you want to create it anyways? [y/N] '
2431 answer = input (msg )
2532 if answer != 'y' :
2633 sys .exit (1 )
2734
35+ if any ([
36+ pofile .translated_nb == pofile .po_file_size ,
37+ pofile .untranslated_nb == 0 ,
38+ ]):
39+ print (f'Skipping { pofilename } . The file is 100% translated already.' )
40+ sys .exit (1 )
41+
2842# https://pygithub.readthedocs.io/en/latest/github_objects/Repository.html#github.Repository.Repository.create_issue
43+ title = f'Translate `{ pofilename } `'
2944issue = repo .create_issue (
30- title = f'Translate ` { pofilename } `' ,
45+ title = title ,
3146 body = f'''This needs to reach 100% translated.
3247
3348Current stats for `{ pofilename } `:
4156
4257Remember to follow the steps in our [Contributing Guide](https://python-docs-es.readthedocs.io/page/CONTRIBUTING.html).''' ,
4358)
44- print (f'Issue created at { issue .html_url } ' )
59+ print (f'Issue " { title } " created at { issue .html_url } ' )
Original file line number Diff line number Diff line change 1+ from pprint import pprint
2+
3+ results = {}
4+
5+ # page-requests-20200504-20200510.txt
6+ # is a file containing stats from pageviews on the official Python documentation
7+ # (including different versions and languages)
8+ # grep -E '\.html$' page-requests-20200504-20200510.txt | grep -v tutorial | sed 's/3\..\///g' | sed 's/3\///g' | sed 's/2\///g' > pageviews.txt
9+ pages = open ('pageviews.txt' ).readlines ()[:- 1 ]
10+ for p in pages :
11+ count , key = int (p .split ()[0 ]), p .split ()[- 1 ].strip ()
12+ if key in results :
13+ results [key ] += count
14+ else :
15+ results [key ] = count
16+
17+ for p in sorted (list (results .items ()), key = lambda x : x [1 ], reverse = True )[50 :100 ]:
18+ print (p [1 ], p [0 ][1 :])
You can’t perform that action at this time.
0 commit comments