Skip to content

Commit caa0d84

Browse files
committed
Translate library/asyncio-runner.po
1 parent ead1032 commit caa0d84

1 file changed

Lines changed: 47 additions & 15 deletions

File tree

library/asyncio-runner.po

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ msgid ""
5555
"This function runs the awaitable, taking care of managing the asyncio event "
5656
"loop, *finalizing asynchronous generators*, and closing the executor."
5757
msgstr ""
58-
"這個函式負責運行被傳入的可等待物件、管理 asyncio 的事件迴圈、*終結非同步產生器*\\"
59-
"及關閉執行器。"
58+
"這個函式負責運行被傳入的可等待物件、管理 asyncio 的事件迴圈、*終結非同步產生"
59+
"器*\\ 以及關閉執行器。"
6060

6161
#: ../../library/asyncio-runner.rst:35 ../../library/asyncio-runner.rst:131
6262
msgid ""
@@ -96,6 +96,8 @@ msgid ""
9696
"executor hasn't finished within that duration, a warning is emitted and the "
9797
"executor is closed."
9898
msgstr ""
99+
"執行器的關閉逾時期限為 5 分鐘。如果執行器未在這段時間內完成,系統會發出警告並"
100+
"關閉執行器。"
99101

100102
#: ../../library/asyncio-runner.rst:54
101103
msgid "Example::"
@@ -117,43 +119,47 @@ msgstr ""
117119

118120
#: ../../library/asyncio-runner.rst:64
119121
msgid "Updated to use :meth:`loop.shutdown_default_executor`."
120-
msgstr ""
122+
msgstr "更新為使用\\ :meth:`loop.shutdown_default_executor`。"
121123

122124
#: ../../library/asyncio-runner.rst:69
123125
msgid ""
124126
"*debug* is ``None`` by default to respect the global debug mode settings."
125-
msgstr ""
127+
msgstr "*debug* 預設為 ``None``,以遵循全域除錯模式設定。"
126128

127129
#: ../../library/asyncio-runner.rst:73
128130
msgid "Added *loop_factory* parameter."
129131
msgstr "新增 *loop_factory* 參數。"
130132

131133
#: ../../library/asyncio-runner.rst:77 ../../library/asyncio-runner.rst:136
132134
msgid "*coro* can be any awaitable object."
133-
msgstr ""
135+
msgstr "*coro* 可以是任何可等待物件。"
134136

135137
#: ../../library/asyncio-runner.rst:81
136138
msgid ""
137139
"The :mod:`!asyncio` policy system is deprecated and will be removed in "
138140
"Python 3.16; from there on, an explicit *loop_factory* is needed to "
139141
"configure the event loop."
140142
msgstr ""
143+
":mod:`!asyncio` 的政策系統已被棄用,並將於 Python 3.16 移除;此後必須明確指"
144+
"定 *loop_factory* 才能設定事件迴圈。"
141145

142146
#: ../../library/asyncio-runner.rst:87
143147
msgid "Runner context manager"
144-
msgstr ""
148+
msgstr "執行器情境管理器"
145149

146150
#: ../../library/asyncio-runner.rst:91
147151
msgid ""
148152
"A context manager that simplifies *multiple* async function calls in the "
149153
"same context."
150-
msgstr ""
154+
msgstr "此情境管理器可簡化在相同情境中對\\ *多個*\\ 非同步函式的呼叫。"
151155

152156
#: ../../library/asyncio-runner.rst:94
153157
msgid ""
154158
"Sometimes several top-level async functions should be called in the "
155159
"same :ref:`event loop <asyncio-event-loop>` and :class:`contextvars.Context`."
156160
msgstr ""
161+
"有時需要在相同的\\ :ref:`事件迴圈 <asyncio-event-loop>` "
162+
"和 :class:`contextvars.Context` 中呼叫數個頂層非同步函式。"
157163

158164
#: ../../library/asyncio-runner.rst:101
159165
msgid ""
@@ -162,12 +168,16 @@ msgid ""
162168
"one. By default :func:`asyncio.new_event_loop` is used and set as current "
163169
"event loop with :func:`asyncio.set_event_loop` if *loop_factory* is ``None``."
164170
msgstr ""
171+
"*loop_factory* 可用來覆寫事件迴圈的建立方式。*loop_factory* 必須負責將建立的"
172+
"迴圈設定為目前的事件迴圈。若 *loop_factory* 為 ``None``,預設會使用"
173+
"\\ :func:`asyncio.new_event_loop`,並以\\ :func:`asyncio.set_event_loop` 將其"
174+
"設定為目前的事件迴圈。"
165175

166176
#: ../../library/asyncio-runner.rst:106
167177
msgid ""
168178
"Basically, :func:`asyncio.run` example can be rewritten with the runner "
169179
"usage::"
170-
msgstr ""
180+
msgstr "基本上,:func:`asyncio.run`\\ 的範例可以改寫為使用執行器: ::"
171181

172182
#: ../../library/asyncio-runner.rst:108
173183
msgid ""
@@ -187,52 +197,60 @@ msgstr ""
187197

188198
#: ../../library/asyncio-runner.rst:119
189199
msgid "Execute *coro* in the embedded event loop."
190-
msgstr ""
200+
msgstr "在內嵌的事件迴圈中執行 *coro*。"
191201

192202
#: ../../library/asyncio-runner.rst:123
193203
msgid "If the argument is a coroutine, it is wrapped in a Task."
194-
msgstr ""
204+
msgstr "如果引數是協程,會將其包裝在 Task 中。"
195205

196206
#: ../../library/asyncio-runner.rst:125
197207
msgid ""
198208
"An optional keyword-only *context* argument allows specifying a "
199209
"custom :class:`contextvars.Context` for the code to run in. The runner's "
200210
"default context is used if context is ``None``."
201211
msgstr ""
212+
"可選的僅限關鍵字引數 *context*,可用來指定程式碼執行時所使用的自訂"
213+
"\\ :class:`contextvars.Context`。如果 context 為 ``None``,則使用執行器的預設"
214+
"情境。"
202215

203216
#: ../../library/asyncio-runner.rst:129
204217
msgid "Returns the awaitable's result or raises an exception."
205-
msgstr ""
218+
msgstr "回傳可等待物件的結果,或引發例外。"
206219

207220
#: ../../library/asyncio-runner.rst:140
208221
msgid "Close the runner."
209-
msgstr ""
222+
msgstr "關閉執行器。"
210223

211224
#: ../../library/asyncio-runner.rst:142
212225
msgid ""
213226
"Finalize asynchronous generators, shutdown default executor, close the event "
214227
"loop and release embedded :class:`contextvars.Context`."
215228
msgstr ""
229+
"最終化非同步產生器、關閉預設執行器與事件迴圈,並釋放內嵌的"
230+
"\\ :class:`contextvars.Context`。"
216231

217232
#: ../../library/asyncio-runner.rst:147
218233
msgid "Return the event loop associated with the runner instance."
219-
msgstr ""
234+
msgstr "回傳與執行器實例關聯的事件迴圈。"
220235

221236
#: ../../library/asyncio-runner.rst:151
222237
msgid ""
223238
":class:`Runner` uses the lazy initialization strategy, its constructor "
224239
"doesn't initialize underlying low-level structures."
225240
msgstr ""
241+
":class:`Runner` 採用延遲初始化策略,其建構函式不會初始化底層的低階結構。"
226242

227243
#: ../../library/asyncio-runner.rst:154
228244
msgid ""
229245
"Embedded *loop* and *context* are created at the :keyword:`with` body "
230246
"entering or the first call of :meth:`run` or :meth:`get_loop`."
231247
msgstr ""
248+
"內嵌的 *loop* 和 *context* 會在進入\\ :keyword:`with`\\ 陳述式主體,或第一次"
249+
"呼叫\\ :meth:`run`\\\\ :meth:`get_loop`\\ 時建立。"
232250

233251
#: ../../library/asyncio-runner.rst:159
234252
msgid "Handling Keyboard Interruption"
235-
msgstr ""
253+
msgstr "處理鍵盤中斷"
236254

237255
#: ../../library/asyncio-runner.rst:163
238256
msgid ""
@@ -241,25 +259,31 @@ msgid ""
241259
"default. However this doesn't work with :mod:`asyncio` because it can "
242260
"interrupt asyncio internals and can hang the program from exiting."
243261
msgstr ""
262+
"當 :const:`signal.SIGINT` 由 :kbd:`Ctrl-C` 引發時,預設會在主執行緒中引"
263+
"發 :exc:`KeyboardInterrupt` 例外。然而,此方式不適用於 :mod:`asyncio`,因為這"
264+
"可能會中斷 asyncio 內部運作,並造成程式無法結束。"
244265

245266
#: ../../library/asyncio-runner.rst:168
246267
msgid ""
247268
"To mitigate this issue, :mod:`asyncio` handles :const:`signal.SIGINT` as "
248269
"follows:"
249270
msgstr ""
271+
"為了緩解此問題,:mod:`asyncio` 會依下列方式處理 :const:`signal.SIGINT`:"
250272

251273
#: ../../library/asyncio-runner.rst:170
252274
msgid ""
253275
":meth:`asyncio.Runner.run` installs a custom :const:`signal.SIGINT` handler "
254276
"before any user code is executed and removes it when exiting from the "
255277
"function."
256278
msgstr ""
279+
":meth:`asyncio.Runner.run` 會在執行任何使用者程式碼之前安裝自訂"
280+
"的 :const:`signal.SIGINT` 處理程式,並在函式結束時將其移除。"
257281

258282
#: ../../library/asyncio-runner.rst:172
259283
msgid ""
260284
"The :class:`~asyncio.Runner` creates the main task for the passed coroutine "
261285
"for its execution."
262-
msgstr ""
286+
msgstr ":class:`~asyncio.Runner` 會為傳入的協程建立主 Task,以執行該協程。"
263287

264288
#: ../../library/asyncio-runner.rst:174
265289
msgid ""
@@ -270,6 +294,11 @@ msgid ""
270294
"used for resource cleanup. After the main task is "
271295
"cancelled, :meth:`asyncio.Runner.run` raises :exc:`KeyboardInterrupt`."
272296
msgstr ""
297+
"當 :const:`signal.SIGINT` 由 :kbd:`Ctrl-C` 引發時,自訂訊號處理程式會呼"
298+
"叫 :meth:`asyncio.Task.cancel` 來取消主 Task,而此方法會在主 Task 內引"
299+
"發 :exc:`asyncio.CancelledError`。這會使 Python 堆疊展開,並可使用 ``try/"
300+
"except`` 與 ``try/finally`` 區塊來清理資源。主 Task 取消"
301+
"後,:meth:`asyncio.Runner.run` 會引發 :exc:`KeyboardInterrupt`。"
273302

274303
#: ../../library/asyncio-runner.rst:180
275304
msgid ""
@@ -278,3 +307,6 @@ msgid ""
278307
"following :kbd:`Ctrl-C` immediately raises the :exc:`KeyboardInterrupt` "
279308
"without cancelling the main task."
280309
msgstr ""
310+
"使用者可能會撰寫一個無法由 :meth:`asyncio.Task.cancel` 中斷的緊密迴圈;在此情"
311+
"況下,再次按下 :kbd:`Ctrl-C` 會立即引發 :exc:`KeyboardInterrupt`,而不會取消"
312+
"主 Task。"

0 commit comments

Comments
 (0)