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

Commit0d8d376

Browse files
authored
Merge branch 'python:3.13' into howto/mro
2 parents8ac1732 +5fbfbd1 commit0d8d376

File tree

380 files changed

+55463
-44287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

380 files changed

+55463
-44287
lines changed

‎.github/workflows/ci.yml‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,40 @@
11
name:build
22

3+
concurrency:preview-${{ github.ref }}
4+
5+
permissions:
6+
contents:write
7+
pull-requests:write
8+
39
on:
410
pull_request:
511

612
jobs:
713
ci:
814
runs-on:ubuntu-22.04
915
steps:
10-
-uses:actions/checkout@v4
16+
-uses:actions/checkout@v5
17+
18+
-uses:actions/setup-python@v5
19+
with:
20+
python-version:"3.13"
1121

1222
-name:Install Dependencies
1323
run:sudo apt-get install gettext
1424

15-
-name:Validate
25+
-name:Install uv
26+
uses:astral-sh/setup-uv@v6
27+
28+
-name:Build HTML Docs
1629
run:VERSION=${{ github.event.repository.default_branch }} JOBS=4 MODE=html make all
30+
31+
-name:Deploy PR Doc Preview
32+
# PR from the forked repo would be denied as the permission is not granted.
33+
# Allow only PR from this repo.
34+
if:${{ ( github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name ) }}
35+
uses:rossjrw/pr-preview-action@v1
36+
with:
37+
source-dir:../cpython/Doc/build/html
38+
preview-branch:gh-pages
39+
umbrella-dir:pr-preview
40+
action:auto

‎.github/workflows/deploy-gh-page.yml‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,22 @@ jobs:
99
cd:
1010
runs-on:ubuntu-latest
1111
steps:
12-
-uses:actions/checkout@v4
12+
-uses:actions/checkout@v5
1313

1414
-name:Install Dependencies
1515
run:sudo apt-get install gettext
1616

17+
-name:Install uv
18+
uses:astral-sh/setup-uv@v6
19+
1720
-name:Build
1821
run:JOBS=4 MODE=html make all
1922

2023
-name:Deploy to gh page
21-
uses:JamesIves/github-pages-deploy-action@v4.7.2
24+
uses:JamesIves/github-pages-deploy-action@v4.7.3
2225
with:
23-
GITHUB_TOKEN:${{ secrets.GITHUB_TOKEN }}
24-
BRANCH:gh-pages
25-
FOLDER:../cpython/Doc/build/html
26-
CLEAN:true
26+
token:${{ secrets.GITHUB_TOKEN }}
27+
branch:gh-pages
28+
folder:../cpython/Doc/build/html
29+
clean:true
30+
clean-exclude:pr-preview/

‎.github/workflows/py313-sync-cpython.yml‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
VERSION:"3.13"
1515
BRANCH:"cron/sync/3.13"
1616
steps:
17-
-uses:actions/checkout@v4
17+
-uses:actions/checkout@v5
1818
with:
1919
ref:${{ env.VERSION }}
2020

@@ -30,20 +30,23 @@ jobs:
3030
-name:Install Dependencies
3131
run:sudo apt-get install gettext
3232

33+
-name:Install uv
34+
uses:astral-sh/setup-uv@v6
35+
3336
-name:Sync with CPython
34-
run:make clone&& makemerge&& makerm_cpython
37+
run:make clone merge rm_cpython wrap
3538

36-
-uses:tibdex/github-app-token@v2
37-
id:generate-token
39+
-uses:actions/create-github-app-token@v2
40+
id:app-token
3841
with:
39-
app_id:${{ secrets.APP_ID }}
40-
private_key:${{ secrets.APP_PRIVATE_KEY }}
42+
app-id:${{ secrets.APP_ID }}
43+
private-key:${{ secrets.APP_PRIVATE_KEY }}
4144

4245
-name:Create Pull Request
4346
id:cpr
4447
uses:peter-evans/create-pull-request@v6
4548
with:
46-
token:${{ steps.generate-token.outputs.token }}
49+
token:${{ steps.app-token.outputs.token }}
4750
commit-message:sync with cpython ${{ env.LATEST_COMMIT_ID }}
4851
committer:GitHub <noreply@github.com>
4952
author:github-actions[bot] <github-actions[bot]@users.noreply.github.com>

‎.github/workflows/summarize_progress.yml‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name:summarize_progress
22

33
on:
4+
workflow_dispatch:
45
schedule:
56
-cron:'30 23 * * 5'
67

@@ -13,10 +14,10 @@ jobs:
1314
# added or changed files to the repository.
1415
contents:write
1516
steps:
16-
-uses:actions/checkout@v4
17+
-uses:actions/checkout@v5
1718

1819
-name:Install poetry
19-
uses:abatilo/actions-poetry@v3
20+
uses:abatilo/actions-poetry@v4
2021

2122
-name:Execute Check Process
2223
run:|
@@ -26,7 +27,7 @@ jobs:
2627

2728

2829
-name:Checkout wiki code
29-
uses:actions/checkout@v4
30+
uses:actions/checkout@v5
3031
with:
3132
repository:${{github.repository}}.wiki
3233
path:markdown
@@ -37,7 +38,7 @@ jobs:
3738
shell:bash
3839

3940
-name:Commit wiki code
40-
uses:stefanzweifel/git-auto-commit-action@v5
41+
uses:stefanzweifel/git-auto-commit-action@v6
4142
with:
4243
commit_message:Weekly Update -- Summarize Progress
43-
repository:markdown
44+
repository:markdown

‎.pre-commit-config.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
repos:
88
-repo:https://git.afpy.org/AFPy/powrap
99
# there's no release tag in repo, use the latest commit hash id instead
10-
rev:a34a9fed116d24562fbe4bb8d456ade85f056c36
10+
rev:v1.0.2
1111
hooks:
1212
-id:powrap

‎.scripts/google_translate/utils.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
'變量':'變數',# variable
4747
'常量':'常數',# constant
4848
'添加':'新增',# add
49+
'轉義':'跳脫',# escape
4950
'基類':'基底類別',# base class
5051
}
5152

‎.scripts/summarize_progress/main.py‎

Lines changed: 55 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,6 @@
66
frompathlibimportPath
77

88

9-
defentry_check(pofile:polib.POFile)->str:
10-
'''
11-
Check the po file with how many entries are translated or not.
12-
'''
13-
14-
lines_tranlated=len(pofile.translated_entries())
15-
lines_untranlated=len(pofile.untranslated_entries())
16-
17-
iflines_tranlated==0:
18-
result="❌"
19-
eliflines_untranlated==0:
20-
result="✅"
21-
else:
22-
lines_all=lines_tranlated+lines_untranlated
23-
progress=lines_tranlated/lines_all
24-
progress_percentage=round(progress*100,2)
25-
result=f"{progress_percentage} %"
26-
27-
returnresult
28-
29-
309
defget_open_issues_count()->int:
3110
'''
3211
Fetch GitHub API to get the number of OPEN ISSUES.
@@ -89,20 +68,23 @@ def get_github_issues() -> list:
8968

9069

9170
defformat_line_table_header()->list:
92-
return [f"|Filename|Progress|Issue|Assignee|\r\n",
71+
return [f"|Filename|Progress (#string)|Issue|Assignee|\r\n",
9372
f"|-------:|:-------|:----|:-------|\r\n"]
9473

9574

96-
defformat_issue_link(url:str)->str:
97-
returnf"[{url.split('/')[-1]}]({url})"iflen(url)>0else''
98-
99-
100-
defformat_line_file(filename:str,data:dict)->str:
101-
returnf"|`{filename}`|{data['progress']}|{format_issue_link(data['issue'])}|{data['assignee']}|\r\n"
75+
defformat_line_po_issue_display(issue_link:str,issue_number:str,progress:float,create_issue_link:str)->str:
76+
ifissue_link:
77+
returnf"[{issue_number}]({issue_link})"
78+
ifprogress!=100.:
79+
returnf"[create issue]({create_issue_link})"
80+
return""
10281

10382

104-
defformat_line_directory(dirname:str)->str:
105-
returnf"##{dirname}\r\n"
83+
defformat_line_po(filename:str,po_link:str,progress:str,num_entries:str,issue_display:str,assignee:str)->str:
84+
progress_display=f"{progress} %"
85+
ifprogress==100:
86+
progress_display="✅"
87+
returnf"|[`{filename}`]({po_link})|{progress_display} ({num_entries:,})|{issue_display}|{assignee}|\r\n"
10688

10789

10890
if__name__=="__main__":
@@ -117,11 +99,17 @@ def format_line_directory(dirname: str) -> str:
11799
forfilepathinglob.glob(str(BASE_DIR/"**/*.po"),recursive=True):
118100
path=Path(filepath)
119101
filename=path.name
120-
dirname=path.parent.nameifpath.parent.name!=BASE_DIR.nameelse'/'
102+
dirname=path.parent.nameifpath.parent.name!=BASE_DIR.nameelse'root'
121103
po=polib.pofile(filepath)
122104

105+
num_entries=len(list(filter(lambdae:note.obsolete,po)))
106+
num_translated=len(po.translated_entries())
123107
summary.setdefault(dirname, {})[filename]= {
124-
'progress':entry_check(po),
108+
'po_info': {
109+
'num_entries':num_entries,
110+
'num_translated':num_translated,
111+
'progress':round(num_translated/num_entries*100,2),
112+
},
125113
'issue':'',
126114
'assignee':'',
127115
}
@@ -137,25 +125,47 @@ def format_line_directory(dirname: str) -> str:
137125
pass
138126

139127
'''
140-
Adding Space for Formatting Markdown Link
141-
'''
142-
143-
'''
144-
Format the lines that will write into the markdown file,
128+
Format the lines that will be written into the markdown file,
145129
also sort the directory name and file name.
146130
'''
147131
writeliner= []
148132
summary_sorted=dict(sorted(summary.items()))
133+
total_entries,total_translated=0,0
149134
fordirname,filedictinsummary_sorted.items():
150-
writeliner.append(format_line_directory(dirname))
151-
writeliner.extend(format_line_table_header())
152-
135+
dir_total_entries,dir_total_translated=0,0
136+
lines= []
153137
filedict_sorted=dict(sorted(filedict.items()))
154138
forfilename,filedatainfiledict_sorted.items():
155-
writeliner.append(format_line_file(filename,filedata))
139+
file_path=f"{dirname}/{filename}"ifdirnameelsefilename
140+
po_link=f"https://github.com/python/python-docs-zh-tw/tree/3.13/{file_path}"
141+
issue_link=filedata['issue']
142+
issue_number=f"#{issue_link.split('/')[-1]}"
143+
create_issue_link=f"https://github.com/python/python-docs-zh-tw/issues/new?title=Translate%20`{file_path}`"
144+
issue_display=format_line_po_issue_display(issue_link,issue_number,filedata['po_info']['progress'],create_issue_link)
145+
line_po=format_line_po(
146+
filename,
147+
po_link,
148+
filedata['po_info']['progress'],
149+
filedata['po_info']['num_entries'],
150+
issue_display,
151+
filedata['assignee'],
152+
)
153+
lines.append(line_po)
154+
155+
dir_total_entries+=filedata['po_info']['num_entries']
156+
dir_total_translated+=filedata['po_info']['num_translated']
157+
158+
dir_progress=round(dir_total_translated/dir_total_entries*100,2)
159+
writeliner.append(f"##{dirname} ({dir_progress}%)\r\n")
160+
writeliner.extend(format_line_table_header())
161+
writeliner.extend(lines)
162+
163+
total_entries+=dir_total_entries
164+
total_translated+=dir_total_translated
165+
166+
overall_progress=round(total_translated/total_entries*100,2)
167+
title=f"## Overall Progress:{overall_progress}% ({total_translated:,} /{total_entries:,})\r\n"
168+
writeliner= [title]+writeliner
156169

157-
withopen(
158-
f"summarize_progress/result.md",
159-
"w",
160-
)asfile:
170+
withopen(f"summarize_progress/result.md","w")asfile:
161171
file.writelines(writeliner)

‎Makefile‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,21 @@ prepare_cpython: ## Prepare CPython clone at `../cpython/`.
8989

9090

9191
$(VENV)/bin/activate:
92-
python3 -m venv$(VENV)
92+
uv venv$(VENV)
9393

9494
$(VENV)/bin/sphinx-build:$(VENV)/bin/activate
95-
.$(VENV)/bin/activate;python3 -m pip install sphinx python-docs-theme
95+
.$(VENV)/bin/activate;uv pip install sphinx python-docs-theme
9696

9797
$(VENV)/bin/sphinx-lint:$(VENV)/bin/activate
98-
.$(VENV)/bin/activate;python3 -m pip install sphinx-lint
98+
.$(VENV)/bin/activate;uv pip install sphinx-lint
9999

100100
$(VENV)/bin/blurb:$(VENV)/bin/activate
101-
.$(VENV)/bin/activate;python3 -m pip install blurb
101+
.$(VENV)/bin/activate;uv pip install blurb
102102

103103

104104
.PHONY: upgrade_venv
105105
upgrade_venv:$(VENV)/bin/activate## Upgrade the venv that compiles the doc
106-
@.$(VENV)/bin/activate;python3 -m pip install -q --upgrade sphinx python-docs-theme blurb sphinx-lint
106+
@.$(VENV)/bin/activate;uv pip install -q --upgrade sphinx python-docs-theme blurb sphinx-lint
107107

108108

109109
.PHONY: progress
@@ -156,6 +156,10 @@ rm_cpython: ## Remove cloned cpython repo
156156
lint:$(VENV)/bin/sphinx-lint## Run sphinx-lint
157157
$(VENV)/bin/sphinx-lint --enable default-role
158158

159+
.PHONY: wrap
160+
wrap:## Run powrap on modified po files
161+
uvx powrap --modified
162+
159163
# This allows us to accept extra arguments (by doing nothing when we get a job that doesn't match, rather than throwing an error)
160164
%:
161165
@:

‎README.rst‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ the PSF for inclusion in the documentation.
5252
請注意此予翻譯專案的授權:Python 的說明文件是以全球的志工社群來維護。透過張貼\
5353
此專案在 Transifex、GitHub 以及其他公眾場合,以及邀請你參與,我們向你提出一個\
5454
協議:你必須將你對於 Python 說明文件或是 Python 說明文件翻譯的貢獻以 CC0\
55-
(請參考 https://creativecommons.org/publicdomain/zero/1.0/legalcode/
55+
(請參考 https://creativecommons.org/publicdomain/zero/1.0/legalcode/
5656
)的方式授權給 PSF 使用。你可以公開地聲明你所貢獻翻譯的部分,並且如果你的翻譯被 PSF
5757
採用,你可以(但並不須要)送出一個修改,其包含在 Misc/ACKS 或是 TRANSLATORS
5858
檔案裡增加合適的注釋。雖然這個說明文件貢獻協議並沒有說明 PSF 有義務納入你的\
@@ -84,6 +84,7 @@ the PSF for inclusion in the documentation.
8484
- `安裝好 git<https://help.github.com/articles/set-up-git/>`_\(Windows
8585
上請參考 https://gitforwindows.org/)
8686
- 一個 ``.po`` 檔的編輯器。推薦使用 `Poedit<https://poedit.net>`_,若熟悉 po 檔用一般文字編輯器亦可。
87+
- 參考 `uv Installation<https://docs.astral.sh/uv/getting-started/installation/>`_ 安裝 uv,以便在本機端預覽翻譯成果。
8788
- macOS 的使用者還需要先利用 `homebrew<https://brew.sh/index_zh-tw>`_ 安裝 gettext,屆時 Sphinx 會使用到。
8889

8990
..code-block::bash
@@ -232,7 +233,7 @@ the PSF for inclusion in the documentation.
232233
其中最簡單的貢獻方式就是更新 *fuzzy entries*,讓曾經翻譯的內容保持與最新版本的文件
233234
同步。請參考\`尋找有翻譯過但需校閱的 fuzzy entries`_ 段落。
234235

235-
此外,當前的目標為完成 **Tutorial** 的翻譯,因此在 ``tutorial/`` 底下的所有
236+
此外,目前的目標為完成 **Tutorial** 的翻譯,因此在 ``tutorial/`` 底下的所有
236237
po 檔皆為首要的翻譯對象。你也可以幫忙校對已經翻譯過的內容。
237238

238239

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp