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

Create issues by pageviews#416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
humitos merged 4 commits into3.8fromcreate-issues-by-pageviews
Jun 20, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletionsscripts/create_issue.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
# Use together with `pageviews.py`
# 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 '{}'

import os
import sys
from pathlib import Path
Expand All@@ -17,17 +20,29 @@
repo = g.get_repo('PyCampES/python-docs-es')


issues = repo.get_issues(state='open')
issues = repo.get_issues(state='all')
for issue in issues:
if pofilename in issue.title:

print(f'Skipping {pofilename}. There is a similar issue already created at {issue.html_url}')
sys.exit(1)

msg = f'There is a similar issue already created at {issue.html_url}.\nDo you want to create it anyways? [y/N] '
answer = input(msg)
if answer != 'y':
sys.exit(1)

if any([
pofile.translated_nb == pofile.po_file_size,
pofile.untranslated_nb == 0,
]):
print(f'Skipping {pofilename}. The file is 100% translated already.')
sys.exit(1)

# https://pygithub.readthedocs.io/en/latest/github_objects/Repository.html#github.Repository.Repository.create_issue
title = f'Translate `{pofilename}`'
issue = repo.create_issue(
title=f'Translate `{pofilename}`',
title=title,
body=f'''This needs to reach 100% translated.

Current stats for `{pofilename}`:
Expand All@@ -41,4 +56,4 @@

Remember to follow the steps in our [Contributing Guide](https://python-docs-es.readthedocs.io/page/CONTRIBUTING.html).''',
)
print(f'Issue created at {issue.html_url}')
print(f'Issue"{title}"created at {issue.html_url}')
18 changes: 18 additions & 0 deletionsscripts/pageviews.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
from pprint import pprint

results = {}

# page-requests-20200504-20200510.txt
# is a file containing stats from pageviews on the official Python documentation
# (including different versions and languages)
# 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
pages = open('pageviews.txt').readlines()[:-1]
for p in pages:
count, key = int(p.split()[0]), p.split()[-1].strip()
if key in results:
results[key] += count
else:
results[key] = count

for p in sorted(list(results.items()), key=lambda x: x[1], reverse=True)[50:100]:
print(p[1], p[0][1:])

[8]ページ先頭

©2009-2025 Movatter.jp