Skip to content

Commit 2c9679a

Browse files
sync with cpython d9feec45
1 parent 0cd09b2 commit 2c9679a

File tree

3 files changed

+180
-139
lines changed

3 files changed

+180
-139
lines changed

library/asyncio-queue.po

Lines changed: 52 additions & 34 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: 2025-02-23 00:15+0000\n"
11+
"POT-Creation-Date: 2025-07-25 00:16+0000\n"
1212
"PO-Revision-Date: 2022-02-20 18:34+0800\n"
1313
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
1414
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -162,31 +162,55 @@ msgid "Return the number of items in the queue."
162162
msgstr "回傳佇列中的元素數量。"
163163

164164
#: ../../library/asyncio-queue.rst:105
165-
msgid ""
166-
"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` raise :"
167-
"exc:`QueueShutDown`."
165+
msgid "Put a :class:`Queue` instance into a shutdown mode."
168166
msgstr ""
169167

170-
#: ../../library/asyncio-queue.rst:108
168+
#: ../../library/asyncio-queue.rst:107
171169
msgid ""
172-
"By default, :meth:`~Queue.get` on a shut down queue will only raise once the "
173-
"queue is empty. Set *immediate* to true to make :meth:`~Queue.get` raise "
174-
"immediately instead."
170+
"The queue can no longer grow. Future calls to :meth:`~Queue.put` raise :exc:"
171+
"`QueueShutDown`. Currently blocked callers of :meth:`~Queue.put` will be "
172+
"unblocked and will raise :exc:`QueueShutDown` in the formerly blocked thread."
175173
msgstr ""
176174

177175
#: ../../library/asyncio-queue.rst:112
178176
msgid ""
179-
"All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be "
180-
"unblocked. If *immediate* is true, a task will be marked as done for each "
181-
"remaining item in the queue, which may unblock callers of :meth:`~Queue."
182-
"join`."
177+
"If *immediate* is false (the default), the queue can be wound down normally "
178+
"with :meth:`~Queue.get` calls to extract tasks that have already been loaded."
179+
msgstr ""
180+
181+
#: ../../library/asyncio-queue.rst:116
182+
msgid ""
183+
"And if :meth:`~Queue.task_done` is called for each remaining task, a "
184+
"pending :meth:`~Queue.join` will be unblocked normally."
183185
msgstr ""
184186

185-
#: ../../library/asyncio-queue.rst:121
187+
#: ../../library/asyncio-queue.rst:119
188+
msgid ""
189+
"Once the queue is empty, future calls to :meth:`~Queue.get` will raise :exc:"
190+
"`QueueShutDown`."
191+
msgstr ""
192+
193+
#: ../../library/asyncio-queue.rst:122
194+
msgid ""
195+
"If *immediate* is true, the queue is terminated immediately. The queue is "
196+
"drained to be completely empty. All callers of :meth:`~Queue.join` are "
197+
"unblocked regardless of the number of unfinished tasks. Blocked callers of :"
198+
"meth:`~Queue.get` are unblocked and will raise :exc:`QueueShutDown` because "
199+
"the queue is empty."
200+
msgstr ""
201+
202+
#: ../../library/asyncio-queue.rst:129
203+
msgid ""
204+
"Use caution when using :meth:`~Queue.join` with *immediate* set to true. "
205+
"This unblocks the join even when no work has been done on the tasks, "
206+
"violating the usual invariant for joining a queue."
207+
msgstr ""
208+
209+
#: ../../library/asyncio-queue.rst:137
186210
msgid "Indicate that a formerly enqueued work item is complete."
187211
msgstr "表示前面一個排隊的工作項目已經完成。"
188212

189-
#: ../../library/asyncio-queue.rst:123
213+
#: ../../library/asyncio-queue.rst:139
190214
msgid ""
191215
"Used by queue consumers. For each :meth:`~Queue.get` used to fetch a work "
192216
"item, a subsequent call to :meth:`task_done` tells the queue that the "
@@ -195,7 +219,7 @@ msgstr ""
195219
"由佇列消耗者使用。對於每個用於取得一個工作項目的 :meth:`~Queue.get`,接續的 :"
196220
"meth:`task_done` 呼叫會告訴佇列這個工作項目的處理已經完成。"
197221

198-
#: ../../library/asyncio-queue.rst:127
222+
#: ../../library/asyncio-queue.rst:143
199223
msgid ""
200224
"If a :meth:`join` is currently blocking, it will resume when all items have "
201225
"been processed (meaning that a :meth:`task_done` call was received for every "
@@ -204,76 +228,70 @@ msgstr ""
204228
"如果 :meth:`join` 目前正在阻塞,在所有項目都被處理後會解除阻塞(意味著每個"
205229
"以 :meth:`~Queue.put` 放進佇列的條目都會收到一個 :meth:`task_done`)。"
206230

207-
#: ../../library/asyncio-queue.rst:132
208-
msgid ""
209-
"``shutdown(immediate=True)`` calls :meth:`task_done` for each remaining item "
210-
"in the queue."
211-
msgstr ""
212-
213-
#: ../../library/asyncio-queue.rst:135
231+
#: ../../library/asyncio-queue.rst:148
214232
msgid ""
215233
"Raises :exc:`ValueError` if called more times than there were items placed "
216234
"in the queue."
217235
msgstr "如果被呼叫的次數多於放入佇列中的項目數量,將引發 :exc:`ValueError`。"
218236

219-
#: ../../library/asyncio-queue.rst:140
237+
#: ../../library/asyncio-queue.rst:153
220238
msgid "Priority Queue"
221239
msgstr "Priority Queue(優先佇列)"
222240

223-
#: ../../library/asyncio-queue.rst:144
241+
#: ../../library/asyncio-queue.rst:157
224242
msgid ""
225243
"A variant of :class:`Queue`; retrieves entries in priority order (lowest "
226244
"first)."
227245
msgstr ":class:`Queue` 的變形;按優先順序取出條目 (最小的先取出)。"
228246

229-
#: ../../library/asyncio-queue.rst:147
247+
#: ../../library/asyncio-queue.rst:160
230248
msgid "Entries are typically tuples of the form ``(priority_number, data)``."
231249
msgstr "條目通常是 ``(priority_number, data)`` 形式的 tuple(元組)。"
232250

233-
#: ../../library/asyncio-queue.rst:152
251+
#: ../../library/asyncio-queue.rst:165
234252
msgid "LIFO Queue"
235253
msgstr "LIFO Queue"
236254

237-
#: ../../library/asyncio-queue.rst:156
255+
#: ../../library/asyncio-queue.rst:169
238256
msgid ""
239257
"A variant of :class:`Queue` that retrieves most recently added entries first "
240258
"(last in, first out)."
241259
msgstr ":class:`Queue` 的變形,先取出最近新增的條目(後進先出)。"
242260

243-
#: ../../library/asyncio-queue.rst:161
261+
#: ../../library/asyncio-queue.rst:174
244262
msgid "Exceptions"
245263
msgstr "例外"
246264

247-
#: ../../library/asyncio-queue.rst:165
265+
#: ../../library/asyncio-queue.rst:178
248266
msgid ""
249267
"This exception is raised when the :meth:`~Queue.get_nowait` method is called "
250268
"on an empty queue."
251269
msgstr "當佇列為空的時候,呼叫 :meth:`~Queue.get_nowait` 方法會引發這個例外。"
252270

253-
#: ../../library/asyncio-queue.rst:171
271+
#: ../../library/asyncio-queue.rst:184
254272
msgid ""
255273
"Exception raised when the :meth:`~Queue.put_nowait` method is called on a "
256274
"queue that has reached its *maxsize*."
257275
msgstr ""
258276
"當佇列中條目數量已經達到它的 *maxsize* 時,呼叫 :meth:`~Queue.put_nowait` 方"
259277
"法會引發這個例外。"
260278

261-
#: ../../library/asyncio-queue.rst:177
279+
#: ../../library/asyncio-queue.rst:190
262280
msgid ""
263281
"Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on "
264282
"a queue which has been shut down."
265283
msgstr ""
266284

267-
#: ../../library/asyncio-queue.rst:184
285+
#: ../../library/asyncio-queue.rst:197
268286
msgid "Examples"
269287
msgstr "範例"
270288

271-
#: ../../library/asyncio-queue.rst:188
289+
#: ../../library/asyncio-queue.rst:201
272290
msgid ""
273291
"Queues can be used to distribute workload between several concurrent tasks::"
274292
msgstr "佇列能被用於多個並行任務的工作分配:"
275293

276-
#: ../../library/asyncio-queue.rst:191
294+
#: ../../library/asyncio-queue.rst:204
277295
msgid ""
278296
"import asyncio\n"
279297
"import random\n"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy