44msgstr ""
55"Project-Id-Version : Python 3.14\n "
66"Report-Msgid-Bugs-To : \n "
7- "POT-Creation-Date : 2026-01-27 00:17 +0000\n "
7+ "POT-Creation-Date : 2026-01-28 00:16 +0000\n "
88"PO-Revision-Date : 2025-07-30 22:06+0800\n "
99"Last-Translator : \n "
1010"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -211,32 +211,38 @@ msgstr ""
211211"# 在重設呼叫之後,var 又沒有值了,所以\n"
212212"# var.get() 會引發 LookupError。"
213213
214- #: ../../library/contextvars.rst:125
214+ #: ../../library/contextvars.rst:122
215+ msgid "The same *token* cannot be used twice."
216+ msgstr ""
217+
218+ #: ../../library/contextvars.rst:127
219+ #, fuzzy
215220msgid ""
216221"*Token* objects are returned by the :meth:`ContextVar.set` method. They can "
217222"be passed to the :meth:`ContextVar.reset` method to revert the value of the "
218- "variable to what it was before the corresponding *set*."
223+ "variable to what it was before the corresponding *set*. A single token "
224+ "cannot reset a context variable more than once."
219225msgstr ""
220226"*Token* 物件由 :meth:`ContextVar.set` 方法回傳,可以傳遞給 :meth:`ContextVar."
221227"reset` 方法,用以將變數的值還原為相對應的 *set* 之前的值。"
222228
223- #: ../../library/contextvars.rst:130
229+ #: ../../library/contextvars.rst:132
224230msgid ""
225231"Tokens support the :ref:`context manager protocol <context-managers>` to "
226232"automatically reset context variables. See :meth:`ContextVar.set`."
227233msgstr ""
228234
229- #: ../../library/contextvars.rst:135
235+ #: ../../library/contextvars.rst:137
230236msgid "Added support for usage as a context manager."
231237msgstr "新增對用作情境管理器的支援。"
232238
233- #: ../../library/contextvars.rst:139
239+ #: ../../library/contextvars.rst:141
234240msgid ""
235241"A read-only property. Points to the :class:`ContextVar` object that created "
236242"the token."
237243msgstr "唯讀屬性。 指向建立 token 的 :class:`ContextVar` 物件。"
238244
239- #: ../../library/contextvars.rst:144
245+ #: ../../library/contextvars.rst:146
240246msgid ""
241247"A read-only property. Set to the value the variable had before the :meth:"
242248"`ContextVar.set` method call that created the token. It points to :attr:"
@@ -245,34 +251,34 @@ msgstr ""
245251"唯讀屬性。 值為變數在呼叫 :meth:`ContextVar.set` 方法之前的值。如果變數在呼叫"
246252"前沒有設定,則指向 :attr:`Token.MISSING`。"
247253
248- #: ../../library/contextvars.rst:151
254+ #: ../../library/contextvars.rst:153
249255msgid "A marker object used by :attr:`Token.old_value`."
250256msgstr "由 :attr:`Token.old_value` 使用的標記物件。"
251257
252- #: ../../library/contextvars.rst:155
258+ #: ../../library/contextvars.rst:157
253259msgid "Manual Context Management"
254260msgstr "手動情境管理"
255261
256- #: ../../library/contextvars.rst:159
262+ #: ../../library/contextvars.rst:161
257263msgid "Returns a copy of the current :class:`~contextvars.Context` object."
258264msgstr "回傳目前 :class:`~contextvars.Context` 物件的複本(copy)。"
259265
260- #: ../../library/contextvars.rst:161
266+ #: ../../library/contextvars.rst:163
261267msgid ""
262268"The following snippet gets a copy of the current context and prints all "
263269"variables and their values that are set in it::"
264270msgstr ""
265271"以下程式碼片段會取得目前情境的複本,並顯示在其中設定的所有變數及其值:::"
266272
267- #: ../../library/contextvars.rst:164
273+ #: ../../library/contextvars.rst:166
268274msgid ""
269275"ctx: Context = copy_context()\n"
270276"print(list(ctx.items()))"
271277msgstr ""
272278"ctx: Context = copy_context()\n"
273279"print(list(ctx.items()))"
274280
275- #: ../../library/contextvars.rst:167
281+ #: ../../library/contextvars.rst:169
276282msgid ""
277283"The function has an *O*\\ (1) complexity, i.e. works equally fast for "
278284"contexts with a few context variables and for contexts that have a lot of "
@@ -281,19 +287,19 @@ msgstr ""
281287"這個函式具有 *O*\\ (1) 的複雜度,也就是說,對於只有少許情境變數的情境和有大量"
282288"情境變數的情境,速度都一樣快。"
283289
284- #: ../../library/contextvars.rst:174
290+ #: ../../library/contextvars.rst:176
285291msgid "A mapping of :class:`ContextVars <ContextVar>` to their values."
286292msgstr ":class:`ContextVars<ContextVar>` 到其值的映射。"
287293
288- #: ../../library/contextvars.rst:176
294+ #: ../../library/contextvars.rst:178
289295msgid ""
290296"``Context()`` creates an empty context with no values in it. To get a copy "
291297"of the current context use the :func:`~contextvars.copy_context` function."
292298msgstr ""
293299"``Context()`` 會建立一個沒有值的空情境。要取得目前情境的複本,請使用 :func:"
294300"`~contextvars.copy_context` 函式。"
295301
296- #: ../../library/contextvars.rst:180
302+ #: ../../library/contextvars.rst:182
297303msgid ""
298304"Each thread has its own effective stack of :class:`!Context` objects. The :"
299305"term:`current context` is the :class:`!Context` object at the top of the "
@@ -304,7 +310,7 @@ msgstr ""
304310"term:`current context` 是目前執行緒堆疊頂端的 :class:`!Context` 物件。 堆疊"
305311"中的所有 :class:`!Context` 物件都被視為\\ *已進入*。"
306312
307- #: ../../library/contextvars.rst:185
313+ #: ../../library/contextvars.rst:187
308314msgid ""
309315"*Entering* a context, which can be done by calling its :meth:`~Context.run` "
310316"method, makes the context the current context by pushing it onto the top of "
@@ -313,7 +319,7 @@ msgstr ""
313319"*進入*\\ 一個情境,可以藉由呼叫其 :meth:`~Context.run` 方法來完成,此\\ *進入"
314320"*\\ 的動作會將一情境推到目前執行緒的情境堆疊的頂端,使該情境成為目前的情境。"
315321
316- #: ../../library/contextvars.rst:189
322+ #: ../../library/contextvars.rst:191
317323msgid ""
318324"*Exiting* from the current context, which can be done by returning from the "
319325"callback passed to the :meth:`~Context.run` method, restores the current "
@@ -324,7 +330,7 @@ msgstr ""
324330"式回傳之後,就會自動\\ *退出*\\ 目前的情境,這會將目前的情境還原到進入情境之"
325331"前的狀態,方法是將情境從情境堆疊的頂端彈出。"
326332
327- #: ../../library/contextvars.rst:194
333+ #: ../../library/contextvars.rst:196
328334msgid ""
329335"Since each thread has its own context stack, :class:`ContextVar` objects "
330336"behave in a similar fashion to :func:`threading.local` when values are "
@@ -333,19 +339,19 @@ msgstr ""
333339"因為每個執行緒都有自己的情境堆疊,當值在不同的執行緒中被指定時, :class:"
334340"`ContextVar` 物件的行為與 :func:`threading.local` 相似。"
335341
336- #: ../../library/contextvars.rst:198
342+ #: ../../library/contextvars.rst:200
337343msgid ""
338344"Attempting to enter an already entered context, including contexts entered "
339345"in other threads, raises a :exc:`RuntimeError`."
340346msgstr ""
341347"嘗試進入已進入的情境,包括在其他執行緒中進入的情境,會引發 :exc:"
342348"`RuntimeError`。"
343349
344- #: ../../library/contextvars.rst:201
350+ #: ../../library/contextvars.rst:203
345351msgid "After exiting a context, it can later be re-entered (from any thread)."
346352msgstr "退出情境後,之後可以重新進入(從任何執行緒)。"
347353
348- #: ../../library/contextvars.rst:203
354+ #: ../../library/contextvars.rst:205
349355msgid ""
350356"Any changes to :class:`ContextVar` values via the :meth:`ContextVar.set` "
351357"method are recorded in the current context. The :meth:`ContextVar.get` "
@@ -359,11 +365,11 @@ msgstr ""
359365"實際造成的效果會像是將其在進入情境時對情境變數所做的任何變一一彈出並還原(如"
360366"果需要,可以透過重新進入情境來還原值)。"
361367
362- #: ../../library/contextvars.rst:210
368+ #: ../../library/contextvars.rst:212
363369msgid "Context implements the :class:`collections.abc.Mapping` interface."
364370msgstr "情境(Context)實作了 :class:`collections.abc.Mapping` 介面。"
365371
366- #: ../../library/contextvars.rst:214
372+ #: ../../library/contextvars.rst:216
367373msgid ""
368374"Enters the Context, executes ``callable(*args, **kwargs)``, then exits the "
369375"Context. Returns *callable*'s return value, or propagates an exception if "
@@ -372,11 +378,11 @@ msgstr ""
372378"進入 Context,執行 ``callable(*args, **kwargs)``,然後退出 Context。 回傳 "
373379"*callable* 的回傳值,如果發生例外(exception),則傳播例外。"
374380
375- #: ../../library/contextvars.rst:218
381+ #: ../../library/contextvars.rst:220
376382msgid "Example:"
377383msgstr "例如:"
378384
379- #: ../../library/contextvars.rst:220
385+ #: ../../library/contextvars.rst:222
380386msgid ""
381387"import contextvars\n"
382388"\n"
@@ -440,60 +446,60 @@ msgstr ""
440446"# 但是,在 'ctx' 外, 'var' 的值仍然是 'spam':\n"
441447"print(var.get()) # 'spam'"
442448
443- #: ../../library/contextvars.rst:266
449+ #: ../../library/contextvars.rst:268
444450msgid "Return a shallow copy of the context object."
445451msgstr "回傳情境物件的淺層複本(shallow copy)。"
446452
447- #: ../../library/contextvars.rst:270
453+ #: ../../library/contextvars.rst:272
448454msgid ""
449455"Return ``True`` if the *context* has a value for *var* set; return ``False`` "
450456"otherwise."
451457msgstr ""
452458"如果\\ *情境*\\ 裡面有 *var* 的值,則回傳 ``True``,否則回傳 ``False``。"
453459
454- #: ../../library/contextvars.rst:275
460+ #: ../../library/contextvars.rst:277
455461msgid ""
456462"Return the value of the *var* :class:`ContextVar` variable. If the variable "
457463"is not set in the context object, a :exc:`KeyError` is raised."
458464msgstr ""
459465"回傳 *var* :class:`ContextVar` 變數的值。如果該變數並沒有在情境物件中設定,則"
460466"會引發 :exc:`KeyError` 錯誤。"
461467
462- #: ../../library/contextvars.rst:281
468+ #: ../../library/contextvars.rst:283
463469msgid ""
464470"Return the value for *var* if *var* has the value in the context object. "
465471"Return *default* otherwise. If *default* is not given, return ``None``."
466472msgstr ""
467473"如果 *var* 的值在情境物件中,則回傳 *var* 的值。否則回傳 *default*。如果沒有 "
468474"*default* 值,則回傳 ``None``。"
469475
470- #: ../../library/contextvars.rst:287
476+ #: ../../library/contextvars.rst:289
471477msgid "Return an iterator over the variables stored in the context object."
472478msgstr "回傳儲存於情境物件中變數的疊代器。"
473479
474- #: ../../library/contextvars.rst:292
480+ #: ../../library/contextvars.rst:294
475481msgid "Return the number of variables set in the context object."
476482msgstr "回傳情境物件中的變數個數。"
477483
478- #: ../../library/contextvars.rst:296
484+ #: ../../library/contextvars.rst:298
479485msgid "Return a list of all variables in the context object."
480486msgstr "回傳情境物件中所有變數的串列。"
481487
482- #: ../../library/contextvars.rst:300
488+ #: ../../library/contextvars.rst:302
483489msgid "Return a list of all variables' values in the context object."
484490msgstr "回傳情境物件中所有變數的值的串列。"
485491
486- #: ../../library/contextvars.rst:305
492+ #: ../../library/contextvars.rst:307
487493msgid ""
488494"Return a list of 2-tuples containing all variables and their values in the "
489495"context object."
490496msgstr "回傳情境物件中所有變數與其值的 2-元組(2-tuples)的串列。"
491497
492- #: ../../library/contextvars.rst:310
498+ #: ../../library/contextvars.rst:312
493499msgid "asyncio support"
494500msgstr "對 asyncio 的支援"
495501
496- #: ../../library/contextvars.rst:312
502+ #: ../../library/contextvars.rst:314
497503msgid ""
498504"Context variables are natively supported in :mod:`asyncio` and are ready to "
499505"be used without any extra configuration. For example, here is a simple echo "
@@ -503,7 +509,7 @@ msgstr ""
503509":mod:`asyncio` 原生支援情境變數,不需任何額外設定。 舉例來說,以下是一個簡單"
504510"的 echo 伺服器,使用情境變數讓遠端用戶端的位址在處理該用戶端的任務中可用:"
505511
506- #: ../../library/contextvars.rst:318
512+ #: ../../library/contextvars.rst:320
507513msgid ""
508514"import asyncio\n"
509515"import contextvars\n"
0 commit comments