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

Commitb906d2e

Browse files
[po] auto sync
1 parent511021c commitb906d2e

File tree

4 files changed

+69
-22
lines changed

4 files changed

+69
-22
lines changed

‎.stat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"translation":"78.47%","updated_at":"2025-05-23T00:39:37Z"}
1+
{"translation":"78.51%","updated_at":"2025-05-23T01:40:10Z"}

‎library/multiprocessing.po

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ msgid ""
273273
"requires *fork* must explicitly specify that via :func:`get_context` or "
274274
":func:`set_start_method`."
275275
msgstr""
276+
"此方法不再是任何平台上的默认启动方法。 需要 *fork* 操作的代码必须通过 :func:`get_context` 或 "
277+
":func:`set_start_method` 来显式地指定。"
276278

277279
#:../../library/multiprocessing.rst:138
278280
msgid""
@@ -2437,7 +2439,7 @@ msgstr ""
24372439
#:../../library/multiprocessing.rst:1445
24382440
#:../../library/multiprocessing.rst:1512
24392441
msgid"Return a boolean indicating whether this object is locked right now."
2440-
msgstr""
2442+
msgstr"返回一个指明该对象目前是否被锁定的布尔值。"
24412443

24422444
#:../../library/multiprocessing.rst:1452
24432445
msgid""

‎library/threading.po

Lines changed: 64 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# ww song <sww4718168@gmail.com>, 2022
1616
# Dai Xu <daixu61@hotmail.com>, 2022
1717
# ProgramRipper, 2023
18-
# Freesand Leo <yuqinju@163.com>, 2025
1918
# Rafael Fontenelle <rffontenelle@gmail.com>, 2025
19+
# Freesand Leo <yuqinju@163.com>, 2025
2020
#
2121
#,fuzzy
2222
msgid ""
@@ -25,7 +25,7 @@ msgstr ""
2525
"Report-Msgid-Bugs-To:\n"
2626
"POT-Creation-Date:2025-05-16 14:19+0000\n"
2727
"PO-Revision-Date:2021-06-28 01:15+0000\n"
28-
"Last-Translator:Rafael Fontenelle <rffontenelle@gmail.com>, 2025\n"
28+
"Last-Translator:Freesand Leo <yuqinju@163.com>, 2025\n"
2929
"Language-Team:Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
3030
"MIME-Version:1.0\n"
3131
"Content-Type:text/plain; charset=UTF-8\n"
@@ -72,13 +72,19 @@ msgid ""
7272
"bound, such as file operations or making network requests, where much of the"
7373
" time is spent waiting for external resources."
7474
msgstr""
75+
":mod:`!threading` 模块提供了一种在单个进程内部并发地运行多个 `线程 "
76+
"<https://en.wikipedia.org/wiki/Thread_(computing)>`_ (从进程分出的更小单位) 的方式。 "
77+
"它允许创建和管理线程,以便能够平行地执行多个任务,并共享内存空间。 线程特别适用于 I/O "
78+
"密集型的任务,如文件操作或发送网络请求,在此类任务中大部分时间都会消耗于等待外部资源。"
7579

7680
#:../../library/threading.rst:27
7781
msgid""
7882
"A typical use case for :mod:`!threading` includes managing a pool of worker "
7983
"threads that can process multiple tasks concurrently. Here's a basic "
8084
"example of creating and starting threads using :class:`~threading.Thread`::"
8185
msgstr""
86+
"典型的 :mod:`!threading` 使用场景包括管理一个工作线程池来并发地处理多个任务。 下面是一个使用 "
87+
":class:`~threading.Thread` 创建并启动线程的简单示例::"
8288

8389
#:../../library/threading.rst:31
8490
msgid""
@@ -111,6 +117,34 @@ msgid ""
111117
"for t in threads:\n"
112118
" t.join()"
113119
msgstr""
120+
"import threading\n"
121+
"import time\n"
122+
"\n"
123+
"def crawl(link, delay=3):\n"
124+
"print(f\"crawl started for {link}\")\n"
125+
"time.sleep(delay) # 阻塞 I/O (模拟网络请求)\n"
126+
"print(f\"crawl ended for {link}\")\n"
127+
"\n"
128+
"links = [\n"
129+
"\"https://python.org\",\n"
130+
"\"https://docs.python.org\",\n"
131+
"\"https://peps.python.org\",\n"
132+
"]\n"
133+
"\n"
134+
"# 针对每个链接启动线程\n"
135+
"threads = []\n"
136+
"for link in links:\n"
137+
"# 使用 `args` 传入位置参数并使用 `kwargs` 传入关键字参数\n"
138+
"t = threading.Thread(target=crawl, args=(link,), kwargs={\"delay\": 2})\n"
139+
"threads.append(t)\n"
140+
"\n"
141+
"# 启动每个线程\n"
142+
"for t in threads:\n"
143+
"t.start()\n"
144+
"\n"
145+
"# 等待所有线程结束\n"
146+
"for t in threads:\n"
147+
"t.join()"
114148

115149
#:../../library/threading.rst:60
116150
msgid"This module used to be optional, it is now always available."
@@ -165,7 +199,7 @@ msgstr ""
165199

166200
#:../../library/threading.rst:95
167201
msgid"GIL and performance considerations"
168-
msgstr""
202+
msgstr"GIL 和性能的考量"
169203

170204
#:../../library/threading.rst:97
171205
msgid""
@@ -177,13 +211,18 @@ msgid ""
177211
"bytecode at a time. Despite this, threads remain a useful tool for achieving"
178212
" concurrency in many scenarios."
179213
msgstr""
214+
"与使用多个进程来绕过 :term:`global interpreter lock` (GIL) 的 :mod:`multiprocessing` "
215+
"模块不同,threading 模块是在单个进程内部操作的,这意味着所有线程共享相同的内存空间。 不过,对于 CPU 密集型任务来说 GIL 会限制 "
216+
"threading 带来的性能提升,因为在同一时刻只有一个线程能执行 Python 字节码。 尽管如此,在许多场景中线程仍然是实现并发的有用工具。"
180217

181218
#:../../library/threading.rst:105
182219
msgid""
183220
"As of Python 3.13, experimental :term:`free-threaded <free threading>` "
184221
"builds can disable the GIL, enabling true parallel execution of threads, but"
185222
" this feature is not available by default (see :pep:`703`)."
186223
msgstr""
224+
"对于 Python 3.13,实验性的 :term:`自由线程 <free threading>` 构建版可以禁用 "
225+
"GIL,启用真正的线程并行执行,但此特性在默认情况下不可用 (参见 :pep:`703`)。"
187226

188227
#:../../library/threading.rst:112
189228
msgid"Reference"
@@ -210,6 +249,8 @@ msgid ""
210249
"through the :mod:`!threading` module, a dummy thread object with limited "
211250
"functionality is returned."
212251
msgstr""
252+
"返回当前 :class:`Thread` 对象,与调用方的控制线程。 如果调用方的控制线程不是通过 :mod:`!threading` "
253+
"模块创建的,则会返回一个功能受限的假线程对象。"
213254

214255
#:../../library/threading.rst:132
215256
msgid""
@@ -336,12 +377,14 @@ msgid ""
336377
"module. The *func* will be passed to :func:`sys.settrace` for each thread, "
337378
"before its :meth:`~Thread.run` method is called."
338379
msgstr""
380+
"为所有从 :mod:`!threading` 模块启动的线程设置追踪函数,在每个线程的 :meth:`~Thread.run` "
381+
"方法被调用前,*func* 会被传递给 :func:`sys.settrace`。"
339382

340383
#:../../library/threading.rst:230
341384
msgid""
342385
"Set a trace function for all threads started from the :mod:`!threading` "
343386
"module and all Python threads that are currently executing."
344-
msgstr""
387+
msgstr"为从 :mod:`!threading` 模块启动的所有线程以及当前正在执行的所有 Python 线程设置追踪函数。"
345388

346389
#:../../library/threading.rst:233
347390
msgid""
@@ -360,12 +403,14 @@ msgid ""
360403
"module. The *func* will be passed to :func:`sys.setprofile` for each "
361404
"thread, before its :meth:`~Thread.run` method is called."
362405
msgstr""
406+
"为从 :mod:`!threading` 模块启动的所有线程设置性能分析函数。 在每个线程的 :meth:`~Thread.run` "
407+
"方法被调用前,*func* 会被传递给 :func:`sys.setprofile`。"
363408

364409
#:../../library/threading.rst:259
365410
msgid""
366411
"Set a profile function for all threads started from the :mod:`!threading` "
367412
"module and all Python threads that are currently executing."
368-
msgstr""
413+
msgstr"为从 :mod:`!threading` 模块启动的所有线程和当前正在执行和的所有 Python 线程设置性能分析函数。"
369414

370415
#:../../library/threading.rst:262
371416
msgid""
@@ -448,7 +493,7 @@ msgstr "下述方法的执行都是原子性的。"
448493

449494
#:../../library/threading.rst:325
450495
msgid"Thread-local data"
451-
msgstr""
496+
msgstr"线程局部数据"
452497

453498
#:../../library/threading.rst:327
454499
msgid""
@@ -720,7 +765,7 @@ msgstr "一个代表线程本地数据的类。"
720765

721766
#:../../library/threading.rst:457
722767
msgid"Thread objects"
723-
msgstr""
768+
msgstr"线程对象"
724769

725770
#:../../library/threading.rst:459
726771
msgid""
@@ -927,7 +972,7 @@ msgstr ""
927972

928973
#:../../library/threading.rst:573
929974
msgid"Set the operating system thread name."
930-
msgstr""
975+
msgstr"设置操作系统线程名称。"
931976

932977
#:../../library/threading.rst:578
933978
msgid"Method representing the thread's activity."
@@ -1023,7 +1068,7 @@ msgstr ""
10231068

10241069
#:../../library/threading.rst:630
10251070
msgid"May raise :exc:`PythonFinalizationError`."
1026-
msgstr""
1071+
msgstr"可能引发 :exc:`PythonFinalizationError`。"
10271072

10281073
#:../../library/threading.rst:634
10291074
msgid""
@@ -1123,7 +1168,7 @@ msgstr "已被弃用的 :attr:`~Thread.daemon` 的取值/设值 API;请改为
11231168

11241169
#:../../library/threading.rst:713
11251170
msgid"Lock objects"
1126-
msgstr""
1171+
msgstr"Lock 对象"
11271172

11281173
#:../../library/threading.rst:715
11291174
msgid""
@@ -1237,7 +1282,7 @@ msgstr "现在如果底层线程实现支持,则可以通过POSIX上的信号
12371282

12381283
#:../../library/threading.rst:780
12391284
msgid"Lock acquisition can now be interrupted by signals on Windows."
1240-
msgstr""
1285+
msgstr"在 Windows 上现在可以通过信号来中断锁的获取。"
12411286

12421287
#:../../library/threading.rst:786
12431288
msgid""
@@ -1266,7 +1311,7 @@ msgstr "当锁被获取时,返回 ``True``。"
12661311

12671312
#:../../library/threading.rst:806
12681313
msgid"RLock objects"
1269-
msgstr""
1314+
msgstr"RLock 对象"
12701315

12711316
#:../../library/threading.rst:808
12721317
msgid""
@@ -1417,11 +1462,11 @@ msgstr "只有在调用方线程持有锁时才能调用此方法。 如果在
14171462

14181463
#:../../library/threading.rst:908../../library/threading.rst:1007
14191464
msgid"Return a boolean indicating whether this object is locked right now."
1420-
msgstr""
1465+
msgstr"返回一个指明该对象目前是否被锁定的布尔值。"
14211466

14221467
#:../../library/threading.rst:916
14231468
msgid"Condition objects"
1424-
msgstr""
1469+
msgstr"Condition 对象"
14251470

14261471
#:../../library/threading.rst:918
14271472
msgid""
@@ -1725,7 +1770,7 @@ msgstr "``notifyAll`` 方法是此方法的已弃用别名。"
17251770

17261771
#:../../library/threading.rst:1094
17271772
msgid"Semaphore objects"
1728-
msgstr""
1773+
msgstr"Semaphore 对象"
17291774

17301775
#:../../library/threading.rst:1096
17311776
msgid""
@@ -1844,7 +1889,7 @@ msgstr ""
18441889

18451890
#:../../library/threading.rst:1175
18461891
msgid":class:`Semaphore` example"
1847-
msgstr""
1892+
msgstr":class:`Semaphore` 示例"
18481893

18491894
#:../../library/threading.rst:1177
18501895
msgid""
@@ -1896,7 +1941,7 @@ msgstr "使用有界信号量能减少这种编程错误:信号量的释放次
18961941

18971942
#:../../library/threading.rst:1203
18981943
msgid"Event objects"
1899-
msgstr""
1944+
msgstr"Event 对象"
19001945

19011946
#:../../library/threading.rst:1205
19021947
msgid""
@@ -1969,7 +2014,7 @@ msgstr "当提供了 timeout 参数且不为 ``None`` 时,它应当为一个
19692014

19702015
#:../../library/threading.rst:1260
19712016
msgid"Timer objects"
1972-
msgstr""
2017+
msgstr"Timer 对象"
19732018

19742019
#:../../library/threading.rst:1262
19752020
msgid""
@@ -2028,7 +2073,7 @@ msgstr "停止定时器并取消执行计时器将要执行的操作。仅当计
20282073

20292074
#:../../library/threading.rst:1298
20302075
msgid"Barrier objects"
2031-
msgstr""
2076+
msgstr"Barrier 对象"
20322077

20332078
#:../../library/threading.rst:1302
20342079
msgid""

‎whatsnew/3.3.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ msgid ""
159159
msgstr""
160160
"虚拟环境有助于创建 独立的 Python 设置,同时共享全系统的基础安装,便于维护。 "
161161
"虚拟环境有自己的私有站点包(即本地安装的库),并可选择与系统范围的站点包分离。 虚拟环境的概念和实现 受到流行的 ``virtualenv`` 第三方"
162-
" 包 的启发,但受益于与解释器 核心更紧密的集成。"
162+
" 包 的启发,但受益于与解释器核心更紧密的集成。"
163163

164164
#:../../whatsnew/3.3.rst:110
165165
msgid""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp