From 8516262ee9fe39cc105042d08fbd384f6b8ecc4e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 11 Apr 2026 16:08:03 +0000 Subject: [PATCH 1/6] sync with cpython 620fb743 --- library/sys.monitoring.po | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index 3d4525d952b..5af1c69f1e5 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-07 00:19+0000\n" +"POT-Creation-Date: 2026-04-11 16:06+0000\n" "PO-Revision-Date: 2025-11-07 17:51+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -21,10 +21,12 @@ msgid ":mod:`!sys.monitoring` --- Execution event monitoring" msgstr ":mod:`!sys.monitoring` --- 執行事件監控" #: ../../library/sys.monitoring.rst:13 +#, fuzzy msgid "" ":mod:`!sys.monitoring` is a namespace within the :mod:`sys` module, not an " -"independent module, so there is no need to ``import sys.monitoring``, simply " -"``import sys`` and then use ``sys.monitoring``." +"independent module, and ``import sys.monitoring`` would fail with a :exc:" +"`ModuleNotFoundError`. Instead, simply ``import sys`` and then use ``sys." +"monitoring``." msgstr "" ":mod:`!sys.monitoring` 是 :mod:`sys` 模組內的一個命名空間,不是一個獨立的模" "組,所以不需要 ``import sys.monitoring``,只需 ``import sys`` 然後使用 ``sys." From 5ea3e3a1dc7cc3c7890b4c9698a0ef8516642123 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 12 Apr 2026 00:26:50 +0000 Subject: [PATCH 2/6] sync with cpython 47b916e2 --- c-api/dict.po | 233 ++++++++++++++++++++------------- c-api/set.po | 84 +++++++----- library/importlib.resources.po | 133 ++++++++++--------- 3 files changed, 267 insertions(+), 183 deletions(-) diff --git a/c-api/dict.po b/c-api/dict.po index e23ff151870..19edbd8f092 100644 --- a/c-api/dict.po +++ b/c-api/dict.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-02 00:15+0000\n" +"POT-Creation-Date: 2026-04-12 00:25+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -84,18 +84,26 @@ msgid "" "is equivalent to the Python expression ``key in p``." msgstr "" -#: ../../c-api/dict.rst:71 +#: ../../c-api/dict.rst:70 ../../c-api/dict.rst:97 ../../c-api/dict.rst:117 +#: ../../c-api/dict.rst:140 ../../c-api/dict.rst:257 ../../c-api/dict.rst:279 +msgid "" +"The operation is atomic on :term:`free threading ` when " +"*key* is :class:`str`, :class:`int`, :class:`float`, :class:`bool` or :class:" +"`bytes`." +msgstr "" + +#: ../../c-api/dict.rst:76 msgid "" "This is the same as :c:func:`PyDict_Contains`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/dict.rst:80 +#: ../../c-api/dict.rst:85 msgid "Return a new dictionary that contains the same key-value pairs as *p*." msgstr "回傳一個新的字典,包含與 *p* 相同的鍵值對。" -#: ../../c-api/dict.rst:85 +#: ../../c-api/dict.rst:90 msgid "" "Insert *val* into the dictionary *p* with a key of *key*. *key* must be :" "term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return ``0`` " @@ -103,14 +111,14 @@ msgid "" "to *val*." msgstr "" -#: ../../c-api/dict.rst:93 +#: ../../c-api/dict.rst:103 msgid "" "This is the same as :c:func:`PyDict_SetItem`, but *key* is specified as a :c:" "expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/dict.rst:100 +#: ../../c-api/dict.rst:110 msgid "" "Remove the entry in dictionary *p* with key *key*. *key* must be :term:" "`hashable`; if it isn't, :exc:`TypeError` is raised. If *key* is not in the " @@ -118,72 +126,79 @@ msgid "" "failure." msgstr "" -#: ../../c-api/dict.rst:108 +#: ../../c-api/dict.rst:123 msgid "" "This is the same as :c:func:`PyDict_DelItem`, but *key* is specified as a :c:" "expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/dict.rst:115 +#: ../../c-api/dict.rst:130 msgid "" "Return a new :term:`strong reference` to the object from dictionary *p* " "which has a key *key*:" msgstr "" -#: ../../c-api/dict.rst:118 +#: ../../c-api/dict.rst:133 msgid "" "If the key is present, set *\\*result* to a new :term:`strong reference` to " "the value and return ``1``." msgstr "" -#: ../../c-api/dict.rst:120 +#: ../../c-api/dict.rst:135 msgid "If the key is missing, set *\\*result* to ``NULL`` and return ``0``." msgstr "如果鍵不存在,將 *\\*result* 設為 ``NULL`` 並回傳 ``0``。" -#: ../../c-api/dict.rst:121 ../../c-api/dict.rst:218 +#: ../../c-api/dict.rst:136 ../../c-api/dict.rst:272 msgid "On error, raise an exception and return ``-1``." msgstr "錯誤發生時,引發一個例外並回傳 ``-1``。" -#: ../../c-api/dict.rst:125 +#: ../../c-api/dict.rst:145 msgid "See also the :c:func:`PyObject_GetItem` function." msgstr "另見 :c:func:`PyObject_GetItem` 函式。" -#: ../../c-api/dict.rst:130 +#: ../../c-api/dict.rst:150 msgid "" "Return a :term:`borrowed reference` to the object from dictionary *p* which " "has a key *key*. Return ``NULL`` if the key *key* is missing *without* " "setting an exception." msgstr "" -#: ../../c-api/dict.rst:136 +#: ../../c-api/dict.rst:156 msgid "" "Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" "`~object.__eq__` methods are silently ignored. Prefer the :c:func:" "`PyDict_GetItemWithError` function instead." msgstr "" -#: ../../c-api/dict.rst:140 +#: ../../c-api/dict.rst:162 ../../c-api/dict.rst:181 +msgid "" +"In the :term:`free-threaded build`, the returned :term:`borrowed reference` " +"may become invalid if another thread modifies the dictionary concurrently. " +"Prefer :c:func:`PyDict_GetItemRef`, which returns a :term:`strong reference`." +msgstr "" + +#: ../../c-api/dict.rst:167 msgid "" "Calling this API without an :term:`attached thread state` had been allowed " "for historical reason. It is no longer allowed." msgstr "" -#: ../../c-api/dict.rst:147 +#: ../../c-api/dict.rst:174 msgid "" "Variant of :c:func:`PyDict_GetItem` that does not suppress exceptions. " "Return ``NULL`` **with** an exception set if an exception occurred. Return " "``NULL`` **without** an exception set if the key wasn't present." msgstr "" -#: ../../c-api/dict.rst:155 +#: ../../c-api/dict.rst:189 msgid "" "This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a :c:" "expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/dict.rst:161 +#: ../../c-api/dict.rst:195 msgid "" "Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" "`~object.__eq__` methods or while creating the temporary :class:`str` object " @@ -191,13 +206,21 @@ msgid "" "function with your own :c:func:`PyUnicode_FromString` *key* instead." msgstr "" -#: ../../c-api/dict.rst:170 +#: ../../c-api/dict.rst:203 +msgid "" +"In the :term:`free-threaded build`, the returned :term:`borrowed reference` " +"may become invalid if another thread modifies the dictionary concurrently. " +"Prefer :c:func:`PyDict_GetItemStringRef`, which returns a :term:`strong " +"reference`." +msgstr "" + +#: ../../c-api/dict.rst:211 msgid "" "Similar to :c:func:`PyDict_GetItemRef`, but *key* is specified as a :c:expr:" "`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." msgstr "" -#: ../../c-api/dict.rst:179 +#: ../../c-api/dict.rst:220 msgid "" "This is the same as the Python-level :meth:`dict.setdefault`. If present, " "it returns the value corresponding to *key* from the dictionary *p*. If the " @@ -207,7 +230,15 @@ msgid "" "the insertion." msgstr "" -#: ../../c-api/dict.rst:190 +#: ../../c-api/dict.rst:230 +msgid "" +"In the :term:`free-threaded build`, the returned :term:`borrowed reference` " +"may become invalid if another thread modifies the dictionary concurrently. " +"Prefer :c:func:`PyDict_SetDefaultRef`, which returns a :term:`strong " +"reference`." +msgstr "" + +#: ../../c-api/dict.rst:239 msgid "" "Inserts *default_value* into the dictionary *p* with a key of *key* if the " "key is not already present in the dictionary. If *result* is not ``NULL``, " @@ -219,7 +250,7 @@ msgid "" "exception, and sets ``*result`` to ``NULL``." msgstr "" -#: ../../c-api/dict.rst:200 +#: ../../c-api/dict.rst:249 msgid "" "For clarity: if you have a strong reference to *default_value* before " "calling this function, then after it returns, you hold a strong reference to " @@ -227,63 +258,63 @@ msgid "" "to the same object: in that case you hold two separate references to it." msgstr "" -#: ../../c-api/dict.rst:211 +#: ../../c-api/dict.rst:265 msgid "" "Remove *key* from dictionary *p* and optionally return the removed value. Do " "not raise :exc:`KeyError` if the key is missing." msgstr "" -#: ../../c-api/dict.rst:214 +#: ../../c-api/dict.rst:268 msgid "" "If the key is present, set *\\*result* to a new reference to the removed " "value if *result* is not ``NULL``, and return ``1``." msgstr "" -#: ../../c-api/dict.rst:216 +#: ../../c-api/dict.rst:270 msgid "" "If the key is missing, set *\\*result* to ``NULL`` if *result* is not " "``NULL``, and return ``0``." msgstr "" -#: ../../c-api/dict.rst:220 +#: ../../c-api/dict.rst:274 msgid "" "Similar to :meth:`dict.pop`, but without the default value and not raising :" "exc:`KeyError` if the key is missing." msgstr "" -#: ../../c-api/dict.rst:228 +#: ../../c-api/dict.rst:287 msgid "" "Similar to :c:func:`PyDict_Pop`, but *key* is specified as a :c:expr:`const " "char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." msgstr "" -#: ../../c-api/dict.rst:237 +#: ../../c-api/dict.rst:296 msgid "" "Return a :c:type:`PyListObject` containing all the items from the dictionary." msgstr "回傳一個包含字典中所有項目的 :c:type:`PyListObject`。" -#: ../../c-api/dict.rst:242 +#: ../../c-api/dict.rst:301 msgid "" "Return a :c:type:`PyListObject` containing all the keys from the dictionary." msgstr "回傳一個包含字典中所有鍵的 :c:type:`PyListObject`。" -#: ../../c-api/dict.rst:247 +#: ../../c-api/dict.rst:306 msgid "" "Return a :c:type:`PyListObject` containing all the values from the " "dictionary *p*." msgstr "回傳一個包含字典 *p* 中所有值的 :c:type:`PyListObject`。" -#: ../../c-api/dict.rst:255 +#: ../../c-api/dict.rst:314 msgid "" "Return the number of items in the dictionary. This is equivalent to " "``len(p)`` on a dictionary." msgstr "回傳字典中項目的數量。此與於字典呼叫 ``len(p)`` 等效。" -#: ../../c-api/dict.rst:261 +#: ../../c-api/dict.rst:320 msgid "Similar to :c:func:`PyDict_Size`, but without error checking." msgstr "和 :c:func:`PyDict_Size` 類似,但沒有錯誤檢查。" -#: ../../c-api/dict.rst:266 +#: ../../c-api/dict.rst:325 msgid "" "Iterate over all key-value pairs in the dictionary *p*. The :c:type:" "`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` prior to the " @@ -297,11 +328,11 @@ msgid "" "structure is sparse, the offsets are not consecutive." msgstr "" -#: ../../c-api/dict.rst:277 +#: ../../c-api/dict.rst:336 msgid "For example::" msgstr "舉例來說: ::" -#: ../../c-api/dict.rst:279 +#: ../../c-api/dict.rst:338 msgid "" "PyObject *key, *value;\n" "Py_ssize_t pos = 0;\n" @@ -319,14 +350,14 @@ msgstr "" " ...\n" "}" -#: ../../c-api/dict.rst:287 +#: ../../c-api/dict.rst:346 msgid "" "The dictionary *p* should not be mutated during iteration. It is safe to " "modify the values of the keys as you iterate over the dictionary, but only " "so long as the set of keys does not change. For example::" msgstr "" -#: ../../c-api/dict.rst:291 +#: ../../c-api/dict.rst:350 msgid "" "PyObject *key, *value;\n" "Py_ssize_t pos = 0;\n" @@ -364,14 +395,14 @@ msgstr "" " Py_DECREF(o);\n" "}" -#: ../../c-api/dict.rst:309 +#: ../../c-api/dict.rst:368 msgid "" "The function is not thread-safe in the :term:`free-threaded ` build without external synchronization. You can use :c:macro:" "`Py_BEGIN_CRITICAL_SECTION` to lock the dictionary while iterating over it::" msgstr "" -#: ../../c-api/dict.rst:314 +#: ../../c-api/dict.rst:373 msgid "" "Py_BEGIN_CRITICAL_SECTION(self->dict);\n" "while (PyDict_Next(self->dict, &pos, &key, &value)) {\n" @@ -385,7 +416,7 @@ msgstr "" "}\n" "Py_END_CRITICAL_SECTION();" -#: ../../c-api/dict.rst:322 +#: ../../c-api/dict.rst:381 msgid "" "On the free-threaded build, this function can be used safely inside a " "critical section. However, the references returned for *pkey* and *pvalue* " @@ -396,7 +427,7 @@ msgid "" "`Py_NewRef`)." msgstr "" -#: ../../c-api/dict.rst:332 +#: ../../c-api/dict.rst:391 msgid "" "Iterate over mapping object *b* adding key-value pairs to dictionary *a*. " "*b* may be a dictionary, or any object supporting :c:func:`PyMapping_Keys` " @@ -406,7 +437,15 @@ msgid "" "or ``-1`` if an exception was raised." msgstr "" -#: ../../c-api/dict.rst:342 +#: ../../c-api/dict.rst:400 ../../c-api/dict.rst:416 +msgid "" +"In the :term:`free-threaded build`, when *b* is a :class:`dict` (with the " +"standard iterator), both *a* and *b* are locked for the duration of the " +"operation. When *b* is a non-dict mapping, only *a* is locked; *b* may be " +"concurrently modified by another thread." +msgstr "" + +#: ../../c-api/dict.rst:408 msgid "" "This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to ``a." "update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall back " @@ -415,7 +454,7 @@ msgid "" "exception was raised." msgstr "" -#: ../../c-api/dict.rst:351 +#: ../../c-api/dict.rst:424 msgid "" "Update or merge into dictionary *a*, from the key-value pairs in *seq2*. " "*seq2* must be an iterable object producing iterable objects of length 2, " @@ -424,7 +463,7 @@ msgid "" "if an exception was raised. Equivalent Python (except for the return value)::" msgstr "" -#: ../../c-api/dict.rst:358 +#: ../../c-api/dict.rst:431 msgid "" "def PyDict_MergeFromSeq2(a, seq2, override):\n" " for key, value in seq2:\n" @@ -436,7 +475,14 @@ msgstr "" " if override or key not in a:\n" " a[key] = value" -#: ../../c-api/dict.rst:365 +#: ../../c-api/dict.rst:438 +msgid "" +"In the :term:`free-threaded ` build, only *a* is locked. The " +"iteration over *seq2* is not synchronized; *seq2* may be concurrently " +"modified by another thread." +msgstr "" + +#: ../../c-api/dict.rst:445 msgid "" "Register *callback* as a dictionary watcher. Return a non-negative integer " "id which must be passed to future calls to :c:func:`PyDict_Watch`. In case " @@ -444,21 +490,28 @@ msgid "" "exception." msgstr "" -#: ../../c-api/dict.rst:374 +#: ../../c-api/dict.rst:452 ../../c-api/dict.rst:467 +msgid "" +"This function is not internally synchronized. In the :term:`free-threaded " +"` build, callers should ensure no concurrent calls to :c:" +"func:`PyDict_AddWatcher` or :c:func:`PyDict_ClearWatcher` are in progress." +msgstr "" + +#: ../../c-api/dict.rst:461 msgid "" "Clear watcher identified by *watcher_id* previously returned from :c:func:" "`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error (e.g. if the " "given *watcher_id* was never registered.)" msgstr "" -#: ../../c-api/dict.rst:382 +#: ../../c-api/dict.rst:476 msgid "" "Mark dictionary *dict* as watched. The callback granted *watcher_id* by :c:" "func:`PyDict_AddWatcher` will be called when *dict* is modified or " "deallocated. Return ``0`` on success or ``-1`` on error." msgstr "" -#: ../../c-api/dict.rst:390 +#: ../../c-api/dict.rst:484 msgid "" "Mark dictionary *dict* as no longer watched. The callback granted " "*watcher_id* by :c:func:`PyDict_AddWatcher` will no longer be called when " @@ -466,7 +519,7 @@ msgid "" "watched by this watcher. Return ``0`` on success or ``-1`` on error." msgstr "" -#: ../../c-api/dict.rst:399 +#: ../../c-api/dict.rst:493 msgid "" "Enumeration of possible dictionary watcher events: ``PyDict_EVENT_ADDED``, " "``PyDict_EVENT_MODIFIED``, ``PyDict_EVENT_DELETED``, " @@ -474,11 +527,11 @@ msgid "" "``PyDict_EVENT_DEALLOCATED``." msgstr "" -#: ../../c-api/dict.rst:407 +#: ../../c-api/dict.rst:501 msgid "Type of a dict watcher callback function." msgstr "" -#: ../../c-api/dict.rst:409 +#: ../../c-api/dict.rst:503 msgid "" "If *event* is ``PyDict_EVENT_CLEARED`` or ``PyDict_EVENT_DEALLOCATED``, both " "*key* and *new_value* will be ``NULL``. If *event* is ``PyDict_EVENT_ADDED`` " @@ -487,7 +540,7 @@ msgid "" "dictionary and *new_value* will be ``NULL``." msgstr "" -#: ../../c-api/dict.rst:415 +#: ../../c-api/dict.rst:509 msgid "" "``PyDict_EVENT_CLONED`` occurs when *dict* was previously empty and another " "dict is merged into it. To maintain efficiency of this operation, per-key " @@ -495,14 +548,14 @@ msgid "" "``PyDict_EVENT_CLONED`` is issued, and *key* will be the source dictionary." msgstr "" -#: ../../c-api/dict.rst:421 +#: ../../c-api/dict.rst:515 msgid "" "The callback may inspect but must not modify *dict*; doing so could have " "unpredictable effects, including infinite recursion. Do not trigger Python " "code execution in the callback, as it could modify the dict as a side effect." msgstr "" -#: ../../c-api/dict.rst:425 +#: ../../c-api/dict.rst:519 msgid "" "If *event* is ``PyDict_EVENT_DEALLOCATED``, taking a new reference in the " "callback to the about-to-be-destroyed dictionary will resurrect it and " @@ -511,20 +564,20 @@ msgid "" "again." msgstr "" -#: ../../c-api/dict.rst:431 +#: ../../c-api/dict.rst:525 msgid "" "Callbacks occur before the notified modification to *dict* takes place, so " "the prior state of *dict* can be inspected." msgstr "" -#: ../../c-api/dict.rst:434 +#: ../../c-api/dict.rst:528 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " "will be printed as an unraisable exception using :c:func:" "`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -#: ../../c-api/dict.rst:438 +#: ../../c-api/dict.rst:532 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " @@ -533,11 +586,11 @@ msgid "" "it before returning." msgstr "" -#: ../../c-api/dict.rst:448 +#: ../../c-api/dict.rst:542 msgid "Dictionary View Objects" msgstr "字典視圖物件" -#: ../../c-api/dict.rst:452 +#: ../../c-api/dict.rst:546 msgid "" "Return true if *op* is a view of a set inside a dictionary. This is " "currently equivalent to :c:expr:`PyDictKeys_Check(op) || " @@ -546,55 +599,55 @@ msgstr "" "若 *op* 是一個字典中集合的視圖則會回傳 true。這目前等同於 :c:expr:" "`PyDictKeys_Check(op) || PyDictItems_Check(op)`。此函式每次都會執行成功。" -#: ../../c-api/dict.rst:459 +#: ../../c-api/dict.rst:553 msgid "" "Type object for a view of dictionary keys. In Python, this is the type of " "the object returned by :meth:`dict.keys`." msgstr "" -#: ../../c-api/dict.rst:465 +#: ../../c-api/dict.rst:559 msgid "" "Return true if *op* is an instance of a dictionary keys view. This function " "always succeeds." msgstr "若 *op* 是一個字典鍵視圖的實例則會回傳 true。此函式每次都會執行成功。" -#: ../../c-api/dict.rst:471 +#: ../../c-api/dict.rst:565 msgid "" "Type object for a view of dictionary values. In Python, this is the type of " "the object returned by :meth:`dict.values`." msgstr "" -#: ../../c-api/dict.rst:477 +#: ../../c-api/dict.rst:571 msgid "" "Return true if *op* is an instance of a dictionary values view. This " "function always succeeds." msgstr "若 *op* 是一個字典值視圖的實例則會回傳 true。此函式每次都會執行成功。" -#: ../../c-api/dict.rst:483 +#: ../../c-api/dict.rst:577 msgid "" "Type object for a view of dictionary items. In Python, this is the type of " "the object returned by :meth:`dict.items`." msgstr "" -#: ../../c-api/dict.rst:489 +#: ../../c-api/dict.rst:583 msgid "" "Return true if *op* is an instance of a dictionary items view. This function " "always succeeds." msgstr "" "若 *op* 是一個字典項目視圖的實例則會回傳 true。此函式每次都會執行成功。" -#: ../../c-api/dict.rst:494 +#: ../../c-api/dict.rst:588 msgid "Ordered Dictionaries" msgstr "有序字典" -#: ../../c-api/dict.rst:496 +#: ../../c-api/dict.rst:590 msgid "" "Python's C API provides interface for :class:`collections.OrderedDict` from " "C. Since Python 3.7, dictionaries are ordered by default, so there is " "usually little need for these functions; prefer ``PyDict*`` where possible." msgstr "" -#: ../../c-api/dict.rst:503 +#: ../../c-api/dict.rst:597 msgid "" "Type object for ordered dictionaries. This is the same object as :class:" "`collections.OrderedDict` in the Python layer." @@ -602,7 +655,7 @@ msgstr "" "有序字典的型別物件。此與 Python 層中的 :class:`collections.OrderedDict` 為同" "一個物件。" -#: ../../c-api/dict.rst:509 +#: ../../c-api/dict.rst:603 msgid "" "Return true if *od* is an ordered dictionary object or an instance of a " "subtype of the :class:`~collections.OrderedDict` type. This function always " @@ -611,7 +664,7 @@ msgstr "" "若 *od* 是一個有序字典物件或 :class:`~collections.OrderedDict` 的子型別實例則" "會回傳 true。此函式每次都會執行成功。" -#: ../../c-api/dict.rst:516 +#: ../../c-api/dict.rst:610 msgid "" "Return true if *od* is an ordered dictionary object, but not an instance of " "a subtype of the :class:`~collections.OrderedDict` type. This function " @@ -620,79 +673,79 @@ msgstr "" "若 *od* 是一個有序字典物件但並不是一個 :class:`~collections.OrderedDict` 子型" "別的實例,則回傳 true。此函式每次都會執行成功。" -#: ../../c-api/dict.rst:523 +#: ../../c-api/dict.rst:617 msgid "Analogous to :c:type:`PyDictKeys_Type` for ordered dictionaries." msgstr "" -#: ../../c-api/dict.rst:528 +#: ../../c-api/dict.rst:622 msgid "Analogous to :c:type:`PyDictValues_Type` for ordered dictionaries." msgstr "" -#: ../../c-api/dict.rst:533 +#: ../../c-api/dict.rst:627 msgid "Analogous to :c:type:`PyDictItems_Type` for ordered dictionaries." msgstr "" -#: ../../c-api/dict.rst:538 +#: ../../c-api/dict.rst:632 msgid "Return a new empty ordered dictionary, or ``NULL`` on failure." msgstr "回傳一個新的空有序字典,或在失敗時回傳 ``NULL``。" -#: ../../c-api/dict.rst:540 +#: ../../c-api/dict.rst:634 msgid "This is analogous to :c:func:`PyDict_New`." msgstr "這和 :c:func:`PyDict_New` 類似。" -#: ../../c-api/dict.rst:545 +#: ../../c-api/dict.rst:639 msgid "" "Insert *value* into the ordered dictionary *od* with a key of *key*. Return " "``0`` on success or ``-1`` with an exception set on failure." msgstr "" -#: ../../c-api/dict.rst:548 +#: ../../c-api/dict.rst:642 msgid "This is analogous to :c:func:`PyDict_SetItem`." msgstr "這和 :c:func:`PyDict_SetItem` 類似。" -#: ../../c-api/dict.rst:553 +#: ../../c-api/dict.rst:647 msgid "" "Remove the entry in the ordered dictionary *od* with key *key*. Return ``0`` " "on success or ``-1`` with an exception set on failure." msgstr "" -#: ../../c-api/dict.rst:556 +#: ../../c-api/dict.rst:650 msgid "This is analogous to :c:func:`PyDict_DelItem`." msgstr "這和 :c:func:`PyDict_DelItem` 類似。" -#: ../../c-api/dict.rst:559 +#: ../../c-api/dict.rst:653 msgid "These are :term:`soft deprecated` aliases to ``PyDict`` APIs:" msgstr "" -#: ../../c-api/dict.rst:566 +#: ../../c-api/dict.rst:660 msgid "``PyODict``" msgstr "``PyODict``" -#: ../../c-api/dict.rst:567 +#: ../../c-api/dict.rst:661 msgid "``PyDict``" msgstr "``PyDict``" -#: ../../c-api/dict.rst:569 +#: ../../c-api/dict.rst:663 msgid ":c:func:`PyDict_GetItem`" msgstr ":c:func:`PyDict_GetItem`" -#: ../../c-api/dict.rst:571 +#: ../../c-api/dict.rst:665 msgid ":c:func:`PyDict_GetItemWithError`" msgstr ":c:func:`PyDict_GetItemWithError`" -#: ../../c-api/dict.rst:573 +#: ../../c-api/dict.rst:667 msgid ":c:func:`PyDict_GetItemString`" msgstr ":c:func:`PyDict_GetItemString`" -#: ../../c-api/dict.rst:575 +#: ../../c-api/dict.rst:669 msgid ":c:func:`PyDict_Contains`" msgstr ":c:func:`PyDict_Contains`" -#: ../../c-api/dict.rst:577 +#: ../../c-api/dict.rst:671 msgid ":c:func:`PyDict_Size`" msgstr ":c:func:`PyDict_Size`" -#: ../../c-api/dict.rst:579 +#: ../../c-api/dict.rst:673 msgid ":c:func:`PyDict_GET_SIZE`" msgstr ":c:func:`PyDict_GET_SIZE`" @@ -704,10 +757,10 @@ msgstr "object(物件)" msgid "dictionary" msgstr "dictionary(字典)" -#: ../../c-api/dict.rst:253 +#: ../../c-api/dict.rst:312 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/dict.rst:253 +#: ../../c-api/dict.rst:312 msgid "len" msgstr "len" diff --git a/c-api/set.po b/c-api/set.po index 4225d058692..fe69922ab0d 100644 --- a/c-api/set.po +++ b/c-api/set.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-01-15 00:15+0000\n" +"POT-Creation-Date: 2026-04-12 00:25+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -70,44 +70,48 @@ msgid "" "Return true if *p* is a :class:`set` object or an instance of a subtype. " "This function always succeeds." msgstr "" -"如果 *p* 是 :class:`set` 物件或是子類別的實例,則回傳 true。此函式總會成功執行。" +"如果 *p* 是 :class:`set` 物件或是子類別的實例,則回傳 true。此函式總會成功執" +"行。" #: ../../c-api/set.rst:60 msgid "" "Return true if *p* is a :class:`frozenset` object or an instance of a " "subtype. This function always succeeds." msgstr "" -"如果 *p* 是 :class:`frozenset` 物件或是子類別的實例,則回傳 true。此函式總會成功執行。" +"如果 *p* 是 :class:`frozenset` 物件或是子類別的實例,則回傳 true。此函式總會" +"成功執行。" #: ../../c-api/set.rst:65 msgid "" "Return true if *p* is a :class:`set` object, a :class:`frozenset` object, or " "an instance of a subtype. This function always succeeds." msgstr "" -"如果 *p* 是 :class:`set` 物件、:class:`frozenset` 物件,或是子類別的實例,則回傳 true。" -"此函式總會成功執行。" +"如果 *p* 是 :class:`set` 物件、:class:`frozenset` 物件,或是子類別的實例,則" +"回傳 true。此函式總會成功執行。" #: ../../c-api/set.rst:70 msgid "" "Return true if *p* is a :class:`set` object but not an instance of a " "subtype. This function always succeeds." msgstr "" -"如果 *p* 是 :class:`set` 物件但不是子類別的實例,則回傳 true。此函式總會成功執行。" +"如果 *p* 是 :class:`set` 物件但不是子類別的實例,則回傳 true。此函式總會成功" +"執行。" #: ../../c-api/set.rst:77 msgid "" "Return true if *p* is a :class:`set` object or a :class:`frozenset` object " "but not an instance of a subtype. This function always succeeds." msgstr "" -"如果 *p* 是 :class:`set` 物件或 :class:`frozenset` 物件但不是子類別的實例,則回傳 " -"true。此函式總會成功執行。" +"如果 *p* 是 :class:`set` 物件或 :class:`frozenset` 物件但不是子類別的實例,則" +"回傳 true。此函式總會成功執行。" #: ../../c-api/set.rst:83 msgid "" "Return true if *p* is a :class:`frozenset` object but not an instance of a " "subtype. This function always succeeds." msgstr "" -"如果 *p* 是 :class:`frozenset` 物件但不是子類別的實例,則回傳 true。此函式總會成功執行。" +"如果 *p* 是 :class:`frozenset` 物件但不是子類別的實例,則回傳 true。此函式總" +"會成功執行。" #: ../../c-api/set.rst:89 msgid "" @@ -118,7 +122,13 @@ msgid "" "(``c=set(s)``)." msgstr "" -#: ../../c-api/set.rst:98 +#: ../../c-api/set.rst:97 ../../c-api/set.rst:110 +msgid "" +"The operation is atomic on :term:`free threading ` when " +"*iterable* is a :class:`set`, :class:`frozenset` or :class:`dict`." +msgstr "" + +#: ../../c-api/set.rst:103 msgid "" "Return a new :class:`frozenset` containing objects returned by the " "*iterable*. The *iterable* may be ``NULL`` to create a new empty frozenset. " @@ -126,24 +136,24 @@ msgid "" "`TypeError` if *iterable* is not actually iterable." msgstr "" -#: ../../c-api/set.rst:104 +#: ../../c-api/set.rst:114 msgid "" "The following functions and macros are available for instances of :class:" "`set` or :class:`frozenset` or instances of their subtypes." msgstr "" -#: ../../c-api/set.rst:112 +#: ../../c-api/set.rst:122 msgid "" "Return the length of a :class:`set` or :class:`frozenset` object. Equivalent " "to ``len(anyset)``. Raises a :exc:`SystemError` if *anyset* is not a :class:" "`set`, :class:`frozenset`, or an instance of a subtype." msgstr "" -#: ../../c-api/set.rst:119 +#: ../../c-api/set.rst:129 msgid "Macro form of :c:func:`PySet_Size` without error checking." msgstr "" -#: ../../c-api/set.rst:124 +#: ../../c-api/set.rst:134 msgid "" "Return ``1`` if found, ``0`` if not found, and ``-1`` if an error is " "encountered. Unlike the Python :meth:`~object.__contains__` method, this " @@ -153,7 +163,14 @@ msgid "" "instance of a subtype." msgstr "" -#: ../../c-api/set.rst:133 +#: ../../c-api/set.rst:142 ../../c-api/set.rst:157 ../../c-api/set.rst:177 +msgid "" +"The operation is atomic on :term:`free threading ` when " +"*key* is :class:`str`, :class:`int`, :class:`float`, :class:`bool` or :class:" +"`bytes`." +msgstr "" + +#: ../../c-api/set.rst:147 msgid "" "Add *key* to a :class:`set` instance. Also works with :class:`frozenset` " "instances (like :c:func:`PyTuple_SetItem` it can be used to fill in the " @@ -164,13 +181,13 @@ msgid "" "`set` or its subtype." msgstr "" -#: ../../c-api/set.rst:142 +#: ../../c-api/set.rst:162 msgid "" "The following functions are available for instances of :class:`set` or its " "subtypes but not for instances of :class:`frozenset` or its subtypes." msgstr "" -#: ../../c-api/set.rst:148 +#: ../../c-api/set.rst:168 msgid "" "Return ``1`` if found and removed, ``0`` if not found (no action taken), and " "``-1`` if an error is encountered. Does not raise :exc:`KeyError` for " @@ -180,7 +197,7 @@ msgid "" "if *set* is not an instance of :class:`set` or its subtype." msgstr "" -#: ../../c-api/set.rst:158 +#: ../../c-api/set.rst:183 msgid "" "Return a new reference to an arbitrary object in the *set*, and removes the " "object from the *set*. Return ``NULL`` on failure. Raise :exc:`KeyError` " @@ -188,37 +205,44 @@ msgid "" "of :class:`set` or its subtype." msgstr "" -#: ../../c-api/set.rst:166 +#: ../../c-api/set.rst:191 msgid "" "Empty an existing set of all elements. Return ``0`` on success. Return " "``-1`` and raise :exc:`SystemError` if *set* is not an instance of :class:" "`set` or its subtype." msgstr "" -#: ../../c-api/set.rst:172 +#: ../../c-api/set.rst:197 +msgid "" +"In the :term:`free-threaded build`, the set is emptied before its entries " +"are cleared, so other threads will observe an empty set rather than " +"intermediate states." +msgstr "" + +#: ../../c-api/set.rst:203 msgid "Deprecated API" msgstr "已棄用的 API" -#: ../../c-api/set.rst:176 +#: ../../c-api/set.rst:207 msgid "" "A :term:`soft deprecated` constant representing the size of an internal " "preallocated table inside :c:type:`PySetObject` instances." msgstr "" -"一個被\\ :term:`軟性棄用 `\\ 的常數,代表 :c:type:`PySetObject` " -"實例內部預分配表格的大小。" +"一個被\\ :term:`軟性棄用 `\\ 的常數,代表 :c:type:" +"`PySetObject` 實例內部預分配表格的大小。" -#: ../../c-api/set.rst:179 +#: ../../c-api/set.rst:210 msgid "" "This is documented solely for completeness, as there are no guarantees that " "a given version of CPython uses preallocated tables with a fixed size. In " "code that does not deal with unstable set internals, :c:macro:`!" "PySet_MINSIZE` can be replaced with a small constant like ``8``." msgstr "" -"這僅為完整性而記錄於文件,且因為無法保證特定版本的 CPython 會使用具有固定大小的預分配表格。" -"在不處理不穩定集合內部結構的程式碼中,:c:macro:`!PySet_MINSIZE` 可以替換為像 ``8`` " -"這樣的小常數。" +"這僅為完整性而記錄於文件,且因為無法保證特定版本的 CPython 會使用具有固定大小" +"的預分配表格。在不處理不穩定集合內部結構的程式碼中,:c:macro:`!" +"PySet_MINSIZE` 可以替換為像 ``8`` 這樣的小常數。" -#: ../../c-api/set.rst:185 +#: ../../c-api/set.rst:216 msgid "If looking for the size of a set, use :c:func:`PySet_Size` instead." msgstr "如果要查詢集合的大小,請使用 :c:func:`PySet_Size`。" @@ -234,10 +258,10 @@ msgstr "set(集合)" msgid "frozenset" msgstr "frozenset(凍結集合)" -#: ../../c-api/set.rst:110 +#: ../../c-api/set.rst:120 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/set.rst:110 +#: ../../c-api/set.rst:120 msgid "len" msgstr "len" diff --git a/library/importlib.resources.po b/library/importlib.resources.po index 40d502c68fc..eadd35afcf2 100644 --- a/library/importlib.resources.po +++ b/library/importlib.resources.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-10-08 00:15+0000\n" +"POT-Creation-Date: 2026-04-12 00:25+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -60,6 +60,13 @@ msgstr "" #: ../../library/importlib.resources.rst:36 msgid "" +":mod:`importlib.resources` follows the same security model as the built-in :" +"func:`open` function. Passing untrusted inputs to the functions in this " +"module is unsafe." +msgstr "" + +#: ../../library/importlib.resources.rst:42 +msgid "" "This module provides functionality similar to `pkg_resources `_ `Basic Resource " "Access `_." msgstr "" -#: ../../library/importlib.resources.rst:50 +#: ../../library/importlib.resources.rst:56 msgid "" ":class:`Loaders ` that wish to support resource " "reading should implement a ``get_resource_reader(fullname)`` method as " "specified by :class:`importlib.resources.abc.ResourceReader`." msgstr "" -#: ../../library/importlib.resources.rst:56 +#: ../../library/importlib.resources.rst:62 msgid "" "Represents an anchor for resources, either a :class:`module object ` or a module name as a string. Defined as ``Union[str, " "ModuleType]``." msgstr "" -#: ../../library/importlib.resources.rst:62 +#: ../../library/importlib.resources.rst:68 msgid "" "Returns a :class:`~importlib.resources.abc.Traversable` object representing " "the resource container (think directory) and its resources (think files). A " "Traversable may contain other containers (think subdirectories)." msgstr "" -#: ../../library/importlib.resources.rst:67 +#: ../../library/importlib.resources.rst:73 msgid "" "*anchor* is an optional :class:`Anchor`. If the anchor is a package, " "resources are resolved from that package. If a module, resources are " @@ -105,7 +112,7 @@ msgid "" "If the anchor is omitted, the caller's module is used." msgstr "" -#: ../../library/importlib.resources.rst:75 +#: ../../library/importlib.resources.rst:81 msgid "" "*package* parameter was renamed to *anchor*. *anchor* can now be a non-" "package module and if omitted will default to the caller's module. *package* " @@ -114,7 +121,7 @@ msgid "" "``importlib_resources >= 5.10`` for a compatible interface on older Pythons." msgstr "" -#: ../../library/importlib.resources.rst:85 +#: ../../library/importlib.resources.rst:91 msgid "" "Given a :class:`~importlib.resources.abc.Traversable` object representing a " "file or directory, typically from :func:`importlib.resources.files`, return " @@ -122,60 +129,60 @@ msgid "" "manager provides a :class:`pathlib.Path` object." msgstr "" -#: ../../library/importlib.resources.rst:90 +#: ../../library/importlib.resources.rst:96 msgid "" "Exiting the context manager cleans up any temporary file or directory " "created when the resource was extracted from e.g. a zip file." msgstr "" -#: ../../library/importlib.resources.rst:93 +#: ../../library/importlib.resources.rst:99 msgid "" "Use ``as_file`` when the Traversable methods (``read_text``, etc) are " "insufficient and an actual file or directory on the file system is required." msgstr "" -#: ../../library/importlib.resources.rst:99 +#: ../../library/importlib.resources.rst:105 msgid "Added support for *traversable* representing a directory." msgstr "" -#: ../../library/importlib.resources.rst:106 +#: ../../library/importlib.resources.rst:112 msgid "Functional API" msgstr "" -#: ../../library/importlib.resources.rst:108 +#: ../../library/importlib.resources.rst:114 msgid "" "A set of simplified, backwards-compatible helpers is available. These allow " "common operations in a single function call." msgstr "" -#: ../../library/importlib.resources.rst:111 +#: ../../library/importlib.resources.rst:117 msgid "For all the following functions:" msgstr "" -#: ../../library/importlib.resources.rst:113 +#: ../../library/importlib.resources.rst:119 msgid "" "*anchor* is an :class:`~importlib.resources.Anchor`, as in :func:`~importlib." "resources.files`. Unlike in ``files``, it may not be omitted." msgstr "" -#: ../../library/importlib.resources.rst:117 +#: ../../library/importlib.resources.rst:123 msgid "" "*path_names* are components of a resource's path name, relative to the " "anchor. For example, to get the text of resource named ``info.txt``, use::" msgstr "" -#: ../../library/importlib.resources.rst:121 +#: ../../library/importlib.resources.rst:127 msgid "importlib.resources.read_text(my_module, \"info.txt\")" msgstr "importlib.resources.read_text(my_module, \"info.txt\")" -#: ../../library/importlib.resources.rst:123 +#: ../../library/importlib.resources.rst:129 msgid "" "Like :meth:`Traversable.joinpath `, The " "individual components should use forward slashes (``/``) as path separators. " "For example, the following are equivalent::" msgstr "" -#: ../../library/importlib.resources.rst:128 +#: ../../library/importlib.resources.rst:134 msgid "" "importlib.resources.read_binary(my_module, \"pics/painting.png\")\n" "importlib.resources.read_binary(my_module, \"pics\", \"painting.png\")" @@ -183,14 +190,14 @@ msgstr "" "importlib.resources.read_binary(my_module, \"pics/painting.png\")\n" "importlib.resources.read_binary(my_module, \"pics\", \"painting.png\")" -#: ../../library/importlib.resources.rst:131 +#: ../../library/importlib.resources.rst:137 msgid "" "For backward compatibility reasons, functions that read text require an " "explicit *encoding* argument if multiple *path_names* are given. For " "example, to get the text of ``info/chapter1.txt``, use::" msgstr "" -#: ../../library/importlib.resources.rst:135 +#: ../../library/importlib.resources.rst:141 msgid "" "importlib.resources.read_text(my_module, \"info\", \"chapter1.txt\",\n" " encoding='utf-8')" @@ -198,124 +205,124 @@ msgstr "" "importlib.resources.read_text(my_module, \"info\", \"chapter1.txt\",\n" " encoding='utf-8')" -#: ../../library/importlib.resources.rst:140 +#: ../../library/importlib.resources.rst:146 msgid "Open the named resource for binary reading." msgstr "" -#: ../../library/importlib.resources.rst:142 -#: ../../library/importlib.resources.rst:185 -#: ../../library/importlib.resources.rst:233 -#: ../../library/importlib.resources.rst:250 -#: ../../library/importlib.resources.rst:268 +#: ../../library/importlib.resources.rst:148 +#: ../../library/importlib.resources.rst:191 +#: ../../library/importlib.resources.rst:239 +#: ../../library/importlib.resources.rst:256 +#: ../../library/importlib.resources.rst:274 msgid "" "See :ref:`the introduction ` for details on " "*anchor* and *path_names*." msgstr "" -#: ../../library/importlib.resources.rst:145 +#: ../../library/importlib.resources.rst:151 msgid "" "This function returns a :class:`~typing.BinaryIO` object, that is, a binary " "stream open for reading." msgstr "" -#: ../../library/importlib.resources.rst:148 -#: ../../library/importlib.resources.rst:172 -#: ../../library/importlib.resources.rst:188 -#: ../../library/importlib.resources.rst:209 -#: ../../library/importlib.resources.rst:236 -#: ../../library/importlib.resources.rst:253 -#: ../../library/importlib.resources.rst:271 +#: ../../library/importlib.resources.rst:154 +#: ../../library/importlib.resources.rst:178 +#: ../../library/importlib.resources.rst:194 +#: ../../library/importlib.resources.rst:215 +#: ../../library/importlib.resources.rst:242 +#: ../../library/importlib.resources.rst:259 +#: ../../library/importlib.resources.rst:277 msgid "This function is roughly equivalent to::" msgstr "這個函式大致等同於: ::" -#: ../../library/importlib.resources.rst:150 +#: ../../library/importlib.resources.rst:156 msgid "files(anchor).joinpath(*path_names).open('rb')" msgstr "files(anchor).joinpath(*path_names).open('rb')" -#: ../../library/importlib.resources.rst:152 -#: ../../library/importlib.resources.rst:192 -#: ../../library/importlib.resources.rst:257 +#: ../../library/importlib.resources.rst:158 +#: ../../library/importlib.resources.rst:198 +#: ../../library/importlib.resources.rst:263 msgid "Multiple *path_names* are accepted." msgstr "多個 *path_names* 是被接受的。" -#: ../../library/importlib.resources.rst:158 +#: ../../library/importlib.resources.rst:164 msgid "" "Open the named resource for text reading. By default, the contents are read " "as strict UTF-8." msgstr "" -#: ../../library/importlib.resources.rst:161 -#: ../../library/importlib.resources.rst:201 +#: ../../library/importlib.resources.rst:167 +#: ../../library/importlib.resources.rst:207 msgid "" "See :ref:`the introduction ` for details on " "*anchor* and *path_names*. *encoding* and *errors* have the same meaning as " "in built-in :func:`open`." msgstr "" -#: ../../library/importlib.resources.rst:165 -#: ../../library/importlib.resources.rst:205 +#: ../../library/importlib.resources.rst:171 +#: ../../library/importlib.resources.rst:211 msgid "" "For backward compatibility reasons, the *encoding* argument must be given " "explicitly if there are multiple *path_names*. This limitation is scheduled " "to be removed in Python 3.15." msgstr "" -#: ../../library/importlib.resources.rst:169 +#: ../../library/importlib.resources.rst:175 msgid "" "This function returns a :class:`~typing.TextIO` object, that is, a text " "stream open for reading." msgstr "" -#: ../../library/importlib.resources.rst:174 +#: ../../library/importlib.resources.rst:180 msgid "files(anchor).joinpath(*path_names).open('r', encoding=encoding)" msgstr "files(anchor).joinpath(*path_names).open('r', encoding=encoding)" -#: ../../library/importlib.resources.rst:176 -#: ../../library/importlib.resources.rst:213 -#: ../../library/importlib.resources.rst:240 +#: ../../library/importlib.resources.rst:182 +#: ../../library/importlib.resources.rst:219 +#: ../../library/importlib.resources.rst:246 msgid "" "Multiple *path_names* are accepted. *encoding* and *errors* must be given as " "keyword arguments." msgstr "" -#: ../../library/importlib.resources.rst:183 +#: ../../library/importlib.resources.rst:189 msgid "Read and return the contents of the named resource as :class:`bytes`." msgstr "以 :class:`bytes` 形式讀取並回傳指定資源的內容。" -#: ../../library/importlib.resources.rst:190 +#: ../../library/importlib.resources.rst:196 msgid "files(anchor).joinpath(*path_names).read_bytes()" msgstr "files(anchor).joinpath(*path_names).read_bytes()" -#: ../../library/importlib.resources.rst:198 +#: ../../library/importlib.resources.rst:204 msgid "" "Read and return the contents of the named resource as :class:`str`. By " "default, the contents are read as strict UTF-8." msgstr "" -#: ../../library/importlib.resources.rst:211 +#: ../../library/importlib.resources.rst:217 msgid "files(anchor).joinpath(*path_names).read_text(encoding=encoding)" msgstr "files(anchor).joinpath(*path_names).read_text(encoding=encoding)" -#: ../../library/importlib.resources.rst:220 +#: ../../library/importlib.resources.rst:226 msgid "" "Provides the path to the *resource* as an actual file system path. This " "function returns a context manager for use in a :keyword:`with` statement. " "The context manager provides a :class:`pathlib.Path` object." msgstr "" -#: ../../library/importlib.resources.rst:224 +#: ../../library/importlib.resources.rst:230 msgid "" "Exiting the context manager cleans up any temporary files created, e.g. when " "the resource needs to be extracted from a zip file." msgstr "" -#: ../../library/importlib.resources.rst:227 +#: ../../library/importlib.resources.rst:233 msgid "" "For example, the :meth:`~pathlib.Path.stat` method requires an actual file " "system path; it can be used like this::" msgstr "" -#: ../../library/importlib.resources.rst:230 +#: ../../library/importlib.resources.rst:236 msgid "" "with importlib.resources.path(anchor, \"resource.txt\") as fspath:\n" " result = fspath.stat()" @@ -323,21 +330,21 @@ msgstr "" "with importlib.resources.path(anchor, \"resource.txt\") as fspath:\n" " result = fspath.stat()" -#: ../../library/importlib.resources.rst:238 +#: ../../library/importlib.resources.rst:244 msgid "as_file(files(anchor).joinpath(*path_names))" msgstr "as_file(files(anchor).joinpath(*path_names))" -#: ../../library/importlib.resources.rst:247 +#: ../../library/importlib.resources.rst:253 msgid "" "Return ``True`` if the named resource exists, otherwise ``False``. This " "function does not consider directories to be resources." msgstr "" -#: ../../library/importlib.resources.rst:255 +#: ../../library/importlib.resources.rst:261 msgid "files(anchor).joinpath(*path_names).is_file()" msgstr "files(anchor).joinpath(*path_names).is_file()" -#: ../../library/importlib.resources.rst:263 +#: ../../library/importlib.resources.rst:269 msgid "" "Return an iterable over the named items within the package or path. The " "iterable returns names of resources (e.g. files) and non-resources (e.g. " @@ -345,7 +352,7 @@ msgid "" "subdirectories." msgstr "" -#: ../../library/importlib.resources.rst:273 +#: ../../library/importlib.resources.rst:279 msgid "" "for resource in files(anchor).joinpath(*path_names).iterdir():\n" " yield resource.name" @@ -353,7 +360,7 @@ msgstr "" "for resource in files(anchor).joinpath(*path_names).iterdir():\n" " yield resource.name" -#: ../../library/importlib.resources.rst:276 +#: ../../library/importlib.resources.rst:282 msgid "" "Prefer ``iterdir()`` as above, which offers more control over the results " "and richer functionality." From 668236615ff932cd9dcb818dfd5905eb6c56c3c7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 13 Apr 2026 00:27:42 +0000 Subject: [PATCH 3/6] sync with cpython 942d3024 --- library/multiprocessing.po | 957 +++++++++++++++++++------------------ 1 file changed, 479 insertions(+), 478 deletions(-) diff --git a/library/multiprocessing.po b/library/multiprocessing.po index 84d4985ea39..e3093d27ac2 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-18 00:20+0000\n" +"POT-Creation-Date: 2026-04-13 00:26+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1482,15 +1482,15 @@ msgid "" "is started which transfers objects from a buffer into the pipe." msgstr "" -#: ../../library/multiprocessing.rst:928 ../../library/multiprocessing.rst:1046 -#: ../../library/multiprocessing.rst:1079 -#: ../../library/multiprocessing.rst:1435 -#: ../../library/multiprocessing.rst:1445 -#: ../../library/multiprocessing.rst:1468 -#: ../../library/multiprocessing.rst:1478 -#: ../../library/multiprocessing.rst:1495 -#: ../../library/multiprocessing.rst:1555 -#: ../../library/multiprocessing.rst:1617 +#: ../../library/multiprocessing.rst:928 ../../library/multiprocessing.rst:1047 +#: ../../library/multiprocessing.rst:1080 +#: ../../library/multiprocessing.rst:1436 +#: ../../library/multiprocessing.rst:1446 +#: ../../library/multiprocessing.rst:1469 +#: ../../library/multiprocessing.rst:1479 +#: ../../library/multiprocessing.rst:1496 +#: ../../library/multiprocessing.rst:1556 +#: ../../library/multiprocessing.rst:1618 msgid "" "Instantiating this class may set the global start method. See :ref:`global-" "start-method` for more details." @@ -1505,38 +1505,39 @@ msgstr "" #: ../../library/multiprocessing.rst:934 msgid "" ":class:`Queue` implements all the methods of :class:`queue.Queue` except " -"for :meth:`~queue.Queue.task_done` and :meth:`~queue.Queue.join`." +"for :meth:`~queue.Queue.task_done`, :meth:`~queue.Queue.join`, and :meth:" +"`~queue.Queue.shutdown`." msgstr "" -#: ../../library/multiprocessing.rst:939 +#: ../../library/multiprocessing.rst:940 msgid "" "Return the approximate size of the queue. Because of multithreading/" "multiprocessing semantics, this number is not reliable." msgstr "" -#: ../../library/multiprocessing.rst:942 ../../library/multiprocessing.rst:1628 +#: ../../library/multiprocessing.rst:943 ../../library/multiprocessing.rst:1629 msgid "" "Note that this may raise :exc:`NotImplementedError` on platforms like macOS " "where ``sem_getvalue()`` is not implemented." msgstr "" -#: ../../library/multiprocessing.rst:947 +#: ../../library/multiprocessing.rst:948 msgid "" "Return ``True`` if the queue is empty, ``False`` otherwise. Because of " "multithreading/multiprocessing semantics, this is not reliable." msgstr "" -#: ../../library/multiprocessing.rst:950 +#: ../../library/multiprocessing.rst:951 msgid "May raise an :exc:`OSError` on closed queues. (not guaranteed)" msgstr "" -#: ../../library/multiprocessing.rst:954 +#: ../../library/multiprocessing.rst:955 msgid "" "Return ``True`` if the queue is full, ``False`` otherwise. Because of " "multithreading/multiprocessing semantics, this is not reliable." msgstr "" -#: ../../library/multiprocessing.rst:959 +#: ../../library/multiprocessing.rst:960 msgid "" "Put obj into the queue. If the optional argument *block* is ``True`` (the " "default) and *timeout* is ``None`` (the default), block if necessary until a " @@ -1547,17 +1548,17 @@ msgid "" "the :exc:`queue.Full` exception (*timeout* is ignored in that case)." msgstr "" -#: ../../library/multiprocessing.rst:968 +#: ../../library/multiprocessing.rst:969 msgid "" "If the queue is closed, :exc:`ValueError` is raised instead of :exc:" "`AssertionError`." msgstr "" -#: ../../library/multiprocessing.rst:974 +#: ../../library/multiprocessing.rst:975 msgid "Equivalent to ``put(obj, False)``." msgstr "相當於 ``put(obj, False)``。" -#: ../../library/multiprocessing.rst:978 +#: ../../library/multiprocessing.rst:979 msgid "" "Remove and return an item from the queue. If optional args *block* is " "``True`` (the default) and *timeout* is ``None`` (the default), block if " @@ -1568,62 +1569,62 @@ msgid "" "Empty` exception (*timeout* is ignored in that case)." msgstr "" -#: ../../library/multiprocessing.rst:986 +#: ../../library/multiprocessing.rst:987 msgid "" "If the queue is closed, :exc:`ValueError` is raised instead of :exc:" "`OSError`." msgstr "" -#: ../../library/multiprocessing.rst:992 +#: ../../library/multiprocessing.rst:993 msgid "Equivalent to ``get(False)``." msgstr "相當於 ``get(False)``。" -#: ../../library/multiprocessing.rst:994 +#: ../../library/multiprocessing.rst:995 msgid "" ":class:`multiprocessing.Queue` has a few additional methods not found in :" "class:`queue.Queue`. These methods are usually unnecessary for most code:" msgstr "" -#: ../../library/multiprocessing.rst:1000 -#: ../../library/multiprocessing.rst:1051 +#: ../../library/multiprocessing.rst:1001 +#: ../../library/multiprocessing.rst:1052 msgid "Close the queue: release internal resources." msgstr "" -#: ../../library/multiprocessing.rst:1002 +#: ../../library/multiprocessing.rst:1003 msgid "" "A queue must not be used anymore after it is closed. For example, :meth:" "`~Queue.get`, :meth:`~Queue.put` and :meth:`~Queue.empty` methods must no " "longer be called." msgstr "" -#: ../../library/multiprocessing.rst:1006 +#: ../../library/multiprocessing.rst:1007 msgid "" "The background thread will quit once it has flushed all buffered data to the " "pipe. This is called automatically when the queue is garbage collected." msgstr "" -#: ../../library/multiprocessing.rst:1012 +#: ../../library/multiprocessing.rst:1013 msgid "" "Join the background thread. This can only be used after :meth:`close` has " "been called. It blocks until the background thread exits, ensuring that all " "data in the buffer has been flushed to the pipe." msgstr "" -#: ../../library/multiprocessing.rst:1016 +#: ../../library/multiprocessing.rst:1017 msgid "" "By default if a process is not the creator of the queue then on exit it will " "attempt to join the queue's background thread. The process can call :meth:" "`cancel_join_thread` to make :meth:`join_thread` do nothing." msgstr "" -#: ../../library/multiprocessing.rst:1022 +#: ../../library/multiprocessing.rst:1023 msgid "" "Prevent :meth:`join_thread` from blocking. In particular, this prevents the " "background thread from being joined automatically when the process exits -- " "see :meth:`join_thread`." msgstr "" -#: ../../library/multiprocessing.rst:1026 +#: ../../library/multiprocessing.rst:1027 msgid "" "A better name for this method might be ``allow_exit_without_flush()``. It " "is likely to cause enqueued data to be lost, and you almost certainly will " @@ -1632,7 +1633,7 @@ msgid "" "pipe, and you don't care about lost data." msgstr "" -#: ../../library/multiprocessing.rst:1035 +#: ../../library/multiprocessing.rst:1036 msgid "" "This class's functionality requires a functioning shared semaphore " "implementation on the host operating system. Without one, the functionality " @@ -1642,40 +1643,40 @@ msgid "" "listed below." msgstr "" -#: ../../library/multiprocessing.rst:1044 +#: ../../library/multiprocessing.rst:1045 msgid "" "It is a simplified :class:`Queue` type, very close to a locked :class:`Pipe`." msgstr "" -#: ../../library/multiprocessing.rst:1053 +#: ../../library/multiprocessing.rst:1054 msgid "" "A queue must not be used anymore after it is closed. For example, :meth:" "`get`, :meth:`put` and :meth:`empty` methods must no longer be called." msgstr "" -#: ../../library/multiprocessing.rst:1061 +#: ../../library/multiprocessing.rst:1062 msgid "Return ``True`` if the queue is empty, ``False`` otherwise." msgstr "" -#: ../../library/multiprocessing.rst:1063 +#: ../../library/multiprocessing.rst:1064 msgid "Always raises an :exc:`OSError` if the SimpleQueue is closed." msgstr "" -#: ../../library/multiprocessing.rst:1067 +#: ../../library/multiprocessing.rst:1068 msgid "Remove and return an item from the queue." msgstr "" -#: ../../library/multiprocessing.rst:1071 +#: ../../library/multiprocessing.rst:1072 msgid "Put *item* into the queue." msgstr "" -#: ../../library/multiprocessing.rst:1076 +#: ../../library/multiprocessing.rst:1077 msgid "" ":class:`JoinableQueue`, a :class:`Queue` subclass, is a queue which " "additionally has :meth:`task_done` and :meth:`join` methods." msgstr "" -#: ../../library/multiprocessing.rst:1084 +#: ../../library/multiprocessing.rst:1085 msgid "" "Indicate that a formerly enqueued task is complete. Used by queue " "consumers. For each :meth:`~Queue.get` used to fetch a task, a subsequent " @@ -1683,24 +1684,24 @@ msgid "" "complete." msgstr "" -#: ../../library/multiprocessing.rst:1089 +#: ../../library/multiprocessing.rst:1090 msgid "" "If a :meth:`~queue.Queue.join` is currently blocking, it will resume when " "all items have been processed (meaning that a :meth:`task_done` call was " "received for every item that had been :meth:`~Queue.put` into the queue)." msgstr "" -#: ../../library/multiprocessing.rst:1093 +#: ../../library/multiprocessing.rst:1094 msgid "" "Raises a :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "" -#: ../../library/multiprocessing.rst:1099 +#: ../../library/multiprocessing.rst:1100 msgid "Block until all items in the queue have been gotten and processed." msgstr "" -#: ../../library/multiprocessing.rst:1101 +#: ../../library/multiprocessing.rst:1102 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " "queue. The count goes down whenever a consumer calls :meth:`task_done` to " @@ -1709,78 +1710,78 @@ msgid "" "unblocks." msgstr "" -#: ../../library/multiprocessing.rst:1109 +#: ../../library/multiprocessing.rst:1110 msgid "Miscellaneous" msgstr "" -#: ../../library/multiprocessing.rst:1113 +#: ../../library/multiprocessing.rst:1114 msgid "Return list of all live children of the current process." msgstr "" -#: ../../library/multiprocessing.rst:1115 +#: ../../library/multiprocessing.rst:1116 msgid "" "Calling this has the side effect of \"joining\" any processes which have " "already finished." msgstr "" -#: ../../library/multiprocessing.rst:1120 +#: ../../library/multiprocessing.rst:1121 msgid "Return the number of CPUs in the system." msgstr "" -#: ../../library/multiprocessing.rst:1122 +#: ../../library/multiprocessing.rst:1123 msgid "" "This number is not equivalent to the number of CPUs the current process can " "use. The number of usable CPUs can be obtained with :func:`os." "process_cpu_count` (or ``len(os.sched_getaffinity(0))``)." msgstr "" -#: ../../library/multiprocessing.rst:1126 +#: ../../library/multiprocessing.rst:1127 msgid "" "When the number of CPUs cannot be determined a :exc:`NotImplementedError` is " "raised." msgstr "" -#: ../../library/multiprocessing.rst:1130 +#: ../../library/multiprocessing.rst:1131 msgid ":func:`os.cpu_count` :func:`os.process_cpu_count`" msgstr ":func:`os.cpu_count` :func:`os.process_cpu_count`" -#: ../../library/multiprocessing.rst:1135 +#: ../../library/multiprocessing.rst:1136 msgid "" "The return value can also be overridden using the :option:`-X cpu_count <-" "X>` flag or :envvar:`PYTHON_CPU_COUNT` as this is merely a wrapper around " "the :mod:`os` cpu count APIs." msgstr "" -#: ../../library/multiprocessing.rst:1141 +#: ../../library/multiprocessing.rst:1142 msgid "" "Return the :class:`Process` object corresponding to the current process." msgstr "" -#: ../../library/multiprocessing.rst:1143 +#: ../../library/multiprocessing.rst:1144 msgid "An analogue of :func:`threading.current_thread`." msgstr "" -#: ../../library/multiprocessing.rst:1147 +#: ../../library/multiprocessing.rst:1148 msgid "" "Return the :class:`Process` object corresponding to the parent process of " "the :func:`current_process`. For the main process, ``parent_process`` will " "be ``None``." msgstr "" -#: ../../library/multiprocessing.rst:1155 +#: ../../library/multiprocessing.rst:1156 msgid "" "Add support for when a program which uses :mod:`!multiprocessing` has been " "frozen to produce an executable. (Has been tested with **py2exe**, " "**PyInstaller** and **cx_Freeze**.)" msgstr "" -#: ../../library/multiprocessing.rst:1159 +#: ../../library/multiprocessing.rst:1160 msgid "" "One needs to call this function straight after the ``if __name__ == " "'__main__'`` line of the main module. For example::" msgstr "" -#: ../../library/multiprocessing.rst:1162 +#: ../../library/multiprocessing.rst:1163 msgid "" "from multiprocessing import Process, freeze_support\n" "\n" @@ -1800,13 +1801,13 @@ msgstr "" " freeze_support()\n" " Process(target=f).start()" -#: ../../library/multiprocessing.rst:1171 +#: ../../library/multiprocessing.rst:1172 msgid "" "If the ``freeze_support()`` line is omitted then trying to run the frozen " "executable will raise :exc:`RuntimeError`." msgstr "" -#: ../../library/multiprocessing.rst:1174 +#: ../../library/multiprocessing.rst:1175 msgid "" "Calling ``freeze_support()`` has no effect when the start method is not " "*spawn*. In addition, if the module is being run normally by the Python " @@ -1814,7 +1815,7 @@ msgid "" "no effect." msgstr "" -#: ../../library/multiprocessing.rst:1181 +#: ../../library/multiprocessing.rst:1182 msgid "" "Returns a list of the supported start methods, the first of which is the " "default. The possible start methods are ``'fork'``, ``'spawn'`` and " @@ -1822,13 +1823,13 @@ msgid "" "`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1190 +#: ../../library/multiprocessing.rst:1191 msgid "" "Return a context object which has the same attributes as the :mod:`!" "multiprocessing` module." msgstr "" -#: ../../library/multiprocessing.rst:1193 +#: ../../library/multiprocessing.rst:1194 msgid "" "If *method* is ``None`` then the default context is returned. Note that if " "the global start method has not been set, this will set it to the system " @@ -1838,54 +1839,54 @@ msgid "" "`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1204 +#: ../../library/multiprocessing.rst:1205 msgid "Return the name of start method used for starting processes." msgstr "" -#: ../../library/multiprocessing.rst:1206 +#: ../../library/multiprocessing.rst:1207 msgid "" "If the global start method is not set and *allow_none* is ``False``, the " "global start method is set to the default, and its name is returned. See :" "ref:`global-start-method` for more details." msgstr "" -#: ../../library/multiprocessing.rst:1210 +#: ../../library/multiprocessing.rst:1211 msgid "" "The return value can be ``'fork'``, ``'spawn'``, ``'forkserver'`` or " "``None``. See :ref:`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1217 +#: ../../library/multiprocessing.rst:1218 msgid "" "On macOS, the *spawn* start method is now the default. The *fork* start " "method should be considered unsafe as it can lead to crashes of the " "subprocess. See :issue:`33725`." msgstr "" -#: ../../library/multiprocessing.rst:1223 +#: ../../library/multiprocessing.rst:1224 msgid "" "Set the path of the Python interpreter to use when starting a child process. " "(By default :data:`sys.executable` is used). Embedders will probably need " "to do something like ::" msgstr "" -#: ../../library/multiprocessing.rst:1227 +#: ../../library/multiprocessing.rst:1228 msgid "set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))" msgstr "set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))" -#: ../../library/multiprocessing.rst:1229 +#: ../../library/multiprocessing.rst:1230 msgid "before they can create child processes." msgstr "" -#: ../../library/multiprocessing.rst:1231 +#: ../../library/multiprocessing.rst:1232 msgid "Now supported on POSIX when the ``'spawn'`` start method is used." msgstr "" -#: ../../library/multiprocessing.rst:1234 +#: ../../library/multiprocessing.rst:1235 msgid "Accepts a :term:`path-like object`." msgstr "接受一個\\ :term:`類路徑物件 `。" -#: ../../library/multiprocessing.rst:1239 +#: ../../library/multiprocessing.rst:1240 msgid "" "Set a list of module names for the forkserver main process to attempt to " "import so that their already imported state is inherited by forked " @@ -1894,19 +1895,19 @@ msgid "" "process." msgstr "" -#: ../../library/multiprocessing.rst:1245 +#: ../../library/multiprocessing.rst:1246 msgid "" "For this to work, it must be called before the forkserver process has been " "launched (before creating a :class:`Pool` or starting a :class:`Process`)." msgstr "" -#: ../../library/multiprocessing.rst:1248 +#: ../../library/multiprocessing.rst:1249 msgid "" "Only meaningful when using the ``'forkserver'`` start method. See :ref:" "`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1255 +#: ../../library/multiprocessing.rst:1256 msgid "" "Set the method which should be used to start child processes. The *method* " "argument can be ``'fork'``, ``'spawn'`` or ``'forkserver'``. Raises :exc:" @@ -1916,17 +1917,17 @@ msgid "" "then the context is set to the default context." msgstr "" -#: ../../library/multiprocessing.rst:1262 +#: ../../library/multiprocessing.rst:1263 msgid "" "Note that this should be called at most once, and it should be protected " "inside the ``if __name__ == '__main__'`` clause of the main module." msgstr "" -#: ../../library/multiprocessing.rst:1266 +#: ../../library/multiprocessing.rst:1267 msgid "See :ref:`multiprocessing-start-methods`." msgstr "參閱 :ref:`multiprocessing-start-methods`。" -#: ../../library/multiprocessing.rst:1272 +#: ../../library/multiprocessing.rst:1273 msgid "" ":mod:`!multiprocessing` contains no analogues of :func:`threading." "active_count`, :func:`threading.enumerate`, :func:`threading.settrace`, :" @@ -1934,75 +1935,75 @@ msgid "" "local`." msgstr "" -#: ../../library/multiprocessing.rst:1279 +#: ../../library/multiprocessing.rst:1280 msgid "Connection Objects" msgstr "" -#: ../../library/multiprocessing.rst:1283 +#: ../../library/multiprocessing.rst:1284 msgid "" "Connection objects allow the sending and receiving of picklable objects or " "strings. They can be thought of as message oriented connected sockets." msgstr "" -#: ../../library/multiprocessing.rst:1286 +#: ../../library/multiprocessing.rst:1287 msgid "" "Connection objects are usually created using :func:`Pipe ` -- see also :ref:`multiprocessing-listeners-clients`." msgstr "" -#: ../../library/multiprocessing.rst:1294 +#: ../../library/multiprocessing.rst:1295 msgid "" "Send an object to the other end of the connection which should be read " "using :meth:`recv`." msgstr "" -#: ../../library/multiprocessing.rst:1297 +#: ../../library/multiprocessing.rst:1298 msgid "" "The object must be picklable. Very large pickles (approximately 32 MiB+, " "though it depends on the OS) may raise a :exc:`ValueError` exception." msgstr "" -#: ../../library/multiprocessing.rst:1302 +#: ../../library/multiprocessing.rst:1303 msgid "" "Return an object sent from the other end of the connection using :meth:" "`send`. Blocks until there is something to receive. Raises :exc:`EOFError` " "if there is nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1309 +#: ../../library/multiprocessing.rst:1310 msgid "Return the file descriptor or handle used by the connection." msgstr "" -#: ../../library/multiprocessing.rst:1313 +#: ../../library/multiprocessing.rst:1314 msgid "Close the connection." msgstr "" -#: ../../library/multiprocessing.rst:1315 +#: ../../library/multiprocessing.rst:1316 msgid "This is called automatically when the connection is garbage collected." msgstr "" -#: ../../library/multiprocessing.rst:1319 +#: ../../library/multiprocessing.rst:1320 msgid "Return whether there is any data available to be read." msgstr "" -#: ../../library/multiprocessing.rst:1321 +#: ../../library/multiprocessing.rst:1322 msgid "" "If *timeout* is not specified then it will return immediately. If *timeout* " "is a number then this specifies the maximum time in seconds to block. If " "*timeout* is ``None`` then an infinite timeout is used." msgstr "" -#: ../../library/multiprocessing.rst:1325 +#: ../../library/multiprocessing.rst:1326 msgid "" "Note that multiple connection objects may be polled at once by using :func:" "`multiprocessing.connection.wait`." msgstr "" -#: ../../library/multiprocessing.rst:1330 +#: ../../library/multiprocessing.rst:1331 msgid "Send byte data from a :term:`bytes-like object` as a complete message." msgstr "" -#: ../../library/multiprocessing.rst:1332 +#: ../../library/multiprocessing.rst:1333 msgid "" "If *offset* is given then data is read from that position in *buffer*. If " "*size* is given then that many bytes will be read from buffer. Very large " @@ -2010,7 +2011,7 @@ msgid "" "exc:`ValueError` exception" msgstr "" -#: ../../library/multiprocessing.rst:1339 +#: ../../library/multiprocessing.rst:1340 msgid "" "Return a complete message of byte data sent from the other end of the " "connection as a string. Blocks until there is something to receive. Raises :" @@ -2018,19 +2019,19 @@ msgid "" "closed." msgstr "" -#: ../../library/multiprocessing.rst:1344 +#: ../../library/multiprocessing.rst:1345 msgid "" "If *maxlength* is specified and the message is longer than *maxlength* then :" "exc:`OSError` is raised and the connection will no longer be readable." msgstr "" -#: ../../library/multiprocessing.rst:1348 +#: ../../library/multiprocessing.rst:1349 msgid "" "This function used to raise :exc:`IOError`, which is now an alias of :exc:" "`OSError`." msgstr "" -#: ../../library/multiprocessing.rst:1355 +#: ../../library/multiprocessing.rst:1356 msgid "" "Read into *buffer* a complete message of byte data sent from the other end " "of the connection and return the number of bytes in the message. Blocks " @@ -2038,38 +2039,38 @@ msgid "" "nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1361 +#: ../../library/multiprocessing.rst:1362 msgid "" "*buffer* must be a writable :term:`bytes-like object`. If *offset* is given " "then the message will be written into the buffer from that position. Offset " "must be a non-negative integer less than the length of *buffer* (in bytes)." msgstr "" -#: ../../library/multiprocessing.rst:1366 +#: ../../library/multiprocessing.rst:1367 msgid "" "If the buffer is too short then a :exc:`BufferTooShort` exception is raised " "and the complete message is available as ``e.args[0]`` where ``e`` is the " "exception instance." msgstr "" -#: ../../library/multiprocessing.rst:1370 +#: ../../library/multiprocessing.rst:1371 msgid "" "Connection objects themselves can now be transferred between processes " "using :meth:`Connection.send` and :meth:`Connection.recv`." msgstr "" -#: ../../library/multiprocessing.rst:1374 +#: ../../library/multiprocessing.rst:1375 msgid "" "Connection objects also now support the context management protocol -- see :" "ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "connection object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:1378 +#: ../../library/multiprocessing.rst:1379 msgid "For example:" msgstr "舉例來說:" -#: ../../library/multiprocessing.rst:1380 +#: ../../library/multiprocessing.rst:1381 msgid "" ">>> from multiprocessing import Pipe\n" ">>> a, b = Pipe()\n" @@ -2105,14 +2106,14 @@ msgstr "" ">>> arr2\n" "array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])" -#: ../../library/multiprocessing.rst:1403 +#: ../../library/multiprocessing.rst:1404 msgid "" "The :meth:`Connection.recv` method automatically unpickles the data it " "receives, which can be a security risk unless you can trust the process " "which sent the message." msgstr "" -#: ../../library/multiprocessing.rst:1407 +#: ../../library/multiprocessing.rst:1408 msgid "" "Therefore, unless the connection object was produced using :func:`Pipe` you " "should only use the :meth:`~Connection.recv` and :meth:`~Connection.send` " @@ -2120,80 +2121,80 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:1414 +#: ../../library/multiprocessing.rst:1415 msgid "" "If a process is killed while it is trying to read or write to a pipe then " "the data in the pipe is likely to become corrupted, because it may become " "impossible to be sure where the message boundaries lie." msgstr "" -#: ../../library/multiprocessing.rst:1420 +#: ../../library/multiprocessing.rst:1421 msgid "Synchronization primitives" msgstr "" -#: ../../library/multiprocessing.rst:1424 +#: ../../library/multiprocessing.rst:1425 msgid "" "Generally synchronization primitives are not as necessary in a multiprocess " "program as they are in a multithreaded program. See the documentation for :" "mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:1428 +#: ../../library/multiprocessing.rst:1429 msgid "" "Note that one can also create synchronization primitives by using a manager " "object -- see :ref:`multiprocessing-managers`." msgstr "" -#: ../../library/multiprocessing.rst:1433 +#: ../../library/multiprocessing.rst:1434 msgid "A barrier object: a clone of :class:`threading.Barrier`." msgstr "" -#: ../../library/multiprocessing.rst:1442 +#: ../../library/multiprocessing.rst:1443 msgid "" "A bounded semaphore object: a close analog of :class:`threading." "BoundedSemaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1448 -#: ../../library/multiprocessing.rst:1620 +#: ../../library/multiprocessing.rst:1449 +#: ../../library/multiprocessing.rst:1621 msgid "" "A solitary difference from its close analog exists: its ``acquire`` method's " "first argument is named *block*, as is consistent with :meth:`Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1453 -#: ../../library/multiprocessing.rst:1538 -#: ../../library/multiprocessing.rst:1608 -#: ../../library/multiprocessing.rst:1634 +#: ../../library/multiprocessing.rst:1454 +#: ../../library/multiprocessing.rst:1539 +#: ../../library/multiprocessing.rst:1609 +#: ../../library/multiprocessing.rst:1635 msgid "Return a boolean indicating whether this object is locked right now." msgstr "" -#: ../../library/multiprocessing.rst:1458 +#: ../../library/multiprocessing.rst:1459 msgid "" "On macOS, this is indistinguishable from :class:`Semaphore` because " "``sem_getvalue()`` is not implemented on that platform." msgstr "" -#: ../../library/multiprocessing.rst:1463 +#: ../../library/multiprocessing.rst:1464 msgid "A condition variable: an alias for :class:`threading.Condition`." msgstr "" -#: ../../library/multiprocessing.rst:1465 +#: ../../library/multiprocessing.rst:1466 msgid "" "If *lock* is specified then it should be a :class:`Lock` or :class:`RLock` " "object from :mod:`!multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:1471 -#: ../../library/multiprocessing.rst:2066 +#: ../../library/multiprocessing.rst:1472 +#: ../../library/multiprocessing.rst:2067 msgid "The :meth:`~threading.Condition.wait_for` method was added." msgstr "新增 :meth:`~threading.Condition.wait_for` 方法。" -#: ../../library/multiprocessing.rst:1476 +#: ../../library/multiprocessing.rst:1477 msgid "A clone of :class:`threading.Event`." msgstr "" -#: ../../library/multiprocessing.rst:1483 +#: ../../library/multiprocessing.rst:1484 msgid "" "A non-recursive lock object: a close analog of :class:`threading.Lock`. Once " "a process or thread has acquired a lock, subsequent attempts to acquire it " @@ -2204,25 +2205,25 @@ msgid "" "as noted." msgstr "" -#: ../../library/multiprocessing.rst:1491 +#: ../../library/multiprocessing.rst:1492 msgid "" "Note that :class:`Lock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.Lock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1498 +#: ../../library/multiprocessing.rst:1499 msgid "" ":class:`Lock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1503 -#: ../../library/multiprocessing.rst:1564 +#: ../../library/multiprocessing.rst:1504 +#: ../../library/multiprocessing.rst:1565 msgid "Acquire a lock, blocking or non-blocking." msgstr "" -#: ../../library/multiprocessing.rst:1505 +#: ../../library/multiprocessing.rst:1506 msgid "" "With the *block* argument set to ``True`` (the default), the method call " "will block until the lock is in an unlocked state, then set it to locked and " @@ -2230,14 +2231,14 @@ msgid "" "that in :meth:`threading.Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1510 +#: ../../library/multiprocessing.rst:1511 msgid "" "With the *block* argument set to ``False``, the method call does not block. " "If the lock is currently in a locked state, return ``False``; otherwise set " "the lock to a locked state and return ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1514 +#: ../../library/multiprocessing.rst:1515 msgid "" "When invoked with a positive, floating-point value for *timeout*, block for " "at most the number of seconds specified by *timeout* as long as the lock can " @@ -2251,19 +2252,19 @@ msgid "" "acquired or ``False`` if the timeout period has elapsed." msgstr "" -#: ../../library/multiprocessing.rst:1529 +#: ../../library/multiprocessing.rst:1530 msgid "" "Release a lock. This can be called from any process or thread, not only the " "process or thread which originally acquired the lock." msgstr "" -#: ../../library/multiprocessing.rst:1532 +#: ../../library/multiprocessing.rst:1533 msgid "" "Behavior is the same as in :meth:`threading.Lock.release` except that when " "invoked on an unlocked lock, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:1545 +#: ../../library/multiprocessing.rst:1546 msgid "" "A recursive lock object: a close analog of :class:`threading.RLock`. A " "recursive lock must be released by the process or thread that acquired it. " @@ -2272,20 +2273,20 @@ msgid "" "release it once for each time it has been acquired." msgstr "" -#: ../../library/multiprocessing.rst:1551 +#: ../../library/multiprocessing.rst:1552 msgid "" "Note that :class:`RLock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.RLock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1558 +#: ../../library/multiprocessing.rst:1559 msgid "" ":class:`RLock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1566 +#: ../../library/multiprocessing.rst:1567 msgid "" "When invoked with the *block* argument set to ``True``, block until the lock " "is in an unlocked state (not owned by any process or thread) unless the lock " @@ -2298,7 +2299,7 @@ msgid "" "itself." msgstr "" -#: ../../library/multiprocessing.rst:1576 +#: ../../library/multiprocessing.rst:1577 msgid "" "When invoked with the *block* argument set to ``False``, do not block. If " "the lock has already been acquired (and thus is owned) by another process or " @@ -2309,14 +2310,14 @@ msgid "" "a return value of ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1584 +#: ../../library/multiprocessing.rst:1585 msgid "" "Use and behaviors of the *timeout* argument are the same as in :meth:`Lock." "acquire`. Note that some of these behaviors of *timeout* differ from the " "implemented behaviors in :meth:`threading.RLock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1591 +#: ../../library/multiprocessing.rst:1592 msgid "" "Release a lock, decrementing the recursion level. If after the decrement " "the recursion level is zero, reset the lock to unlocked (not owned by any " @@ -2326,7 +2327,7 @@ msgid "" "locked and owned by the calling process or thread." msgstr "" -#: ../../library/multiprocessing.rst:1599 +#: ../../library/multiprocessing.rst:1600 msgid "" "Only call this method when the calling process or thread owns the lock. An :" "exc:`AssertionError` is raised if this method is called by a process or " @@ -2335,21 +2336,21 @@ msgid "" "from the implemented behavior in :meth:`threading.RLock.release`." msgstr "" -#: ../../library/multiprocessing.rst:1615 +#: ../../library/multiprocessing.rst:1616 msgid "A semaphore object: a close analog of :class:`threading.Semaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1626 +#: ../../library/multiprocessing.rst:1627 msgid "Return the current value of semaphore." msgstr "" -#: ../../library/multiprocessing.rst:1641 +#: ../../library/multiprocessing.rst:1642 msgid "" "On macOS, ``sem_timedwait`` is unsupported, so calling ``acquire()`` with a " "timeout will emulate that function's behavior using a sleeping loop." msgstr "" -#: ../../library/multiprocessing.rst:1646 +#: ../../library/multiprocessing.rst:1647 msgid "" "Some of this package's functionality requires a functioning shared semaphore " "implementation on the host operating system. Without one, the :mod:" @@ -2358,32 +2359,32 @@ msgid "" "additional information." msgstr "" -#: ../../library/multiprocessing.rst:1654 +#: ../../library/multiprocessing.rst:1655 msgid "Shared :mod:`ctypes` Objects" msgstr "共享的 :mod:`ctypes` 物件" -#: ../../library/multiprocessing.rst:1656 +#: ../../library/multiprocessing.rst:1657 msgid "" "It is possible to create shared objects using shared memory which can be " "inherited by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1661 +#: ../../library/multiprocessing.rst:1662 msgid "" "Return a :mod:`ctypes` object allocated from shared memory. By default the " "return value is actually a synchronized wrapper for the object. The object " "itself can be accessed via the *value* attribute of a :class:`Value`." msgstr "" -#: ../../library/multiprocessing.rst:1665 -#: ../../library/multiprocessing.rst:1755 +#: ../../library/multiprocessing.rst:1666 +#: ../../library/multiprocessing.rst:1756 msgid "" "*typecode_or_type* determines the type of the returned object: it is either " "a ctypes type or a one character typecode of the kind used by the :mod:" "`array` module. *\\*args* is passed on to the constructor for the type." msgstr "" -#: ../../library/multiprocessing.rst:1669 +#: ../../library/multiprocessing.rst:1670 msgid "" "If *lock* is ``True`` (the default) then a new recursive lock object is " "created to synchronize access to the value. If *lock* is a :class:`Lock` " @@ -2393,24 +2394,24 @@ msgid "" "\"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1676 +#: ../../library/multiprocessing.rst:1677 msgid "" "Operations like ``+=`` which involve a read and write are not atomic. So " "if, for instance, you want to atomically increment a shared value it is " "insufficient to just do ::" msgstr "" -#: ../../library/multiprocessing.rst:1680 +#: ../../library/multiprocessing.rst:1681 msgid "counter.value += 1" msgstr "counter.value += 1" -#: ../../library/multiprocessing.rst:1682 +#: ../../library/multiprocessing.rst:1683 msgid "" "Assuming the associated lock is recursive (which it is by default) you can " "instead do ::" msgstr "" -#: ../../library/multiprocessing.rst:1685 +#: ../../library/multiprocessing.rst:1686 msgid "" "with counter.get_lock():\n" " counter.value += 1" @@ -2418,17 +2419,17 @@ msgstr "" "with counter.get_lock():\n" " counter.value += 1" -#: ../../library/multiprocessing.rst:1688 +#: ../../library/multiprocessing.rst:1689 msgid "Note that *lock* is a keyword-only argument." msgstr "" -#: ../../library/multiprocessing.rst:1692 +#: ../../library/multiprocessing.rst:1693 msgid "" "Return a ctypes array allocated from shared memory. By default the return " "value is actually a synchronized wrapper for the array." msgstr "" -#: ../../library/multiprocessing.rst:1695 +#: ../../library/multiprocessing.rst:1696 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a :ref:`ctypes type ` or " @@ -2441,7 +2442,7 @@ msgid "" "of the array." msgstr "" -#: ../../library/multiprocessing.rst:1705 +#: ../../library/multiprocessing.rst:1706 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`Lock` or :class:" @@ -2451,28 +2452,28 @@ msgid "" "safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1712 +#: ../../library/multiprocessing.rst:1713 msgid "Note that *lock* is a keyword only argument." msgstr "" -#: ../../library/multiprocessing.rst:1714 +#: ../../library/multiprocessing.rst:1715 msgid "" "Note that an array of :data:`ctypes.c_char` has *value* and *raw* attributes " "which allow one to use it to store and retrieve strings." msgstr "" -#: ../../library/multiprocessing.rst:1719 +#: ../../library/multiprocessing.rst:1720 msgid "The :mod:`!multiprocessing.sharedctypes` module" msgstr ":mod:`!multiprocessing.sharedctypes` 模組" -#: ../../library/multiprocessing.rst:1724 +#: ../../library/multiprocessing.rst:1725 msgid "" "The :mod:`!multiprocessing.sharedctypes` module provides functions for " "allocating :mod:`ctypes` objects from shared memory which can be inherited " "by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1730 +#: ../../library/multiprocessing.rst:1731 msgid "" "Although it is possible to store a pointer in shared memory remember that " "this will refer to a location in the address space of a specific process. " @@ -2481,11 +2482,11 @@ msgid "" "may cause a crash." msgstr "" -#: ../../library/multiprocessing.rst:1738 +#: ../../library/multiprocessing.rst:1739 msgid "Return a ctypes array allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1740 +#: ../../library/multiprocessing.rst:1741 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -2495,40 +2496,40 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1747 +#: ../../library/multiprocessing.rst:1748 msgid "" "Note that setting and getting an element is potentially non-atomic -- use :" "func:`Array` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1753 +#: ../../library/multiprocessing.rst:1754 msgid "Return a ctypes object allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1759 +#: ../../library/multiprocessing.rst:1760 msgid "" "Note that setting and getting the value is potentially non-atomic -- use :" "func:`Value` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1763 +#: ../../library/multiprocessing.rst:1764 msgid "" "Note that an array of :data:`ctypes.c_char` has ``value`` and ``raw`` " "attributes which allow one to use it to store and retrieve strings -- see " "documentation for :mod:`ctypes`." msgstr "" -#: ../../library/multiprocessing.rst:1769 +#: ../../library/multiprocessing.rst:1770 msgid "" "The same as :func:`RawArray` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "array." msgstr "" -#: ../../library/multiprocessing.rst:1773 -#: ../../library/multiprocessing.rst:1793 +#: ../../library/multiprocessing.rst:1774 +#: ../../library/multiprocessing.rst:1794 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`~multiprocessing." @@ -2538,128 +2539,128 @@ msgid "" "not necessarily be \"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1781 -#: ../../library/multiprocessing.rst:1800 -#: ../../library/multiprocessing.rst:1817 -#: ../../library/multiprocessing.rst:1938 +#: ../../library/multiprocessing.rst:1782 +#: ../../library/multiprocessing.rst:1801 +#: ../../library/multiprocessing.rst:1818 +#: ../../library/multiprocessing.rst:1939 msgid "" "*ctx* is a context object, or ``None`` (use the current context). If " "``None``, calling this may set the global start method. See :ref:`global-" "start-method` for more details." msgstr "" -#: ../../library/multiprocessing.rst:1785 -#: ../../library/multiprocessing.rst:1804 +#: ../../library/multiprocessing.rst:1786 +#: ../../library/multiprocessing.rst:1805 msgid "Note that *lock* and *ctx* are keyword-only parameters." msgstr "" -#: ../../library/multiprocessing.rst:1789 +#: ../../library/multiprocessing.rst:1790 msgid "" "The same as :func:`RawValue` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "object." msgstr "" -#: ../../library/multiprocessing.rst:1808 +#: ../../library/multiprocessing.rst:1809 msgid "" "Return a ctypes object allocated from shared memory which is a copy of the " "ctypes object *obj*." msgstr "" -#: ../../library/multiprocessing.rst:1813 +#: ../../library/multiprocessing.rst:1814 msgid "" "Return a process-safe wrapper object for a ctypes object which uses *lock* " "to synchronize access. If *lock* is ``None`` (the default) then a :class:" "`multiprocessing.RLock` object is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:1821 +#: ../../library/multiprocessing.rst:1822 msgid "" "A synchronized wrapper will have two methods in addition to those of the " "object it wraps: :meth:`get_obj` returns the wrapped object and :meth:" "`get_lock` returns the lock object used for synchronization." msgstr "" -#: ../../library/multiprocessing.rst:1825 +#: ../../library/multiprocessing.rst:1826 msgid "" "Note that accessing the ctypes object through the wrapper can be a lot " "slower than accessing the raw ctypes object." msgstr "" -#: ../../library/multiprocessing.rst:1828 +#: ../../library/multiprocessing.rst:1829 msgid "Synchronized objects support the :term:`context manager` protocol." msgstr "" -#: ../../library/multiprocessing.rst:1832 +#: ../../library/multiprocessing.rst:1833 msgid "" "The table below compares the syntax for creating shared ctypes objects from " "shared memory with the normal ctypes syntax. (In the table ``MyStruct`` is " "some subclass of :class:`ctypes.Structure`.)" msgstr "" -#: ../../library/multiprocessing.rst:1837 +#: ../../library/multiprocessing.rst:1838 msgid "ctypes" msgstr "ctypes" -#: ../../library/multiprocessing.rst:1837 +#: ../../library/multiprocessing.rst:1838 msgid "sharedctypes using type" msgstr "" -#: ../../library/multiprocessing.rst:1837 +#: ../../library/multiprocessing.rst:1838 msgid "sharedctypes using typecode" msgstr "" -#: ../../library/multiprocessing.rst:1839 +#: ../../library/multiprocessing.rst:1840 msgid "c_double(2.4)" msgstr "c_double(2.4)" -#: ../../library/multiprocessing.rst:1839 +#: ../../library/multiprocessing.rst:1840 msgid "RawValue(c_double, 2.4)" msgstr "RawValue(c_double, 2.4)" -#: ../../library/multiprocessing.rst:1839 +#: ../../library/multiprocessing.rst:1840 msgid "RawValue('d', 2.4)" msgstr "RawValue('d', 2.4)" -#: ../../library/multiprocessing.rst:1840 +#: ../../library/multiprocessing.rst:1841 msgid "MyStruct(4, 6)" msgstr "MyStruct(4, 6)" -#: ../../library/multiprocessing.rst:1840 +#: ../../library/multiprocessing.rst:1841 msgid "RawValue(MyStruct, 4, 6)" msgstr "RawValue(MyStruct, 4, 6)" -#: ../../library/multiprocessing.rst:1841 +#: ../../library/multiprocessing.rst:1842 msgid "(c_short * 7)()" msgstr "(c_short * 7)()" -#: ../../library/multiprocessing.rst:1841 +#: ../../library/multiprocessing.rst:1842 msgid "RawArray(c_short, 7)" msgstr "RawArray(c_short, 7)" -#: ../../library/multiprocessing.rst:1841 +#: ../../library/multiprocessing.rst:1842 msgid "RawArray('h', 7)" msgstr "RawArray('h', 7)" -#: ../../library/multiprocessing.rst:1842 +#: ../../library/multiprocessing.rst:1843 msgid "(c_int * 3)(9, 2, 8)" msgstr "(c_int * 3)(9, 2, 8)" -#: ../../library/multiprocessing.rst:1842 +#: ../../library/multiprocessing.rst:1843 msgid "RawArray(c_int, (9, 2, 8))" msgstr "RawArray(c_int, (9, 2, 8))" -#: ../../library/multiprocessing.rst:1842 +#: ../../library/multiprocessing.rst:1843 msgid "RawArray('i', (9, 2, 8))" msgstr "RawArray('i', (9, 2, 8))" -#: ../../library/multiprocessing.rst:1846 +#: ../../library/multiprocessing.rst:1847 msgid "" "Below is an example where a number of ctypes objects are modified by a child " "process::" msgstr "" -#: ../../library/multiprocessing.rst:1849 +#: ../../library/multiprocessing.rst:1850 msgid "" "from multiprocessing import Process, Lock\n" "from multiprocessing.sharedctypes import Value, Array\n" @@ -2725,11 +2726,11 @@ msgstr "" " print(s.value)\n" " print([(a.x, a.y) for a in A])" -#: ../../library/multiprocessing.rst:1884 +#: ../../library/multiprocessing.rst:1885 msgid "The results printed are ::" msgstr "" -#: ../../library/multiprocessing.rst:1886 +#: ../../library/multiprocessing.rst:1887 msgid "" "49\n" "0.1111111111111111\n" @@ -2741,11 +2742,11 @@ msgstr "" "HELLO WORLD\n" "[(3.515625, 39.0625), (33.0625, 4.0), (5.640625, 90.25)]" -#: ../../library/multiprocessing.rst:1897 +#: ../../library/multiprocessing.rst:1898 msgid "Managers" msgstr "" -#: ../../library/multiprocessing.rst:1899 +#: ../../library/multiprocessing.rst:1900 msgid "" "Managers provide a way to create data which can be shared between different " "processes, including sharing over a network between processes running on " @@ -2754,7 +2755,7 @@ msgid "" "proxies." msgstr "" -#: ../../library/multiprocessing.rst:1908 +#: ../../library/multiprocessing.rst:1909 msgid "" "Returns a started :class:`~multiprocessing.managers.SyncManager` object " "which can be used for sharing objects between processes. The returned " @@ -2762,31 +2763,31 @@ msgid "" "will create shared objects and return corresponding proxies." msgstr "" -#: ../../library/multiprocessing.rst:1916 +#: ../../library/multiprocessing.rst:1917 msgid "" "Manager processes will be shutdown as soon as they are garbage collected or " "their parent process exits. The manager classes are defined in the :mod:" "`multiprocessing.managers` module:" msgstr "" -#: ../../library/multiprocessing.rst:1922 +#: ../../library/multiprocessing.rst:1923 msgid "Create a BaseManager object." msgstr "建立一個 BaseManager 物件。" -#: ../../library/multiprocessing.rst:1924 +#: ../../library/multiprocessing.rst:1925 msgid "" "Once created one should call :meth:`start` or ``get_server()." "serve_forever()`` to ensure that the manager object refers to a started " "manager process." msgstr "" -#: ../../library/multiprocessing.rst:1927 +#: ../../library/multiprocessing.rst:1928 msgid "" "*address* is the address on which the manager process listens for new " "connections. If *address* is ``None`` then an arbitrary one is chosen." msgstr "" -#: ../../library/multiprocessing.rst:1930 +#: ../../library/multiprocessing.rst:1931 msgid "" "*authkey* is the authentication key which will be used to check the validity " "of incoming connections to the server process. If *authkey* is ``None`` " @@ -2794,13 +2795,13 @@ msgid "" "it must be a byte string." msgstr "" -#: ../../library/multiprocessing.rst:1935 +#: ../../library/multiprocessing.rst:1936 msgid "" "*serializer* must be ``'pickle'`` (use :mod:`pickle` serialization) or " "``'xmlrpclib'`` (use :mod:`xmlrpc.client` serialization)." msgstr "" -#: ../../library/multiprocessing.rst:1942 +#: ../../library/multiprocessing.rst:1943 msgid "" "*shutdown_timeout* is a timeout in seconds used to wait until the process " "used by the manager completes in the :meth:`shutdown` method. If the " @@ -2808,24 +2809,24 @@ msgid "" "also times out, the process is killed." msgstr "" -#: ../../library/multiprocessing.rst:1947 +#: ../../library/multiprocessing.rst:1948 msgid "Added the *shutdown_timeout* parameter." msgstr "新增 *shutdown_timeout* 參數。" -#: ../../library/multiprocessing.rst:1952 +#: ../../library/multiprocessing.rst:1953 msgid "" "Start a subprocess to start the manager. If *initializer* is not ``None`` " "then the subprocess will call ``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:1957 +#: ../../library/multiprocessing.rst:1958 msgid "" "Returns a :class:`Server` object which represents the actual server under " "the control of the Manager. The :class:`Server` object supports the :meth:" "`serve_forever` method::" msgstr "" -#: ../../library/multiprocessing.rst:1961 +#: ../../library/multiprocessing.rst:1962 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> manager = BaseManager(address=('', 50000), authkey=b'abc')\n" @@ -2837,15 +2838,15 @@ msgstr "" ">>> server = manager.get_server()\n" ">>> server.serve_forever()" -#: ../../library/multiprocessing.rst:1966 +#: ../../library/multiprocessing.rst:1967 msgid ":class:`Server` additionally has an :attr:`address` attribute." msgstr "" -#: ../../library/multiprocessing.rst:1970 +#: ../../library/multiprocessing.rst:1971 msgid "Connect a local manager object to a remote manager process::" msgstr "" -#: ../../library/multiprocessing.rst:1972 +#: ../../library/multiprocessing.rst:1973 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')\n" @@ -2855,29 +2856,29 @@ msgstr "" ">>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')\n" ">>> m.connect()" -#: ../../library/multiprocessing.rst:1978 +#: ../../library/multiprocessing.rst:1979 msgid "" "Stop the process used by the manager. This is only available if :meth:" "`start` has been used to start the server process." msgstr "" -#: ../../library/multiprocessing.rst:1981 +#: ../../library/multiprocessing.rst:1982 msgid "This can be called multiple times." msgstr "" -#: ../../library/multiprocessing.rst:1985 +#: ../../library/multiprocessing.rst:1986 msgid "" "A classmethod which can be used for registering a type or callable with the " "manager class." msgstr "" -#: ../../library/multiprocessing.rst:1988 +#: ../../library/multiprocessing.rst:1989 msgid "" "*typeid* is a \"type identifier\" which is used to identify a particular " "type of shared object. This must be a string." msgstr "" -#: ../../library/multiprocessing.rst:1991 +#: ../../library/multiprocessing.rst:1992 msgid "" "*callable* is a callable used for creating objects for this type " "identifier. If a manager instance will be connected to the server using " @@ -2885,14 +2886,14 @@ msgid "" "then this can be left as ``None``." msgstr "" -#: ../../library/multiprocessing.rst:1997 +#: ../../library/multiprocessing.rst:1998 msgid "" "*proxytype* is a subclass of :class:`BaseProxy` which is used to create " "proxies for shared objects with this *typeid*. If ``None`` then a proxy " "class is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:2001 +#: ../../library/multiprocessing.rst:2002 msgid "" "*exposed* is used to specify a sequence of method names which proxies for " "this typeid should be allowed to access using :meth:`BaseProxy." @@ -2903,7 +2904,7 @@ msgid "" "method and whose name does not begin with ``'_'``.)" msgstr "" -#: ../../library/multiprocessing.rst:2010 +#: ../../library/multiprocessing.rst:2011 msgid "" "*method_to_typeid* is a mapping used to specify the return type of those " "exposed methods which should return a proxy. It maps method names to typeid " @@ -2913,22 +2914,22 @@ msgid "" "returned by the method will be copied by value." msgstr "" -#: ../../library/multiprocessing.rst:2017 +#: ../../library/multiprocessing.rst:2018 msgid "" "*create_method* determines whether a method should be created with name " "*typeid* which can be used to tell the server process to create a new shared " "object and return a proxy for it. By default it is ``True``." msgstr "" -#: ../../library/multiprocessing.rst:2021 +#: ../../library/multiprocessing.rst:2022 msgid ":class:`BaseManager` instances also have one read-only property:" msgstr "" -#: ../../library/multiprocessing.rst:2025 +#: ../../library/multiprocessing.rst:2026 msgid "The address used by the manager." msgstr "" -#: ../../library/multiprocessing.rst:2027 +#: ../../library/multiprocessing.rst:2028 msgid "" "Manager objects support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` starts the server " @@ -2936,129 +2937,129 @@ msgid "" "object. :meth:`~contextmanager.__exit__` calls :meth:`shutdown`." msgstr "" -#: ../../library/multiprocessing.rst:2033 +#: ../../library/multiprocessing.rst:2034 msgid "" "In previous versions :meth:`~contextmanager.__enter__` did not start the " "manager's server process if it was not already started." msgstr "" -#: ../../library/multiprocessing.rst:2038 +#: ../../library/multiprocessing.rst:2039 msgid "" "A subclass of :class:`BaseManager` which can be used for the synchronization " "of processes. Objects of this type are returned by :func:`multiprocessing." "Manager`." msgstr "" -#: ../../library/multiprocessing.rst:2042 +#: ../../library/multiprocessing.rst:2043 msgid "" "Its methods create and return :ref:`multiprocessing-proxy_objects` for a " "number of commonly used data types to be synchronized across processes. This " "notably includes shared lists and dictionaries." msgstr "" -#: ../../library/multiprocessing.rst:2048 +#: ../../library/multiprocessing.rst:2049 msgid "" "Create a shared :class:`threading.Barrier` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:2055 +#: ../../library/multiprocessing.rst:2056 msgid "" "Create a shared :class:`threading.BoundedSemaphore` object and return a " "proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:2060 +#: ../../library/multiprocessing.rst:2061 msgid "" "Create a shared :class:`threading.Condition` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:2063 +#: ../../library/multiprocessing.rst:2064 msgid "" "If *lock* is supplied then it should be a proxy for a :class:`threading." "Lock` or :class:`threading.RLock` object." msgstr "" -#: ../../library/multiprocessing.rst:2071 +#: ../../library/multiprocessing.rst:2072 msgid "" "Create a shared :class:`threading.Event` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:2075 +#: ../../library/multiprocessing.rst:2076 msgid "" "Create a shared :class:`threading.Lock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:2079 +#: ../../library/multiprocessing.rst:2080 msgid "Create a shared :class:`Namespace` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:2083 +#: ../../library/multiprocessing.rst:2084 msgid "Create a shared :class:`queue.Queue` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:2087 +#: ../../library/multiprocessing.rst:2088 msgid "" "Create a shared :class:`threading.RLock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:2091 +#: ../../library/multiprocessing.rst:2092 msgid "" "Create a shared :class:`threading.Semaphore` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:2096 +#: ../../library/multiprocessing.rst:2097 msgid "Create an array and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:2100 +#: ../../library/multiprocessing.rst:2101 msgid "" "Create an object with a writable ``value`` attribute and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:2107 +#: ../../library/multiprocessing.rst:2108 msgid "Create a shared :class:`dict` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:2112 +#: ../../library/multiprocessing.rst:2113 msgid "Create a shared :class:`list` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:2118 +#: ../../library/multiprocessing.rst:2119 msgid "Create a shared :class:`set` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:2120 +#: ../../library/multiprocessing.rst:2121 msgid ":class:`set` support was added." msgstr "已新增對 :class:`set` 的支援。" -#: ../../library/multiprocessing.rst:2123 +#: ../../library/multiprocessing.rst:2124 msgid "" "Shared objects are capable of being nested. For example, a shared container " "object such as a shared list can contain other shared objects which will all " "be managed and synchronized by the :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:2130 +#: ../../library/multiprocessing.rst:2131 msgid "A type that can register with :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:2132 +#: ../../library/multiprocessing.rst:2133 msgid "" "A namespace object has no public methods, but does have writable attributes. " "Its representation shows the values of its attributes." msgstr "" -#: ../../library/multiprocessing.rst:2135 +#: ../../library/multiprocessing.rst:2136 msgid "" "However, when using a proxy for a namespace object, an attribute beginning " "with ``'_'`` will be an attribute of the proxy and not an attribute of the " "referent:" msgstr "" -#: ../../library/multiprocessing.rst:2139 +#: ../../library/multiprocessing.rst:2140 msgid "" ">>> mp_context = multiprocessing.get_context('spawn')\n" ">>> manager = mp_context.Manager()\n" @@ -3070,18 +3071,18 @@ msgid "" "Namespace(x=10, y='hello')" msgstr "" -#: ../../library/multiprocessing.rst:2152 +#: ../../library/multiprocessing.rst:2153 msgid "Customized managers" msgstr "" -#: ../../library/multiprocessing.rst:2154 +#: ../../library/multiprocessing.rst:2155 msgid "" "To create one's own manager, one creates a subclass of :class:`BaseManager` " "and uses the :meth:`~BaseManager.register` classmethod to register new types " "or callables with the manager class. For example::" msgstr "" -#: ../../library/multiprocessing.rst:2158 +#: ../../library/multiprocessing.rst:2159 msgid "" "from multiprocessing.managers import BaseManager\n" "\n" @@ -3121,23 +3122,23 @@ msgstr "" " print(maths.add(4, 3)) # 印出 7\n" " print(maths.mul(7, 8)) # 印出 56" -#: ../../library/multiprocessing.rst:2179 +#: ../../library/multiprocessing.rst:2180 msgid "Using a remote manager" msgstr "" -#: ../../library/multiprocessing.rst:2181 +#: ../../library/multiprocessing.rst:2182 msgid "" "It is possible to run a manager server on one machine and have clients use " "it from other machines (assuming that the firewalls involved allow it)." msgstr "" -#: ../../library/multiprocessing.rst:2184 +#: ../../library/multiprocessing.rst:2185 msgid "" "Running the following commands creates a server for a single shared queue " "which remote clients can access::" msgstr "" -#: ../../library/multiprocessing.rst:2187 +#: ../../library/multiprocessing.rst:2188 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> from queue import Queue\n" @@ -3157,11 +3158,11 @@ msgstr "" ">>> s = m.get_server()\n" ">>> s.serve_forever()" -#: ../../library/multiprocessing.rst:2196 +#: ../../library/multiprocessing.rst:2197 msgid "One client can access the server as follows::" msgstr "" -#: ../../library/multiprocessing.rst:2198 +#: ../../library/multiprocessing.rst:2199 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> class QueueManager(BaseManager): pass\n" @@ -3181,11 +3182,11 @@ msgstr "" ">>> queue = m.get_queue()\n" ">>> queue.put('hello')" -#: ../../library/multiprocessing.rst:2206 +#: ../../library/multiprocessing.rst:2207 msgid "Another client can also use it::" msgstr "" -#: ../../library/multiprocessing.rst:2208 +#: ../../library/multiprocessing.rst:2209 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> class QueueManager(BaseManager): pass\n" @@ -3207,13 +3208,13 @@ msgstr "" ">>> queue.get()\n" "'hello'" -#: ../../library/multiprocessing.rst:2217 +#: ../../library/multiprocessing.rst:2218 msgid "" "Local processes can also access that queue, using the code from above on the " "client to access it remotely::" msgstr "" -#: ../../library/multiprocessing.rst:2220 +#: ../../library/multiprocessing.rst:2221 msgid "" ">>> from multiprocessing import Process, Queue\n" ">>> from multiprocessing.managers import BaseManager\n" @@ -3253,18 +3254,18 @@ msgstr "" ">>> s = m.get_server()\n" ">>> s.serve_forever()" -#: ../../library/multiprocessing.rst:2242 +#: ../../library/multiprocessing.rst:2243 msgid "Proxy Objects" msgstr "" -#: ../../library/multiprocessing.rst:2244 +#: ../../library/multiprocessing.rst:2245 msgid "" "A proxy is an object which *refers* to a shared object which lives " "(presumably) in a different process. The shared object is said to be the " "*referent* of the proxy. Multiple proxy objects may have the same referent." msgstr "" -#: ../../library/multiprocessing.rst:2248 +#: ../../library/multiprocessing.rst:2249 msgid "" "A proxy object has methods which invoke corresponding methods of its " "referent (although not every method of the referent will necessarily be " @@ -3272,7 +3273,7 @@ msgid "" "its referent can:" msgstr "" -#: ../../library/multiprocessing.rst:2252 +#: ../../library/multiprocessing.rst:2253 msgid "" ">>> mp_context = multiprocessing.get_context('spawn')\n" ">>> manager = mp_context.Manager()\n" @@ -3298,14 +3299,14 @@ msgstr "" ">>> l[2:5]\n" "[4, 9, 16]" -#: ../../library/multiprocessing.rst:2266 +#: ../../library/multiprocessing.rst:2267 msgid "" "Notice that applying :func:`str` to a proxy will return the representation " "of the referent, whereas applying :func:`repr` will return the " "representation of the proxy." msgstr "" -#: ../../library/multiprocessing.rst:2270 +#: ../../library/multiprocessing.rst:2271 msgid "" "An important feature of proxy objects is that they are picklable so they can " "be passed between processes. As such, a referent can contain :ref:" @@ -3313,7 +3314,7 @@ msgid "" "lists, dicts, and other :ref:`multiprocessing-proxy_objects`:" msgstr "" -#: ../../library/multiprocessing.rst:2275 +#: ../../library/multiprocessing.rst:2276 msgid "" ">>> a = manager.list()\n" ">>> b = manager.list()\n" @@ -3325,11 +3326,11 @@ msgid "" "['hello'] ['hello']" msgstr "" -#: ../../library/multiprocessing.rst:2286 +#: ../../library/multiprocessing.rst:2287 msgid "Similarly, dict and list proxies may be nested inside one another::" msgstr "" -#: ../../library/multiprocessing.rst:2288 +#: ../../library/multiprocessing.rst:2289 msgid "" ">>> l_outer = manager.list([ manager.dict() for i in range(2) ])\n" ">>> d_first_inner = l_outer[0]\n" @@ -3353,7 +3354,7 @@ msgstr "" ">>> print(l_outer[1])\n" "{'c': 3, 'z': 26}" -#: ../../library/multiprocessing.rst:2299 +#: ../../library/multiprocessing.rst:2300 msgid "" "If standard (non-proxy) :class:`list` or :class:`dict` objects are contained " "in a referent, modifications to those mutable values will not be propagated " @@ -3364,7 +3365,7 @@ msgid "" "assign the modified value to the container proxy::" msgstr "" -#: ../../library/multiprocessing.rst:2307 +#: ../../library/multiprocessing.rst:2308 msgid "" "# create a list proxy and append a mutable object (a dictionary)\n" "lproxy = manager.list()\n" @@ -3378,20 +3379,20 @@ msgid "" "lproxy[0] = d" msgstr "" -#: ../../library/multiprocessing.rst:2318 +#: ../../library/multiprocessing.rst:2319 msgid "" "This approach is perhaps less convenient than employing nested :ref:" "`multiprocessing-proxy_objects` for most use cases but also demonstrates a " "level of control over the synchronization." msgstr "" -#: ../../library/multiprocessing.rst:2324 +#: ../../library/multiprocessing.rst:2325 msgid "" "The proxy types in :mod:`!multiprocessing` do nothing to support comparisons " "by value. So, for instance, we have:" msgstr "" -#: ../../library/multiprocessing.rst:2327 +#: ../../library/multiprocessing.rst:2328 msgid "" ">>> manager.list([1,2,3]) == [1,2,3]\n" "False" @@ -3399,48 +3400,48 @@ msgstr "" ">>> manager.list([1,2,3]) == [1,2,3]\n" "False" -#: ../../library/multiprocessing.rst:2332 +#: ../../library/multiprocessing.rst:2333 msgid "" "One should just use a copy of the referent instead when making comparisons." msgstr "" -#: ../../library/multiprocessing.rst:2336 +#: ../../library/multiprocessing.rst:2337 msgid "Proxy objects are instances of subclasses of :class:`BaseProxy`." msgstr "" -#: ../../library/multiprocessing.rst:2340 +#: ../../library/multiprocessing.rst:2341 msgid "Call and return the result of a method of the proxy's referent." msgstr "" -#: ../../library/multiprocessing.rst:2342 +#: ../../library/multiprocessing.rst:2343 msgid "" "If ``proxy`` is a proxy whose referent is ``obj`` then the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2344 +#: ../../library/multiprocessing.rst:2345 msgid "proxy._callmethod(methodname, args, kwds)" msgstr "proxy._callmethod(methodname, args, kwds)" -#: ../../library/multiprocessing.rst:2346 +#: ../../library/multiprocessing.rst:2347 msgid "will evaluate the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2348 +#: ../../library/multiprocessing.rst:2349 msgid "getattr(obj, methodname)(*args, **kwds)" msgstr "getattr(obj, methodname)(*args, **kwds)" -#: ../../library/multiprocessing.rst:2350 +#: ../../library/multiprocessing.rst:2351 msgid "in the manager's process." msgstr "" -#: ../../library/multiprocessing.rst:2352 +#: ../../library/multiprocessing.rst:2353 msgid "" "The returned value will be a copy of the result of the call or a proxy to a " "new shared object -- see documentation for the *method_to_typeid* argument " "of :meth:`BaseManager.register`." msgstr "" -#: ../../library/multiprocessing.rst:2356 +#: ../../library/multiprocessing.rst:2357 msgid "" "If an exception is raised by the call, then is re-raised by :meth:" "`_callmethod`. If some other exception is raised in the manager's process " @@ -3448,17 +3449,17 @@ msgid "" "meth:`_callmethod`." msgstr "" -#: ../../library/multiprocessing.rst:2361 +#: ../../library/multiprocessing.rst:2362 msgid "" "Note in particular that an exception will be raised if *methodname* has not " "been *exposed*." msgstr "" -#: ../../library/multiprocessing.rst:2364 +#: ../../library/multiprocessing.rst:2365 msgid "An example of the usage of :meth:`_callmethod`:" msgstr "" -#: ../../library/multiprocessing.rst:2366 +#: ../../library/multiprocessing.rst:2367 msgid "" ">>> l = manager.list(range(10))\n" ">>> l._callmethod('__len__')\n" @@ -3480,69 +3481,69 @@ msgstr "" "...\n" "IndexError: list index out of range" -#: ../../library/multiprocessing.rst:2380 +#: ../../library/multiprocessing.rst:2381 msgid "Return a copy of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2382 +#: ../../library/multiprocessing.rst:2383 msgid "If the referent is unpicklable then this will raise an exception." msgstr "" -#: ../../library/multiprocessing.rst:2386 +#: ../../library/multiprocessing.rst:2387 msgid "Return a representation of the proxy object." msgstr "" -#: ../../library/multiprocessing.rst:2390 +#: ../../library/multiprocessing.rst:2391 msgid "Return the representation of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2394 +#: ../../library/multiprocessing.rst:2395 msgid "Cleanup" msgstr "" -#: ../../library/multiprocessing.rst:2396 +#: ../../library/multiprocessing.rst:2397 msgid "" "A proxy object uses a weakref callback so that when it gets garbage " "collected it deregisters itself from the manager which owns its referent." msgstr "" -#: ../../library/multiprocessing.rst:2399 +#: ../../library/multiprocessing.rst:2400 msgid "" "A shared object gets deleted from the manager process when there are no " "longer any proxies referring to it." msgstr "" -#: ../../library/multiprocessing.rst:2404 +#: ../../library/multiprocessing.rst:2405 msgid "Process Pools" msgstr "" -#: ../../library/multiprocessing.rst:2409 +#: ../../library/multiprocessing.rst:2410 msgid "" "One can create a pool of processes which will carry out tasks submitted to " "it with the :class:`Pool` class." msgstr "" -#: ../../library/multiprocessing.rst:2414 +#: ../../library/multiprocessing.rst:2415 msgid "" "A process pool object which controls a pool of worker processes to which " "jobs can be submitted. It supports asynchronous results with timeouts and " "callbacks and has a parallel map implementation." msgstr "" -#: ../../library/multiprocessing.rst:2418 +#: ../../library/multiprocessing.rst:2419 msgid "" "*processes* is the number of worker processes to use. If *processes* is " "``None`` then the number returned by :func:`os.process_cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2421 -#: ../../library/multiprocessing.rst:2987 +#: ../../library/multiprocessing.rst:2422 +#: ../../library/multiprocessing.rst:2988 msgid "" "If *initializer* is not ``None`` then each worker process will call " "``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:2424 +#: ../../library/multiprocessing.rst:2425 msgid "" "*maxtasksperchild* is the number of tasks a worker process can complete " "before it will exit and be replaced with a fresh worker process, to enable " @@ -3550,7 +3551,7 @@ msgid "" "which means worker processes will live as long as the pool." msgstr "" -#: ../../library/multiprocessing.rst:2429 +#: ../../library/multiprocessing.rst:2430 msgid "" "*context* can be used to specify the context used for starting the worker " "processes. Usually a pool is created using the function :func:" @@ -3560,13 +3561,13 @@ msgid "" "method if it has not been set already. See the :func:`get_context` function." msgstr "" -#: ../../library/multiprocessing.rst:2437 +#: ../../library/multiprocessing.rst:2438 msgid "" "Note that the methods of the pool object should only be called by the " "process which created the pool." msgstr "" -#: ../../library/multiprocessing.rst:2441 +#: ../../library/multiprocessing.rst:2442 msgid "" ":class:`multiprocessing.pool` objects have internal resources that need to " "be properly managed (like any other resource) by using the pool as a context " @@ -3574,28 +3575,28 @@ msgid "" "to do this can lead to the process hanging on finalization." msgstr "" -#: ../../library/multiprocessing.rst:2446 +#: ../../library/multiprocessing.rst:2447 msgid "" "Note that it is **not correct** to rely on the garbage collector to destroy " "the pool as CPython does not assure that the finalizer of the pool will be " "called (see :meth:`object.__del__` for more information)." msgstr "" -#: ../../library/multiprocessing.rst:2450 +#: ../../library/multiprocessing.rst:2451 msgid "Added the *maxtasksperchild* parameter." msgstr "新增 *maxtasksperchild* 參數。" -#: ../../library/multiprocessing.rst:2453 +#: ../../library/multiprocessing.rst:2454 msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" -#: ../../library/multiprocessing.rst:2456 +#: ../../library/multiprocessing.rst:2457 msgid "" "*processes* uses :func:`os.process_cpu_count` by default, instead of :func:" "`os.cpu_count`." msgstr "" -#: ../../library/multiprocessing.rst:2462 +#: ../../library/multiprocessing.rst:2463 msgid "" "Worker processes within a :class:`Pool` typically live for the complete " "duration of the Pool's work queue. A frequent pattern found in other systems " @@ -3606,7 +3607,7 @@ msgid "" "the end user." msgstr "" -#: ../../library/multiprocessing.rst:2472 +#: ../../library/multiprocessing.rst:2473 msgid "" "Call *func* with arguments *args* and keyword arguments *kwds*. It blocks " "until the result is ready. Given this blocks, :meth:`apply_async` is better " @@ -3614,14 +3615,14 @@ msgid "" "executed in one of the workers of the pool." msgstr "" -#: ../../library/multiprocessing.rst:2479 +#: ../../library/multiprocessing.rst:2480 msgid "" "A variant of the :meth:`apply` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2482 -#: ../../library/multiprocessing.rst:2513 +#: ../../library/multiprocessing.rst:2483 +#: ../../library/multiprocessing.rst:2514 msgid "" "If *callback* is specified then it should be a callable which accepts a " "single argument. When the result becomes ready *callback* is applied to it, " @@ -3629,60 +3630,60 @@ msgid "" "applied instead." msgstr "" -#: ../../library/multiprocessing.rst:2487 -#: ../../library/multiprocessing.rst:2518 +#: ../../library/multiprocessing.rst:2488 +#: ../../library/multiprocessing.rst:2519 msgid "" "If *error_callback* is specified then it should be a callable which accepts " "a single argument. If the target function fails, then the *error_callback* " "is called with the exception instance." msgstr "" -#: ../../library/multiprocessing.rst:2491 -#: ../../library/multiprocessing.rst:2522 +#: ../../library/multiprocessing.rst:2492 +#: ../../library/multiprocessing.rst:2523 msgid "" "Callbacks should complete immediately since otherwise the thread which " "handles the results will get blocked." msgstr "" -#: ../../library/multiprocessing.rst:2496 +#: ../../library/multiprocessing.rst:2497 msgid "" "A parallel equivalent of the :func:`map` built-in function (it supports only " "one *iterable* argument though, for multiple iterables see :meth:`starmap`). " "It blocks until the result is ready." msgstr "" -#: ../../library/multiprocessing.rst:2500 +#: ../../library/multiprocessing.rst:2501 msgid "" "This method chops the iterable into a number of chunks which it submits to " "the process pool as separate tasks. The (approximate) size of these chunks " "can be specified by setting *chunksize* to a positive integer." msgstr "" -#: ../../library/multiprocessing.rst:2504 +#: ../../library/multiprocessing.rst:2505 msgid "" "Note that it may cause high memory usage for very long iterables. Consider " "using :meth:`imap` or :meth:`imap_unordered` with explicit *chunksize* " "option for better efficiency." msgstr "" -#: ../../library/multiprocessing.rst:2510 +#: ../../library/multiprocessing.rst:2511 msgid "" "A variant of the :meth:`.map` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2527 +#: ../../library/multiprocessing.rst:2528 msgid "A lazier version of :meth:`.map`." msgstr "" -#: ../../library/multiprocessing.rst:2529 +#: ../../library/multiprocessing.rst:2530 msgid "" "The *chunksize* argument is the same as the one used by the :meth:`.map` " "method. For very long iterables using a large value for *chunksize* can " "make the job complete **much** faster than using the default value of ``1``." msgstr "" -#: ../../library/multiprocessing.rst:2534 +#: ../../library/multiprocessing.rst:2535 msgid "" "Also if *chunksize* is ``1`` then the :meth:`!next` method of the iterator " "returned by the :meth:`imap` method has an optional *timeout* parameter: " @@ -3690,65 +3691,65 @@ msgid "" "result cannot be returned within *timeout* seconds." msgstr "" -#: ../../library/multiprocessing.rst:2541 +#: ../../library/multiprocessing.rst:2542 msgid "" "The same as :meth:`imap` except that the ordering of the results from the " "returned iterator should be considered arbitrary. (Only when there is only " "one worker process is the order guaranteed to be \"correct\".)" msgstr "" -#: ../../library/multiprocessing.rst:2547 +#: ../../library/multiprocessing.rst:2548 msgid "" "Like :meth:`~multiprocessing.pool.Pool.map` except that the elements of the " "*iterable* are expected to be iterables that are unpacked as arguments." msgstr "" -#: ../../library/multiprocessing.rst:2551 +#: ../../library/multiprocessing.rst:2552 msgid "" "Hence an *iterable* of ``[(1,2), (3, 4)]`` results in ``[func(1,2), " "func(3,4)]``." msgstr "" -#: ../../library/multiprocessing.rst:2558 +#: ../../library/multiprocessing.rst:2559 msgid "" "A combination of :meth:`starmap` and :meth:`map_async` that iterates over " "*iterable* of iterables and calls *func* with the iterables unpacked. " "Returns a result object." msgstr "" -#: ../../library/multiprocessing.rst:2566 +#: ../../library/multiprocessing.rst:2567 msgid "" "Prevents any more tasks from being submitted to the pool. Once all the " "tasks have been completed the worker processes will exit." msgstr "" -#: ../../library/multiprocessing.rst:2571 +#: ../../library/multiprocessing.rst:2572 msgid "" "Stops the worker processes immediately without completing outstanding work. " "When the pool object is garbage collected :meth:`terminate` will be called " "immediately." msgstr "" -#: ../../library/multiprocessing.rst:2577 +#: ../../library/multiprocessing.rst:2578 msgid "" "Wait for the worker processes to exit. One must call :meth:`close` or :meth:" "`terminate` before using :meth:`join`." msgstr "" -#: ../../library/multiprocessing.rst:2580 +#: ../../library/multiprocessing.rst:2581 msgid "" "Pool objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the pool " "object, and :meth:`~contextmanager.__exit__` calls :meth:`terminate`." msgstr "" -#: ../../library/multiprocessing.rst:2588 +#: ../../library/multiprocessing.rst:2589 msgid "" "The class of the result returned by :meth:`Pool.apply_async` and :meth:`Pool." "map_async`." msgstr "" -#: ../../library/multiprocessing.rst:2593 +#: ../../library/multiprocessing.rst:2594 msgid "" "Return the result when it arrives. If *timeout* is not ``None`` and the " "result does not arrive within *timeout* seconds then :exc:`multiprocessing." @@ -3756,31 +3757,31 @@ msgid "" "exception will be reraised by :meth:`get`." msgstr "" -#: ../../library/multiprocessing.rst:2600 +#: ../../library/multiprocessing.rst:2601 msgid "Wait until the result is available or until *timeout* seconds pass." msgstr "" -#: ../../library/multiprocessing.rst:2604 +#: ../../library/multiprocessing.rst:2605 msgid "Return whether the call has completed." msgstr "" -#: ../../library/multiprocessing.rst:2608 +#: ../../library/multiprocessing.rst:2609 msgid "" "Return whether the call completed without raising an exception. Will raise :" "exc:`ValueError` if the result is not ready." msgstr "" -#: ../../library/multiprocessing.rst:2611 +#: ../../library/multiprocessing.rst:2612 msgid "" "If the result is not ready, :exc:`ValueError` is raised instead of :exc:" "`AssertionError`." msgstr "" -#: ../../library/multiprocessing.rst:2615 +#: ../../library/multiprocessing.rst:2616 msgid "The following example demonstrates the use of a pool::" msgstr "" -#: ../../library/multiprocessing.rst:2617 +#: ../../library/multiprocessing.rst:2618 msgid "" "from multiprocessing import Pool\n" "import time\n" @@ -3808,17 +3809,17 @@ msgid "" "TimeoutError" msgstr "" -#: ../../library/multiprocessing.rst:2642 +#: ../../library/multiprocessing.rst:2643 msgid "Listeners and Clients" msgstr "" -#: ../../library/multiprocessing.rst:2647 +#: ../../library/multiprocessing.rst:2648 msgid "" "Usually message passing between processes is done using queues or by using :" "class:`~Connection` objects returned by :func:`~multiprocessing.Pipe`." msgstr "" -#: ../../library/multiprocessing.rst:2651 +#: ../../library/multiprocessing.rst:2652 msgid "" "However, the :mod:`!multiprocessing.connection` module allows some extra " "flexibility. It basically gives a high level message oriented API for " @@ -3827,46 +3828,46 @@ msgid "" "multiple connections at the same time." msgstr "" -#: ../../library/multiprocessing.rst:2660 +#: ../../library/multiprocessing.rst:2661 msgid "" "Send a randomly generated message to the other end of the connection and " "wait for a reply." msgstr "" -#: ../../library/multiprocessing.rst:2663 +#: ../../library/multiprocessing.rst:2664 msgid "" "If the reply matches the digest of the message using *authkey* as the key " "then a welcome message is sent to the other end of the connection. " "Otherwise :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2669 +#: ../../library/multiprocessing.rst:2670 msgid "" "Receive a message, calculate the digest of the message using *authkey* as " "the key, and then send the digest back." msgstr "" -#: ../../library/multiprocessing.rst:2672 +#: ../../library/multiprocessing.rst:2673 msgid "" "If a welcome message is not received, then :exc:`~multiprocessing." "AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2677 +#: ../../library/multiprocessing.rst:2678 msgid "" "Attempt to set up a connection to the listener which is using address " "*address*, returning a :class:`~Connection`." msgstr "" -#: ../../library/multiprocessing.rst:2680 +#: ../../library/multiprocessing.rst:2681 msgid "" "The type of the connection is determined by *family* argument, but this can " "generally be omitted since it can usually be inferred from the format of " "*address*. (See :ref:`multiprocessing-address-formats`)" msgstr "" -#: ../../library/multiprocessing.rst:2684 -#: ../../library/multiprocessing.rst:2719 +#: ../../library/multiprocessing.rst:2685 +#: ../../library/multiprocessing.rst:2720 msgid "" "If *authkey* is given and not ``None``, it should be a byte string and will " "be used as the secret key for an HMAC-based authentication challenge. No " @@ -3875,26 +3876,26 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:2692 +#: ../../library/multiprocessing.rst:2693 msgid "" "A wrapper for a bound socket or Windows named pipe which is 'listening' for " "connections." msgstr "" -#: ../../library/multiprocessing.rst:2695 +#: ../../library/multiprocessing.rst:2696 msgid "" "*address* is the address to be used by the bound socket or named pipe of the " "listener object." msgstr "" -#: ../../library/multiprocessing.rst:2700 +#: ../../library/multiprocessing.rst:2701 msgid "" "If an address of '0.0.0.0' is used, the address will not be a connectable " "end point on Windows. If you require a connectable end-point, you should use " "'127.0.0.1'." msgstr "" -#: ../../library/multiprocessing.rst:2704 +#: ../../library/multiprocessing.rst:2705 msgid "" "*family* is the type of socket (or named pipe) to use. This can be one of " "the strings ``'AF_INET'`` (for a TCP socket), ``'AF_UNIX'`` (for a Unix " @@ -3908,49 +3909,49 @@ msgid "" "using :func:`tempfile.mkstemp`." msgstr "" -#: ../../library/multiprocessing.rst:2715 +#: ../../library/multiprocessing.rst:2716 msgid "" "If the listener object uses a socket then *backlog* (1 by default) is passed " "to the :meth:`~socket.socket.listen` method of the socket once it has been " "bound." msgstr "" -#: ../../library/multiprocessing.rst:2727 +#: ../../library/multiprocessing.rst:2728 msgid "" "Accept a connection on the bound socket or named pipe of the listener object " "and return a :class:`~Connection` object. If authentication is attempted and " "fails, then :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2734 +#: ../../library/multiprocessing.rst:2735 msgid "" "Close the bound socket or named pipe of the listener object. This is called " "automatically when the listener is garbage collected. However it is " "advisable to call it explicitly." msgstr "" -#: ../../library/multiprocessing.rst:2738 +#: ../../library/multiprocessing.rst:2739 msgid "Listener objects have the following read-only properties:" msgstr "" -#: ../../library/multiprocessing.rst:2742 +#: ../../library/multiprocessing.rst:2743 msgid "The address which is being used by the Listener object." msgstr "" -#: ../../library/multiprocessing.rst:2746 +#: ../../library/multiprocessing.rst:2747 msgid "" "The address from which the last accepted connection came. If this is " "unavailable then it is ``None``." msgstr "" -#: ../../library/multiprocessing.rst:2749 +#: ../../library/multiprocessing.rst:2750 msgid "" "Listener objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "listener object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:2756 +#: ../../library/multiprocessing.rst:2757 msgid "" "Wait till an object in *object_list* is ready. Returns the list of those " "objects in *object_list* which are ready. If *timeout* is a float then the " @@ -3959,32 +3960,32 @@ msgid "" "zero timeout." msgstr "" -#: ../../library/multiprocessing.rst:2762 +#: ../../library/multiprocessing.rst:2763 msgid "" "For both POSIX and Windows, an object can appear in *object_list* if it is" msgstr "" -#: ../../library/multiprocessing.rst:2765 +#: ../../library/multiprocessing.rst:2766 msgid "a readable :class:`~multiprocessing.connection.Connection` object;" msgstr "" -#: ../../library/multiprocessing.rst:2766 +#: ../../library/multiprocessing.rst:2767 msgid "a connected and readable :class:`socket.socket` object; or" msgstr "" -#: ../../library/multiprocessing.rst:2767 +#: ../../library/multiprocessing.rst:2768 msgid "" "the :attr:`~multiprocessing.Process.sentinel` attribute of a :class:" "`~multiprocessing.Process` object." msgstr "" -#: ../../library/multiprocessing.rst:2770 +#: ../../library/multiprocessing.rst:2771 msgid "" "A connection or socket object is ready when there is data available to be " "read from it, or the other end has been closed." msgstr "" -#: ../../library/multiprocessing.rst:2773 +#: ../../library/multiprocessing.rst:2774 msgid "" "**POSIX**: ``wait(object_list, timeout)`` almost equivalent ``select." "select(object_list, [], [], timeout)``. The difference is that, if :func:" @@ -3992,7 +3993,7 @@ msgid "" "an error number of ``EINTR``, whereas :func:`wait` will not." msgstr "" -#: ../../library/multiprocessing.rst:2779 +#: ../../library/multiprocessing.rst:2780 msgid "" "**Windows**: An item in *object_list* must either be an integer handle which " "is waitable (according to the definition used by the documentation of the " @@ -4002,18 +4003,18 @@ msgid "" "handles.)" msgstr "" -#: ../../library/multiprocessing.rst:2789 +#: ../../library/multiprocessing.rst:2790 msgid "**Examples**" msgstr "" -#: ../../library/multiprocessing.rst:2791 +#: ../../library/multiprocessing.rst:2792 msgid "" "The following server code creates a listener which uses ``'secret " "password'`` as an authentication key. It then waits for a connection and " "sends some data to the client::" msgstr "" -#: ../../library/multiprocessing.rst:2795 +#: ../../library/multiprocessing.rst:2796 msgid "" "from multiprocessing.connection import Listener\n" "from array import array\n" @@ -4031,13 +4032,13 @@ msgid "" " conn.send_bytes(array('i', [42, 1729]))" msgstr "" -#: ../../library/multiprocessing.rst:2810 +#: ../../library/multiprocessing.rst:2811 msgid "" "The following code connects to the server and receives some data from the " "server::" msgstr "" -#: ../../library/multiprocessing.rst:2813 +#: ../../library/multiprocessing.rst:2814 msgid "" "from multiprocessing.connection import Client\n" "from array import array\n" @@ -4067,13 +4068,13 @@ msgstr "" " print(conn.recv_bytes_into(arr)) # => 8\n" " print(arr) # => array('i', [42, 1729, 0, 0, 0])" -#: ../../library/multiprocessing.rst:2827 +#: ../../library/multiprocessing.rst:2828 msgid "" "The following code uses :func:`~multiprocessing.connection.wait` to wait for " "messages from multiple processes at once::" msgstr "" -#: ../../library/multiprocessing.rst:2830 +#: ../../library/multiprocessing.rst:2831 msgid "" "from multiprocessing import Process, Pipe, current_process\n" "from multiprocessing.connection import wait\n" @@ -4107,23 +4108,23 @@ msgid "" " print(msg)" msgstr "" -#: ../../library/multiprocessing.rst:2865 +#: ../../library/multiprocessing.rst:2866 msgid "Address Formats" msgstr "" -#: ../../library/multiprocessing.rst:2867 +#: ../../library/multiprocessing.rst:2868 msgid "" "An ``'AF_INET'`` address is a tuple of the form ``(hostname, port)`` where " "*hostname* is a string and *port* is an integer." msgstr "" -#: ../../library/multiprocessing.rst:2870 +#: ../../library/multiprocessing.rst:2871 msgid "" "An ``'AF_UNIX'`` address is a string representing a filename on the " "filesystem." msgstr "" -#: ../../library/multiprocessing.rst:2873 +#: ../../library/multiprocessing.rst:2874 msgid "" "An ``'AF_PIPE'`` address is a string of the form :samp:`r'\\\\\\\\\\\\.\\" "\\pipe\\\\\\\\{PipeName}'`. To use :func:`Client` to connect to a named " @@ -4132,17 +4133,17 @@ msgid "" "instead." msgstr "" -#: ../../library/multiprocessing.rst:2878 +#: ../../library/multiprocessing.rst:2879 msgid "" "Note that any string beginning with two backslashes is assumed by default to " "be an ``'AF_PIPE'`` address rather than an ``'AF_UNIX'`` address." msgstr "" -#: ../../library/multiprocessing.rst:2885 +#: ../../library/multiprocessing.rst:2886 msgid "Authentication keys" msgstr "" -#: ../../library/multiprocessing.rst:2887 +#: ../../library/multiprocessing.rst:2888 msgid "" "When one uses :meth:`Connection.recv `, the data received " "is automatically unpickled. Unfortunately unpickling data from an untrusted " @@ -4150,7 +4151,7 @@ msgid "" "use the :mod:`hmac` module to provide digest authentication." msgstr "" -#: ../../library/multiprocessing.rst:2893 +#: ../../library/multiprocessing.rst:2894 msgid "" "An authentication key is a byte string which can be thought of as a " "password: once a connection is established both ends will demand proof that " @@ -4158,7 +4159,7 @@ msgid "" "using the same key does **not** involve sending the key over the connection.)" msgstr "" -#: ../../library/multiprocessing.rst:2899 +#: ../../library/multiprocessing.rst:2900 msgid "" "If authentication is requested but no authentication key is specified then " "the return value of ``current_process().authkey`` is used (see :class:" @@ -4169,17 +4170,17 @@ msgid "" "setting up connections between themselves." msgstr "" -#: ../../library/multiprocessing.rst:2907 +#: ../../library/multiprocessing.rst:2908 msgid "" "Suitable authentication keys can also be generated by using :func:`os." "urandom`." msgstr "" -#: ../../library/multiprocessing.rst:2911 +#: ../../library/multiprocessing.rst:2912 msgid "Logging" msgstr "" -#: ../../library/multiprocessing.rst:2913 +#: ../../library/multiprocessing.rst:2914 msgid "" "Some support for logging is available. Note, however, that the :mod:" "`logging` package does not use process shared locks so it is possible " @@ -4187,27 +4188,27 @@ msgid "" "mixed up." msgstr "" -#: ../../library/multiprocessing.rst:2920 +#: ../../library/multiprocessing.rst:2921 msgid "" "Returns the logger used by :mod:`!multiprocessing`. If necessary, a new one " "will be created." msgstr "" -#: ../../library/multiprocessing.rst:2923 +#: ../../library/multiprocessing.rst:2924 msgid "" "When first created the logger has level :const:`logging.NOTSET` and no " "default handler. Messages sent to this logger will not by default propagate " "to the root logger." msgstr "" -#: ../../library/multiprocessing.rst:2927 +#: ../../library/multiprocessing.rst:2928 msgid "" "Note that on Windows child processes will only inherit the level of the " "parent process's logger -- any other customization of the logger will not be " "inherited." msgstr "" -#: ../../library/multiprocessing.rst:2934 +#: ../../library/multiprocessing.rst:2935 msgid "" "This function performs a call to :func:`get_logger` but in addition to " "returning the logger created by get_logger, it adds a handler which sends " @@ -4216,11 +4217,11 @@ msgid "" "``level`` argument." msgstr "" -#: ../../library/multiprocessing.rst:2940 +#: ../../library/multiprocessing.rst:2941 msgid "Below is an example session with logging turned on::" msgstr "" -#: ../../library/multiprocessing.rst:2942 +#: ../../library/multiprocessing.rst:2943 msgid "" ">>> import multiprocessing, logging\n" ">>> logger = multiprocessing.log_to_stderr()\n" @@ -4248,21 +4249,21 @@ msgstr "" "[INFO/MainProcess] sending shutdown message to manager\n" "[INFO/SyncManager-...] manager exiting with exitcode 0" -#: ../../library/multiprocessing.rst:2955 +#: ../../library/multiprocessing.rst:2956 msgid "For a full table of logging levels, see the :mod:`logging` module." msgstr "" -#: ../../library/multiprocessing.rst:2959 +#: ../../library/multiprocessing.rst:2960 msgid "The :mod:`!multiprocessing.dummy` module" msgstr ":mod:`!multiprocessing.dummy` 模組" -#: ../../library/multiprocessing.rst:2964 +#: ../../library/multiprocessing.rst:2965 msgid "" ":mod:`!multiprocessing.dummy` replicates the API of :mod:`!multiprocessing` " "but is no more than a wrapper around the :mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:2969 +#: ../../library/multiprocessing.rst:2970 msgid "" "In particular, the ``Pool`` function provided by :mod:`!multiprocessing." "dummy` returns an instance of :class:`ThreadPool`, which is a subclass of :" @@ -4270,7 +4271,7 @@ msgid "" "worker threads rather than worker processes." msgstr "" -#: ../../library/multiprocessing.rst:2977 +#: ../../library/multiprocessing.rst:2978 msgid "" "A thread pool object which controls a pool of worker threads to which jobs " "can be submitted. :class:`ThreadPool` instances are fully interface " @@ -4280,18 +4281,18 @@ msgid "" "pool.Pool.terminate` manually." msgstr "" -#: ../../library/multiprocessing.rst:2984 +#: ../../library/multiprocessing.rst:2985 msgid "" "*processes* is the number of worker threads to use. If *processes* is " "``None`` then the number returned by :func:`os.process_cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2990 +#: ../../library/multiprocessing.rst:2991 msgid "" "Unlike :class:`Pool`, *maxtasksperchild* and *context* cannot be provided." msgstr "" -#: ../../library/multiprocessing.rst:2994 +#: ../../library/multiprocessing.rst:2995 msgid "" "A :class:`ThreadPool` shares the same interface as :class:`Pool`, which is " "designed around a pool of processes and predates the introduction of the :" @@ -4301,7 +4302,7 @@ msgid "" "is not understood by any other libraries." msgstr "" -#: ../../library/multiprocessing.rst:3001 +#: ../../library/multiprocessing.rst:3002 msgid "" "Users should generally prefer to use :class:`concurrent.futures." "ThreadPoolExecutor`, which has a simpler interface that was designed around " @@ -4310,69 +4311,69 @@ msgid "" "`asyncio`." msgstr "" -#: ../../library/multiprocessing.rst:3011 +#: ../../library/multiprocessing.rst:3012 msgid "Programming guidelines" msgstr "" -#: ../../library/multiprocessing.rst:3013 +#: ../../library/multiprocessing.rst:3014 msgid "" "There are certain guidelines and idioms which should be adhered to when " "using :mod:`!multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:3018 +#: ../../library/multiprocessing.rst:3019 msgid "All start methods" msgstr "" -#: ../../library/multiprocessing.rst:3020 +#: ../../library/multiprocessing.rst:3021 msgid "The following applies to all start methods." msgstr "" -#: ../../library/multiprocessing.rst:3022 +#: ../../library/multiprocessing.rst:3023 msgid "Avoid shared state" msgstr "" -#: ../../library/multiprocessing.rst:3024 +#: ../../library/multiprocessing.rst:3025 msgid "" "As far as possible one should try to avoid shifting large amounts of data " "between processes." msgstr "" -#: ../../library/multiprocessing.rst:3027 +#: ../../library/multiprocessing.rst:3028 msgid "" "It is probably best to stick to using queues or pipes for communication " "between processes rather than using the lower level synchronization " "primitives." msgstr "" -#: ../../library/multiprocessing.rst:3031 +#: ../../library/multiprocessing.rst:3032 msgid "Picklability" msgstr "" -#: ../../library/multiprocessing.rst:3033 +#: ../../library/multiprocessing.rst:3034 msgid "Ensure that the arguments to the methods of proxies are picklable." msgstr "" -#: ../../library/multiprocessing.rst:3035 +#: ../../library/multiprocessing.rst:3036 msgid "Thread safety of proxies" msgstr "" -#: ../../library/multiprocessing.rst:3037 +#: ../../library/multiprocessing.rst:3038 msgid "" "Do not use a proxy object from more than one thread unless you protect it " "with a lock." msgstr "" -#: ../../library/multiprocessing.rst:3040 +#: ../../library/multiprocessing.rst:3041 msgid "" "(There is never a problem with different processes using the *same* proxy.)" msgstr "" -#: ../../library/multiprocessing.rst:3042 +#: ../../library/multiprocessing.rst:3043 msgid "Joining zombie processes" msgstr "" -#: ../../library/multiprocessing.rst:3044 +#: ../../library/multiprocessing.rst:3045 msgid "" "On POSIX when a process finishes but has not been joined it becomes a " "zombie. There should never be very many because each time a new process " @@ -4383,11 +4384,11 @@ msgid "" "explicitly join all the processes that you start." msgstr "" -#: ../../library/multiprocessing.rst:3052 +#: ../../library/multiprocessing.rst:3053 msgid "Better to inherit than pickle/unpickle" msgstr "" -#: ../../library/multiprocessing.rst:3054 +#: ../../library/multiprocessing.rst:3055 msgid "" "When using the *spawn* or *forkserver* start methods many types from :mod:`!" "multiprocessing` need to be picklable so that child processes can use them. " @@ -4397,11 +4398,11 @@ msgid "" "inherit it from an ancestor process." msgstr "" -#: ../../library/multiprocessing.rst:3062 +#: ../../library/multiprocessing.rst:3063 msgid "Avoid terminating processes" msgstr "" -#: ../../library/multiprocessing.rst:3064 +#: ../../library/multiprocessing.rst:3065 msgid "" "Using the :meth:`Process.terminate ` " "method to stop a process is liable to cause any shared resources (such as " @@ -4409,18 +4410,18 @@ msgid "" "become broken or unavailable to other processes." msgstr "" -#: ../../library/multiprocessing.rst:3070 +#: ../../library/multiprocessing.rst:3071 msgid "" "Therefore it is probably best to only consider using :meth:`Process." "terminate ` on processes which never use " "any shared resources." msgstr "" -#: ../../library/multiprocessing.rst:3074 +#: ../../library/multiprocessing.rst:3075 msgid "Joining processes that use queues" msgstr "" -#: ../../library/multiprocessing.rst:3076 +#: ../../library/multiprocessing.rst:3077 msgid "" "Bear in mind that a process that has put items in a queue will wait before " "terminating until all the buffered items are fed by the \"feeder\" thread to " @@ -4429,7 +4430,7 @@ msgid "" "queue to avoid this behaviour.)" msgstr "" -#: ../../library/multiprocessing.rst:3082 +#: ../../library/multiprocessing.rst:3083 msgid "" "This means that whenever you use a queue you need to make sure that all " "items which have been put on the queue will eventually be removed before the " @@ -4438,11 +4439,11 @@ msgid "" "processes will be joined automatically." msgstr "" -#: ../../library/multiprocessing.rst:3088 +#: ../../library/multiprocessing.rst:3089 msgid "An example which will deadlock is the following::" msgstr "" -#: ../../library/multiprocessing.rst:3090 +#: ../../library/multiprocessing.rst:3091 msgid "" "from multiprocessing import Process, Queue\n" "\n" @@ -4457,17 +4458,17 @@ msgid "" " obj = queue.get()" msgstr "" -#: ../../library/multiprocessing.rst:3102 +#: ../../library/multiprocessing.rst:3103 msgid "" "A fix here would be to swap the last two lines (or simply remove the ``p." "join()`` line)." msgstr "" -#: ../../library/multiprocessing.rst:3105 +#: ../../library/multiprocessing.rst:3106 msgid "Explicitly pass resources to child processes" msgstr "" -#: ../../library/multiprocessing.rst:3107 +#: ../../library/multiprocessing.rst:3108 msgid "" "On POSIX using the *fork* start method, a child process can make use of a " "shared resource created in a parent process using a global resource. " @@ -4475,7 +4476,7 @@ msgid "" "for the child process." msgstr "" -#: ../../library/multiprocessing.rst:3112 +#: ../../library/multiprocessing.rst:3113 msgid "" "Apart from making the code (potentially) compatible with Windows and the " "other start methods this also ensures that as long as the child process is " @@ -4484,11 +4485,11 @@ msgid "" "collected in the parent process." msgstr "" -#: ../../library/multiprocessing.rst:3119 +#: ../../library/multiprocessing.rst:3120 msgid "So for instance ::" msgstr "" -#: ../../library/multiprocessing.rst:3121 +#: ../../library/multiprocessing.rst:3122 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -4510,11 +4511,11 @@ msgstr "" " for i in range(10):\n" " Process(target=f).start()" -#: ../../library/multiprocessing.rst:3131 +#: ../../library/multiprocessing.rst:3132 msgid "should be rewritten as ::" msgstr "" -#: ../../library/multiprocessing.rst:3133 +#: ../../library/multiprocessing.rst:3134 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -4536,25 +4537,25 @@ msgstr "" " for i in range(10):\n" " Process(target=f, args=(lock,)).start()" -#: ../../library/multiprocessing.rst:3143 +#: ../../library/multiprocessing.rst:3144 msgid "Beware of replacing :data:`sys.stdin` with a \"file like object\"" msgstr "" -#: ../../library/multiprocessing.rst:3145 +#: ../../library/multiprocessing.rst:3146 msgid ":mod:`!multiprocessing` originally unconditionally called::" msgstr "" -#: ../../library/multiprocessing.rst:3147 +#: ../../library/multiprocessing.rst:3148 msgid "os.close(sys.stdin.fileno())" msgstr "os.close(sys.stdin.fileno())" -#: ../../library/multiprocessing.rst:3149 +#: ../../library/multiprocessing.rst:3150 msgid "" "in the :meth:`multiprocessing.Process._bootstrap` method --- this resulted " "in issues with processes-in-processes. This has been changed to::" msgstr "" -#: ../../library/multiprocessing.rst:3152 +#: ../../library/multiprocessing.rst:3153 msgid "" "sys.stdin.close()\n" "sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)" @@ -4562,7 +4563,7 @@ msgstr "" "sys.stdin.close()\n" "sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)" -#: ../../library/multiprocessing.rst:3155 +#: ../../library/multiprocessing.rst:3156 msgid "" "Which solves the fundamental issue of processes colliding with each other " "resulting in a bad file descriptor error, but introduces a potential danger " @@ -4572,14 +4573,14 @@ msgid "" "data being flushed to the object multiple times, resulting in corruption." msgstr "" -#: ../../library/multiprocessing.rst:3162 +#: ../../library/multiprocessing.rst:3163 msgid "" "If you write a file-like object and implement your own caching, you can make " "it fork-safe by storing the pid whenever you append to the cache, and " "discarding the cache when the pid changes. For example::" msgstr "" -#: ../../library/multiprocessing.rst:3166 +#: ../../library/multiprocessing.rst:3167 msgid "" "@property\n" "def cache(self):\n" @@ -4597,26 +4598,26 @@ msgstr "" " self._cache = []\n" " return self._cache" -#: ../../library/multiprocessing.rst:3174 +#: ../../library/multiprocessing.rst:3175 msgid "" "For more information, see :issue:`5155`, :issue:`5313` and :issue:`5331`" msgstr "" -#: ../../library/multiprocessing.rst:3180 +#: ../../library/multiprocessing.rst:3181 msgid "The *spawn* and *forkserver* start methods" msgstr "" -#: ../../library/multiprocessing.rst:3182 +#: ../../library/multiprocessing.rst:3183 msgid "" "There are a few extra restrictions which don't apply to the *fork* start " "method." msgstr "" -#: ../../library/multiprocessing.rst:3185 +#: ../../library/multiprocessing.rst:3186 msgid "More picklability" msgstr "" -#: ../../library/multiprocessing.rst:3187 +#: ../../library/multiprocessing.rst:3188 msgid "" "Ensure that all arguments to :class:`~multiprocessing.Process` are " "picklable. Also, if you subclass ``Process.__init__``, you must make sure " @@ -4624,11 +4625,11 @@ msgid "" "` method is called." msgstr "" -#: ../../library/multiprocessing.rst:3192 +#: ../../library/multiprocessing.rst:3193 msgid "Global variables" msgstr "" -#: ../../library/multiprocessing.rst:3194 +#: ../../library/multiprocessing.rst:3195 msgid "" "Bear in mind that if code run in a child process tries to access a global " "variable, then the value it sees (if any) may not be the same as the value " @@ -4636,30 +4637,30 @@ msgid "" "Process.start>` was called." msgstr "" -#: ../../library/multiprocessing.rst:3199 +#: ../../library/multiprocessing.rst:3200 msgid "" "However, global variables which are just module level constants cause no " "problems." msgstr "" -#: ../../library/multiprocessing.rst:3204 +#: ../../library/multiprocessing.rst:3205 msgid "Safe importing of main module" msgstr "" -#: ../../library/multiprocessing.rst:3206 +#: ../../library/multiprocessing.rst:3207 msgid "" "Make sure that the main module can be safely imported by a new Python " "interpreter without causing unintended side effects (such as starting a new " "process)." msgstr "" -#: ../../library/multiprocessing.rst:3210 +#: ../../library/multiprocessing.rst:3211 msgid "" "For example, using the *spawn* or *forkserver* start method running the " "following module would fail with a :exc:`RuntimeError`::" msgstr "" -#: ../../library/multiprocessing.rst:3214 +#: ../../library/multiprocessing.rst:3215 msgid "" "from multiprocessing import Process\n" "\n" @@ -4677,13 +4678,13 @@ msgstr "" "p = Process(target=foo)\n" "p.start()" -#: ../../library/multiprocessing.rst:3222 +#: ../../library/multiprocessing.rst:3223 msgid "" "Instead one should protect the \"entry point\" of the program by using ``if " "__name__ == '__main__':`` as follows::" msgstr "" -#: ../../library/multiprocessing.rst:3225 +#: ../../library/multiprocessing.rst:3226 msgid "" "from multiprocessing import Process, freeze_support, set_start_method\n" "\n" @@ -4707,33 +4708,33 @@ msgstr "" " p = Process(target=foo)\n" " p.start()" -#: ../../library/multiprocessing.rst:3236 +#: ../../library/multiprocessing.rst:3237 msgid "" "(The ``freeze_support()`` line can be omitted if the program will be run " "normally instead of frozen.)" msgstr "" -#: ../../library/multiprocessing.rst:3239 +#: ../../library/multiprocessing.rst:3240 msgid "" "This allows the newly spawned Python interpreter to safely import the module " "and then run the module's ``foo()`` function." msgstr "" -#: ../../library/multiprocessing.rst:3242 +#: ../../library/multiprocessing.rst:3243 msgid "" "Similar restrictions apply if a pool or manager is created in the main " "module." msgstr "" -#: ../../library/multiprocessing.rst:3249 +#: ../../library/multiprocessing.rst:3250 msgid "Examples" msgstr "範例" -#: ../../library/multiprocessing.rst:3251 +#: ../../library/multiprocessing.rst:3252 msgid "Demonstration of how to create and use customized managers and proxies:" msgstr "" -#: ../../library/multiprocessing.rst:3253 +#: ../../library/multiprocessing.rst:3254 msgid "" "from multiprocessing import freeze_support\n" "from multiprocessing.managers import BaseManager, BaseProxy\n" @@ -4827,11 +4828,11 @@ msgid "" " test()\n" msgstr "" -#: ../../library/multiprocessing.rst:3257 +#: ../../library/multiprocessing.rst:3258 msgid "Using :class:`~multiprocessing.pool.Pool`:" msgstr "使用 :class:`~multiprocessing.pool.Pool`:" -#: ../../library/multiprocessing.rst:3259 +#: ../../library/multiprocessing.rst:3260 msgid "" "import multiprocessing\n" "import time\n" @@ -4991,13 +4992,13 @@ msgid "" " test()\n" msgstr "" -#: ../../library/multiprocessing.rst:3263 +#: ../../library/multiprocessing.rst:3264 msgid "" "An example showing how to use queues to feed tasks to a collection of worker " "processes and collect the results:" msgstr "" -#: ../../library/multiprocessing.rst:3266 +#: ../../library/multiprocessing.rst:3267 msgid "" "import time\n" "import random\n" From 7cbb33095375faf679447930c45c0d449935d993 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 14 Apr 2026 00:29:58 +0000 Subject: [PATCH 4/6] sync with cpython d42874a1 --- library/argparse.po | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/argparse.po b/library/argparse.po index c1f72122397..ac338210e82 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-04-04 00:21+0000\n" +"POT-Creation-Date: 2026-04-14 00:28+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -3808,7 +3808,8 @@ msgstr "" "用 :keyword:`with` 陳述式來管理檔案。" #: ../../library/argparse.rst:1936 -msgid "Added the *encodings* and *errors* parameters." +#, fuzzy +msgid "Added the *encoding* and *errors* parameters." msgstr "新增了 *encodings* 和 *errors* 參數。" #: ../../library/argparse.rst:1943 From 1d0152e7c606a66a0e00eabf3b16631fb19491c3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 15 Apr 2026 00:30:32 +0000 Subject: [PATCH 5/6] sync with cpython bfbabb55 --- library/argparse.po | 116 +++++++++++++++++++++++--------------------- library/enum.po | 9 ++-- library/unittest.po | 16 +++--- 3 files changed, 73 insertions(+), 68 deletions(-) diff --git a/library/argparse.po b/library/argparse.po index ac338210e82..48ca120efa4 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-04-14 00:28+0000\n" +"POT-Creation-Date: 2026-04-15 00:29+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -3928,6 +3928,12 @@ msgstr "" #: ../../library/argparse.rst:1999 msgid "" +"Within each argument group, arguments are displayed in help output in the " +"order in which they are added." +msgstr "" + +#: ../../library/argparse.rst:2002 +msgid "" "Calling :meth:`add_argument_group` on an argument group now raises an " "exception. This nesting was never supported, often failed to work correctly, " "and was unintentionally exposed through inheritance." @@ -3935,15 +3941,15 @@ msgstr "" "在引數群組上呼叫 :meth:`add_argument_group` 現在會引發例外。這種巢狀用法從未" "被支援,通常無法正確運作,是因為繼承而無意間被公開出來的。" -#: ../../library/argparse.rst:2004 +#: ../../library/argparse.rst:2007 msgid "Passing prefix_chars_ to :meth:`add_argument_group` is now deprecated." msgstr "將 prefix_chars_ 傳給 :meth:`add_argument_group` 的用法現在已棄用。" -#: ../../library/argparse.rst:2010 +#: ../../library/argparse.rst:2013 msgid "Mutual exclusion" msgstr "互斥" -#: ../../library/argparse.rst:2014 +#: ../../library/argparse.rst:2017 msgid "" "Create a mutually exclusive group. :mod:`!argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " @@ -3952,7 +3958,7 @@ msgstr "" "建立一個互斥群組。:mod:`!argparse` 會確保互斥群組中只有一個引數出現在命令列" "上: ::" -#: ../../library/argparse.rst:2018 +#: ../../library/argparse.rst:2021 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3978,7 +3984,7 @@ msgstr "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" -#: ../../library/argparse.rst:2030 +#: ../../library/argparse.rst:2033 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " @@ -3987,7 +3993,7 @@ msgstr "" ":meth:`add_mutually_exclusive_group` 方法也接受一個 *required* 引數,用來指示" "至少需要一個互斥引數: ::" -#: ../../library/argparse.rst:2034 +#: ../../library/argparse.rst:2037 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -4005,7 +4011,7 @@ msgstr "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:2042 +#: ../../library/argparse.rst:2045 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." @@ -4016,7 +4022,7 @@ msgstr "" "*title* 和 *description* 引數。然而互斥群組可以加入到具有標題和描述的引數群組" "中。例如: ::" -#: ../../library/argparse.rst:2048 +#: ../../library/argparse.rst:2051 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -4052,7 +4058,7 @@ msgstr "" " --foo FOO foo help\n" " --bar BAR bar help" -#: ../../library/argparse.rst:2065 +#: ../../library/argparse.rst:2068 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group now raises an exception. This nesting was " @@ -4063,11 +4069,11 @@ msgstr "" "`add_mutually_exclusive_group` 現在會引發例外。這種巢狀用法從未支援,通常無法" "正確運作,且是因為繼承而無意間被公開出來的。" -#: ../../library/argparse.rst:2073 +#: ../../library/argparse.rst:2076 msgid "Parser defaults" msgstr "剖析器預設值" -#: ../../library/argparse.rst:2077 +#: ../../library/argparse.rst:2080 msgid "" "Most of the time, the attributes of the object returned by :meth:" "`parse_args` will be fully determined by inspecting the command-line " @@ -4079,7 +4085,7 @@ msgstr "" "數 action 來決定。:meth:`set_defaults` 允許加入一些無需檢查命令列即可決定的額" "外屬性: ::" -#: ../../library/argparse.rst:2083 +#: ../../library/argparse.rst:2086 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -4093,7 +4099,7 @@ msgstr "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" -#: ../../library/argparse.rst:2089 +#: ../../library/argparse.rst:2092 msgid "" "Note that defaults can be set at both the parser level using :meth:" "`set_defaults` and at the argument level using :meth:`add_argument`. If both " @@ -4104,7 +4110,7 @@ msgstr "" "級使用 :meth:`add_argument` 設定。如果兩者都為同一個引數呼叫,會使用最後設定" "的預設值: ::" -#: ../../library/argparse.rst:2093 +#: ../../library/argparse.rst:2096 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -4118,7 +4124,7 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" -#: ../../library/argparse.rst:2099 +#: ../../library/argparse.rst:2102 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " @@ -4127,7 +4133,7 @@ msgstr "" "在使用多個剖析器時,剖析器層級的預設值可能特別有用。請參閱 :meth:" "`~ArgumentParser.add_subparsers` 方法以了解這類範例。" -#: ../../library/argparse.rst:2105 +#: ../../library/argparse.rst:2108 msgid "" "Get the default value for a namespace attribute, as set by either :meth:" "`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" @@ -4135,7 +4141,7 @@ msgstr "" "取得命名空間屬性的預設值,由 :meth:`~ArgumentParser.add_argument` 或 :meth:" "`~ArgumentParser.set_defaults` 設定: ::" -#: ../../library/argparse.rst:2109 +#: ../../library/argparse.rst:2112 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -4147,11 +4153,11 @@ msgstr "" ">>> parser.get_default('foo')\n" "'badger'" -#: ../../library/argparse.rst:2116 +#: ../../library/argparse.rst:2119 msgid "Printing help" msgstr "印出幫助訊息" -#: ../../library/argparse.rst:2118 +#: ../../library/argparse.rst:2121 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " @@ -4160,7 +4166,7 @@ msgstr "" "在大多數典型的應用程式中,:meth:`~ArgumentParser.parse_args` 會處理格式化和印" "出任何用法或錯誤訊息。然而,有幾個格式化方法可以使用:" -#: ../../library/argparse.rst:2124 +#: ../../library/argparse.rst:2127 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " @@ -4169,7 +4175,7 @@ msgstr "" "印出 :class:`ArgumentParser` 在命令列上呼叫方式的簡短描述。如果 *file* 為 " "``None``,則假設為 :data:`sys.stdout`。" -#: ../../library/argparse.rst:2130 +#: ../../library/argparse.rst:2133 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " @@ -4178,20 +4184,20 @@ msgstr "" "印出說明訊息,包括程式用法和在 :class:`ArgumentParser` 中註冊的引數相關資訊。" "如果 *file* 為 ``None``,假設為 :data:`sys.stdout`。" -#: ../../library/argparse.rst:2134 +#: ../../library/argparse.rst:2137 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "這些方法也有變體,它們只回傳字串而非印出它:" -#: ../../library/argparse.rst:2139 +#: ../../library/argparse.rst:2142 msgid "" "Return a string containing a brief description of how the :class:" "`ArgumentParser` should be invoked on the command line." msgstr "" "回傳一個字串,包含 :class:`ArgumentParser` 在命令列上的呼叫方式的簡短描述。" -#: ../../library/argparse.rst:2144 +#: ../../library/argparse.rst:2147 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." @@ -4199,11 +4205,11 @@ msgstr "" "回傳一個字串,包含說明訊息,包括程式用法和在 :class:`ArgumentParser` 中註冊的" "引數相關資訊。" -#: ../../library/argparse.rst:2149 +#: ../../library/argparse.rst:2152 msgid "Partial parsing" msgstr "部分剖析" -#: ../../library/argparse.rst:2153 +#: ../../library/argparse.rst:2156 msgid "" "Sometimes a script only needs to handle a specific set of command-line " "arguments, leaving any unrecognized arguments for another script or program. " @@ -4214,7 +4220,7 @@ msgstr "" "本或程式。在這些情況下,:meth:`~ArgumentParser.parse_known_args` 方法可能很有" "用。" -#: ../../library/argparse.rst:2158 +#: ../../library/argparse.rst:2161 msgid "" "This method works similarly to :meth:`~ArgumentParser.parse_args`, but it " "does not raise an error for extra, unrecognized arguments. Instead, it " @@ -4225,7 +4231,7 @@ msgstr "" "辨識的引數引發錯誤,而是會只剖析已知的引數並回傳一個包含填充後的命名空間和任" "何未辨識引數串列的二元素元組。" -#: ../../library/argparse.rst:2165 +#: ../../library/argparse.rst:2168 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -4239,7 +4245,7 @@ msgstr "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" -#: ../../library/argparse.rst:2172 +#: ../../library/argparse.rst:2175 msgid "" ":ref:`Prefix matching ` rules apply to :meth:" "`~ArgumentParser.parse_known_args`. The parser may consume an option even if " @@ -4250,11 +4256,11 @@ msgstr "" "parse_known_args`。即使選項只是其已知選項之一的前綴,剖析器也可能消耗它,而非" "將其留在剩餘引數串列中。" -#: ../../library/argparse.rst:2179 +#: ../../library/argparse.rst:2182 msgid "Customizing file parsing" msgstr "自訂檔案剖析" -#: ../../library/argparse.rst:2183 +#: ../../library/argparse.rst:2186 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -4265,7 +4271,7 @@ msgstr "" "*fromfile_prefix_chars* 關鍵字引數)每行讀取一個引數。可以覆寫 :meth:" "`convert_arg_line_to_args` 以進行更精細的讀取。" -#: ../../library/argparse.rst:2188 +#: ../../library/argparse.rst:2191 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " @@ -4274,7 +4280,7 @@ msgstr "" "此方法接受單個引數 *arg_line*,它是從引數檔案讀取的字串。它回傳從此字串剖析出" "的引數串列。此方法對從引數檔案讀取的每一行依序呼叫一次。" -#: ../../library/argparse.rst:2192 +#: ../../library/argparse.rst:2195 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" @@ -4282,7 +4288,7 @@ msgstr "" "此方法的一個有用覆寫是將每個以空格分隔的詞作為引數。以下範例示範了如何做到這" "一點: ::" -#: ../../library/argparse.rst:2195 +#: ../../library/argparse.rst:2198 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" @@ -4292,11 +4298,11 @@ msgstr "" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" -#: ../../library/argparse.rst:2201 +#: ../../library/argparse.rst:2204 msgid "Exiting methods" msgstr "退出方法" -#: ../../library/argparse.rst:2205 +#: ../../library/argparse.rst:2208 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* to :data:`sys.stderr` before that. The user " @@ -4306,7 +4312,7 @@ msgstr "" "`sys.stderr` 印出一個 *message*。使用者可以覆寫此方法來以不同方式處理這些步" "驟: ::" -#: ../../library/argparse.rst:2209 +#: ../../library/argparse.rst:2212 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -4320,7 +4326,7 @@ msgstr "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" -#: ../../library/argparse.rst:2217 +#: ../../library/argparse.rst:2220 msgid "" "This method prints a usage message, including the *message*, to :data:`sys." "stderr` and terminates the program with a status code of 2." @@ -4328,11 +4334,11 @@ msgstr "" "此方法將用法訊息(包含 *message*)印出到 :data:`sys.stderr`,並以狀態碼 2 終" "止程式。" -#: ../../library/argparse.rst:2222 +#: ../../library/argparse.rst:2225 msgid "Intermixed parsing" msgstr "交錯剖析" -#: ../../library/argparse.rst:2227 +#: ../../library/argparse.rst:2230 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -4343,7 +4349,7 @@ msgstr "" "parse_intermixed_args` 和 :meth:`~ArgumentParser." "parse_known_intermixed_args` 方法支援此剖析風格。" -#: ../../library/argparse.rst:2232 +#: ../../library/argparse.rst:2235 msgid "" "These parsers do not support all the :mod:`!argparse` features, and will " "raise exceptions if unsupported features are used. In particular, " @@ -4353,7 +4359,7 @@ msgstr "" "這些剖析器不支援所有 :mod:`!argparse` 功能,如果使用了不支援的功能會引發例" "外。特別是不支援子剖析器,以及同時包含可選引數和位置引數的互斥群組。" -#: ../../library/argparse.rst:2237 +#: ../../library/argparse.rst:2240 msgid "" "The following example shows the difference between :meth:`~ArgumentParser." "parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " @@ -4364,7 +4370,7 @@ msgstr "" "`~ArgumentParser.parse_intermixed_args` 之間的差異:前者回傳 ``['2', '3']`` " "作為未剖析的引數,而後者將所有位置引數收集到 ``rest`` 中。 ::" -#: ../../library/argparse.rst:2243 +#: ../../library/argparse.rst:2246 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -4384,7 +4390,7 @@ msgstr "" ">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" -#: ../../library/argparse.rst:2252 +#: ../../library/argparse.rst:2255 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -4395,11 +4401,11 @@ msgstr "" "填充後的命名空間和剩餘引數字串的串列。:meth:`~ArgumentParser." "parse_intermixed_args` 在有任何剩餘未剖析的引數字串時會引發錯誤。" -#: ../../library/argparse.rst:2261 +#: ../../library/argparse.rst:2264 msgid "Registering custom types or actions" msgstr "註冊自訂型別或 action" -#: ../../library/argparse.rst:2265 +#: ../../library/argparse.rst:2268 msgid "" "Sometimes it's desirable to use a custom string in error messages to provide " "more user-friendly output. In these cases, :meth:`!register` can be used to " @@ -4410,7 +4416,7 @@ msgstr "" "用 :meth:`!register` 向剖析器註冊自訂 action 或型別,讓你可以透過註冊名稱而非" "可呼叫物件名稱來參照型別。" -#: ../../library/argparse.rst:2270 +#: ../../library/argparse.rst:2273 msgid "" "The :meth:`!register` method accepts three arguments - a *registry_name*, " "specifying the internal registry where the object will be stored (e.g., " @@ -4421,12 +4427,12 @@ msgstr "" "錄檔(例如 ``action``、``type``);*value*,用於註冊物件的鍵值;以及 object," "要註冊的可呼叫物件。" -#: ../../library/argparse.rst:2275 +#: ../../library/argparse.rst:2278 msgid "" "The following example shows how to register a custom type with a parser::" msgstr "以下範例展示如何向剖析器註冊自訂型別: ::" -#: ../../library/argparse.rst:2277 +#: ../../library/argparse.rst:2280 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -4454,26 +4460,26 @@ msgstr "" "usage: PROG [-h] [--foo FOO]\n" "PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" -#: ../../library/argparse.rst:2289 +#: ../../library/argparse.rst:2292 msgid "Exceptions" msgstr "例外" -#: ../../library/argparse.rst:2293 +#: ../../library/argparse.rst:2296 msgid "An error from creating or using an argument (optional or positional)." msgstr "建立或使用引數(可選或位置引數)時的錯誤。" -#: ../../library/argparse.rst:2295 +#: ../../library/argparse.rst:2298 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "此例外的字串值是訊息,附帶了導致錯誤的引數的相關資訊。" -#: ../../library/argparse.rst:2300 +#: ../../library/argparse.rst:2303 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "當將命令列字串轉換為型別時出錯時引發。" -#: ../../library/argparse.rst:2304 +#: ../../library/argparse.rst:2307 msgid "Guides and Tutorials" msgstr "指南與教學" diff --git a/library/enum.po b/library/enum.po index 29e43e5182d..5ac9c46f97f 100644 --- a/library/enum.po +++ b/library/enum.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-03-24 00:18+0000\n" +"POT-Creation-Date: 2026-04-15 00:29+0000\n" "PO-Revision-Date: 2024-12-21 13:50+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -541,7 +541,8 @@ msgstr "" "[, , ]" #: ../../library/enum.rst:248 -msgid "Returns the number of member in *cls*::" +#, fuzzy +msgid "Returns the number of members in *cls*::" msgstr "回傳 *cls* 的成員數量: ::" #: ../../library/enum.rst:250 @@ -1651,8 +1652,8 @@ msgid "" "used." msgstr "" ":meth:`~Enum.__new__`,如果有指定,它必須建立並回傳列舉成員;適當地設定成員" -"的 :attr:`~Enum._value_` 也是一個很好的主意。一旦所有成員都建立之後就不會再被用" -"到。" +"的 :attr:`~Enum._value_` 也是一個很好的主意。一旦所有成員都建立之後就不會再被" +"用到。" #: ../../library/enum.rst:946 msgid "Supported ``_sunder_`` names" diff --git a/library/unittest.po b/library/unittest.po index 46409581c66..ed960a11e67 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-07 00:19+0000\n" +"POT-Creation-Date: 2026-04-15 00:29+0000\n" "PO-Revision-Date: 2022-10-16 06:03+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,9 +45,9 @@ msgid "" "for tests, aggregation of tests into collections, and independence of the " "tests from the reporting framework." msgstr "" -":mod:`!unittest` 原生的單元測試框架最初由 JUnit 開發,和其他程式語言相似有主要" -"的單元測試框架。支援自動化測試,對測試分享安裝與關閉程式碼,集合所有匯總的測" -"試,並且獨立各個測試報告框架。" +":mod:`!unittest` 原生的單元測試框架最初由 JUnit 開發,和其他程式語言相似有主" +"要的單元測試框架。支援自動化測試,對測試分享安裝與關閉程式碼,集合所有匯總的" +"測試,並且獨立各個測試報告框架。" #: ../../library/unittest.rst:25 msgid "" @@ -318,8 +318,8 @@ msgid "" "which are sufficient to meet many everyday testing needs. The remainder of " "the documentation explores the full feature set from first principles." msgstr "" -"以上的例子顯示大多數使用 :mod:`!unittest` 特徵足以滿足大多數日常測試的需求。接" -"下來第一部分文件的剩餘部分將繼續探索完整特徵設定。" +"以上的例子顯示大多數使用 :mod:`!unittest` 特徵足以滿足大多數日常測試的需求。" +"接下來第一部分文件的剩餘部分將繼續探索完整特徵設定。" #: ../../library/unittest.rst:154 msgid "" @@ -2037,9 +2037,7 @@ msgid ":meth:`assertCountEqual(a, b) `" msgstr ":meth:`assertCountEqual(a, b) `" #: ../../library/unittest.rst:1224 -msgid "" -"*a* and *b* have the same elements in the same number, regardless of their " -"order." +msgid "*a* contains the same elements as *b*, regardless of their order." msgstr "" #: ../../library/unittest.rst:1228 From cb96b6c59625647385adb799197045a03ae131ca Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 16 Apr 2026 00:30:42 +0000 Subject: [PATCH 6/6] sync with cpython 0a6bc082 --- library/functions.po | 340 ++++++++------- library/http.server.po | 86 ++-- using/windows.po | 908 +++++++++++++++++++++++------------------ 3 files changed, 730 insertions(+), 604 deletions(-) diff --git a/library/functions.po b/library/functions.po index 553e8fd614d..ed298246929 100644 --- a/library/functions.po +++ b/library/functions.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-04-09 18:54+0800\n" +"POT-Creation-Date: 2026-04-16 00:29+0000\n" "PO-Revision-Date: 2025-07-28 21:38+0800\n" "Last-Translator: Weilin Du <1372449351@qq.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -997,9 +997,9 @@ msgstr "" "式相同,但後綴為 ``'j'`` 或 ``'J'``),或同時包含實數部分和虛數部分(在這種情" "況下,虛數部分的符號是必須的)。字串可以選擇以空白和圓括號 ``'('`` 和 " "``')'`` 包圍,這些都會被忽略。字串在 ``'+'``、``'-'``、``'j'`` 或 ``'J'`` 後" -"綴和十進位數字之間不能包含空白。例如,``complex('1+2j')`` 沒有問題," -"但 ``complex('1 + 2j')`` 會引發 :exc:`ValueError`。更精確地說,輸入必須符合以" -"下文法中的 :token:`~float:complexvalue` 產生規則,在去除括號和前後空白字元之" +"綴和十進位數字之間不能包含空白。例如,``complex('1+2j')`` 沒有問題,但 " +"``complex('1 + 2j')`` 會引發 :exc:`ValueError`。更精確地說,輸入必須符合以下" +"文法中的 :token:`~float:complexvalue` 產生規則,在去除括號和前後空白字元之" "後:" #: ../../library/functions.rst:424 @@ -1288,14 +1288,13 @@ msgstr "" "*source* 引數會被視為一條 Python 運算式(技術上而言,是條件列表)來剖析及求" "值,而 *globals* 和 *locals* 對映分別用作全域和區域命名空間。如果 *globals* " "dictionary 存在但缺少 ``__builtins__`` 的鍵值,那 *source* 被剖析之前,將為該" -"鍵插入對內建 :mod:`builtins` module dictionary 的引用。覆寫 " -"``__builtins__`` 可以用來限制或更改可用的名稱,但這\\ **不是**\\ 一種安全機" -"制:被執行的程式碼仍然可以存取所有內建名稱。如果 *locals* 對映被省略,那它的" -"預設值是 *globals* dictionary。如果兩個對映都被省略,則以在 :func:`eval` 被呼" -"叫的環境中的 *globals* 和 *locals* 執行原始碼。請注意,*eval()* 在封閉 " -"(enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-locals)," -"除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透過 :keyword:`nonlocal` 陳" -"述式)。" +"鍵插入對內建 :mod:`builtins` module dictionary 的引用。覆寫 ``__builtins__`` " +"可以用來限制或更改可用的名稱,但這\\ **不是**\\ 一種安全機制:被執行的程式碼" +"仍然可以存取所有內建名稱。如果 *locals* 對映被省略,那它的預設值是 *globals* " +"dictionary。如果兩個對映都被省略,則以在 :func:`eval` 被呼叫的環境中的 " +"*globals* 和 *locals* 執行原始碼。請注意,*eval()* 在封閉 (enclosing) 環境中" +"無法存取\\ :term:`巢狀作用域 ` (non-locals),除非呼叫 :func:" +"`eval` 的作用域已經有參照它們(例如透過 :keyword:`nonlocal` 陳述式)。" #: ../../library/functions.rst:619 msgid "Example:" @@ -1330,9 +1329,10 @@ msgid "" msgstr "如果給定來源是一個字串,那麼其前後的空格和定位字元會被移除。" #: ../../library/functions.rst:638 +#, fuzzy msgid "" -"See :func:`ast.literal_eval` for a function that can safely evaluate strings " -"with expressions containing only literals." +"See :func:`ast.literal_eval` for a function to evaluate strings with " +"expressions containing only literals." msgstr "" "另外可以參閱 :func:`ast.literal_eval`,該函式可以安全執行僅包含文字的運算式字" "串。" @@ -2094,7 +2094,8 @@ msgstr "" msgid "" "At class scope, it returns the namespace that will be passed to the " "metaclass constructor." -msgstr "在類別作用域中,它會回傳將傳遞給元類別 (metaclass) 建構函式的命名空間。" +msgstr "" +"在類別作用域中,它會回傳將傳遞給元類別 (metaclass) 建構函式的命名空間。" #: ../../library/functions.rst:1169 msgid "" @@ -2113,10 +2114,10 @@ msgid "" "deleting local variables will immediately affect the contents of the " "returned mapping object." msgstr "" -"在上述所有情況下,在指定的執行框架中,每次呼叫 ``locals()`` 都會回傳\\ *相" -"同*\\ 的對映物件。透過 ``locals()`` 回傳的對映物件所做的變更,會以被指派、重" -"新指派或刪除的區域變數的形式顯示,而指派、重新指派或刪除區域變數會立即影響回" -"傳的對映物件的內容。" +"在上述所有情況下,在指定的執行框架中,每次呼叫 ``locals()`` 都會回傳\\ *相同" +"*\\ 的對映物件。透過 ``locals()`` 回傳的對映物件所做的變更,會以被指派、重新" +"指派或刪除的區域變數的形式顯示,而指派、重新指派或刪除區域變數會立即影響回傳" +"的對映物件的內容。" #: ../../library/functions.rst:1179 msgid "" @@ -2129,11 +2130,11 @@ msgid "" "variables and nonlocal cell references does *not* affect the contents of " "previously returned dictionaries." msgstr "" -"在\\ :term:`optimized scope` 中(包括函式、產生器和協程),每次呼" -"叫 ``locals()`` 都會回傳一個新的字典,其中包含函式的區域變數和任何非區域 " -"cell 參照的目前綁定。在這種情況下,透過回傳的字典所做的名稱綁定變更,\\ **不" -"會**\\ 寫回對應的區域變數或非區域 cell 參照,而且指派、重新指派或刪除區域變數" -"和非區域 cell 參照,\\ **不會**\\ 影響先前回傳字典的內容。" +"在\\ :term:`optimized scope` 中(包括函式、產生器和協程),每次呼叫 " +"``locals()`` 都會回傳一個新的字典,其中包含函式的區域變數和任何非區域 cell 參" +"照的目前綁定。在這種情況下,透過回傳的字典所做的名稱綁定變更,\\ **不會**\\ " +"寫回對應的區域變數或非區域 cell 參照,而且指派、重新指派或刪除區域變數和非區" +"域 cell 參照,\\ **不會**\\ 影響先前回傳字典的內容。" #: ../../library/functions.rst:1188 msgid "" @@ -2169,9 +2170,9 @@ msgid "" "being defined, the behaviour in other scopes remains unchanged from previous " "versions." msgstr "" -"作為 :pep:`667` 的一部分,現在定義了變更此函式回傳的對映物件的語意。" -"在 :term:`optimized scopes ` 中的行為現在如上所述。除了被定" -"義外,其他作用域中的行為與先前版本保持不變。" +"作為 :pep:`667` 的一部分,現在定義了變更此函式回傳的對映物件的語意。在 :term:" +"`optimized scopes ` 中的行為現在如上所述。除了被定義外,其他" +"作用域中的行為與先前版本保持不變。" #: ../../library/functions.rst:1211 msgid "" @@ -2220,8 +2221,8 @@ msgid "" msgstr "" "這個函式有兩個選擇性的僅限關鍵字引數。*key* 引數能指定單一引數所使用的排序函" "式,如同 :meth:`list.sort` 的使用方式。*default* 引數是當 iterable 為空時回傳" -"的物件。如果 iterable 為空,並且沒有提供 *default*,則會引" -"發 :exc:`ValueError`。" +"的物件。如果 iterable 為空,並且沒有提供 *default*,則會引發 :exc:" +"`ValueError`。" #: ../../library/functions.rst:1242 msgid "" @@ -2283,8 +2284,8 @@ msgid "" "iterator is exhausted, otherwise :exc:`StopIteration` is raised." msgstr "" "透過呼叫 :term:`iterator` 的 :meth:`~iterator.__next__` method 取得下一個元" -"素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引" -"發 :exc:`StopIteration`。" +"素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引發 :" +"exc:`StopIteration`。" #: ../../library/functions.rst:1302 msgid "" @@ -3112,8 +3113,8 @@ msgid "" "Rather than being a function, :class:`range` is actually an immutable " "sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." msgstr "" -"與其說是函式,:class:`range` 實際上是一個不可變的序列型別," -"如 :ref:`typesseq-range` 和 :ref:`typesseq` 所述。" +"與其說是函式,:class:`range` 實際上是一個不可變的序列型別,如 :ref:`typesseq-" +"range` 和 :ref:`typesseq` 所述。" #: ../../library/functions.rst:1749 msgid "" @@ -3131,8 +3132,8 @@ msgstr "" "當傳遞給 :func:`eval` 時,這個字串會產生一個具有相同值的物件;否則,這個表示" "是一個用角括弧括起來的字串,包含物件型別的名稱,以及額外的資訊,通常包括物件" "的名稱和位址。一個類別可以透過定義 :meth:`~object.__repr__` 方法來控制這個函" -"式對其實例的回傳值。如果 :func:`sys.displayhook` 不可存取,這個函式會引" -"發 :exc:`RuntimeError`。" +"式對其實例的回傳值。如果 :func:`sys.displayhook` 不可存取,這個函式會引發 :" +"exc:`RuntimeError`。" #: ../../library/functions.rst:1760 msgid "This class has a custom representation that can be evaluated::" @@ -3163,9 +3164,9 @@ msgid "" "(the :meth:`~object.__len__` method and the :meth:`~object.__getitem__` " "method with integer arguments starting at ``0``)." msgstr "" -"回傳一個反向的\\ :term:`疊代器 `。引數必須是一個擁有 :meth:`~object." -"__reversed__` 方法或支援序列協定(即 :meth:`~object.__len__` 方法和以 ``0`` " -"開始的整數引數的 :meth:`~object.__getitem__` 方法)的物件。" +"回傳一個反向的\\ :term:`疊代器 `。引數必須是一個擁有 :meth:" +"`~object.__reversed__` 方法或支援序列協定(即 :meth:`~object.__len__` 方法和" +"以 ``0`` 開始的整數引數的 :meth:`~object.__getitem__` 方法)的物件。" #: ../../library/functions.rst:1781 msgid "" @@ -3188,9 +3189,9 @@ msgid "" msgstr "" "對於支援 :func:`round` 的內建型別,值會被四捨五入到最接近 10 的負 *ndigits* " "次方的倍數;如果兩個倍數一樣接近,則會向偶數方向進位(因此,例如 " -"``round(0.5)`` 和 ``round(-0.5)`` 都是 ``0``,而 ``round(1.5)`` 是 " -"``2``)。*ndigits* 的任何整數值都是有效的(正數、零或負數)。如果省略 " -"*ndigits* 或為 ``None``,則回傳值是整數。否則回傳值與 *number* 有相同的型別。" +"``round(0.5)`` 和 ``round(-0.5)`` 都是 ``0``,而 ``round(1.5)`` 是 ``2``)。" +"*ndigits* 的任何整數值都是有效的(正數、零或負數)。如果省略 *ndigits* 或為 " +"``None``,則回傳值是整數。否則回傳值與 *number* 有相同的型別。" #: ../../library/functions.rst:1794 msgid "" @@ -3208,8 +3209,8 @@ msgid "" "information." msgstr "" ":func:`round` 對於浮點數的行為可能出乎意料:例如 ``round(2.675, 2)`` 會得到 " -"``2.67`` 而非預期的 ``2.68``。這不是一個 bug:這是因為大多數十進位小數無法精確" -"地表示為浮點數。更多資訊請參閱 :ref:`tut-fp-issues`。" +"``2.67`` 而非預期的 ``2.68``。這不是一個 bug:這是因為大多數十進位小數無法精" +"確地表示為浮點數。更多資訊請參閱 :ref:`tut-fp-issues`。" #: ../../library/functions.rst:1810 msgid "" @@ -3250,8 +3251,8 @@ msgid "" "whose name is not an identifier will not be accessible using the dot " "notation, but is accessible through :func:`getattr` etc.." msgstr "" -"*name* 不必是 :ref:`identifiers` 中定義的 Python 識別字,除非該物件選擇強制" -"要求,例如在自訂的 :meth:`~object.__getattribute__` 中或透過 :attr:`~object." +"*name* 不必是 :ref:`identifiers` 中定義的 Python 識別字,除非該物件選擇強制要" +"求,例如在自訂的 :meth:`~object.__getattribute__` 中或透過 :attr:`~object." "__slots__`。名稱不是識別字的屬性將無法使用點記法存取,但可以透過 :func:" "`getattr` 等方式存取。" @@ -3271,16 +3272,16 @@ msgid "" "``range(start, stop, step)``. The *start* and *step* arguments default to " "``None``." msgstr "" -"回傳一個 :term:`slice` 物件,表示由 ``range(start, stop, step)`` 指定的索引" -"集合。*start* 和 *step* 引數預設為 ``None``。" +"回傳一個 :term:`slice` 物件,表示由 ``range(start, stop, step)`` 指定的索引集" +"合。*start* 和 *step* 引數預設為 ``None``。" #: ../../library/functions.rst:1848 msgid "" "Slice objects are also generated when :ref:`slicing syntax ` is " "used. For example: ``a[start:stop:step]`` or ``a[start:stop, i]``." msgstr "" -"Slice 物件也會在使用\\ :ref:`切片語法 `\\ 時產生。例如:" -"``a[start:stop:step]`` 或 ``a[start:stop, i]``。" +"Slice 物件也會在使用\\ :ref:`切片語法 `\\ 時產生。例如:``a[start:" +"stop:step]`` 或 ``a[start:stop, i]``。" #: ../../library/functions.rst:1851 msgid "" @@ -3296,8 +3297,8 @@ msgid "" "default). They have no other explicit functionality; however, they are used " "by NumPy and other third-party packages." msgstr "" -"這些唯讀屬性被設定為引數值(或其預設值)。它們沒有其他明確的功能;然而,它們會" -"被 NumPy 和其他第三方套件使用。" +"這些唯讀屬性被設定為引數值(或其預設值)。它們沒有其他明確的功能;然而,它們" +"會被 NumPy 和其他第三方套件使用。" #: ../../library/functions.rst:1862 msgid "" @@ -3330,8 +3331,8 @@ msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." msgstr "" -"*reverse* 是一個布林值。如果設為 ``True``,則 list 元素的排序方式如同每次" -"比較都被反轉一樣。" +"*reverse* 是一個布林值。如果設為 ``True``,則 list 元素的排序方式如同每次比較" +"都被反轉一樣。" #: ../../library/functions.rst:1879 msgid "" @@ -3347,9 +3348,9 @@ msgid "" "compare equal --- this is helpful for sorting in multiple passes (for " "example, sort by department, then by salary grade)." msgstr "" -"內建的 :func:`sorted` 函式保證是穩定排序。一個排序如果保證不會改變比較結果" -"相等的元素之間的相對順序,就是穩定的 --- 這對於多次排序很有幫助(例如,先" -"按部門排序,再按薪資等級排序)。" +"內建的 :func:`sorted` 函式保證是穩定排序。一個排序如果保證不會改變比較結果相" +"等的元素之間的相對順序,就是穩定的 --- 這對於多次排序很有幫助(例如,先按部門" +"排序,再按薪資等級排序)。" #: ../../library/functions.rst:1887 msgid "" @@ -3362,17 +3363,16 @@ msgid "" "mixed type comparisons which can call the reflected :meth:`~object.__gt__` " "method." msgstr "" -"排序演算法僅使用項目之間的 ``<`` 比較。雖然定義 :meth:`~object.__lt__` 方法" -"就足以進行排序,但 :PEP:`8` 建議實作全部六個\\ :ref:`複合比較 " -"`。這有助於避免在使用相同資料搭配其他排序工具(例如依賴不同" -"底層方法的 :func:`max`)時產生錯誤。實作全部六個比較也有助於避免混合型別" -"比較時的混淆,因為這種比較可能會呼叫被反映的 :meth:`~object.__gt__` 方法。" +"排序演算法僅使用項目之間的 ``<`` 比較。雖然定義 :meth:`~object.__lt__` 方法就" +"足以進行排序,但 :PEP:`8` 建議實作全部六個\\ :ref:`複合比較 `。" +"這有助於避免在使用相同資料搭配其他排序工具(例如依賴不同底層方法的 :func:" +"`max`)時產生錯誤。實作全部六個比較也有助於避免混合型別比較時的混淆,因為這種" +"比較可能會呼叫被反映的 :meth:`~object.__gt__` 方法。" #: ../../library/functions.rst:1896 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." -msgstr "" -"有關排序的範例和簡要的排序教學,請參閱 :ref:`sortinghowto`。" +msgstr "有關排序的範例和簡要的排序教學,請參閱 :ref:`sortinghowto`。" #: ../../library/functions.rst:1900 msgid "Transform a method into a static method." @@ -3383,8 +3383,7 @@ msgid "" "A static method does not receive an implicit first argument. To declare a " "static method, use this idiom::" msgstr "" -"靜態方法不會接收隱含的第一個引數。要宣告一個靜態方法,請使用以下慣用寫" -"法: ::" +"靜態方法不會接收隱含的第一個引數。要宣告一個靜態方法,請使用以下慣用寫法: ::" #: ../../library/functions.rst:1905 msgid "" @@ -3411,9 +3410,9 @@ msgid "" "`descriptor` is also callable, so it can be used in the class definition " "(such as ``f()``)." msgstr "" -"靜態方法可以在類別上呼叫(例如 ``C.f()``),也可以在實例上呼叫(例如 " -"``C().f()``)。此外,靜態方法的\\ :term:`描述器 `\\ 也是可呼叫" -"的,因此可以在類別定義中使用(例如 ``f()``)。" +"靜態方法可以在類別上呼叫(例如 ``C.f()``),也可以在實例上呼叫(例如 ``C()." +"f()``)。此外,靜態方法的\\ :term:`描述器 `\\ 也是可呼叫的,因此" +"可以在類別定義中使用(例如 ``f()``)。" #: ../../library/functions.rst:1917 msgid "" @@ -3421,8 +3420,8 @@ msgid "" "see :func:`classmethod` for a variant that is useful for creating alternate " "class constructors." msgstr "" -"Python 中的靜態方法類似於 Java 或 C++ 中的靜態方法。另請參閱 " -":func:`classmethod`,它是一個對於建立替代類別建構式很有用的變體。" +"Python 中的靜態方法類似於 Java 或 C++ 中的靜態方法。另請參閱 :func:" +"`classmethod`,它是一個對於建立替代類別建構式很有用的變體。" #: ../../library/functions.rst:1921 msgid "" @@ -3433,8 +3432,8 @@ msgid "" "cases, use this idiom::" msgstr "" "如同所有裝飾器,也可以將 ``staticmethod`` 作為一般函式呼叫並對其結果進行操" -"作。這在某些情況下是必要的,例如當你需要從類別主體中引用一個函式,且希望避" -"免自動轉換為實例方法時。對於這些情況,請使用以下慣用寫法: ::" +"作。這在某些情況下是必要的,例如當你需要從類別主體中引用一個函式,且希望避免" +"自動轉換為實例方法時。對於這些情況,請使用以下慣用寫法: ::" #: ../../library/functions.rst:1927 msgid "" @@ -3476,8 +3475,8 @@ msgid "" "``str`` is the built-in string :term:`class`. For general information about " "strings, see :ref:`textseq`." msgstr "" -"``str`` 是內建的字串\\ :term:`類別 `。有關字串的一般資訊,請參閱 " -":ref:`textseq`。" +"``str`` 是內建的字串\\ :term:`類別 `。有關字串的一般資訊,請參閱 :ref:" +"`textseq`。" #: ../../library/functions.rst:1961 msgid "" @@ -3485,8 +3484,8 @@ msgid "" "the total. The *iterable*'s items are normally numbers, and the start value " "is not allowed to be a string." msgstr "" -"從左到右加總 *start* 和一個 *iterable* 的項目並回傳總和。*iterable* 的項目" -"通常是數字,且 start 值不允許為字串。" +"從左到右加總 *start* 和一個 *iterable* 的項目並回傳總和。*iterable* 的項目通" +"常是數字,且 start 值不允許為字串。" #: ../../library/functions.rst:1965 msgid "" @@ -3496,10 +3495,9 @@ msgid "" "see :func:`math.fsum`\\. To concatenate a series of iterables, consider " "using :func:`itertools.chain`." msgstr "" -"對於某些使用情境,有比 :func:`sum` 更好的替代方案。串接字串序列的首選快速方" -"式是呼叫 ``''.join(sequence)``。要以延伸精度加總浮點數值,請參閱 " -":func:`math.fsum`。要串接一系列可疊代物件,請考慮使用 " -":func:`itertools.chain`。" +"對於某些使用情境,有比 :func:`sum` 更好的替代方案。串接字串序列的首選快速方式" +"是呼叫 ``''.join(sequence)``。要以延伸精度加總浮點數值,請參閱 :func:`math." +"fsum`。要串接一系列可疊代物件,請考慮使用 :func:`itertools.chain`。" #: ../../library/functions.rst:1971 msgid "The *start* parameter can be specified as a keyword argument." @@ -3516,8 +3514,7 @@ msgstr "" msgid "" "Added specialization for summation of complexes, using same algorithm as for " "summation of floats." -msgstr "" -"新增了複數加總的特化處理,使用與浮點數加總相同的演算法。" +msgstr "新增了複數加總的特化處理,使用與浮點數加總相同的演算法。" #: ../../library/functions.rst:1985 msgid "" @@ -3525,8 +3522,8 @@ msgid "" "class of *type*. This is useful for accessing inherited methods that have " "been overridden in a class." msgstr "" -"回傳一個代理物件,該物件會將方法呼叫委派給 *type* 的父類別或兄弟類別。這對" -"於存取在類別中被覆寫的繼承方法很有用。" +"回傳一個代理物件,該物件會將方法呼叫委派給 *type* 的父類別或兄弟類別。這對於" +"存取在類別中被覆寫的繼承方法很有用。" #: ../../library/functions.rst:1989 msgid "" @@ -3542,9 +3539,9 @@ msgid "" "> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" -"舉例來說,如果 *object_or_type* 的 :attr:`~type.__mro__` 是 ``D -> B -> C " -"-> A -> object``,且 *type* 的值是 ``B``,則 :func:`super` 會搜尋 ``C -> " -"A -> object``。" +"舉例來說,如果 *object_or_type* 的 :attr:`~type.__mro__` 是 ``D -> B -> C -> " +"A -> object``,且 *type* 的值是 ``B``,則 :func:`super` 會搜尋 ``C -> A -> " +"object``。" #: ../../library/functions.rst:1997 msgid "" @@ -3553,9 +3550,9 @@ msgid "" "`getattr` and :func:`super`. The attribute is dynamic and can change " "whenever the inheritance hierarchy is updated." msgstr "" -"與 *object_or_type* 對應的類別之 :attr:`~type.__mro__` 屬性列出了 " -":func:`getattr` 和 :func:`super` 所使用的方法解析搜尋順序。該屬性是動態" -"的,每當繼承階層被更新時就可能改變。" +"與 *object_or_type* 對應的類別之 :attr:`~type.__mro__` 屬性列出了 :func:" +"`getattr` 和 :func:`super` 所使用的方法解析搜尋順序。該屬性是動態的,每當繼承" +"階層被更新時就可能改變。" #: ../../library/functions.rst:2002 msgid "" @@ -3564,8 +3561,8 @@ msgid "" "If the second argument is a type, ``issubclass(type2, type)`` must be true " "(this is useful for classmethods)." msgstr "" -"如果省略第二個引數,回傳的 super 物件就是未繫結的。如果第二個引數是一個物" -"件,``isinstance(obj, type)`` 必須為真。如果第二個引數是一個型別," +"如果省略第二個引數,回傳的 super 物件就是未繫結的。如果第二個引數是一個物件," +"``isinstance(obj, type)`` 必須為真。如果第二個引數是一個型別," "``issubclass(type2, type)`` 必須為真(這對類別方法很有用)。" #: ../../library/functions.rst:2007 @@ -3577,11 +3574,10 @@ msgid "" "argument :func:`!super` will not work as expected within nested functions, " "including generator expressions, which implicitly create nested functions.)" msgstr "" -"在類別的一般方法中直接呼叫時,兩個引數都可以省略(「零引數 " -":func:`!super`」)。在這種情況下,*type* 將是外圍類別,而 *obj* 將是直接" -"外圍函式的第一個引數(通常是 ``self``)。(這意味著零引數 " -":func:`!super` 在巢狀函式中將無法如預期般運作,包括隱式建立巢狀函式的產" -"生器運算式。)" +"在類別的一般方法中直接呼叫時,兩個引數都可以省略(「零引數 :func:`!" +"super`」)。在這種情況下,*type* 將是外圍類別,而 *obj* 將是直接外圍函式的第" +"一個引數(通常是 ``self``)。(這意味著零引數 :func:`!super` 在巢狀函式中將無" +"法如預期般運作,包括隱式建立巢狀函式的產生器運算式。)" #: ../../library/functions.rst:2014 msgid "" @@ -3590,9 +3586,9 @@ msgid "" "naming them explicitly, thus making the code more maintainable. This use " "closely parallels the use of *super* in other programming languages." msgstr "" -"*super* 有兩種典型的使用情境。在具有單一繼承的類別階層中,*super* 可以用" -"來參照父類別而不需要明確命名它們,從而使程式碼更易於維護。這種用法與 " -"*super* 在其他程式語言中的用法非常相似。" +"*super* 有兩種典型的使用情境。在具有單一繼承的類別階層中,*super* 可以用來參" +"照父類別而不需要明確命名它們,從而使程式碼更易於維護。這種用法與 *super* 在其" +"他程式語言中的用法非常相似。" #: ../../library/functions.rst:2019 msgid "" @@ -3606,12 +3602,11 @@ msgid "" "changes in the class hierarchy, and because that order can include sibling " "classes that are unknown prior to runtime)." msgstr "" -"第二種使用情境是在動態執行環境中支援協作式多重繼承。這種使用情境是 " -"Python 獨有的,在靜態編譯語言或僅支援單一繼承的語言中找不到。這使得實作" -"「鑽石圖」(diamond diagrams)成為可能,其中多個基礎類別實作相同的方" -"法。良好的設計要求這些實作在每種情況下都有相同的呼叫簽名(因為呼叫順序是" -"在執行期決定的,因為該順序會適應類別階層的變化,也因為該順序可以包含在執" -"行期之前未知的兄弟類別)。" +"第二種使用情境是在動態執行環境中支援協作式多重繼承。這種使用情境是 Python 獨" +"有的,在靜態編譯語言或僅支援單一繼承的語言中找不到。這使得實作「鑽石圖」" +"(diamond diagrams)成為可能,其中多個基礎類別實作相同的方法。良好的設計要求" +"這些實作在每種情況下都有相同的呼叫簽名(因為呼叫順序是在執行期決定的,因為該" +"順序會適應類別階層的變化,也因為該順序可以包含在執行期之前未知的兄弟類別)。" #: ../../library/functions.rst:2029 msgid "For both use cases, a typical superclass call looks like this::" @@ -3635,8 +3630,8 @@ msgid "" "lookups. One possible use case for this is calling :term:`descriptors " "` in a parent or sibling class." msgstr "" -"除了方法查找之外,:func:`super` 也適用於屬性查找。這個功能的一個可能使用情" -"境是在父類別或兄弟類別中呼叫\\ :term:`描述器 `。" +"除了方法查找之外,:func:`super` 也適用於屬性查找。這個功能的一個可能使用情境" +"是在父類別或兄弟類別中呼叫\\ :term:`描述器 `。" #: ../../library/functions.rst:2040 msgid "" @@ -3647,11 +3642,11 @@ msgid "" "inheritance. Accordingly, :func:`super` is undefined for implicit lookups " "using statements or operators such as ``super()[name]``." msgstr "" -"請注意,:func:`super` 是作為顯式點號屬性查找(例如 " -"``super().__getitem__(name)``)之繫結過程的一部分來實作的。它透過實作自己" -"的 :meth:`~object.__getattribute__` 方法來搜尋類別,以可預測的順序來支援協作" -"式多重繼承。因此,:func:`super` 對於使用陳述式或運算子的隱式查找(例如 " -"``super()[name]``)是未定義的。" +"請注意,:func:`super` 是作為顯式點號屬性查找(例如 ``super()." +"__getitem__(name)``)之繫結過程的一部分來實作的。它透過實作自己的 :meth:" +"`~object.__getattribute__` 方法來搜尋類別,以可預測的順序來支援協作式多重繼" +"承。因此,:func:`super` 對於使用陳述式或運算子的隱式查找(例如 ``super()" +"[name]``)是未定義的。" #: ../../library/functions.rst:2048 msgid "" @@ -3662,10 +3657,10 @@ msgid "" "necessary details to correctly retrieve the class being defined, as well as " "accessing the current instance for ordinary methods." msgstr "" -"另外請注意,除了零引數形式之外,:func:`super` 並不限於在方法內部使用。雙引" -"數形式會精確地指定引數並建立適當的參照。零引數形式只能在類別定義內部使用," -"因為編譯器會填入必要的細節以正確地取得正在被定義的類別,以及存取一般方法的" -"目前實例。" +"另外請注意,除了零引數形式之外,:func:`super` 並不限於在方法內部使用。雙引數" +"形式會精確地指定引數並建立適當的參照。零引數形式只能在類別定義內部使用,因為" +"編譯器會填入必要的細節以正確地取得正在被定義的類別,以及存取一般方法的目前實" +"例。" #: ../../library/functions.rst:2055 msgid "" @@ -3674,8 +3669,8 @@ msgid "" "com/2011/05/26/super-considered-super/>`_." msgstr "" "有關如何使用 :func:`super` 設計協作式類別的實用建議,請參閱\\ `使用 super() " -"的指南 `_。" +"的指南 `_。" #: ../../library/functions.rst:2059 msgid "" @@ -3699,16 +3694,16 @@ msgid "" "type object and generally the same object as returned by :attr:`object." "__class__`." msgstr "" -"傳入一個引數時,回傳一個 *object* 的型別。回傳值是一個型別物件,通常與 " -":attr:`object.__class__` 所回傳的物件相同。" +"傳入一個引數時,回傳一個 *object* 的型別。回傳值是一個型別物件,通常與 :attr:" +"`object.__class__` 所回傳的物件相同。" #: ../../library/functions.rst:2081 msgid "" "The :func:`isinstance` built-in function is recommended for testing the type " "of an object, because it takes subclasses into account." msgstr "" -"建議使用內建函式 :func:`isinstance` 來測試物件的型別,因為它會將子類別納入" -"考量。" +"建議使用內建函式 :func:`isinstance` 來測試物件的型別,因為它會將子類別納入考" +"量。" #: ../../library/functions.rst:2084 msgid "" @@ -3722,12 +3717,12 @@ msgid "" "__dict__` attribute. The following two statements create identical :class:`!" "type` objects:" msgstr "" -"傳入三個引數時,回傳一個新的型別物件。這本質上是 :keyword:`class` 陳述式的" -"動態形式。*name* 字串是類別名稱,會成為 :attr:`~type.__name__` 屬性。" -"*bases* tuple 包含基底類別,會成為 :attr:`~type.__bases__` 屬性;如果為空," -"則會加入所有類別的最終基底類別 :class:`object`。*dict* 字典包含類別主體的屬" -"性和方法定義;它可能會被複製或包裝後才成為 :attr:`~type.__dict__` 屬性。以下" -"兩個陳述式會建立相同的 :class:`!type` 物件:" +"傳入三個引數時,回傳一個新的型別物件。這本質上是 :keyword:`class` 陳述式的動" +"態形式。*name* 字串是類別名稱,會成為 :attr:`~type.__name__` 屬性。*bases* " +"tuple 包含基底類別,會成為 :attr:`~type.__bases__` 屬性;如果為空,則會加入所" +"有類別的最終基底類別 :class:`object`。*dict* 字典包含類別主體的屬性和方法定" +"義;它可能會被複製或包裝後才成為 :attr:`~type.__dict__` 屬性。以下兩個陳述式" +"會建立相同的 :class:`!type` 物件:" #: ../../library/functions.rst:2099 msgid "See also:" @@ -3737,8 +3732,7 @@ msgstr "另請參閱:" msgid "" ":ref:`Documentation on attributes and methods on classes `." -msgstr "" -":ref:`類別的屬性和方法的文件 `。" +msgstr ":ref:`類別的屬性和方法的文件 `。" #: ../../library/functions.rst:2102 msgid ":ref:`bltin-type-objects`" @@ -3751,8 +3745,8 @@ msgid "" "in the same way that keywords in a class definition (besides *metaclass*) " "would." msgstr "" -"提供給三引數形式的關鍵字引數會以與類別定義中的關鍵字(除了 *metaclass* 之" -"外)相同的方式,傳遞給適當的元類別機制(通常是 :meth:`~object." +"提供給三引數形式的關鍵字引數會以與類別定義中的關鍵字(除了 *metaclass* 之外)" +"相同的方式,傳遞給適當的元類別機制(通常是 :meth:`~object." "__init_subclass__`)。" #: ../../library/functions.rst:2109 @@ -3764,8 +3758,8 @@ msgid "" "Subclasses of :class:`!type` which don't override ``type.__new__`` may no " "longer use the one-argument form to get the type of an object." msgstr "" -"沒有覆寫 ``type.__new__`` 的 :class:`!type` 子類別不能再使用單引數形式來取" -"得物件的型別。" +"沒有覆寫 ``type.__new__`` 的 :class:`!type` 子類別不能再使用單引數形式來取得" +"物件的型別。" #: ../../library/functions.rst:2118 msgid "" @@ -3782,8 +3776,8 @@ msgid "" "their :attr:`!__dict__` attributes (for example, classes use a :class:`types." "MappingProxyType` to prevent direct dictionary updates)." msgstr "" -"像模組和實例這樣的物件具有可更新的 :attr:`~object.__dict__` 屬性;然而,其" -"他物件的 :attr:`!__dict__` 屬性可能有寫入限制(例如,類別使用 :class:`types." +"像模組和實例這樣的物件具有可更新的 :attr:`~object.__dict__` 屬性;然而,其他" +"物件的 :attr:`!__dict__` 屬性可能有寫入限制(例如,類別使用 :class:`types." "MappingProxyType` 來防止直接更新字典)。" #: ../../library/functions.rst:2126 @@ -3796,22 +3790,20 @@ msgid "" "doesn't have a :attr:`~object.__dict__` attribute (for example, if its class " "defines the :attr:`~object.__slots__` attribute)." msgstr "" -"如果指定了一個物件但它沒有 :attr:`~object.__dict__` 屬性(例如,如果它的類" -"別定義了 :attr:`~object.__slots__` 屬性),則會引發 :exc:`TypeError` 例外。" +"如果指定了一個物件但它沒有 :attr:`~object.__dict__` 屬性(例如,如果它的類別" +"定義了 :attr:`~object.__slots__` 屬性),則會引發 :exc:`TypeError` 例外。" #: ../../library/functions.rst:2134 msgid "" "The result of calling this function without an argument has been updated as " "described for the :func:`locals` builtin." -msgstr "" -"不帶引數呼叫此函式的結果已按照內建函式 :func:`locals` 的說明進行更新。" +msgstr "不帶引數呼叫此函式的結果已按照內建函式 :func:`locals` 的說明進行更新。" #: ../../library/functions.rst:2140 msgid "" "Iterate over several iterables in parallel, producing tuples with an item " "from each one." -msgstr "" -"平行疊代多個可疊代物件,產生包含每個可疊代物件中一個項目的 tuple。" +msgstr "平行疊代多個可疊代物件,產生包含每個可疊代物件中一個項目的 tuple。" #: ../../library/functions.rst:2143 msgid "Example::" @@ -3838,8 +3830,8 @@ msgid "" "More formally: :func:`zip` returns an iterator of tuples, where the *i*-th " "tuple contains the *i*-th element from each of the argument iterables." msgstr "" -"更正式地說::func:`zip` 回傳一個由 tuple 組成的疊代器,其中第 *i* 個 tuple " -"包含來自每個引數可疊代物件的第 *i* 個元素。" +"更正式地說::func:`zip` 回傳一個由 tuple 組成的疊代器,其中第 *i* 個 tuple 包" +"含來自每個引數可疊代物件的第 *i* 個元素。" #: ../../library/functions.rst:2155 msgid "" @@ -3856,8 +3848,8 @@ msgid "" "iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" "`list`." msgstr "" -":func:`zip` 是惰性的 (lazy):元素在可疊代物件被疊代之前不會被處理,例如透過" -"一個 :keyword:`!for` 迴圈或包裝在一個 :class:`list` 中。" +":func:`zip` 是惰性的 (lazy):元素在可疊代物件被疊代之前不會被處理,例如透過一" +"個 :keyword:`!for` 迴圈或包裝在一個 :class:`list` 中。" #: ../../library/functions.rst:2163 msgid "" @@ -3866,9 +3858,9 @@ msgid "" "the code that prepared these iterables. Python offers three different " "approaches to dealing with this issue:" msgstr "" -"需要考慮的一點是,傳遞給 :func:`zip` 的可疊代物件可能具有不同的長度;有時候" -"是刻意設計的,有時候是因為準備這些可疊代物件的程式碼中的錯誤。Python 提供三" -"種不同的方式來處理這個問題:" +"需要考慮的一點是,傳遞給 :func:`zip` 的可疊代物件可能具有不同的長度;有時候是" +"刻意設計的,有時候是因為準備這些可疊代物件的程式碼中的錯誤。Python 提供三種不" +"同的方式來處理這個問題:" #: ../../library/functions.rst:2168 msgid "" @@ -3909,8 +3901,8 @@ msgid "" "Unlike the default behavior, it raises a :exc:`ValueError` if one iterable " "is exhausted before the others:" msgstr "" -"與預設行為不同的是,如果有一個可疊代物件先於其他可疊代物件耗盡,它會引" -"發 :exc:`ValueError`:" +"與預設行為不同的是,如果有一個可疊代物件先於其他可疊代物件耗盡,它會引發 :" +"exc:`ValueError`:" #: ../../library/functions.rst:2200 msgid "" @@ -3927,8 +3919,8 @@ msgid "" "iterables have the same length. This is done by :func:`itertools." "zip_longest`." msgstr "" -"較短的可疊代物件可以填充常數值,使所有可疊代物件的長度相同。這可以透" -"過 :func:`itertools.zip_longest` 來完成。" +"較短的可疊代物件可以填充常數值,使所有可疊代物件的長度相同。這可以透過 :func:" +"`itertools.zip_longest` 來完成。" #: ../../library/functions.rst:2208 msgid "" @@ -3952,8 +3944,8 @@ msgid "" msgstr "" "可疊代物件的從左至右求值順序是有保證的。這使得使用 ``zip(*[iter(s)]*n, " "strict=True)`` 將資料序列聚類為 n 個長度群組的慣用語成為可能。這會重複\\ *相" -"同的*\\ 疊代器 ``n`` 次,因此每個輸出 tuple 會有 ``n`` 次呼叫疊代器的結果。" -"這樣做的效果是將輸入分割成 n 個長度的區塊。" +"同的*\\ 疊代器 ``n`` 次,因此每個輸出 tuple 會有 ``n`` 次呼叫疊代器的結果。這" +"樣做的效果是將輸入分割成 n 個長度的區塊。" #: ../../library/functions.rst:2219 msgid "" @@ -4002,12 +3994,12 @@ msgid "" "implementation is in use. Direct use of :func:`__import__` is also " "discouraged in favor of :func:`importlib.import_module`." msgstr "" -"這個函式被 :keyword:`import` 陳述式所叫用。它可以被取代(透過引" -"入 :mod:`builtins` 模組並指定給 ``builtins.__import__``),以改變 :keyword:`!" -"import` 陳述式的語意,但這樣做是\\ **強烈**\\ 不鼓勵的,因為通常使用 import " -"鉤子(見 :pep:`302`)來達到相同的目的會比較簡單,而且也不會造成假設使用預" -"設 import 實作的程式碼問題。我們也不鼓勵直接使用 :func:`__import__`,而應改" -"用 :func:`importlib.import_module`。" +"這個函式被 :keyword:`import` 陳述式所叫用。它可以被取代(透過引入 :mod:" +"`builtins` 模組並指定給 ``builtins.__import__``),以改變 :keyword:`!import` " +"陳述式的語意,但這樣做是\\ **強烈**\\ 不鼓勵的,因為通常使用 import 鉤子" +"(見 :pep:`302`)來達到相同的目的會比較簡單,而且也不會造成假設使用預設 " +"import 實作的程式碼問題。我們也不鼓勵直接使用 :func:`__import__`,而應改用 :" +"func:`importlib.import_module`。" #: ../../library/functions.rst:2254 msgid "" @@ -4020,8 +4012,8 @@ msgid "" msgstr "" "這個函式引入 *name* 模組,可能會使用給定的 *globals* 和 *locals* 來決定如何在" "套件情境中解釋這個名稱。*fromlist* 給出應該從 *name* 給出的模組引入的物件或子" -"模組的名稱。標準的實作完全不使用 *locals* 引數,而只使用 *globals* 來決" -"定 :keyword:`import` 陳述式的套件情境。" +"模組的名稱。標準的實作完全不使用 *locals* 引數,而只使用 *globals* 來決定 :" +"keyword:`import` 陳述式的套件情境。" #: ../../library/functions.rst:2261 msgid "" @@ -4031,9 +4023,9 @@ msgid "" "directory of the module calling :func:`__import__` (see :pep:`328` for the " "details)." msgstr "" -"*level* 指定使用絕對或相對引入。``0``\\(預設)表示只執行絕對引入。*level* 的正" -"值表示相對於呼叫 :func:`__import__` 的模組目錄要搜尋的父目錄數目(參" -"見 :pep:`328` 以了解詳情)。" +"*level* 指定使用絕對或相對引入。``0``\\(預設)表示只執行絕對引入。*level* 的" +"正值表示相對於呼叫 :func:`__import__` 的模組目錄要搜尋的父目錄數目(參見 :" +"pep:`328` 以了解詳情)。" #: ../../library/functions.rst:2267 msgid "" @@ -4050,7 +4042,8 @@ msgstr "" msgid "" "For example, the statement ``import spam`` results in bytecode resembling " "the following code::" -msgstr "例如,陳述式 ``import spam`` 會產生類似以下程式碼的位元組碼 (bytecode): ::" +msgstr "" +"例如,陳述式 ``import spam`` 會產生類似以下程式碼的位元組碼 (bytecode): ::" #: ../../library/functions.rst:2275 msgid "spam = __import__('spam', globals(), locals(), [], 0)" @@ -4076,7 +4069,8 @@ msgstr "" msgid "" "On the other hand, the statement ``from spam.ham import eggs, sausage as " "saus`` results in ::" -msgstr "另一方面,陳述式 ``from spam.ham import eggs, sausage as saus`` 結果是: ::" +msgstr "" +"另一方面,陳述式 ``from spam.ham import eggs, sausage as saus`` 結果是: ::" #: ../../library/functions.rst:2287 msgid "" @@ -4102,8 +4096,8 @@ msgid "" "If you simply want to import a module (potentially within a package) by " "name, use :func:`importlib.import_module`." msgstr "" -"如果你只想依名稱引入一個模組(可能在套件中),請使" -"用 :func:`importlib.import_module`。" +"如果你只想依名稱引入一個模組(可能在套件中),請使用 :func:`importlib." +"import_module`。" #: ../../library/functions.rst:2298 msgid "" @@ -4116,8 +4110,8 @@ msgid "" "When the command line options :option:`-E` or :option:`-I` are being used, " "the environment variable :envvar:`PYTHONCASEOK` is now ignored." msgstr "" -"當使用命令列選項 :option:`-E` 或 :option:`-I` 時,環境變" -"數 :envvar:`PYTHONCASEOK` 現在會被忽略。" +"當使用命令列選項 :option:`-E` 或 :option:`-I` 時,環境變數 :envvar:" +"`PYTHONCASEOK` 現在會被忽略。" #: ../../library/functions.rst:2307 msgid "Footnotes" diff --git a/library/http.server.po b/library/http.server.po index 3a0de48a8c1..b5fd360fdb3 100644 --- a/library/http.server.po +++ b/library/http.server.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-04-03 00:23+0000\n" +"POT-Creation-Date: 2026-04-16 00:29+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -139,9 +139,9 @@ msgstr "" msgid "" "This class is used to handle the HTTP requests that arrive at the server. " "By itself, it cannot respond to any actual HTTP requests; it must be " -"subclassed to handle each request method (e.g. GET or POST). :class:" -"`BaseHTTPRequestHandler` provides a number of class and instance variables, " -"and methods for use by subclasses." +"subclassed to handle each request method (for example, ``'GET'`` or " +"``'POST'``). :class:`BaseHTTPRequestHandler` provides a number of class and " +"instance variables, and methods for use by subclasses." msgstr "" #: ../../library/http.server.rst:106 @@ -306,8 +306,8 @@ msgid "" "When an HTTP/1.1 conformant server receives an ``Expect: 100-continue`` " "request header it responds back with a ``100 Continue`` followed by ``200 " "OK`` headers. This method can be overridden to raise an error if the server " -"does not want the client to continue. For e.g. server can choose to send " -"``417 Expectation Failed`` as a response header and ``return False``." +"does not want the client to continue. For example, the server can choose to " +"send ``417 Expectation Failed`` as a response header and ``return False``." msgstr "" #: ../../library/http.server.rst:251 @@ -667,109 +667,109 @@ msgstr "命令列介面" msgid "" ":mod:`!http.server` can also be invoked directly using the :option:`-m` " "switch of the interpreter. The following example illustrates how to serve " -"files relative to the current directory::" +"files relative to the current directory:" msgstr "" #: ../../library/http.server.rst:523 msgid "python -m http.server [OPTIONS] [port]" msgstr "python -m http.server [OPTIONS] [port]" -#: ../../library/http.server.rst:525 +#: ../../library/http.server.rst:527 msgid "The following options are accepted:" msgstr "可接受以下選項:" -#: ../../library/http.server.rst:531 +#: ../../library/http.server.rst:533 msgid "" "The server listens to port 8000 by default. The default can be overridden by " -"passing the desired port number as an argument::" +"passing the desired port number as an argument:" msgstr "" -#: ../../library/http.server.rst:534 +#: ../../library/http.server.rst:536 msgid "python -m http.server 9000" msgstr "python -m http.server 9000" -#: ../../library/http.server.rst:538 +#: ../../library/http.server.rst:542 msgid "" "Specifies a specific address to which it should bind. Both IPv4 and IPv6 " "addresses are supported. By default, the server binds itself to all " "interfaces. For example, the following command causes the server to bind to " -"localhost only::" +"localhost only:" msgstr "" -#: ../../library/http.server.rst:543 +#: ../../library/http.server.rst:547 msgid "python -m http.server --bind 127.0.0.1" msgstr "python -m http.server --bind 127.0.0.1" -#: ../../library/http.server.rst:547 +#: ../../library/http.server.rst:553 msgid "Support IPv6 in the ``--bind`` option." msgstr "於 ``--bind`` 選項中支援 IPv6。" -#: ../../library/http.server.rst:552 +#: ../../library/http.server.rst:558 msgid "" "Specifies a directory to which it should serve the files. By default, the " "server uses the current directory. For example, the following command uses a " -"specific directory::" +"specific directory:" msgstr "" -#: ../../library/http.server.rst:556 +#: ../../library/http.server.rst:562 msgid "python -m http.server --directory /tmp/" msgstr "python -m http.server --directory /tmp/" -#: ../../library/http.server.rst:562 +#: ../../library/http.server.rst:570 msgid "" "Specifies the HTTP version to which the server is conformant. By default, " "the server is conformant to HTTP/1.0. For example, the following command " -"runs an HTTP/1.1 conformant server::" +"runs an HTTP/1.1 conformant server:" msgstr "" -#: ../../library/http.server.rst:566 +#: ../../library/http.server.rst:574 msgid "python -m http.server --protocol HTTP/1.1" msgstr "python -m http.server --protocol HTTP/1.1" -#: ../../library/http.server.rst:572 +#: ../../library/http.server.rst:582 msgid "" ":class:`CGIHTTPRequestHandler` can be enabled in the command line by passing " "the ``--cgi`` option::" msgstr "" -#: ../../library/http.server.rst:575 +#: ../../library/http.server.rst:585 msgid "python -m http.server --cgi" msgstr "python -m http.server --cgi" -#: ../../library/http.server.rst:579 +#: ../../library/http.server.rst:589 msgid "" ":mod:`!http.server` command line ``--cgi`` support is being removed because :" "class:`CGIHTTPRequestHandler` is being removed." msgstr "" -#: ../../library/http.server.rst:584 +#: ../../library/http.server.rst:594 msgid "" ":class:`CGIHTTPRequestHandler` and the ``--cgi`` command-line option are not " "intended for use by untrusted clients and may be vulnerable to exploitation. " "Always use within a secure environment." msgstr "" -#: ../../library/http.server.rst:590 -msgid "Specifies a TLS certificate chain for HTTPS connections::" +#: ../../library/http.server.rst:600 +msgid "Specifies a TLS certificate chain for HTTPS connections:" msgstr "" -#: ../../library/http.server.rst:592 +#: ../../library/http.server.rst:602 msgid "python -m http.server --tls-cert fullchain.pem" msgstr "python -m http.server --tls-cert fullchain.pem" -#: ../../library/http.server.rst:598 +#: ../../library/http.server.rst:610 msgid "Specifies a private key file for HTTPS connections." msgstr "" -#: ../../library/http.server.rst:600 +#: ../../library/http.server.rst:612 ../../library/http.server.rst:627 msgid "This option requires ``--tls-cert`` to be specified." msgstr "" -#: ../../library/http.server.rst:606 -msgid "Specifies the password file for password-protected private keys::" +#: ../../library/http.server.rst:618 +msgid "Specifies the password file for password-protected private keys:" msgstr "" -#: ../../library/http.server.rst:608 +#: ../../library/http.server.rst:620 msgid "" "python -m http.server \\\n" " --tls-cert cert.pem \\\n" @@ -781,30 +781,26 @@ msgstr "" " --tls-key key.pem \\\n" " --tls-password-file password.txt" -#: ../../library/http.server.rst:613 -msgid "This option requires `--tls-cert`` to be specified." -msgstr "" - -#: ../../library/http.server.rst:621 +#: ../../library/http.server.rst:635 msgid "Security considerations" msgstr "安全性注意事項" -#: ../../library/http.server.rst:625 +#: ../../library/http.server.rst:639 msgid "" ":class:`SimpleHTTPRequestHandler` will follow symbolic links when handling " "requests, this makes it possible for files outside of the specified " "directory to be served." msgstr "" -#: ../../library/http.server.rst:629 +#: ../../library/http.server.rst:643 msgid "" "Methods :meth:`BaseHTTPRequestHandler.send_header` and :meth:" -"`BaseHTTPRequestHandler.send_response_only` assume sanitized input and does " +"`BaseHTTPRequestHandler.send_response_only` assume sanitized input and do " "not perform input validation such as checking for the presence of CRLF " "sequences. Untrusted input may result in HTTP Header injection attacks." msgstr "" -#: ../../library/http.server.rst:634 +#: ../../library/http.server.rst:648 msgid "" "Earlier versions of Python did not scrub control characters from the log " "messages emitted to stderr from ``python -m http.server`` or the default :" @@ -813,7 +809,7 @@ msgid "" "codes to your terminal." msgstr "" -#: ../../library/http.server.rst:640 +#: ../../library/http.server.rst:654 msgid "Control characters are scrubbed in stderr logs." msgstr "" @@ -841,10 +837,10 @@ msgstr "URL(統一資源定位器)" msgid "httpd" msgstr "httpd" -#: ../../library/http.server.rst:623 +#: ../../library/http.server.rst:637 msgid "http.server" msgstr "http.server" -#: ../../library/http.server.rst:623 +#: ../../library/http.server.rst:637 msgid "security" msgstr "security(安全)" diff --git a/using/windows.po b/using/windows.po index 6dc06136864..6ec228010ac 100644 --- a/using/windows.po +++ b/using/windows.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-25 00:21+0000\n" +"POT-Creation-Date: 2026-04-16 00:29+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -622,8 +622,8 @@ msgid "Environment Variable" msgstr "" #: ../../using/windows.rst:419 ../../using/windows.rst:725 -#: ../../using/windows.rst:1458 ../../using/windows.rst:1478 -#: ../../using/windows.rst:2068 +#: ../../using/windows.rst:1561 ../../using/windows.rst:1581 +#: ../../using/windows.rst:2171 msgid "Description" msgstr "描述" @@ -815,7 +815,7 @@ msgid "" "format`` would be specified as ``{\"list\": {\"format\": \"table\"}}``." msgstr "" -#: ../../using/windows.rst:517 ../../using/windows.rst:1824 +#: ../../using/windows.rst:517 ../../using/windows.rst:1927 msgid "Shebang lines" msgstr "" @@ -855,15 +855,15 @@ msgstr "``/usr/local/bin/``" msgid "````" msgstr "````" -#: ../../using/windows.rst:535 ../../using/windows.rst:1842 +#: ../../using/windows.rst:535 ../../using/windows.rst:1945 msgid "For example, if the first line of your script starts with" msgstr "" -#: ../../using/windows.rst:537 ../../using/windows.rst:1844 +#: ../../using/windows.rst:537 ../../using/windows.rst:1947 msgid "#! /usr/bin/python" msgstr "#! /usr/bin/python" -#: ../../using/windows.rst:541 ../../using/windows.rst:1848 +#: ../../using/windows.rst:541 ../../using/windows.rst:1951 msgid "" "The default Python or an active virtual environment will be located and " "used. As many Python scripts written to work on Unix will already have this " @@ -1241,17 +1241,29 @@ msgid "" "other than a Python runtime." msgstr "" -#: ../../using/windows.rst:786 ../../using/windows.rst:1637 +#: ../../using/windows.rst:783 +msgid "``source_settings``" +msgstr "" + +#: ../../using/windows.rst:784 +msgid "" +"A mapping from source URL to settings specific to that index. When multiple " +"configuration files include this section, URL settings are added or " +"overwritten, but individual settings are not merged. These settings are " +"currently only for :ref:`index signatures `." +msgstr "" + +#: ../../using/windows.rst:794 ../../using/windows.rst:1740 msgid "Installing free-threaded binaries" msgstr "" -#: ../../using/windows.rst:790 +#: ../../using/windows.rst:798 msgid "" "Pre-built distributions of the free-threaded build are available by " "installing tags with the ``t`` suffix." msgstr "" -#: ../../using/windows.rst:793 +#: ../../using/windows.rst:801 msgid "" "$> py install 3.14t\n" "$> py install 3.14t-arm64\n" @@ -1261,7 +1273,7 @@ msgstr "" "$> py install 3.14t-arm64\n" "$> py install 3.14t-32" -#: ../../using/windows.rst:799 +#: ../../using/windows.rst:807 msgid "" "This will install and register as normal. If you have no other runtimes " "installed, then ``python`` will launch this one. Otherwise, you will need to " @@ -1270,11 +1282,135 @@ msgid "" "commands." msgstr "" -#: ../../using/windows.rst:807 ../../using/windows.rst:819 +#: ../../using/windows.rst:816 +msgid "Index signatures" +msgstr "" + +#: ../../using/windows.rst:820 +msgid "" +"Index files may be signed to detect tampering. A signature is a catalog file " +"at the same URL as the index with ``.cat`` added to the filename. The " +"catalog file should contain the hash of its matching index file, and should " +"be signed with a valid Authenticode signature. This allows standard tooling " +"(on Windows) to generate a signature, and any certificate may be used as " +"long as the client operating system already trusts its certification " +"authority (root CA)." +msgstr "" + +#: ../../using/windows.rst:827 +msgid "" +"Index signatures are only downloaded and checked when the local " +"configuration's ``source_settings`` section includes the index URL and " +"``requires_signature`` is true, or the index JSON contains " +"``requires_signature`` set to true. When the setting exists in local " +"configuration, even when false, settings in the index are ignored." +msgstr "" + +#: ../../using/windows.rst:833 +msgid "" +"As well as requiring a valid signature, the ``required_root_subject`` and " +"``required_publisher_subject`` settings can further restrict acceptable " +"signatures based on the certificate Subject fields. Any attribute specified " +"in the configuration must match the attribute in the certificate (additional " +"attributes in the certificate are ignored). Typical attributes are ``CN=`` " +"for the common name, ``O=`` for the organizational unit, and ``C=`` for the " +"publisher's country." +msgstr "" + +#: ../../using/windows.rst:841 +msgid "" +"Finally, the ``required_publisher_eku`` setting allows requiring that a " +"specific Enhanced Key Usage (EKU) has been assigned to the publisher " +"certificate. For example, the EKU ``1.3.6.1.5.5.7.3.3`` indicates that the " +"certificate was intended for code signing (as opposed to server or client " +"authentication). In combination with a specific root CA, this provides " +"another mechanism to verify a legitimate signature." +msgstr "" + +#: ../../using/windows.rst:848 +msgid "" +"This is an example ``source_settings`` section from a configuration file. In " +"this case, the publisher of the feed is uniquely identified by the " +"combination of the Microsoft Identity Verification root and the EKU assigned " +"by that root. The signature for this case would be found at ``https://www." +"python.org/ftp/python/index-windows.json.cat``." +msgstr "" + +#: ../../using/windows.rst:854 +msgid "" +"{\n" +" \"source_settings\": {\n" +" \"https://www.python.org/ftp/python/index-windows.json\": {\n" +" \"requires_signature\": true,\n" +" \"required_root_subject\": \"CN=Microsoft Identity Verification Root " +"Certificate Authority 2020\",\n" +" \"required_publisher_subject\": \"CN=Python Software Foundation\",\n" +" \"required_publisher_eku\": " +"\"1.3.6.1.4.1.311.97.608394634.79987812.305991749.578777327\"\n" +" }\n" +" }\n" +"}" +msgstr "" + +#: ../../using/windows.rst:867 +msgid "" +"The same settings could be specified in the ``index.json`` file instead. In " +"this case, the root and EKU are omitted, meaning that the signature must be " +"valid and have a specific common name in the publisher's certificate, but no " +"other checks are used." +msgstr "" + +#: ../../using/windows.rst:872 +msgid "" +"{\n" +" \"requires_signature\": true,\n" +" \"required_publisher_subject\": \"CN=Python Software Foundation\",\n" +" \"versions\": [\n" +" // ...\n" +" ]\n" +"}" +msgstr "" + +#: ../../using/windows.rst:882 +msgid "" +"When settings from inside a feed are used, the user is notified and the " +"settings are shown in the log file or verbose output. It is recommended to " +"copy these settings into a local configuration file for feeds that will be " +"used frequently, so that unauthorised modifications to the feed cannot " +"disable verification." +msgstr "" + +#: ../../using/windows.rst:887 +msgid "" +"It is not possible to override the location of the signature file in the " +"feed or through a configuration file. Administrators can provide their own " +"``source_settings`` in a mandatory configuration file (see :ref:`pymanager-" +"admin-config`)." +msgstr "" + +#: ../../using/windows.rst:892 +msgid "" +"If signature validation fails, you will be notified and prompted to " +"continue. When interactive confirmation is not allowed (for example, because " +"``--yes`` was specified), it will always abort. To use a feed with invalid " +"configuration in this scenario, you must provide a configuration file that " +"disables signature checking for that feed." +msgstr "" + +#: ../../using/windows.rst:898 +msgid "" +"\"source_settings\": {\n" +" \"https://www.example.com/feed-with-invalid-signature.json\": {\n" +" \"requires_signature\": false\n" +" }\n" +"}" +msgstr "" + +#: ../../using/windows.rst:910 ../../using/windows.rst:922 msgid "Troubleshooting" msgstr "" -#: ../../using/windows.rst:809 +#: ../../using/windows.rst:912 msgid "" "If your Python install manager does not seem to be working correctly, please " "work through these tests and fixes to see if it helps. If not, please report " @@ -1283,25 +1419,25 @@ msgid "" "by default)." msgstr "" -#: ../../using/windows.rst:823 +#: ../../using/windows.rst:926 msgid "Symptom" msgstr "" -#: ../../using/windows.rst:824 +#: ../../using/windows.rst:927 msgid "Things to try" msgstr "" -#: ../../using/windows.rst:826 +#: ../../using/windows.rst:929 msgid "" "``python`` gives me a \"command not found\" error or opens the Store app " "when I type it in my terminal." msgstr "" -#: ../../using/windows.rst:828 ../../using/windows.rst:847 +#: ../../using/windows.rst:931 ../../using/windows.rst:950 msgid "Did you :ref:`install the Python install manager `?" msgstr "" -#: ../../using/windows.rst:831 ../../using/windows.rst:850 +#: ../../using/windows.rst:934 ../../using/windows.rst:953 msgid "" "Click Start, open \"Manage app execution aliases\", and check that the " "aliases for \"Python (default)\" are enabled. If they already are, try " @@ -1309,11 +1445,11 @@ msgid "" "windowed)\" and \"Python install manager\" commands may also need refreshing." msgstr "" -#: ../../using/windows.rst:838 +#: ../../using/windows.rst:941 msgid "Check that the ``py`` and ``pymanager`` commands work." msgstr "" -#: ../../using/windows.rst:841 ../../using/windows.rst:857 +#: ../../using/windows.rst:944 ../../using/windows.rst:960 msgid "" "Ensure your :envvar:`PATH` variable contains the entry for ``%UserProfile%" "\\AppData\\Local\\Microsoft\\WindowsApps``. The operating system includes " @@ -1321,59 +1457,59 @@ msgid "" "will not be found." msgstr "" -#: ../../using/windows.rst:846 +#: ../../using/windows.rst:949 msgid "" "``py`` gives me a \"command not found\" error when I type it in my terminal." msgstr "" -#: ../../using/windows.rst:862 +#: ../../using/windows.rst:965 msgid "" "``py`` gives me a \"can't open file\" error when I type commands in my " "terminal." msgstr "" -#: ../../using/windows.rst:864 +#: ../../using/windows.rst:967 msgid "" "This usually means you have the legacy launcher installed and it has " "priority over the Python install manager. To remove, click Start, open " "\"Installed apps\", search for \"Python launcher\" and uninstall it." msgstr "" -#: ../../using/windows.rst:869 +#: ../../using/windows.rst:972 msgid "``python`` doesn't launch the same runtime as ``py``" msgstr "" -#: ../../using/windows.rst:870 +#: ../../using/windows.rst:973 msgid "" "Click Start, open \"Installed apps\", look for any existing Python runtimes, " "and either remove them or Modify and disable the :envvar:`PATH` options." msgstr "" -#: ../../using/windows.rst:874 +#: ../../using/windows.rst:977 msgid "" "Click Start, open \"Manage app execution aliases\", and check that your " "``python.exe`` alias is set to \"Python (default)\"" msgstr "" -#: ../../using/windows.rst:877 +#: ../../using/windows.rst:980 msgid "``python`` and ``py`` don't launch the runtime I expect" msgstr "" -#: ../../using/windows.rst:878 +#: ../../using/windows.rst:981 msgid "" "Check your :envvar:`PYTHON_MANAGER_DEFAULT` environment variable or " "``default_tag`` configuration. The ``py list`` command will show your " "default based on these settings." msgstr "" -#: ../../using/windows.rst:883 +#: ../../using/windows.rst:986 msgid "" "Installs that are managed by the Python install manager will be chosen ahead " "of unmanaged installs. Use ``py install`` to install the runtime you expect, " "or configure your default tag." msgstr "" -#: ../../using/windows.rst:889 +#: ../../using/windows.rst:992 msgid "" "Prerelease and experimental installs that are not managed by the Python " "install manager may be chosen ahead of stable releases. Configure your " @@ -1381,29 +1517,29 @@ msgid "" "install``." msgstr "" -#: ../../using/windows.rst:894 +#: ../../using/windows.rst:997 msgid "" "``pythonw`` or ``pyw`` don't launch the same runtime as ``python`` or ``py``" msgstr "" -#: ../../using/windows.rst:895 +#: ../../using/windows.rst:998 msgid "" "Click Start, open \"Manage app execution aliases\", and check that your " "``pythonw.exe`` and ``pyw.exe`` aliases are consistent with your others." msgstr "" -#: ../../using/windows.rst:898 +#: ../../using/windows.rst:1001 msgid "" "``pip`` gives me a \"command not found\" error when I type it in my terminal." msgstr "" -#: ../../using/windows.rst:899 ../../using/windows.rst:911 +#: ../../using/windows.rst:1002 ../../using/windows.rst:1014 msgid "" "Have you activated a virtual environment? Run the ``." "venv\\Scripts\\activate`` script in your terminal to activate." msgstr "" -#: ../../using/windows.rst:903 +#: ../../using/windows.rst:1006 msgid "" "The package may be available but missing the generated executable. We " "recommend using the ``python -m pip`` command instead. Running ``py install " @@ -1412,11 +1548,11 @@ msgid "" "commands such as ``pip`` (and other installed packages) available." msgstr "" -#: ../../using/windows.rst:910 +#: ../../using/windows.rst:1013 msgid "I installed a package with ``pip`` but its command is not found." msgstr "" -#: ../../using/windows.rst:915 +#: ../../using/windows.rst:1018 msgid "" "New packages do not automatically have global shortcuts created by the " "Python install manager. Similarly, uninstalled packages do not have their " @@ -1424,11 +1560,11 @@ msgid "" "shortcuts for newly installed packages." msgstr "" -#: ../../using/windows.rst:921 +#: ../../using/windows.rst:1024 msgid "Typing ``script-name.py`` in the terminal opens in a new window." msgstr "" -#: ../../using/windows.rst:922 +#: ../../using/windows.rst:1025 msgid "" "This is a known limitation of the operating system. Either specify ``py`` " "before the script name, create a batch file containing ``@py \"%~dpn0.py\" " @@ -1436,68 +1572,68 @@ msgid "" "select it as the association for scripts." msgstr "" -#: ../../using/windows.rst:927 +#: ../../using/windows.rst:1030 msgid "Drag-dropping files onto a script doesn't work" msgstr "" -#: ../../using/windows.rst:928 +#: ../../using/windows.rst:1031 msgid "" "This is a known limitation of the operating system. It is supported with the " "`legacy launcher`_, or with the Python install manager when installed from " "the MSI." msgstr "" -#: ../../using/windows.rst:932 +#: ../../using/windows.rst:1035 msgid "I have installed the Python install manager multiple times." msgstr "" -#: ../../using/windows.rst:933 +#: ../../using/windows.rst:1036 msgid "" "It is possible to install from the Store or WinGet, from the MSIX on the " "Python website, and from the MSI, all at once. They are all compatible and " "will share configuration and runtimes." msgstr "" -#: ../../using/windows.rst:938 +#: ../../using/windows.rst:1041 msgid "" "See the earlier :ref:`pymanager-advancedinstall` section for ways to " "uninstall the install manager other than the typical Installed Apps (Add and " "Remove Programs) settings page." msgstr "" -#: ../../using/windows.rst:942 +#: ../../using/windows.rst:1045 msgid "My old ``py.ini`` settings no longer work." msgstr "" -#: ../../using/windows.rst:943 +#: ../../using/windows.rst:1046 msgid "" "The new Python install manager no longer supports this configuration file or " "its settings, and so it will be ignored. See :ref:`pymanager-config` for " "information about configuration settings." msgstr "" -#: ../../using/windows.rst:950 +#: ../../using/windows.rst:1053 msgid "The embeddable package" msgstr "" -#: ../../using/windows.rst:954 +#: ../../using/windows.rst:1057 msgid "" "The embedded distribution is a ZIP file containing a minimal Python " "environment. It is intended for acting as part of another application, " "rather than being directly accessed by end-users." msgstr "" -#: ../../using/windows.rst:958 +#: ../../using/windows.rst:1061 msgid "" "To install an embedded distribution, we recommend using ``py install`` with " "the ``--target`` option:" msgstr "" -#: ../../using/windows.rst:961 +#: ../../using/windows.rst:1064 msgid "$> py install 3.14-embed --target=" msgstr "$> py install 3.14-embed --target=" -#: ../../using/windows.rst:965 +#: ../../using/windows.rst:1068 msgid "" "When extracted, the embedded distribution is (almost) fully isolated from " "the user's system, including environment variables, system registry " @@ -1508,14 +1644,14 @@ msgid "" "documentation are not included." msgstr "" -#: ../../using/windows.rst:972 +#: ../../using/windows.rst:1075 msgid "" "A default ``._pth`` file is included, which further restricts the default " "search paths (as described below in :ref:`windows_finding_modules`). This " "file is intended for embedders to modify as necessary." msgstr "" -#: ../../using/windows.rst:976 +#: ../../using/windows.rst:1079 msgid "" "Third-party packages should be installed by the application installer " "alongside the embedded distribution. Using pip to manage dependencies as for " @@ -1526,16 +1662,16 @@ msgid "" "compatibility with newer versions before providing updates to users." msgstr "" -#: ../../using/windows.rst:984 +#: ../../using/windows.rst:1087 msgid "" "The two recommended use cases for this distribution are described below." msgstr "" -#: ../../using/windows.rst:987 +#: ../../using/windows.rst:1090 msgid "Python application" msgstr "Python 應用程式" -#: ../../using/windows.rst:989 +#: ../../using/windows.rst:1092 msgid "" "An application written in Python does not necessarily require users to be " "aware of that fact. The embedded distribution may be used in this case to " @@ -1544,7 +1680,7 @@ msgid "" "there are two options." msgstr "" -#: ../../using/windows.rst:995 +#: ../../using/windows.rst:1098 msgid "" "Using a specialized executable as a launcher requires some coding, but " "provides the most transparent experience for users. With a customized " @@ -1555,7 +1691,7 @@ msgid "" "line." msgstr "" -#: ../../using/windows.rst:1002 +#: ../../using/windows.rst:1105 msgid "" "The simpler approach is to provide a batch file or generated shortcut that " "directly calls the ``python.exe`` or ``pythonw.exe`` with the required " @@ -1564,7 +1700,7 @@ msgid "" "from other running Python processes or file associations." msgstr "" -#: ../../using/windows.rst:1008 +#: ../../using/windows.rst:1111 msgid "" "With the latter approach, packages should be installed as directories " "alongside the Python executable to ensure they are available on the path. " @@ -1573,11 +1709,11 @@ msgid "" "application." msgstr "" -#: ../../using/windows.rst:1014 +#: ../../using/windows.rst:1117 msgid "Embedding Python" msgstr "嵌入 Python" -#: ../../using/windows.rst:1016 +#: ../../using/windows.rst:1119 msgid "" "Applications written in native code often require some form of scripting " "language, and the embedded Python distribution can be used for this purpose. " @@ -1588,7 +1724,7 @@ msgid "" "interpreter." msgstr "" -#: ../../using/windows.rst:1023 +#: ../../using/windows.rst:1126 msgid "" "As with the application use, packages can be installed to any location as " "there is an opportunity to specify search paths before initializing the " @@ -1596,11 +1732,11 @@ msgid "" "the embedded distribution and a regular installation." msgstr "" -#: ../../using/windows.rst:1032 +#: ../../using/windows.rst:1135 msgid "The nuget.org packages" msgstr "nuget.org 套件" -#: ../../using/windows.rst:1036 +#: ../../using/windows.rst:1139 msgid "" "The nuget.org package is a reduced size Python environment intended for use " "on continuous integration and build systems that do not have a system-wide " @@ -1608,14 +1744,14 @@ msgid "" "works perfectly fine for packages containing build-time tools." msgstr "" -#: ../../using/windows.rst:1041 +#: ../../using/windows.rst:1144 msgid "" "Visit `nuget.org `_ for the most up-to-date " "information on using nuget. What follows is a summary that is sufficient for " "Python developers." msgstr "" -#: ../../using/windows.rst:1045 +#: ../../using/windows.rst:1148 msgid "" "The ``nuget.exe`` command line tool may be downloaded directly from " "``https://aka.ms/nugetclidl``, for example, using curl or PowerShell. With " @@ -1623,7 +1759,7 @@ msgid "" "installed using::" msgstr "" -#: ../../using/windows.rst:1050 +#: ../../using/windows.rst:1153 msgid "" "nuget.exe install python -ExcludeVersion -OutputDirectory .\n" "nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory ." @@ -1631,7 +1767,7 @@ msgstr "" "nuget.exe install python -ExcludeVersion -OutputDirectory .\n" "nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory ." -#: ../../using/windows.rst:1053 +#: ../../using/windows.rst:1156 msgid "" "To select a particular version, add a ``-Version 3.x.y``. The output " "directory may be changed from ``.``, and the package will be installed into " @@ -1641,7 +1777,7 @@ msgid "" "directory that contains the Python installation:" msgstr "" -#: ../../using/windows.rst:1060 +#: ../../using/windows.rst:1163 msgid "" "# Without -ExcludeVersion\n" "> .\\python.3.5.2\\tools\\python.exe -V\n" @@ -1659,7 +1795,7 @@ msgstr "" "> .\\python\\tools\\python.exe -V\n" "Python 3.5.2" -#: ../../using/windows.rst:1070 +#: ../../using/windows.rst:1173 msgid "" "In general, nuget packages are not upgradeable, and newer versions should be " "installed side-by-side and referenced using the full path. Alternatively, " @@ -1667,7 +1803,7 @@ msgid "" "will do this automatically if they do not preserve files between builds." msgstr "" -#: ../../using/windows.rst:1075 +#: ../../using/windows.rst:1178 msgid "" "Alongside the ``tools`` directory is a ``build\\native`` directory. This " "contains a MSBuild properties file ``python.props`` that can be used in a C+" @@ -1675,7 +1811,7 @@ msgid "" "automatically use the headers and import libraries in your build." msgstr "" -#: ../../using/windows.rst:1080 +#: ../../using/windows.rst:1183 msgid "" "The package information pages on nuget.org are `www.nuget.org/packages/" "python `_ for the 64-bit version, " @@ -1684,11 +1820,11 @@ msgid "" "`_ for the ARM64 version" msgstr "" -#: ../../using/windows.rst:1088 +#: ../../using/windows.rst:1191 msgid "Free-threaded packages" msgstr "" -#: ../../using/windows.rst:1092 +#: ../../using/windows.rst:1195 msgid "" "Packages containing free-threaded binaries are named `python-freethreaded " "`_ for the 64-bit " @@ -1699,46 +1835,46 @@ msgid "" "exe`` entry points, both of which run free threaded." msgstr "" -#: ../../using/windows.rst:1103 +#: ../../using/windows.rst:1206 msgid "Alternative bundles" msgstr "" -#: ../../using/windows.rst:1105 +#: ../../using/windows.rst:1208 msgid "" "Besides the standard CPython distribution, there are modified packages " "including additional functionality. The following is a list of popular " "versions and their key features:" msgstr "" -#: ../../using/windows.rst:1109 +#: ../../using/windows.rst:1212 msgid "`ActivePython `_" msgstr "`ActivePython `_" -#: ../../using/windows.rst:1110 +#: ../../using/windows.rst:1213 msgid "Installer with multi-platform compatibility, documentation, PyWin32" msgstr "" -#: ../../using/windows.rst:1112 +#: ../../using/windows.rst:1215 msgid "`Anaconda `_" msgstr "`Anaconda `_" -#: ../../using/windows.rst:1113 +#: ../../using/windows.rst:1216 msgid "" "Popular scientific modules (such as numpy, scipy and pandas) and the " "``conda`` package manager." msgstr "" -#: ../../using/windows.rst:1116 +#: ../../using/windows.rst:1219 msgid "" "`Enthought Deployment Manager `_" msgstr "" "`Enthought Deployment Manager `_" -#: ../../using/windows.rst:1117 +#: ../../using/windows.rst:1220 msgid "\"The Next Generation Python Environment and Package Manager\"." msgstr "" -#: ../../using/windows.rst:1119 +#: ../../using/windows.rst:1222 msgid "" "Previously Enthought provided Canopy, but it `reached end of life in 2016 " "`_." msgstr "" -#: ../../using/windows.rst:1122 +#: ../../using/windows.rst:1225 msgid "`WinPython `_" msgstr "`WinPython `_" -#: ../../using/windows.rst:1123 +#: ../../using/windows.rst:1226 msgid "" "Windows-specific distribution with prebuilt scientific packages and tools " "for building packages." msgstr "" -#: ../../using/windows.rst:1126 +#: ../../using/windows.rst:1229 msgid "" "Note that these packages may not include the latest versions of Python or " "other libraries, and are not maintained or supported by the core Python team." msgstr "" -#: ../../using/windows.rst:1131 +#: ../../using/windows.rst:1234 msgid "Supported Windows versions" msgstr "" -#: ../../using/windows.rst:1133 +#: ../../using/windows.rst:1236 msgid "" "As specified in :pep:`11`, a Python release only supports a Windows platform " "while Microsoft considers the platform under extended support. This means " @@ -1775,17 +1911,17 @@ msgid "" "please install Python 3.12." msgstr "" -#: ../../using/windows.rst:1143 ../../using/windows.rst:1424 +#: ../../using/windows.rst:1246 ../../using/windows.rst:1527 msgid "Removing the MAX_PATH limitation" msgstr "" -#: ../../using/windows.rst:1145 ../../using/windows.rst:1426 +#: ../../using/windows.rst:1248 ../../using/windows.rst:1529 msgid "" "Windows historically has limited path lengths to 260 characters. This meant " "that paths longer than this would not resolve and errors would result." msgstr "" -#: ../../using/windows.rst:1148 +#: ../../using/windows.rst:1251 msgid "" "In the latest versions of Windows, this limitation can be expanded to over " "32,000 characters. Your administrator will need to activate the \"Enable " @@ -1794,36 +1930,36 @@ msgid "" "``HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem``." msgstr "" -#: ../../using/windows.rst:1153 ../../using/windows.rst:1435 +#: ../../using/windows.rst:1256 ../../using/windows.rst:1538 msgid "" "This allows the :func:`open` function, the :mod:`os` module and most other " "path functionality to accept and return paths longer than 260 characters." msgstr "" -#: ../../using/windows.rst:1156 +#: ../../using/windows.rst:1259 msgid "" "After changing the above option and rebooting, no further configuration is " "required." msgstr "" -#: ../../using/windows.rst:1163 +#: ../../using/windows.rst:1266 msgid "UTF-8 mode" msgstr "UTF-8 模式" -#: ../../using/windows.rst:1167 +#: ../../using/windows.rst:1270 msgid "" "Windows still uses legacy encodings for the system encoding (the ANSI Code " "Page). Python uses it for the default encoding of text files (e.g. :func:" "`locale.getencoding`)." msgstr "" -#: ../../using/windows.rst:1171 +#: ../../using/windows.rst:1274 msgid "" "This may cause issues because UTF-8 is widely used on the internet and most " "Unix systems, including WSL (Windows Subsystem for Linux)." msgstr "" -#: ../../using/windows.rst:1174 +#: ../../using/windows.rst:1277 msgid "" "You can use the :ref:`Python UTF-8 Mode ` to change the default " "text encoding to UTF-8. You can enable the :ref:`Python UTF-8 Mode ` is enabled, you can still use " "the system encoding (the ANSI Code Page) via the \"mbcs\" codec." msgstr "" -#: ../../using/windows.rst:1183 +#: ../../using/windows.rst:1286 msgid "" "Note that adding ``PYTHONUTF8=1`` to the default environment variables will " "affect all Python 3.7+ applications on your system. If you have any Python " @@ -1847,45 +1983,45 @@ msgid "" "utf8`` command line option." msgstr "" -#: ../../using/windows.rst:1190 +#: ../../using/windows.rst:1293 msgid "" "Even when UTF-8 mode is disabled, Python uses UTF-8 by default on Windows " "for:" msgstr "" -#: ../../using/windows.rst:1193 +#: ../../using/windows.rst:1296 msgid "Console I/O including standard I/O (see :pep:`528` for details)." msgstr "" -#: ../../using/windows.rst:1194 +#: ../../using/windows.rst:1297 msgid "" "The :term:`filesystem encoding ` " "(see :pep:`529` for details)." msgstr "" -#: ../../using/windows.rst:1201 +#: ../../using/windows.rst:1304 msgid "Finding modules" msgstr "找尋模組" -#: ../../using/windows.rst:1203 +#: ../../using/windows.rst:1306 msgid "" "These notes supplement the description at :ref:`sys-path-init` with detailed " "Windows notes." msgstr "" -#: ../../using/windows.rst:1206 +#: ../../using/windows.rst:1309 msgid "" "When no ``._pth`` file is found, this is how :data:`sys.path` is populated " "on Windows:" msgstr "" -#: ../../using/windows.rst:1209 +#: ../../using/windows.rst:1312 msgid "" "An empty entry is added at the start, which corresponds to the current " "directory." msgstr "" -#: ../../using/windows.rst:1212 +#: ../../using/windows.rst:1315 msgid "" "If the environment variable :envvar:`PYTHONPATH` exists, as described in :" "ref:`using-on-envvars`, its entries are added next. Note that on Windows, " @@ -1893,7 +2029,7 @@ msgid "" "from the colon used in drive identifiers (``C:\\`` etc.)." msgstr "" -#: ../../using/windows.rst:1217 +#: ../../using/windows.rst:1320 msgid "" "Additional \"application paths\" can be added in the registry as subkeys of :" "samp:`\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\{version}\\\\PythonPath` under " @@ -1903,7 +2039,7 @@ msgid "" "installers only use HKLM, so HKCU is typically empty.)" msgstr "" -#: ../../using/windows.rst:1224 +#: ../../using/windows.rst:1327 msgid "" "If the environment variable :envvar:`PYTHONHOME` is set, it is assumed as " "\"Python Home\". Otherwise, the path of the main Python executable is used " @@ -1914,31 +2050,31 @@ msgid "" "PythonPath stored in the registry." msgstr "" -#: ../../using/windows.rst:1232 +#: ../../using/windows.rst:1335 msgid "" "If the Python Home cannot be located, no :envvar:`PYTHONPATH` is specified " "in the environment, and no registry entries can be found, a default path " "with relative entries is used (e.g. ``.\\Lib;.\\plat-win``, etc)." msgstr "" -#: ../../using/windows.rst:1236 +#: ../../using/windows.rst:1339 msgid "" "If a ``pyvenv.cfg`` file is found alongside the main executable or in the " "directory one level above the executable, the following variations apply:" msgstr "" -#: ../../using/windows.rst:1239 +#: ../../using/windows.rst:1342 msgid "" "If ``home`` is an absolute path and :envvar:`PYTHONHOME` is not set, this " "path is used instead of the path to the main executable when deducing the " "home location." msgstr "" -#: ../../using/windows.rst:1243 +#: ../../using/windows.rst:1346 msgid "The end result of all this is:" msgstr "最終這所有的結果為:" -#: ../../using/windows.rst:1245 +#: ../../using/windows.rst:1348 msgid "" "When running :file:`python.exe`, or any other .exe in the main Python " "directory (either an installed version, or directly from the PCbuild " @@ -1946,7 +2082,7 @@ msgid "" "ignored. Other \"application paths\" in the registry are always read." msgstr "" -#: ../../using/windows.rst:1250 +#: ../../using/windows.rst:1353 msgid "" "When Python is hosted in another .exe (different directory, embedded via " "COM, etc), the \"Python Home\" will not be deduced, so the core path from " @@ -1954,20 +2090,20 @@ msgid "" "always read." msgstr "" -#: ../../using/windows.rst:1254 +#: ../../using/windows.rst:1357 msgid "" "If Python can't find its home and there are no registry value (frozen .exe, " "some very strange installation setup) you get a path with some default, but " "relative, paths." msgstr "" -#: ../../using/windows.rst:1258 +#: ../../using/windows.rst:1361 msgid "" "For those who want to bundle Python into their application or distribution, " "the following advice will prevent conflicts with other installations:" msgstr "" -#: ../../using/windows.rst:1261 +#: ../../using/windows.rst:1364 msgid "" "Include a ``._pth`` file alongside your executable containing the " "directories to include. This will ignore paths listed in the registry and " @@ -1975,20 +2111,20 @@ msgid "" "listed." msgstr "" -#: ../../using/windows.rst:1266 +#: ../../using/windows.rst:1369 msgid "" "If you are loading :file:`python3.dll` or :file:`python37.dll` in your own " "executable, explicitly set :c:member:`PyConfig.module_search_paths` before :" "c:func:`Py_InitializeFromConfig`." msgstr "" -#: ../../using/windows.rst:1270 +#: ../../using/windows.rst:1373 msgid "" "Clear and/or overwrite :envvar:`PYTHONPATH` and set :envvar:`PYTHONHOME` " "before launching :file:`python.exe` from your application." msgstr "" -#: ../../using/windows.rst:1273 +#: ../../using/windows.rst:1376 msgid "" "If you cannot use the previous suggestions (for example, you are a " "distribution that allows people to run :file:`python.exe` directly), ensure " @@ -1997,7 +2133,7 @@ msgid "" "correctly named ZIP file will be detected instead.)" msgstr "" -#: ../../using/windows.rst:1279 +#: ../../using/windows.rst:1382 msgid "" "These will ensure that the files in a system-wide installation will not take " "precedence over the copy of the standard library bundled with your " @@ -2007,19 +2143,19 @@ msgid "" "packages." msgstr "" -#: ../../using/windows.rst:1287 +#: ../../using/windows.rst:1390 msgid "" "Add ``._pth`` file support and removes ``applocal`` option from ``pyvenv." "cfg``." msgstr "" -#: ../../using/windows.rst:1292 +#: ../../using/windows.rst:1395 msgid "" "Add :file:`python{XX}.zip` as a potential landmark when directly adjacent to " "the executable." msgstr "" -#: ../../using/windows.rst:1297 +#: ../../using/windows.rst:1400 msgid "" "Modules specified in the registry under ``Modules`` (not ``PythonPath``) may " "be imported by :class:`importlib.machinery.WindowsRegistryFinder`. This " @@ -2027,87 +2163,87 @@ msgid "" "explicitly added to :data:`sys.meta_path` in the future." msgstr "" -#: ../../using/windows.rst:1303 +#: ../../using/windows.rst:1406 msgid "Additional modules" msgstr "額外的模組" -#: ../../using/windows.rst:1305 +#: ../../using/windows.rst:1408 msgid "" "Even though Python aims to be portable among all platforms, there are " "features that are unique to Windows. A couple of modules, both in the " "standard library and external, and snippets exist to use these features." msgstr "" -#: ../../using/windows.rst:1309 +#: ../../using/windows.rst:1412 msgid "" "The Windows-specific standard modules are documented in :ref:`mswin-specific-" "services`." msgstr "" -#: ../../using/windows.rst:1313 +#: ../../using/windows.rst:1416 msgid "PyWin32" msgstr "PyWin32" -#: ../../using/windows.rst:1315 +#: ../../using/windows.rst:1418 msgid "" "The :pypi:`PyWin32` module by Mark Hammond is a collection of modules for " "advanced Windows-specific support. This includes utilities for:" msgstr "" -#: ../../using/windows.rst:1319 +#: ../../using/windows.rst:1422 msgid "" "`Component Object Model `_ (COM)" msgstr "" -#: ../../using/windows.rst:1322 +#: ../../using/windows.rst:1425 msgid "Win32 API calls" msgstr "Win32 API 呼叫" -#: ../../using/windows.rst:1323 +#: ../../using/windows.rst:1426 msgid "Registry" msgstr "登錄檔(Registry)" -#: ../../using/windows.rst:1324 +#: ../../using/windows.rst:1427 msgid "Event log" msgstr "事件日誌(Event log)" -#: ../../using/windows.rst:1325 +#: ../../using/windows.rst:1428 msgid "" "`Microsoft Foundation Classes `_ (MFC) user interfaces" msgstr "" -#: ../../using/windows.rst:1329 +#: ../../using/windows.rst:1432 msgid "" "`PythonWin `_ is a sample MFC application shipped with PyWin32. " "It is an embeddable IDE with a built-in debugger." msgstr "" -#: ../../using/windows.rst:1335 +#: ../../using/windows.rst:1438 msgid "" "`Win32 How Do I...? `_" msgstr "" "`Win32 How Do I...? `_" -#: ../../using/windows.rst:1336 +#: ../../using/windows.rst:1439 msgid "by Tim Golden" msgstr "由 Tim Golden 所著" -#: ../../using/windows.rst:1338 +#: ../../using/windows.rst:1441 msgid "`Python and COM `_" msgstr "`Python and COM `_" -#: ../../using/windows.rst:1339 +#: ../../using/windows.rst:1442 msgid "by David and Paul Boddie" msgstr "由 David 與 Paul Boddie 所著" -#: ../../using/windows.rst:1343 +#: ../../using/windows.rst:1446 msgid "cx_Freeze" msgstr "cx_Freeze" -#: ../../using/windows.rst:1345 +#: ../../using/windows.rst:1448 msgid "" "`cx_Freeze `_ wraps Python " "scripts into executable Windows programs (:file:`{*}.exe` files). When you " @@ -2115,11 +2251,11 @@ msgid "" "users to install Python." msgstr "" -#: ../../using/windows.rst:1352 +#: ../../using/windows.rst:1455 msgid "Compiling Python on Windows" msgstr "編譯 Python 在 Windows" -#: ../../using/windows.rst:1354 +#: ../../using/windows.rst:1457 msgid "" "If you want to compile CPython yourself, first thing you should do is get " "the `source `_. You can download " @@ -2127,38 +2263,38 @@ msgid "" "devguide.python.org/setup/#get-the-source-code>`_." msgstr "" -#: ../../using/windows.rst:1359 +#: ../../using/windows.rst:1462 msgid "" "The source tree contains a build solution and project files for Microsoft " "Visual Studio, which is the compiler used to build the official Python " "releases. These files are in the :file:`PCbuild` directory." msgstr "" -#: ../../using/windows.rst:1363 +#: ../../using/windows.rst:1466 msgid "" "Check :file:`PCbuild/readme.txt` for general information on the build " "process." msgstr "" -#: ../../using/windows.rst:1365 +#: ../../using/windows.rst:1468 msgid "For extension modules, consult :ref:`building-on-windows`." msgstr "" -#: ../../using/windows.rst:1372 +#: ../../using/windows.rst:1475 msgid "The full installer (deprecated)" msgstr "" -#: ../../using/windows.rst:1376 +#: ../../using/windows.rst:1479 msgid "" "This installer is deprecated since 3.14 and will not be produced for Python " "3.16 or later. See :ref:`pymanager` for the modern installer." msgstr "" -#: ../../using/windows.rst:1381 +#: ../../using/windows.rst:1484 msgid "Installation steps" msgstr "安裝步驟" -#: ../../using/windows.rst:1383 +#: ../../using/windows.rst:1486 msgid "" "Four Python |version| installers are available for download - two each for " "the 32-bit and 64-bit versions of the interpreter. The *web installer* is a " @@ -2169,43 +2305,43 @@ msgid "" "ways to avoid downloading during installation." msgstr "" -#: ../../using/windows.rst:1391 +#: ../../using/windows.rst:1494 msgid "After starting the installer, one of two options may be selected:" msgstr "" -#: ../../using/windows.rst:1395 +#: ../../using/windows.rst:1498 msgid "If you select \"Install Now\":" msgstr "如果你選擇「馬上安裝」:" -#: ../../using/windows.rst:1397 +#: ../../using/windows.rst:1500 msgid "" "You will *not* need to be an administrator (unless a system update for the C " "Runtime Library is required or you install the :ref:`launcher` for all users)" msgstr "" -#: ../../using/windows.rst:1400 +#: ../../using/windows.rst:1503 msgid "Python will be installed into your user directory" msgstr "" -#: ../../using/windows.rst:1401 +#: ../../using/windows.rst:1504 msgid "" "The :ref:`launcher` will be installed according to the option at the bottom " "of the first page" msgstr "" -#: ../../using/windows.rst:1403 +#: ../../using/windows.rst:1506 msgid "The standard library, test suite, launcher and pip will be installed" msgstr "" -#: ../../using/windows.rst:1404 +#: ../../using/windows.rst:1507 msgid "If selected, the install directory will be added to your :envvar:`PATH`" msgstr "如果選擇,安裝目錄將被加入到你的 :envvar:`PATH`" -#: ../../using/windows.rst:1405 +#: ../../using/windows.rst:1508 msgid "Shortcuts will only be visible for the current user" msgstr "安裝捷徑將只能被目前使用者所看見" -#: ../../using/windows.rst:1407 +#: ../../using/windows.rst:1510 msgid "" "Selecting \"Customize installation\" will allow you to select the features " "to install, the installation location and other options or post-install " @@ -2215,42 +2351,42 @@ msgstr "" "選擇「客製化安裝」將允許你選擇所需的項目進行安裝,安裝位置與其他選擇或安裝後" "的所需進行的動作。你將需要使用此選項「除錯特徵」或「二進位方式」進行安裝。" -#: ../../using/windows.rst:1411 +#: ../../using/windows.rst:1514 msgid "" "To perform an all-users installation, you should select \"Customize " "installation\". In this case:" msgstr "" -#: ../../using/windows.rst:1414 +#: ../../using/windows.rst:1517 msgid "You may be required to provide administrative credentials or approval" msgstr "" -#: ../../using/windows.rst:1415 +#: ../../using/windows.rst:1518 msgid "Python will be installed into the Program Files directory" msgstr "" -#: ../../using/windows.rst:1416 +#: ../../using/windows.rst:1519 msgid "The :ref:`launcher` will be installed into the Windows directory" msgstr "" -#: ../../using/windows.rst:1417 +#: ../../using/windows.rst:1520 msgid "Optional features may be selected during installation" msgstr "" -#: ../../using/windows.rst:1418 +#: ../../using/windows.rst:1521 msgid "The standard library can be pre-compiled to bytecode" msgstr "" -#: ../../using/windows.rst:1419 +#: ../../using/windows.rst:1522 msgid "" "If selected, the install directory will be added to the system :envvar:`PATH`" msgstr "" -#: ../../using/windows.rst:1420 +#: ../../using/windows.rst:1523 msgid "Shortcuts are available for all users" msgstr "捷徑將被所有使用者所見" -#: ../../using/windows.rst:1429 +#: ../../using/windows.rst:1532 msgid "" "In the latest versions of Windows, this limitation can be expanded to " "approximately 32,000 characters. Your administrator will need to activate " @@ -2259,19 +2395,19 @@ msgid "" "``HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem``." msgstr "" -#: ../../using/windows.rst:1438 +#: ../../using/windows.rst:1541 msgid "After changing the above option, no further configuration is required." msgstr "" -#: ../../using/windows.rst:1442 +#: ../../using/windows.rst:1545 msgid "Support for long paths was enabled in Python." msgstr "" -#: ../../using/windows.rst:1447 +#: ../../using/windows.rst:1550 msgid "Installing without UI" msgstr "無使用者介面安裝" -#: ../../using/windows.rst:1449 +#: ../../using/windows.rst:1552 msgid "" "All of the options available in the installer UI can also be specified from " "the command line, allowing scripted installers to replicate an installation " @@ -2279,112 +2415,112 @@ msgid "" "without suppressing the UI in order to change some of the defaults." msgstr "" -#: ../../using/windows.rst:1454 +#: ../../using/windows.rst:1557 msgid "" "The following options (found by executing the installer with ``/?``) can be " "passed into the installer:" msgstr "" -#: ../../using/windows.rst:1458 ../../using/windows.rst:1478 -#: ../../using/windows.rst:2068 +#: ../../using/windows.rst:1561 ../../using/windows.rst:1581 +#: ../../using/windows.rst:2171 msgid "Name" msgstr "名稱" -#: ../../using/windows.rst:1460 +#: ../../using/windows.rst:1563 msgid "/passive" msgstr "/passive" -#: ../../using/windows.rst:1460 +#: ../../using/windows.rst:1563 msgid "to display progress without requiring user interaction" msgstr "" -#: ../../using/windows.rst:1462 +#: ../../using/windows.rst:1565 msgid "/quiet" msgstr "/quiet" -#: ../../using/windows.rst:1462 +#: ../../using/windows.rst:1565 msgid "to install/uninstall without displaying any UI" msgstr "" -#: ../../using/windows.rst:1464 +#: ../../using/windows.rst:1567 msgid "/simple" msgstr "/simple" -#: ../../using/windows.rst:1464 +#: ../../using/windows.rst:1567 msgid "to prevent user customization" msgstr "" -#: ../../using/windows.rst:1466 +#: ../../using/windows.rst:1569 msgid "/uninstall" msgstr "/uninstall" -#: ../../using/windows.rst:1466 +#: ../../using/windows.rst:1569 msgid "to remove Python (without confirmation)" msgstr "" -#: ../../using/windows.rst:1468 +#: ../../using/windows.rst:1571 msgid "/layout [directory]" msgstr "/layout [directory]" -#: ../../using/windows.rst:1468 +#: ../../using/windows.rst:1571 msgid "to pre-download all components" msgstr "" -#: ../../using/windows.rst:1470 +#: ../../using/windows.rst:1573 msgid "/log [filename]" msgstr "/log [filename]" -#: ../../using/windows.rst:1470 +#: ../../using/windows.rst:1573 msgid "to specify log files location" msgstr "" -#: ../../using/windows.rst:1473 +#: ../../using/windows.rst:1576 msgid "" "All other options are passed as ``name=value``, where the value is usually " "``0`` to disable a feature, ``1`` to enable a feature, or a path. The full " "list of available options is shown below." msgstr "" -#: ../../using/windows.rst:1478 +#: ../../using/windows.rst:1581 msgid "Default" msgstr "預設" -#: ../../using/windows.rst:1480 +#: ../../using/windows.rst:1583 msgid "InstallAllUsers" msgstr "InstallAllUsers" -#: ../../using/windows.rst:1480 +#: ../../using/windows.rst:1583 msgid "Perform a system-wide installation." msgstr "" -#: ../../using/windows.rst:1480 ../../using/windows.rst:1506 -#: ../../using/windows.rst:1509 ../../using/windows.rst:1513 -#: ../../using/windows.rst:1522 ../../using/windows.rst:1544 -#: ../../using/windows.rst:1552 ../../using/windows.rst:1555 +#: ../../using/windows.rst:1583 ../../using/windows.rst:1609 +#: ../../using/windows.rst:1612 ../../using/windows.rst:1616 +#: ../../using/windows.rst:1625 ../../using/windows.rst:1647 +#: ../../using/windows.rst:1655 ../../using/windows.rst:1658 msgid "0" msgstr "0" -#: ../../using/windows.rst:1482 +#: ../../using/windows.rst:1585 msgid "TargetDir" msgstr "TargetDir" -#: ../../using/windows.rst:1482 +#: ../../using/windows.rst:1585 msgid "The installation directory" msgstr "安裝目錄" -#: ../../using/windows.rst:1482 +#: ../../using/windows.rst:1585 msgid "Selected based on InstallAllUsers" msgstr "" -#: ../../using/windows.rst:1485 +#: ../../using/windows.rst:1588 msgid "DefaultAllUsersTargetDir" msgstr "DefaultAllUsersTargetDir" -#: ../../using/windows.rst:1485 +#: ../../using/windows.rst:1588 msgid "The default installation directory for all-user installs" msgstr "" -#: ../../using/windows.rst:1485 +#: ../../using/windows.rst:1588 msgid "" ":file:`%ProgramFiles%\\\\\\ Python X.Y` or :file:`\\ %ProgramFiles(x86)%\\\\" "\\ Python X.Y`" @@ -2392,15 +2528,15 @@ msgstr "" ":file:`%ProgramFiles%\\\\\\ Python X.Y` or :file:`\\ %ProgramFiles(x86)%\\\\" "\\ Python X.Y`" -#: ../../using/windows.rst:1490 +#: ../../using/windows.rst:1593 msgid "DefaultJustForMeTargetDir" msgstr "DefaultJustForMeTargetDir" -#: ../../using/windows.rst:1490 +#: ../../using/windows.rst:1593 msgid "The default install directory for just-for-me installs" msgstr "" -#: ../../using/windows.rst:1490 +#: ../../using/windows.rst:1593 msgid "" ":file:`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY` or :file:" "`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-32` or :file:" @@ -2410,218 +2546,218 @@ msgstr "" "`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-32` 或 :file:" "`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-64`" -#: ../../using/windows.rst:1500 +#: ../../using/windows.rst:1603 msgid "DefaultCustomTargetDir" msgstr "DefaultCustomTargetDir" -#: ../../using/windows.rst:1500 +#: ../../using/windows.rst:1603 msgid "The default custom install directory displayed in the UI" msgstr "" -#: ../../using/windows.rst:1500 ../../using/windows.rst:1557 +#: ../../using/windows.rst:1603 ../../using/windows.rst:1660 msgid "(empty)" msgstr "(empty)" -#: ../../using/windows.rst:1503 +#: ../../using/windows.rst:1606 msgid "AssociateFiles" msgstr "AssociateFiles" -#: ../../using/windows.rst:1503 +#: ../../using/windows.rst:1606 msgid "Create file associations if the launcher is also installed." msgstr "如果啟動器也被安裝,建立檔案關聯。" -#: ../../using/windows.rst:1503 ../../using/windows.rst:1517 -#: ../../using/windows.rst:1520 ../../using/windows.rst:1524 -#: ../../using/windows.rst:1528 ../../using/windows.rst:1532 -#: ../../using/windows.rst:1534 ../../using/windows.rst:1538 -#: ../../using/windows.rst:1542 ../../using/windows.rst:1546 -#: ../../using/windows.rst:1548 ../../using/windows.rst:1550 +#: ../../using/windows.rst:1606 ../../using/windows.rst:1620 +#: ../../using/windows.rst:1623 ../../using/windows.rst:1627 +#: ../../using/windows.rst:1631 ../../using/windows.rst:1635 +#: ../../using/windows.rst:1637 ../../using/windows.rst:1641 +#: ../../using/windows.rst:1645 ../../using/windows.rst:1649 +#: ../../using/windows.rst:1651 ../../using/windows.rst:1653 msgid "1" msgstr "1" -#: ../../using/windows.rst:1506 +#: ../../using/windows.rst:1609 msgid "CompileAll" msgstr "CompileAll" -#: ../../using/windows.rst:1506 +#: ../../using/windows.rst:1609 msgid "Compile all ``.py`` files to ``.pyc``." msgstr "編譯所有 ``.py`` 檔案為 ``.pyc``。" -#: ../../using/windows.rst:1509 +#: ../../using/windows.rst:1612 msgid "PrependPath" msgstr "PrependPath" -#: ../../using/windows.rst:1509 +#: ../../using/windows.rst:1612 msgid "" "Prepend install and Scripts directories to :envvar:`PATH` and add ``.PY`` " "to :envvar:`PATHEXT`" msgstr "" -#: ../../using/windows.rst:1513 +#: ../../using/windows.rst:1616 msgid "AppendPath" msgstr "AppendPath" -#: ../../using/windows.rst:1513 +#: ../../using/windows.rst:1616 msgid "" "Append install and Scripts directories to :envvar:`PATH` and add ``.PY`` " "to :envvar:`PATHEXT`" msgstr "" -#: ../../using/windows.rst:1517 +#: ../../using/windows.rst:1620 msgid "Shortcuts" msgstr "Shortcuts" -#: ../../using/windows.rst:1517 +#: ../../using/windows.rst:1620 msgid "" "Create shortcuts for the interpreter, documentation and IDLE if installed." msgstr "" -#: ../../using/windows.rst:1520 +#: ../../using/windows.rst:1623 msgid "Include_doc" msgstr "Include_doc" -#: ../../using/windows.rst:1520 +#: ../../using/windows.rst:1623 msgid "Install Python manual" msgstr "安裝Python文件" -#: ../../using/windows.rst:1522 +#: ../../using/windows.rst:1625 msgid "Include_debug" msgstr "Include_debug" -#: ../../using/windows.rst:1522 +#: ../../using/windows.rst:1625 msgid "Install debug binaries" msgstr "" -#: ../../using/windows.rst:1524 +#: ../../using/windows.rst:1627 msgid "Include_dev" msgstr "Include_dev" -#: ../../using/windows.rst:1524 +#: ../../using/windows.rst:1627 msgid "" "Install developer headers and libraries. Omitting this may lead to an " "unusable installation." msgstr "" -#: ../../using/windows.rst:1528 +#: ../../using/windows.rst:1631 msgid "Include_exe" msgstr "Include_exe" -#: ../../using/windows.rst:1528 +#: ../../using/windows.rst:1631 msgid "" "Install :file:`python.exe` and related files. Omitting this may lead to an " "unusable installation." msgstr "" -#: ../../using/windows.rst:1532 +#: ../../using/windows.rst:1635 msgid "Include_launcher" msgstr "Include_launcher" -#: ../../using/windows.rst:1532 +#: ../../using/windows.rst:1635 msgid "Install :ref:`launcher`." msgstr "安裝 :ref:`launcher`。" -#: ../../using/windows.rst:1534 +#: ../../using/windows.rst:1637 msgid "InstallLauncherAllUsers" msgstr "InstallLauncherAllUsers" -#: ../../using/windows.rst:1534 +#: ../../using/windows.rst:1637 msgid "" "Installs the launcher for all users. Also requires ``Include_launcher`` to " "be set to 1" msgstr "" -#: ../../using/windows.rst:1538 +#: ../../using/windows.rst:1641 msgid "Include_lib" msgstr "Include_lib" -#: ../../using/windows.rst:1538 +#: ../../using/windows.rst:1641 msgid "" "Install standard library and extension modules. Omitting this may lead to an " "unusable installation." msgstr "" -#: ../../using/windows.rst:1542 +#: ../../using/windows.rst:1645 msgid "Include_pip" msgstr "Include_pip" -#: ../../using/windows.rst:1542 +#: ../../using/windows.rst:1645 msgid "Install bundled pip and setuptools" msgstr "" -#: ../../using/windows.rst:1544 +#: ../../using/windows.rst:1647 msgid "Include_symbols" msgstr "Include_symbols" -#: ../../using/windows.rst:1544 +#: ../../using/windows.rst:1647 msgid "Install debugging symbols (``*.pdb``)" msgstr "" -#: ../../using/windows.rst:1546 +#: ../../using/windows.rst:1649 msgid "Include_tcltk" msgstr "Include_tcltk" -#: ../../using/windows.rst:1546 +#: ../../using/windows.rst:1649 msgid "Install Tcl/Tk support and IDLE" msgstr "" -#: ../../using/windows.rst:1548 +#: ../../using/windows.rst:1651 msgid "Include_test" msgstr "Include_test" -#: ../../using/windows.rst:1548 +#: ../../using/windows.rst:1651 msgid "Install standard library test suite" msgstr "" -#: ../../using/windows.rst:1550 +#: ../../using/windows.rst:1653 msgid "Include_tools" msgstr "Include_tools" -#: ../../using/windows.rst:1550 +#: ../../using/windows.rst:1653 msgid "Install utility scripts" msgstr "" -#: ../../using/windows.rst:1552 +#: ../../using/windows.rst:1655 msgid "LauncherOnly" msgstr "LauncherOnly" -#: ../../using/windows.rst:1552 +#: ../../using/windows.rst:1655 msgid "Only installs the launcher. This will override most other options." msgstr "" -#: ../../using/windows.rst:1555 +#: ../../using/windows.rst:1658 msgid "SimpleInstall" msgstr "SimpleInstall" -#: ../../using/windows.rst:1555 +#: ../../using/windows.rst:1658 msgid "Disable most install UI" msgstr "" -#: ../../using/windows.rst:1557 +#: ../../using/windows.rst:1660 msgid "SimpleInstallDescription" msgstr "SimpleInstallDescription" -#: ../../using/windows.rst:1557 +#: ../../using/windows.rst:1660 msgid "A custom message to display when the simplified install UI is used." msgstr "" -#: ../../using/windows.rst:1561 +#: ../../using/windows.rst:1664 msgid "" "For example, to silently install a default, system-wide Python installation, " "you could use the following command (from an elevated command prompt)::" msgstr "" -#: ../../using/windows.rst:1564 +#: ../../using/windows.rst:1667 msgid "python-3.9.0.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0" msgstr "python-3.9.0.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0" -#: ../../using/windows.rst:1566 +#: ../../using/windows.rst:1669 msgid "" "To allow users to easily install a personal copy of Python without the test " "suite, you could provide a shortcut with the following command. This will " "display a simplified initial page and disallow customization::" msgstr "" -#: ../../using/windows.rst:1570 +#: ../../using/windows.rst:1673 msgid "" "python-3.9.0.exe InstallAllUsers=0 Include_launcher=0 Include_test=0\n" " SimpleInstall=1 SimpleInstallDescription=\"Just for me, no test suite.\"" @@ -2629,14 +2765,14 @@ msgstr "" "python-3.9.0.exe InstallAllUsers=0 Include_launcher=0 Include_test=0\n" " SimpleInstall=1 SimpleInstallDescription=\"Just for me, no test suite.\"" -#: ../../using/windows.rst:1573 +#: ../../using/windows.rst:1676 msgid "" "(Note that omitting the launcher also omits file associations, and is only " "recommended for per-user installs when there is also a system-wide " "installation that included the launcher.)" msgstr "" -#: ../../using/windows.rst:1577 +#: ../../using/windows.rst:1680 msgid "" "The options listed above can also be provided in a file named ``unattend." "xml`` alongside the executable. This file specifies a list of options and " @@ -2645,7 +2781,7 @@ msgid "" "strings. This example file sets the same options as the previous example:" msgstr "" -#: ../../using/windows.rst:1583 +#: ../../using/windows.rst:1686 msgid "" "\n" " " -#: ../../using/windows.rst:1596 +#: ../../using/windows.rst:1699 msgid "Installing without downloading" msgstr "無下載安裝" -#: ../../using/windows.rst:1598 +#: ../../using/windows.rst:1701 msgid "" "As some features of Python are not included in the initial installer " "download, selecting those features may require an internet connection. To " @@ -2680,7 +2816,7 @@ msgid "" "to be performed it is very useful to have a locally cached copy." msgstr "" -#: ../../using/windows.rst:1606 +#: ../../using/windows.rst:1709 msgid "" "Execute the following command from Command Prompt to download all possible " "required files. Remember to substitute ``python-3.9.0.exe`` for the actual " @@ -2688,27 +2824,27 @@ msgid "" "avoid collisions between files with the same name." msgstr "" -#: ../../using/windows.rst:1613 +#: ../../using/windows.rst:1716 msgid "python-3.9.0.exe /layout [optional target directory]" msgstr "python-3.9.0.exe /layout [optional target directory]" -#: ../../using/windows.rst:1615 +#: ../../using/windows.rst:1718 msgid "" "You may also specify the ``/quiet`` option to hide the progress display." msgstr "" -#: ../../using/windows.rst:1618 +#: ../../using/windows.rst:1721 msgid "Modifying an install" msgstr "" -#: ../../using/windows.rst:1620 +#: ../../using/windows.rst:1723 msgid "" "Once Python has been installed, you can add or remove features through the " "Programs and Features tool that is part of Windows. Select the Python entry " "and choose \"Uninstall/Change\" to open the installer in maintenance mode." msgstr "" -#: ../../using/windows.rst:1624 +#: ../../using/windows.rst:1727 msgid "" "\"Modify\" allows you to add or remove features by modifying the checkboxes " "- unchanged checkboxes will not install or remove anything. Some options " @@ -2716,26 +2852,26 @@ msgid "" "these, you will need to remove and then reinstall Python completely." msgstr "" -#: ../../using/windows.rst:1629 +#: ../../using/windows.rst:1732 msgid "" "\"Repair\" will verify all the files that should be installed using the " "current settings and replace any that have been removed or modified." msgstr "" -#: ../../using/windows.rst:1632 +#: ../../using/windows.rst:1735 msgid "" "\"Uninstall\" will remove Python entirely, with the exception of the :ref:" "`launcher`, which has its own entry in Programs and Features." msgstr "" -#: ../../using/windows.rst:1641 +#: ../../using/windows.rst:1744 msgid "" "To install pre-built binaries with free-threading enabled (see :pep:`703`), " "you should select \"Customize installation\". The second page of options " "includes the \"Download free-threaded binaries\" checkbox." msgstr "" -#: ../../using/windows.rst:1647 +#: ../../using/windows.rst:1750 msgid "" "Selecting this option will download and install additional binaries to the " "same location as the main Python install. The main executable is called " @@ -2744,7 +2880,7 @@ msgid "" "are shared with the main install." msgstr "" -#: ../../using/windows.rst:1653 +#: ../../using/windows.rst:1756 msgid "" "The free-threaded version is registered as a regular Python install with the " "tag ``3.13t`` (with a ``-32`` or ``-arm64`` suffix as normal for those " @@ -2756,7 +2892,7 @@ msgid "" "not install the free-threaded binaries at this time." msgstr "" -#: ../../using/windows.rst:1662 +#: ../../using/windows.rst:1765 msgid "" "To specify the install option at the command line, use " "``Include_freethreaded=1``. See :ref:`install-layout-option` for " @@ -2765,24 +2901,24 @@ msgid "" "apply to the free-threaded builds." msgstr "" -#: ../../using/windows.rst:1668 +#: ../../using/windows.rst:1771 msgid "" "Free-threaded binaries are also available :ref:`on nuget.org `." msgstr "" -#: ../../using/windows.rst:1672 +#: ../../using/windows.rst:1775 msgid "Python launcher for Windows (deprecated)" msgstr "" -#: ../../using/windows.rst:1676 +#: ../../using/windows.rst:1779 msgid "" "The launcher and this documentation have been superseded by the Python " "Install Manager described above. This is preserved temporarily for " "historical interest." msgstr "" -#: ../../using/windows.rst:1682 +#: ../../using/windows.rst:1785 msgid "" "The Python launcher for Windows is a utility which aids in locating and " "executing of different Python versions. It allows scripts (or the command-" @@ -2790,7 +2926,7 @@ msgid "" "locate and execute that version." msgstr "" -#: ../../using/windows.rst:1687 +#: ../../using/windows.rst:1790 msgid "" "Unlike the :envvar:`PATH` variable, the launcher will correctly select the " "most appropriate version of Python. It will prefer per-user installations " @@ -2798,19 +2934,19 @@ msgid "" "most recently installed version." msgstr "" -#: ../../using/windows.rst:1692 +#: ../../using/windows.rst:1795 msgid "The launcher was originally specified in :pep:`397`." msgstr "" -#: ../../using/windows.rst:1695 +#: ../../using/windows.rst:1798 msgid "Getting started" msgstr "開始" -#: ../../using/windows.rst:1698 +#: ../../using/windows.rst:1801 msgid "From the command-line" msgstr "" -#: ../../using/windows.rst:1702 +#: ../../using/windows.rst:1805 msgid "" "System-wide installations of Python 3.3 and later will put the launcher on " "your :envvar:`PATH`. The launcher is compatible with all available versions " @@ -2818,62 +2954,62 @@ msgid "" "the launcher is available, execute the following command in Command Prompt::" msgstr "" -#: ../../using/windows.rst:1707 +#: ../../using/windows.rst:1810 msgid "py" msgstr "py" -#: ../../using/windows.rst:1709 +#: ../../using/windows.rst:1812 msgid "" "You should find that the latest version of Python you have installed is " "started - it can be exited as normal, and any additional command-line " "arguments specified will be sent directly to Python." msgstr "" -#: ../../using/windows.rst:1713 +#: ../../using/windows.rst:1816 msgid "" "If you have multiple versions of Python installed (e.g., 3.7 and |version|) " "you will have noticed that Python |version| was started - to launch Python " "3.7, try the command::" msgstr "" -#: ../../using/windows.rst:1717 +#: ../../using/windows.rst:1820 msgid "py -3.7" msgstr "py -3.7" -#: ../../using/windows.rst:1719 +#: ../../using/windows.rst:1822 msgid "" "If you want the latest version of Python 2 you have installed, try the " "command::" msgstr "" -#: ../../using/windows.rst:1722 +#: ../../using/windows.rst:1825 msgid "py -2" msgstr "py -2" -#: ../../using/windows.rst:1724 +#: ../../using/windows.rst:1827 msgid "" "If you see the following error, you do not have the launcher installed::" msgstr "" -#: ../../using/windows.rst:1726 +#: ../../using/windows.rst:1829 msgid "" "'py' is not recognized as an internal or external command,\n" "operable program or batch file." msgstr "" -#: ../../using/windows.rst:1729 +#: ../../using/windows.rst:1832 msgid "The command::" msgstr "指令: ::" -#: ../../using/windows.rst:1731 +#: ../../using/windows.rst:1834 msgid "py --list" msgstr "py --list" -#: ../../using/windows.rst:1733 +#: ../../using/windows.rst:1836 msgid "displays the currently installed version(s) of Python." msgstr "" -#: ../../using/windows.rst:1735 +#: ../../using/windows.rst:1838 msgid "" "The ``-x.y`` argument is the short form of the ``-V:Company/Tag`` argument, " "which allows selecting a specific Python runtime, including those that may " @@ -2882,14 +3018,14 @@ msgid "" "available runtimes using the ``-V:`` format." msgstr "" -#: ../../using/windows.rst:1741 +#: ../../using/windows.rst:1844 msgid "" "When using the ``-V:`` argument, specifying the Company will limit selection " "to runtimes from that provider, while specifying only the Tag will select " "from all providers. Note that omitting the slash implies a tag::" msgstr "" -#: ../../using/windows.rst:1745 +#: ../../using/windows.rst:1848 msgid "" "# Select any '3.*' tagged runtime\n" "py -V:3\n" @@ -2901,14 +3037,14 @@ msgid "" "py -V:PythonCore/3" msgstr "" -#: ../../using/windows.rst:1754 +#: ../../using/windows.rst:1857 msgid "" "The short form of the argument (``-3``) only ever selects from core Python " "releases, and not other distributions. However, the longer form (``-V:3``) " "will select from any." msgstr "" -#: ../../using/windows.rst:1758 +#: ../../using/windows.rst:1861 msgid "" "The Company is matched on the full string, case-insensitive. The Tag is " "matched on either the full string, or a prefix, provided the next character " @@ -2917,11 +3053,11 @@ msgid "" "``3.1``), but are compared using text (``-V:3.01`` does not match ``3.1``)." msgstr "" -#: ../../using/windows.rst:1766 +#: ../../using/windows.rst:1869 msgid "Virtual environments" msgstr "虛擬環境(Virtual environment)" -#: ../../using/windows.rst:1770 +#: ../../using/windows.rst:1873 msgid "" "If the launcher is run with no explicit Python version specification, and a " "virtual environment (created with the standard library :mod:`venv` module or " @@ -2931,17 +3067,17 @@ msgid "" "specify the global Python version." msgstr "" -#: ../../using/windows.rst:1778 +#: ../../using/windows.rst:1881 msgid "From a script" msgstr "" -#: ../../using/windows.rst:1780 +#: ../../using/windows.rst:1883 msgid "" "Let's create a test Python script - create a file called ``hello.py`` with " "the following contents" msgstr "" -#: ../../using/windows.rst:1783 +#: ../../using/windows.rst:1886 msgid "" "#! python\n" "import sys\n" @@ -2951,25 +3087,25 @@ msgstr "" "import sys\n" "sys.stdout.write(\"hello from Python %s\\n\" % (sys.version,))" -#: ../../using/windows.rst:1789 +#: ../../using/windows.rst:1892 msgid "From the directory in which hello.py lives, execute the command::" msgstr "" -#: ../../using/windows.rst:1791 +#: ../../using/windows.rst:1894 msgid "py hello.py" msgstr "py hello.py" -#: ../../using/windows.rst:1793 +#: ../../using/windows.rst:1896 msgid "" "You should notice the version number of your latest Python 2.x installation " "is printed. Now try changing the first line to be:" msgstr "" -#: ../../using/windows.rst:1796 +#: ../../using/windows.rst:1899 msgid "#! python3" msgstr "#! python3" -#: ../../using/windows.rst:1800 +#: ../../using/windows.rst:1903 msgid "" "Re-executing the command should now print the latest Python 3.x information. " "As with the above command-line examples, you can specify a more explicit " @@ -2978,7 +3114,7 @@ msgid "" "information printed." msgstr "" -#: ../../using/windows.rst:1806 +#: ../../using/windows.rst:1909 msgid "" "Note that unlike interactive use, a bare \"python\" will use the latest " "version of Python 2.x that you have installed. This is for backward " @@ -2986,11 +3122,11 @@ msgid "" "typically refers to Python 2." msgstr "" -#: ../../using/windows.rst:1812 +#: ../../using/windows.rst:1915 msgid "From file associations" msgstr "從檔案關聯" -#: ../../using/windows.rst:1814 +#: ../../using/windows.rst:1917 msgid "" "The launcher should have been associated with Python files (i.e. ``.py``, ``." "pyw``, ``.pyc`` files) when it was installed. This means that when you " @@ -2999,13 +3135,13 @@ msgid "" "have the script specify the version which should be used." msgstr "" -#: ../../using/windows.rst:1820 +#: ../../using/windows.rst:1923 msgid "" "The key benefit of this is that a single launcher can support multiple " "Python versions at the same time depending on the contents of the first line." msgstr "" -#: ../../using/windows.rst:1826 +#: ../../using/windows.rst:1929 msgid "" "If the first line of a script file starts with ``#!``, it is known as a " "\"shebang\" line. Linux and other Unix like operating systems have native " @@ -3015,30 +3151,30 @@ msgid "" "demonstrate their use." msgstr "" -#: ../../using/windows.rst:1833 +#: ../../using/windows.rst:1936 msgid "" "To allow shebang lines in Python scripts to be portable between Unix and " "Windows, this launcher supports a number of 'virtual' commands to specify " "which interpreter to use. The supported virtual commands are:" msgstr "" -#: ../../using/windows.rst:1837 +#: ../../using/windows.rst:1940 msgid "``/usr/bin/env``" msgstr "``/usr/bin/env``" -#: ../../using/windows.rst:1838 +#: ../../using/windows.rst:1941 msgid "``/usr/bin/python``" msgstr "``/usr/bin/python``" -#: ../../using/windows.rst:1839 +#: ../../using/windows.rst:1942 msgid "``/usr/local/bin/python``" msgstr "``/usr/local/bin/python``" -#: ../../using/windows.rst:1840 +#: ../../using/windows.rst:1943 msgid "``python``" msgstr "``python``" -#: ../../using/windows.rst:1854 +#: ../../using/windows.rst:1957 msgid "" "Any of the above virtual commands can be suffixed with an explicit version " "(either just the major version, or the major and minor version). Furthermore " @@ -3048,21 +3184,21 @@ msgid "" "and the environment will be used." msgstr "" -#: ../../using/windows.rst:1863 +#: ../../using/windows.rst:1966 msgid "" "Beginning with python launcher 3.7 it is possible to request 64-bit version " "by the \"-64\" suffix. Furthermore it is possible to specify a major and " "architecture without minor (i.e. ``/usr/bin/python3-64``)." msgstr "" -#: ../../using/windows.rst:1869 +#: ../../using/windows.rst:1972 msgid "" "The \"-64\" suffix is deprecated, and now implies \"any architecture that is " "not provably i386/32-bit\". To request a specific environment, use the new :" "samp:`-V:{TAG}` argument with the complete tag." msgstr "" -#: ../../using/windows.rst:1875 +#: ../../using/windows.rst:1978 msgid "" "Virtual commands referencing ``python`` now prefer an active virtual " "environment rather than searching :envvar:`PATH`. This handles cases where " @@ -3070,7 +3206,7 @@ msgid "" "not present in the active environment." msgstr "" -#: ../../using/windows.rst:1880 +#: ../../using/windows.rst:1983 msgid "" "The ``/usr/bin/env`` form of shebang line has one further special property. " "Before looking for installed Python interpreters, this form will search the " @@ -3084,7 +3220,7 @@ msgid "" "envvar:`PATH`." msgstr "" -#: ../../using/windows.rst:1891 +#: ../../using/windows.rst:1994 msgid "" "Shebang lines that do not match any of these patterns are looked up in the " "``[commands]`` section of the launcher's :ref:`.INI file `. " @@ -3095,7 +3231,7 @@ msgid "" "part of the filename)." msgstr "" -#: ../../using/windows.rst:1899 +#: ../../using/windows.rst:2002 msgid "" "[commands]\n" "/bin/xpython=C:\\Program Files\\XPython\\python.exe" @@ -3103,7 +3239,7 @@ msgstr "" "[commands]\n" "/bin/xpython=C:\\Program Files\\XPython\\python.exe" -#: ../../using/windows.rst:1904 +#: ../../using/windows.rst:2007 msgid "" "Any commands not found in the .INI file are treated as **Windows** " "executable paths that are absolute or relative to the directory containing " @@ -3114,33 +3250,33 @@ msgid "" "will be appended." msgstr "" -#: ../../using/windows.rst:1913 +#: ../../using/windows.rst:2016 msgid "Arguments in shebang lines" msgstr "" -#: ../../using/windows.rst:1915 +#: ../../using/windows.rst:2018 msgid "" "The shebang lines can also specify additional options to be passed to the " "Python interpreter. For example, if you have a shebang line:" msgstr "" -#: ../../using/windows.rst:1918 +#: ../../using/windows.rst:2021 msgid "#! /usr/bin/python -v" msgstr "#! /usr/bin/python -v" -#: ../../using/windows.rst:1922 +#: ../../using/windows.rst:2025 msgid "Then Python will be started with the ``-v`` option" msgstr "" -#: ../../using/windows.rst:1925 +#: ../../using/windows.rst:2028 msgid "Customization" msgstr "" -#: ../../using/windows.rst:1930 +#: ../../using/windows.rst:2033 msgid "Customization via INI files" msgstr "" -#: ../../using/windows.rst:1932 +#: ../../using/windows.rst:2035 msgid "" "Two .ini files will be searched by the launcher - ``py.ini`` in the current " "user's application data directory (``%LOCALAPPDATA%`` or ``$env:" @@ -3149,7 +3285,7 @@ msgid "" "e. py.exe) and for the 'windows' version (i.e. pyw.exe)." msgstr "" -#: ../../using/windows.rst:1938 +#: ../../using/windows.rst:2041 msgid "" "Customization specified in the \"application directory\" will have " "precedence over the one next to the executable, so a user, who may not have " @@ -3157,11 +3293,11 @@ msgid "" "that global .ini file." msgstr "" -#: ../../using/windows.rst:1943 +#: ../../using/windows.rst:2046 msgid "Customizing default Python versions" msgstr "" -#: ../../using/windows.rst:1945 +#: ../../using/windows.rst:2048 msgid "" "In some cases, a version qualifier can be included in a command to dictate " "which version of Python will be used by the command. A version qualifier " @@ -3171,13 +3307,13 @@ msgid "" "\"-32\" or \"-64\"." msgstr "" -#: ../../using/windows.rst:1951 +#: ../../using/windows.rst:2054 msgid "" "For example, a shebang line of ``#!python`` has no version qualifier, while " "``#!python3`` has a version qualifier which specifies only a major version." msgstr "" -#: ../../using/windows.rst:1954 +#: ../../using/windows.rst:2057 msgid "" "If no version qualifiers are found in a command, the environment variable :" "envvar:`!PY_PYTHON` can be set to specify the default version qualifier. If " @@ -3187,7 +3323,7 @@ msgid "" "launcher included with Python 3.7 or newer.)" msgstr "" -#: ../../using/windows.rst:1961 +#: ../../using/windows.rst:2064 msgid "" "If no minor version qualifiers are found, the environment variable " "``PY_PYTHON{major}`` (where ``{major}`` is the current major version " @@ -3198,7 +3334,7 @@ msgid "" "version in that family." msgstr "" -#: ../../using/windows.rst:1969 +#: ../../using/windows.rst:2072 msgid "" "On 64-bit Windows with both 32-bit and 64-bit implementations of the same " "(major.minor) Python version installed, the 64-bit version will always be " @@ -3212,30 +3348,30 @@ msgid "" "suffix can be used on a version specifier to change this behaviour." msgstr "" -#: ../../using/windows.rst:1980 +#: ../../using/windows.rst:2083 msgid "Examples:" msgstr "範例:" -#: ../../using/windows.rst:1982 +#: ../../using/windows.rst:2085 msgid "" "If no relevant options are set, the commands ``python`` and ``python2`` will " "use the latest Python 2.x version installed and the command ``python3`` will " "use the latest Python 3.x installed." msgstr "" -#: ../../using/windows.rst:1986 +#: ../../using/windows.rst:2089 msgid "" "The command ``python3.7`` will not consult any options at all as the " "versions are fully specified." msgstr "" -#: ../../using/windows.rst:1989 +#: ../../using/windows.rst:2092 msgid "" "If ``PY_PYTHON=3``, the commands ``python`` and ``python3`` will both use " "the latest installed Python 3 version." msgstr "" -#: ../../using/windows.rst:1992 +#: ../../using/windows.rst:2095 msgid "" "If ``PY_PYTHON=3.7-32``, the command ``python`` will use the 32-bit " "implementation of 3.7 whereas the command ``python3`` will use the latest " @@ -3243,13 +3379,13 @@ msgid "" "specified.)" msgstr "" -#: ../../using/windows.rst:1997 +#: ../../using/windows.rst:2100 msgid "" "If ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7``, the commands ``python`` and " "``python3`` will both use specifically 3.7" msgstr "" -#: ../../using/windows.rst:2000 +#: ../../using/windows.rst:2103 msgid "" "In addition to environment variables, the same settings can be configured in " "the .INI file used by the launcher. The section in the INI file is called " @@ -3259,15 +3395,15 @@ msgid "" "will override things specified in the INI file." msgstr "" -#: ../../using/windows.rst:2007 +#: ../../using/windows.rst:2110 msgid "For example:" msgstr "舉例來說:" -#: ../../using/windows.rst:2009 +#: ../../using/windows.rst:2112 msgid "Setting ``PY_PYTHON=3.7`` is equivalent to the INI file containing:" msgstr "" -#: ../../using/windows.rst:2011 +#: ../../using/windows.rst:2114 msgid "" "[defaults]\n" "python=3.7" @@ -3275,13 +3411,13 @@ msgstr "" "[defaults]\n" "python=3.7" -#: ../../using/windows.rst:2016 +#: ../../using/windows.rst:2119 msgid "" "Setting ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7`` is equivalent to the INI file " "containing:" msgstr "" -#: ../../using/windows.rst:2019 +#: ../../using/windows.rst:2122 msgid "" "[defaults]\n" "python=3\n" @@ -3291,11 +3427,11 @@ msgstr "" "python=3\n" "python3=3.7" -#: ../../using/windows.rst:2026 +#: ../../using/windows.rst:2129 msgid "Diagnostics" msgstr "" -#: ../../using/windows.rst:2028 +#: ../../using/windows.rst:2131 msgid "" "If an environment variable :envvar:`!PYLAUNCHER_DEBUG` is set (to any " "value), the launcher will print diagnostic information to stderr (i.e. to " @@ -3306,11 +3442,11 @@ msgid "" "debugging." msgstr "" -#: ../../using/windows.rst:2036 +#: ../../using/windows.rst:2139 msgid "Dry run" msgstr "" -#: ../../using/windows.rst:2038 +#: ../../using/windows.rst:2141 msgid "" "If an environment variable :envvar:`!PYLAUNCHER_DRYRUN` is set (to any " "value), the launcher will output the command it would have run, but will not " @@ -3320,11 +3456,11 @@ msgid "" "correctly in the console." msgstr "" -#: ../../using/windows.rst:2046 +#: ../../using/windows.rst:2149 msgid "Install on demand" msgstr "安裝隨選" -#: ../../using/windows.rst:2048 +#: ../../using/windows.rst:2151 msgid "" "If an environment variable :envvar:`!PYLAUNCHER_ALLOW_INSTALL` is set (to " "any value), and the requested Python version is not installed but is " @@ -3333,7 +3469,7 @@ msgid "" "command again." msgstr "" -#: ../../using/windows.rst:2053 +#: ../../using/windows.rst:2156 msgid "" "An additional :envvar:`!PYLAUNCHER_ALWAYS_INSTALL` variable causes the " "launcher to always try to install Python, even if it is detected. This is " @@ -3341,111 +3477,111 @@ msgid "" "PYLAUNCHER_DRYRUN`)." msgstr "" -#: ../../using/windows.rst:2058 +#: ../../using/windows.rst:2161 msgid "Return codes" msgstr "" -#: ../../using/windows.rst:2060 +#: ../../using/windows.rst:2163 msgid "" "The following exit codes may be returned by the Python launcher. " "Unfortunately, there is no way to distinguish these from the exit code of " "Python itself." msgstr "" -#: ../../using/windows.rst:2063 +#: ../../using/windows.rst:2166 msgid "" "The names of codes are as used in the sources, and are only for reference. " "There is no way to access or resolve them apart from reading this page. " "Entries are listed in alphabetical order of names." msgstr "" -#: ../../using/windows.rst:2068 +#: ../../using/windows.rst:2171 msgid "Value" msgstr "" -#: ../../using/windows.rst:2070 +#: ../../using/windows.rst:2173 msgid "RC_BAD_VENV_CFG" msgstr "RC_BAD_VENV_CFG" -#: ../../using/windows.rst:2070 +#: ../../using/windows.rst:2173 msgid "107" msgstr "107" -#: ../../using/windows.rst:2070 +#: ../../using/windows.rst:2173 msgid "A :file:`pyvenv.cfg` was found but is corrupt." msgstr "" -#: ../../using/windows.rst:2072 +#: ../../using/windows.rst:2175 msgid "RC_CREATE_PROCESS" msgstr "RC_CREATE_PROCESS" -#: ../../using/windows.rst:2072 +#: ../../using/windows.rst:2175 msgid "101" msgstr "101" -#: ../../using/windows.rst:2072 +#: ../../using/windows.rst:2175 msgid "Failed to launch Python." msgstr "" -#: ../../using/windows.rst:2074 +#: ../../using/windows.rst:2177 msgid "RC_INSTALLING" msgstr "RC_INSTALLING" -#: ../../using/windows.rst:2074 +#: ../../using/windows.rst:2177 msgid "111" msgstr "111" -#: ../../using/windows.rst:2074 +#: ../../using/windows.rst:2177 msgid "" "An install was started, but the command will need to be re-run after it " "completes." msgstr "" -#: ../../using/windows.rst:2077 +#: ../../using/windows.rst:2180 msgid "RC_INTERNAL_ERROR" msgstr "RC_INTERNAL_ERROR" -#: ../../using/windows.rst:2077 +#: ../../using/windows.rst:2180 msgid "109" msgstr "109" -#: ../../using/windows.rst:2077 +#: ../../using/windows.rst:2180 msgid "Unexpected error. Please report a bug." msgstr "" -#: ../../using/windows.rst:2079 +#: ../../using/windows.rst:2182 msgid "RC_NO_COMMANDLINE" msgstr "RC_NO_COMMANDLINE" -#: ../../using/windows.rst:2079 +#: ../../using/windows.rst:2182 msgid "108" msgstr "108" -#: ../../using/windows.rst:2079 +#: ../../using/windows.rst:2182 msgid "Unable to obtain command line from the operating system." msgstr "" -#: ../../using/windows.rst:2082 +#: ../../using/windows.rst:2185 msgid "RC_NO_PYTHON" msgstr "RC_NO_PYTHON" -#: ../../using/windows.rst:2082 +#: ../../using/windows.rst:2185 msgid "103" msgstr "103" -#: ../../using/windows.rst:2082 +#: ../../using/windows.rst:2185 msgid "Unable to locate the requested version." msgstr "" -#: ../../using/windows.rst:2084 +#: ../../using/windows.rst:2187 msgid "RC_NO_VENV_CFG" msgstr "RC_NO_VENV_CFG" -#: ../../using/windows.rst:2084 +#: ../../using/windows.rst:2187 msgid "106" msgstr "106" -#: ../../using/windows.rst:2084 +#: ../../using/windows.rst:2187 msgid "A :file:`pyvenv.cfg` was required but not found." msgstr ""