File tree 2 files changed +36
-3
lines changed
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
+
1
4
import os
2
5
import sys
3
6
from pathlib import Path
17
20
repo = g .get_repo ('PyCampES/python-docs-es' )
18
21
19
22
20
- issues = repo .get_issues (state = 'open ' )
23
+ issues = repo .get_issues (state = 'all ' )
21
24
for issue in issues :
22
25
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
+
23
30
msg = f'There is a similar issue already created at { issue .html_url } .\n Do you want to create it anyways? [y/N] '
24
31
answer = input (msg )
25
32
if answer != 'y' :
26
33
sys .exit (1 )
27
34
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
+
28
42
# https://pygithub.readthedocs.io/en/latest/github_objects/Repository.html#github.Repository.Repository.create_issue
43
+ title = f'Translate `{ pofilename } `'
29
44
issue = repo .create_issue (
30
- title = f'Translate ` { pofilename } `' ,
45
+ title = title ,
31
46
body = f'''This needs to reach 100% translated.
32
47
33
48
Current stats for `{ pofilename } `:
41
56
42
57
Remember to follow the steps in our [Contributing Guide](https://python-docs-es.readthedocs.io/page/CONTRIBUTING.html).''' ,
43
58
)
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