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

Commit82bf0f0

Browse files
authored
Merge pull request#416 from python/create-issues-by-pageviews
2 parents8f1053a +cc0603c commit82bf0f0

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

‎scripts/create_issue.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
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+
14
importos
25
importsys
36
frompathlibimportPath
@@ -17,17 +20,29 @@
1720
repo=g.get_repo('PyCampES/python-docs-es')
1821

1922

20-
issues=repo.get_issues(state='open')
23+
issues=repo.get_issues(state='all')
2124
forissueinissues:
2225
ifpofilenameinissue.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}.\nDo you want to create it anyways? [y/N] '
2431
answer=input(msg)
2532
ifanswer!='y':
2633
sys.exit(1)
2734

35+
ifany([
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}`'
2944
issue=repo.create_issue(
30-
title=f'Translate `{pofilename}`',
45+
title=title,
3146
body=f'''This needs to reach 100% translated.
3247
3348
Current stats for `{pofilename}`:
@@ -41,4 +56,4 @@
4156
4257
Remember 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}')

‎scripts/pageviews.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
frompprintimportpprint
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+
forpinpages:
11+
count,key=int(p.split()[0]),p.split()[-1].strip()
12+
ifkeyinresults:
13+
results[key]+=count
14+
else:
15+
results[key]=count
16+
17+
forpinsorted(list(results.items()),key=lambdax:x[1],reverse=True)[50:100]:
18+
print(p[1],p[0][1:])

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp