Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7942c0e

Browse files
sync with cpython 510e28ec
1 parent bdb7a53 commit 7942c0e

File tree

4 files changed

+910
-817
lines changed

4 files changed

+910
-817
lines changed

library/asyncio-dev.po

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: Python 3.13\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2024-09-03 11:11+0800\n"
11+
"POT-Creation-Date: 2025-05-17 00:18+0000\n"
1212
"PO-Revision-Date: 2023-02-18 14:17+0800\n"
1313
"Last-Translator: Matt Wang <mattwang44gmail.com>\n"
1414
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -101,15 +101,6 @@ msgstr "啟用除錯模式時:"
101101

102102
#: ../../library/asyncio-dev.rst:49
103103
msgid ""
104-
"asyncio checks for :ref:`coroutines that were not awaited <asyncio-coroutine-"
105-
"not-scheduled>` and logs them; this mitigates the \"forgotten await\" "
106-
"pitfall."
107-
msgstr ""
108-
"asyncio 會檢查\\ :ref:`未被等待的協程 <asyncio-coroutine-not-scheduled>`\\ 並"
109-
"記錄他們;這會減輕\"被遺忘的等待 (forgotten await)\" 問題。"
110-
111-
#: ../../library/asyncio-dev.rst:53
112-
msgid ""
113104
"Many non-threadsafe asyncio APIs (such as :meth:`loop.call_soon` and :meth:"
114105
"`loop.call_at` methods) raise an exception if they are called from a wrong "
115106
"thread."
@@ -118,15 +109,15 @@ msgstr ""
118109
"call_soon` 和 :meth:`loop.call_at` 方法),如果從錯誤的執行緒呼叫就會引發例"
119110
"外。"
120111

121-
#: ../../library/asyncio-dev.rst:57
112+
#: ../../library/asyncio-dev.rst:53
122113
msgid ""
123114
"The execution time of the I/O selector is logged if it takes too long to "
124115
"perform an I/O operation."
125116
msgstr ""
126117
"如果執行一個 I/O 操作花費的時間太長,則將 I/O 選擇器 (selector) 的執行時間記"
127118
"錄到日誌中。"
128119

129-
#: ../../library/asyncio-dev.rst:60
120+
#: ../../library/asyncio-dev.rst:56
130121
msgid ""
131122
"Callbacks taking longer than 100 milliseconds are logged. The :attr:`loop."
132123
"slow_callback_duration` attribute can be used to set the minimum execution "
@@ -136,11 +127,11 @@ msgstr ""
136127
"slow_callback_duration` 可用於設定以秒為單位的最小執行持續時間,超過這個值執"
137128
"行時間就會被視為\"緩慢\"。"
138129

139-
#: ../../library/asyncio-dev.rst:68
130+
#: ../../library/asyncio-dev.rst:64
140131
msgid "Concurrency and Multithreading"
141132
msgstr "並行性和多執行緒 (Concurrency and Multithreading)"
142133

143-
#: ../../library/asyncio-dev.rst:70
134+
#: ../../library/asyncio-dev.rst:66
144135
msgid ""
145136
"An event loop runs in a thread (typically the main thread) and executes all "
146137
"callbacks and Tasks in its thread. While a Task is running in the event "
@@ -153,19 +144,19 @@ msgstr ""
153144
"運行。當一個 Task 執行一個 ``await`` 運算式時,正在執行的 Task 會被暫停,而事"
154145
"件迴圈會執行下一個 Task。"
155146

156-
#: ../../library/asyncio-dev.rst:76
147+
#: ../../library/asyncio-dev.rst:72
157148
msgid ""
158149
"To schedule a :term:`callback` from another OS thread, the :meth:`loop."
159150
"call_soon_threadsafe` method should be used. Example::"
160151
msgstr ""
161152
"要從不同的 OS 執行緒為一個 :term:`callback` 排程,應該使用 :meth:`loop."
162153
"call_soon_threadsafe` 方法。例如: ::"
163154

164-
#: ../../library/asyncio-dev.rst:79
155+
#: ../../library/asyncio-dev.rst:75
165156
msgid "loop.call_soon_threadsafe(callback, *args)"
166157
msgstr "loop.call_soon_threadsafe(callback, *args)"
167158

168-
#: ../../library/asyncio-dev.rst:81
159+
#: ../../library/asyncio-dev.rst:77
169160
msgid ""
170161
"Almost all asyncio objects are not thread safe, which is typically not a "
171162
"problem unless there is code that works with them from outside of a Task or "
@@ -176,11 +167,11 @@ msgstr ""
176167
"在 Task 或回呼函式之外有程式需要和它們一起運作。如果需要這樣的程式來呼叫低階 "
177168
"asyncio API,應該使用 :meth:`loop.call_soon_threadsafe` 方法,例如: ::"
178169

179-
#: ../../library/asyncio-dev.rst:87
170+
#: ../../library/asyncio-dev.rst:83
180171
msgid "loop.call_soon_threadsafe(fut.cancel)"
181172
msgstr "loop.call_soon_threadsafe(fut.cancel)"
182173

183-
#: ../../library/asyncio-dev.rst:89
174+
#: ../../library/asyncio-dev.rst:85
184175
msgid ""
185176
"To schedule a coroutine object from a different OS thread, the :func:"
186177
"`run_coroutine_threadsafe` function should be used. It returns a :class:"
@@ -190,7 +181,7 @@ msgstr ""
190181
"`run_coroutine_threadsafe` 函式。它會回傳一個 :class:`concurrent.futures."
191182
"Future` 以存取結果: ::"
192183

193-
#: ../../library/asyncio-dev.rst:93
184+
#: ../../library/asyncio-dev.rst:89
194185
msgid ""
195186
"async def coro_func():\n"
196187
" return await asyncio.sleep(1, 42)\n"
@@ -202,11 +193,11 @@ msgid ""
202193
"result = future.result()"
203194
msgstr ""
204195

205-
#: ../../library/asyncio-dev.rst:102
196+
#: ../../library/asyncio-dev.rst:98
206197
msgid "To handle signals the event loop must be run in the main thread."
207198
msgstr "為了能夠處理訊號,事件迴圈必須於主執行緒中運行。"
208199

209-
#: ../../library/asyncio-dev.rst:105
200+
#: ../../library/asyncio-dev.rst:101
210201
msgid ""
211202
"The :meth:`loop.run_in_executor` method can be used with a :class:"
212203
"`concurrent.futures.ThreadPoolExecutor` to execute blocking code in a "
@@ -217,7 +208,7 @@ msgstr ""
217208
"ThreadPoolExecutor` 一起使用,這能夠在作業系統上另一個不同的執行緒中執行阻塞"
218209
"程式,且避免阻塞執行事件迴圈的執行緒。"
219210

220-
#: ../../library/asyncio-dev.rst:110
211+
#: ../../library/asyncio-dev.rst:106
221212
msgid ""
222213
"There is currently no way to schedule coroutines or callbacks directly from "
223214
"a different process (such as one started with :mod:`multiprocessing`). The :"
@@ -237,11 +228,11 @@ msgstr ""
237228
"run_in_executor` 方法也可和 :class:`concurrent.futures.ProcessPoolExecutor` "
238229
"搭配使用,以在另一個行程中執行程式。"
239230

240-
#: ../../library/asyncio-dev.rst:124
231+
#: ../../library/asyncio-dev.rst:120
241232
msgid "Running Blocking Code"
242233
msgstr "執行阻塞的程式"
243234

244-
#: ../../library/asyncio-dev.rst:126
235+
#: ../../library/asyncio-dev.rst:122
245236
msgid ""
246237
"Blocking (CPU-bound) code should not be called directly. For example, if a "
247238
"function performs a CPU-intensive calculation for 1 second, all concurrent "
@@ -250,7 +241,7 @@ msgstr ""
250241
"不應該直接呼叫阻塞(CPU 密集型)程式。例如一個執行 1 秒 CPU 密集型計算的函"
251242
"式,那麼所有並行非同步 Tasks 和 IO 操作都會被延遲 1 秒。"
252243

253-
#: ../../library/asyncio-dev.rst:131
244+
#: ../../library/asyncio-dev.rst:127
254245
msgid ""
255246
"An executor can be used to run a task in a different thread or even in a "
256247
"different process to avoid blocking the OS thread with the event loop. See "
@@ -260,29 +251,29 @@ msgstr ""
260251
"以避免使用事件迴圈阻塞 OS 執行緒。詳情請見 :meth:`loop.run_in_executor` 方"
261252
"法。"
262253

263-
#: ../../library/asyncio-dev.rst:140
254+
#: ../../library/asyncio-dev.rst:136
264255
msgid "Logging"
265256
msgstr "日誌記錄"
266257

267-
#: ../../library/asyncio-dev.rst:142
258+
#: ../../library/asyncio-dev.rst:138
268259
msgid ""
269260
"asyncio uses the :mod:`logging` module and all logging is performed via the "
270261
"``\"asyncio\"`` logger."
271262
msgstr ""
272263
"asyncio 使用 :mod:`logging` 模組,所有日誌記錄都是透過 ``\"asyncio\"`` "
273264
"logger 執行的。"
274265

275-
#: ../../library/asyncio-dev.rst:145
266+
#: ../../library/asyncio-dev.rst:141
276267
msgid ""
277268
"The default log level is :py:const:`logging.INFO`, which can be easily "
278269
"adjusted::"
279270
msgstr "日誌級別被預設為 :py:const:`logging.INFO`,它可以很容易地被調整: ::"
280271

281-
#: ../../library/asyncio-dev.rst:148
272+
#: ../../library/asyncio-dev.rst:144
282273
msgid "logging.getLogger(\"asyncio\").setLevel(logging.WARNING)"
283274
msgstr "logging.getLogger(\"asyncio\").setLevel(logging.WARNING)"
284275

285-
#: ../../library/asyncio-dev.rst:151
276+
#: ../../library/asyncio-dev.rst:147
286277
msgid ""
287278
"Network logging can block the event loop. It is recommended to use a "
288279
"separate thread for handling logs or use non-blocking IO. For example, see :"
@@ -291,11 +282,11 @@ msgstr ""
291282
"網路日誌記錄可能會阻塞事件迴圈。建議使用獨立的執行緒來處理日誌或使用非阻塞 "
292283
"IO,範例請參見 :ref:`blocking-handlers`。"
293284

294-
#: ../../library/asyncio-dev.rst:159
285+
#: ../../library/asyncio-dev.rst:155
295286
msgid "Detect never-awaited coroutines"
296287
msgstr "偵測從未被等待的 (never-awaited) 協程"
297288

298-
#: ../../library/asyncio-dev.rst:161
289+
#: ../../library/asyncio-dev.rst:157
299290
msgid ""
300291
"When a coroutine function is called, but not awaited (e.g. ``coro()`` "
301292
"instead of ``await coro()``) or the coroutine is not scheduled with :meth:"
@@ -305,7 +296,7 @@ msgstr ""
305296
"者協程沒有透過 :meth:`asyncio.create_task` 被排程,asyncio 將會發出 :exc:"
306297
"`RuntimeWarning`: ::"
307298

308-
#: ../../library/asyncio-dev.rst:166
299+
#: ../../library/asyncio-dev.rst:162
309300
msgid ""
310301
"import asyncio\n"
311302
"\n"
@@ -318,23 +309,23 @@ msgid ""
318309
"asyncio.run(main())"
319310
msgstr ""
320311

321-
#: ../../library/asyncio-dev.rst:176 ../../library/asyncio-dev.rst:221
312+
#: ../../library/asyncio-dev.rst:172 ../../library/asyncio-dev.rst:217
322313
msgid "Output::"
323314
msgstr "輸出: ::"
324315

325-
#: ../../library/asyncio-dev.rst:178
316+
#: ../../library/asyncio-dev.rst:174
326317
msgid ""
327318
"test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n"
328319
" test()"
329320
msgstr ""
330321
"test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n"
331322
" test()"
332323

333-
#: ../../library/asyncio-dev.rst:181 ../../library/asyncio-dev.rst:237
324+
#: ../../library/asyncio-dev.rst:177 ../../library/asyncio-dev.rst:233
334325
msgid "Output in debug mode::"
335326
msgstr "除錯模式中的輸出: ::"
336327

337-
#: ../../library/asyncio-dev.rst:183
328+
#: ../../library/asyncio-dev.rst:179
338329
msgid ""
339330
"test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n"
340331
"Coroutine created at (most recent call last)\n"
@@ -358,26 +349,26 @@ msgstr ""
358349
" test()\n"
359350
" test()"
360351

361-
#: ../../library/asyncio-dev.rst:194
352+
#: ../../library/asyncio-dev.rst:190
362353
msgid ""
363354
"The usual fix is to either await the coroutine or call the :meth:`asyncio."
364355
"create_task` function::"
365356
msgstr ""
366357
"常用的修復方法是去等待協程或者呼叫 :meth:`asyncio.create_task` 函式: ::"
367358

368-
#: ../../library/asyncio-dev.rst:197
359+
#: ../../library/asyncio-dev.rst:193
369360
msgid ""
370361
"async def main():\n"
371362
" await test()"
372363
msgstr ""
373364
"async def main():\n"
374365
" await test()"
375366

376-
#: ../../library/asyncio-dev.rst:202
367+
#: ../../library/asyncio-dev.rst:198
377368
msgid "Detect never-retrieved exceptions"
378369
msgstr "偵測從未被取得的 (never-retrieved) 例外"
379370

380-
#: ../../library/asyncio-dev.rst:204
371+
#: ../../library/asyncio-dev.rst:200
381372
msgid ""
382373
"If a :meth:`Future.set_exception` is called but the Future object is never "
383374
"awaited on, the exception would never be propagated to the user code. In "
@@ -388,11 +379,11 @@ msgstr ""
388379
"傳播 (propagate) 到使用者程式。在這種情況下,當 Future 物件被垃圾回收 "
389380
"(garbage collected) 時,asyncio 將發出一則日誌訊息。"
390381

391-
#: ../../library/asyncio-dev.rst:209
382+
#: ../../library/asyncio-dev.rst:205
392383
msgid "Example of an unhandled exception::"
393384
msgstr "未處理例外的例子: ::"
394385

395-
#: ../../library/asyncio-dev.rst:211
386+
#: ../../library/asyncio-dev.rst:207
396387
msgid ""
397388
"import asyncio\n"
398389
"\n"
@@ -414,7 +405,7 @@ msgstr ""
414405
"\n"
415406
"asyncio.run(main())"
416407

417-
#: ../../library/asyncio-dev.rst:223
408+
#: ../../library/asyncio-dev.rst:219
418409
msgid ""
419410
"Task exception was never retrieved\n"
420411
"future: <Task finished coro=<bug() done, defined at test.py:3>\n"
@@ -434,19 +425,19 @@ msgstr ""
434425
" raise Exception(\"not consumed\")\n"
435426
"Exception: not consumed"
436427

437-
#: ../../library/asyncio-dev.rst:232
428+
#: ../../library/asyncio-dev.rst:228
438429
msgid ""
439430
":ref:`Enable the debug mode <asyncio-debug-mode>` to get the traceback where "
440431
"the task was created::"
441432
msgstr ""
442433
":ref:`啟用除錯模式 <asyncio-debug-mode>`\\ 以取得任務建立處的追蹤資訊 "
443434
"(traceback): ::"
444435

445-
#: ../../library/asyncio-dev.rst:235
436+
#: ../../library/asyncio-dev.rst:231
446437
msgid "asyncio.run(main(), debug=True)"
447438
msgstr "asyncio.run(main(), debug=True)"
448439

449-
#: ../../library/asyncio-dev.rst:239
440+
#: ../../library/asyncio-dev.rst:235
450441
msgid ""
451442
"Task exception was never retrieved\n"
452443
"future: <Task finished coro=<bug() done, defined at test.py:3>\n"
@@ -477,3 +468,12 @@ msgstr ""
477468
" File \"../t.py\", line 4, in bug\n"
478469
" raise Exception(\"not consumed\")\n"
479470
"Exception: not consumed"
471+
472+
#~ msgid ""
473+
#~ "asyncio checks for :ref:`coroutines that were not awaited <asyncio-"
474+
#~ "coroutine-not-scheduled>` and logs them; this mitigates the \"forgotten "
475+
#~ "await\" pitfall."
476+
#~ msgstr ""
477+
#~ "asyncio 會檢查\\ :ref:`未被等待的協程 <asyncio-coroutine-not-"
478+
#~ "scheduled>`\\ 並記錄他們;這會減輕\"被遺忘的等待 (forgotten await)\" 問"
479+
#~ "題。"

0 commit comments

Comments
 (0)