diff --git a/c-api/allocation.po b/c-api/allocation.po index 2d4ce8e20a..28435d6916 100644 --- a/c-api/allocation.po +++ b/c-api/allocation.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-06 00:13+0000\n" +"POT-Creation-Date: 2025-03-18 00:14+0000\n" "PO-Revision-Date: 2022-10-16 15:35+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -56,7 +56,14 @@ msgstr "" "化;呼叫者會擁有那個對於物件的唯一參照(物件的參照計數為一)。記憶體分配大小" "由 type 物件的 :c:member:`~PyTypeObject.tp_basicsize` 欄位來指定。" -#: ../../c-api/allocation.rst:41 +#: ../../c-api/allocation.rst:38 +msgid "" +"Note that this function is unsuitable if *typeobj* has :c:macro:" +"`Py_TPFLAGS_HAVE_GC` set. For such objects, use :c:func:`PyObject_GC_New` " +"instead." +msgstr "" + +#: ../../c-api/allocation.rst:45 msgid "" "Allocate a new Python object using the C structure type *TYPE* and the " "Python type object *typeobj* (``PyTypeObject*``). Fields not defined by the " @@ -75,7 +82,14 @@ msgstr "" "於實現如 tuple 這種能夠在建立期間決定自己大小的物件是很實用的。將欄位的陣列嵌" "入到相同的記憶體分配中可以減少記憶體分配的次數,這提高了記憶體管理的效率。" -#: ../../c-api/allocation.rst:55 +#: ../../c-api/allocation.rst:56 +msgid "" +"Note that this function is unsuitable if *typeobj* has :c:macro:" +"`Py_TPFLAGS_HAVE_GC` set. For such objects, use :c:func:`PyObject_GC_NewVar` " +"instead." +msgstr "" + +#: ../../c-api/allocation.rst:63 msgid "" "Releases memory allocated to an object using :c:macro:`PyObject_New` or :c:" "macro:`PyObject_NewVar`. This is normally called from the :c:member:" @@ -88,7 +102,7 @@ msgstr "" "handler 中呼叫。呼叫這個函式以後,物件的各欄位都不可以被存取,因為原本分配的" "記憶體已不再是一個有效的 Python 物件。" -#: ../../c-api/allocation.rst:64 +#: ../../c-api/allocation.rst:72 msgid "" "Object which is visible in Python as ``None``. This should only be accessed " "using the :c:macro:`Py_None` macro, which evaluates to a pointer to this " @@ -97,10 +111,10 @@ msgstr "" "這個物件像是 Python 中的 ``None``。它只應該透過 :c:macro:`Py_None` 巨集來存" "取,該巨集的拿到指向該物件的指標。" -#: ../../c-api/allocation.rst:71 +#: ../../c-api/allocation.rst:79 msgid ":c:func:`PyModule_Create`" msgstr ":c:func:`PyModule_Create`" -#: ../../c-api/allocation.rst:72 +#: ../../c-api/allocation.rst:80 msgid "To allocate and create extension modules." msgstr "分配記憶體和建立擴充模組。" diff --git a/c-api/arg.po b/c-api/arg.po index 7d0ae25460..65d27c2636 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-07 00:14+0000\n" +"POT-Creation-Date: 2025-03-03 00:15+0000\n" "PO-Revision-Date: 2022-10-16 03:21+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -24,18 +24,18 @@ msgstr "剖析引數與建置數值" #: ../../c-api/arg.rst:8 msgid "" -"These functions are useful when creating your own extensions functions and " -"methods. Additional information and examples are available " -"in :ref:`extending-index`." +"These functions are useful when creating your own extension functions and " +"methods. Additional information and examples are available in :ref:" +"`extending-index`." msgstr "" #: ../../c-api/arg.rst:12 msgid "" -"The first three of these functions " -"described, :c:func:`PyArg_ParseTuple`, :c:func:`PyArg_ParseTupleAndKeywords`, " -"and :c:func:`PyArg_Parse`, all use *format strings* which are used to tell " -"the function about the expected arguments. The format strings use the same " -"syntax for each of these functions." +"The first three of these functions described, :c:func:`PyArg_ParseTuple`, :c:" +"func:`PyArg_ParseTupleAndKeywords`, and :c:func:`PyArg_Parse`, all use " +"*format strings* which are used to tell the function about the expected " +"arguments. The format strings use the same syntax for each of these " +"functions." msgstr "" #: ../../c-api/arg.rst:19 @@ -108,10 +108,10 @@ msgstr "" #: ../../c-api/arg.rst:70 msgid "" -"To ensure that the underlying buffer may be safely borrowed, the " -"object's :c:member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. " -"This disallows common mutable objects such as :class:`bytearray`, but also " -"some read-only objects such as :class:`memoryview` of :class:`bytes`." +"To ensure that the underlying buffer may be safely borrowed, the object's :c:" +"member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. This " +"disallows common mutable objects such as :class:`bytearray`, but also some " +"read-only objects such as :class:`memoryview` of :class:`bytes`." msgstr "" #: ../../c-api/arg.rst:76 @@ -139,8 +139,8 @@ msgstr "" msgid "" "This format does not accept :term:`bytes-like objects `. " "If you want to accept filesystem paths and convert them to C character " -"strings, it is preferable to use the ``O&`` format " -"with :c:func:`PyUnicode_FSConverter` as *converter*." +"strings, it is preferable to use the ``O&`` format with :c:func:" +"`PyUnicode_FSConverter` as *converter*." msgstr "" #: ../../c-api/arg.rst:96 @@ -163,11 +163,11 @@ msgstr "" #: ../../c-api/arg.rst:106 msgid "" -"``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char " -"\\*, :c:type:`Py_ssize_t`]" +"``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char \\*, :" +"c:type:`Py_ssize_t`]" msgstr "" -"``s#`` (:class:`str`、唯讀的 :term:`bytes-like object`) [const char " -"\\*, :c:type:`Py_ssize_t`]" +"``s#`` (:class:`str`、唯讀的 :term:`bytes-like object`) [const char \\*, :c:" +"type:`Py_ssize_t`]" #: ../../c-api/arg.rst:107 msgid "" @@ -244,11 +244,11 @@ msgstr "" #: ../../c-api/arg.rst:141 msgid "" -"``y#`` (read-only :term:`bytes-like object`) [const char " -"\\*, :c:type:`Py_ssize_t`]" +"``y#`` (read-only :term:`bytes-like object`) [const char \\*, :c:type:" +"`Py_ssize_t`]" msgstr "" -"``y#`` (唯讀的 :term:`bytes-like object`) [const char " -"\\*, :c:type:`Py_ssize_t`]" +"``y#`` (唯讀的 :term:`bytes-like object`) [const char \\*, :c:type:" +"`Py_ssize_t`]" #: ../../c-api/arg.rst:142 msgid "" @@ -274,9 +274,9 @@ msgstr "``Y`` (:class:`bytearray`) [PyByteArrayObject \\*]" #: ../../c-api/arg.rst:151 msgid "" "Requires that the Python object is a :class:`bytearray` object, without " -"attempting any conversion. Raises :exc:`TypeError` if the object is not " -"a :class:`bytearray` object. The C variable may also be declared " -"as :c:expr:`PyObject*`." +"attempting any conversion. Raises :exc:`TypeError` if the object is not a :" +"class:`bytearray` object. The C variable may also be declared as :c:expr:" +"`PyObject*`." msgstr "" #: ../../c-api/arg.rst:155 @@ -298,8 +298,8 @@ msgstr "``w*`` (可讀寫 :term:`bytes-like object`) [Py_buffer]" msgid "" "This format accepts any object which implements the read-write buffer " "interface. It fills a :c:type:`Py_buffer` structure provided by the caller. " -"The buffer may contain embedded null bytes. The caller have to " -"call :c:func:`PyBuffer_Release` when it is done with the buffer." +"The buffer may contain embedded null bytes. The caller have to call :c:func:" +"`PyBuffer_Release` when it is done with the buffer." msgstr "" #: ../../c-api/arg.rst:166 @@ -327,8 +327,8 @@ msgstr "" msgid "" ":c:func:`PyArg_ParseTuple` will allocate a buffer of the needed size, copy " "the encoded data into this buffer and adjust *\\*buffer* to reference the " -"newly allocated storage. The caller is responsible for " -"calling :c:func:`PyMem_Free` to free the allocated buffer after use." +"newly allocated storage. The caller is responsible for calling :c:func:" +"`PyMem_Free` to free the allocated buffer after use." msgstr "" #: ../../c-api/arg.rst:183 @@ -348,11 +348,11 @@ msgstr "" #: ../../c-api/arg.rst:188 msgid "" -"``es#`` (:class:`str`) [const char \\*encoding, char " -"\\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" +"``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" +"`Py_ssize_t` \\*buffer_length]" msgstr "" -"``es#`` (:class:`str`) [const char \\*encoding, char " -"\\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" +"``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" +"`Py_ssize_t` \\*buffer_length]" #: ../../c-api/arg.rst:189 msgid "" @@ -428,11 +428,10 @@ msgstr "數字" #: ../../c-api/arg.rst:232 msgid "" "These formats allow representing Python numbers or single characters as C " -"numbers. Formats that require :class:`int`, :class:`float` " -"or :class:`complex` can also use the corresponding special " -"methods :meth:`~object.__index__`, :meth:`~object.__float__` " -"or :meth:`~object.__complex__` to convert the Python object to the required " -"type." +"numbers. Formats that require :class:`int`, :class:`float` or :class:" +"`complex` can also use the corresponding special methods :meth:`~object." +"__index__`, :meth:`~object.__float__` or :meth:`~object.__complex__` to " +"convert the Python object to the required type." msgstr "" #: ../../c-api/arg.rst:238 @@ -452,8 +451,8 @@ msgid "" "Convert a nonnegative Python integer to an unsigned tiny integer, stored in " "a C :c:expr:`unsigned char`." msgstr "" -"將一個 Python 非負整數轉換成無符號 tiny integer(小整數),儲存在 C " -"的 :c:expr:`unsigned`" +"將一個 Python 非負整數轉換成無符號 tiny integer(小整數),儲存在 C 的 :c:" +"expr:`unsigned`" #: ../../c-api/arg.rst:248 ../../c-api/arg.rst:627 msgid "``B`` (:class:`int`) [unsigned char]" @@ -464,8 +463,8 @@ msgid "" "Convert a Python integer to a tiny integer without overflow checking, stored " "in a C :c:expr:`unsigned char`." msgstr "" -"將一個 Python 整數轉換成 tiny integer,轉換過程無溢位檢查,儲存在 C " -"的 :c:expr:`unsigned char`。" +"將一個 Python 整數轉換成 tiny integer,轉換過程無溢位檢查,儲存在 C 的 :c:" +"expr:`unsigned char`。" #: ../../c-api/arg.rst:252 ../../c-api/arg.rst:621 msgid "``h`` (:class:`int`) [short int]" @@ -612,9 +611,9 @@ msgstr "``O`` (object) [PyObject \\*]" #: ../../c-api/arg.rst:307 msgid "" "Store a Python object (without any conversion) in a C object pointer. The C " -"program thus receives the actual object that was passed. A " -"new :term:`strong reference` to the object is not created (i.e. its " -"reference count is not increased). The pointer stored is not ``NULL``." +"program thus receives the actual object that was passed. A new :term:" +"`strong reference` to the object is not created (i.e. its reference count is " +"not increased). The pointer stored is not ``NULL``." msgstr "" #: ../../c-api/arg.rst:313 @@ -648,12 +647,12 @@ msgstr "status = converter(object, address);" #: ../../c-api/arg.rst:330 msgid "" -"where *object* is the Python object to be converted and *address* is " -"the :c:expr:`void*` argument that was passed to the ``PyArg_Parse*`` " -"function. The returned *status* should be ``1`` for a successful conversion " -"and ``0`` if the conversion has failed. When the conversion fails, the " -"*converter* function should raise an exception and leave the content of " -"*address* unmodified." +"where *object* is the Python object to be converted and *address* is the :c:" +"expr:`void*` argument that was passed to the ``PyArg_Parse*`` function. The " +"returned *status* should be ``1`` for a successful conversion and ``0`` if " +"the conversion has failed. When the conversion fails, the *converter* " +"function should raise an exception and leave the content of *address* " +"unmodified." msgstr "" #: ../../c-api/arg.rst:339 @@ -667,8 +666,8 @@ msgstr "" #: ../../c-api/arg.rst:345 msgid "" -"Examples of converters: :c:func:`PyUnicode_FSConverter` " -"and :c:func:`PyUnicode_FSDecoder`." +"Examples of converters: :c:func:`PyUnicode_FSConverter` and :c:func:" +"`PyUnicode_FSDecoder`." msgstr "" #: ../../c-api/arg.rst:348 @@ -748,8 +747,8 @@ msgstr "``;``" #: ../../c-api/arg.rst:390 msgid "" "The list of format units ends here; the string after the semicolon is used " -"as the error message *instead* of the default error message. ``:`` and " -"``;`` mutually exclude each other." +"as the error message *instead* of the default error message. ``:`` and ``;" +"`` mutually exclude each other." msgstr "" #: ../../c-api/arg.rst:394 @@ -808,9 +807,9 @@ msgstr "" #: ../../c-api/arg.rst:441 msgid "" -"The *keywords* parameter declaration is :c:expr:`char * const *` in C " -"and :c:expr:`const char * const *` in C++. This can be overridden with " -"the :c:macro:`PY_CXX_CONST` macro." +"The *keywords* parameter declaration is :c:expr:`char * const *` in C and :c:" +"expr:`const char * const *` in C++. This can be overridden with the :c:macro:" +"`PY_CXX_CONST` macro." msgstr "" #: ../../c-api/arg.rst:445 @@ -821,9 +820,9 @@ msgstr "新增對\\ :ref:`僅限位置參數 `\\ 的 #: ../../c-api/arg.rst:449 msgid "" -"The *keywords* parameter has now type :c:expr:`char * const *` in C " -"and :c:expr:`const char * const *` in C++, instead of :c:expr:`char **`. " -"Added support for non-ASCII keyword parameter names." +"The *keywords* parameter has now type :c:expr:`char * const *` in C and :c:" +"expr:`const char * const *` in C++, instead of :c:expr:`char **`. Added " +"support for non-ASCII keyword parameter names." msgstr "" #: ../../c-api/arg.rst:458 @@ -961,10 +960,10 @@ msgid "" "When memory buffers are passed as parameters to supply data to build " "objects, as for the ``s`` and ``s#`` formats, the required data is copied. " "Buffers provided by the caller are never referenced by the objects created " -"by :c:func:`Py_BuildValue`. In other words, if your code " -"invokes :c:func:`malloc` and passes the allocated memory " -"to :c:func:`Py_BuildValue`, your code is responsible for " -"calling :c:func:`free` for that memory once :c:func:`Py_BuildValue` returns." +"by :c:func:`Py_BuildValue`. In other words, if your code invokes :c:func:" +"`malloc` and passes the allocated memory to :c:func:`Py_BuildValue`, your " +"code is responsible for calling :c:func:`free` for that memory once :c:func:" +"`Py_BuildValue` returns." msgstr "" #: ../../c-api/arg.rst:568 @@ -1128,16 +1127,16 @@ msgid "" "Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` " "object of length 1." msgstr "" -"將一個 C 中代表一個位元組的 :c:expr:`int` 轉換成 Python 中長度為一" -"的 :class:`bytes`。" +"將一個 C 中代表一個位元組的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" +"`bytes`。" #: ../../c-api/arg.rst:653 msgid "" "Convert a C :c:expr:`int` representing a character to Python :class:`str` " "object of length 1." msgstr "" -"將一個 C 中代表一個字元的 :c:expr:`int` 轉換成 Python 中長度為一" -"的 :class:`str`。" +"將一個 C 中代表一個字元的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" +"`str`。" #: ../../c-api/arg.rst:657 msgid "Convert a C :c:expr:`double` to a Python floating-point number." @@ -1160,9 +1159,9 @@ msgid "" "Pass a Python object untouched but create a new :term:`strong reference` to " "it (i.e. its reference count is incremented by one). If the object passed in " "is a ``NULL`` pointer, it is assumed that this was caused because the call " -"producing the argument found an error and set an exception. " -"Therefore, :c:func:`Py_BuildValue` will return ``NULL`` but won't raise an " -"exception. If no exception has been raised yet, :exc:`SystemError` is set." +"producing the argument found an error and set an exception. Therefore, :c:" +"func:`Py_BuildValue` will return ``NULL`` but won't raise an exception. If " +"no exception has been raised yet, :exc:`SystemError` is set." msgstr "" #: ../../c-api/arg.rst:675 @@ -1191,9 +1190,9 @@ msgstr "``O&`` (object) [*converter*, *anything*]" #: ../../c-api/arg.rst:684 msgid "" "Convert *anything* to a Python object through a *converter* function. The " -"function is called with *anything* (which should be compatible " -"with :c:expr:`void*`) as its argument and should return a \"new\" Python " -"object, or ``NULL`` if an error occurred." +"function is called with *anything* (which should be compatible with :c:expr:" +"`void*`) as its argument and should return a \"new\" Python object, or " +"``NULL`` if an error occurred." msgstr "" #: ../../c-api/arg.rst:690 diff --git a/c-api/dict.po b/c-api/dict.po index 5a9c30db1f..b11b75f775 100644 --- a/c-api/dict.po +++ b/c-api/dict.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-21 00:13+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-" @@ -34,8 +34,8 @@ msgid "" "This instance of :c:type:`PyTypeObject` represents the Python dictionary " "type. This is the same object as :class:`dict` in the Python layer." msgstr "" -":c:type:`PyTypeObject` 實例代表一個 Python 字典型態。此與 Python 層中的 :" -"class:`dict` 為同一個物件。" +":c:type:`PyTypeObject` 實例代表一個 Python 字典型態。此與 Python 層中" +"的 :class:`dict` 為同一個物件。" #: ../../c-api/dict.rst:24 msgid "" @@ -77,9 +77,9 @@ msgstr "" #: ../../c-api/dict.rst:60 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*`." +"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:69 @@ -88,32 +88,32 @@ msgstr "" #: ../../c-api/dict.rst:74 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`` " -"on success or ``-1`` on failure. This function *does not* steal a reference " -"to *val*." +"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`` on success or ``-1`` on failure. This function *does not* steal a " +"reference to *val*." msgstr "" #: ../../c-api/dict.rst:82 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*`." +"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:89 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 " -"dictionary, :exc:`KeyError` is raised. Return ``0`` on success or ``-1`` on " -"failure." +"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 dictionary, :exc:`KeyError` is raised. Return ``0`` on success or " +"``-1`` on failure." msgstr "" #: ../../c-api/dict.rst:97 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*`." +"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:104 @@ -134,11 +134,11 @@ msgstr "" #: ../../c-api/dict.rst:110 ../../c-api/dict.rst:207 msgid "On error, raise an exception and return ``-1``." -msgstr "" +msgstr "錯誤發生時,引發一個例外並回傳 ``-1``。" #: ../../c-api/dict.rst:114 msgid "See also the :c:func:`PyObject_GetItem` function." -msgstr "" +msgstr "另見 :c:func:`PyObject_GetItem` 函式。" #: ../../c-api/dict.rst:119 msgid "" @@ -149,9 +149,9 @@ msgstr "" #: ../../c-api/dict.rst:125 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." +"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:129 @@ -169,24 +169,25 @@ msgstr "" #: ../../c-api/dict.rst:144 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*`." +"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:150 msgid "" -"Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" -"`~object.__eq__` methods or while creating the temporary :class:`str` object " -"are silently ignored. Prefer using the :c:func:`PyDict_GetItemWithError` " -"function with your own :c:func:`PyUnicode_FromString` *key* instead." +"Exceptions that occur while this calls :meth:`~object.__hash__` " +"and :meth:`~object.__eq__` methods or while creating the " +"temporary :class:`str` object are silently ignored. Prefer using " +"the :c:func:`PyDict_GetItemWithError` function with your " +"own :c:func:`PyUnicode_FromString` *key* instead." msgstr "" #: ../../c-api/dict.rst:159 msgid "" -"Similar than :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*`." +"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:168 @@ -239,7 +240,7 @@ msgstr "" #: ../../c-api/dict.rst:209 msgid "" -"This is similar to :meth:`dict.pop`, but without the default value and not " +"Similar to :meth:`dict.pop`, but without the default value and not " "raising :exc:`KeyError` if the key missing." msgstr "" @@ -252,37 +253,37 @@ msgstr "" #: ../../c-api/dict.rst:226 msgid "" "Return a :c:type:`PyListObject` containing all the items from the dictionary." -msgstr "" +msgstr "回傳一個包含字典中所有項目的 :c:type:`PyListObject`。" #: ../../c-api/dict.rst:231 msgid "" "Return a :c:type:`PyListObject` containing all the keys from the dictionary." -msgstr "" +msgstr "回傳一個包含字典中所有鍵的 :c:type:`PyListObject`。" #: ../../c-api/dict.rst:236 msgid "" "Return a :c:type:`PyListObject` containing all the values from the " "dictionary *p*." -msgstr "" +msgstr "回傳一個包含字典 *p* 中所有值的 :c:type:`PyListObject`。" #: ../../c-api/dict.rst:244 msgid "" "Return the number of items in the dictionary. This is equivalent to " "``len(p)`` on a dictionary." -msgstr "" +msgstr "回傳字典中項目的數量。此與於字典呼叫 ``len(p)`` 等效。" #: ../../c-api/dict.rst:250 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 " -"first call to this function to start the iteration; the function returns " -"true for each pair in the dictionary, and false once all pairs have been " -"reported. The parameters *pkey* and *pvalue* should either point to :c:expr:" -"`PyObject*` variables that will be filled in with each key and value, " -"respectively, or may be ``NULL``. Any references returned through them are " -"borrowed. *ppos* should not be altered during iteration. Its value " -"represents offsets within the internal dictionary structure, and since the " -"structure is sparse, the offsets are not consecutive." +"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 first call to this function to start the iteration; the " +"function returns true for each pair in the dictionary, and false once all " +"pairs have been reported. The parameters *pkey* and *pvalue* should either " +"point to :c:expr:`PyObject*` variables that will be filled in with each key " +"and value, respectively, or may be ``NULL``. Any references returned " +"through them are borrowed. *ppos* should not be altered during iteration. " +"Its value represents offsets within the internal dictionary structure, and " +"since the structure is sparse, the offsets are not consecutive." msgstr "" #: ../../c-api/dict.rst:261 @@ -348,8 +349,9 @@ msgstr "" #: ../../c-api/dict.rst:293 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::" +"threading>` 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:298 @@ -360,6 +362,11 @@ msgid "" "}\n" "Py_END_CRITICAL_SECTION();" msgstr "" +"Py_BEGIN_CRITICAL_SECTION(self->dict);\n" +"while (PyDict_Next(self->dict, &pos, &key, &value)) {\n" +" ...\n" +"}\n" +"Py_END_CRITICAL_SECTION();" #: ../../c-api/dict.rst:307 msgid "" @@ -373,10 +380,10 @@ msgstr "" #: ../../c-api/dict.rst:317 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 " -"to the iterating over a sequence of key value pairs if the second argument " -"has no \"keys\" attribute. Return ``0`` on success or ``-1`` if an " +"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 to the iterating over a sequence of key value pairs if the second " +"argument has no \"keys\" attribute. Return ``0`` on success or ``-1`` if an " "exception was raised." msgstr "" @@ -411,15 +418,15 @@ msgstr "" #: ../../c-api/dict.rst:349 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.)" +"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:357 msgid "" -"Mark dictionary *dict* as watched. The callback granted *watcher_id* by :c:" -"func:`PyDict_AddWatcher` will be called when *dict* is modified or " +"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 "" @@ -485,8 +492,8 @@ msgstr "" #: ../../c-api/dict.rst:409 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``." +"will be printed as an unraisable exception " +"using :c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" #: ../../c-api/dict.rst:413 diff --git a/c-api/function.po b/c-api/function.po index c9e9a6c79f..299c34cd6c 100644 --- a/c-api/function.po +++ b/c-api/function.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-12-13 00:03+0000\n" +"POT-Creation-Date: 2025-02-17 00:15+0000\n" "PO-Revision-Date: 2022-11-12 15:45+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,17 +37,17 @@ msgstr "用於函式的 C 結構。" #: ../../c-api/function.rst:22 msgid "" "This is an instance of :c:type:`PyTypeObject` and represents the Python " -"function type. It is exposed to Python programmers as ``types." -"FunctionType``." +"function type. It is exposed to Python programmers as " +"``types.FunctionType``." msgstr "" "這是個 :c:type:`PyTypeObject` 的實例,且代表了 Python 函式型別,Python 程式設" "計者可透過 ``types.FunctionType`` 使用它。" #: ../../c-api/function.rst:28 msgid "" -"Return true if *o* is a function object (has type :c:data:" -"`PyFunction_Type`). The parameter must not be ``NULL``. This function " -"always succeeds." +"Return true if *o* is a function object (has " +"type :c:data:`PyFunction_Type`). The parameter must not be ``NULL``. This " +"function always succeeds." msgstr "" "如果 *o* 是個函式物件(擁有 :c:data:`PyFunction_Type` 的型別)則回傳 true。參" "數必須不為 ``NULL``。此函式必能成功執行。" @@ -63,28 +63,30 @@ msgstr "" #: ../../c-api/function.rst:37 msgid "" -"The function's docstring and name are retrieved from the code object. :attr:" -"`~function.__module__` is retrieved from *globals*. The argument defaults, " -"annotations and closure are set to ``NULL``. :attr:`~function.__qualname__` " -"is set to the same value as the code object's :attr:`~codeobject." -"co_qualname` field." +"The function's docstring and name are retrieved from the code " +"object. :attr:`~function.__module__` is retrieved from *globals*. The " +"argument defaults, annotations and closure are set to " +"``NULL``. :attr:`~function.__qualname__` is set to the same value as the " +"code object's :attr:`~codeobject.co_qualname` field." msgstr "" -"函式的文件字串 (docstring) 和名稱是從程式碼物件所取得,:attr:`~function." -"__module__` 是自 *globals* 所取得。引數預設值、標註 (annotation) 和閉包 " -"(closure) 被設為 ``NULL``,:attr:`~function.__qualname__` 被設為和程式碼物" +"函式的文件字串 (docstring) 和名稱是從程式碼物件所取" +"得,:attr:`~function.__module__` 是自 *globals* 所取得。引數預設值、標註 " +"(annotation) 和閉包 (closure) 被設為 " +"``NULL``,:attr:`~function.__qualname__` 被設為和程式碼物" "件 :attr:`~codeobject.co_qualname` 欄位相同的值。" #: ../../c-api/function.rst:46 msgid "" -"As :c:func:`PyFunction_New`, but also allows setting the function object's :" -"attr:`~function.__qualname__` attribute. *qualname* should be a unicode " -"object or ``NULL``; if ``NULL``, the :attr:`!__qualname__` attribute is set " -"to the same value as the code object's :attr:`~codeobject.co_qualname` field." +"As :c:func:`PyFunction_New`, but also allows setting the function " +"object's :attr:`~function.__qualname__` attribute. *qualname* should be a " +"unicode object or ``NULL``; if ``NULL``, the :attr:`!__qualname__` attribute " +"is set to the same value as the code " +"object's :attr:`~codeobject.co_qualname` field." msgstr "" -"和 :c:func:`PyFunction_New` 相似,但也允許函式物件 :attr:`~function." -"__qualname__` 屬性的設定,*qualname* 應為一個 unicode 物件或是 ``NULL``;如" -"為 ``NULL``,:attr:`!__qualname__` 屬性會被設為與程式碼物件 :attr:" -"`~codeobject.co_qualname` 欄位相同的值。" +"和 :c:func:`PyFunction_New` 相似,但也允許函式物" +"件 :attr:`~function.__qualname__` 屬性的設定,*qualname* 應為一個 unicode 物" +"件或是 ``NULL``;如為 ``NULL``,:attr:`!__qualname__` 屬性會被設為與程式碼物" +"件 :attr:`~codeobject.co_qualname` 欄位相同的值。" #: ../../c-api/function.rst:57 msgid "Return the code object associated with the function object *op*." @@ -100,8 +102,9 @@ msgid "" "attribute of the :ref:`function object ` *op*. It can be " "*NULL*." msgstr "" -"回傳一個\\ :ref:`函式物件 ` *op* 之 :attr:`~function." -"__module__` 屬性的 :term:`borrowed reference`,它可以是 *NULL*。" +"回傳一個\\ :ref:`函式物件 ` *op* " +"之 :attr:`~function.__module__` 屬性的 :term:`borrowed reference`,它可以是 " +"*NULL*。" #: ../../c-api/function.rst:71 msgid "" @@ -180,39 +183,55 @@ msgstr "" #: ../../c-api/function.rst:138 msgid "" -"Clear watcher identified by *watcher_id* previously returned from :c:func:" -"`PyFunction_AddWatcher` for the current interpreter. Return ``0`` on " -"success, or ``-1`` and set an exception on error (e.g. if the given " -"*watcher_id* was never registered.)" +"Clear watcher identified by *watcher_id* previously returned " +"from :c:func:`PyFunction_AddWatcher` for the current interpreter. Return " +"``0`` on success, or ``-1`` and set an exception on error (e.g. if the " +"given *watcher_id* was never registered.)" msgstr "" #: ../../c-api/function.rst:148 -msgid "" -"Enumeration of possible function watcher events: - " -"``PyFunction_EVENT_CREATE`` - ``PyFunction_EVENT_DESTROY`` - " -"``PyFunction_EVENT_MODIFY_CODE`` - ``PyFunction_EVENT_MODIFY_DEFAULTS`` - " -"``PyFunction_EVENT_MODIFY_KWDEFAULTS``" +msgid "Enumeration of possible function watcher events:" msgstr "" -#: ../../c-api/function.rst:160 +#: ../../c-api/function.rst:150 +msgid "``PyFunction_EVENT_CREATE``" +msgstr "``PyFunction_EVENT_CREATE``" + +#: ../../c-api/function.rst:151 +msgid "``PyFunction_EVENT_DESTROY``" +msgstr "``PyFunction_EVENT_DESTROY``" + +#: ../../c-api/function.rst:152 +msgid "``PyFunction_EVENT_MODIFY_CODE``" +msgstr "``PyFunction_EVENT_MODIFY_CODE``" + +#: ../../c-api/function.rst:153 +msgid "``PyFunction_EVENT_MODIFY_DEFAULTS``" +msgstr "``PyFunction_EVENT_MODIFY_DEFAULTS``" + +#: ../../c-api/function.rst:154 +msgid "``PyFunction_EVENT_MODIFY_KWDEFAULTS``" +msgstr "``PyFunction_EVENT_MODIFY_KWDEFAULTS``" + +#: ../../c-api/function.rst:161 msgid "Type of a function watcher callback function." msgstr "" -#: ../../c-api/function.rst:162 +#: ../../c-api/function.rst:163 msgid "" "If *event* is ``PyFunction_EVENT_CREATE`` or ``PyFunction_EVENT_DESTROY`` " -"then *new_value* will be ``NULL``. Otherwise, *new_value* will hold a :term:" -"`borrowed reference` to the new value that is about to be stored in *func* " -"for the attribute that is being modified." +"then *new_value* will be ``NULL``. Otherwise, *new_value* will hold " +"a :term:`borrowed reference` to the new value that is about to be stored in " +"*func* for the attribute that is being modified." msgstr "" -#: ../../c-api/function.rst:167 +#: ../../c-api/function.rst:168 msgid "" "The callback may inspect but must not modify *func*; doing so could have " "unpredictable effects, including infinite recursion." msgstr "" -#: ../../c-api/function.rst:170 +#: ../../c-api/function.rst:171 msgid "" "If *event* is ``PyFunction_EVENT_CREATE``, then the callback is invoked " "after `func` has been fully initialized. Otherwise, the callback is invoked " @@ -224,7 +243,7 @@ msgid "" "semantics of the Python code being executed." msgstr "" -#: ../../c-api/function.rst:179 +#: ../../c-api/function.rst:180 msgid "" "If *event* is ``PyFunction_EVENT_DESTROY``, Taking a reference in the " "callback to the about-to-be-destroyed function will resurrect it, preventing " @@ -232,14 +251,14 @@ msgid "" "later, any watcher callbacks active at that time will be called again." msgstr "" -#: ../../c-api/function.rst:184 +#: ../../c-api/function.rst:185 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``." +"will be printed as an unraisable exception " +"using :c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -#: ../../c-api/function.rst:188 +#: ../../c-api/function.rst:189 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 " diff --git a/c-api/gcsupport.po b/c-api/gcsupport.po index 51c11e9884..5fd35ae6f8 100644 --- a/c-api/gcsupport.po +++ b/c-api/gcsupport.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-04-13 00:40+0000\n" "PO-Revision-Date: 2018-05-23 14:31+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -369,7 +369,7 @@ msgstr "" msgid "" "Type of the visitor function to be passed to :c:func:" "`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* passed to " -"``PyUnstable_GC_VisitObjects``. Return ``0`` to continue iteration, return " -"``1`` to stop iteration. Other return values are reserved for now so " +"``PyUnstable_GC_VisitObjects``. Return ``1`` to continue iteration, return " +"``0`` to stop iteration. Other return values are reserved for now so " "behavior on returning anything else is undefined." msgstr "" diff --git a/c-api/init.po b/c-api/init.po index a4bc79d1a8..0ce89e728e 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-07 00:13+0000\n" +"POT-Creation-Date: 2025-02-12 00:13+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -854,7 +854,7 @@ msgstr "" #: ../../c-api/init.rst:900 msgid "" "Use :c:func:`Py_DecodeLocale` to decode a bytes string to get " -"a :c:expr:`wchar_*` string." +"a :c:expr:`wchar_t*` string." msgstr "" #: ../../c-api/init.rst:604 @@ -2145,7 +2145,7 @@ msgstr "" #: ../../c-api/init.rst:1790 msgid "A Per-Interpreter GIL" -msgstr "" +msgstr "直譯器各別持有的 GIL" #: ../../c-api/init.rst:1792 msgid "" diff --git a/c-api/init_config.po b/c-api/init_config.po index a8fedbc984..3397a5853b 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-11 00:14+0000\n" +"POT-Creation-Date: 2025-03-14 00:14+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-" @@ -479,7 +479,7 @@ msgstr "" #: ../../c-api/init_config.rst:952 ../../c-api/init_config.rst:1012 #: ../../c-api/init_config.rst:1064 ../../c-api/init_config.rst:1126 #: ../../c-api/init_config.rst:1180 ../../c-api/init_config.rst:1209 -#: ../../c-api/init_config.rst:1309 +#: ../../c-api/init_config.rst:1298 msgid "Default: ``0``." msgstr "預設:``0``。" @@ -573,7 +573,7 @@ msgid "" "`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -#: ../../c-api/init_config.rst:401 ../../c-api/init_config.rst:1370 +#: ../../c-api/init_config.rst:401 ../../c-api/init_config.rst:1359 msgid "" "The caller is responsible to handle exceptions (error or exit) using :c:func:" "`PyStatus_Exception` and :c:func:`Py_ExitStatusException`." @@ -902,7 +902,7 @@ msgid "stdin is always opened in buffered mode." msgstr "" #: ../../c-api/init_config.rst:645 ../../c-api/init_config.rst:678 -#: ../../c-api/init_config.rst:1197 ../../c-api/init_config.rst:1341 +#: ../../c-api/init_config.rst:1197 ../../c-api/init_config.rst:1330 msgid "Default: ``1``." msgstr "預設值:``1``。" @@ -1215,7 +1215,7 @@ msgid "Install Python signal handlers?" msgstr "" #: ../../c-api/init_config.rst:863 ../../c-api/init_config.rst:1047 -#: ../../c-api/init_config.rst:1071 ../../c-api/init_config.rst:1293 +#: ../../c-api/init_config.rst:1071 ../../c-api/init_config.rst:1282 msgid "Default: ``1`` in Python mode, ``0`` in isolated mode." msgstr "" @@ -1434,8 +1434,8 @@ msgid "" "`Py_GetArgcArgv` function." msgstr "" -#: ../../c-api/init_config.rst:1029 ../../c-api/init_config.rst:1328 -#: ../../c-api/init_config.rst:1347 +#: ../../c-api/init_config.rst:1029 ../../c-api/init_config.rst:1317 +#: ../../c-api/init_config.rst:1336 msgid "Default: empty list." msgstr "" @@ -1740,101 +1740,88 @@ msgid "Set to ``0`` by the :option:`-E` environment variable." msgstr "" #: ../../c-api/init_config.rst:1276 -msgid "" -"If non-zero, ``stdout`` and ``stderr`` will be redirected to the system log." -msgstr "" - -#: ../../c-api/init_config.rst:1279 -msgid "Only available on macOS 10.12 and later, and on iOS." -msgstr "" - -#: ../../c-api/init_config.rst:1281 -msgid "Default: ``0`` (don't use system log)." -msgstr "" - -#: ../../c-api/init_config.rst:1287 msgid "If non-zero, add the user site directory to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1289 +#: ../../c-api/init_config.rst:1278 msgid "Set to ``0`` by the :option:`-s` and :option:`-I` command line options." msgstr "" -#: ../../c-api/init_config.rst:1291 +#: ../../c-api/init_config.rst:1280 msgid "Set to ``0`` by the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1297 +#: ../../c-api/init_config.rst:1286 msgid "" "Verbose mode. If greater than ``0``, print a message each time a module is " "imported, showing the place (filename or built-in module) from which it is " "loaded." msgstr "" -#: ../../c-api/init_config.rst:1301 +#: ../../c-api/init_config.rst:1290 msgid "" "If greater than or equal to ``2``, print a message for each file that is " "checked for when searching for a module. Also provides information on module " "cleanup at exit." msgstr "" -#: ../../c-api/init_config.rst:1305 +#: ../../c-api/init_config.rst:1294 msgid "Incremented by the :option:`-v` command line option." msgstr "" -#: ../../c-api/init_config.rst:1307 +#: ../../c-api/init_config.rst:1296 msgid "Set by the :envvar:`PYTHONVERBOSE` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:1313 +#: ../../c-api/init_config.rst:1302 msgid "" "Options of the :mod:`warnings` module to build warnings filters, lowest to " "highest priority: :data:`sys.warnoptions`." msgstr "" -#: ../../c-api/init_config.rst:1316 +#: ../../c-api/init_config.rst:1305 msgid "" "The :mod:`warnings` module adds :data:`sys.warnoptions` in the reverse " "order: the last :c:member:`PyConfig.warnoptions` item becomes the first item " "of :data:`warnings.filters` which is checked first (highest priority)." msgstr "" -#: ../../c-api/init_config.rst:1321 +#: ../../c-api/init_config.rst:1310 msgid "" "The :option:`-W` command line options adds its value to :c:member:`~PyConfig." "warnoptions`, it can be used multiple times." msgstr "" -#: ../../c-api/init_config.rst:1324 +#: ../../c-api/init_config.rst:1313 msgid "" "The :envvar:`PYTHONWARNINGS` environment variable can also be used to add " "warning options. Multiple options can be specified, separated by commas (``," "``)." msgstr "" -#: ../../c-api/init_config.rst:1332 +#: ../../c-api/init_config.rst:1321 msgid "" "If equal to ``0``, Python won't try to write ``.pyc`` files on the import of " "source modules." msgstr "" -#: ../../c-api/init_config.rst:1335 +#: ../../c-api/init_config.rst:1324 msgid "" "Set to ``0`` by the :option:`-B` command line option and the :envvar:" "`PYTHONDONTWRITEBYTECODE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1338 +#: ../../c-api/init_config.rst:1327 msgid "" ":data:`sys.dont_write_bytecode` is initialized to the inverted value of :c:" "member:`~PyConfig.write_bytecode`." msgstr "" -#: ../../c-api/init_config.rst:1345 +#: ../../c-api/init_config.rst:1334 msgid "Values of the :option:`-X` command line options: :data:`sys._xoptions`." msgstr "" -#: ../../c-api/init_config.rst:1349 +#: ../../c-api/init_config.rst:1338 msgid "" "If :c:member:`~PyConfig.parse_argv` is non-zero, :c:member:`~PyConfig.argv` " "arguments are parsed the same way the regular Python parses :ref:`command " @@ -1842,27 +1829,27 @@ msgid "" "c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:1354 +#: ../../c-api/init_config.rst:1343 msgid "" "The :c:member:`~PyConfig.xoptions` options are parsed to set other options: " "see the :option:`-X` command line option." msgstr "" -#: ../../c-api/init_config.rst:1359 +#: ../../c-api/init_config.rst:1348 msgid "The ``show_alloc_count`` field has been removed." msgstr "" -#: ../../c-api/init_config.rst:1365 +#: ../../c-api/init_config.rst:1354 msgid "Initialization with PyConfig" msgstr "" -#: ../../c-api/init_config.rst:1367 +#: ../../c-api/init_config.rst:1356 msgid "" "Initializing the interpreter from a populated configuration struct is " "handled by calling :c:func:`Py_InitializeFromConfig`." msgstr "" -#: ../../c-api/init_config.rst:1373 +#: ../../c-api/init_config.rst:1362 msgid "" "If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` or :c:" "func:`PyImport_ExtendInittab` are used, they must be set or called after " @@ -1871,17 +1858,17 @@ msgid "" "`PyImport_ExtendInittab` must be called before each Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1380 +#: ../../c-api/init_config.rst:1369 msgid "" "The current configuration (``PyConfig`` type) is stored in " "``PyInterpreterState.config``." msgstr "" -#: ../../c-api/init_config.rst:1383 +#: ../../c-api/init_config.rst:1372 msgid "Example setting the program name::" msgstr "" -#: ../../c-api/init_config.rst:1385 +#: ../../c-api/init_config.rst:1374 msgid "" "void init_python(void)\n" "{\n" @@ -1935,7 +1922,7 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init_config.rst:1411 +#: ../../c-api/init_config.rst:1400 msgid "" "More complete example modifying the default configuration, read the " "configuration, and then override some parameters. Note that since 3.11, many " @@ -1944,7 +1931,7 @@ msgid "" "called will be left unchanged by initialization::" msgstr "" -#: ../../c-api/init_config.rst:1418 +#: ../../c-api/init_config.rst:1407 msgid "" "PyStatus init_python(const char *program_name)\n" "{\n" @@ -1999,18 +1986,18 @@ msgid "" "}" msgstr "" -#: ../../c-api/init_config.rst:1474 +#: ../../c-api/init_config.rst:1463 msgid "Isolated Configuration" msgstr "" -#: ../../c-api/init_config.rst:1476 +#: ../../c-api/init_config.rst:1465 msgid "" ":c:func:`PyPreConfig_InitIsolatedConfig` and :c:func:" "`PyConfig_InitIsolatedConfig` functions create a configuration to isolate " "Python from the system. For example, to embed Python into an application." msgstr "" -#: ../../c-api/init_config.rst:1481 +#: ../../c-api/init_config.rst:1470 msgid "" "This configuration ignores global configuration variables, environment " "variables, command line arguments (:c:member:`PyConfig.argv` is not parsed) " @@ -2018,115 +2005,115 @@ msgid "" "LC_CTYPE locale are left unchanged. Signal handlers are not installed." msgstr "" -#: ../../c-api/init_config.rst:1486 +#: ../../c-api/init_config.rst:1475 msgid "" "Configuration files are still used with this configuration to determine " "paths that are unspecified. Ensure :c:member:`PyConfig.home` is specified to " "avoid computing the default path configuration." msgstr "" -#: ../../c-api/init_config.rst:1494 +#: ../../c-api/init_config.rst:1483 msgid "Python Configuration" msgstr "" -#: ../../c-api/init_config.rst:1496 +#: ../../c-api/init_config.rst:1485 msgid "" ":c:func:`PyPreConfig_InitPythonConfig` and :c:func:" "`PyConfig_InitPythonConfig` functions create a configuration to build a " "customized Python which behaves as the regular Python." msgstr "" -#: ../../c-api/init_config.rst:1500 +#: ../../c-api/init_config.rst:1489 msgid "" "Environments variables and command line arguments are used to configure " "Python, whereas global configuration variables are ignored." msgstr "" -#: ../../c-api/init_config.rst:1503 +#: ../../c-api/init_config.rst:1492 msgid "" "This function enables C locale coercion (:pep:`538`) and :ref:`Python UTF-8 " "Mode ` (:pep:`540`) depending on the LC_CTYPE locale, :envvar:" "`PYTHONUTF8` and :envvar:`PYTHONCOERCECLOCALE` environment variables." msgstr "" -#: ../../c-api/init_config.rst:1512 +#: ../../c-api/init_config.rst:1501 msgid "Python Path Configuration" msgstr "" -#: ../../c-api/init_config.rst:1514 +#: ../../c-api/init_config.rst:1503 msgid ":c:type:`PyConfig` contains multiple fields for the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1516 +#: ../../c-api/init_config.rst:1505 msgid "Path configuration inputs:" msgstr "" -#: ../../c-api/init_config.rst:1518 +#: ../../c-api/init_config.rst:1507 msgid ":c:member:`PyConfig.home`" msgstr ":c:member:`PyConfig.home`" -#: ../../c-api/init_config.rst:1519 +#: ../../c-api/init_config.rst:1508 msgid ":c:member:`PyConfig.platlibdir`" msgstr ":c:member:`PyConfig.platlibdir`" -#: ../../c-api/init_config.rst:1520 +#: ../../c-api/init_config.rst:1509 msgid ":c:member:`PyConfig.pathconfig_warnings`" msgstr ":c:member:`PyConfig.pathconfig_warnings`" -#: ../../c-api/init_config.rst:1521 +#: ../../c-api/init_config.rst:1510 msgid ":c:member:`PyConfig.program_name`" msgstr ":c:member:`PyConfig.program_name`" -#: ../../c-api/init_config.rst:1522 +#: ../../c-api/init_config.rst:1511 msgid ":c:member:`PyConfig.pythonpath_env`" msgstr ":c:member:`PyConfig.pythonpath_env`" -#: ../../c-api/init_config.rst:1523 +#: ../../c-api/init_config.rst:1512 msgid "current working directory: to get absolute paths" msgstr "" -#: ../../c-api/init_config.rst:1524 +#: ../../c-api/init_config.rst:1513 msgid "" "``PATH`` environment variable to get the program full path (from :c:member:" "`PyConfig.program_name`)" msgstr "" -#: ../../c-api/init_config.rst:1526 +#: ../../c-api/init_config.rst:1515 msgid "``__PYVENV_LAUNCHER__`` environment variable" msgstr "``__PYVENV_LAUNCHER__`` 環境變數" -#: ../../c-api/init_config.rst:1527 +#: ../../c-api/init_config.rst:1516 msgid "" "(Windows only) Application paths in the registry under " "\"Software\\Python\\PythonCore\\X.Y\\PythonPath\" of HKEY_CURRENT_USER and " "HKEY_LOCAL_MACHINE (where X.Y is the Python version)." msgstr "" -#: ../../c-api/init_config.rst:1531 +#: ../../c-api/init_config.rst:1520 msgid "Path configuration output fields:" msgstr "" -#: ../../c-api/init_config.rst:1533 +#: ../../c-api/init_config.rst:1522 msgid ":c:member:`PyConfig.base_exec_prefix`" msgstr ":c:member:`PyConfig.base_exec_prefix`" -#: ../../c-api/init_config.rst:1534 +#: ../../c-api/init_config.rst:1523 msgid ":c:member:`PyConfig.base_executable`" msgstr ":c:member:`PyConfig.base_executable`" -#: ../../c-api/init_config.rst:1535 +#: ../../c-api/init_config.rst:1524 msgid ":c:member:`PyConfig.base_prefix`" msgstr ":c:member:`PyConfig.base_prefix`" -#: ../../c-api/init_config.rst:1536 +#: ../../c-api/init_config.rst:1525 msgid ":c:member:`PyConfig.exec_prefix`" msgstr ":c:member:`PyConfig.exec_prefix`" -#: ../../c-api/init_config.rst:1537 +#: ../../c-api/init_config.rst:1526 msgid ":c:member:`PyConfig.executable`" msgstr ":c:member:`PyConfig.executable`" -#: ../../c-api/init_config.rst:1538 +#: ../../c-api/init_config.rst:1527 msgid "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" @@ -2134,11 +2121,11 @@ msgstr "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" -#: ../../c-api/init_config.rst:1540 +#: ../../c-api/init_config.rst:1529 msgid ":c:member:`PyConfig.prefix`" msgstr ":c:member:`PyConfig.prefix`" -#: ../../c-api/init_config.rst:1542 +#: ../../c-api/init_config.rst:1531 msgid "" "If at least one \"output field\" is not set, Python calculates the path " "configuration to fill unset fields. If :c:member:`~PyConfig." @@ -2147,7 +2134,7 @@ msgid "" "module_search_paths_set` is set to ``1``." msgstr "" -#: ../../c-api/init_config.rst:1548 +#: ../../c-api/init_config.rst:1537 msgid "" "It is possible to completely ignore the function calculating the default " "path configuration by setting explicitly all path configuration output " @@ -2157,52 +2144,52 @@ msgid "" "modification." msgstr "" -#: ../../c-api/init_config.rst:1555 +#: ../../c-api/init_config.rst:1544 msgid "" "Set :c:member:`~PyConfig.pathconfig_warnings` to ``0`` to suppress warnings " "when calculating the path configuration (Unix only, Windows does not log any " "warning)." msgstr "" -#: ../../c-api/init_config.rst:1558 +#: ../../c-api/init_config.rst:1547 msgid "" "If :c:member:`~PyConfig.base_prefix` or :c:member:`~PyConfig." "base_exec_prefix` fields are not set, they inherit their value from :c:" "member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` respectively." msgstr "" -#: ../../c-api/init_config.rst:1562 +#: ../../c-api/init_config.rst:1551 msgid ":c:func:`Py_RunMain` and :c:func:`Py_Main` modify :data:`sys.path`:" msgstr "" -#: ../../c-api/init_config.rst:1564 +#: ../../c-api/init_config.rst:1553 msgid "" "If :c:member:`~PyConfig.run_filename` is set and is a directory which " "contains a ``__main__.py`` script, prepend :c:member:`~PyConfig." "run_filename` to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1567 +#: ../../c-api/init_config.rst:1556 msgid "If :c:member:`~PyConfig.isolated` is zero:" msgstr "如果 :c:member:`~PyConfig.isolated` 為零:" -#: ../../c-api/init_config.rst:1569 +#: ../../c-api/init_config.rst:1558 msgid "" "If :c:member:`~PyConfig.run_module` is set, prepend the current directory " "to :data:`sys.path`. Do nothing if the current directory cannot be read." msgstr "" -#: ../../c-api/init_config.rst:1571 +#: ../../c-api/init_config.rst:1560 msgid "" "If :c:member:`~PyConfig.run_filename` is set, prepend the directory of the " "filename to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1573 +#: ../../c-api/init_config.rst:1562 msgid "Otherwise, prepend an empty string to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1575 +#: ../../c-api/init_config.rst:1564 msgid "" "If :c:member:`~PyConfig.site_import` is non-zero, :data:`sys.path` can be " "modified by the :mod:`site` module. If :c:member:`~PyConfig." @@ -2211,143 +2198,143 @@ msgid "" "data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1581 +#: ../../c-api/init_config.rst:1570 msgid "The following configuration files are used by the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1583 +#: ../../c-api/init_config.rst:1572 msgid "``pyvenv.cfg``" msgstr "``pyvenv.cfg``" -#: ../../c-api/init_config.rst:1584 +#: ../../c-api/init_config.rst:1573 msgid "``._pth`` file (ex: ``python._pth``)" msgstr "" -#: ../../c-api/init_config.rst:1585 +#: ../../c-api/init_config.rst:1574 msgid "``pybuilddir.txt`` (Unix only)" msgstr "``pybuilddir.txt``\\ (僅限 Unix)" -#: ../../c-api/init_config.rst:1587 +#: ../../c-api/init_config.rst:1576 msgid "If a ``._pth`` file is present:" msgstr "" -#: ../../c-api/init_config.rst:1589 +#: ../../c-api/init_config.rst:1578 msgid "Set :c:member:`~PyConfig.isolated` to ``1``." msgstr "將 :c:member:`~PyConfig.isolated` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1590 +#: ../../c-api/init_config.rst:1579 msgid "Set :c:member:`~PyConfig.use_environment` to ``0``." msgstr "將 :c:member:`~PyConfig.use_environment` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1591 +#: ../../c-api/init_config.rst:1580 msgid "Set :c:member:`~PyConfig.site_import` to ``0``." msgstr "將 :c:member:`~PyConfig.site_import` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1592 +#: ../../c-api/init_config.rst:1581 msgid "Set :c:member:`~PyConfig.safe_path` to ``1``." msgstr "將 :c:member:`~PyConfig.safe_path` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1594 +#: ../../c-api/init_config.rst:1583 msgid "" "The ``__PYVENV_LAUNCHER__`` environment variable is used to set :c:member:" "`PyConfig.base_executable`." msgstr "" -#: ../../c-api/init_config.rst:1599 +#: ../../c-api/init_config.rst:1588 msgid "Py_GetArgcArgv()" msgstr "Py_GetArgcArgv()" -#: ../../c-api/init_config.rst:1603 +#: ../../c-api/init_config.rst:1592 msgid "Get the original command line arguments, before Python modified them." msgstr "" -#: ../../c-api/init_config.rst:1605 +#: ../../c-api/init_config.rst:1594 msgid "See also :c:member:`PyConfig.orig_argv` member." msgstr "也請參與 :c:member:`PyConfig.orig_argv` 成員。" -#: ../../c-api/init_config.rst:1609 +#: ../../c-api/init_config.rst:1598 msgid "Multi-Phase Initialization Private Provisional API" msgstr "" -#: ../../c-api/init_config.rst:1611 +#: ../../c-api/init_config.rst:1600 msgid "" "This section is a private provisional API introducing multi-phase " "initialization, the core feature of :pep:`432`:" msgstr "" -#: ../../c-api/init_config.rst:1614 +#: ../../c-api/init_config.rst:1603 msgid "\"Core\" initialization phase, \"bare minimum Python\":" msgstr "" -#: ../../c-api/init_config.rst:1616 +#: ../../c-api/init_config.rst:1605 msgid "Builtin types;" msgstr "內建型別;" -#: ../../c-api/init_config.rst:1617 +#: ../../c-api/init_config.rst:1606 msgid "Builtin exceptions;" msgstr "內建例外;" -#: ../../c-api/init_config.rst:1618 +#: ../../c-api/init_config.rst:1607 msgid "Builtin and frozen modules;" msgstr "" -#: ../../c-api/init_config.rst:1619 +#: ../../c-api/init_config.rst:1608 msgid "" "The :mod:`sys` module is only partially initialized (ex: :data:`sys.path` " "doesn't exist yet)." msgstr "" -#: ../../c-api/init_config.rst:1622 +#: ../../c-api/init_config.rst:1611 msgid "\"Main\" initialization phase, Python is fully initialized:" msgstr "" -#: ../../c-api/init_config.rst:1624 +#: ../../c-api/init_config.rst:1613 msgid "Install and configure :mod:`importlib`;" msgstr "" -#: ../../c-api/init_config.rst:1625 +#: ../../c-api/init_config.rst:1614 msgid "Apply the :ref:`Path Configuration `;" msgstr "" -#: ../../c-api/init_config.rst:1626 +#: ../../c-api/init_config.rst:1615 msgid "Install signal handlers;" msgstr "" -#: ../../c-api/init_config.rst:1627 +#: ../../c-api/init_config.rst:1616 msgid "" "Finish :mod:`sys` module initialization (ex: create :data:`sys.stdout` and :" "data:`sys.path`);" msgstr "" -#: ../../c-api/init_config.rst:1629 +#: ../../c-api/init_config.rst:1618 msgid "" "Enable optional features like :mod:`faulthandler` and :mod:`tracemalloc`;" msgstr "" -#: ../../c-api/init_config.rst:1630 +#: ../../c-api/init_config.rst:1619 msgid "Import the :mod:`site` module;" msgstr "引入 :mod:`site` 模組;" -#: ../../c-api/init_config.rst:1631 +#: ../../c-api/init_config.rst:1620 msgid "etc." msgstr "" -#: ../../c-api/init_config.rst:1633 +#: ../../c-api/init_config.rst:1622 msgid "Private provisional API:" msgstr "" -#: ../../c-api/init_config.rst:1635 +#: ../../c-api/init_config.rst:1624 msgid "" ":c:member:`PyConfig._init_main`: if set to ``0``, :c:func:" "`Py_InitializeFromConfig` stops at the \"Core\" initialization phase." msgstr "" -#: ../../c-api/init_config.rst:1640 +#: ../../c-api/init_config.rst:1629 msgid "" "Move to the \"Main\" initialization phase, finish the Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1642 +#: ../../c-api/init_config.rst:1631 msgid "" "No module is imported during the \"Core\" phase and the ``importlib`` module " "is not configured: the :ref:`Path Configuration ` is only " @@ -2356,14 +2343,14 @@ msgid "" "maybe install a custom :data:`sys.meta_path` importer or an import hook, etc." msgstr "" -#: ../../c-api/init_config.rst:1648 +#: ../../c-api/init_config.rst:1637 msgid "" "It may become possible to calculate the :ref:`Path Configuration ` in Python, after the Core phase and before the Main phase, which is " "one of the :pep:`432` motivation." msgstr "" -#: ../../c-api/init_config.rst:1652 +#: ../../c-api/init_config.rst:1641 msgid "" "The \"Core\" phase is not properly defined: what should be and what should " "not be available at this phase is not specified yet. The API is marked as " @@ -2371,13 +2358,13 @@ msgid "" "until a proper public API is designed." msgstr "" -#: ../../c-api/init_config.rst:1657 +#: ../../c-api/init_config.rst:1646 msgid "" "Example running Python code between \"Core\" and \"Main\" initialization " "phases::" msgstr "" -#: ../../c-api/init_config.rst:1660 +#: ../../c-api/init_config.rst:1649 msgid "" "void init_python(void)\n" "{\n" diff --git a/c-api/module.po b/c-api/module.po index 7ebac731fe..8df6ee5240 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-04 00:13+0000\n" +"POT-Creation-Date: 2025-02-25 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,17 +36,18 @@ msgstr "" #: ../../c-api/module.rst:27 msgid "" -"Return true if *p* is a module object, but not a subtype of :c:data:" -"`PyModule_Type`. This function always succeeds." +"Return true if *p* is a module object, but not a subtype " +"of :c:data:`PyModule_Type`. This function always succeeds." msgstr "" #: ../../c-api/module.rst:40 msgid "" "Return a new module object with :attr:`module.__name__` set to *name*. The " -"module's :attr:`!__name__`, :attr:`~module.__doc__`, :attr:`~module." -"__package__` and :attr:`~module.__loader__` attributes are filled in (all " -"but :attr:`!__name__` are set to ``None``). The caller is responsible for " -"setting a :attr:`~module.__file__` attribute." +"module's :attr:`!" +"__name__`, :attr:`~module.__doc__`, :attr:`~module.__package__` " +"and :attr:`~module.__loader__` attributes are filled in (all but :attr:`!" +"__name__` are set to ``None``). The caller is responsible for setting " +"a :attr:`~module.__file__` attribute." msgstr "" #: ../../c-api/module.rst:46 ../../c-api/module.rst:272 @@ -79,8 +80,8 @@ msgstr "" #: ../../c-api/module.rst:70 msgid "" "It is recommended extensions use other ``PyModule_*`` and ``PyObject_*`` " -"functions rather than directly manipulate a module's :attr:`~object." -"__dict__`." +"functions rather than directly manipulate a " +"module's :attr:`~object.__dict__`." msgstr "" #: ../../c-api/module.rst:81 @@ -99,8 +100,8 @@ msgstr "" #: ../../c-api/module.rst:95 msgid "" "Return the \"state\" of the module, that is, a pointer to the block of " -"memory allocated at module creation time, or ``NULL``. See :c:member:" -"`PyModuleDef.m_size`." +"memory allocated at module creation time, or ``NULL``. " +"See :c:member:`PyModuleDef.m_size`." msgstr "" #: ../../c-api/module.rst:102 @@ -111,10 +112,10 @@ msgstr "" #: ../../c-api/module.rst:112 msgid "" -"Return the name of the file from which *module* was loaded using *module*'s :" -"attr:`~module.__file__` attribute. If this is not defined, or if it is not " -"a string, raise :exc:`SystemError` and return ``NULL``; otherwise return a " -"reference to a Unicode object." +"Return the name of the file from which *module* was loaded using " +"*module*'s :attr:`~module.__file__` attribute. If this is not defined, or " +"if it is not a string, raise :exc:`SystemError` and return ``NULL``; " +"otherwise return a reference to a Unicode object." msgstr "" #: ../../c-api/module.rst:122 @@ -143,9 +144,10 @@ msgstr "" #: ../../c-api/module.rst:140 msgid "" -"The initialization function can either pass a module definition instance to :" -"c:func:`PyModule_Create`, and return the resulting module object, or request " -"\"multi-phase initialization\" by returning the definition struct itself." +"The initialization function can either pass a module definition instance " +"to :c:func:`PyModule_Create`, and return the resulting module object, or " +"request \"multi-phase initialization\" by returning the definition struct " +"itself." msgstr "" #: ../../c-api/module.rst:146 @@ -165,8 +167,8 @@ msgstr "" #: ../../c-api/module.rst:160 msgid "" -"Docstring for the module; usually a docstring variable created with :c:macro:" -"`PyDoc_STRVAR` is used." +"Docstring for the module; usually a docstring variable created " +"with :c:macro:`PyDoc_STRVAR` is used." msgstr "" #: ../../c-api/module.rst:165 @@ -179,8 +181,8 @@ msgstr "" #: ../../c-api/module.rst:169 msgid "" "This memory area is allocated based on *m_size* on module creation, and " -"freed when the module object is deallocated, after the :c:member:" -"`~PyModuleDef.m_free` function has been called, if present." +"freed when the module object is deallocated, after " +"the :c:member:`~PyModuleDef.m_free` function has been called, if present." msgstr "" #: ../../c-api/module.rst:173 @@ -203,8 +205,9 @@ msgstr "更多詳情請見 :pep:`3121`。" #: ../../c-api/module.rst:185 msgid "" -"A pointer to a table of module-level functions, described by :c:type:" -"`PyMethodDef` values. Can be ``NULL`` if no functions are present." +"A pointer to a table of module-level functions, described " +"by :c:type:`PyMethodDef` values. Can be ``NULL`` if no functions are " +"present." msgstr "" #: ../../c-api/module.rst:190 @@ -233,8 +236,8 @@ msgid "" "allocated yet. This is the case immediately after the module is created and " "before the module is executed (:c:data:`Py_mod_exec` function). More " "precisely, this function is not called if :c:member:`~PyModuleDef.m_size` is " -"greater than 0 and the module state (as returned by :c:func:" -"`PyModule_GetState`) is ``NULL``." +"greater than 0 and the module state (as returned " +"by :c:func:`PyModule_GetState`) is ``NULL``." msgstr "" #: ../../c-api/module.rst:213 ../../c-api/module.rst:234 @@ -277,8 +280,8 @@ msgstr "" #: ../../c-api/module.rst:261 msgid "" "Create a new module object, given the definition in *def*. This behaves " -"like :c:func:`PyModule_Create2` with *module_api_version* set to :c:macro:" -"`PYTHON_API_VERSION`." +"like :c:func:`PyModule_Create2` with *module_api_version* set " +"to :c:macro:`PYTHON_API_VERSION`." msgstr "" #: ../../c-api/module.rst:268 @@ -297,8 +300,8 @@ msgstr "" #: ../../c-api/module.rst:279 msgid "" "Before it is returned from in the initialization function, the resulting " -"module object is typically populated using functions like :c:func:" -"`PyModule_AddObjectRef`." +"module object is typically populated using functions " +"like :c:func:`PyModule_AddObjectRef`." msgstr "" #: ../../c-api/module.rst:285 @@ -323,9 +326,10 @@ msgid "" "normal garbage collection -- as with Python modules. By default, multiple " "modules created from the same definition should be independent: changes to " "one should not affect the others. This means that all state should be " -"specific to the module object (using e.g. using :c:func:" -"`PyModule_GetState`), or its contents (such as the module's :attr:`~object." -"__dict__` or individual classes created with :c:func:`PyType_FromSpec`)." +"specific to the module object (using e.g. " +"using :c:func:`PyModule_GetState`), or its contents (such as the " +"module's :attr:`~object.__dict__` or individual classes created " +"with :c:func:`PyType_FromSpec`)." msgstr "" #: ../../c-api/module.rst:304 @@ -338,9 +342,9 @@ msgstr "" #: ../../c-api/module.rst:308 msgid "" "To request multi-phase initialization, the initialization function " -"(PyInit_modulename) returns a :c:type:`PyModuleDef` instance with non-empty :" -"c:member:`~PyModuleDef.m_slots`. Before it is returned, the ``PyModuleDef`` " -"instance must be initialized with the following function:" +"(PyInit_modulename) returns a :c:type:`PyModuleDef` instance with non-" +"empty :c:member:`~PyModuleDef.m_slots`. Before it is returned, the " +"``PyModuleDef`` instance must be initialized with the following function:" msgstr "" #: ../../c-api/module.rst:315 @@ -412,12 +416,12 @@ msgstr "" #: ../../c-api/module.rst:368 msgid "" -"There is no requirement for the returned object to be an instance of :c:type:" -"`PyModule_Type`. Any type can be used, as long as it supports setting and " -"getting import-related attributes. However, only ``PyModule_Type`` instances " -"may be returned if the ``PyModuleDef`` has non-``NULL`` ``m_traverse``, " -"``m_clear``, ``m_free``; non-zero ``m_size``; or slots other than " -"``Py_mod_create``." +"There is no requirement for the returned object to be an instance " +"of :c:type:`PyModule_Type`. Any type can be used, as long as it supports " +"setting and getting import-related attributes. However, only " +"``PyModule_Type`` instances may be returned if the ``PyModuleDef`` has non-" +"``NULL`` ``m_traverse``, ``m_clear``, ``m_free``; non-zero ``m_size``; or " +"slots other than ``Py_mod_create``." msgstr "" #: ../../c-api/module.rst:377 @@ -469,7 +473,7 @@ msgstr "" #: ../../c-api/module.rst:417 msgid "" "If ``Py_mod_multiple_interpreters`` is not specified, the import machinery " -"defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED``." +"defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED``." msgstr "" #: ../../c-api/module.rst:430 @@ -658,10 +662,10 @@ msgstr "" msgid "" "The number of different *name* strings passed to this function should be " "kept small, usually by only using statically allocated strings as *name*. " -"For names that aren't known at compile time, prefer calling :c:func:" -"`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For more " -"details, see :c:func:`PyUnicode_InternFromString`, which may be used " -"internally to create a key object." +"For names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` " +"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " +"may be used internally to create a key object." msgstr "" #: ../../c-api/module.rst:572 @@ -700,8 +704,8 @@ msgstr "" #: ../../c-api/module.rst:601 msgid "" -"This means that its return value must be checked, and calling code must :c:" -"func:`Py_XDECREF` *value* manually on error." +"This means that its return value must be checked, and calling code " +"must :c:func:`Py_XDECREF` *value* manually on error." msgstr "" #: ../../c-api/module.rst:606 @@ -731,8 +735,8 @@ msgstr "" #: ../../c-api/module.rst:628 msgid "" -"This is a convenience function that calls :c:func:`PyLong_FromLong` and :c:" -"func:`PyModule_AddObjectRef`; see their documentation for details." +"This is a convenience function that calls :c:func:`PyLong_FromLong` " +"and :c:func:`PyModule_AddObjectRef`; see their documentation for details." msgstr "" #: ../../c-api/module.rst:634 @@ -745,9 +749,9 @@ msgstr "" #: ../../c-api/module.rst:639 msgid "" -"This is a convenience function that calls :c:func:" -"`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; see their " -"documentation for details." +"This is a convenience function that " +"calls :c:func:`PyUnicode_InternFromString` " +"and :c:func:`PyModule_AddObjectRef`; see their documentation for details." msgstr "" #: ../../c-api/module.rst:646 @@ -760,7 +764,7 @@ msgstr "" #: ../../c-api/module.rst:654 msgid "Add a string constant to *module*." -msgstr "" +msgstr "將字串常數加入到 *module* 中。" #: ../../c-api/module.rst:658 msgid "" @@ -811,8 +815,8 @@ msgstr "" #: ../../c-api/module.rst:699 msgid "" "Attaches the module object passed to the function to the interpreter state. " -"This allows the module object to be accessible via :c:func:" -"`PyState_FindModule`." +"This allows the module object to be accessible " +"via :c:func:`PyState_FindModule`." msgstr "" #: ../../c-api/module.rst:702 diff --git a/c-api/monitoring.po b/c-api/monitoring.po index 67816dfd7a..ac7e58b853 100644 --- a/c-api/monitoring.po +++ b/c-api/monitoring.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-22 00:13+0000\n" +"POT-Creation-Date: 2025-03-20 00:14+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-" @@ -282,3 +282,13 @@ msgstr ":monitoring-event:`STOP_ITERATION`" msgid "" "Exit the last scope that was entered with :c:func:`!PyMonitoring_EnterScope`." msgstr "" + +#: ../../c-api/monitoring.rst:197 +msgid "" +"Return true if the event corresponding to the event ID *ev* is a :ref:`local " +"event `." +msgstr "" + +#: ../../c-api/monitoring.rst:204 +msgid "This function is :term:`soft deprecated`." +msgstr "" diff --git a/c-api/object.po b/c-api/object.po index 661f6905da..85e8adfd09 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -28,11 +28,11 @@ msgstr "" #: ../../c-api/object.rst:13 msgid "Set an exception and return ``NULL`` if *constant_id* is invalid." -msgstr "" +msgstr "如果 *constant_id* 無效,則設定一個例外並回傳 ``NULL``。" #: ../../c-api/object.rst:15 msgid "*constant_id* must be one of these constant identifiers:" -msgstr "" +msgstr "*constant_id* 必須是這些常數識別字之一:" #: ../../c-api/object.rst:20 msgid "Constant Identifier" @@ -135,8 +135,8 @@ msgstr "" #: ../../c-api/object.rst:50 msgid "" -"This function is primarily intended for backwards compatibility: using :c:" -"func:`Py_GetConstant` is recommended for new code." +"This function is primarily intended for backwards compatibility: " +"using :c:func:`Py_GetConstant` is recommended for new code." msgstr "" #: ../../c-api/object.rst:53 @@ -154,15 +154,16 @@ msgstr "" #: ../../c-api/object.rst:67 msgid "" "Properly handle returning :c:data:`Py_NotImplemented` from within a C " -"function (that is, create a new :term:`strong reference` to :const:" -"`NotImplemented` and return it)." +"function (that is, create a new :term:`strong reference` " +"to :const:`NotImplemented` and return it)." msgstr "" #: ../../c-api/object.rst:74 msgid "" -"Flag to be used with multiple functions that print the object (like :c:func:" -"`PyObject_Print` and :c:func:`PyFile_WriteObject`). If passed, these " -"function would use the :func:`str` of the object instead of the :func:`repr`." +"Flag to be used with multiple functions that print the object " +"(like :c:func:`PyObject_Print` and :c:func:`PyFile_WriteObject`). If passed, " +"these function would use the :func:`str` of the object instead of " +"the :func:`repr`." msgstr "" #: ../../c-api/object.rst:82 @@ -195,26 +196,27 @@ msgstr "" #: ../../c-api/object.rst:113 msgid "" -"Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" -"`~object.__getattribute__` methods aren't propagated, but instead given to :" -"func:`sys.unraisablehook`. For proper error handling, use :c:func:" -"`PyObject_HasAttrWithError`, :c:func:`PyObject_GetOptionalAttr` or :c:func:" -"`PyObject_GetAttr` instead." +"Exceptions that occur when this calls :meth:`~object.__getattr__` " +"and :meth:`~object.__getattribute__` methods aren't propagated, but instead " +"given to :func:`sys.unraisablehook`. For proper error handling, " +"use :c:func:`PyObject_HasAttrWithError`, :c:func:`PyObject_GetOptionalAttr` " +"or :c:func:`PyObject_GetAttr` instead." msgstr "" #: ../../c-api/object.rst:122 msgid "" "This is the same as :c:func:`PyObject_HasAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/object.rst:128 msgid "" -"Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" -"`~object.__getattribute__` methods or while creating the temporary :class:" -"`str` object are silently ignored. For proper error handling, use :c:func:" -"`PyObject_HasAttrStringWithError`, :c:func:`PyObject_GetOptionalAttrString` " +"Exceptions that occur when this calls :meth:`~object.__getattr__` " +"and :meth:`~object.__getattribute__` methods or while creating the " +"temporary :class:`str` object are silently ignored. For proper error " +"handling, " +"use :c:func:`PyObject_HasAttrStringWithError`, :c:func:`PyObject_GetOptionalAttrString` " "or :c:func:`PyObject_GetAttrString` instead." msgstr "" @@ -227,36 +229,37 @@ msgstr "" #: ../../c-api/object.rst:142 msgid "" -"If the missing attribute should not be treated as a failure, you can use :c:" -"func:`PyObject_GetOptionalAttr` instead." +"If the missing attribute should not be treated as a failure, you can " +"use :c:func:`PyObject_GetOptionalAttr` instead." msgstr "" #: ../../c-api/object.rst:148 msgid "" "This is the same as :c:func:`PyObject_GetAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/object.rst:152 msgid "" -"If the missing attribute should not be treated as a failure, you can use :c:" -"func:`PyObject_GetOptionalAttrString` instead." +"If the missing attribute should not be treated as a failure, you can " +"use :c:func:`PyObject_GetOptionalAttrString` instead." msgstr "" #: ../../c-api/object.rst:158 msgid "" -"Variant of :c:func:`PyObject_GetAttr` which doesn't raise :exc:" -"`AttributeError` if the attribute is not found." +"Variant of :c:func:`PyObject_GetAttr` which doesn't " +"raise :exc:`AttributeError` if the attribute is not found." msgstr "" #: ../../c-api/object.rst:161 msgid "" -"If the attribute is found, return ``1`` and set *\\*result* to a new :term:" -"`strong reference` to the attribute. If the attribute is not found, return " -"``0`` and set *\\*result* to ``NULL``; the :exc:`AttributeError` is " -"silenced. If an error other than :exc:`AttributeError` is raised, return " -"``-1`` and set *\\*result* to ``NULL``." +"If the attribute is found, return ``1`` and set *\\*result* to a " +"new :term:`strong reference` to the attribute. If the attribute is not " +"found, return ``0`` and set *\\*result* to ``NULL``; " +"the :exc:`AttributeError` is silenced. If an error other " +"than :exc:`AttributeError` is raised, return ``-1`` and set *\\*result* to " +"``NULL``." msgstr "" #: ../../c-api/object.rst:173 @@ -270,10 +273,11 @@ msgstr "" msgid "" "Generic attribute getter function that is meant to be put into a type " "object's ``tp_getattro`` slot. It looks for a descriptor in the dictionary " -"of classes in the object's MRO as well as an attribute in the object's :attr:" -"`~object.__dict__` (if present). As outlined in :ref:`descriptors`, data " -"descriptors take preference over instance attributes, while non-data " -"descriptors don't. Otherwise, an :exc:`AttributeError` is raised." +"of classes in the object's MRO as well as an attribute in the " +"object's :attr:`~object.__dict__` (if present). As outlined " +"in :ref:`descriptors`, data descriptors take preference over instance " +"attributes, while non-data descriptors don't. Otherwise, " +"an :exc:`AttributeError` is raised." msgstr "" #: ../../c-api/object.rst:191 @@ -293,8 +297,8 @@ msgstr "" #: ../../c-api/object.rst:203 msgid "" "This is the same as :c:func:`PyObject_SetAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/object.rst:207 @@ -307,10 +311,10 @@ msgstr "" msgid "" "The number of different attribute names passed to this function should be " "kept small, usually by using a statically allocated string as *attr_name*. " -"For attribute names that aren't known at compile time, prefer calling :c:" -"func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For " -"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " -"internally to create a key object." +"For attribute names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` " +"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " +"may be used internally to create a key object." msgstr "" #: ../../c-api/object.rst:220 @@ -334,18 +338,18 @@ msgstr "" #: ../../c-api/object.rst:238 msgid "" "This is the same as :c:func:`PyObject_DelAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/object.rst:242 msgid "" "The number of different attribute names passed to this function should be " "kept small, usually by using a statically allocated string as *attr_name*. " -"For attribute names that aren't known at compile time, prefer calling :c:" -"func:`PyUnicode_FromString` and :c:func:`PyObject_DelAttr` directly. For " -"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " -"internally to create a key object for lookup." +"For attribute names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_DelAttr` " +"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " +"may be used internally to create a key object for lookup." msgstr "" #: ../../c-api/object.rst:253 @@ -389,12 +393,12 @@ msgstr "" #: ../../c-api/object.rst:287 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " -"which must be one of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :" -"c:macro:`Py_NE`, :c:macro:`Py_GT`, or :c:macro:`Py_GE`, corresponding to " -"``<``, ``<=``, ``==``, ``!=``, ``>``, or ``>=`` respectively. This is the " -"equivalent of the Python expression ``o1 op o2``, where ``op`` is the " -"operator corresponding to *opid*. Returns the value of the comparison on " -"success, or ``NULL`` on failure." +"which must be one " +"of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_GT`, " +"or :c:macro:`Py_GE`, corresponding to ``<``, ``<=``, ``==``, ``!=``, ``>``, " +"or ``>=`` respectively. This is the equivalent of the Python expression ``o1 " +"op o2``, where ``op`` is the operator corresponding to *opid*. Returns the " +"value of the comparison on success, or ``NULL`` on failure." msgstr "" #: ../../c-api/object.rst:297 @@ -440,10 +444,10 @@ msgstr "" #: ../../c-api/object.rst:330 msgid "" "As :c:func:`PyObject_Repr`, compute a string representation of object *o*, " -"but escape the non-ASCII characters in the string returned by :c:func:" -"`PyObject_Repr` with ``\\x``, ``\\u`` or ``\\U`` escapes. This generates a " -"string similar to that returned by :c:func:`PyObject_Repr` in Python 2. " -"Called by the :func:`ascii` built-in function." +"but escape the non-ASCII characters in the string returned " +"by :c:func:`PyObject_Repr` with ``\\x``, ``\\u`` or ``\\U`` escapes. This " +"generates a string similar to that returned by :c:func:`PyObject_Repr` in " +"Python 2. Called by the :func:`ascii` built-in function." msgstr "" #: ../../c-api/object.rst:341 @@ -480,8 +484,8 @@ msgstr "" msgid "" "If *cls* has a :meth:`~type.__subclasscheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " -"*derived* is a subclass of *cls* if it is a direct or indirect subclass, i." -"e. contained in :attr:`cls.__mro__ `." +"*derived* is a subclass of *cls* if it is a direct or indirect subclass, " +"i.e. contained in :attr:`cls.__mro__ `." msgstr "" #: ../../c-api/object.rst:376 @@ -506,8 +510,8 @@ msgstr "" #: ../../c-api/object.rst:394 msgid "" -"An instance *inst* can override what is considered its class by having a :" -"attr:`~object.__class__` attribute." +"An instance *inst* can override what is considered its class by having " +"a :attr:`~object.__class__` attribute." msgstr "" #: ../../c-api/object.rst:397 @@ -606,9 +610,9 @@ msgstr "" #: ../../c-api/object.rst:498 msgid "" -"This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as a :" -"c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"This is the same as :c:func:`PyObject_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/object.rst:505 @@ -617,8 +621,8 @@ msgid "" "(possibly empty) list of strings appropriate for the object argument, or " "``NULL`` if there was an error. If the argument is ``NULL``, this is like " "the Python ``dir()``, returning the names of the current locals; in this " -"case, if no execution frame is active then ``NULL`` is returned but :c:func:" -"`PyErr_Occurred` will return false." +"case, if no execution frame is active then ``NULL`` is returned " +"but :c:func:`PyErr_Occurred` will return false." msgstr "" #: ../../c-api/object.rst:514 @@ -632,17 +636,17 @@ msgstr "" #: ../../c-api/object.rst:522 msgid "" "This is equivalent to the Python ``__iter__(self): return self`` method. It " -"is intended for :term:`iterator` types, to be used in the :c:member:" -"`PyTypeObject.tp_iter` slot." +"is intended for :term:`iterator` types, to be used in " +"the :c:member:`PyTypeObject.tp_iter` slot." msgstr "" #: ../../c-api/object.rst:528 msgid "" -"This is the equivalent to the Python expression ``aiter(o)``. Takes an :" -"class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it. " -"This is typically a new iterator but if the argument is an :class:" -"`AsyncIterator`, this returns itself. Raises :exc:`TypeError` and returns " -"``NULL`` if the object cannot be iterated." +"This is the equivalent to the Python expression ``aiter(o)``. Takes " +"an :class:`AsyncIterable` object and returns an :class:`AsyncIterator` for " +"it. This is typically a new iterator but if the argument is " +"an :class:`AsyncIterator`, this returns itself. Raises :exc:`TypeError` and " +"returns ``NULL`` if the object cannot be iterated." msgstr "" #: ../../c-api/object.rst:538 @@ -658,7 +662,7 @@ msgstr "" #: ../../c-api/object.rst:544 msgid "On error, set an exception and return ``NULL``." -msgstr "" +msgstr "錯誤時設定一個例外並回傳 ``NULL``。" #: ../../c-api/object.rst:550 msgid "" @@ -669,24 +673,24 @@ msgstr "" #: ../../c-api/object.rst:553 msgid "" "This may be larger than requested using :c:member:`-PyType_Spec.basicsize " -"`; it is safe to use this larger size (e.g. with :c:" -"func:`!memset`)." +"`; it is safe to use this larger size (e.g. " +"with :c:func:`!memset`)." msgstr "" #: ../../c-api/object.rst:556 msgid "" -"The type *cls* **must** have been created using negative :c:member:" -"`PyType_Spec.basicsize`. Python does not check this." +"The type *cls* **must** have been created using " +"negative :c:member:`PyType_Spec.basicsize`. Python does not check this." msgstr "" #: ../../c-api/object.rst:560 msgid "On error, set an exception and return a negative value." -msgstr "" +msgstr "錯誤時設定一個例外並回傳一個負值。" #: ../../c-api/object.rst:566 msgid "" -"Get a pointer to per-item data for a class with :c:macro:" -"`Py_TPFLAGS_ITEMS_AT_END`." +"Get a pointer to per-item data for a class " +"with :c:macro:`Py_TPFLAGS_ITEMS_AT_END`." msgstr "" #: ../../c-api/object.rst:569 @@ -694,6 +698,8 @@ msgid "" "On error, set an exception and return ``NULL``. :py:exc:`TypeError` is " "raised if *o* does not have :c:macro:`Py_TPFLAGS_ITEMS_AT_END` set." msgstr "" +"錯誤時設定一個例外並回傳 ``NULL``。如果 *o* 沒有設" +"定 :c:macro:`Py_TPFLAGS_ITEMS_AT_END`,則會引發 :py:exc:`TypeError`。" #: ../../c-api/object.rst:577 msgid "Visit the managed dictionary of *obj*." diff --git a/c-api/slice.po b/c-api/slice.po index a2b3dbc7a7..a368b1137c 100644 --- a/c-api/slice.po +++ b/c-api/slice.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-18 00:13+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-" @@ -160,10 +160,16 @@ msgstr "" #: ../../c-api/slice.rst:123 msgid "" +"The type of Python :const:`Ellipsis` object. Same as :class:`types." +"EllipsisType` in the Python layer." +msgstr "" + +#: ../../c-api/slice.rst:129 +msgid "" "The Python ``Ellipsis`` object. This object has no methods. Like :c:data:" "`Py_None`, it is an :term:`immortal` singleton object." msgstr "" -#: ../../c-api/slice.rst:126 +#: ../../c-api/slice.rst:132 msgid ":c:data:`Py_Ellipsis` is immortal." msgstr ":c:data:`Py_Ellipsis` 為不滅的 (immortal)。" diff --git a/c-api/structures.po b/c-api/structures.po index 76d856ee90..ee346fb81b 100644 --- a/c-api/structures.po +++ b/c-api/structures.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-11 00:14+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-" @@ -95,80 +95,85 @@ msgstr "請見上面 :c:type:`PyVarObject` 的文件。" #: ../../c-api/structures.rst:68 msgid "" +"The base class of all other objects, the same as :class:`object` in Python." +msgstr "" + +#: ../../c-api/structures.rst:73 +msgid "" "Test if the *x* object is the *y* object, the same as ``x is y`` in Python." msgstr "" -#: ../../c-api/structures.rst:75 +#: ../../c-api/structures.rst:80 msgid "" "Test if an object is the ``None`` singleton, the same as ``x is None`` in " "Python." msgstr "" -#: ../../c-api/structures.rst:83 +#: ../../c-api/structures.rst:88 msgid "" "Test if an object is the ``True`` singleton, the same as ``x is True`` in " "Python." msgstr "" -#: ../../c-api/structures.rst:91 +#: ../../c-api/structures.rst:96 msgid "" "Test if an object is the ``False`` singleton, the same as ``x is False`` in " "Python." msgstr "" -#: ../../c-api/structures.rst:99 +#: ../../c-api/structures.rst:104 msgid "Get the type of the Python object *o*." msgstr "" -#: ../../c-api/structures.rst:101 +#: ../../c-api/structures.rst:106 msgid "Return a :term:`borrowed reference`." msgstr "" -#: ../../c-api/structures.rst:103 +#: ../../c-api/structures.rst:108 msgid "Use the :c:func:`Py_SET_TYPE` function to set an object type." msgstr "" -#: ../../c-api/structures.rst:105 +#: ../../c-api/structures.rst:110 msgid "" ":c:func:`Py_TYPE()` is changed to an inline static function. The parameter " "type is no longer :c:expr:`const PyObject*`." msgstr "" -#: ../../c-api/structures.rst:112 +#: ../../c-api/structures.rst:117 msgid "" "Return non-zero if the object *o* type is *type*. Return zero otherwise. " "Equivalent to: ``Py_TYPE(o) == type``." msgstr "" -#: ../../c-api/structures.rst:120 +#: ../../c-api/structures.rst:125 msgid "Set the object *o* type to *type*." msgstr "將物件 *o* 的型別設為 *type*。" -#: ../../c-api/structures.rst:127 +#: ../../c-api/structures.rst:132 msgid "Get the size of the Python object *o*." msgstr "取得 Python 物件 *o* 的大小。" -#: ../../c-api/structures.rst:129 +#: ../../c-api/structures.rst:134 msgid "Use the :c:func:`Py_SET_SIZE` function to set an object size." msgstr "" -#: ../../c-api/structures.rst:131 +#: ../../c-api/structures.rst:136 msgid "" ":c:func:`Py_SIZE()` is changed to an inline static function. The parameter " "type is no longer :c:expr:`const PyVarObject*`." msgstr "" -#: ../../c-api/structures.rst:138 +#: ../../c-api/structures.rst:143 msgid "Set the object *o* size to *size*." msgstr "將物件 *o* 的大小設為 *size*。" -#: ../../c-api/structures.rst:145 +#: ../../c-api/structures.rst:150 msgid "" "This is a macro which expands to initialization values for a new :c:type:" "`PyObject` type. This macro expands to::" msgstr "" -#: ../../c-api/structures.rst:148 +#: ../../c-api/structures.rst:153 msgid "" "_PyObject_EXTRA_INIT\n" "1, type," @@ -176,14 +181,14 @@ msgstr "" "_PyObject_EXTRA_INIT\n" "1, type," -#: ../../c-api/structures.rst:154 +#: ../../c-api/structures.rst:159 msgid "" "This is a macro which expands to initialization values for a new :c:type:" "`PyVarObject` type, including the :c:member:`~PyVarObject.ob_size` field. " "This macro expands to::" msgstr "" -#: ../../c-api/structures.rst:158 +#: ../../c-api/structures.rst:163 msgid "" "_PyObject_EXTRA_INIT\n" "1, type, size," @@ -191,11 +196,11 @@ msgstr "" "_PyObject_EXTRA_INIT\n" "1, type, size," -#: ../../c-api/structures.rst:163 +#: ../../c-api/structures.rst:168 msgid "Implementing functions and methods" msgstr "實作函式與方法" -#: ../../c-api/structures.rst:167 +#: ../../c-api/structures.rst:172 msgid "" "Type of the functions used to implement most Python callables in C. " "Functions of this type take two :c:expr:`PyObject*` parameters and return " @@ -205,11 +210,11 @@ msgid "" "reference." msgstr "" -#: ../../c-api/structures.rst:174 +#: ../../c-api/structures.rst:179 msgid "The function signature is::" msgstr "" -#: ../../c-api/structures.rst:176 +#: ../../c-api/structures.rst:181 msgid "" "PyObject *PyCFunction(PyObject *self,\n" " PyObject *args);" @@ -217,14 +222,14 @@ msgstr "" "PyObject *PyCFunction(PyObject *self,\n" " PyObject *args);" -#: ../../c-api/structures.rst:181 +#: ../../c-api/structures.rst:186 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_VARARGS | METH_KEYWORDS `. " "The function signature is::" msgstr "" -#: ../../c-api/structures.rst:185 +#: ../../c-api/structures.rst:190 msgid "" "PyObject *PyCFunctionWithKeywords(PyObject *self,\n" " PyObject *args,\n" @@ -234,13 +239,13 @@ msgstr "" " PyObject *args,\n" " PyObject *kwargs);" -#: ../../c-api/structures.rst:192 +#: ../../c-api/structures.rst:197 msgid "" "Type of the functions used to implement Python callables in C with " "signature :c:macro:`METH_FASTCALL`. The function signature is::" msgstr "" -#: ../../c-api/structures.rst:196 +#: ../../c-api/structures.rst:201 #, fuzzy msgid "" "PyObject *PyCFunctionFast(PyObject *self,\n" @@ -251,14 +256,14 @@ msgstr "" " PyObject *const *args,\n" " Py_ssize_t nargs);" -#: ../../c-api/structures.rst:202 +#: ../../c-api/structures.rst:207 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_FASTCALL | METH_KEYWORDS `. The function signature is::" msgstr "" -#: ../../c-api/structures.rst:206 +#: ../../c-api/structures.rst:211 #, fuzzy msgid "" "PyObject *PyCFunctionFastWithKeywords(PyObject *self,\n" @@ -271,14 +276,14 @@ msgstr "" " Py_ssize_t nargs,\n" " PyObject *kwnames);" -#: ../../c-api/structures.rst:213 +#: ../../c-api/structures.rst:218 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS `. The function signature is::" msgstr "" -#: ../../c-api/structures.rst:217 +#: ../../c-api/structures.rst:222 msgid "" "PyObject *PyCMethod(PyObject *self,\n" " PyTypeObject *defining_class,\n" @@ -292,29 +297,29 @@ msgstr "" " Py_ssize_t nargs,\n" " PyObject *kwnames)" -#: ../../c-api/structures.rst:228 +#: ../../c-api/structures.rst:233 msgid "" "Structure used to describe a method of an extension type. This structure " "has four fields:" msgstr "" -#: ../../c-api/structures.rst:233 +#: ../../c-api/structures.rst:238 msgid "Name of the method." msgstr "" -#: ../../c-api/structures.rst:237 +#: ../../c-api/structures.rst:242 msgid "Pointer to the C implementation." msgstr "" -#: ../../c-api/structures.rst:241 +#: ../../c-api/structures.rst:246 msgid "Flags bits indicating how the call should be constructed." msgstr "" -#: ../../c-api/structures.rst:245 +#: ../../c-api/structures.rst:250 msgid "Points to the contents of the docstring." msgstr "" -#: ../../c-api/structures.rst:247 +#: ../../c-api/structures.rst:252 msgid "" "The :c:member:`~PyMethodDef.ml_meth` is a C function pointer. The functions " "may be of different types, but they always return :c:expr:`PyObject*`. If " @@ -324,18 +329,18 @@ msgid "" "implementation uses the specific C type of the *self* object." msgstr "" -#: ../../c-api/structures.rst:255 +#: ../../c-api/structures.rst:260 msgid "" "The :c:member:`~PyMethodDef.ml_flags` field is a bitfield which can include " "the following flags. The individual flags indicate either a calling " "convention or a binding convention." msgstr "" -#: ../../c-api/structures.rst:260 +#: ../../c-api/structures.rst:265 msgid "There are these calling conventions:" msgstr "" -#: ../../c-api/structures.rst:264 +#: ../../c-api/structures.rst:269 msgid "" "This is the typical calling convention, where the methods have the type :c:" "type:`PyCFunction`. The function expects two :c:expr:`PyObject*` values. The " @@ -345,7 +350,7 @@ msgid "" "func:`PyArg_ParseTuple` or :c:func:`PyArg_UnpackTuple`." msgstr "" -#: ../../c-api/structures.rst:274 +#: ../../c-api/structures.rst:279 msgid "" "Can only be used in certain combinations with other flags: :ref:" "`METH_VARARGS | METH_KEYWORDS `, :ref:" @@ -354,11 +359,11 @@ msgid "" "METH_KEYWORDS>`." msgstr "" -#: ../../c-api/structures.rst:282 +#: ../../c-api/structures.rst:287 msgid ":c:expr:`METH_VARARGS | METH_KEYWORDS`" msgstr ":c:expr:`METH_VARARGS | METH_KEYWORDS`" -#: ../../c-api/structures.rst:283 +#: ../../c-api/structures.rst:288 msgid "" "Methods with these flags must be of type :c:type:`PyCFunctionWithKeywords`. " "The function expects three parameters: *self*, *args*, *kwargs* where " @@ -367,7 +372,7 @@ msgid "" "using :c:func:`PyArg_ParseTupleAndKeywords`." msgstr "" -#: ../../c-api/structures.rst:292 +#: ../../c-api/structures.rst:297 msgid "" "Fast calling convention supporting only positional arguments. The methods " "have the type :c:type:`PyCFunctionFast`. The first parameter is *self*, the " @@ -376,15 +381,15 @@ msgid "" "the array)." msgstr "" -#: ../../c-api/structures.rst:302 +#: ../../c-api/structures.rst:307 msgid "``METH_FASTCALL`` is now part of the :ref:`stable ABI `." msgstr "" -#: ../../c-api/structures.rst:307 +#: ../../c-api/structures.rst:312 msgid ":c:expr:`METH_FASTCALL | METH_KEYWORDS`" msgstr ":c:expr:`METH_FASTCALL | METH_KEYWORDS`" -#: ../../c-api/structures.rst:308 +#: ../../c-api/structures.rst:313 msgid "" "Extension of :c:macro:`METH_FASTCALL` supporting also keyword arguments, " "with methods of type :c:type:`PyCFunctionFastWithKeywords`. Keyword " @@ -396,17 +401,17 @@ msgid "" "the positional arguments." msgstr "" -#: ../../c-api/structures.rst:323 +#: ../../c-api/structures.rst:328 msgid "" "Can only be used in the combination with other flags: :ref:`METH_METHOD | " "METH_FASTCALL | METH_KEYWORDS `." msgstr "" -#: ../../c-api/structures.rst:329 +#: ../../c-api/structures.rst:334 msgid ":c:expr:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS`" msgstr ":c:expr:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS`" -#: ../../c-api/structures.rst:330 +#: ../../c-api/structures.rst:335 msgid "" "Extension of :ref:`METH_FASTCALL | METH_KEYWORDS ` supporting the *defining class*, that is, the class that " @@ -414,14 +419,14 @@ msgid "" "``Py_TYPE(self)``." msgstr "" -#: ../../c-api/structures.rst:335 +#: ../../c-api/structures.rst:340 msgid "" "The method needs to be of type :c:type:`PyCMethod`, the same as for " "``METH_FASTCALL | METH_KEYWORDS`` with ``defining_class`` argument added " "after ``self``." msgstr "" -#: ../../c-api/structures.rst:344 +#: ../../c-api/structures.rst:349 msgid "" "Methods without parameters don't need to check whether arguments are given " "if they are listed with the :c:macro:`METH_NOARGS` flag. They need to be of " @@ -430,13 +435,13 @@ msgid "" "the second parameter will be ``NULL``." msgstr "" -#: ../../c-api/structures.rst:350 +#: ../../c-api/structures.rst:355 msgid "" "The function must have 2 parameters. Since the second parameter is unused, :" "c:macro:`Py_UNUSED` can be used to prevent a compiler warning." msgstr "" -#: ../../c-api/structures.rst:356 +#: ../../c-api/structures.rst:361 msgid "" "Methods with a single object argument can be listed with the :c:macro:" "`METH_O` flag, instead of invoking :c:func:`PyArg_ParseTuple` with a " @@ -445,7 +450,7 @@ msgid "" "single argument." msgstr "" -#: ../../c-api/structures.rst:362 +#: ../../c-api/structures.rst:367 msgid "" "These two constants are not used to indicate the calling convention but the " "binding when use with methods of classes. These may not be used for " @@ -453,27 +458,27 @@ msgid "" "any given method." msgstr "" -#: ../../c-api/structures.rst:372 +#: ../../c-api/structures.rst:377 msgid "" "The method will be passed the type object as the first parameter rather than " "an instance of the type. This is used to create *class methods*, similar to " "what is created when using the :func:`classmethod` built-in function." msgstr "" -#: ../../c-api/structures.rst:382 +#: ../../c-api/structures.rst:387 msgid "" "The method will be passed ``NULL`` as the first parameter rather than an " "instance of the type. This is used to create *static methods*, similar to " "what is created when using the :func:`staticmethod` built-in function." msgstr "" -#: ../../c-api/structures.rst:386 +#: ../../c-api/structures.rst:391 msgid "" "One other constant controls whether a method is loaded in place of another " "definition with the same method name." msgstr "" -#: ../../c-api/structures.rst:392 +#: ../../c-api/structures.rst:397 msgid "" "The method will be loaded in place of existing definitions. Without " "*METH_COEXIST*, the default is to skip repeated definitions. Since slot " @@ -486,20 +491,20 @@ msgid "" "wrapper object calls." msgstr "" -#: ../../c-api/structures.rst:404 +#: ../../c-api/structures.rst:409 msgid "" "Turn *ml* into a Python :term:`callable` object. The caller must ensure that " "*ml* outlives the :term:`callable`. Typically, *ml* is defined as a static " "variable." msgstr "" -#: ../../c-api/structures.rst:408 +#: ../../c-api/structures.rst:413 msgid "" "The *self* parameter will be passed as the *self* argument to the C function " "in ``ml->ml_meth`` when invoked. *self* can be ``NULL``." msgstr "" -#: ../../c-api/structures.rst:412 +#: ../../c-api/structures.rst:417 msgid "" "The :term:`callable` object's ``__module__`` attribute can be set from the " "given *module* argument. *module* should be a Python string, which will be " @@ -507,71 +512,71 @@ msgid "" "can be set to :const:`None` or ``NULL``." msgstr "" -#: ../../c-api/structures.rst:418 +#: ../../c-api/structures.rst:423 msgid ":attr:`function.__module__`" msgstr ":attr:`function.__module__`" -#: ../../c-api/structures.rst:420 +#: ../../c-api/structures.rst:425 msgid "" "The *cls* parameter will be passed as the *defining_class* argument to the C " "function. Must be set if :c:macro:`METH_METHOD` is set on ``ml->ml_flags``." msgstr "" -#: ../../c-api/structures.rst:429 +#: ../../c-api/structures.rst:434 msgid "Equivalent to ``PyCMethod_New(ml, self, module, NULL)``." msgstr "等價於 ``PyCMethod_New(ml, self, module, NULL)``。" -#: ../../c-api/structures.rst:434 +#: ../../c-api/structures.rst:439 msgid "Equivalent to ``PyCMethod_New(ml, self, NULL, NULL)``." msgstr "等價於 ``PyCMethod_New(ml, self, NULL, NULL)``。" -#: ../../c-api/structures.rst:438 +#: ../../c-api/structures.rst:443 msgid "Accessing attributes of extension types" msgstr "" -#: ../../c-api/structures.rst:442 +#: ../../c-api/structures.rst:447 msgid "" "Structure which describes an attribute of a type which corresponds to a C " "struct member. When defining a class, put a NULL-terminated array of these " "structures in the :c:member:`~PyTypeObject.tp_members` slot." msgstr "" -#: ../../c-api/structures.rst:447 +#: ../../c-api/structures.rst:452 msgid "Its fields are, in order:" msgstr "" -#: ../../c-api/structures.rst:451 +#: ../../c-api/structures.rst:456 msgid "" "Name of the member. A NULL value marks the end of a ``PyMemberDef[]`` array." msgstr "" -#: ../../c-api/structures.rst:454 +#: ../../c-api/structures.rst:459 msgid "The string should be static, no copy is made of it." msgstr "" -#: ../../c-api/structures.rst:458 +#: ../../c-api/structures.rst:463 msgid "" "The type of the member in the C struct. See :ref:`PyMemberDef-types` for the " "possible values." msgstr "" -#: ../../c-api/structures.rst:463 +#: ../../c-api/structures.rst:468 msgid "" "The offset in bytes that the member is located on the type’s object struct." msgstr "" -#: ../../c-api/structures.rst:467 +#: ../../c-api/structures.rst:472 msgid "" "Zero or more of the :ref:`PyMemberDef-flags`, combined using bitwise OR." msgstr "" -#: ../../c-api/structures.rst:471 +#: ../../c-api/structures.rst:476 msgid "" "The docstring, or NULL. The string should be static, no copy is made of it. " "Typically, it is defined using :c:macro:`PyDoc_STR`." msgstr "" -#: ../../c-api/structures.rst:475 +#: ../../c-api/structures.rst:480 msgid "" "By default (when :c:member:`~PyMemberDef.flags` is ``0``), members allow " "both read and write access. Use the :c:macro:`Py_READONLY` flag for read-" @@ -580,7 +585,7 @@ msgid "" "`T_OBJECT`) members can be deleted." msgstr "" -#: ../../c-api/structures.rst:484 +#: ../../c-api/structures.rst:489 msgid "" "For heap-allocated types (created using :c:func:`PyType_FromSpec` or " "similar), ``PyMemberDef`` may contain a definition for the special member " @@ -589,7 +594,7 @@ msgid "" "``Py_T_PYSSIZET`` and ``Py_READONLY``, for example::" msgstr "" -#: ../../c-api/structures.rst:490 +#: ../../c-api/structures.rst:495 msgid "" "static PyMemberDef spam_type_members[] = {\n" " {\"__vectorcalloffset__\", Py_T_PYSSIZET,\n" @@ -603,11 +608,11 @@ msgstr "" " {NULL} /* Sentinel */\n" "};" -#: ../../c-api/structures.rst:496 +#: ../../c-api/structures.rst:501 msgid "(You may need to ``#include `` for :c:func:`!offsetof`.)" msgstr "" -#: ../../c-api/structures.rst:498 +#: ../../c-api/structures.rst:503 msgid "" "The legacy offsets :c:member:`~PyTypeObject.tp_dictoffset` and :c:member:" "`~PyTypeObject.tp_weaklistoffset` can be defined similarly using " @@ -616,77 +621,77 @@ msgid "" "and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead." msgstr "" -#: ../../c-api/structures.rst:506 +#: ../../c-api/structures.rst:511 msgid "" "``PyMemberDef`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" -#: ../../c-api/structures.rst:511 +#: ../../c-api/structures.rst:516 msgid "" "Get an attribute belonging to the object at address *obj_addr*. The " "attribute is described by ``PyMemberDef`` *m*. Returns ``NULL`` on error." msgstr "" -#: ../../c-api/structures.rst:517 +#: ../../c-api/structures.rst:522 msgid "" "``PyMember_GetOne`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" -#: ../../c-api/structures.rst:522 +#: ../../c-api/structures.rst:527 msgid "" "Set an attribute belonging to the object at address *obj_addr* to object " "*o*. The attribute to set is described by ``PyMemberDef`` *m*. Returns " "``0`` if successful and a negative value on failure." msgstr "" -#: ../../c-api/structures.rst:528 +#: ../../c-api/structures.rst:533 msgid "" "``PyMember_SetOne`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" -#: ../../c-api/structures.rst:534 +#: ../../c-api/structures.rst:539 msgid "Member flags" msgstr "" -#: ../../c-api/structures.rst:536 +#: ../../c-api/structures.rst:541 msgid "The following flags can be used with :c:member:`PyMemberDef.flags`:" msgstr "" -#: ../../c-api/structures.rst:540 +#: ../../c-api/structures.rst:545 msgid "Not writable." msgstr "不可寫入。" -#: ../../c-api/structures.rst:544 +#: ../../c-api/structures.rst:549 msgid "" "Emit an ``object.__getattr__`` :ref:`audit event ` before " "reading." msgstr "" -#: ../../c-api/structures.rst:549 +#: ../../c-api/structures.rst:554 msgid "" "Indicates that the :c:member:`~PyMemberDef.offset` of this ``PyMemberDef`` " "entry indicates an offset from the subclass-specific data, rather than from " "``PyObject``." msgstr "" -#: ../../c-api/structures.rst:553 +#: ../../c-api/structures.rst:558 msgid "" "Can only be used as part of :c:member:`Py_tp_members ` :c:type:`slot ` when creating a class using " "negative :c:member:`~PyType_Spec.basicsize`. It is mandatory in that case." msgstr "" -#: ../../c-api/structures.rst:558 +#: ../../c-api/structures.rst:563 msgid "" "This flag is only used in :c:type:`PyType_Slot`. When setting :c:member:" "`~PyTypeObject.tp_members` during class creation, Python clears it and sets :" "c:member:`PyMemberDef.offset` to the offset from the ``PyObject`` struct." msgstr "" -#: ../../c-api/structures.rst:570 +#: ../../c-api/structures.rst:575 msgid "" "The :c:macro:`!RESTRICTED`, :c:macro:`!READ_RESTRICTED` and :c:macro:`!" "WRITE_RESTRICTED` macros available with ``#include \"structmember.h\"`` are " @@ -695,7 +700,7 @@ msgid "" "nothing." msgstr "" -#: ../../c-api/structures.rst:581 +#: ../../c-api/structures.rst:586 msgid "" "The :c:macro:`!READONLY` macro was renamed to :c:macro:`Py_READONLY`. The :c:" "macro:`!PY_AUDIT_READ` macro was renamed with the ``Py_`` prefix. The new " @@ -704,11 +709,11 @@ msgid "" "names." msgstr "" -#: ../../c-api/structures.rst:590 +#: ../../c-api/structures.rst:595 msgid "Member types" msgstr "" -#: ../../c-api/structures.rst:592 +#: ../../c-api/structures.rst:597 msgid "" ":c:member:`PyMemberDef.type` can be one of the following macros " "corresponding to various C types. When the member is accessed in Python, it " @@ -717,147 +722,147 @@ msgid "" "exception such as :exc:`TypeError` or :exc:`ValueError` is raised." msgstr "" -#: ../../c-api/structures.rst:600 +#: ../../c-api/structures.rst:605 msgid "" "Unless marked (D), attributes defined this way cannot be deleted using e.g. :" "keyword:`del` or :py:func:`delattr`." msgstr "" -#: ../../c-api/structures.rst:604 +#: ../../c-api/structures.rst:609 msgid "Macro name" msgstr "巨集名稱" -#: ../../c-api/structures.rst:604 +#: ../../c-api/structures.rst:609 msgid "C type" msgstr "" -#: ../../c-api/structures.rst:604 +#: ../../c-api/structures.rst:609 msgid "Python type" msgstr "" -#: ../../c-api/structures.rst:606 +#: ../../c-api/structures.rst:611 msgid ":c:expr:`char`" msgstr ":c:expr:`char`" -#: ../../c-api/structures.rst:606 ../../c-api/structures.rst:607 -#: ../../c-api/structures.rst:608 ../../c-api/structures.rst:609 -#: ../../c-api/structures.rst:610 ../../c-api/structures.rst:611 -#: ../../c-api/structures.rst:612 ../../c-api/structures.rst:613 -#: ../../c-api/structures.rst:614 ../../c-api/structures.rst:615 -#: ../../c-api/structures.rst:616 +#: ../../c-api/structures.rst:611 ../../c-api/structures.rst:612 +#: ../../c-api/structures.rst:613 ../../c-api/structures.rst:614 +#: ../../c-api/structures.rst:615 ../../c-api/structures.rst:616 +#: ../../c-api/structures.rst:617 ../../c-api/structures.rst:618 +#: ../../c-api/structures.rst:619 ../../c-api/structures.rst:620 +#: ../../c-api/structures.rst:621 msgid ":py:class:`int`" msgstr ":py:class:`int`" -#: ../../c-api/structures.rst:607 +#: ../../c-api/structures.rst:612 msgid ":c:expr:`short`" msgstr ":c:expr:`short`" -#: ../../c-api/structures.rst:608 +#: ../../c-api/structures.rst:613 msgid ":c:expr:`int`" msgstr ":c:expr:`int`" -#: ../../c-api/structures.rst:609 +#: ../../c-api/structures.rst:614 msgid ":c:expr:`long`" msgstr ":c:expr:`long`" -#: ../../c-api/structures.rst:610 +#: ../../c-api/structures.rst:615 msgid ":c:expr:`long long`" msgstr ":c:expr:`long long`" -#: ../../c-api/structures.rst:611 +#: ../../c-api/structures.rst:616 msgid ":c:expr:`unsigned char`" msgstr ":c:expr:`unsigned char`" -#: ../../c-api/structures.rst:612 +#: ../../c-api/structures.rst:617 msgid ":c:expr:`unsigned int`" msgstr ":c:expr:`unsigned int`" -#: ../../c-api/structures.rst:613 +#: ../../c-api/structures.rst:618 msgid ":c:expr:`unsigned short`" msgstr ":c:expr:`unsigned short`" -#: ../../c-api/structures.rst:614 +#: ../../c-api/structures.rst:619 msgid ":c:expr:`unsigned long`" msgstr ":c:expr:`unsigned long`" -#: ../../c-api/structures.rst:615 +#: ../../c-api/structures.rst:620 msgid ":c:expr:`unsigned long long`" msgstr ":c:expr:`unsigned long long`" -#: ../../c-api/structures.rst:616 +#: ../../c-api/structures.rst:621 msgid ":c:expr:`Py_ssize_t`" msgstr ":c:expr:`Py_ssize_t`" -#: ../../c-api/structures.rst:617 +#: ../../c-api/structures.rst:622 msgid ":c:expr:`float`" msgstr ":c:expr:`float`" -#: ../../c-api/structures.rst:617 ../../c-api/structures.rst:618 +#: ../../c-api/structures.rst:622 ../../c-api/structures.rst:623 msgid ":py:class:`float`" msgstr ":py:class:`float`" -#: ../../c-api/structures.rst:618 +#: ../../c-api/structures.rst:623 msgid ":c:expr:`double`" msgstr ":c:expr:`double`" -#: ../../c-api/structures.rst:619 +#: ../../c-api/structures.rst:624 msgid ":c:expr:`char` (written as 0 or 1)" msgstr ":c:expr:`char` (寫成 0 或 1)" -#: ../../c-api/structures.rst:619 +#: ../../c-api/structures.rst:624 msgid ":py:class:`bool`" msgstr ":py:class:`bool`" -#: ../../c-api/structures.rst:621 +#: ../../c-api/structures.rst:626 msgid ":c:expr:`const char *` (*)" msgstr ":c:expr:`const char *` (*)" -#: ../../c-api/structures.rst:621 ../../c-api/structures.rst:622 +#: ../../c-api/structures.rst:626 ../../c-api/structures.rst:627 msgid ":py:class:`str` (RO)" msgstr ":py:class:`str` (RO)" -#: ../../c-api/structures.rst:622 +#: ../../c-api/structures.rst:627 msgid ":c:expr:`const char[]` (*)" msgstr ":c:expr:`const char[]` (*)" -#: ../../c-api/structures.rst:623 +#: ../../c-api/structures.rst:628 msgid ":c:expr:`char` (0-127)" msgstr ":c:expr:`char` (0-127)" -#: ../../c-api/structures.rst:623 +#: ../../c-api/structures.rst:628 msgid ":py:class:`str` (**)" msgstr ":py:class:`str` (**)" -#: ../../c-api/structures.rst:624 +#: ../../c-api/structures.rst:629 msgid ":c:expr:`PyObject *`" msgstr ":c:expr:`PyObject *`" -#: ../../c-api/structures.rst:624 +#: ../../c-api/structures.rst:629 msgid ":py:class:`object` (D)" msgstr ":py:class:`object` (D)" -#: ../../c-api/structures.rst:627 +#: ../../c-api/structures.rst:632 msgid "" "(*): Zero-terminated, UTF8-encoded C string. With :c:macro:`!Py_T_STRING` " "the C representation is a pointer; with :c:macro:`!Py_T_STRING_INPLACE` the " "string is stored directly in the structure." msgstr "" -#: ../../c-api/structures.rst:632 +#: ../../c-api/structures.rst:637 msgid "(**): String of length 1. Only ASCII is accepted." msgstr "" -#: ../../c-api/structures.rst:634 +#: ../../c-api/structures.rst:639 msgid "(RO): Implies :c:macro:`Py_READONLY`." msgstr "" -#: ../../c-api/structures.rst:636 +#: ../../c-api/structures.rst:641 msgid "" "(D): Can be deleted, in which case the pointer is set to ``NULL``. Reading a " "``NULL`` pointer raises :py:exc:`AttributeError`." msgstr "" -#: ../../c-api/structures.rst:662 +#: ../../c-api/structures.rst:667 msgid "" "In previous versions, the macros were only available with ``#include " "\"structmember.h\"`` and were named without the ``Py_`` prefix (e.g. as " @@ -865,174 +870,174 @@ msgid "" "with the following deprecated types:" msgstr "" -#: ../../c-api/structures.rst:670 +#: ../../c-api/structures.rst:675 msgid "" "Like ``Py_T_OBJECT_EX``, but ``NULL`` is converted to ``None``. This results " "in surprising behavior in Python: deleting the attribute effectively sets it " "to ``None``." msgstr "" -#: ../../c-api/structures.rst:676 +#: ../../c-api/structures.rst:681 msgid "Always ``None``. Must be used with :c:macro:`Py_READONLY`." msgstr "" -#: ../../c-api/structures.rst:679 +#: ../../c-api/structures.rst:684 msgid "Defining Getters and Setters" msgstr "" -#: ../../c-api/structures.rst:683 +#: ../../c-api/structures.rst:688 msgid "" "Structure to define property-like access for a type. See also description of " "the :c:member:`PyTypeObject.tp_getset` slot." msgstr "" -#: ../../c-api/structures.rst:688 +#: ../../c-api/structures.rst:693 msgid "attribute name" msgstr "屬性名稱" -#: ../../c-api/structures.rst:692 +#: ../../c-api/structures.rst:697 msgid "C function to get the attribute." msgstr "" -#: ../../c-api/structures.rst:696 +#: ../../c-api/structures.rst:701 msgid "" "Optional C function to set or delete the attribute. If ``NULL``, the " "attribute is read-only." msgstr "" -#: ../../c-api/structures.rst:701 +#: ../../c-api/structures.rst:706 msgid "optional docstring" msgstr "可選的文件字串" -#: ../../c-api/structures.rst:705 +#: ../../c-api/structures.rst:710 msgid "" "Optional user data pointer, providing additional data for getter and setter." msgstr "" -#: ../../c-api/structures.rst:709 +#: ../../c-api/structures.rst:714 msgid "" "The ``get`` function takes one :c:expr:`PyObject*` parameter (the instance) " "and a user data pointer (the associated ``closure``):" msgstr "" -#: ../../c-api/structures.rst:712 +#: ../../c-api/structures.rst:717 msgid "" "It should return a new reference on success or ``NULL`` with a set exception " "on failure." msgstr "" -#: ../../c-api/structures.rst:717 +#: ../../c-api/structures.rst:722 msgid "" "``set`` functions take two :c:expr:`PyObject*` parameters (the instance and " "the value to be set) and a user data pointer (the associated ``closure``):" msgstr "" -#: ../../c-api/structures.rst:720 +#: ../../c-api/structures.rst:725 msgid "" "In case the attribute should be deleted the second parameter is ``NULL``. " "Should return ``0`` on success or ``-1`` with a set exception on failure." msgstr "" -#: ../../c-api/structures.rst:370 ../../c-api/structures.rst:380 +#: ../../c-api/structures.rst:375 ../../c-api/structures.rst:385 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/structures.rst:370 +#: ../../c-api/structures.rst:375 msgid "classmethod" msgstr "classmethod" -#: ../../c-api/structures.rst:380 +#: ../../c-api/structures.rst:385 msgid "staticmethod" msgstr "staticmethod" -#: ../../c-api/structures.rst:563 +#: ../../c-api/structures.rst:568 msgid "READ_RESTRICTED (C macro)" msgstr "READ_RESTRICTED(C 巨集)" -#: ../../c-api/structures.rst:563 +#: ../../c-api/structures.rst:568 msgid "WRITE_RESTRICTED (C macro)" msgstr "WRITE_RESTRICTED(C 巨集)" -#: ../../c-api/structures.rst:563 +#: ../../c-api/structures.rst:568 msgid "RESTRICTED (C macro)" msgstr "RESTRICTED(C 巨集)" -#: ../../c-api/structures.rst:576 +#: ../../c-api/structures.rst:581 msgid "READONLY (C macro)" msgstr "READONLY(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_BYTE (C macro)" msgstr "T_BYTE(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_SHORT (C macro)" msgstr "T_SHORT(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_INT (C macro)" msgstr "T_INT(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_LONG (C macro)" msgstr "T_LONG(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_LONGLONG (C macro)" msgstr "T_LONGLONG(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_UBYTE (C macro)" msgstr "T_UBYTE(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_USHORT (C macro)" msgstr "T_USHORT(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_UINT (C macro)" msgstr "T_UINT(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_ULONG (C macro)" msgstr "T_ULONG(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_ULONGULONG (C macro)" msgstr "T_ULONGULONG(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_PYSSIZET (C macro)" msgstr "T_PYSSIZET(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_FLOAT (C macro)" msgstr "T_FLOAT(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_DOUBLE (C macro)" msgstr "T_DOUBLE(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_BOOL (C macro)" msgstr "T_BOOL(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_CHAR (C macro)" msgstr "T_CHAR(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_STRING (C macro)" msgstr "T_STRING(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_STRING_INPLACE (C macro)" msgstr "T_STRING_INPLACE(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_OBJECT_EX (C macro)" msgstr "T_OBJECT_EX(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "structmember.h" msgstr "structmember.h" diff --git a/c-api/tuple.po b/c-api/tuple.po index 0392e13819..d70d49e967 100644 --- a/c-api/tuple.po +++ b/c-api/tuple.po @@ -72,16 +72,16 @@ msgstr "" #: ../../c-api/tuple.rst:61 msgid "" "Return the object at position *pos* in the tuple pointed to by *p*. If " -"*pos* is negative or out of bounds, return ``NULL`` and set an :exc:" -"`IndexError` exception." +"*pos* is negative or out of bounds, return ``NULL`` and set " +"an :exc:`IndexError` exception." msgstr "" #: ../../c-api/tuple.rst:64 msgid "" "The returned reference is borrowed from the tuple *p* (that is: it is only " "valid as long as you hold a reference to *p*). To get a :term:`strong " -"reference`, use :c:func:`Py_NewRef(PyTuple_GetItem(...)) ` or :c:" -"func:`PySequence_GetItem`." +"reference`, use :c:func:`Py_NewRef(PyTuple_GetItem(...)) ` " +"or :c:func:`PySequence_GetItem`." msgstr "" #: ../../c-api/tuple.rst:73 @@ -122,15 +122,17 @@ msgstr "" #: ../../c-api/tuple.rst:102 ../../c-api/tuple.rst:218 #: ../../c-api/tuple.rst:236 msgid "" -"Bounds checking is performed as an assertion if Python is built in :ref:" -"`debug mode ` or :option:`with assertions <--with-assertions>`." +"Bounds checking is performed as an assertion if Python is built " +"in :ref:`debug mode ` or :option:`with assertions <--with-" +"assertions>`." msgstr "" #: ../../c-api/tuple.rst:107 msgid "" -"This function \"steals\" a reference to *o*, and, unlike :c:func:" -"`PyTuple_SetItem`, does *not* discard a reference to any item that is being " -"replaced; any reference in the tuple at position *pos* will be leaked." +"This function \"steals\" a reference to *o*, and, " +"unlike :c:func:`PyTuple_SetItem`, does *not* discard a reference to any item " +"that is being replaced; any reference in the tuple at position *pos* will be " +"leaked." msgstr "" #: ../../c-api/tuple.rst:115 @@ -144,8 +146,8 @@ msgid "" "Client code should never assume that the resulting value of ``*p`` will be " "the same as before calling this function. If the object referenced by ``*p`` " "is replaced, the original ``*p`` is destroyed. On failure, returns ``-1`` " -"and sets ``*p`` to ``NULL``, and raises :exc:`MemoryError` or :exc:" -"`SystemError`." +"and sets ``*p`` to ``NULL``, and raises :exc:`MemoryError` " +"or :exc:`SystemError`." msgstr "" #: ../../c-api/tuple.rst:130 @@ -154,22 +156,22 @@ msgstr "" #: ../../c-api/tuple.rst:132 msgid "" -"Struct sequence objects are the C equivalent of :func:`~collections." -"namedtuple` objects, i.e. a sequence whose items can also be accessed " -"through attributes. To create a struct sequence, you first have to create a " -"specific struct sequence type." +"Struct sequence objects are the C equivalent " +"of :func:`~collections.namedtuple` objects, i.e. a sequence whose items can " +"also be accessed through attributes. To create a struct sequence, you first " +"have to create a specific struct sequence type." msgstr "" #: ../../c-api/tuple.rst:139 msgid "" "Create a new struct sequence type from the data in *desc*, described below. " -"Instances of the resulting type can be created with :c:func:" -"`PyStructSequence_New`." +"Instances of the resulting type can be created " +"with :c:func:`PyStructSequence_New`." msgstr "" #: ../../c-api/tuple.rst:142 ../../c-api/tuple.rst:211 msgid "Return ``NULL`` with an exception set on failure." -msgstr "" +msgstr "失敗時回傳 ``NULL`` 並設定例外。" #: ../../c-api/tuple.rst:147 msgid "Initializes a struct sequence type *type* from *desc* in place." @@ -206,16 +208,16 @@ msgstr "" #: ../../c-api/tuple.rst:182 msgid "" "Describes a field of a struct sequence. As a struct sequence is modeled as a " -"tuple, all fields are typed as :c:expr:`PyObject*`. The index in the :c:" -"member:`~PyStructSequence_Desc.fields` array of the :c:type:" -"`PyStructSequence_Desc` determines which field of the struct sequence is " -"described." +"tuple, all fields are typed as :c:expr:`PyObject*`. The index in " +"the :c:member:`~PyStructSequence_Desc.fields` array of " +"the :c:type:`PyStructSequence_Desc` determines which field of the struct " +"sequence is described." msgstr "" #: ../../c-api/tuple.rst:190 msgid "" -"Name for the field or ``NULL`` to end the list of named fields, set to :c:" -"data:`PyStructSequence_UnnamedField` to leave unnamed." +"Name for the field or ``NULL`` to end the list of named fields, set " +"to :c:data:`PyStructSequence_UnnamedField` to leave unnamed." msgstr "" #: ../../c-api/tuple.rst:195 @@ -232,8 +234,8 @@ msgstr "" #: ../../c-api/tuple.rst:208 msgid "" -"Creates an instance of *type*, which must have been created with :c:func:" -"`PyStructSequence_NewType`." +"Creates an instance of *type*, which must have been created " +"with :c:func:`PyStructSequence_NewType`." msgstr "" #: ../../c-api/tuple.rst:216 diff --git a/c-api/type.po b/c-api/type.po index 570d06ce19..0ff3fc423c 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-01 15:01+0000\n" +"POT-Creation-Date: 2025-04-03 00:14+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -98,21 +98,27 @@ msgid "" "exception." msgstr "" -#: ../../c-api/type.rst:90 +#: ../../c-api/type.rst:85 +msgid "" +"In free-threaded builds, :c:func:`PyType_AddWatcher` is not thread-safe, so " +"it must be called at start up (before spawning the first thread)." +msgstr "" + +#: ../../c-api/type.rst:93 msgid "" "Clear watcher identified by *watcher_id* (previously returned from :c:func:" "`PyType_AddWatcher`). Return ``0`` on success, ``-1`` on error (e.g. if " "*watcher_id* was never registered.)" msgstr "" -#: ../../c-api/type.rst:94 +#: ../../c-api/type.rst:97 msgid "" "An extension should never call ``PyType_ClearWatcher`` with a *watcher_id* " "that was not returned to it by a previous call to :c:func:" "`PyType_AddWatcher`." msgstr "" -#: ../../c-api/type.rst:103 +#: ../../c-api/type.rst:106 msgid "" "Mark *type* as watched. The callback granted *watcher_id* by :c:func:" "`PyType_AddWatcher` will be called whenever :c:func:`PyType_Modified` " @@ -122,61 +128,61 @@ msgid "" "detail and subject to change.)" msgstr "" -#: ../../c-api/type.rst:110 +#: ../../c-api/type.rst:113 msgid "" "An extension should never call ``PyType_Watch`` with a *watcher_id* that was " "not returned to it by a previous call to :c:func:`PyType_AddWatcher`." msgstr "" -#: ../../c-api/type.rst:118 +#: ../../c-api/type.rst:121 msgid "Type of a type-watcher callback function." msgstr "" -#: ../../c-api/type.rst:120 +#: ../../c-api/type.rst:123 msgid "" "The callback must not modify *type* or cause :c:func:`PyType_Modified` to be " "called on *type* or any type in its MRO; violating this rule could cause " "infinite recursion." msgstr "" -#: ../../c-api/type.rst:129 +#: ../../c-api/type.rst:132 msgid "" "Return non-zero if the type object *o* sets the feature *feature*. Type " "features are denoted by single bit flags." msgstr "" -#: ../../c-api/type.rst:135 +#: ../../c-api/type.rst:138 msgid "" "Return true if the type object includes support for the cycle detector; this " "tests the type flag :c:macro:`Py_TPFLAGS_HAVE_GC`." msgstr "" -#: ../../c-api/type.rst:141 +#: ../../c-api/type.rst:144 msgid "Return true if *a* is a subtype of *b*." msgstr "" -#: ../../c-api/type.rst:143 +#: ../../c-api/type.rst:146 msgid "" "This function only checks for actual subtypes, which means that :meth:`~type." "__subclasscheck__` is not called on *b*. Call :c:func:`PyObject_IsSubclass` " "to do the same check that :func:`issubclass` would do." msgstr "" -#: ../../c-api/type.rst:151 +#: ../../c-api/type.rst:154 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_alloc` slot of a type " "object. Use Python's default memory allocation mechanism to allocate a new " "instance and initialize all its contents to ``NULL``." msgstr "" -#: ../../c-api/type.rst:157 +#: ../../c-api/type.rst:160 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_new` slot of a type " "object. Create a new instance using the type's :c:member:`~PyTypeObject." "tp_alloc` slot." msgstr "" -#: ../../c-api/type.rst:162 +#: ../../c-api/type.rst:165 msgid "" "Finalize a type object. This should be called on all type objects to finish " "their initialization. This function is responsible for adding inherited " @@ -184,7 +190,7 @@ msgid "" "and sets an exception on error." msgstr "" -#: ../../c-api/type.rst:168 +#: ../../c-api/type.rst:171 msgid "" "If some of the base classes implements the GC protocol and the provided type " "does not include the :c:macro:`Py_TPFLAGS_HAVE_GC` in its flags, then the GC " @@ -195,32 +201,32 @@ msgid "" "handle." msgstr "" -#: ../../c-api/type.rst:178 +#: ../../c-api/type.rst:181 msgid "" "Return the type's name. Equivalent to getting the type's :attr:`~type." "__name__` attribute." msgstr "" -#: ../../c-api/type.rst:185 +#: ../../c-api/type.rst:188 msgid "" "Return the type's qualified name. Equivalent to getting the type's :attr:" "`~type.__qualname__` attribute." msgstr "" -#: ../../c-api/type.rst:192 +#: ../../c-api/type.rst:195 msgid "" "Return the type's fully qualified name. Equivalent to ``f\"{type.__module__}." "{type.__qualname__}\"``, or :attr:`type.__qualname__` if :attr:`type." "__module__` is not a string or is equal to ``\"builtins\"``." msgstr "" -#: ../../c-api/type.rst:200 +#: ../../c-api/type.rst:203 msgid "" "Return the type's module name. Equivalent to getting the :attr:`type." "__module__` attribute." msgstr "" -#: ../../c-api/type.rst:207 +#: ../../c-api/type.rst:210 msgid "" "Return the function pointer stored in the given slot. If the result is " "``NULL``, this indicates that either the slot is ``NULL``, or that the " @@ -228,30 +234,30 @@ msgid "" "result pointer into the appropriate function type." msgstr "" -#: ../../c-api/type.rst:213 +#: ../../c-api/type.rst:216 msgid "" "See :c:member:`PyType_Slot.slot` for possible values of the *slot* argument." msgstr "" -#: ../../c-api/type.rst:217 +#: ../../c-api/type.rst:220 msgid "" ":c:func:`PyType_GetSlot` can now accept all types. Previously, it was " "limited to :ref:`heap types `." msgstr "" -#: ../../c-api/type.rst:223 +#: ../../c-api/type.rst:226 msgid "" "Return the module object associated with the given type when the type was " "created using :c:func:`PyType_FromModuleAndSpec`." msgstr "" -#: ../../c-api/type.rst:226 ../../c-api/type.rst:246 +#: ../../c-api/type.rst:229 ../../c-api/type.rst:249 msgid "" "If no module is associated with the given type, sets :py:class:`TypeError` " "and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:229 +#: ../../c-api/type.rst:232 msgid "" "This function is usually used to get the module in which a method is " "defined. Note that in such a method, ``PyType_GetModule(Py_TYPE(self))`` may " @@ -262,31 +268,31 @@ msgid "" "type:`!PyCMethod` cannot be used." msgstr "" -#: ../../c-api/type.rst:242 +#: ../../c-api/type.rst:245 msgid "" "Return the state of the module object associated with the given type. This " "is a shortcut for calling :c:func:`PyModule_GetState()` on the result of :c:" "func:`PyType_GetModule`." msgstr "" -#: ../../c-api/type.rst:249 +#: ../../c-api/type.rst:252 msgid "" "If the *type* has an associated module but its state is ``NULL``, returns " "``NULL`` without setting an exception." msgstr "" -#: ../../c-api/type.rst:256 +#: ../../c-api/type.rst:259 msgid "" "Find the first superclass whose module was created from the given :c:type:" "`PyModuleDef` *def*, and return that module." msgstr "" -#: ../../c-api/type.rst:259 +#: ../../c-api/type.rst:262 msgid "" "If no module is found, raises a :py:class:`TypeError` and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:261 +#: ../../c-api/type.rst:264 msgid "" "This function is intended to be used together with :c:func:" "`PyModule_GetState()` to get module state from slot methods (such as :c:" @@ -295,40 +301,40 @@ msgid "" "type:`PyCMethod` calling convention." msgstr "" -#: ../../c-api/type.rst:271 +#: ../../c-api/type.rst:274 msgid "Attempt to assign a version tag to the given type." msgstr "" -#: ../../c-api/type.rst:273 +#: ../../c-api/type.rst:276 msgid "" "Returns 1 if the type already had a valid version tag or a new one was " "assigned, or 0 if a new tag could not be assigned." msgstr "" -#: ../../c-api/type.rst:280 +#: ../../c-api/type.rst:283 msgid "Creating Heap-Allocated Types" msgstr "" -#: ../../c-api/type.rst:282 +#: ../../c-api/type.rst:285 msgid "" "The following functions and structs are used to create :ref:`heap types " "`." msgstr "" -#: ../../c-api/type.rst:287 +#: ../../c-api/type.rst:290 msgid "" "Create and return a :ref:`heap type ` from the *spec* (see :c:" "macro:`Py_TPFLAGS_HEAPTYPE`)." msgstr "" -#: ../../c-api/type.rst:290 +#: ../../c-api/type.rst:293 msgid "" "The metaclass *metaclass* is used to construct the resulting type object. " "When *metaclass* is ``NULL``, the metaclass is derived from *bases* (or " "*Py_tp_base[s]* slots if *bases* is ``NULL``, see below)." msgstr "" -#: ../../c-api/type.rst:294 +#: ../../c-api/type.rst:297 msgid "" "Metaclasses that override :c:member:`~PyTypeObject.tp_new` are not " "supported, except if ``tp_new`` is ``NULL``. (For backwards compatibility, " @@ -337,7 +343,7 @@ msgid "" "deprecated and in Python 3.14+ such metaclasses will not be supported.)" msgstr "" -#: ../../c-api/type.rst:301 +#: ../../c-api/type.rst:304 msgid "" "The *bases* argument can be used to specify base classes; it can either be " "only one class or a tuple of classes. If *bases* is ``NULL``, the " @@ -346,7 +352,7 @@ msgid "" "derives from :class:`object`." msgstr "" -#: ../../c-api/type.rst:307 +#: ../../c-api/type.rst:310 msgid "" "The *module* argument can be used to record the module in which the new " "class is defined. It must be a module object or ``NULL``. If not ``NULL``, " @@ -355,11 +361,11 @@ msgid "" "subclasses; it must be specified for each class individually." msgstr "" -#: ../../c-api/type.rst:314 +#: ../../c-api/type.rst:317 msgid "This function calls :c:func:`PyType_Ready` on the new type." msgstr "" -#: ../../c-api/type.rst:316 +#: ../../c-api/type.rst:319 msgid "" "Note that this function does *not* fully match the behavior of calling :py:" "class:`type() ` or using the :keyword:`class` statement. With user-" @@ -368,41 +374,41 @@ msgid "" "Specifically:" msgstr "" -#: ../../c-api/type.rst:323 +#: ../../c-api/type.rst:326 msgid "" ":py:meth:`~object.__new__` is not called on the new class (and it must be " "set to ``type.__new__``)." msgstr "" -#: ../../c-api/type.rst:325 +#: ../../c-api/type.rst:328 msgid ":py:meth:`~object.__init__` is not called on the new class." msgstr "" -#: ../../c-api/type.rst:326 +#: ../../c-api/type.rst:329 msgid ":py:meth:`~object.__init_subclass__` is not called on any bases." msgstr "" -#: ../../c-api/type.rst:327 +#: ../../c-api/type.rst:330 msgid ":py:meth:`~object.__set_name__` is not called on new descriptors." msgstr "" -#: ../../c-api/type.rst:333 +#: ../../c-api/type.rst:336 msgid "Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, module, spec, bases)``。" -#: ../../c-api/type.rst:339 +#: ../../c-api/type.rst:342 msgid "" "The function now accepts a single class as the *bases* argument and ``NULL`` " "as the ``tp_doc`` slot." msgstr "" -#: ../../c-api/type.rst:344 ../../c-api/type.rst:361 +#: ../../c-api/type.rst:347 ../../c-api/type.rst:364 msgid "" "The function now finds and uses a metaclass corresponding to the provided " "base classes. Previously, only :class:`type` instances were returned." msgstr "" -#: ../../c-api/type.rst:347 ../../c-api/type.rst:364 ../../c-api/type.rst:380 +#: ../../c-api/type.rst:350 ../../c-api/type.rst:367 ../../c-api/type.rst:383 msgid "" "The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*. which " "may result in incomplete initialization. Creating classes whose metaclass " @@ -410,60 +416,62 @@ msgid "" "it will be no longer allowed." msgstr "" -#: ../../c-api/type.rst:355 +#: ../../c-api/type.rst:358 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, bases)``。" -#: ../../c-api/type.rst:372 +#: ../../c-api/type.rst:375 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``。" -#: ../../c-api/type.rst:376 +#: ../../c-api/type.rst:379 msgid "" "The function now finds and uses a metaclass corresponding to the base " "classes provided in *Py_tp_base[s]* slots. Previously, only :class:`type` " "instances were returned." msgstr "" -#: ../../c-api/type.rst:397 +#: ../../c-api/type.rst:400 msgid "Structure defining a type's behavior." msgstr "" -#: ../../c-api/type.rst:401 +#: ../../c-api/type.rst:404 msgid "Name of the type, used to set :c:member:`PyTypeObject.tp_name`." msgstr "" -#: ../../c-api/type.rst:405 +#: ../../c-api/type.rst:408 msgid "" "If positive, specifies the size of the instance in bytes. It is used to set :" "c:member:`PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/type.rst:408 +#: ../../c-api/type.rst:411 msgid "" "If zero, specifies that :c:member:`~PyTypeObject.tp_basicsize` should be " "inherited." msgstr "" -#: ../../c-api/type.rst:411 +#: ../../c-api/type.rst:414 msgid "" "If negative, the absolute value specifies how much space instances of the " "class need *in addition* to the superclass. Use :c:func:" "`PyObject_GetTypeData` to get a pointer to subclass-specific memory reserved " -"this way." +"this way. For negative :c:member:`!basicsize`, Python will insert padding " +"when needed to meet :c:member:`~PyTypeObject.tp_basicsize`'s alignment " +"requirements." msgstr "" -#: ../../c-api/type.rst:418 +#: ../../c-api/type.rst:424 msgid "Previously, this field could not be negative." msgstr "" -#: ../../c-api/type.rst:422 +#: ../../c-api/type.rst:428 msgid "" "Size of one element of a variable-size type, in bytes. Used to set :c:member:" "`PyTypeObject.tp_itemsize`. See ``tp_itemsize`` documentation for caveats." msgstr "" -#: ../../c-api/type.rst:426 +#: ../../c-api/type.rst:432 msgid "" "If zero, :c:member:`~PyTypeObject.tp_itemsize` is inherited. Extending " "arbitrary variable-sized classes is dangerous, since some types use a fixed " @@ -472,58 +480,58 @@ msgid "" "only possible in the following situations:" msgstr "" -#: ../../c-api/type.rst:433 +#: ../../c-api/type.rst:439 msgid "" "The base is not variable-sized (its :c:member:`~PyTypeObject.tp_itemsize`)." msgstr "" -#: ../../c-api/type.rst:435 +#: ../../c-api/type.rst:441 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is positive, suggesting that " "the memory layout of the base class is known." msgstr "" -#: ../../c-api/type.rst:437 +#: ../../c-api/type.rst:443 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is zero, suggesting that the " "subclass does not access the instance's memory directly." msgstr "" -#: ../../c-api/type.rst:440 +#: ../../c-api/type.rst:446 msgid "With the :c:macro:`Py_TPFLAGS_ITEMS_AT_END` flag." msgstr "" -#: ../../c-api/type.rst:444 +#: ../../c-api/type.rst:450 msgid "Type flags, used to set :c:member:`PyTypeObject.tp_flags`." msgstr "" -#: ../../c-api/type.rst:446 +#: ../../c-api/type.rst:452 msgid "" "If the ``Py_TPFLAGS_HEAPTYPE`` flag is not set, :c:func:" "`PyType_FromSpecWithBases` sets it automatically." msgstr "" -#: ../../c-api/type.rst:451 +#: ../../c-api/type.rst:457 msgid "" "Array of :c:type:`PyType_Slot` structures. Terminated by the special slot " "value ``{0, NULL}``." msgstr "" -#: ../../c-api/type.rst:454 +#: ../../c-api/type.rst:460 msgid "Each slot ID should be specified at most once." msgstr "" -#: ../../c-api/type.rst:464 +#: ../../c-api/type.rst:470 msgid "" "Structure defining optional functionality of a type, containing a slot ID " "and a value pointer." msgstr "" -#: ../../c-api/type.rst:469 +#: ../../c-api/type.rst:475 msgid "A slot ID." msgstr "" -#: ../../c-api/type.rst:471 +#: ../../c-api/type.rst:477 msgid "" "Slot IDs are named like the field names of the structures :c:type:" "`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:" @@ -531,30 +539,30 @@ msgid "" "prefix. For example, use:" msgstr "" -#: ../../c-api/type.rst:477 +#: ../../c-api/type.rst:483 msgid "``Py_tp_dealloc`` to set :c:member:`PyTypeObject.tp_dealloc`" msgstr "" -#: ../../c-api/type.rst:478 +#: ../../c-api/type.rst:484 msgid "``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`" msgstr "" -#: ../../c-api/type.rst:479 +#: ../../c-api/type.rst:485 msgid "``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`" msgstr "" -#: ../../c-api/type.rst:481 +#: ../../c-api/type.rst:487 msgid "" "The following “offset” fields cannot be set using :c:type:`PyType_Slot`:" msgstr "" -#: ../../c-api/type.rst:483 +#: ../../c-api/type.rst:489 msgid "" ":c:member:`~PyTypeObject.tp_weaklistoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)" msgstr "" -#: ../../c-api/type.rst:485 +#: ../../c-api/type.rst:491 msgid "" ":c:member:`~PyTypeObject.tp_dictoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_DICT` instead if possible)" @@ -562,7 +570,7 @@ msgstr "" ":c:member:`~PyTypeObject.tp_dictoffset`\\ (如果可能,請改用 :c:macro:" "`Py_TPFLAGS_MANAGED_DICT`)" -#: ../../c-api/type.rst:487 +#: ../../c-api/type.rst:493 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall_offset` (use " "``\"__vectorcalloffset__\"`` in :ref:`PyMemberDef `)" @@ -570,7 +578,7 @@ msgstr "" ":c:member:`~PyTypeObject.tp_vectorcall_offset`\\ (請用 :ref:`PyMemberDef " "` 中的 ``\"__vectorcalloffset__\"``)" -#: ../../c-api/type.rst:491 +#: ../../c-api/type.rst:497 msgid "" "If it is not possible to switch to a ``MANAGED`` flag (for example, for " "vectorcall or to support Python older than 3.12), specify the offset in :c:" @@ -578,48 +586,48 @@ msgid "" "documentation ` for details." msgstr "" -#: ../../c-api/type.rst:497 +#: ../../c-api/type.rst:503 msgid "The following fields cannot be set at all when creating a heap type:" msgstr "" -#: ../../c-api/type.rst:499 +#: ../../c-api/type.rst:505 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall` (use :c:member:`~PyTypeObject." "tp_new` and/or :c:member:`~PyTypeObject.tp_init`)" msgstr "" -#: ../../c-api/type.rst:503 +#: ../../c-api/type.rst:509 msgid "" "Internal fields: :c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject." "tp_mro`, :c:member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject." "tp_subclasses`, and :c:member:`~PyTypeObject.tp_weaklist`." msgstr "" -#: ../../c-api/type.rst:510 +#: ../../c-api/type.rst:516 msgid "" "Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be problematic on " "some platforms. To avoid issues, use the *bases* argument of :c:func:" "`PyType_FromSpecWithBases` instead." msgstr "" -#: ../../c-api/type.rst:515 +#: ../../c-api/type.rst:521 msgid "Slots in :c:type:`PyBufferProcs` may be set in the unlimited API." msgstr "" -#: ../../c-api/type.rst:518 +#: ../../c-api/type.rst:524 msgid "" ":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." "bf_releasebuffer` are now available under the :ref:`limited API `." msgstr "" -#: ../../c-api/type.rst:525 +#: ../../c-api/type.rst:531 msgid "" "The desired value of the slot. In most cases, this is a pointer to a " "function." msgstr "" -#: ../../c-api/type.rst:528 +#: ../../c-api/type.rst:534 msgid "Slots other than ``Py_tp_doc`` may not be ``NULL``." msgstr "" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 2b7e6341f3..75a03344e9 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-22 00:13+0000\n" +"POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -18,7 +18,8 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../c-api/typeobj.rst:6 -msgid "Type Objects" +#, fuzzy +msgid "Type Object Structures" msgstr "型別物件" #: ../../c-api/typeobj.rst:8 @@ -1172,7 +1173,7 @@ msgstr "" #: ../../c-api/typeobj.rst:475 msgid "" "The structure definition for :c:type:`PyTypeObject` can be found in :file:" -"`Include/object.h`. For convenience of reference, this repeats the " +"`Include/cpython/object.h`. For convenience of reference, this repeats the " "definition found there:" msgstr "" @@ -1291,42 +1292,42 @@ msgid "" msgstr "" #: ../../c-api/typeobj.rst:503 ../../c-api/typeobj.rst:526 -#: ../../c-api/typeobj.rst:540 ../../c-api/typeobj.rst:584 -#: ../../c-api/typeobj.rst:627 ../../c-api/typeobj.rst:699 -#: ../../c-api/typeobj.rst:740 ../../c-api/typeobj.rst:757 -#: ../../c-api/typeobj.rst:774 ../../c-api/typeobj.rst:792 -#: ../../c-api/typeobj.rst:816 ../../c-api/typeobj.rst:833 -#: ../../c-api/typeobj.rst:845 ../../c-api/typeobj.rst:857 -#: ../../c-api/typeobj.rst:890 ../../c-api/typeobj.rst:912 -#: ../../c-api/typeobj.rst:932 ../../c-api/typeobj.rst:953 -#: ../../c-api/typeobj.rst:979 ../../c-api/typeobj.rst:998 -#: ../../c-api/typeobj.rst:1014 ../../c-api/typeobj.rst:1053 -#: ../../c-api/typeobj.rst:1064 ../../c-api/typeobj.rst:1074 -#: ../../c-api/typeobj.rst:1084 ../../c-api/typeobj.rst:1098 -#: ../../c-api/typeobj.rst:1116 ../../c-api/typeobj.rst:1139 -#: ../../c-api/typeobj.rst:1157 ../../c-api/typeobj.rst:1170 -#: ../../c-api/typeobj.rst:1192 ../../c-api/typeobj.rst:1236 -#: ../../c-api/typeobj.rst:1257 ../../c-api/typeobj.rst:1276 -#: ../../c-api/typeobj.rst:1306 ../../c-api/typeobj.rst:1328 -#: ../../c-api/typeobj.rst:1354 ../../c-api/typeobj.rst:1439 -#: ../../c-api/typeobj.rst:1513 ../../c-api/typeobj.rst:1574 -#: ../../c-api/typeobj.rst:1610 ../../c-api/typeobj.rst:1635 -#: ../../c-api/typeobj.rst:1658 ../../c-api/typeobj.rst:1671 -#: ../../c-api/typeobj.rst:1686 ../../c-api/typeobj.rst:1700 -#: ../../c-api/typeobj.rst:1730 ../../c-api/typeobj.rst:1762 -#: ../../c-api/typeobj.rst:1788 ../../c-api/typeobj.rst:1806 -#: ../../c-api/typeobj.rst:1835 ../../c-api/typeobj.rst:1879 -#: ../../c-api/typeobj.rst:1896 ../../c-api/typeobj.rst:1937 -#: ../../c-api/typeobj.rst:1959 ../../c-api/typeobj.rst:1991 -#: ../../c-api/typeobj.rst:2019 ../../c-api/typeobj.rst:2032 -#: ../../c-api/typeobj.rst:2042 ../../c-api/typeobj.rst:2059 -#: ../../c-api/typeobj.rst:2076 ../../c-api/typeobj.rst:2090 -#: ../../c-api/typeobj.rst:2125 ../../c-api/typeobj.rst:2148 +#: ../../c-api/typeobj.rst:543 ../../c-api/typeobj.rst:587 +#: ../../c-api/typeobj.rst:665 ../../c-api/typeobj.rst:741 +#: ../../c-api/typeobj.rst:782 ../../c-api/typeobj.rst:799 +#: ../../c-api/typeobj.rst:816 ../../c-api/typeobj.rst:834 +#: ../../c-api/typeobj.rst:858 ../../c-api/typeobj.rst:875 +#: ../../c-api/typeobj.rst:887 ../../c-api/typeobj.rst:899 +#: ../../c-api/typeobj.rst:932 ../../c-api/typeobj.rst:954 +#: ../../c-api/typeobj.rst:974 ../../c-api/typeobj.rst:995 +#: ../../c-api/typeobj.rst:1021 ../../c-api/typeobj.rst:1040 +#: ../../c-api/typeobj.rst:1056 ../../c-api/typeobj.rst:1095 +#: ../../c-api/typeobj.rst:1106 ../../c-api/typeobj.rst:1116 +#: ../../c-api/typeobj.rst:1126 ../../c-api/typeobj.rst:1140 +#: ../../c-api/typeobj.rst:1158 ../../c-api/typeobj.rst:1181 +#: ../../c-api/typeobj.rst:1199 ../../c-api/typeobj.rst:1212 +#: ../../c-api/typeobj.rst:1234 ../../c-api/typeobj.rst:1278 +#: ../../c-api/typeobj.rst:1299 ../../c-api/typeobj.rst:1318 +#: ../../c-api/typeobj.rst:1348 ../../c-api/typeobj.rst:1370 +#: ../../c-api/typeobj.rst:1396 ../../c-api/typeobj.rst:1481 +#: ../../c-api/typeobj.rst:1555 ../../c-api/typeobj.rst:1616 +#: ../../c-api/typeobj.rst:1652 ../../c-api/typeobj.rst:1677 +#: ../../c-api/typeobj.rst:1700 ../../c-api/typeobj.rst:1713 +#: ../../c-api/typeobj.rst:1728 ../../c-api/typeobj.rst:1742 +#: ../../c-api/typeobj.rst:1772 ../../c-api/typeobj.rst:1804 +#: ../../c-api/typeobj.rst:1830 ../../c-api/typeobj.rst:1848 +#: ../../c-api/typeobj.rst:1877 ../../c-api/typeobj.rst:1921 +#: ../../c-api/typeobj.rst:1938 ../../c-api/typeobj.rst:1979 +#: ../../c-api/typeobj.rst:2001 ../../c-api/typeobj.rst:2033 +#: ../../c-api/typeobj.rst:2061 ../../c-api/typeobj.rst:2074 +#: ../../c-api/typeobj.rst:2084 ../../c-api/typeobj.rst:2101 +#: ../../c-api/typeobj.rst:2118 ../../c-api/typeobj.rst:2132 +#: ../../c-api/typeobj.rst:2165 ../../c-api/typeobj.rst:2188 msgid "**Inheritance:**" msgstr "" -#: ../../c-api/typeobj.rst:505 ../../c-api/typeobj.rst:542 -#: ../../c-api/typeobj.rst:586 +#: ../../c-api/typeobj.rst:505 ../../c-api/typeobj.rst:545 +#: ../../c-api/typeobj.rst:589 msgid "This field is not inherited by subtypes." msgstr "" @@ -1354,12 +1355,12 @@ msgid "" "class. :c:func:`PyType_Ready` will not change this field if it is non-zero." msgstr "" -#: ../../c-api/typeobj.rst:528 ../../c-api/typeobj.rst:701 -#: ../../c-api/typeobj.rst:818 ../../c-api/typeobj.rst:914 -#: ../../c-api/typeobj.rst:934 ../../c-api/typeobj.rst:1637 -#: ../../c-api/typeobj.rst:1660 ../../c-api/typeobj.rst:1790 -#: ../../c-api/typeobj.rst:1808 ../../c-api/typeobj.rst:1881 -#: ../../c-api/typeobj.rst:1993 ../../c-api/typeobj.rst:2127 +#: ../../c-api/typeobj.rst:528 ../../c-api/typeobj.rst:743 +#: ../../c-api/typeobj.rst:860 ../../c-api/typeobj.rst:956 +#: ../../c-api/typeobj.rst:976 ../../c-api/typeobj.rst:1679 +#: ../../c-api/typeobj.rst:1702 ../../c-api/typeobj.rst:1832 +#: ../../c-api/typeobj.rst:1850 ../../c-api/typeobj.rst:1923 +#: ../../c-api/typeobj.rst:2035 ../../c-api/typeobj.rst:2167 msgid "This field is inherited by subtypes." msgstr "" @@ -1374,11 +1375,17 @@ msgid "" "types>`, this field has a special internal meaning." msgstr "" -#: ../../c-api/typeobj.rst:546 +#: ../../c-api/typeobj.rst:540 +msgid "" +"This field should be accessed using the :c:func:`Py_SIZE()` and :c:func:" +"`Py_SET_SIZE()` macros." +msgstr "" + +#: ../../c-api/typeobj.rst:549 msgid "PyTypeObject Slots" msgstr "" -#: ../../c-api/typeobj.rst:548 +#: ../../c-api/typeobj.rst:551 msgid "" "Each slot has a section describing inheritance. If :c:func:`PyType_Ready` " "may set a value when the field is set to ``NULL`` then there will also be a " @@ -1386,7 +1393,7 @@ msgid "" "`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as defaults.)" msgstr "" -#: ../../c-api/typeobj.rst:555 +#: ../../c-api/typeobj.rst:558 msgid "" "Pointer to a NUL-terminated string containing the name of the type. For " "types that are accessible as module globals, the string should be the full " @@ -1398,14 +1405,14 @@ msgid "" "tp_name` initializer ``\"P.Q.M.T\"``." msgstr "" -#: ../../c-api/typeobj.rst:563 +#: ../../c-api/typeobj.rst:566 msgid "" "For :ref:`dynamically allocated type objects `, this should just " "be the type name, and the module name explicitly stored in the type dict as " "the value for key ``'__module__'``." msgstr "" -#: ../../c-api/typeobj.rst:568 +#: ../../c-api/typeobj.rst:571 msgid "" "For :ref:`statically allocated type objects `, the *tp_name* " "field should contain a dot. Everything before the last dot is made " @@ -1413,7 +1420,7 @@ msgid "" "the last dot is made accessible as the :attr:`~type.__name__` attribute." msgstr "" -#: ../../c-api/typeobj.rst:574 +#: ../../c-api/typeobj.rst:577 msgid "" "If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is " "made accessible as the :attr:`~type.__name__` attribute, and the :attr:" @@ -1423,80 +1430,136 @@ msgid "" "created with pydoc." msgstr "" -#: ../../c-api/typeobj.rst:580 +#: ../../c-api/typeobj.rst:583 msgid "" "This field must not be ``NULL``. It is the only required field in :c:func:" "`PyTypeObject` (other than potentially :c:member:`~PyTypeObject." "tp_itemsize`)." msgstr "" -#: ../../c-api/typeobj.rst:592 +#: ../../c-api/typeobj.rst:595 msgid "" "These fields allow calculating the size in bytes of instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:594 +#: ../../c-api/typeobj.rst:597 msgid "" "There are two kinds of types: types with fixed-length instances have a zero :" -"c:member:`~PyTypeObject.tp_itemsize` field, types with variable-length " -"instances have a non-zero :c:member:`~PyTypeObject.tp_itemsize` field. For " -"a type with fixed-length instances, all instances have the same size, given " -"in :c:member:`~PyTypeObject.tp_basicsize`." +"c:member:`!tp_itemsize` field, types with variable-length instances have a " +"non-zero :c:member:`!tp_itemsize` field. For a type with fixed-length " +"instances, all instances have the same size, given in :c:member:`!" +"tp_basicsize`. (Exceptions to this rule can be made using :c:func:" +"`PyUnstable_Object_GC_NewWithExtraData`.)" msgstr "" -#: ../../c-api/typeobj.rst:599 +#: ../../c-api/typeobj.rst:604 msgid "" "For a type with variable-length instances, the instances must have an :c:" -"member:`~PyVarObject.ob_size` field, and the instance size is :c:member:" -"`~PyTypeObject.tp_basicsize` plus N times :c:member:`~PyTypeObject." -"tp_itemsize`, where N is the \"length\" of the object. The value of N is " -"typically stored in the instance's :c:member:`~PyVarObject.ob_size` field. " -"There are exceptions: for example, ints use a negative :c:member:" -"`~PyVarObject.ob_size` to indicate a negative number, and N is " -"``abs(ob_size)`` there. Also, the presence of an :c:member:`~PyVarObject." -"ob_size` field in the instance layout doesn't mean that the instance " -"structure is variable-length (for example, the structure for the list type " -"has fixed-length instances, yet those instances have a meaningful :c:member:" -"`~PyVarObject.ob_size` field)." +"member:`~PyVarObject.ob_size` field, and the instance size is :c:member:`!" +"tp_basicsize` plus N times :c:member:`!tp_itemsize`, where N is the " +"\"length\" of the object." msgstr "" -#: ../../c-api/typeobj.rst:610 +#: ../../c-api/typeobj.rst:609 msgid "" -"The basic size includes the fields in the instance declared by the macro :c:" -"macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD` (whichever is used to " -"declare the instance struct) and this in turn includes the :c:member:" -"`~PyObject._ob_prev` and :c:member:`~PyObject._ob_next` fields if they are " -"present. This means that the only correct way to get an initializer for " -"the :c:member:`~PyTypeObject.tp_basicsize` is to use the ``sizeof`` operator " -"on the struct used to declare the instance layout. The basic size does not " -"include the GC header size." +"Functions like :c:func:`PyObject_NewVar` will take the value of N as an " +"argument, and store in the instance's :c:member:`~PyVarObject.ob_size` " +"field. Note that the :c:member:`~PyVarObject.ob_size` field may later be " +"used for other purposes. For example, :py:type:`int` instances use the bits " +"of :c:member:`~PyVarObject.ob_size` in an implementation-defined way; the " +"underlying storage and its size should be accessed using :c:func:" +"`PyLong_Export`." msgstr "" -#: ../../c-api/typeobj.rst:618 +#: ../../c-api/typeobj.rst:619 msgid "" -"A note about alignment: if the variable items require a particular " -"alignment, this should be taken care of by the value of :c:member:" -"`~PyTypeObject.tp_basicsize`. Example: suppose a type implements an array " -"of ``double``. :c:member:`~PyTypeObject.tp_itemsize` is ``sizeof(double)``. " -"It is the programmer's responsibility that :c:member:`~PyTypeObject." -"tp_basicsize` is a multiple of ``sizeof(double)`` (assuming this is the " -"alignment requirement for ``double``)." +"The :c:member:`~PyVarObject.ob_size` field should be accessed using the :c:" +"func:`Py_SIZE()` and :c:func:`Py_SET_SIZE()` macros." msgstr "" -#: ../../c-api/typeobj.rst:625 +#: ../../c-api/typeobj.rst:622 msgid "" -"For any type with variable-length instances, this field must not be ``NULL``." +"Also, the presence of an :c:member:`~PyVarObject.ob_size` field in the " +"instance layout doesn't mean that the instance structure is variable-length. " +"For example, the :py:type:`list` type has fixed-length instances, yet those " +"instances have a :c:member:`~PyVarObject.ob_size` field. (As with :py:type:" +"`int`, avoid reading lists' :c:member:`!ob_size` directly. Call :c:func:" +"`PyList_Size` instead.)" msgstr "" #: ../../c-api/typeobj.rst:629 msgid "" -"These fields are inherited separately by subtypes. If the base type has a " -"non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is generally not safe to " -"set :c:member:`~PyTypeObject.tp_itemsize` to a different non-zero value in a " -"subtype (though this depends on the implementation of the base type)." +"The :c:member:`!tp_basicsize` includes size needed for data of the type's :c:" +"member:`~PyTypeObject.tp_base`, plus any extra data needed by each instance." +msgstr "" + +#: ../../c-api/typeobj.rst:633 +msgid "" +"The correct way to set :c:member:`!tp_basicsize` is to use the ``sizeof`` " +"operator on the struct used to declare the instance layout. This struct must " +"include the struct used to declare the base type. In other words, :c:member:" +"`!tp_basicsize` must be greater than or equal to the base's :c:member:`!" +"tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:637 +#: ../../c-api/typeobj.rst:639 +msgid "" +"Since every type is a subtype of :py:type:`object`, this struct must " +"include :c:type:`PyObject` or :c:type:`PyVarObject` (depending on whether :c:" +"member:`~PyVarObject.ob_size` should be included). These are usually defined " +"by the macro :c:macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD`, " +"respectively." +msgstr "" + +#: ../../c-api/typeobj.rst:645 +msgid "" +"The basic size does not include the GC header size, as that header is not " +"part of :c:macro:`PyObject_HEAD`." +msgstr "" + +#: ../../c-api/typeobj.rst:648 +msgid "" +"For cases where struct used to declare the base type is unknown, see :c:" +"member:`PyType_Spec.basicsize` and :c:func:`PyType_FromMetaclass`." +msgstr "" + +#: ../../c-api/typeobj.rst:651 +msgid "Notes about alignment:" +msgstr "" + +#: ../../c-api/typeobj.rst:653 +msgid "" +":c:member:`!tp_basicsize` must be a multiple of ``_Alignof(PyObject)``. When " +"using ``sizeof`` on a ``struct`` that includes :c:macro:`PyObject_HEAD`, as " +"recommended, the compiler ensures this. When not using a C ``struct``, or " +"when using compiler extensions like ``__attribute__((packed))``, it is up to " +"you." +msgstr "" + +#: ../../c-api/typeobj.rst:658 +msgid "" +"If the variable items require a particular alignment, :c:member:`!" +"tp_basicsize` and :c:member:`!tp_itemsize` must each be a multiple of that " +"alignment. For example, if a type's variable part stores a ``double``, it is " +"your responsibility that both fields are a multiple of ``_Alignof(double)``." +msgstr "" + +#: ../../c-api/typeobj.rst:667 +msgid "" +"These fields are inherited separately by subtypes. (That is, if the field is " +"set to zero, :c:func:`PyType_Ready` will copy the value from the base type, " +"indicating that the instances do not need additional storage.)" +msgstr "" + +#: ../../c-api/typeobj.rst:672 +msgid "" +"If the base type has a non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is " +"generally not safe to set :c:member:`~PyTypeObject.tp_itemsize` to a " +"different non-zero value in a subtype (though this depends on the " +"implementation of the base type)." +msgstr "" + +#: ../../c-api/typeobj.rst:679 msgid "" "A pointer to the instance destructor function. This function must be " "defined unless the type guarantees that its instances will never be " @@ -1504,11 +1567,11 @@ msgid "" "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:641 +#: ../../c-api/typeobj.rst:683 msgid "void tp_dealloc(PyObject *self);" msgstr "void tp_dealloc(PyObject *self);" -#: ../../c-api/typeobj.rst:643 +#: ../../c-api/typeobj.rst:685 msgid "" "The destructor function is called by the :c:func:`Py_DECREF` and :c:func:" "`Py_XDECREF` macros when the new reference count is zero. At this point, " @@ -1526,14 +1589,14 @@ msgid "" "allocated using :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar`." msgstr "" -#: ../../c-api/typeobj.rst:658 +#: ../../c-api/typeobj.rst:700 msgid "" "If the type supports garbage collection (has the :c:macro:" "`Py_TPFLAGS_HAVE_GC` flag bit set), the destructor should call :c:func:" "`PyObject_GC_UnTrack` before clearing any member fields." msgstr "" -#: ../../c-api/typeobj.rst:662 +#: ../../c-api/typeobj.rst:704 msgid "" "static void foo_dealloc(foo_object *self) {\n" " PyObject_GC_UnTrack(self);\n" @@ -1547,7 +1610,7 @@ msgstr "" " Py_TYPE(self)->tp_free((PyObject *)self);\n" "}" -#: ../../c-api/typeobj.rst:670 +#: ../../c-api/typeobj.rst:712 msgid "" "Finally, if the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the " "deallocator should release the owned reference to its type object (via :c:" @@ -1555,7 +1618,7 @@ msgid "" "dangling pointers, the recommended way to achieve this is:" msgstr "" -#: ../../c-api/typeobj.rst:676 +#: ../../c-api/typeobj.rst:718 msgid "" "static void foo_dealloc(foo_object *self) {\n" " PyTypeObject *tp = Py_TYPE(self);\n" @@ -1565,7 +1628,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:687 +#: ../../c-api/typeobj.rst:729 msgid "" "In a garbage collected Python, :c:member:`!tp_dealloc` may be called from " "any Python thread, not just the thread which created the object (if the " @@ -1578,28 +1641,28 @@ msgid "" "member:`!tp_dealloc` will not violate any assumptions of the library." msgstr "" -#: ../../c-api/typeobj.rst:706 +#: ../../c-api/typeobj.rst:748 msgid "" "An optional offset to a per-instance function that implements calling the " "object using the :ref:`vectorcall protocol `, a more efficient " "alternative of the simpler :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:711 +#: ../../c-api/typeobj.rst:753 msgid "" "This field is only used if the flag :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` is " "set. If so, this must be a positive integer containing the offset in the " "instance of a :c:type:`vectorcallfunc` pointer." msgstr "" -#: ../../c-api/typeobj.rst:715 +#: ../../c-api/typeobj.rst:757 msgid "" "The *vectorcallfunc* pointer may be ``NULL``, in which case the instance " "behaves as if :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` was not set: calling the " "instance falls back to :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:719 +#: ../../c-api/typeobj.rst:761 msgid "" "Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also set :c:member:" "`~PyTypeObject.tp_call` and make sure its behaviour is consistent with the " @@ -1607,13 +1670,13 @@ msgid "" "`PyVectorcall_Call`." msgstr "" -#: ../../c-api/typeobj.rst:726 +#: ../../c-api/typeobj.rst:768 msgid "" "Before version 3.8, this slot was named ``tp_print``. In Python 2.x, it was " "used for printing to a file. In Python 3.0 to 3.7, it was unused." msgstr "" -#: ../../c-api/typeobj.rst:732 +#: ../../c-api/typeobj.rst:774 msgid "" "Before version 3.12, it was not recommended for :ref:`mutable heap types " "` to implement the vectorcall protocol. When a user sets :attr:" @@ -1623,7 +1686,7 @@ msgid "" "`Py_TPFLAGS_HAVE_VECTORCALL` flag." msgstr "" -#: ../../c-api/typeobj.rst:742 +#: ../../c-api/typeobj.rst:784 msgid "" "This field is always inherited. However, the :c:macro:" "`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If it's not set, " @@ -1631,11 +1694,11 @@ msgid "" "func:`PyVectorcall_Call` is explicitly called." msgstr "" -#: ../../c-api/typeobj.rst:751 +#: ../../c-api/typeobj.rst:793 msgid "An optional pointer to the get-attribute-string function." msgstr "" -#: ../../c-api/typeobj.rst:753 +#: ../../c-api/typeobj.rst:795 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, " @@ -1643,7 +1706,7 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:759 ../../c-api/typeobj.rst:955 +#: ../../c-api/typeobj.rst:801 ../../c-api/typeobj.rst:997 msgid "" "Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject." "tp_getattro`" @@ -1651,7 +1714,7 @@ msgstr "" "群組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject." "tp_getattro`" -#: ../../c-api/typeobj.rst:761 +#: ../../c-api/typeobj.rst:803 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " @@ -1660,12 +1723,12 @@ msgid "" "tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:768 ../../c-api/typeobj.rst:968 +#: ../../c-api/typeobj.rst:810 ../../c-api/typeobj.rst:1010 msgid "" "An optional pointer to the function for setting and deleting attributes." msgstr "" -#: ../../c-api/typeobj.rst:770 +#: ../../c-api/typeobj.rst:812 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, " @@ -1673,7 +1736,7 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:776 ../../c-api/typeobj.rst:981 +#: ../../c-api/typeobj.rst:818 ../../c-api/typeobj.rst:1023 msgid "" "Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject." "tp_setattro`" @@ -1681,7 +1744,7 @@ msgstr "" "群組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject." "tp_setattro`" -#: ../../c-api/typeobj.rst:778 +#: ../../c-api/typeobj.rst:820 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " @@ -1690,38 +1753,38 @@ msgid "" "tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:785 +#: ../../c-api/typeobj.rst:827 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement :term:`awaitable` and :term:`asynchronous iterator` " "protocols at the C-level. See :ref:`async-structs` for details." msgstr "" -#: ../../c-api/typeobj.rst:789 +#: ../../c-api/typeobj.rst:831 msgid "Formerly known as ``tp_compare`` and ``tp_reserved``." msgstr "" -#: ../../c-api/typeobj.rst:794 +#: ../../c-api/typeobj.rst:836 msgid "" "The :c:member:`~PyTypeObject.tp_as_async` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:802 +#: ../../c-api/typeobj.rst:844 msgid "" "An optional pointer to a function that implements the built-in function :" "func:`repr`." msgstr "" -#: ../../c-api/typeobj.rst:805 +#: ../../c-api/typeobj.rst:847 msgid "The signature is the same as for :c:func:`PyObject_Repr`::" msgstr "" -#: ../../c-api/typeobj.rst:807 +#: ../../c-api/typeobj.rst:849 msgid "PyObject *tp_repr(PyObject *self);" msgstr "PyObject *tp_repr(PyObject *self);" -#: ../../c-api/typeobj.rst:809 +#: ../../c-api/typeobj.rst:851 msgid "" "The function must return a string or a Unicode object. Ideally, this " "function should return a string that, when passed to :func:`eval`, given a " @@ -1730,85 +1793,85 @@ msgid "" "``'>'`` from which both the type and the value of the object can be deduced." msgstr "" -#: ../../c-api/typeobj.rst:820 ../../c-api/typeobj.rst:899 -#: ../../c-api/typeobj.rst:936 ../../c-api/typeobj.rst:961 -#: ../../c-api/typeobj.rst:987 ../../c-api/typeobj.rst:1028 -#: ../../c-api/typeobj.rst:1583 ../../c-api/typeobj.rst:1617 -#: ../../c-api/typeobj.rst:1734 ../../c-api/typeobj.rst:1767 -#: ../../c-api/typeobj.rst:1842 ../../c-api/typeobj.rst:1883 -#: ../../c-api/typeobj.rst:1901 ../../c-api/typeobj.rst:1943 -#: ../../c-api/typeobj.rst:1964 ../../c-api/typeobj.rst:1995 +#: ../../c-api/typeobj.rst:862 ../../c-api/typeobj.rst:941 +#: ../../c-api/typeobj.rst:978 ../../c-api/typeobj.rst:1003 +#: ../../c-api/typeobj.rst:1029 ../../c-api/typeobj.rst:1070 +#: ../../c-api/typeobj.rst:1625 ../../c-api/typeobj.rst:1659 +#: ../../c-api/typeobj.rst:1776 ../../c-api/typeobj.rst:1809 +#: ../../c-api/typeobj.rst:1884 ../../c-api/typeobj.rst:1925 +#: ../../c-api/typeobj.rst:1943 ../../c-api/typeobj.rst:1985 +#: ../../c-api/typeobj.rst:2006 ../../c-api/typeobj.rst:2037 msgid "**Default:**" msgstr "**預設:**" -#: ../../c-api/typeobj.rst:822 +#: ../../c-api/typeobj.rst:864 msgid "" "When this field is not set, a string of the form ``<%s object at %p>`` is " "returned, where ``%s`` is replaced by the type name, and ``%p`` by the " "object's memory address." msgstr "" -#: ../../c-api/typeobj.rst:829 +#: ../../c-api/typeobj.rst:871 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the number protocol. These fields are documented " "in :ref:`number-structs`." msgstr "" -#: ../../c-api/typeobj.rst:835 +#: ../../c-api/typeobj.rst:877 msgid "" "The :c:member:`~PyTypeObject.tp_as_number` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:841 +#: ../../c-api/typeobj.rst:883 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the sequence protocol. These fields are documented " "in :ref:`sequence-structs`." msgstr "" -#: ../../c-api/typeobj.rst:847 +#: ../../c-api/typeobj.rst:889 msgid "" "The :c:member:`~PyTypeObject.tp_as_sequence` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:853 +#: ../../c-api/typeobj.rst:895 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the mapping protocol. These fields are documented " "in :ref:`mapping-structs`." msgstr "" -#: ../../c-api/typeobj.rst:859 +#: ../../c-api/typeobj.rst:901 msgid "" "The :c:member:`~PyTypeObject.tp_as_mapping` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:867 +#: ../../c-api/typeobj.rst:909 msgid "" "An optional pointer to a function that implements the built-in function :" "func:`hash`." msgstr "" -#: ../../c-api/typeobj.rst:870 +#: ../../c-api/typeobj.rst:912 msgid "The signature is the same as for :c:func:`PyObject_Hash`::" msgstr "" -#: ../../c-api/typeobj.rst:872 +#: ../../c-api/typeobj.rst:914 msgid "Py_hash_t tp_hash(PyObject *);" msgstr "Py_hash_t tp_hash(PyObject *);" -#: ../../c-api/typeobj.rst:874 +#: ../../c-api/typeobj.rst:916 msgid "" "The value ``-1`` should not be returned as a normal return value; when an " "error occurs during the computation of the hash value, the function should " "set an exception and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:878 +#: ../../c-api/typeobj.rst:920 msgid "" "When this field is not set (*and* :c:member:`~PyTypeObject.tp_richcompare` " "is not set), an attempt to take the hash of the object raises :exc:" @@ -1816,7 +1879,7 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:882 +#: ../../c-api/typeobj.rst:924 msgid "" "This field can be set explicitly to :c:func:`PyObject_HashNotImplemented` to " "block inheritance of the hash method from a parent type. This is interpreted " @@ -1827,7 +1890,7 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:892 ../../c-api/typeobj.rst:1576 +#: ../../c-api/typeobj.rst:934 ../../c-api/typeobj.rst:1618 msgid "" "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." "tp_richcompare`" @@ -1835,7 +1898,7 @@ msgstr "" "群組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject." "tp_richcompare`" -#: ../../c-api/typeobj.rst:894 +#: ../../c-api/typeobj.rst:936 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject." @@ -1844,22 +1907,22 @@ msgid "" "are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:901 +#: ../../c-api/typeobj.rst:943 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericHash`." msgstr "" -#: ../../c-api/typeobj.rst:906 +#: ../../c-api/typeobj.rst:948 msgid "" "An optional pointer to a function that implements calling the object. This " "should be ``NULL`` if the object is not callable. The signature is the same " "as for :c:func:`PyObject_Call`::" msgstr "" -#: ../../c-api/typeobj.rst:910 +#: ../../c-api/typeobj.rst:952 msgid "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" msgstr "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" -#: ../../c-api/typeobj.rst:919 +#: ../../c-api/typeobj.rst:961 msgid "" "An optional pointer to a function that implements the built-in operation :" "func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls " @@ -1868,15 +1931,15 @@ msgid "" "this handler.)" msgstr "" -#: ../../c-api/typeobj.rst:924 +#: ../../c-api/typeobj.rst:966 msgid "The signature is the same as for :c:func:`PyObject_Str`::" msgstr "" -#: ../../c-api/typeobj.rst:926 +#: ../../c-api/typeobj.rst:968 msgid "PyObject *tp_str(PyObject *self);" msgstr "PyObject *tp_str(PyObject *self);" -#: ../../c-api/typeobj.rst:928 +#: ../../c-api/typeobj.rst:970 msgid "" "The function must return a string or a Unicode object. It should be a " "\"friendly\" string representation of the object, as this is the " @@ -1884,32 +1947,32 @@ msgid "" "function." msgstr "" -#: ../../c-api/typeobj.rst:938 +#: ../../c-api/typeobj.rst:980 msgid "" "When this field is not set, :c:func:`PyObject_Repr` is called to return a " "string representation." msgstr "" -#: ../../c-api/typeobj.rst:944 +#: ../../c-api/typeobj.rst:986 msgid "An optional pointer to the get-attribute function." msgstr "" -#: ../../c-api/typeobj.rst:946 +#: ../../c-api/typeobj.rst:988 msgid "The signature is the same as for :c:func:`PyObject_GetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:948 +#: ../../c-api/typeobj.rst:990 msgid "PyObject *tp_getattro(PyObject *self, PyObject *attr);" msgstr "PyObject *tp_getattro(PyObject *self, PyObject *attr);" -#: ../../c-api/typeobj.rst:950 +#: ../../c-api/typeobj.rst:992 msgid "" "It is usually convenient to set this field to :c:func:" "`PyObject_GenericGetAttr`, which implements the normal way of looking for " "object attributes." msgstr "" -#: ../../c-api/typeobj.rst:957 +#: ../../c-api/typeobj.rst:999 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " @@ -1918,19 +1981,19 @@ msgid "" "tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:963 +#: ../../c-api/typeobj.rst:1005 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:970 +#: ../../c-api/typeobj.rst:1012 msgid "The signature is the same as for :c:func:`PyObject_SetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:972 +#: ../../c-api/typeobj.rst:1014 msgid "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" msgstr "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" -#: ../../c-api/typeobj.rst:974 +#: ../../c-api/typeobj.rst:1016 msgid "" "In addition, setting *value* to ``NULL`` to delete an attribute must be " "supported. It is usually convenient to set this field to :c:func:" @@ -1938,7 +2001,7 @@ msgid "" "attributes." msgstr "" -#: ../../c-api/typeobj.rst:983 +#: ../../c-api/typeobj.rst:1025 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " @@ -1947,24 +2010,24 @@ msgid "" "tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:989 +#: ../../c-api/typeobj.rst:1031 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:994 +#: ../../c-api/typeobj.rst:1036 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the buffer interface. These fields are documented " "in :ref:`buffer-structs`." msgstr "" -#: ../../c-api/typeobj.rst:1000 +#: ../../c-api/typeobj.rst:1042 msgid "" "The :c:member:`~PyTypeObject.tp_as_buffer` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:1006 +#: ../../c-api/typeobj.rst:1048 msgid "" "This field is a bit mask of various flags. Some flags indicate variant " "semantics for certain situations; others are used to indicate that certain " @@ -1976,7 +2039,7 @@ msgid "" "accessed and must be considered to have a zero or ``NULL`` value instead." msgstr "" -#: ../../c-api/typeobj.rst:1016 +#: ../../c-api/typeobj.rst:1058 msgid "" "Inheritance of this field is complicated. Most flag bits are inherited " "individually, i.e. if the base type has a flag bit set, the subtype inherits " @@ -1992,7 +2055,7 @@ msgid "" "*really* inherited individually?" msgstr "" -#: ../../c-api/typeobj.rst:1030 +#: ../../c-api/typeobj.rst:1072 msgid "" ":c:data:`PyBaseObject_Type` uses ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``." @@ -2000,11 +2063,11 @@ msgstr "" ":c:data:`PyBaseObject_Type` 使用 ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``。" -#: ../../c-api/typeobj.rst:1033 +#: ../../c-api/typeobj.rst:1075 msgid "**Bit Masks:**" msgstr "" -#: ../../c-api/typeobj.rst:1037 +#: ../../c-api/typeobj.rst:1079 msgid "" "The following bit masks are currently defined; these can be ORed together " "using the ``|`` operator to form the value of the :c:member:`~PyTypeObject." @@ -2013,7 +2076,7 @@ msgid "" "zero." msgstr "" -#: ../../c-api/typeobj.rst:1044 +#: ../../c-api/typeobj.rst:1086 msgid "" "This bit is set when the type object itself is allocated on the heap, for " "example, types created dynamically using :c:func:`PyType_FromSpec`. In this " @@ -2026,32 +2089,32 @@ msgid "" "reference cycle with their own module object." msgstr "" -#: ../../c-api/typeobj.rst:1055 ../../c-api/typeobj.rst:1066 -#: ../../c-api/typeobj.rst:1076 ../../c-api/typeobj.rst:1086 -#: ../../c-api/typeobj.rst:1118 +#: ../../c-api/typeobj.rst:1097 ../../c-api/typeobj.rst:1108 +#: ../../c-api/typeobj.rst:1118 ../../c-api/typeobj.rst:1128 +#: ../../c-api/typeobj.rst:1160 msgid "???" msgstr "???" -#: ../../c-api/typeobj.rst:1060 +#: ../../c-api/typeobj.rst:1102 msgid "" "This bit is set when the type can be used as the base type of another type. " "If this bit is clear, the type cannot be subtyped (similar to a \"final\" " "class in Java)." msgstr "" -#: ../../c-api/typeobj.rst:1071 +#: ../../c-api/typeobj.rst:1113 msgid "" "This bit is set when the type object has been fully initialized by :c:func:" "`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1081 +#: ../../c-api/typeobj.rst:1123 msgid "" "This bit is set while :c:func:`PyType_Ready` is in the process of " "initializing the type object." msgstr "" -#: ../../c-api/typeobj.rst:1091 +#: ../../c-api/typeobj.rst:1133 msgid "" "This bit is set when the object supports garbage collection. If this bit is " "set, instances must be created using :c:macro:`PyObject_GC_New` and " @@ -2061,14 +2124,14 @@ msgid "" "tp_clear` are present in the type object." msgstr "" -#: ../../c-api/typeobj.rst:1100 ../../c-api/typeobj.rst:1441 -#: ../../c-api/typeobj.rst:1515 +#: ../../c-api/typeobj.rst:1142 ../../c-api/typeobj.rst:1483 +#: ../../c-api/typeobj.rst:1557 msgid "" "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." "tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" msgstr "" -#: ../../c-api/typeobj.rst:1102 +#: ../../c-api/typeobj.rst:1144 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :c:" "member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` " @@ -2078,105 +2141,105 @@ msgid "" "values." msgstr "" -#: ../../c-api/typeobj.rst:1112 +#: ../../c-api/typeobj.rst:1154 msgid "" "This is a bitmask of all the bits that pertain to the existence of certain " "fields in the type object and its extension structures. Currently, it " "includes the following bits: :c:macro:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`." msgstr "" -#: ../../c-api/typeobj.rst:1123 +#: ../../c-api/typeobj.rst:1165 msgid "This bit indicates that objects behave like unbound methods." msgstr "" -#: ../../c-api/typeobj.rst:1125 +#: ../../c-api/typeobj.rst:1167 msgid "If this flag is set for ``type(meth)``, then:" msgstr "" -#: ../../c-api/typeobj.rst:1127 +#: ../../c-api/typeobj.rst:1169 msgid "" "``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be " "equivalent to ``meth(obj, *args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1130 +#: ../../c-api/typeobj.rst:1172 msgid "" "``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to " "``meth(*args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1133 +#: ../../c-api/typeobj.rst:1175 msgid "" "This flag enables an optimization for typical method calls like ``obj." "meth()``: it avoids creating a temporary \"bound method\" object for ``obj." "meth``." msgstr "" -#: ../../c-api/typeobj.rst:1141 +#: ../../c-api/typeobj.rst:1183 msgid "" "This flag is never inherited by types without the :c:macro:" "`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is inherited " "whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1147 +#: ../../c-api/typeobj.rst:1189 msgid "" "This bit indicates that instances of the class have a `~object.__dict__` " "attribute, and that the space for the dictionary is managed by the VM." msgstr "" -#: ../../c-api/typeobj.rst:1150 +#: ../../c-api/typeobj.rst:1192 msgid "If this flag is set, :c:macro:`Py_TPFLAGS_HAVE_GC` should also be set." msgstr "" -#: ../../c-api/typeobj.rst:1152 +#: ../../c-api/typeobj.rst:1194 msgid "" "The type traverse function must call :c:func:`PyObject_VisitManagedDict` and " "its clear function must call :c:func:`PyObject_ClearManagedDict`." msgstr "" -#: ../../c-api/typeobj.rst:1159 +#: ../../c-api/typeobj.rst:1201 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject.tp_dictoffset` " "field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1165 +#: ../../c-api/typeobj.rst:1207 msgid "" "This bit indicates that instances of the class should be weakly " "referenceable." msgstr "" -#: ../../c-api/typeobj.rst:1172 +#: ../../c-api/typeobj.rst:1214 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject." "tp_weaklistoffset` field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1178 +#: ../../c-api/typeobj.rst:1220 msgid "" "Only usable with variable-size types, i.e. ones with non-zero :c:member:" "`~PyTypeObject.tp_itemsize`." msgstr "" -#: ../../c-api/typeobj.rst:1181 +#: ../../c-api/typeobj.rst:1223 msgid "" "Indicates that the variable-sized portion of an instance of this type is at " "the end of the instance's memory area, at an offset of ``Py_TYPE(obj)-" ">tp_basicsize`` (which may be different in each subclass)." msgstr "" -#: ../../c-api/typeobj.rst:1186 +#: ../../c-api/typeobj.rst:1228 msgid "" "When setting this flag, be sure that all superclasses either use this memory " "layout, or are not variable-sized. Python does not check this." msgstr "" -#: ../../c-api/typeobj.rst:1194 +#: ../../c-api/typeobj.rst:1236 msgid "This flag is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1208 +#: ../../c-api/typeobj.rst:1250 msgid "" "These flags are used by functions such as :c:func:`PyLong_Check` to quickly " "determine if a type is a subclass of a built-in type; such specific checks " @@ -2186,90 +2249,90 @@ msgid "" "behave differently depending on what kind of check is used." msgstr "" -#: ../../c-api/typeobj.rst:1219 +#: ../../c-api/typeobj.rst:1261 msgid "" "This bit is set when the :c:member:`~PyTypeObject.tp_finalize` slot is " "present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1224 +#: ../../c-api/typeobj.rst:1266 msgid "" "This flag isn't necessary anymore, as the interpreter assumes the :c:member:" "`~PyTypeObject.tp_finalize` slot is always present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1232 +#: ../../c-api/typeobj.rst:1274 msgid "" "This bit is set when the class implements the :ref:`vectorcall protocol " "`. See :c:member:`~PyTypeObject.tp_vectorcall_offset` for " "details." msgstr "" -#: ../../c-api/typeobj.rst:1238 +#: ../../c-api/typeobj.rst:1280 msgid "" "This bit is inherited if :c:member:`~PyTypeObject.tp_call` is also inherited." msgstr "" -#: ../../c-api/typeobj.rst:1245 +#: ../../c-api/typeobj.rst:1287 msgid "" "This flag is now removed from a class when the class's :py:meth:`~object." "__call__` method is reassigned." msgstr "" -#: ../../c-api/typeobj.rst:1248 +#: ../../c-api/typeobj.rst:1290 msgid "This flag can now be inherited by mutable classes." msgstr "" -#: ../../c-api/typeobj.rst:1252 +#: ../../c-api/typeobj.rst:1294 msgid "" "This bit is set for type objects that are immutable: type attributes cannot " "be set nor deleted." msgstr "" -#: ../../c-api/typeobj.rst:1254 +#: ../../c-api/typeobj.rst:1296 msgid "" ":c:func:`PyType_Ready` automatically applies this flag to :ref:`static types " "`." msgstr "" -#: ../../c-api/typeobj.rst:1259 +#: ../../c-api/typeobj.rst:1301 msgid "This flag is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:1265 +#: ../../c-api/typeobj.rst:1307 msgid "" "Disallow creating instances of the type: set :c:member:`~PyTypeObject." "tp_new` to NULL and don't create the ``__new__`` key in the type dictionary." msgstr "" -#: ../../c-api/typeobj.rst:1269 +#: ../../c-api/typeobj.rst:1311 msgid "" "The flag must be set before creating the type, not after. For example, it " "must be set before :c:func:`PyType_Ready` is called on the type." msgstr "" -#: ../../c-api/typeobj.rst:1272 +#: ../../c-api/typeobj.rst:1314 msgid "" "The flag is set automatically on :ref:`static types ` if :c:" "member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` and :c:" "member:`~PyTypeObject.tp_new` is NULL." msgstr "" -#: ../../c-api/typeobj.rst:1278 +#: ../../c-api/typeobj.rst:1320 msgid "" "This flag is not inherited. However, subclasses will not be instantiable " "unless they provide a non-NULL :c:member:`~PyTypeObject.tp_new` (which is " "only possible via the C API)." msgstr "" -#: ../../c-api/typeobj.rst:1285 +#: ../../c-api/typeobj.rst:1327 msgid "" "To disallow instantiating a class directly but allow instantiating its " "subclasses (e.g. for an :term:`abstract base class`), do not use this flag. " "Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1296 +#: ../../c-api/typeobj.rst:1338 msgid "" "This bit indicates that instances of the class may match mapping patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2277,23 +2340,23 @@ msgid "" "unset when registering :class:`collections.abc.Sequence`." msgstr "" -#: ../../c-api/typeobj.rst:1303 ../../c-api/typeobj.rst:1325 +#: ../../c-api/typeobj.rst:1345 ../../c-api/typeobj.rst:1367 msgid "" ":c:macro:`Py_TPFLAGS_MAPPING` and :c:macro:`Py_TPFLAGS_SEQUENCE` are " "mutually exclusive; it is an error to enable both flags simultaneously." msgstr "" -#: ../../c-api/typeobj.rst:1308 +#: ../../c-api/typeobj.rst:1350 msgid "" "This flag is inherited by types that do not already set :c:macro:" "`Py_TPFLAGS_SEQUENCE`." msgstr "" -#: ../../c-api/typeobj.rst:1311 ../../c-api/typeobj.rst:1333 +#: ../../c-api/typeobj.rst:1353 ../../c-api/typeobj.rst:1375 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../c-api/typeobj.rst:1318 +#: ../../c-api/typeobj.rst:1360 msgid "" "This bit indicates that instances of the class may match sequence patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2301,53 +2364,53 @@ msgid "" "unset when registering :class:`collections.abc.Mapping`." msgstr "" -#: ../../c-api/typeobj.rst:1330 +#: ../../c-api/typeobj.rst:1372 msgid "" "This flag is inherited by types that do not already set :c:macro:" "`Py_TPFLAGS_MAPPING`." msgstr "" -#: ../../c-api/typeobj.rst:1340 +#: ../../c-api/typeobj.rst:1382 msgid "" "Internal. Do not set or unset this flag. To indicate that a class has " "changed call :c:func:`PyType_Modified`" msgstr "" -#: ../../c-api/typeobj.rst:1344 +#: ../../c-api/typeobj.rst:1386 msgid "" "This flag is present in header files, but is not be used. It will be removed " "in a future version of CPython" msgstr "" -#: ../../c-api/typeobj.rst:1350 +#: ../../c-api/typeobj.rst:1392 msgid "" "An optional pointer to a NUL-terminated C string giving the docstring for " "this type object. This is exposed as the :attr:`~type.__doc__` attribute on " "the type and instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:1356 +#: ../../c-api/typeobj.rst:1398 msgid "This field is *not* inherited by subtypes." msgstr "" -#: ../../c-api/typeobj.rst:1361 +#: ../../c-api/typeobj.rst:1403 msgid "" "An optional pointer to a traversal function for the garbage collector. This " "is only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1364 +#: ../../c-api/typeobj.rst:1406 msgid "int tp_traverse(PyObject *self, visitproc visit, void *arg);" msgstr "int tp_traverse(PyObject *self, visitproc visit, void *arg);" -#: ../../c-api/typeobj.rst:1366 ../../c-api/typeobj.rst:1510 +#: ../../c-api/typeobj.rst:1408 ../../c-api/typeobj.rst:1552 msgid "" "More information about Python's garbage collection scheme can be found in " "section :ref:`supporting-cycle-detection`." msgstr "" -#: ../../c-api/typeobj.rst:1369 +#: ../../c-api/typeobj.rst:1411 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " "collector to detect reference cycles. A typical implementation of a :c:" @@ -2357,7 +2420,7 @@ msgid "" "`!_thread` extension module::" msgstr "" -#: ../../c-api/typeobj.rst:1375 +#: ../../c-api/typeobj.rst:1417 msgid "" "static int\n" "local_traverse(localobject *self, visitproc visit, void *arg)\n" @@ -2377,7 +2440,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1384 +#: ../../c-api/typeobj.rst:1426 msgid "" "Note that :c:func:`Py_VISIT` is called only on those members that can " "participate in reference cycles. Although there is also a ``self->key`` " @@ -2385,29 +2448,29 @@ msgid "" "part of a reference cycle." msgstr "" -#: ../../c-api/typeobj.rst:1388 +#: ../../c-api/typeobj.rst:1430 msgid "" "On the other hand, even if you know a member can never be part of a cycle, " "as a debugging aid you may want to visit it anyway just so the :mod:`gc` " "module's :func:`~gc.get_referents` function will include it." msgstr "" -#: ../../c-api/typeobj.rst:1392 +#: ../../c-api/typeobj.rst:1434 msgid "" "Heap types (:c:macro:`Py_TPFLAGS_HEAPTYPE`) must visit their type with::" msgstr "" -#: ../../c-api/typeobj.rst:1394 +#: ../../c-api/typeobj.rst:1436 msgid "Py_VISIT(Py_TYPE(self));" msgstr "Py_VISIT(Py_TYPE(self));" -#: ../../c-api/typeobj.rst:1396 +#: ../../c-api/typeobj.rst:1438 msgid "" "It is only needed since Python 3.9. To support Python 3.8 and older, this " "line must be conditional::" msgstr "" -#: ../../c-api/typeobj.rst:1399 +#: ../../c-api/typeobj.rst:1441 msgid "" "#if PY_VERSION_HEX >= 0x03090000\n" " Py_VISIT(Py_TYPE(self));\n" @@ -2417,18 +2480,18 @@ msgstr "" " Py_VISIT(Py_TYPE(self));\n" "#endif" -#: ../../c-api/typeobj.rst:1403 +#: ../../c-api/typeobj.rst:1445 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" "`PyObject_VisitManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1407 +#: ../../c-api/typeobj.rst:1449 msgid "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" msgstr "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" -#: ../../c-api/typeobj.rst:1410 +#: ../../c-api/typeobj.rst:1452 msgid "" "When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members " "that the instance *owns* (by having :term:`strong references ` hold a reference to " "their type. Their traversal function must therefore either visit :c:func:" @@ -2457,14 +2520,14 @@ msgid "" "superclass). If they do not, the type object may not be garbage-collected." msgstr "" -#: ../../c-api/typeobj.rst:1434 +#: ../../c-api/typeobj.rst:1476 msgid "" "Heap-allocated types are expected to visit ``Py_TYPE(self)`` in " "``tp_traverse``. In earlier versions of Python, due to `bug 40217 `_, doing this may lead to crashes in subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1443 +#: ../../c-api/typeobj.rst:1485 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_clear` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" @@ -2472,18 +2535,18 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1451 +#: ../../c-api/typeobj.rst:1493 msgid "" "An optional pointer to a clear function for the garbage collector. This is " "only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1454 +#: ../../c-api/typeobj.rst:1496 msgid "int tp_clear(PyObject *);" msgstr "int tp_clear(PyObject *);" -#: ../../c-api/typeobj.rst:1456 +#: ../../c-api/typeobj.rst:1498 msgid "" "The :c:member:`~PyTypeObject.tp_clear` member function is used to break " "reference cycles in cyclic garbage detected by the garbage collector. Taken " @@ -2498,7 +2561,7 @@ msgid "" "good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1466 +#: ../../c-api/typeobj.rst:1508 msgid "" "Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the " "instance's references to those of its members that may be Python objects, " @@ -2506,7 +2569,7 @@ msgid "" "example::" msgstr "" -#: ../../c-api/typeobj.rst:1470 +#: ../../c-api/typeobj.rst:1512 msgid "" "static int\n" "local_clear(localobject *self)\n" @@ -2528,7 +2591,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1480 +#: ../../c-api/typeobj.rst:1522 msgid "" "The :c:func:`Py_CLEAR` macro should be used, because clearing references is " "delicate: the reference to the contained object must not be released (via :" @@ -2543,18 +2606,18 @@ msgid "" "performs the operations in a safe order." msgstr "" -#: ../../c-api/typeobj.rst:1492 +#: ../../c-api/typeobj.rst:1534 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" "`PyObject_ClearManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1496 +#: ../../c-api/typeobj.rst:1538 msgid "PyObject_ClearManagedDict((PyObject*)self);" msgstr "PyObject_ClearManagedDict((PyObject*)self);" -#: ../../c-api/typeobj.rst:1498 +#: ../../c-api/typeobj.rst:1540 msgid "" "Note that :c:member:`~PyTypeObject.tp_clear` is not *always* called before " "an instance is deallocated. For example, when reference counting is enough " @@ -2562,7 +2625,7 @@ msgid "" "is not involved and :c:member:`~PyTypeObject.tp_dealloc` is called directly." msgstr "" -#: ../../c-api/typeobj.rst:1504 +#: ../../c-api/typeobj.rst:1546 msgid "" "Because the goal of :c:member:`~PyTypeObject.tp_clear` functions is to break " "reference cycles, it's not necessary to clear contained objects like Python " @@ -2572,7 +2635,7 @@ msgid "" "invoke :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1517 +#: ../../c-api/typeobj.rst:1559 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_traverse` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :" @@ -2580,22 +2643,22 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1525 +#: ../../c-api/typeobj.rst:1567 msgid "" "An optional pointer to the rich comparison function, whose signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1527 +#: ../../c-api/typeobj.rst:1569 msgid "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" msgstr "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" -#: ../../c-api/typeobj.rst:1529 +#: ../../c-api/typeobj.rst:1571 msgid "" "The first parameter is guaranteed to be an instance of the type that is " "defined by :c:type:`PyTypeObject`." msgstr "" -#: ../../c-api/typeobj.rst:1532 +#: ../../c-api/typeobj.rst:1574 msgid "" "The function should return the result of the comparison (usually ``Py_True`` " "or ``Py_False``). If the comparison is undefined, it must return " @@ -2603,50 +2666,50 @@ msgid "" "set an exception condition." msgstr "" -#: ../../c-api/typeobj.rst:1537 +#: ../../c-api/typeobj.rst:1579 msgid "" "The following constants are defined to be used as the third argument for :c:" "member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" msgstr "" -#: ../../c-api/typeobj.rst:1543 +#: ../../c-api/typeobj.rst:1585 msgid "Constant" msgstr "常數" -#: ../../c-api/typeobj.rst:1543 +#: ../../c-api/typeobj.rst:1585 msgid "Comparison" msgstr "" -#: ../../c-api/typeobj.rst:1545 +#: ../../c-api/typeobj.rst:1587 msgid "``<``" msgstr "``<``" -#: ../../c-api/typeobj.rst:1547 +#: ../../c-api/typeobj.rst:1589 msgid "``<=``" msgstr "``<=``" -#: ../../c-api/typeobj.rst:1549 +#: ../../c-api/typeobj.rst:1591 msgid "``==``" msgstr "``==``" -#: ../../c-api/typeobj.rst:1551 +#: ../../c-api/typeobj.rst:1593 msgid "``!=``" msgstr "``!=``" -#: ../../c-api/typeobj.rst:1553 +#: ../../c-api/typeobj.rst:1595 msgid "``>``" msgstr "``>``" -#: ../../c-api/typeobj.rst:1555 +#: ../../c-api/typeobj.rst:1597 msgid "``>=``" msgstr "``>=``" -#: ../../c-api/typeobj.rst:1558 +#: ../../c-api/typeobj.rst:1600 msgid "" "The following macro is defined to ease writing rich comparison functions:" msgstr "" -#: ../../c-api/typeobj.rst:1562 +#: ../../c-api/typeobj.rst:1604 msgid "" "Return ``Py_True`` or ``Py_False`` from the function, depending on the " "result of a comparison. VAL_A and VAL_B must be orderable by C comparison " @@ -2654,15 +2717,15 @@ msgid "" "specifies the requested operation, as for :c:func:`PyObject_RichCompare`." msgstr "" -#: ../../c-api/typeobj.rst:1568 +#: ../../c-api/typeobj.rst:1610 msgid "The returned value is a new :term:`strong reference`." msgstr "" -#: ../../c-api/typeobj.rst:1570 +#: ../../c-api/typeobj.rst:1612 msgid "On error, sets an exception and returns ``NULL`` from the function." msgstr "" -#: ../../c-api/typeobj.rst:1578 +#: ../../c-api/typeobj.rst:1620 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" @@ -2670,7 +2733,7 @@ msgid "" "tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1585 +#: ../../c-api/typeobj.rst:1627 msgid "" ":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." "tp_richcompare` implementation, which may be inherited. However, if only :c:" @@ -2679,13 +2742,13 @@ msgid "" "comparisons." msgstr "" -#: ../../c-api/typeobj.rst:1594 +#: ../../c-api/typeobj.rst:1636 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1597 +#: ../../c-api/typeobj.rst:1639 msgid "" "If the instances of this type are weakly referenceable, this field is " "greater than zero and contains the offset in the instance structure of the " @@ -2695,19 +2758,19 @@ msgid "" "`PyObject*` which is initialized to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1604 +#: ../../c-api/typeobj.rst:1646 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that " "is the list head for weak references to the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1607 +#: ../../c-api/typeobj.rst:1649 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_weaklistoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1612 +#: ../../c-api/typeobj.rst:1654 msgid "" "This field is inherited by subtypes, but see the rules listed below. A " "subtype may override this offset; this means that the subtype uses a " @@ -2716,7 +2779,7 @@ msgid "" "not be a problem." msgstr "" -#: ../../c-api/typeobj.rst:1619 +#: ../../c-api/typeobj.rst:1661 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." @@ -2724,32 +2787,32 @@ msgid "" "unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1627 +#: ../../c-api/typeobj.rst:1669 msgid "" "An optional pointer to a function that returns an :term:`iterator` for the " "object. Its presence normally signals that the instances of this type are :" "term:`iterable` (although sequences may be iterable without this function)." msgstr "" -#: ../../c-api/typeobj.rst:1631 +#: ../../c-api/typeobj.rst:1673 msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "" -#: ../../c-api/typeobj.rst:1633 +#: ../../c-api/typeobj.rst:1675 msgid "PyObject *tp_iter(PyObject *self);" msgstr "PyObject *tp_iter(PyObject *self);" -#: ../../c-api/typeobj.rst:1642 +#: ../../c-api/typeobj.rst:1684 msgid "" "An optional pointer to a function that returns the next item in an :term:" "`iterator`. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1645 +#: ../../c-api/typeobj.rst:1687 msgid "PyObject *tp_iternext(PyObject *self);" msgstr "PyObject *tp_iternext(PyObject *self);" -#: ../../c-api/typeobj.rst:1647 +#: ../../c-api/typeobj.rst:1689 msgid "" "When the iterator is exhausted, it must return ``NULL``; a :exc:" "`StopIteration` exception may or may not be set. When another error occurs, " @@ -2757,74 +2820,74 @@ msgid "" "this type are iterators." msgstr "" -#: ../../c-api/typeobj.rst:1652 +#: ../../c-api/typeobj.rst:1694 msgid "" "Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` " "function, and that function should return the iterator instance itself (not " "a new iterator instance)." msgstr "" -#: ../../c-api/typeobj.rst:1656 +#: ../../c-api/typeobj.rst:1698 msgid "This function has the same signature as :c:func:`PyIter_Next`." msgstr "" -#: ../../c-api/typeobj.rst:1665 +#: ../../c-api/typeobj.rst:1707 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMethodDef` structures, declaring regular methods of this type." msgstr "" -#: ../../c-api/typeobj.rst:1668 +#: ../../c-api/typeobj.rst:1710 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1673 +#: ../../c-api/typeobj.rst:1715 msgid "" "This field is not inherited by subtypes (methods are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1679 +#: ../../c-api/typeobj.rst:1721 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMemberDef` structures, declaring regular data members (fields or slots) " "of instances of this type." msgstr "" -#: ../../c-api/typeobj.rst:1683 +#: ../../c-api/typeobj.rst:1725 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1688 +#: ../../c-api/typeobj.rst:1730 msgid "" "This field is not inherited by subtypes (members are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1694 +#: ../../c-api/typeobj.rst:1736 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyGetSetDef` structures, declaring computed attributes of instances of this " "type." msgstr "" -#: ../../c-api/typeobj.rst:1697 +#: ../../c-api/typeobj.rst:1739 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1702 +#: ../../c-api/typeobj.rst:1744 msgid "" "This field is not inherited by subtypes (computed attributes are inherited " "through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1708 +#: ../../c-api/typeobj.rst:1750 msgid "" "An optional pointer to a base type from which type properties are " "inherited. At this level, only single inheritance is supported; multiple " @@ -2832,7 +2895,7 @@ msgid "" "metatype." msgstr "" -#: ../../c-api/typeobj.rst:1716 +#: ../../c-api/typeobj.rst:1758 msgid "" "Slot initialization is subject to the rules of initializing globals. C99 " "requires the initializers to be \"address constants\". Function designators " @@ -2840,7 +2903,7 @@ msgid "" "valid C99 address constants." msgstr "" -#: ../../c-api/typeobj.rst:1721 +#: ../../c-api/typeobj.rst:1763 msgid "" "However, the unary '&' operator applied to a non-static variable like :c:" "data:`PyBaseObject_Type` is not required to produce an address constant. " @@ -2848,27 +2911,27 @@ msgid "" "strictly standard conforming in this particular behavior." msgstr "" -#: ../../c-api/typeobj.rst:1727 +#: ../../c-api/typeobj.rst:1769 msgid "" "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " "extension module's init function." msgstr "" -#: ../../c-api/typeobj.rst:1732 +#: ../../c-api/typeobj.rst:1774 msgid "This field is not inherited by subtypes (obviously)." msgstr "" -#: ../../c-api/typeobj.rst:1736 +#: ../../c-api/typeobj.rst:1778 msgid "" "This field defaults to ``&PyBaseObject_Type`` (which to Python programmers " "is known as the type :class:`object`)." msgstr "" -#: ../../c-api/typeobj.rst:1742 +#: ../../c-api/typeobj.rst:1784 msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1744 +#: ../../c-api/typeobj.rst:1786 msgid "" "This field should normally be initialized to ``NULL`` before PyType_Ready is " "called; it may also be initialized to a dictionary containing initial " @@ -2879,73 +2942,73 @@ msgid "" "be treated as read-only." msgstr "" -#: ../../c-api/typeobj.rst:1752 +#: ../../c-api/typeobj.rst:1794 msgid "" "Some types may not store their dictionary in this slot. Use :c:func:" "`PyType_GetDict` to retrieve the dictionary for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1758 +#: ../../c-api/typeobj.rst:1800 msgid "" "Internals detail: For static builtin types, this is always ``NULL``. " "Instead, the dict for such types is stored on ``PyInterpreterState``. Use :c:" "func:`PyType_GetDict` to get the dict for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1764 +#: ../../c-api/typeobj.rst:1806 msgid "" "This field is not inherited by subtypes (though the attributes defined in " "here are inherited through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1769 +#: ../../c-api/typeobj.rst:1811 msgid "" "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " "dictionary to it." msgstr "" -#: ../../c-api/typeobj.rst:1774 +#: ../../c-api/typeobj.rst:1816 msgid "" "It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:" "member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" -#: ../../c-api/typeobj.rst:1780 +#: ../../c-api/typeobj.rst:1822 msgid "An optional pointer to a \"descriptor get\" function." msgstr "" -#: ../../c-api/typeobj.rst:1782 ../../c-api/typeobj.rst:1798 -#: ../../c-api/typeobj.rst:1862 ../../c-api/typeobj.rst:1892 -#: ../../c-api/typeobj.rst:1916 +#: ../../c-api/typeobj.rst:1824 ../../c-api/typeobj.rst:1840 +#: ../../c-api/typeobj.rst:1904 ../../c-api/typeobj.rst:1934 +#: ../../c-api/typeobj.rst:1958 msgid "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1784 +#: ../../c-api/typeobj.rst:1826 msgid "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" msgstr "" "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" -#: ../../c-api/typeobj.rst:1795 +#: ../../c-api/typeobj.rst:1837 msgid "" "An optional pointer to a function for setting and deleting a descriptor's " "value." msgstr "" -#: ../../c-api/typeobj.rst:1800 +#: ../../c-api/typeobj.rst:1842 msgid "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" msgstr "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" -#: ../../c-api/typeobj.rst:1802 +#: ../../c-api/typeobj.rst:1844 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "" -#: ../../c-api/typeobj.rst:1813 +#: ../../c-api/typeobj.rst:1855 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1816 +#: ../../c-api/typeobj.rst:1858 msgid "" "If the instances of this type have a dictionary containing instance " "variables, this field is non-zero and contains the offset in the instances " @@ -2953,19 +3016,19 @@ msgid "" "func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:1821 +#: ../../c-api/typeobj.rst:1863 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is " "the dictionary for attributes of the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1824 +#: ../../c-api/typeobj.rst:1866 msgid "" "The value specifies the offset of the dictionary from the start of the " "instance structure." msgstr "" -#: ../../c-api/typeobj.rst:1826 +#: ../../c-api/typeobj.rst:1868 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" "only. To get the pointer to the dictionary call :c:func:" @@ -2974,13 +3037,13 @@ msgid "" "to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" -#: ../../c-api/typeobj.rst:1832 +#: ../../c-api/typeobj.rst:1874 msgid "" -"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " -"and :c:member:`~PyTypeObject.tp_dictoffset`." +"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit and :c:" +"member:`~PyTypeObject.tp_dictoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1837 +#: ../../c-api/typeobj.rst:1879 msgid "" "This field is inherited by subtypes. A subtype should not override this " "offset; doing so could be unsafe, if C code tries to access the dictionary " @@ -2988,25 +3051,25 @@ msgid "" "`Py_TPFLAGS_MANAGED_DICT`." msgstr "" -#: ../../c-api/typeobj.rst:1844 +#: ../../c-api/typeobj.rst:1886 msgid "" "This slot has no default. For :ref:`static types `, if the " "field is ``NULL`` then no :attr:`~object.__dict__` gets created for " "instances." msgstr "" -#: ../../c-api/typeobj.rst:1847 +#: ../../c-api/typeobj.rst:1889 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_dictoffset` " "will be set to ``-1``, to indicate that it is unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1855 +#: ../../c-api/typeobj.rst:1897 msgid "An optional pointer to an instance initialization function." msgstr "" -#: ../../c-api/typeobj.rst:1857 +#: ../../c-api/typeobj.rst:1899 msgid "" "This function corresponds to the :meth:`~object.__init__` method of " "classes. Like :meth:`!__init__`, it is possible to create an instance " @@ -3014,18 +3077,18 @@ msgid "" "instance by calling its :meth:`!__init__` method again." msgstr "" -#: ../../c-api/typeobj.rst:1864 +#: ../../c-api/typeobj.rst:1906 msgid "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" msgstr "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1866 +#: ../../c-api/typeobj.rst:1908 msgid "" "The self argument is the instance to be initialized; the *args* and *kwds* " "arguments represent positional and keyword arguments of the call to :meth:" "`~object.__init__`." msgstr "" -#: ../../c-api/typeobj.rst:1870 +#: ../../c-api/typeobj.rst:1912 msgid "" "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " "when an instance is created normally by calling its type, after the type's :" @@ -3037,53 +3100,53 @@ msgid "" "subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" -#: ../../c-api/typeobj.rst:1877 +#: ../../c-api/typeobj.rst:1919 msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" -#: ../../c-api/typeobj.rst:1885 +#: ../../c-api/typeobj.rst:1927 msgid "" "For :ref:`static types ` this field does not have a default." msgstr "" -#: ../../c-api/typeobj.rst:1890 +#: ../../c-api/typeobj.rst:1932 msgid "An optional pointer to an instance allocation function." msgstr "" -#: ../../c-api/typeobj.rst:1894 +#: ../../c-api/typeobj.rst:1936 msgid "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" msgstr "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" -#: ../../c-api/typeobj.rst:1898 +#: ../../c-api/typeobj.rst:1940 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)." msgstr "" -#: ../../c-api/typeobj.rst:1903 +#: ../../c-api/typeobj.rst:1945 msgid "" "For dynamic subtypes, this field is always set to :c:func:" "`PyType_GenericAlloc`, to force a standard heap allocation strategy." msgstr "" -#: ../../c-api/typeobj.rst:1907 +#: ../../c-api/typeobj.rst:1949 msgid "" "For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:" "`PyType_GenericAlloc`. That is the recommended value for all statically " "defined types." msgstr "" -#: ../../c-api/typeobj.rst:1914 +#: ../../c-api/typeobj.rst:1956 msgid "An optional pointer to an instance creation function." msgstr "" -#: ../../c-api/typeobj.rst:1918 +#: ../../c-api/typeobj.rst:1960 msgid "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" msgstr "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1920 +#: ../../c-api/typeobj.rst:1962 msgid "" "The *subtype* argument is the type of the object being created; the *args* " "and *kwds* arguments represent positional and keyword arguments of the call " @@ -3092,7 +3155,7 @@ msgid "" "that type (but not an unrelated type)." msgstr "" -#: ../../c-api/typeobj.rst:1926 +#: ../../c-api/typeobj.rst:1968 msgid "" "The :c:member:`~PyTypeObject.tp_new` function should call ``subtype-" ">tp_alloc(subtype, nitems)`` to allocate space for the object, and then do " @@ -3104,20 +3167,20 @@ msgid "" "be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" -#: ../../c-api/typeobj.rst:1934 +#: ../../c-api/typeobj.rst:1976 msgid "" "Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow " "creating instances of the type in Python." msgstr "" -#: ../../c-api/typeobj.rst:1939 +#: ../../c-api/typeobj.rst:1981 msgid "" "This field is inherited by subtypes, except it is not inherited by :ref:" "`static types ` whose :c:member:`~PyTypeObject.tp_base` is " "``NULL`` or ``&PyBaseObject_Type``." msgstr "" -#: ../../c-api/typeobj.rst:1945 +#: ../../c-api/typeobj.rst:1987 msgid "" "For :ref:`static types ` this field has no default. This means " "if the slot is defined as ``NULL``, the type cannot be called to create new " @@ -3125,44 +3188,44 @@ msgid "" "factory function." msgstr "" -#: ../../c-api/typeobj.rst:1953 +#: ../../c-api/typeobj.rst:1995 msgid "" "An optional pointer to an instance deallocation function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1955 +#: ../../c-api/typeobj.rst:1997 msgid "void tp_free(void *self);" msgstr "void tp_free(void *self);" -#: ../../c-api/typeobj.rst:1957 +#: ../../c-api/typeobj.rst:1999 msgid "" "An initializer that is compatible with this signature is :c:func:" "`PyObject_Free`." msgstr "" -#: ../../c-api/typeobj.rst:1961 +#: ../../c-api/typeobj.rst:2003 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)" msgstr "" -#: ../../c-api/typeobj.rst:1966 +#: ../../c-api/typeobj.rst:2008 msgid "" "In dynamic subtypes, this field is set to a deallocator suitable to match :c:" "func:`PyType_GenericAlloc` and the value of the :c:macro:" "`Py_TPFLAGS_HAVE_GC` flag bit." msgstr "" -#: ../../c-api/typeobj.rst:1970 +#: ../../c-api/typeobj.rst:2012 msgid "" "For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:`PyObject_Del`." msgstr "" -#: ../../c-api/typeobj.rst:1975 +#: ../../c-api/typeobj.rst:2017 msgid "An optional pointer to a function called by the garbage collector." msgstr "" -#: ../../c-api/typeobj.rst:1977 +#: ../../c-api/typeobj.rst:2019 msgid "" "The garbage collector needs to know whether a particular object is " "collectible or not. Normally, it is sufficient to look at the object's " @@ -3174,93 +3237,93 @@ msgid "" "instance. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1985 +#: ../../c-api/typeobj.rst:2027 msgid "int tp_is_gc(PyObject *self);" msgstr "int tp_is_gc(PyObject *self);" -#: ../../c-api/typeobj.rst:1987 +#: ../../c-api/typeobj.rst:2029 msgid "" "(The only example of this are types themselves. The metatype, :c:data:" "`PyType_Type`, defines this function to distinguish between statically and :" "ref:`dynamically allocated types `.)" msgstr "" -#: ../../c-api/typeobj.rst:1997 +#: ../../c-api/typeobj.rst:2039 msgid "" "This slot has no default. If this field is ``NULL``, :c:macro:" "`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" -#: ../../c-api/typeobj.rst:2003 +#: ../../c-api/typeobj.rst:2045 msgid "Tuple of base types." msgstr "" -#: ../../c-api/typeobj.rst:2005 ../../c-api/typeobj.rst:2029 +#: ../../c-api/typeobj.rst:2047 ../../c-api/typeobj.rst:2071 msgid "" "This field should be set to ``NULL`` and treated as read-only. Python will " "fill it in when the type is :c:func:`initialized `." msgstr "" -#: ../../c-api/typeobj.rst:2008 +#: ../../c-api/typeobj.rst:2050 msgid "" "For dynamically created classes, the ``Py_tp_bases`` :c:type:`slot " "` can be used instead of the *bases* argument of :c:func:" "`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" -#: ../../c-api/typeobj.rst:2015 +#: ../../c-api/typeobj.rst:2057 msgid "" "Multiple inheritance does not work well for statically defined types. If you " "set ``tp_bases`` to a tuple, Python will not raise an error, but some slots " "will only be inherited from the first base." msgstr "" -#: ../../c-api/typeobj.rst:2021 ../../c-api/typeobj.rst:2044 -#: ../../c-api/typeobj.rst:2061 ../../c-api/typeobj.rst:2078 -#: ../../c-api/typeobj.rst:2092 +#: ../../c-api/typeobj.rst:2063 ../../c-api/typeobj.rst:2086 +#: ../../c-api/typeobj.rst:2103 ../../c-api/typeobj.rst:2120 +#: ../../c-api/typeobj.rst:2134 msgid "This field is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:2026 +#: ../../c-api/typeobj.rst:2068 msgid "" "Tuple containing the expanded set of base types, starting with the type " "itself and ending with :class:`object`, in Method Resolution Order." msgstr "" -#: ../../c-api/typeobj.rst:2034 +#: ../../c-api/typeobj.rst:2076 msgid "" "This field is not inherited; it is calculated fresh by :c:func:" "`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2040 +#: ../../c-api/typeobj.rst:2082 msgid "Unused. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2049 +#: ../../c-api/typeobj.rst:2091 msgid "" "A collection of subclasses. Internal use only. May be an invalid pointer." msgstr "" -#: ../../c-api/typeobj.rst:2051 +#: ../../c-api/typeobj.rst:2093 msgid "" "To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__`." msgstr "" -#: ../../c-api/typeobj.rst:2056 +#: ../../c-api/typeobj.rst:2098 msgid "" "For some types, this field does not hold a valid :c:expr:`PyObject*`. The " "type was changed to :c:expr:`void*` to indicate this." msgstr "" -#: ../../c-api/typeobj.rst:2066 +#: ../../c-api/typeobj.rst:2108 msgid "" "Weak reference list head, for weak references to this type object. Not " "inherited. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2071 +#: ../../c-api/typeobj.rst:2113 msgid "" "Internals detail: For the static builtin types this is always ``NULL``, even " "if weakrefs are added. Instead, the weakrefs for each are stored on " @@ -3268,25 +3331,25 @@ msgid "" "``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." msgstr "" -#: ../../c-api/typeobj.rst:2083 +#: ../../c-api/typeobj.rst:2125 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "" -#: ../../c-api/typeobj.rst:2088 +#: ../../c-api/typeobj.rst:2130 msgid "Used to index into the method cache. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2097 +#: ../../c-api/typeobj.rst:2139 msgid "" "An optional pointer to an instance finalization function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2099 +#: ../../c-api/typeobj.rst:2141 msgid "void tp_finalize(PyObject *self);" msgstr "void tp_finalize(PyObject *self);" -#: ../../c-api/typeobj.rst:2101 +#: ../../c-api/typeobj.rst:2143 msgid "" "If :c:member:`~PyTypeObject.tp_finalize` is set, the interpreter calls it " "once when finalizing an instance. It is called either from the garbage " @@ -3296,42 +3359,40 @@ msgid "" "object in a sane state." msgstr "" -#: ../../c-api/typeobj.rst:2108 +#: ../../c-api/typeobj.rst:2150 msgid "" ":c:member:`~PyTypeObject.tp_finalize` should not mutate the current " "exception status; therefore, a recommended way to write a non-trivial " "finalizer is::" msgstr "" -#: ../../c-api/typeobj.rst:2111 +#: ../../c-api/typeobj.rst:2153 msgid "" "static void\n" "local_finalize(PyObject *self)\n" "{\n" -" PyObject *error_type, *error_value, *error_traceback;\n" -"\n" " /* Save the current exception, if any. */\n" -" PyErr_Fetch(&error_type, &error_value, &error_traceback);\n" +" PyObject *exc = PyErr_GetRaisedException();\n" "\n" " /* ... */\n" "\n" " /* Restore the saved exception. */\n" -" PyErr_Restore(error_type, error_value, error_traceback);\n" +" PyErr_SetRaisedException(exc);\n" "}" msgstr "" -#: ../../c-api/typeobj.rst:2133 +#: ../../c-api/typeobj.rst:2173 msgid "" "Before version 3.8 it was necessary to set the :c:macro:" "`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. " "This is no longer required." msgstr "" -#: ../../c-api/typeobj.rst:2137 +#: ../../c-api/typeobj.rst:2177 msgid "\"Safe object finalization\" (:pep:`442`)" msgstr "" -#: ../../c-api/typeobj.rst:2142 +#: ../../c-api/typeobj.rst:2182 msgid "" "Vectorcall function to use for calls of this type object. In other words, it " "is used to implement :ref:`vectorcall ` for ``type.__call__``. " @@ -3339,65 +3400,65 @@ msgid "" "meth:`~object.__new__` and :meth:`~object.__init__` is used." msgstr "" -#: ../../c-api/typeobj.rst:2150 +#: ../../c-api/typeobj.rst:2190 msgid "This field is never inherited." msgstr "" -#: ../../c-api/typeobj.rst:2152 +#: ../../c-api/typeobj.rst:2192 msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" -#: ../../c-api/typeobj.rst:2157 +#: ../../c-api/typeobj.rst:2197 msgid "Internal. Do not use." msgstr "" -#: ../../c-api/typeobj.rst:2165 +#: ../../c-api/typeobj.rst:2205 msgid "Static Types" msgstr "" -#: ../../c-api/typeobj.rst:2167 +#: ../../c-api/typeobj.rst:2207 msgid "" "Traditionally, types defined in C code are *static*, that is, a static :c:" "type:`PyTypeObject` structure is defined directly in code and initialized " "using :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2171 +#: ../../c-api/typeobj.rst:2211 msgid "" "This results in types that are limited relative to types defined in Python:" msgstr "" -#: ../../c-api/typeobj.rst:2173 +#: ../../c-api/typeobj.rst:2213 msgid "" "Static types are limited to one base, i.e. they cannot use multiple " "inheritance." msgstr "" -#: ../../c-api/typeobj.rst:2175 +#: ../../c-api/typeobj.rst:2215 msgid "" "Static type objects (but not necessarily their instances) are immutable. It " "is not possible to add or modify the type object's attributes from Python." msgstr "" -#: ../../c-api/typeobj.rst:2177 +#: ../../c-api/typeobj.rst:2217 msgid "" "Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-" "specific state." msgstr "" -#: ../../c-api/typeobj.rst:2181 +#: ../../c-api/typeobj.rst:2221 msgid "" "Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API " "` as an opaque struct, any extension modules using static " "types must be compiled for a specific Python minor version." msgstr "" -#: ../../c-api/typeobj.rst:2189 +#: ../../c-api/typeobj.rst:2229 msgid "Heap Types" msgstr "" -#: ../../c-api/typeobj.rst:2191 +#: ../../c-api/typeobj.rst:2231 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " @@ -3405,29 +3466,29 @@ msgid "" "`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" -#: ../../c-api/typeobj.rst:2196 +#: ../../c-api/typeobj.rst:2236 msgid "" "This is done by filling a :c:type:`PyType_Spec` structure and calling :c:" "func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:" "`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`." msgstr "" -#: ../../c-api/typeobj.rst:2204 +#: ../../c-api/typeobj.rst:2244 msgid "Number Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2211 +#: ../../c-api/typeobj.rst:2251 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the number protocol. Each function is used by the function of " "similar name documented in the :ref:`number` section." msgstr "" -#: ../../c-api/typeobj.rst:2217 ../../c-api/typeobj.rst:2541 +#: ../../c-api/typeobj.rst:2257 ../../c-api/typeobj.rst:2581 msgid "Here is the structure definition::" msgstr "" -#: ../../c-api/typeobj.rst:2219 +#: ../../c-api/typeobj.rst:2259 msgid "" "typedef struct {\n" " binaryfunc nb_add;\n" @@ -3515,7 +3576,7 @@ msgstr "" " binaryfunc nb_inplace_matrix_multiply;\n" "} PyNumberMethods;" -#: ../../c-api/typeobj.rst:2264 +#: ../../c-api/typeobj.rst:2304 msgid "" "Binary and ternary functions must check the type of all their operands, and " "implement the necessary conversions (at least one of the operands is an " @@ -3525,31 +3586,31 @@ msgid "" "and set an exception." msgstr "" -#: ../../c-api/typeobj.rst:2273 +#: ../../c-api/typeobj.rst:2313 msgid "" "The :c:member:`~PyNumberMethods.nb_reserved` field should always be " "``NULL``. It was previously called :c:member:`!nb_long`, and was renamed in " "Python 3.0.1." msgstr "" -#: ../../c-api/typeobj.rst:2318 +#: ../../c-api/typeobj.rst:2358 msgid "Mapping Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2325 +#: ../../c-api/typeobj.rst:2365 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the mapping protocol. It has three members:" msgstr "" -#: ../../c-api/typeobj.rst:2330 +#: ../../c-api/typeobj.rst:2370 msgid "" "This function is used by :c:func:`PyMapping_Size` and :c:func:" "`PyObject_Size`, and has the same signature. This slot may be set to " "``NULL`` if the object has no defined length." msgstr "" -#: ../../c-api/typeobj.rst:2336 +#: ../../c-api/typeobj.rst:2376 msgid "" "This function is used by :c:func:`PyObject_GetItem` and :c:func:" "`PySequence_GetSlice`, and has the same signature as :c:func:`!" @@ -3557,7 +3618,7 @@ msgid "" "`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2344 +#: ../../c-api/typeobj.rst:2384 msgid "" "This function is used by :c:func:`PyObject_SetItem`, :c:func:" "`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" @@ -3567,17 +3628,17 @@ msgid "" "deletion." msgstr "" -#: ../../c-api/typeobj.rst:2355 +#: ../../c-api/typeobj.rst:2395 msgid "Sequence Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2362 +#: ../../c-api/typeobj.rst:2402 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the sequence protocol." msgstr "" -#: ../../c-api/typeobj.rst:2367 +#: ../../c-api/typeobj.rst:2407 msgid "" "This function is used by :c:func:`PySequence_Size` and :c:func:" "`PyObject_Size`, and has the same signature. It is also used for handling " @@ -3585,21 +3646,21 @@ msgid "" "member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" -#: ../../c-api/typeobj.rst:2374 +#: ../../c-api/typeobj.rst:2414 msgid "" "This function is used by :c:func:`PySequence_Concat` and has the same " "signature. It is also used by the ``+`` operator, after trying the numeric " "addition via the :c:member:`~PyNumberMethods.nb_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2380 +#: ../../c-api/typeobj.rst:2420 msgid "" "This function is used by :c:func:`PySequence_Repeat` and has the same " "signature. It is also used by the ``*`` operator, after trying numeric " "multiplication via the :c:member:`~PyNumberMethods.nb_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2386 +#: ../../c-api/typeobj.rst:2426 msgid "" "This function is used by :c:func:`PySequence_GetItem` and has the same " "signature. It is also used by :c:func:`PyObject_GetItem`, after trying the " @@ -3608,7 +3669,7 @@ msgid "" "``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2392 +#: ../../c-api/typeobj.rst:2432 msgid "" "Negative indexes are handled as follows: if the :c:member:" "`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " @@ -3617,7 +3678,7 @@ msgid "" "index is passed as is to the function." msgstr "" -#: ../../c-api/typeobj.rst:2399 +#: ../../c-api/typeobj.rst:2439 msgid "" "This function is used by :c:func:`PySequence_SetItem` and has the same " "signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" @@ -3626,14 +3687,14 @@ msgid "" "``NULL`` if the object does not support item assignment and deletion." msgstr "" -#: ../../c-api/typeobj.rst:2408 +#: ../../c-api/typeobj.rst:2448 msgid "" "This function may be used by :c:func:`PySequence_Contains` and has the same " "signature. This slot may be left to ``NULL``, in this case :c:func:`!" "PySequence_Contains` simply traverses the sequence until it finds a match." msgstr "" -#: ../../c-api/typeobj.rst:2415 +#: ../../c-api/typeobj.rst:2455 msgid "" "This function is used by :c:func:`PySequence_InPlaceConcat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3643,7 +3704,7 @@ msgid "" "c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2424 +#: ../../c-api/typeobj.rst:2464 msgid "" "This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3653,76 +3714,76 @@ msgid "" "via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2435 +#: ../../c-api/typeobj.rst:2475 msgid "Buffer Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2443 +#: ../../c-api/typeobj.rst:2483 msgid "" "This structure holds pointers to the functions required by the :ref:`Buffer " "protocol `. The protocol defines how an exporter object can " "expose its internal data to consumer objects." msgstr "" -#: ../../c-api/typeobj.rst:2449 ../../c-api/typeobj.rst:2498 -#: ../../c-api/typeobj.rst:2552 ../../c-api/typeobj.rst:2563 -#: ../../c-api/typeobj.rst:2575 ../../c-api/typeobj.rst:2585 +#: ../../c-api/typeobj.rst:2489 ../../c-api/typeobj.rst:2538 +#: ../../c-api/typeobj.rst:2592 ../../c-api/typeobj.rst:2603 +#: ../../c-api/typeobj.rst:2615 ../../c-api/typeobj.rst:2625 msgid "The signature of this function is::" msgstr "" -#: ../../c-api/typeobj.rst:2451 +#: ../../c-api/typeobj.rst:2491 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" msgstr "int (PyObject *exporter, Py_buffer *view, int flags);" -#: ../../c-api/typeobj.rst:2453 +#: ../../c-api/typeobj.rst:2493 msgid "" "Handle a request to *exporter* to fill in *view* as specified by *flags*. " "Except for point (3), an implementation of this function MUST take these " "steps:" msgstr "" -#: ../../c-api/typeobj.rst:2457 +#: ../../c-api/typeobj.rst:2497 msgid "" "Check if the request can be met. If not, raise :exc:`BufferError`, set :c:" "expr:`view->obj` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:2460 +#: ../../c-api/typeobj.rst:2500 msgid "Fill in the requested fields." msgstr "" -#: ../../c-api/typeobj.rst:2462 +#: ../../c-api/typeobj.rst:2502 msgid "Increment an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2464 +#: ../../c-api/typeobj.rst:2504 msgid "" "Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`." msgstr "" -#: ../../c-api/typeobj.rst:2466 +#: ../../c-api/typeobj.rst:2506 msgid "Return ``0``." msgstr "回傳 ``0``。" -#: ../../c-api/typeobj.rst:2468 +#: ../../c-api/typeobj.rst:2508 msgid "" "If *exporter* is part of a chain or tree of buffer providers, two main " "schemes can be used:" msgstr "" -#: ../../c-api/typeobj.rst:2471 +#: ../../c-api/typeobj.rst:2511 msgid "" "Re-export: Each member of the tree acts as the exporting object and sets :c:" "expr:`view->obj` to a new reference to itself." msgstr "" -#: ../../c-api/typeobj.rst:2474 +#: ../../c-api/typeobj.rst:2514 msgid "" "Redirect: The buffer request is redirected to the root object of the tree. " "Here, :c:expr:`view->obj` will be a new reference to the root object." msgstr "" -#: ../../c-api/typeobj.rst:2478 +#: ../../c-api/typeobj.rst:2518 msgid "" "The individual fields of *view* are described in section :ref:`Buffer " "structure `, the rules how an exporter must react to " @@ -3730,7 +3791,7 @@ msgid "" "types>`." msgstr "" -#: ../../c-api/typeobj.rst:2483 +#: ../../c-api/typeobj.rst:2523 msgid "" "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " "exporter and must remain valid until there are no consumers left. :c:member:" @@ -3739,23 +3800,23 @@ msgid "" "internal` are read-only for the consumer." msgstr "" -#: ../../c-api/typeobj.rst:2490 +#: ../../c-api/typeobj.rst:2530 msgid "" ":c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes " "buffer while dealing correctly with all request types." msgstr "" -#: ../../c-api/typeobj.rst:2493 +#: ../../c-api/typeobj.rst:2533 msgid "" ":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps " "this function." msgstr "" -#: ../../c-api/typeobj.rst:2500 +#: ../../c-api/typeobj.rst:2540 msgid "void (PyObject *exporter, Py_buffer *view);" msgstr "void (PyObject *exporter, Py_buffer *view);" -#: ../../c-api/typeobj.rst:2502 +#: ../../c-api/typeobj.rst:2542 msgid "" "Handle a request to release the resources of the buffer. If no resources " "need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be " @@ -3763,15 +3824,15 @@ msgid "" "these optional steps:" msgstr "" -#: ../../c-api/typeobj.rst:2507 +#: ../../c-api/typeobj.rst:2547 msgid "Decrement an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2509 +#: ../../c-api/typeobj.rst:2549 msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" -#: ../../c-api/typeobj.rst:2511 +#: ../../c-api/typeobj.rst:2551 msgid "" "The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep " "track of buffer-specific resources. This field is guaranteed to remain " @@ -3779,30 +3840,30 @@ msgid "" "*view* argument." msgstr "" -#: ../../c-api/typeobj.rst:2517 +#: ../../c-api/typeobj.rst:2557 msgid "" "This function MUST NOT decrement :c:expr:`view->obj`, since that is done " "automatically in :c:func:`PyBuffer_Release` (this scheme is useful for " "breaking reference cycles)." msgstr "" -#: ../../c-api/typeobj.rst:2522 +#: ../../c-api/typeobj.rst:2562 msgid "" ":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this " "function." msgstr "" -#: ../../c-api/typeobj.rst:2530 +#: ../../c-api/typeobj.rst:2570 msgid "Async Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2538 +#: ../../c-api/typeobj.rst:2578 msgid "" "This structure holds pointers to the functions required to implement :term:" "`awaitable` and :term:`asynchronous iterator` objects." msgstr "" -#: ../../c-api/typeobj.rst:2543 +#: ../../c-api/typeobj.rst:2583 msgid "" "typedef struct {\n" " unaryfunc am_await;\n" @@ -3818,62 +3879,62 @@ msgstr "" " sendfunc am_send;\n" "} PyAsyncMethods;" -#: ../../c-api/typeobj.rst:2554 +#: ../../c-api/typeobj.rst:2594 msgid "PyObject *am_await(PyObject *self);" msgstr "" -#: ../../c-api/typeobj.rst:2556 +#: ../../c-api/typeobj.rst:2596 msgid "" "The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check` " "must return ``1`` for it." msgstr "" -#: ../../c-api/typeobj.rst:2559 +#: ../../c-api/typeobj.rst:2599 msgid "" "This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." msgstr "" -#: ../../c-api/typeobj.rst:2565 +#: ../../c-api/typeobj.rst:2605 msgid "PyObject *am_aiter(PyObject *self);" msgstr "PyObject *am_aiter(PyObject *self);" -#: ../../c-api/typeobj.rst:2567 +#: ../../c-api/typeobj.rst:2607 msgid "" "Must return an :term:`asynchronous iterator` object. See :meth:`~object." "__anext__` for details." msgstr "" -#: ../../c-api/typeobj.rst:2570 +#: ../../c-api/typeobj.rst:2610 msgid "" "This slot may be set to ``NULL`` if an object does not implement " "asynchronous iteration protocol." msgstr "" -#: ../../c-api/typeobj.rst:2577 +#: ../../c-api/typeobj.rst:2617 msgid "PyObject *am_anext(PyObject *self);" msgstr "PyObject *am_anext(PyObject *self);" -#: ../../c-api/typeobj.rst:2579 +#: ../../c-api/typeobj.rst:2619 msgid "" "Must return an :term:`awaitable` object. See :meth:`~object.__anext__` for " "details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2587 +#: ../../c-api/typeobj.rst:2627 msgid "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" msgstr "" "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" -#: ../../c-api/typeobj.rst:2589 +#: ../../c-api/typeobj.rst:2629 msgid "" "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2598 +#: ../../c-api/typeobj.rst:2638 msgid "Slot Type typedefs" msgstr "" -#: ../../c-api/typeobj.rst:2602 +#: ../../c-api/typeobj.rst:2642 msgid "" "The purpose of this function is to separate memory allocation from memory " "initialization. It should return a pointer to a block of memory of adequate " @@ -3887,80 +3948,80 @@ msgid "" "length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:2612 +#: ../../c-api/typeobj.rst:2652 msgid "" "This function should not do any other instance initialization, not even to " "allocate additional memory; that should be done by :c:member:`~PyTypeObject." "tp_new`." msgstr "" -#: ../../c-api/typeobj.rst:2619 +#: ../../c-api/typeobj.rst:2659 msgid "See :c:member:`~PyTypeObject.tp_free`." msgstr "請見 :c:member:`~PyTypeObject.tp_free`。" -#: ../../c-api/typeobj.rst:2623 +#: ../../c-api/typeobj.rst:2663 msgid "See :c:member:`~PyTypeObject.tp_new`." msgstr "請見 :c:member:`~PyTypeObject.tp_new`。" -#: ../../c-api/typeobj.rst:2627 +#: ../../c-api/typeobj.rst:2667 msgid "See :c:member:`~PyTypeObject.tp_init`." msgstr "請見 :c:member:`~PyTypeObject.tp_init`。" -#: ../../c-api/typeobj.rst:2631 +#: ../../c-api/typeobj.rst:2671 msgid "See :c:member:`~PyTypeObject.tp_repr`." msgstr "請見 :c:member:`~PyTypeObject.tp_repr`。" -#: ../../c-api/typeobj.rst:2635 ../../c-api/typeobj.rst:2644 +#: ../../c-api/typeobj.rst:2675 ../../c-api/typeobj.rst:2684 msgid "Return the value of the named attribute for the object." msgstr "" -#: ../../c-api/typeobj.rst:2639 ../../c-api/typeobj.rst:2650 +#: ../../c-api/typeobj.rst:2679 ../../c-api/typeobj.rst:2690 msgid "" "Set the value of the named attribute for the object. The value argument is " "set to ``NULL`` to delete the attribute." msgstr "" -#: ../../c-api/typeobj.rst:2646 +#: ../../c-api/typeobj.rst:2686 msgid "See :c:member:`~PyTypeObject.tp_getattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_getattro`。" -#: ../../c-api/typeobj.rst:2653 +#: ../../c-api/typeobj.rst:2693 msgid "See :c:member:`~PyTypeObject.tp_setattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_setattro`。" -#: ../../c-api/typeobj.rst:2657 +#: ../../c-api/typeobj.rst:2697 msgid "See :c:member:`~PyTypeObject.tp_descr_get`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_get`。" -#: ../../c-api/typeobj.rst:2661 +#: ../../c-api/typeobj.rst:2701 msgid "See :c:member:`~PyTypeObject.tp_descr_set`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_set`。" -#: ../../c-api/typeobj.rst:2665 +#: ../../c-api/typeobj.rst:2705 msgid "See :c:member:`~PyTypeObject.tp_hash`." msgstr "請見 :c:member:`~PyTypeObject.tp_hash`。" -#: ../../c-api/typeobj.rst:2669 +#: ../../c-api/typeobj.rst:2709 msgid "See :c:member:`~PyTypeObject.tp_richcompare`." msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" -#: ../../c-api/typeobj.rst:2673 +#: ../../c-api/typeobj.rst:2713 msgid "See :c:member:`~PyTypeObject.tp_iter`." msgstr "請見 :c:member:`~PyTypeObject.tp_iter`。" -#: ../../c-api/typeobj.rst:2677 +#: ../../c-api/typeobj.rst:2717 msgid "See :c:member:`~PyTypeObject.tp_iternext`." msgstr "請見 :c:member:`~PyTypeObject.tp_iternext`。" -#: ../../c-api/typeobj.rst:2691 +#: ../../c-api/typeobj.rst:2731 msgid "See :c:member:`~PyAsyncMethods.am_send`." msgstr "請見 :c:member:`~PyAsyncMethods.am_send`。" -#: ../../c-api/typeobj.rst:2707 +#: ../../c-api/typeobj.rst:2747 msgid "Examples" msgstr "範例" -#: ../../c-api/typeobj.rst:2709 +#: ../../c-api/typeobj.rst:2749 msgid "" "The following are simple examples of Python type definitions. They include " "common usage you may encounter. Some demonstrate tricky corner cases. For " @@ -3968,11 +4029,11 @@ msgid "" "and :ref:`new-types-topics`." msgstr "" -#: ../../c-api/typeobj.rst:2714 +#: ../../c-api/typeobj.rst:2754 msgid "A basic :ref:`static type `::" msgstr "" -#: ../../c-api/typeobj.rst:2716 +#: ../../c-api/typeobj.rst:2756 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -3990,13 +4051,13 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2731 +#: ../../c-api/typeobj.rst:2771 msgid "" "You may also find older code (especially in the CPython code base) with a " "more verbose initializer::" msgstr "" -#: ../../c-api/typeobj.rst:2734 +#: ../../c-api/typeobj.rst:2774 msgid "" "static PyTypeObject MyObject_Type = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -4080,11 +4141,11 @@ msgstr "" " myobj_new, /* tp_new */\n" "};" -#: ../../c-api/typeobj.rst:2775 +#: ../../c-api/typeobj.rst:2815 msgid "A type that supports weakrefs, instance dicts, and hashing::" msgstr "" -#: ../../c-api/typeobj.rst:2777 +#: ../../c-api/typeobj.rst:2817 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4110,14 +4171,14 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2800 +#: ../../c-api/typeobj.rst:2840 msgid "" "A str subclass that cannot be subclassed and cannot be called to create " "instances (e.g. uses a separate factory func) using :c:macro:" "`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" -#: ../../c-api/typeobj.rst:2804 +#: ../../c-api/typeobj.rst:2844 msgid "" "typedef struct {\n" " PyUnicodeObject raw;\n" @@ -4135,12 +4196,12 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2819 +#: ../../c-api/typeobj.rst:2859 msgid "" "The simplest :ref:`static type ` with fixed-length instances::" msgstr "" -#: ../../c-api/typeobj.rst:2821 +#: ../../c-api/typeobj.rst:2861 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4160,13 +4221,13 @@ msgstr "" " .tp_name = \"mymod.MyObject\",\n" "};" -#: ../../c-api/typeobj.rst:2830 +#: ../../c-api/typeobj.rst:2870 msgid "" "The simplest :ref:`static type ` with variable-length " "instances::" msgstr "" -#: ../../c-api/typeobj.rst:2832 +#: ../../c-api/typeobj.rst:2872 msgid "" "typedef struct {\n" " PyObject_VAR_HEAD\n" @@ -4192,14 +4253,14 @@ msgstr "" " .tp_itemsize = sizeof(char *),\n" "};" -#: ../../c-api/typeobj.rst:800 ../../c-api/typeobj.rst:865 +#: ../../c-api/typeobj.rst:842 ../../c-api/typeobj.rst:907 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/typeobj.rst:800 +#: ../../c-api/typeobj.rst:842 msgid "repr" msgstr "repr" -#: ../../c-api/typeobj.rst:865 +#: ../../c-api/typeobj.rst:907 msgid "hash" msgstr "hash(雜湊)" diff --git a/c-api/unicode.po b/c-api/unicode.po index 6049c55176..537acd3b28 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-21 00:13+0000\n" +"POT-Creation-Date: 2025-04-15 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,23 +41,25 @@ msgstr "" #: ../../c-api/unicode.rst:20 msgid "" "UTF-8 representation is created on demand and cached in the Unicode object." -msgstr "" +msgstr "UTF-8 表示法會在需要時建立並快取在 Unicode 物件中。" #: ../../c-api/unicode.rst:23 msgid "" "The :c:type:`Py_UNICODE` representation has been removed since Python 3.12 " "with deprecated APIs. See :pep:`623` for more information." msgstr "" +"自 Python 3.12 起,已移除 :c:type:`Py_UNICODE` 表示法,並標示為已棄用的 API。" +"更多資訊請參閱 :pep:`623`。" #: ../../c-api/unicode.rst:29 msgid "Unicode Type" -msgstr "" +msgstr "Unicode 型別" #: ../../c-api/unicode.rst:31 msgid "" "These are the basic Unicode object types used for the Unicode implementation " "in Python:" -msgstr "" +msgstr "這些是 Python 中用於 Unicode 實作的基本 Unicode 物件型別:" #: ../../c-api/unicode.rst:38 msgid "" @@ -112,11 +114,11 @@ msgstr "" #: ../../c-api/unicode.rst:92 msgid "Returns ``0``. This API is kept only for backward compatibility." -msgstr "" +msgstr "回傳 ``0``。此 API 僅保留以維持向後相容性。" #: ../../c-api/unicode.rst:96 msgid "This API does nothing since Python 3.12." -msgstr "" +msgstr "自 Python 3.12 起,此 API 不再執行任何動作。" #: ../../c-api/unicode.rst:102 msgid "" @@ -128,8 +130,8 @@ msgstr "" msgid "" "Return a pointer to the canonical representation cast to UCS1, UCS2 or UCS4 " "integer types for direct character access. No checks are performed if the " -"canonical representation has the correct character size; " -"use :c:func:`PyUnicode_KIND` to select the right function." +"canonical representation has the correct character size; use :c:func:" +"`PyUnicode_KIND` to select the right function." msgstr "" #: ../../c-api/unicode.rst:124 @@ -156,25 +158,25 @@ msgstr "" #: ../../c-api/unicode.rst:152 msgid "" -"Write into a canonical representation *data* (as obtained " -"with :c:func:`PyUnicode_DATA`). This function performs no sanity checks, " -"and is intended for usage in loops. The caller should cache the *kind* " -"value and *data* pointer as obtained from other calls. *index* is the index " -"in the string (starts at 0) and *value* is the new code point value which " -"should be written to that location." +"Write into a canonical representation *data* (as obtained with :c:func:" +"`PyUnicode_DATA`). This function performs no sanity checks, and is intended " +"for usage in loops. The caller should cache the *kind* value and *data* " +"pointer as obtained from other calls. *index* is the index in the string " +"(starts at 0) and *value* is the new code point value which should be " +"written to that location." msgstr "" #: ../../c-api/unicode.rst:165 msgid "" -"Read a code point from a canonical representation *data* (as obtained " -"with :c:func:`PyUnicode_DATA`). No checks or ready calls are performed." +"Read a code point from a canonical representation *data* (as obtained with :" +"c:func:`PyUnicode_DATA`). No checks or ready calls are performed." msgstr "" #: ../../c-api/unicode.rst:173 msgid "" "Read a character from a Unicode object *unicode*, which must be in the " -"\"canonical\" representation. This is less efficient " -"than :c:func:`PyUnicode_READ` if you do multiple consecutive reads." +"\"canonical\" representation. This is less efficient than :c:func:" +"`PyUnicode_READ` if you do multiple consecutive reads." msgstr "" #: ../../c-api/unicode.rst:182 @@ -256,32 +258,29 @@ msgstr "根據 *ch* 是否為字母數字 (alphanumeric) 字元來回傳 ``1`` #: ../../c-api/unicode.rst:259 msgid "" -"Return ``1`` or ``0`` depending on whether *ch* is a printable character. " -"Nonprintable characters are those characters defined in the Unicode " -"character database as \"Other\" or \"Separator\", excepting the ASCII space " -"(0x20) which is considered printable. (Note that printable characters in " -"this context are those which should not be escaped when :func:`repr` is " -"invoked on a string. It has no bearing on the handling of strings written " -"to :data:`sys.stdout` or :data:`sys.stderr`.)" +"Return ``1`` or ``0`` depending on whether *ch* is a printable character, in " +"the sense of :meth:`str.isprintable`." msgstr "" +"根據 *ch* 是否為可列印字元(如 :meth:`str.isprintable` 所定義)來回傳 ``1`` " +"或 ``0``。" -#: ../../c-api/unicode.rst:268 +#: ../../c-api/unicode.rst:263 msgid "These APIs can be used for fast direct character conversions:" -msgstr "" +msgstr "這些 API 可用於快速直接字元轉換:" -#: ../../c-api/unicode.rst:273 +#: ../../c-api/unicode.rst:268 msgid "Return the character *ch* converted to lower case." msgstr "回傳轉換為小寫的 *ch* 字元。" -#: ../../c-api/unicode.rst:278 +#: ../../c-api/unicode.rst:273 msgid "Return the character *ch* converted to upper case." msgstr "回傳轉換為大寫的 *ch* 字元。" -#: ../../c-api/unicode.rst:283 +#: ../../c-api/unicode.rst:278 msgid "Return the character *ch* converted to title case." msgstr "回傳轉換為首字大寫的 *ch* 字元。" -#: ../../c-api/unicode.rst:288 +#: ../../c-api/unicode.rst:283 msgid "" "Return the character *ch* converted to a decimal positive integer. Return " "``-1`` if this is not possible. This function does not raise exceptions." @@ -289,7 +288,7 @@ msgstr "" "回傳轉換為十進位正整數的 *ch* 字元,若無法轉換則回傳 ``-1``。此函式不會引發例" "外。" -#: ../../c-api/unicode.rst:294 +#: ../../c-api/unicode.rst:289 msgid "" "Return the character *ch* converted to a single digit integer. Return ``-1`` " "if this is not possible. This function does not raise exceptions." @@ -297,7 +296,7 @@ msgstr "" "回傳轉換為單一數字整數的 *ch* 字元,若無法轉換則回傳 ``-1``。此函式不會引發例" "外。" -#: ../../c-api/unicode.rst:300 +#: ../../c-api/unicode.rst:295 msgid "" "Return the character *ch* converted to a double. Return ``-1.0`` if this is " "not possible. This function does not raise exceptions." @@ -305,25 +304,25 @@ msgstr "" "回傳轉換為雙精度浮點數 (double) 的 *ch* 字元,若無法轉換則回傳 ``-1.0``。此函" "式不會引發例外。" -#: ../../c-api/unicode.rst:304 +#: ../../c-api/unicode.rst:299 msgid "These APIs can be used to work with surrogates:" msgstr "這些 API 可用於處理代理字元:" -#: ../../c-api/unicode.rst:308 +#: ../../c-api/unicode.rst:303 msgid "Check if *ch* is a surrogate (``0xD800 <= ch <= 0xDFFF``)." msgstr "檢查 *ch* 是否為代理字元 (surrogate, ``0xD800 <= ch <= 0xDFFF``)。" -#: ../../c-api/unicode.rst:312 +#: ../../c-api/unicode.rst:307 msgid "Check if *ch* is a high surrogate (``0xD800 <= ch <= 0xDBFF``)." msgstr "" "檢查 *ch* 是否為高代理字元 (high surrogate, ``0xD800 <= ch <= 0xDBFF``)。" -#: ../../c-api/unicode.rst:316 +#: ../../c-api/unicode.rst:311 msgid "Check if *ch* is a low surrogate (``0xDC00 <= ch <= 0xDFFF``)." msgstr "" "檢查 *ch* 是否為低代理字元 (low surrogate, ``0xDC00 <= ch <= 0xDFFF``)。" -#: ../../c-api/unicode.rst:320 +#: ../../c-api/unicode.rst:315 msgid "" "Join two surrogate code points and return a single :c:type:`Py_UCS4` value. " "*high* and *low* are respectively the leading and trailing surrogates in a " @@ -331,51 +330,50 @@ msgid "" "be in the range [0xDC00; 0xDFFF]." msgstr "" -#: ../../c-api/unicode.rst:327 +#: ../../c-api/unicode.rst:322 msgid "Creating and accessing Unicode strings" msgstr "" -#: ../../c-api/unicode.rst:329 +#: ../../c-api/unicode.rst:324 msgid "" "To create Unicode objects and access their basic sequence properties, use " "these APIs:" msgstr "" -#: ../../c-api/unicode.rst:334 +#: ../../c-api/unicode.rst:329 msgid "" "Create a new Unicode object. *maxchar* should be the true maximum code " "point to be placed in the string. As an approximation, it can be rounded up " "to the nearest value in the sequence 127, 255, 65535, 1114111." msgstr "" -#: ../../c-api/unicode.rst:338 +#: ../../c-api/unicode.rst:333 msgid "" "This is the recommended way to allocate a new Unicode object. Objects " "created using this function are not resizable." msgstr "" -#: ../../c-api/unicode.rst:341 +#: ../../c-api/unicode.rst:336 msgid "On error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:349 +#: ../../c-api/unicode.rst:344 msgid "" -"Create a new Unicode object with the given *kind* (possible values " -"are :c:macro:`PyUnicode_1BYTE_KIND` etc., as returned " -"by :c:func:`PyUnicode_KIND`). The *buffer* must point to an array of *size* " -"units of 1, 2 or 4 bytes per character, as given by the kind." +"Create a new Unicode object with the given *kind* (possible values are :c:" +"macro:`PyUnicode_1BYTE_KIND` etc., as returned by :c:func:" +"`PyUnicode_KIND`). The *buffer* must point to an array of *size* units of " +"1, 2 or 4 bytes per character, as given by the kind." msgstr "" -#: ../../c-api/unicode.rst:354 +#: ../../c-api/unicode.rst:349 msgid "" "If necessary, the input *buffer* is copied and transformed into the " -"canonical representation. For example, if the *buffer* is a UCS4 string " -"(:c:macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in the " -"UCS1 range, it will be transformed into UCS1 " -"(:c:macro:`PyUnicode_1BYTE_KIND`)." +"canonical representation. For example, if the *buffer* is a UCS4 string (:c:" +"macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in the UCS1 " +"range, it will be transformed into UCS1 (:c:macro:`PyUnicode_1BYTE_KIND`)." msgstr "" -#: ../../c-api/unicode.rst:365 +#: ../../c-api/unicode.rst:360 msgid "" "Create a Unicode object from the char buffer *str*. The bytes will be " "interpreted as being UTF-8 encoded. The buffer is copied into the new " @@ -383,29 +381,29 @@ msgid "" "data is not allowed." msgstr "" -#: ../../c-api/unicode.rst:371 +#: ../../c-api/unicode.rst:366 msgid "This function raises :exc:`SystemError` when:" -msgstr "" +msgstr "此函式在以下情況下會引發 :exc:`SystemError`:" -#: ../../c-api/unicode.rst:373 +#: ../../c-api/unicode.rst:368 msgid "*size* < 0," -msgstr "" +msgstr "*size* < 0," -#: ../../c-api/unicode.rst:374 +#: ../../c-api/unicode.rst:369 msgid "*str* is ``NULL`` and *size* > 0" -msgstr "" +msgstr "*str* 為 ``NULL`` 且 *size* > 0" -#: ../../c-api/unicode.rst:376 +#: ../../c-api/unicode.rst:371 msgid "*str* == ``NULL`` with *size* > 0 is not allowed anymore." -msgstr "" +msgstr "*str* == ``NULL`` 且 *size* > 0 不再被允許。" -#: ../../c-api/unicode.rst:382 +#: ../../c-api/unicode.rst:377 msgid "" "Create a Unicode object from a UTF-8 encoded null-terminated char buffer " "*str*." msgstr "" -#: ../../c-api/unicode.rst:388 +#: ../../c-api/unicode.rst:383 msgid "" "Take a C :c:func:`printf`\\ -style *format* string and a variable number of " "arguments, calculate the size of the resulting Python Unicode string and " @@ -414,31 +412,31 @@ msgid "" "*format* ASCII-encoded string." msgstr "" -#: ../../c-api/unicode.rst:394 +#: ../../c-api/unicode.rst:389 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../c-api/unicode.rst:397 +#: ../../c-api/unicode.rst:392 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../c-api/unicode.rst:399 +#: ../../c-api/unicode.rst:394 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../c-api/unicode.rst:402 +#: ../../c-api/unicode.rst:397 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " -"actual width is given in the next argument, which must be of " -"type :c:expr:`int`, and the object to convert comes after the minimum field " -"width and optional precision." +"actual width is given in the next argument, which must be of type :c:expr:" +"`int`, and the object to convert comes after the minimum field width and " +"optional precision." msgstr "" -#: ../../c-api/unicode.rst:407 +#: ../../c-api/unicode.rst:402 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. If " "specified as ``'*'`` (an asterisk), the actual precision is given in the " @@ -446,316 +444,316 @@ msgid "" "comes after the precision." msgstr "" -#: ../../c-api/unicode.rst:412 +#: ../../c-api/unicode.rst:407 msgid "Length modifier (optional)." msgstr "" -#: ../../c-api/unicode.rst:414 +#: ../../c-api/unicode.rst:409 msgid "Conversion type." msgstr "" -#: ../../c-api/unicode.rst:416 +#: ../../c-api/unicode.rst:411 msgid "The conversion flag characters are:" msgstr "" -#: ../../c-api/unicode.rst:421 +#: ../../c-api/unicode.rst:416 msgid "Flag" msgstr "旗標" -#: ../../c-api/unicode.rst:421 +#: ../../c-api/unicode.rst:416 msgid "Meaning" msgstr "含義" -#: ../../c-api/unicode.rst:423 +#: ../../c-api/unicode.rst:418 msgid "``0``" msgstr "``0``" -#: ../../c-api/unicode.rst:423 +#: ../../c-api/unicode.rst:418 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../c-api/unicode.rst:425 +#: ../../c-api/unicode.rst:420 msgid "``-``" msgstr "``-``" -#: ../../c-api/unicode.rst:425 +#: ../../c-api/unicode.rst:420 msgid "" "The converted value is left adjusted (overrides the ``0`` flag if both are " "given)." msgstr "" -#: ../../c-api/unicode.rst:429 +#: ../../c-api/unicode.rst:424 msgid "" "The length modifiers for following integer conversions (``d``, ``i``, ``o``, " "``u``, ``x``, or ``X``) specify the type of the argument (:c:expr:`int` by " "default):" msgstr "" -#: ../../c-api/unicode.rst:436 +#: ../../c-api/unicode.rst:431 msgid "Modifier" msgstr "" -#: ../../c-api/unicode.rst:436 +#: ../../c-api/unicode.rst:431 msgid "Types" msgstr "" -#: ../../c-api/unicode.rst:438 +#: ../../c-api/unicode.rst:433 msgid "``l``" msgstr "``l``" -#: ../../c-api/unicode.rst:438 +#: ../../c-api/unicode.rst:433 msgid ":c:expr:`long` or :c:expr:`unsigned long`" msgstr ":c:expr:`long` 或 :c:expr:`unsigned long`" -#: ../../c-api/unicode.rst:440 +#: ../../c-api/unicode.rst:435 msgid "``ll``" msgstr "``ll``" -#: ../../c-api/unicode.rst:440 +#: ../../c-api/unicode.rst:435 msgid ":c:expr:`long long` or :c:expr:`unsigned long long`" msgstr ":c:expr:`long long` 或 :c:expr:`unsigned long long`" -#: ../../c-api/unicode.rst:442 +#: ../../c-api/unicode.rst:437 msgid "``j``" msgstr "``j``" -#: ../../c-api/unicode.rst:442 +#: ../../c-api/unicode.rst:437 msgid ":c:type:`intmax_t` or :c:type:`uintmax_t`" msgstr ":c:type:`intmax_t` 或 :c:type:`uintmax_t`" -#: ../../c-api/unicode.rst:444 +#: ../../c-api/unicode.rst:439 msgid "``z``" msgstr "``z``" -#: ../../c-api/unicode.rst:444 +#: ../../c-api/unicode.rst:439 msgid ":c:type:`size_t` or :c:type:`ssize_t`" msgstr ":c:type:`size_t` 或 :c:type:`ssize_t`" -#: ../../c-api/unicode.rst:446 +#: ../../c-api/unicode.rst:441 msgid "``t``" msgstr "``t``" -#: ../../c-api/unicode.rst:446 +#: ../../c-api/unicode.rst:441 msgid ":c:type:`ptrdiff_t`" msgstr ":c:type:`ptrdiff_t`" -#: ../../c-api/unicode.rst:449 +#: ../../c-api/unicode.rst:444 msgid "" "The length modifier ``l`` for following conversions ``s`` or ``V`` specify " "that the type of the argument is :c:expr:`const wchar_t*`." msgstr "" -#: ../../c-api/unicode.rst:452 +#: ../../c-api/unicode.rst:447 msgid "The conversion specifiers are:" msgstr "" -#: ../../c-api/unicode.rst:458 +#: ../../c-api/unicode.rst:453 msgid "Conversion Specifier" msgstr "" -#: ../../c-api/unicode.rst:459 +#: ../../c-api/unicode.rst:454 msgid "Type" msgstr "" -#: ../../c-api/unicode.rst:460 +#: ../../c-api/unicode.rst:455 msgid "Comment" msgstr "" -#: ../../c-api/unicode.rst:462 +#: ../../c-api/unicode.rst:457 msgid "``%``" msgstr "``%``" -#: ../../c-api/unicode.rst:463 +#: ../../c-api/unicode.rst:458 msgid "*n/a*" msgstr "*n/a*" -#: ../../c-api/unicode.rst:464 +#: ../../c-api/unicode.rst:459 msgid "The literal ``%`` character." msgstr "字面 ``%`` 字元。" -#: ../../c-api/unicode.rst:466 +#: ../../c-api/unicode.rst:461 msgid "``d``, ``i``" msgstr "``d``, ``i``" -#: ../../c-api/unicode.rst:467 ../../c-api/unicode.rst:471 -#: ../../c-api/unicode.rst:475 ../../c-api/unicode.rst:479 -#: ../../c-api/unicode.rst:483 +#: ../../c-api/unicode.rst:462 ../../c-api/unicode.rst:466 +#: ../../c-api/unicode.rst:470 ../../c-api/unicode.rst:474 +#: ../../c-api/unicode.rst:478 msgid "Specified by the length modifier" msgstr "" -#: ../../c-api/unicode.rst:468 +#: ../../c-api/unicode.rst:463 msgid "The decimal representation of a signed C integer." msgstr "一個有符號 C 整數的十進位表示法。" -#: ../../c-api/unicode.rst:470 +#: ../../c-api/unicode.rst:465 msgid "``u``" msgstr "``u``" -#: ../../c-api/unicode.rst:472 +#: ../../c-api/unicode.rst:467 msgid "The decimal representation of an unsigned C integer." msgstr "一個無符號 C 整數的十進位表示法。" -#: ../../c-api/unicode.rst:474 +#: ../../c-api/unicode.rst:469 msgid "``o``" msgstr "``o``" -#: ../../c-api/unicode.rst:476 +#: ../../c-api/unicode.rst:471 msgid "The octal representation of an unsigned C integer." msgstr "一個無符號 C 整數的八進位表示法。" -#: ../../c-api/unicode.rst:478 +#: ../../c-api/unicode.rst:473 msgid "``x``" msgstr "``x``" -#: ../../c-api/unicode.rst:480 +#: ../../c-api/unicode.rst:475 msgid "The hexadecimal representation of an unsigned C integer (lowercase)." msgstr "一個無符號 C 整數的十六進位表示法(小寫)。" -#: ../../c-api/unicode.rst:482 +#: ../../c-api/unicode.rst:477 msgid "``X``" msgstr "``X``" -#: ../../c-api/unicode.rst:484 +#: ../../c-api/unicode.rst:479 msgid "The hexadecimal representation of an unsigned C integer (uppercase)." msgstr "一個無符號 C 整數的十六進位表示法(大寫)。" -#: ../../c-api/unicode.rst:486 +#: ../../c-api/unicode.rst:481 msgid "``c``" msgstr "``c``" -#: ../../c-api/unicode.rst:487 +#: ../../c-api/unicode.rst:482 msgid ":c:expr:`int`" msgstr ":c:expr:`int`" -#: ../../c-api/unicode.rst:488 +#: ../../c-api/unicode.rst:483 msgid "A single character." msgstr "一個單一字元。" -#: ../../c-api/unicode.rst:490 +#: ../../c-api/unicode.rst:485 msgid "``s``" msgstr "``s``" -#: ../../c-api/unicode.rst:491 +#: ../../c-api/unicode.rst:486 msgid ":c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:492 +#: ../../c-api/unicode.rst:487 msgid "A null-terminated C character array." msgstr "一個以 null 結尾的 C 字元陣列。" -#: ../../c-api/unicode.rst:494 +#: ../../c-api/unicode.rst:489 msgid "``p``" msgstr "``p``" -#: ../../c-api/unicode.rst:495 +#: ../../c-api/unicode.rst:490 msgid ":c:expr:`const void*`" msgstr ":c:expr:`const void*`" -#: ../../c-api/unicode.rst:496 +#: ../../c-api/unicode.rst:491 msgid "" "The hex representation of a C pointer. Mostly equivalent to " "``printf(\"%p\")`` except that it is guaranteed to start with the literal " "``0x`` regardless of what the platform's ``printf`` yields." msgstr "" -#: ../../c-api/unicode.rst:501 +#: ../../c-api/unicode.rst:496 msgid "``A``" msgstr "``A``" -#: ../../c-api/unicode.rst:502 ../../c-api/unicode.rst:506 -#: ../../c-api/unicode.rst:516 ../../c-api/unicode.rst:520 -#: ../../c-api/unicode.rst:524 ../../c-api/unicode.rst:529 +#: ../../c-api/unicode.rst:497 ../../c-api/unicode.rst:501 +#: ../../c-api/unicode.rst:511 ../../c-api/unicode.rst:515 +#: ../../c-api/unicode.rst:519 ../../c-api/unicode.rst:524 msgid ":c:expr:`PyObject*`" msgstr ":c:expr:`PyObject*`" -#: ../../c-api/unicode.rst:503 +#: ../../c-api/unicode.rst:498 msgid "The result of calling :func:`ascii`." msgstr "呼叫 :func:`ascii` 的結果。" -#: ../../c-api/unicode.rst:505 +#: ../../c-api/unicode.rst:500 msgid "``U``" msgstr "``U``" -#: ../../c-api/unicode.rst:507 +#: ../../c-api/unicode.rst:502 msgid "A Unicode object." msgstr "一個 Unicode 物件。" -#: ../../c-api/unicode.rst:509 +#: ../../c-api/unicode.rst:504 msgid "``V``" msgstr "``V``" -#: ../../c-api/unicode.rst:510 +#: ../../c-api/unicode.rst:505 msgid ":c:expr:`PyObject*`, :c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`PyObject*`、:c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:511 +#: ../../c-api/unicode.rst:506 msgid "" "A Unicode object (which may be ``NULL``) and a null-terminated C character " "array as a second parameter (which will be used, if the first parameter is " "``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:515 +#: ../../c-api/unicode.rst:510 msgid "``S``" msgstr "``S``" -#: ../../c-api/unicode.rst:517 +#: ../../c-api/unicode.rst:512 msgid "The result of calling :c:func:`PyObject_Str`." msgstr "呼叫 :c:func:`PyObject_Str` 的結果。" -#: ../../c-api/unicode.rst:519 +#: ../../c-api/unicode.rst:514 msgid "``R``" msgstr "``R``" -#: ../../c-api/unicode.rst:521 +#: ../../c-api/unicode.rst:516 msgid "The result of calling :c:func:`PyObject_Repr`." msgstr "呼叫 :c:func:`PyObject_Repr` 的結果。" -#: ../../c-api/unicode.rst:523 +#: ../../c-api/unicode.rst:518 msgid "``T``" msgstr "``T``" -#: ../../c-api/unicode.rst:525 +#: ../../c-api/unicode.rst:520 msgid "" -"Get the fully qualified name of an object type; " -"call :c:func:`PyType_GetFullyQualifiedName`." +"Get the fully qualified name of an object type; call :c:func:" +"`PyType_GetFullyQualifiedName`." msgstr "" -#: ../../c-api/unicode.rst:528 +#: ../../c-api/unicode.rst:523 msgid "``#T``" msgstr "``#T``" -#: ../../c-api/unicode.rst:530 +#: ../../c-api/unicode.rst:525 msgid "" "Similar to ``T`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" -#: ../../c-api/unicode.rst:533 +#: ../../c-api/unicode.rst:528 msgid "``N``" msgstr "``N``" -#: ../../c-api/unicode.rst:534 ../../c-api/unicode.rst:539 +#: ../../c-api/unicode.rst:529 ../../c-api/unicode.rst:534 msgid ":c:expr:`PyTypeObject*`" msgstr ":c:expr:`PyTypeObject*`" -#: ../../c-api/unicode.rst:535 +#: ../../c-api/unicode.rst:530 msgid "" -"Get the fully qualified name of a type; " -"call :c:func:`PyType_GetFullyQualifiedName`." +"Get the fully qualified name of a type; call :c:func:" +"`PyType_GetFullyQualifiedName`." msgstr "" -#: ../../c-api/unicode.rst:538 +#: ../../c-api/unicode.rst:533 msgid "``#N``" msgstr "``#N``" -#: ../../c-api/unicode.rst:540 +#: ../../c-api/unicode.rst:535 msgid "" "Similar to ``N`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" -#: ../../c-api/unicode.rst:544 +#: ../../c-api/unicode.rst:539 msgid "" "The width formatter unit is number of characters rather than bytes. The " "precision formatter unit is number of bytes or :c:type:`wchar_t` items (if " @@ -765,22 +763,22 @@ msgid "" "``PyObject*`` argument is not ``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:552 +#: ../../c-api/unicode.rst:547 msgid "" "Unlike to C :c:func:`printf` the ``0`` flag has effect even when a precision " "is given for integer conversions (``d``, ``i``, ``u``, ``o``, ``x``, or " "``X``)." msgstr "" -#: ../../c-api/unicode.rst:556 +#: ../../c-api/unicode.rst:551 msgid "Support for ``\"%lld\"`` and ``\"%llu\"`` added." msgstr "新增對 ``\"%lld\"`` 和 ``\"%llu\"`` 的支援。" -#: ../../c-api/unicode.rst:559 +#: ../../c-api/unicode.rst:554 msgid "Support for ``\"%li\"``, ``\"%lli\"`` and ``\"%zi\"`` added." msgstr "新增對 ``\"%li\"``、``\"%lli\"`` 和 ``\"%zi\"`` 的支援。" -#: ../../c-api/unicode.rst:562 +#: ../../c-api/unicode.rst:557 msgid "" "Support width and precision formatter for ``\"%s\"``, ``\"%A\"``, " "``\"%U\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` added." @@ -788,7 +786,7 @@ msgstr "" "新增對 ``\"%s\"``、``\"%A\"``、``\"%U\"``、``\"%V\"``、``\"%S\"``、" "``\"%R\"`` 的寬度和精確度格式化支援。" -#: ../../c-api/unicode.rst:566 +#: ../../c-api/unicode.rst:561 msgid "" "Support for conversion specifiers ``o`` and ``X``. Support for length " "modifiers ``j`` and ``t``. Length modifiers are now applied to all integer " @@ -797,40 +795,50 @@ msgid "" "flag ``-``." msgstr "" -#: ../../c-api/unicode.rst:574 +#: ../../c-api/unicode.rst:569 msgid "" "An unrecognized format character now sets a :exc:`SystemError`. In previous " "versions it caused all the rest of the format string to be copied as-is to " "the result string, and any extra arguments discarded." msgstr "" -#: ../../c-api/unicode.rst:578 +#: ../../c-api/unicode.rst:573 msgid "Support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats added." msgstr "新增對 ``%T``、``%#T``、``%N`` 和 ``%#N`` 格式的支援。" -#: ../../c-api/unicode.rst:584 +#: ../../c-api/unicode.rst:579 msgid "" "Identical to :c:func:`PyUnicode_FromFormat` except that it takes exactly two " "arguments." msgstr "" -#: ../../c-api/unicode.rst:590 +#: ../../c-api/unicode.rst:585 msgid "" "Copy an instance of a Unicode subtype to a new true Unicode object if " "necessary. If *obj* is already a true Unicode object (not a subtype), return " "a new :term:`strong reference` to the object." msgstr "" -#: ../../c-api/unicode.rst:594 +#: ../../c-api/unicode.rst:589 msgid "" "Objects other than Unicode or its subtypes will cause a :exc:`TypeError`." msgstr "" -#: ../../c-api/unicode.rst:600 +#: ../../c-api/unicode.rst:594 +msgid "Create a Unicode Object from the given Unicode code point *ordinal*." +msgstr "" + +#: ../../c-api/unicode.rst:596 +msgid "" +"The ordinal must be in ``range(0x110000)``. A :exc:`ValueError` is raised in " +"the case it is not." +msgstr "" + +#: ../../c-api/unicode.rst:603 msgid "Decode an encoded object *obj* to a Unicode object." msgstr "" -#: ../../c-api/unicode.rst:602 +#: ../../c-api/unicode.rst:605 msgid "" ":class:`bytes`, :class:`bytearray` and other :term:`bytes-like objects " "` are decoded according to the given *encoding* and using " @@ -838,27 +846,39 @@ msgid "" "interface use the default values (see :ref:`builtincodecs` for details)." msgstr "" -#: ../../c-api/unicode.rst:608 +#: ../../c-api/unicode.rst:611 msgid "" "All other objects, including Unicode objects, cause a :exc:`TypeError` to be " "set." msgstr "" -#: ../../c-api/unicode.rst:611 +#: ../../c-api/unicode.rst:614 msgid "" "The API returns ``NULL`` if there was an error. The caller is responsible " "for decref'ing the returned objects." msgstr "" -#: ../../c-api/unicode.rst:617 +#: ../../c-api/unicode.rst:620 +msgid "" +"Return the name of the default string encoding, ``\"utf-8\"``. See :func:" +"`sys.getdefaultencoding`." +msgstr "" + +#: ../../c-api/unicode.rst:623 +msgid "" +"The returned string does not need to be freed, and is valid until " +"interpreter shutdown." +msgstr "" + +#: ../../c-api/unicode.rst:629 msgid "Return the length of the Unicode object, in code points." msgstr "" -#: ../../c-api/unicode.rst:619 +#: ../../c-api/unicode.rst:631 msgid "On error, set an exception and return ``-1``." msgstr "發生錯誤時,設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:630 +#: ../../c-api/unicode.rst:642 msgid "" "Copy characters from one Unicode object into another. This function " "performs character conversion when necessary and falls back to :c:func:`!" @@ -866,61 +886,61 @@ msgid "" "otherwise returns the number of copied characters." msgstr "" -#: ../../c-api/unicode.rst:641 +#: ../../c-api/unicode.rst:653 msgid "" -"Fill a string with a character: write *fill_char* into " -"``unicode[start:start+length]``." +"Fill a string with a character: write *fill_char* into ``unicode[start:" +"start+length]``." msgstr "" -#: ../../c-api/unicode.rst:644 +#: ../../c-api/unicode.rst:656 msgid "" "Fail if *fill_char* is bigger than the string maximum character, or if the " "string has more than 1 reference." msgstr "" -#: ../../c-api/unicode.rst:647 +#: ../../c-api/unicode.rst:659 msgid "" "Return the number of written character, or return ``-1`` and raise an " "exception on error." msgstr "" -#: ../../c-api/unicode.rst:656 +#: ../../c-api/unicode.rst:668 msgid "" -"Write a character to a string. The string must have been created " -"through :c:func:`PyUnicode_New`. Since Unicode strings are supposed to be " -"immutable, the string must not be shared, or have been hashed yet." +"Write a character to a string. The string must have been created through :c:" +"func:`PyUnicode_New`. Since Unicode strings are supposed to be immutable, " +"the string must not be shared, or have been hashed yet." msgstr "" -#: ../../c-api/unicode.rst:660 +#: ../../c-api/unicode.rst:672 msgid "" "This function checks that *unicode* is a Unicode object, that the index is " "not out of bounds, and that the object can be modified safely (i.e. that it " "its reference count is one)." msgstr "" -#: ../../c-api/unicode.rst:664 +#: ../../c-api/unicode.rst:676 msgid "Return ``0`` on success, ``-1`` on error with an exception set." msgstr "成功時回傳 ``0``,發生錯誤時設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:671 +#: ../../c-api/unicode.rst:683 msgid "" "Read a character from a string. This function checks that *unicode* is a " -"Unicode object and the index is not out of bounds, in contrast " -"to :c:func:`PyUnicode_READ_CHAR`, which performs no error checking." +"Unicode object and the index is not out of bounds, in contrast to :c:func:" +"`PyUnicode_READ_CHAR`, which performs no error checking." msgstr "" -#: ../../c-api/unicode.rst:675 +#: ../../c-api/unicode.rst:687 msgid "Return character on success, ``-1`` on error with an exception set." msgstr "成功時回傳字元,發生錯誤時設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:683 +#: ../../c-api/unicode.rst:695 msgid "" "Return a substring of *unicode*, from character index *start* (included) to " "character index *end* (excluded). Negative indices are not supported. On " "error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:693 +#: ../../c-api/unicode.rst:705 msgid "" "Copy the string *unicode* into a UCS4 buffer, including a null character, if " "*copy_null* is set. Returns ``NULL`` and sets an exception on error (in " @@ -928,25 +948,25 @@ msgid "" "*unicode*). *buffer* is returned on success." msgstr "" -#: ../../c-api/unicode.rst:703 +#: ../../c-api/unicode.rst:715 msgid "" -"Copy the string *unicode* into a new UCS4 buffer that is allocated " -"using :c:func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with " -"a :exc:`MemoryError` set. The returned buffer always has an extra null code " -"point appended." +"Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:" +"func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" +"`MemoryError` set. The returned buffer always has an extra null code point " +"appended." msgstr "" -#: ../../c-api/unicode.rst:712 +#: ../../c-api/unicode.rst:724 msgid "Locale Encoding" msgstr "" -#: ../../c-api/unicode.rst:714 +#: ../../c-api/unicode.rst:726 msgid "" "The current locale encoding can be used to decode text from the operating " "system." msgstr "" -#: ../../c-api/unicode.rst:721 +#: ../../c-api/unicode.rst:733 msgid "" "Decode a string from UTF-8 on Android and VxWorks, or from the current " "locale encoding on other platforms. The supported error handlers are " @@ -955,29 +975,29 @@ msgid "" "null character but cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:728 +#: ../../c-api/unicode.rst:740 msgid "" -"Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from " -"the :term:`filesystem encoding and error handler`." +"Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :" +"term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:731 ../../c-api/unicode.rst:766 +#: ../../c-api/unicode.rst:743 ../../c-api/unicode.rst:778 msgid "This function ignores the :ref:`Python UTF-8 Mode `." msgstr "此函式會忽略 :ref:`Python UTF-8 模式 `。" -#: ../../c-api/unicode.rst:735 ../../c-api/unicode.rst:851 +#: ../../c-api/unicode.rst:747 ../../c-api/unicode.rst:863 msgid "The :c:func:`Py_DecodeLocale` function." msgstr ":c:func:`Py_DecodeLocale` 函式。" -#: ../../c-api/unicode.rst:739 +#: ../../c-api/unicode.rst:751 msgid "" "The function now also uses the current locale encoding for the " -"``surrogateescape`` error handler, except on Android. " -"Previously, :c:func:`Py_DecodeLocale` was used for the ``surrogateescape``, " -"and the current locale encoding was used for ``strict``." +"``surrogateescape`` error handler, except on Android. Previously, :c:func:" +"`Py_DecodeLocale` was used for the ``surrogateescape``, and the current " +"locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:748 +#: ../../c-api/unicode.rst:760 msgid "" "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " "length using :c:func:`!strlen`." @@ -985,55 +1005,55 @@ msgstr "" "類似於 :c:func:`PyUnicode_DecodeLocaleAndSize`,但使用 :c:func:`!strlen` 計算" "字串長度。" -#: ../../c-api/unicode.rst:756 +#: ../../c-api/unicode.rst:768 msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are " "``\"strict\"`` and ``\"surrogateescape\"`` (:pep:`383`). The encoder uses " -"``\"strict\"`` error handler if *errors* is ``NULL``. Return " -"a :class:`bytes` object. *unicode* cannot contain embedded null characters." +"``\"strict\"`` error handler if *errors* is ``NULL``. Return a :class:" +"`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:763 +#: ../../c-api/unicode.rst:775 msgid "" -"Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to " -"the :term:`filesystem encoding and error handler`." +"Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:" +"`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:770 ../../c-api/unicode.rst:882 +#: ../../c-api/unicode.rst:782 ../../c-api/unicode.rst:894 msgid "The :c:func:`Py_EncodeLocale` function." msgstr ":c:func:`Py_EncodeLocale` 函式。" -#: ../../c-api/unicode.rst:774 +#: ../../c-api/unicode.rst:786 msgid "" "The function now also uses the current locale encoding for the " -"``surrogateescape`` error handler, except on Android. " -"Previously, :c:func:`Py_EncodeLocale` was used for the ``surrogateescape``, " -"and the current locale encoding was used for ``strict``." +"``surrogateescape`` error handler, except on Android. Previously, :c:func:" +"`Py_EncodeLocale` was used for the ``surrogateescape``, and the current " +"locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:783 +#: ../../c-api/unicode.rst:795 msgid "File System Encoding" msgstr "檔案系統編碼" -#: ../../c-api/unicode.rst:785 +#: ../../c-api/unicode.rst:797 msgid "" "Functions encoding to and decoding from the :term:`filesystem encoding and " "error handler` (:pep:`383` and :pep:`529`)." msgstr "" -#: ../../c-api/unicode.rst:788 +#: ../../c-api/unicode.rst:800 msgid "" "To encode file names to :class:`bytes` during argument parsing, the " "``\"O&\"`` converter should be used, passing :c:func:`!" "PyUnicode_FSConverter` as the conversion function:" msgstr "" -#: ../../c-api/unicode.rst:794 +#: ../../c-api/unicode.rst:806 msgid "" ":ref:`PyArg_Parse\\* converter `: encode :class:`str` objects " -"-- obtained directly or through the :class:`os.PathLike` interface -- " -"to :class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` " +"-- obtained directly or through the :class:`os.PathLike` interface -- to :" +"class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` " "objects are output as-is. *result* must be an address of a C variable of " "type :c:expr:`PyObject*` (or :c:expr:`PyBytesObject*`). On success, set the " "variable to a new :term:`strong reference` to a :ref:`bytes object " @@ -1042,95 +1062,94 @@ msgid "" "not allowed in the result. On failure, return ``0`` with an exception set." msgstr "" -#: ../../c-api/unicode.rst:806 +#: ../../c-api/unicode.rst:818 msgid "" "If *obj* is ``NULL``, the function releases a strong reference stored in the " "variable referred by *result* and returns ``1``." msgstr "" -#: ../../c-api/unicode.rst:811 ../../c-api/unicode.rst:838 +#: ../../c-api/unicode.rst:823 ../../c-api/unicode.rst:850 msgid "Accepts a :term:`path-like object`." msgstr "接受一個 :term:`path-like object`。" -#: ../../c-api/unicode.rst:814 +#: ../../c-api/unicode.rst:826 msgid "" "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " "converter should be used, passing :c:func:`!PyUnicode_FSDecoder` as the " "conversion function:" msgstr "" -#: ../../c-api/unicode.rst:820 +#: ../../c-api/unicode.rst:832 msgid "" ":ref:`PyArg_Parse\\* converter `: decode :class:`bytes` objects " "-- obtained either directly or indirectly through the :class:`os.PathLike` " -"interface -- to :class:`str` " -"using :c:func:`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are " -"output as-is. *result* must be an address of a C variable of " -"type :c:expr:`PyObject*` (or :c:expr:`PyUnicodeObject*`). On success, set " -"the variable to a new :term:`strong reference` to a :ref:`Unicode object " -"` which must be released when it is no longer used and " -"return a non-zero value (:c:macro:`Py_CLEANUP_SUPPORTED`). Embedded null " -"characters are not allowed in the result. On failure, return ``0`` with an " -"exception set." +"interface -- to :class:`str` using :c:func:" +"`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are output as-is. " +"*result* must be an address of a C variable of type :c:expr:`PyObject*` (or :" +"c:expr:`PyUnicodeObject*`). On success, set the variable to a new :term:" +"`strong reference` to a :ref:`Unicode object ` which must be " +"released when it is no longer used and return a non-zero value (:c:macro:" +"`Py_CLEANUP_SUPPORTED`). Embedded null characters are not allowed in the " +"result. On failure, return ``0`` with an exception set." msgstr "" -#: ../../c-api/unicode.rst:833 +#: ../../c-api/unicode.rst:845 msgid "" "If *obj* is ``NULL``, release the strong reference to the object referred to " "by *result* and return ``1``." msgstr "" -#: ../../c-api/unicode.rst:844 +#: ../../c-api/unicode.rst:856 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:846 +#: ../../c-api/unicode.rst:858 msgid "" -"If you need to decode a string from the current locale encoding, " -"use :c:func:`PyUnicode_DecodeLocaleAndSize`." +"If you need to decode a string from the current locale encoding, use :c:func:" +"`PyUnicode_DecodeLocaleAndSize`." msgstr "" -#: ../../c-api/unicode.rst:853 ../../c-api/unicode.rst:866 -#: ../../c-api/unicode.rst:886 +#: ../../c-api/unicode.rst:865 ../../c-api/unicode.rst:878 +#: ../../c-api/unicode.rst:898 msgid "" "The :term:`filesystem error handler ` " "is now used." msgstr "" -#: ../../c-api/unicode.rst:860 +#: ../../c-api/unicode.rst:872 msgid "" "Decode a null-terminated string from the :term:`filesystem encoding and " "error handler`." msgstr "" -#: ../../c-api/unicode.rst:863 +#: ../../c-api/unicode.rst:875 msgid "" -"If the string length is known, " -"use :c:func:`PyUnicode_DecodeFSDefaultAndSize`." +"If the string length is known, use :c:func:" +"`PyUnicode_DecodeFSDefaultAndSize`." msgstr "如果字串長度已知,請使用 :c:func:`PyUnicode_DecodeFSDefaultAndSize`。" -#: ../../c-api/unicode.rst:873 +#: ../../c-api/unicode.rst:885 msgid "" "Encode a Unicode object to the :term:`filesystem encoding and error " "handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` " "object can contain null bytes." msgstr "" -#: ../../c-api/unicode.rst:877 +#: ../../c-api/unicode.rst:889 msgid "" -"If you need to encode a string to the current locale encoding, " -"use :c:func:`PyUnicode_EncodeLocale`." +"If you need to encode a string to the current locale encoding, use :c:func:" +"`PyUnicode_EncodeLocale`." msgstr "" -#: ../../c-api/unicode.rst:891 +#: ../../c-api/unicode.rst:903 msgid "wchar_t Support" msgstr "wchar_t 支援" -#: ../../c-api/unicode.rst:893 +#: ../../c-api/unicode.rst:905 msgid ":c:type:`wchar_t` support for platforms which support it:" msgstr "對支援 :c:type:`wchar_t` 的平台提供支援:" -#: ../../c-api/unicode.rst:897 +#: ../../c-api/unicode.rst:909 msgid "" "Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the " "given *size*. Passing ``-1`` as the *size* indicates that the function must " @@ -1138,73 +1157,72 @@ msgid "" "failure." msgstr "" -#: ../../c-api/unicode.rst:905 +#: ../../c-api/unicode.rst:917 msgid "" "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " "At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " -"trailing null termination character). Return the number " -"of :c:type:`wchar_t` characters copied or ``-1`` in case of an error." +"trailing null termination character). Return the number of :c:type:" +"`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" -#: ../../c-api/unicode.rst:910 +#: ../../c-api/unicode.rst:922 msgid "" "When *wstr* is ``NULL``, instead return the *size* that would be required to " "store all of *unicode* including a terminating null." msgstr "" -#: ../../c-api/unicode.rst:913 +#: ../../c-api/unicode.rst:925 msgid "" "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" -"terminated. It is the responsibility of the caller to make sure that " -"the :c:expr:`wchar_t*` string is null-terminated in case this is required by " -"the application. Also, note that the :c:expr:`wchar_t*` string might contain " +"terminated. It is the responsibility of the caller to make sure that the :c:" +"expr:`wchar_t*` string is null-terminated in case this is required by the " +"application. Also, note that the :c:expr:`wchar_t*` string might contain " "null characters, which would cause the string to be truncated when used with " "most C functions." msgstr "" -#: ../../c-api/unicode.rst:923 +#: ../../c-api/unicode.rst:935 msgid "" "Convert the Unicode object to a wide character string. The output string " "always ends with a null character. If *size* is not ``NULL``, write the " "number of wide characters (excluding the trailing null termination " "character) into *\\*size*. Note that the resulting :c:type:`wchar_t` string " "might contain null characters, which would cause the string to be truncated " -"when used with most C functions. If *size* is ``NULL`` and " -"the :c:expr:`wchar_t*` string contains null characters a :exc:`ValueError` " -"is raised." +"when used with most C functions. If *size* is ``NULL`` and the :c:expr:" +"`wchar_t*` string contains null characters a :exc:`ValueError` is raised." msgstr "" -#: ../../c-api/unicode.rst:931 +#: ../../c-api/unicode.rst:943 msgid "" "Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` " "to free it) on success. On error, returns ``NULL`` and *\\*size* is " "undefined. Raises a :exc:`MemoryError` if memory allocation is failed." msgstr "" -#: ../../c-api/unicode.rst:938 +#: ../../c-api/unicode.rst:950 msgid "" "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " "string contains null characters." msgstr "" -#: ../../c-api/unicode.rst:946 +#: ../../c-api/unicode.rst:958 msgid "Built-in Codecs" msgstr "內建編解碼器" -#: ../../c-api/unicode.rst:948 +#: ../../c-api/unicode.rst:960 msgid "" "Python provides a set of built-in codecs which are written in C for speed. " "All of these codecs are directly usable via the following functions." msgstr "" -#: ../../c-api/unicode.rst:951 +#: ../../c-api/unicode.rst:963 msgid "" "Many of the following APIs take two arguments encoding and errors, and they " "have the same semantics as the ones of the built-in :func:`str` string " "object constructor." msgstr "" -#: ../../c-api/unicode.rst:955 +#: ../../c-api/unicode.rst:967 msgid "" "Setting encoding to ``NULL`` causes the default encoding to be used which is " "UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " @@ -1212,28 +1230,28 @@ msgid "" "handler` internally." msgstr "" -#: ../../c-api/unicode.rst:960 +#: ../../c-api/unicode.rst:972 msgid "" "Error handling is set by errors which may also be set to ``NULL`` meaning to " "use the default handling defined for the codec. Default error handling for " "all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." msgstr "" -#: ../../c-api/unicode.rst:964 +#: ../../c-api/unicode.rst:976 msgid "" "The codecs all use a similar interface. Only deviations from the following " "generic ones are documented for simplicity." msgstr "" -#: ../../c-api/unicode.rst:969 +#: ../../c-api/unicode.rst:981 msgid "Generic Codecs" msgstr "泛用編解碼器" -#: ../../c-api/unicode.rst:971 +#: ../../c-api/unicode.rst:983 msgid "These are the generic codec APIs:" msgstr "這些是泛用編解碼器的 API:" -#: ../../c-api/unicode.rst:977 +#: ../../c-api/unicode.rst:989 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string " "*str*. *encoding* and *errors* have the same meaning as the parameters of " @@ -1242,7 +1260,7 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:987 +#: ../../c-api/unicode.rst:999 msgid "" "Encode a Unicode object and return the result as Python bytes object. " "*encoding* and *errors* have the same meaning as the parameters of the same " @@ -1251,21 +1269,21 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:995 +#: ../../c-api/unicode.rst:1007 msgid "UTF-8 Codecs" msgstr "UTF-8 編解碼器" -#: ../../c-api/unicode.rst:997 +#: ../../c-api/unicode.rst:1009 msgid "These are the UTF-8 codec APIs:" msgstr "這些是 UTF-8 編解碼器的 API:" -#: ../../c-api/unicode.rst:1002 +#: ../../c-api/unicode.rst:1014 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1009 +#: ../../c-api/unicode.rst:1021 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will " @@ -1273,20 +1291,20 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1017 +#: ../../c-api/unicode.rst:1029 msgid "" "Encode a Unicode object using UTF-8 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1021 ../../c-api/unicode.rst:1036 +#: ../../c-api/unicode.rst:1033 ../../c-api/unicode.rst:1048 msgid "" "The function fails if the string contains surrogate code points (``U+D800`` " "- ``U+DFFF``)." msgstr "" -#: ../../c-api/unicode.rst:1027 +#: ../../c-api/unicode.rst:1039 msgid "" "Return a pointer to the UTF-8 encoding of the Unicode object, and store the " "size of the encoded representation (in bytes) in *size*. The *size* " @@ -1295,7 +1313,7 @@ msgid "" "regardless of whether there are any other null code points." msgstr "" -#: ../../c-api/unicode.rst:1033 +#: ../../c-api/unicode.rst:1045 msgid "" "On error, set an exception, set *size* to ``-1`` (if it's not NULL) and " "return ``NULL``." @@ -1303,7 +1321,7 @@ msgstr "" "發生錯誤時,設定例外並將 *size* 設為 ``-1``\\ (如果不是 NULL),並回傳 " "``NULL``。" -#: ../../c-api/unicode.rst:1039 +#: ../../c-api/unicode.rst:1051 msgid "" "This caches the UTF-8 representation of the string in the Unicode object, " "and subsequent calls will return a pointer to the same buffer. The caller " @@ -1312,57 +1330,57 @@ msgid "" "collected." msgstr "" -#: ../../c-api/unicode.rst:1046 ../../c-api/unicode.rst:1068 +#: ../../c-api/unicode.rst:1058 ../../c-api/unicode.rst:1080 msgid "The return type is now ``const char *`` rather of ``char *``." msgstr "回傳型別現在是 ``const char *`` 而不是 ``char *``。" -#: ../../c-api/unicode.rst:1049 +#: ../../c-api/unicode.rst:1061 msgid "This function is a part of the :ref:`limited API `." msgstr "" -#: ../../c-api/unicode.rst:1055 +#: ../../c-api/unicode.rst:1067 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." msgstr "與 :c:func:`PyUnicode_AsUTF8AndSize` 類似,但不儲存大小。" -#: ../../c-api/unicode.rst:1059 +#: ../../c-api/unicode.rst:1071 msgid "" "This function does not have any special behavior for `null characters " "`_ embedded within *unicode*. " "As a result, strings containing null characters will remain in the returned " "string, which some C functions might interpret as the end of the string, " -"leading to truncation. If truncation is an issue, it is recommended to " -"use :c:func:`PyUnicode_AsUTF8AndSize` instead." +"leading to truncation. If truncation is an issue, it is recommended to use :" +"c:func:`PyUnicode_AsUTF8AndSize` instead." msgstr "" -#: ../../c-api/unicode.rst:1073 +#: ../../c-api/unicode.rst:1085 msgid "UTF-32 Codecs" msgstr "UTF-32 編解碼器" -#: ../../c-api/unicode.rst:1075 +#: ../../c-api/unicode.rst:1087 msgid "These are the UTF-32 codec APIs:" msgstr "這些是 UTF-32 編解碼器的 API:" -#: ../../c-api/unicode.rst:1081 +#: ../../c-api/unicode.rst:1093 msgid "" "Decode *size* bytes from a UTF-32 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1085 ../../c-api/unicode.rst:1135 +#: ../../c-api/unicode.rst:1097 ../../c-api/unicode.rst:1147 msgid "" "If *byteorder* is non-``NULL``, the decoder starts decoding using the given " "byte order::" msgstr "" -#: ../../c-api/unicode.rst:1088 ../../c-api/unicode.rst:1138 +#: ../../c-api/unicode.rst:1100 ../../c-api/unicode.rst:1150 msgid "" "*byteorder == -1: little endian\n" "*byteorder == 0: native order\n" "*byteorder == 1: big endian" msgstr "" -#: ../../c-api/unicode.rst:1092 +#: ../../c-api/unicode.rst:1104 msgid "" "If ``*byteorder`` is zero, and the first four bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1370,21 +1388,21 @@ msgid "" "``-1`` or ``1``, any byte order mark is copied to the output." msgstr "" -#: ../../c-api/unicode.rst:1097 +#: ../../c-api/unicode.rst:1109 msgid "" "After completion, *\\*byteorder* is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1100 ../../c-api/unicode.rst:1151 +#: ../../c-api/unicode.rst:1112 ../../c-api/unicode.rst:1163 msgid "If *byteorder* is ``NULL``, the codec starts in native order mode." msgstr "" -#: ../../c-api/unicode.rst:1102 ../../c-api/unicode.rst:1153 +#: ../../c-api/unicode.rst:1114 ../../c-api/unicode.rst:1165 msgid "Return ``NULL`` if an exception was raised by the codec." msgstr "如果編解碼器引發例外則回傳 ``NULL``。" -#: ../../c-api/unicode.rst:1108 +#: ../../c-api/unicode.rst:1120 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not " @@ -1393,29 +1411,29 @@ msgid "" "number of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1117 +#: ../../c-api/unicode.rst:1129 msgid "" "Return a Python byte string using the UTF-32 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1123 +#: ../../c-api/unicode.rst:1135 msgid "UTF-16 Codecs" msgstr "UTF-16 編解碼器" -#: ../../c-api/unicode.rst:1125 +#: ../../c-api/unicode.rst:1137 msgid "These are the UTF-16 codec APIs:" msgstr "這些是 UTF-16 編解碼器的 API:" -#: ../../c-api/unicode.rst:1131 +#: ../../c-api/unicode.rst:1143 msgid "" "Decode *size* bytes from a UTF-16 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1142 +#: ../../c-api/unicode.rst:1154 msgid "" "If ``*byteorder`` is zero, and the first two bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1424,13 +1442,13 @@ msgid "" "result in either a ``\\ufeff`` or a ``\\ufffe`` character)." msgstr "" -#: ../../c-api/unicode.rst:1148 +#: ../../c-api/unicode.rst:1160 msgid "" "After completion, ``*byteorder`` is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1159 +#: ../../c-api/unicode.rst:1171 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not " @@ -1440,28 +1458,28 @@ msgid "" "*consumed*." msgstr "" -#: ../../c-api/unicode.rst:1168 +#: ../../c-api/unicode.rst:1180 msgid "" "Return a Python byte string using the UTF-16 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1174 +#: ../../c-api/unicode.rst:1186 msgid "UTF-7 Codecs" msgstr "UTF-7 編解碼器" -#: ../../c-api/unicode.rst:1176 +#: ../../c-api/unicode.rst:1188 msgid "These are the UTF-7 codec APIs:" msgstr "這些是 UTF-7 編解碼器的 API:" -#: ../../c-api/unicode.rst:1181 +#: ../../c-api/unicode.rst:1193 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1188 +#: ../../c-api/unicode.rst:1200 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will " @@ -1469,101 +1487,101 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1195 +#: ../../c-api/unicode.rst:1207 msgid "Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1197 +#: ../../c-api/unicode.rst:1209 msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1203 +#: ../../c-api/unicode.rst:1215 msgid "" "Create a Unicode object by decoding *size* bytes of the Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1209 +#: ../../c-api/unicode.rst:1221 msgid "" "Encode a Unicode object using Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1215 +#: ../../c-api/unicode.rst:1227 msgid "Raw-Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1217 +#: ../../c-api/unicode.rst:1229 msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1223 +#: ../../c-api/unicode.rst:1235 msgid "" "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1229 +#: ../../c-api/unicode.rst:1241 msgid "" "Encode a Unicode object using Raw-Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1235 +#: ../../c-api/unicode.rst:1247 msgid "Latin-1 Codecs" msgstr "Latin-1 編解碼器" -#: ../../c-api/unicode.rst:1237 +#: ../../c-api/unicode.rst:1249 msgid "" "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 " "Unicode ordinals and only these are accepted by the codecs during encoding." msgstr "" -#: ../../c-api/unicode.rst:1243 +#: ../../c-api/unicode.rst:1255 msgid "" "Create a Unicode object by decoding *size* bytes of the Latin-1 encoded " "string *str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1249 +#: ../../c-api/unicode.rst:1261 msgid "" "Encode a Unicode object using Latin-1 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1255 +#: ../../c-api/unicode.rst:1267 msgid "ASCII Codecs" msgstr "ASCII 編解碼器" -#: ../../c-api/unicode.rst:1257 +#: ../../c-api/unicode.rst:1269 msgid "" "These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All " "other codes generate errors." msgstr "" -#: ../../c-api/unicode.rst:1263 +#: ../../c-api/unicode.rst:1275 msgid "" "Create a Unicode object by decoding *size* bytes of the ASCII encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1269 +#: ../../c-api/unicode.rst:1281 msgid "" "Encode a Unicode object using ASCII and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1275 +#: ../../c-api/unicode.rst:1287 msgid "Character Map Codecs" msgstr "" -#: ../../c-api/unicode.rst:1277 +#: ../../c-api/unicode.rst:1289 msgid "" "This codec is special in that it can be used to implement many different " "codecs (and this is in fact what was done to obtain most of the standard " @@ -1573,18 +1591,18 @@ msgid "" "sequences work well." msgstr "" -#: ../../c-api/unicode.rst:1283 +#: ../../c-api/unicode.rst:1295 msgid "These are the mapping codec APIs:" msgstr "這些是對映編解碼器的 API:" -#: ../../c-api/unicode.rst:1288 +#: ../../c-api/unicode.rst:1300 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string *str* " "using the given *mapping* object. Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1292 +#: ../../c-api/unicode.rst:1304 msgid "" "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " "must map bytes ordinals (integers in the range from 0 to 255) to Unicode " @@ -1594,14 +1612,14 @@ msgid "" "treated as undefined mappings and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1303 +#: ../../c-api/unicode.rst:1315 msgid "" "Encode a Unicode object using the given *mapping* object and return the " "result as a bytes object. Error handling is \"strict\". Return ``NULL`` if " "an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1307 +#: ../../c-api/unicode.rst:1319 msgid "" "The *mapping* object must map Unicode ordinal integers to bytes objects, " "integers in the range from 0 to 255 or ``None``. Unmapped character " @@ -1609,41 +1627,41 @@ msgid "" "``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1313 +#: ../../c-api/unicode.rst:1325 msgid "The following codec API is special in that maps Unicode to Unicode." msgstr "" -#: ../../c-api/unicode.rst:1317 +#: ../../c-api/unicode.rst:1329 msgid "" "Translate a string by applying a character mapping table to it and return " "the resulting Unicode object. Return ``NULL`` if an exception was raised by " "the codec." msgstr "" -#: ../../c-api/unicode.rst:1321 +#: ../../c-api/unicode.rst:1333 msgid "" "The mapping table must map Unicode ordinal integers to Unicode ordinal " "integers or ``None`` (causing deletion of the character)." msgstr "" -#: ../../c-api/unicode.rst:1324 +#: ../../c-api/unicode.rst:1336 msgid "" "Mapping tables need only provide the :meth:`~object.__getitem__` interface; " "dictionaries and sequences work well. Unmapped character ordinals (ones " "which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" -#: ../../c-api/unicode.rst:1328 +#: ../../c-api/unicode.rst:1340 msgid "" "*errors* has the usual meaning for codecs. It may be ``NULL`` which " "indicates to use the default error handling." msgstr "" -#: ../../c-api/unicode.rst:1333 +#: ../../c-api/unicode.rst:1345 msgid "MBCS codecs for Windows" msgstr "Windows 的 MBCS 編解碼器" -#: ../../c-api/unicode.rst:1335 +#: ../../c-api/unicode.rst:1347 msgid "" "These are the MBCS codec APIs. They are currently only available on Windows " "and use the Win32 MBCS converters to implement the conversions. Note that " @@ -1651,13 +1669,13 @@ msgid "" "is defined by the user settings on the machine running the codec." msgstr "" -#: ../../c-api/unicode.rst:1342 +#: ../../c-api/unicode.rst:1354 msgid "" "Create a Unicode object by decoding *size* bytes of the MBCS encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1349 +#: ../../c-api/unicode.rst:1361 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not " @@ -1665,44 +1683,50 @@ msgid "" "will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1357 +#: ../../c-api/unicode.rst:1370 +msgid "" +"Similar to :c:func:`PyUnicode_DecodeMBCSStateful`, except uses the code page " +"specified by *code_page*." +msgstr "" + +#: ../../c-api/unicode.rst:1376 msgid "" "Encode a Unicode object using MBCS and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1364 +#: ../../c-api/unicode.rst:1383 msgid "" "Encode the Unicode object using the specified code page and return a Python " -"bytes object. Return ``NULL`` if an exception was raised by the codec. " -"Use :c:macro:`!CP_ACP` code page to get the MBCS encoder." +"bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" +"c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" -#: ../../c-api/unicode.rst:1372 +#: ../../c-api/unicode.rst:1391 msgid "Methods & Slots" msgstr "" -#: ../../c-api/unicode.rst:1378 +#: ../../c-api/unicode.rst:1397 msgid "Methods and Slot Functions" msgstr "" -#: ../../c-api/unicode.rst:1380 +#: ../../c-api/unicode.rst:1399 msgid "" "The following APIs are capable of handling Unicode objects and strings on " "input (we refer to them as strings in the descriptions) and return Unicode " "objects or integers as appropriate." msgstr "" -#: ../../c-api/unicode.rst:1384 +#: ../../c-api/unicode.rst:1403 msgid "They all return ``NULL`` or ``-1`` if an exception occurs." -msgstr "" +msgstr "如果發生例外,則回傳 ``NULL`` 或 ``-1``。" -#: ../../c-api/unicode.rst:1389 +#: ../../c-api/unicode.rst:1408 msgid "Concat two strings giving a new Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1394 +#: ../../c-api/unicode.rst:1413 msgid "" "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " "splitting will be done at all whitespace substrings. Otherwise, splits " @@ -1711,27 +1735,73 @@ msgid "" "list." msgstr "" -#: ../../c-api/unicode.rst:1402 +#: ../../c-api/unicode.rst:1418 ../../c-api/unicode.rst:1428 +#: ../../c-api/unicode.rst:1449 ../../c-api/unicode.rst:1462 +msgid "On error, return ``NULL`` with an exception set." +msgstr "於錯誤發生時回傳 ``NULL`` 並設定例外。" + +#: ../../c-api/unicode.rst:1420 +msgid "Equivalent to :py:meth:`str.split`." +msgstr "等價於 :py:meth:`str.split`。" + +#: ../../c-api/unicode.rst:1425 +msgid "" +"Similar to :c:func:`PyUnicode_Split`, but splitting will be done beginning " +"at the end of the string." +msgstr "" + +#: ../../c-api/unicode.rst:1430 +msgid "Equivalent to :py:meth:`str.rsplit`." +msgstr "等價於 :py:meth:`str.rsplit`。" + +#: ../../c-api/unicode.rst:1435 msgid "" "Split a Unicode string at line breaks, returning a list of Unicode strings. " "CRLF is considered to be one line break. If *keepends* is ``0``, the Line " "break characters are not included in the resulting strings." msgstr "" -#: ../../c-api/unicode.rst:1409 +#: ../../c-api/unicode.rst:1442 +msgid "" +"Split a Unicode string at the first occurrence of *sep*, and return a 3-" +"tuple containing the part before the separator, the separator itself, and " +"the part after the separator. If the separator is not found, return a 3-" +"tuple containing the string itself, followed by two empty strings." +msgstr "" + +#: ../../c-api/unicode.rst:1447 ../../c-api/unicode.rst:1460 +msgid "*sep* must not be empty." +msgstr "*sep* 不得為空。" + +#: ../../c-api/unicode.rst:1451 +msgid "Equivalent to :py:meth:`str.partition`." +msgstr "等價於 :py:meth:`str.partition`。" + +#: ../../c-api/unicode.rst:1456 +msgid "" +"Similar to :c:func:`PyUnicode_Partition`, but split a Unicode string at the " +"last occurrence of *sep*. If the separator is not found, return a 3-tuple " +"containing two empty strings, followed by the string itself." +msgstr "" + +#: ../../c-api/unicode.rst:1464 +msgid "Equivalent to :py:meth:`str.rpartition`." +msgstr "等價於 :py:meth:`str.rpartition`。" + +#: ../../c-api/unicode.rst:1469 msgid "" "Join a sequence of strings using the given *separator* and return the " "resulting Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1416 +#: ../../c-api/unicode.rst:1476 msgid "" "Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail " "end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` " "a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1424 +#: ../../c-api/unicode.rst:1484 msgid "" "Return the first position of *substr* in ``unicode[start:end]`` using the " "given *direction* (*direction* == ``1`` means to do a forward search, " @@ -1740,7 +1810,7 @@ msgid "" "``-2`` indicates that an error occurred and an exception has been set." msgstr "" -#: ../../c-api/unicode.rst:1434 +#: ../../c-api/unicode.rst:1494 msgid "" "Return the first position of the character *ch* in ``unicode[start:end]`` " "using the given *direction* (*direction* == ``1`` means to do a forward " @@ -1750,37 +1820,37 @@ msgid "" "set." msgstr "" -#: ../../c-api/unicode.rst:1442 +#: ../../c-api/unicode.rst:1502 msgid "" "*start* and *end* are now adjusted to behave like ``unicode[start:end]``." msgstr "" -#: ../../c-api/unicode.rst:1449 +#: ../../c-api/unicode.rst:1509 msgid "" "Return the number of non-overlapping occurrences of *substr* in " "``unicode[start:end]``. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1456 +#: ../../c-api/unicode.rst:1516 msgid "" "Replace at most *maxcount* occurrences of *substr* in *unicode* with " "*replstr* and return the resulting Unicode object. *maxcount* == ``-1`` " "means replace all occurrences." msgstr "" -#: ../../c-api/unicode.rst:1463 +#: ../../c-api/unicode.rst:1523 msgid "" "Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, " "and greater than, respectively." msgstr "" -#: ../../c-api/unicode.rst:1466 +#: ../../c-api/unicode.rst:1526 msgid "" -"This function returns ``-1`` upon failure, so one should " -"call :c:func:`PyErr_Occurred` to check for errors." +"This function returns ``-1`` upon failure, so one should call :c:func:" +"`PyErr_Occurred` to check for errors." msgstr "" -#: ../../c-api/unicode.rst:1472 +#: ../../c-api/unicode.rst:1532 msgid "" "Compare a Unicode object with a char buffer which is interpreted as being " "UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false " @@ -1789,18 +1859,18 @@ msgid "" "is returned." msgstr "" -#: ../../c-api/unicode.rst:1479 ../../c-api/unicode.rst:1500 +#: ../../c-api/unicode.rst:1539 ../../c-api/unicode.rst:1560 msgid "This function does not raise exceptions." msgstr "此函式不會引發例外。" -#: ../../c-api/unicode.rst:1486 +#: ../../c-api/unicode.rst:1546 msgid "" "Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* " "length using :c:func:`!strlen`. If the Unicode object contains null " "characters, false (``0``) is returned." msgstr "" -#: ../../c-api/unicode.rst:1495 +#: ../../c-api/unicode.rst:1555 msgid "" "Compare a Unicode object, *unicode*, with *string* and return ``-1``, ``0``, " "``1`` for less than, equal, and greater than, respectively. It is best to " @@ -1808,59 +1878,58 @@ msgid "" "string as ISO-8859-1 if it contains non-ASCII characters." msgstr "" -#: ../../c-api/unicode.rst:1505 +#: ../../c-api/unicode.rst:1565 msgid "Rich compare two Unicode strings and return one of the following:" msgstr "" -#: ../../c-api/unicode.rst:1507 +#: ../../c-api/unicode.rst:1567 msgid "``NULL`` in case an exception was raised" msgstr "" -#: ../../c-api/unicode.rst:1508 +#: ../../c-api/unicode.rst:1568 msgid ":c:data:`Py_True` or :c:data:`Py_False` for successful comparisons" msgstr "" -#: ../../c-api/unicode.rst:1509 +#: ../../c-api/unicode.rst:1569 msgid ":c:data:`Py_NotImplemented` in case the type combination is unknown" msgstr "" -#: ../../c-api/unicode.rst:1511 +#: ../../c-api/unicode.rst:1571 msgid "" -"Possible values for *op* " -"are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, " -"and :c:macro:`Py_LE`." +"Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:" +"`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." msgstr "" -#: ../../c-api/unicode.rst:1517 +#: ../../c-api/unicode.rst:1577 msgid "" "Return a new string object from *format* and *args*; this is analogous to " "``format % args``." msgstr "" -#: ../../c-api/unicode.rst:1523 +#: ../../c-api/unicode.rst:1583 msgid "" "Check whether *substr* is contained in *unicode* and return true or false " "accordingly." msgstr "" -#: ../../c-api/unicode.rst:1526 +#: ../../c-api/unicode.rst:1586 msgid "" "*substr* has to coerce to a one element Unicode string. ``-1`` is returned " "if there was an error." msgstr "" -#: ../../c-api/unicode.rst:1532 +#: ../../c-api/unicode.rst:1592 msgid "" "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " "address of a pointer variable pointing to a Python Unicode string object. " -"If there is an existing interned string that is the same " -"as :c:expr:`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the " -"reference to the old string object and creating a new :term:`strong " -"reference` to the interned string object), otherwise it " -"leaves :c:expr:`*p_unicode` alone and interns it." +"If there is an existing interned string that is the same as :c:expr:" +"`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the reference to " +"the old string object and creating a new :term:`strong reference` to the " +"interned string object), otherwise it leaves :c:expr:`*p_unicode` alone and " +"interns it." msgstr "" -#: ../../c-api/unicode.rst:1539 +#: ../../c-api/unicode.rst:1599 msgid "" "(Clarification: even though there is a lot of talk about references, think " "of this function as reference-neutral. You must own the object you pass in; " @@ -1868,48 +1937,47 @@ msgid "" "the result.)" msgstr "" -#: ../../c-api/unicode.rst:1544 +#: ../../c-api/unicode.rst:1604 msgid "" "This function never raises an exception. On error, it leaves its argument " "unchanged without interning it." msgstr "" -#: ../../c-api/unicode.rst:1547 +#: ../../c-api/unicode.rst:1607 msgid "" -"Instances of subclasses of :py:class:`str` may not be interned, that " -"is, :c:expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, " -"then -- as with any other error -- the argument is left unchanged." +"Instances of subclasses of :py:class:`str` may not be interned, that is, :c:" +"expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- " +"as with any other error -- the argument is left unchanged." msgstr "" -#: ../../c-api/unicode.rst:1551 +#: ../../c-api/unicode.rst:1611 msgid "" "Note that interned strings are not “immortal”. You must keep a reference to " "the result to benefit from interning." msgstr "" -#: ../../c-api/unicode.rst:1557 +#: ../../c-api/unicode.rst:1617 msgid "" -"A combination of :c:func:`PyUnicode_FromString` " -"and :c:func:`PyUnicode_InternInPlace`, meant for statically allocated " -"strings." +"A combination of :c:func:`PyUnicode_FromString` and :c:func:" +"`PyUnicode_InternInPlace`, meant for statically allocated strings." msgstr "" -#: ../../c-api/unicode.rst:1560 +#: ../../c-api/unicode.rst:1620 msgid "" "Return a new (\"owned\") reference to either a new Unicode string object " "that has been interned, or an earlier interned string object with the same " "value." msgstr "" -#: ../../c-api/unicode.rst:1564 +#: ../../c-api/unicode.rst:1624 msgid "" "Python may keep a reference to the result, or make it :term:`immortal`, " "preventing it from being garbage-collected promptly. For interning an " "unbounded number of different strings, such as ones coming from user input, " -"prefer calling :c:func:`PyUnicode_FromString` " -"and :c:func:`PyUnicode_InternInPlace` directly." +"prefer calling :c:func:`PyUnicode_FromString` and :c:func:" +"`PyUnicode_InternInPlace` directly." msgstr "" -#: ../../c-api/unicode.rst:1572 +#: ../../c-api/unicode.rst:1632 msgid "Strings interned this way are made :term:`immortal`." msgstr "" diff --git a/deprecations/index.po b/deprecations/index.po index b6c4ff73e5..1996ccf8a9 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-10 17:21+0000\n" +"POT-Creation-Date: 2025-02-28 00:14+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-" @@ -65,8 +65,8 @@ msgstr ":class:`!ast.Ellipsis`" #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" -"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" -"`90953`.)" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " +"in :gh:`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" @@ -77,27 +77,26 @@ msgstr ":mod:`asyncio`:" #: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" -"The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" -"`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" -"class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " +"The child watcher " +"classes :class:`~asyncio.MultiLoopChildWatcher`, :class:`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` " +"and :class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " "Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`~asyncio." -"MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio." -"AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " -"Aditya 於 :gh:`94597` 貢獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類" +"別::class:`~asyncio.MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio.AbstractChildWatcher` " +"和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar Aditya 於 :gh:`94597` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" -":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" -"`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." -"AbstractEventLoopPolicy.get_child_watcher` are deprecated and will be " -"removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " +"and :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated " +"and will be removed in Python 3.14. (Contributed by Kumar Aditya " +"in :gh:`94597`.)" msgstr "" -":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:" -"`asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`asyncio." -"AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" -"除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " +"和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 " +"Python 3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" @@ -114,18 +113,21 @@ msgstr "" msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." -"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" +"typing, prefer a union, like ``bytes | bytearray``, " +"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " +"in :gh:`91896`.)" msgstr "" -":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改用 :" -"class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用時,請" -"改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " -"Shantanu Jain 於 :gh:`91896` 貢獻。)" +":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" +"用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" +"時,請改用聯集,如 ``bytes | bytearray``," +"或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" -":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." -"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" +":mod:`email`: Deprecated the *isdst* parameter " +"in :func:`email.utils.localtime`. (Contributed by Alan Williams " +"in :gh:`72346`.)" msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" @@ -179,24 +181,25 @@ msgid "" "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " "currently the default (:gh:`84559`). Adding a runtime warning about this was " "deemed too disruptive as the majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." -"set_start_method` APIs to explicitly specify when your code *requires* " -"``'fork'``. See :ref:`multiprocessing-start-methods`." +"the :func:`~multiprocessing.get_context` " +"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " +"your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" ":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" "台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" -"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" -"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " -"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" -"`multiprocessing-start-methods`。" +"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使" +"用 :func:`~multiprocessing.get_context` " +"或 :func:`~multiprocessing.set_start_method` API 來明確指定你的程式碼何時\\ *" +"需要* ``'fork'``。請參閱 :ref:`multiprocessing-start-methods`。" #: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" -":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." -"PurePath.relative_to`: passing additional arguments is deprecated." +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " +"and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments is " +"deprecated." msgstr "" -":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" -"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" +":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` " +"和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" #: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" @@ -205,8 +208,9 @@ msgid "" "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " -"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." -"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" +"現在會引發 :exc:`DeprecationWarning`;請改" +"用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" @@ -230,9 +234,9 @@ msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" #: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" -":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" -"ref:`named placeholders ` are used and *parameters* is " -"a sequence instead of a :class:`dict`." +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " +"if :ref:`named placeholders ` are used and " +"*parameters* is a sequence instead of a :class:`dict`." msgstr "" ":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" @@ -249,8 +253,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " -"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" -"`88168`.)" +"intended to be a public API. (Contributed by Gregory P. Smith " +"in :gh:`88168`.)" msgstr "" ":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" "(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" @@ -267,10 +271,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" -"`__spec__.cached ` is deprecated. In " -"Python 3.15, :attr:`!__cached__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to " +"set :attr:`__spec__.cached ` is " +"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " +"into consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "` 的做法已被棄用。在 Python 3.15 中," @@ -278,10 +282,11 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to set :attr:" -"`__spec__.parent ` is deprecated. In " -"Python 3.15, :attr:`!__package__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to " +"set :attr:`__spec__.parent ` is " +"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " +"take into consideration by the import system or standard library. " +"(:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "` 的做法已被棄用。在 Python 3.15 中," @@ -321,39 +326,50 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:58 +msgid ":mod:`importlib`:" +msgstr ":mod:`importlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "``load_module()`` method:請改用 ``exec_module()``。" + +#: ../../deprecations/pending-removal-in-3.15.rst:36 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:34 +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" -"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." -"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " -"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 " +"(:gh:`90817`), but has been postponed to Python 3.15. " +"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " +"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " +"in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" -"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." -"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" +"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " +"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" +"獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" -"func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " +"Use :func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." -"isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" +"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:48 +#: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -362,11 +378,23 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:54 +#: ../../deprecations/pending-removal-in-3.15.rst:58 +msgid ":mod:`sysconfig`:" +msgstr ":mod:`sysconfig`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" +":func:`sysconfig.is_python_build` 的 *check_home* 引數自 Python 3.12 起已被棄" +"用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:63 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:56 +#: ../../deprecations/pending-removal-in-3.15.rst:65 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -377,11 +405,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`types`:" msgstr ":mod:`types`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -389,26 +417,26 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" +"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " +"於 :gh:`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:71 +#: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:73 +#: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" -"The undocumented keyword argument syntax for creating :class:`~typing." -"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " -"has been deprecated since Python 3.13. Use the class-based syntax or the " -"functional syntax instead." +"The undocumented keyword argument syntax for " +"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " +"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " +"3.13. Use the class-based syntax or the functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:79 +#: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -418,19 +446,20 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:84 +#: ../../deprecations/pending-removal-in-3.15.rst:93 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:86 +#: ../../deprecations/pending-removal-in-3.15.rst:95 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." -"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" -"`~wave.Wave_write` classes have been deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " +"and :meth:`~wave.Wave_read.getmarkers` methods of " +"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " +"deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" -"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." -"getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" +"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " +"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending removal in Python 3.16" @@ -438,10 +467,10 @@ msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" -"`__spec__.loader ` is deprecated. In " -"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " -"consideration by the import system or the standard library." +"Setting :attr:`~module.__loader__` on a module while failing to " +"set :attr:`__spec__.loader ` is " +"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " +"taken into consideration by the import system or the standard library." msgstr "" "在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " "` 的做法將於 Python 3.16 被棄用。在 " @@ -468,8 +497,8 @@ msgid "" "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" -"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" -"gh:`122875` 貢獻。)" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " +"於 :gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 #: ../../deprecations/pending-removal-in-future.rst:12 @@ -579,17 +608,17 @@ msgid "" "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of keywords :keyword:" -"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" -"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " -"syntax error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of " +"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " +"and :keyword:`or`. In a future release it will be changed to a syntax " +"error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " "1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" -"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" -"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" -"本中,它將被更改為語法錯誤。(:gh:`87999`)" +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" +"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " +"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" +"法錯誤。(:gh:`87999`)" #: ../../deprecations/pending-removal-in-future.rst:26 msgid "" @@ -602,18 +631,18 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:29 msgid "" -"Support for ``__float__()`` method returning a strict subclass of :class:" -"`float`: these methods will be required to return an instance of :class:" -"`float`." +"Support for ``__float__()`` method returning a strict subclass " +"of :class:`float`: these methods will be required to return an instance " +"of :class:`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" #: ../../deprecations/pending-removal-in-future.rst:32 msgid "" -"Support for ``__complex__()`` method returning a strict subclass of :class:" -"`complex`: these methods will be required to return an instance of :class:" -"`complex`." +"Support for ``__complex__()`` method returning a strict subclass " +"of :class:`complex`: these methods will be required to return an instance " +"of :class:`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" @@ -624,10 +653,10 @@ msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" #: ../../deprecations/pending-removal-in-future.rst:36 msgid "" -"Passing a complex number as the *real* or *imag* argument in the :func:" -"`complex` constructor is now deprecated; it should only be passed as a " -"single positional argument. (Contributed by Serhiy Storchaka in :gh:" -"`109218`.)" +"Passing a complex number as the *real* or *imag* argument in " +"the :func:`complex` constructor is now deprecated; it should only be passed " +"as a single positional argument. (Contributed by Serhiy Storchaka " +"in :gh:`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" @@ -635,8 +664,9 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:41 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." -"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` " +"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " +"in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " @@ -655,33 +685,25 @@ msgstr ":mod:`datetime`:" #: ../../deprecations/pending-removal-in-future.rst:51 msgid "" -":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." -"UTC)``." +":meth:`~datetime.datetime.utcnow`: use " +"``datetime.datetime.now(tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." -"now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 " +"``datetime.datetime.now(tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:53 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." -"fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use " +"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." -"fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " +"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:56 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" -#: ../../deprecations/pending-removal-in-future.rst:58 -msgid ":mod:`importlib`:" -msgstr ":mod:`importlib`:" - #: ../../deprecations/pending-removal-in-future.rst:60 -msgid "``load_module()`` method: use ``exec_module()`` instead." -msgstr "``load_module()`` method:請改用 ``exec_module()``。" - -#: ../../deprecations/pending-removal-in-future.rst:61 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -689,39 +711,39 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:65 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:67 +#: ../../deprecations/pending-removal-in-future.rst:66 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:68 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" -"`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" +"用 :meth:`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:71 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:75 +#: ../../deprecations/pending-removal-in-future.rst:74 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:76 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -729,7 +751,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:80 +#: ../../deprecations/pending-removal-in-future.rst:79 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -741,12 +763,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:87 +#: ../../deprecations/pending-removal-in-future.rst:86 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:88 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -754,115 +776,108 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:91 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:94 +#: ../../deprecations/pending-removal-in-future.rst:93 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:94 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" -"`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " +"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" -"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " +"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:97 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 -msgid "" -":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " -"ignored." -msgstr "" -":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" - -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "" -":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." -"notify_all`." +":meth:`!threading.Condition.notifyAll`: " +"use :meth:`~threading.Condition.notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." -"notify_all`。" +":meth:`!threading.Condition.notifyAll`:請" +"用 :meth:`~threading.Condition.notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:111 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" -"attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " +"use :attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" -"attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " +"use :attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" -"attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" +"用 :attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:116 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:121 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:119 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:121 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -870,91 +885,91 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:127 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:129 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:135 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "" -":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" -"`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " -"Use newer :func:`~urllib.request.urlopen` functions and methods." +":mod:`urllib.request`: :class:`~urllib.request.URLopener` " +"and :class:`~urllib.request.FancyURLopener` style of invoking requests is " +"deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods." msgstr "" -":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` 和 :" -"class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" -"`~urllib.request.urlopen` 函式和方法。" +":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` " +"和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" +"的 :func:`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:145 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." -"etree.ElementTree.Element` is deprecated. In a future release it will always " -"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " -"instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of " +"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " +"release it will always return ``True``. Prefer explicit ``len(elem)`` or " +"``elem is not None`` tests instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." -"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " -"``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用" +"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" +"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:154 +#: ../../deprecations/pending-removal-in-future.rst:150 msgid "" -":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" -"`~zipimport.zipimporter.exec_module` instead." +":meth:`zipimport.zipimporter.load_module` is deprecated: " +"use :meth:`~zipimport.zipimporter.exec_module` instead." msgstr "" -":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." -"zipimporter.exec_module`。" +":meth:`zipimport.zipimporter.load_module` 已被棄用:請改" +"用 :meth:`~zipimport.zipimporter.exec_module`。" #: ../../deprecations/index.rst:13 msgid "C API Deprecations" @@ -965,16 +980,16 @@ msgid "" "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " "(:pep:`699`; :gh:`101193`)." msgstr "" -":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 (:pep:" -"`699`;:gh:`101193`)。" +":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 " +"(:pep:`699`;:gh:`101193`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 msgid "" "Creating :c:data:`immutable types ` with mutable " "bases (:gh:`95388`)." msgstr "" -"使用可變基底建立\\ :c:data:`不可變型別 ` (:gh:" -"`95388`)。" +"使用可變基底建立\\ :c:data:`不可變型別 ` " +"(:gh:`95388`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 msgid "" @@ -1004,8 +1019,8 @@ msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" -"`PyConfig` instead." +"The :c:func:`Py_InitializeFromConfig` API should be used " +"with :c:type:`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" @@ -1062,24 +1077,24 @@ msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." -"use_environment`。" +":c:var:`Py_IgnoreEnvironmentFlag`:請改" +"用 :c:member:`PyConfig.use_environment`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." -"write_bytecode`。" +":c:var:`Py_DontWriteBytecodeFlag`:請改" +"用 :c:member:`PyConfig.write_bytecode`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." -"user_site_directory` instead." +":c:var:`Py_NoUserSiteDirectory`: " +"Use :c:member:`PyConfig.user_site_directory` instead." msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." -"user_site_directory`。" +":c:var:`Py_NoUserSiteDirectory`:請改" +"用 :c:member:`PyConfig.user_site_directory`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" @@ -1102,51 +1117,51 @@ msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." -"legacy_windows_fs_encoding` instead." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: " +"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` instead." msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." -"legacy_windows_fs_encoding`。" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" +"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." -"legacy_windows_stdio` instead." +":c:var:`Py_LegacyWindowsStdioFlag`: " +"Use :c:member:`PyConfig.legacy_windows_stdio` instead." msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." -"legacy_windows_stdio`。" +":c:var:`Py_LegacyWindowsStdioFlag`:請改" +"用 :c:member:`PyConfig.legacy_windows_stdio`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." -"filesystem_encoding` instead." +":c:var:`!Py_FileSystemDefaultEncoding`: " +"Use :c:member:`PyConfig.filesystem_encoding` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." -"filesystem_encoding`。" +":c:var:`!Py_FileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." -"filesystem_encoding` instead." +":c:var:`!Py_HasFileSystemDefaultEncoding`: " +"Use :c:member:`PyConfig.filesystem_encoding` instead." msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." -"filesystem_encoding`。" +":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." -"filesystem_errors` instead." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: " +"Use :c:member:`PyConfig.filesystem_errors` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." -"filesystem_errors`。" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" +"用 :c:member:`PyConfig.filesystem_errors`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" -"c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. " +"(see :c:func:`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" -"func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" +"見 :c:func:`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 msgid "The bundled copy of ``libmpdecimal``." @@ -1154,27 +1169,27 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" -"`PyImport_ImportModule` instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: " +"Use :c:func:`PyImport_ImportModule` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" -"`PyImport_ImportModule`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改" +"用 :c:func:`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" -"func:`PyWeakref_GetRef` instead." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " +"Use :c:func:`PyWeakref_GetRef` instead." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" -"func:`PyWeakref_GetRef`。" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" +"用 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" -"type:`wchar_t` instead." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " +"Use :c:type:`wchar_t` instead." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" -"`wchar_t`。" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" +"用 :c:type:`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" @@ -1185,16 +1200,16 @@ msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" -"data:`!warnings.filters`。" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " +"和 :data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 msgid "" -":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." -"exec_prefix` instead." +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " +"and :data:`sys.exec_prefix` instead." msgstr "" -":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" -"`sys.exec_prefix`。" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " +"與 :data:`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." @@ -1205,8 +1220,8 @@ msgid "" ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " "instead." msgstr "" -":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." -"prefix`。" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " +"與 :data:`sys.prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." @@ -1218,11 +1233,11 @@ msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" -"`PYTHONHOME` environment variable instead." +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or " +"the :envvar:`PYTHONHOME` environment variable instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" -"`PYTHONHOME` 環境變數。" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " +"或 :envvar:`PYTHONHOME` 環境變數。" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" @@ -1243,8 +1258,8 @@ msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" -":c:func:`PyErr_NormalizeException`:請改用 :c:func:" -"`PyErr_GetRaisedException`。" +":c:func:`PyErr_NormalizeException`:請改" +"用 :c:func:`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" @@ -1264,11 +1279,11 @@ msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" -"`PySlice_AdjustIndices` instead." +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " +"and :c:func:`PySlice_AdjustIndices` instead." msgstr "" -":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" -"`PySlice_AdjustIndices`。" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " +"和 :c:func:`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" @@ -1314,8 +1329,8 @@ msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" -":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" -"`PyObject_Hash`。" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" +"叫 :c:func:`PyObject_Hash`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index 8c048042e0..726d403414 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-05 00:13+0000\n" +"POT-Creation-Date: 2025-02-28 00:14+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-" @@ -25,10 +25,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" -"`__spec__.cached ` is deprecated. In " -"Python 3.15, :attr:`!__cached__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to " +"set :attr:`__spec__.cached ` is " +"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " +"into consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "` 的做法已被棄用。在 Python 3.15 中," @@ -36,10 +36,11 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to set :attr:" -"`__spec__.parent ` is deprecated. In " -"Python 3.15, :attr:`!__package__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to " +"set :attr:`__spec__.parent ` is " +"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " +"take into consideration by the import system or standard library. " +"(:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "` 的做法已被棄用。在 Python 3.15 中," @@ -79,39 +80,49 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 +msgid ":mod:`importlib`:" +msgstr ":mod:`importlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "``load_module()`` method:請改用 ``exec_module()``。" + +#: ../../deprecations/pending-removal-in-3.15.rst:36 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:34 +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" -"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." -"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " -"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 " +"(:gh:`90817`), but has been postponed to Python 3.15. " +"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " +"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " +"in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" -"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." -"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" +"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " +"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" +"獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" -"func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " +"Use :func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." -"isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" +"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:48 +#: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -120,11 +131,23 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:54 +#: ../../deprecations/pending-removal-in-3.15.rst:58 +msgid ":mod:`sysconfig`:" +msgstr ":mod:`sysconfig`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" +":func:`sysconfig.is_python_build` 的 *check_home* 引數自 Python 3.12 起已被棄" +"用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:63 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:56 +#: ../../deprecations/pending-removal-in-3.15.rst:65 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -135,11 +158,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`types`:" msgstr ":mod:`types`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -147,26 +170,26 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" +"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " +"於 :gh:`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:71 +#: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:73 +#: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" -"The undocumented keyword argument syntax for creating :class:`~typing." -"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " -"has been deprecated since Python 3.13. Use the class-based syntax or the " -"functional syntax instead." +"The undocumented keyword argument syntax for " +"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " +"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " +"3.13. Use the class-based syntax or the functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:79 +#: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -176,16 +199,17 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:84 +#: ../../deprecations/pending-removal-in-3.15.rst:93 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:86 +#: ../../deprecations/pending-removal-in-3.15.rst:95 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." -"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" -"`~wave.Wave_write` classes have been deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " +"and :meth:`~wave.Wave_read.getmarkers` methods of " +"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " +"deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" -"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." -"getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" +"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " +"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" diff --git a/deprecations/pending-removal-in-future.po b/deprecations/pending-removal-in-future.po index 9649475ba7..d471d93af3 100644 --- a/deprecations/pending-removal-in-future.po +++ b/deprecations/pending-removal-in-future.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-28 00:14+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-" @@ -59,17 +59,17 @@ msgid "" "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of keywords :keyword:" -"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" -"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " -"syntax error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of " +"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " +"and :keyword:`or`. In a future release it will be changed to a syntax " +"error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " "1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" -"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" -"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" -"本中,它將被更改為語法錯誤。(:gh:`87999`)" +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" +"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " +"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" +"法錯誤。(:gh:`87999`)" #: ../../deprecations/pending-removal-in-future.rst:26 msgid "" @@ -82,18 +82,18 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:29 msgid "" -"Support for ``__float__()`` method returning a strict subclass of :class:" -"`float`: these methods will be required to return an instance of :class:" -"`float`." +"Support for ``__float__()`` method returning a strict subclass " +"of :class:`float`: these methods will be required to return an instance " +"of :class:`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" #: ../../deprecations/pending-removal-in-future.rst:32 msgid "" -"Support for ``__complex__()`` method returning a strict subclass of :class:" -"`complex`: these methods will be required to return an instance of :class:" -"`complex`." +"Support for ``__complex__()`` method returning a strict subclass " +"of :class:`complex`: these methods will be required to return an instance " +"of :class:`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" @@ -104,10 +104,10 @@ msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" #: ../../deprecations/pending-removal-in-future.rst:36 msgid "" -"Passing a complex number as the *real* or *imag* argument in the :func:" -"`complex` constructor is now deprecated; it should only be passed as a " -"single positional argument. (Contributed by Serhiy Storchaka in :gh:" -"`109218`.)" +"Passing a complex number as the *real* or *imag* argument in " +"the :func:`complex` constructor is now deprecated; it should only be passed " +"as a single positional argument. (Contributed by Serhiy Storchaka " +"in :gh:`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" @@ -115,8 +115,9 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:41 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." -"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` " +"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " +"in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " @@ -135,19 +136,19 @@ msgstr ":mod:`datetime`:" #: ../../deprecations/pending-removal-in-future.rst:51 msgid "" -":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." -"UTC)``." +":meth:`~datetime.datetime.utcnow`: use " +"``datetime.datetime.now(tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." -"now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 " +"``datetime.datetime.now(tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:53 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." -"fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use " +"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." -"fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " +"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:56 msgid ":mod:`gettext`: Plural value must be an integer." @@ -158,10 +159,6 @@ msgid ":mod:`importlib`:" msgstr ":mod:`importlib`:" #: ../../deprecations/pending-removal-in-future.rst:60 -msgid "``load_module()`` method: use ``exec_module()`` instead." -msgstr "``load_module()`` method:請改用 ``exec_module()``。" - -#: ../../deprecations/pending-removal-in-future.rst:61 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -169,39 +166,39 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:65 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:67 +#: ../../deprecations/pending-removal-in-future.rst:66 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:68 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" -"`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" +"用 :meth:`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:71 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:75 +#: ../../deprecations/pending-removal-in-future.rst:74 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:76 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -209,7 +206,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:80 +#: ../../deprecations/pending-removal-in-future.rst:79 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -221,12 +218,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:87 +#: ../../deprecations/pending-removal-in-future.rst:86 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:88 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -234,115 +231,108 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:91 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:94 +#: ../../deprecations/pending-removal-in-future.rst:93 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:94 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" -"`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " +"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" -"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " +"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:97 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 -msgid "" -":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " -"ignored." -msgstr "" -":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" - -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "" -":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." -"notify_all`." +":meth:`!threading.Condition.notifyAll`: " +"use :meth:`~threading.Condition.notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." -"notify_all`。" +":meth:`!threading.Condition.notifyAll`:請" +"用 :meth:`~threading.Condition.notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:111 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" -"attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " +"use :attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" -"attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " +"use :attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" -"attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" +"用 :attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:116 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:121 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:119 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:121 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -350,88 +340,88 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:127 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:129 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:135 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "" -":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" -"`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " -"Use newer :func:`~urllib.request.urlopen` functions and methods." +":mod:`urllib.request`: :class:`~urllib.request.URLopener` " +"and :class:`~urllib.request.FancyURLopener` style of invoking requests is " +"deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods." msgstr "" -":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` 和 :" -"class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" -"`~urllib.request.urlopen` 函式和方法。" +":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` " +"和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" +"的 :func:`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:145 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." -"etree.ElementTree.Element` is deprecated. In a future release it will always " -"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " -"instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of " +"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " +"release it will always return ``True``. Prefer explicit ``len(elem)`` or " +"``elem is not None`` tests instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." -"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " -"``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用" +"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" +"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:154 +#: ../../deprecations/pending-removal-in-future.rst:150 msgid "" -":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" -"`~zipimport.zipimporter.exec_module` instead." +":meth:`zipimport.zipimporter.load_module` is deprecated: " +"use :meth:`~zipimport.zipimporter.exec_module` instead." msgstr "" -":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." -"zipimporter.exec_module`。" +":meth:`zipimport.zipimporter.load_module` 已被棄用:請改" +"用 :meth:`~zipimport.zipimporter.exec_module`。" diff --git a/extending/embedding.po b/extending/embedding.po index ac486c5aef..4f1244dc1c 100644 --- a/extending/embedding.po +++ b/extending/embedding.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-07 15:49+0000\n" "PO-Revision-Date: 2018-05-23 14:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -356,7 +356,7 @@ msgstr "" msgid "" "After initializing the interpreter, the script is loaded using :c:func:" "`PyImport_Import`. This routine needs a Python string as its argument, " -"which is constructed using the :c:func:`PyUnicode_FromString` data " +"which is constructed using the :c:func:`PyUnicode_DecodeFSDefault` data " "conversion routine. ::" msgstr "" diff --git a/faq/design.po b/faq/design.po index 8474f7dc97..91ee765253 100644 --- a/faq/design.po +++ b/faq/design.po @@ -138,17 +138,18 @@ msgstr "" #: ../../faq/design.rst:65 msgid "" -"The :class:`float` type in CPython uses a C ``double`` for storage. A :" -"class:`float` object's value is stored in binary floating-point with a fixed " -"precision (typically 53 bits) and Python uses C operations, which in turn " -"rely on the hardware implementation in the processor, to perform floating-" -"point operations. This means that as far as floating-point operations are " -"concerned, Python behaves like many popular languages including C and Java." -msgstr "" -"CPython 的 :class:`float` 型別使用了 C 的 ``double`` 型別來儲存。一個 :class:" -"`float` 物件的值會以固定的精度(通常為 53 位元)存為二進制浮點數,Python 使" -"用 C 來運算浮點數,而他的結果會依處理器中的硬體實作方式來決定。這表示就浮點數" -"運算來說,Python 和 C、Java 等很多受歡迎的語言有一樣的行為。" +"The :class:`float` type in CPython uses a C ``double`` for storage. " +"A :class:`float` object's value is stored in binary floating-point with a " +"fixed precision (typically 53 bits) and Python uses C operations, which in " +"turn rely on the hardware implementation in the processor, to perform " +"floating-point operations. This means that as far as floating-point " +"operations are concerned, Python behaves like many popular languages " +"including C and Java." +msgstr "" +"CPython 的 :class:`float` 型別使用了 C 的 ``double`` 型別來儲存。一" +"個 :class:`float` 物件的值會以固定的精度(通常為 53 位元)存為二進制浮點數," +"Python 使用 C 來運算浮點數,而他的結果會依處理器中的硬體實作方式來決定。這表" +"示就浮點數運算來說,Python 和 C、Java 等很多受歡迎的語言有一樣的行為。" #: ../../faq/design.rst:72 msgid "" @@ -249,11 +250,11 @@ msgid "" "``m_`` prefix, so this explicitness is still useful in those languages, too." msgstr "" "第一,這樣可以更明顯表現出你在用方法 (method) 或是實例 (instance) 的屬性,而" -"非一個區域變數。即使不知道類別 (class) 的定義,當看到 ``self.x`` 或 ``self." -"meth()``,就會很清楚地知道是正在使用實例的變數或是方法。在 C++ 裡,你可以藉由" -"沒有區域變數宣告來判斷這件事 ── 但在 Python 裡沒有區域變數宣告,所以你必須去" -"看類別的定義來確定。有些 C++ 和 Java 的程式碼規格要求要在實例屬性的名稱加上前" -"綴 ``m_``,所以這種明確性在那些語言也是很好用的。" +"非一個區域變數。即使不知道類別 (class) 的定義,當看到 ``self.x`` 或 " +"``self.meth()``,就會很清楚地知道是正在使用實例的變數或是方法。在 C++ 裡,你" +"可以藉由沒有區域變數宣告來判斷這件事 ── 但在 Python 裡沒有區域變數宣告,所以" +"你必須去看類別的定義來確定。有些 C++ 和 Java 的程式碼規格要求要在實例屬性的名" +"稱加上前綴 ``m_``,所以這種明確性在那些語言也是很好用的。" #: ../../faq/design.rst:127 msgid "" @@ -353,12 +354,12 @@ msgstr "" msgid "" "(b) When I read code that says len(x) I *know* that it is asking for the " "length of something. This tells me two things: the result is an integer, and " -"the argument is some kind of container. To the contrary, when I read x." -"len(), I have to already know that x is some kind of container implementing " -"an interface or inheriting from a class that has a standard len(). Witness " -"the confusion we occasionally have when a class that is not implementing a " -"mapping has a get() or keys() method, or something that isn't a file has a " -"write() method." +"the argument is some kind of container. To the contrary, when I read " +"x.len(), I have to already know that x is some kind of container " +"implementing an interface or inheriting from a class that has a standard " +"len(). Witness the confusion we occasionally have when a class that is not " +"implementing a mapping has a get() or keys() method, or something that isn't " +"a file has a write() method." msgstr "" "(二) 當我看到一段程式碼寫著 len(x),我\\ *知道*\\ 他要找某個東西的長度。這" "告訴了我兩件事:結果是一個整數、參數是某種容器。相對地,當我看到 x.len(),我" @@ -419,8 +420,9 @@ msgstr "" msgid "" "The second objection is typically cast as: \"I am really telling a sequence " "to join its members together with a string constant\". Sadly, you aren't. " -"For some reason there seems to be much less difficulty with having :meth:" -"`~str.split` as a string method, since in that case it is easy to see that ::" +"For some reason there seems to be much less difficulty with " +"having :meth:`~str.split` as a string method, since in that case it is easy " +"to see that ::" msgstr "" "第二個反對意見通常是:「我是在叫一個序列把它的成員用一個字串常數連接起來」。" "但很遺憾地,你並不是在這樣做。因為某種原因,把 :meth:`~str.split` 當成字串方" @@ -544,8 +546,8 @@ msgstr "" #: ../../faq/design.rst:279 msgid "" -"For calling methods on objects, you can simplify yet further by using the :" -"func:`getattr` built-in to retrieve methods with a particular name::" +"For calling methods on objects, you can simplify yet further by using " +"the :func:`getattr` built-in to retrieve methods with a particular name::" msgstr "" "對於呼叫物件裡的方法,你可以利用內建用來找尋特定方法的函式 :func:`getattr` 來" "做進一步的簡化: ::" @@ -818,10 +820,10 @@ msgstr "" msgid "" "Lists, on the other hand, are more like arrays in other languages. They " "tend to hold a varying number of objects all of which have the same type and " -"which are operated on one-by-one. For example, :func:`os.listdir('.') ` returns a list of strings representing the files in the current " -"directory. Functions which operate on this output would generally not break " -"if you added another file or two to the directory." +"which are operated on one-by-one. For example, :func:`os.listdir('.') " +"` returns a list of strings representing the files in the " +"current directory. Functions which operate on this output would generally " +"not break if you added another file or two to the directory." msgstr "" "另一方面,串列更像是其他語言的陣列 (array)。他可以有不固定個同類別物件,且為" "逐項操作。舉例來說,:func:`os.listdir('.') ` 回傳當下目錄裡的檔" @@ -960,8 +962,8 @@ msgstr "" msgid "" "would raise a :exc:`KeyError` exception because the id of the ``[1, 2]`` " "used in the second line differs from that in the first line. In other " -"words, dictionary keys should be compared using ``==``, not using :keyword:" -"`is`." +"words, dictionary keys should be compared using ``==``, not " +"using :keyword:`is`." msgstr "" "這將會導致 :exc:`KeyError` 例外,因為 ``[1, 2]`` 的 id 在第一行和第二行是不同" "的。換句話說,字典的鍵應該要用 ``==`` 來做比較,而不是用 :keyword:`is`。" @@ -1011,9 +1013,7 @@ msgstr "" "如果你需要的話,這裡有個小技巧可以幫你,但請自己承擔風險:你可以把一個可變物" "件包裝進一個有 :meth:`~object.__eq__` 和 :meth:`~object.__hash__` 方法的類別" "實例。只要這種包裝物件還存在於字典(或其他類似結構)中,你就必須確定在字典" -"(或其他用雜湊為基底的結構)中他們的雜湊值會保持恆定。\n" -"\n" -"::" +"(或其他用雜湊為基底的結構)中他們的雜湊值會保持恆定。 ::" #: ../../faq/design.rst:513 msgid "" @@ -1062,16 +1062,16 @@ msgstr "" #: ../../faq/design.rst:534 msgid "" -"Furthermore it must always be the case that if ``o1 == o2`` (ie ``o1." -"__eq__(o2) is True``) then ``hash(o1) == hash(o2)`` (ie, ``o1.__hash__() == " -"o2.__hash__()``), regardless of whether the object is in a dictionary or " -"not. If you fail to meet these restrictions dictionaries and other hash " -"based structures will misbehave." +"Furthermore it must always be the case that if ``o1 == o2`` (ie " +"``o1.__eq__(o2) is True``) then ``hash(o1) == hash(o2)`` (ie, " +"``o1.__hash__() == o2.__hash__()``), regardless of whether the object is in " +"a dictionary or not. If you fail to meet these restrictions dictionaries " +"and other hash based structures will misbehave." msgstr "" "此外,不管物件是否在字典中,如果 ``o1 == o2``\\ (即 ``o1.__eq__(o2) is " -"True``),則 ``hash(o1) == hash(o2)``\\ (即 ``o1.__hash__() == o2." -"__hash__()``),這個事實必須要成立。如果無法滿足這項限制,那字典和其他用雜湊" -"為基底的結構會出現不正常的行為。" +"True``),則 ``hash(o1) == hash(o2)``\\ (即 ``o1.__hash__() == " +"o2.__hash__()``),這個事實必須要成立。如果無法滿足這項限制,那字典和其他用雜" +"湊為基底的結構會出現不正常的行為。" #: ../../faq/design.rst:539 msgid "" @@ -1136,16 +1136,17 @@ msgstr "" msgid "" "Python 2.6 adds an :mod:`abc` module that lets you define Abstract Base " "Classes (ABCs). You can then use :func:`isinstance` and :func:`issubclass` " -"to check whether an instance or a class implements a particular ABC. The :" -"mod:`collections.abc` module defines a set of useful ABCs such as :class:" -"`~collections.abc.Iterable`, :class:`~collections.abc.Container`, and :class:" -"`~collections.abc.MutableMapping`." +"to check whether an instance or a class implements a particular ABC. " +"The :mod:`collections.abc` module defines a set of useful ABCs such " +"as :class:`~collections.abc.Iterable`, :class:`~collections.abc.Container`, " +"and :class:`~collections.abc.MutableMapping`." msgstr "" "Python 2.6 加入了 :mod:`abc` 模組,讓你可以定義抽象基底類別 (Abstract Base " "Class, ABC)。你可以使用 :func:`isinstance` 和 :func:`issubclass` 來確認一個實" "例或是類別是否實作了某個抽象基底類別。而 :mod:`collections.abc` 模組定義了一" -"系列好用的抽象基底類別,像是 :class:`~collections.abc.Iterable`、:class:" -"`~collections.abc.Container` 和 :class:`~collections.abc.MutableMapping`。" +"系列好用的抽象基底類別,像" +"是 :class:`~collections.abc.Iterable`、:class:`~collections.abc.Container` " +"和 :class:`~collections.abc.MutableMapping`。" #: ../../faq/design.rst:578 msgid "" @@ -1159,12 +1160,12 @@ msgid "" "as a module interface specification and a set of examples. Many Python " "modules can be run as a script to provide a simple \"self test.\" Even " "modules which use complex external interfaces can often be tested in " -"isolation using trivial \"stub\" emulations of the external interface. The :" -"mod:`doctest` and :mod:`unittest` modules or third-party test frameworks can " -"be used to construct exhaustive test suites that exercise every line of code " -"in a module." +"isolation using trivial \"stub\" emulations of the external interface. " +"The :mod:`doctest` and :mod:`unittest` modules or third-party test " +"frameworks can be used to construct exhaustive test suites that exercise " +"every line of code in a module." msgstr "" -"一個針對模組的好測試套件提供了回歸測試 (regression testing),並作為模組介面規" +"一個針對模組的好測試套件提供了迴歸測試 (regression testing),並作為模組介面規" "範和一組範例。許多 Python 模組可以直接當成腳本執行,並提供簡單的「自我測" "試」。即便模組使用了複雜的外部介面,他依然可以用外部介面的簡單的「樁」(stub) " "模擬來獨立測試。:mod:`doctest` 和 :mod:`unittest` 模組或第三方的測試框架可以" @@ -1209,16 +1210,16 @@ msgid "" "\"spaghetti\" code that was hard to understand and revise. In a high-level " "language, it is also unneeded as long as there are ways to branch (in " "Python, with :keyword:`if` statements and :keyword:`or`, :keyword:`and`, " -"and :keyword:`if`/:keyword:`else` expressions) and loop (with :keyword:" -"`while` and :keyword:`for` statements, possibly containing :keyword:" -"`continue` and :keyword:`break`)." +"and :keyword:`if`/:keyword:`else` expressions) and loop " +"(with :keyword:`while` and :keyword:`for` statements, possibly " +"containing :keyword:`continue` and :keyword:`break`)." msgstr "" "在 1970 年代,人們了解到沒有限制的 goto 會導致混亂、難以理解和修改的「義大利" "麵」程式碼 (\"spaghetti\" code)。在高階語言裡,這也是不需要的,因為有方法可以" -"做邏輯分支(以 Python 來說,用 :keyword:`if` 陳述式和 :keyword:`or`、:" -"keyword:`and` 及 :keyword:`if`/:keyword:`else` 運算式)和迴圈(用 :keyword:" -"`while` 和 :keyword:`for` 陳述式,可能會有 :keyword:`continue` 和 :keyword:" -"`break`)。" +"做邏輯分支(以 Python 來說,用 :keyword:`if` 陳述式" +"和 :keyword:`or`、:keyword:`and` 及 :keyword:`if`/:keyword:`else` 運算式)和" +"迴圈(用 :keyword:`while` 和 :keyword:`for` 陳述式,可能會" +"有 :keyword:`continue` 和 :keyword:`break`)。" #: ../../faq/design.rst:614 msgid "" @@ -1437,14 +1438,14 @@ msgstr "為何產生器 (generator) 不支援 with 陳述式?" msgid "" "For technical reasons, a generator used directly as a context manager would " "not work correctly. When, as is most common, a generator is used as an " -"iterator run to completion, no closing is needed. When it is, wrap it as :" -"func:`contextlib.closing(generator) ` in the :keyword:" -"`with` statement." +"iterator run to completion, no closing is needed. When it is, wrap it " +"as :func:`contextlib.closing(generator) ` in " +"the :keyword:`with` statement." msgstr "" "出於技術原因,把產生器直接用作情境 (context) 管理器會無法正常運作。因為通常來" "說,產生器是被當成疊代器 (iterator),到最後完成時不需要被手動關閉。但如果你需" -"要的話,你可以在 :keyword:`with` 陳述式裡用 :func:`contextlib." -"closing(generator) ` 來包裝他。" +"要的話,你可以在 :keyword:`with` 陳述式裡" +"用 :func:`contextlib.closing(generator) ` 來包裝他。" #: ../../faq/design.rst:730 msgid "Why are colons required for the if/while/def/class statements?" diff --git a/faq/general.po b/faq/general.po index ac24b2276b..ac684d513b 100644 --- a/faq/general.po +++ b/faq/general.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2023-06-23 16:56+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -84,14 +84,14 @@ msgid "" msgstr "" "Python 軟體基金會 (Python Software Foundation) 是一個獨立的非營利性組織,它擁" "有 Python 2.1 版與之後各版本的版權。PSF 的使命在於推展 Python 程式設計語言相" -"關的開放原始碼技術,以及宣傳 Python 的使用。PSF 首頁的網址是 https://www." -"python.org/psf/。" +"關的開放原始碼技術,以及宣傳 Python 的使用。PSF 首頁的網址是 https://" +"www.python.org/psf/。" #: ../../faq/general.rst:42 msgid "" "Donations to the PSF are tax-exempt in the US. If you use Python and find " -"it helpful, please contribute via `the PSF donation page `_." +"it helpful, please contribute via `the PSF donation page `_." msgstr "" "在美國捐款給 PSF 是免稅的。如果你使用了 Python 且發現它很有用,請至 `PSF 捐款" "頁面 `_\\ 為它做出貢獻。" @@ -333,6 +333,11 @@ msgid "" "See also the documentation for :data:`sys.version`, :data:`sys.hexversion`, " "and :data:`sys.version_info`." msgstr "" +"請參閱\\ `開發人員指南 `__\\ 以獲得更多關於開發週期的資訊,並參閱 :pep:`387` 以瞭" +"解更多關於 Python 的向後相容性政策。另外,也請查" +"看 :data:`sys.version`、:data:`sys.hexversion` 和 :data:`sys.version_info` 的" +"說明文件。" #: ../../faq/general.rst:169 msgid "How do I obtain a copy of the Python source?" @@ -344,9 +349,9 @@ msgid "" "at https://www.python.org/downloads/. The latest development sources can be " "obtained at https://github.com/python/cpython/." msgstr "" -"最新的 Python 原始碼發行版永遠可以從 python.org 取得,在 https://www.python." -"org/downloads/。最新的開發中原始碼可以在 https://github.com/python/cpython/ " -"取得。" +"最新的 Python 原始碼發行版永遠可以從 python.org 取得,在 https://" +"www.python.org/downloads/。最新的開發中原始碼可以在 https://github.com/" +"python/cpython/ 取得。" #: ../../faq/general.rst:175 msgid "" @@ -421,9 +426,10 @@ msgid "" "There is a newsgroup, :newsgroup:`comp.lang.python`, and a mailing list, " "`python-list `_. The " "newsgroup and mailing list are gatewayed into each other -- if you can read " -"news it's unnecessary to subscribe to the mailing list. :newsgroup:`comp." -"lang.python` is high-traffic, receiving hundreds of postings every day, and " -"Usenet readers are often more able to cope with this volume." +"news it's unnecessary to subscribe to the mailing " +"list. :newsgroup:`comp.lang.python` is high-traffic, receiving hundreds of " +"postings every day, and Usenet readers are often more able to cope with this " +"volume." msgstr "" "有一個新聞群組 (newsgroup),:newsgroup:`comp.lang.python`,也有一個郵件討論" "群 (mailing list),`python-list `_." msgstr "" "新的軟體發布版本及事件的通知,可以在 comp.lang.python.announce 中找到,這是一" @@ -458,9 +464,9 @@ msgstr "如何取得 Python 的 beta 測試版本?" #: ../../faq/general.rst:229 msgid "" "Alpha and beta releases are available from https://www.python.org/" -"downloads/. All releases are announced on the comp.lang.python and comp." -"lang.python.announce newsgroups and on the Python home page at https://www." -"python.org/; an RSS feed of news is available." +"downloads/. All releases are announced on the comp.lang.python and " +"comp.lang.python.announce newsgroups and on the Python home page at https://" +"www.python.org/; an RSS feed of news is available." msgstr "" "Alpha 和 beta 發布版本可以從 https://www.python.org/downloads/ 取得。所有的發" "布版本都會在 comp.lang.python 和 comp.lang.python.announce 新聞群組上宣布,也" @@ -480,8 +486,8 @@ msgstr "如何提交 Python 的錯誤報告和修補程式?" #: ../../faq/general.rst:241 msgid "" -"To report a bug or submit a patch, use the issue tracker at https://github." -"com/python/cpython/issues." +"To report a bug or submit a patch, use the issue tracker at https://" +"github.com/python/cpython/issues." msgstr "" "要回報一個錯誤 (bug) 或提交一個修補程式 (patch),請使用於 https://github.com/" "python/cpython/issues 的問題追蹤系統。" @@ -547,8 +553,8 @@ msgstr "www.python.org 的真實位置在哪裡?" #: ../../faq/general.rst:274 msgid "" "The Python project's infrastructure is located all over the world and is " -"managed by the Python Infrastructure Team. Details `here `__." +"managed by the Python Infrastructure Team. Details `here `__." msgstr "" "Python 專案的基礎建設遍佈世界各地,由 Python 基礎建設團隊管理。詳細資訊\\ `在" "此 `__。" @@ -560,8 +566,8 @@ msgstr "為什麼要取名為 Python?" #: ../../faq/general.rst:281 msgid "" "When he began implementing Python, Guido van Rossum was also reading the " -"published scripts from `\"Monty Python's Flying Circus\" `__, a BBC comedy series from the 1970s. " +"published scripts from `\"Monty Python's Flying Circus\" `__, a BBC comedy series from the 1970s. " "Van Rossum thought he needed a name that was short, unique, and slightly " "mysterious, so he decided to call the language Python." msgstr "" @@ -611,7 +617,6 @@ msgstr "" "且會保證介面在一系列的錯誤修正發布版本中維持不變。" #: ../../faq/general.rst:311 -#, fuzzy msgid "" "The latest stable releases can always be found on the `Python download page " "`_. Python 3.x is the recommended version " @@ -619,9 +624,8 @@ msgid "" "maintained anymore <373>`." msgstr "" "最新的穩定發布版本隨時都可以在 `Python 下載頁面 `_\\ 上找到。Python 有兩個生產就緒 (production-ready) 的版本:2.x " -"和 3.x。推薦的版本是 3.x,此版本能被那些最為廣泛使用的函式庫所支援。雖然 2.x " -"仍然被廣泛使用,但\\ :pep:`它已不再被維護 <0373>`。" +"downloads/>`_\\ 上找到。Python 3.x 是推薦的版本,並且被大多數廣泛使用的函式庫" +"所支援。Python 2.x :pep:`已不再被維護 <0373>`。" #: ../../faq/general.rst:318 msgid "How many people are using Python?" @@ -657,8 +661,8 @@ msgstr "有沒有任何重要的專案使用 Python 完成開發?" #: ../../faq/general.rst:334 msgid "" "See https://www.python.org/about/success for a list of projects that use " -"Python. Consulting the proceedings for `past Python conferences `_ will reveal contributions from many " +"Python. Consulting the proceedings for `past Python conferences `_ will reveal contributions from many " "different companies and organizations." msgstr "" "要查看使用 Python 的專案清單,請參閱 https://www.python.org/about/success。藉" @@ -668,17 +672,17 @@ msgstr "" #: ../../faq/general.rst:339 msgid "" "High-profile Python projects include `the Mailman mailing list manager " -"`_ and `the Zope application server `_. Several Linux distributions, most notably `Red Hat `_, have written part or all of their installer and system " -"administration software in Python. Companies that use Python internally " -"include Google, Yahoo, and Lucasfilm Ltd." -msgstr "" -"備受矚目的 Python 專案包括 `Mailman 郵件討論群管理員 `_\\ 和 `Zope 應用程式伺服器 `_。有一些 Linux 發行" -"版,最著名的是 `Red Hat `_,已經用 Python 編寫了部分" -"或全部的安裝程式及系統管理軟體。內部使用 Python 的公司包括 Google、Yahoo 和 " -"Lucasfilm Ltd。" +"`_ and `the Zope application server `_. Several Linux distributions, most notably `Red Hat " +"`_, have written part or all of their installer and " +"system administration software in Python. Companies that use Python " +"internally include Google, Yahoo, and Lucasfilm Ltd." +msgstr "" +"備受矚目的 Python 專案包括 `Mailman 郵件討論群管理員 `_\\ 和 `Zope 應用程式伺服器 `_。有一些 " +"Linux 發行版,最著名的是 `Red Hat `_,已經用 Python " +"編寫了部分或全部的安裝程式及系統管理軟體。內部使用 Python 的公司包括 Google、" +"Yahoo 和 Lucasfilm Ltd。" #: ../../faq/general.rst:348 msgid "What new developments are expected for Python in the future?" @@ -699,8 +703,8 @@ msgstr "" #: ../../faq/general.rst:356 msgid "" -"New development is discussed on `the python-dev mailing list `_." +"New development is discussed on `the python-dev mailing list `_." msgstr "" "新的開發會在 `python-dev 郵件討論群 `_\\ 中討論。" @@ -810,7 +814,7 @@ msgstr "" #: ../../faq/general.rst:412 msgid "" ">>> L = []\n" -">>> dir(L) \n" +">>> dir(L)\n" "['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',\n" "'__dir__', '__doc__', '__eq__', '__format__', '__ge__',\n" "'__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__',\n" @@ -835,7 +839,7 @@ msgid "" "[1]" msgstr "" ">>> L = []\n" -">>> dir(L) \n" +">>> dir(L)\n" "['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',\n" "'__dir__', '__doc__', '__eq__', '__format__', '__ge__',\n" "'__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__',\n" @@ -889,13 +893,3 @@ msgid "" msgstr "" "如果你想討論 Python 在教育領域中的使用,你可能會有興趣加入 `edu-sig 郵件討論" "群 `_。" - -#~ msgid "See :pep:`6` for more information about bugfix releases." -#~ msgstr "更多關於錯誤修正發布的資訊請見 :pep:`6`。" - -#~ msgid "" -#~ "See also the documentation for :data:`sys.version`, :data:`sys." -#~ "hexversion`, and :data:`sys.version_info`." -#~ msgstr "" -#~ "另請參閱 :data:`sys.version`、:data:`sys.hexversion` 和 :data:`sys." -#~ "version_info` 的說明文件。" diff --git a/faq/library.po b/faq/library.po index 648029c94e..bf7d82dcfa 100644 --- a/faq/library.po +++ b/faq/library.po @@ -49,8 +49,8 @@ msgstr "" #: ../../faq/library.rst:21 #, fuzzy msgid "" -"For third-party packages, search the `Python Package Index `_ or try `Google `_ or another web search " +"For third-party packages, search the `Python Package Index `_ or try `Google `_ or another web search " "engine. Searching for \"Python\" plus a keyword or two for your topic of " "interest will usually find something helpful." msgstr "" @@ -67,13 +67,13 @@ msgstr "哪裡可以找到 math.py (socket.py, regex.py, 等...) 來源檔案? msgid "" "If you can't find a source file for a module it may be a built-in or " "dynamically loaded module implemented in C, C++ or other compiled language. " -"In this case you may not have the source file or it may be something like :" -"file:`mathmodule.c`, somewhere in a C source directory (not on the Python " -"Path)." +"In this case you may not have the source file or it may be something " +"like :file:`mathmodule.c`, somewhere in a C source directory (not on the " +"Python Path)." msgstr "" "如果找不到模組的源檔案,它可能是用 C、C++ 或其他編譯語言實作的內置或動態載入" -"的模組。在這種情況下,你可能沒有源檔案,或者它可能類似於 :file:`mathmodule." -"c`,位於 C 源目錄中(不在 Python 路徑中)。" +"的模組。在這種情況下,你可能沒有源檔案,或者它可能類似" +"於 :file:`mathmodule.c`,位於 C 源目錄中(不在 Python 路徑中)。" #: ../../faq/library.rst:35 msgid "There are (at least) three kinds of modules in Python:" @@ -99,6 +99,8 @@ msgid "" "import sys\n" "print(sys.builtin_module_names)" msgstr "" +"import sys\n" +"print(sys.builtin_module_names)" #: ../../faq/library.rst:47 msgid "How do I make a Python script executable on Unix?" @@ -150,22 +152,21 @@ msgid "" "directory on the user's :envvar:`PATH`::" msgstr "" "如果你希望腳本獨立於 Python 直譯器所在的位置,你可以使用 :program:`env` 程" -"式。幾乎所有 Unix 變體都支援以下內容,假設 Python 直譯器位於使用者的 :envvar:" -"`PATH` 上的目錄中: ::" +"式。幾乎所有 Unix 變體都支援以下內容,假設 Python 直譯器位於使用者" +"的 :envvar:`PATH` 上的目錄中: ::" #: ../../faq/library.rst:69 msgid "#!/usr/bin/env python" msgstr "#!/usr/bin/env python" #: ../../faq/library.rst:71 -#, fuzzy msgid "" "*Don't* do this for CGI scripts. The :envvar:`PATH` variable for CGI " "scripts is often very minimal, so you need to use the actual absolute " "pathname of the interpreter." msgstr "" -"*不要*對 CGI 腳本執行此操作。 CGI 腳本的 :envvar:`PATH` 變數通常非常小,因此" -"你需要使用直譯器的實際絕對路徑名。" +"*不要*\\ 對 CGI 腳本執行此操作。CGI 腳本的 :envvar:`PATH` 變數通常非常小,因" +"此你需要使用直譯器的實際絕對路徑名稱。" #: ../../faq/library.rst:75 #, fuzzy @@ -200,7 +201,7 @@ msgstr "" #: ../../faq/library.rst:89 msgid "__doc__ = \"\"\"...Whatever...\"\"\"" -msgstr "" +msgstr "__doc__ = \"\"\"...Whatever...\"\"\"" #: ../../faq/library.rst:94 msgid "Is there a curses/termcap package for Python?" @@ -246,14 +247,14 @@ msgstr "" #: ../../faq/library.rst:118 msgid "Why don't my signal handlers work?" -msgstr "為什麼我的信號處理程式不起作用?" +msgstr "為什麼我的訊號處理程式不起作用?" #: ../../faq/library.rst:120 #, fuzzy msgid "" "The most common problem is that the signal handler is declared with the " "wrong argument list. It is called as ::" -msgstr "最常見的問題是信號處理程式是用錯誤的引數列表聲明的。它被稱為: ::" +msgstr "最常見的問題是訊號處理程式是用錯誤的引數列表聲明的。它被稱為: ::" #: ../../faq/library.rst:123 msgid "handler(signum, frame)" @@ -311,19 +312,21 @@ msgid "" msgstr "" "為了使測試更容易,你應該在程式中使用良好的模組化設計。你的程式應該將幾乎所有" "功能都封裝在函式或類別方法中——這有時會產生使程式運行得更快的令人驚訝和令人愉" -"快的效果(因為局部變數存取比全局存取更快)。此外,該程式應避免依賴於可變的全" +"快的效果(因為局部變數存取比全域存取更快)。此外,該程式應避免依賴於可變的全" "局變數,因為這會使測試變得更加困難。" #: ../../faq/library.rst:152 #, fuzzy msgid "The \"global main logic\" of your program may be as simple as ::" -msgstr "你程式的「全局主邏輯」可能像一樣簡單: ::" +msgstr "你程式的「全域主邏輯」可能像一樣簡單: ::" #: ../../faq/library.rst:154 msgid "" "if __name__ == \"__main__\":\n" " main_logic()" msgstr "" +"if __name__ == \"__main__\":\n" +" main_logic()" #: ../../faq/library.rst:157 #, fuzzy @@ -360,6 +363,8 @@ msgid "" "if __name__ == \"__main__\":\n" " self_test()" msgstr "" +"if __name__ == \"__main__\":\n" +" self_test()" #: ../../faq/library.rst:173 #, fuzzy @@ -417,8 +422,9 @@ msgid "" "module. The :mod:`threading` module builds convenient abstractions on top of " "the low-level primitives provided by the :mod:`_thread` module." msgstr "" -"請務必使用 :mod:`threading` 模組而不是 :mod:`_thread` 模組。 :mod:" -"`threading` 模組在 :mod:`_thread` 模組提供的低階原語之上構建方便的抽象。" +"請務必使用 :mod:`threading` 模組而不是 :mod:`_thread` 模" +"組。 :mod:`threading` 模組在 :mod:`_thread` 模組提供的低階原語之上構建方便的" +"抽象。" #: ../../faq/library.rst:245 msgid "None of my threads seem to run: why?" @@ -455,6 +461,17 @@ msgid "" "\n" "time.sleep(10) # <---------------------------!" msgstr "" +"import threading, time\n" +"\n" +"def thread_task(name, n):\n" +" for i in range(n):\n" +" print(name, i)\n" +"\n" +"for i in range(10):\n" +" T = threading.Thread(target=thread_task, args=(str(i), i))\n" +" T.start()\n" +"\n" +"time.sleep(10) # <---------------------------!" #: ../../faq/library.rst:265 #, fuzzy @@ -485,17 +502,27 @@ msgid "" "\n" "time.sleep(10)" msgstr "" +"def thread_task(name, n):\n" +" time.sleep(0.001) # <--------------------!\n" +" for i in range(n):\n" +" print(name, i)\n" +"\n" +"for i in range(10):\n" +" T = threading.Thread(target=thread_task, args=(str(i), i))\n" +" T.start()\n" +"\n" +"time.sleep(10)" #: ../../faq/library.rst:282 #, fuzzy msgid "" "Instead of trying to guess a good delay value for :func:`time.sleep`, it's " -"better to use some kind of semaphore mechanism. One idea is to use the :mod:" -"`queue` module to create a queue object, let each thread append a token to " -"the queue when it finishes, and let the main thread read as many tokens from " -"the queue as there are threads." +"better to use some kind of semaphore mechanism. One idea is to use " +"the :mod:`queue` module to create a queue object, let each thread append a " +"token to the queue when it finishes, and let the main thread read as many " +"tokens from the queue as there are threads." msgstr "" -"與其嘗試為 :func:`time.sleep` 猜測一個好的延遲值,不如使用某種信號量機制。一" +"與其嘗試為 :func:`time.sleep` 猜測一個好的延遲值,不如使用某種訊號量機制。一" "種想法是使用 :mod:`queue` 模組建立一個隊列物件,讓每個執行緒在完成時向隊列新" "增一個權杖,並讓主執行緒從隊列中讀取與執行緒數一樣多的權杖。" @@ -510,8 +537,8 @@ msgid "" "The easiest way is to use the :mod:`concurrent.futures` module, especially " "the :mod:`~concurrent.futures.ThreadPoolExecutor` class." msgstr "" -"最簡單的方法是使用 :mod:`concurrent.futures` 模組,尤其是 :mod:`~concurrent." -"futures.ThreadPoolExecutor` 類別。" +"最簡單的方法是使用 :mod:`concurrent.futures` 模組,尤其" +"是 :mod:`~concurrent.futures.ThreadPoolExecutor` 類別。" #: ../../faq/library.rst:295 #, fuzzy @@ -523,10 +550,10 @@ msgid "" "``.get()`` method to return them. The class will take care of the locking " "necessary to ensure that each job is handed out exactly once." msgstr "" -"或者,如果你想對調度演算法進行精細控制,你可以手動編寫自己的邏輯。使用 :mod:" -"`queue` 模組建立一個包含作業列表的隊列。 :class:`~queue.Queue` 類別維護一個物" -"件列表,並有一個 `.put(obj)`` 方法將項目新增到隊列和一個 ``.get()`` 方法回傳" -"它們。該類別將負責必要的鎖定,以確保每個作業都恰好分發一次。" +"或者,如果你想對調度演算法進行精細控制,你可以手動編寫自己的邏輯。使" +"用 :mod:`queue` 模組建立一個包含作業列表的隊列。 :class:`~queue.Queue` 類別維" +"護一個物件列表,並有一個 `.put(obj)`` 方法將項目新增到隊列和一個 ``.get()`` " +"方法回傳它們。該類別將負責必要的鎖定,以確保每個作業都恰好分發一次。" #: ../../faq/library.rst:302 #, fuzzy @@ -610,8 +637,8 @@ msgstr "" #: ../../faq/library.rst:358 #, fuzzy msgid "" -"Consult the module's documentation for more details; the :class:`~queue." -"Queue` class provides a featureful interface." +"Consult the module's documentation for more details; " +"the :class:`~queue.Queue` class provides a featureful interface." msgstr "" "有關更多詳細資訊,請參閱模組的文檔; :class:`~queue.Queue` 類別提供了一個功能" "強大的介面。" @@ -619,7 +646,7 @@ msgstr "" #: ../../faq/library.rst:363 #, fuzzy msgid "What kinds of global value mutation are thread-safe?" -msgstr "什麼樣的全局值突變是執行緒安全的?" +msgstr "什麼樣的全域值突變是執行緒安全的?" #: ../../faq/library.rst:365 #, fuzzy @@ -631,7 +658,7 @@ msgid "" "instruction and therefore all the C implementation code reached from each " "instruction is therefore atomic from the point of view of a Python program." msgstr "" -"內部使用 :term:`全局直譯器鎖 (GIL, global interpreter lock)`\\ 來確保一次只有" +"內部使用 :term:`全域直譯器鎖 (GIL, global interpreter lock)`\\ 來確保一次只有" "一個執行緒在 Python VM 中運行。通常,Python 僅提供位元組碼指令之間的執行緒切" "換;可以通過 :func:`sys.setswitchinterval` 設定它切換的頻率。因此,從 Python " "程式的角度來看,每條位元組碼指令以及從每條指令到達的所有 C 實作程式碼都是原子" @@ -703,10 +730,10 @@ msgstr "" #: ../../faq/library.rst:399 #, fuzzy msgid "" -"Operations that replace other objects may invoke those other objects' :meth:" -"`~object.__del__` method when their reference count reaches zero, and that " -"can affect things. This is especially true for the mass updates to " -"dictionaries and lists. When in doubt, use a mutex!" +"Operations that replace other objects may invoke those other " +"objects' :meth:`~object.__del__` method when their reference count reaches " +"zero, and that can affect things. This is especially true for the mass " +"updates to dictionaries and lists. When in doubt, use a mutex!" msgstr "" "替換其他物件的操作可能會在引用計數達到零時呼叫其他物件的 :meth:`__del__` 方" "法,這可能會影響事情。對於字典和列表的大量更新尤其如此。如有疑問,請使用互斥" @@ -714,7 +741,7 @@ msgstr "" #: ../../faq/library.rst:406 msgid "Can't we get rid of the Global Interpreter Lock?" -msgstr "不能擺脫全局直譯器鎖嗎?" +msgstr "不能擺脫全域直譯器鎖嗎?" #: ../../faq/library.rst:408 #, fuzzy @@ -773,10 +800,10 @@ msgid "" "case you want more control over dispatching of tasks." msgstr "" "這並不意味著你不能在多 CPU 機器上用好 Python!你只需要創造性地將工作分配給多" -"個*行程*而​​不是多個*執行緒*。新的 :mod:`concurrent.futures` 模組中的 :class:" -"`~concurrent.futures.ProcessPoolExecutor` 類別提供了一種簡單的方法; :mod:" -"`multiprocessing` 模組提供了一個較低階別的 API,以防你希望更好地控制任務的調" -"度。" +"個*行程*而​​不是多個*執行緒*。新的 :mod:`concurrent.futures` 模組中" +"的 :class:`~concurrent.futures.ProcessPoolExecutor` 類別提供了一種簡單的方" +"法; :mod:`multiprocessing` 模組提供了一個較低階別的 API,以防你希望更好地控" +"制任務的調度。" #: ../../faq/library.rst:446 #, fuzzy @@ -784,8 +811,8 @@ msgid "" "Judicious use of C extensions will also help; if you use a C extension to " "perform a time-consuming task, the extension can release the GIL while the " "thread of execution is in the C code and allow other threads to get some " -"work done. Some standard library modules such as :mod:`zlib` and :mod:" -"`hashlib` already do this." +"work done. Some standard library modules such as :mod:`zlib` " +"and :mod:`hashlib` already do this." msgstr "" "明智地使用 C 擴充也會有所幫助;如果你使用 C 擴充來執行耗時任務,則該擴充可以" "在執行執行緒在 C 程式碼中時釋放 GIL,並允許其他執行緒完成一些工作。一些標準函" @@ -801,6 +828,11 @@ msgid "" "since these must be written with multiple interpreters in mind in order to " "be usable, so many older extension modules will not be usable." msgstr "" +"減少 GIL 影響的另一種方法是將 GIL 設置為直譯器各自狀態的鎖 (per-interpreter-" +"state lock),而不是真正的全域鎖。這在 :ref:`Python 3.12 中首次實現 " +"`,並且可於 C API 中使用。預計 Python 3.13 將會提供其 " +"Python 介面。目前主要的限制可能是第三方擴充模組,因為實作時必須考慮到多個直譯" +"器才能使用,因此許多舊的擴充模組將無法使用。" #: ../../faq/library.rst:462 msgid "Input and Output" @@ -814,12 +846,13 @@ msgstr "如何刪除檔案?(以及其他檔案問題...)" #, fuzzy msgid "" "Use ``os.remove(filename)`` or ``os.unlink(filename)``; for documentation, " -"see the :mod:`os` module. The two functions are identical; :func:`~os." -"unlink` is simply the name of the Unix system call for this function." +"see the :mod:`os` module. The two functions are " +"identical; :func:`~os.unlink` is simply the name of the Unix system call for " +"this function." msgstr "" -"使用 ``os.remove(filename)`` 或 ``os.unlink(filename)``;有關文檔,請參閱 :" -"mod:`os` 模組。這兩個功能是相同的; :func:`~os.unlink` 只是這個函式的 Unix 系" -"統呼叫的名稱。" +"使用 ``os.remove(filename)`` 或 ``os.unlink(filename)``;有關文檔,請參" +"閱 :mod:`os` 模組。這兩個功能是相同的; :func:`~os.unlink` 只是這個函式的 " +"Unix 系統呼叫的名稱。" #: ../../faq/library.rst:471 #, fuzzy @@ -830,10 +863,10 @@ msgid "" "directories as long as they're empty; if you want to delete an entire " "directory tree and its contents, use :func:`shutil.rmtree`." msgstr "" -"要刪除目錄,請使用 :func:`os.rmdir`;使用 :func:`os.mkdir` 建立一個。 ``os." -"makedirs(path)`` 將在 ``path`` 中建立任何不存在的中間目錄。 ``os." -"removedirs(path)`` 將刪除中間目錄,只要它們是空的;如果要刪除整個目錄樹及其內" -"容,請使用 :func:`shutil.rmtree`。" +"要刪除目錄,請使用 :func:`os.rmdir`;使用 :func:`os.mkdir` 建立一個。 " +"``os.makedirs(path)`` 將在 ``path`` 中建立任何不存在的中間目錄。 " +"``os.removedirs(path)`` 將刪除中間目錄,只要它們是空的;如果要刪除整個目錄樹" +"及其內容,請使用 :func:`shutil.rmtree`。" #: ../../faq/library.rst:477 msgid "To rename a file, use ``os.rename(old_path, new_path)``." @@ -844,23 +877,24 @@ msgstr "要重新命名檔案,請使用 ``os.rename(old_path, new_path)``。" msgid "" "To truncate a file, open it using ``f = open(filename, \"rb+\")``, and use " "``f.truncate(offset)``; offset defaults to the current seek position. " -"There's also ``os.ftruncate(fd, offset)`` for files opened with :func:`os." -"open`, where *fd* is the file descriptor (a small integer)." +"There's also ``os.ftruncate(fd, offset)`` for files opened " +"with :func:`os.open`, where *fd* is the file descriptor (a small integer)." msgstr "" -"要截斷一個檔案,使用``f = open(filename, \"rb+\")``打開它,然後使用``f." -"truncate(offset)``;偏移量預設為當前搜索位置。對於使用 :func:`os.open` 打開的" -"檔案,還有 ``os.ftruncate(fd, offset)``,其中 *fd* 是檔案描述器(一個小整" +"要截斷一個檔案,使用``f = open(filename, \"rb+\")``打開它,然後使用" +"``f.truncate(offset)``;偏移量預設為當前搜索位置。對於使用 :func:`os.open` 打" +"開的檔案,還有 ``os.ftruncate(fd, offset)``,其中 *fd* 是檔案描述器(一個小整" "數)。" #: ../../faq/library.rst:484 #, fuzzy msgid "" "The :mod:`shutil` module also contains a number of functions to work on " -"files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, and :" -"func:`~shutil.rmtree`." +"files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, " +"and :func:`~shutil.rmtree`." msgstr "" -":mod:`shutil` 模組還包含許多用於處理檔案的函式,包括:func:`~shutil." -"copyfile`、:func:`~shutil.copytree` 和:func:`~shutil.rmtree`。" +":mod:`shutil` 模組還包含許多用於處理檔案的函式,包" +"括:func:`~shutil.copyfile`、:func:`~shutil.copytree` " +"和:func:`~shutil.rmtree`。" #: ../../faq/library.rst:490 msgid "How do I copy a file?" @@ -879,10 +913,10 @@ msgid "" msgstr "" ":mod:`shutil` 模組包含一個 :func:`~shutil.copyfile` 函式。請注意,在 Windows " "NTFS 卷上,它不會複製 `alternate data streams `_ 也不會複製 `resource forks `__ 在 macOS HFS+ 卷上,儘管現在兩者都很少" -"使用。它也不會複製檔案權限和元資料,儘管使用 :func:`shutil.copy2` 會保留其中" -"的大部分(儘管不是全部)。" +"NTFS#Alternate_data_stream_(ADS)>`_ 也不會複製 `resource forks `__ 在 macOS HFS+ 卷上,儘管現在兩者都很" +"少使用。它也不會複製檔案權限和元資料,儘管使用 :func:`shutil.copy2` 會保留其" +"中的大部分(儘管不是全部)。" #: ../../faq/library.rst:503 msgid "How do I read (or write) binary data?" @@ -891,9 +925,9 @@ msgstr "如何讀取(或寫入)二進位制資料?" #: ../../faq/library.rst:505 #, fuzzy msgid "" -"To read or write complex binary data formats, it's best to use the :mod:" -"`struct` module. It allows you to take a string containing binary data " -"(usually numbers) and convert it to Python objects; and vice versa." +"To read or write complex binary data formats, it's best to use " +"the :mod:`struct` module. It allows you to take a string containing binary " +"data (usually numbers) and convert it to Python objects; and vice versa." msgstr "" "要讀取或寫入複雜的二進制資料格式,最好使用 :mod:`struct` 模組。它允許你獲取包" "含二進制資料(通常是數字)的字串並將其轉換為 Python 物件;反之亦然。" @@ -948,14 +982,13 @@ msgid "" "instead (the default), the file will be open in text mode and ``f.read()`` " "will return :class:`str` objects rather than :class:`bytes` objects." msgstr "" -"要讀取和寫入二進制資料,必須以二進制模式打開檔案(這裡,將 ``\"rb\"`` 傳遞" +"要讀取和寫入二進位資料,必須以二進位模式打開檔案(這裡,將 ``\"rb\"`` 傳遞" "給 :func:`open`)。如果你改用 ``\"r\"``(預設設定),檔案將以文本模式打開,並" -"且 ``f.read()`` 將回傳 str 物件而不是 bytes ` 物件。" +"且 ``f.read()`` 將回傳 :class:`str` 物件而不是 :class:`bytes` 物件。" #: ../../faq/library.rst:535 -#, fuzzy msgid "I can't seem to use os.read() on a pipe created with os.popen(); why?" -msgstr "我似乎無法在用 os.popen() 建立的管道上使用 os.read();為什麼?" +msgstr "我似乎無法在用 os.popen() 建立的 pipe 上使用 os.read();為什麼?" #: ../../faq/library.rst:537 #, fuzzy @@ -963,8 +996,8 @@ msgid "" ":func:`os.read` is a low-level function which takes a file descriptor, a " "small integer representing the opened file. :func:`os.popen` creates a high-" "level file object, the same type returned by the built-in :func:`open` " -"function. Thus, to read *n* bytes from a pipe *p* created with :func:`os." -"popen`, you need to use ``p.read(n)``." +"function. Thus, to read *n* bytes from a pipe *p* created " +"with :func:`os.popen`, you need to use ``p.read(n)``." msgstr "" ":func:`os.read` 是一個低階函式,它接受一個檔案描述器,一個代表打開檔案的小整" "數。 :func:`os.popen` 建立一個高階檔案物件,與內置的 :func:`open` 函式回傳的" @@ -1011,9 +1044,9 @@ msgid "" "descriptor. This also happens automatically in ``f``'s destructor, when " "``f`` becomes garbage." msgstr "" -"對於你通過內置的 :func:`open` 函式在 Python 中建立的大多數檔案物件,``f." -"close()`` 從 Python 的角度將 Python 檔案物件標記為已關閉,並安排關閉底層 C 檔" -"案描述器。當 ``f`` 變成垃圾時,這也會自動發生在 ``f`` 的析構函式中。" +"對於你通過內置的 :func:`open` 函式在 Python 中建立的大多數檔案物件," +"``f.close()`` 從 Python 的角度將 Python 檔案物件標記為已關閉,並安排關閉底層 " +"C 檔案描述器。當 ``f`` 變成垃圾時,這也會自動發生在 ``f`` 的析構函式中。" #: ../../faq/library.rst:646 #, fuzzy @@ -1127,6 +1160,22 @@ msgid "" "server.sendmail(fromaddr, toaddrs, msg)\n" "server.quit()" msgstr "" +"import sys, smtplib\n" +"\n" +"fromaddr = input(\"From: \")\n" +"toaddrs = input(\"To: \").split(',')\n" +"print(\"Enter message, end with ^D:\")\n" +"msg = ''\n" +"while True:\n" +" line = sys.stdin.readline()\n" +" if not line:\n" +" break\n" +" msg += line\n" +"\n" +"# The actual mail send\n" +"server = smtplib.SMTP('localhost')\n" +"server.sendmail(fromaddr, toaddrs, msg)\n" +"server.quit()" #: ../../faq/library.rst:712 #, fuzzy @@ -1178,24 +1227,24 @@ msgid "" "return different values, so you're going to have to check what's returned on " "your system." msgstr "" -"為防止 TCP 連接阻塞,可以將 socket 設定為非阻塞模式。然後當你執行 :meth:" -"`socket.connect` 時,你要麼立即連接(不太可能),要麼得到一個例外,其中包含錯" -"誤號 ``.errno``。 ``errno.EINPROGRESS`` 表示連接正在進行中,但尚未完成。不同" -"的作業系統將回傳不同的值,因此你將不得不檢查系統回傳的內容。" +"為防止 TCP 連接阻塞,可以將 socket 設定為非阻塞模式。然後當你執" +"行 :meth:`socket.connect` 時,你要麼立即連接(不太可能),要麼得到一個例外," +"其中包含錯誤號 ``.errno``。 ``errno.EINPROGRESS`` 表示連接正在進行中,但尚未" +"完成。不同的作業系統將回傳不同的值,因此你將不得不檢查系統回傳的內容。" #: ../../faq/library.rst:745 #, fuzzy msgid "" "You can use the :meth:`~socket.socket.connect_ex` method to avoid creating " -"an exception. It will just return the errno value. To poll, you can call :" -"meth:`~socket.socket.connect_ex` again later -- ``0`` or ``errno.EISCONN`` " -"indicate that you're connected -- or you can pass this socket to :meth:" -"`select.select` to check if it's writable." +"an exception. It will just return the errno value. To poll, you can " +"call :meth:`~socket.socket.connect_ex` again later -- ``0`` or " +"``errno.EISCONN`` indicate that you're connected -- or you can pass this " +"socket to :meth:`select.select` to check if it's writable." msgstr "" "你可以使用 :meth:`socket.connect_ex` 方法來避免建立例外。它只會回傳 errno " -"值。要輪詢,你可以稍後再次呼叫 :meth:`socket.connect_ex` - ``0`` 或 ``errno." -"EISCONN`` 表示你已連接 - 或者你可以將此 socket 傳遞給 :meth:`select.select` " -"檢查它是否可寫。" +"值。要輪詢,你可以稍後再次呼叫 :meth:`socket.connect_ex` - ``0`` 或 " +"``errno.EISCONN`` 表示你已連接 - 或者你可以將此 socket 傳遞" +"給 :meth:`select.select` 檢查它是否可寫。" #: ../../faq/library.rst:753 msgid "" @@ -1224,9 +1273,9 @@ msgstr "有的。" #, fuzzy msgid "" "Interfaces to disk-based hashes such as :mod:`DBM ` and :mod:`GDBM " -"` are also included with standard Python. There is also the :mod:" -"`sqlite3` module, which provides a lightweight disk-based relational " -"database." +"` are also included with standard Python. There is also " +"the :mod:`sqlite3` module, which provides a lightweight disk-based " +"relational database." msgstr "" "基於磁盤的雜湊介面,例如 :mod:`DBM ` 和 :mod:`GDBM ` 也包" "含在標準 Python 中。還有 :mod:`sqlite3` 模組,它提供了一個輕量級的基於磁盤的" @@ -1243,16 +1292,15 @@ msgstr "" "`_。" #: ../../faq/library.rst:779 -#, fuzzy msgid "How do you implement persistent objects in Python?" -msgstr "你如何在 Python 中實作持久物件?" +msgstr "你如何在 Python 中實作持久性物件?" #: ../../faq/library.rst:781 #, fuzzy msgid "" "The :mod:`pickle` library module solves this in a very general way (though " -"you still can't store things like open files, sockets or windows), and the :" -"mod:`shelve` library module uses pickle and (g)dbm to create persistent " +"you still can't store things like open files, sockets or windows), and " +"the :mod:`shelve` library module uses pickle and (g)dbm to create persistent " "mappings containing arbitrary Python objects." msgstr "" ":mod:`pickle` 函式庫模組以一種非常通用的方式解決了這個問題(儘管你仍然不能存" @@ -1333,9 +1381,9 @@ msgstr "" #~ "interpreter state. Other object types have their own free list; these " #~ "free lists would have to be moved to the interpreter state. And so on." #~ msgstr "" -#~ "有人建議 GIL 應該是每個直譯器狀態鎖,而不是真正的全局鎖;口譯員將無法共享" +#~ "有人建議 GIL 應該是每個直譯器狀態鎖,而不是真正的全域鎖;口譯員將無法共享" #~ "物件。不幸的是,這也不太可能發生。這將是一項巨大的工作量,因為目前許多物件" -#~ "實作都具有全局狀態。例如,快取小整數和短字串;這些快取必須移至直譯器狀態。" +#~ "實作都具有全域狀態。例如,快取小整數和短字串;這些快取必須移至直譯器狀態。" #~ "其他物件型別有自己的空閒列表;這些空閒列表必須移至直譯器狀態。等等。" #, fuzzy @@ -1346,30 +1394,19 @@ msgstr "" #~ "to store all their global state in the interpreter state." #~ msgstr "" #~ "而且我懷疑它甚至可以在有限的時間內完成,因為第 3 方擴充存在同樣的問題。 " -#~ "3rd 方擴充的編寫速度可能比你轉換它們以將其所有全局狀態存儲在直譯器狀態中的" +#~ "3rd 方擴充的編寫速度可能比你轉換它們以將其所有全域狀態存儲在直譯器狀態中的" #~ "速度更快。" -#, fuzzy -#~ msgid "" -#~ "And finally, once you have multiple interpreters not sharing any state, " -#~ "what have you gained over running each interpreter in a separate process?" -#~ msgstr "" -#~ "最後,如果你有多個不共享任何狀態的直譯器,那麼在單獨的行程中運行每個直譯器" -#~ "有什麼好處呢?" - #, fuzzy #~ msgid "" #~ "Cameron Laird maintains a useful set of pages about Python web " -#~ "technologies at https://web.archive.org/web/20210224183619/http://phaseit." -#~ "net/claird/comp.lang.python/web_python." +#~ "technologies at https://web.archive.org/web/20210224183619/http://" +#~ "phaseit.net/claird/comp.lang.python/web_python." #~ msgstr "" #~ "Cameron Laird 在 https://web.archive.org/web/20210224183619/http://" #~ "phaseit.net/claird/comp.lang.python/web_python 維護著一組有用的關於 " #~ "Python 網路技術的頁面。" -#~ msgid "How can I mimic CGI form submission (METHOD=POST)?" -#~ msgstr "如何模擬 CGI 表單送出 (submission) (METHOD=POST)?" - #, fuzzy #~ msgid "" #~ "I would like to retrieve web pages that are the result of POSTing a form. " @@ -1387,8 +1424,9 @@ msgstr "" #~ "must be quoted using :func:`urllib.parse.urlencode`. For example, to " #~ "send ``name=Guy Steele, Jr.``::" #~ msgstr "" -#~ "請注意,通常對於百分比編碼的 POST 操作,查詢字串必須使用 :func:`urllib." -#~ "parse.urlencode` 引用。例如,發送 ``name=Guy Steele, Jr.``: ::" +#~ "請注意,通常對於百分比編碼的 POST 操作,查詢字串必須使" +#~ "用 :func:`urllib.parse.urlencode` 引用。例如,發送 ``name=Guy Steele, " +#~ "Jr.``: ::" #~ msgid "" #~ ">>> import urllib.parse\n" @@ -1398,6 +1436,3 @@ msgstr "" #~ ">>> import urllib.parse\n" #~ ">>> urllib.parse.urlencode({'name': 'Guy Steele, Jr.'})\n" #~ "'name=Guy+Steele%2C+Jr.'" - -#~ msgid ":ref:`urllib-howto` for extensive examples." -#~ msgstr ":ref:`urllib-howto` 內有大量範例。" diff --git a/faq/programming.po b/faq/programming.po index f2df420db1..b9946648a4 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-19 00:15+0000\n" +"POT-Creation-Date: 2025-04-06 00:16+0000\n" "PO-Revision-Date: 2024-04-25 14:17+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,8 +45,8 @@ msgstr "有的。" #: ../../faq/programming.rst:19 msgid "" -"Several debuggers for Python are described below, and the built-in " -"function :func:`breakpoint` allows you to drop into any of them." +"Several debuggers for Python are described below, and the built-in function :" +"func:`breakpoint` allows you to drop into any of them." msgstr "" "下面描述了幾個 Python 除錯器,內建函式 :func:`breakpoint` 允許你進入其中任何" "一個。" @@ -340,11 +340,10 @@ msgid "" "a component of an imported module. This clutter would defeat the usefulness " "of the ``global`` declaration for identifying side-effects." msgstr "" -"雖然起初有點令人驚訝,但稍加考慮就可以解釋這一點。一方面,要" -"求 :keyword:`global` 分配的變數可以防止意外的副作用。另一方面,如果所有全域參" -"照都需要 ``global``,那麼你將一直使用 ``global``。你必須將對內建函式或引入模" -"組的組件的每個參照聲明為全域。這種混亂會破壞用於識別副作用的 ``global`` 聲明" -"的有用性。" +"雖然起初有點令人驚訝,但稍加考慮就可以解釋這一點。一方面,要求 :keyword:" +"`global` 分配的變數可以防止意外的副作用。另一方面,如果所有全域參照都需要 " +"``global``,那麼你將一直使用 ``global``。你必須將對內建函式或引入模組的組件的" +"每個參照聲明為全域。這種混亂會破壞用於識別副作用的 ``global`` 聲明的有用性。" #: ../../faq/programming.rst:208 msgid "" @@ -557,8 +556,8 @@ msgstr "如果你按以下順序引入模組,這是一個很好的做法:" #: ../../faq/programming.rst:301 msgid "" -"standard library modules -- " -"e.g. :mod:`sys`, :mod:`os`, :mod:`argparse`, :mod:`re`" +"standard library modules -- e.g. :mod:`sys`, :mod:`os`, :mod:`argparse`, :" +"mod:`re`" msgstr "" "標準函式庫模組 —— 例如 :mod:`sys`、:mod:`os`、:mod:`argparse`、:mod:`re`" @@ -572,7 +571,6 @@ msgstr "" "dateutil`, :mod:`!requests`, :mod:`!PIL.Image`" #: ../../faq/programming.rst:304 -#, fuzzy msgid "locally developed modules" msgstr "本地開發的模組" @@ -639,20 +637,18 @@ msgstr "" "入移動到局部範圍內,例如在函式定義內。如果根據程式的執行方式,許多引入是不必" "要的,則此技術特別有用。如果模組僅在該函式中使用,你可能還想將引入移動到該函" "式中。請注意,由於模組的一次性初始化,第一次載入模組可能很昂貴,但多次載入模" -"組實際上是免費的,只需幾次字典查詢。即使模組名稱超出範圍,該模組也可能" -"在 :data:`sys.modules` 中可用。" +"組實際上是免費的,只需幾次字典查詢。即使模組名稱超出範圍,該模組也可能在 :" +"data:`sys.modules` 中可用。" #: ../../faq/programming.rst:338 -#, fuzzy msgid "Why are default values shared between objects?" msgstr "為什麼物件之間共享預設值?" #: ../../faq/programming.rst:340 -#, fuzzy msgid "" "This type of bug commonly bites neophyte programmers. Consider this " "function::" -msgstr "這種型別的錯誤通常會困擾新手程式員。考慮這個功能: ::" +msgstr "這種類型的錯誤通常會困擾新手程式員。像是這個函式: ::" #: ../../faq/programming.rst:342 msgid "" @@ -661,15 +657,18 @@ msgid "" " mydict[key] = value\n" " return mydict" msgstr "" +"def foo(mydict={}): # 危險:所有呼叫共享對字典的參照\n" +" ... 計算一些東西 ...\n" +" mydict[key] = value\n" +" return mydict" #: ../../faq/programming.rst:347 -#, fuzzy msgid "" "The first time you call this function, ``mydict`` contains a single item. " "The second time, ``mydict`` contains two items because when ``foo()`` begins " "executing, ``mydict`` starts out with an item already in it." msgstr "" -"第一次呼叫此函式時, ``mydict`` 包含一個項目。第二次,``mydict`` 包含兩個項" +"第一次呼叫此函式時, ``mydict`` 包含一個項目。第二次後 ``mydict`` 包含兩個項" "目,因為當 ``foo()`` 開始執行時,``mydict`` 以其中已有的項目開始。" #: ../../faq/programming.rst:351 @@ -693,19 +692,18 @@ msgid "" "dictionaries, lists, and class instances can lead to confusion." msgstr "" "根據定義,數字、字串、元組和 ``None`` 等不可變物件是安全的,不會發生變化。對" -"字典、list和類別實例等可變物件的更改可能會導致混淆。" +"字典、串列和類別實例等可變物件的更改可能會導致混淆。" #: ../../faq/programming.rst:360 -#, fuzzy msgid "" "Because of this feature, it is good programming practice to not use mutable " "objects as default values. Instead, use ``None`` as the default value and " "inside the function, check if the parameter is ``None`` and create a new " "list/dictionary/whatever if it is. For example, don't write::" msgstr "" -"由於這個特性,不使用可變物件作為預設值是一個很好的編程習慣。相反,使用 " -"``None`` 作為預設值並在函式內部檢查參數是否為 ``None`` 並建立一個新的list/字" -"典/無論是否是。例如,不要寫: ::" +"由於這個特性,不使用可變物件作為預設值是一個很好的程式設計習慣,而是應使用 " +"``None`` 作為預設值,並在函式內部檢查參數是否為 ``None``,再建立一個新的串列/" +"字典/或其他東西。例如,不要這樣寫: ::" #: ../../faq/programming.rst:365 msgid "" @@ -717,7 +715,7 @@ msgstr "" #: ../../faq/programming.rst:368 msgid "but::" -msgstr "但是: ::" +msgstr "而是寫成: ::" #: ../../faq/programming.rst:370 msgid "" @@ -755,6 +753,15 @@ msgid "" " _cache[(arg1, arg2)] = result # Store result in the cache\n" " return result" msgstr "" +"# 呼叫者只能提供兩個參數,並選擇性地透過關鍵字傳遞 _cache\n" +"def expensive(arg1, arg2, *, _cache={}):\n" +" if (arg1, arg2) in _cache:\n" +" return _cache[(arg1, arg2)]\n" +"\n" +" # Calculate the value\n" +" result = ... expensive computation ...\n" +" _cache[(arg1, arg2)] = result # 將結果存儲在快取中\n" +" return result" #: ../../faq/programming.rst:389 msgid "" @@ -802,13 +809,13 @@ msgstr "引數 (arguments) 和參數 (parameters) 有什麼區別?" msgid "" ":term:`Parameters ` are defined by the names that appear in a " "function definition, whereas :term:`arguments ` are the values " -"actually passed to a function when calling it. Parameters define " -"what :term:`kind of arguments ` a function can accept. For " -"example, given the function definition::" +"actually passed to a function when calling it. Parameters define what :term:" +"`kind of arguments ` a function can accept. For example, given " +"the function definition::" msgstr "" ":term:`參數 `\\ 由出現在函式定義中的名稱定義,而\\ :term:`引數 " -"`\\ 是呼叫函式時實際傳遞給函式的值。參數定義函式可以接受的" -"\\ :term:`引數種類 `。例如,給定以下函式定義: ::" +"`\\ 是呼叫函式時實際傳遞給函式的值。參數定義函式可以接受的\\ :term:" +"`引數種類 `。例如,給定以下函式定義: ::" #: ../../faq/programming.rst:423 msgid "" @@ -836,7 +843,7 @@ msgstr "``42``、``314`` 和 ``somevar`` 是引數。" #: ../../faq/programming.rst:435 msgid "Why did changing list 'y' also change list 'x'?" -msgstr "為什麼更改 list 'y' 也會更改 list 'x'?" +msgstr "為什麼更改串列 'y' 也會更改串列 'x'?" #: ../../faq/programming.rst:437 msgid "If you wrote code like::" @@ -949,9 +956,9 @@ msgstr "" "一些操作(例如 ``y.append(10)`` 和 ``y.sort()``)會改變物件,而表面上相似的操" "作(例如 ``y = y + [10]`` 和: func:`sorted(y) `) 建立一個新物件。通" "常在 Python 中(以及在標準函式庫中的所有情況下)改變物件的方法將回傳 " -"``None`` 以幫助避免混淆這兩種型別的操作。因此,如果你錯誤地編寫了 " -"``y.sort()``,認為它會為你提供 ``y`` 的排序副本,那麼你最終會得到 ``None``," -"這可能會導致你的程式生成一個容易診斷的錯誤。" +"``None`` 以幫助避免混淆這兩種型別的操作。因此,如果你錯誤地編寫了 ``y." +"sort()``,認為它會為你提供 ``y`` 的排序副本,那麼你最終會得到 ``None``,這可" +"能會導致你的程式生成一個容易診斷的錯誤。" #: ../../faq/programming.rst:488 #, fuzzy @@ -1047,10 +1054,9 @@ msgid "This is almost always the clearest solution." msgstr "這幾乎都會是最清楚的方案。" #: ../../faq/programming.rst:530 -#, fuzzy msgid "" "By using global variables. This isn't thread-safe, and is not recommended." -msgstr "透過使用全域變數。這不是執行緒安全的,不推薦。" +msgstr "透過使用全域變數。這不是執行緒安全的,所以不推薦。" #: ../../faq/programming.rst:532 msgid "By passing a mutable (changeable in-place) object::" @@ -1077,9 +1083,8 @@ msgstr "" "['new-value', 100]" #: ../../faq/programming.rst:543 -#, fuzzy msgid "By passing in a dictionary that gets mutated::" -msgstr "透過傳入一個發生變異的字典: ::" +msgstr "透過傳入一個發生改變的字典: ::" #: ../../faq/programming.rst:545 msgid "" @@ -1092,9 +1097,16 @@ msgid "" ">>> args\n" "{'a': 'new-value', 'b': 100}" msgstr "" +">>> def func3(args):\n" +"... args['a'] = 'new-value' # args 是可變字典\n" +"... args['b'] = args['b'] + 1 # 原地改變它\n" +"...\n" +">>> args = {'a': 'old-value', 'b': 99}\n" +">>> func3(args)\n" +">>> args\n" +"{'a': 'new-value', 'b': 100}" #: ../../faq/programming.rst:554 -#, fuzzy msgid "Or bundle up values in a class instance::" msgstr "或者在類別實例中捆綁值: ::" @@ -1114,24 +1126,33 @@ msgid "" ">>> vars(args)\n" "{'a': 'new-value', 'b': 100}" msgstr "" +">>> class Namespace:\n" +"... def __init__(self, /, **args):\n" +"... for key, value in args.items():\n" +"... setattr(self, key, value)\n" +"...\n" +">>> def func4(args):\n" +"... args.a = 'new-value' # args 是可變命名空間\n" +"... args.b = args.b + 1 # 原地改變物件\n" +"...\n" +">>> args = Namespace(a='old-value', b=99)\n" +">>> func4(args)\n" +">>> vars(args)\n" +"{'a': 'new-value', 'b': 100}" #: ../../faq/programming.rst:571 -#, fuzzy msgid "There's almost never a good reason to get this complicated." -msgstr "幾乎沒有充分的理由讓事情變得如此復雜。" +msgstr "幾乎不會有要讓事情變得如此複雜的充分理由。" #: ../../faq/programming.rst:573 -#, fuzzy msgid "Your best choice is to return a tuple containing the multiple results." msgstr "你最好的選擇是回傳一個包含多個結果的元組。" #: ../../faq/programming.rst:577 -#, fuzzy msgid "How do you make a higher order function in Python?" msgstr "你如何在 Python 中建立高階函式?" #: ../../faq/programming.rst:579 -#, fuzzy msgid "" "You have two choices: you can use nested scopes or you can use callable " "objects. For example, suppose you wanted to define ``linear(a,b)`` which " @@ -1139,7 +1160,8 @@ msgid "" "scopes::" msgstr "" "你有兩種選擇:可以使用巢狀作用域,也可以使用可呼叫物件。例如,假設你想定義 " -"linear(a,b) ,它回傳一個計算值 a*x+b 的函式 f(x) 。使用嵌套範圍: ::" +"``linear(a,b)``,它會回傳 ``a*x+b`` 計算值的函式 ``f(x)``。使用巢狀作用" +"域: ::" #: ../../faq/programming.rst:583 msgid "" @@ -1184,9 +1206,8 @@ msgid "taxes = linear(0.3, 2)" msgstr "taxes = linear(0.3, 2)" #: ../../faq/programming.rst:602 -#, fuzzy msgid "gives a callable object where ``taxes(10e6) == 0.3 * 10e6 + 2``." -msgstr "給出一個可呼叫物件,其中 ``taxes(10e6) == 0.3 * 10e6 + 2``。" +msgstr "給定一個可呼叫物件,其中 ``taxes(10e6) == 0.3 * 10e6 + 2``。" #: ../../faq/programming.rst:604 #, fuzzy @@ -1271,8 +1292,8 @@ msgstr "" #: ../../faq/programming.rst:641 #, fuzzy msgid "" -"Some objects can be copied more easily. Dictionaries have " -"a :meth:`~dict.copy` method::" +"Some objects can be copied more easily. Dictionaries have a :meth:`~dict." +"copy` method::" msgstr "可以更輕鬆地複製某些物件。字典有一個 :meth:`~dict.copy` 方法: ::" #: ../../faq/programming.rst:644 @@ -1541,8 +1562,8 @@ msgid "" "only parameters. Its documentation looks like this::" msgstr "" "函式引數list中的斜線表示它前面的參數是位置參數。僅位置參數是沒有外部可用名稱" -"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置對映到參數。例" -"如,:func:`divmod` 是一個只接受位置參數的函式。它的文件看起來像這樣: ::" +"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置對映到參數。例如,:" +"func:`divmod` 是一個只接受位置參數的函式。它的文件看起來像這樣: ::" #: ../../faq/programming.rst:786 msgid "" @@ -1564,8 +1585,8 @@ msgid "" "positional-only. Thus, calling :func:`divmod` with keyword arguments would " "lead to an error::" msgstr "" -"參數串列最後的斜線表示兩個參數都是僅限位置參數。因此使用關鍵字引數呼" -"叫 :func:`divmod` 會導致錯誤: ::" +"參數串列最後的斜線表示兩個參數都是僅限位置參數。因此使用關鍵字引數呼叫 :func:" +"`divmod` 會導致錯誤: ::" #: ../../faq/programming.rst:796 msgid "" @@ -1680,8 +1701,8 @@ msgstr "如何取得 int 文字屬性而不是 SyntaxError?" #: ../../faq/programming.rst:850 msgid "" -"Trying to lookup an ``int`` literal attribute in the normal manner gives " -"a :exc:`SyntaxError` because the period is seen as a decimal point::" +"Trying to lookup an ``int`` literal attribute in the normal manner gives a :" +"exc:`SyntaxError` because the period is seen as a decimal point::" msgstr "" "嘗試以正常方式查找 ``int`` 字面值屬性會給出一個 :exc:`SyntaxError`,因為句點" "被視為小數點: ::" @@ -1717,8 +1738,8 @@ msgid "" "``int('144') == 144``. Similarly, :func:`float` converts to a floating-" "point number, e.g. ``float('144') == 144.0``." msgstr "" -"對於整數,使用內建的 int 型別建構函式,例如``int('144') == 144``。同" -"樣,:func:`float` 轉換為浮點數,例如``浮動('144')== 144.0``。" +"對於整數,使用內建的 int 型別建構函式,例如``int('144') == 144``。同樣,:" +"func:`float` 轉換為浮點數,例如``浮動('144')== 144.0``。" #: ../../faq/programming.rst:875 #, fuzzy @@ -1772,14 +1793,14 @@ msgid "" "in type constructor :func:`str`. If you want a hexadecimal or octal " "representation, use the built-in functions :func:`hex` or :func:`oct`. For " "fancy formatting, see the :ref:`f-strings` and :ref:`formatstrings` " -"sections, e.g. ``\"{:04d}\".format(144)`` yields ``'0144'`` and ``\"{:.3f}" -"\".format(1.0/3.0)`` yields ``'0.333'``." +"sections, e.g. ``\"{:04d}\".format(144)`` yields ``'0144'`` and ``\"{:.3f}\"." +"format(1.0/3.0)`` yields ``'0.333'``." msgstr "" -"例如,要將數字 ``144`` 轉換為字串 ``'144'``,請使用內建型別建構函" -"式 :func:`str`。如果你想要十六進製或八進製表示,請使用內建函式 :func:`hex` " -"或 :func:`oct`。對於精美的格式,請參閱:ref:`f-strings` " -"和:ref:`formatstrings` 部分,例如``\"{:04d}\".format(144)`` 產生 ``'0144'`` " -"和 ``\"{:.3f}\".format(1.0/3.0)`` 產生 ``'0.333'`` ." +"例如,要將數字 ``144`` 轉換為字串 ``'144'``,請使用內建型別建構函式 :func:" +"`str`。如果你想要十六進製或八進製表示,請使用內建函式 :func:`hex` 或 :func:" +"`oct`。對於精美的格式,請參閱:ref:`f-strings` 和:ref:`formatstrings` 部分,例" +"如``\"{:04d}\".format(144)`` 產生 ``'0144'`` 和 ``\"{:.3f}\"." +"format(1.0/3.0)`` 產生 ``'0.333'`` ." #: ../../faq/programming.rst:906 msgid "How do I modify a string in place?" @@ -1894,9 +1915,8 @@ msgid "" msgstr "請注意 :func:`getattr` 適用於任何物件,包括類別、類別實例、模組等。" #: ../../faq/programming.rst:965 -#, fuzzy msgid "This is used in several places in the standard library, like this::" -msgstr "這在標準函式庫中的幾個地方使用,如下所示: ::" +msgstr "這在標準函式庫中的幾個地方被使用,如: ::" #: ../../faq/programming.rst:967 msgid "" @@ -1943,9 +1963,10 @@ msgstr "" "f()" #: ../../faq/programming.rst:990 +#, fuzzy msgid "" -"Is there an equivalent to Perl's chomp() for removing trailing newlines from " -"strings?" +"Is there an equivalent to Perl's ``chomp()`` for removing trailing newlines " +"from strings?" msgstr "" "是否有與 Perl 的 chomp() 等效的方法,能用於從字串中刪除後綴的換行符號?" @@ -1982,7 +2003,8 @@ msgstr "" "很好。" #: ../../faq/programming.rst:1009 -msgid "Is there a scanf() or sscanf() equivalent?" +#, fuzzy +msgid "Is there a ``scanf()`` or ``sscanf()`` equivalent?" msgstr "是否有 scanf() 或 sscanf() 的等效方法?" #: ../../faq/programming.rst:1011 @@ -1995,15 +2017,15 @@ msgstr "不是這樣的。" msgid "" "For simple input parsing, the easiest approach is usually to split the line " "into whitespace-delimited words using the :meth:`~str.split` method of " -"string objects and then convert decimal strings to numeric values " -"using :func:`int` or :func:`float`. :meth:`!split` supports an optional " -"\"sep\" parameter which is useful if the line uses something other than " -"whitespace as a separator." +"string objects and then convert decimal strings to numeric values using :" +"func:`int` or :func:`float`. :meth:`!split` supports an optional \"sep\" " +"parameter which is useful if the line uses something other than whitespace " +"as a separator." msgstr "" "對於簡單的輸入解析,最簡單的方法通常是使用字串物件的 :meth:`~str.split` 方法" -"將行拆分為以空格分隔的單詞,然後使用 :func:`int` 或將十進製字串轉換為數" -"值:func:`浮動`。 :meth:`!split` 支援可選的 \"sep\" 參數,如果該行使用空格以外" -"的其他內容作為分隔符,該參數很有用。" +"將行拆分為以空格分隔的單詞,然後使用 :func:`int` 或將十進製字串轉換為數值:" +"func:`浮動`。 :meth:`!split` 支援可選的 \"sep\" 參數,如果該行使用空格以外的" +"其他內容作為分隔符,該參數很有用。" #: ../../faq/programming.rst:1019 #, fuzzy @@ -2014,7 +2036,8 @@ msgstr "" "對於更複雜的輸入解析,正則運算式比 C 的 ``sscanf`` 更強大,更適合這項任務。" #: ../../faq/programming.rst:1024 -msgid "What does 'UnicodeDecodeError' or 'UnicodeEncodeError' error mean?" +#, fuzzy +msgid "What does ``UnicodeDecodeError`` or ``UnicodeEncodeError`` error mean?" msgstr "'UnicodeDecodeError' 或 'UnicodeEncodeErro' 錯誤是什麼意思?" #: ../../faq/programming.rst:1026 @@ -2034,11 +2057,12 @@ msgid "" msgstr "以奇數個反斜線結尾的原始字串將轉義字串的引號: ::" #: ../../faq/programming.rst:1036 +#, fuzzy msgid "" ">>> r'C:\\this\\will\\not\\work\\'\n" " File \"\", line 1\n" " r'C:\\this\\will\\not\\work\\'\n" -" ^\n" +" ^\n" "SyntaxError: unterminated string literal (detected at line 1)" msgstr "" ">>> r'C:\\this\\will\\not\\work\\'\n" @@ -2118,7 +2142,7 @@ msgstr "另請參閱 :ref:`語言參考 ` 中的規範。" #: ../../faq/programming.rst:1070 msgid "Performance" -msgstr "" +msgstr "效能" #: ../../faq/programming.rst:1073 msgid "My program is too slow. How do I speed it up?" @@ -2152,8 +2176,8 @@ msgid "" "You should always find the hot spots in your program *before* attempting to " "optimize any code (see the :mod:`profile` module)." msgstr "" -"在嘗試最佳化任何程式碼\\ *之前*,你應該始終找到程式中的熱點(請參" -"閱 :mod:`profile` 模組)。" +"在嘗試最佳化任何程式碼\\ *之前*,你應該始終找到程式中的熱點(請參閱 :mod:" +"`profile` 模組)。" #: ../../faq/programming.rst:1084 #, fuzzy @@ -2208,9 +2232,9 @@ msgid "" "When the standard library provides a primitive for doing something, it is " "likely (although not guaranteed) to be faster than any alternative you may " "come up with. This is doubly true for primitives written in C, such as " -"builtins and some extension types. For example, be sure to use either " -"the :meth:`list.sort` built-in method or the related :func:`sorted` function " -"to do sorting (and see the :ref:`sortinghowto` for examples of moderately " +"builtins and some extension types. For example, be sure to use either the :" +"meth:`list.sort` built-in method or the related :func:`sorted` function to " +"do sorting (and see the :ref:`sortinghowto` for examples of moderately " "advanced usage)." msgstr "" "當標準函式庫提供用於執行某些操作的原語時,它很可能(儘管不能保證)比你可能想" @@ -2245,9 +2269,9 @@ msgid "" msgstr "" "如果你已經達到純 Python 所能允許的極限,可以使用一些工具讓你走得更遠。例如," "`Cython `_ 可以將稍微修改過的 Python 程式碼編譯成 C 擴" -"充,並且可以在許多不同的平台上使用。 Cython 可以利用編譯(和可選的型別註釋)" -"使你的程式碼比解釋時快得多。如果你對自己的 C 編程技能有信心,你也可以 :ref:`" -"自己編寫一個 C 擴充模組 `。" +"充,並且可以在許多不同的平台上使用。Cython 可以利用編譯(和可選的型別註釋)使" +"你的程式碼比解釋時快得多。如果你對自己的 C 程式設計技能有信心,你也可以\\ :" +"ref:`自己編寫一個 C 擴充模組 `。" #: ../../faq/programming.rst:1125 msgid "" @@ -2280,8 +2304,8 @@ msgid "" "To accumulate many :class:`str` objects, the recommended idiom is to place " "them into a list and call :meth:`str.join` at the end::" msgstr "" -"要累積許多 :class:`str` 物件,推薦的習慣用法是將它們放入list中並在末尾呼" -"叫 :meth:`str.join`: ::" +"要累積許多 :class:`str` 物件,推薦的習慣用法是將它們放入list中並在末尾呼叫 :" +"meth:`str.join`: ::" #: ../../faq/programming.rst:1141 msgid "" @@ -2290,6 +2314,10 @@ msgid "" " chunks.append(s)\n" "result = ''.join(chunks)" msgstr "" +"chunks = []\n" +"for s in my_strings:\n" +" chunks.append(s)\n" +"result = ''.join(chunks)" #: ../../faq/programming.rst:1146 #, fuzzy @@ -2312,16 +2340,17 @@ msgid "" "for b in my_bytes_objects:\n" " result += b" msgstr "" +"result = bytearray()\n" +"for b in my_bytes_objects:\n" +" result += b" #: ../../faq/programming.rst:1157 -#, fuzzy msgid "Sequences (Tuples/Lists)" -msgstr "序列(元組/list)" +msgstr "序列(元組/串列)" #: ../../faq/programming.rst:1160 -#, fuzzy msgid "How do I convert between tuples and lists?" -msgstr "如何在元組和list之間進行轉換?" +msgstr "如何在元組和串列之間進行轉換?" #: ../../faq/programming.rst:1162 msgid "" @@ -2357,9 +2386,8 @@ msgstr "" "本。" #: ../../faq/programming.rst:1177 -#, fuzzy msgid "What's a negative index?" -msgstr "什麼是負指數?" +msgstr "什麼是負索引?" #: ../../faq/programming.rst:1179 #, fuzzy @@ -2408,27 +2436,24 @@ msgid "" msgstr "這不會觸及你的原始序列,但會構建一個具有相反順序的新副本以進行疊代。" #: ../../faq/programming.rst:1202 -#, fuzzy msgid "How do you remove duplicates from a list?" -msgstr "如何從list中刪除重複項?" +msgstr "如何從串列中刪除重複項?" #: ../../faq/programming.rst:1204 -#, fuzzy msgid "See the Python Cookbook for a long discussion of many ways to do this:" -msgstr "請參閱 Python Cookbook 以獲取有關執行此操作的多種方法的詳細討論:" +msgstr "請參閱 Python Cookbook 以得到有關執行此操作的各種方法的詳細討論:" #: ../../faq/programming.rst:1206 msgid "https://code.activestate.com/recipes/52560/" msgstr "https://code.activestate.com/recipes/52560/" #: ../../faq/programming.rst:1208 -#, fuzzy msgid "" "If you don't mind reordering the list, sort it and then scan from the end of " "the list, deleting duplicates as you go::" msgstr "" -"如果你不介意重新排序list,請對其進行排序,然後從list末尾開始掃描,同時刪除重" -"複項: ::" +"如果你不介意重新排序串列,可以對其進行排序,然後從串列末尾開始掃描,同時刪除" +"重複項: ::" #: ../../faq/programming.rst:1211 msgid "" @@ -2441,31 +2466,36 @@ msgid "" " else:\n" " last = mylist[i]" msgstr "" +"if mylist:\n" +" mylist.sort()\n" +" last = mylist[-1]\n" +" for i in range(len(mylist)-2, -1, -1):\n" +" if last == mylist[i]:\n" +" del mylist[i]\n" +" else:\n" +" last = mylist[i]" #: ../../faq/programming.rst:1220 -#, fuzzy msgid "" -"If all elements of the list may be used as set keys (i.e. they are " -"all :term:`hashable`) this is often faster ::" +"If all elements of the list may be used as set keys (i.e. they are all :term:" +"`hashable`) this is often faster ::" msgstr "" -"如果list的所有元素都可以用作集合鍵(即它們都是 :term:`hashable`),這通常會更" -"快: ::" +"如果串列的所有元素都可以做為集合的鍵(即它們都必須是 :term:`hashable`),那這" +"通常會更快: ::" #: ../../faq/programming.rst:1223 msgid "mylist = list(set(mylist))" -msgstr "" +msgstr "mylist = list(set(mylist))" #: ../../faq/programming.rst:1225 -#, fuzzy msgid "" "This converts the list into a set, thereby removing duplicates, and then " "back into a list." -msgstr "這會將list轉換為一個集合,從而刪除重複項,然後再轉換回list。" +msgstr "這會將串列轉換為一個集合,從而刪除重複項,然後再轉換回串列。" #: ../../faq/programming.rst:1230 -#, fuzzy msgid "How do you remove multiple items from a list" -msgstr "如何從list中刪除多個項目" +msgstr "如何從串列中刪除多個項目" #: ../../faq/programming.rst:1232 #, fuzzy @@ -2549,14 +2579,12 @@ msgstr "" "樣做,因為它通常比使用 Python list慢很多。" #: ../../faq/programming.rst:1273 -#, fuzzy msgid "How do I create a multidimensional list?" -msgstr "如何建立多維 list?" +msgstr "如何建立多維度串列?" #: ../../faq/programming.rst:1275 -#, fuzzy msgid "You probably tried to make a multidimensional array like this::" -msgstr "你可能嘗試製作這樣的多維數組: ::" +msgstr "你可能會這樣建立一個多維度陣列: ::" #: ../../faq/programming.rst:1277 msgid ">>> A = [[None] * 2] * 3" @@ -2575,9 +2603,8 @@ msgstr "" "[[None, None], [None, None], [None, None]]" #: ../../faq/programming.rst:1290 -#, fuzzy msgid "But when you assign a value, it shows up in multiple places:" -msgstr "但是當你分配一個值時,它會出現在多個地方:" +msgstr "但是當你賦予一個值時,它會出現在多個地方:" #: ../../faq/programming.rst:1296 msgid "" @@ -2585,25 +2612,26 @@ msgid "" ">>> A\n" "[[5, None], [5, None], [5, None]]" msgstr "" +">>> A[0][0] = 5\n" +">>> A\n" +"[[5, None], [5, None], [5, None]]" #: ../../faq/programming.rst:1302 -#, fuzzy msgid "" "The reason is that replicating a list with ``*`` doesn't create copies, it " "only creates references to the existing objects. The ``*3`` creates a list " "containing 3 references to the same list of length two. Changes to one row " "will show in all rows, which is almost certainly not what you want." msgstr "" -"原因是複製帶有 ``*`` 的list不會建立副本,它只會建立對現有物件的參照。 ``*3`` " -"建立一個list,其中包含 3 個對長度為 2 的相同list的參照。對一行的更改將顯示在" -"所有行中,這幾乎肯定不是你想要的。" +"原因是複製帶有 ``*`` 的串列不會建立副本,它只會建立對現有物件的參照。``*3`` " +"建立一個串列,其中包含 3 個對長度為 2 的相同串列的參照。對其中一列的變更也將" +"顯示在所有其他列中,而這幾乎不會是你想要的。" #: ../../faq/programming.rst:1307 -#, fuzzy msgid "" "The suggested approach is to create a list of the desired length first and " "then fill in each element with a newly created list::" -msgstr "建議的方法是先建立所需長度的list,然後用新建立的list填充每個元素: ::" +msgstr "建議的方法是先建立所需長度的串列,然後用新建立的串列填充每個元素: ::" #: ../../faq/programming.rst:1310 msgid "" @@ -2611,40 +2639,43 @@ msgid "" "for i in range(3):\n" " A[i] = [None] * 2" msgstr "" +"A = [None] * 3\n" +"for i in range(3):\n" +" A[i] = [None] * 2" #: ../../faq/programming.rst:1314 -#, fuzzy msgid "" "This generates a list containing 3 different lists of length two. You can " "also use a list comprehension::" msgstr "" -"這會生成一個包含 3 個長度為 2 的不同list的list。你還可以使用list推導: ::" +"這會產生一個包含 3 個長度為 2 的不同串列的串列。你也可以使用串列綜合運算" +"式: ::" #: ../../faq/programming.rst:1317 msgid "" "w, h = 2, 3\n" "A = [[None] * w for i in range(h)]" msgstr "" +"w, h = 2, 3\n" +"A = [[None] * w for i in range(h)]" #: ../../faq/programming.rst:1320 -#, fuzzy msgid "" "Or, you can use an extension that provides a matrix datatype; `NumPy " "`_ is the best known." msgstr "" -"或者,你可以使用提供矩陣資料型別的擴充; `NumPy `_ 是最著" -"名的。" +"或者你也可以使用提供矩陣資料型別的擴充套件;`NumPy `_ 是" +"其中最著名的一個。" #: ../../faq/programming.rst:1325 -#, fuzzy msgid "How do I apply a method or function to a sequence of objects?" -msgstr "如何將方法或函式應用於一系列物件?" +msgstr "如何將方法或函式應用於物件序列?" #: ../../faq/programming.rst:1327 #, fuzzy msgid "" -"To call a method or function and accumulate the return values is a list, " -"a :term:`list comprehension` is an elegant solution::" +"To call a method or function and accumulate the return values is a list, a :" +"term:`list comprehension` is an elegant solution::" msgstr "" "呼叫一個方法或函式並累積回傳值是一個list,一個 :term:`list comprehension` 是" "一個優雅的解決方案: ::" @@ -2655,6 +2686,9 @@ msgid "" "\n" "result = [function(obj) for obj in mylist]" msgstr "" +"result = [obj.method() for obj in mylist]\n" +"\n" +"result = [function(obj) for obj in mylist]" #: ../../faq/programming.rst:1334 #, fuzzy @@ -2671,12 +2705,16 @@ msgid "" "for obj in mylist:\n" " function(obj)" msgstr "" +"for obj in mylist:\n" +" obj.method()\n" +"\n" +"for obj in mylist:\n" +" function(obj)" #: ../../faq/programming.rst:1346 -#, fuzzy msgid "" "Why does a_tuple[i] += ['item'] raise an exception when the addition works?" -msgstr "為什麼 a_tuple[i] += ['item'] 在加法工作時引發例外?" +msgstr "為什麼 a_tuple[i] += ['item'] 做加法時會引發例外?" #: ../../faq/programming.rst:1348 #, fuzzy @@ -2699,7 +2737,6 @@ msgstr "" "``list`` 和 ``+=\" 作為範例。" #: ../../faq/programming.rst:1356 -#, fuzzy msgid "If you wrote::" msgstr "如果你寫了: ::" @@ -2711,6 +2748,11 @@ msgid "" " ...\n" "TypeError: 'tuple' object does not support item assignment" msgstr "" +">>> a_tuple = (1, 2)\n" +">>> a_tuple[0] += 1\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" #: ../../faq/programming.rst:1364 #, fuzzy @@ -2726,11 +2768,10 @@ msgstr "" "會得到一個錯誤,因為我們無法更改元組的元素指向的內容。" #: ../../faq/programming.rst:1370 -#, fuzzy msgid "" "Under the covers, what this augmented assignment statement is doing is " "approximately this::" -msgstr "在幕後,這個擴充賦值陳述式所做的大致是這樣的: ::" +msgstr "這個增強賦值陳述式在背後大致是做這些事情: ::" #: ../../faq/programming.rst:1373 msgid "" @@ -2740,6 +2781,11 @@ msgid "" " ...\n" "TypeError: 'tuple' object does not support item assignment" msgstr "" +">>> result = a_tuple[0] + 1\n" +">>> a_tuple[0] = result\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" #: ../../faq/programming.rst:1379 #, fuzzy @@ -2787,11 +2833,11 @@ msgid "" "to calling :meth:`!extend` on the list and returning the list. That's why " "we say that for lists, ``+=`` is a \"shorthand\" for :meth:`!list.extend`::" msgstr "" -"要了解為什麼會發生這種情況,你需要知道 (a) 如果一個物件實作了一" -"個 :meth:`~object.__iadd__` 魔術方法,它會在執行 ``+=`` 增廣賦值時被呼叫,並" -"且它的回傳value 是賦值陳述式中使用的值; (b) 對於list,:meth:`!__iadd__` 相當" -"於在list上呼叫 :meth:`!extend` 並回傳list。這就是為什麼我們說對於list," -"``+=`` 是 :meth:`!list.extend` 的「簡寫」: ::" +"要了解為什麼會發生這種情況,你需要知道 (a) 如果一個物件實作了一個 :meth:" +"`~object.__iadd__` 魔術方法,它會在執行 ``+=`` 增廣賦值時被呼叫,並且它的回傳" +"value 是賦值陳述式中使用的值; (b) 對於list,:meth:`!__iadd__` 相當於在list上" +"呼叫 :meth:`!extend` 並回傳list。這就是為什麼我們說對於list,``+=`` 是 :meth:" +"`!list.extend` 的「簡寫」: ::" #: ../../faq/programming.rst:1404 msgid "" @@ -2962,8 +3008,8 @@ msgstr "什麼是方法 (method)?" #: ../../faq/programming.rst:1481 #, fuzzy msgid "" -"A method is a function on some object ``x`` that you normally call as " -"``x.name(arguments...)``. Methods are defined as functions inside the class " +"A method is a function on some object ``x`` that you normally call as ``x." +"name(arguments...)``. Methods are defined as functions inside the class " "definition::" msgstr "" "方法是一些物件 ``x`` 上的函式,你通常將其稱為 ``x.name(arguments...)`` 。方法" @@ -2999,11 +3045,10 @@ msgid "See also :ref:`why-self`." msgstr "另請參閱 :ref:`why-self`。" #: ../../faq/programming.rst:1502 -#, fuzzy msgid "" "How do I check if an object is an instance of a given class or of a subclass " "of it?" -msgstr "如何檢查一個物件是給定類別的實例還是它的子類別的實例?" +msgstr "如何檢查物件是否是給定類別的實例或其子類別的實例?" #: ../../faq/programming.rst:1504 #, fuzzy @@ -3023,15 +3068,15 @@ msgstr "" #: ../../faq/programming.rst:1511 msgid "" -"Note that :func:`isinstance` also checks for virtual inheritance from " -"an :term:`abstract base class`. So, the test will return ``True`` for a " +"Note that :func:`isinstance` also checks for virtual inheritance from an :" +"term:`abstract base class`. So, the test will return ``True`` for a " "registered class even if hasn't directly or indirectly inherited from it. " "To test for \"true inheritance\", scan the :term:`MRO` of the class:" msgstr "" "請注意,:func:`isinstance` 還會檢查來自\\ :term:`抽象基底類別 (abstract base " "class) ` 的虛擬繼承。因此對已註冊類別的檢驗會回傳 " -"``True``,即使沒有直接或間接繼承自它。要測試「真正繼承」,請掃描該類別" -"的 :term:`MRO`:" +"``True``,即使沒有直接或間接繼承自它。要測試「真正繼承」,請掃描該類別的 :" +"term:`MRO`:" #: ../../faq/programming.rst:1516 msgid "" @@ -3148,12 +3193,10 @@ msgstr "" "obj.search()" #: ../../faq/programming.rst:1575 -#, fuzzy msgid "What is delegation?" -msgstr "什麼是委派?" +msgstr "什麼是委派 (delegation)?" #: ../../faq/programming.rst:1577 -#, fuzzy msgid "" "Delegation is an object oriented technique (also called a design pattern). " "Let's say you have an object ``x`` and want to change the behaviour of just " @@ -3161,19 +3204,18 @@ msgid "" "implementation of the method you're interested in changing and delegates all " "other methods to the corresponding method of ``x``." msgstr "" -"委託是一種面向物件的技術(也稱為設計模式)。假設你有一個物件 ``x`` 並且只想更" -"改其中一個方法的行為。你可以建立一個新類別,它提供你感興趣的方法的新實作,並" -"將所有其他方法委託給 ``x`` 的相應方法。" +"委派是一種物件導向的技法(也稱為設計模式)。假設你有一個物件 ``x`` 並且只想更" +"改其中一個方法的行為。你可以建立一個新類別,它提供你想改變的那個方法的新實" +"作,並將所有其他方法委派給 ``x`` 的相應方法。" #: ../../faq/programming.rst:1583 -#, fuzzy msgid "" "Python programmers can easily implement delegation. For example, the " "following class implements a class that behaves like a file but converts all " "written data to uppercase::" msgstr "" -"Python 程式設計師可以輕鬆實作委託。例如,下面的類別實作了一個行為類似於檔案但" -"將所有寫入資料轉換為大寫的類別: ::" +"Python 程式設計師可以輕鬆地實作委派。舉例來說,以下類別實作了一個行為類似檔案" +"的類別,但將所有寫入的資料轉換為大寫:" #: ../../faq/programming.rst:1587 msgid "" @@ -3203,29 +3245,29 @@ msgstr "" #, fuzzy msgid "" "Here the ``UpperOut`` class redefines the ``write()`` method to convert the " -"argument string to uppercase before calling the underlying " -"``self._outfile.write()`` method. All other methods are delegated to the " -"underlying ``self._outfile`` object. The delegation is accomplished via " -"the :meth:`~object.__getattr__` method; consult :ref:`the language reference " -"` for more information about controlling attribute access." +"argument string to uppercase before calling the underlying ``self._outfile." +"write()`` method. All other methods are delegated to the underlying ``self." +"_outfile`` object. The delegation is accomplished via the :meth:`~object." +"__getattr__` method; consult :ref:`the language reference ` for more information about controlling attribute access." msgstr "" -"這裡的 ``UpperOut`` 類別重新定義了``write()`` 方法,在呼叫底層的" -"``self._outfile.write()`` 方法之前將引數字串轉換為大寫。所有其他方法都委託給" -"底層的 ``self._outfile`` 物件。委託是透過 :meth:`~object.__getattr__` 方法完" -"成的;有關控制屬性存取的更多資訊,請參閱語言參考 。" +"這裡的 ``UpperOut`` 類別重新定義了``write()`` 方法,在呼叫底層的``self." +"_outfile.write()`` 方法之前將引數字串轉換為大寫。所有其他方法都委託給底層的 " +"``self._outfile`` 物件。委託是透過 :meth:`~object.__getattr__` 方法完成的;有" +"關控制屬性存取的更多資訊,請參閱語言參考 。" #: ../../faq/programming.rst:1605 #, fuzzy msgid "" "Note that for more general cases delegation can get trickier. When " -"attributes must be set as well as retrieved, the class must define " -"a :meth:`~object.__setattr__` method too, and it must do so carefully. The " -"basic implementation of :meth:`!__setattr__` is roughly equivalent to the " +"attributes must be set as well as retrieved, the class must define a :meth:" +"`~object.__setattr__` method too, and it must do so carefully. The basic " +"implementation of :meth:`!__setattr__` is roughly equivalent to the " "following::" msgstr "" "請注意,對於更一般的情況,委託可能會變得更加棘手。當必須設定和檢索屬性時,該" -"類別也必須定義一個 :meth:`~object.__setattr__` 方法,而且必須小心謹" -"慎。 :meth:`!__setattr__` 的基本實作大致等同於以下: ::" +"類別也必須定義一個 :meth:`~object.__setattr__` 方法,而且必須小心謹慎。 :" +"meth:`!__setattr__` 的基本實作大致等同於以下: ::" #: ../../faq/programming.rst:1610 msgid "" @@ -3243,9 +3285,8 @@ msgstr "" #: ../../faq/programming.rst:1616 msgid "" -"Many :meth:`~object.__setattr__` implementations call :meth:`!" -"object.__setattr__` to set an attribute on self without causing infinite " -"recursion::" +"Many :meth:`~object.__setattr__` implementations call :meth:`!object." +"__setattr__` to set an attribute on self without causing infinite recursion::" msgstr "" "許多 :meth:`~object.__setattr__` 的實作會呼叫 :meth:`!object.__setattr__` 以" "設定 self 的屬性,而不會導致無限遞迴。" @@ -3264,8 +3305,8 @@ msgstr "" #: ../../faq/programming.rst:1624 msgid "" -"Alternatively, it is possible to set attributes by inserting entries " -"into :attr:`self.__dict__ ` directly." +"Alternatively, it is possible to set attributes by inserting entries into :" +"attr:`self.__dict__ ` directly." msgstr "" #: ../../faq/programming.rst:1629 @@ -3298,9 +3339,8 @@ msgid "" msgstr "" #: ../../faq/programming.rst:1644 -#, fuzzy msgid "How can I organize my code to make it easier to change the base class?" -msgstr "我如何組織我的程式碼以便更容易地更改基底類別?" +msgstr "我可以如何組織我的程式碼以使得更改基底類別變的更容易?" #: ../../faq/programming.rst:1646 #, fuzzy @@ -3333,25 +3373,22 @@ msgstr "" " ..." #: ../../faq/programming.rst:1661 -#, fuzzy msgid "How do I create static class data and static class methods?" msgstr "如何建立靜態類別資料和靜態類別方法?" #: ../../faq/programming.rst:1663 -#, fuzzy msgid "" "Both static data and static methods (in the sense of C++ or Java) are " "supported in Python." msgstr "Python 支援靜態資料和靜態方法(在 C++ 或 Java 的意義上)。" #: ../../faq/programming.rst:1666 -#, fuzzy msgid "" "For static data, simply define a class attribute. To assign a new value to " "the attribute, you have to explicitly use the class name in the assignment::" msgstr "" -"對於靜態資料,只需定義一個類別屬性即可。要為屬性分配新值,你必須在分配中顯式" -"使用類別名: ::" +"對於靜態資料,只需定義一個類別屬性即可。要為屬性賦予新值,你必須在賦值中明確" +"使用類別名稱: ::" #: ../../faq/programming.rst:1669 msgid "" @@ -3374,15 +3411,14 @@ msgstr "" " return C.count # 或回傳 self.count" #: ../../faq/programming.rst:1678 -#, fuzzy msgid "" "``c.count`` also refers to ``C.count`` for any ``c`` such that " "``isinstance(c, C)`` holds, unless overridden by ``c`` itself or by some " "class on the base-class search path from ``c.__class__`` back to ``C``." msgstr "" -"``c.count`` 還指代任何 ``c`` 的 ``C.count`` 使得 ``isinstance(c, C)`` 成立," -"除非被 ``c`` 本身或某些人覆蓋從 ``c.__class__`` 回到 ``C`` 的基底類別搜索路徑" -"上的類別。" +"``c.count`` 還代指對於任何 ``c`` 使得 ``isinstance(c, C)`` 成立的 ``C." +"count``,除非被 ``c`` 本身覆蓋或從 ``c.__class__`` 回到 ``C`` 的基底類別搜索" +"路徑上的某個類別覆蓋。" #: ../../faq/programming.rst:1682 #, fuzzy @@ -3444,9 +3480,8 @@ msgstr "" "則這提供了所需的封裝。" #: ../../faq/programming.rst:1708 -#, fuzzy msgid "How can I overload constructors (or methods) in Python?" -msgstr "如何在 Python 中重載建構函式(或方法)?" +msgstr "如何在 Python 中多載 (overload) 建構函式(或方法)?" #: ../../faq/programming.rst:1710 msgid "" @@ -3519,7 +3554,6 @@ msgid "I try to use __spam and I get an error about _SomeClassName__spam." msgstr "我嘗試使用 __spam,但收到有關 _SomeClassName__spam 的錯誤。" #: ../../faq/programming.rst:1745 -#, fuzzy msgid "" "Variable names with double leading underscores are \"mangled\" to provide a " "simple but effective way to define class private variables. Any identifier " @@ -3528,10 +3562,10 @@ msgid "" "``classname`` is the current class name with any leading underscores " "stripped." msgstr "" -"帶有雙前導底線的變數名被「破壞」以提供一種簡單但有效的方法來定義類別私有變" -"數。 ``__spam`` 形式的任何標識器(至少兩個前導底線,最多一個尾隨底線)在文本" -"上替換為 ``_classname__spam``,其中 ``classname`` 是當前類別名,所有前導底線" -"被去除。" +"帶有雙前導底線的變數名會被「破壞 (mangled)」以做為提供定義類別私有變數的一個" +"簡單但有效的方法。``__spam`` 形式的任何識別字(至少兩個前導底線,最多一個尾隨" +"底線)在文字上會被替換為 ``_classname__spam``,其中 ``classname`` 是當前類別" +"之所有前導底線被去除的名稱。" #: ../../faq/programming.rst:1751 msgid "" @@ -3590,14 +3624,13 @@ msgid "There are several possible reasons for this." msgstr "這有幾個可能的原因。" #: ../../faq/programming.rst:1782 -#, fuzzy msgid "" -"The :keyword:`del` statement does not necessarily " -"call :meth:`~object.__del__` -- it simply decrements the object's reference " -"count, and if this reaches zero :meth:`!__del__` is called." +"The :keyword:`del` statement does not necessarily call :meth:`~object." +"__del__` -- it simply decrements the object's reference count, and if this " +"reaches zero :meth:`!__del__` is called." msgstr "" -":keyword:`del` 陳述式不一定呼叫 :meth:`~object.__del__` -- 它只是減少物件的引" -"用計數,如果達到零,則呼叫 :meth:`!__del__`。" +":keyword:`del` 陳述式不一定會呼叫 :meth:`~object.__del__` -- 它只是減少物件的" +"參照計數,如果達到零則呼叫 :meth:`!__del__`。" #: ../../faq/programming.rst:1786 #, fuzzy @@ -3653,23 +3686,21 @@ msgid "" "Finally, if your :meth:`!__del__` method raises an exception, a warning " "message is printed to :data:`sys.stderr`." msgstr "" -"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告訊息印出" -"到 :data:`sys.stderr`。" +"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告訊息印出到 :data:" +"`sys.stderr`。" #: ../../faq/programming.rst:1822 -#, fuzzy msgid "How do I get a list of all instances of a given class?" -msgstr "如何獲取給定類別的所有實例的 list?" +msgstr "我該如何取得給定類別的所有實例的串列?" #: ../../faq/programming.rst:1824 -#, fuzzy msgid "" "Python does not keep track of all instances of a class (or of a built-in " "type). You can program the class's constructor to keep track of all " "instances by keeping a list of weak references to each instance." msgstr "" -"Python 不會追蹤類別(或內建型別)的所有實例。你可以對類別的建構函式進行編程," -"以透過保留對每個實例的弱參照串列來追蹤所有實例。" +"Python 不會追蹤類別(或內建型別)的所有實例。你可以將類別的建構函式進行改寫," +"以透過保留對每個實例之弱參照串列來追蹤所有實例。" #: ../../faq/programming.rst:1830 msgid "Why does the result of ``id()`` appear to be not unique?" @@ -3731,16 +3762,18 @@ msgstr "" "說,保證識別性的情況有以下三種:" #: ../../faq/programming.rst:1870 +#, fuzzy msgid "" -"1) Assignments create new names but do not change object identity. After " -"the assignment ``new = old``, it is guaranteed that ``new is old``." +"Assignments create new names but do not change object identity. After the " +"assignment ``new = old``, it is guaranteed that ``new is old``." msgstr "" "1) 賦值建立新名稱但不改變物件識別性。賦值 ``new = old`` 後,保證 ``new is " "old``。" #: ../../faq/programming.rst:1873 +#, fuzzy msgid "" -"2) Putting an object in a container that stores object references does not " +"Putting an object in a container that stores object references does not " "change object identity. After the list assignment ``s[0] = x``, it is " "guaranteed that ``s[0] is x``." msgstr "" @@ -3750,9 +3783,9 @@ msgstr "" #: ../../faq/programming.rst:1877 #, fuzzy msgid "" -"3) If an object is a singleton, it means that only one instance of that " -"object can exist. After the assignments ``a = None`` and ``b = None``, it " -"is guaranteed that ``a is b`` because ``None`` is a singleton." +"If an object is a singleton, it means that only one instance of that object " +"can exist. After the assignments ``a = None`` and ``b = None``, it is " +"guaranteed that ``a is b`` because ``None`` is a singleton." msgstr "" "3)如果一個物件是單例,則意味著該物件只能存在一個實例。在賦值 ``a = None`` " "和 ``b = None`` 之後,可以保證 ``a is b`` 因為 ``None`` 是單例。" @@ -3833,8 +3866,8 @@ msgid "" "implement a method that behaves like :meth:`dict.pop`:" msgstr "" "當 ``None`` 是有效輸入值時,檢測可選引數可能會很棘手。在這些情況下,你可以建" -"立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似" -"於 :meth:`dict.pop` 的方法:" +"立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似於 :" +"meth:`dict.pop` 的方法:" #: ../../faq/programming.rst:1917 msgid "" @@ -3871,8 +3904,8 @@ msgstr "" #: ../../faq/programming.rst:1934 msgid "" -"For example, here is the implementation of :meth:`!" -"collections.abc.Sequence.__contains__`::" +"For example, here is the implementation of :meth:`!collections.abc.Sequence." +"__contains__`::" msgstr "" "例如,以下是 :meth:`!collections.abc.Sequence.__contains__` 的實作: ::" @@ -3903,9 +3936,9 @@ msgid "" "*after* an instance is created, which is too late to alter data in an " "immutable instance." msgstr "" -"當對不可變型別進行子類別化時,覆蓋 :meth:`~object.__new__` 方法而不" -"是 :meth:`~object.__init__` 方法。後者僅在*建立實例後*運行,這為時已晚,無法" -"更改不可變實例中的資料。" +"當對不可變型別進行子類別化時,覆蓋 :meth:`~object.__new__` 方法而不是 :meth:" +"`~object.__init__` 方法。後者僅在*建立實例後*運行,這為時已晚,無法更改不可變" +"實例中的資料。" #: ../../faq/programming.rst:1952 msgid "" @@ -3988,14 +4021,12 @@ msgstr "如何快取方法呼叫?" #: ../../faq/programming.rst:1997 #, fuzzy msgid "" -"The two principal tools for caching methods " -"are :func:`functools.cached_property` and :func:`functools.lru_cache`. The " -"former stores results at the instance level and the latter at the class " -"level." +"The two principal tools for caching methods are :func:`functools." +"cached_property` and :func:`functools.lru_cache`. The former stores results " +"at the instance level and the latter at the class level." msgstr "" -"快取方法的兩個主要工具是 func:`functools.cached_property` " -"和 :func:`functools.lru_cache`。前者在實例級別存儲結果,後者在類別級別存儲結" -"果。" +"快取方法的兩個主要工具是 func:`functools.cached_property` 和 :func:" +"`functools.lru_cache`。前者在實例級別存儲結果,後者在類別級別存儲結果。" #: ../../faq/programming.rst:2002 #, fuzzy @@ -4080,13 +4111,12 @@ msgstr "" #, fuzzy msgid "" "To make the *lru_cache* approach work when the *station_id* is mutable, the " -"class needs to define the :meth:`~object.__eq__` " -"and :meth:`~object.__hash__` methods so that the cache can detect relevant " -"attribute updates::" +"class needs to define the :meth:`~object.__eq__` and :meth:`~object." +"__hash__` methods so that the cache can detect relevant attribute updates::" msgstr "" -"要在 *station_id* 可變時使 *lru_cache* 方法起作用,該類別需要定" -"義 :meth:`~object.__eq__` 和 :meth:`~object.__hash__` 方法,以便快取可以檢測" -"相關屬性更新: ::" +"要在 *station_id* 可變時使 *lru_cache* 方法起作用,該類別需要定義 :meth:" +"`~object.__eq__` 和 :meth:`~object.__hash__` 方法,以便快取可以檢測相關屬性更" +"新: ::" #: ../../faq/programming.rst:2053 msgid "" @@ -4133,8 +4163,8 @@ msgstr "" "第一次引入模組時(或者源檔案自建立當前編譯檔案後發生更改時)應在 " "``__pycache__`` 的子目錄中建立包含編譯程式碼的 ``.pyc`` 檔案包含 .py 檔案的目" "錄。 ``.pyc`` 檔案的檔案名以與``.py`` 檔案相同的名稱開頭,以``.pyc`` 結尾,中" -"間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參" -"閱 :pep:`3147`。)" +"間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參閱 :" +"pep:`3147`。)" #: ../../faq/programming.rst:2088 #, fuzzy @@ -4165,10 +4195,10 @@ msgstr "" #: ../../faq/programming.rst:2098 #, fuzzy msgid "" -"Running Python on a top level script is not considered an import and no " -"``.pyc`` will be created. For example, if you have a top-level module " -"``foo.py`` that imports another module ``xyz.py``, when you run ``foo`` (by " -"typing ``python foo.py`` as a shell command), a ``.pyc`` will be created for " +"Running Python on a top level script is not considered an import and no ``." +"pyc`` will be created. For example, if you have a top-level module ``foo." +"py`` that imports another module ``xyz.py``, when you run ``foo`` (by typing " +"``python foo.py`` as a shell command), a ``.pyc`` will be created for " "``xyz`` because ``xyz`` is imported, but no ``.pyc`` file will be created " "for ``foo`` since ``foo.py`` isn't being imported." msgstr "" @@ -4179,9 +4209,9 @@ msgstr "" #: ../../faq/programming.rst:2105 msgid "" -"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a " -"``.pyc`` file for a module that is not imported -- you can, using " -"the :mod:`py_compile` and :mod:`compileall` modules." +"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``." +"pyc`` file for a module that is not imported -- you can, using the :mod:" +"`py_compile` and :mod:`compileall` modules." msgstr "" "如果你需要為 ``foo`` 建立一個 ``.pyc`` 檔案 —— 也就是說,要為一個未引入的模組" "建立一個 ``.pyc`` 檔案 —— 你可以使用 :mod:`py_compile` 和 :mod:`compileall` " @@ -4198,10 +4228,10 @@ msgstr "" #: ../../faq/programming.rst:2112 msgid "" ">>> import py_compile\n" -">>> py_compile.compile('foo.py') " +">>> py_compile.compile('foo.py')" msgstr "" ">>> import py_compile\n" -">>> py_compile.compile('foo.py') " +">>> py_compile.compile('foo.py')" #: ../../faq/programming.rst:2115 msgid "" @@ -4359,11 +4389,11 @@ msgstr "此問題有(至少)三種可能的解決方法。" #: ../../faq/programming.rst:2178 #, fuzzy msgid "" -"Guido van Rossum recommends avoiding all uses of ``from " -"import ...``, and placing all code inside functions. Initializations of " -"global variables and class variables should use constants or built-in " -"functions only. This means everything from an imported module is referenced " -"as ``.``." +"Guido van Rossum recommends avoiding all uses of ``from import ..." +"``, and placing all code inside functions. Initializations of global " +"variables and class variables should use constants or built-in functions " +"only. This means everything from an imported module is referenced as " +"``.``." msgstr "" "Guido van Rossum 建議避免使用``from import ...``,並將所有程式碼放在" "函式中。全域變數和類別變數的初始化應該只使用常數或內建函式。這意味著來自引入" diff --git a/faq/windows.po b/faq/windows.po index a0659bea13..b46fe34cdc 100644 --- a/faq/windows.po +++ b/faq/windows.po @@ -150,10 +150,10 @@ msgstr "" #: ../../faq/windows.rst:84 msgid "" "Many people use the interactive mode as a convenient yet highly programmable " -"calculator. When you want to end your interactive Python session, call the :" -"func:`exit` function or hold the :kbd:`Ctrl` key down while you enter a :kbd:" -"`Z`, then hit the \":kbd:`Enter`\" key to get back to your Windows command " -"prompt." +"calculator. When you want to end your interactive Python session, call " +"the :func:`exit` function or hold the :kbd:`Ctrl` key down while you enter " +"a :kbd:`Z`, then hit the \":kbd:`Enter`\" key to get back to your Windows " +"command prompt." msgstr "" "許多人將互動模式作為方便但可高度程式化的計算機。如果你要結束互動式 Python 對" "話,請呼叫 :func:`exit` 函式或是按住 :kbd:`Ctrl` 鍵再輸入 :kbd:`Z`,然後按下 " @@ -161,12 +161,12 @@ msgstr "" #: ../../faq/windows.rst:90 msgid "" -"You may also find that you have a Start-menu entry such as :menuselection:" -"`Start --> Programs --> Python 3.x --> Python (command line)` that results " -"in you seeing the ``>>>`` prompt in a new window. If so, the window will " -"disappear after you call the :func:`exit` function or enter the :kbd:`Ctrl-" -"Z` character; Windows is running a single \"python\" command in the window, " -"and closes it when you terminate the interpreter." +"You may also find that you have a Start-menu entry such " +"as :menuselection:`Start --> Programs --> Python 3.x --> Python (command " +"line)` that results in you seeing the ``>>>`` prompt in a new window. If " +"so, the window will disappear after you call the :func:`exit` function or " +"enter the :kbd:`Ctrl-Z` character; Windows is running a single \"python\" " +"command in the window, and closes it when you terminate the interpreter." msgstr "" "你可能還會發現你有一個開始功能表項目,像是::menuselection:`開始 --> 所有程" "式 --> Python 3.x --> Python(命令行)`,它會讓你在一個新視窗中看到 ``>>>`` " @@ -221,11 +221,11 @@ msgid "" "typing 'foo' with no extension you need to add .py to the PATHEXT " "environment variable." msgstr "" -"在 Windows 上,標準的 Python 安裝程式已將 .py 副檔名與一種檔案類型 (Python." -"File) 進行關聯,並為該檔案類型提供一個開啟命令來運行直譯器 (``D:\\Program " -"Files\\Python\\python.exe \"%1\" %*``)。這足以使腳本能以類似 'foo.py' 的形式" -"從命令提示字元被執行。如果你希望能夠簡單地輸入 'foo' 來執行腳本,而不用加上副" -"檔名,則需要將 .py 新增至 PATHEXT 環境變數中。" +"在 Windows 上,標準的 Python 安裝程式已將 .py 副檔名與一種檔案類型 " +"(Python.File) 進行關聯,並為該檔案類型提供一個開啟命令來運行直譯器 (``D:" +"\\Program Files\\Python\\python.exe \"%1\" %*``)。這足以使腳本能以類似 " +"'foo.py' 的形式從命令提示字元被執行。如果你希望能夠簡單地輸入 'foo' 來執行腳" +"本,而不用加上副檔名,則需要將 .py 新增至 PATHEXT 環境變數中。" #: ../../faq/windows.rst:124 msgid "Why does Python sometimes take so long to start?" @@ -285,8 +285,8 @@ msgstr "" "是的,.pyd 檔類似於 dll,但也有一些區別。如果你有一個名為 ``foo.pyd`` 的 " "DLL,則它必須具有函式 ``PyInit_foo()``。接著你可以將 \"import foo\" 寫入 " "Python 腳本,Python 將會搜尋 foo.pyd(以及 foo.py、foo.pyc),如果 Python 找" -"到它,將會嘗試呼叫 ``PyInit_foo()`` 來將它初始化。你並不會將你的 .exe 與 foo." -"lib 連結 (link),因為這會導致 Windows 要求 DLL 的存在。" +"到它,將會嘗試呼叫 ``PyInit_foo()`` 來將它初始化。你並不會將你的 .exe 與 " +"foo.lib 連結 (link),因為這會導致 Windows 要求 DLL 的存在。" #: ../../faq/windows.rst:157 msgid "" @@ -318,9 +318,10 @@ msgstr "在 Windows 應用程式中嵌入 Python 直譯器的過程可以總結 msgid "" "Do **not** build Python into your .exe file directly. On Windows, Python " "must be a DLL to handle importing modules that are themselves DLL's. (This " -"is the first key undocumented fact.) Instead, link to :file:`python{NN}." -"dll`; it is typically installed in ``C:\\Windows\\System``. *NN* is the " -"Python version, a number such as \"33\" for Python 3.3." +"is the first key undocumented fact.) Instead, link " +"to :file:`python{NN}.dll`; it is typically installed in ``C:" +"\\Windows\\System``. *NN* is the Python version, a number such as \"33\" " +"for Python 3.3." msgstr "" "**不要**\\ 直接將 Python 建置到你的 .exe 檔中。在 Windows 上,Python 必須是一" "個 DLL 來處理模組的 import,而那些模組本身也是 DLL。(這是第一個未正式記載的" @@ -337,8 +338,9 @@ msgid "" msgstr "" "你可以透過兩種不同的方式連結到 Python。載入時連結 (load-time linking) 表示要" "連結到 :file:`python{NN}.lib`,而執行環境連結 (run-time linking) 表示要連結" -"到 :file:`python{NN}.dll`。(一般註解::file:`python{NN}.lib` 是 :file:" -"`python{NN}.dll` 相對應的所謂 \"import lib\"。它只會為鏈接器定義符號。)" +"到 :file:`python{NN}.dll`。(一般註解::file:`python{NN}.lib` " +"是 :file:`python{NN}.dll` 相對應的所謂 \"import lib\"。它只會為鏈接器定義符" +"號。)" #: ../../faq/windows.rst:182 msgid "" @@ -352,9 +354,9 @@ msgid "" msgstr "" "執行環境連結大大簡化了連結選項;所有事情都會發生在執行環境。你的程式碼必須使" "用 Windows ``LoadLibraryEx()`` 常式 (routine) 來載入 :file:`python{NN}.dll`。" -"該程式碼也必須用 Windows ``GetProcAddress()`` 常式所取得的指標,來使用 :file:" -"`python{NN}.dll` 中的(即為 Python C API 的)存取常式和資料。對於任何呼叫 " -"Python C API 常式的 C 程式碼,巨集可以讓使用這些指標的過程透明化。" +"該程式碼也必須用 Windows ``GetProcAddress()`` 常式所取得的指標,來使" +"用 :file:`python{NN}.dll` 中的(即為 Python C API 的)存取常式和資料。對於任" +"何呼叫 Python C API 常式的 C 程式碼,巨集可以讓使用這些指標的過程透明化。" #: ../../faq/windows.rst:191 msgid "" @@ -498,10 +500,10 @@ msgstr "" #: ../../faq/windows.rst:262 msgid "" "Under any editor, mixing tabs and spaces is a bad idea. MSVC is no " -"different in this respect, and is easily configured to use spaces: Take :" -"menuselection:`Tools --> Options --> Tabs`, and for file type \"Default\" " -"set \"Tab size\" and \"Indent size\" to 4, and select the \"Insert spaces\" " -"radio button." +"different in this respect, and is easily configured to use spaces: " +"Take :menuselection:`Tools --> Options --> Tabs`, and for file type " +"\"Default\" set \"Tab size\" and \"Indent size\" to 4, and select the " +"\"Insert spaces\" radio button." msgstr "" "在任何編輯器下,將 tab 和空格混合都是一個壞主意。MSVC 在這方面也是一樣,且可" "以輕鬆配置為使用空格:選擇\\ :menuselection:`工具 --> 選項 --> Tabs`,然後對" @@ -511,12 +513,12 @@ msgstr "" #: ../../faq/windows.rst:267 msgid "" "Python raises :exc:`IndentationError` or :exc:`TabError` if mixed tabs and " -"spaces are causing problems in leading whitespace. You may also run the :mod:" -"`tabnanny` module to check a directory tree in batch mode." +"spaces are causing problems in leading whitespace. You may also run " +"the :mod:`tabnanny` module to check a directory tree in batch mode." msgstr "" -"如果混合 tab 和空格造成前導空白字元出現問題,則 Python 會引發 :exc:" -"`IndentationError` 或 :exc:`TabError`。你也可以運行 :mod:`tabnanny` 模組,在" -"批次模式下檢查目錄樹。" +"如果混合 tab 和空格造成前導空白字元出現問題,則 Python 會引" +"發 :exc:`IndentationError` 或 :exc:`TabError`。你也可以運行 :mod:`tabnanny` " +"模組,在批次模式下檢查目錄樹。" #: ../../faq/windows.rst:274 msgid "How do I check for a keypress without blocking?" @@ -549,12 +551,6 @@ msgstr "" "解決問題,請造訪 `Microsoft 支援頁面 `_\\ 以取得關於手動安裝 C Runtime 更新的指南。" -#~ msgid "or::" -#~ msgstr "" -#~ "或是:\n" -#~ "\n" -#~ "::" - #~ msgid "" #~ "This series of screencasts aims to get you up and running with Python on " #~ "Windows XP. The knowledge is distilled into 1.5 hours and will get you " diff --git a/glossary.po b/glossary.po index 780dc58513..09829faffe 100644 --- a/glossary.po +++ b/glossary.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-21 00:13+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -68,23 +68,22 @@ msgid "" "define interfaces when other techniques like :func:`hasattr` would be clumsy " "or subtly wrong (for example with :ref:`magic methods `). " "ABCs introduce virtual subclasses, which are classes that don't inherit from " -"a class but are still recognized by :func:`isinstance` " -"and :func:`issubclass`; see the :mod:`abc` module documentation. Python " -"comes with many built-in ABCs for data structures (in " -"the :mod:`collections.abc` module), numbers (in the :mod:`numbers` module), " -"streams (in the :mod:`io` module), import finders and loaders (in " -"the :mod:`importlib.abc` module). You can create your own ABCs with " -"the :mod:`abc` module." +"a class but are still recognized by :func:`isinstance` and :func:" +"`issubclass`; see the :mod:`abc` module documentation. Python comes with " +"many built-in ABCs for data structures (in the :mod:`collections.abc` " +"module), numbers (in the :mod:`numbers` module), streams (in the :mod:`io` " +"module), import finders and loaders (in the :mod:`importlib.abc` module). " +"You can create your own ABCs with the :mod:`abc` module." msgstr "" "抽象基底類別(又稱為 ABC)提供了一種定義介面的方法,作為 :term:`duck-" "typing`\\ (鴨子型別)的補充。其他類似的技術,像是 :func:`hasattr`,則顯得笨" "拙或是帶有細微的錯誤(例如使用\\ :ref:`魔術方法 (magic method) `\\ )。ABC 採用虛擬的 subclass(子類別),它們並不繼承自另一個 class" -"(類別),但仍可被 :func:`isinstance` 及 :func:`issubclass` 辨識;請參" -"閱 :mod:`abc` 模組的說明文件。Python 有許多內建的 ABC,用於資料結構" -"(在 :mod:`collections.abc` 模組)、數字(在 :mod:`numbers` 模組)、串流" -"(在 :mod:`io` 模組)及 import 尋檢器和載入器(在 :mod:`importlib.abc` 模" -"組)。你可以使用 :mod:`abc` 模組建立自己的 ABC。" +"(類別),但仍可被 :func:`isinstance` 及 :func:`issubclass` 辨識;請參閱 :" +"mod:`abc` 模組的說明文件。Python 有許多內建的 ABC,用於資料結構(在 :mod:" +"`collections.abc` 模組)、數字(在 :mod:`numbers` 模組)、串流(在 :mod:`io` " +"模組)及 import 尋檢器和載入器(在 :mod:`importlib.abc` 模組)。你可以使用 :" +"mod:`abc` 模組建立自己的 ABC。" #: ../../glossary.rst:38 msgid "annotation" @@ -112,12 +111,12 @@ msgstr "" #: ../../glossary.rst:50 msgid "" "See :term:`variable annotation`, :term:`function annotation`, :pep:`484` " -"and :pep:`526`, which describe this functionality. Also " -"see :ref:`annotations-howto` for best practices on working with annotations." +"and :pep:`526`, which describe this functionality. Also see :ref:" +"`annotations-howto` for best practices on working with annotations." msgstr "" "請參閱 :term:`variable annotation`、:term:`function annotation`、:pep:`484` " -"和 :pep:`526`,這些章節皆有此功能的說明。關於註釋的最佳實踐方法也請參" -"閱 :ref:`annotations-howto`。" +"和 :pep:`526`,這些章節皆有此功能的說明。關於註釋的最佳實踐方法也請參閱 :ref:" +"`annotations-howto`。" #: ../../glossary.rst:54 msgid "argument" @@ -197,12 +196,12 @@ msgstr "asynchronous context manager(非同步情境管理器)" #: ../../glossary.rst:86 msgid "" "An object which controls the environment seen in an :keyword:`async with` " -"statement by defining :meth:`~object.__aenter__` " -"and :meth:`~object.__aexit__` methods. Introduced by :pep:`492`." +"statement by defining :meth:`~object.__aenter__` and :meth:`~object." +"__aexit__` methods. Introduced by :pep:`492`." msgstr "" -"一個可以控制 :keyword:`async with` 陳述式中所見環境的物件,而它是透過定" -"義 :meth:`~object.__aenter__` 和 :meth:`~object.__aexit__` method(方法)來控" -"制的。由 :pep:`492` 引入。" +"一個可以控制 :keyword:`async with` 陳述式中所見環境的物件,而它是透過定義 :" +"meth:`~object.__aenter__` 和 :meth:`~object.__aexit__` method(方法)來控制" +"的。由 :pep:`492` 引入。" #: ../../glossary.rst:89 msgid "asynchronous generator" @@ -217,8 +216,8 @@ msgid "" msgstr "" "一個會回傳 :term:`asynchronous generator iterator`\\ (非同步產生器疊代器)的" "函式。它看起來像一個以 :keyword:`async def` 定義的協程函式 (coroutine " -"function),但不同的是它包含了 :keyword:`yield` 運算式,能生成一系列可用" -"於 :keyword:`async for` 迴圈的值。" +"function),但不同的是它包含了 :keyword:`yield` 運算式,能生成一系列可用於 :" +"keyword:`async for` 迴圈的值。" #: ../../glossary.rst:96 msgid "" @@ -249,15 +248,15 @@ msgstr "" #: ../../glossary.rst:107 msgid "" -"This is an :term:`asynchronous iterator` which when called using " -"the :meth:`~object.__anext__` method returns an awaitable object which will " -"execute the body of the asynchronous generator function until the " -"next :keyword:`yield` expression." +"This is an :term:`asynchronous iterator` which when called using the :meth:" +"`~object.__anext__` method returns an awaitable object which will execute " +"the body of the asynchronous generator function until the next :keyword:" +"`yield` expression." msgstr "" -"這是一個 :term:`asynchronous iterator`\\ (非同步疊代器),當它" -"以 :meth:`~object.__anext__` method 被呼叫時,會回傳一個可等待物件 " -"(awaitable object),該物件將執行非同步產生器的函式主體,直到遇到下一" -"個 :keyword:`yield` 運算式。" +"這是一個 :term:`asynchronous iterator`\\ (非同步疊代器),當它以 :meth:" +"`~object.__anext__` method 被呼叫時,會回傳一個可等待物件 (awaitable " +"object),該物件將執行非同步產生器的函式主體,直到遇到下一個 :keyword:`yield` " +"運算式。" #: ../../glossary.rst:112 msgid "" @@ -268,9 +267,9 @@ msgid "" "off. See :pep:`492` and :pep:`525`." msgstr "" "每個 :keyword:`yield` 會暫停處理程序,並記住執行狀態(包括區域變數及擱置中的 " -"try 陳述式)。當\\ *非同步產生器疊代器*\\ 以另一個" -"被 :meth:`~object.__anext__` 回傳的可等待物件有效地回復時,它會從停止的地方繼" -"續執行。請參閱 :pep:`492` 和 :pep:`525`。" +"try 陳述式)。當\\ *非同步產生器疊代器*\\ 以另一個被 :meth:`~object." +"__anext__` 回傳的可等待物件有效地回復時,它會從停止的地方繼續執行。請參閱 :" +"pep:`492` 和 :pep:`525`。" #: ../../glossary.rst:117 msgid "asynchronous iterable" @@ -282,9 +281,9 @@ msgid "" "return an :term:`asynchronous iterator` from its :meth:`~object.__aiter__` " "method. Introduced by :pep:`492`." msgstr "" -"一個物件,它可以在 :keyword:`async for` 陳述式中被使用。必須從它" -"的 :meth:`~object.__aiter__` method 回傳一個 :term:`asynchronous iterator`\\ " -"(非同步疊代器)。由 :pep:`492` 引入。" +"一個物件,它可以在 :keyword:`async for` 陳述式中被使用。必須從它的 :meth:" +"`~object.__aiter__` method 回傳一個 :term:`asynchronous iterator`\\ (非同步" +"疊代器)。由 :pep:`492` 引入。" #: ../../glossary.rst:122 msgid "asynchronous iterator" @@ -292,18 +291,17 @@ msgstr "asynchronous iterator(非同步疊代器)" #: ../../glossary.rst:124 msgid "" -"An object that implements the :meth:`~object.__aiter__` " -"and :meth:`~object.__anext__` methods. :meth:`~object.__anext__` must " -"return an :term:`awaitable` object. :keyword:`async for` resolves the " -"awaitables returned by an asynchronous iterator's :meth:`~object.__anext__` " -"method until it raises a :exc:`StopAsyncIteration` exception. Introduced " -"by :pep:`492`." +"An object that implements the :meth:`~object.__aiter__` and :meth:`~object." +"__anext__` methods. :meth:`~object.__anext__` must return an :term:" +"`awaitable` object. :keyword:`async for` resolves the awaitables returned by " +"an asynchronous iterator's :meth:`~object.__anext__` method until it raises " +"a :exc:`StopAsyncIteration` exception. Introduced by :pep:`492`." msgstr "" "一個實作 :meth:`~object.__aiter__` 和 :meth:`~object.__anext__` method 的物" "件。:meth:`~object.__anext__` 必須回傳一個 :term:`awaitable`\\ (可等待物" "件)。:keyword:`async for` 會解析非同步疊代器的 :meth:`~object.__anext__` " -"method 所回傳的可等待物件,直到它引發 :exc:`StopAsyncIteration` 例外。" -"由 :pep:`492` 引入。" +"method 所回傳的可等待物件,直到它引發 :exc:`StopAsyncIteration` 例外。由 :" +"pep:`492` 引入。" #: ../../glossary.rst:129 msgid "attribute" @@ -321,10 +319,10 @@ msgstr "" #: ../../glossary.rst:136 msgid "" "It is possible to give an object an attribute whose name is not an " -"identifier as defined by :ref:`identifiers`, for example " -"using :func:`setattr`, if the object allows it. Such an attribute will not " -"be accessible using a dotted expression, and would instead need to be " -"retrieved with :func:`getattr`." +"identifier as defined by :ref:`identifiers`, for example using :func:" +"`setattr`, if the object allows it. Such an attribute will not be accessible " +"using a dotted expression, and would instead need to be retrieved with :func:" +"`getattr`." msgstr "" "如果一個物件允許,給予該物件一個名稱不是由\\ :ref:`identifiers`\\ 所定義之識" "別符 (identifier) 的屬性是有可能的,例如使用 :func:`setattr`。像這樣的屬性將" @@ -336,13 +334,13 @@ msgstr "awaitable(可等待物件)" #: ../../glossary.rst:143 msgid "" -"An object that can be used in an :keyword:`await` expression. Can be " -"a :term:`coroutine` or an object with an :meth:`~object.__await__` method. " -"See also :pep:`492`." +"An object that can be used in an :keyword:`await` expression. Can be a :" +"term:`coroutine` or an object with an :meth:`~object.__await__` method. See " +"also :pep:`492`." msgstr "" -"一個可以在 :keyword:`await` 運算式中被使用的物件。它可以是一" -"個 :term:`coroutine`\\ (協程),或是一個有 :meth:`~object.__await__` method " -"的物件。另請參閱 :pep:`492`。" +"一個可以在 :keyword:`await` 運算式中被使用的物件。它可以是一個 :term:" +"`coroutine`\\ (協程),或是一個有 :meth:`~object.__await__` method 的物件。" +"另請參閱 :pep:`492`。" #: ../../glossary.rst:146 msgid "BDFL" @@ -350,8 +348,8 @@ msgstr "BDFL" #: ../../glossary.rst:148 msgid "" -"Benevolent Dictator For Life, a.k.a. `Guido van Rossum `_, Python's creator." +"Benevolent Dictator For Life, a.k.a. `Guido van Rossum `_, Python's creator." msgstr "" "Benevolent Dictator For Life(終身仁慈獨裁者),又名 `Guido van Rossum " "`_,Python 的創造者。" @@ -364,23 +362,23 @@ msgstr "binary file(二進位檔案)" msgid "" "A :term:`file object` able to read and write :term:`bytes-like objects " "`. Examples of binary files are files opened in binary " -"mode (``'rb'``, ``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer " -"`, :data:`sys.stdout.buffer `, and instances " -"of :class:`io.BytesIO` and :class:`gzip.GzipFile`." +"mode (``'rb'``, ``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer `, :data:`sys.stdout.buffer `, and instances of :class:`io." +"BytesIO` and :class:`gzip.GzipFile`." msgstr "" "一個能夠讀取和寫入 :term:`bytes-like objects `\\ (類位元" "組串物件)的 :term:`file object`\\ (檔案物件)。二進位檔案的例子有:以二進位" "模式(``'rb'``、``'wb'`` 或 ``'rb+'``)開啟的檔案、:data:`sys.stdin.buffer " -"`、:data:`sys.stdout.buffer `,以" -"及 :class:`io.BytesIO` 和 :class:`gzip.GzipFile` 實例。" +"`、:data:`sys.stdout.buffer `,以及 :class:`io." +"BytesIO` 和 :class:`gzip.GzipFile` 實例。" #: ../../glossary.rst:159 msgid "" -"See also :term:`text file` for a file object able to read and " -"write :class:`str` objects." +"See also :term:`text file` for a file object able to read and write :class:" +"`str` objects." msgstr "" -"另請參閱 :term:`text file`\\ (文字檔案),它是一個能夠讀取和寫" -"入 :class:`str` 物件的檔案物件。" +"另請參閱 :term:`text file`\\ (文字檔案),它是一個能夠讀取和寫入 :class:" +"`str` 物件的檔案物件。" #: ../../glossary.rst:161 msgid "borrowed reference" @@ -402,8 +400,8 @@ msgstr "" msgid "" "Calling :c:func:`Py_INCREF` on the :term:`borrowed reference` is recommended " "to convert it to a :term:`strong reference` in-place, except when the object " -"cannot be destroyed before the last usage of the borrowed reference. " -"The :c:func:`Py_NewRef` function can be used to create a new :term:`strong " +"cannot be destroyed before the last usage of the borrowed reference. The :c:" +"func:`Py_NewRef` function can be used to create a new :term:`strong " "reference`." msgstr "" "對 :term:`borrowed reference` 呼叫 :c:func:`Py_INCREF` 以將它原地 (in-place) " @@ -417,12 +415,12 @@ msgstr "bytes-like object(類位元組串物件)" #: ../../glossary.rst:176 msgid "" -"An object that supports the :ref:`bufferobjects` and can export a " -"C-:term:`contiguous` buffer. This includes " -"all :class:`bytes`, :class:`bytearray`, and :class:`array.array` objects, as " -"well as many common :class:`memoryview` objects. Bytes-like objects can be " -"used for various operations that work with binary data; these include " -"compression, saving to a binary file, and sending over a socket." +"An object that supports the :ref:`bufferobjects` and can export a C-:term:" +"`contiguous` buffer. This includes all :class:`bytes`, :class:`bytearray`, " +"and :class:`array.array` objects, as well as many common :class:`memoryview` " +"objects. Bytes-like objects can be used for various operations that work " +"with binary data; these include compression, saving to a binary file, and " +"sending over a socket." msgstr "" "一個支援\\ :ref:`bufferobjects`\\ 且能夠匯出 C-:term:`contiguous` 緩衝區的物" "件。這包括所有的 :class:`bytes`、:class:`bytearray` 和 :class:`array.array` " @@ -433,9 +431,9 @@ msgstr "" msgid "" "Some operations need the binary data to be mutable. The documentation often " "refers to these as \"read-write bytes-like objects\". Example mutable " -"buffer objects include :class:`bytearray` and a :class:`memoryview` of " -"a :class:`bytearray`. Other operations require the binary data to be stored " -"in immutable objects (\"read-only bytes-like objects\"); examples of these " +"buffer objects include :class:`bytearray` and a :class:`memoryview` of a :" +"class:`bytearray`. Other operations require the binary data to be stored in " +"immutable objects (\"read-only bytes-like objects\"); examples of these " "include :class:`bytes` and a :class:`memoryview` of a :class:`bytes` object." msgstr "" "有些運算需要二進位資料是可變的。說明文件通常會將這些物件稱為「可讀寫的類位元" @@ -469,8 +467,8 @@ msgstr "" #: ../../glossary.rst:203 msgid "" -"A list of bytecode instructions can be found in the documentation " -"for :ref:`the dis module `." +"A list of bytecode instructions can be found in the documentation for :ref:" +"`the dis module `." msgstr "" "位元組碼的指令列表可以在 :ref:`dis 模組 `\\ 的說明文件中找到。" @@ -483,8 +481,8 @@ msgid "" "A callable is an object that can be called, possibly with a set of arguments " "(see :term:`argument`), with the following syntax::" msgstr "" -"一個 callable 是可以被呼叫的物件,呼叫時可能以下列形式帶有一組引數(請" -"見 :term:`argument`): ::" +"一個 callable 是可以被呼叫的物件,呼叫時可能以下列形式帶有一組引數(請見 :" +"term:`argument`): ::" #: ../../glossary.rst:210 msgid "callable(argument1, argument2, argumentN)" @@ -496,8 +494,8 @@ msgid "" "instance of a class that implements the :meth:`~object.__call__` method is " "also a callable." msgstr "" -"一個 :term:`function` 與其延伸的 :term:`method` 都是 callable。一個有實" -"作 :meth:`~object.__call__` 方法的 class 之實例也是個 callable。" +"一個 :term:`function` 與其延伸的 :term:`method` 都是 callable。一個有實作 :" +"meth:`~object.__call__` 方法的 class 之實例也是個 callable。" #: ../../glossary.rst:215 msgid "callback" @@ -542,9 +540,9 @@ msgstr "closure variable(閉包變數)" msgid "" "A :term:`free variable` referenced from a :term:`nested scope` that is " "defined in an outer scope rather than being resolved at runtime from the " -"globals or builtin namespaces. May be explicitly defined with " -"the :keyword:`nonlocal` keyword to allow write access, or implicitly defined " -"if the variable is only being read." +"globals or builtin namespaces. May be explicitly defined with the :keyword:" +"`nonlocal` keyword to allow write access, or implicitly defined if the " +"variable is only being read." msgstr "" "從外部作用域中定義且從\\ :term:`巢狀作用域 `\\ 參照的\\ :term:`" "自由變數 `,不是於 runtime 從全域或內建命名空間解析。可以使" @@ -609,10 +607,10 @@ msgstr "" "一個我們熟悉的實數系統的擴充,在此所有數字都會被表示為一個實部和一個虛部之" "和。虛數就是虛數單位(``-1`` 的平方根)的實數倍,此單位通常在數學中被寫為 " "``i``,在工程學中被寫為 ``j``。Python 內建了對複數的支援,它是用後者的記法來" -"表示複數;虛部會帶著一個後綴的 ``j`` 被編寫,例如 ``3+1j``。若要" -"將 :mod:`math` 模組內的工具等效地用於複數,請使用 :mod:`cmath` 模組。複數的使" -"用是一個相當進階的數學功能。如果你沒有察覺到對它們的需求,那麼幾乎能確定你可" -"以安全地忽略它們。" +"表示複數;虛部會帶著一個後綴的 ``j`` 被編寫,例如 ``3+1j``。若要將 :mod:" +"`math` 模組內的工具等效地用於複數,請使用 :mod:`cmath` 模組。複數的使用是一個" +"相當進階的數學功能。如果你沒有察覺到對它們的需求,那麼幾乎能確定你可以安全地" +"忽略它們。" #: ../../glossary.rst:262 msgid "context" @@ -632,10 +630,9 @@ msgstr "" #: ../../glossary.rst:269 msgid "" -"The collection of key­value bindings associated with a " -"particular :class:`contextvars.Context` object and accessed " -"via :class:`~contextvars.ContextVar` objects. Also see :term:`context " -"variable`." +"The collection of key­value bindings associated with a particular :class:" +"`contextvars.Context` object and accessed via :class:`~contextvars." +"ContextVar` objects. Also see :term:`context variable`." msgstr "" #: ../../glossary.rst:273 @@ -653,8 +650,8 @@ msgid "" "The :meth:`~object.__enter__` and :meth:`~object.__exit__` methods called by " "the :keyword:`with` statement. See :pep:`343`." msgstr "" -"由 :keyword:`with` 陳述式所呼叫的 :meth:`~object.__enter__` " -"和 :meth:`~object.__exit__` 方法。另請參閱 :pep:`343`。" +"由 :keyword:`with` 陳述式所呼叫的 :meth:`~object.__enter__` 和 :meth:" +"`~object.__exit__` 方法。另請參閱 :pep:`343`。" #: ../../glossary.rst:279 msgid "context manager" @@ -663,8 +660,8 @@ msgstr "context manager(情境管理器)" #: ../../glossary.rst:281 msgid "" "An object which implements the :term:`context management protocol` and " -"controls the environment seen in a :keyword:`with` statement. " -"See :pep:`343`." +"controls the environment seen in a :keyword:`with` statement. See :pep:" +"`343`." msgstr "" #: ../../glossary.rst:284 @@ -722,14 +719,13 @@ msgstr "coroutine function(協程函式)" #: ../../glossary.rst:311 msgid "" "A function which returns a :term:`coroutine` object. A coroutine function " -"may be defined with the :keyword:`async def` statement, and may " -"contain :keyword:`await`, :keyword:`async for`, and :keyword:`async with` " -"keywords. These were introduced by :pep:`492`." +"may be defined with the :keyword:`async def` statement, and may contain :" +"keyword:`await`, :keyword:`async for`, and :keyword:`async with` keywords. " +"These were introduced by :pep:`492`." msgstr "" -"一個回傳 :term:`coroutine`\\ (協程)物件的函式。一個協程函式能" -"以 :keyword:`async def` 陳述式被定義,並可能會包" -"含 :keyword:`await`、:keyword:`async for` 和 :keyword:`async with` 關鍵字。這" -"些關鍵字由 :pep:`492` 引入。" +"一個回傳 :term:`coroutine`\\ (協程)物件的函式。一個協程函式能以 :keyword:" +"`async def` 陳述式被定義,並可能會包含 :keyword:`await`、:keyword:`async " +"for` 和 :keyword:`async with` 關鍵字。這些關鍵字由 :pep:`492` 引入。" #: ../../glossary.rst:316 msgid "CPython" @@ -755,9 +751,9 @@ msgid "" "The :term:`context` (:class:`contextvars.Context` object) that is currently " "used by :class:`~contextvars.ContextVar` objects to access (get or set) the " "values of :term:`context variables `. Each thread has its " -"own current context. Frameworks for executing asynchronous tasks " -"(see :mod:`asyncio`) associate each task with a context which becomes the " -"current context whenever the task starts or resumes execution." +"own current context. Frameworks for executing asynchronous tasks (see :mod:" +"`asyncio`) associate each task with a context which becomes the current " +"context whenever the task starts or resumes execution." msgstr "" #: ../../glossary.rst:330 @@ -804,8 +800,8 @@ msgid "" "the documentation for :ref:`function definitions ` and :ref:`class " "definitions ` for more about decorators." msgstr "" -"Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱" -"\\ :ref:`函式定義 `\\ 和 :ref:`class 定義 `\\ 的說明文件。" +"Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱\\ :" +"ref:`函式定義 `\\ 和 :ref:`class 定義 `\\ 的說明文件。" #: ../../glossary.rst:350 msgid "descriptor" @@ -813,24 +809,23 @@ msgstr "descriptor(描述器)" #: ../../glossary.rst:352 msgid "" -"Any object which defines the " -"methods :meth:`~object.__get__`, :meth:`~object.__set__`, " -"or :meth:`~object.__delete__`. When a class attribute is a descriptor, its " -"special binding behavior is triggered upon attribute lookup. Normally, " -"using *a.b* to get, set or delete an attribute looks up the object named *b* " -"in the class dictionary for *a*, but if *b* is a descriptor, the respective " -"descriptor method gets called. Understanding descriptors is a key to a deep " -"understanding of Python because they are the basis for many features " -"including functions, methods, properties, class methods, static methods, and " -"reference to super classes." -msgstr "" -"任何定義了 :meth:`~object.__get__`、:meth:`~object.__set__` " -"或 :meth:`~object.__delete__` method 的物件。當一個 class 屬性是一個描述器" -"時,它的特殊連結行為會在屬性查找時被觸發。通常,使用 *a.b* 來取得、設定或刪除" -"某個屬性時,會在 *a* 的 class 字典中查找名稱為 *b* 的物件,但如果 *b* 是一個" -"描述器,則相對應的描述器 method 會被呼叫。對描述器的理解是深入理解 Python 的" -"關鍵,因為它們是許多功能的基礎,這些功能包括函式、method、屬性 (property)、" -"class method、靜態 method,以及對 super class(父類別)的參照。" +"Any object which defines the methods :meth:`~object.__get__`, :meth:`~object." +"__set__`, or :meth:`~object.__delete__`. When a class attribute is a " +"descriptor, its special binding behavior is triggered upon attribute " +"lookup. Normally, using *a.b* to get, set or delete an attribute looks up " +"the object named *b* in the class dictionary for *a*, but if *b* is a " +"descriptor, the respective descriptor method gets called. Understanding " +"descriptors is a key to a deep understanding of Python because they are the " +"basis for many features including functions, methods, properties, class " +"methods, static methods, and reference to super classes." +msgstr "" +"任何定義了 :meth:`~object.__get__`、:meth:`~object.__set__` 或 :meth:" +"`~object.__delete__` method 的物件。當一個 class 屬性是一個描述器時,它的特殊" +"連結行為會在屬性查找時被觸發。通常,使用 *a.b* 來取得、設定或刪除某個屬性時," +"會在 *a* 的 class 字典中查找名稱為 *b* 的物件,但如果 *b* 是一個描述器,則相" +"對應的描述器 method 會被呼叫。對描述器的理解是深入理解 Python 的關鍵,因為它" +"們是許多功能的基礎,這些功能包括函式、method、屬性 (property)、class method、" +"靜態 method,以及對 super class(父類別)的參照。" #: ../../glossary.rst:363 msgid "" @@ -875,11 +870,11 @@ msgstr "dictionary view(字典檢視)" #: ../../glossary.rst:379 msgid "" -"The objects returned from :meth:`dict.keys`, :meth:`dict.values`, " -"and :meth:`dict.items` are called dictionary views. They provide a dynamic " -"view on the dictionary’s entries, which means that when the dictionary " -"changes, the view reflects these changes. To force the dictionary view to " -"become a full list use ``list(dictview)``. See :ref:`dict-views`." +"The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:" +"`dict.items` are called dictionary views. They provide a dynamic view on the " +"dictionary’s entries, which means that when the dictionary changes, the view " +"reflects these changes. To force the dictionary view to become a full list " +"use ``list(dictview)``. See :ref:`dict-views`." msgstr "" "從 :meth:`dict.keys`、:meth:`dict.values` 及 :meth:`dict.items` 回傳的物件被" "稱為字典檢視。它們提供了字典中項目的動態檢視,這表示當字典有變動時,該檢視會" @@ -899,9 +894,9 @@ msgid "" "introspection, it is the canonical place for documentation of the object." msgstr "" "一個在 class、函式或模組中,作為第一個運算式出現的字串文本。雖然它在套件執行" -"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組" -"的 :attr:`~definition.__doc__` 屬性中。由於說明字串可以透過內省 " -"(introspection) 來瀏覽,因此它是物件的說明文件存放的標準位置。" +"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組的 :attr:" +"`~definition.__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏" +"覽,因此它是物件的說明文件存放的標準位置。" #: ../../glossary.rst:393 msgid "duck-typing" @@ -914,10 +909,10 @@ msgid "" "called or used (\"If it looks like a duck and quacks like a duck, it must be " "a duck.\") By emphasizing interfaces rather than specific types, well-" "designed code improves its flexibility by allowing polymorphic " -"substitution. Duck-typing avoids tests using :func:`type` " -"or :func:`isinstance`. (Note, however, that duck-typing can be complemented " -"with :term:`abstract base classes `.) Instead, it " -"typically employs :func:`hasattr` tests or :term:`EAFP` programming." +"substitution. Duck-typing avoids tests using :func:`type` or :func:" +"`isinstance`. (Note, however, that duck-typing can be complemented with :" +"term:`abstract base classes `.) Instead, it typically " +"employs :func:`hasattr` tests or :term:`EAFP` programming." msgstr "" "一種程式設計風格,它不是藉由檢查一個物件的型別來確定它是否具有正確的介面;取" "而代之的是,method 或屬性會單純地被呼叫或使用。(「如果它看起來像一隻鴨子而且" @@ -943,9 +938,9 @@ msgid "" msgstr "" "Easier to ask for forgiveness than permission.(請求寬恕比請求許可更容易。)" "這種常見的 Python 編碼風格會先假設有效的鍵或屬性的存在,並在該假設被推翻時再" -"捕獲例外。這種乾淨且快速的風格,其特色是存在許多的 :keyword:`try` " -"和 :keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見" -"的 :term:`LBYL` 風格形成了對比。" +"捕獲例外。這種乾淨且快速的風格,其特色是存在許多的 :keyword:`try` 和 :" +"keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見的 :term:`LBYL` 風" +"格形成了對比。" #: ../../glossary.rst:412 msgid "expression" @@ -1019,10 +1014,9 @@ msgid "" "The canonical way to create a file object is by using the :func:`open` " "function." msgstr "" -"實際上,有三種檔案物件:原始的\\ :term:`二進位檔案 `、緩衝的" -"\\ :term:`二進位檔案 `\\ 和\\ :term:`文字檔案 `。它們" -"的介面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:`open` 函" -"式。" +"實際上,有三種檔案物件:原始的\\ :term:`二進位檔案 `、緩衝的\\ :" +"term:`二進位檔案 `\\ 和\\ :term:`文字檔案 `。它們的介" +"面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:`open` 函式。" #: ../../glossary.rst:445 msgid "file-like object" @@ -1055,9 +1049,9 @@ msgstr "" #: ../../glossary.rst:457 msgid "" -"The :func:`sys.getfilesystemencoding` " -"and :func:`sys.getfilesystemencodeerrors` functions can be used to get the " -"filesystem encoding and error handler." +"The :func:`sys.getfilesystemencoding` and :func:`sys." +"getfilesystemencodeerrors` functions can be used to get the filesystem " +"encoding and error handler." msgstr "" ":func:`sys.getfilesystemencoding` 和 :func:`sys.getfilesystemencodeerrors` 函" "式可用於取得檔案系統編碼和錯誤處理函式。" @@ -1065,14 +1059,14 @@ msgstr "" #: ../../glossary.rst:461 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " -"startup by the :c:func:`PyConfig_Read` function: " -"see :c:member:`~PyConfig.filesystem_encoding` " -"and :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." +"startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." +"filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :" +"c:type:`PyConfig`." msgstr "" ":term:`filesystem encoding and error handler`\\ (檔案系統編碼和錯誤處理函" -"式)會在 Python 啟動時由 :c:func:`PyConfig_Read` 函式來配置:請參" -"閱 :c:member:`~PyConfig.filesystem_encoding`,以及 :c:type:`PyConfig` 的成" -"員 :c:member:`~PyConfig.filesystem_errors`。" +"式)會在 Python 啟動時由 :c:func:`PyConfig_Read` 函式來配置:請參閱 :c:" +"member:`~PyConfig.filesystem_encoding`,以及 :c:type:`PyConfig` 的成員 :c:" +"member:`~PyConfig.filesystem_errors`。" #: ../../glossary.rst:466 msgid "See also the :term:`locale encoding`." @@ -1128,8 +1122,8 @@ msgstr "free threading(自由執行緒)" #: ../../glossary.rst:486 msgid "" "A threading model where multiple threads can run Python bytecode " -"simultaneously within the same interpreter. This is in contrast to " -"the :term:`global interpreter lock` which allows only one thread to execute " +"simultaneously within the same interpreter. This is in contrast to the :" +"term:`global interpreter lock` which allows only one thread to execute " "Python bytecode at a time. See :pep:`703`." msgstr "" "為一種執行緒模型,多個執行緒可以在同一直譯器中同時運行 Python 位元組碼。這與" @@ -1158,13 +1152,13 @@ msgstr "function(函式)" msgid "" "A series of statements which returns some value to a caller. It can also be " "passed zero or more :term:`arguments ` which may be used in the " -"execution of the body. See also :term:`parameter`, :term:`method`, and " -"the :ref:`function` section." +"execution of the body. See also :term:`parameter`, :term:`method`, and the :" +"ref:`function` section." msgstr "" "一連串的陳述式,它能夠向呼叫者回傳一些值。它也可以被傳遞零個或多個\\ :term:`" -"引數 `,這些引數可被使用於函式本體的執行。另請參" -"閱 :term:`parameter`\\ (參數)、:term:`method`\\ (方法),以及" -"\\ :ref:`function`\\ 章節。" +"引數 `,這些引數可被使用於函式本體的執行。另請參閱 :term:" +"`parameter`\\ (參數)、:term:`method`\\ (方法),以及\\ :ref:`function`\\ " +"章節。" #: ../../glossary.rst:503 msgid "function annotation" @@ -1212,8 +1206,8 @@ msgstr "__future__" msgid "" "A :ref:`future statement `, ``from __future__ import ``, " "directs the compiler to compile the current module using syntax or semantics " -"that will become standard in a future release of Python. " -"The :mod:`__future__` module documents the possible values of *feature*. By " +"that will become standard in a future release of Python. The :mod:" +"`__future__` module documents the possible values of *feature*. By " "importing this module and evaluating its variables, you can see when a new " "feature was first added to the language and when it will (or did) become the " "default::" @@ -1332,11 +1326,11 @@ msgstr "" #: ../../glossary.rst:578 msgid "" -"See also the :term:`single dispatch` glossary entry, " -"the :func:`functools.singledispatch` decorator, and :pep:`443`." +"See also the :term:`single dispatch` glossary entry, the :func:`functools." +"singledispatch` decorator, and :pep:`443`." msgstr "" -"另請參閱 :term:`single dispatch`\\ (單一調度)術語表條" -"目、:func:`functools.singledispatch` 裝飾器和 :pep:`443`。" +"另請參閱 :term:`single dispatch`\\ (單一調度)術語表條目、:func:`functools." +"singledispatch` 裝飾器和 :pep:`443`。" #: ../../glossary.rst:580 msgid "generic type" @@ -1345,21 +1339,20 @@ msgstr "generic type(泛型型別)" #: ../../glossary.rst:582 msgid "" "A :term:`type` that can be parameterized; typically a :ref:`container " -"class` such as :class:`list` or :class:`dict`. Used " -"for :term:`type hints ` and :term:`annotations `." +"class` such as :class:`list` or :class:`dict`. Used for :" +"term:`type hints ` and :term:`annotations `." msgstr "" -"一個能夠被參數化 (parameterized) 的 :term:`type`\\ (型別);通常是一" -"個 :ref:`容器型別 `,像是 :class:`list` 和 :class:`dict`。它" -"被用於\\ :term:`型別提示 `\\ 和\\ :term:`註釋 `。" +"一個能夠被參數化 (parameterized) 的 :term:`type`\\ (型別);通常是一個 :ref:" +"`容器型別 `,像是 :class:`list` 和 :class:`dict`。它被用於" +"\\ :term:`型別提示 `\\ 和\\ :term:`註釋 `。" #: ../../glossary.rst:587 msgid "" -"For more details, see :ref:`generic alias types`, :pep:`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` " -"module." +"For more details, see :ref:`generic alias types`, :pep:" +"`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module." msgstr "" -"詳情請參閱\\ :ref:`泛型別名型別 `、:pep:`483`、:pep:`484`、:pep:`585` 和 :mod:`typing` 模組。" +"詳情請參閱\\ :ref:`泛型別名型別 `、:pep:`483`、:pep:" +"`484`、:pep:`585` 和 :mod:`typing` 模組。" #: ../../glossary.rst:589 msgid "GIL" @@ -1440,10 +1433,10 @@ msgid "" "compared to other objects (it needs an :meth:`~object.__eq__` method). " "Hashable objects which compare equal must have the same hash value." msgstr "" -"如果一個物件有一個雜湊值,該值在其生命週期中永不改變(它需要一" -"個 :meth:`~object.__hash__` method),且可與其他物件互相比較(它需要一" -"個 :meth:`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結" -"果為相等的多個可雜湊物件,它們必須擁有相同的雜湊值。" +"如果一個物件有一個雜湊值,該值在其生命週期中永不改變(它需要一個 :meth:" +"`~object.__hash__` method),且可與其他物件互相比較(它需要一個 :meth:" +"`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結果為相等的" +"多個可雜湊物件,它們必須擁有相同的雜湊值。" #: ../../glossary.rst:627 msgid "" @@ -1488,8 +1481,8 @@ msgstr "immortal(不滅)" #: ../../glossary.rst:644 msgid "" -"*Immortal objects* are a CPython implementation detail introduced " -"in :pep:`683`." +"*Immortal objects* are a CPython implementation detail introduced in :pep:" +"`683`." msgstr "*不滅物件 (Immortal objects)* 是 :pep:`683` 引入的 CPython 實作細節。" #: ../../glossary.rst:647 @@ -1499,8 +1492,8 @@ msgid "" "example, :const:`True` and :const:`None` are immortal in CPython." msgstr "" "如果一個物件是不滅的,它的\\ :term:`參照計數 `\\ 永遠不會被" -"修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` " -"和 :const:`None` 在 CPython 中是不滅的。" +"修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` 和 :const:" +"`None` 在 CPython 中是不滅的。" #: ../../glossary.rst:650 msgid "immutable" @@ -1552,11 +1545,11 @@ msgstr "importer(引入器)" #: ../../glossary.rst:670 msgid "" -"An object that both finds and loads a module; both a :term:`finder` " -"and :term:`loader` object." +"An object that both finds and loads a module; both a :term:`finder` and :" +"term:`loader` object." msgstr "" -"一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也" -"是 :term:`loader`\\ (載入器)物件。" +"一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也是 :term:" +"`loader`\\ (載入器)物件。" #: ../../glossary.rst:672 msgid "interactive" @@ -1602,12 +1595,12 @@ msgstr "interpreter shutdown(直譯器關閉)" msgid "" "When asked to shut down, the Python interpreter enters a special phase where " "it gradually releases all allocated resources, such as modules and various " -"critical internal structures. It also makes several calls to " -"the :term:`garbage collector `. This can trigger the " -"execution of code in user-defined destructors or weakref callbacks. Code " -"executed during the shutdown phase can encounter various exceptions as the " -"resources it relies on may not function anymore (common examples are library " -"modules or the warnings machinery)." +"critical internal structures. It also makes several calls to the :term:" +"`garbage collector `. This can trigger the execution of " +"code in user-defined destructors or weakref callbacks. Code executed during " +"the shutdown phase can encounter various exceptions as the resources it " +"relies on may not function anymore (common examples are library modules or " +"the warnings machinery)." msgstr "" "當 Python 直譯器被要求關閉時,它會進入一個特殊階段,在此它逐漸釋放所有被配置" "的資源,例如模組和各種關鍵內部結構。它也會多次呼叫\\ :term:`垃圾回收器 " @@ -1628,42 +1621,41 @@ msgid "iterable" msgstr "iterable(可疊代物件)" #: ../../glossary.rst:705 +#, fuzzy msgid "" "An object capable of returning its members one at a time. Examples of " "iterables include all sequence types (such as :class:`list`, :class:`str`, " -"and :class:`tuple`) and some non-sequence types " -"like :class:`dict`, :term:`file objects `, and objects of any " -"classes you define with an :meth:`~iterator.__iter__` method or with " -"a :meth:`~object.__getitem__` method that implements :term:`sequence` " -"semantics." +"and :class:`tuple`) and some non-sequence types like :class:`dict`, :term:" +"`file objects `, and objects of any classes you define with an :" +"meth:`~object.__iter__` method or with a :meth:`~object.__getitem__` method " +"that implements :term:`sequence` semantics." msgstr "" "一種能夠一次回傳一個其中成員的物件。可疊代物件的例子包括所有的序列型別(像" -"是 :class:`list`、:class:`str` 和 :class:`tuple`\\ )和某些非序列型別,像" -"是 :class:`dict`、:term:`檔案物件 `,以及你所定義的任何 class 物" -"件,只要那些 class 有 :meth:`~iterator.__iter__` method 或是實" -"作 :term:`sequence`\\ (序列)語意的 :meth:`~object.__getitem__` method,該物" -"件就是可疊代物件。" +"是 :class:`list`、:class:`str` 和 :class:`tuple`\\ )和某些非序列型別,像是 :" +"class:`dict`、:term:`檔案物件 `,以及你所定義的任何 class 物件," +"只要那些 class 有 :meth:`~iterator.__iter__` method 或是實作 :term:" +"`sequence`\\ (序列)語意的 :meth:`~object.__getitem__` method,該物件就是可" +"疊代物件。" #: ../../glossary.rst:713 msgid "" "Iterables can be used in a :keyword:`for` loop and in many other places " "where a sequence is needed (:func:`zip`, :func:`map`, ...). When an " -"iterable object is passed as an argument to the built-in " -"function :func:`iter`, it returns an iterator for the object. This iterator " -"is good for one pass over the set of values. When using iterables, it is " -"usually not necessary to call :func:`iter` or deal with iterator objects " -"yourself. The :keyword:`for` statement does that automatically for you, " -"creating a temporary unnamed variable to hold the iterator for the duration " -"of the loop. See also :term:`iterator`, :term:`sequence`, " -"and :term:`generator`." -msgstr "" -"可疊代物件可用於 :keyword:`for` 迴圈和許多其他需要一個序列的地方 " -"(:func:`zip`、:func:`map`\\ ...)。當一個可疊代物件作為引數被傳遞給內建函" -"式 :func:`iter` 時,它會為該物件回傳一個疊代器。此疊代器適用於針對一組值進行" -"一遍 (one pass) 運算。使用疊代器時,通常不一定要呼叫 :func:`iter` 或自行處理" -"疊代器物件。:keyword:`for` 陳述式會自動地為你處理這些事,它會建立一個暫時性的" -"未命名變數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代" -"器)、:term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" +"iterable object is passed as an argument to the built-in function :func:" +"`iter`, it returns an iterator for the object. This iterator is good for " +"one pass over the set of values. When using iterables, it is usually not " +"necessary to call :func:`iter` or deal with iterator objects yourself. The :" +"keyword:`for` statement does that automatically for you, creating a " +"temporary unnamed variable to hold the iterator for the duration of the " +"loop. See also :term:`iterator`, :term:`sequence`, and :term:`generator`." +msgstr "" +"可疊代物件可用於 :keyword:`for` 迴圈和許多其他需要一個序列的地方 (:func:" +"`zip`、:func:`map`\\ ...)。當一個可疊代物件作為引數被傳遞給內建函式 :func:" +"`iter` 時,它會為該物件回傳一個疊代器。此疊代器適用於針對一組值進行一遍 (one " +"pass) 運算。使用疊代器時,通常不一定要呼叫 :func:`iter` 或自行處理疊代器物" +"件。:keyword:`for` 陳述式會自動地為你處理這些事,它會建立一個暫時性的未命名變" +"數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代器)、:" +"term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" #: ../../glossary.rst:723 msgid "iterator" @@ -1671,33 +1663,32 @@ msgstr "iterator(疊代器)" #: ../../glossary.rst:725 msgid "" -"An object representing a stream of data. Repeated calls to the " -"iterator's :meth:`~iterator.__next__` method (or passing it to the built-in " -"function :func:`next`) return successive items in the stream. When no more " -"data are available a :exc:`StopIteration` exception is raised instead. At " -"this point, the iterator object is exhausted and any further calls to " -"its :meth:`!__next__` method just raise :exc:`StopIteration` again. " -"Iterators are required to have an :meth:`~iterator.__iter__` method that " -"returns the iterator object itself so every iterator is also iterable and " -"may be used in most places where other iterables are accepted. One notable " -"exception is code which attempts multiple iteration passes. A container " -"object (such as a :class:`list`) produces a fresh new iterator each time you " -"pass it to the :func:`iter` function or use it in a :keyword:`for` loop. " -"Attempting this with an iterator will just return the same exhausted " -"iterator object used in the previous iteration pass, making it appear like " -"an empty container." +"An object representing a stream of data. Repeated calls to the iterator's :" +"meth:`~iterator.__next__` method (or passing it to the built-in function :" +"func:`next`) return successive items in the stream. When no more data are " +"available a :exc:`StopIteration` exception is raised instead. At this " +"point, the iterator object is exhausted and any further calls to its :meth:`!" +"__next__` method just raise :exc:`StopIteration` again. Iterators are " +"required to have an :meth:`~iterator.__iter__` method that returns the " +"iterator object itself so every iterator is also iterable and may be used in " +"most places where other iterables are accepted. One notable exception is " +"code which attempts multiple iteration passes. A container object (such as " +"a :class:`list`) produces a fresh new iterator each time you pass it to the :" +"func:`iter` function or use it in a :keyword:`for` loop. Attempting this " +"with an iterator will just return the same exhausted iterator object used in " +"the previous iteration pass, making it appear like an empty container." msgstr "" "一個表示資料流的物件。重複地呼叫疊代器的 :meth:`~iterator.__next__` method" "(或是將它傳遞給內建函式 :func:`next`\\ )會依序回傳資料流中的各項目。當不再" "有資料時,則會引發 :exc:`StopIteration` 例外。此時,該疊代器物件已被用盡,而" -"任何對其 :meth:`!__next__` method 的進一步呼叫,都只會再次引" -"發 :exc:`StopIteration`。疊代器必須有一個 :meth:`~iterator.__iter__` method," -"它會回傳疊代器物件本身,所以每個疊代器也都是可疊代物件,且可以用於大多數適用" -"其他可疊代物件的場合。一個明顯的例外,是嘗試多遍疊代 (multiple iteration " -"passes) 的程式碼。一個容器物件(像是 :class:`list`)在每次你將它傳遞" -"給 :func:`iter` 函式或在 :keyword:`for` 迴圈中使用它時,都會產生一個全新的疊" -"代器。使用疊代器嘗試此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一" -"個已被用盡的疊代器物件,使其看起來就像一個空的容器。" +"任何對其 :meth:`!__next__` method 的進一步呼叫,都只會再次引發 :exc:" +"`StopIteration`。疊代器必須有一個 :meth:`~iterator.__iter__` method,它會回傳" +"疊代器物件本身,所以每個疊代器也都是可疊代物件,且可以用於大多數適用其他可疊" +"代物件的場合。一個明顯的例外,是嘗試多遍疊代 (multiple iteration passes) 的程" +"式碼。一個容器物件(像是 :class:`list`)在每次你將它傳遞給 :func:`iter` 函式" +"或在 :keyword:`for` 迴圈中使用它時,都會產生一個全新的疊代器。使用疊代器嘗試" +"此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一個已被用盡的疊代器物" +"件,使其看起來就像一個空的容器。" #: ../../glossary.rst:740 msgid "More information can be found in :ref:`typeiter`." @@ -1705,14 +1696,13 @@ msgstr "在\\ :ref:`typeiter`\\ 文中可以找到更多資訊。" #: ../../glossary.rst:744 msgid "" -"CPython does not consistently apply the requirement that an iterator " -"define :meth:`~iterator.__iter__`. And also please note that the free-" -"threading CPython does not guarantee the thread-safety of iterator " -"operations." +"CPython does not consistently apply the requirement that an iterator define :" +"meth:`~iterator.__iter__`. And also please note that the free-threading " +"CPython does not guarantee the thread-safety of iterator operations." msgstr "" -"CPython 並不是始終如一地都會檢查「疊代器有定" -"義 :meth:`~iterator.__iter__`\\ 」這個規定。另請注意,free-threading(自由執" -"行緒)CPython 不保證疊代器操作的執行緒安全。" +"CPython 並不是始終如一地都會檢查「疊代器有定義 :meth:`~iterator." +"__iter__`\\ 」這個規定。另請注意,free-threading(自由執行緒)CPython 不保證" +"疊代器操作的執行緒安全。" #: ../../glossary.rst:749 msgid "key function" @@ -1731,37 +1721,37 @@ msgstr "" #: ../../glossary.rst:756 msgid "" "A number of tools in Python accept key functions to control how elements are " -"ordered or grouped. They " -"include :func:`min`, :func:`max`, :func:`sorted`, :meth:`list.sort`, :func:`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq.nlargest`, " -"and :func:`itertools.groupby`." +"ordered or grouped. They include :func:`min`, :func:`max`, :func:`sorted`, :" +"meth:`list.sort`, :func:`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq." +"nlargest`, and :func:`itertools.groupby`." msgstr "" -"Python 中的許多工具,都接受以鍵函式來控制元素被定序或分組的方式。它們包" -"括 :func:`min`、:func:`max`、:func:`sorted`、:meth:`list.sort`、:func:`heapq.merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` " -"和 :func:`itertools.groupby`。" +"Python 中的許多工具,都接受以鍵函式來控制元素被定序或分組的方式。它們包括 :" +"func:`min`、:func:`max`、:func:`sorted`、:meth:`list.sort`、:func:`heapq." +"merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` 和 :func:`itertools." +"groupby`。" #: ../../glossary.rst:762 msgid "" -"There are several ways to create a key function. For example. " -"the :meth:`str.lower` method can serve as a key function for case " -"insensitive sorts. Alternatively, a key function can be built from " -"a :keyword:`lambda` expression such as ``lambda r: (r[0], r[2])``. " -"Also, :func:`operator.attrgetter`, :func:`operator.itemgetter`, " -"and :func:`operator.methodcaller` are three key function constructors. See " -"the :ref:`Sorting HOW TO ` for examples of how to create and " -"use key functions." +"There are several ways to create a key function. For example. the :meth:" +"`str.lower` method can serve as a key function for case insensitive sorts. " +"Alternatively, a key function can be built from a :keyword:`lambda` " +"expression such as ``lambda r: (r[0], r[2])``. Also, :func:`operator." +"attrgetter`, :func:`operator.itemgetter`, and :func:`operator.methodcaller` " +"are three key function constructors. See the :ref:`Sorting HOW TO " +"` for examples of how to create and use key functions." msgstr "" "有幾種方法可以建立一個鍵函式。例如,:meth:`str.lower` method 可以作為不分大小" "寫排序的鍵函式。或者,一個鍵函式也可以從 :keyword:`lambda` 運算式被建造,例" -"如 ``lambda r: (r[0], r[2])``。另" -"外,:func:`operator.attrgetter`、:func:`operator.itemgetter` " -"和 :func:`operator.methodcaller` 為三個鍵函式的建構函式 (constructor)。關於如" -"何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 `。" +"如 ``lambda r: (r[0], r[2])``。另外,:func:`operator.attrgetter`、:func:" +"`operator.itemgetter` 和 :func:`operator.methodcaller` 為三個鍵函式的建構函" +"式 (constructor)。關於如何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 " +"`。" #: ../../glossary.rst:769 msgid "keyword argument" msgstr "keyword argument(關鍵字引數)" -#: ../../glossary.rst:771 ../../glossary.rst:1077 +#: ../../glossary.rst:771 ../../glossary.rst:1086 msgid "See :term:`argument`." msgstr "請參閱 :term:`argument`\\ (引數)。" @@ -1791,8 +1781,8 @@ msgid "" "statements." msgstr "" "Look before you leap.(三思而後行。)這種編碼風格會在進行呼叫或查找之前,明確" -"地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許" -"多 :keyword:`if` 陳述式的存在。" +"地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許多 :" +"keyword:`if` 陳述式的存在。" #: ../../glossary.rst:784 msgid "" @@ -1809,10 +1799,18 @@ msgstr "" "解決。" #: ../../glossary.rst:789 +msgid "lexical analyzer" +msgstr "" + +#: ../../glossary.rst:792 +msgid "Formal name for the *tokenizer*; see :term:`token`." +msgstr "" + +#: ../../glossary.rst:793 msgid "list" msgstr "list(串列)" -#: ../../glossary.rst:791 +#: ../../glossary.rst:795 msgid "" "A built-in Python :term:`sequence`. Despite its name it is more akin to an " "array in other languages than to a linked list since access to elements is " @@ -1822,11 +1820,11 @@ msgstr "" "似其他語言中的一個陣列 (array) 而較不像一個鏈結串列 (linked list),因為存取元" "素的時間複雜度是 *O*\\ (1)。" -#: ../../glossary.rst:794 +#: ../../glossary.rst:798 msgid "list comprehension" msgstr "list comprehension(串列綜合運算)" -#: ../../glossary.rst:796 +#: ../../glossary.rst:800 msgid "" "A compact way to process all or part of the elements in a sequence and " "return a list with the results. ``result = ['{:#04x}'.format(x) for x in " @@ -1836,101 +1834,98 @@ msgid "" msgstr "" "一種用來處理一個序列中的全部或部分元素,並將處理結果以一個 list 回傳的簡要方" "法。``result = ['{:#04x}'.format(x) for x in range(256) if x % 2 == 0]`` 會產" -"生一個字串 list,其中包含 0 到 255 範圍內,所有偶數的十六進位數 " -"(0x..)。:keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有" -"元素都會被處理。" +"生一個字串 list,其中包含 0 到 255 範圍內,所有偶數的十六進位數 (0x..)。:" +"keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有元素都會被" +"處理。" -#: ../../glossary.rst:802 +#: ../../glossary.rst:806 msgid "loader" msgstr "loader(載入器)" -#: ../../glossary.rst:804 +#: ../../glossary.rst:808 msgid "" -"An object that loads a module. It must define the :meth:`!exec_module` " -"and :meth:`!create_module` methods to implement " -"the :class:`~importlib.abc.Loader` interface. A loader is typically returned " -"by a :term:`finder`. See also:" +"An object that loads a module. It must define the :meth:`!exec_module` and :" +"meth:`!create_module` methods to implement the :class:`~importlib.abc." +"Loader` interface. A loader is typically returned by a :term:`finder`. See " +"also:" msgstr "" "一個能夠載入模組的物件。它必須定義 :meth:`!exec_module` 和 :meth:`!" "create_module` 方法以實作 :class:`~importlib.abc.Loader` 介面。載入器通常是" "被 :term:`finder`\\ (尋檢器)回傳。更多細節請參閱:" -#: ../../glossary.rst:810 +#: ../../glossary.rst:814 msgid ":ref:`finders-and-loaders`" msgstr ":ref:`finders-and-loaders`" -#: ../../glossary.rst:811 +#: ../../glossary.rst:815 msgid ":class:`importlib.abc.Loader`" msgstr ":class:`importlib.abc.Loader`" -#: ../../glossary.rst:812 +#: ../../glossary.rst:816 msgid ":pep:`302`" msgstr ":pep:`302`" -#: ../../glossary.rst:813 +#: ../../glossary.rst:817 msgid "locale encoding" msgstr "locale encoding(區域編碼)" -#: ../../glossary.rst:815 +#: ../../glossary.rst:819 msgid "" -"On Unix, it is the encoding of the LC_CTYPE locale. It can be set " -"with :func:`locale.setlocale(locale.LC_CTYPE, new_locale) " -"`." +"On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:" +"`locale.setlocale(locale.LC_CTYPE, new_locale) `." msgstr "" -"在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以" -"用 :func:`locale.setlocale(locale.LC_CTYPE, new_locale) ` " -"來設定。" +"在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以用 :func:`locale." +"setlocale(locale.LC_CTYPE, new_locale) ` 來設定。" -#: ../../glossary.rst:818 +#: ../../glossary.rst:822 msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." msgstr "在 Windows 上,它是 ANSI 代碼頁(code page,例如 ``\"cp1252\"``\\ )。" -#: ../../glossary.rst:820 +#: ../../glossary.rst:824 msgid "" "On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." msgstr "在 Android 和 VxWorks 上,Python 使用 ``\"utf-8\"`` 作為區域編碼。" -#: ../../glossary.rst:822 +#: ../../glossary.rst:826 msgid ":func:`locale.getencoding` can be used to get the locale encoding." msgstr ":func:`locale.getencoding` 可以用來取得區域編碼。" -#: ../../glossary.rst:824 +#: ../../glossary.rst:828 msgid "See also the :term:`filesystem encoding and error handler`." msgstr "也請參考 :term:`filesystem encoding and error handler`。" -#: ../../glossary.rst:825 +#: ../../glossary.rst:829 msgid "magic method" msgstr "magic method(魔術方法)" -#: ../../glossary.rst:829 +#: ../../glossary.rst:833 msgid "An informal synonym for :term:`special method`." msgstr ":term:`special method`\\ (特殊方法)的一個非正式同義詞。" -#: ../../glossary.rst:830 +#: ../../glossary.rst:834 msgid "mapping" msgstr "mapping(對映)" -#: ../../glossary.rst:832 +#: ../../glossary.rst:836 msgid "" "A container object that supports arbitrary key lookups and implements the " -"methods specified in the :class:`collections.abc.Mapping` " -"or :class:`collections.abc.MutableMapping` :ref:`abstract base classes " -"`. Examples " -"include :class:`dict`, :class:`collections.defaultdict`, :class:`collections.OrderedDict` " -"and :class:`collections.Counter`." +"methods specified in the :class:`collections.abc.Mapping` or :class:" +"`collections.abc.MutableMapping` :ref:`abstract base classes `. Examples include :class:`dict`, :class:" +"`collections.defaultdict`, :class:`collections.OrderedDict` and :class:" +"`collections.Counter`." msgstr "" "一個容器物件,它支援任意鍵的查找,且能實作 :ref:`abstract base classes(抽象" -"基底類別) `\\ " -"中,:class:`collections.abc.Mapping` " -"或 :class:`collections.abc.MutableMapping` 所指定的 method。範例包" -"括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections.OrderedDict` " -"和 :class:`collections.Counter`。" +"基底類別) `\\ 中,:class:`collections." +"abc.Mapping` 或 :class:`collections.abc.MutableMapping` 所指定的 method。範例" +"包括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections." +"OrderedDict` 和 :class:`collections.Counter`。" -#: ../../glossary.rst:838 +#: ../../glossary.rst:842 msgid "meta path finder" msgstr "meta path finder(元路徑尋檢器)" -#: ../../glossary.rst:840 +#: ../../glossary.rst:844 msgid "" "A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path " "finders are related to, but different from :term:`path entry finders ` " "相關但是不同。" -#: ../../glossary.rst:844 +#: ../../glossary.rst:848 msgid "" "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path " "finders implement." msgstr "" "關於元路徑尋檢器實作的 method,請參閱 :class:`importlib.abc.MetaPathFinder`。" -#: ../../glossary.rst:846 +#: ../../glossary.rst:850 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../glossary.rst:848 +#: ../../glossary.rst:852 msgid "" "The class of a class. Class definitions create a class name, a class " "dictionary, and a list of base classes. The metaclass is responsible for " @@ -1971,31 +1966,31 @@ msgstr "" "性存取、增加執行緒安全性、追蹤物件建立、實作單例模式 (singleton),以及許多其" "他的任務。" -#: ../../glossary.rst:858 +#: ../../glossary.rst:862 msgid "More information can be found in :ref:`metaclasses`." msgstr "更多資訊可以在\\ :ref:`metaclasses`\\ 章節中找到。" -#: ../../glossary.rst:827 ../../glossary.rst:859 ../../glossary.rst:1222 +#: ../../glossary.rst:831 ../../glossary.rst:863 ../../glossary.rst:1231 msgid "method" msgstr "method(方法)" -#: ../../glossary.rst:861 +#: ../../glossary.rst:865 msgid "" "A function which is defined inside a class body. If called as an attribute " "of an instance of that class, the method will get the instance object as its " -"first :term:`argument` (which is usually called ``self``). " -"See :term:`function` and :term:`nested scope`." +"first :term:`argument` (which is usually called ``self``). See :term:" +"`function` and :term:`nested scope`." msgstr "" "一個在 class 本體內被定義的函式。如果 method 作為其 class 實例的一個屬性被呼" "叫,則它將會得到該實例物件成為它的第一個 :term:`argument`\\ (引數)(此引數" "通常被稱為 ``self``)。請參閱 :term:`function`\\ (函式)和 :term:`nested " "scope`\\ (巢狀作用域)。" -#: ../../glossary.rst:865 +#: ../../glossary.rst:869 msgid "method resolution order" msgstr "method resolution order(方法解析順序)" -#: ../../glossary.rst:867 +#: ../../glossary.rst:871 msgid "" "Method Resolution Order is the order in which base classes are searched for " "a member during lookup. See :ref:`python_2.3_mro` for details of the " @@ -2004,11 +1999,11 @@ msgstr "" "方法解析順序是在查找某個成員的過程中,base class(基底類別)被搜尋的順序。關" "於 Python 自 2.3 版直譯器所使用的演算法細節,請參閱 :ref:`python_2.3_mro`。" -#: ../../glossary.rst:870 +#: ../../glossary.rst:874 msgid "module" msgstr "module(模組)" -#: ../../glossary.rst:872 +#: ../../glossary.rst:876 msgid "" "An object that serves as an organizational unit of Python code. Modules " "have a namespace containing arbitrary Python objects. Modules are loaded " @@ -2018,51 +2013,51 @@ msgstr "" "空間,它包含任意的 Python 物件。模組是藉由 :term:`importing` 的過程,被載入" "至 Python。" -#: ../../glossary.rst:876 +#: ../../glossary.rst:880 msgid "See also :term:`package`." msgstr "另請參閱 :term:`package`\\ (套件)。" -#: ../../glossary.rst:877 +#: ../../glossary.rst:881 msgid "module spec" msgstr "module spec(模組規格)" -#: ../../glossary.rst:879 +#: ../../glossary.rst:883 msgid "" "A namespace containing the import-related information used to load a module. " "An instance of :class:`importlib.machinery.ModuleSpec`." msgstr "" -"一個命名空間,它包含用於載入模組的 import 相關資訊。它" -"是 :class:`importlib.machinery.ModuleSpec` 的一個實例。" +"一個命名空間,它包含用於載入模組的 import 相關資訊。它是 :class:`importlib." +"machinery.ModuleSpec` 的一個實例。" -#: ../../glossary.rst:882 +#: ../../glossary.rst:886 msgid "See also :ref:`module-specs`." msgstr "另請參閱 :ref:`module-specs`。" -#: ../../glossary.rst:883 +#: ../../glossary.rst:887 msgid "MRO" msgstr "MRO" -#: ../../glossary.rst:885 +#: ../../glossary.rst:889 msgid "See :term:`method resolution order`." msgstr "請參閱 :term:`method resolution order`\\ (方法解析順序)。" -#: ../../glossary.rst:886 +#: ../../glossary.rst:890 msgid "mutable" msgstr "mutable(可變物件)" -#: ../../glossary.rst:888 +#: ../../glossary.rst:892 msgid "" -"Mutable objects can change their value but keep their :func:`id`. See " -"also :term:`immutable`." +"Mutable objects can change their value but keep their :func:`id`. See also :" +"term:`immutable`." msgstr "" -"可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參" -"閱 :term:`immutable`\\ (不可變物件)。" +"可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參閱 :term:" +"`immutable`\\ (不可變物件)。" -#: ../../glossary.rst:890 +#: ../../glossary.rst:894 msgid "named tuple" msgstr "named tuple(附名元組)" -#: ../../glossary.rst:892 +#: ../../glossary.rst:896 msgid "" "The term \"named tuple\" applies to any type or class that inherits from " "tuple and whose indexable elements are also accessible using named " @@ -2072,16 +2067,16 @@ msgstr "" "索引 (indexable) 元素也可以用附名屬性來存取。這些型別或 class 也可以具有其他" "的特性。" -#: ../../glossary.rst:896 +#: ../../glossary.rst:900 msgid "" -"Several built-in types are named tuples, including the values returned " -"by :func:`time.localtime` and :func:`os.stat`. Another example " -"is :data:`sys.float_info`::" +"Several built-in types are named tuples, including the values returned by :" +"func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys." +"float_info`::" msgstr "" "有些內建型別是 named tuple,包括由 :func:`time.localtime` 和 :func:`os.stat` " "回傳的值。另一個例子是 :data:`sys.float_info`: ::" -#: ../../glossary.rst:900 +#: ../../glossary.rst:904 msgid "" ">>> sys.float_info[1] # indexed access\n" "1024\n" @@ -2091,74 +2086,84 @@ msgid "" "True" msgstr "" -#: ../../glossary.rst:907 +#: ../../glossary.rst:911 msgid "" "Some named tuples are built-in types (such as the above examples). " "Alternatively, a named tuple can be created from a regular class definition " "that inherits from :class:`tuple` and that defines named fields. Such a " -"class can be written by hand, or it can be created by " -"inheriting :class:`typing.NamedTuple`, or with the factory " -"function :func:`collections.namedtuple`. The latter techniques also add " -"some extra methods that may not be found in hand-written or built-in named " -"tuples." +"class can be written by hand, or it can be created by inheriting :class:" +"`typing.NamedTuple`, or with the factory function :func:`collections." +"namedtuple`. The latter techniques also add some extra methods that may not " +"be found in hand-written or built-in named tuples." msgstr "" "有些 named tuple 是內建型別(如上例)。或者,一個 named tuple 也可以從一個正" "規的 class 定義來建立,只要該 class 是繼承自 :class:`tuple`,且定義了附名欄" -"位 (named field) 即可。這類的 class 可以手工編寫、可以繼承" -"自 :class:`typing.NamedTuple` 來建立,也可以使用工廠函式 (factory " -"function) :func:`collections.namedtuple` 來建立。後者技術也增加了一些額外的 " -"method,這些 method 可能是在手寫或內建的 named tuple 中,無法找到的。" +"位 (named field) 即可。這類的 class 可以手工編寫、可以繼承自 :class:`typing." +"NamedTuple` 來建立,也可以使用工廠函式 (factory function) :func:`collections." +"namedtuple` 來建立。後者技術也增加了一些額外的 method,這些 method 可能是在手" +"寫或內建的 named tuple 中,無法找到的。" -#: ../../glossary.rst:915 +#: ../../glossary.rst:919 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../glossary.rst:917 +#: ../../glossary.rst:921 msgid "" "The place where a variable is stored. Namespaces are implemented as " "dictionaries. There are the local, global and built-in namespaces as well " "as nested namespaces in objects (in methods). Namespaces support modularity " -"by preventing naming conflicts. For instance, the " -"functions :func:`builtins.open <.open>` and :func:`os.open` are " -"distinguished by their namespaces. Namespaces also aid readability and " -"maintainability by making it clear which module implements a function. For " -"instance, writing :func:`random.seed` or :func:`itertools.islice` makes it " -"clear that those functions are implemented by the :mod:`random` " -"and :mod:`itertools` modules, respectively." +"by preventing naming conflicts. For instance, the functions :func:`builtins." +"open <.open>` and :func:`os.open` are distinguished by their namespaces. " +"Namespaces also aid readability and maintainability by making it clear which " +"module implements a function. For instance, writing :func:`random.seed` or :" +"func:`itertools.islice` makes it clear that those functions are implemented " +"by the :mod:`random` and :mod:`itertools` modules, respectively." msgstr "" "變數被儲存的地方。命名空間是以 dictionary(字典)被實作。有區域的、全域的及內" "建的命名空間,而在物件中(在 method 中)也有巢狀的命名空間。命名空間藉由防止" -"命名衝突,來支援模組化。例如,函式 :func:`builtins.open <.open>` " -"和 :func:`os.open` 是透過它們的命名空間來區分彼此。命名空間也藉由明確地區分是" -"哪個模組在實作一個函式,來增進可讀性及可維護性。例如,寫" -"出 :func:`random.seed` 或 :func:`itertools.islice` 明確地表示,這些函式分別是" -"由 :mod:`random` 和 :mod:`itertools` 模組在實作。" +"命名衝突,來支援模組化。例如,函式 :func:`builtins.open <.open>` 和 :func:" +"`os.open` 是透過它們的命名空間來區分彼此。命名空間也藉由明確地區分是哪個模組" +"在實作一個函式,來增進可讀性及可維護性。例如,寫出 :func:`random.seed` 或 :" +"func:`itertools.islice` 明確地表示,這些函式分別是由 :mod:`random` 和 :mod:" +"`itertools` 模組在實作。" -#: ../../glossary.rst:927 +#: ../../glossary.rst:931 msgid "namespace package" msgstr "namespace package(命名空間套件)" -#: ../../glossary.rst:929 +#: ../../glossary.rst:933 msgid "" -"A :pep:`420` :term:`package` which serves only as a container for " -"subpackages. Namespace packages may have no physical representation, and " -"specifically are not like a :term:`regular package` because they have no " -"``__init__.py`` file." +"A :term:`package` which serves only as a container for subpackages. " +"Namespace packages may have no physical representation, and specifically are " +"not like a :term:`regular package` because they have no ``__init__.py`` file." msgstr "" -"一個 :pep:`420` :term:`package`\\ (套件),它只能作為子套件 (subpackage) 的" -"一個容器。命名空間套件可能沒有實體的表示法,而且具體來說它們不像是一" -"個 :term:`regular package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這" -"個檔案。" +"一個 :term:`package`\\ (套件),它只能作為子套件 (subpackage) 的一個容器。命" +"名空間套件可能沒有實體的表示法,而且具體來說它們不像是一個 :term:`regular " +"package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這個檔案。" -#: ../../glossary.rst:934 +#: ../../glossary.rst:938 +msgid "" +"Namespace packages allow several individually installable packages to have a " +"common parent package. Otherwise, it is recommended to use a :term:`regular " +"package`." +msgstr "" +"命名空間套件允許數個可獨立安裝的套件擁有一個共同的父套件。除此之外,建議使" +"用 :term:`regular package`。" + +#: ../../glossary.rst:941 +msgid "" +"For more information, see :pep:`420` and :ref:`reference-namespace-package`." +msgstr "更多資訊,請參閱 :pep:`420` 和 :ref:`reference-namespace-package`。" + +#: ../../glossary.rst:943 msgid "See also :term:`module`." msgstr "另請參閱 :term:`module`\\ (模組)。" -#: ../../glossary.rst:935 +#: ../../glossary.rst:944 msgid "nested scope" msgstr "nested scope(巢狀作用域)" -#: ../../glossary.rst:937 +#: ../../glossary.rst:946 msgid "" "The ability to refer to a variable in an enclosing definition. For " "instance, a function defined inside another function can refer to variables " @@ -2173,41 +2178,39 @@ msgstr "" "寫入。同樣地,全域變數是在全域命名空間中讀取及寫入。:keyword:`nonlocal` 容許" "對外層作用域進行寫入。" -#: ../../glossary.rst:944 +#: ../../glossary.rst:953 msgid "new-style class" msgstr "new-style class(新式類別)" -#: ../../glossary.rst:946 +#: ../../glossary.rst:955 msgid "" "Old name for the flavor of classes now used for all class objects. In " "earlier Python versions, only new-style classes could use Python's newer, " -"versatile features like :attr:`~object.__slots__`, descriptors, " -"properties, :meth:`~object.__getattribute__`, class methods, and static " -"methods." +"versatile features like :attr:`~object.__slots__`, descriptors, properties, :" +"meth:`~object.__getattribute__`, class methods, and static methods." msgstr "" "一個舊名,它是指現在所有的 class 物件所使用的 class 風格。在早期的 Python 版" -"本中,只有新式 class 才能使用 Python 較新的、多樣的功能,像" -"是 :attr:`~object.__slots__`、描述器 (descriptor)、屬性 " -"(property)、:meth:`~object.__getattribute__`、class method(類別方法)和 " -"static method(靜態方法)。" +"本中,只有新式 class 才能使用 Python 較新的、多樣的功能,像是 :attr:`~object." +"__slots__`、描述器 (descriptor)、屬性 (property)、:meth:`~object." +"__getattribute__`、class method(類別方法)和 static method(靜態方法)。" -#: ../../glossary.rst:951 +#: ../../glossary.rst:960 msgid "object" msgstr "object(物件)" -#: ../../glossary.rst:953 +#: ../../glossary.rst:962 msgid "" "Any data with state (attributes or value) and defined behavior (methods). " "Also the ultimate base class of any :term:`new-style class`." msgstr "" -"具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任" -"何 :term:`new-style class`\\ (新式類別)的最終 base class(基底類別)。" +"具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任何 :term:" +"`new-style class`\\ (新式類別)的最終 base class(基底類別)。" -#: ../../glossary.rst:956 +#: ../../glossary.rst:965 msgid "optimized scope" msgstr "optimized scope(最佳化作用域)" -#: ../../glossary.rst:958 +#: ../../glossary.rst:967 msgid "" "A scope where target local variable names are reliably known to the compiler " "when the code is compiled, allowing optimization of read and write access to " @@ -2218,11 +2221,11 @@ msgid "" "to optimized scopes." msgstr "" -#: ../../glossary.rst:965 +#: ../../glossary.rst:974 msgid "package" msgstr "package(套件)" -#: ../../glossary.rst:967 +#: ../../glossary.rst:976 msgid "" "A Python :term:`module` which can contain submodules or recursively, " "subpackages. Technically, a package is a Python module with a ``__path__`` " @@ -2232,17 +2235,17 @@ msgstr "" "迴的子套件 (subpackage)。技術上而言,套件就是具有 ``__path__`` 屬性的一個 " "Python 模組。" -#: ../../glossary.rst:971 +#: ../../glossary.rst:980 msgid "See also :term:`regular package` and :term:`namespace package`." msgstr "" "另請參閱 :term:`regular package`\\ (正規套件)和 :term:`namespace " "package`\\ (命名空間套件)。" -#: ../../glossary.rst:972 +#: ../../glossary.rst:981 msgid "parameter" msgstr "parameter(參數)" -#: ../../glossary.rst:974 +#: ../../glossary.rst:983 msgid "" "A named entity in a :term:`function` (or method) definition that specifies " "an :term:`argument` (or in some cases, arguments) that the function can " @@ -2252,7 +2255,7 @@ msgstr "" "它指明該函式能夠接受的一個 :term:`argument`\\ (引數),或在某些情況下指示多" "個引數。共有有五種不同的參數類型:" -#: ../../glossary.rst:978 +#: ../../glossary.rst:987 msgid "" ":dfn:`positional-or-keyword`: specifies an argument that can be passed " "either :term:`positionally ` or as a :term:`keyword argument " @@ -2263,11 +2266,11 @@ msgstr "" "置 `\\ 或是作為\\ :term:`關鍵字引數 `\\ 被傳遞的引數。這" "是參數的預設類型,例如以下的 *foo* 和 *bar*: ::" -#: ../../glossary.rst:983 +#: ../../glossary.rst:992 msgid "def func(foo, bar=None): ..." msgstr "def func(foo, bar=None): ..." -#: ../../glossary.rst:987 +#: ../../glossary.rst:996 msgid "" ":dfn:`positional-only`: specifies an argument that can be supplied only by " "position. Positional-only parameters can be defined by including a ``/`` " @@ -2278,11 +2281,11 @@ msgstr "" "式定義的參數列表中包含一個 ``/`` 字元,就可以在該字元前面定義僅限位置參數,例" "如以下的 *posonly1* 和 *posonly2*: ::" -#: ../../glossary.rst:992 +#: ../../glossary.rst:1001 msgid "def func(posonly1, posonly2, /, positional_or_keyword): ..." msgstr "def func(posonly1, posonly2, /, positional_or_keyword): ..." -#: ../../glossary.rst:996 +#: ../../glossary.rst:1005 msgid "" ":dfn:`keyword-only`: specifies an argument that can be supplied only by " "keyword. Keyword-only parameters can be defined by including a single var-" @@ -2295,11 +2298,11 @@ msgstr "" "單純的 ``*`` 字元,就可以在其後方定義僅限關鍵字參數,例如以下的 *kw_only1* " "和 *kw_only2*: ::" -#: ../../glossary.rst:1002 +#: ../../glossary.rst:1011 msgid "def func(arg, *, kw_only1, kw_only2): ..." msgstr "def func(arg, *, kw_only1, kw_only2): ..." -#: ../../glossary.rst:1004 +#: ../../glossary.rst:1013 msgid "" ":dfn:`var-positional`: specifies that an arbitrary sequence of positional " "arguments can be provided (in addition to any positional arguments already " @@ -2311,11 +2314,11 @@ msgstr "" "數(在已被其他參數接受的任何位置引數之外)。這類參數是透過在其參數名稱字首加" "上 ``*`` 來定義的,例如以下的 *args*: ::" -#: ../../glossary.rst:1010 +#: ../../glossary.rst:1019 msgid "def func(*args, **kwargs): ..." msgstr "def func(*args, **kwargs): ..." -#: ../../glossary.rst:1012 +#: ../../glossary.rst:1021 msgid "" ":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be " "provided (in addition to any keyword arguments already accepted by other " @@ -2326,29 +2329,29 @@ msgstr "" "已被其他參數接受的任何關鍵字引數之外)。這類參數是透過在其參數名稱字首加上 " "``**`` 來定義的,例如上面範例中的 *kwargs*。" -#: ../../glossary.rst:1018 +#: ../../glossary.rst:1027 msgid "" "Parameters can specify both optional and required arguments, as well as " "default values for some optional arguments." msgstr "" "參數可以指明引數是選擇性的或必需的,也可以為一些選擇性的引數指定預設值。" -#: ../../glossary.rst:1021 +#: ../../glossary.rst:1030 msgid "" "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " -"the :class:`inspect.Parameter` class, the :ref:`function` section, " -"and :pep:`362`." +"the :class:`inspect.Parameter` class, the :ref:`function` section, and :pep:" +"`362`." msgstr "" "另請參閱術語表的 :term:`argument`\\ (引數)條目、常見問題中的\\ :ref:`引數和" "參數之間的差異 `、:class:`inspect.Parameter` " "class、:ref:`function`\\ 章節,以及 :pep:`362`。" -#: ../../glossary.rst:1025 +#: ../../glossary.rst:1034 msgid "path entry" msgstr "path entry(路徑項目)" -#: ../../glossary.rst:1027 +#: ../../glossary.rst:1036 msgid "" "A single location on the :term:`import path` which the :term:`path based " "finder` consults to find modules for importing." @@ -2356,33 +2359,33 @@ msgstr "" "在 :term:`import path`\\ (引入路徑)中的一個位置,而 :term:`path based " "finder` (基於路徑的尋檢器)會參考該位置來尋找要 import 的模組。" -#: ../../glossary.rst:1029 +#: ../../glossary.rst:1038 msgid "path entry finder" msgstr "path entry finder(路徑項目尋檢器)" -#: ../../glossary.rst:1031 +#: ../../glossary.rst:1040 msgid "" -"A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. " -"a :term:`path entry hook`) which knows how to locate modules given " -"a :term:`path entry`." +"A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :" +"term:`path entry hook`) which knows how to locate modules given a :term:" +"`path entry`." msgstr "" -"被 :data:`sys.path_hooks` 中的一個可呼叫物件 (callable)(意即一" -"個 :term:`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一" -"個 :term:`path entry`\\ 定位模組。" +"被 :data:`sys.path_hooks` 中的一個可呼叫物件 (callable)(意即一個 :term:" +"`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一個 :term:" +"`path entry`\\ 定位模組。" -#: ../../glossary.rst:1035 +#: ../../glossary.rst:1044 msgid "" "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry " "finders implement." msgstr "" -"關於路徑項目尋檢器實作的 method,請參" -"閱 :class:`importlib.abc.PathEntryFinder`。" +"關於路徑項目尋檢器實作的 method,請參閱 :class:`importlib.abc." +"PathEntryFinder`。" -#: ../../glossary.rst:1037 +#: ../../glossary.rst:1046 msgid "path entry hook" msgstr "path entry hook(路徑項目鉤)" -#: ../../glossary.rst:1039 +#: ../../glossary.rst:1048 msgid "" "A callable on the :data:`sys.path_hooks` list which returns a :term:`path " "entry finder` if it knows how to find modules on a specific :term:`path " @@ -2392,11 +2395,11 @@ msgstr "" "個特定的 :term:`path entry` 中尋找模組,則會回傳一個 :term:`path entry " "finder`\\ (路徑項目尋檢器)。" -#: ../../glossary.rst:1042 +#: ../../glossary.rst:1051 msgid "path based finder" msgstr "path based finder(基於路徑的尋檢器)" -#: ../../glossary.rst:1044 +#: ../../glossary.rst:1053 msgid "" "One of the default :term:`meta path finders ` which " "searches an :term:`import path` for modules." @@ -2404,33 +2407,33 @@ msgstr "" "預設的\\ :term:`元路徑尋檢器 (meta path finder) ` 之一,它" "會在一個 :term:`import path` 中搜尋模組。" -#: ../../glossary.rst:1046 +#: ../../glossary.rst:1055 msgid "path-like object" msgstr "path-like object(類路徑物件)" -#: ../../glossary.rst:1048 -msgid "" -"An object representing a file system path. A path-like object is either " -"a :class:`str` or :class:`bytes` object representing a path, or an object " -"implementing the :class:`os.PathLike` protocol. An object that supports " -"the :class:`os.PathLike` protocol can be converted to a :class:`str` " -"or :class:`bytes` file system path by calling the :func:`os.fspath` " -"function; :func:`os.fsdecode` and :func:`os.fsencode` can be used to " -"guarantee a :class:`str` or :class:`bytes` result instead, respectively. " -"Introduced by :pep:`519`." -msgstr "" -"一個表示檔案系統路徑的物件。類路徑物件可以是一個表示路徑的 :class:`str` " -"或 :class:`bytes` 物件,或是一個實作 :class:`os.PathLike` 協定的物件。透過呼" -"叫 :func:`os.fspath` 函式,一個支援 :class:`os.PathLike` 協定的物件可以被轉換" -"為 :class:`str` 或 :class:`bytes` 檔案系統路徑;而 :func:`os.fsdecode` " -"及 :func:`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結" -"果。由 :pep:`519` 引入。" - -#: ../../glossary.rst:1056 +#: ../../glossary.rst:1057 +msgid "" +"An object representing a file system path. A path-like object is either a :" +"class:`str` or :class:`bytes` object representing a path, or an object " +"implementing the :class:`os.PathLike` protocol. An object that supports the :" +"class:`os.PathLike` protocol can be converted to a :class:`str` or :class:" +"`bytes` file system path by calling the :func:`os.fspath` function; :func:" +"`os.fsdecode` and :func:`os.fsencode` can be used to guarantee a :class:" +"`str` or :class:`bytes` result instead, respectively. Introduced by :pep:" +"`519`." +msgstr "" +"一個表示檔案系統路徑的物件。類路徑物件可以是一個表示路徑的 :class:`str` 或 :" +"class:`bytes` 物件,或是一個實作 :class:`os.PathLike` 協定的物件。透過呼叫 :" +"func:`os.fspath` 函式,一個支援 :class:`os.PathLike` 協定的物件可以被轉換為 :" +"class:`str` 或 :class:`bytes` 檔案系統路徑;而 :func:`os.fsdecode` 及 :func:" +"`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結果。由 :" +"pep:`519` 引入。" + +#: ../../glossary.rst:1065 msgid "PEP" msgstr "PEP" -#: ../../glossary.rst:1058 +#: ../../glossary.rst:1067 msgid "" "Python Enhancement Proposal. A PEP is a design document providing " "information to the Python community, or describing a new feature for Python " @@ -2441,7 +2444,7 @@ msgstr "" "為 Python 社群提供資訊,或是描述 Python 的一個新功能或該功能的程序和環境。" "PEP 應該要提供簡潔的技術規範以及被提案功能的運作原理。" -#: ../../glossary.rst:1064 +#: ../../glossary.rst:1073 msgid "" "PEPs are intended to be the primary mechanisms for proposing major new " "features, for collecting community input on an issue, and for documenting " @@ -2453,15 +2456,15 @@ msgstr "" "已納入 Python 的設計決策的記錄,這些過程的主要機制。PEP 的作者要負責在社群內" "建立共識並記錄反對意見。" -#: ../../glossary.rst:1070 +#: ../../glossary.rst:1079 msgid "See :pep:`1`." msgstr "請參閱 :pep:`1`。" -#: ../../glossary.rst:1071 +#: ../../glossary.rst:1080 msgid "portion" msgstr "portion(部分)" -#: ../../glossary.rst:1073 +#: ../../glossary.rst:1082 msgid "" "A set of files in a single directory (possibly stored in a zip file) that " "contribute to a namespace package, as defined in :pep:`420`." @@ -2469,15 +2472,15 @@ msgstr "" "在單一目錄中的一組檔案(也可能儲存在一個 zip 檔中),這些檔案能對一個命名空間" "套件 (namespace package) 有所貢獻,如同 :pep:`420` 中的定義。" -#: ../../glossary.rst:1075 +#: ../../glossary.rst:1084 msgid "positional argument" msgstr "positional argument(位置引數)" -#: ../../glossary.rst:1078 +#: ../../glossary.rst:1087 msgid "provisional API" msgstr "provisional API(暫行 API)" -#: ../../glossary.rst:1080 +#: ../../glossary.rst:1089 msgid "" "A provisional API is one which has been deliberately excluded from the " "standard library's backwards compatibility guarantees. While major changes " @@ -2493,7 +2496,7 @@ msgstr "" "該介面)。這種變更並不會無端地產生——只有 API 被納入之前未察覺的嚴重基本缺陷被" "揭露時,它們才會發生。" -#: ../../glossary.rst:1089 +#: ../../glossary.rst:1098 msgid "" "Even for provisional APIs, backwards incompatible changes are seen as a " "\"solution of last resort\" - every attempt will still be made to find a " @@ -2502,7 +2505,7 @@ msgstr "" "即使對於暫行 API,向後不相容的變更也會被視為「最後的解決方案」——對於任何被發" "現的問題,仍然會盡可能找出一個向後相容的解決方案。" -#: ../../glossary.rst:1093 +#: ../../glossary.rst:1102 msgid "" "This process allows the standard library to continue to evolve over time, " "without locking in problematic design errors for extended periods of time. " @@ -2511,19 +2514,19 @@ msgstr "" "這個過程使得標準函式庫能隨著時間不斷進化,而避免耗費過長的時間去鎖定有問題的" "設計錯誤。請參閱 :pep:`411` 了解更多細節。" -#: ../../glossary.rst:1096 +#: ../../glossary.rst:1105 msgid "provisional package" msgstr "provisional package(暫行套件)" -#: ../../glossary.rst:1098 +#: ../../glossary.rst:1107 msgid "See :term:`provisional API`." msgstr "請參閱 :term:`provisional API`\\ (暫行 API)。" -#: ../../glossary.rst:1099 +#: ../../glossary.rst:1108 msgid "Python 3000" msgstr "Python 3000" -#: ../../glossary.rst:1101 +#: ../../glossary.rst:1110 msgid "" "Nickname for the Python 3.x release line (coined long ago when the release " "of version 3 was something in the distant future.) This is also abbreviated " @@ -2532,11 +2535,11 @@ msgstr "" "Python 3.x 系列版本的暱稱(很久以前創造的,當時第 3 版的發布是在遙遠的未" "來。)也可以縮寫為「Py3k」。" -#: ../../glossary.rst:1104 +#: ../../glossary.rst:1113 msgid "Pythonic" msgstr "Pythonic(Python 風格的)" -#: ../../glossary.rst:1106 +#: ../../glossary.rst:1115 msgid "" "An idea or piece of code which closely follows the most common idioms of the " "Python language, rather than implementing code using concepts common to " @@ -2546,11 +2549,11 @@ msgid "" "Python sometimes use a numerical counter instead::" msgstr "" "一個想法或一段程式碼,它應用了 Python 語言最常見的慣用語,而不是使用其他語言" -"常見的概念來實作程式碼。例如,Python 中常見的一種習慣用法,是使用一" -"個 :keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並" -"沒有這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" +"常見的概念來實作程式碼。例如,Python 中常見的一種習慣用法,是使用一個 :" +"keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並沒有" +"這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" -#: ../../glossary.rst:1113 +#: ../../glossary.rst:1122 msgid "" "for i in range(len(food)):\n" " print(food[i])" @@ -2558,11 +2561,11 @@ msgstr "" "for i in range(len(food)):\n" " print(food[i])" -#: ../../glossary.rst:1116 +#: ../../glossary.rst:1125 msgid "As opposed to the cleaner, Pythonic method::" msgstr "相較之下,以下方法更簡潔、更具有 Python 風格: ::" -#: ../../glossary.rst:1118 +#: ../../glossary.rst:1127 msgid "" "for piece in food:\n" " print(piece)" @@ -2570,11 +2573,11 @@ msgstr "" "for piece in food:\n" " print(piece)" -#: ../../glossary.rst:1120 +#: ../../glossary.rst:1129 msgid "qualified name" msgstr "qualified name(限定名稱)" -#: ../../glossary.rst:1122 +#: ../../glossary.rst:1131 msgid "" "A dotted name showing the \"path\" from a module's global scope to a class, " "function or method defined in that module, as defined in :pep:`3155`. For " @@ -2585,7 +2588,7 @@ msgstr "" "或 method 的「路徑」,如 :pep:`3155` 中的定義。對於頂層的函式和 class 而言," "限定名稱與其物件名稱相同: ::" -#: ../../glossary.rst:1127 +#: ../../glossary.rst:1136 msgid "" ">>> class C:\n" "... class D:\n" @@ -2611,16 +2614,16 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -#: ../../glossary.rst:1139 +#: ../../glossary.rst:1148 msgid "" "When used to refer to modules, the *fully qualified name* means the entire " -"dotted path to the module, including any parent packages, e.g. " -"``email.mime.text``::" +"dotted path to the module, including any parent packages, e.g. ``email.mime." +"text``::" msgstr "" "當用於引用模組時,*完全限定名稱 (fully qualified name)* 是表示該模組的完整點" "分隔路徑,包括任何的父套件,例如 ``email.mime.text``: ::" -#: ../../glossary.rst:1143 +#: ../../glossary.rst:1152 msgid "" ">>> import email.mime.text\n" ">>> email.mime.text.__name__\n" @@ -2630,11 +2633,11 @@ msgstr "" ">>> email.mime.text.__name__\n" "'email.mime.text'" -#: ../../glossary.rst:1146 +#: ../../glossary.rst:1155 msgid "reference count" msgstr "reference count(參照計數)" -#: ../../glossary.rst:1148 +#: ../../glossary.rst:1157 msgid "" "The number of references to an object. When the reference count of an " "object drops to zero, it is deallocated. Some objects are :term:`immortal` " @@ -2647,42 +2650,42 @@ msgstr "" "對於一個物件的參照次數。當一個物件的參照計數下降到零時,它會被解除配置 " "(deallocated)。有些物件是「\\ :term:`不滅的 ` (immortal)」並擁有不" "會被改變的參照計數,也因此永遠不會被解除配置。參照計數通常在 Python 程式碼中" -"看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼" -"叫 :func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" +"看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :" +"func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" -#: ../../glossary.rst:1156 +#: ../../glossary.rst:1165 msgid "regular package" msgstr "regular package(正規套件)" -#: ../../glossary.rst:1158 +#: ../../glossary.rst:1167 msgid "" -"A traditional :term:`package`, such as a directory containing an " -"``__init__.py`` file." +"A traditional :term:`package`, such as a directory containing an ``__init__." +"py`` file." msgstr "" "一個傳統的 :term:`package`\\ (套件),例如一個包含 ``__init__.py`` 檔案的目" "錄。" -#: ../../glossary.rst:1161 +#: ../../glossary.rst:1170 msgid "See also :term:`namespace package`." msgstr "另請參閱 :term:`namespace package`\\ (命名空間套件)。" -#: ../../glossary.rst:1162 +#: ../../glossary.rst:1171 msgid "REPL" msgstr "REPL" -#: ../../glossary.rst:1164 +#: ../../glossary.rst:1173 msgid "" -"An acronym for the \"read–eval–print loop\", another name for " -"the :term:`interactive` interpreter shell." +"An acronym for the \"read–eval–print loop\", another name for the :term:" +"`interactive` interpreter shell." msgstr "" "「read-eval-print 迴圈 (read–eval–print loop)」的縮寫,是\\ :term:`互動式 " "`\\ 直譯器 shell 的另一個名稱。" -#: ../../glossary.rst:1166 +#: ../../glossary.rst:1175 msgid "__slots__" msgstr "__slots__" -#: ../../glossary.rst:1168 +#: ../../glossary.rst:1177 msgid "" "A declaration inside a class that saves memory by pre-declaring space for " "instance attributes and eliminating instance dictionaries. Though popular, " @@ -2695,66 +2698,66 @@ msgstr "" "最好保留給那種在一個記憶體關鍵 (memory-critical) 的應用程式中存在大量實例的罕" "見情況。" -#: ../../glossary.rst:1173 +#: ../../glossary.rst:1182 msgid "sequence" msgstr "sequence(序列)" -#: ../../glossary.rst:1175 +#: ../../glossary.rst:1184 msgid "" "An :term:`iterable` which supports efficient element access using integer " -"indices via the :meth:`~object.__getitem__` special method and defines " -"a :meth:`~object.__len__` method that returns the length of the sequence. " -"Some built-in sequence types " -"are :class:`list`, :class:`str`, :class:`tuple`, and :class:`bytes`. Note " -"that :class:`dict` also supports :meth:`~object.__getitem__` and :meth:`!" -"__len__`, but is considered a mapping rather than a sequence because the " -"lookups use arbitrary :term:`hashable` keys rather than integers." +"indices via the :meth:`~object.__getitem__` special method and defines a :" +"meth:`~object.__len__` method that returns the length of the sequence. Some " +"built-in sequence types are :class:`list`, :class:`str`, :class:`tuple`, " +"and :class:`bytes`. Note that :class:`dict` also supports :meth:`~object." +"__getitem__` and :meth:`!__len__`, but is considered a mapping rather than a " +"sequence because the lookups use arbitrary :term:`hashable` keys rather than " +"integers." msgstr "" "一個 :term:`iterable`\\ (可疊代物件),它透過 :meth:`~object.__getitem__` " "special method(特殊方法),使用整數索引來支援高效率的元素存取,並定義了一" -"個 :meth:`~object.__len__` method 來回傳該序列的長度。一些內建序列型別包" -"括 :class:`list`、:class:`str`、:class:`tuple` 和 :class:`bytes`。請注意,雖" -"然 :class:`dict` 也支援 :meth:`~object.__getitem__` 和 :meth:`!__len__`,但它" -"被視為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` " -"鍵,而不是整數。" +"個 :meth:`~object.__len__` method 來回傳該序列的長度。一些內建序列型別包括 :" +"class:`list`、:class:`str`、:class:`tuple` 和 :class:`bytes`。請注意,雖然 :" +"class:`dict` 也支援 :meth:`~object.__getitem__` 和 :meth:`!__len__`,但它被視" +"為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` 鍵," +"而不是整數。" -#: ../../glossary.rst:1184 +#: ../../glossary.rst:1193 msgid "" "The :class:`collections.abc.Sequence` abstract base class defines a much " -"richer interface that goes beyond just :meth:`~object.__getitem__` " -"and :meth:`~object.__len__`, adding :meth:`!count`, :meth:`!" -"index`, :meth:`~object.__contains__`, and :meth:`~object.__reversed__`. " -"Types that implement this expanded interface can be registered explicitly " -"using :func:`~abc.ABCMeta.register`. For more documentation on sequence " -"methods generally, see :ref:`Common Sequence Operations `." +"richer interface that goes beyond just :meth:`~object.__getitem__` and :meth:" +"`~object.__len__`, adding :meth:`!count`, :meth:`!index`, :meth:`~object." +"__contains__`, and :meth:`~object.__reversed__`. Types that implement this " +"expanded interface can be registered explicitly using :func:`~abc.ABCMeta." +"register`. For more documentation on sequence methods generally, see :ref:" +"`Common Sequence Operations `." msgstr "" "抽象基底類別 (abstract base class) :class:`collections.abc.Sequence` 定義了一" -"個更加豐富的介面,並不僅止於 :meth:`~object.__getitem__` " -"和 :meth:`~object.__len__`,還增加了 :meth:`!count`、:meth:`!" -"index`、:meth:`~object.__contains__` 和 :meth:`~object.__reversed__`。實作此" -"擴充介面的型別,可以使用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於" -"序列方法的文件,請見\\ :ref:`常見序列操作 `。" +"個更加豐富的介面,並不僅止於 :meth:`~object.__getitem__` 和 :meth:`~object." +"__len__`,還增加了 :meth:`!count`、:meth:`!index`、:meth:`~object." +"__contains__` 和 :meth:`~object.__reversed__`。實作此擴充介面的型別,可以使" +"用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於序列方法的文件,請見" +"\\ :ref:`常見序列操作 `。" -#: ../../glossary.rst:1193 +#: ../../glossary.rst:1202 msgid "set comprehension" msgstr "set comprehension(集合綜合運算)" -#: ../../glossary.rst:1195 +#: ../../glossary.rst:1204 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a set with the results. ``results = {c for c in 'abracadabra' if c " -"not in 'abc'}`` generates the set of strings ``{'r', 'd'}``. " -"See :ref:`comprehensions`." +"not in 'abc'}`` generates the set of strings ``{'r', 'd'}``. See :ref:" +"`comprehensions`." msgstr "" "一種緊密的方法,用來處理一個可疊代物件中的全部或部分元素,並將處理結果以一個 " "set 回傳。``results = {c for c in 'abracadabra' if c not in 'abc'}`` 會產生一" "個字串 set:``{'r', 'd'}``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:1199 +#: ../../glossary.rst:1208 msgid "single dispatch" msgstr "single dispatch(單一調度)" -#: ../../glossary.rst:1201 +#: ../../glossary.rst:1210 msgid "" "A form of :term:`generic function` dispatch where the implementation is " "chosen based on the type of a single argument." @@ -2762,11 +2765,11 @@ msgstr "" ":term:`generic function`\\ (泛型函式)調度的一種形式,在此,實作的選擇是基於" "單一引數的型別。" -#: ../../glossary.rst:1203 +#: ../../glossary.rst:1212 msgid "slice" msgstr "slice(切片)" -#: ../../glossary.rst:1205 +#: ../../glossary.rst:1214 msgid "" "An object usually containing a portion of a :term:`sequence`. A slice is " "created using the subscript notation, ``[]`` with colons between numbers " @@ -2778,11 +2781,11 @@ msgstr "" "之間使用冒號,例如 ``variable_name[1:3:5]``。在括號(下標)符號的內部,會使" "用 :class:`slice` 物件。" -#: ../../glossary.rst:1209 +#: ../../glossary.rst:1218 msgid "soft deprecated" msgstr "soft deprecated(軟性棄用)" -#: ../../glossary.rst:1211 +#: ../../glossary.rst:1220 msgid "" "A soft deprecated API should not be used in new code, but it is safe for " "already existing code to use it. The API remains documented and tested, but " @@ -2791,13 +2794,13 @@ msgstr "" "被軟性棄用的 API 代表不應再用於新程式碼中,但在現有程式碼中繼續使用它仍會是安" "全的。API 仍會以文件記錄並會被測試,但不會被繼續改進。" -#: ../../glossary.rst:1215 +#: ../../glossary.rst:1224 msgid "" "Soft deprecation, unlike normal deprecation, does not plan on removing the " "API and will not emit warnings." msgstr "與正常棄用不同,軟性棄用沒有刪除 API 的規劃,也不會發出警告。" -#: ../../glossary.rst:1218 +#: ../../glossary.rst:1227 msgid "" "See `PEP 387: Soft Deprecation `_." @@ -2805,65 +2808,65 @@ msgstr "" "請參閱 `PEP 387:軟性棄用 `_。" -#: ../../glossary.rst:1220 +#: ../../glossary.rst:1229 msgid "special method" msgstr "special method(特殊方法)" -#: ../../glossary.rst:1224 +#: ../../glossary.rst:1233 msgid "" "A method that is called implicitly by Python to execute a certain operation " "on a type, such as addition. Such methods have names starting and ending " -"with double underscores. Special methods are documented " -"in :ref:`specialnames`." +"with double underscores. Special methods are documented in :ref:" +"`specialnames`." msgstr "" "一種會被 Python 自動呼叫的 method,用於對某種型別執行某種運算,例如加法。這" -"種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在" -"\\ :ref:`specialnames`\\ 中有詳細說明。" +"種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在\\ :ref:" +"`specialnames`\\ 中有詳細說明。" -#: ../../glossary.rst:1228 +#: ../../glossary.rst:1237 msgid "statement" msgstr "statement(陳述式)" -#: ../../glossary.rst:1230 +#: ../../glossary.rst:1239 msgid "" "A statement is part of a suite (a \"block\" of code). A statement is either " -"an :term:`expression` or one of several constructs with a keyword, such " -"as :keyword:`if`, :keyword:`while` or :keyword:`for`." +"an :term:`expression` or one of several constructs with a keyword, such as :" +"keyword:`if`, :keyword:`while` or :keyword:`for`." msgstr "" -"陳述式是一個套組(suite,一個程式碼「區塊」)中的一部分。陳述式可以是一" -"個 :term:`expression`\\ (運算式),或是含有關鍵字(例" -"如 :keyword:`if`、:keyword:`while` 或 :keyword:`for`\\ )的多種結構之一。" +"陳述式是一個套組(suite,一個程式碼「區塊」)中的一部分。陳述式可以是一個 :" +"term:`expression`\\ (運算式),或是含有關鍵字(例如 :keyword:`if`、:keyword:" +"`while` 或 :keyword:`for`\\ )的多種結構之一。" -#: ../../glossary.rst:1233 +#: ../../glossary.rst:1242 msgid "static type checker" msgstr "static type checker(靜態型別檢查器)" -#: ../../glossary.rst:1235 +#: ../../glossary.rst:1244 msgid "" "An external tool that reads Python code and analyzes it, looking for issues " -"such as incorrect types. See also :term:`type hints ` and " -"the :mod:`typing` module." +"such as incorrect types. See also :term:`type hints ` and the :" +"mod:`typing` module." msgstr "" "會讀取 Python 程式碼並分析的外部工具,能夠找出錯誤,像是使用了不正確的型別。" "另請參閱\\ :term:`型別提示 (type hints) ` 以及 :mod:`typing` 模" "組。" -#: ../../glossary.rst:1238 +#: ../../glossary.rst:1247 msgid "strong reference" msgstr "strong reference(強參照)" -#: ../../glossary.rst:1240 +#: ../../glossary.rst:1249 msgid "" "In Python's C API, a strong reference is a reference to an object which is " "owned by the code holding the reference. The strong reference is taken by " -"calling :c:func:`Py_INCREF` when the reference is created and released " -"with :c:func:`Py_DECREF` when the reference is deleted." +"calling :c:func:`Py_INCREF` when the reference is created and released with :" +"c:func:`Py_DECREF` when the reference is deleted." msgstr "" "在 Python 的 C API 中,強參照是對物件的參照,該物件為持有該參照的程式碼所擁" -"有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透" -"過 :c:func:`Py_DECREF` 釋放強參照。" +"有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透過 :c:" +"func:`Py_DECREF` 釋放強參照。" -#: ../../glossary.rst:1246 +#: ../../glossary.rst:1255 msgid "" "The :c:func:`Py_NewRef` function can be used to create a strong reference to " "an object. Usually, the :c:func:`Py_DECREF` function must be called on the " @@ -2873,15 +2876,15 @@ msgstr "" ":c:func:`Py_NewRef` 函式可用於建立一個對物件的強參照。通常,在退出強參照的作" "用域之前,必須在該強參照上呼叫 :c:func:`Py_DECREF` 函式,以避免洩漏一個參照。" -#: ../../glossary.rst:1251 +#: ../../glossary.rst:1260 msgid "See also :term:`borrowed reference`." msgstr "另請參閱 :term:`borrowed reference`\\ (借用參照)。" -#: ../../glossary.rst:1252 +#: ../../glossary.rst:1261 msgid "text encoding" msgstr "text encoding(文字編碼)" -#: ../../glossary.rst:1254 +#: ../../glossary.rst:1263 msgid "" "A string in Python is a sequence of Unicode code points (in range " "``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " @@ -2890,7 +2893,7 @@ msgstr "" "Python 中的字串是一個 Unicode 碼點 (code point) 的序列(範圍在 ``U+0000`` -- " "``U+10FFFF`` 之間)。若要儲存或傳送一個字串,它必須被序列化為一個位元組序列。" -#: ../../glossary.rst:1258 +#: ../../glossary.rst:1267 msgid "" "Serializing a string into a sequence of bytes is known as \"encoding\", and " "recreating the string from the sequence of bytes is known as \"decoding\"." @@ -2898,7 +2901,7 @@ msgstr "" "將一個字串序列化為位元組序列,稱為「編碼」,而從位元組序列重新建立該字串則稱" "為「解碼 (decoding)」。" -#: ../../glossary.rst:1261 +#: ../../glossary.rst:1270 msgid "" "There are a variety of different text serialization :ref:`codecs `, which are collectively referred to as \"text encodings\"." @@ -2906,39 +2909,54 @@ msgstr "" "有多種不同的文字序列化編解碼器 (:ref:`codecs `),它們被統" "稱為「文字編碼」。" -#: ../../glossary.rst:1264 +#: ../../glossary.rst:1273 msgid "text file" msgstr "text file(文字檔案)" -#: ../../glossary.rst:1266 +#: ../../glossary.rst:1275 msgid "" "A :term:`file object` able to read and write :class:`str` objects. Often, a " -"text file actually accesses a byte-oriented datastream and handles " -"the :term:`text encoding` automatically. Examples of text files are files " -"opened in text mode (``'r'`` or " -"``'w'``), :data:`sys.stdin`, :data:`sys.stdout`, and instances " -"of :class:`io.StringIO`." +"text file actually accesses a byte-oriented datastream and handles the :term:" +"`text encoding` automatically. Examples of text files are files opened in " +"text mode (``'r'`` or ``'w'``), :data:`sys.stdin`, :data:`sys.stdout`, and " +"instances of :class:`io.StringIO`." msgstr "" "一個能夠讀取和寫入 :class:`str` 物件的一個 :term:`file object`\\ (檔案物" "件)。通常,文字檔案實際上是存取位元組導向的資料流 (byte-oriented " "datastream) 並會自動處理 :term:`text encoding`\\ (文字編碼)。文字檔案的例子" -"有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔" -"案、:data:`sys.stdin`、:data:`sys.stdout` 以及 :class:`io.StringIO` 的實例。" +"有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔案、:data:`sys.stdin`、:data:" +"`sys.stdout` 以及 :class:`io.StringIO` 的實例。" -#: ../../glossary.rst:1273 +#: ../../glossary.rst:1282 msgid "" -"See also :term:`binary file` for a file object able to read and " -"write :term:`bytes-like objects `." +"See also :term:`binary file` for a file object able to read and write :term:" +"`bytes-like objects `." msgstr "" -"另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入" -"\\ :term:`類位元組串物件 (bytes-like object) ` 的檔案物" -"件。" +"另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入\\ :" +"term:`類位元組串物件 (bytes-like object) ` 的檔案物件。" -#: ../../glossary.rst:1275 +#: ../../glossary.rst:1284 +msgid "token" +msgstr "" + +#: ../../glossary.rst:1287 +msgid "" +"A small unit of source code, generated by the :ref:`lexical analyzer " +"` (also called the *tokenizer*). Names, numbers, strings, " +"operators, newlines and similar are represented by tokens." +msgstr "" + +#: ../../glossary.rst:1292 +msgid "" +"The :mod:`tokenize` module exposes Python's lexical analyzer. The :mod:" +"`token` module contains information on the various types of tokens." +msgstr "" + +#: ../../glossary.rst:1295 msgid "triple-quoted string" msgstr "triple-quoted string(三引號內字串)" -#: ../../glossary.rst:1277 +#: ../../glossary.rst:1297 msgid "" "A string which is bound by three instances of either a quotation mark (\") " "or an apostrophe ('). While they don't provide any functionality not " @@ -2953,37 +2971,36 @@ msgstr "" "中包含未跳脫 (unescaped) 的單引號和雙引號,而且它們不需使用連續字元 " "(continuation character) 就可以跨越多行,這使得它們在編寫說明字串時特別有用。" -#: ../../glossary.rst:1284 +#: ../../glossary.rst:1304 msgid "type" msgstr "type(型別)" -#: ../../glossary.rst:1286 +#: ../../glossary.rst:1306 msgid "" "The type of a Python object determines what kind of object it is; every " -"object has a type. An object's type is accessible as " -"its :attr:`~object.__class__` attribute or can be retrieved with " -"``type(obj)``." +"object has a type. An object's type is accessible as its :attr:`~object." +"__class__` attribute or can be retrieved with ``type(obj)``." msgstr "" "一個 Python 物件的型別決定了它是什麼類型的物件;每個物件都有一個型別。一個物" "件的型別可以用它的 :attr:`~object.__class__` 屬性來存取,或以 ``type(obj)`` " "來檢索。" -#: ../../glossary.rst:1290 +#: ../../glossary.rst:1310 msgid "type alias" msgstr "type alias(型別別名)" -#: ../../glossary.rst:1292 +#: ../../glossary.rst:1312 msgid "A synonym for a type, created by assigning the type to an identifier." msgstr "一個型別的同義詞,透過將型別指定給一個識別符 (identifier) 來建立。" -#: ../../glossary.rst:1294 +#: ../../glossary.rst:1314 msgid "" "Type aliases are useful for simplifying :term:`type hints `. For " "example::" msgstr "" "型別別名對於簡化\\ :term:`型別提示 (type hint) ` 很有用。例如: ::" -#: ../../glossary.rst:1297 +#: ../../glossary.rst:1317 msgid "" "def remove_gray_shades(\n" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" @@ -2993,11 +3010,11 @@ msgstr "" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" " pass" -#: ../../glossary.rst:1301 +#: ../../glossary.rst:1321 msgid "could be made more readable like this::" msgstr "可以寫成這樣,更具有可讀性: ::" -#: ../../glossary.rst:1303 +#: ../../glossary.rst:1323 msgid "" "Color = tuple[int, int, int]\n" "\n" @@ -3009,15 +3026,15 @@ msgstr "" "def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" " pass" -#: ../../glossary.rst:1308 ../../glossary.rst:1322 +#: ../../glossary.rst:1328 ../../glossary.rst:1342 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." msgstr "請參閱 :mod:`typing` 和 :pep:`484`,有此功能的描述。" -#: ../../glossary.rst:1309 +#: ../../glossary.rst:1329 msgid "type hint" msgstr "type hint(型別提示)" -#: ../../glossary.rst:1311 +#: ../../glossary.rst:1331 msgid "" "An :term:`annotation` that specifies the expected type for a variable, a " "class attribute, or a function parameter or return value." @@ -3025,7 +3042,7 @@ msgstr "" "一種 :term:`annotation`\\ (註釋),它指定一個變數、一個 class 屬性或一個函式" "的參數或回傳值的預期型別。" -#: ../../glossary.rst:1314 +#: ../../glossary.rst:1334 msgid "" "Type hints are optional and are not enforced by Python but they are useful " "to :term:`static type checkers `. They can also aid " @@ -3035,45 +3052,45 @@ msgstr "" "(static type checkers) `\\ 很有用,並能協助 IDE 完成程式" "碼的補全 (completion) 和重構 (refactoring)。" -#: ../../glossary.rst:1318 +#: ../../glossary.rst:1338 msgid "" "Type hints of global variables, class attributes, and functions, but not " "local variables, can be accessed using :func:`typing.get_type_hints`." msgstr "" -"全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使" -"用 :func:`typing.get_type_hints` 來存取。" +"全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使用 :func:" +"`typing.get_type_hints` 來存取。" -#: ../../glossary.rst:1323 +#: ../../glossary.rst:1343 msgid "universal newlines" msgstr "universal newlines(通用換行字元)" -#: ../../glossary.rst:1325 +#: ../../glossary.rst:1345 msgid "" "A manner of interpreting text streams in which all of the following are " "recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the " "Windows convention ``'\\r\\n'``, and the old Macintosh convention " -"``'\\r'``. See :pep:`278` and :pep:`3116`, as well " -"as :func:`bytes.splitlines` for an additional use." +"``'\\r'``. See :pep:`278` and :pep:`3116`, as well as :func:`bytes." +"splitlines` for an additional use." msgstr "" "一種解譯文字流 (text stream) 的方式,會將以下所有的情況識別為一行的結束:" "Unix 行尾慣例 ``'\\n'``、Windows 慣例 ``'\\r\\n'`` 和舊的 Macintosh 慣例 " -"``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用" -"於 :func:`bytes.splitlines` 的附加用途。" +"``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用於 :func:`bytes." +"splitlines` 的附加用途。" -#: ../../glossary.rst:1330 +#: ../../glossary.rst:1350 msgid "variable annotation" msgstr "variable annotation(變數註釋)" -#: ../../glossary.rst:1332 +#: ../../glossary.rst:1352 msgid "An :term:`annotation` of a variable or a class attribute." msgstr "一個變數或 class 屬性的 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:1334 +#: ../../glossary.rst:1354 msgid "" "When annotating a variable or a class attribute, assignment is optional::" msgstr "註釋變數或 class 屬性時,賦值是選擇性的: ::" -#: ../../glossary.rst:1336 +#: ../../glossary.rst:1356 msgid "" "class C:\n" " field: 'annotation'" @@ -3081,7 +3098,7 @@ msgstr "" "class C:\n" " field: 'annotation'" -#: ../../glossary.rst:1339 +#: ../../glossary.rst:1359 msgid "" "Variable annotations are usually used for :term:`type hints `: " "for example this variable is expected to take :class:`int` values::" @@ -3089,15 +3106,15 @@ msgstr "" "變數註釋通常用於\\ :term:`型別提示 (type hint) `:例如,這個變數預" "期會取得 :class:`int`\\ (整數)值: ::" -#: ../../glossary.rst:1343 +#: ../../glossary.rst:1363 msgid "count: int = 0" msgstr "count: int = 0" -#: ../../glossary.rst:1345 +#: ../../glossary.rst:1365 msgid "Variable annotation syntax is explained in section :ref:`annassign`." msgstr "變數註釋的語法在\\ :ref:`annassign`\\ 章節有詳細的解釋。" -#: ../../glossary.rst:1347 +#: ../../glossary.rst:1367 msgid "" "See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe " "this functionality. Also see :ref:`annotations-howto` for best practices on " @@ -3106,11 +3123,11 @@ msgstr "" "請參閱 :term:`function annotation`\\ (函式註釋)、:pep:`484` 和 :pep:`526`," "皆有此功能的描述。關於註釋的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:1351 +#: ../../glossary.rst:1371 msgid "virtual environment" msgstr "virtual environment(虛擬環境)" -#: ../../glossary.rst:1353 +#: ../../glossary.rst:1373 msgid "" "A cooperatively isolated runtime environment that allows Python users and " "applications to install and upgrade Python distribution packages without " @@ -3121,27 +3138,27 @@ msgstr "" "程式得以安裝和升級 Python 發佈套件,而不會對同一個系統上運行的其他 Python 應" "用程式的行為產生干擾。" -#: ../../glossary.rst:1358 +#: ../../glossary.rst:1378 msgid "See also :mod:`venv`." msgstr "另請參閱 :mod:`venv`。" -#: ../../glossary.rst:1359 +#: ../../glossary.rst:1379 msgid "virtual machine" msgstr "virtual machine(虛擬機器)" -#: ../../glossary.rst:1361 +#: ../../glossary.rst:1381 msgid "" "A computer defined entirely in software. Python's virtual machine executes " "the :term:`bytecode` emitted by the bytecode compiler." msgstr "" -"一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行" -"由 :term:`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" +"一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行由 :term:" +"`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" -#: ../../glossary.rst:1363 +#: ../../glossary.rst:1383 msgid "Zen of Python" msgstr "Zen of Python(Python 之禪)" -#: ../../glossary.rst:1365 +#: ../../glossary.rst:1385 msgid "" "Listing of Python design principles and philosophies that are helpful in " "understanding and using the language. The listing can be found by typing " @@ -3158,22 +3175,22 @@ msgstr "C-contiguous(C 連續的)" msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" -#: ../../glossary.rst:827 +#: ../../glossary.rst:831 msgid "magic" msgstr "magic" -#: ../../glossary.rst:1222 +#: ../../glossary.rst:1231 msgid "special" msgstr "special" #~ msgid "" #~ "An object which controls the environment seen in a :keyword:`with` " -#~ "statement by defining :meth:`~object.__enter__` " -#~ "and :meth:`~object.__exit__` methods. See :pep:`343`." +#~ "statement by defining :meth:`~object.__enter__` and :meth:`~object." +#~ "__exit__` methods. See :pep:`343`." #~ msgstr "" -#~ "一個可以控制 :keyword:`with` 陳述式中所見環境的物件,而它是透過定" -#~ "義 :meth:`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。" -#~ "請參閱 :pep:`343`。" +#~ "一個可以控制 :keyword:`with` 陳述式中所見環境的物件,而它是透過定義 :meth:" +#~ "`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。請參閱 :" +#~ "pep:`343`。" #~ msgid "" #~ "A variable which can have different values depending on its context. This " diff --git a/howto/curses.po b/howto/curses.po index d28b8e7fb1..5c22aaf379 100644 --- a/howto/curses.po +++ b/howto/curses.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-04-11 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -240,8 +240,8 @@ msgid "" " v = i-10\n" " stdscr.addstr(i, 0, '10 divided by {} is {}'.format(v, 10/v))\n" "\n" -" stdscr.refresh()\n" -" stdscr.getkey()\n" +" stdscr.refresh()\n" +" stdscr.getkey()\n" "\n" "wrapper(main)" msgstr "" diff --git a/howto/descriptor.po b/howto/descriptor.po index 4d1b659340..8a489fafc2 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -75,8 +75,9 @@ msgstr "" msgid "" "The last section has pure Python equivalents for built-in descriptors that " "are written in C. Read this if you're curious about how functions turn into " -"bound methods or about the implementation of common tools like :func:" -"`classmethod`, :func:`staticmethod`, :func:`property`, and :term:`__slots__`." +"bound methods or about the implementation of common tools " +"like :func:`classmethod`, :func:`staticmethod`, :func:`property`, " +"and :term:`__slots__`." msgstr "" #: ../../howto/descriptor.rst:36 @@ -230,8 +231,9 @@ msgid "" "A popular use for descriptors is managing access to instance data. The " "descriptor is assigned to a public attribute in the class dictionary while " "the actual data is stored as a private attribute in the instance " -"dictionary. The descriptor's :meth:`~object.__get__` and :meth:`~object." -"__set__` methods are triggered when the public attribute is accessed." +"dictionary. The descriptor's :meth:`~object.__get__` " +"and :meth:`~object.__set__` methods are triggered when the public attribute " +"is accessed." msgstr "" #: ../../howto/descriptor.rst:139 @@ -369,9 +371,10 @@ msgstr "" #: ../../howto/descriptor.rst:256 msgid "" -"An interactive session shows that the :class:`!Person` class has called :" -"meth:`~object.__set_name__` so that the field names would be recorded. Here " -"we call :func:`vars` to look up the descriptor without triggering it:" +"An interactive session shows that the :class:`!Person` class has " +"called :meth:`~object.__set_name__` so that the field names would be " +"recorded. Here we call :func:`vars` to look up the descriptor without " +"triggering it:" msgstr "" #: ../../howto/descriptor.rst:260 @@ -428,8 +431,9 @@ msgstr "" #: ../../howto/descriptor.rst:297 msgid "" -"A :term:`descriptor` is what we call any object that defines :meth:`~object." -"__get__`, :meth:`~object.__set__`, or :meth:`~object.__delete__`." +"A :term:`descriptor` is what we call any object that " +"defines :meth:`~object.__get__`, :meth:`~object.__set__`, " +"or :meth:`~object.__delete__`." msgstr "" #: ../../howto/descriptor.rst:300 @@ -469,9 +473,9 @@ msgstr "" #: ../../howto/descriptor.rst:319 msgid "" "Descriptors are used throughout the language. It is how functions turn into " -"bound methods. Common tools like :func:`classmethod`, :func:" -"`staticmethod`, :func:`property`, and :func:`functools.cached_property` are " -"all implemented as descriptors." +"bound methods. Common tools " +"like :func:`classmethod`, :func:`staticmethod`, :func:`property`, " +"and :func:`functools.cached_property` are all implemented as descriptors." msgstr "" #: ../../howto/descriptor.rst:326 @@ -561,9 +565,9 @@ msgstr "" #: ../../howto/descriptor.rst:374 msgid "" -":class:`!Number` verifies that a value is either an :class:`int` or :class:" -"`float`. Optionally, it verifies that a value is between a given minimum or " -"maximum." +":class:`!Number` verifies that a value is either an :class:`int` " +"or :class:`float`. Optionally, it verifies that a value is between a given " +"minimum or maximum." msgstr "" #: ../../howto/descriptor.rst:378 @@ -716,9 +720,10 @@ msgstr "" #: ../../howto/descriptor.rst:503 msgid "" "In general, a descriptor is an attribute value that has one of the methods " -"in the descriptor protocol. Those methods are :meth:`~object.__get__`, :" -"meth:`~object.__set__`, and :meth:`~object.__delete__`. If any of those " -"methods are defined for an attribute, it is said to be a :term:`descriptor`." +"in the descriptor protocol. Those methods " +"are :meth:`~object.__get__`, :meth:`~object.__set__`, " +"and :meth:`~object.__delete__`. If any of those methods are defined for an " +"attribute, it is said to be a :term:`descriptor`." msgstr "" #: ../../howto/descriptor.rst:508 @@ -736,10 +741,10 @@ msgstr "" #: ../../howto/descriptor.rst:517 msgid "" "Descriptors are a powerful, general purpose protocol. They are the " -"mechanism behind properties, methods, static methods, class methods, and :" -"func:`super`. They are used throughout Python itself. Descriptors simplify " -"the underlying C code and offer a flexible set of new tools for everyday " -"Python programs." +"mechanism behind properties, methods, static methods, class methods, " +"and :func:`super`. They are used throughout Python itself. Descriptors " +"simplify the underlying C code and offer a flexible set of new tools for " +"everyday Python programs." msgstr "" #: ../../howto/descriptor.rst:525 @@ -768,9 +773,9 @@ msgstr "" #: ../../howto/descriptor.rst:537 msgid "" "If an object defines :meth:`~object.__set__` or :meth:`~object.__delete__`, " -"it is considered a data descriptor. Descriptors that only define :meth:" -"`~object.__get__` are called non-data descriptors (they are often used for " -"methods but other uses are possible)." +"it is considered a data descriptor. Descriptors that only " +"define :meth:`~object.__get__` are called non-data descriptors (they are " +"often used for methods but other uses are possible)." msgstr "" #: ../../howto/descriptor.rst:542 @@ -785,9 +790,10 @@ msgstr "" #: ../../howto/descriptor.rst:548 msgid "" "To make a read-only data descriptor, define both :meth:`~object.__get__` " -"and :meth:`~object.__set__` with the :meth:`~object.__set__` raising an :exc:" -"`AttributeError` when called. Defining the :meth:`~object.__set__` method " -"with an exception raising placeholder is enough to make it a data descriptor." +"and :meth:`~object.__set__` with the :meth:`~object.__set__` raising " +"an :exc:`AttributeError` when called. Defining the :meth:`~object.__set__` " +"method with an exception raising placeholder is enough to make it a data " +"descriptor." msgstr "" #: ../../howto/descriptor.rst:555 @@ -796,8 +802,8 @@ msgstr "" #: ../../howto/descriptor.rst:557 msgid "" -"A descriptor can be called directly with ``desc.__get__(obj)`` or ``desc." -"__get__(None, cls)``." +"A descriptor can be called directly with ``desc.__get__(obj)`` or " +"``desc.__get__(None, cls)``." msgstr "" #: ../../howto/descriptor.rst:560 @@ -834,8 +840,8 @@ msgstr "" #: ../../howto/descriptor.rst:580 msgid "" -"If a descriptor is found for ``a.x``, then it is invoked with: ``desc." -"__get__(a, type(a))``." +"If a descriptor is found for ``a.x``, then it is invoked with: " +"``desc.__get__(a, type(a))``." msgstr "" #: ../../howto/descriptor.rst:583 @@ -875,18 +881,19 @@ msgstr "" #: ../../howto/descriptor.rst:722 msgid "" -"Note, there is no :meth:`~object.__getattr__` hook in the :meth:`~object." -"__getattribute__` code. That is why calling :meth:`~object." -"__getattribute__` directly or with ``super().__getattribute__`` will bypass :" -"meth:`~object.__getattr__` entirely." +"Note, there is no :meth:`~object.__getattr__` hook in " +"the :meth:`~object.__getattribute__` code. That is why " +"calling :meth:`~object.__getattribute__` directly or with " +"``super().__getattribute__`` will bypass :meth:`~object.__getattr__` " +"entirely." msgstr "" #: ../../howto/descriptor.rst:726 msgid "" "Instead, it is the dot operator and the :func:`getattr` function that are " -"responsible for invoking :meth:`~object.__getattr__` whenever :meth:`~object." -"__getattribute__` raises an :exc:`AttributeError`. Their logic is " -"encapsulated in a helper function:" +"responsible for invoking :meth:`~object.__getattr__` " +"whenever :meth:`~object.__getattribute__` raises an :exc:`AttributeError`. " +"Their logic is encapsulated in a helper function:" msgstr "" #: ../../howto/descriptor.rst:731 @@ -915,10 +922,10 @@ msgstr "" #: ../../howto/descriptor.rst:778 msgid "" -"The logic for a dotted lookup such as ``A.x`` is in :meth:`!type." -"__getattribute__`. The steps are similar to those for :meth:`!object." -"__getattribute__` but the instance dictionary lookup is replaced by a search " -"through the class's :term:`method resolution order`." +"The logic for a dotted lookup such as ``A.x`` is in :meth:`!" +"type.__getattribute__`. The steps are similar to those for :meth:`!" +"object.__getattribute__` but the instance dictionary lookup is replaced by a " +"search through the class's :term:`method resolution order`." msgstr "" #: ../../howto/descriptor.rst:783 @@ -927,8 +934,8 @@ msgstr "" #: ../../howto/descriptor.rst:785 msgid "" -"The full C implementation can be found in :c:func:`!type_getattro` and :c:" -"func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." +"The full C implementation can be found in :c:func:`!type_getattro` " +"and :c:func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." msgstr "" #: ../../howto/descriptor.rst:790 @@ -937,22 +944,23 @@ msgstr "" #: ../../howto/descriptor.rst:792 msgid "" -"The logic for super's dotted lookup is in the :meth:`~object." -"__getattribute__` method for object returned by :func:`super`." +"The logic for super's dotted lookup is in " +"the :meth:`~object.__getattribute__` method for object returned " +"by :func:`super`." msgstr "" #: ../../howto/descriptor.rst:795 msgid "" -"A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__." -"__mro__`` for the base class ``B`` immediately following ``A`` and then " -"returns ``B.__dict__['m'].__get__(obj, A)``. If not a descriptor, ``m`` is " -"returned unchanged." +"A dotted lookup such as ``super(A, obj).m`` searches " +"``obj.__class__.__mro__`` for the base class ``B`` immediately following " +"``A`` and then returns ``B.__dict__['m'].__get__(obj, A)``. If not a " +"descriptor, ``m`` is returned unchanged." msgstr "" #: ../../howto/descriptor.rst:800 msgid "" -"The full C implementation can be found in :c:func:`!super_getattro` in :" -"source:`Objects/typeobject.c`. A pure Python equivalent can be found in " +"The full C implementation can be found in :c:func:`!super_getattro` " +"in :source:`Objects/typeobject.c`. A pure Python equivalent can be found in " "`Guido's Tutorial `_." msgstr "" @@ -963,9 +971,9 @@ msgstr "" #: ../../howto/descriptor.rst:809 msgid "" -"The mechanism for descriptors is embedded in the :meth:`~object." -"__getattribute__` methods for :class:`object`, :class:`type`, and :func:" -"`super`." +"The mechanism for descriptors is embedded in " +"the :meth:`~object.__getattribute__` methods " +"for :class:`object`, :class:`type`, and :func:`super`." msgstr "" #: ../../howto/descriptor.rst:812 @@ -978,8 +986,8 @@ msgstr "" #: ../../howto/descriptor.rst:816 msgid "" -"Classes inherit this machinery from :class:`object`, :class:`type`, or :func:" -"`super`." +"Classes inherit this machinery from :class:`object`, :class:`type`, " +"or :func:`super`." msgstr "" #: ../../howto/descriptor.rst:819 @@ -1038,8 +1046,8 @@ msgstr "ORM 範例" #: ../../howto/descriptor.rst:853 msgid "" "The following code is a simplified skeleton showing how data descriptors " -"could be used to implement an `object relational mapping `_." +"could be used to implement an `object relational mapping `_." msgstr "" #: ../../howto/descriptor.rst:857 @@ -1083,9 +1091,9 @@ msgstr "" #: ../../howto/descriptor.rst:876 msgid "" -"We can use the :class:`!Field` class to define `models `_ that describe the schema for each table in a " -"database:" +"We can use the :class:`!Field` class to define `models `_ that describe the schema for each " +"table in a database:" msgstr "" #: ../../howto/descriptor.rst:880 @@ -1342,10 +1350,10 @@ msgstr "" #: ../../howto/descriptor.rst:1189 msgid "" -"To support automatic creation of methods, functions include the :meth:" -"`~object.__get__` method for binding methods during attribute access. This " -"means that functions are non-data descriptors that return bound methods " -"during dotted lookup from an instance. Here's how it works:" +"To support automatic creation of methods, functions include " +"the :meth:`~object.__get__` method for binding methods during attribute " +"access. This means that functions are non-data descriptors that return " +"bound methods during dotted lookup from an instance. Here's how it works:" msgstr "" #: ../../howto/descriptor.rst:1194 @@ -1397,8 +1405,9 @@ msgstr "" #: ../../howto/descriptor.rst:1233 msgid "" -"Accessing the function through the class dictionary does not invoke :meth:" -"`~object.__get__`. Instead, it just returns the underlying function object::" +"Accessing the function through the class dictionary does not " +"invoke :meth:`~object.__get__`. Instead, it just returns the underlying " +"function object::" msgstr "" #: ../../howto/descriptor.rst:1236 @@ -1535,10 +1544,10 @@ msgstr "" #: ../../howto/descriptor.rst:1293 msgid "" "Static methods return the underlying function without changes. Calling " -"either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into ``object." -"__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, \"f\")``. As a " -"result, the function becomes identically accessible from either an object or " -"a class." +"either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into " +"``object.__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, " +"\"f\")``. As a result, the function becomes identically accessible from " +"either an object or a class." msgstr "" #: ../../howto/descriptor.rst:1299 @@ -1591,8 +1600,8 @@ msgstr "" #: ../../howto/descriptor.rst:1328 msgid "" -"Using the non-data descriptor protocol, a pure Python version of :func:" -"`staticmethod` would look like this:" +"Using the non-data descriptor protocol, a pure Python version " +"of :func:`staticmethod` would look like this:" msgstr "" #: ../../howto/descriptor.rst:1331 @@ -1617,9 +1626,9 @@ msgstr "" msgid "" "The :func:`functools.update_wrapper` call adds a ``__wrapped__`` attribute " "that refers to the underlying function. Also it carries forward the " -"attributes necessary to make the wrapper look like the wrapped function: :" -"attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function." -"__doc__`, and :attr:`~function.__annotations__`." +"attributes necessary to make the wrapper look like the wrapped " +"function: :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__`, " +"and :attr:`~function.__annotations__`." msgstr "" #: ../../howto/descriptor.rst:1417 @@ -1698,8 +1707,8 @@ msgstr "" #: ../../howto/descriptor.rst:1464 msgid "" -"Using the non-data descriptor protocol, a pure Python version of :func:" -"`classmethod` would look like this:" +"Using the non-data descriptor protocol, a pure Python version " +"of :func:`classmethod` would look like this:" msgstr "" #: ../../howto/descriptor.rst:1467 @@ -1724,9 +1733,9 @@ msgid "" "The :func:`functools.update_wrapper` call in ``ClassMethod`` adds a " "``__wrapped__`` attribute that refers to the underlying function. Also it " "carries forward the attributes necessary to make the wrapper look like the " -"wrapped function: :attr:`~function.__name__`, :attr:`~function." -"__qualname__`, :attr:`~function.__doc__`, and :attr:`~function." -"__annotations__`." +"wrapped " +"function: :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__`, " +"and :attr:`~function.__annotations__`." msgstr "" #: ../../howto/descriptor.rst:1538 @@ -2053,23 +2062,3 @@ msgstr "" "Traceback (most recent call last):\n" " ...\n" "AttributeError: 'H' object has no attribute 'xz'" - -#~ msgid "" -#~ "class G:\n" -#~ " @classmethod\n" -#~ " @property\n" -#~ " def __doc__(cls):\n" -#~ " return f'A doc for {cls.__name__!r}'" -#~ msgstr "" -#~ "class G:\n" -#~ " @classmethod\n" -#~ " @property\n" -#~ " def __doc__(cls):\n" -#~ " return f'A doc for {cls.__name__!r}'" - -#~ msgid "" -#~ ">>> G.__doc__\n" -#~ "\"A doc for 'G'\"" -#~ msgstr "" -#~ ">>> G.__doc__\n" -#~ "\"A doc for 'G'\"" diff --git a/howto/enum.po b/howto/enum.po index eeeae58470..924ee16d8a 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-27 00:14+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+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-" @@ -211,9 +211,12 @@ msgstr "" #: ../../howto/enum.rst:108 msgid "" ">>> from datetime import date\n" -">>> Weekday.from_date(date.today()) \n" +">>> Weekday.from_date(date.today())\n" "" msgstr "" +">>> from datetime import date\n" +">>> Weekday.from_date(date.today())\n" +"" #: ../../howto/enum.rst:112 msgid "" @@ -312,15 +315,15 @@ msgstr "" #: ../../howto/enum.rst:154 msgid "" ">>> chores_for_ethan = {\n" -"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." -"FRIDAY,\n" +"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | " +"Weekday.FRIDAY,\n" "... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n" "... 'answer SO questions': Weekday.SATURDAY,\n" "... }" msgstr "" ">>> chores_for_ethan = {\n" -"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." -"FRIDAY,\n" +"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | " +"Weekday.FRIDAY,\n" "... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n" "... 'answer SO questions': Weekday.SATURDAY,\n" "... }" @@ -383,8 +386,8 @@ msgstr "" #: ../../howto/enum.rst:191 msgid "" -"Sometimes it's useful to access members in enumerations programmatically (i." -"e. situations where ``Color.RED`` won't do because the exact color is not " +"Sometimes it's useful to access members in enumerations programmatically " +"(i.e. situations where ``Color.RED`` won't do because the exact color is not " "known at program-writing time). ``Enum`` allows such access::" msgstr "" @@ -624,16 +627,16 @@ msgid "" ">>> list(Shape)\n" "[, , ]\n" ">>> list(Weekday)\n" -"[, , , , , , ]" +"[, , , " +", , , " +"]" msgstr "" ">>> list(Shape)\n" "[, , ]\n" ">>> list(Weekday)\n" -"[, , , , , , ]" +"[, , , " +", , , " +"]" #: ../../howto/enum.rst:319 msgid "" @@ -836,24 +839,25 @@ msgid "" "The rules for what is allowed are as follows: names that start and end with " "a single underscore are reserved by enum and cannot be used; all other " "attributes defined within an enumeration will become members of this " -"enumeration, with the exception of special methods (:meth:`~object." -"__str__`, :meth:`~object.__add__`, etc.), descriptors (methods are also " -"descriptors), and variable names listed in :attr:`~Enum._ignore_`." +"enumeration, with the exception of special methods " +"(:meth:`~object.__str__`, :meth:`~object.__add__`, etc.), descriptors " +"(methods are also descriptors), and variable names listed " +"in :attr:`~Enum._ignore_`." msgstr "" #: ../../howto/enum.rst:432 msgid "" -"Note: if your enumeration defines :meth:`~object.__new__` and/or :meth:" -"`~object.__init__`, any value(s) given to the enum member will be passed " -"into those methods. See `Planet`_ for an example." +"Note: if your enumeration defines :meth:`~object.__new__` and/" +"or :meth:`~object.__init__`, any value(s) given to the enum member will be " +"passed into those methods. See `Planet`_ for an example." msgstr "" #: ../../howto/enum.rst:438 msgid "" "The :meth:`~object.__new__` method, if defined, is used during creation of " "the Enum members; it is then replaced by Enum's :meth:`~object.__new__` " -"which is used after class creation for lookup of existing members. See :ref:" -"`new-vs-init` for more details." +"which is used after class creation for lookup of existing members. " +"See :ref:`new-vs-init` for more details." msgstr "" #: ../../howto/enum.rst:445 @@ -935,8 +939,8 @@ msgstr "" #: ../../howto/enum.rst:486 msgid "" -"When inheriting from a :class:`~dataclasses.dataclass`, the :meth:`~Enum." -"__repr__` omits the inherited class' name. For example::" +"When inheriting from a :class:`~dataclasses.dataclass`, " +"the :meth:`~Enum.__repr__` omits the inherited class' name. For example::" msgstr "" #: ../../howto/enum.rst:489 @@ -1037,9 +1041,10 @@ msgstr "" #: ../../howto/enum.rst:547 msgid "" -"It is possible to modify how enum members are pickled/unpickled by defining :" -"meth:`~object.__reduce_ex__` in the enumeration class. The default method " -"is by-value, but enums with complicated values may want to use by-name::" +"It is possible to modify how enum members are pickled/unpickled by " +"defining :meth:`~object.__reduce_ex__` in the enumeration class. The " +"default method is by-value, but enums with complicated values may want to " +"use by-name::" msgstr "" #: ../../howto/enum.rst:551 @@ -1148,10 +1153,10 @@ msgstr "" #: ../../howto/enum.rst:611 msgid "" -"The new pickle protocol 4 also, in some circumstances, relies on :attr:" -"`~type.__qualname__` being set to the location where pickle will be able to " -"find the class. For example, if the class was made available in class " -"SomeData in the global scope::" +"The new pickle protocol 4 also, in some circumstances, relies " +"on :attr:`~type.__qualname__` being set to the location where pickle will be " +"able to find the class. For example, if the class was made available in " +"class SomeData in the global scope::" msgstr "" #: ../../howto/enum.rst:616 @@ -1254,10 +1259,10 @@ msgstr "IntEnum" #: ../../howto/enum.rst:667 msgid "" -"The first variation of :class:`Enum` that is provided is also a subclass of :" -"class:`int`. Members of an :class:`IntEnum` can be compared to integers; by " -"extension, integer enumerations of different types can also be compared to " -"each other::" +"The first variation of :class:`Enum` that is provided is also a subclass " +"of :class:`int`. Members of an :class:`IntEnum` can be compared to " +"integers; by extension, integer enumerations of different types can also be " +"compared to each other::" msgstr "" #: ../../howto/enum.rst:672 @@ -1366,9 +1371,9 @@ msgid "" "The next variation of :class:`Enum` provided, :class:`IntFlag`, is also " "based on :class:`int`. The difference being :class:`IntFlag` members can be " "combined using the bitwise operators (&, \\|, ^, ~) and the result is still " -"an :class:`IntFlag` member, if possible. Like :class:`IntEnum`, :class:" -"`IntFlag` members are also integers and can be used wherever an :class:`int` " -"is used." +"an :class:`IntFlag` member, if possible. " +"Like :class:`IntEnum`, :class:`IntFlag` members are also integers and can be " +"used wherever an :class:`int` is used." msgstr "" #: ../../howto/enum.rst:733 @@ -1458,8 +1463,8 @@ msgstr "" #: ../../howto/enum.rst:781 msgid "" "Another important difference between :class:`IntFlag` and :class:`Enum` is " -"that if no flags are set (the value is 0), its boolean evaluation is :data:" -"`False`::" +"that if no flags are set (the value is 0), its boolean evaluation " +"is :data:`False`::" msgstr "" #: ../../howto/enum.rst:784 @@ -1527,10 +1532,10 @@ msgstr "Flag" #: ../../howto/enum.rst:817 msgid "" "The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` " -"members can be combined using the bitwise operators (&, \\|, ^, ~). Unlike :" -"class:`IntFlag`, they cannot be combined with, nor compared against, any " -"other :class:`Flag` enumeration, nor :class:`int`. While it is possible to " -"specify the values directly it is recommended to use :class:`auto` as the " +"members can be combined using the bitwise operators (&, \\|, ^, ~). " +"Unlike :class:`IntFlag`, they cannot be combined with, nor compared against, " +"any other :class:`Flag` enumeration, nor :class:`int`. While it is possible " +"to specify the values directly it is recommended to use :class:`auto` as the " "value and let :class:`Flag` select an appropriate value." msgstr "" @@ -1639,10 +1644,10 @@ msgid "" "For the majority of new code, :class:`Enum` and :class:`Flag` are strongly " "recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic " "promises of an enumeration (by being comparable to integers, and thus by " -"transitivity to other unrelated enumerations). :class:`IntEnum` and :class:" -"`IntFlag` should be used only in cases where :class:`Enum` and :class:`Flag` " -"will not do; for example, when integer constants are replaced with " -"enumerations, or for interoperability with other systems." +"transitivity to other unrelated enumerations). :class:`IntEnum` " +"and :class:`IntFlag` should be used only in cases where :class:`Enum` " +"and :class:`Flag` will not do; for example, when integer constants are " +"replaced with enumerations, or for interoperability with other systems." msgstr "" #: ../../howto/enum.rst:886 @@ -1666,8 +1671,8 @@ msgstr "" #: ../../howto/enum.rst:894 msgid "" "This demonstrates how similar derived enumerations can be defined; for " -"example a :class:`!FloatEnum` that mixes in :class:`float` instead of :class:" -"`int`." +"example a :class:`!FloatEnum` that mixes in :class:`float` instead " +"of :class:`int`." msgstr "" #: ../../howto/enum.rst:897 @@ -1676,24 +1681,24 @@ msgstr "一些規則:" #: ../../howto/enum.rst:899 msgid "" -"When subclassing :class:`Enum`, mix-in types must appear before the :class:" -"`Enum` class itself in the sequence of bases, as in the :class:`IntEnum` " -"example above." +"When subclassing :class:`Enum`, mix-in types must appear before " +"the :class:`Enum` class itself in the sequence of bases, as in " +"the :class:`IntEnum` example above." msgstr "" #: ../../howto/enum.rst:902 msgid "" -"Mix-in types must be subclassable. For example, :class:`bool` and :class:" -"`range` are not subclassable and will throw an error during Enum creation if " -"used as the mix-in type." +"Mix-in types must be subclassable. For example, :class:`bool` " +"and :class:`range` are not subclassable and will throw an error during Enum " +"creation if used as the mix-in type." msgstr "" #: ../../howto/enum.rst:905 msgid "" "While :class:`Enum` can have members of any type, once you mix in an " -"additional type, all the members must have values of that type, e.g. :class:" -"`int` above. This restriction does not apply to mix-ins which only add " -"methods and don't specify another type." +"additional type, all the members must have values of that type, " +"e.g. :class:`int` above. This restriction does not apply to mix-ins which " +"only add methods and don't specify another type." msgstr "" #: ../../howto/enum.rst:909 @@ -1705,30 +1710,30 @@ msgstr "" #: ../../howto/enum.rst:912 msgid "" -"A ``data type`` is a mixin that defines :meth:`~object.__new__`, or a :class:" -"`~dataclasses.dataclass`" +"A ``data type`` is a mixin that defines :meth:`~object.__new__`, or " +"a :class:`~dataclasses.dataclass`" msgstr "" #: ../../howto/enum.rst:914 msgid "" -"%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` class's :meth:" -"`~object.__str__` and :meth:`~object.__repr__` respectively; other codes " -"(such as ``%i`` or ``%h`` for IntEnum) treat the enum member as its mixed-in " -"type." +"%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` " +"class's :meth:`~object.__str__` and :meth:`~object.__repr__` respectively; " +"other codes (such as ``%i`` or ``%h`` for IntEnum) treat the enum member as " +"its mixed-in type." msgstr "" #: ../../howto/enum.rst:917 msgid "" -":ref:`Formatted string literals `, :meth:`str.format`, and :func:" -"`format` will use the enum's :meth:`~object.__str__` method." +":ref:`Formatted string literals `, :meth:`str.format`, " +"and :func:`format` will use the enum's :meth:`~object.__str__` method." msgstr "" #: ../../howto/enum.rst:922 msgid "" "Because :class:`IntEnum`, :class:`IntFlag`, and :class:`StrEnum` are " -"designed to be drop-in replacements for existing constants, their :meth:" -"`~object.__str__` method has been reset to their data types' :meth:`~object." -"__str__` method." +"designed to be drop-in replacements for existing constants, " +"their :meth:`~object.__str__` method has been reset to their data " +"types' :meth:`~object.__str__` method." msgstr "" #: ../../howto/enum.rst:930 @@ -1739,8 +1744,8 @@ msgstr "" msgid "" ":meth:`~object.__new__` must be used whenever you want to customize the " "actual value of the :class:`Enum` member. Any other modifications may go in " -"either :meth:`~object.__new__` or :meth:`~object.__init__`, with :meth:" -"`~object.__init__` being preferred." +"either :meth:`~object.__new__` or :meth:`~object.__init__`, " +"with :meth:`~object.__init__` being preferred." msgstr "" #: ../../howto/enum.rst:936 @@ -1786,7 +1791,7 @@ msgstr "" #: ../../howto/enum.rst:971 msgid "Supported ``__dunder__`` names" -msgstr "" +msgstr "有支援的 ``__dunder__`` 名稱" #: ../../howto/enum.rst:973 msgid "" @@ -1797,14 +1802,14 @@ msgstr "" #: ../../howto/enum.rst:976 msgid "" ":meth:`~object.__new__`, if specified, must create and return the enum " -"members; it is also a very good idea to set the member's :attr:`~Enum." -"_value_` appropriately. Once all the members are created it is no longer " -"used." +"members; it is also a very good idea to set the " +"member's :attr:`~Enum._value_` appropriately. Once all the members are " +"created it is no longer used." msgstr "" #: ../../howto/enum.rst:982 msgid "Supported ``_sunder_`` names" -msgstr "" +msgstr "有支援的 ``_sunder_`` 名稱" #: ../../howto/enum.rst:984 msgid ":attr:`~Enum._name_` -- name of the member" @@ -1822,9 +1827,9 @@ msgstr "" #: ../../howto/enum.rst:988 msgid "" -":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" -"class:`str`, that will not be transformed into members, and will be removed " -"from the final class" +":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or " +"a :class:`str`, that will not be transformed into members, and will be " +"removed from the final class" msgstr "" #: ../../howto/enum.rst:991 @@ -1872,7 +1877,7 @@ msgstr "``_ignore_``" #: ../../howto/enum.rst:1011 msgid "``_add_alias_``, ``_add_value_alias_``" -msgstr "" +msgstr "``_add_alias_``、``_add_value_alias_``" #: ../../howto/enum.rst:1013 msgid "" @@ -1968,11 +1973,11 @@ msgstr "" #: ../../howto/enum.rst:1074 msgid "" -"Enum classes that are mixed with non-:class:`Enum` types (such as :class:" -"`int`, :class:`str`, etc.) are evaluated according to the mixed-in type's " -"rules; otherwise, all members evaluate as :data:`True`. To make your own " -"enum's boolean evaluation depend on the member's value add the following to " -"your class::" +"Enum classes that are mixed with non-:class:`Enum` types (such " +"as :class:`int`, :class:`str`, etc.) are evaluated according to the mixed-in " +"type's rules; otherwise, all members evaluate as :data:`True`. To make your " +"own enum's boolean evaluation depend on the member's value add the following " +"to your class::" msgstr "" #: ../../howto/enum.rst:1080 @@ -2000,23 +2005,23 @@ msgstr "" #: ../../howto/enum.rst:1093 msgid "" -">>> dir(Planet) \n" +">>> dir(Planet)\n" "['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', " "'VENUS', '__class__', '__doc__', '__members__', '__module__']\n" -">>> dir(Planet.EARTH) \n" +">>> dir(Planet.EARTH)\n" "['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', " "'surface_gravity', 'value']" msgstr "" -">>> dir(Planet) \n" +">>> dir(Planet)\n" "['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', " "'VENUS', '__class__', '__doc__', '__members__', '__module__']\n" -">>> dir(Planet.EARTH) \n" +">>> dir(Planet.EARTH)\n" "['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', " "'surface_gravity', 'value']" #: ../../howto/enum.rst:1100 msgid "Combining members of ``Flag``" -msgstr "" +msgstr "``Flag`` 的成員組合" #: ../../howto/enum.rst:1102 msgid "" @@ -2196,23 +2201,23 @@ msgstr "" #: ../../howto/enum.rst:1193 msgid "STRICT --> raises an exception when presented with invalid values" -msgstr "" +msgstr "STRICT --> 當遇到無效值時引發例外" #: ../../howto/enum.rst:1194 msgid "CONFORM --> discards any invalid bits" -msgstr "" +msgstr "CONFORM --> 捨棄任何無效位元" #: ../../howto/enum.rst:1195 msgid "EJECT --> lose Flag status and become a normal int with the given value" -msgstr "" +msgstr "EJECT --> 失去 Flag 狀態並成為具有給定值的普通 int" #: ../../howto/enum.rst:1196 msgid "KEEP --> keep the extra bits" -msgstr "" +msgstr "KEEP --> 保留額外位元" #: ../../howto/enum.rst:1198 msgid "keeps Flag status and extra bits" -msgstr "" +msgstr "保留 Flag 狀態和額外位元" #: ../../howto/enum.rst:1199 msgid "extra bits do not show up in iteration" @@ -2225,18 +2230,18 @@ msgstr "" #: ../../howto/enum.rst:1202 msgid "" "The default for Flag is ``STRICT``, the default for ``IntFlag`` is " -"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl." -"Options`` for an example of when ``KEEP`` is needed)." +"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see " +"``ssl.Options`` for an example of when ``KEEP`` is needed)." msgstr "" #: ../../howto/enum.rst:1210 msgid "How are Enums and Flags different?" -msgstr "" +msgstr "Enums 和 Flags 有何不同?" #: ../../howto/enum.rst:1212 msgid "" -"Enums have a custom metaclass that affects many aspects of both derived :" -"class:`Enum` classes and their instances (members)." +"Enums have a custom metaclass that affects many aspects of both " +"derived :class:`Enum` classes and their instances (members)." msgstr "" #: ../../howto/enum.rst:1217 @@ -2245,14 +2250,14 @@ msgstr "Enum 類別" #: ../../howto/enum.rst:1219 msgid "" -"The :class:`EnumType` metaclass is responsible for providing the :meth:" -"`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` " +"The :class:`EnumType` metaclass is responsible for providing " +"the :meth:`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` " "and other methods that allow one to do things with an :class:`Enum` class " "that fail on a typical class, such as ``list(Color)`` or ``some_enum_var in " "Color``. :class:`EnumType` is responsible for ensuring that various other " -"methods on the final :class:`Enum` class are correct (such as :meth:`~object." -"__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` and :meth:" -"`~object.__repr__`)." +"methods on the final :class:`Enum` class are correct (such " +"as :meth:`~object.__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` " +"and :meth:`~object.__repr__`)." msgstr "" #: ../../howto/enum.rst:1228 @@ -2263,8 +2268,8 @@ msgstr "Flag 類別" msgid "" "Flags have an expanded view of aliasing: to be canonical, the value of a " "flag needs to be a power-of-two value, and not a duplicate name. So, in " -"addition to the :class:`Enum` definition of alias, a flag with no value (a.k." -"a. ``0``) or with more than one power-of-two value (e.g. ``3``) is " +"addition to the :class:`Enum` definition of alias, a flag with no value " +"(a.k.a. ``0``) or with more than one power-of-two value (e.g. ``3``) is " "considered an alias." msgstr "" @@ -2274,11 +2279,11 @@ msgstr "" #: ../../howto/enum.rst:1238 msgid "" -"The most interesting thing about enum members is that they are singletons. :" -"class:`EnumType` creates them all while it is creating the enum class " -"itself, and then puts a custom :meth:`~object.__new__` in place to ensure " -"that no new ones are ever instantiated by returning only the existing member " -"instances." +"The most interesting thing about enum members is that they are " +"singletons. :class:`EnumType` creates them all while it is creating the enum " +"class itself, and then puts a custom :meth:`~object.__new__` in place to " +"ensure that no new ones are ever instantiated by returning only the existing " +"member instances." msgstr "" #: ../../howto/enum.rst:1244 @@ -2337,15 +2342,16 @@ msgstr "" #: ../../howto/enum.rst:1273 msgid "" -"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :" -"class:`IntFlag` are expected to cover the majority of use-cases, they cannot " -"cover them all. Here are recipes for some different types of enumerations " -"that can be used directly, or as examples for creating one's own." +"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, " +"and :class:`IntFlag` are expected to cover the majority of use-cases, they " +"cannot cover them all. Here are recipes for some different types of " +"enumerations that can be used directly, or as examples for creating one's " +"own." msgstr "" #: ../../howto/enum.rst:1280 msgid "Omitting values" -msgstr "" +msgstr "省略值" #: ../../howto/enum.rst:1282 msgid "" @@ -2384,7 +2390,7 @@ msgstr "使用 :class:`auto`" #: ../../howto/enum.rst:1299 msgid "Using :class:`auto` would look like::" -msgstr "" +msgstr "使用 :class:`auto` 會像這樣: ::" #: ../../howto/enum.rst:1301 msgid "" @@ -2410,7 +2416,7 @@ msgstr "使用 :class:`object`" #: ../../howto/enum.rst:1313 msgid "Using :class:`object` would look like::" -msgstr "" +msgstr "使用 :class:`object` 會像這樣: ::" #: ../../howto/enum.rst:1315 msgid "" @@ -2419,7 +2425,7 @@ msgid "" "... GREEN = object()\n" "... BLUE = object()\n" "...\n" -">>> Color.GREEN \n" +">>> Color.GREEN\n" ">" msgstr "" ">>> class Color(Enum):\n" @@ -2427,13 +2433,13 @@ msgstr "" "... GREEN = object()\n" "... BLUE = object()\n" "...\n" -">>> Color.GREEN \n" +">>> Color.GREEN\n" ">" #: ../../howto/enum.rst:1323 msgid "" -"This is also a good example of why you might want to write your own :meth:" -"`~object.__repr__`::" +"This is also a good example of why you might want to write your " +"own :meth:`~object.__repr__`::" msgstr "" #: ../../howto/enum.rst:1326 @@ -2486,7 +2492,7 @@ msgstr "" #: ../../howto/enum.rst:1353 msgid "Using a custom :meth:`~object.__new__`" -msgstr "" +msgstr "使用自訂的 :meth:`~object.__new__`" #: ../../howto/enum.rst:1355 msgid "Using an auto-numbering :meth:`~object.__new__` would look like::" @@ -2774,11 +2780,11 @@ msgid "" "... Period['day_%d' % i] = i\n" "...\n" ">>> list(Period)[:2]\n" -"[, ]\n" +"[, ]\n" ">>> list(Period)[-2:]\n" -"[, ]" +"[, ]" msgstr "" #: ../../howto/enum.rst:1558 diff --git a/howto/functional.po b/howto/functional.po index 15ccb13599..b41774276d 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -20,7 +20,7 @@ msgstr "" #: ../../howto/functional.rst:5 msgid "Functional Programming HOWTO" -msgstr "函式編程 HOWTO" +msgstr "函式程式設計 HOWTO" #: ../../howto/functional.rst:0 msgid "Author" @@ -1011,11 +1011,11 @@ msgid "" ">>> import random\n" ">>> # Generate 8 random numbers between [0, 10000)\n" ">>> rand_list = random.sample(range(10000), 8)\n" -">>> rand_list \n" +">>> rand_list\n" "[769, 7953, 9828, 6431, 8442, 9878, 6213, 2207]\n" -">>> sorted(rand_list) \n" +">>> sorted(rand_list)\n" "[769, 2207, 6213, 6431, 7953, 8442, 9828, 9878]\n" -">>> sorted(rand_list, reverse=True) \n" +">>> sorted(rand_list, reverse=True)\n" "[9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]" msgstr "" diff --git a/howto/ipaddress.po b/howto/ipaddress.po index 69bef65056..b4124f004d 100644 --- a/howto/ipaddress.po +++ b/howto/ipaddress.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2024-07-20 16:09+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -54,7 +53,7 @@ msgstr "" #: ../../howto/ipaddress.rst:24 msgid "Creating Address/Network/Interface objects" -msgstr "" +msgstr "建立 Address/Network/Interface 物件" #: ../../howto/ipaddress.rst:26 msgid "" @@ -146,8 +145,8 @@ msgstr "定義網路" #: ../../howto/ipaddress.rst:84 msgid "" -"Host addresses are usually grouped together into IP networks, so :mod:" -"`ipaddress` provides a way to create, inspect and manipulate network " +"Host addresses are usually grouped together into IP networks, " +"so :mod:`ipaddress` provides a way to create, inspect and manipulate network " "definitions. IP network objects are constructed from strings that define the " "range of host addresses that are part of that network. The simplest form for " "that information is a \"network address/network prefix\" pair, where the " @@ -243,11 +242,11 @@ msgid "" "network, neither the address nor the network classes are sufficient. " "Notation like ``192.0.2.1/24`` is commonly used by network engineers and the " "people who write tools for firewalls and routers as shorthand for \"the host " -"``192.0.2.1`` on the network ``192.0.2.0/24``\", Accordingly, :mod:" -"`ipaddress` provides a set of hybrid classes that associate an address with " -"a particular network. The interface for creation is identical to that for " -"defining network objects, except that the address portion isn't constrained " -"to being a network address." +"``192.0.2.1`` on the network ``192.0.2.0/24``\", " +"Accordingly, :mod:`ipaddress` provides a set of hybrid classes that " +"associate an address with a particular network. The interface for creation " +"is identical to that for defining network objects, except that the address " +"portion isn't constrained to being a network address." msgstr "" #: ../../howto/ipaddress.rst:152 @@ -258,13 +257,13 @@ msgstr "" #: ../../howto/ipaddress.rst:157 msgid "Inspecting Address/Network/Interface Objects" -msgstr "" +msgstr "檢視 Address/Network/Interface 物件" #: ../../howto/ipaddress.rst:159 msgid "" "You've gone to the trouble of creating an IPv(4|6)(Address|Network|" -"Interface) object, so you probably want to get information about it. :mod:" -"`ipaddress` tries to make doing this easy and intuitive." +"Interface) object, so you probably want to get information about " +"it. :mod:`ipaddress` tries to make doing this easy and intuitive." msgstr "" #: ../../howto/ipaddress.rst:163 @@ -335,7 +334,7 @@ msgstr "" msgid "" ">>> net4 = ipaddress.ip_network('192.0.2.0/24')\n" ">>> for x in net4.hosts():\n" -"... print(x) \n" +"... print(x)\n" "192.0.2.1\n" "192.0.2.2\n" "192.0.2.3\n" @@ -347,7 +346,7 @@ msgid "" msgstr "" ">>> net4 = ipaddress.ip_network('192.0.2.0/24')\n" ">>> for x in net4.hosts():\n" -"... print(x) \n" +"... print(x)\n" "192.0.2.1\n" "192.0.2.2\n" "192.0.2.3\n" @@ -436,6 +435,8 @@ msgid "" "if address in network:\n" " # do something" msgstr "" +"if address in network:\n" +" # 做某些事情" #: ../../howto/ipaddress.rst:259 msgid "Containment testing is done efficiently based on the network prefix::" @@ -457,7 +458,7 @@ msgstr "" #: ../../howto/ipaddress.rst:269 msgid "Comparisons" -msgstr "" +msgstr "比較" #: ../../howto/ipaddress.rst:271 msgid "" @@ -521,9 +522,9 @@ msgstr "" #: ../../howto/ipaddress.rst:305 msgid "" "To support use cases where it is useful to have access to this additional " -"detail, the individual class constructors actually raise the :exc:" -"`ValueError` subclasses :exc:`ipaddress.AddressValueError` and :exc:" -"`ipaddress.NetmaskValueError` to indicate exactly which part of the " +"detail, the individual class constructors actually raise " +"the :exc:`ValueError` subclasses :exc:`ipaddress.AddressValueError` " +"and :exc:`ipaddress.NetmaskValueError` to indicate exactly which part of the " "definition failed to parse correctly." msgstr "" @@ -587,3 +588,7 @@ msgid "" "except ValueError:\n" " print('address/netmask is invalid for IPv4:', address)" msgstr "" +"try:\n" +" network = ipaddress.IPv4Network(address)\n" +"except ValueError:\n" +" print('address/netmask is invalid for IPv4:', address)" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index 340d2075f3..725f48933a 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-08 00:13+0000\n" +"POT-Creation-Date: 2025-02-21 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -68,8 +68,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " -"%(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" +"(message)s')\n" "fh.setFormatter(formatter)\n" "ch.setFormatter(formatter)\n" "# add the handlers to the logger\n" @@ -100,8 +100,8 @@ msgid "" "\n" "class Auxiliary:\n" " def __init__(self):\n" -" self.logger = logging.getLogger('spam_application.auxiliary." -"Auxiliary')\n" +" self.logger = " +"logging.getLogger('spam_application.auxiliary.Auxiliary')\n" " self.logger.info('creating an instance of Auxiliary')\n" "\n" " def do_something(self):\n" @@ -163,8 +163,8 @@ msgid "" " time.sleep(0.5)\n" "\n" "def main():\n" -" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d " -"%(threadName)s %(message)s')\n" +" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d %" +"(threadName)s %(message)s')\n" " info = {'stop': False}\n" " thread = threading.Thread(target=worker, args=(info,))\n" " thread.start()\n" @@ -241,8 +241,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " -"%(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" +"(message)s')\n" "ch.setFormatter(formatter)\n" "fh.setFormatter(formatter)\n" "# add the handlers to logger\n" @@ -295,8 +295,8 @@ msgid "" "\n" "# set up logging to file - see previous section for more details\n" "logging.basicConfig(level=logging.DEBUG,\n" -" format='%(asctime)s %(name)-12s %(levelname)-8s " -"%(message)s',\n" +" format='%(asctime)s %(name)-12s %(levelname)-8s %" +"(message)s',\n" " datefmt='%m-%d %H:%M',\n" " filename='/tmp/myapp.log',\n" " filemode='w')\n" @@ -504,9 +504,9 @@ msgid "" "a function which only returns ``True`` if the level of the passed in record " "is at or below the specified level. Note that in this example I have defined " "the ``filter_maker`` in a test script ``main.py`` that I run from the " -"command line, so its module will be ``__main__`` - hence the ``__main__." -"filter_maker`` in the filter configuration. You will need to change that if " -"you define it in a different module." +"command line, so its module will be ``__main__`` - hence the " +"``__main__.filter_maker`` in the filter configuration. You will need to " +"change that if you define it in a different module." msgstr "" #: ../../howto/logging-cookbook.rst:387 @@ -683,6 +683,22 @@ msgid "" "s.close()\n" "print('complete')" msgstr "" +"#!/usr/bin/env python\n" +"import socket, sys, struct\n" +"\n" +"with open(sys.argv[1], 'rb') as f:\n" +" data_to_send = f.read()\n" +"\n" +"HOST = 'localhost'\n" +"PORT = 9999\n" +"s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"print('connecting...')\n" +"s.connect((HOST, PORT))\n" +"print('sending config...')\n" +"s.send(struct.pack('>L', len(data_to_send)))\n" +"s.send(data_to_send)\n" +"s.close()\n" +"print('complete')" #: ../../howto/logging-cookbook.rst:547 msgid "Dealing with handlers that block" @@ -697,13 +713,13 @@ msgstr "" #: ../../howto/logging-cookbook.rst:555 msgid "" -"A common culprit which demonstrates sluggish behaviour is the :class:" -"`SMTPHandler`: sending emails can take a long time, for a number of reasons " -"outside the developer's control (for example, a poorly performing mail or " -"network infrastructure). But almost any network-based handler can block: " -"Even a :class:`SocketHandler` operation may do a DNS query under the hood " -"which is too slow (and this query can be deep in the socket library code, " -"below the Python layer, and outside your control)." +"A common culprit which demonstrates sluggish behaviour is " +"the :class:`SMTPHandler`: sending emails can take a long time, for a number " +"of reasons outside the developer's control (for example, a poorly performing " +"mail or network infrastructure). But almost any network-based handler can " +"block: Even a :class:`SocketHandler` operation may do a DNS query under the " +"hood which is too slow (and this query can be deep in the socket library " +"code, below the Python layer, and outside your control)." msgstr "" #: ../../howto/logging-cookbook.rst:563 @@ -723,12 +739,12 @@ msgstr "" #: ../../howto/logging-cookbook.rst:574 msgid "" "The second part of the solution is :class:`QueueListener`, which has been " -"designed as the counterpart to :class:`QueueHandler`. A :class:" -"`QueueListener` is very simple: it's passed a queue and some handlers, and " -"it fires up an internal thread which listens to its queue for LogRecords " -"sent from ``QueueHandlers`` (or any other source of ``LogRecords``, for that " -"matter). The ``LogRecords`` are removed from the queue and passed to the " -"handlers for processing." +"designed as the counterpart to :class:`QueueHandler`. " +"A :class:`QueueListener` is very simple: it's passed a queue and some " +"handlers, and it fires up an internal thread which listens to its queue for " +"LogRecords sent from ``QueueHandlers`` (or any other source of " +"``LogRecords``, for that matter). The ``LogRecords`` are removed from the " +"queue and passed to the handlers for processing." msgstr "" #: ../../howto/logging-cookbook.rst:582 @@ -776,10 +792,10 @@ msgid "" "Although the earlier discussion wasn't specifically talking about async " "code, but rather about slow logging handlers, it should be noted that when " "logging from async code, network and even file handlers could lead to " -"problems (blocking the event loop) because some logging is done from :mod:" -"`asyncio` internals. It might be best, if any async code is used in an " -"application, to use the above approach for logging, so that any blocking " -"code runs only in the ``QueueListener`` thread." +"problems (blocking the event loop) because some logging is done " +"from :mod:`asyncio` internals. It might be best, if any async code is used " +"in an application, to use the above approach for logging, so that any " +"blocking code runs only in the ``QueueListener`` thread." msgstr "" #: ../../howto/logging-cookbook.rst:619 @@ -801,8 +817,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:634 msgid "" "Let's say you want to send logging events across a network, and handle them " -"at the receiving end. A simple way of doing this is attaching a :class:" -"`SocketHandler` instance to the root logger at the sending end::" +"at the receiving end. A simple way of doing this is attaching " +"a :class:`SocketHandler` instance to the root logger at the sending end::" msgstr "" #: ../../howto/logging-cookbook.rst:638 @@ -835,8 +851,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:662 msgid "" -"At the receiving end, you can set up a receiver using the :mod:" -"`socketserver` module. Here is a basic working example::" +"At the receiving end, you can set up a receiver using " +"the :mod:`socketserver` module. Here is a basic working example::" msgstr "" #: ../../howto/logging-cookbook.rst:665 @@ -920,8 +936,8 @@ msgid "" "\n" "def main():\n" " logging.basicConfig(\n" -" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s " -"%(message)s')\n" +" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s %" +"(message)s')\n" " tcpserver = LogRecordSocketReceiver()\n" " print('About to start TCP server...')\n" " tcpserver.serve_until_stopped()\n" @@ -1054,8 +1070,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:811 msgid "" -"Download `the Gist `__ as a ZIP archive using the :" -"guilabel:`Download ZIP` button." +"Download `the Gist `__ as a ZIP archive using " +"the :guilabel:`Download ZIP` button." msgstr "" #: ../../howto/logging-cookbook.rst:814 @@ -1102,11 +1118,32 @@ msgid "" "configured ports clash with something else in your test environment." msgstr "" -#: ../../howto/logging-cookbook.rst:843 +#: ../../howto/logging-cookbook.rst:838 +msgid "" +"The default configuration uses a TCP socket on port 9020. You can use a Unix " +"Domain socket instead of a TCP socket by doing the following:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:841 +msgid "" +"In :file:`listener.json`, add a ``socket`` key with the path to the domain " +"socket you want to use. If this key is present, the listener listens on the " +"corresponding domain socket and not on a TCP socket (the ``port`` key is " +"ignored)." +msgstr "" + +#: ../../howto/logging-cookbook.rst:846 +msgid "" +"In :file:`webapp.json`, change the socket handler configuration dictionary " +"so that the ``host`` value is the path to the domain socket, and set the " +"``port`` value to ``null``." +msgstr "" + +#: ../../howto/logging-cookbook.rst:856 msgid "Adding contextual information to your logging output" msgstr "" -#: ../../howto/logging-cookbook.rst:845 +#: ../../howto/logging-cookbook.rst:858 msgid "" "Sometimes you want logging output to contain contextual information in " "addition to the parameters passed to the logging call. For example, in a " @@ -1118,37 +1155,37 @@ msgid "" "is not a good idea because these instances are not garbage collected. While " "this is not a problem in practice, when the number of :class:`Logger` " "instances is dependent on the level of granularity you want to use in " -"logging an application, it could be hard to manage if the number of :class:" -"`Logger` instances becomes effectively unbounded." +"logging an application, it could be hard to manage if the number " +"of :class:`Logger` instances becomes effectively unbounded." msgstr "" -#: ../../howto/logging-cookbook.rst:860 +#: ../../howto/logging-cookbook.rst:873 msgid "Using LoggerAdapters to impart contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:862 +#: ../../howto/logging-cookbook.rst:875 msgid "" "An easy way in which you can pass contextual information to be output along " "with logging event information is to use the :class:`LoggerAdapter` class. " -"This class is designed to look like a :class:`Logger`, so that you can call :" -"meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:" -"`exception`, :meth:`critical` and :meth:`log`. These methods have the same " -"signatures as their counterparts in :class:`Logger`, so you can use the two " -"types of instances interchangeably." +"This class is designed to look like a :class:`Logger`, so that you can " +"call :meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:`exception`, :meth:`critical` " +"and :meth:`log`. These methods have the same signatures as their " +"counterparts in :class:`Logger`, so you can use the two types of instances " +"interchangeably." msgstr "" -#: ../../howto/logging-cookbook.rst:870 +#: ../../howto/logging-cookbook.rst:883 msgid "" -"When you create an instance of :class:`LoggerAdapter`, you pass it a :class:" -"`Logger` instance and a dict-like object which contains your contextual " -"information. When you call one of the logging methods on an instance of :" -"class:`LoggerAdapter`, it delegates the call to the underlying instance of :" -"class:`Logger` passed to its constructor, and arranges to pass the " -"contextual information in the delegated call. Here's a snippet from the code " -"of :class:`LoggerAdapter`::" +"When you create an instance of :class:`LoggerAdapter`, you pass it " +"a :class:`Logger` instance and a dict-like object which contains your " +"contextual information. When you call one of the logging methods on an " +"instance of :class:`LoggerAdapter`, it delegates the call to the underlying " +"instance of :class:`Logger` passed to its constructor, and arranges to pass " +"the contextual information in the delegated call. Here's a snippet from the " +"code of :class:`LoggerAdapter`::" msgstr "" -#: ../../howto/logging-cookbook.rst:878 +#: ../../howto/logging-cookbook.rst:891 msgid "" "def debug(self, msg, /, *args, **kwargs):\n" " \"\"\"\n" @@ -1159,7 +1196,7 @@ msgid "" " self.logger.debug(msg, *args, **kwargs)" msgstr "" -#: ../../howto/logging-cookbook.rst:886 +#: ../../howto/logging-cookbook.rst:899 msgid "" "The :meth:`~LoggerAdapter.process` method of :class:`LoggerAdapter` is where " "the contextual information is added to the logging output. It's passed the " @@ -1172,18 +1209,19 @@ msgid "" "be silently overwritten." msgstr "" -#: ../../howto/logging-cookbook.rst:895 +#: ../../howto/logging-cookbook.rst:908 msgid "" "The advantage of using 'extra' is that the values in the dict-like object " "are merged into the :class:`LogRecord` instance's __dict__, allowing you to " "use customized strings with your :class:`Formatter` instances which know " "about the keys of the dict-like object. If you need a different method, e.g. " "if you want to prepend or append the contextual information to the message " -"string, you just need to subclass :class:`LoggerAdapter` and override :meth:" -"`~LoggerAdapter.process` to do what you need. Here is a simple example::" +"string, you just need to subclass :class:`LoggerAdapter` and " +"override :meth:`~LoggerAdapter.process` to do what you need. Here is a " +"simple example::" msgstr "" -#: ../../howto/logging-cookbook.rst:903 +#: ../../howto/logging-cookbook.rst:916 msgid "" "class CustomAdapter(logging.LoggerAdapter):\n" " \"\"\"\n" @@ -1194,27 +1232,27 @@ msgid "" " return '[%s] %s' % (self.extra['connid'], msg), kwargs" msgstr "" -#: ../../howto/logging-cookbook.rst:911 +#: ../../howto/logging-cookbook.rst:924 msgid "which you can use like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:913 +#: ../../howto/logging-cookbook.rst:926 msgid "" "logger = logging.getLogger(__name__)\n" "adapter = CustomAdapter(logger, {'connid': some_conn_id})" msgstr "" -#: ../../howto/logging-cookbook.rst:916 +#: ../../howto/logging-cookbook.rst:929 msgid "" "Then any events that you log to the adapter will have the value of " "``some_conn_id`` prepended to the log messages." msgstr "" -#: ../../howto/logging-cookbook.rst:920 +#: ../../howto/logging-cookbook.rst:933 msgid "Using objects other than dicts to pass contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:922 +#: ../../howto/logging-cookbook.rst:935 msgid "" "You don't need to pass an actual dict to a :class:`LoggerAdapter` - you " "could pass an instance of a class which implements ``__getitem__`` and " @@ -1223,32 +1261,32 @@ msgid "" "would be constant)." msgstr "" -#: ../../howto/logging-cookbook.rst:931 +#: ../../howto/logging-cookbook.rst:944 msgid "Using Filters to impart contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:933 +#: ../../howto/logging-cookbook.rst:946 msgid "" -"You can also add contextual information to log output using a user-defined :" -"class:`Filter`. ``Filter`` instances are allowed to modify the " +"You can also add contextual information to log output using a user-" +"defined :class:`Filter`. ``Filter`` instances are allowed to modify the " "``LogRecords`` passed to them, including adding additional attributes which " -"can then be output using a suitable format string, or if needed a custom :" -"class:`Formatter`." +"can then be output using a suitable format string, or if needed a " +"custom :class:`Formatter`." msgstr "" -#: ../../howto/logging-cookbook.rst:938 +#: ../../howto/logging-cookbook.rst:951 msgid "" "For example in a web application, the request being processed (or at least, " -"the interesting parts of it) can be stored in a threadlocal (:class:" -"`threading.local`) variable, and then accessed from a ``Filter`` to add, " -"say, information from the request - say, the remote IP address and remote " -"user's username - to the ``LogRecord``, using the attribute names 'ip' and " -"'user' as in the ``LoggerAdapter`` example above. In that case, the same " -"format string can be used to get similar output to that shown above. Here's " -"an example script::" +"the interesting parts of it) can be stored in a threadlocal " +"(:class:`threading.local`) variable, and then accessed from a ``Filter`` to " +"add, say, information from the request - say, the remote IP address and " +"remote user's username - to the ``LogRecord``, using the attribute names " +"'ip' and 'user' as in the ``LoggerAdapter`` example above. In that case, the " +"same format string can be used to get similar output to that shown above. " +"Here's an example script::" msgstr "" -#: ../../howto/logging-cookbook.rst:947 +#: ../../howto/logging-cookbook.rst:960 msgid "" "import logging\n" "from random import choice\n" @@ -1291,11 +1329,11 @@ msgid "" "'parameters')" msgstr "" -#: ../../howto/logging-cookbook.rst:984 +#: ../../howto/logging-cookbook.rst:997 msgid "which, when run, produces something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:986 +#: ../../howto/logging-cookbook.rst:999 msgid "" "2010-09-06 22:38:15,292 a.b.c DEBUG IP: 123.231.231.123 User: fred A " "debug message\n" @@ -1323,11 +1361,11 @@ msgid "" "message at INFO level with 2 parameters" msgstr "" -#: ../../howto/logging-cookbook.rst:1002 +#: ../../howto/logging-cookbook.rst:1015 msgid "Use of ``contextvars``" msgstr "" -#: ../../howto/logging-cookbook.rst:1004 +#: ../../howto/logging-cookbook.rst:1017 msgid "" "Since Python 3.7, the :mod:`contextvars` module has provided context-local " "storage which works for both :mod:`threading` and :mod:`asyncio` processing " @@ -1337,7 +1375,7 @@ msgid "" "attributes handled by web applications." msgstr "" -#: ../../howto/logging-cookbook.rst:1010 +#: ../../howto/logging-cookbook.rst:1023 msgid "" "For the purposes of illustration, say that you have different web " "applications, each independent of the other but running in the same Python " @@ -1348,11 +1386,11 @@ msgid "" "information such as client IP, HTTP request method and client username?" msgstr "" -#: ../../howto/logging-cookbook.rst:1017 +#: ../../howto/logging-cookbook.rst:1030 msgid "Let's assume that the library can be simulated by the following code:" msgstr "" -#: ../../howto/logging-cookbook.rst:1019 +#: ../../howto/logging-cookbook.rst:1032 msgid "" "# webapplib.py\n" "import logging\n" @@ -1367,14 +1405,14 @@ msgid "" " time.sleep(0.01)" msgstr "" -#: ../../howto/logging-cookbook.rst:1033 +#: ../../howto/logging-cookbook.rst:1046 msgid "" "We can simulate the multiple web applications by means of two simple " "classes, ``Request`` and ``WebApp``. These simulate how real threaded web " "applications work - each request is handled by a thread:" msgstr "" -#: ../../howto/logging-cookbook.rst:1037 +#: ../../howto/logging-cookbook.rst:1050 msgid "" "# main.py\n" "import argparse\n" @@ -1402,8 +1440,8 @@ msgid "" "\n" "# A dummy set of requests which will be used in the simulation - we'll just " "pick\n" -"# from this list randomly. Note that all GET requests are from 192.168.2." -"XXX\n" +"# from this list randomly. Note that all GET requests are from " +"192.168.2.XXX\n" "# addresses, whereas POST requests are from 192.16.3.XXX addresses. Three " "users\n" "# are represented in the sample requests.\n" @@ -1421,8 +1459,8 @@ msgid "" "information\n" "# such as HTTP method, client IP and username\n" "\n" -"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s " -"%(user)-6s %(ip)s %(method)-4s %(message)s')\n" +"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s %" +"(user)-6s %(ip)s %(method)-4s %(message)s')\n" "\n" "# Create our context variables. These will be filled at the start of " "request\n" @@ -1529,7 +1567,7 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1177 +#: ../../howto/logging-cookbook.rst:1190 msgid "" "If you run the above, you should find that roughly half the requests go " "into :file:`app1.log` and the rest into :file:`app2.log`, and the all the " @@ -1540,7 +1578,7 @@ msgid "" "illustrated by the following shell output:" msgstr "" -#: ../../howto/logging-cookbook.rst:1184 +#: ../../howto/logging-cookbook.rst:1197 msgid "" "~/logging-contextual-webapp$ python main.py\n" "app1 processed 51 requests\n" @@ -1595,11 +1633,11 @@ msgid "" "147" msgstr "" -#: ../../howto/logging-cookbook.rst:1224 +#: ../../howto/logging-cookbook.rst:1237 msgid "Imparting contextual information in handlers" msgstr "" -#: ../../howto/logging-cookbook.rst:1226 +#: ../../howto/logging-cookbook.rst:1239 msgid "" "Each :class:`~Handler` has its own chain of filters. If you want to add " "contextual information to a :class:`LogRecord` without leaking it to other " @@ -1607,7 +1645,7 @@ msgid "" "instead of modifying it in-place, as shown in the following script::" msgstr "" -#: ../../howto/logging-cookbook.rst:1231 +#: ../../howto/logging-cookbook.rst:1244 msgid "" "import copy\n" "import logging\n" @@ -1628,12 +1666,30 @@ msgid "" "\n" " logger.info('A log message')" msgstr "" +"import copy\n" +"import logging\n" +"\n" +"def filter(record: logging.LogRecord):\n" +" record = copy.copy(record)\n" +" record.user = 'jim'\n" +" return record\n" +"\n" +"if __name__ == '__main__':\n" +" logger = logging.getLogger()\n" +" logger.setLevel(logging.INFO)\n" +" handler = logging.StreamHandler()\n" +" formatter = logging.Formatter('%(message)s from %(user)-8s')\n" +" handler.setFormatter(formatter)\n" +" handler.addFilter(filter)\n" +" logger.addHandler(handler)\n" +"\n" +" logger.info('A log message')" -#: ../../howto/logging-cookbook.rst:1253 +#: ../../howto/logging-cookbook.rst:1266 msgid "Logging to a single file from multiple processes" msgstr "" -#: ../../howto/logging-cookbook.rst:1255 +#: ../../howto/logging-cookbook.rst:1268 msgid "" "Although logging is thread-safe, and logging to a single file from multiple " "threads in a single process *is* supported, logging to a single file from " @@ -1643,21 +1699,22 @@ msgid "" "this is to have all the processes log to a :class:`~handlers.SocketHandler`, " "and have a separate process which implements a socket server which reads " "from the socket and logs to file. (If you prefer, you can dedicate one " -"thread in one of the existing processes to perform this function.) :ref:" -"`This section ` documents this approach in more detail and " -"includes a working socket receiver which can be used as a starting point for " -"you to adapt in your own applications." +"thread in one of the existing processes to perform this " +"function.) :ref:`This section ` documents this approach in " +"more detail and includes a working socket receiver which can be used as a " +"starting point for you to adapt in your own applications." msgstr "" -#: ../../howto/logging-cookbook.rst:1268 +#: ../../howto/logging-cookbook.rst:1281 msgid "" -"You could also write your own handler which uses the :class:" -"`~multiprocessing.Lock` class from the :mod:`multiprocessing` module to " -"serialize access to the file from your processes. The stdlib :class:" -"`FileHandler` and subclasses do not make use of :mod:`multiprocessing`." +"You could also write your own handler which uses " +"the :class:`~multiprocessing.Lock` class from the :mod:`multiprocessing` " +"module to serialize access to the file from your processes. The " +"stdlib :class:`FileHandler` and subclasses do not make use " +"of :mod:`multiprocessing`." msgstr "" -#: ../../howto/logging-cookbook.rst:1275 +#: ../../howto/logging-cookbook.rst:1288 msgid "" "Alternatively, you can use a ``Queue`` and a :class:`QueueHandler` to send " "all logging events to one of the processes in your multi-process " @@ -1672,7 +1729,7 @@ msgid "" "requirements::" msgstr "" -#: ../../howto/logging-cookbook.rst:1286 +#: ../../howto/logging-cookbook.rst:1299 msgid "" "# You'll need these imports in your own code\n" "import logging\n" @@ -1705,8 +1762,8 @@ msgid "" "def listener_configurer():\n" " root = logging.getLogger()\n" " h = logging.handlers.RotatingFileHandler('mptest.log', 'a', 300, 10)\n" -" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s " -"%(levelname)-8s %(message)s')\n" +" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s %" +"(levelname)-8s %(message)s')\n" " h.setFormatter(f)\n" " root.addHandler(h)\n" "\n" @@ -1792,13 +1849,13 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1391 +#: ../../howto/logging-cookbook.rst:1404 msgid "" "A variant of the above script keeps the logging in the main process, in a " "separate thread::" msgstr "" -#: ../../howto/logging-cookbook.rst:1394 +#: ../../howto/logging-cookbook.rst:1407 msgid "" "import logging\n" "import logging.config\n" @@ -1838,8 +1895,8 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " -"%(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" +"(processName)-10s %(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -1895,7 +1952,7 @@ msgid "" " lp.join()" msgstr "" -#: ../../howto/logging-cookbook.rst:1486 +#: ../../howto/logging-cookbook.rst:1499 msgid "" "This variant shows how you can e.g. apply configuration for particular " "loggers - e.g. the ``foo`` logger has a special handler which stores all " @@ -1905,36 +1962,36 @@ msgid "" "appropriate destinations." msgstr "" -#: ../../howto/logging-cookbook.rst:1493 +#: ../../howto/logging-cookbook.rst:1506 msgid "Using concurrent.futures.ProcessPoolExecutor" msgstr "使用 concurrent.futures.ProcessPoolExecutor" -#: ../../howto/logging-cookbook.rst:1495 +#: ../../howto/logging-cookbook.rst:1508 msgid "" "If you want to use :class:`concurrent.futures.ProcessPoolExecutor` to start " "your worker processes, you need to create the queue slightly differently. " "Instead of" msgstr "" -#: ../../howto/logging-cookbook.rst:1499 +#: ../../howto/logging-cookbook.rst:1512 msgid "queue = multiprocessing.Queue(-1)" msgstr "queue = multiprocessing.Queue(-1)" -#: ../../howto/logging-cookbook.rst:1503 +#: ../../howto/logging-cookbook.rst:1516 msgid "you should use" msgstr "" -#: ../../howto/logging-cookbook.rst:1505 +#: ../../howto/logging-cookbook.rst:1518 msgid "" "queue = multiprocessing.Manager().Queue(-1) # also works with the examples " "above" msgstr "" -#: ../../howto/logging-cookbook.rst:1509 +#: ../../howto/logging-cookbook.rst:1522 msgid "and you can then replace the worker creation from this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1511 +#: ../../howto/logging-cookbook.rst:1524 msgid "" "workers = []\n" "for i in range(10):\n" @@ -1946,22 +2003,22 @@ msgid "" " w.join()" msgstr "" -#: ../../howto/logging-cookbook.rst:1520 +#: ../../howto/logging-cookbook.rst:1533 msgid "to this (remembering to first import :mod:`concurrent.futures`)::" msgstr "" -#: ../../howto/logging-cookbook.rst:1522 +#: ../../howto/logging-cookbook.rst:1535 msgid "" "with concurrent.futures.ProcessPoolExecutor(max_workers=10) as executor:\n" " for i in range(10):\n" " executor.submit(worker_process, queue, worker_configurer)" msgstr "" -#: ../../howto/logging-cookbook.rst:1527 +#: ../../howto/logging-cookbook.rst:1540 msgid "Deploying Web applications using Gunicorn and uWSGI" msgstr "" -#: ../../howto/logging-cookbook.rst:1529 +#: ../../howto/logging-cookbook.rst:1542 msgid "" "When deploying Web applications using `Gunicorn `_ or " "`uWSGI `_ (or similar), " @@ -1973,11 +2030,11 @@ msgid "" "listener in production`_ for more details." msgstr "" -#: ../../howto/logging-cookbook.rst:1539 +#: ../../howto/logging-cookbook.rst:1552 msgid "Using file rotation" msgstr "" -#: ../../howto/logging-cookbook.rst:1544 +#: ../../howto/logging-cookbook.rst:1557 msgid "" "Sometimes you want to let a log file grow to a certain size, then open a new " "file and log to that. You may want to keep a certain number of these files, " @@ -1986,7 +2043,7 @@ msgid "" "usage pattern, the logging package provides a :class:`RotatingFileHandler`::" msgstr "" -#: ../../howto/logging-cookbook.rst:1550 +#: ../../howto/logging-cookbook.rst:1563 msgid "" "import glob\n" "import logging\n" @@ -2015,13 +2072,13 @@ msgid "" " print(filename)" msgstr "" -#: ../../howto/logging-cookbook.rst:1576 +#: ../../howto/logging-cookbook.rst:1589 msgid "" "The result should be 6 separate files, each with part of the log history for " "the application:" msgstr "" -#: ../../howto/logging-cookbook.rst:1579 +#: ../../howto/logging-cookbook.rst:1592 msgid "" "logging_rotatingfile_example.out\n" "logging_rotatingfile_example.out.1\n" @@ -2031,7 +2088,7 @@ msgid "" "logging_rotatingfile_example.out.5" msgstr "" -#: ../../howto/logging-cookbook.rst:1588 +#: ../../howto/logging-cookbook.rst:1601 msgid "" "The most current file is always :file:`logging_rotatingfile_example.out`, " "and each time it reaches the size limit it is renamed with the suffix " @@ -2039,26 +2096,26 @@ msgid "" "(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased." msgstr "" -#: ../../howto/logging-cookbook.rst:1593 +#: ../../howto/logging-cookbook.rst:1606 msgid "" "Obviously this example sets the log length much too small as an extreme " "example. You would want to set *maxBytes* to an appropriate value." msgstr "" -#: ../../howto/logging-cookbook.rst:1601 +#: ../../howto/logging-cookbook.rst:1614 msgid "Use of alternative formatting styles" msgstr "" -#: ../../howto/logging-cookbook.rst:1603 +#: ../../howto/logging-cookbook.rst:1616 msgid "" "When logging was added to the Python standard library, the only way of " "formatting messages with variable content was to use the %-formatting " -"method. Since then, Python has gained two new formatting approaches: :class:" -"`string.Template` (added in Python 2.4) and :meth:`str.format` (added in " -"Python 2.6)." +"method. Since then, Python has gained two new formatting " +"approaches: :class:`string.Template` (added in Python 2.4) " +"and :meth:`str.format` (added in Python 2.6)." msgstr "" -#: ../../howto/logging-cookbook.rst:1609 +#: ../../howto/logging-cookbook.rst:1622 msgid "" "Logging (as of 3.2) provides improved support for these two additional " "formatting styles. The :class:`Formatter` class been enhanced to take an " @@ -2066,12 +2123,12 @@ msgid "" "``'%'``, but other possible values are ``'{'`` and ``'$'``, which correspond " "to the other two formatting styles. Backwards compatibility is maintained by " "default (as you would expect), but by explicitly specifying a style " -"parameter, you get the ability to specify format strings which work with :" -"meth:`str.format` or :class:`string.Template`. Here's an example console " -"session to show the possibilities:" +"parameter, you get the ability to specify format strings which work " +"with :meth:`str.format` or :class:`string.Template`. Here's an example " +"console session to show the possibilities:" msgstr "" -#: ../../howto/logging-cookbook.rst:1619 +#: ../../howto/logging-cookbook.rst:1632 msgid "" ">>> import logging\n" ">>> root = logging.getLogger()\n" @@ -2096,21 +2153,21 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1643 +#: ../../howto/logging-cookbook.rst:1656 msgid "" "Note that the formatting of logging messages for final output to logs is " "completely independent of how an individual logging message is constructed. " "That can still use %-formatting, as shown here::" msgstr "" -#: ../../howto/logging-cookbook.rst:1647 +#: ../../howto/logging-cookbook.rst:1660 msgid "" ">>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message')\n" "2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message\n" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1651 +#: ../../howto/logging-cookbook.rst:1664 msgid "" "Logging calls (``logger.debug()``, ``logger.info()`` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -2118,15 +2175,15 @@ msgid "" "logging call (e.g. the ``exc_info`` keyword parameter to indicate that " "traceback information should be logged, or the ``extra`` keyword parameter " "to indicate additional contextual information to be added to the log). So " -"you cannot directly make logging calls using :meth:`str.format` or :class:" -"`string.Template` syntax, because internally the logging package uses %-" -"formatting to merge the format string and the variable arguments. There " -"would be no changing this while preserving backward compatibility, since all " -"logging calls which are out there in existing code will be using %-format " -"strings." +"you cannot directly make logging calls using :meth:`str.format` " +"or :class:`string.Template` syntax, because internally the logging package " +"uses %-formatting to merge the format string and the variable arguments. " +"There would be no changing this while preserving backward compatibility, " +"since all logging calls which are out there in existing code will be using %-" +"format strings." msgstr "" -#: ../../howto/logging-cookbook.rst:1664 +#: ../../howto/logging-cookbook.rst:1677 msgid "" "There is, however, a way that you can use {}- and $- formatting to construct " "your individual log messages. Recall that for a message you can use an " @@ -2135,7 +2192,7 @@ msgid "" "the following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:1670 ../../howto/logging-cookbook.rst:2758 +#: ../../howto/logging-cookbook.rst:1683 ../../howto/logging-cookbook.rst:2771 msgid "" "class BraceMessage:\n" " def __init__(self, fmt, /, *args, **kwargs):\n" @@ -2173,7 +2230,7 @@ msgstr "" " from string import Template\n" " return Template(self.fmt).substitute(**self.kwargs)" -#: ../../howto/logging-cookbook.rst:1688 +#: ../../howto/logging-cookbook.rst:1701 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -2184,14 +2241,14 @@ msgid "" "used as a synonym/alias for :func:`gettext.gettext` or its brethren)." msgstr "" -#: ../../howto/logging-cookbook.rst:1696 +#: ../../howto/logging-cookbook.rst:1709 msgid "" "The above classes are not included in Python, though they're easy enough to " "copy and paste into your own code. They can be used as follows (assuming " "that they're declared in a module called ``wherever``):" msgstr "" -#: ../../howto/logging-cookbook.rst:1700 +#: ../../howto/logging-cookbook.rst:1713 msgid "" ">>> from wherever import BraceMessage as __\n" ">>> print(__('Message with {0} {name}', 2, name='placeholders'))\n" @@ -2210,14 +2267,14 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1718 +#: ../../howto/logging-cookbook.rst:1731 msgid "" "While the above examples use ``print()`` to show how the formatting works, " "you would of course use ``logger.debug()`` or similar to actually log using " "this approach." msgstr "" -#: ../../howto/logging-cookbook.rst:1722 +#: ../../howto/logging-cookbook.rst:1735 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -2228,13 +2285,13 @@ msgid "" "sugar for a constructor call to one of the :samp:`{XXX}Message` classes." msgstr "" -#: ../../howto/logging-cookbook.rst:1730 +#: ../../howto/logging-cookbook.rst:1743 msgid "" "If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar " "effect to the above, as in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1733 +#: ../../howto/logging-cookbook.rst:1746 msgid "" "import logging\n" "\n" @@ -2263,63 +2320,64 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1759 +#: ../../howto/logging-cookbook.rst:1772 msgid "" "The above script should log the message ``Hello, world!`` when run with " "Python 3.8 or later." msgstr "" -#: ../../howto/logging-cookbook.rst:1768 +#: ../../howto/logging-cookbook.rst:1781 msgid "Customizing ``LogRecord``" msgstr "" -#: ../../howto/logging-cookbook.rst:1770 +#: ../../howto/logging-cookbook.rst:1783 msgid "" "Every logging event is represented by a :class:`LogRecord` instance. When an " -"event is logged and not filtered out by a logger's level, a :class:" -"`LogRecord` is created, populated with information about the event and then " -"passed to the handlers for that logger (and its ancestors, up to and " -"including the logger where further propagation up the hierarchy is " +"event is logged and not filtered out by a logger's level, " +"a :class:`LogRecord` is created, populated with information about the event " +"and then passed to the handlers for that logger (and its ancestors, up to " +"and including the logger where further propagation up the hierarchy is " "disabled). Before Python 3.2, there were only two places where this creation " "was done:" msgstr "" -#: ../../howto/logging-cookbook.rst:1777 +#: ../../howto/logging-cookbook.rst:1790 msgid "" ":meth:`Logger.makeRecord`, which is called in the normal process of logging " "an event. This invoked :class:`LogRecord` directly to create an instance." msgstr "" -#: ../../howto/logging-cookbook.rst:1780 +#: ../../howto/logging-cookbook.rst:1793 msgid "" ":func:`makeLogRecord`, which is called with a dictionary containing " "attributes to be added to the LogRecord. This is typically invoked when a " "suitable dictionary has been received over the network (e.g. in pickle form " -"via a :class:`~handlers.SocketHandler`, or in JSON form via an :class:" -"`~handlers.HTTPHandler`)." +"via a :class:`~handlers.SocketHandler`, or in JSON form via " +"an :class:`~handlers.HTTPHandler`)." msgstr "" -#: ../../howto/logging-cookbook.rst:1786 +#: ../../howto/logging-cookbook.rst:1799 msgid "" -"This has usually meant that if you need to do anything special with a :class:" -"`LogRecord`, you've had to do one of the following." +"This has usually meant that if you need to do anything special with " +"a :class:`LogRecord`, you've had to do one of the following." msgstr "" -#: ../../howto/logging-cookbook.rst:1789 +#: ../../howto/logging-cookbook.rst:1802 msgid "" -"Create your own :class:`Logger` subclass, which overrides :meth:`Logger." -"makeRecord`, and set it using :func:`~logging.setLoggerClass` before any " -"loggers that you care about are instantiated." +"Create your own :class:`Logger` subclass, which " +"overrides :meth:`Logger.makeRecord`, and set it " +"using :func:`~logging.setLoggerClass` before any loggers that you care about " +"are instantiated." msgstr "" -#: ../../howto/logging-cookbook.rst:1792 +#: ../../howto/logging-cookbook.rst:1805 msgid "" "Add a :class:`Filter` to a logger or handler, which does the necessary " "special manipulation you need when its :meth:`~Filter.filter` method is " "called." msgstr "" -#: ../../howto/logging-cookbook.rst:1796 +#: ../../howto/logging-cookbook.rst:1809 msgid "" "The first approach would be a little unwieldy in the scenario where (say) " "several different libraries wanted to do different things. Each would " @@ -2327,7 +2385,7 @@ msgid "" "last would win." msgstr "" -#: ../../howto/logging-cookbook.rst:1801 +#: ../../howto/logging-cookbook.rst:1814 msgid "" "The second approach works reasonably well for many cases, but does not allow " "you to e.g. use a specialized subclass of :class:`LogRecord`. Library " @@ -2336,11 +2394,11 @@ msgid "" "would do simply by adding new packages or modules and doing ::" msgstr "" -#: ../../howto/logging-cookbook.rst:1807 +#: ../../howto/logging-cookbook.rst:1820 msgid "logger = logging.getLogger(__name__)" msgstr "logger = logging.getLogger(__name__)" -#: ../../howto/logging-cookbook.rst:1809 +#: ../../howto/logging-cookbook.rst:1822 msgid "" "at module level). It's probably one too many things to think about. " "Developers could also add the filter to a :class:`~logging.NullHandler` " @@ -2350,17 +2408,17 @@ msgid "" "developer." msgstr "" -#: ../../howto/logging-cookbook.rst:1815 +#: ../../howto/logging-cookbook.rst:1828 msgid "" "In Python 3.2 and later, :class:`~logging.LogRecord` creation is done " "through a factory, which you can specify. The factory is just a callable you " -"can set with :func:`~logging.setLogRecordFactory`, and interrogate with :" -"func:`~logging.getLogRecordFactory`. The factory is invoked with the same " -"signature as the :class:`~logging.LogRecord` constructor, as :class:" -"`LogRecord` is the default setting for the factory." +"can set with :func:`~logging.setLogRecordFactory`, and interrogate " +"with :func:`~logging.getLogRecordFactory`. The factory is invoked with the " +"same signature as the :class:`~logging.LogRecord` constructor, " +"as :class:`LogRecord` is the default setting for the factory." msgstr "" -#: ../../howto/logging-cookbook.rst:1822 +#: ../../howto/logging-cookbook.rst:1835 msgid "" "This approach allows a custom factory to control all aspects of LogRecord " "creation. For example, you could return a subclass, or just add some " @@ -2368,7 +2426,7 @@ msgid "" "this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1826 +#: ../../howto/logging-cookbook.rst:1839 msgid "" "old_factory = logging.getLogRecordFactory()\n" "\n" @@ -2380,7 +2438,7 @@ msgid "" "logging.setLogRecordFactory(record_factory)" msgstr "" -#: ../../howto/logging-cookbook.rst:1835 +#: ../../howto/logging-cookbook.rst:1848 msgid "" "This pattern allows different libraries to chain factories together, and as " "long as they don't overwrite each other's attributes or unintentionally " @@ -2390,22 +2448,22 @@ msgid "" "used when the use of a :class:`Filter` does not provide the desired result." msgstr "" -#: ../../howto/logging-cookbook.rst:1847 +#: ../../howto/logging-cookbook.rst:1860 msgid "Subclassing QueueHandler and QueueListener- a ZeroMQ example" msgstr "" -#: ../../howto/logging-cookbook.rst:1850 ../../howto/logging-cookbook.rst:1983 +#: ../../howto/logging-cookbook.rst:1863 ../../howto/logging-cookbook.rst:1996 msgid "Subclass ``QueueHandler``" msgstr "" -#: ../../howto/logging-cookbook.rst:1852 +#: ../../howto/logging-cookbook.rst:1865 msgid "" "You can use a :class:`QueueHandler` subclass to send messages to other kinds " "of queues, for example a ZeroMQ 'publish' socket. In the example below,the " "socket is created separately and passed to the handler (as its 'queue')::" msgstr "" -#: ../../howto/logging-cookbook.rst:1856 +#: ../../howto/logging-cookbook.rst:1869 msgid "" "import zmq # using pyzmq, the Python binding for ZeroMQ\n" "import json # for serializing records portably\n" @@ -2422,13 +2480,13 @@ msgid "" "handler = ZeroMQSocketHandler(sock)" msgstr "" -#: ../../howto/logging-cookbook.rst:1871 +#: ../../howto/logging-cookbook.rst:1884 msgid "" "Of course there are other ways of organizing this, for example passing in " "the data needed by the handler to create the socket::" msgstr "" -#: ../../howto/logging-cookbook.rst:1874 +#: ../../howto/logging-cookbook.rst:1887 msgid "" "class ZeroMQSocketHandler(QueueHandler):\n" " def __init__(self, uri, socktype=zmq.PUB, ctx=None):\n" @@ -2444,17 +2502,17 @@ msgid "" " self.queue.close()" msgstr "" -#: ../../howto/logging-cookbook.rst:1889 ../../howto/logging-cookbook.rst:1919 +#: ../../howto/logging-cookbook.rst:1902 ../../howto/logging-cookbook.rst:1932 msgid "Subclass ``QueueListener``" msgstr "" -#: ../../howto/logging-cookbook.rst:1891 +#: ../../howto/logging-cookbook.rst:1904 msgid "" "You can also subclass :class:`QueueListener` to get messages from other " "kinds of queues, for example a ZeroMQ 'subscribe' socket. Here's an example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1894 +#: ../../howto/logging-cookbook.rst:1907 msgid "" "class ZeroMQSocketListener(QueueListener):\n" " def __init__(self, uri, /, *handlers, **kwargs):\n" @@ -2470,20 +2528,20 @@ msgid "" " return logging.makeLogRecord(msg)" msgstr "" -#: ../../howto/logging-cookbook.rst:1909 +#: ../../howto/logging-cookbook.rst:1922 msgid "Subclassing QueueHandler and QueueListener- a ``pynng`` example" msgstr "" -#: ../../howto/logging-cookbook.rst:1911 +#: ../../howto/logging-cookbook.rst:1924 msgid "" "In a similar way to the above section, we can implement a listener and " -"handler using :pypi:`pynng`, which is a Python binding to `NNG `_, billed as a spiritual successor to ZeroMQ. The following " -"snippets illustrate -- you can test them in an environment which has " -"``pynng`` installed. Just for variety, we present the listener first." +"handler using :pypi:`pynng`, which is a Python binding to `NNG `_, billed as a spiritual successor to ZeroMQ. The " +"following snippets illustrate -- you can test them in an environment which " +"has ``pynng`` installed. Just for variety, we present the listener first." msgstr "" -#: ../../howto/logging-cookbook.rst:1921 +#: ../../howto/logging-cookbook.rst:1934 msgid "" "# listener.py\n" "import json\n" @@ -2545,7 +2603,7 @@ msgid "" " listener.stop()" msgstr "" -#: ../../howto/logging-cookbook.rst:1987 +#: ../../howto/logging-cookbook.rst:2000 msgid "" "# sender.py\n" "import json\n" @@ -2578,8 +2636,8 @@ msgid "" "# Make sure the process ID is in the output\n" "logging.basicConfig(level=logging.DEBUG,\n" " handlers=[logging.StreamHandler(), handler],\n" -" format='%(levelname)-8s %(name)10s %(process)6s " -"%(message)s')\n" +" format='%(levelname)-8s %(name)10s %(process)6s %" +"(message)s')\n" "levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\n" " logging.CRITICAL)\n" "logger_names = ('myapp', 'myapp.lib1', 'myapp.lib2')\n" @@ -2594,14 +2652,14 @@ msgid "" " time.sleep(delay)" msgstr "" -#: ../../howto/logging-cookbook.rst:2034 +#: ../../howto/logging-cookbook.rst:2047 msgid "" "You can run the above two snippets in separate command shells. If we run the " "listener in one shell and run the sender in two separate shells, we should " "see something like the following. In the first sender shell:" msgstr "" -#: ../../howto/logging-cookbook.rst:2038 +#: ../../howto/logging-cookbook.rst:2051 msgid "" "$ python sender.py\n" "DEBUG myapp 613 Message no. 1\n" @@ -2615,11 +2673,11 @@ msgid "" "(and so on)" msgstr "" -#: ../../howto/logging-cookbook.rst:2051 +#: ../../howto/logging-cookbook.rst:2064 msgid "In the second sender shell:" msgstr "" -#: ../../howto/logging-cookbook.rst:2053 +#: ../../howto/logging-cookbook.rst:2066 msgid "" "$ python sender.py\n" "INFO myapp.lib2 657 Message no. 1\n" @@ -2633,11 +2691,11 @@ msgid "" "(and so on)" msgstr "" -#: ../../howto/logging-cookbook.rst:2066 +#: ../../howto/logging-cookbook.rst:2079 msgid "In the listener shell:" msgstr "" -#: ../../howto/logging-cookbook.rst:2068 +#: ../../howto/logging-cookbook.rst:2081 msgid "" "$ python listener.py\n" "Press Ctrl-C to stop.\n" @@ -2660,25 +2718,25 @@ msgid "" "(and so on)" msgstr "" -#: ../../howto/logging-cookbook.rst:2090 +#: ../../howto/logging-cookbook.rst:2103 msgid "" "As you can see, the logging from the two sender processes is interleaved in " "the listener's output." msgstr "" -#: ../../howto/logging-cookbook.rst:2095 +#: ../../howto/logging-cookbook.rst:2108 msgid "An example dictionary-based configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:2097 +#: ../../howto/logging-cookbook.rst:2110 msgid "" "Below is an example of a logging configuration dictionary - it's taken from " "the `documentation on the Django project `_. This dictionary is passed to :" -"func:`~config.dictConfig` to put the configuration into effect::" +"stable/topics/logging/#configuring-logging>`_. This dictionary is passed " +"to :func:`~config.dictConfig` to put the configuration into effect::" msgstr "" -#: ../../howto/logging-cookbook.rst:2101 +#: ../../howto/logging-cookbook.rst:2114 msgid "" "LOGGING = {\n" " 'version': 1,\n" @@ -2780,24 +2838,24 @@ msgstr "" " }\n" "}" -#: ../../howto/logging-cookbook.rst:2150 +#: ../../howto/logging-cookbook.rst:2163 msgid "" "For more information about this configuration, you can see the `relevant " "section `_ of the Django documentation." msgstr "" -#: ../../howto/logging-cookbook.rst:2157 +#: ../../howto/logging-cookbook.rst:2170 msgid "Using a rotator and namer to customize log rotation processing" msgstr "" -#: ../../howto/logging-cookbook.rst:2159 +#: ../../howto/logging-cookbook.rst:2172 msgid "" "An example of how you can define a namer and rotator is given in the " "following runnable script, which shows gzip compression of the log file::" msgstr "" -#: ../../howto/logging-cookbook.rst:2162 +#: ../../howto/logging-cookbook.rst:2175 msgid "" "import gzip\n" "import logging\n" @@ -2857,12 +2915,12 @@ msgstr "" "for i in range(1000):\n" " root.info(f'Message no. {i + 1}')" -#: ../../howto/logging-cookbook.rst:2190 +#: ../../howto/logging-cookbook.rst:2203 msgid "" "After running this, you will see six new files, five of which are compressed:" msgstr "" -#: ../../howto/logging-cookbook.rst:2192 +#: ../../howto/logging-cookbook.rst:2205 msgid "" "$ ls rotated.log*\n" "rotated.log rotated.log.2.gz rotated.log.4.gz\n" @@ -2880,11 +2938,11 @@ msgstr "" "2023-01-20 02:28:17,767 Message no. 997\n" "2023-01-20 02:28:17,767 Message no. 998" -#: ../../howto/logging-cookbook.rst:2203 +#: ../../howto/logging-cookbook.rst:2216 msgid "A more elaborate multiprocessing example" msgstr "" -#: ../../howto/logging-cookbook.rst:2205 +#: ../../howto/logging-cookbook.rst:2218 msgid "" "The following working example shows how logging can be used with " "multiprocessing using configuration files. The configurations are fairly " @@ -2892,7 +2950,7 @@ msgid "" "in a real multiprocessing scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:2210 +#: ../../howto/logging-cookbook.rst:2223 msgid "" "In the example, the main process spawns a listener process and some worker " "processes. Each of the main process, the listener and the workers have three " @@ -2905,13 +2963,13 @@ msgid "" "own scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:2220 +#: ../../howto/logging-cookbook.rst:2233 msgid "" "Here's the script - the docstrings and the comments hopefully explain how it " "works::" msgstr "" -#: ../../howto/logging-cookbook.rst:2223 +#: ../../howto/logging-cookbook.rst:2236 msgid "" "import logging\n" "import logging.config\n" @@ -3056,13 +3114,13 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " -"%(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" +"(processName)-10s %(message)s'\n" " },\n" " 'simple': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s " -"%(message)s'\n" +" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s %" +"(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -3134,11 +3192,11 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2432 +#: ../../howto/logging-cookbook.rst:2445 msgid "Inserting a BOM into messages sent to a SysLogHandler" msgstr "" -#: ../../howto/logging-cookbook.rst:2434 +#: ../../howto/logging-cookbook.rst:2447 msgid "" ":rfc:`5424` requires that a Unicode message be sent to a syslog daemon as a " "set of bytes which have the following structure: an optional pure-ASCII " @@ -3147,7 +3205,7 @@ msgid "" "<5424#section-6>`.)" msgstr "" -#: ../../howto/logging-cookbook.rst:2440 +#: ../../howto/logging-cookbook.rst:2453 msgid "" "In Python 3.1, code was added to :class:`~logging.handlers.SysLogHandler` to " "insert a BOM into the message, but unfortunately, it was implemented " @@ -3155,7 +3213,7 @@ msgid "" "hence not allowing any pure-ASCII component to appear before it." msgstr "" -#: ../../howto/logging-cookbook.rst:2446 +#: ../../howto/logging-cookbook.rst:2459 msgid "" "As this behaviour is broken, the incorrect BOM insertion code is being " "removed from Python 3.2.4 and later. However, it is not being replaced, and " @@ -3164,37 +3222,38 @@ msgid "" "encoded using UTF-8, then you need to do the following:" msgstr "" -#: ../../howto/logging-cookbook.rst:2452 +#: ../../howto/logging-cookbook.rst:2465 msgid "" -"Attach a :class:`~logging.Formatter` instance to your :class:`~logging." -"handlers.SysLogHandler` instance, with a format string such as::" +"Attach a :class:`~logging.Formatter` instance to " +"your :class:`~logging.handlers.SysLogHandler` instance, with a format string " +"such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:2456 +#: ../../howto/logging-cookbook.rst:2469 msgid "'ASCII section\\ufeffUnicode section'" msgstr "" -#: ../../howto/logging-cookbook.rst:2458 +#: ../../howto/logging-cookbook.rst:2471 msgid "" "The Unicode code point U+FEFF, when encoded using UTF-8, will be encoded as " "a UTF-8 BOM -- the byte-string ``b'\\xef\\xbb\\xbf'``." msgstr "" -#: ../../howto/logging-cookbook.rst:2461 +#: ../../howto/logging-cookbook.rst:2474 msgid "" "Replace the ASCII section with whatever placeholders you like, but make sure " "that the data that appears in there after substitution is always ASCII (that " "way, it will remain unchanged after UTF-8 encoding)." msgstr "" -#: ../../howto/logging-cookbook.rst:2465 +#: ../../howto/logging-cookbook.rst:2478 msgid "" "Replace the Unicode section with whatever placeholders you like; if the data " "which appears there after substitution contains characters outside the ASCII " "range, that's fine -- it will be encoded using UTF-8." msgstr "" -#: ../../howto/logging-cookbook.rst:2469 +#: ../../howto/logging-cookbook.rst:2482 msgid "" "The formatted message *will* be encoded using UTF-8 encoding by " "``SysLogHandler``. If you follow the above rules, you should be able to " @@ -3203,11 +3262,11 @@ msgid "" "daemon may complain." msgstr "" -#: ../../howto/logging-cookbook.rst:2476 +#: ../../howto/logging-cookbook.rst:2489 msgid "Implementing structured logging" msgstr "" -#: ../../howto/logging-cookbook.rst:2478 +#: ../../howto/logging-cookbook.rst:2491 msgid "" "Although most logging messages are intended for reading by humans, and thus " "not readily machine-parseable, there might be circumstances where you want " @@ -3219,7 +3278,7 @@ msgid "" "machine-parseable manner::" msgstr "" -#: ../../howto/logging-cookbook.rst:2486 +#: ../../howto/logging-cookbook.rst:2499 msgid "" "import json\n" "import logging\n" @@ -3238,11 +3297,11 @@ msgid "" "logging.info(_('message 1', foo='bar', bar='baz', num=123, fnum=123.456))" msgstr "" -#: ../../howto/logging-cookbook.rst:2502 +#: ../../howto/logging-cookbook.rst:2515 msgid "If the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2504 +#: ../../howto/logging-cookbook.rst:2517 msgid "" "message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " "\"bar\"}" @@ -3250,19 +3309,19 @@ msgstr "" "message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " "\"bar\"}" -#: ../../howto/logging-cookbook.rst:2508 ../../howto/logging-cookbook.rst:2550 +#: ../../howto/logging-cookbook.rst:2521 ../../howto/logging-cookbook.rst:2563 msgid "" "Note that the order of items might be different according to the version of " "Python used." msgstr "" -#: ../../howto/logging-cookbook.rst:2511 +#: ../../howto/logging-cookbook.rst:2524 msgid "" "If you need more specialised processing, you can use a custom JSON encoder, " "as in the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2514 +#: ../../howto/logging-cookbook.rst:2527 msgid "" "import json\n" "import logging\n" @@ -3295,19 +3354,19 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2544 +#: ../../howto/logging-cookbook.rst:2557 msgid "When the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2546 +#: ../../howto/logging-cookbook.rst:2559 msgid "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" msgstr "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" -#: ../../howto/logging-cookbook.rst:2559 +#: ../../howto/logging-cookbook.rst:2572 msgid "Customizing handlers with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2561 +#: ../../howto/logging-cookbook.rst:2574 msgid "" "There are times when you want to customize logging handlers in particular " "ways, and if you use :func:`dictConfig` you may be able to do this without " @@ -3317,7 +3376,7 @@ msgid "" "customize handler creation using a plain function such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:2568 +#: ../../howto/logging-cookbook.rst:2581 msgid "" "def owned_file_handler(filename, mode='a', encoding=None, owner=None):\n" " if owner:\n" @@ -3333,13 +3392,14 @@ msgstr "" " shutil.chown(filename, *owner)\n" " return logging.FileHandler(filename, mode, encoding)" -#: ../../howto/logging-cookbook.rst:2575 +#: ../../howto/logging-cookbook.rst:2588 msgid "" -"You can then specify, in a logging configuration passed to :func:" -"`dictConfig`, that a logging handler be created by calling this function::" +"You can then specify, in a logging configuration passed " +"to :func:`dictConfig`, that a logging handler be created by calling this " +"function::" msgstr "" -#: ../../howto/logging-cookbook.rst:2578 +#: ../../howto/logging-cookbook.rst:2591 msgid "" "LOGGING = {\n" " 'version': 1,\n" @@ -3372,14 +3432,14 @@ msgid "" "}" msgstr "" -#: ../../howto/logging-cookbook.rst:2608 +#: ../../howto/logging-cookbook.rst:2621 msgid "" "In this example I am setting the ownership using the ``pulse`` user and " "group, just for the purposes of illustration. Putting it together into a " "working script, ``chowntest.py``::" msgstr "" -#: ../../howto/logging-cookbook.rst:2612 +#: ../../howto/logging-cookbook.rst:2625 msgid "" "import logging, logging.config, os, shutil\n" "\n" @@ -3425,11 +3485,11 @@ msgid "" "logger.debug('A debug message')" msgstr "" -#: ../../howto/logging-cookbook.rst:2655 +#: ../../howto/logging-cookbook.rst:2668 msgid "To run this, you will probably need to run as ``root``:" msgstr "" -#: ../../howto/logging-cookbook.rst:2657 +#: ../../howto/logging-cookbook.rst:2670 msgid "" "$ sudo python3.3 chowntest.py\n" "$ cat chowntest.log\n" @@ -3438,34 +3498,34 @@ msgid "" "-rw-r--r-- 1 pulse pulse 55 2013-11-05 09:34 chowntest.log" msgstr "" -#: ../../howto/logging-cookbook.rst:2665 +#: ../../howto/logging-cookbook.rst:2678 msgid "" -"Note that this example uses Python 3.3 because that's where :func:`shutil." -"chown` makes an appearance. This approach should work with any Python " -"version that supports :func:`dictConfig` - namely, Python 2.7, 3.2 or later. " -"With pre-3.3 versions, you would need to implement the actual ownership " -"change using e.g. :func:`os.chown`." +"Note that this example uses Python 3.3 because that's " +"where :func:`shutil.chown` makes an appearance. This approach should work " +"with any Python version that supports :func:`dictConfig` - namely, Python " +"2.7, 3.2 or later. With pre-3.3 versions, you would need to implement the " +"actual ownership change using e.g. :func:`os.chown`." msgstr "" -#: ../../howto/logging-cookbook.rst:2671 +#: ../../howto/logging-cookbook.rst:2684 msgid "" "In practice, the handler-creating function may be in a utility module " "somewhere in your project. Instead of the line in the configuration::" msgstr "" -#: ../../howto/logging-cookbook.rst:2674 +#: ../../howto/logging-cookbook.rst:2687 msgid "'()': owned_file_handler," msgstr "'()': owned_file_handler," -#: ../../howto/logging-cookbook.rst:2676 +#: ../../howto/logging-cookbook.rst:2689 msgid "you could use e.g.::" msgstr "" -#: ../../howto/logging-cookbook.rst:2678 +#: ../../howto/logging-cookbook.rst:2691 msgid "'()': 'ext://project.util.owned_file_handler'," msgstr "'()': 'ext://project.util.owned_file_handler'," -#: ../../howto/logging-cookbook.rst:2680 +#: ../../howto/logging-cookbook.rst:2693 msgid "" "where ``project.util`` can be replaced with the actual name of the package " "where the function resides. In the above working script, using ``'ext://" @@ -3473,25 +3533,25 @@ msgid "" "resolved by :func:`dictConfig` from the ``ext://`` specification." msgstr "" -#: ../../howto/logging-cookbook.rst:2685 +#: ../../howto/logging-cookbook.rst:2698 msgid "" "This example hopefully also points the way to how you could implement other " "types of file change - e.g. setting specific POSIX permission bits - in the " "same way, using :func:`os.chmod`." msgstr "" -#: ../../howto/logging-cookbook.rst:2689 +#: ../../howto/logging-cookbook.rst:2702 msgid "" "Of course, the approach could also be extended to types of handler other " "than a :class:`~logging.FileHandler` - for example, one of the rotating file " "handlers, or a different type of handler altogether." msgstr "" -#: ../../howto/logging-cookbook.rst:2699 +#: ../../howto/logging-cookbook.rst:2712 msgid "Using particular formatting styles throughout your application" msgstr "" -#: ../../howto/logging-cookbook.rst:2701 +#: ../../howto/logging-cookbook.rst:2714 msgid "" "In Python 3.2, the :class:`~logging.Formatter` gained a ``style`` keyword " "parameter which, while defaulting to ``%`` for backward compatibility, " @@ -3502,7 +3562,7 @@ msgid "" "is constructed." msgstr "" -#: ../../howto/logging-cookbook.rst:2708 +#: ../../howto/logging-cookbook.rst:2721 msgid "" "Logging calls (:meth:`~Logger.debug`, :meth:`~Logger.info` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -3510,14 +3570,15 @@ msgid "" "call (e.g. the ``exc_info`` keyword parameter to indicate that traceback " "information should be logged, or the ``extra`` keyword parameter to indicate " "additional contextual information to be added to the log). So you cannot " -"directly make logging calls using :meth:`str.format` or :class:`string." -"Template` syntax, because internally the logging package uses %-formatting " -"to merge the format string and the variable arguments. There would be no " -"changing this while preserving backward compatibility, since all logging " -"calls which are out there in existing code will be using %-format strings." +"directly make logging calls using :meth:`str.format` " +"or :class:`string.Template` syntax, because internally the logging package " +"uses %-formatting to merge the format string and the variable arguments. " +"There would be no changing this while preserving backward compatibility, " +"since all logging calls which are out there in existing code will be using %-" +"format strings." msgstr "" -#: ../../howto/logging-cookbook.rst:2720 +#: ../../howto/logging-cookbook.rst:2733 msgid "" "There have been suggestions to associate format styles with specific " "loggers, but that approach also runs into backward compatibility problems " @@ -3525,7 +3586,7 @@ msgid "" "formatting." msgstr "" -#: ../../howto/logging-cookbook.rst:2724 +#: ../../howto/logging-cookbook.rst:2737 msgid "" "For logging to work interoperably between any third-party libraries and your " "code, decisions about formatting need to be made at the level of the " @@ -3533,11 +3594,11 @@ msgid "" "formatting styles can be accommodated." msgstr "" -#: ../../howto/logging-cookbook.rst:2731 +#: ../../howto/logging-cookbook.rst:2744 msgid "Using LogRecord factories" msgstr "" -#: ../../howto/logging-cookbook.rst:2733 +#: ../../howto/logging-cookbook.rst:2746 msgid "" "In Python 3.2, along with the :class:`~logging.Formatter` changes mentioned " "above, the logging package gained the ability to allow users to set their " @@ -3552,27 +3613,27 @@ msgid "" "implementation does." msgstr "" -#: ../../howto/logging-cookbook.rst:2744 +#: ../../howto/logging-cookbook.rst:2757 msgid "" -"Refer to the reference documentation on :func:`setLogRecordFactory` and :" -"class:`LogRecord` for more information." +"Refer to the reference documentation on :func:`setLogRecordFactory` " +"and :class:`LogRecord` for more information." msgstr "" -#: ../../howto/logging-cookbook.rst:2749 +#: ../../howto/logging-cookbook.rst:2762 msgid "Using custom message objects" msgstr "" -#: ../../howto/logging-cookbook.rst:2751 +#: ../../howto/logging-cookbook.rst:2764 msgid "" "There is another, perhaps simpler way that you can use {}- and $- formatting " -"to construct your individual log messages. You may recall (from :ref:" -"`arbitrary-object-messages`) that when logging you can use an arbitrary " -"object as a message format string, and that the logging package will call :" -"func:`str` on that object to get the actual format string. Consider the " -"following two classes::" +"to construct your individual log messages. You may recall " +"(from :ref:`arbitrary-object-messages`) that when logging you can use an " +"arbitrary object as a message format string, and that the logging package " +"will call :func:`str` on that object to get the actual format string. " +"Consider the following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:2776 +#: ../../howto/logging-cookbook.rst:2789 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -3583,13 +3644,13 @@ msgid "" "using ``_`` for localization)." msgstr "" -#: ../../howto/logging-cookbook.rst:2784 +#: ../../howto/logging-cookbook.rst:2797 msgid "" -"Examples of this approach are given below. Firstly, formatting with :meth:" -"`str.format`::" +"Examples of this approach are given below. Firstly, formatting " +"with :meth:`str.format`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2787 +#: ../../howto/logging-cookbook.rst:2800 msgid "" ">>> __ = BraceMessage\n" ">>> print(__('Message with {0} {1}', 2, 'placeholders'))\n" @@ -3604,11 +3665,11 @@ msgid "" "Message with coordinates: (0.50, 0.50)" msgstr "" -#: ../../howto/logging-cookbook.rst:2798 +#: ../../howto/logging-cookbook.rst:2811 msgid "Secondly, formatting with :class:`string.Template`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2800 +#: ../../howto/logging-cookbook.rst:2813 msgid "" ">>> __ = DollarMessage\n" ">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" @@ -3616,7 +3677,7 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:2805 +#: ../../howto/logging-cookbook.rst:2818 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -3628,26 +3689,26 @@ msgid "" "shown above." msgstr "" -#: ../../howto/logging-cookbook.rst:2819 +#: ../../howto/logging-cookbook.rst:2832 msgid "Configuring filters with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2821 +#: ../../howto/logging-cookbook.rst:2834 msgid "" "You *can* configure filters using :func:`~logging.config.dictConfig`, though " "it might not be obvious at first glance how to do it (hence this recipe). " "Since :class:`~logging.Filter` is the only filter class included in the " "standard library, and it is unlikely to cater to many requirements (it's " -"only there as a base class), you will typically need to define your own :" -"class:`~logging.Filter` subclass with an overridden :meth:`~logging.Filter." -"filter` method. To do this, specify the ``()`` key in the configuration " -"dictionary for the filter, specifying a callable which will be used to " -"create the filter (a class is the most obvious, but you can provide any " -"callable which returns a :class:`~logging.Filter` instance). Here is a " -"complete example::" +"only there as a base class), you will typically need to define your " +"own :class:`~logging.Filter` subclass with an " +"overridden :meth:`~logging.Filter.filter` method. To do this, specify the " +"``()`` key in the configuration dictionary for the filter, specifying a " +"callable which will be used to create the filter (a class is the most " +"obvious, but you can provide any callable which returns " +"a :class:`~logging.Filter` instance). Here is a complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2832 +#: ../../howto/logging-cookbook.rst:2845 msgid "" "import logging\n" "import logging.config\n" @@ -3733,26 +3794,26 @@ msgstr "" " logging.debug('hello')\n" " logging.debug('hello - noshow')" -#: ../../howto/logging-cookbook.rst:2874 +#: ../../howto/logging-cookbook.rst:2887 msgid "" "This example shows how you can pass configuration data to the callable which " "constructs the instance, in the form of keyword parameters. When run, the " "above script will print:" msgstr "" -#: ../../howto/logging-cookbook.rst:2878 +#: ../../howto/logging-cookbook.rst:2891 msgid "changed: hello" msgstr "changed: hello" -#: ../../howto/logging-cookbook.rst:2882 +#: ../../howto/logging-cookbook.rst:2895 msgid "which shows that the filter is working as configured." msgstr "" -#: ../../howto/logging-cookbook.rst:2884 +#: ../../howto/logging-cookbook.rst:2897 msgid "A couple of extra points to note:" msgstr "" -#: ../../howto/logging-cookbook.rst:2886 +#: ../../howto/logging-cookbook.rst:2899 msgid "" "If you can't refer to the callable directly in the configuration (e.g. if it " "lives in a different module, and you can't import it directly where the " @@ -3762,7 +3823,7 @@ msgid "" "the above example." msgstr "" -#: ../../howto/logging-cookbook.rst:2893 +#: ../../howto/logging-cookbook.rst:2906 msgid "" "As well as for filters, this technique can also be used to configure custom " "handlers and formatters. See :ref:`logging-config-dict-userdef` for more " @@ -3771,11 +3832,11 @@ msgid "" "above." msgstr "" -#: ../../howto/logging-cookbook.rst:2902 +#: ../../howto/logging-cookbook.rst:2915 msgid "Customized exception formatting" msgstr "" -#: ../../howto/logging-cookbook.rst:2904 +#: ../../howto/logging-cookbook.rst:2917 msgid "" "There might be times when you want to do customized exception formatting - " "for argument's sake, let's say you want exactly one line per logged event, " @@ -3783,7 +3844,7 @@ msgid "" "formatter class, as shown in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2909 +#: ../../howto/logging-cookbook.rst:2922 msgid "" "import logging\n" "\n" @@ -3822,11 +3883,11 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2945 +#: ../../howto/logging-cookbook.rst:2958 msgid "When run, this produces a file with exactly two lines:" msgstr "" -#: ../../howto/logging-cookbook.rst:2947 +#: ../../howto/logging-cookbook.rst:2960 msgid "" "28/01/2015 07:21:23|INFO|Sample message|\n" "28/01/2015 07:21:23|ERROR|ZeroDivisionError: integer division or modulo by " @@ -3840,35 +3901,35 @@ msgstr "" "in main\\n x = 1 / 0\\nZeroDivisionError: integer division or modulo by " "zero'|" -#: ../../howto/logging-cookbook.rst:2952 +#: ../../howto/logging-cookbook.rst:2965 msgid "" "While the above treatment is simplistic, it points the way to how exception " "information can be formatted to your liking. The :mod:`traceback` module may " "be helpful for more specialized needs." msgstr "" -#: ../../howto/logging-cookbook.rst:2959 +#: ../../howto/logging-cookbook.rst:2972 msgid "Speaking logging messages" msgstr "" -#: ../../howto/logging-cookbook.rst:2961 +#: ../../howto/logging-cookbook.rst:2974 msgid "" "There might be situations when it is desirable to have logging messages " "rendered in an audible rather than a visible format. This is easy to do if " "you have text-to-speech (TTS) functionality available in your system, even " "if it doesn't have a Python binding. Most TTS systems have a command line " -"program you can run, and this can be invoked from a handler using :mod:" -"`subprocess`. It's assumed here that TTS command line programs won't expect " -"to interact with users or take a long time to complete, and that the " -"frequency of logged messages will be not so high as to swamp the user with " -"messages, and that it's acceptable to have the messages spoken one at a time " -"rather than concurrently, The example implementation below waits for one " -"message to be spoken before the next is processed, and this might cause " -"other handlers to be kept waiting. Here is a short example showing the " +"program you can run, and this can be invoked from a handler " +"using :mod:`subprocess`. It's assumed here that TTS command line programs " +"won't expect to interact with users or take a long time to complete, and " +"that the frequency of logged messages will be not so high as to swamp the " +"user with messages, and that it's acceptable to have the messages spoken one " +"at a time rather than concurrently, The example implementation below waits " +"for one message to be spoken before the next is processed, and this might " +"cause other handlers to be kept waiting. Here is a short example showing the " "approach, which assumes that the ``espeak`` TTS package is available::" msgstr "" -#: ../../howto/logging-cookbook.rst:2974 +#: ../../howto/logging-cookbook.rst:2987 msgid "" "import logging\n" "import subprocess\n" @@ -3900,24 +3961,24 @@ msgid "" " sys.exit(main())" msgstr "" -#: ../../howto/logging-cookbook.rst:3003 +#: ../../howto/logging-cookbook.rst:3016 msgid "" "When run, this script should say \"Hello\" and then \"Goodbye\" in a female " "voice." msgstr "" -#: ../../howto/logging-cookbook.rst:3005 +#: ../../howto/logging-cookbook.rst:3018 msgid "" "The above approach can, of course, be adapted to other TTS systems and even " "other systems altogether which can process messages via external programs " "run from a command line." msgstr "" -#: ../../howto/logging-cookbook.rst:3013 +#: ../../howto/logging-cookbook.rst:3026 msgid "Buffering logging messages and outputting them conditionally" msgstr "" -#: ../../howto/logging-cookbook.rst:3015 +#: ../../howto/logging-cookbook.rst:3028 msgid "" "There might be situations where you want to log messages in a temporary area " "and only output them if a certain condition occurs. For example, you may " @@ -3927,7 +3988,7 @@ msgid "" "debug information to be output as well as the error." msgstr "" -#: ../../howto/logging-cookbook.rst:3022 +#: ../../howto/logging-cookbook.rst:3035 msgid "" "Here is an example which shows how you could do this using a decorator for " "your functions where you want logging to behave this way. It makes use of " @@ -3940,7 +4001,7 @@ msgid "" "subclass of ``MemoryHandler`` if you want custom flushing behavior." msgstr "" -#: ../../howto/logging-cookbook.rst:3032 +#: ../../howto/logging-cookbook.rst:3045 msgid "" "The example script has a simple function, ``foo``, which just cycles through " "all the logging levels, writing to ``sys.stderr`` to say what level it's " @@ -3949,23 +4010,23 @@ msgid "" "levels - otherwise, it only logs at DEBUG, INFO and WARNING levels." msgstr "" -#: ../../howto/logging-cookbook.rst:3038 +#: ../../howto/logging-cookbook.rst:3051 msgid "" "The script just arranges to decorate ``foo`` with a decorator which will do " "the conditional logging that's required. The decorator takes a logger as a " "parameter and attaches a memory handler for the duration of the call to the " "decorated function. The decorator can be additionally parameterised using a " "target handler, a level at which flushing should occur, and a capacity for " -"the buffer (number of records buffered). These default to a :class:`~logging." -"StreamHandler` which writes to ``sys.stderr``, ``logging.ERROR`` and ``100`` " -"respectively." +"the buffer (number of records buffered). These default to " +"a :class:`~logging.StreamHandler` which writes to ``sys.stderr``, " +"``logging.ERROR`` and ``100`` respectively." msgstr "" -#: ../../howto/logging-cookbook.rst:3046 +#: ../../howto/logging-cookbook.rst:3059 msgid "Here's the script::" msgstr "" -#: ../../howto/logging-cookbook.rst:3048 +#: ../../howto/logging-cookbook.rst:3061 msgid "" "import logging\n" "from logging.handlers import MemoryHandler\n" @@ -4031,11 +4092,11 @@ msgid "" " assert decorated_foo(True)" msgstr "" -#: ../../howto/logging-cookbook.rst:3109 +#: ../../howto/logging-cookbook.rst:3122 msgid "When this script is run, the following output should be observed:" msgstr "" -#: ../../howto/logging-cookbook.rst:3111 +#: ../../howto/logging-cookbook.rst:3124 msgid "" "Calling undecorated foo with False\n" "about to log at DEBUG ...\n" @@ -4064,40 +4125,41 @@ msgid "" "Actually logged at CRITICAL" msgstr "" -#: ../../howto/logging-cookbook.rst:3139 +#: ../../howto/logging-cookbook.rst:3152 msgid "" "As you can see, actual logging output only occurs when an event is logged " "whose severity is ERROR or greater, but in that case, any previous events at " "lower severities are also logged." msgstr "" -#: ../../howto/logging-cookbook.rst:3143 +#: ../../howto/logging-cookbook.rst:3156 msgid "You can of course use the conventional means of decoration::" msgstr "" -#: ../../howto/logging-cookbook.rst:3145 +#: ../../howto/logging-cookbook.rst:3158 msgid "" "@log_if_errors(logger)\n" "def foo(fail=False):\n" " ..." msgstr "" -#: ../../howto/logging-cookbook.rst:3153 +#: ../../howto/logging-cookbook.rst:3166 msgid "Sending logging messages to email, with buffering" msgstr "" -#: ../../howto/logging-cookbook.rst:3155 +#: ../../howto/logging-cookbook.rst:3168 msgid "" "To illustrate how you can send log messages via email, so that a set number " -"of messages are sent per email, you can subclass :class:`~logging.handlers." -"BufferingHandler`. In the following example, which you can adapt to suit " -"your specific needs, a simple test harness is provided which allows you to " -"run the script with command line arguments specifying what you typically " -"need to send things via SMTP. (Run the downloaded script with the ``-h`` " -"argument to see the required and optional arguments.)" +"of messages are sent per email, you can " +"subclass :class:`~logging.handlers.BufferingHandler`. In the following " +"example, which you can adapt to suit your specific needs, a simple test " +"harness is provided which allows you to run the script with command line " +"arguments specifying what you typically need to send things via SMTP. (Run " +"the downloaded script with the ``-h`` argument to see the required and " +"optional arguments.)" msgstr "" -#: ../../howto/logging-cookbook.rst:3163 +#: ../../howto/logging-cookbook.rst:3176 msgid "" "import logging\n" "import logging.handlers\n" @@ -4117,8 +4179,8 @@ msgid "" " toaddrs = [toaddrs]\n" " self.toaddrs = toaddrs\n" " self.subject = subject\n" -" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s " -"%(message)s\"))\n" +" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s %" +"(message)s\"))\n" "\n" " def flush(self):\n" " if len(self.buffer) > 0:\n" @@ -4165,7 +4227,7 @@ msgid "" " h.close()" msgstr "" -#: ../../howto/logging-cookbook.rst:3227 +#: ../../howto/logging-cookbook.rst:3240 msgid "" "If you run this script and your SMTP server is correctly set up, you should " "find that it sends eleven emails to the addressee you specify. The first ten " @@ -4173,17 +4235,17 @@ msgid "" "messages. That makes up 102 messages as specified in the script." msgstr "" -#: ../../howto/logging-cookbook.rst:3235 +#: ../../howto/logging-cookbook.rst:3248 msgid "Formatting times using UTC (GMT) via configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:3237 +#: ../../howto/logging-cookbook.rst:3250 msgid "" "Sometimes you want to format times using UTC, which can be done using a " "class such as ``UTCFormatter``, shown below::" msgstr "" -#: ../../howto/logging-cookbook.rst:3240 +#: ../../howto/logging-cookbook.rst:3253 msgid "" "import logging\n" "import time\n" @@ -4192,15 +4254,15 @@ msgid "" " converter = time.gmtime" msgstr "" -#: ../../howto/logging-cookbook.rst:3246 +#: ../../howto/logging-cookbook.rst:3259 msgid "" -"and you can then use the ``UTCFormatter`` in your code instead of :class:" -"`~logging.Formatter`. If you want to do that via configuration, you can use " -"the :func:`~logging.config.dictConfig` API with an approach illustrated by " -"the following complete example::" +"and you can then use the ``UTCFormatter`` in your code instead " +"of :class:`~logging.Formatter`. If you want to do that via configuration, " +"you can use the :func:`~logging.config.dictConfig` API with an approach " +"illustrated by the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:3251 +#: ../../howto/logging-cookbook.rst:3264 msgid "" "import logging\n" "import logging.config\n" @@ -4241,11 +4303,11 @@ msgid "" " logging.warning('The local time is %s', time.asctime())" msgstr "" -#: ../../howto/logging-cookbook.rst:3289 +#: ../../howto/logging-cookbook.rst:3302 msgid "When this script is run, it should print something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:3291 +#: ../../howto/logging-cookbook.rst:3304 msgid "" "2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" "2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" @@ -4253,17 +4315,17 @@ msgstr "" "2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" "2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" -#: ../../howto/logging-cookbook.rst:3296 +#: ../../howto/logging-cookbook.rst:3309 msgid "" "showing how the time is formatted both as local time and UTC, one for each " "handler." msgstr "" -#: ../../howto/logging-cookbook.rst:3303 +#: ../../howto/logging-cookbook.rst:3316 msgid "Using a context manager for selective logging" msgstr "" -#: ../../howto/logging-cookbook.rst:3305 +#: ../../howto/logging-cookbook.rst:3318 msgid "" "There are times when it would be useful to temporarily change the logging " "configuration and revert it back after doing something. For this, a context " @@ -4273,7 +4335,7 @@ msgid "" "scope of the context manager::" msgstr "" -#: ../../howto/logging-cookbook.rst:3312 +#: ../../howto/logging-cookbook.rst:3325 msgid "" "import logging\n" "import sys\n" @@ -4302,7 +4364,7 @@ msgid "" " # implicit return of None => don't swallow exceptions" msgstr "" -#: ../../howto/logging-cookbook.rst:3338 +#: ../../howto/logging-cookbook.rst:3351 msgid "" "If you specify a level value, the logger's level is set to that value in the " "scope of the with block covered by the context manager. If you specify a " @@ -4311,13 +4373,13 @@ msgid "" "block exit - you could do this if you don't need the handler any more." msgstr "" -#: ../../howto/logging-cookbook.rst:3344 +#: ../../howto/logging-cookbook.rst:3357 msgid "" "To illustrate how it works, we can add the following block of code to the " "above::" msgstr "" -#: ../../howto/logging-cookbook.rst:3347 +#: ../../howto/logging-cookbook.rst:3360 msgid "" "if __name__ == '__main__':\n" " logger = logging.getLogger('foo')\n" @@ -4337,7 +4399,7 @@ msgid "" " logger.debug('7. This should not appear.')" msgstr "" -#: ../../howto/logging-cookbook.rst:3362 +#: ../../howto/logging-cookbook.rst:3375 msgid "" "We initially set the logger's level to ``INFO``, so message #1 appears and " "message #2 doesn't. We then change the level to ``DEBUG`` temporarily in the " @@ -4350,11 +4412,11 @@ msgid "" "(like message #1) whereas message #7 doesn't (just like message #2)." msgstr "" -#: ../../howto/logging-cookbook.rst:3372 +#: ../../howto/logging-cookbook.rst:3385 msgid "If we run the resulting script, the result is as follows:" msgstr "" -#: ../../howto/logging-cookbook.rst:3374 +#: ../../howto/logging-cookbook.rst:3387 msgid "" "$ python logctx.py\n" "1. This should appear just once on stderr.\n" @@ -4364,23 +4426,23 @@ msgid "" "6. This should appear just once on stderr." msgstr "" -#: ../../howto/logging-cookbook.rst:3383 +#: ../../howto/logging-cookbook.rst:3396 msgid "" "If we run it again, but pipe ``stderr`` to ``/dev/null``, we see the " "following, which is the only message written to ``stdout``:" msgstr "" -#: ../../howto/logging-cookbook.rst:3386 +#: ../../howto/logging-cookbook.rst:3399 msgid "" "$ python logctx.py 2>/dev/null\n" "5. This should appear twice - once on stderr and once on stdout." msgstr "" -#: ../../howto/logging-cookbook.rst:3391 +#: ../../howto/logging-cookbook.rst:3404 msgid "Once again, but piping ``stdout`` to ``/dev/null``, we get:" msgstr "" -#: ../../howto/logging-cookbook.rst:3393 +#: ../../howto/logging-cookbook.rst:3406 msgid "" "$ python logctx.py >/dev/null\n" "1. This should appear just once on stderr.\n" @@ -4389,53 +4451,53 @@ msgid "" "6. This should appear just once on stderr." msgstr "" -#: ../../howto/logging-cookbook.rst:3401 +#: ../../howto/logging-cookbook.rst:3414 msgid "" "In this case, the message #5 printed to ``stdout`` doesn't appear, as " "expected." msgstr "" -#: ../../howto/logging-cookbook.rst:3403 +#: ../../howto/logging-cookbook.rst:3416 msgid "" "Of course, the approach described here can be generalised, for example to " "attach logging filters temporarily. Note that the above code works in Python " "2 as well as Python 3." msgstr "" -#: ../../howto/logging-cookbook.rst:3411 +#: ../../howto/logging-cookbook.rst:3424 msgid "A CLI application starter template" msgstr "" -#: ../../howto/logging-cookbook.rst:3413 +#: ../../howto/logging-cookbook.rst:3426 msgid "Here's an example which shows how you can:" msgstr "" -#: ../../howto/logging-cookbook.rst:3415 +#: ../../howto/logging-cookbook.rst:3428 msgid "Use a logging level based on command-line arguments" msgstr "" -#: ../../howto/logging-cookbook.rst:3416 +#: ../../howto/logging-cookbook.rst:3429 msgid "" "Dispatch to multiple subcommands in separate files, all logging at the same " "level in a consistent way" msgstr "" -#: ../../howto/logging-cookbook.rst:3418 +#: ../../howto/logging-cookbook.rst:3431 msgid "Make use of simple, minimal configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:3420 +#: ../../howto/logging-cookbook.rst:3433 msgid "" "Suppose we have a command-line application whose job is to stop, start or " "restart some services. This could be organised for the purposes of " "illustration as a file ``app.py`` that is the main script for the " -"application, with individual commands implemented in ``start.py``, ``stop." -"py`` and ``restart.py``. Suppose further that we want to control the " +"application, with individual commands implemented in ``start.py``, " +"``stop.py`` and ``restart.py``. Suppose further that we want to control the " "verbosity of the application via a command-line argument, defaulting to " "``logging.INFO``. Here's one way that ``app.py`` could be written::" msgstr "" -#: ../../howto/logging-cookbook.rst:3428 +#: ../../howto/logging-cookbook.rst:3441 msgid "" "import argparse\n" "import importlib\n" @@ -4470,8 +4532,8 @@ msgid "" " mod = importlib.import_module(options.command)\n" " cmd = getattr(mod, 'command')\n" " except (ImportError, AttributeError):\n" -" print('Unable to find the code for command \\'%s\\'' % options." -"command)\n" +" print('Unable to find the code for command \\'%s\\'' % " +"options.command)\n" " return 1\n" " # Could get fancy here and load configuration from file or dictionary\n" " logging.basicConfig(level=options.log_level,\n" @@ -4482,13 +4544,13 @@ msgid "" " sys.exit(main())" msgstr "" -#: ../../howto/logging-cookbook.rst:3469 +#: ../../howto/logging-cookbook.rst:3482 msgid "" "And the ``start``, ``stop`` and ``restart`` commands can be implemented in " "separate modules, like so for starting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3472 +#: ../../howto/logging-cookbook.rst:3485 msgid "" "# start.py\n" "import logging\n" @@ -4501,11 +4563,11 @@ msgid "" " logger.info('Started the \\'%s\\' service.', options.name)" msgstr "" -#: ../../howto/logging-cookbook.rst:3482 +#: ../../howto/logging-cookbook.rst:3495 msgid "and thus for stopping::" msgstr "" -#: ../../howto/logging-cookbook.rst:3484 +#: ../../howto/logging-cookbook.rst:3497 msgid "" "# stop.py\n" "import logging\n" @@ -4527,11 +4589,11 @@ msgid "" " logger.info('Stopped the %s service%s.', services, plural)" msgstr "" -#: ../../howto/logging-cookbook.rst:3503 +#: ../../howto/logging-cookbook.rst:3516 msgid "and similarly for restarting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3505 +#: ../../howto/logging-cookbook.rst:3518 msgid "" "# restart.py\n" "import logging\n" @@ -4553,13 +4615,13 @@ msgid "" " logger.info('Restarted the %s service%s.', services, plural)" msgstr "" -#: ../../howto/logging-cookbook.rst:3524 +#: ../../howto/logging-cookbook.rst:3537 msgid "" "If we run this application with the default log level, we get output like " "this:" msgstr "" -#: ../../howto/logging-cookbook.rst:3526 +#: ../../howto/logging-cookbook.rst:3539 msgid "" "$ python app.py start foo\n" "INFO start Started the 'foo' service.\n" @@ -4571,19 +4633,19 @@ msgid "" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" -#: ../../howto/logging-cookbook.rst:3537 +#: ../../howto/logging-cookbook.rst:3550 msgid "" "The first word is the logging level, and the second word is the module or " "package name of the place where the event was logged." msgstr "" -#: ../../howto/logging-cookbook.rst:3540 +#: ../../howto/logging-cookbook.rst:3553 msgid "" "If we change the logging level, then we can change the information sent to " "the log. For example, if we want more information:" msgstr "" -#: ../../howto/logging-cookbook.rst:3543 +#: ../../howto/logging-cookbook.rst:3556 msgid "" "$ python app.py --log-level DEBUG start foo\n" "DEBUG start About to start foo\n" @@ -4598,36 +4660,36 @@ msgid "" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" -#: ../../howto/logging-cookbook.rst:3557 +#: ../../howto/logging-cookbook.rst:3570 msgid "And if we want less:" msgstr "" -#: ../../howto/logging-cookbook.rst:3559 +#: ../../howto/logging-cookbook.rst:3572 msgid "" "$ python app.py --log-level WARNING start foo\n" "$ python app.py --log-level WARNING stop foo bar\n" "$ python app.py --log-level WARNING restart foo bar baz" msgstr "" -#: ../../howto/logging-cookbook.rst:3565 +#: ../../howto/logging-cookbook.rst:3578 msgid "" "In this case, the commands don't print anything to the console, since " "nothing at ``WARNING`` level or above is logged by them." msgstr "" -#: ../../howto/logging-cookbook.rst:3571 +#: ../../howto/logging-cookbook.rst:3584 msgid "A Qt GUI for logging" msgstr "" -#: ../../howto/logging-cookbook.rst:3573 +#: ../../howto/logging-cookbook.rst:3586 msgid "" "A question that comes up from time to time is about how to log to a GUI " "application. The `Qt `_ framework is a popular cross-" -"platform UI framework with Python bindings using :pypi:`PySide2` or :pypi:" -"`PyQt5` libraries." +"platform UI framework with Python bindings using :pypi:`PySide2` " +"or :pypi:`PyQt5` libraries." msgstr "" -#: ../../howto/logging-cookbook.rst:3578 +#: ../../howto/logging-cookbook.rst:3591 msgid "" "The following example shows how to log to a Qt GUI. This introduces a simple " "``QtHandler`` class which takes a callable, which should be a slot in the " @@ -4637,14 +4699,14 @@ msgid "" "logging messages at random levels with random short delays in between)." msgstr "" -#: ../../howto/logging-cookbook.rst:3585 +#: ../../howto/logging-cookbook.rst:3598 msgid "" "The worker thread is implemented using Qt's ``QThread`` class rather than " "the :mod:`threading` module, as there are circumstances where one has to use " "``QThread``, which offers better integration with other ``Qt`` components." msgstr "" -#: ../../howto/logging-cookbook.rst:3589 +#: ../../howto/logging-cookbook.rst:3602 msgid "" "The code should work with recent releases of any of ``PySide6``, ``PyQt6``, " "``PySide2`` or ``PyQt5``. You should be able to adapt the approach to " @@ -4652,7 +4714,7 @@ msgid "" "more detailed information." msgstr "" -#: ../../howto/logging-cookbook.rst:3594 +#: ../../howto/logging-cookbook.rst:3607 msgid "" "import datetime\n" "import logging\n" @@ -4835,8 +4897,8 @@ msgid "" " self.start_thread()\n" " self.work_button.clicked.connect(self.worker.start)\n" " # Once started, the button should be disabled\n" -" self.work_button.clicked.connect(lambda : self.work_button." -"setEnabled(False))\n" +" self.work_button.clicked.connect(lambda : " +"self.work_button.setEnabled(False))\n" "\n" " def start_thread(self):\n" " self.worker = Worker()\n" @@ -4903,28 +4965,29 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:3826 +#: ../../howto/logging-cookbook.rst:3839 msgid "Logging to syslog with RFC5424 support" msgstr "" -#: ../../howto/logging-cookbook.rst:3828 +#: ../../howto/logging-cookbook.rst:3841 msgid "" "Although :rfc:`5424` dates from 2009, most syslog servers are configured by " "default to use the older :rfc:`3164`, which hails from 2001. When " "``logging`` was added to Python in 2003, it supported the earlier (and only " "existing) protocol at the time. Since RFC5424 came out, as there has not " -"been widespread deployment of it in syslog servers, the :class:`~logging." -"handlers.SysLogHandler` functionality has not been updated." +"been widespread deployment of it in syslog servers, " +"the :class:`~logging.handlers.SysLogHandler` functionality has not been " +"updated." msgstr "" -#: ../../howto/logging-cookbook.rst:3835 +#: ../../howto/logging-cookbook.rst:3848 msgid "" "RFC 5424 contains some useful features such as support for structured data, " "and if you need to be able to log to a syslog server with support for it, " "you can do so with a subclassed handler which looks something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3839 +#: ../../howto/logging-cookbook.rst:3852 msgid "" "import datetime\n" "import logging.handlers\n" @@ -4944,8 +5007,8 @@ msgid "" "\n" " def format(self, record):\n" " version = 1\n" -" asctime = datetime.datetime.fromtimestamp(record.created)." -"isoformat()\n" +" asctime = " +"datetime.datetime.fromtimestamp(record.created).isoformat()\n" " m = self.tz_offset.match(time.strftime('%z'))\n" " has_offset = False\n" " if m and time.timezone:\n" @@ -4994,7 +5057,7 @@ msgid "" "{sdata} {msg}'" msgstr "" -#: ../../howto/logging-cookbook.rst:3901 +#: ../../howto/logging-cookbook.rst:3914 msgid "" "You'll need to be familiar with RFC 5424 to fully understand the above code, " "and it may be that you have slightly different needs (e.g. for how you pass " @@ -5003,7 +5066,7 @@ msgid "" "using something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3906 +#: ../../howto/logging-cookbook.rst:3919 msgid "" "sd = {\n" " 'foo@12345': {'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'},\n" @@ -5021,11 +5084,11 @@ msgstr "" "i = 1\n" "logger.debug('Message %d', i, extra=extra)" -#: ../../howto/logging-cookbook.rst:3915 +#: ../../howto/logging-cookbook.rst:3928 msgid "How to treat a logger like an output stream" msgstr "" -#: ../../howto/logging-cookbook.rst:3917 +#: ../../howto/logging-cookbook.rst:3930 msgid "" "Sometimes, you need to interface to a third-party API which expects a file-" "like object to write to, but you want to direct the API's output to a " @@ -5033,7 +5096,7 @@ msgid "" "API. Here's a short script illustrating such a class:" msgstr "" -#: ../../howto/logging-cookbook.rst:3922 +#: ../../howto/logging-cookbook.rst:3935 msgid "" "import logging\n" "\n" @@ -5071,39 +5134,43 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:3957 +#: ../../howto/logging-cookbook.rst:3970 msgid "When this script is run, it prints" msgstr "" -#: ../../howto/logging-cookbook.rst:3959 +#: ../../howto/logging-cookbook.rst:3972 msgid "" "INFO:demo:An INFO message\n" "DEBUG:demo:A DEBUG message" msgstr "" -#: ../../howto/logging-cookbook.rst:3964 +#: ../../howto/logging-cookbook.rst:3977 msgid "" -"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and ``sys." -"stderr`` by doing something like this:" +"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and " +"``sys.stderr`` by doing something like this:" msgstr "" -#: ../../howto/logging-cookbook.rst:3967 +#: ../../howto/logging-cookbook.rst:3980 msgid "" "import sys\n" "\n" "sys.stdout = LoggerWriter(logger, logging.INFO)\n" "sys.stderr = LoggerWriter(logger, logging.WARNING)" msgstr "" +"import sys\n" +"\n" +"sys.stdout = LoggerWriter(logger, logging.INFO)\n" +"sys.stderr = LoggerWriter(logger, logging.WARNING)" -#: ../../howto/logging-cookbook.rst:3974 +#: ../../howto/logging-cookbook.rst:3987 msgid "" "You should do this *after* configuring logging for your needs. In the above " -"example, the :func:`~logging.basicConfig` call does this (using the ``sys." -"stderr`` value *before* it is overwritten by a ``LoggerWriter`` instance). " -"Then, you'd get this kind of result:" +"example, the :func:`~logging.basicConfig` call does this (using the " +"``sys.stderr`` value *before* it is overwritten by a ``LoggerWriter`` " +"instance). Then, you'd get this kind of result:" msgstr "" -#: ../../howto/logging-cookbook.rst:3979 +#: ../../howto/logging-cookbook.rst:3992 msgid "" ">>> print('Foo')\n" "INFO:demo:Foo\n" @@ -5117,31 +5184,31 @@ msgstr "" "WARNING:demo:Bar\n" ">>>" -#: ../../howto/logging-cookbook.rst:3987 +#: ../../howto/logging-cookbook.rst:4000 msgid "" -"Of course, the examples above show output according to the format used by :" -"func:`~logging.basicConfig`, but you can use a different formatter when you " -"configure logging." +"Of course, the examples above show output according to the format used " +"by :func:`~logging.basicConfig`, but you can use a different formatter when " +"you configure logging." msgstr "" -#: ../../howto/logging-cookbook.rst:3991 +#: ../../howto/logging-cookbook.rst:4004 msgid "" "Note that with the above scheme, you are somewhat at the mercy of buffering " "and the sequence of write calls which you are intercepting. For example, " "with the definition of ``LoggerWriter`` above, if you have the snippet" msgstr "" -#: ../../howto/logging-cookbook.rst:3995 +#: ../../howto/logging-cookbook.rst:4008 msgid "" "sys.stderr = LoggerWriter(logger, logging.WARNING)\n" "1 / 0" msgstr "" -#: ../../howto/logging-cookbook.rst:4000 +#: ../../howto/logging-cookbook.rst:4013 msgid "then running the script results in" msgstr "" -#: ../../howto/logging-cookbook.rst:4002 +#: ../../howto/logging-cookbook.rst:4015 msgid "" "WARNING:demo:Traceback (most recent call last):\n" "\n" @@ -5160,7 +5227,7 @@ msgid "" "WARNING:demo:division by zero" msgstr "" -#: ../../howto/logging-cookbook.rst:4018 +#: ../../howto/logging-cookbook.rst:4031 msgid "" "As you can see, this output isn't ideal. That's because the underlying code " "which writes to ``sys.stderr`` makes multiple writes, each of which results " @@ -5170,7 +5237,7 @@ msgid "" "``LoggerWriter``:" msgstr "" -#: ../../howto/logging-cookbook.rst:4024 +#: ../../howto/logging-cookbook.rst:4037 msgid "" "class BufferingLoggerWriter(LoggerWriter):\n" " def __init__(self, logger, level):\n" @@ -5206,13 +5273,13 @@ msgstr "" " for part in parts:\n" " self.logger.log(self.level, part)" -#: ../../howto/logging-cookbook.rst:4043 +#: ../../howto/logging-cookbook.rst:4056 msgid "" "This just buffers up stuff until a newline is seen, and then logs complete " "lines. With this approach, you get better output:" msgstr "" -#: ../../howto/logging-cookbook.rst:4046 +#: ../../howto/logging-cookbook.rst:4059 msgid "" "WARNING:demo:Traceback (most recent call last):\n" "WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 55, " @@ -5232,11 +5299,11 @@ msgstr "" "WARNING:demo: 1/0\n" "WARNING:demo:ZeroDivisionError: division by zero" -#: ../../howto/logging-cookbook.rst:4059 +#: ../../howto/logging-cookbook.rst:4072 msgid "Patterns to avoid" msgstr "" -#: ../../howto/logging-cookbook.rst:4061 +#: ../../howto/logging-cookbook.rst:4074 msgid "" "Although the preceding sections have described ways of doing things you " "might need to do or deal with, it is worth mentioning some usage patterns " @@ -5244,11 +5311,11 @@ msgid "" "The following sections are in no particular order." msgstr "" -#: ../../howto/logging-cookbook.rst:4067 +#: ../../howto/logging-cookbook.rst:4080 msgid "Opening the same log file multiple times" msgstr "" -#: ../../howto/logging-cookbook.rst:4069 +#: ../../howto/logging-cookbook.rst:4082 msgid "" "On Windows, you will generally not be able to open the same file multiple " "times as this will lead to a \"file is in use by another process\" error. " @@ -5256,32 +5323,32 @@ msgid "" "file multiple times. This could be done accidentally, for example by:" msgstr "" -#: ../../howto/logging-cookbook.rst:4074 +#: ../../howto/logging-cookbook.rst:4087 msgid "" "Adding a file handler more than once which references the same file (e.g. by " "a copy/paste/forget-to-change error)." msgstr "" -#: ../../howto/logging-cookbook.rst:4077 +#: ../../howto/logging-cookbook.rst:4090 msgid "" "Opening two files that look different, as they have different names, but are " "the same because one is a symbolic link to the other." msgstr "" -#: ../../howto/logging-cookbook.rst:4080 +#: ../../howto/logging-cookbook.rst:4093 msgid "" "Forking a process, following which both parent and child have a reference to " "the same file. This might be through use of the :mod:`multiprocessing` " "module, for example." msgstr "" -#: ../../howto/logging-cookbook.rst:4084 +#: ../../howto/logging-cookbook.rst:4097 msgid "" "Opening a file multiple times might *appear* to work most of the time, but " "can lead to a number of problems in practice:" msgstr "" -#: ../../howto/logging-cookbook.rst:4087 +#: ../../howto/logging-cookbook.rst:4100 msgid "" "Logging output can be garbled because multiple threads or processes try to " "write to the same file. Although logging guards against concurrent use of " @@ -5290,7 +5357,7 @@ msgid "" "different handler instances which happen to point to the same file." msgstr "" -#: ../../howto/logging-cookbook.rst:4093 +#: ../../howto/logging-cookbook.rst:4106 msgid "" "An attempt to delete a file (e.g. during file rotation) silently fails, " "because there is another reference pointing to it. This can lead to " @@ -5300,17 +5367,17 @@ msgid "" "being supposedly in place." msgstr "" -#: ../../howto/logging-cookbook.rst:4100 +#: ../../howto/logging-cookbook.rst:4113 msgid "" "Use the techniques outlined in :ref:`multiple-processes` to circumvent such " "issues." msgstr "" -#: ../../howto/logging-cookbook.rst:4104 +#: ../../howto/logging-cookbook.rst:4117 msgid "Using loggers as attributes in a class or passing them as parameters" msgstr "" -#: ../../howto/logging-cookbook.rst:4106 +#: ../../howto/logging-cookbook.rst:4119 msgid "" "While there might be unusual cases where you'll need to do this, in general " "there is no point because loggers are singletons. Code can always access a " @@ -5321,13 +5388,13 @@ msgid "" "module (and not the class) is the unit of software decomposition." msgstr "" -#: ../../howto/logging-cookbook.rst:4115 +#: ../../howto/logging-cookbook.rst:4128 msgid "" "Adding handlers other than :class:`~logging.NullHandler` to a logger in a " "library" msgstr "" -#: ../../howto/logging-cookbook.rst:4117 +#: ../../howto/logging-cookbook.rst:4130 msgid "" "Configuring logging by adding handlers, formatters and filters is the " "responsibility of the application developer, not the library developer. If " @@ -5335,11 +5402,11 @@ msgid "" "your loggers other than a :class:`~logging.NullHandler` instance." msgstr "" -#: ../../howto/logging-cookbook.rst:4123 +#: ../../howto/logging-cookbook.rst:4136 msgid "Creating a lot of loggers" msgstr "" -#: ../../howto/logging-cookbook.rst:4125 +#: ../../howto/logging-cookbook.rst:4138 msgid "" "Loggers are singletons that are never freed during a script execution, and " "so creating lots of loggers will use up memory which can't then be freed. " @@ -5350,38 +5417,38 @@ msgid "" "occasionally slightly more fine-grained than that)." msgstr "" -#: ../../howto/logging-cookbook.rst:4136 +#: ../../howto/logging-cookbook.rst:4149 msgid "Other resources" msgstr "其他資源" -#: ../../howto/logging-cookbook.rst:4140 +#: ../../howto/logging-cookbook.rst:4153 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../howto/logging-cookbook.rst:4141 +#: ../../howto/logging-cookbook.rst:4154 msgid "API reference for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4143 +#: ../../howto/logging-cookbook.rst:4156 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../howto/logging-cookbook.rst:4144 +#: ../../howto/logging-cookbook.rst:4157 msgid "Configuration API for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4146 +#: ../../howto/logging-cookbook.rst:4159 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../howto/logging-cookbook.rst:4147 +#: ../../howto/logging-cookbook.rst:4160 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4149 +#: ../../howto/logging-cookbook.rst:4162 msgid ":ref:`Basic Tutorial `" msgstr ":ref:`基礎教學 `" -#: ../../howto/logging-cookbook.rst:4151 +#: ../../howto/logging-cookbook.rst:4164 msgid ":ref:`Advanced Tutorial `" msgstr ":ref:`進階教學 `" diff --git a/howto/perf_profiling.po b/howto/perf_profiling.po index 0274ff095f..1c91e90f9f 100644 --- a/howto/perf_profiling.po +++ b/howto/perf_profiling.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-19 00:14+0000\n" "PO-Revision-Date: 2023-12-09 17:39+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -402,8 +402,10 @@ msgid "Example, using the environment variable::" msgstr "例如,使用環境變數: ::" #: ../../howto/perf_profiling.rst:165 +#, fuzzy msgid "" -"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python script.py\n" +"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python my_script." +"py\n" "$ perf report -g -i perf.data" msgstr "" "$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python script.py\n" @@ -414,8 +416,9 @@ msgid "Example, using the :option:`!-X` option::" msgstr "例如,使用 :option:`!-X` 選項: ::" #: ../../howto/perf_profiling.rst:170 +#, fuzzy msgid "" -"$ perf record -F 9999 -g -o perf.data python -X perf script.py\n" +"$ perf record -F 9999 -g -o perf.data python -X perf my_script.py\n" "$ perf report -g -i perf.data" msgstr "" "$ perf record -F 9999 -g -o perf.data python -X perf script.py\n" @@ -535,9 +538,10 @@ msgid "" msgstr "" #: ../../howto/perf_profiling.rst:239 +#, fuzzy msgid "" -"$ perf record -F 9999 -g --call-graph dwarf -o perf.data python -Xperf_jit " -"my_script.py\n" +"$ perf record -F 9999 -g -k 1 --call-graph dwarf -o perf.data python -" +"Xperf_jit my_script.py\n" "$ perf inject -i perf.data --jit --output perf.jit.data\n" "$ perf report -g -i perf.jit.data" msgstr "" @@ -574,13 +578,55 @@ msgstr "" #: ../../howto/perf_profiling.rst:257 msgid "" -"Notice that when using ``--call-graph dwarf`` the ``perf`` tool will take " -"snapshots of the stack of the process being profiled and save the " -"information in the ``perf.data`` file. By default the size of the stack dump " -"is 8192 bytes but the user can change the size by passing the size after " -"comma like ``--call-graph dwarf,4096``. The size of the stack dump is " -"important because if the size is too small ``perf`` will not be able to " -"unwind the stack and the output will be incomplete. On the other hand, if " -"the size is too big, then ``perf`` won't be able to sample the process as " -"frequently as it would like as the overhead will be higher." +"When using ``--call-graph dwarf``, the ``perf`` tool will take snapshots of " +"the stack of the process being profiled and save the information in the " +"``perf.data`` file. By default, the size of the stack dump is 8192 bytes, " +"but you can change the size by passing it after a comma like ``--call-graph " +"dwarf,16384``." +msgstr "" + +#: ../../howto/perf_profiling.rst:263 +msgid "" +"The size of the stack dump is important because if the size is too small " +"``perf`` will not be able to unwind the stack and the output will be " +"incomplete. On the other hand, if the size is too big, then ``perf`` won't " +"be able to sample the process as frequently as it would like as the overhead " +"will be higher." +msgstr "" + +#: ../../howto/perf_profiling.rst:269 +msgid "" +"The stack size is particularly important when profiling Python code compiled " +"with low optimization levels (like ``-O0``), as these builds tend to have " +"larger stack frames. If you are compiling Python with ``-O0`` and not seeing " +"Python functions in your profiling output, try increasing the stack dump " +"size to 65528 bytes (the maximum)::" +msgstr "" + +#: ../../howto/perf_profiling.rst:275 +#, fuzzy +msgid "" +"$ perf record -F 9999 -g -k 1 --call-graph dwarf,65528 -o perf.data python -" +"Xperf_jit my_script.py" +msgstr "$ perf record -F 9999 -g -o perf.data python my_script.py" + +#: ../../howto/perf_profiling.rst:277 +msgid "Different compilation flags can significantly impact stack sizes:" +msgstr "" + +#: ../../howto/perf_profiling.rst:279 +msgid "" +"Builds with ``-O0`` typically have much larger stack frames than those with " +"``-O1`` or higher" +msgstr "" + +#: ../../howto/perf_profiling.rst:280 +msgid "" +"Adding optimizations (``-O1``, ``-O2``, etc.) typically reduces stack size" +msgstr "" + +#: ../../howto/perf_profiling.rst:281 +msgid "" +"Frame pointers (``-fno-omit-frame-pointer``) generally provide more reliable " +"stack unwinding" msgstr "" diff --git a/howto/regex.po b/howto/regex.po index 42467d34b9..b261243bd7 100644 --- a/howto/regex.po +++ b/howto/regex.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -120,12 +120,12 @@ msgstr "" #: ../../howto/regex.rst:70 msgid "" -"There are exceptions to this rule; some characters are special :dfn:" -"`metacharacters`, and don't match themselves. Instead, they signal that " -"some out-of-the-ordinary thing should be matched, or they affect other " -"portions of the RE by repeating them or changing their meaning. Much of " -"this document is devoted to discussing various metacharacters and what they " -"do." +"There are exceptions to this rule; some characters are " +"special :dfn:`metacharacters`, and don't match themselves. Instead, they " +"signal that some out-of-the-ordinary thing should be matched, or they affect " +"other portions of the RE by repeating them or changing their meaning. Much " +"of this document is devoted to discussing various metacharacters and what " +"they do." msgstr "" #: ../../howto/regex.rst:76 @@ -160,12 +160,12 @@ msgstr "" #: ../../howto/regex.rst:97 msgid "" -"You can match the characters not listed within the class by :dfn:" -"`complementing` the set. This is indicated by including a ``'^'`` as the " -"first character of the class. For example, ``[^5]`` will match any character " -"except ``'5'``. If the caret appears elsewhere in a character class, it " -"does not have special meaning. For example: ``[5^]`` will match either a " -"``'5'`` or a ``'^'``." +"You can match the characters not listed within the class " +"by :dfn:`complementing` the set. This is indicated by including a ``'^'`` " +"as the first character of the class. For example, ``[^5]`` will match any " +"character except ``'5'``. If the caret appears elsewhere in a character " +"class, it does not have special meaning. For example: ``[5^]`` will match " +"either a ``'5'`` or a ``'^'``." msgstr "" #: ../../howto/regex.rst:103 @@ -190,10 +190,10 @@ msgid "" "Let's take an example: ``\\w`` matches any alphanumeric character. If the " "regex pattern is expressed in bytes, this is equivalent to the class ``[a-zA-" "Z0-9_]``. If the regex pattern is a string, ``\\w`` will match all the " -"characters marked as letters in the Unicode database provided by the :mod:" -"`unicodedata` module. You can use the more restricted definition of ``\\w`` " -"in a string pattern by supplying the :const:`re.ASCII` flag when compiling " -"the regular expression." +"characters marked as letters in the Unicode database provided by " +"the :mod:`unicodedata` module. You can use the more restricted definition " +"of ``\\w`` in a string pattern by supplying the :const:`re.ASCII` flag when " +"compiling the regular expression." msgstr "" #: ../../howto/regex.rst:123 @@ -272,9 +272,9 @@ msgstr "" #: ../../howto/regex.rst:156 msgid "" "The final metacharacter in this section is ``.``. It matches anything " -"except a newline character, and there's an alternate mode (:const:`re." -"DOTALL`) where it will match even a newline. ``.`` is often used where you " -"want to match \"any character\"." +"except a newline character, and there's an alternate mode " +"(:const:`re.DOTALL`) where it will match even a newline. ``.`` is often " +"used where you want to match \"any character\"." msgstr "" #: ../../howto/regex.rst:163 @@ -524,8 +524,8 @@ msgid "" "and no special syntax was created for expressing them. (There are " "applications that don't need REs at all, so there's no need to bloat the " "language specification by including them.) Instead, the :mod:`re` module is " -"simply a C extension module included with Python, just like the :mod:" -"`socket` or :mod:`zlib` modules." +"simply a C extension module included with Python, just like " +"the :mod:`socket` or :mod:`zlib` modules." msgstr "" #: ../../howto/regex.rst:292 @@ -612,10 +612,10 @@ msgstr "" #: ../../howto/regex.rst:336 msgid "" "In addition, special escape sequences that are valid in regular expressions, " -"but not valid as Python string literals, now result in a :exc:" -"`DeprecationWarning` and will eventually become a :exc:`SyntaxError`, which " -"means the sequences will be invalid if raw string notation or escaping the " -"backslashes isn't used." +"but not valid as Python string literals, now result in " +"a :exc:`DeprecationWarning` and will eventually become a :exc:`SyntaxError`, " +"which means the sequences will be invalid if raw string notation or escaping " +"the backslashes isn't used." msgstr "" #: ../../howto/regex.rst:344 @@ -698,8 +698,8 @@ msgstr "``finditer()``" #: ../../howto/regex.rst:374 msgid "" -"Find all substrings where the RE matches, and returns them as an :term:" -"`iterator`." +"Find all substrings where the RE matches, and returns them as " +"an :term:`iterator`." msgstr "" #: ../../howto/regex.rst:378 @@ -831,11 +831,11 @@ msgstr "" #: ../../howto/regex.rst:438 msgid "" -":meth:`~re.Match.group` returns the substring that was matched by the RE. :" -"meth:`~re.Match.start` and :meth:`~re.Match.end` return the starting and " -"ending index of the match. :meth:`~re.Match.span` returns both start and end " -"indexes in a single tuple. Since the :meth:`~re.Pattern.match` method only " -"checks if the RE matches at the start of a string, :meth:`!start` will " +":meth:`~re.Match.group` returns the substring that was matched by the " +"RE. :meth:`~re.Match.start` and :meth:`~re.Match.end` return the starting " +"and ending index of the match. :meth:`~re.Match.span` returns both start and " +"end indexes in a single tuple. Since the :meth:`~re.Pattern.match` method " +"only checks if the RE matches at the start of a string, :meth:`!start` will " "always be zero. However, the :meth:`~re.Pattern.search` method of patterns " "scans through the string, so the match may not start at zero in that " "case. ::" @@ -886,8 +886,8 @@ msgstr "" #: ../../howto/regex.rst:466 msgid "" -"Two pattern methods return all of the matches for a pattern. :meth:`~re." -"Pattern.findall` returns a list of matching strings::" +"Two pattern methods return all of the matches for a " +"pattern. :meth:`~re.Pattern.findall` returns a list of matching strings::" msgstr "" #: ../../howto/regex.rst:469 @@ -905,22 +905,22 @@ msgid "" "The ``r`` prefix, making the literal a raw string literal, is needed in this " "example because escape sequences in a normal \"cooked\" string literal that " "are not recognized by Python, as opposed to regular expressions, now result " -"in a :exc:`DeprecationWarning` and will eventually become a :exc:" -"`SyntaxError`. See :ref:`the-backslash-plague`." +"in a :exc:`DeprecationWarning` and will eventually become " +"a :exc:`SyntaxError`. See :ref:`the-backslash-plague`." msgstr "" #: ../../howto/regex.rst:479 msgid "" ":meth:`~re.Pattern.findall` has to create the entire list before it can be " "returned as the result. The :meth:`~re.Pattern.finditer` method returns a " -"sequence of :ref:`match object ` instances as an :term:" -"`iterator`::" +"sequence of :ref:`match object ` instances as " +"an :term:`iterator`::" msgstr "" #: ../../howto/regex.rst:483 msgid "" ">>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')\n" -">>> iterator \n" +">>> iterator\n" "\n" ">>> for match in iterator:\n" "... print(match.span())\n" @@ -930,7 +930,7 @@ msgid "" "(29, 31)" msgstr "" ">>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')\n" -">>> iterator \n" +">>> iterator\n" "\n" ">>> for match in iterator:\n" "... print(match.span())\n" @@ -941,28 +941,28 @@ msgstr "" #: ../../howto/regex.rst:495 msgid "Module-Level Functions" -msgstr "" +msgstr "模組層級函式" #: ../../howto/regex.rst:497 msgid "" -"You don't have to create a pattern object and call its methods; the :mod:" -"`re` module also provides top-level functions called :func:`~re.match`, :" -"func:`~re.search`, :func:`~re.findall`, :func:`~re.sub`, and so forth. " -"These functions take the same arguments as the corresponding pattern method " -"with the RE string added as the first argument, and still return either " -"``None`` or a :ref:`match object ` instance. ::" +"You don't have to create a pattern object and call its methods; " +"the :mod:`re` module also provides top-level functions " +"called :func:`~re.match`, :func:`~re.search`, :func:`~re.findall`, :func:`~re.sub`, " +"and so forth. These functions take the same arguments as the corresponding " +"pattern method with the RE string added as the first argument, and still " +"return either ``None`` or a :ref:`match object ` instance. ::" msgstr "" #: ../../howto/regex.rst:504 msgid "" ">>> print(re.match(r'From\\s+', 'Fromage amk'))\n" "None\n" -">>> re.match(r'From\\s+', 'From amk Thu May 14 19:12:10 1998') \n" +">>> re.match(r'From\\s+', 'From amk Thu May 14 19:12:10 1998')\n" "" msgstr "" ">>> print(re.match(r'From\\s+', 'Fromage amk'))\n" "None\n" -">>> re.match(r'From\\s+', 'From amk Thu May 14 19:12:10 1998') \n" +">>> re.match(r'From\\s+', 'From amk Thu May 14 19:12:10 1998')\n" "" #: ../../howto/regex.rst:509 @@ -989,12 +989,12 @@ msgstr "" msgid "" "Compilation flags let you modify some aspects of how regular expressions " "work. Flags are available in the :mod:`re` module under two names, a long " -"name such as :const:`IGNORECASE` and a short, one-letter form such as :const:" -"`I`. (If you're familiar with Perl's pattern modifiers, the one-letter " -"forms use the same letters; the short form of :const:`re.VERBOSE` is :const:" -"`re.X`, for example.) Multiple flags can be specified by bitwise OR-ing " -"them; ``re.I | re.M`` sets both the :const:`I` and :const:`M` flags, for " -"example." +"name such as :const:`IGNORECASE` and a short, one-letter form such " +"as :const:`I`. (If you're familiar with Perl's pattern modifiers, the one-" +"letter forms use the same letters; the short form of :const:`re.VERBOSE` " +"is :const:`re.X`, for example.) Multiple flags can be specified by bitwise " +"OR-ing them; ``re.I | re.M`` sets both the :const:`I` and :const:`M` flags, " +"for example." msgstr "" #: ../../howto/regex.rst:534 @@ -1074,8 +1074,8 @@ msgid "" "letter dotless i), 'ſ' (U+017F, Latin small letter long s) and 'K' (U+212A, " "Kelvin sign). ``Spam`` will match ``'Spam'``, ``'spam'``, ``'spAM'``, or " "``'ſpam'`` (the latter is matched only in Unicode mode). This lowercasing " -"doesn't take the current locale into account; it will if you also set the :" -"const:`LOCALE` flag." +"doesn't take the current locale into account; it will if you also set " +"the :const:`LOCALE` flag." msgstr "" #: ../../howto/regex.rst:581 @@ -1245,9 +1245,9 @@ msgstr "``^``" #: ../../howto/regex.rst:707 msgid "" "Matches at the beginning of lines. Unless the :const:`MULTILINE` flag has " -"been set, this will only match at the beginning of the string. In :const:" -"`MULTILINE` mode, this also matches immediately after each newline within " -"the string." +"been set, this will only match at the beginning of the string. " +"In :const:`MULTILINE` mode, this also matches immediately after each newline " +"within the string." msgstr "" #: ../../howto/regex.rst:711 @@ -1258,12 +1258,12 @@ msgstr "" #: ../../howto/regex.rst:714 msgid "" -">>> print(re.search('^From', 'From Here to Eternity')) \n" +">>> print(re.search('^From', 'From Here to Eternity'))\n" "\n" ">>> print(re.search('^From', 'Reciting From Memory'))\n" "None" msgstr "" -">>> print(re.search('^From', 'From Here to Eternity')) \n" +">>> print(re.search('^From', 'From Here to Eternity'))\n" "\n" ">>> print(re.search('^From', 'Reciting From Memory'))\n" "None" @@ -1284,18 +1284,18 @@ msgstr "" #: ../../howto/regex.rst:725 msgid "" -">>> print(re.search('}$', '{block}')) \n" +">>> print(re.search('}$', '{block}'))\n" "\n" ">>> print(re.search('}$', '{block} '))\n" "None\n" -">>> print(re.search('}$', '{block}\\n')) \n" +">>> print(re.search('}$', '{block}\\n'))\n" "" msgstr "" -">>> print(re.search('}$', '{block}')) \n" +">>> print(re.search('}$', '{block}'))\n" "\n" ">>> print(re.search('}$', '{block} '))\n" "None\n" -">>> print(re.search('}$', '{block}\\n')) \n" +">>> print(re.search('}$', '{block}\\n'))\n" "" #: ../../howto/regex.rst:732 @@ -1459,12 +1459,12 @@ msgstr "" msgid "" "Groups indicated with ``'('``, ``')'`` also capture the starting and ending " "index of the text that they match; this can be retrieved by passing an " -"argument to :meth:`~re.Match.group`, :meth:`~re.Match.start`, :meth:`~re." -"Match.end`, and :meth:`~re.Match.span`. Groups are numbered starting with " -"0. Group 0 is always present; it's the whole RE, so :ref:`match object " -"` methods all have group 0 as their default argument. Later " -"we'll see how to express groups that don't capture the span of text that " -"they match. ::" +"argument " +"to :meth:`~re.Match.group`, :meth:`~re.Match.start`, :meth:`~re.Match.end`, " +"and :meth:`~re.Match.span`. Groups are numbered starting with 0. Group 0 " +"is always present; it's the whole RE, so :ref:`match object ` " +"methods all have group 0 as their default argument. Later we'll see how to " +"express groups that don't capture the span of text that they match. ::" msgstr "" #: ../../howto/regex.rst:824 @@ -1693,8 +1693,8 @@ msgstr "" #: ../../howto/regex.rst:946 msgid "" -"Additionally, you can retrieve named groups as a dictionary with :meth:`~re." -"Match.groupdict`::" +"Additionally, you can retrieve named groups as a dictionary " +"with :meth:`~re.Match.groupdict`::" msgstr "" #: ../../howto/regex.rst:949 @@ -1710,8 +1710,8 @@ msgstr "" #: ../../howto/regex.rst:953 msgid "" "Named groups are handy because they let you use easily remembered names, " -"instead of having to remember numbers. Here's an example RE from the :mod:" -"`imaplib` module::" +"instead of having to remember numbers. Here's an example RE from " +"the :mod:`imaplib` module::" msgstr "" #: ../../howto/regex.rst:957 @@ -1743,8 +1743,8 @@ msgid "" "name instead of the number. This is another Python extension: ``(?P=name)`` " "indicates that the contents of the group called *name* should again be " "matched at the current point. The regular expression for finding doubled " -"words, ``\\b(\\w+)\\s+\\1\\b`` can also be written as ``\\b(?" -"P\\w+)\\s+(?P=word)\\b``::" +"words, ``\\b(\\w+)\\s+\\1\\b`` can also be written as ``\\b(?P\\w+)\\s+" +"(?P=word)\\b``::" msgstr "" #: ../../howto/regex.rst:974 @@ -1840,10 +1840,10 @@ msgid "" "The expression gets messier when you try to patch up the first solution by " "requiring one of the following cases to match: the first character of the " "extension isn't ``b``; the second character isn't ``a``; or the third " -"character isn't ``t``. This accepts ``foo.bar`` and rejects ``autoexec." -"bat``, but it requires a three-letter extension and won't accept a filename " -"with a two-letter extension such as ``sendmail.cf``. We'll complicate the " -"pattern again in an effort to fix it." +"character isn't ``t``. This accepts ``foo.bar`` and rejects " +"``autoexec.bat``, but it requires a three-letter extension and won't accept " +"a filename with a two-letter extension such as ``sendmail.cf``. We'll " +"complicate the pattern again in an effort to fix it." msgstr "" #: ../../howto/regex.rst:1030 @@ -2216,13 +2216,13 @@ msgstr "" #: ../../howto/regex.rst:1243 msgid "" "Sometimes using the :mod:`re` module is a mistake. If you're matching a " -"fixed string, or a single character class, and you're not using any :mod:" -"`re` features such as the :const:`~re.IGNORECASE` flag, then the full power " -"of regular expressions may not be required. Strings have several methods for " -"performing operations with fixed strings and they're usually much faster, " -"because the implementation is a single small C loop that's been optimized " -"for the purpose, instead of the large, more generalized regular expression " -"engine." +"fixed string, or a single character class, and you're not using " +"any :mod:`re` features such as the :const:`~re.IGNORECASE` flag, then the " +"full power of regular expressions may not be required. Strings have several " +"methods for performing operations with fixed strings and they're usually " +"much faster, because the implementation is a single small C loop that's been " +"optimized for the purpose, instead of the large, more generalized regular " +"expression engine." msgstr "" #: ../../howto/regex.rst:1251 @@ -2234,8 +2234,8 @@ msgid "" "turning ``swordfish`` into ``sdeedfish``, but the naive RE ``word`` would " "have done that, too. (To avoid performing the substitution on parts of " "words, the pattern would have to be ``\\bword\\b``, in order to require that " -"``word`` have a word boundary on either side. This takes the job beyond :" -"meth:`!replace`'s abilities.)" +"``word`` have a word boundary on either side. This takes the job " +"beyond :meth:`!replace`'s abilities.)" msgstr "" #: ../../howto/regex.rst:1260 @@ -2299,14 +2299,15 @@ msgstr "" #: ../../howto/regex.rst:1292 msgid "" -"Sometimes you'll be tempted to keep using :func:`re.match`, and just add ``." -"*`` to the front of your RE. Resist this temptation and use :func:`re." -"search` instead. The regular expression compiler does some analysis of REs " -"in order to speed up the process of looking for a match. One such analysis " -"figures out what the first character of a match must be; for example, a " -"pattern starting with ``Crow`` must match starting with a ``'C'``. The " -"analysis lets the engine quickly scan through the string looking for the " -"starting character, only trying the full match if a ``'C'`` is found." +"Sometimes you'll be tempted to keep using :func:`re.match`, and just add " +"``.*`` to the front of your RE. Resist this temptation and " +"use :func:`re.search` instead. The regular expression compiler does some " +"analysis of REs in order to speed up the process of looking for a match. " +"One such analysis figures out what the first character of a match must be; " +"for example, a pattern starting with ``Crow`` must match starting with a " +"``'C'``. The analysis lets the engine quickly scan through the string " +"looking for the starting character, only trying the full match if a ``'C'`` " +"is found." msgstr "" #: ../../howto/regex.rst:1301 diff --git a/howto/unicode.po b/howto/unicode.po index b7b29e8cd1..66eab41171 100644 --- a/howto/unicode.po +++ b/howto/unicode.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -79,10 +79,10 @@ msgstr "" msgid "" "The Unicode standard describes how characters are represented by **code " "points**. A code point value is an integer in the range 0 to 0x10FFFF " -"(about 1.1 million values, the `actual number assigned `_ is less than that). In the standard and in " -"this document, a code point is written using the notation ``U+265E`` to mean " -"the character with value ``0x265e`` (9,822 in decimal)." +"(about 1.1 million values, the `actual number assigned `_ is less than that). In the " +"standard and in this document, a code point is written using the notation " +"``U+265E`` to mean the character with value ``0x265e`` (9,822 in decimal)." msgstr "" #: ../../howto/unicode.rst:50 @@ -301,8 +301,8 @@ msgstr "" #: ../../howto/unicode.rst:173 msgid "" -"Another `good introductory article `_ was " "written by Joel Spolsky. If this introduction didn't make things clear to " "you, you should try reading this alternate article before continuing." @@ -406,7 +406,7 @@ msgstr "" #: ../../howto/unicode.rst:236 msgid "" -">>> b'\\x80abc'.decode(\"utf-8\", \"strict\") \n" +">>> b'\\x80abc'.decode(\"utf-8\", \"strict\")\n" "Traceback (most recent call last):\n" " ...\n" "UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0:\n" @@ -418,7 +418,7 @@ msgid "" ">>> b'\\x80abc'.decode(\"utf-8\", \"ignore\")\n" "'abc'" msgstr "" -">>> b'\\x80abc'.decode(\"utf-8\", \"strict\") \n" +">>> b'\\x80abc'.decode(\"utf-8\", \"strict\")\n" "Traceback (most recent call last):\n" " ...\n" "UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0:\n" @@ -473,10 +473,10 @@ msgstr "" #: ../../howto/unicode.rst:272 msgid "" -"The *errors* parameter is the same as the parameter of the :meth:`~bytes." -"decode` method but supports a few more possible handlers. As well as " -"``'strict'``, ``'ignore'``, and ``'replace'`` (which in this case inserts a " -"question mark instead of the unencodable character), there is also " +"The *errors* parameter is the same as the parameter of " +"the :meth:`~bytes.decode` method but supports a few more possible handlers. " +"As well as ``'strict'``, ``'ignore'``, and ``'replace'`` (which in this case " +"inserts a question mark instead of the unencodable character), there is also " "``'xmlcharrefreplace'`` (inserts an XML character reference), " "``backslashreplace`` (inserts a ``\\uNNNN`` escape sequence) and " "``namereplace`` (inserts a ``\\N{...}`` escape sequence)." @@ -491,7 +491,7 @@ msgid "" ">>> u = chr(40960) + 'abcd' + chr(1972)\n" ">>> u.encode('utf-8')\n" "b'\\xea\\x80\\x80abcd\\xde\\xb4'\n" -">>> u.encode('ascii') \n" +">>> u.encode('ascii')\n" "Traceback (most recent call last):\n" " ...\n" "UnicodeEncodeError: 'ascii' codec can't encode character '\\ua000' in\n" @@ -510,7 +510,7 @@ msgstr "" ">>> u = chr(40960) + 'abcd' + chr(1972)\n" ">>> u.encode('utf-8')\n" "b'\\xea\\x80\\x80abcd\\xde\\xb4'\n" -">>> u.encode('ascii') \n" +">>> u.encode('ascii')\n" "Traceback (most recent call last):\n" " ...\n" "UnicodeEncodeError: 'ascii' codec can't encode character '\\ua000' in\n" @@ -674,9 +674,9 @@ msgid "" "subcategories. To take the codes from the above output, ``'Ll'`` means " "'Letter, lowercase', ``'No'`` means \"Number, other\", ``'Mn'`` is \"Mark, " "nonspacing\", and ``'So'`` is \"Symbol, other\". See `the General Category " -"Values section of the Unicode Character Database documentation `_ for a list of category " -"codes." +"Values section of the Unicode Character Database documentation `_ for a list of " +"category codes." msgstr "" #: ../../howto/unicode.rst:402 @@ -714,12 +714,12 @@ msgstr "" #: ../../howto/unicode.rst:425 msgid "" -"A second tool is the :mod:`unicodedata` module's :func:`~unicodedata." -"normalize` function that converts strings to one of several normal forms, " -"where letters followed by a combining character are replaced with single " -"characters. :func:`~unicodedata.normalize` can be used to perform string " -"comparisons that won't falsely report inequality if two strings use " -"combining characters differently:" +"A second tool is the :mod:`unicodedata` " +"module's :func:`~unicodedata.normalize` function that converts strings to " +"one of several normal forms, where letters followed by a combining character " +"are replaced with single characters. :func:`~unicodedata.normalize` can be " +"used to perform string comparisons that won't falsely report inequality if " +"two strings use combining characters differently:" msgstr "" #: ../../howto/unicode.rst:434 @@ -863,8 +863,9 @@ msgstr "" #: ../../howto/unicode.rst:520 msgid "" -"`Processing Text Files in Python 3 `_, by Nick Coghlan." +"`Processing Text Files in Python 3 `_, " +"by Nick Coghlan." msgstr "" #: ../../howto/unicode.rst:521 @@ -875,8 +876,8 @@ msgstr "" #: ../../howto/unicode.rst:523 msgid "" -"The :class:`str` type is described in the Python library reference at :ref:" -"`textseq`." +"The :class:`str` type is described in the Python library reference " +"at :ref:`textseq`." msgstr "" #: ../../howto/unicode.rst:526 @@ -947,8 +948,8 @@ msgid "" "object that assumes the file's contents are in a specified encoding and " "accepts Unicode parameters for methods such as :meth:`~io.TextIOBase.read` " "and :meth:`~io.TextIOBase.write`. This works through :func:`open`\\'s " -"*encoding* and *errors* parameters which are interpreted just like those in :" -"meth:`str.encode` and :meth:`bytes.decode`." +"*encoding* and *errors* parameters which are interpreted just like those " +"in :meth:`str.encode` and :meth:`bytes.decode`." msgstr "" #: ../../howto/unicode.rst:574 @@ -1217,8 +1218,8 @@ msgstr "" #: ../../howto/unicode.rst:737 msgid "" -"One section of `Mastering Python 3 Input/Output `_, a PyCon 2010 talk by David " +"One section of `Mastering Python 3 Input/Output `_, a PyCon 2010 talk by David " "Beazley, discusses text processing and binary data handling." msgstr "" diff --git a/howto/urllib2.po b/howto/urllib2.po index 4e79e88dd9..bff4e431ba 100644 --- a/howto/urllib2.po +++ b/howto/urllib2.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2022-06-27 09:36+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,11 +43,11 @@ msgstr "以下這些與 Python 有關的文章說不定能幫到你::" #: ../../howto/urllib2.rst:18 msgid "" -"`Basic Authentication `_" +"`Basic Authentication `_" msgstr "" -"`Basic Authentication `_" +"`Basic Authentication `_" #: ../../howto/urllib2.rst:20 msgid "A tutorial on *Basic Authentication*, with examples in Python." @@ -114,8 +114,8 @@ msgstr "" #: ../../howto/urllib2.rst:52 msgid "" "If you wish to retrieve a resource via URL and store it in a temporary " -"location, you can do so via the :func:`shutil.copyfileobj` and :func:" -"`tempfile.NamedTemporaryFile` functions::" +"location, you can do so via the :func:`shutil.copyfileobj` " +"and :func:`tempfile.NamedTemporaryFile` functions::" msgstr "" #: ../../howto/urllib2.rst:56 @@ -274,7 +274,7 @@ msgid "" ">>> data['location'] = 'Northampton'\n" ">>> data['language'] = 'Python'\n" ">>> url_values = urllib.parse.urlencode(data)\n" -">>> print(url_values) # The order may differ from below. \n" +">>> print(url_values) # The order may differ from below.\n" "name=Somebody+Here&language=Python&location=Northampton\n" ">>> url = 'http://www.example.com/example.cgi'\n" ">>> full_url = url + '?' + url_values\n" @@ -287,7 +287,7 @@ msgstr "" ">>> data['location'] = 'Northampton'\n" ">>> data['language'] = 'Python'\n" ">>> url_values = urllib.parse.urlencode(data)\n" -">>> print(url_values) # The order may differ from below. \n" +">>> print(url_values) # The order may differ from below.\n" "name=Somebody+Here&language=Python&location=Northampton\n" ">>> url = 'http://www.example.com/example.cgi'\n" ">>> full_url = url + '?' + url_values\n" @@ -370,14 +370,14 @@ msgstr "" #: ../../howto/urllib2.rst:197 msgid "" "*urlopen* raises :exc:`~urllib.error.URLError` when it cannot handle a " -"response (though as usual with Python APIs, built-in exceptions such as :exc:" -"`ValueError`, :exc:`TypeError` etc. may also be raised)." +"response (though as usual with Python APIs, built-in exceptions such " +"as :exc:`ValueError`, :exc:`TypeError` etc. may also be raised)." msgstr "" #: ../../howto/urllib2.rst:201 msgid "" -":exc:`~urllib.error.HTTPError` is the subclass of :exc:`~urllib.error." -"URLError` raised in the specific case of HTTP URLs." +":exc:`~urllib.error.HTTPError` is the subclass " +"of :exc:`~urllib.error.URLError` raised in the specific case of HTTP URLs." msgstr "" #: ../../howto/urllib2.rst:204 @@ -405,14 +405,14 @@ msgid "" ">>> req = urllib.request.Request('http://www.pretend_server.org')\n" ">>> try: urllib.request.urlopen(req)\n" "... except urllib.error.URLError as e:\n" -"... print(e.reason) \n" +"... print(e.reason)\n" "...\n" "(4, 'getaddrinfo failed')" msgstr "" ">>> req = urllib.request.Request('http://www.pretend_server.org')\n" ">>> try: urllib.request.urlopen(req)\n" "... except urllib.error.URLError as e:\n" -"... print(e.reason) \n" +"... print(e.reason)\n" "...\n" "(4, 'getaddrinfo failed')" @@ -427,9 +427,9 @@ msgid "" "request. The default handlers will handle some of these responses for you " "(for example, if the response is a \"redirection\" that requests the client " "fetch the document from a different URL, urllib will handle that for you). " -"For those it can't handle, urlopen will raise an :exc:`~urllib.error." -"HTTPError`. Typical errors include '404' (page not found), '403' (request " -"forbidden), and '401' (authentication required)." +"For those it can't handle, urlopen will raise " +"an :exc:`~urllib.error.HTTPError`. Typical errors include '404' (page not " +"found), '403' (request forbidden), and '401' (authentication required)." msgstr "" #: ../../howto/urllib2.rst:235 @@ -548,12 +548,12 @@ msgid "" "... urllib.request.urlopen(req)\n" "... except urllib.error.HTTPError as e:\n" "... print(e.code)\n" -"... print(e.read()) \n" +"... print(e.read())\n" "...\n" "404\n" "b'\\n\\n\\n\\n\\n\\nPage Not Found\\n\n" " ..." @@ -563,12 +563,12 @@ msgstr "" "... urllib.request.urlopen(req)\n" "... except urllib.error.HTTPError as e:\n" "... print(e.code)\n" -"... print(e.read()) \n" +"... print(e.read())\n" "...\n" "404\n" "b'\\n\\n\\n\\n\\n\\nPage Not Found\\n\n" " ..." @@ -579,9 +579,9 @@ msgstr "" #: ../../howto/urllib2.rst:341 msgid "" -"So if you want to be prepared for :exc:`~urllib.error.HTTPError` *or* :exc:" -"`~urllib.error.URLError` there are two basic approaches. I prefer the second " -"approach." +"So if you want to be prepared for :exc:`~urllib.error.HTTPError` " +"*or* :exc:`~urllib.error.URLError` there are two basic approaches. I prefer " +"the second approach." msgstr "" #: ../../howto/urllib2.rst:345 @@ -655,8 +655,8 @@ msgstr "" #: ../../howto/urllib2.rst:402 msgid "" "**info** - this returns a dictionary-like object that describes the page " -"fetched, particularly the headers sent by the server. It is currently an :" -"class:`http.client.HTTPMessage` instance." +"fetched, particularly the headers sent by the server. It is currently " +"an :class:`http.client.HTTPMessage` instance." msgstr "" #: ../../howto/urllib2.rst:406 @@ -691,8 +691,8 @@ msgstr "" #: ../../howto/urllib2.rst:427 msgid "" -"To create an opener, instantiate an ``OpenerDirector``, and then call ``." -"add_handler(some_handler_instance)`` repeatedly." +"To create an opener, instantiate an ``OpenerDirector``, and then call " +"``.add_handler(some_handler_instance)`` repeatedly." msgstr "" #: ../../howto/urllib2.rst:430 @@ -850,8 +850,8 @@ msgstr "" #: ../../howto/urllib2.rst:540 msgid "" "Currently ``urllib.request`` *does not* support fetching of ``https`` " -"locations through a proxy. However, this can be enabled by extending urllib." -"request as shown in the recipe [#]_." +"locations through a proxy. However, this can be enabled by extending " +"urllib.request as shown in the recipe [#]_." msgstr "" #: ../../howto/urllib2.rst:546 @@ -875,9 +875,9 @@ msgid "" "As of Python 2.3 you can specify how long a socket should wait for a " "response before timing out. This can be useful in applications which have to " "fetch web pages. By default the socket module has *no timeout* and can hang. " -"Currently, the socket timeout is not exposed at the http.client or urllib." -"request levels. However, you can set the default timeout globally for all " -"sockets using ::" +"Currently, the socket timeout is not exposed at the http.client or " +"urllib.request levels. However, you can set the default timeout globally for " +"all sockets using ::" msgstr "" #: ../../howto/urllib2.rst:562 @@ -897,7 +897,7 @@ msgstr "" #: ../../howto/urllib2.rst:579 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../howto/urllib2.rst:581 msgid "This document was reviewed and revised by John Lee." @@ -940,13 +940,3 @@ msgid "" "code.activestate.com/recipes/456195-urrlib2-opener-for-ssl-proxy-connect-" "method/>`_." msgstr "" - -#~ msgid "" -#~ "There is a French translation of an earlier revision of this HOWTO, " -#~ "available at `urllib2 - Le Manuel manquant `_." -#~ msgstr "" -#~ "這份指南出自於早期版本的法文翻譯 `urllib2 - Le Manuel manquant `_。" diff --git a/library/abc.po b/library/abc.po index 5d5dde6b3b..ed52a2ad79 100644 --- a/library/abc.po +++ b/library/abc.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-02-27 00:15+0000\n" "PO-Revision-Date: 2022-11-16 03:29+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,8 +33,9 @@ msgstr "**原始碼:**\\ :source:`Lib/abc.py`" msgid "" "This module provides the infrastructure for defining :term:`abstract base " "classes ` (ABCs) in Python, as outlined in :pep:`3119`; " -"see the PEP for why this was added to Python. (See also :pep:`3141` and the :" -"mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.)" +"see the PEP for why this was added to Python. (See also :pep:`3141` and " +"the :mod:`numbers` module regarding a type hierarchy for numbers based on " +"ABCs.)" msgstr "" "如同在 :pep:`3119` 中所述,該模組提供了在 Python 中定義\\ :term:`抽象基底類" "別 ` (ABC) 的基礎元件;若想瞭解為什麼需要在 Python 中增" @@ -44,10 +45,10 @@ msgstr "" #: ../../library/abc.rst:20 msgid "" "The :mod:`collections` module has some concrete classes that derive from " -"ABCs; these can, of course, be further derived. In addition, the :mod:" -"`collections.abc` submodule has some ABCs that can be used to test whether a " -"class or instance provides a particular interface, for example, if it is :" -"term:`hashable` or if it is a :term:`mapping`." +"ABCs; these can, of course, be further derived. In addition, " +"the :mod:`collections.abc` submodule has some ABCs that can be used to test " +"whether a class or instance provides a particular interface, for example, if " +"it is :term:`hashable` or if it is a :term:`mapping`." msgstr "" ":mod:`collections` 模組中有一些衍生自 ABC 的具體類別;當然這些類別還可以進一" "步衍生出其他類別。此外,:mod:`collections.abc` 子模組中有一些 ABC 可被用於測" @@ -68,9 +69,9 @@ msgid "" "an abstract base class can be created by simply deriving from :class:`!ABC` " "avoiding sometimes confusing metaclass usage, for example::" msgstr "" -"一個使用 :class:`ABCMeta` 作為元類別的工具類別。抽象基底類別可以透過自 :" -"class:`!ABC` 衍生而建立,這就避免了在某些情況下會令人混淆的元類別用法,用法如" -"以下範例: ::" +"一個使用 :class:`ABCMeta` 作為元類別的工具類別。抽象基底類別可以透過" +"自 :class:`!ABC` 衍生而建立,這就避免了在某些情況下會令人混淆的元類別用法,用" +"法如以下範例: ::" #: ../../library/abc.rst:36 msgid "" @@ -125,10 +126,10 @@ msgid "" msgstr "" "使用該元類別以建立一個 ABC。一個 ABC 可以像 mix-in 類別一樣直接被子類別繼承。" "你也可以將不相關的具體類別(甚至是內建類別)和 ABC 註冊為「虛擬子類別 " -"(virtual subclass)」 —— 這些類別以及它們的子類別會被內建函式 :func:" -"`issubclass` 識別為已註冊 ABC 的子類別,但是該 ABC 不會出現在其 MRO(Method " -"Resolution Order,方法解析順序)中,由該 ABC 所定義的方法實作也不可呼叫(即使" -"透過 :func:`super` 呼叫也不行)。[#]_" +"(virtual subclass)」 —— 這些類別以及它們的子類別會被內建函" +"式 :func:`issubclass` 識別為已註冊 ABC 的子類別,但是該 ABC 不會出現在其 MRO" +"(Method Resolution Order,方法解析順序)中,由該 ABC 所定義的方法實作也不可" +"呼叫(即使透過 :func:`super` 呼叫也不行)。[#]_" #: ../../library/abc.rst:68 msgid "" @@ -169,8 +170,8 @@ msgstr "回傳已註冊的子類別,使其能夠作為類別裝飾器。" #: ../../library/abc.rst:88 msgid "" -"To detect calls to :meth:`!register`, you can use the :func:" -"`get_cache_token` function." +"To detect calls to :meth:`!register`, you can use " +"the :func:`get_cache_token` function." msgstr "" "你可以使用 :func:`get_cache_token` 函式來檢測對 :meth:`!register` 的呼叫。" @@ -187,13 +188,13 @@ msgid "" "Check whether *subclass* is considered a subclass of this ABC. This means " "that you can customize the behavior of :func:`issubclass` further without " "the need to call :meth:`register` on every class you want to consider a " -"subclass of the ABC. (This class method is called from the :meth:`~type." -"__subclasscheck__` method of the ABC.)" +"subclass of the ABC. (This class method is called from " +"the :meth:`~type.__subclasscheck__` method of the ABC.)" msgstr "" -"檢查 *subclass* 是否該被認為是該 ABC 的子類別,也就是說你可以直接自訂 :func:" -"`issubclass` 的行為,而不用對於那些你希望定義為該 ABC 的子類別的類別都個別呼" -"叫 :meth:`register` 方法。(這個類別方法是在 ABC 的 :meth:`~type." -"__subclasscheck__` 方法中呼叫。)" +"檢查 *subclass* 是否該被認為是該 ABC 的子類別,也就是說你可以直接自" +"訂 :func:`issubclass` 的行為,而不用對於那些你希望定義為該 ABC 的子類別的類別" +"都個別呼叫 :meth:`register` 方法。(這個類別方法是在 ABC " +"的 :meth:`~type.__subclasscheck__` 方法中呼叫。)" #: ../../library/abc.rst:104 msgid "" @@ -205,8 +206,8 @@ msgid "" msgstr "" "此方法必須回傳 ``True``、``False`` 或是 :data:`NotImplemented`。如果回傳 " "``True``,*subclass* 就會被認為是這個 ABC 的子類別。如果回傳 ``False``," -"*subclass* 就會被判定並非該 ABC 的子類別,即便正常情況應如此。如果回傳 :data:" -"`!NotImplemented`,子類別檢查會按照正常機制繼續執行。" +"*subclass* 就會被判定並非該 ABC 的子類別,即便正常情況應如此。如果回" +"傳 :data:`!NotImplemented`,子類別檢查會按照正常機制繼續執行。" #: ../../library/abc.rst:114 msgid "" @@ -271,39 +272,40 @@ msgstr "" #: ../../library/abc.rst:143 msgid "" -"The ABC ``MyIterable`` defines the standard iterable method, :meth:" -"`~iterator.__iter__`, as an abstract method. The implementation given here " -"can still be called from subclasses. The :meth:`!get_iterator` method is " -"also part of the ``MyIterable`` abstract base class, but it does not have to " -"be overridden in non-abstract derived classes." +"The ABC ``MyIterable`` defines the standard iterable " +"method, :meth:`~object.__iter__`, as an abstract method. The implementation " +"given here can still be called from subclasses. The :meth:`!get_iterator` " +"method is also part of the ``MyIterable`` abstract base class, but it does " +"not have to be overridden in non-abstract derived classes." msgstr "" -"ABC ``MyIterable`` 定義了作為抽象方法的一個標準疊代方法 :meth:`~iterator." -"__iter__`。這裡給定的實作仍可在子類別中被呼叫。:meth:`!get_iterator` 方法也" -"是 ``MyIterable`` 抽象基底類別的一部分,但它不必被非抽象衍生類別覆寫。" +"ABC ``MyIterable`` 定義了作為抽象方法的一個標準疊代方" +"法 :meth:`~object.__iter__`。這裡給定的實作仍可在子類別中被呼叫。:meth:`!" +"get_iterator` 方法也是 ``MyIterable`` 抽象基底類別的一部分,但它不必被非抽象" +"衍生類別覆寫。" #: ../../library/abc.rst:149 msgid "" "The :meth:`__subclasshook__` class method defined here says that any class " -"that has an :meth:`~iterator.__iter__` method in its :attr:`~object." -"__dict__` (or in that of one of its base classes, accessed via the :attr:" -"`~type.__mro__` list) is considered a ``MyIterable`` too." +"that has an :meth:`~object.__iter__` method in its :attr:`~object.__dict__` " +"(or in that of one of its base classes, accessed via " +"the :attr:`~type.__mro__` list) is considered a ``MyIterable`` too." msgstr "" -"這裡定義的 :meth:`__subclasshook__` 類別方法說明任何在其 :attr:`~object." -"__dict__` (或在其透過 :attr:`~type.__mro__` 列表訪問的基底類別) 中具有 :meth:" -"`~iterator.__iter__` 方法的類別也都會被視為 ``MyIterable``。" +"這裡定義的 :meth:`__subclasshook__` 類別方法說明任何在" +"其 :attr:`~object.__dict__` (或在其透過 :attr:`~type.__mro__` 列表訪問的基底" +"類別) 中具有 :meth:`~object.__iter__` 方法的類別也都會被視為 ``MyIterable``。" #: ../../library/abc.rst:154 msgid "" "Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``, " -"even though it does not define an :meth:`~iterator.__iter__` method (it uses " +"even though it does not define an :meth:`~object.__iter__` method (it uses " "the old-style iterable protocol, defined in terms of :meth:`~object.__len__` " "and :meth:`~object.__getitem__`). Note that this will not make " "``get_iterator`` available as a method of ``Foo``, so it is provided " "separately." msgstr "" -"最後,即使 ``Foo`` 沒有定義 :meth:`~iterator.__iter__` 方法(它使用了以 :" -"meth:`~object.__len__` 和 :meth:`~object.__getitem__` 所定義的舊式可疊代物件" -"協定),最末一行使其成為 ``MyIterable`` 的一個虛擬子類別。請注意這不會使 " +"最後,即使 ``Foo`` 沒有定義 :meth:`~object.__iter__` 方法(它使用了" +"以 :meth:`~object.__len__` 和 :meth:`~object.__getitem__` 所定義的舊式可疊代" +"物件協定),最末一行使其成為 ``MyIterable`` 的一個虛擬子類別。請注意這不會使 " "``get_iterator`` 成為 ``Foo`` 的一個可用方法,所以它是需要被另外提供的。" #: ../../library/abc.rst:163 @@ -423,8 +425,8 @@ msgid "" msgstr "" "為了能正確地與 ABC 機制實作相互操作,描述器必須使用 :attr:`!" "__isabstractmethod__` 將自身標識為抽象的。一般來說,如果被用於組成描述器的任" -"一方法是抽象的,則此屬性應當為 ``True``。 例如,Python 的內建 :class:" -"`property` 所做的就等價於: ::" +"一方法是抽象的,則此屬性應當為 ``True``。 例如,Python 的內" +"建 :class:`property` 所做的就等價於: ::" #: ../../library/abc.rst:223 msgid "" @@ -536,13 +538,15 @@ msgstr "" #: ../../library/abc.rst:285 msgid "" -"It is now possible to use :class:`property`, :meth:`property.getter`, :meth:" -"`property.setter` and :meth:`property.deleter` with :func:`abstractmethod`, " -"making this decorator redundant." +"It is now possible to " +"use :class:`property`, :meth:`property.getter`, :meth:`property.setter` " +"and :meth:`property.deleter` with :func:`abstractmethod`, making this " +"decorator redundant." msgstr "" -"現在可以讓 :class:`property`、:meth:`property.getter`、:meth:`property." -"setter` 和 :meth:`property.deleter` 配合 :func:`abstractmethod` 使用,使得此" -"裝飾器變得冗餘。" +"現在可以" +"讓 :class:`property`、:meth:`property.getter`、:meth:`property.setter` " +"和 :meth:`property.deleter` 配合 :func:`abstractmethod` 使用,使得此裝飾器變" +"得冗餘。" #: ../../library/abc.rst:290 msgid "" @@ -636,8 +640,8 @@ msgid "" "The token changes with every call to :meth:`ABCMeta.register` on any ABC." msgstr "" "此令牌是一個(支援相等性測試的)不透明物件 (opaque object),用於為虛擬子類別" -"標識抽象基底類別快取的當前版本。此令牌會在任何 ABC 上每次呼叫 :meth:`ABCMeta." -"register` 時發生更改。" +"標識抽象基底類別快取的當前版本。此令牌會在任何 ABC 上每次呼" +"叫 :meth:`ABCMeta.register` 時發生更改。" #: ../../library/abc.rst:340 msgid "" diff --git a/library/argparse.po b/library/argparse.po index b0188fae49..ba81a4c6d3 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-29 11:18+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+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-" @@ -47,16 +47,16 @@ msgstr "教學" #: ../../library/argparse.rst:30 msgid "" "This page contains the API reference information. For a more gentle " -"introduction to Python command-line parsing, have a look at the :ref:" -"`argparse tutorial `." +"introduction to Python command-line parsing, have a look at " +"the :ref:`argparse tutorial `." msgstr "" #: ../../library/argparse.rst:34 msgid "" "The :mod:`!argparse` module makes it easy to write user-friendly command-" "line interfaces. The program defines what arguments it requires, and :mod:`!" -"argparse` will figure out how to parse those out of :data:`sys.argv`. The :" -"mod:`!argparse` module also automatically generates help and usage " +"argparse` will figure out how to parse those out of :data:`sys.argv`. " +"The :mod:`!argparse` module also automatically generates help and usage " "messages. The module will also issue errors when users give the program " "invalid arguments." msgstr "" @@ -116,8 +116,8 @@ msgstr "" #: ../../library/argparse.rst:65 msgid "" -"If you're looking for a guide about how to upgrade :mod:`optparse` code to :" -"mod:`!argparse`, see :ref:`Upgrading Optparse Code `." msgstr "" @@ -420,11 +420,11 @@ msgstr "parents" msgid "" "Sometimes, several parsers share a common set of arguments. Rather than " "repeating the definitions of these arguments, a single parser with all the " -"shared arguments and passed to ``parents=`` argument to :class:" -"`ArgumentParser` can be used. The ``parents=`` argument takes a list of :" -"class:`ArgumentParser` objects, collects all the positional and optional " -"actions from them, and adds these actions to the :class:`ArgumentParser` " -"object being constructed::" +"shared arguments and passed to ``parents=`` argument " +"to :class:`ArgumentParser` can be used. The ``parents=`` argument takes a " +"list of :class:`ArgumentParser` objects, collects all the positional and " +"optional actions from them, and adds these actions to " +"the :class:`ArgumentParser` object being constructed::" msgstr "" #: ../../library/argparse.rst:249 @@ -483,9 +483,9 @@ msgstr "" #: ../../library/argparse.rst:286 msgid "" ":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give " -"more control over how textual descriptions are displayed. By default, :class:" -"`ArgumentParser` objects line-wrap the description_ and epilog_ texts in " -"command-line help messages::" +"more control over how textual descriptions are displayed. By " +"default, :class:`ArgumentParser` objects line-wrap the description_ and " +"epilog_ texts in command-line help messages::" msgstr "" #: ../../library/argparse.rst:291 @@ -717,9 +717,9 @@ msgstr "" #: ../../library/argparse.rst:418 msgid "" -"Arguments read from a file must by default be one per line (but see also :" -"meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they " -"were in the same place as the original file referencing argument on the " +"Arguments read from a file must by default be one per line (but see " +"also :meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if " +"they were in the same place as the original file referencing argument on the " "command line. So in the example above, the expression ``['-f', 'foo', " "'@args.txt']`` is considered equivalent to the expression ``['-f', 'foo', '-" "f', 'bar']``." @@ -740,10 +740,10 @@ msgstr "" #: ../../library/argparse.rst:430 msgid "" ":class:`ArgumentParser` changed encoding and errors to read arguments files " -"from default (e.g. :func:`locale.getpreferredencoding(False) ` and ``\"strict\"``) to the :term:`filesystem encoding " -"and error handler`. Arguments file should be encoded in UTF-8 instead of " -"ANSI Codepage on Windows." +"from default (e.g. :func:`locale.getpreferredencoding(False) " +"` and ``\"strict\"``) to the :term:`filesystem " +"encoding and error handler`. Arguments file should be encoded in UTF-8 " +"instead of ANSI Codepage on Windows." msgstr "" #: ../../library/argparse.rst:438 @@ -752,14 +752,15 @@ msgstr "argument_default" #: ../../library/argparse.rst:440 msgid "" -"Generally, argument defaults are specified either by passing a default to :" -"meth:`~ArgumentParser.add_argument` or by calling the :meth:`~ArgumentParser." -"set_defaults` methods with a specific set of name-value pairs. Sometimes " -"however, it may be useful to specify a single parser-wide default for " -"arguments. This can be accomplished by passing the ``argument_default=`` " -"keyword argument to :class:`ArgumentParser`. For example, to globally " -"suppress attribute creation on :meth:`~ArgumentParser.parse_args` calls, we " -"supply ``argument_default=SUPPRESS``::" +"Generally, argument defaults are specified either by passing a default " +"to :meth:`~ArgumentParser.add_argument` or by calling " +"the :meth:`~ArgumentParser.set_defaults` methods with a specific set of name-" +"value pairs. Sometimes however, it may be useful to specify a single parser-" +"wide default for arguments. This can be accomplished by passing the " +"``argument_default=`` keyword argument to :class:`ArgumentParser`. For " +"example, to globally suppress attribute creation " +"on :meth:`~ArgumentParser.parse_args` calls, we supply " +"``argument_default=SUPPRESS``::" msgstr "" #: ../../library/argparse.rst:449 @@ -786,9 +787,9 @@ msgstr "allow_abbrev" #: ../../library/argparse.rst:462 msgid "" -"Normally, when you pass an argument list to the :meth:`~ArgumentParser." -"parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes " -"abbreviations ` of long options." +"Normally, when you pass an argument list to " +"the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, " +"it :ref:`recognizes abbreviations ` of long options." msgstr "" #: ../../library/argparse.rst:466 @@ -895,8 +896,8 @@ msgstr "" #: ../../library/argparse.rst:522 msgid "" "Occasionally, it may be useful to disable the addition of this help option. " -"This can be achieved by passing ``False`` as the ``add_help=`` argument to :" -"class:`ArgumentParser`::" +"This can be achieved by passing ``False`` as the ``add_help=`` argument " +"to :class:`ArgumentParser`::" msgstr "" #: ../../library/argparse.rst:526 @@ -947,9 +948,10 @@ msgstr "exit_on_error" #: ../../library/argparse.rst:551 msgid "" -"Normally, when you pass an invalid argument list to the :meth:" -"`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will " -"print a *message* to :data:`sys.stderr` and exit with a status code of 2." +"Normally, when you pass an invalid argument list to " +"the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, " +"it will print a *message* to :data:`sys.stderr` and exit with a status code " +"of 2." msgstr "" #: ../../library/argparse.rst:555 @@ -1046,8 +1048,8 @@ msgstr "" #: ../../library/argparse.rst:605 msgid "" -"dest_ - The name of the attribute to be added to the object returned by :" -"meth:`parse_args`." +"dest_ - The name of the attribute to be added to the object returned " +"by :meth:`parse_args`." msgstr "" #: ../../library/argparse.rst:608 @@ -1062,9 +1064,9 @@ msgstr "name or flags" msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " -"a list of filenames, is expected. The first arguments passed to :meth:" -"`~ArgumentParser.add_argument` must therefore be either a series of flags, " -"or a simple argument name." +"a list of filenames, is expected. The first arguments passed " +"to :meth:`~ArgumentParser.add_argument` must therefore be either a series of " +"flags, or a simple argument name." msgstr "" #: ../../library/argparse.rst:624 @@ -1279,9 +1281,9 @@ msgstr "" #: ../../library/argparse.rst:737 msgid "" -"``'version'`` - This expects a ``version=`` keyword argument in the :meth:" -"`~ArgumentParser.add_argument` call, and prints version information and " -"exits when invoked::" +"``'version'`` - This expects a ``version=`` keyword argument in " +"the :meth:`~ArgumentParser.add_argument` call, and prints version " +"information and exits when invoked::" msgstr "" #: ../../library/argparse.rst:741 @@ -1543,10 +1545,11 @@ msgstr "" msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='store_const'`` or ``action='append_const'``. These actions add " -"the ``const`` value to one of the attributes of the object returned by :meth:" -"`~ArgumentParser.parse_args`. See the action_ description for examples. If " -"``const`` is not provided to :meth:`~ArgumentParser.add_argument`, it will " -"receive a default value of ``None``." +"the ``const`` value to one of the attributes of the object returned " +"by :meth:`~ArgumentParser.parse_args`. See the action_ description for " +"examples. If ``const`` is not provided " +"to :meth:`~ArgumentParser.add_argument`, it will receive a default value of " +"``None``." msgstr "" #: ../../library/argparse.rst:901 @@ -1572,11 +1575,11 @@ msgstr "default" #: ../../library/argparse.rst:917 msgid "" "All optional arguments and some positional arguments may be omitted at the " -"command line. The ``default`` keyword argument of :meth:`~ArgumentParser." -"add_argument`, whose value defaults to ``None``, specifies what value should " -"be used if the command-line argument is not present. For optional arguments, " -"the ``default`` value is used when the option string was not present at the " -"command line::" +"command line. The ``default`` keyword argument " +"of :meth:`~ArgumentParser.add_argument`, whose value defaults to ``None``, " +"specifies what value should be used if the command-line argument is not " +"present. For optional arguments, the ``default`` value is used when the " +"option string was not present at the command line::" msgstr "" #: ../../library/argparse.rst:924 @@ -1617,8 +1620,9 @@ msgstr "" msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " -"conversion argument, if provided, before setting the attribute on the :class:" -"`Namespace` return value. Otherwise, the parser uses the value as is::" +"conversion argument, if provided, before setting the attribute on " +"the :class:`Namespace` return value. Otherwise, the parser uses the value " +"as is::" msgstr "" #: ../../library/argparse.rst:944 @@ -1709,9 +1713,9 @@ msgstr "" msgid "" "The argument to ``type`` can be a callable that accepts a single string or " "the name of a registered type (see :meth:`~ArgumentParser.register`) If the " -"function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" -"`ValueError`, the exception is caught and a nicely formatted error message " -"is displayed. Other exception types are not handled." +"function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, " +"or :exc:`ValueError`, the exception is caught and a nicely formatted error " +"message is displayed. Other exception types are not handled." msgstr "" #: ../../library/argparse.rst:995 @@ -1784,9 +1788,9 @@ msgstr "" #: ../../library/argparse.rst:1031 msgid "" "For example, JSON or YAML conversions have complex error cases that require " -"better reporting than can be given by the ``type`` keyword. A :exc:`~json." -"JSONDecodeError` would not be well formatted and a :exc:`FileNotFoundError` " -"exception would not be handled at all." +"better reporting than can be given by the ``type`` keyword. " +"A :exc:`~json.JSONDecodeError` would not be well formatted and " +"a :exc:`FileNotFoundError` exception would not be handled at all." msgstr "" #: ../../library/argparse.rst:1036 @@ -1897,9 +1901,9 @@ msgstr "" #: ../../library/argparse.rst:1101 msgid "" -"As the example shows, if an option is marked as ``required``, :meth:" -"`~ArgumentParser.parse_args` will report an error if that option is not " -"present at the command line." +"As the example shows, if an option is marked as " +"``required``, :meth:`~ArgumentParser.parse_args` will report an error if " +"that option is not present at the command line." msgstr "" #: ../../library/argparse.rst:1107 @@ -1925,8 +1929,8 @@ msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " "available specifiers include the program name, ``%(prog)s`` and most keyword " -"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, " -"``%(type)s``, etc.::" +"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, ``%" +"(type)s``, etc.::" msgstr "" #: ../../library/argparse.rst:1126 @@ -2115,10 +2119,10 @@ msgstr "dest" msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " -"attribute is determined by the ``dest`` keyword argument of :meth:" -"`~ArgumentParser.add_argument`. For positional argument actions, ``dest`` " -"is normally supplied as the first argument to :meth:`~ArgumentParser." -"add_argument`::" +"attribute is determined by the ``dest`` keyword argument " +"of :meth:`~ArgumentParser.add_argument`. For positional argument actions, " +"``dest`` is normally supplied as the first argument " +"to :meth:`~ArgumentParser.add_argument`::" msgstr "" #: ../../library/argparse.rst:1231 @@ -2201,7 +2205,7 @@ msgid "" ">>> parser.add_argument('--legs', default=0, type=int, deprecated=True)\n" ">>> parser.parse_args([])\n" "Namespace(legs=0)\n" -">>> parser.parse_args(['--legs', '4']) \n" +">>> parser.parse_args(['--legs', '4'])\n" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" msgstr "" @@ -2210,7 +2214,7 @@ msgstr "" ">>> parser.add_argument('--legs', default=0, type=int, deprecated=True)\n" ">>> parser.parse_args([])\n" "Namespace(legs=0)\n" -">>> parser.parse_args(['--legs', '4']) \n" +">>> parser.parse_args(['--legs', '4'])\n" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" @@ -2222,8 +2226,8 @@ msgstr "Action 類別" msgid "" ":class:`!Action` classes implement the Action API, a callable which returns " "a callable which processes arguments from the command-line. Any object which " -"follows this API may be passed as the ``action`` parameter to :meth:" -"`~ArgumentParser.add_argument`." +"follows this API may be passed as the ``action`` parameter " +"to :meth:`~ArgumentParser.add_argument`." msgstr "" #: ../../library/argparse.rst:1300 @@ -2231,8 +2235,8 @@ msgid "" ":class:`!Action` objects are used by an :class:`ArgumentParser` to represent " "the information needed to parse a single argument from one or more strings " "from the command line. The :class:`!Action` class must accept the two " -"positional arguments plus any keyword arguments passed to :meth:" -"`ArgumentParser.add_argument` except for the ``action`` itself." +"positional arguments plus any keyword arguments passed " +"to :meth:`ArgumentParser.add_argument` except for the ``action`` itself." msgstr "" #: ../../library/argparse.rst:1306 @@ -2257,16 +2261,16 @@ msgstr "" #: ../../library/argparse.rst:1319 msgid "" -"*namespace* - The :class:`Namespace` object that will be returned by :meth:" -"`~ArgumentParser.parse_args`. Most actions add an attribute to this object " -"using :func:`setattr`." +"*namespace* - The :class:`Namespace` object that will be returned " +"by :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to " +"this object using :func:`setattr`." msgstr "" #: ../../library/argparse.rst:1323 msgid "" "*values* - The associated command-line arguments, with any type conversions " -"applied. Type conversions are specified with the type_ keyword argument to :" -"meth:`~ArgumentParser.add_argument`." +"applied. Type conversions are specified with the type_ keyword argument " +"to :meth:`~ArgumentParser.add_argument`." msgstr "" #: ../../library/argparse.rst:1327 @@ -2310,14 +2314,14 @@ msgstr "" #: ../../library/argparse.rst:1353 msgid "" -"args_ - List of strings to parse. The default is taken from :data:`sys." -"argv`." +"args_ - List of strings to parse. The default is taken " +"from :data:`sys.argv`." msgstr "" #: ../../library/argparse.rst:1356 msgid "" -"namespace_ - An object to take the attributes. The default is a new empty :" -"class:`Namespace` object." +"namespace_ - An object to take the attributes. The default is a new " +"empty :class:`Namespace` object." msgstr "" #: ../../library/argparse.rst:1361 @@ -2676,13 +2680,14 @@ msgid "" "example, the ``svn`` program can invoke subcommands like ``svn checkout``, " "``svn update``, and ``svn commit``. Splitting up functionality this way can " "be a particularly good idea when a program performs several different " -"functions which require different kinds of command-line arguments. :class:" -"`ArgumentParser` supports the creation of such subcommands with the :meth:`!" -"add_subparsers` method. The :meth:`!add_subparsers` method is normally " -"called with no arguments and returns a special action object. This object " -"has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a " -"command name and any :class:`!ArgumentParser` constructor arguments, and " -"returns an :class:`!ArgumentParser` object that can be modified as usual." +"functions which require different kinds of command-line " +"arguments. :class:`ArgumentParser` supports the creation of such subcommands " +"with the :meth:`!add_subparsers` method. The :meth:`!add_subparsers` method " +"is normally called with no arguments and returns a special action object. " +"This object has a single method, :meth:`~_SubParsersAction.add_parser`, " +"which takes a command name and any :class:`!ArgumentParser` constructor " +"arguments, and returns an :class:`!ArgumentParser` object that can be " +"modified as usual." msgstr "" #: ../../library/argparse.rst:1582 @@ -3004,10 +3009,10 @@ msgstr "FileType 物件" #: ../../library/argparse.rst:1785 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " -"argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" -"`FileType` objects as their type will open command-line arguments as files " -"with the requested modes, buffer sizes, encodings and error handling (see " -"the :func:`open` function for more details)::" +"argument of :meth:`ArgumentParser.add_argument`. Arguments that " +"have :class:`FileType` objects as their type will open command-line " +"arguments as files with the requested modes, buffer sizes, encodings and " +"error handling (see the :func:`open` function for more details)::" msgstr "" #: ../../library/argparse.rst:1791 @@ -3091,12 +3096,12 @@ msgstr "" #: ../../library/argparse.rst:1833 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " -"has an :meth:`~ArgumentParser.add_argument` method just like a regular :" -"class:`ArgumentParser`. When an argument is added to the group, the parser " -"treats it just like a normal argument, but displays the argument in a " -"separate group for help messages. The :meth:`!add_argument_group` method " -"accepts *title* and *description* arguments which can be used to customize " -"this display::" +"has an :meth:`~ArgumentParser.add_argument` method just like a " +"regular :class:`ArgumentParser`. When an argument is added to the group, " +"the parser treats it just like a normal argument, but displays the argument " +"in a separate group for help messages. The :meth:`!add_argument_group` " +"method accepts *title* and *description* arguments which can be used to " +"customize this display::" msgstr "" #: ../../library/argparse.rst:1841 @@ -3141,9 +3146,9 @@ msgstr "" msgid "" "The optional, keyword-only parameters argument_default_ and " "conflict_handler_ allow for finer-grained control of the behavior of the " -"argument group. These parameters have the same meaning as in the :class:" -"`ArgumentParser` constructor, but apply specifically to the argument group " -"rather than the entire parser." +"argument group. These parameters have the same meaning as in " +"the :class:`ArgumentParser` constructor, but apply specifically to the " +"argument group rather than the entire parser." msgstr "" #: ../../library/argparse.rst:1864 @@ -3225,9 +3230,10 @@ msgstr "" #: ../../library/argparse.rst:1907 msgid "" "Note that currently mutually exclusive argument groups do not support the " -"*title* and *description* arguments of :meth:`~ArgumentParser." -"add_argument_group`. However, a mutually exclusive group can be added to an " -"argument group that has a title and description. For example::" +"*title* and *description* arguments " +"of :meth:`~ArgumentParser.add_argument_group`. However, a mutually exclusive " +"group can be added to an argument group that has a title and description. " +"For example::" msgstr "" #: ../../library/argparse.rst:1913 @@ -3280,9 +3286,9 @@ msgstr "" #: ../../library/argparse.rst:1942 msgid "" -"Most of the time, the attributes of the object returned by :meth:" -"`parse_args` will be fully determined by inspecting the command-line " -"arguments and the argument actions. :meth:`set_defaults` allows some " +"Most of the time, the attributes of the object returned " +"by :meth:`parse_args` will be fully determined by inspecting the command-" +"line arguments and the argument actions. :meth:`set_defaults` allows some " "additional attributes that are determined without any inspection of the " "command line to be added::" msgstr "" @@ -3329,8 +3335,9 @@ msgstr "" #: ../../library/argparse.rst:1968 msgid "" -"Get the default value for a namespace attribute, as set by either :meth:" -"`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" +"Get the default value for a namespace attribute, as set by " +"either :meth:`~ArgumentParser.add_argument` or " +"by :meth:`~ArgumentParser.set_defaults`::" msgstr "" #: ../../library/argparse.rst:1972 @@ -3378,8 +3385,8 @@ msgstr "" #: ../../library/argparse.rst:2002 msgid "" -"Return a string containing a brief description of how the :class:" -"`ArgumentParser` should be invoked on the command line." +"Return a string containing a brief description of how " +"the :class:`ArgumentParser` should be invoked on the command line." msgstr "" #: ../../library/argparse.rst:2007 @@ -3419,10 +3426,10 @@ msgstr "" #: ../../library/argparse.rst:2032 msgid "" -":ref:`Prefix matching ` rules apply to :meth:" -"`~ArgumentParser.parse_known_args`. The parser may consume an option even if " -"it's just a prefix of one of its known options, instead of leaving it in the " -"remaining arguments list." +":ref:`Prefix matching ` rules apply " +"to :meth:`~ArgumentParser.parse_known_args`. The parser may consume an " +"option even if it's just a prefix of one of its known options, instead of " +"leaving it in the remaining arguments list." msgstr "" #: ../../library/argparse.rst:2039 @@ -3487,8 +3494,8 @@ msgstr "" #: ../../library/argparse.rst:2077 msgid "" -"This method prints a usage message, including the *message*, to :data:`sys." -"stderr` and terminates the program with a status code of 2." +"This method prints a usage message, including the *message*, " +"to :data:`sys.stderr` and terminates the program with a status code of 2." msgstr "" #: ../../library/argparse.rst:2082 @@ -3513,10 +3520,11 @@ msgstr "" #: ../../library/argparse.rst:2097 msgid "" -"The following example shows the difference between :meth:`~ArgumentParser." -"parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " -"former returns ``['2', '3']`` as unparsed arguments, while the latter " -"collects all the positionals into ``rest``. ::" +"The following example shows the difference " +"between :meth:`~ArgumentParser.parse_known_args` " +"and :meth:`~ArgumentParser.parse_intermixed_args`: the former returns " +"``['2', '3']`` as unparsed arguments, while the latter collects all the " +"positionals into ``rest``. ::" msgstr "" #: ../../library/argparse.rst:2103 diff --git a/library/ast.po b/library/ast.po index a117a57e5a..3309468e82 100644 --- a/library/ast.po +++ b/library/ast.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-15 17:05+0000\n" +"POT-Creation-Date: 2025-04-17 00:15+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-" @@ -2117,8 +2117,9 @@ msgid "" msgstr "一個 ``while`` 迴圈。``test`` 保存條件,例如 :class:`Compare` 節點。" #: ../../library/ast.rst:1186 +#, fuzzy msgid "" -">> print(ast.dump(ast.parse(\"\"\"\n" +">>> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" "... ...\n" "... else:\n" diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index 5008415a77..ab8402a43f 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-10 00:14+0000\n" +"POT-Creation-Date: 2025-04-15 00:15+0000\n" "PO-Revision-Date: 2022-02-20 12:36+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -94,8 +94,8 @@ msgid "" "If there is no running event loop set, the function will return the result " "of the ``get_event_loop_policy().get_event_loop()`` call." msgstr "" -"如果沒有設定正在運行的事件迴圈,該函式將回傳 " -"``get_event_loop_policy().get_event_loop()`` 呼叫的結果。" +"如果沒有設定正在運行的事件迴圈,該函式將回傳 ``get_event_loop_policy()." +"get_event_loop()`` 呼叫的結果。" #: ../../library/asyncio-eventloop.rst:53 msgid "" @@ -104,8 +104,8 @@ msgid "" "is preferred to :func:`get_event_loop` in coroutines and callbacks." msgstr "" "由於此函式具有相當複雜的行為(尤其是在使用自訂事件迴圈策略時),在協程和回呼" -"函式中,建議使用 :func:`get_running_loop` 函式,而不" -"是 :func:`get_event_loop`。" +"函式中,建議使用 :func:`get_running_loop` 函式,而不是 :func:" +"`get_event_loop`。" #: ../../library/asyncio-eventloop.rst:58 msgid "" @@ -138,9 +138,9 @@ msgid "" "and :func:`new_event_loop` functions can be altered by :ref:`setting a " "custom event loop policy `." msgstr "" -"請注意 :func:`get_event_loop`、:func:`set_event_loop` " -"和 :func:`new_event_loop` 函式的行為可以透過\\ :ref:`設定自訂事件迴圈策略 " -"`\\ 進行調整。" +"請注意 :func:`get_event_loop`、:func:`set_event_loop` 和 :func:" +"`new_event_loop` 函式的行為可以透過\\ :ref:`設定自訂事件迴圈策略 `\\ 進行調整。" #: ../../library/asyncio-eventloop.rst:80 msgid "Contents" @@ -159,29 +159,29 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:86 msgid "" -"The `Callback Handles`_ section documents the :class:`Handle` " -"and :class:`TimerHandle` instances which are returned from scheduling " -"methods such as :meth:`loop.call_soon` and :meth:`loop.call_later`;" +"The `Callback Handles`_ section documents the :class:`Handle` and :class:" +"`TimerHandle` instances which are returned from scheduling methods such as :" +"meth:`loop.call_soon` and :meth:`loop.call_later`;" msgstr "" -"`回呼處理 `_\\ 章節記錄了從排程方法" -"(如 :meth:`loop.call_soon` 和 :meth:`loop.call_later`)回傳" -"的 :class:`Handle` 和 :class:`TimerHandle` 實例;" +"`回呼處理 `_\\ 章節記錄了從排程方法(如 :meth:`loop." +"call_soon` 和 :meth:`loop.call_later`)回傳的 :class:`Handle` 和 :class:" +"`TimerHandle` 實例;" #: ../../library/asyncio-eventloop.rst:90 msgid "" "The `Server Objects`_ section documents types returned from event loop " "methods like :meth:`loop.create_server`;" msgstr "" -"`Server 物件 `_\\ 章節記錄了從事件迴圈方法" -"(如 :meth:`loop.create_server`)回傳的資料型別;" +"`Server 物件 `_\\ 章節記錄了從事件迴圈方法(如 :meth:`loop." +"create_server`)回傳的資料型別;" #: ../../library/asyncio-eventloop.rst:93 msgid "" -"The `Event Loop Implementations`_ section documents " -"the :class:`SelectorEventLoop` and :class:`ProactorEventLoop` classes;" +"The `Event Loop Implementations`_ section documents the :class:" +"`SelectorEventLoop` and :class:`ProactorEventLoop` classes;" msgstr "" -"`事件迴圈實作 `_\\ 章節記錄" -"了 :class:`SelectorEventLoop` 和 :class:`ProactorEventLoop` 類別;" +"`事件迴圈實作 `_\\ 章節記錄了 :class:" +"`SelectorEventLoop` 和 :class:`ProactorEventLoop` 類別;" #: ../../library/asyncio-eventloop.rst:96 msgid "" @@ -209,8 +209,8 @@ msgid "" "If the argument is a :ref:`coroutine object ` it is implicitly " "scheduled to run as a :class:`asyncio.Task`." msgstr "" -"如果引數是\\ :ref:`協程物件 `,則它將被隱式排程" -"為 :class:`asyncio.Task` 運行。" +"如果引數是\\ :ref:`協程物件 `,則它將被隱式排程為 :class:`asyncio." +"Task` 運行。" #: ../../library/asyncio-eventloop.rst:123 msgid "Return the Future's result or raise its exception." @@ -277,7 +277,7 @@ msgid "" "called after the event loop is closed." msgstr "此方法是冪等且不可逆的。在事件迴圈關閉後不應呼叫其他方法。" -#: ../../library/asyncio-eventloop.rst:167 +#: ../../library/asyncio-eventloop.rst:168 msgid "" "Schedule all currently open :term:`asynchronous generator` objects to close " "with an :meth:`~agen.aclose` call. After calling this method, the event " @@ -288,19 +288,19 @@ msgstr "" "用 :meth:`~agen.aclose` 呼叫來關閉。呼叫此方法後,如果疊代新的非同步產生器," "事件迴圈將發出警告。應該使用此方法可靠地完成所有已排程的非同步產生器。" -#: ../../library/asyncio-eventloop.rst:173 +#: ../../library/asyncio-eventloop.rst:174 msgid "" "Note that there is no need to call this function when :func:`asyncio.run` is " "used." msgstr "請注意,使用 :func:`asyncio.run` 時不需要呼叫此函式。" -#: ../../library/asyncio-eventloop.rst:176 -#: ../../library/asyncio-eventloop.rst:1278 -#: ../../library/asyncio-eventloop.rst:1721 +#: ../../library/asyncio-eventloop.rst:177 +#: ../../library/asyncio-eventloop.rst:1301 +#: ../../library/asyncio-eventloop.rst:1750 msgid "Example::" msgstr "範例: ::" -#: ../../library/asyncio-eventloop.rst:178 +#: ../../library/asyncio-eventloop.rst:179 msgid "" "try:\n" " loop.run_forever()\n" @@ -314,19 +314,18 @@ msgstr "" " loop.run_until_complete(loop.shutdown_asyncgens())\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:188 +#: ../../library/asyncio-eventloop.rst:190 msgid "" "Schedule the closure of the default executor and wait for it to join all of " "the threads in the :class:`~concurrent.futures.ThreadPoolExecutor`. Once " -"this method has been called, using the default executor " -"with :meth:`loop.run_in_executor` will raise a :exc:`RuntimeError`." +"this method has been called, using the default executor with :meth:`loop." +"run_in_executor` will raise a :exc:`RuntimeError`." msgstr "" -"排程預設執行器的關閉,並等待它加" -"入 :class:`~concurrent.futures.ThreadPoolExecutor` 中的所有執行緒。一旦呼叫了" -"此方法,使用預設執行器與 :meth:`loop.run_in_executor` 將引" -"發 :exc:`RuntimeError`。" +"排程預設執行器的關閉,並等待它加入 :class:`~concurrent.futures." +"ThreadPoolExecutor` 中的所有執行緒。一旦呼叫了此方法,使用預設執行器與 :meth:" +"`loop.run_in_executor` 將引發 :exc:`RuntimeError`。" -#: ../../library/asyncio-eventloop.rst:194 +#: ../../library/asyncio-eventloop.rst:196 msgid "" "The *timeout* parameter specifies the amount of time (in :class:`float` " "seconds) the executor will be given to finish joining. With the default, " @@ -335,7 +334,7 @@ msgstr "" "*timeout* 參數指定執行器完成加入所需的時間(以 :class:`float` 秒為單位)。預" "設情況下為 ``None``,不會限制執行器所花費的時間。" -#: ../../library/asyncio-eventloop.rst:199 +#: ../../library/asyncio-eventloop.rst:201 msgid "" "If the *timeout* is reached, a :exc:`RuntimeWarning` is emitted and the " "default executor is terminated without waiting for its threads to finish " @@ -344,7 +343,7 @@ msgstr "" "如果達到 *timeout*,將發出 :exc:`RuntimeWarning` 警告,預設執行器將立即終止," "不等待其執行緒完成加入。" -#: ../../library/asyncio-eventloop.rst:205 +#: ../../library/asyncio-eventloop.rst:207 msgid "" "Do not call this method when using :func:`asyncio.run`, as the latter " "handles default executor shutdown automatically." @@ -352,48 +351,47 @@ msgstr "" "使用 :func:`asyncio.run` 時請勿呼叫此方法,因為後者會自動處理預設執行器的關" "閉。" -#: ../../library/asyncio-eventloop.rst:210 +#: ../../library/asyncio-eventloop.rst:212 msgid "Added the *timeout* parameter." msgstr "加入 *timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:214 +#: ../../library/asyncio-eventloop.rst:216 msgid "Scheduling callbacks" msgstr "排程回呼函式" -#: ../../library/asyncio-eventloop.rst:218 +#: ../../library/asyncio-eventloop.rst:220 msgid "" "Schedule the *callback* :term:`callback` to be called with *args* arguments " "at the next iteration of the event loop." msgstr "" "在事件迴圈的下一次疊代中排程以 *args* 引數呼叫 *callback* :term:`callback`。" -#: ../../library/asyncio-eventloop.rst:221 +#: ../../library/asyncio-eventloop.rst:223 msgid "" "Return an instance of :class:`asyncio.Handle`, which can be used later to " "cancel the callback." msgstr "回傳 :class:`asyncio.Handle` 的實例,稍後可以用於取消回呼函式。" -#: ../../library/asyncio-eventloop.rst:224 +#: ../../library/asyncio-eventloop.rst:226 msgid "" "Callbacks are called in the order in which they are registered. Each " "callback will be called exactly once." msgstr "回呼函式按照其註冊的順序呼叫。每個回呼函式將被呼叫恰好一次。" -#: ../../library/asyncio-eventloop.rst:227 +#: ../../library/asyncio-eventloop.rst:229 msgid "" -"The optional keyword-only *context* argument specifies a " -"custom :class:`contextvars.Context` for the *callback* to run in. Callbacks " -"use the current context when no *context* is provided." +"The optional keyword-only *context* argument specifies a custom :class:" +"`contextvars.Context` for the *callback* to run in. Callbacks use the " +"current context when no *context* is provided." msgstr "" -"選用的僅限關鍵字引數 *context* 指定了要給 *callback* 執行的自定" -"義 :class:`contextvars.Context`。當未提供 *context* 時,回呼函式使用當前情" -"境。" +"選用的僅限關鍵字引數 *context* 指定了要給 *callback* 執行的自定義 :class:" +"`contextvars.Context`。當未提供 *context* 時,回呼函式使用當前情境。" -#: ../../library/asyncio-eventloop.rst:231 +#: ../../library/asyncio-eventloop.rst:233 msgid "Unlike :meth:`call_soon_threadsafe`, this method is not thread-safe." msgstr "與 :meth:`call_soon_threadsafe` 不同,此方法不是執行緒安全的。" -#: ../../library/asyncio-eventloop.rst:235 +#: ../../library/asyncio-eventloop.rst:237 msgid "" "A thread-safe variant of :meth:`call_soon`. When scheduling callbacks from " "another thread, this function *must* be used, since :meth:`call_soon` is not " @@ -402,14 +400,14 @@ msgstr "" "這是 :meth:`call_soon` 的執行緒安全變體。當從另一個執行緒排程回呼函式時,*必" "須*\\ 使用此函式,因為 :meth:`call_soon` 不是執行緒安全的。" -#: ../../library/asyncio-eventloop.rst:239 +#: ../../library/asyncio-eventloop.rst:241 msgid "" "This function is safe to be called from a reentrant context or signal " "handler, however, it is not safe or fruitful to use the returned handle in " "such contexts." msgstr "" -#: ../../library/asyncio-eventloop.rst:242 +#: ../../library/asyncio-eventloop.rst:244 msgid "" "Raises :exc:`RuntimeError` if called on a loop that's been closed. This can " "happen on a secondary thread when the main application is shutting down." @@ -417,21 +415,21 @@ msgstr "" "如果在已關閉的迴圈上呼叫,則引發 :exc:`RuntimeError`。在主應用程式關閉時,這" "可能發生在次要執行緒上。" -#: ../../library/asyncio-eventloop.rst:246 +#: ../../library/asyncio-eventloop.rst:248 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "請參閱文件的\\ :ref:`並行和多執行緒 `\\ 部分。" -#: ../../library/asyncio-eventloop.rst:249 -#: ../../library/asyncio-eventloop.rst:299 -#: ../../library/asyncio-eventloop.rst:319 +#: ../../library/asyncio-eventloop.rst:251 +#: ../../library/asyncio-eventloop.rst:301 +#: ../../library/asyncio-eventloop.rst:321 msgid "" "The *context* keyword-only parameter was added. See :pep:`567` for more " "details." msgstr "新增了 *context* 僅限關鍵字參數。詳細資訊請參閱 :pep:`567`。" -#: ../../library/asyncio-eventloop.rst:257 +#: ../../library/asyncio-eventloop.rst:259 msgid "" "Most :mod:`asyncio` scheduling functions don't allow passing keyword " "arguments. To do that, use :func:`functools.partial`::" @@ -439,7 +437,7 @@ msgstr "" "大多數 :mod:`asyncio` 排程函式不允許傳遞關鍵字引數。要傳遞關鍵字引數,請使" "用 :func:`functools.partial`: ::" -#: ../../library/asyncio-eventloop.rst:260 +#: ../../library/asyncio-eventloop.rst:262 msgid "" "# will schedule \"print(\"Hello\", flush=True)\"\n" "loop.call_soon(\n" @@ -449,7 +447,7 @@ msgstr "" "loop.call_soon(\n" " functools.partial(print, \"Hello\", flush=True))" -#: ../../library/asyncio-eventloop.rst:264 +#: ../../library/asyncio-eventloop.rst:266 msgid "" "Using partial objects is usually more convenient than using lambdas, as " "asyncio can render partial objects better in debug and error messages." @@ -457,11 +455,11 @@ msgstr "" "通常使用 partial 物件比使用 lambda 更方便,因為 asyncio 可以在除錯和錯誤訊息" "中更好地呈現 partial 物件。" -#: ../../library/asyncio-eventloop.rst:272 +#: ../../library/asyncio-eventloop.rst:274 msgid "Scheduling delayed callbacks" msgstr "排程延遲的回呼函式" -#: ../../library/asyncio-eventloop.rst:274 +#: ../../library/asyncio-eventloop.rst:276 msgid "" "Event loop provides mechanisms to schedule callback functions to be called " "at some point in the future. Event loop uses monotonic clocks to track time." @@ -469,20 +467,20 @@ msgstr "" "事件迴圈提供為回呼函式排程在將來某個時間點才呼叫的機制。事件迴圈使用了單調時" "鐘來追蹤時間。" -#: ../../library/asyncio-eventloop.rst:281 +#: ../../library/asyncio-eventloop.rst:283 msgid "" "Schedule *callback* to be called after the given *delay* number of seconds " "(can be either an int or a float)." msgstr "排程 *callback* 在給定的 *delay* 秒數後呼叫(可以是整數或浮點數)。" -#: ../../library/asyncio-eventloop.rst:284 -#: ../../library/asyncio-eventloop.rst:316 +#: ../../library/asyncio-eventloop.rst:286 +#: ../../library/asyncio-eventloop.rst:318 msgid "" "An instance of :class:`asyncio.TimerHandle` is returned which can be used to " "cancel the callback." msgstr "回傳 :class:`asyncio.TimerHandle` 的實例,可用於取消回呼函式。" -#: ../../library/asyncio-eventloop.rst:287 +#: ../../library/asyncio-eventloop.rst:289 msgid "" "*callback* will be called exactly once. If two callbacks are scheduled for " "exactly the same time, the order in which they are called is undefined." @@ -490,26 +488,25 @@ msgstr "" "*callback* 將只被呼叫恰好一次。如果有兩個回呼函式被排程在完全相同的時間,則其" "呼叫順序是不定的。" -#: ../../library/asyncio-eventloop.rst:291 +#: ../../library/asyncio-eventloop.rst:293 msgid "" "The optional positional *args* will be passed to the callback when it is " -"called. If you want the callback to be called with keyword arguments " -"use :func:`functools.partial`." +"called. If you want the callback to be called with keyword arguments use :" +"func:`functools.partial`." msgstr "" "可選的位置引數 *args* 將在呼叫回呼函式時傳遞。如果要使用關鍵字引數呼叫回呼函" "數,請使用 :func:`functools.partial`。" -#: ../../library/asyncio-eventloop.rst:295 +#: ../../library/asyncio-eventloop.rst:297 msgid "" -"An optional keyword-only *context* argument allows specifying a " -"custom :class:`contextvars.Context` for the *callback* to run in. The " -"current context is used when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a custom :" +"class:`contextvars.Context` for the *callback* to run in. The current " +"context is used when no *context* is provided." msgstr "" -"可選的僅限關鍵字 *context* 引數允許為 *callback* 指定自定義" -"的 :class:`contextvars.Context` 以提供運行。當未提供 *context* 時,將使用當前" -"情境。" +"可選的僅限關鍵字 *context* 引數允許為 *callback* 指定自定義的 :class:" +"`contextvars.Context` 以提供運行。當未提供 *context* 時,將使用當前情境。" -#: ../../library/asyncio-eventloop.rst:303 +#: ../../library/asyncio-eventloop.rst:305 msgid "" "In Python 3.7 and earlier with the default event loop implementation, the " "*delay* could not exceed one day. This has been fixed in Python 3.8." @@ -517,19 +514,19 @@ msgstr "" "在 Python 3.7 及更早版本中,使用預設事件迴圈實作時,*delay* 不能超過一天。這" "在 Python 3.8 中已經修復。" -#: ../../library/asyncio-eventloop.rst:310 +#: ../../library/asyncio-eventloop.rst:312 msgid "" "Schedule *callback* to be called at the given absolute timestamp *when* (an " "int or a float), using the same time reference as :meth:`loop.time`." msgstr "" -"排程 *callback* 在給定的絕對時間戳 *when* (整數或浮點數)處呼叫,使用" -"與 :meth:`loop.time` 相同的時間參照。" +"排程 *callback* 在給定的絕對時間戳 *when* (整數或浮點數)處呼叫,使用與 :" +"meth:`loop.time` 相同的時間參照。" -#: ../../library/asyncio-eventloop.rst:314 +#: ../../library/asyncio-eventloop.rst:316 msgid "This method's behavior is the same as :meth:`call_later`." msgstr "此方法的行為與 :meth:`call_later` 相同。" -#: ../../library/asyncio-eventloop.rst:323 +#: ../../library/asyncio-eventloop.rst:325 msgid "" "In Python 3.7 and earlier with the default event loop implementation, the " "difference between *when* and the current time could not exceed one day. " @@ -538,13 +535,13 @@ msgstr "" "在 Python 3.7 及更早版本中,使用預設事件迴圈實作時,*when* 和當前時間之間的差" "值不能超過一天。這在 Python 3.8 中已經修復。" -#: ../../library/asyncio-eventloop.rst:330 +#: ../../library/asyncio-eventloop.rst:332 msgid "" "Return the current time, as a :class:`float` value, according to the event " "loop's internal monotonic clock." msgstr "根據事件迴圈的內部單調時鐘,回傳當前時間,以 :class:`float` 值表示。" -#: ../../library/asyncio-eventloop.rst:334 +#: ../../library/asyncio-eventloop.rst:336 msgid "" "In Python 3.7 and earlier timeouts (relative *delay* or absolute *when*) " "should not exceed one day. This has been fixed in Python 3.8." @@ -552,19 +549,19 @@ msgstr "" "在 Python 3.7 及更早版本中,超時(相對 *delay* 或絕對 *when*)不應超過一天。" "這在 Python 3.8 中已經修復。" -#: ../../library/asyncio-eventloop.rst:340 +#: ../../library/asyncio-eventloop.rst:342 msgid "The :func:`asyncio.sleep` function." msgstr "函式 :func:`asyncio.sleep`。" -#: ../../library/asyncio-eventloop.rst:344 +#: ../../library/asyncio-eventloop.rst:346 msgid "Creating Futures and Tasks" msgstr "建立 Futures 和 Tasks" -#: ../../library/asyncio-eventloop.rst:348 +#: ../../library/asyncio-eventloop.rst:350 msgid "Create an :class:`asyncio.Future` object attached to the event loop." msgstr "建立附加到事件迴圈的 :class:`asyncio.Future` 物件。" -#: ../../library/asyncio-eventloop.rst:350 +#: ../../library/asyncio-eventloop.rst:352 msgid "" "This is the preferred way to create Futures in asyncio. This lets third-" "party event loops provide alternative implementations of the Future object " @@ -573,94 +570,94 @@ msgstr "" "這是在 asyncio 中建立 Futures 的首選方式。這允許第三方事件迴圈提供 Future 物" "件的替代實作(具有更好的性能或儀器計測表現)。" -#: ../../library/asyncio-eventloop.rst:358 +#: ../../library/asyncio-eventloop.rst:360 msgid "" -"Schedule the execution of :ref:`coroutine ` *coro*. Return " -"a :class:`Task` object." +"Schedule the execution of :ref:`coroutine ` *coro*. Return a :" +"class:`Task` object." msgstr "排程執行\\ :ref:`協程 ` *coro*。回傳 :class:`Task` 物件。" -#: ../../library/asyncio-eventloop.rst:361 +#: ../../library/asyncio-eventloop.rst:363 msgid "" "Third-party event loops can use their own subclass of :class:`Task` for " -"interoperability. In this case, the result type is a subclass " -"of :class:`Task`." +"interoperability. In this case, the result type is a subclass of :class:" +"`Task`." msgstr "" "第三方事件迴圈可以使用其自己的 :class:`Task` 子類別以實現互操作性" "(interoperability)。在這種情況下,結果類型是 :class:`Task` 的子類別。" -#: ../../library/asyncio-eventloop.rst:365 +#: ../../library/asyncio-eventloop.rst:367 msgid "" "If the *name* argument is provided and not ``None``, it is set as the name " "of the task using :meth:`Task.set_name`." msgstr "" -"如果提供了 *name* 引數且不為 ``None``,則將其設置為任務的名稱,使" -"用 :meth:`Task.set_name`。" +"如果提供了 *name* 引數且不為 ``None``,則將其設置為任務的名稱,使用 :meth:" +"`Task.set_name`。" -#: ../../library/asyncio-eventloop.rst:368 +#: ../../library/asyncio-eventloop.rst:370 msgid "" -"An optional keyword-only *context* argument allows specifying a " -"custom :class:`contextvars.Context` for the *coro* to run in. The current " -"context copy is created when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a custom :" +"class:`contextvars.Context` for the *coro* to run in. The current context " +"copy is created when no *context* is provided." msgstr "" -"可選的僅限關鍵字 *context* 引數允許為 *coro* 指定自定義" -"的 :class:`contextvars.Context` 以提供運行。當未提供 *context* 時,將建立當前" -"情境的副本。" +"可選的僅限關鍵字 *context* 引數允許為 *coro* 指定自定義的 :class:" +"`contextvars.Context` 以提供運行。當未提供 *context* 時,將建立當前情境的副" +"本。" -#: ../../library/asyncio-eventloop.rst:372 +#: ../../library/asyncio-eventloop.rst:374 msgid "Added the *name* parameter." msgstr "加入 *name* 參數。" -#: ../../library/asyncio-eventloop.rst:375 +#: ../../library/asyncio-eventloop.rst:377 msgid "Added the *context* parameter." msgstr "加入 *context* 參數。" -#: ../../library/asyncio-eventloop.rst:380 +#: ../../library/asyncio-eventloop.rst:382 msgid "Set a task factory that will be used by :meth:`loop.create_task`." msgstr "設置將由 :meth:`loop.create_task` 使用的任務工廠。" -#: ../../library/asyncio-eventloop.rst:383 +#: ../../library/asyncio-eventloop.rst:385 msgid "" "If *factory* is ``None`` the default task factory will be set. Otherwise, " "*factory* must be a *callable* with the signature matching ``(loop, coro, " -"context=None)``, where *loop* is a reference to the active event loop, and " -"*coro* is a coroutine object. The callable must return " -"a :class:`asyncio.Future`-compatible object." +"**kwargs)``, where *loop* is a reference to the active event loop, and " +"*coro* is a coroutine object. The callable must pass on all *kwargs*, and " +"return a :class:`asyncio.Task`-compatible object." msgstr "" "如果 *factory* 為 ``None``,將設置預設的任務工廠。否則,*factory* 必須是一個" -"具有匹配簽名 ``(loop, coro, context=None)`` 的 *callable*,其中 *loop* 是有效" -"事件迴圈的參照,*coro* 是一個協程物件。該可呼叫物件必須回傳一個" -"與 :class:`asyncio.Future` 相容的物件。" +"具有匹配簽名 ``(loop, coro, **kwargs)`` 的 *callable*,其中 *loop* 是有效事件" +"迴圈的參照、*coro* 是一個協程物件。該可呼叫物件必須傳遞所有 *kwargs* 並回傳一" +"個與 :class:`asyncio.Task` 相容的物件。" -#: ../../library/asyncio-eventloop.rst:391 +#: ../../library/asyncio-eventloop.rst:393 msgid "Return a task factory or ``None`` if the default one is in use." msgstr "回傳任務工廠,如果使用預設任務工廠則回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:395 +#: ../../library/asyncio-eventloop.rst:397 msgid "Opening network connections" msgstr "打開網路連線" -#: ../../library/asyncio-eventloop.rst:406 +#: ../../library/asyncio-eventloop.rst:409 msgid "" "Open a streaming transport connection to a given address specified by *host* " "and *port*." msgstr "打開以 *host* 和 *port* 指定之給定地址的串流傳輸連線。" -#: ../../library/asyncio-eventloop.rst:409 +#: ../../library/asyncio-eventloop.rst:412 msgid "" -"The socket family can be either :py:const:`~socket.AF_INET` " -"or :py:const:`~socket.AF_INET6` depending on *host* (or the *family* " -"argument, if provided)." +"The socket family can be either :py:const:`~socket.AF_INET` or :py:const:" +"`~socket.AF_INET6` depending on *host* (or the *family* argument, if " +"provided)." msgstr "" -"根據 *host*(或提供的 *family* 引數)的情況,socket 家族可以" -"是 :py:const:`~socket.AF_INET` 或 :py:const:`~socket.AF_INET6`。" +"根據 *host*(或提供的 *family* 引數)的情況,socket 家族可以是 :py:const:" +"`~socket.AF_INET` 或 :py:const:`~socket.AF_INET6`。" -#: ../../library/asyncio-eventloop.rst:413 +#: ../../library/asyncio-eventloop.rst:416 msgid "The socket type will be :py:const:`~socket.SOCK_STREAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_STREAM`。" -#: ../../library/asyncio-eventloop.rst:415 -#: ../../library/asyncio-eventloop.rst:1189 -#: ../../library/asyncio-eventloop.rst:1205 +#: ../../library/asyncio-eventloop.rst:418 +#: ../../library/asyncio-eventloop.rst:1211 +#: ../../library/asyncio-eventloop.rst:1228 msgid "" "*protocol_factory* must be a callable returning an :ref:`asyncio protocol " "` implementation." @@ -668,70 +665,70 @@ msgstr "" "*protocol_factory* 必須是一個回傳 :ref:`asyncio protocol ` " "實作的可呼叫函式。" -#: ../../library/asyncio-eventloop.rst:418 +#: ../../library/asyncio-eventloop.rst:421 msgid "" "This method will try to establish the connection in the background. When " "successful, it returns a ``(transport, protocol)`` pair." msgstr "" "此方法將嘗試在背景建立連線。成功時,它將回傳一對 ``(transport, protocol)``。" -#: ../../library/asyncio-eventloop.rst:421 +#: ../../library/asyncio-eventloop.rst:424 msgid "The chronological synopsis of the underlying operation is as follows:" msgstr "底層操作的時間軸簡介如下:" -#: ../../library/asyncio-eventloop.rst:423 +#: ../../library/asyncio-eventloop.rst:426 msgid "" "The connection is established and a :ref:`transport ` is " "created for it." msgstr "建立連線並為其建立\\ :ref:`傳輸 `。" -#: ../../library/asyncio-eventloop.rst:426 +#: ../../library/asyncio-eventloop.rst:429 msgid "" -"*protocol_factory* is called without arguments and is expected to return " -"a :ref:`protocol ` instance." +"*protocol_factory* is called without arguments and is expected to return a :" +"ref:`protocol ` instance." msgstr "" "*protocol_factory* 在無引數的情況下被呼叫,並且預計回傳一個 :ref:`協定 " "` 實例。" -#: ../../library/asyncio-eventloop.rst:429 +#: ../../library/asyncio-eventloop.rst:432 msgid "" -"The protocol instance is coupled with the transport by calling " -"its :meth:`~BaseProtocol.connection_made` method." +"The protocol instance is coupled with the transport by calling its :meth:" +"`~BaseProtocol.connection_made` method." msgstr "" "通過呼叫其 :meth:`~BaseProtocol.connection_made` 方法,將協議實例與傳輸連線在" "一起。" -#: ../../library/asyncio-eventloop.rst:432 +#: ../../library/asyncio-eventloop.rst:435 msgid "A ``(transport, protocol)`` tuple is returned on success." msgstr "成功時回傳一個 ``(transport, protocol)`` 元組。" -#: ../../library/asyncio-eventloop.rst:434 +#: ../../library/asyncio-eventloop.rst:437 msgid "" "The created transport is an implementation-dependent bidirectional stream." msgstr "建立的傳輸是一個依賴實作的雙向串流。" -#: ../../library/asyncio-eventloop.rst:437 -#: ../../library/asyncio-eventloop.rst:569 +#: ../../library/asyncio-eventloop.rst:440 +#: ../../library/asyncio-eventloop.rst:573 msgid "Other arguments:" msgstr "其他引數:" -#: ../../library/asyncio-eventloop.rst:439 +#: ../../library/asyncio-eventloop.rst:442 msgid "" "*ssl*: if given and not false, a SSL/TLS transport is created (by default a " "plain TCP transport is created). If *ssl* is a :class:`ssl.SSLContext` " -"object, this context is used to create the transport; if *ssl* " -"is :const:`True`, a default context returned " -"from :func:`ssl.create_default_context` is used." +"object, this context is used to create the transport; if *ssl* is :const:" +"`True`, a default context returned from :func:`ssl.create_default_context` " +"is used." msgstr "" "若有給定 *ssl* 且非 false,將建立 SSL/TLS 傳輸(預設建立普通 TCP 傳輸)。如" "果 *ssl* 為 :class:`ssl.SSLContext` 物件,則使用該情境來建立傳輸;如果 *ssl* " "為 :const:`True`,則使用 :func:`ssl.create_default_context` 回傳的預設情境。" -#: ../../library/asyncio-eventloop.rst:445 +#: ../../library/asyncio-eventloop.rst:448 msgid ":ref:`SSL/TLS security considerations `" msgstr ":ref:`SSL/TLS 安全考量 `" -#: ../../library/asyncio-eventloop.rst:447 +#: ../../library/asyncio-eventloop.rst:450 msgid "" "*server_hostname* sets or overrides the hostname that the target server's " "certificate will be matched against. Should only be passed if *ssl* is not " @@ -746,7 +743,7 @@ msgstr "" "預設值,必須傳遞 *server_hostname* 的值。若 *server_hostname* 為空字串,將停" "用主機名稱匹配(這是一個嚴重的安全風險,可能導致中間人攻擊)。" -#: ../../library/asyncio-eventloop.rst:455 +#: ../../library/asyncio-eventloop.rst:458 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to getaddrinfo() for *host* resolution. If given, " @@ -757,7 +754,7 @@ msgstr "" "getaddrinfo() 進行 *host* 解析。若有給定這些應該都是相應 :mod:`socket` 模組常" "數的整數。" -#: ../../library/asyncio-eventloop.rst:460 +#: ../../library/asyncio-eventloop.rst:463 msgid "" "*happy_eyeballs_delay*, if given, enables Happy Eyeballs for this " "connection. It should be a floating-point number representing the amount of " @@ -767,11 +764,11 @@ msgid "" "the RFC is ``0.25`` (250 milliseconds)." msgstr "" "若有給定,*happy_eyeballs_delay* 會啟用此連線的 Happy Eyeballs。它應該是一個" -"浮點數,表示等待連線嘗試完成的秒數,然後在並行啟動下一次嘗試。這" -"是 :rfc:`8305` 中定義的「連線嘗試延遲」。RFC 建議的合理預設值為 ``0.25`` 秒" -"(250 毫秒)。" +"浮點數,表示等待連線嘗試完成的秒數,然後在並行啟動下一次嘗試。這是 :rfc:" +"`8305` 中定義的「連線嘗試延遲」。RFC 建議的合理預設值為 ``0.25`` 秒(250 毫" +"秒)。" -#: ../../library/asyncio-eventloop.rst:468 +#: ../../library/asyncio-eventloop.rst:471 msgid "" "*interleave* controls address reordering when a host name resolves to " "multiple IP addresses. If ``0`` or unspecified, no reordering is done, and " @@ -787,29 +784,29 @@ msgstr "" "族計數」。如果未指定 *happy_eyeballs_delay*,則預設值為 ``0``,如果指定則為 " "``1``。" -#: ../../library/asyncio-eventloop.rst:477 +#: ../../library/asyncio-eventloop.rst:480 msgid "" -"*sock*, if given, should be an existing, already " -"connected :class:`socket.socket` object to be used by the transport. If " -"*sock* is given, none of *host*, *port*, *family*, *proto*, *flags*, " -"*happy_eyeballs_delay*, *interleave* and *local_addr* should be specified." +"*sock*, if given, should be an existing, already connected :class:`socket." +"socket` object to be used by the transport. If *sock* is given, none of " +"*host*, *port*, *family*, *proto*, *flags*, *happy_eyeballs_delay*, " +"*interleave* and *local_addr* should be specified." msgstr "" "若有給定 *sock* 則其應為已存在且已連線的 :class:`socket.socket` 物件,可供傳" "輸使用。如果提供了 *sock*,則不應指定 *host*、*port*、*family*、*proto*、" "*flags*、*happy_eyeballs_delay*、*interleave* 和 *local_addr* 中的任何一項。" -#: ../../library/asyncio-eventloop.rst:485 -#: ../../library/asyncio-eventloop.rst:600 -#: ../../library/asyncio-eventloop.rst:844 +#: ../../library/asyncio-eventloop.rst:488 +#: ../../library/asyncio-eventloop.rst:604 +#: ../../library/asyncio-eventloop.rst:852 msgid "" "The *sock* argument transfers ownership of the socket to the transport " -"created. To close the socket, call the " -"transport's :meth:`~asyncio.BaseTransport.close` method." +"created. To close the socket, call the transport's :meth:`~asyncio." +"BaseTransport.close` method." msgstr "" -"引數 *sock* 將 socket 所有權轉移給所建立的傳輸 socket,請呼叫傳輸" -"的 :meth:`~asyncio.BaseTransport.close` 方法。" +"引數 *sock* 將 socket 所有權轉移給所建立的傳輸 socket,請呼叫傳輸的 :meth:" +"`~asyncio.BaseTransport.close` 方法。" -#: ../../library/asyncio-eventloop.rst:489 +#: ../../library/asyncio-eventloop.rst:492 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " "the socket locally. The *local_host* and *local_port* are looked up using " @@ -819,8 +816,8 @@ msgstr "" "地綁定 socket。將使用 ``getaddrinfo()`` 查找 *local_host* 和 *local_port*,方" "式類似於 *host* 和 *port*。" -#: ../../library/asyncio-eventloop.rst:493 -#: ../../library/asyncio-eventloop.rst:938 +#: ../../library/asyncio-eventloop.rst:496 +#: ../../library/asyncio-eventloop.rst:948 msgid "" "*ssl_handshake_timeout* is (for a TLS connection) the time in seconds to " "wait for the TLS handshake to complete before aborting the connection. " @@ -830,10 +827,10 @@ msgstr "" "在那之前若未完成則會中斷連線。如果為 ``None`` (預設值),則會等待 ``60.0`` " "秒。" -#: ../../library/asyncio-eventloop.rst:497 -#: ../../library/asyncio-eventloop.rst:753 -#: ../../library/asyncio-eventloop.rst:855 -#: ../../library/asyncio-eventloop.rst:942 +#: ../../library/asyncio-eventloop.rst:500 +#: ../../library/asyncio-eventloop.rst:759 +#: ../../library/asyncio-eventloop.rst:863 +#: ../../library/asyncio-eventloop.rst:952 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " @@ -842,7 +839,7 @@ msgstr "" "*ssl_shutdown_timeout* 是等待 SSL 關閉完成以前中斷連線的時間,以秒為單位。如" "果為 ``None`` (預設值),則會等待 ``30.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:501 +#: ../../library/asyncio-eventloop.rst:504 msgid "" "*all_errors* determines what exceptions are raised when a connection cannot " "be created. By default, only a single ``Exception`` is raised: the first " @@ -856,12 +853,12 @@ msgstr "" "包含所有錯誤訊息的單一 ``OSError``。當 ``all_errors`` 為 ``True`` 時,將引發" "包含所有例外的 ``ExceptionGroup`` (即使只有一個例外)。" -#: ../../library/asyncio-eventloop.rst:511 -#: ../../library/asyncio-eventloop.rst:765 +#: ../../library/asyncio-eventloop.rst:514 +#: ../../library/asyncio-eventloop.rst:771 msgid "Added support for SSL/TLS in :class:`ProactorEventLoop`." msgstr "新增 :class:`ProactorEventLoop` 中的 SSL/TLS 支援。" -#: ../../library/asyncio-eventloop.rst:515 +#: ../../library/asyncio-eventloop.rst:518 msgid "" "The socket option :ref:`socket.TCP_NODELAY ` is set " "by default for all TCP connections." @@ -869,16 +866,16 @@ msgstr "" "所有 TCP 連線都預設有 :ref:`socket.TCP_NODELAY ` " "socket 選項。" -#: ../../library/asyncio-eventloop.rst:520 -#: ../../library/asyncio-eventloop.rst:865 +#: ../../library/asyncio-eventloop.rst:523 +#: ../../library/asyncio-eventloop.rst:873 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "增加 *ssl_handshake_timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:524 +#: ../../library/asyncio-eventloop.rst:527 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "加入 *happy_eyeballs_delay* 和 *interleave* 參數。" -#: ../../library/asyncio-eventloop.rst:526 +#: ../../library/asyncio-eventloop.rst:529 msgid "" "Happy Eyeballs Algorithm: Success with Dual-Stack Hosts. When a server's " "IPv4 path and protocol are working, but the server's IPv6 path and protocol " @@ -894,55 +891,53 @@ msgstr "" "用戶端的使用者體驗變差。本文件具體說明了減少此用戶可見延遲的演算法要求並提供" "了一種演算法。" -#: ../../library/asyncio-eventloop.rst:535 +#: ../../library/asyncio-eventloop.rst:538 msgid "For more information: https://datatracker.ietf.org/doc/html/rfc6555" msgstr "更多資訊請見: https://datatracker.ietf.org/doc/html/rfc6555" -#: ../../library/asyncio-eventloop.rst:539 -#: ../../library/asyncio-eventloop.rst:663 -#: ../../library/asyncio-eventloop.rst:779 -#: ../../library/asyncio-eventloop.rst:818 -#: ../../library/asyncio-eventloop.rst:869 -#: ../../library/asyncio-eventloop.rst:950 +#: ../../library/asyncio-eventloop.rst:542 +#: ../../library/asyncio-eventloop.rst:668 +#: ../../library/asyncio-eventloop.rst:785 +#: ../../library/asyncio-eventloop.rst:825 +#: ../../library/asyncio-eventloop.rst:877 +#: ../../library/asyncio-eventloop.rst:960 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "增加 *ssl_shutdown_timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:541 +#: ../../library/asyncio-eventloop.rst:544 msgid "*all_errors* was added." msgstr "已新增 *all_errors*。" -#: ../../library/asyncio-eventloop.rst:546 +#: ../../library/asyncio-eventloop.rst:549 msgid "" "The :func:`open_connection` function is a high-level alternative API. It " "returns a pair of (:class:`StreamReader`, :class:`StreamWriter`) that can be " "used directly in async/await code." msgstr "" -"函式 :func:`open_connection` 是高階的替代 API。它回傳一對 " -"(:class:`StreamReader`, :class:`StreamWriter`) 可直接在 async/await 程式碼中" -"使用。" +"函式 :func:`open_connection` 是高階的替代 API。它回傳一對 (:class:" +"`StreamReader`, :class:`StreamWriter`) 可直接在 async/await 程式碼中使用。" -#: ../../library/asyncio-eventloop.rst:556 +#: ../../library/asyncio-eventloop.rst:560 msgid "Create a datagram connection." msgstr "建立一個資料報連線。" -#: ../../library/asyncio-eventloop.rst:558 +#: ../../library/asyncio-eventloop.rst:562 msgid "" -"The socket family can be " -"either :py:const:`~socket.AF_INET`, :py:const:`~socket.AF_INET6`, " -"or :py:const:`~socket.AF_UNIX`, depending on *host* (or the *family* " -"argument, if provided)." +"The socket family can be either :py:const:`~socket.AF_INET`, :py:const:" +"`~socket.AF_INET6`, or :py:const:`~socket.AF_UNIX`, depending on *host* (or " +"the *family* argument, if provided)." msgstr "" "Socket 家族可以是 :py:const:`~socket.AF_INET`、:py:const:`~socket.AF_INET6` " "或 :py:const:`~socket.AF_UNIX`,視乎 *host*\\ (或提供的 *family* 引數)而" "定。" -#: ../../library/asyncio-eventloop.rst:562 +#: ../../library/asyncio-eventloop.rst:566 msgid "The socket type will be :py:const:`~socket.SOCK_DGRAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_DGRAM`。" -#: ../../library/asyncio-eventloop.rst:564 -#: ../../library/asyncio-eventloop.rst:689 -#: ../../library/asyncio-eventloop.rst:836 +#: ../../library/asyncio-eventloop.rst:568 +#: ../../library/asyncio-eventloop.rst:695 +#: ../../library/asyncio-eventloop.rst:844 msgid "" "*protocol_factory* must be a callable returning a :ref:`protocol ` implementation." @@ -950,31 +945,31 @@ msgstr "" "*protocol_factory* 必須是可呼叫的函式,回傳 :ref:`protocol ` 實作。" -#: ../../library/asyncio-eventloop.rst:567 -#: ../../library/asyncio-eventloop.rst:645 +#: ../../library/asyncio-eventloop.rst:571 +#: ../../library/asyncio-eventloop.rst:650 msgid "A tuple of ``(transport, protocol)`` is returned on success." msgstr "成功時回傳 ``(transport, protocol)`` 元組。" -#: ../../library/asyncio-eventloop.rst:571 +#: ../../library/asyncio-eventloop.rst:575 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " -"the socket locally. The *local_host* and *local_port* are looked up " -"using :meth:`getaddrinfo`." +"the socket locally. The *local_host* and *local_port* are looked up using :" +"meth:`getaddrinfo`." msgstr "" "*local_addr*,如果提供,是一個 ``(local_host, local_port)`` 元組,用於在本地" "綁定 socket。*local_host* 和 *local_port* 使用 :meth:`getaddrinfo` 來查找。" -#: ../../library/asyncio-eventloop.rst:575 +#: ../../library/asyncio-eventloop.rst:579 msgid "" "*remote_addr*, if given, is a ``(remote_host, remote_port)`` tuple used to " "connect the socket to a remote address. The *remote_host* and *remote_port* " "are looked up using :meth:`getaddrinfo`." msgstr "" "*remote_addr*,如果提供,是一個 ``(remote_host, remote_port)`` 元組,用於將 " -"socket 連線到遠端位址。 *remote_host* 和 *remote_port* 使" -"用 :meth:`getaddrinfo` 來查找。" +"socket 連線到遠端位址。 *remote_host* 和 *remote_port* 使用 :meth:" +"`getaddrinfo` 來查找。" -#: ../../library/asyncio-eventloop.rst:579 +#: ../../library/asyncio-eventloop.rst:583 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to :meth:`getaddrinfo` for *host* resolution. If " @@ -985,7 +980,7 @@ msgstr "" "的可選地址家族、協定和旗標。如果提供,這些應該都是來自相應的 :mod:`socket` 模" "組常數的整數。" -#: ../../library/asyncio-eventloop.rst:584 +#: ../../library/asyncio-eventloop.rst:588 msgid "" "*reuse_port* tells the kernel to allow this endpoint to be bound to the same " "port as other existing endpoints are bound to, so long as they all set this " @@ -994,36 +989,35 @@ msgid "" "is not defined then this capability is unsupported." msgstr "" "*reuse_port* 告訴核心允許將此端點綁定到與其他現有端點相同的埠,只要它們在建立" -"時都設定了此旗標。此選項不受 Windows 和某些 Unix 系統支援。如果未定" -"義 :py:const:`~socket.SO_REUSEPORT` 常數,則不支援此功能。" +"時都設定了此旗標。此選項不受 Windows 和某些 Unix 系統支援。如果未定義 :py:" +"const:`~socket.SO_REUSEPORT` 常數,則不支援此功能。" -#: ../../library/asyncio-eventloop.rst:590 +#: ../../library/asyncio-eventloop.rst:594 msgid "" "*allow_broadcast* tells the kernel to allow this endpoint to send messages " "to the broadcast address." msgstr "*allow_broadcast* 告訴核心允許此端點向廣播位址發送訊息。" -#: ../../library/asyncio-eventloop.rst:593 +#: ../../library/asyncio-eventloop.rst:597 msgid "" "*sock* can optionally be specified in order to use a preexisting, already " "connected, :class:`socket.socket` object to be used by the transport. If " -"specified, *local_addr* and *remote_addr* should be omitted (must " -"be :const:`None`)." +"specified, *local_addr* and *remote_addr* should be omitted (must be :const:" +"`None`)." msgstr "" "*sock* 可以選擇性地指定,以使用預先存在且已連線的 :class:`socket.socket` 物件" -"供傳輸使用。如果指定,*local_addr* 和 *remote_addr* 應省略(必須" -"是 :const:`None`\\ )。" +"供傳輸使用。如果指定,*local_addr* 和 *remote_addr* 應省略(必須是 :const:" +"`None`\\ )。" -#: ../../library/asyncio-eventloop.rst:604 +#: ../../library/asyncio-eventloop.rst:608 msgid "" -"See :ref:`UDP echo client protocol ` " -"and :ref:`UDP echo server protocol ` " -"examples." +"See :ref:`UDP echo client protocol ` and :" +"ref:`UDP echo server protocol ` examples." msgstr "" -"請參閱 :ref:`UDP 回應用戶端協議 ` " -"和 :ref:`UDP 回應伺服器協議 ` 範例。" +"請參閱 :ref:`UDP 回應用戶端協議 ` 和 :ref:" +"`UDP 回應伺服器協議 ` 範例。" -#: ../../library/asyncio-eventloop.rst:607 +#: ../../library/asyncio-eventloop.rst:611 msgid "" "The *family*, *proto*, *flags*, *reuse_address*, *reuse_port*, " "*allow_broadcast*, and *sock* parameters were added." @@ -1031,21 +1025,20 @@ msgstr "" "新增 *family*、*proto*、*flags*、*reuse_address*、*reuse_port*、" "*allow_broadcast* 和 *sock* 參數。" -#: ../../library/asyncio-eventloop.rst:611 +#: ../../library/asyncio-eventloop.rst:615 msgid "Added support for Windows." msgstr "新增對於 Windows 的支援。" -#: ../../library/asyncio-eventloop.rst:614 +#: ../../library/asyncio-eventloop.rst:618 msgid "" -"The *reuse_address* parameter is no longer supported, as " -"using :ref:`socket.SO_REUSEADDR ` poses a significant " -"security concern for UDP. Explicitly passing ``reuse_address=True`` will " -"raise an exception." +"The *reuse_address* parameter is no longer supported, as using :ref:`socket." +"SO_REUSEADDR ` poses a significant security concern " +"for UDP. Explicitly passing ``reuse_address=True`` will raise an exception." msgstr "" "不再支援 *reuse_address* 參數,因為使用 :py:const:`~sockets.SO_REUSEADDR` 對" "於 UDP 存有重大的安全疑慮。明確傳遞 ``reuse_address=True`` 將引發例外。" -#: ../../library/asyncio-eventloop.rst:620 +#: ../../library/asyncio-eventloop.rst:624 msgid "" "When multiple processes with differing UIDs assign sockets to an identical " "UDP socket address with ``SO_REUSEADDR``, incoming packets can become " @@ -1054,7 +1047,7 @@ msgstr "" "當具有不同 UID 的多個行程使用 ``SO_REUSEADDR`` 將 socket 分配給相同的 UDP " "socket 地址時,傳入的封包可能會在 socket 之間隨機分佈。" -#: ../../library/asyncio-eventloop.rst:624 +#: ../../library/asyncio-eventloop.rst:628 msgid "" "For supported platforms, *reuse_port* can be used as a replacement for " "similar functionality. With *reuse_port*, :ref:`socket.SO_REUSEPORT ` is set by default " "for all TCP connections." msgstr "" -"新增 *ssl_handshake_timeout* 與 *start_serving* 參數。所有 TCP 連線都預設" -"有 :ref:`socket.TCP_NODELAY ` socket 選項。" +"新增 *ssl_handshake_timeout* 與 *start_serving* 參數。所有 TCP 連線都預設有 :" +"ref:`socket.TCP_NODELAY ` socket 選項。" -#: ../../library/asyncio-eventloop.rst:783 +#: ../../library/asyncio-eventloop.rst:789 msgid "" "The :func:`start_server` function is a higher-level alternative API that " "returns a pair of :class:`StreamReader` and :class:`StreamWriter` that can " "be used in an async/await code." msgstr "" -":func:`start_server` 函式是一個更高階的替代 API,它回傳一" -"對 :class:`StreamReader` 和 :class:`StreamWriter`,可以在 async/await 程式碼" -"中使用。" +":func:`start_server` 函式是一個更高階的替代 API,它回傳一對 :class:" +"`StreamReader` 和 :class:`StreamWriter`,可以在 async/await 程式碼中使用。" -#: ../../library/asyncio-eventloop.rst:794 +#: ../../library/asyncio-eventloop.rst:801 msgid "" -"Similar to :meth:`loop.create_server` but works with " -"the :py:const:`~socket.AF_UNIX` socket family." +"Similar to :meth:`loop.create_server` but works with the :py:const:`~socket." +"AF_UNIX` socket family." msgstr "" "類似 :meth:`loop.create_server`,但適用於 :py:const:`~socket.AF_UNIX` socket " "家族。" -#: ../../library/asyncio-eventloop.rst:797 +#: ../../library/asyncio-eventloop.rst:804 msgid "" "*path* is the name of a Unix domain socket, and is required, unless a *sock* " "argument is provided. Abstract Unix sockets, :class:`str`, :class:`bytes`, " @@ -1310,7 +1300,7 @@ msgstr "" "象 Unix sockets、:class:`str`、:class:`bytes` 和 :class:`~pathlib.Path` 路" "徑。" -#: ../../library/asyncio-eventloop.rst:802 +#: ../../library/asyncio-eventloop.rst:809 msgid "" "If *cleanup_socket* is true then the Unix socket will automatically be " "removed from the filesystem when the server is closed, unless the socket has " @@ -1319,13 +1309,13 @@ msgstr "" "如果 *cleanup_socket* 為真,則 Unix socket 將在伺服器關閉時自動從檔案系統中刪" "除,除非在建立伺服器後替換了 socket。" -#: ../../library/asyncio-eventloop.rst:806 +#: ../../library/asyncio-eventloop.rst:813 msgid "" "See the documentation of the :meth:`loop.create_server` method for " "information about arguments to this method." msgstr "有關此方法的引數資訊,請參閱 :meth:`loop.create_server` 方法的文件。" -#: ../../library/asyncio-eventloop.rst:813 +#: ../../library/asyncio-eventloop.rst:820 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :class:`~pathlib.Path` object." @@ -1333,26 +1323,26 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。*path* 參數現在可為一" "個 :class:`~pathlib.Path` 物件。" -#: ../../library/asyncio-eventloop.rst:822 +#: ../../library/asyncio-eventloop.rst:829 msgid "Added the *cleanup_socket* parameter." msgstr "加入 *cleanup_socket* 參數。" -#: ../../library/asyncio-eventloop.rst:829 +#: ../../library/asyncio-eventloop.rst:837 msgid "Wrap an already accepted connection into a transport/protocol pair." msgstr "將已接受的連線包裝成傳輸層/協議對。" -#: ../../library/asyncio-eventloop.rst:831 +#: ../../library/asyncio-eventloop.rst:839 msgid "" "This method can be used by servers that accept connections outside of " "asyncio but that use asyncio to handle them." msgstr "此方法可以由在 asyncio 外接受連線但使用 asyncio 處理連線的伺服器使用。" -#: ../../library/asyncio-eventloop.rst:834 -#: ../../library/asyncio-eventloop.rst:924 +#: ../../library/asyncio-eventloop.rst:842 +#: ../../library/asyncio-eventloop.rst:934 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-eventloop.rst:839 +#: ../../library/asyncio-eventloop.rst:847 msgid "" "*sock* is a preexisting socket object returned from :meth:`socket.accept " "`." @@ -1360,13 +1350,13 @@ msgstr "" "*sock* 是從 :meth:`socket.accept ` 回傳的預先存在的 " "socket 物件。" -#: ../../library/asyncio-eventloop.rst:848 +#: ../../library/asyncio-eventloop.rst:856 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over the " "accepted connections." msgstr "*ssl* 可以設置為 :class:`~ssl.SSLContext` 以在已接受的連線上啟用 SSL。" -#: ../../library/asyncio-eventloop.rst:851 +#: ../../library/asyncio-eventloop.rst:859 msgid "" "*ssl_handshake_timeout* is (for an SSL connection) the time in seconds to " "wait for the SSL handshake to complete before aborting the connection. " @@ -1375,29 +1365,29 @@ msgstr "" "(對於 SSL 連線)\\ *ssl_handshake_timeout* 是在中斷連線之前等待 SSL 握手完成" "的時間(以秒為單位)。如果為 ``None``\\ (預設),則為 ``60.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:859 +#: ../../library/asyncio-eventloop.rst:867 msgid "Returns a ``(transport, protocol)`` pair." msgstr "回傳 ``(transport, protocol)`` 對。" -#: ../../library/asyncio-eventloop.rst:873 +#: ../../library/asyncio-eventloop.rst:881 msgid "Transferring files" msgstr "傳輸檔案" -#: ../../library/asyncio-eventloop.rst:878 +#: ../../library/asyncio-eventloop.rst:887 msgid "" "Send a *file* over a *transport*. Return the total number of bytes sent." msgstr "通過 *transport* 發送 *file*。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:881 +#: ../../library/asyncio-eventloop.rst:890 msgid "The method uses high-performance :meth:`os.sendfile` if available." msgstr "如果可用,該方法使用高性能 :meth:`os.sendfile`。" -#: ../../library/asyncio-eventloop.rst:883 +#: ../../library/asyncio-eventloop.rst:892 msgid "*file* must be a regular file object opened in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:885 -#: ../../library/asyncio-eventloop.rst:1136 +#: ../../library/asyncio-eventloop.rst:894 +#: ../../library/asyncio-eventloop.rst:1155 msgid "" "*offset* tells from where to start reading the file. If specified, *count* " "is the total number of bytes to transmit as opposed to sending the file " @@ -1409,7 +1399,7 @@ msgstr "" "不是發送檔案直到達到 EOF。即使此方法引發錯誤時,檔案位置也始終更新,可以使" "用 :meth:`file.tell() ` 取得實際發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:892 +#: ../../library/asyncio-eventloop.rst:901 msgid "" "*fallback* set to ``True`` makes asyncio to manually read and send the file " "when the platform does not support the sendfile system call (e.g. Windows or " @@ -1418,23 +1408,23 @@ msgstr "" "將 *fallback* 設置為 ``True`` 會使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:896 +#: ../../library/asyncio-eventloop.rst:905 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support the " "*sendfile* syscall and *fallback* is ``False``." msgstr "" -"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,則引" -"發 :exc:`SendfileNotAvailableError`。" +"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,則引發 :exc:" +"`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:903 +#: ../../library/asyncio-eventloop.rst:912 msgid "TLS Upgrade" msgstr "TLS 升級" -#: ../../library/asyncio-eventloop.rst:910 +#: ../../library/asyncio-eventloop.rst:920 msgid "Upgrade an existing transport-based connection to TLS." msgstr "將基於傳輸的現有連線升級到 TLS。" -#: ../../library/asyncio-eventloop.rst:912 +#: ../../library/asyncio-eventloop.rst:922 msgid "" "Create a TLS coder/decoder instance and insert it between the *transport* " "and the *protocol*. The coder/decoder implements both *transport*-facing " @@ -1443,7 +1433,7 @@ msgstr "" "建立 TLS 編解碼器實例並在 *transport* 和 *protocol* 之間插入它。編解碼器既實" "作了對於 *transport* 的協議,也實作了對於 *protocol* 的傳輸。" -#: ../../library/asyncio-eventloop.rst:916 +#: ../../library/asyncio-eventloop.rst:926 msgid "" "Return the created two-interface instance. After *await*, the *protocol* " "must stop using the original *transport* and communicate with the returned " @@ -1454,25 +1444,25 @@ msgstr "" "*transport*,僅與回傳的物件通信,因為編碼器快取了 *protocol* 端的資料,並且" "與 *transport* 間歇性地交換額外的 TLS session 封包。" -#: ../../library/asyncio-eventloop.rst:921 +#: ../../library/asyncio-eventloop.rst:931 msgid "" "In some situations (e.g. when the passed transport is already closing) this " "may return ``None``." msgstr "在某些情況下(例如傳入的傳輸已經關閉),此函式可能回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:926 +#: ../../library/asyncio-eventloop.rst:936 msgid "" -"*transport* and *protocol* instances that methods " -"like :meth:`~loop.create_server` and :meth:`~loop.create_connection` return." +"*transport* and *protocol* instances that methods like :meth:`~loop." +"create_server` and :meth:`~loop.create_connection` return." msgstr "" -"*transport* 和 *protocol* 實例,由像 :meth:`~loop.create_server` " -"和 :meth:`~loop.create_connection` 等方法回傳。" +"*transport* 和 *protocol* 實例,由像 :meth:`~loop.create_server` 和 :meth:" +"`~loop.create_connection` 等方法回傳。" -#: ../../library/asyncio-eventloop.rst:930 +#: ../../library/asyncio-eventloop.rst:940 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "*sslcontext*:配置好的 :class:`~ssl.SSLContext` 實例。" -#: ../../library/asyncio-eventloop.rst:932 +#: ../../library/asyncio-eventloop.rst:942 msgid "" "*server_side* pass ``True`` when a server-side connection is being upgraded " "(like the one created by :meth:`~loop.create_server`)." @@ -1480,17 +1470,17 @@ msgstr "" "當升級伺服器端連線時(像由 :meth:`~loop.create_server` 建立的那樣)傳遞 " "``True``。" -#: ../../library/asyncio-eventloop.rst:935 +#: ../../library/asyncio-eventloop.rst:945 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "*server_hostname*:設置或覆蓋將用於匹配目標伺服器憑證的主機名。" -#: ../../library/asyncio-eventloop.rst:955 +#: ../../library/asyncio-eventloop.rst:965 msgid "Watching file descriptors" msgstr "監視檔案描述器" -#: ../../library/asyncio-eventloop.rst:959 +#: ../../library/asyncio-eventloop.rst:969 msgid "" "Start monitoring the *fd* file descriptor for read availability and invoke " "*callback* with the specified arguments once *fd* is available for reading." @@ -1498,14 +1488,14 @@ msgstr "" "開始監視 *fd* 檔案描述器的讀取可用性,一但 *fd* 可讀取,使用指定引數呼叫 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:963 -#: ../../library/asyncio-eventloop.rst:977 +#: ../../library/asyncio-eventloop.rst:973 +#: ../../library/asyncio-eventloop.rst:987 msgid "" "Any preexisting callback registered for *fd* is cancelled and replaced by " "*callback*." msgstr "任何預先存在、為 *fd* 註冊的回呼函式將被取消並替換為 *callback*。" -#: ../../library/asyncio-eventloop.rst:968 +#: ../../library/asyncio-eventloop.rst:978 msgid "" "Stop monitoring the *fd* file descriptor for read availability. Returns " "``True`` if *fd* was previously being monitored for reads." @@ -1513,7 +1503,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的讀取可用性。如果 *fd* 之前正在監視讀取,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:973 +#: ../../library/asyncio-eventloop.rst:983 msgid "" "Start monitoring the *fd* file descriptor for write availability and invoke " "*callback* with the specified arguments once *fd* is available for writing." @@ -1521,8 +1511,8 @@ msgstr "" "開始監視 *fd* 檔案描述器的寫入可用性,一旦 *fd* 可寫入,使用指定引數呼叫 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:980 -#: ../../library/asyncio-eventloop.rst:1245 +#: ../../library/asyncio-eventloop.rst:990 +#: ../../library/asyncio-eventloop.rst:1268 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *callback*." @@ -1530,7 +1520,7 @@ msgstr "" "使用 :func:`functools.partial` 向 *callback* :ref:`傳送關鍵字引數 `。" -#: ../../library/asyncio-eventloop.rst:985 +#: ../../library/asyncio-eventloop.rst:995 msgid "" "Stop monitoring the *fd* file descriptor for write availability. Returns " "``True`` if *fd* was previously being monitored for writes." @@ -1538,7 +1528,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的寫入可用性。如果 *fd* 之前正在監視寫入,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:988 +#: ../../library/asyncio-eventloop.rst:998 msgid "" "See also :ref:`Platform Support ` section for some " "limitations of these methods." @@ -1546,47 +1536,47 @@ msgstr "" "另請參閱\\ :ref:`平台支援 `\\ 部分以了解這些方法的" "一些限制。" -#: ../../library/asyncio-eventloop.rst:993 +#: ../../library/asyncio-eventloop.rst:1003 msgid "Working with socket objects directly" msgstr "直接使用 socket 物件" -#: ../../library/asyncio-eventloop.rst:995 +#: ../../library/asyncio-eventloop.rst:1005 msgid "" -"In general, protocol implementations that use transport-based APIs such " -"as :meth:`loop.create_connection` and :meth:`loop.create_server` are faster " -"than implementations that work with sockets directly. However, there are " -"some use cases when performance is not critical, and working " -"with :class:`~socket.socket` objects directly is more convenient." +"In general, protocol implementations that use transport-based APIs such as :" +"meth:`loop.create_connection` and :meth:`loop.create_server` are faster than " +"implementations that work with sockets directly. However, there are some use " +"cases when performance is not critical, and working with :class:`~socket." +"socket` objects directly is more convenient." msgstr "" -"一般情況下,使用基於傳輸的 API(如 :meth:`loop.create_connection` " -"和 :meth:`loop.create_server`\\ )的協議實作比直接使用 socket 的實作更快。然" -"而在某些情況下性能不是關鍵,直接使用 :class:`~socket.socket` 物件更方便。" +"一般情況下,使用基於傳輸的 API(如 :meth:`loop.create_connection` 和 :meth:" +"`loop.create_server`\\ )的協議實作比直接使用 socket 的實作更快。然而在某些情" +"況下性能不是關鍵,直接使用 :class:`~socket.socket` 物件更方便。" -#: ../../library/asyncio-eventloop.rst:1004 +#: ../../library/asyncio-eventloop.rst:1015 msgid "" -"Receive up to *nbytes* from *sock*. Asynchronous version " -"of :meth:`socket.recv() `." +"Receive up to *nbytes* from *sock*. Asynchronous version of :meth:`socket." +"recv() `." msgstr "" "從 *sock* 接收最多 *nbytes*。:meth:`socket.recv() ` 的非" "同步版本。" -#: ../../library/asyncio-eventloop.rst:1007 +#: ../../library/asyncio-eventloop.rst:1018 msgid "Return the received data as a bytes object." msgstr "將接收到的資料作為 bytes 物件回傳。" -#: ../../library/asyncio-eventloop.rst:1009 -#: ../../library/asyncio-eventloop.rst:1023 -#: ../../library/asyncio-eventloop.rst:1034 -#: ../../library/asyncio-eventloop.rst:1046 -#: ../../library/asyncio-eventloop.rst:1061 +#: ../../library/asyncio-eventloop.rst:1020 +#: ../../library/asyncio-eventloop.rst:1035 +#: ../../library/asyncio-eventloop.rst:1047 +#: ../../library/asyncio-eventloop.rst:1060 #: ../../library/asyncio-eventloop.rst:1076 -#: ../../library/asyncio-eventloop.rst:1086 -#: ../../library/asyncio-eventloop.rst:1112 -#: ../../library/asyncio-eventloop.rst:1150 +#: ../../library/asyncio-eventloop.rst:1092 +#: ../../library/asyncio-eventloop.rst:1103 +#: ../../library/asyncio-eventloop.rst:1130 +#: ../../library/asyncio-eventloop.rst:1169 msgid "*sock* must be a non-blocking socket." msgstr "*sock* 必須是非阻塞 socket。" -#: ../../library/asyncio-eventloop.rst:1011 +#: ../../library/asyncio-eventloop.rst:1022 msgid "" "Even though this method was always documented as a coroutine method, " "releases before Python 3.7 returned a :class:`Future`. Since Python 3.7 this " @@ -1595,52 +1585,51 @@ msgstr "" "儘管此方法一直記錄為協程方法,但 Python 3.7 之前的版本回傳 :class:`Future`。" "自 Python 3.7 起,這是 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1018 +#: ../../library/asyncio-eventloop.rst:1030 msgid "" -"Receive data from *sock* into the *buf* buffer. Modeled after the " -"blocking :meth:`socket.recv_into() ` method." +"Receive data from *sock* into the *buf* buffer. Modeled after the blocking :" +"meth:`socket.recv_into() ` method." msgstr "" "從 *sock* 接收資料到 *buf* 緩衝區。仿照阻塞 :meth:`socket.recv_into() " "` 方法。" -#: ../../library/asyncio-eventloop.rst:1021 +#: ../../library/asyncio-eventloop.rst:1033 msgid "Return the number of bytes written to the buffer." msgstr "回傳寫入緩衝區位元組的數目。" -#: ../../library/asyncio-eventloop.rst:1029 +#: ../../library/asyncio-eventloop.rst:1042 msgid "" -"Receive a datagram of up to *bufsize* from *sock*. Asynchronous version " -"of :meth:`socket.recvfrom() `." +"Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of :" +"meth:`socket.recvfrom() `." msgstr "" "從 *sock* 接收最多 *bufsize* 大小的資料單元。:meth:`socket.recvfrom() " "` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1032 +#: ../../library/asyncio-eventloop.rst:1045 msgid "Return a tuple of (received data, remote address)." msgstr "回傳一個元組 (received data, remote address)。" -#: ../../library/asyncio-eventloop.rst:1040 +#: ../../library/asyncio-eventloop.rst:1054 msgid "" "Receive a datagram of up to *nbytes* from *sock* into *buf*. Asynchronous " "version of :meth:`socket.recvfrom_into() `." msgstr "" -"從 *sock* 接收最多 *nbytes* 大小的資料單元到 " -"*buf*。:meth:`socket.recvfrom_into() ` 的非同步" -"版本。" +"從 *sock* 接收最多 *nbytes* 大小的資料單元到 *buf*。:meth:`socket." +"recvfrom_into() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1044 +#: ../../library/asyncio-eventloop.rst:1058 msgid "Return a tuple of (number of bytes received, remote address)." msgstr "回傳一個元組 (number of bytes received, remote address)。" -#: ../../library/asyncio-eventloop.rst:1052 +#: ../../library/asyncio-eventloop.rst:1067 msgid "" -"Send *data* to the *sock* socket. Asynchronous version " -"of :meth:`socket.sendall() `." +"Send *data* to the *sock* socket. Asynchronous version of :meth:`socket." +"sendall() `." msgstr "" -"將 *data* 發送到 *sock* socket。:meth:`socket.sendall() " -"` 的非同步版本。" +"將 *data* 發送到 *sock* socket。:meth:`socket.sendall() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1055 +#: ../../library/asyncio-eventloop.rst:1070 msgid "" "This method continues to send to the socket until either all data in *data* " "has been sent or an error occurs. ``None`` is returned on success. On " @@ -1652,8 +1641,8 @@ msgstr "" "回傳 ``None``。錯誤時引發例外。此外,沒有辦法確定接收端成功處理了多少資料(如" "果有的話)。" -#: ../../library/asyncio-eventloop.rst:1063 -#: ../../library/asyncio-eventloop.rst:1114 +#: ../../library/asyncio-eventloop.rst:1078 +#: ../../library/asyncio-eventloop.rst:1132 msgid "" "Even though the method was always documented as a coroutine method, before " "Python 3.7 it returned a :class:`Future`. Since Python 3.7, this is an " @@ -1662,39 +1651,39 @@ msgstr "" "儘管該方法一直被記錄為協程方法,但在 Python 3.7 之前它回傳 :class:`Future`。" "從 Python 3.7 開始,這是一個 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1070 +#: ../../library/asyncio-eventloop.rst:1086 msgid "" -"Send a datagram from *sock* to *address*. Asynchronous version " -"of :meth:`socket.sendto() `." +"Send a datagram from *sock* to *address*. Asynchronous version of :meth:" +"`socket.sendto() `." msgstr "" -"從 *sock* 向 *address* 發送一個資料單元。:meth:`socket.sendto() " -"` 的非同步版本。" +"從 *sock* 向 *address* 發送一個資料單元。:meth:`socket.sendto() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1074 +#: ../../library/asyncio-eventloop.rst:1090 msgid "Return the number of bytes sent." msgstr "回傳發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:1082 +#: ../../library/asyncio-eventloop.rst:1099 msgid "Connect *sock* to a remote socket at *address*." msgstr "將 *sock* 連線到位於 *address* 的遠端 socket。" -#: ../../library/asyncio-eventloop.rst:1084 +#: ../../library/asyncio-eventloop.rst:1101 msgid "" "Asynchronous version of :meth:`socket.connect() `." msgstr ":meth:`socket.connect() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1088 +#: ../../library/asyncio-eventloop.rst:1105 msgid "" "``address`` no longer needs to be resolved. ``sock_connect`` will try to " -"check if the *address* is already resolved by " -"calling :func:`socket.inet_pton`. If not, :meth:`loop.getaddrinfo` will be " -"used to resolve the *address*." +"check if the *address* is already resolved by calling :func:`socket." +"inet_pton`. If not, :meth:`loop.getaddrinfo` will be used to resolve the " +"*address*." msgstr "" -"不再需要解析 ``address``。``sock_connect`` 將嘗試透過呼" -"叫 :func:`socket.inet_pton` 檢查 *address* 是否已解析。如果沒有,將使" -"用 :meth:`loop.getaddrinfo` 解析 *address*。" +"不再需要解析 ``address``。``sock_connect`` 將嘗試透過呼叫 :func:`socket." +"inet_pton` 檢查 *address* 是否已解析。如果沒有,將使用 :meth:`loop." +"getaddrinfo` 解析 *address*。" -#: ../../library/asyncio-eventloop.rst:1097 +#: ../../library/asyncio-eventloop.rst:1114 msgid "" ":meth:`loop.create_connection` and :func:`asyncio.open_connection() " "`." @@ -1702,7 +1691,7 @@ msgstr "" ":meth:`loop.create_connection` 和 :func:`asyncio.open_connection() " "`。" -#: ../../library/asyncio-eventloop.rst:1103 +#: ../../library/asyncio-eventloop.rst:1121 msgid "" "Accept a connection. Modeled after the blocking :meth:`socket.accept() " "` method." @@ -1710,7 +1699,7 @@ msgstr "" "接受一個連線。模擬阻塞的 :meth:`socket.accept() ` 方" "法。" -#: ../../library/asyncio-eventloop.rst:1106 +#: ../../library/asyncio-eventloop.rst:1124 msgid "" "The socket must be bound to an address and listening for connections. The " "return value is a pair ``(conn, address)`` where *conn* is a *new* socket " @@ -1721,34 +1710,34 @@ msgstr "" "中 *conn* 是一個 *新* socket 物件,可在連線上發送和接收資料,*address* 是連接" "另一端對應的 socket 地址。" -#: ../../library/asyncio-eventloop.rst:1121 +#: ../../library/asyncio-eventloop.rst:1139 msgid ":meth:`loop.create_server` and :func:`start_server`." msgstr ":meth:`loop.create_server` 和 :func:`start_server`。" -#: ../../library/asyncio-eventloop.rst:1126 +#: ../../library/asyncio-eventloop.rst:1145 msgid "" "Send a file using high-performance :mod:`os.sendfile` if possible. Return " "the total number of bytes sent." msgstr "" "如果可行,使用高性能 :mod:`os.sendfile` 發送檔案。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:1129 +#: ../../library/asyncio-eventloop.rst:1148 msgid "" "Asynchronous version of :meth:`socket.sendfile() `." msgstr ":meth:`socket.sendfile() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1131 +#: ../../library/asyncio-eventloop.rst:1150 msgid "" -"*sock* must be a non-" -"blocking :const:`socket.SOCK_STREAM` :class:`~socket.socket`." +"*sock* must be a non-blocking :const:`socket.SOCK_STREAM` :class:`~socket." +"socket`." msgstr "" "*sock* 必須是非阻塞的 :const:`socket.SOCK_STREAM` :class:`~socket.socket`。" -#: ../../library/asyncio-eventloop.rst:1134 +#: ../../library/asyncio-eventloop.rst:1153 msgid "*file* must be a regular file object open in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:1143 +#: ../../library/asyncio-eventloop.rst:1162 msgid "" "*fallback*, when set to ``True``, makes asyncio manually read and send the " "file when the platform does not support the sendfile syscall (e.g. Windows " @@ -1757,27 +1746,27 @@ msgstr "" "當設置為 ``True`` 時,*fallback* 使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:1147 +#: ../../library/asyncio-eventloop.rst:1166 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support " "*sendfile* syscall and *fallback* is ``False``." msgstr "" -"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,引" -"發 :exc:`SendfileNotAvailableError`。" +"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,引發 :exc:" +"`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:1156 +#: ../../library/asyncio-eventloop.rst:1175 msgid "DNS" msgstr "DNS" -#: ../../library/asyncio-eventloop.rst:1161 +#: ../../library/asyncio-eventloop.rst:1181 msgid "Asynchronous version of :meth:`socket.getaddrinfo`." msgstr ":meth:`socket.getaddrinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1165 +#: ../../library/asyncio-eventloop.rst:1186 msgid "Asynchronous version of :meth:`socket.getnameinfo`." msgstr ":meth:`socket.getnameinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1168 +#: ../../library/asyncio-eventloop.rst:1189 msgid "" "Both *getaddrinfo* and *getnameinfo* internally utilize their synchronous " "versions through the loop's default thread pool executor. When this executor " @@ -1787,86 +1776,84 @@ msgid "" "executor with a larger number of workers." msgstr "" -#: ../../library/asyncio-eventloop.rst:1175 +#: ../../library/asyncio-eventloop.rst:1196 msgid "" "Both *getaddrinfo* and *getnameinfo* methods were always documented to " -"return a coroutine, but prior to Python 3.7 they were, in fact, " -"returning :class:`asyncio.Future` objects. Starting with Python 3.7 both " -"methods are coroutines." +"return a coroutine, but prior to Python 3.7 they were, in fact, returning :" +"class:`asyncio.Future` objects. Starting with Python 3.7 both methods are " +"coroutines." msgstr "" "*getaddrinfo* 和 *getnameinfo* 方法一直被記錄為回傳協程,但在 Python 3.7 之前" "它們實際上回傳 :class:`asyncio.Future` 物件。從 Python 3.7 開始,兩個方法都是" "協程。" -#: ../../library/asyncio-eventloop.rst:1183 +#: ../../library/asyncio-eventloop.rst:1204 msgid "Working with pipes" msgstr "使用管道" -#: ../../library/asyncio-eventloop.rst:1187 +#: ../../library/asyncio-eventloop.rst:1209 msgid "Register the read end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的讀取端。" -#: ../../library/asyncio-eventloop.rst:1192 +#: ../../library/asyncio-eventloop.rst:1214 msgid "*pipe* is a :term:`file-like object `." msgstr "*pipe* 是 :term:`類檔案物件 `。" -#: ../../library/asyncio-eventloop.rst:1194 +#: ../../library/asyncio-eventloop.rst:1216 msgid "" -"Return pair ``(transport, protocol)``, where *transport* supports " -"the :class:`ReadTransport` interface and *protocol* is an object " -"instantiated by the *protocol_factory*." +"Return pair ``(transport, protocol)``, where *transport* supports the :class:" +"`ReadTransport` interface and *protocol* is an object instantiated by the " +"*protocol_factory*." msgstr "" -"回傳 ``(transport, protocol)`` 對,其中 *transport* 支" -"援 :class:`ReadTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物" -"件。" +"回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" +"`ReadTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1198 -#: ../../library/asyncio-eventloop.rst:1214 +#: ../../library/asyncio-eventloop.rst:1220 +#: ../../library/asyncio-eventloop.rst:1237 msgid "" "With :class:`SelectorEventLoop` event loop, the *pipe* is set to non-" "blocking mode." msgstr "使用 :class:`SelectorEventLoop` 事件迴圈時,*pipe* 設置為非阻塞模式。" -#: ../../library/asyncio-eventloop.rst:1203 +#: ../../library/asyncio-eventloop.rst:1226 msgid "Register the write end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的寫入端。" -#: ../../library/asyncio-eventloop.rst:1208 +#: ../../library/asyncio-eventloop.rst:1231 msgid "*pipe* is :term:`file-like object `." msgstr "*pipe* 是 :term:`file-like object `。" -#: ../../library/asyncio-eventloop.rst:1210 +#: ../../library/asyncio-eventloop.rst:1233 msgid "" -"Return pair ``(transport, protocol)``, where *transport* " -"supports :class:`WriteTransport` interface and *protocol* is an object " -"instantiated by the *protocol_factory*." +"Return pair ``(transport, protocol)``, where *transport* supports :class:" +"`WriteTransport` interface and *protocol* is an object instantiated by the " +"*protocol_factory*." msgstr "" -"回傳 ``(transport, protocol)`` 對,其中 *transport* 支" -"援 :class:`WriteTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的" -"物件。" +"回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" +"`WriteTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1219 +#: ../../library/asyncio-eventloop.rst:1242 msgid "" ":class:`SelectorEventLoop` does not support the above methods on Windows. " "Use :class:`ProactorEventLoop` instead for Windows." msgstr "" -":class:`SelectorEventLoop` 在 Windows 上不支援上述方法。對於 Windows 請使" -"用 :class:`ProactorEventLoop`。" +":class:`SelectorEventLoop` 在 Windows 上不支援上述方法。對於 Windows 請使用 :" +"class:`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1224 +#: ../../library/asyncio-eventloop.rst:1247 msgid "" "The :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods." msgstr ":meth:`loop.subprocess_exec` 和 :meth:`loop.subprocess_shell` 方法。" -#: ../../library/asyncio-eventloop.rst:1229 +#: ../../library/asyncio-eventloop.rst:1252 msgid "Unix signals" msgstr "Unix 訊號" -#: ../../library/asyncio-eventloop.rst:1235 +#: ../../library/asyncio-eventloop.rst:1258 msgid "Set *callback* as the handler for the *signum* signal." msgstr "將 *callback* 設置為 *signum* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1237 +#: ../../library/asyncio-eventloop.rst:1260 msgid "" "The callback will be invoked by *loop*, along with other queued callbacks " "and runnable coroutines of that event loop. Unlike signal handlers " @@ -1877,7 +1864,7 @@ msgstr "" "用 :func:`signal.signal` 註冊的訊號處理程式不同,使用此函式註冊的回呼允許與事" "件迴圈進行互動。" -#: ../../library/asyncio-eventloop.rst:1242 +#: ../../library/asyncio-eventloop.rst:1265 msgid "" "Raise :exc:`ValueError` if the signal number is invalid or uncatchable. " "Raise :exc:`RuntimeError` if there is a problem setting up the handler." @@ -1885,16 +1872,16 @@ msgstr "" "如果訊號號無效或不可捕獲,引發 :exc:`ValueError`。如果設定處理程序有問題,拋" "出 :exc:`RuntimeError`。" -#: ../../library/asyncio-eventloop.rst:1248 +#: ../../library/asyncio-eventloop.rst:1271 msgid "" "Like :func:`signal.signal`, this function must be invoked in the main thread." msgstr "像 :func:`signal.signal` 一樣,此函式必須在主執行緒中呼叫。" -#: ../../library/asyncio-eventloop.rst:1253 +#: ../../library/asyncio-eventloop.rst:1276 msgid "Remove the handler for the *sig* signal." msgstr "移除 *sig* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1255 +#: ../../library/asyncio-eventloop.rst:1278 msgid "" "Return ``True`` if the signal handler was removed, or ``False`` if no " "handler was set for the given signal." @@ -1902,19 +1889,19 @@ msgstr "" "如果訊號處理程式被移除,回傳 ``True``;如果給定訊號沒有設置處理程式,回傳 " "``False``。" -#: ../../library/asyncio-eventloop.rst:1262 +#: ../../library/asyncio-eventloop.rst:1285 msgid "The :mod:`signal` module." msgstr ":mod:`signal` 模組。" -#: ../../library/asyncio-eventloop.rst:1266 +#: ../../library/asyncio-eventloop.rst:1289 msgid "Executing code in thread or process pools" msgstr "在執行緒池或行程池中執行程式碼" -#: ../../library/asyncio-eventloop.rst:1270 +#: ../../library/asyncio-eventloop.rst:1293 msgid "Arrange for *func* to be called in the specified executor." msgstr "安排在指定的執行器中呼叫 *func*。" -#: ../../library/asyncio-eventloop.rst:1272 +#: ../../library/asyncio-eventloop.rst:1295 msgid "" "The *executor* argument should be an :class:`concurrent.futures.Executor` " "instance. The default executor is used if *executor* is ``None``. The " @@ -1923,7 +1910,7 @@ msgid "" "and used by :func:`run_in_executor` if needed." msgstr "" -#: ../../library/asyncio-eventloop.rst:1280 +#: ../../library/asyncio-eventloop.rst:1303 msgid "" "import asyncio\n" "import concurrent.futures\n" @@ -1966,23 +1953,23 @@ msgid "" " asyncio.run(main())" msgstr "" -#: ../../library/asyncio-eventloop.rst:1320 +#: ../../library/asyncio-eventloop.rst:1343 msgid "" "Note that the entry point guard (``if __name__ == '__main__'``) is required " "for option 3 due to the peculiarities of :mod:`multiprocessing`, which is " "used by :class:`~concurrent.futures.ProcessPoolExecutor`. See :ref:`Safe " "importing of main module `." msgstr "" -"請注意,由於 :mod:`multiprocessing`\\ " -"(由 :class:`~concurrent.futures.ProcessPoolExecutor` 使用)的特殊性,選項 3 " -"需要進入點保護(\\ ``if __name__ == '__main__'``\\ )。請參閱\\ :ref:`主模組" -"的安全引入 `。" +"請注意,由於 :mod:`multiprocessing`\\ (由 :class:`~concurrent.futures." +"ProcessPoolExecutor` 使用)的特殊性,選項 3 需要進入點保護(\\ ``if __name__ " +"== '__main__'``\\ )。請參閱\\ :ref:`主模組的安全引入 `。" -#: ../../library/asyncio-eventloop.rst:1325 +#: ../../library/asyncio-eventloop.rst:1348 msgid "This method returns a :class:`asyncio.Future` object." msgstr "此方法回傳 :class:`asyncio.Future` 物件。" -#: ../../library/asyncio-eventloop.rst:1327 +#: ../../library/asyncio-eventloop.rst:1350 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *func*." @@ -1990,7 +1977,7 @@ msgstr "" "使用 :func:`functools.partial` 將來\\ :ref:`關鍵字引數傳遞 `\\ 給 *func*。" -#: ../../library/asyncio-eventloop.rst:1330 +#: ../../library/asyncio-eventloop.rst:1353 msgid "" ":meth:`loop.run_in_executor` no longer configures the ``max_workers`` of the " "thread pool executor it creates, instead leaving it up to the thread pool " @@ -1998,38 +1985,38 @@ msgid "" "default." msgstr "" ":meth:`loop.run_in_executor` 不再配置它建立的執行緒池執行器的 " -"``max_workers``,而是讓執行緒池執行器" -"(\\ :class:`~concurrent.futures.ThreadPoolExecutor`)設定預設值。" +"``max_workers``,而是讓執行緒池執行器(\\ :class:`~concurrent.futures." +"ThreadPoolExecutor`)設定預設值。" -#: ../../library/asyncio-eventloop.rst:1339 +#: ../../library/asyncio-eventloop.rst:1362 msgid "" "Set *executor* as the default executor used by :meth:`run_in_executor`. " -"*executor* must be an instance " -"of :class:`~concurrent.futures.ThreadPoolExecutor`." +"*executor* must be an instance of :class:`~concurrent.futures." +"ThreadPoolExecutor`." msgstr "" "將 *executor* 設置為 :meth:`run_in_executor` 使用的預設執行器。*executor* 必" "須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1343 +#: ../../library/asyncio-eventloop.rst:1366 msgid "" -"*executor* must be an instance " -"of :class:`~concurrent.futures.ThreadPoolExecutor`." +"*executor* must be an instance of :class:`~concurrent.futures." +"ThreadPoolExecutor`." msgstr "" "*executor* 必須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1349 +#: ../../library/asyncio-eventloop.rst:1372 msgid "Error Handling API" msgstr "錯誤處理 API" -#: ../../library/asyncio-eventloop.rst:1351 +#: ../../library/asyncio-eventloop.rst:1374 msgid "Allows customizing how exceptions are handled in the event loop." msgstr "允許自定義事件迴圈中的例外處理方式。" -#: ../../library/asyncio-eventloop.rst:1355 +#: ../../library/asyncio-eventloop.rst:1378 msgid "Set *handler* as the new event loop exception handler." msgstr "將 *handler* 設定為新的事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1357 +#: ../../library/asyncio-eventloop.rst:1380 msgid "" "If *handler* is ``None``, the default exception handler will be set. " "Otherwise, *handler* must be a callable with the signature matching ``(loop, " @@ -2042,16 +2029,16 @@ msgstr "" "圈的,``context`` 是包含例外詳細資訊的 ``dict`` 物件(有關情境的詳細資訊,請" "參閱 :meth:`call_exception_handler` 文件)。" -#: ../../library/asyncio-eventloop.rst:1365 +#: ../../library/asyncio-eventloop.rst:1388 msgid "" -"If the handler is called on behalf of a :class:`~asyncio.Task` " -"or :class:`~asyncio.Handle`, it is run in the :class:`contextvars.Context` " -"of that task or callback handle." +"If the handler is called on behalf of a :class:`~asyncio.Task` or :class:" +"`~asyncio.Handle`, it is run in the :class:`contextvars.Context` of that " +"task or callback handle." msgstr "" "如果代表 :class:`~asyncio.Task` 或 :class:`~asyncio.Handle` 呼叫處理程式,它" "將在該任務或回呼處理程式的 :class:`contextvars.Context` 中運行。" -#: ../../library/asyncio-eventloop.rst:1371 +#: ../../library/asyncio-eventloop.rst:1394 msgid "" "The handler may be called in the :class:`~contextvars.Context` of the task " "or handle where the exception originated." @@ -2059,18 +2046,18 @@ msgstr "" "處理程式可能在引發例外的任務或處理程式的 :class:`~contextvars.Context` 中被呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1376 +#: ../../library/asyncio-eventloop.rst:1399 msgid "" "Return the current exception handler, or ``None`` if no custom exception " "handler was set." msgstr "" "回傳當前的例外處理程式,如果未設置自定義例外處理程式,則回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:1383 +#: ../../library/asyncio-eventloop.rst:1406 msgid "Default exception handler." msgstr "預設例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1385 +#: ../../library/asyncio-eventloop.rst:1408 msgid "" "This is called when an exception occurs and no exception handler is set. " "This can be called by a custom exception handler that wants to defer to the " @@ -2079,17 +2066,17 @@ msgstr "" "當發生例外且未設置例外處理程式時呼叫此函式。自定義例外處理程式可以呼叫此函式" "以轉由預設處理程式處理。" -#: ../../library/asyncio-eventloop.rst:1389 +#: ../../library/asyncio-eventloop.rst:1412 msgid "" -"*context* parameter has the same meaning as " -"in :meth:`call_exception_handler`." +"*context* parameter has the same meaning as in :meth:" +"`call_exception_handler`." msgstr "*context* 參數與 :meth:`call_exception_handler` 中的意思相同。" -#: ../../library/asyncio-eventloop.rst:1394 +#: ../../library/asyncio-eventloop.rst:1417 msgid "Call the current event loop exception handler." msgstr "呼叫當前事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1396 +#: ../../library/asyncio-eventloop.rst:1419 msgid "" "*context* is a ``dict`` object containing the following keys (new keys may " "be introduced in future Python versions):" @@ -2097,143 +2084,149 @@ msgstr "" "*context* 是一個包含以下鍵的 ``dict`` 物件(未來的 Python 版本中可能會引入新" "的鍵):" -#: ../../library/asyncio-eventloop.rst:1399 +#: ../../library/asyncio-eventloop.rst:1422 msgid "'message': Error message;" msgstr "'message':錯誤訊息;" -#: ../../library/asyncio-eventloop.rst:1400 +#: ../../library/asyncio-eventloop.rst:1423 msgid "'exception' (optional): Exception object;" msgstr "'exception'(可選):例外物件;" -#: ../../library/asyncio-eventloop.rst:1401 +#: ../../library/asyncio-eventloop.rst:1424 msgid "'future' (optional): :class:`asyncio.Future` instance;" msgstr "'future'(可選): :class:`asyncio.Future` 實例;" -#: ../../library/asyncio-eventloop.rst:1402 +#: ../../library/asyncio-eventloop.rst:1425 msgid "'task' (optional): :class:`asyncio.Task` instance;" msgstr "'task'(可選): :class:`asyncio.Task` 實例;" -#: ../../library/asyncio-eventloop.rst:1403 +#: ../../library/asyncio-eventloop.rst:1426 msgid "'handle' (optional): :class:`asyncio.Handle` instance;" msgstr "'handle'(可選): :class:`asyncio.Handle` 實例;" -#: ../../library/asyncio-eventloop.rst:1404 +#: ../../library/asyncio-eventloop.rst:1427 msgid "'protocol' (optional): :ref:`Protocol ` instance;" msgstr "'protocol'(可選): :ref:`Protocol ` 實例;" -#: ../../library/asyncio-eventloop.rst:1405 +#: ../../library/asyncio-eventloop.rst:1428 msgid "'transport' (optional): :ref:`Transport ` instance;" msgstr "'transport'(可選): :ref:`Transport ` 實例;" -#: ../../library/asyncio-eventloop.rst:1406 +#: ../../library/asyncio-eventloop.rst:1429 msgid "'socket' (optional): :class:`socket.socket` instance;" msgstr "'socket'(可選): :class:`socket.socket` 實例;" -#: ../../library/asyncio-eventloop.rst:1407 +#: ../../library/asyncio-eventloop.rst:1430 +msgid "'source_traceback' (optional): Traceback of the source;" +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1431 +msgid "'handle_traceback' (optional): Traceback of the handle;" +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1432 msgid "'asyncgen' (optional): Asynchronous generator that caused" msgstr "'asyncgen'(可選): 非同步產生器引發" -#: ../../library/asyncio-eventloop.rst:1408 +#: ../../library/asyncio-eventloop.rst:1433 msgid "the exception." msgstr "例外。" -#: ../../library/asyncio-eventloop.rst:1412 +#: ../../library/asyncio-eventloop.rst:1437 msgid "" "This method should not be overloaded in subclassed event loops. For custom " "exception handling, use the :meth:`set_exception_handler` method." msgstr "" -"此方法不應在子類別事件迴圈中被覆寫。為了自定義例外處理,請使" -"用 :meth:`set_exception_handler` 方法。" +"此方法不應在子類別事件迴圈中被覆寫。為了自定義例外處理,請使用 :meth:" +"`set_exception_handler` 方法。" -#: ../../library/asyncio-eventloop.rst:1417 +#: ../../library/asyncio-eventloop.rst:1442 msgid "Enabling debug mode" msgstr "啟用除錯模式" -#: ../../library/asyncio-eventloop.rst:1421 +#: ../../library/asyncio-eventloop.rst:1446 msgid "Get the debug mode (:class:`bool`) of the event loop." msgstr "取得事件迴圈的除錯模式(\\ :class:`bool`\\ )。" -#: ../../library/asyncio-eventloop.rst:1423 +#: ../../library/asyncio-eventloop.rst:1448 msgid "" -"The default value is ``True`` if the environment " -"variable :envvar:`PYTHONASYNCIODEBUG` is set to a non-empty string, " -"``False`` otherwise." +"The default value is ``True`` if the environment variable :envvar:" +"`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False`` otherwise." msgstr "" "如果環境變數 :envvar:`PYTHONASYNCIODEBUG` 被設定為非空字串,則預設值為 " "``True``,否則為 ``False``。" -#: ../../library/asyncio-eventloop.rst:1429 +#: ../../library/asyncio-eventloop.rst:1454 msgid "Set the debug mode of the event loop." msgstr "設定事件迴圈的除錯模式。" -#: ../../library/asyncio-eventloop.rst:1433 +#: ../../library/asyncio-eventloop.rst:1458 msgid "" "The new :ref:`Python Development Mode ` can now also be used to " "enable the debug mode." msgstr "現在也可以使用新的 :ref:`Python 開發模式 ` 啟用除錯模式。" -#: ../../library/asyncio-eventloop.rst:1438 +#: ../../library/asyncio-eventloop.rst:1463 msgid "" "This attribute can be used to set the minimum execution duration in seconds " "that is considered \"slow\". When debug mode is enabled, \"slow\" callbacks " "are logged." msgstr "" -"此屬性可用於設定被視為\"慢\"的最短執行時間(以秒為單位)。啟用偵錯模式後," -"\"慢\"回呼將被記錄。" +"此屬性可用於設定被視為\"慢\"的最短執行時間(以秒為單位)。啟用偵錯模式" +"後,\"慢\"回呼將被記錄。" -#: ../../library/asyncio-eventloop.rst:1442 +#: ../../library/asyncio-eventloop.rst:1467 msgid "Default value is 100 milliseconds." msgstr "預設值為 100 毫秒" -#: ../../library/asyncio-eventloop.rst:1446 +#: ../../library/asyncio-eventloop.rst:1471 msgid "The :ref:`debug mode of asyncio `." msgstr ":ref:`asyncio 的除錯模式 `。" -#: ../../library/asyncio-eventloop.rst:1450 +#: ../../library/asyncio-eventloop.rst:1475 msgid "Running Subprocesses" msgstr "運行子行程" -#: ../../library/asyncio-eventloop.rst:1452 +#: ../../library/asyncio-eventloop.rst:1477 msgid "" "Methods described in this subsections are low-level. In regular async/await " "code consider using the high-level :func:`asyncio.create_subprocess_shell` " "and :func:`asyncio.create_subprocess_exec` convenience functions instead." msgstr "" -"本小節描述的方法是低階的。在常規的 async/await 程式碼中,請考慮使用高" -"階 :func:`asyncio.create_subprocess_shell` " -"和 :func:`asyncio.create_subprocess_exec` 輔助功能而不是。" +"本小節描述的方法是低階的。在常規的 async/await 程式碼中,請考慮使用高階 :" +"func:`asyncio.create_subprocess_shell` 和 :func:`asyncio." +"create_subprocess_exec` 輔助功能而不是。" -#: ../../library/asyncio-eventloop.rst:1459 +#: ../../library/asyncio-eventloop.rst:1484 msgid "" "On Windows, the default event loop :class:`ProactorEventLoop` supports " -"subprocesses, whereas :class:`SelectorEventLoop` does not. " -"See :ref:`Subprocess Support on Windows ` for " -"details." +"subprocesses, whereas :class:`SelectorEventLoop` does not. See :ref:" +"`Subprocess Support on Windows ` for details." msgstr "" -"在 Windows 上,預設事件迴圈 :class:`ProactorEventLoop` 支援子行程," -"而 :class:`SelectorEventLoop` 不支援。詳細資訊請參見 :ref:`Windows 上對於子行" -"程的支援 `。" +"在 Windows 上,預設事件迴圈 :class:`ProactorEventLoop` 支援子行程,而 :class:" +"`SelectorEventLoop` 不支援。詳細資訊請參見 :ref:`Windows 上對於子行程的支援 " +"`。" -#: ../../library/asyncio-eventloop.rst:1470 +#: ../../library/asyncio-eventloop.rst:1496 msgid "" "Create a subprocess from one or more string arguments specified by *args*." msgstr "從 *args* 指定的一個或多個字串引數建立子行程。" -#: ../../library/asyncio-eventloop.rst:1473 +#: ../../library/asyncio-eventloop.rst:1499 msgid "*args* must be a list of strings represented by:" msgstr "*args* 必須是由以下項表示的字串串列:" -#: ../../library/asyncio-eventloop.rst:1475 +#: ../../library/asyncio-eventloop.rst:1501 msgid ":class:`str`;" msgstr ":class:`str`;" -#: ../../library/asyncio-eventloop.rst:1476 +#: ../../library/asyncio-eventloop.rst:1502 msgid "" "or :class:`bytes`, encoded to the :ref:`filesystem encoding `." msgstr "或 :class:`bytes`,編碼為 :ref:`檔案系統編碼 `。" -#: ../../library/asyncio-eventloop.rst:1479 +#: ../../library/asyncio-eventloop.rst:1505 msgid "" "The first string specifies the program executable, and the remaining strings " "specify the arguments. Together, string arguments form the ``argv`` of the " @@ -2242,7 +2235,7 @@ msgstr "" "第一個字串指定程序可執行檔案,其餘字串指定引數。字串引數一起組成程序的 " "``argv``。" -#: ../../library/asyncio-eventloop.rst:1483 +#: ../../library/asyncio-eventloop.rst:1509 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=False`` and the list of strings passed as the first " @@ -2253,75 +2246,75 @@ msgstr "" "字串串列作為第一個引數傳遞;然而,:class:`~subprocess.Popen` 接受單個字串串列" "引數,*subprocess_exec* 接受多個字串引數。" -#: ../../library/asyncio-eventloop.rst:1489 +#: ../../library/asyncio-eventloop.rst:1515 msgid "" -"The *protocol_factory* must be a callable returning a subclass of " -"the :class:`asyncio.SubprocessProtocol` class." +"The *protocol_factory* must be a callable returning a subclass of the :class:" +"`asyncio.SubprocessProtocol` class." msgstr "" "*protocol_factory* 必須是回傳 :class:`asyncio.SubprocessProtocol` 子類別的可" "呼叫物件。" -#: ../../library/asyncio-eventloop.rst:1492 +#: ../../library/asyncio-eventloop.rst:1518 msgid "Other parameters:" msgstr "其他參數:" -#: ../../library/asyncio-eventloop.rst:1494 +#: ../../library/asyncio-eventloop.rst:1520 msgid "*stdin* can be any of these:" msgstr "*stdin* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1496 -#: ../../library/asyncio-eventloop.rst:1507 -#: ../../library/asyncio-eventloop.rst:1517 +#: ../../library/asyncio-eventloop.rst:1522 +#: ../../library/asyncio-eventloop.rst:1533 +#: ../../library/asyncio-eventloop.rst:1543 msgid "a file-like object" msgstr "類檔案物件" -#: ../../library/asyncio-eventloop.rst:1497 +#: ../../library/asyncio-eventloop.rst:1523 msgid "" "an existing file descriptor (a positive integer), for example those created " "with :meth:`os.pipe`" msgstr "現有的檔案描述器(正整數),例如用 :meth:`os.pipe` 建立的" -#: ../../library/asyncio-eventloop.rst:1498 -#: ../../library/asyncio-eventloop.rst:1508 -#: ../../library/asyncio-eventloop.rst:1518 +#: ../../library/asyncio-eventloop.rst:1524 +#: ../../library/asyncio-eventloop.rst:1534 +#: ../../library/asyncio-eventloop.rst:1544 msgid "" "the :const:`subprocess.PIPE` constant (default) which will create a new pipe " "and connect it," msgstr ":const:`subprocess.PIPE` 常數(預設),它將建立一個新的管道並連線," -#: ../../library/asyncio-eventloop.rst:1500 -#: ../../library/asyncio-eventloop.rst:1510 -#: ../../library/asyncio-eventloop.rst:1520 +#: ../../library/asyncio-eventloop.rst:1526 +#: ../../library/asyncio-eventloop.rst:1536 +#: ../../library/asyncio-eventloop.rst:1546 msgid "" "the value ``None`` which will make the subprocess inherit the file " "descriptor from this process" msgstr "值 ``None`` 將使子行程從此行程繼承檔案描述器" -#: ../../library/asyncio-eventloop.rst:1502 -#: ../../library/asyncio-eventloop.rst:1512 -#: ../../library/asyncio-eventloop.rst:1522 +#: ../../library/asyncio-eventloop.rst:1528 +#: ../../library/asyncio-eventloop.rst:1538 +#: ../../library/asyncio-eventloop.rst:1548 msgid "" -"the :const:`subprocess.DEVNULL` constant which indicates that the " -"special :data:`os.devnull` file will be used" +"the :const:`subprocess.DEVNULL` constant which indicates that the special :" +"data:`os.devnull` file will be used" msgstr "" ":const:`subprocess.DEVNULL` 常數,表示將使用特殊的 :data:`os.devnull` 檔案" -#: ../../library/asyncio-eventloop.rst:1505 +#: ../../library/asyncio-eventloop.rst:1531 msgid "*stdout* can be any of these:" msgstr "*stdout* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1515 +#: ../../library/asyncio-eventloop.rst:1541 msgid "*stderr* can be any of these:" msgstr "*stderr* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1524 +#: ../../library/asyncio-eventloop.rst:1550 msgid "" "the :const:`subprocess.STDOUT` constant which will connect the standard " "error stream to the process' standard output stream" msgstr "" ":const:`subprocess.STDOUT` 常數,它將標準錯誤串流連線到行程的標準輸出串流" -#: ../../library/asyncio-eventloop.rst:1527 +#: ../../library/asyncio-eventloop.rst:1553 msgid "" "All other keyword arguments are passed to :class:`subprocess.Popen` without " "interpretation, except for *bufsize*, *universal_newlines*, *shell*, *text*, " @@ -2331,7 +2324,7 @@ msgstr "" "*bufsize*、*universal_newlines*、*shell*、*text*、*encoding* 和 *errors* 除" "外,這些不應該指定。" -#: ../../library/asyncio-eventloop.rst:1532 +#: ../../library/asyncio-eventloop.rst:1558 msgid "" "The ``asyncio`` subprocess API does not support decoding the streams as " "text. :func:`bytes.decode` can be used to convert the bytes returned from " @@ -2340,43 +2333,43 @@ msgstr "" "``asyncio`` 子行程 API 不支援將串流解碼為文本。可以使用 :func:`bytes.decode` " "將從串流回傳的位元組轉換為文本。" -#: ../../library/asyncio-eventloop.rst:1536 +#: ../../library/asyncio-eventloop.rst:1562 msgid "" "If a file-like object passed as *stdin*, *stdout* or *stderr* represents a " -"pipe, then the other side of this pipe should be registered " -"with :meth:`~loop.connect_write_pipe` or :meth:`~loop.connect_read_pipe` for " -"use with the event loop." +"pipe, then the other side of this pipe should be registered with :meth:" +"`~loop.connect_write_pipe` or :meth:`~loop.connect_read_pipe` for use with " +"the event loop." msgstr "" "如果傳遞給 *stdin*、*stdout* 或 *stderr* 的類檔案物件表示管道,則該管道的另一" -"端應該使用 :meth:`~loop.connect_write_pipe` " -"或 :meth:`~loop.connect_read_pipe` 註冊到事件迴圈中。" +"端應該使用 :meth:`~loop.connect_write_pipe` 或 :meth:`~loop." +"connect_read_pipe` 註冊到事件迴圈中。" -#: ../../library/asyncio-eventloop.rst:1541 +#: ../../library/asyncio-eventloop.rst:1567 msgid "" "See the constructor of the :class:`subprocess.Popen` class for documentation " "on other arguments." msgstr "有關其他引數的文件,請參閱 :class:`subprocess.Popen` 類別的建構函式。" -#: ../../library/asyncio-eventloop.rst:1544 +#: ../../library/asyncio-eventloop.rst:1570 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`asyncio.SubprocessTransport` base class and *protocol* is an " "object instantiated by the *protocol_factory*." msgstr "" -"回傳 ``(transport, protocol)`` 對,其中 *transport* 符" -"合 :class:`asyncio.SubprocessTransport` 基底類別,*protocol* 是由 " -"*protocol_factory* 實例化的物件。" +"回傳 ``(transport, protocol)`` 對,其中 *transport* 符合 :class:`asyncio." +"SubprocessTransport` 基底類別,*protocol* 是由 *protocol_factory* 實例化的物" +"件。" -#: ../../library/asyncio-eventloop.rst:1552 +#: ../../library/asyncio-eventloop.rst:1579 msgid "" -"Create a subprocess from *cmd*, which can be a :class:`str` or " -"a :class:`bytes` string encoded to the :ref:`filesystem encoding `, using the platform's \"shell\" syntax." msgstr "" -"使用平台的 “shell” 語法從 *cmd* 建立子行程,*cmd* 可以是 :class:`str` 或編碼" -"為 :ref:`檔案系統編碼 ` 的 :class:`bytes` 字串。" +"使用平台的 \"shell\" 語法從 *cmd* 建立子行程,*cmd* 可以是 :class:`str` 或編" +"碼為 :ref:`檔案系統編碼 ` 的 :class:`bytes` 字串。" -#: ../../library/asyncio-eventloop.rst:1557 +#: ../../library/asyncio-eventloop.rst:1584 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=True``." @@ -2384,31 +2377,31 @@ msgstr "" "這類似於標準函式庫中的 :class:`subprocess.Popen` 類別,使用 ``shell=True`` 呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1560 +#: ../../library/asyncio-eventloop.rst:1587 msgid "" -"The *protocol_factory* must be a callable returning a subclass of " -"the :class:`SubprocessProtocol` class." +"The *protocol_factory* must be a callable returning a subclass of the :class:" +"`SubprocessProtocol` class." msgstr "" "*protocol_factory* 必須是回傳 :class:`SubprocessProtocol` 子類別的可呼叫物" "件。" -#: ../../library/asyncio-eventloop.rst:1563 +#: ../../library/asyncio-eventloop.rst:1590 msgid "" "See :meth:`~loop.subprocess_exec` for more details about the remaining " "arguments." msgstr "有關其餘引數的更多詳細資訊,請參閱 :meth:`~loop.subprocess_exec`。" -#: ../../library/asyncio-eventloop.rst:1566 +#: ../../library/asyncio-eventloop.rst:1593 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`SubprocessTransport` base class and *protocol* is an object " "instantiated by the *protocol_factory*." msgstr "" -"回傳一對 ``(transport, protocol)``,其中 *transport* 符" -"合 :class:`SubprocessTransport` 基底類別,而 *protocol* 是由 " -"*protocol_factory* 實例化的物件。" +"回傳一對 ``(transport, protocol)``,其中 *transport* 符合 :class:" +"`SubprocessTransport` 基底類別,而 *protocol* 是由 *protocol_factory* 實例化" +"的物件。" -#: ../../library/asyncio-eventloop.rst:1571 +#: ../../library/asyncio-eventloop.rst:1598 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -2417,77 +2410,76 @@ msgid "" "escape whitespace and special characters in strings that are going to be " "used to construct shell commands." msgstr "" -"由應用程式負責確保適當引用所有空白和特殊字元,以避免 `shell 注入 `_\\ 風險。可以使" -"用 :func:`shlex.quote` 函式來正確跳脫用於構建 shell 命令的字串中的空白和特殊" -"字元。" +"由應用程式負責確保適當引用所有空白和特殊字元,以避免 `shell 注入 `_\\ 風險。可以使用 :func:" +"`shlex.quote` 函式來正確跳脫用於構建 shell 命令的字串中的空白和特殊字元。" -#: ../../library/asyncio-eventloop.rst:1580 +#: ../../library/asyncio-eventloop.rst:1607 msgid "Callback Handles" msgstr "回呼處理" -#: ../../library/asyncio-eventloop.rst:1584 +#: ../../library/asyncio-eventloop.rst:1611 msgid "" -"A callback wrapper object returned " -"by :meth:`loop.call_soon`, :meth:`loop.call_soon_threadsafe`." +"A callback wrapper object returned by :meth:`loop.call_soon`, :meth:`loop." +"call_soon_threadsafe`." msgstr "" "由 :meth:`loop.call_soon` 和 :meth:`loop.call_soon_threadsafe` 回傳的回呼包裝" "器。" -#: ../../library/asyncio-eventloop.rst:1589 +#: ../../library/asyncio-eventloop.rst:1616 msgid "" "Return the :class:`contextvars.Context` object associated with the handle." msgstr "回傳與處理相關聯的 :class:`contextvars.Context` 物件。" -#: ../../library/asyncio-eventloop.rst:1596 +#: ../../library/asyncio-eventloop.rst:1623 msgid "" "Cancel the callback. If the callback has already been canceled or executed, " "this method has no effect." msgstr "取消回呼。如果回呼已被取消或執行,此方法將不起作用。" -#: ../../library/asyncio-eventloop.rst:1601 +#: ../../library/asyncio-eventloop.rst:1628 msgid "Return ``True`` if the callback was cancelled." msgstr "如果回呼已被取消,回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1607 +#: ../../library/asyncio-eventloop.rst:1634 msgid "" -"A callback wrapper object returned by :meth:`loop.call_later`, " -"and :meth:`loop.call_at`." +"A callback wrapper object returned by :meth:`loop.call_later`, and :meth:" +"`loop.call_at`." msgstr "由 :meth:`loop.call_later` 和 :meth:`loop.call_at` 回傳的回呼包裝器。" -#: ../../library/asyncio-eventloop.rst:1610 +#: ../../library/asyncio-eventloop.rst:1637 msgid "This class is a subclass of :class:`Handle`." msgstr "這個類別是 :class:`Handle` 的子類別。" -#: ../../library/asyncio-eventloop.rst:1614 +#: ../../library/asyncio-eventloop.rst:1641 msgid "Return a scheduled callback time as :class:`float` seconds." msgstr "回傳預定的回呼時間,以 :class:`float` 秒為單位。" -#: ../../library/asyncio-eventloop.rst:1616 +#: ../../library/asyncio-eventloop.rst:1643 msgid "" -"The time is an absolute timestamp, using the same time reference " -"as :meth:`loop.time`." +"The time is an absolute timestamp, using the same time reference as :meth:" +"`loop.time`." msgstr "時間是一個絕對的時間戳,使用與 :meth:`loop.time` 相同的時間參照。" -#: ../../library/asyncio-eventloop.rst:1623 +#: ../../library/asyncio-eventloop.rst:1650 msgid "Server Objects" msgstr "Server 物件" -#: ../../library/asyncio-eventloop.rst:1625 +#: ../../library/asyncio-eventloop.rst:1652 msgid "" -"Server objects are created " -"by :meth:`loop.create_server`, :meth:`loop.create_unix_server`, :func:`start_server`, " -"and :func:`start_unix_server` functions." +"Server objects are created by :meth:`loop.create_server`, :meth:`loop." +"create_unix_server`, :func:`start_server`, and :func:`start_unix_server` " +"functions." msgstr "" -"Server 物件是" -"由 :meth:`loop.create_server`、:meth:`loop.create_unix_server`、:func:`start_server` " -"和 :func:`start_unix_server` 函式所建立。" +"Server 物件是由 :meth:`loop.create_server`、:meth:`loop." +"create_unix_server`、:func:`start_server` 和 :func:`start_unix_server` 函式所" +"建立。" -#: ../../library/asyncio-eventloop.rst:1629 +#: ../../library/asyncio-eventloop.rst:1656 msgid "Do not instantiate the :class:`Server` class directly." msgstr "請勿直接實例化 :class:`Server` 類別。" -#: ../../library/asyncio-eventloop.rst:1633 +#: ../../library/asyncio-eventloop.rst:1660 msgid "" "*Server* objects are asynchronous context managers. When used in an ``async " "with`` statement, it's guaranteed that the Server object is closed and not " @@ -2496,7 +2488,7 @@ msgstr "" "*Server* 物件是非同步情境管理器。當在 ``async with`` 陳述中使用時,可以保證在" "完成 ``async with`` 陳述時,Server 物件將會關閉並停止接受新的連線: ::" -#: ../../library/asyncio-eventloop.rst:1638 +#: ../../library/asyncio-eventloop.rst:1665 msgid "" "srv = await loop.create_server(...)\n" "\n" @@ -2512,30 +2504,30 @@ msgstr "" "\n" "# 此時 srv 已關閉,不再接受新的連線。" -#: ../../library/asyncio-eventloop.rst:1646 +#: ../../library/asyncio-eventloop.rst:1673 msgid "Server object is an asynchronous context manager since Python 3.7." msgstr "自 Python 3.7 起,Server 物件是非同步情境管理器。" -#: ../../library/asyncio-eventloop.rst:1649 +#: ../../library/asyncio-eventloop.rst:1676 msgid "" "This class was exposed publicly as ``asyncio.Server`` in Python 3.9.11, " "3.10.3 and 3.11." msgstr "" "此類別在 Python 3.9.11、3.10.3 和 3.11 中以 ``asyncio.Server`` 的形式被公開。" -#: ../../library/asyncio-eventloop.rst:1654 +#: ../../library/asyncio-eventloop.rst:1681 msgid "" "Stop serving: close listening sockets and set the :attr:`sockets` attribute " "to ``None``." msgstr "停止服務:關閉監聽的 sockets 並將 :attr:`sockets` 屬性設為 ``None``。" -#: ../../library/asyncio-eventloop.rst:1657 +#: ../../library/asyncio-eventloop.rst:1684 msgid "" "The sockets that represent existing incoming client connections are left " "open." msgstr "代表現有傳入用戶端連線的 sockets 仍然保持開啟。" -#: ../../library/asyncio-eventloop.rst:1660 +#: ../../library/asyncio-eventloop.rst:1687 msgid "" "The server is closed asynchronously; use the :meth:`wait_closed` coroutine " "to wait until the server is closed (and no more connections are active)." @@ -2543,53 +2535,53 @@ msgstr "" "伺服器以非同步方式關閉;使用 :meth:`wait_close` 協程等待伺服器關閉(不再有活" "躍連線)。" -#: ../../library/asyncio-eventloop.rst:1666 +#: ../../library/asyncio-eventloop.rst:1693 msgid "Close all existing incoming client connections." msgstr "關閉所有現有的傳入客戶端連線。" -#: ../../library/asyncio-eventloop.rst:1668 +#: ../../library/asyncio-eventloop.rst:1695 msgid "" "Calls :meth:`~asyncio.BaseTransport.close` on all associated transports." msgstr "在所有關聯的傳輸上呼叫 :meth:`~asyncio.BaseTransport.close`。" -#: ../../library/asyncio-eventloop.rst:1671 +#: ../../library/asyncio-eventloop.rst:1698 msgid "" ":meth:`close` should be called before :meth:`close_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" -#: ../../library/asyncio-eventloop.rst:1678 +#: ../../library/asyncio-eventloop.rst:1705 msgid "" "Close all existing incoming client connections immediately, without waiting " "for pending operations to complete." msgstr "立即關閉所有現有的傳入客戶端連線,而不等待待定操作完成。" -#: ../../library/asyncio-eventloop.rst:1681 +#: ../../library/asyncio-eventloop.rst:1708 msgid "" "Calls :meth:`~asyncio.WriteTransport.abort` on all associated transports." msgstr "在所有關聯的傳輸上呼叫 :meth:`~asyncio.BaseTransport.close`。" -#: ../../library/asyncio-eventloop.rst:1684 +#: ../../library/asyncio-eventloop.rst:1711 msgid "" ":meth:`close` should be called before :meth:`abort_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" -#: ../../library/asyncio-eventloop.rst:1691 +#: ../../library/asyncio-eventloop.rst:1718 msgid "Return the event loop associated with the server object." msgstr "回傳與伺服器物件關聯的事件迴圈。" -#: ../../library/asyncio-eventloop.rst:1697 +#: ../../library/asyncio-eventloop.rst:1725 msgid "Start accepting connections." msgstr "開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1699 +#: ../../library/asyncio-eventloop.rst:1727 msgid "" "This method is idempotent, so it can be called when the server is already " "serving." msgstr "此方法是幂等的,因此可以在伺服器已經運行時呼叫。" -#: ../../library/asyncio-eventloop.rst:1702 +#: ../../library/asyncio-eventloop.rst:1730 msgid "" "The *start_serving* keyword-only parameter to :meth:`loop.create_server` " "and :meth:`asyncio.start_server` allows creating a Server object that is not " @@ -2597,19 +2589,19 @@ msgid "" "or :meth:`Server.serve_forever` can be used to make the Server start " "accepting connections." msgstr "" -"*start_serving* 僅限關鍵字參數只能在 :meth:`loop.create_server` " -"和 :meth:`asyncio.start_server` 中使用,允許建立一個最初不接受連線的 Server " -"物件。在這種情況下,可以使用 ``Server.start_serving()`` " -"或 :meth:`Server.serve_forever` 來使 Server 開始接受連線。" +"*start_serving* 僅限關鍵字參數只能在 :meth:`loop.create_server` 和 :meth:" +"`asyncio.start_server` 中使用,允許建立一個最初不接受連線的 Server 物件。在這" +"種情況下,可以使用 ``Server.start_serving()`` 或 :meth:`Server." +"serve_forever` 來使 Server 開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1713 +#: ../../library/asyncio-eventloop.rst:1742 msgid "" "Start accepting connections until the coroutine is cancelled. Cancellation " "of ``serve_forever`` task causes the server to be closed." msgstr "" "開始接受連線,直到協程被取消。取消 ``serve_forever`` 任務會導致伺服器關閉。" -#: ../../library/asyncio-eventloop.rst:1717 +#: ../../library/asyncio-eventloop.rst:1746 msgid "" "This method can be called if the server is already accepting connections. " "Only one ``serve_forever`` task can exist per one *Server* object." @@ -2617,7 +2609,7 @@ msgstr "" "如果伺服器已經接受連線,則可以呼叫此方法。每個 *Server* 物件只能存在一個 " "``serve_forever`` 任務。" -#: ../../library/asyncio-eventloop.rst:1723 +#: ../../library/asyncio-eventloop.rst:1752 msgid "" "async def client_connected(reader, writer):\n" " # Communicate with the client with\n" @@ -2643,24 +2635,24 @@ msgstr "" "\n" "asyncio.run(main('127.0.0.1', 0))" -#: ../../library/asyncio-eventloop.rst:1739 +#: ../../library/asyncio-eventloop.rst:1768 msgid "Return ``True`` if the server is accepting new connections." msgstr "如果伺服器正在接受新連線,則回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1745 +#: ../../library/asyncio-eventloop.rst:1775 msgid "" "Wait until the :meth:`close` method completes and all active connections " "have finished." msgstr "等待 :meth:`close` 方法完成且所有活動連線都已結束。" -#: ../../library/asyncio-eventloop.rst:1750 +#: ../../library/asyncio-eventloop.rst:1780 msgid "" "List of socket-like objects, ``asyncio.trsock.TransportSocket``, which the " "server is listening on." msgstr "" "伺服器正在監聽的類似 socket 的物件串列,``asyncio.trsock.TransportSocket``。" -#: ../../library/asyncio-eventloop.rst:1753 +#: ../../library/asyncio-eventloop.rst:1783 msgid "" "Prior to Python 3.7 ``Server.sockets`` used to return an internal list of " "server sockets directly. In 3.7 a copy of that list is returned." @@ -2668,29 +2660,29 @@ msgstr "" "在 Python 3.7 之前,``Server.sockets`` 曾經直接回傳內部伺服器 sockets 的串" "列。在 3.7 中回傳了該串列的副本。" -#: ../../library/asyncio-eventloop.rst:1763 +#: ../../library/asyncio-eventloop.rst:1793 msgid "Event Loop Implementations" msgstr "事件迴圈實作" -#: ../../library/asyncio-eventloop.rst:1765 +#: ../../library/asyncio-eventloop.rst:1795 msgid "" -"asyncio ships with two different event loop " -"implementations: :class:`SelectorEventLoop` and :class:`ProactorEventLoop`." +"asyncio ships with two different event loop implementations: :class:" +"`SelectorEventLoop` and :class:`ProactorEventLoop`." msgstr "" -"asyncio 內附兩個不同的事件迴圈實作::class:`SelectorEventLoop` " -"和 :class:`ProactorEventLoop`。" +"asyncio 內附兩個不同的事件迴圈實作::class:`SelectorEventLoop` 和 :class:" +"`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1768 +#: ../../library/asyncio-eventloop.rst:1798 msgid "By default asyncio is configured to use :class:`EventLoop`." msgstr "預設情況下,asyncio 被配置為要使用 :class:`EventLoop`。" -#: ../../library/asyncio-eventloop.rst:1773 +#: ../../library/asyncio-eventloop.rst:1803 msgid "" "A subclass of :class:`AbstractEventLoop` based on the :mod:`selectors` " "module." msgstr "基於 :mod:`selectors` 模組的一個 :class:`AbstractEventLoop` 子類別。" -#: ../../library/asyncio-eventloop.rst:1776 +#: ../../library/asyncio-eventloop.rst:1806 msgid "" "Uses the most efficient *selector* available for the given platform. It is " "also possible to manually configure the exact selector implementation to be " @@ -2699,7 +2691,7 @@ msgstr "" "使用特定平台上最有效的 *selector*。也可以手動配置要使用的確切 selector 實" "作: ::" -#: ../../library/asyncio-eventloop.rst:1780 +#: ../../library/asyncio-eventloop.rst:1810 msgid "" "import asyncio\n" "import selectors\n" @@ -2721,7 +2713,7 @@ msgstr "" "\n" "asyncio.set_event_loop_policy(MyPolicy())" -#: ../../library/asyncio-eventloop.rst:1796 +#: ../../library/asyncio-eventloop.rst:1826 msgid "" "A subclass of :class:`AbstractEventLoop` for Windows that uses \"I/O " "Completion Ports\" (IOCP)." @@ -2729,7 +2721,7 @@ msgstr "" "用於 Windows 的 :class:`AbstractEventLoop` 子類別,使用「I/O 完成埠 (IOCP, I/" "O Completion Ports)」。" -#: ../../library/asyncio-eventloop.rst:1802 +#: ../../library/asyncio-eventloop.rst:1832 msgid "" "`MSDN documentation on I/O Completion Ports `_." @@ -2737,25 +2729,25 @@ msgstr "" "`I/O 完成埠的 MSDN 文件 `_。" -#: ../../library/asyncio-eventloop.rst:1807 +#: ../../library/asyncio-eventloop.rst:1837 msgid "" -"An alias to the most efficient available subclass " -"of :class:`AbstractEventLoop` for the given platform." +"An alias to the most efficient available subclass of :class:" +"`AbstractEventLoop` for the given platform." msgstr "" -#: ../../library/asyncio-eventloop.rst:1810 +#: ../../library/asyncio-eventloop.rst:1840 msgid "" -"It is an alias to :class:`SelectorEventLoop` on Unix " -"and :class:`ProactorEventLoop` on Windows." +"It is an alias to :class:`SelectorEventLoop` on Unix and :class:" +"`ProactorEventLoop` on Windows." msgstr "" -"在 Unix 上是 :class:`SelectorEventLoop` 的別名,在 Windows 上" -"是 :class:`ProactorEventLoop` 的別名。" +"在 Unix 上是 :class:`SelectorEventLoop` 的別名,在 Windows 上是 :class:" +"`ProactorEventLoop` 的別名。" -#: ../../library/asyncio-eventloop.rst:1816 +#: ../../library/asyncio-eventloop.rst:1846 msgid "Abstract base class for asyncio-compliant event loops." msgstr "為符合 asyncio 標準的事件迴圈的抽象基礎類別。" -#: ../../library/asyncio-eventloop.rst:1818 +#: ../../library/asyncio-eventloop.rst:1848 msgid "" "The :ref:`asyncio-event-loop-methods` section lists all methods that an " "alternative implementation of ``AbstractEventLoop`` should have defined." @@ -2763,27 +2755,26 @@ msgstr "" ":ref:`asyncio-event-loop-methods` 部分列出了替代 ``AbstractEventLoop`` 實作應" "該定義的所有方法。" -#: ../../library/asyncio-eventloop.rst:1824 +#: ../../library/asyncio-eventloop.rst:1854 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-eventloop.rst:1826 +#: ../../library/asyncio-eventloop.rst:1856 msgid "" "Note that all examples in this section **purposefully** show how to use the " -"low-level event loop APIs, such as :meth:`loop.run_forever` " -"and :meth:`loop.call_soon`. Modern asyncio applications rarely need to be " -"written this way; consider using the high-level functions " -"like :func:`asyncio.run`." +"low-level event loop APIs, such as :meth:`loop.run_forever` and :meth:`loop." +"call_soon`. Modern asyncio applications rarely need to be written this way; " +"consider using the high-level functions like :func:`asyncio.run`." msgstr "" -"請注意,本節中的所有範例都 **故意** 展示如何使用低階事件迴圈 API," -"如 :meth:`loop.run_forever` 和 :meth:`loop.call_soon`。現代 asyncio 應用程式" -"很少需要這種方式撰寫;請考慮使用高階的函式,如 :func:`asyncio.run`。" +"請注意,本節中的所有範例都 **故意** 展示如何使用低階事件迴圈 API,如 :meth:" +"`loop.run_forever` 和 :meth:`loop.call_soon`。現代 asyncio 應用程式很少需要這" +"種方式撰寫;請考慮使用高階的函式,如 :func:`asyncio.run`。" -#: ../../library/asyncio-eventloop.rst:1836 +#: ../../library/asyncio-eventloop.rst:1866 msgid "Hello World with call_soon()" msgstr "使用 call_soon() 的 Hello World 範例" -#: ../../library/asyncio-eventloop.rst:1838 +#: ../../library/asyncio-eventloop.rst:1868 msgid "" "An example using the :meth:`loop.call_soon` method to schedule a callback. " "The callback displays ``\"Hello World\"`` and then stops the event loop::" @@ -2791,7 +2782,7 @@ msgstr "" "使用 :meth:`loop.call_soon` 方法排程回呼的範例。回呼會顯示 ``\"Hello " "World\"``,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1842 +#: ../../library/asyncio-eventloop.rst:1872 msgid "" "import asyncio\n" "\n" @@ -2829,18 +2820,18 @@ msgstr "" "finally:\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:1862 +#: ../../library/asyncio-eventloop.rst:1892 msgid "" "A similar :ref:`Hello World ` example created with a coroutine " "and the :func:`run` function." msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`Hello World ` 範例。" -#: ../../library/asyncio-eventloop.rst:1869 +#: ../../library/asyncio-eventloop.rst:1899 msgid "Display the current date with call_later()" msgstr "使用 call_later() 顯示目前日期" -#: ../../library/asyncio-eventloop.rst:1871 +#: ../../library/asyncio-eventloop.rst:1901 msgid "" "An example of a callback displaying the current date every second. The " "callback uses the :meth:`loop.call_later` method to reschedule itself after " @@ -2849,7 +2840,7 @@ msgstr "" "一個回呼的範例,每秒顯示目前日期。回呼使用 :meth:`loop.call_later` 方法在 5 " "秒後重新排程自己,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1875 +#: ../../library/asyncio-eventloop.rst:1905 msgid "" "import asyncio\n" "import datetime\n" @@ -2895,7 +2886,7 @@ msgstr "" "finally:\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:1899 +#: ../../library/asyncio-eventloop.rst:1929 msgid "" "A similar :ref:`current date ` example created with a " "coroutine and the :func:`run` function." @@ -2903,19 +2894,19 @@ msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`current date " "` 範例。" -#: ../../library/asyncio-eventloop.rst:1906 +#: ../../library/asyncio-eventloop.rst:1936 msgid "Watch a file descriptor for read events" msgstr "監聽檔案描述器以進行讀取事件" -#: ../../library/asyncio-eventloop.rst:1908 +#: ../../library/asyncio-eventloop.rst:1938 msgid "" -"Wait until a file descriptor received some data using " -"the :meth:`loop.add_reader` method and then close the event loop::" +"Wait until a file descriptor received some data using the :meth:`loop." +"add_reader` method and then close the event loop::" msgstr "" "使用 :meth:`loop.add_reader` 方法等待檔案描述器接收到某些資料,然後關閉事件迴" "圈: ::" -#: ../../library/asyncio-eventloop.rst:1911 +#: ../../library/asyncio-eventloop.rst:1941 msgid "" "import asyncio\n" "from socket import socketpair\n" @@ -2983,7 +2974,7 @@ msgstr "" " wsock.close()\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:1946 +#: ../../library/asyncio-eventloop.rst:1976 msgid "" "A similar :ref:`example ` using " "transports, protocols, and the :meth:`loop.create_connection` method." @@ -2991,7 +2982,7 @@ msgstr "" "使用傳輸、協定和 :meth:`loop.create_connection` 方法的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:1950 +#: ../../library/asyncio-eventloop.rst:1980 msgid "" "Another similar :ref:`example ` " "using the high-level :func:`asyncio.open_connection` function and streams." @@ -2999,24 +2990,23 @@ msgstr "" "另一個使用高階 :func:`asyncio.open_connection` 函式和串流的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:1958 +#: ../../library/asyncio-eventloop.rst:1988 msgid "Set signal handlers for SIGINT and SIGTERM" msgstr "設定 SIGINT 和 SIGTERM 的訊號處理程式" -#: ../../library/asyncio-eventloop.rst:1960 +#: ../../library/asyncio-eventloop.rst:1990 msgid "(This ``signals`` example only works on Unix.)" msgstr "(此 ``signals`` 範例僅在 Unix 上運作。)" -#: ../../library/asyncio-eventloop.rst:1962 +#: ../../library/asyncio-eventloop.rst:1992 msgid "" -"Register handlers for signals :const:`~signal.SIGINT` " -"and :const:`~signal.SIGTERM` using the :meth:`loop.add_signal_handler` " -"method::" +"Register handlers for signals :const:`~signal.SIGINT` and :const:`~signal." +"SIGTERM` using the :meth:`loop.add_signal_handler` method::" msgstr "" -"使用 :meth:`loop.add_signal_handler` 方法註冊訊號 :py:data:`SIGINT` " -"和 :py:data:`SIGTERM` 的處理程式: ::" +"使用 :meth:`loop.add_signal_handler` 方法註冊訊號 :py:data:`SIGINT` 和 :py:" +"data:`SIGTERM` 的處理程式: ::" -#: ../../library/asyncio-eventloop.rst:1965 +#: ../../library/asyncio-eventloop.rst:1995 msgid "" "import asyncio\n" "import functools\n" diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index effaeebec4..ad019f6311 100644 --- a/library/asyncio-queue.po +++ b/library/asyncio-queue.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-10 00:14+0000\n" +"POT-Creation-Date: 2025-02-23 00:15+0000\n" "PO-Revision-Date: 2022-02-20 18:34+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -39,8 +39,8 @@ msgstr "" #: ../../library/asyncio-queue.rst:17 msgid "" -"Note that methods of asyncio queues don't have a *timeout* parameter; " -"use :func:`asyncio.wait_for` function to do queue operations with a timeout." +"Note that methods of asyncio queues don't have a *timeout* parameter; use :" +"func:`asyncio.wait_for` function to do queue operations with a timeout." msgstr "" "注意 asyncio 的佇列沒有 *timeout* 參數;請使用 :func:`asyncio.wait_for` 函式" "來為佇列新增具有超時 (timeout) 設定的操作。" @@ -64,8 +64,8 @@ msgid "" "queue reaches *maxsize* until an item is removed by :meth:`get`." msgstr "" "如果 *maxsize* 小於或等於零,則佇列大小是無限制的。如果是大於 ``0`` 的整數," -"則當佇列達到 *maxsize* 時,``await put()`` 將會阻塞 (block),直到某個元素" -"被 :meth:`get` 取出。" +"則當佇列達到 *maxsize* 時,``await put()`` 將會阻塞 (block),直到某個元素被 :" +"meth:`get` 取出。" #: ../../library/asyncio-queue.rst:35 msgid "" @@ -97,47 +97,47 @@ msgstr "如果有 :attr:`maxsize` 個條目在佇列中,則回傳 ``True``。" #: ../../library/asyncio-queue.rst:57 msgid "" -"If the queue was initialized with ``maxsize=0`` (the default), " -"then :meth:`full` never returns ``True``." +"If the queue was initialized with ``maxsize=0`` (the default), then :meth:" +"`full` never returns ``True``." msgstr "" "如果佇列用 ``maxsize=0`` (預設)初始化,則 :meth:`full` 永遠不會回傳 " "``True``。" -#: ../../library/asyncio-queue.rst:62 +#: ../../library/asyncio-queue.rst:63 msgid "" "Remove and return an item from the queue. If queue is empty, wait until an " "item is available." msgstr "從佇列中刪除並回傳一個元素。如果佇列為空,則持續等待直到佇列中有元素。" -#: ../../library/asyncio-queue.rst:65 +#: ../../library/asyncio-queue.rst:66 msgid "" "Raises :exc:`QueueShutDown` if the queue has been shut down and is empty, or " "if the queue has been shut down immediately." msgstr "" -#: ../../library/asyncio-queue.rst:70 +#: ../../library/asyncio-queue.rst:71 msgid "" "Return an item if one is immediately available, else raise :exc:`QueueEmpty`." msgstr "如果佇列內有值則立即回傳佇列中的元素,否則引發 :exc:`QueueEmpty`。" -#: ../../library/asyncio-queue.rst:75 +#: ../../library/asyncio-queue.rst:77 msgid "Block until all items in the queue have been received and processed." msgstr "持續阻塞直到佇列中所有的元素都被接收和處理完畢。" -#: ../../library/asyncio-queue.rst:77 +#: ../../library/asyncio-queue.rst:79 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " -"queue. The count goes down whenever a consumer coroutine " -"calls :meth:`task_done` to indicate that the item was retrieved and all work " -"on it is complete. When the count of unfinished tasks drops to " -"zero, :meth:`join` unblocks." +"queue. The count goes down whenever a consumer coroutine calls :meth:" +"`task_done` to indicate that the item was retrieved and all work on it is " +"complete. When the count of unfinished tasks drops to zero, :meth:`join` " +"unblocks." msgstr "" "當條目新增到佇列的時候,未完成任務的計數就會增加。每當一個消耗者 (consumer) " "協程呼叫 :meth:`task_done`,表示這個條目已經被取回且被它包含的所有工作都已完" "成,未完成任務計數就會減少。當未完成計數降到零的時候,:meth:`join` 阻塞會被解" "除 (unblock)。" -#: ../../library/asyncio-queue.rst:85 +#: ../../library/asyncio-queue.rst:88 msgid "" "Put an item into the queue. If the queue is full, wait until a free slot is " "available before adding the item." @@ -145,57 +145,57 @@ msgstr "" "將一個元素放進佇列。如果佇列滿了,在新增元素之前,會持續等待直到有空閒插槽 " "(free slot) 能被使用。" -#: ../../library/asyncio-queue.rst:88 +#: ../../library/asyncio-queue.rst:91 msgid "Raises :exc:`QueueShutDown` if the queue has been shut down." msgstr "如果佇列已經被關閉,則引發 :exc:`QueueShutDown`。" -#: ../../library/asyncio-queue.rst:92 +#: ../../library/asyncio-queue.rst:95 msgid "Put an item into the queue without blocking." msgstr "不阻塞地將一個元素放入佇列。" -#: ../../library/asyncio-queue.rst:94 +#: ../../library/asyncio-queue.rst:97 msgid "If no free slot is immediately available, raise :exc:`QueueFull`." msgstr "如果沒有立即可用的空閒插槽,引發 :exc:`QueueFull`。" -#: ../../library/asyncio-queue.rst:98 +#: ../../library/asyncio-queue.rst:101 msgid "Return the number of items in the queue." msgstr "回傳佇列中的元素數量。" -#: ../../library/asyncio-queue.rst:102 +#: ../../library/asyncio-queue.rst:105 msgid "" -"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` " -"raise :exc:`QueueShutDown`." +"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` raise :" +"exc:`QueueShutDown`." msgstr "" -#: ../../library/asyncio-queue.rst:105 +#: ../../library/asyncio-queue.rst:108 msgid "" "By default, :meth:`~Queue.get` on a shut down queue will only raise once the " "queue is empty. Set *immediate* to true to make :meth:`~Queue.get` raise " "immediately instead." msgstr "" -#: ../../library/asyncio-queue.rst:109 +#: ../../library/asyncio-queue.rst:112 msgid "" "All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be " "unblocked. If *immediate* is true, a task will be marked as done for each " -"remaining item in the queue, which may unblock callers " -"of :meth:`~Queue.join`." +"remaining item in the queue, which may unblock callers of :meth:`~Queue." +"join`." msgstr "" -#: ../../library/asyncio-queue.rst:118 +#: ../../library/asyncio-queue.rst:121 msgid "Indicate that a formerly enqueued work item is complete." msgstr "表示前面一個排隊的工作項目已經完成。" -#: ../../library/asyncio-queue.rst:120 +#: ../../library/asyncio-queue.rst:123 msgid "" "Used by queue consumers. For each :meth:`~Queue.get` used to fetch a work " "item, a subsequent call to :meth:`task_done` tells the queue that the " "processing on the work item is complete." msgstr "" -"由佇列消耗者使用。對於每個用於獲取一個工作項目的 :meth:`~Queue.get`,接續" -"的 :meth:`task_done` 呼叫會告訴佇列這個工作項目的處理已經完成。" +"由佇列消耗者使用。對於每個用於獲取一個工作項目的 :meth:`~Queue.get`,接續的 :" +"meth:`task_done` 呼叫會告訴佇列這個工作項目的處理已經完成。" -#: ../../library/asyncio-queue.rst:124 +#: ../../library/asyncio-queue.rst:127 msgid "" "If a :meth:`join` is currently blocking, it will resume when all items have " "been processed (meaning that a :meth:`task_done` call was received for every " @@ -204,53 +204,53 @@ msgstr "" "如果 :meth:`join` 當前正在阻塞,在所有項目都被處理後會解除阻塞(意味著每個" "以 :meth:`~Queue.put` 放進佇列的條目都會收到一個 :meth:`task_done`)。" -#: ../../library/asyncio-queue.rst:129 +#: ../../library/asyncio-queue.rst:132 msgid "" "``shutdown(immediate=True)`` calls :meth:`task_done` for each remaining item " "in the queue." msgstr "" -#: ../../library/asyncio-queue.rst:132 +#: ../../library/asyncio-queue.rst:135 msgid "" "Raises :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "如果被呼叫的次數多於放入佇列中的項目數量,將引發 :exc:`ValueError`。" -#: ../../library/asyncio-queue.rst:137 +#: ../../library/asyncio-queue.rst:140 msgid "Priority Queue" msgstr "Priority Queue(優先佇列)" -#: ../../library/asyncio-queue.rst:141 +#: ../../library/asyncio-queue.rst:144 msgid "" "A variant of :class:`Queue`; retrieves entries in priority order (lowest " "first)." msgstr ":class:`Queue` 的變形;按優先順序取出條目 (最小的先取出)。" -#: ../../library/asyncio-queue.rst:144 +#: ../../library/asyncio-queue.rst:147 msgid "Entries are typically tuples of the form ``(priority_number, data)``." msgstr "條目通常是 ``(priority_number, data)`` 形式的 tuple(元組)。" -#: ../../library/asyncio-queue.rst:149 +#: ../../library/asyncio-queue.rst:152 msgid "LIFO Queue" msgstr "LIFO Queue" -#: ../../library/asyncio-queue.rst:153 +#: ../../library/asyncio-queue.rst:156 msgid "" "A variant of :class:`Queue` that retrieves most recently added entries first " "(last in, first out)." msgstr ":class:`Queue` 的變形,先取出最近新增的條目(後進先出)。" -#: ../../library/asyncio-queue.rst:158 +#: ../../library/asyncio-queue.rst:161 msgid "Exceptions" msgstr "例外" -#: ../../library/asyncio-queue.rst:162 +#: ../../library/asyncio-queue.rst:165 msgid "" "This exception is raised when the :meth:`~Queue.get_nowait` method is called " "on an empty queue." msgstr "當佇列為空的時候,呼叫 :meth:`~Queue.get_nowait` 方法會引發這個例外。" -#: ../../library/asyncio-queue.rst:168 +#: ../../library/asyncio-queue.rst:171 msgid "" "Exception raised when the :meth:`~Queue.put_nowait` method is called on a " "queue that has reached its *maxsize*." @@ -258,22 +258,22 @@ msgstr "" "當佇列中條目數量已經達到它的 *maxsize* 時,呼叫 :meth:`~Queue.put_nowait` 方" "法會引發這個例外。" -#: ../../library/asyncio-queue.rst:174 +#: ../../library/asyncio-queue.rst:177 msgid "" "Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on " "a queue which has been shut down." msgstr "" -#: ../../library/asyncio-queue.rst:181 +#: ../../library/asyncio-queue.rst:184 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-queue.rst:185 +#: ../../library/asyncio-queue.rst:188 msgid "" "Queues can be used to distribute workload between several concurrent tasks::" msgstr "佇列能被用於多個並行任務的工作分配:" -#: ../../library/asyncio-queue.rst:188 +#: ../../library/asyncio-queue.rst:191 msgid "" "import asyncio\n" "import random\n" diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index f4ca808ca4..bcc0854d76 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-25 00:14+0000\n" +"POT-Creation-Date: 2025-02-23 00:15+0000\n" "PO-Revision-Date: 2022-10-31 16:28+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,7 +42,7 @@ msgstr "" msgid "Here is an example of a TCP echo client written using asyncio streams::" msgstr "這是一個使用 asyncio 串流編寫的 TCP echo 客戶端範例: ::" -#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:419 +#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:430 msgid "" "import asyncio\n" "\n" @@ -96,13 +96,13 @@ msgid "" "with streams:" msgstr "下面的高階 asyncio 函式可以用來建立和處理串流:" -#: ../../library/asyncio-stream.rst:58 +#: ../../library/asyncio-stream.rst:59 msgid "" "Establish a network connection and return a pair of ``(reader, writer)`` " "objects." msgstr "建立網路連線並回傳一對 ``(reader, writer)`` 物件。" -#: ../../library/asyncio-stream.rst:61 +#: ../../library/asyncio-stream.rst:62 msgid "" "The returned *reader* and *writer* objects are instances of :class:" "`StreamReader` and :class:`StreamWriter` classes." @@ -110,7 +110,7 @@ msgstr "" "回傳的 *reader* 和 *writer* 物件是 :class:`StreamReader` 和 :class:" "`StreamWriter` 類別的實例。" -#: ../../library/asyncio-stream.rst:64 ../../library/asyncio-stream.rst:110 +#: ../../library/asyncio-stream.rst:65 ../../library/asyncio-stream.rst:112 msgid "" "*limit* determines the buffer size limit used by the returned :class:" "`StreamReader` instance. By default the *limit* is set to 64 KiB." @@ -118,43 +118,43 @@ msgstr "" "*limit* 指定了回傳的 :class:`StreamReader` 實例所使用的緩衝區 (buffer) 大小限" "制。*limit* 預設為 64 KiB。" -#: ../../library/asyncio-stream.rst:68 +#: ../../library/asyncio-stream.rst:69 msgid "" "The rest of the arguments are passed directly to :meth:`loop." "create_connection`." msgstr "其餘的引數會直接傳遞到 :meth:`loop.create_connection`。" -#: ../../library/asyncio-stream.rst:73 ../../library/asyncio-stream.rst:151 +#: ../../library/asyncio-stream.rst:74 ../../library/asyncio-stream.rst:154 msgid "" "The *sock* argument transfers ownership of the socket to the :class:" "`StreamWriter` created. To close the socket, call its :meth:`~asyncio." "StreamWriter.close` method." msgstr "" -#: ../../library/asyncio-stream.rst:77 +#: ../../library/asyncio-stream.rst:78 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "新增 *ssl_handshake_timeout* 參數。" -#: ../../library/asyncio-stream.rst:80 +#: ../../library/asyncio-stream.rst:81 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "新增 *happy_eyeballs_delay* 和 *interleave* 參數。" -#: ../../library/asyncio-stream.rst:83 ../../library/asyncio-stream.rst:126 -#: ../../library/asyncio-stream.rst:161 ../../library/asyncio-stream.rst:191 +#: ../../library/asyncio-stream.rst:84 ../../library/asyncio-stream.rst:128 +#: ../../library/asyncio-stream.rst:164 ../../library/asyncio-stream.rst:195 msgid "Removed the *loop* parameter." msgstr "移除 *loop* 參數。" -#: ../../library/asyncio-stream.rst:86 ../../library/asyncio-stream.rst:129 -#: ../../library/asyncio-stream.rst:164 ../../library/asyncio-stream.rst:194 -#: ../../library/asyncio-stream.rst:387 +#: ../../library/asyncio-stream.rst:87 ../../library/asyncio-stream.rst:131 +#: ../../library/asyncio-stream.rst:167 ../../library/asyncio-stream.rst:198 +#: ../../library/asyncio-stream.rst:397 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "新增 *ssl_shutdown_timeout* 參數。" -#: ../../library/asyncio-stream.rst:99 +#: ../../library/asyncio-stream.rst:101 msgid "Start a socket server." msgstr "啟動 socket 伺服器。" -#: ../../library/asyncio-stream.rst:101 +#: ../../library/asyncio-stream.rst:103 msgid "" "The *client_connected_cb* callback is called whenever a new client " "connection is established. It receives a ``(reader, writer)`` pair as two " @@ -165,7 +165,7 @@ msgstr "" "式會接收到一對引數 ``(reader, writer)``,分別為 :class:`StreamReader` 和 :" "class:`StreamWriter` 的實例。" -#: ../../library/asyncio-stream.rst:106 +#: ../../library/asyncio-stream.rst:108 msgid "" "*client_connected_cb* can be a plain callable or a :ref:`coroutine function " "`; if it is a coroutine function, it will be automatically " @@ -175,47 +175,47 @@ msgstr "" "ref:`協程函式 `;如果它是一個協程函式,它將自動作為 :class:`Task` " "來被排程。" -#: ../../library/asyncio-stream.rst:114 +#: ../../library/asyncio-stream.rst:116 msgid "" "The rest of the arguments are passed directly to :meth:`loop.create_server`." msgstr "剩下的引數將會直接傳遞給 :meth:`loop.create_server`。" -#: ../../library/asyncio-stream.rst:119 ../../library/asyncio-stream.rst:181 +#: ../../library/asyncio-stream.rst:121 ../../library/asyncio-stream.rst:185 msgid "" "The *sock* argument transfers ownership of the socket to the server created. " "To close the socket, call the server's :meth:`~asyncio.Server.close` method." msgstr "" -#: ../../library/asyncio-stream.rst:123 +#: ../../library/asyncio-stream.rst:125 msgid "Added the *ssl_handshake_timeout* and *start_serving* parameters." msgstr "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。" -#: ../../library/asyncio-stream.rst:132 +#: ../../library/asyncio-stream.rst:134 msgid "Added the *keep_alive* parameter." msgstr "新增 *keep_alive* 參數。" -#: ../../library/asyncio-stream.rst:137 +#: ../../library/asyncio-stream.rst:139 msgid "Unix Sockets" msgstr "Unix Sockets" -#: ../../library/asyncio-stream.rst:142 +#: ../../library/asyncio-stream.rst:145 msgid "" "Establish a Unix socket connection and return a pair of ``(reader, writer)``." msgstr "建立一個 Unix socket 連線並回傳一對 ``(reader, writer)``。" -#: ../../library/asyncio-stream.rst:145 +#: ../../library/asyncio-stream.rst:148 msgid "Similar to :func:`open_connection` but operates on Unix sockets." msgstr "與 :func:`open_connection` 相似,但是是操作 Unix sockets。" -#: ../../library/asyncio-stream.rst:147 +#: ../../library/asyncio-stream.rst:150 msgid "See also the documentation of :meth:`loop.create_unix_connection`." msgstr "另請參閱 :meth:`loop.create_unix_connection` 文件。" -#: ../../library/asyncio-stream.rst:155 ../../library/asyncio-stream.rst:185 +#: ../../library/asyncio-stream.rst:158 ../../library/asyncio-stream.rst:189 msgid "Availability" msgstr "" -#: ../../library/asyncio-stream.rst:157 +#: ../../library/asyncio-stream.rst:160 msgid "" "Added the *ssl_handshake_timeout* parameter. The *path* parameter can now be " "a :term:`path-like object`" @@ -223,19 +223,19 @@ msgstr "" "新增 *ssl_handshake_timeout* 參數。*path* 參數現在可以是個 :term:`path-like " "object`" -#: ../../library/asyncio-stream.rst:173 +#: ../../library/asyncio-stream.rst:177 msgid "Start a Unix socket server." msgstr "啟動一個 Unix socket 伺服器。" -#: ../../library/asyncio-stream.rst:175 +#: ../../library/asyncio-stream.rst:179 msgid "Similar to :func:`start_server` but works with Unix sockets." msgstr "與 :func:`start_server` 相似,但會是操作 Unix sockets。" -#: ../../library/asyncio-stream.rst:177 +#: ../../library/asyncio-stream.rst:181 msgid "See also the documentation of :meth:`loop.create_unix_server`." msgstr "另請參閱 :meth:`loop.create_unix_server` 文件。" -#: ../../library/asyncio-stream.rst:187 +#: ../../library/asyncio-stream.rst:191 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :term:`path-like object`." @@ -243,11 +243,11 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。*path* 參數現在可以是" "個 :term:`path-like object`。" -#: ../../library/asyncio-stream.rst:199 +#: ../../library/asyncio-stream.rst:203 msgid "StreamReader" msgstr "StreamReader" -#: ../../library/asyncio-stream.rst:203 +#: ../../library/asyncio-stream.rst:207 msgid "" "Represents a reader object that provides APIs to read data from the IO " "stream. As an :term:`asynchronous iterable`, the object supports the :" @@ -256,7 +256,7 @@ msgstr "" "表示一個有提供 API 來從 IO 串流中讀取資料的 reader 物件。作為一個 :term:" "`asynchronous iterable`,此物件支援 :keyword:`async for` 陳述式。" -#: ../../library/asyncio-stream.rst:207 +#: ../../library/asyncio-stream.rst:211 msgid "" "It is not recommended to instantiate *StreamReader* objects directly; use :" "func:`open_connection` and :func:`start_server` instead." @@ -264,15 +264,15 @@ msgstr "" "不建議直接實例化 *StreamReader* 物件;使用 :func:`open_connection` 和 :func:" "`start_server` 會是較好的做法。" -#: ../../library/asyncio-stream.rst:213 +#: ../../library/asyncio-stream.rst:217 msgid "Acknowledge the EOF." msgstr "" -#: ../../library/asyncio-stream.rst:217 +#: ../../library/asyncio-stream.rst:222 msgid "Read up to *n* bytes from the stream." msgstr "從串流中讀取至多 *n* 個位元組的資料。" -#: ../../library/asyncio-stream.rst:219 +#: ../../library/asyncio-stream.rst:224 msgid "" "If *n* is not provided or set to ``-1``, read until EOF, then return all " "read :class:`bytes`. If EOF was received and the internal buffer is empty, " @@ -282,39 +282,39 @@ msgstr "" "的 :class:`bytes`。讀取到 EOF 且內部緩衝區是空的,則回傳一個空的 ``bytes`` 物" "件。" -#: ../../library/asyncio-stream.rst:224 +#: ../../library/asyncio-stream.rst:229 msgid "If *n* is ``0``, return an empty ``bytes`` object immediately." msgstr "如果 *n* 為 ``0``,則立即回傳一個空的 ``bytes`` 物件。" -#: ../../library/asyncio-stream.rst:226 +#: ../../library/asyncio-stream.rst:231 msgid "" "If *n* is positive, return at most *n* available ``bytes`` as soon as at " "least 1 byte is available in the internal buffer. If EOF is received before " "any byte is read, return an empty ``bytes`` object." msgstr "" -#: ../../library/asyncio-stream.rst:233 +#: ../../library/asyncio-stream.rst:239 msgid "" "Read one line, where \"line\" is a sequence of bytes ending with ``\\n``." msgstr "讀取一行,其中\"行\"指的是以 ``\\n`` 結尾的位元組序列。" -#: ../../library/asyncio-stream.rst:236 +#: ../../library/asyncio-stream.rst:242 msgid "" "If EOF is received and ``\\n`` was not found, the method returns partially " "read data." msgstr "如果讀取到 EOF 而沒有找到 ``\\n``,該方法會回傳部分的已讀取資料。" -#: ../../library/asyncio-stream.rst:239 +#: ../../library/asyncio-stream.rst:245 msgid "" "If EOF is received and the internal buffer is empty, return an empty " "``bytes`` object." msgstr "如果讀取到 EOF 且內部緩衝區是空的,則回傳一個空的 ``bytes`` 物件。" -#: ../../library/asyncio-stream.rst:244 +#: ../../library/asyncio-stream.rst:251 msgid "Read exactly *n* bytes." msgstr "讀取剛好 *n* 個位元組。" -#: ../../library/asyncio-stream.rst:246 +#: ../../library/asyncio-stream.rst:253 msgid "" "Raise an :exc:`IncompleteReadError` if EOF is reached before *n* can be " "read. Use the :attr:`IncompleteReadError.partial` attribute to get the " @@ -324,11 +324,11 @@ msgstr "" "`IncompleteReadError`。使用 :attr:`IncompleteReadError.partial` 屬性來獲取串" "流結束前已讀取的部分資料。" -#: ../../library/asyncio-stream.rst:252 +#: ../../library/asyncio-stream.rst:260 msgid "Read data from the stream until *separator* is found." msgstr "從串流中持續讀取資料直到出現 *separator*。" -#: ../../library/asyncio-stream.rst:254 +#: ../../library/asyncio-stream.rst:262 msgid "" "On success, the data and separator will be removed from the internal buffer " "(consumed). Returned data will include the separator at the end." @@ -336,7 +336,7 @@ msgstr "" "成功後,資料和 separator(分隔符號)會從內部緩衝區中刪除(或者說是被消費掉 " "(consumed))。回傳的資料在末尾會有一個 separator。" -#: ../../library/asyncio-stream.rst:258 +#: ../../library/asyncio-stream.rst:266 msgid "" "If the amount of data read exceeds the configured stream limit, a :exc:" "`LimitOverrunError` exception is raised, and the data is left in the " @@ -345,7 +345,7 @@ msgstr "" "如果讀取的資料量超過了設定的串流限制,將會引發 :exc:`LimitOverrunError` 例" "外,資料將被留在內部緩衝區中,並可以再次被讀取。" -#: ../../library/asyncio-stream.rst:262 +#: ../../library/asyncio-stream.rst:270 msgid "" "If EOF is reached before the complete separator is found, an :exc:" "`IncompleteReadError` exception is raised, and the internal buffer is " @@ -356,7 +356,7 @@ msgstr "" "`IncompleteReadError` 例外,且內部緩衝區會被重置。:attr:`IncompleteReadError." "partial` 屬性可能包含一部分的 separator。" -#: ../../library/asyncio-stream.rst:267 +#: ../../library/asyncio-stream.rst:275 msgid "" "The *separator* may also be a tuple of separators. In this case the return " "value will be the shortest possible that has any separator as the suffix. " @@ -364,24 +364,24 @@ msgid "" "separator is considered to be the one that matched." msgstr "" -#: ../../library/asyncio-stream.rst:277 +#: ../../library/asyncio-stream.rst:285 msgid "The *separator* parameter may now be a :class:`tuple` of separators." msgstr "現在 *separator* 參數可以是一個分隔符號的 :class:`tuple`。" -#: ../../library/asyncio-stream.rst:282 +#: ../../library/asyncio-stream.rst:290 msgid "Return ``True`` if the buffer is empty and :meth:`feed_eof` was called." msgstr "如果緩衝區是空的且 :meth:`feed_eof` 曾被呼叫則回傳 ``True``。" -#: ../../library/asyncio-stream.rst:287 +#: ../../library/asyncio-stream.rst:295 msgid "StreamWriter" msgstr "StreamWriter" -#: ../../library/asyncio-stream.rst:291 +#: ../../library/asyncio-stream.rst:299 msgid "" "Represents a writer object that provides APIs to write data to the IO stream." msgstr "表示一個有提供 API 來將資料寫入 IO 串流的 writer 物件。" -#: ../../library/asyncio-stream.rst:294 +#: ../../library/asyncio-stream.rst:302 msgid "" "It is not recommended to instantiate *StreamWriter* objects directly; use :" "func:`open_connection` and :func:`start_server` instead." @@ -389,7 +389,7 @@ msgstr "" "不建議直接實例化 *StreamWriter* 物件;使用 :func:`open_connection` 和 :func:" "`start_server` 會是較好的做法。" -#: ../../library/asyncio-stream.rst:300 +#: ../../library/asyncio-stream.rst:308 msgid "" "The method attempts to write the *data* to the underlying socket " "immediately. If that fails, the data is queued in an internal write buffer " @@ -398,11 +398,11 @@ msgstr "" "此方法會嘗試立即將 *data* 寫入到底層的 socket。如果失敗,資料會被放到內部寫入" "緩衝中排隊等待 (queue),直到它可被發送。" -#: ../../library/asyncio-stream.rst:304 ../../library/asyncio-stream.rst:316 +#: ../../library/asyncio-stream.rst:312 ../../library/asyncio-stream.rst:324 msgid "The method should be used along with the ``drain()`` method::" msgstr "此方法應當與 ``drain()`` 方法一起使用: ::" -#: ../../library/asyncio-stream.rst:306 +#: ../../library/asyncio-stream.rst:314 msgid "" "stream.write(data)\n" "await stream.drain()" @@ -410,7 +410,7 @@ msgstr "" "stream.write(data)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:311 +#: ../../library/asyncio-stream.rst:319 msgid "" "The method writes a list (or any iterable) of bytes to the underlying socket " "immediately. If that fails, the data is queued in an internal write buffer " @@ -419,7 +419,7 @@ msgstr "" "此方法會立即嘗試將一個位元組 list(或任何可疊代物件 (iterable))寫入到底層的 " "socket。如果失敗,資料會被放到內部寫入緩衝中排隊等待,直到它可被發送。" -#: ../../library/asyncio-stream.rst:318 +#: ../../library/asyncio-stream.rst:326 msgid "" "stream.writelines(lines)\n" "await stream.drain()" @@ -427,17 +427,17 @@ msgstr "" "stream.writelines(lines)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:323 +#: ../../library/asyncio-stream.rst:331 msgid "The method closes the stream and the underlying socket." msgstr "此方法會關閉串流以及底層的 socket。" -#: ../../library/asyncio-stream.rst:325 +#: ../../library/asyncio-stream.rst:333 msgid "" "The method should be used, though not mandatory, along with the " "``wait_closed()`` method::" msgstr "此方法應與 ``wait_closed()`` 方法一起使用,但並非強制: ::" -#: ../../library/asyncio-stream.rst:328 +#: ../../library/asyncio-stream.rst:336 msgid "" "stream.close()\n" "await stream.wait_closed()" @@ -445,7 +445,7 @@ msgstr "" "stream.close()\n" "await stream.wait_closed()" -#: ../../library/asyncio-stream.rst:333 +#: ../../library/asyncio-stream.rst:341 msgid "" "Return ``True`` if the underlying transport supports the :meth:`write_eof` " "method, ``False`` otherwise." @@ -453,26 +453,26 @@ msgstr "" "如果底層的傳輸支援 :meth:`write_eof` 方法就回傳 ``True``,否則回傳 " "``False``。" -#: ../../library/asyncio-stream.rst:338 +#: ../../library/asyncio-stream.rst:346 msgid "" "Close the write end of the stream after the buffered write data is flushed." msgstr "在已緩衝的寫入資料被清理 (flush) 後關閉串流的寫入端。" -#: ../../library/asyncio-stream.rst:343 +#: ../../library/asyncio-stream.rst:351 msgid "Return the underlying asyncio transport." msgstr "回傳底層的 asyncio 傳輸。" -#: ../../library/asyncio-stream.rst:347 +#: ../../library/asyncio-stream.rst:355 msgid "" "Access optional transport information; see :meth:`BaseTransport." "get_extra_info` for details." msgstr "存取可選的傳輸資訊;詳情請見 :meth:`BaseTransport.get_extra_info`。" -#: ../../library/asyncio-stream.rst:352 +#: ../../library/asyncio-stream.rst:361 msgid "Wait until it is appropriate to resume writing to the stream. Example::" msgstr "等待直到可以繼續寫入到串流。範例: ::" -#: ../../library/asyncio-stream.rst:355 +#: ../../library/asyncio-stream.rst:364 msgid "" "writer.write(data)\n" "await writer.drain()" @@ -480,7 +480,7 @@ msgstr "" "writer.write(data)\n" "await writer.drain()" -#: ../../library/asyncio-stream.rst:358 +#: ../../library/asyncio-stream.rst:367 msgid "" "This is a flow control method that interacts with the underlying IO write " "buffer. When the size of the buffer reaches the high watermark, *drain()* " @@ -492,48 +492,48 @@ msgstr "" "(high watermark) 時,*drain()* 會阻塞直到緩衝區大小減少至最低標記位 (low " "watermark) 以便繼續寫入。當沒有要等待的資料時,:meth:`drain` 會立即回傳。" -#: ../../library/asyncio-stream.rst:368 +#: ../../library/asyncio-stream.rst:378 msgid "Upgrade an existing stream-based connection to TLS." msgstr "將現有的基於串流的連線升級到 TLS。" -#: ../../library/asyncio-stream.rst:370 +#: ../../library/asyncio-stream.rst:380 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-stream.rst:372 +#: ../../library/asyncio-stream.rst:382 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "*sslcontext*:一個 :class:`~ssl.SSLContext` 的已配置實例。" -#: ../../library/asyncio-stream.rst:374 +#: ../../library/asyncio-stream.rst:384 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "*server_hostname*:設定或覆寫將會被目標伺服器憑證比對的主機名稱。" -#: ../../library/asyncio-stream.rst:377 +#: ../../library/asyncio-stream.rst:387 msgid "" "*ssl_handshake_timeout* is the time in seconds to wait for the TLS handshake " "to complete before aborting the connection. ``60.0`` seconds if ``None`` " "(default)." msgstr "" -#: ../../library/asyncio-stream.rst:381 +#: ../../library/asyncio-stream.rst:391 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " "(default)." msgstr "" -#: ../../library/asyncio-stream.rst:393 +#: ../../library/asyncio-stream.rst:403 msgid "" "Return ``True`` if the stream is closed or in the process of being closed." msgstr "如果串流已被關閉或正在被關閉則回傳 ``True``。" -#: ../../library/asyncio-stream.rst:400 +#: ../../library/asyncio-stream.rst:411 msgid "Wait until the stream is closed." msgstr "等待直到串流被關閉。" -#: ../../library/asyncio-stream.rst:402 +#: ../../library/asyncio-stream.rst:413 msgid "" "Should be called after :meth:`close` to wait until the underlying connection " "is closed, ensuring that all data has been flushed before e.g. exiting the " @@ -542,19 +542,19 @@ msgstr "" "應當在 :meth:`close` 之後才被呼叫,這會持續等待直到底層的連線被關閉,以確保在" "這之前(例如在程式退出前)所有資料都已經被清空" -#: ../../library/asyncio-stream.rst:410 +#: ../../library/asyncio-stream.rst:421 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-stream.rst:415 +#: ../../library/asyncio-stream.rst:426 msgid "TCP echo client using streams" msgstr "使用串流的 TCP echo 客戶端" -#: ../../library/asyncio-stream.rst:417 +#: ../../library/asyncio-stream.rst:428 msgid "TCP echo client using the :func:`asyncio.open_connection` function::" msgstr "使用 :func:`asyncio.open_connection` 函式的 TCP echo 客戶端: ::" -#: ../../library/asyncio-stream.rst:441 +#: ../../library/asyncio-stream.rst:452 msgid "" "The :ref:`TCP echo client protocol " "` example uses the low-level :meth:" @@ -563,15 +563,15 @@ msgstr "" "使用低階 :meth:`loop.create_connection` 方法的 :ref:`TCP echo 客戶端協定 " "`\\ 範例。" -#: ../../library/asyncio-stream.rst:448 +#: ../../library/asyncio-stream.rst:459 msgid "TCP echo server using streams" msgstr "使用串流的 TCP echo 伺服器" -#: ../../library/asyncio-stream.rst:450 +#: ../../library/asyncio-stream.rst:461 msgid "TCP echo server using the :func:`asyncio.start_server` function::" msgstr "TCP echo 伺服器使用 :func:`asyncio.start_server` 函式: ::" -#: ../../library/asyncio-stream.rst:452 +#: ../../library/asyncio-stream.rst:463 msgid "" "import asyncio\n" "\n" @@ -631,7 +631,7 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../library/asyncio-stream.rst:484 +#: ../../library/asyncio-stream.rst:495 msgid "" "The :ref:`TCP echo server protocol " "` example uses the :meth:`loop." @@ -640,16 +640,16 @@ msgstr "" "使用 :meth:`loop.create_server` 方法的 :ref:`TCP echo 伺服器協定 " "` 範例。" -#: ../../library/asyncio-stream.rst:489 +#: ../../library/asyncio-stream.rst:500 msgid "Get HTTP headers" msgstr "獲取 HTTP 標頭" -#: ../../library/asyncio-stream.rst:491 +#: ../../library/asyncio-stream.rst:502 msgid "" "Simple example querying HTTP headers of the URL passed on the command line::" msgstr "查詢自命令列傳入之 URL 所帶有 HTTP 標頭的簡單範例: ::" -#: ../../library/asyncio-stream.rst:493 +#: ../../library/asyncio-stream.rst:504 msgid "" "import asyncio\n" "import urllib.parse\n" @@ -688,34 +688,34 @@ msgid "" "asyncio.run(print_http_headers(url))" msgstr "" -#: ../../library/asyncio-stream.rst:530 +#: ../../library/asyncio-stream.rst:541 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-stream.rst:532 +#: ../../library/asyncio-stream.rst:543 msgid "python example.py http://example.com/path/page.html" msgstr "python example.py http://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:534 +#: ../../library/asyncio-stream.rst:545 msgid "or with HTTPS::" msgstr "或使用 HTTPS: ::" -#: ../../library/asyncio-stream.rst:536 +#: ../../library/asyncio-stream.rst:547 msgid "python example.py https://example.com/path/page.html" msgstr "python example.py https://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:542 +#: ../../library/asyncio-stream.rst:553 msgid "Register an open socket to wait for data using streams" msgstr "註冊一個使用串流來等待資料的開放 socket" -#: ../../library/asyncio-stream.rst:544 +#: ../../library/asyncio-stream.rst:555 msgid "" "Coroutine waiting until a socket receives data using the :func:" "`open_connection` function::" msgstr "" "等待直到 socket 透過使用 :func:`open_connection` 函式接收到資料的協程: ::" -#: ../../library/asyncio-stream.rst:547 +#: ../../library/asyncio-stream.rst:558 msgid "" "import asyncio\n" "import socket\n" @@ -748,7 +748,7 @@ msgid "" "asyncio.run(wait_for_data())" msgstr "" -#: ../../library/asyncio-stream.rst:579 +#: ../../library/asyncio-stream.rst:590 msgid "" "The :ref:`register an open socket to wait for data using a protocol " "` example uses a low-level protocol and " @@ -758,7 +758,7 @@ msgstr "" "`\\ 範例中,有使用了低階協定以及 :meth:" "`loop.create_connection` 方法。" -#: ../../library/asyncio-stream.rst:583 +#: ../../library/asyncio-stream.rst:594 msgid "" "The :ref:`watch a file descriptor for read events " "` example uses the low-level :meth:`loop." diff --git a/library/asyncio-subprocess.po b/library/asyncio-subprocess.po index a3ffe6d7bf..8669d045c3 100644 --- a/library/asyncio-subprocess.po +++ b/library/asyncio-subprocess.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-03-12 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -127,43 +127,44 @@ msgstr "另請參閱\\ `Examples`_。" msgid "Creating Subprocesses" msgstr "建立子行程" -#: ../../library/asyncio-subprocess.rst:67 +#: ../../library/asyncio-subprocess.rst:68 msgid "Create a subprocess." msgstr "" -#: ../../library/asyncio-subprocess.rst:69 -#: ../../library/asyncio-subprocess.rst:87 +#: ../../library/asyncio-subprocess.rst:70 +#: ../../library/asyncio-subprocess.rst:89 msgid "" "The *limit* argument sets the buffer limit for :class:`StreamReader` " -"wrappers for :attr:`Process.stdout` and :attr:`Process.stderr` (if :const:" -"`subprocess.PIPE` is passed to *stdout* and *stderr* arguments)." +"wrappers for :attr:`~asyncio.subprocess.Process.stdout` and :attr:`~asyncio." +"subprocess.Process.stderr` (if :const:`subprocess.PIPE` is passed to " +"*stdout* and *stderr* arguments)." msgstr "" -#: ../../library/asyncio-subprocess.rst:73 -#: ../../library/asyncio-subprocess.rst:91 +#: ../../library/asyncio-subprocess.rst:74 +#: ../../library/asyncio-subprocess.rst:93 msgid "Return a :class:`~asyncio.subprocess.Process` instance." msgstr "" -#: ../../library/asyncio-subprocess.rst:75 +#: ../../library/asyncio-subprocess.rst:76 msgid "" "See the documentation of :meth:`loop.subprocess_exec` for other parameters." msgstr "" -#: ../../library/asyncio-subprocess.rst:78 -#: ../../library/asyncio-subprocess.rst:105 +#: ../../library/asyncio-subprocess.rst:79 +#: ../../library/asyncio-subprocess.rst:107 msgid "Removed the *loop* parameter." msgstr "" -#: ../../library/asyncio-subprocess.rst:85 +#: ../../library/asyncio-subprocess.rst:87 msgid "Run the *cmd* shell command." msgstr "" -#: ../../library/asyncio-subprocess.rst:93 +#: ../../library/asyncio-subprocess.rst:95 msgid "" "See the documentation of :meth:`loop.subprocess_shell` for other parameters." msgstr "" -#: ../../library/asyncio-subprocess.rst:98 +#: ../../library/asyncio-subprocess.rst:100 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -173,14 +174,14 @@ msgid "" "be used to construct shell commands." msgstr "" -#: ../../library/asyncio-subprocess.rst:110 +#: ../../library/asyncio-subprocess.rst:112 msgid "" "Subprocesses are available for Windows if a :class:`ProactorEventLoop` is " "used. See :ref:`Subprocess Support on Windows ` " "for details." msgstr "" -#: ../../library/asyncio-subprocess.rst:116 +#: ../../library/asyncio-subprocess.rst:118 msgid "" "asyncio also has the following *low-level* APIs to work with subprocesses: :" "meth:`loop.subprocess_exec`, :meth:`loop.subprocess_shell`, :meth:`loop." @@ -189,47 +190,47 @@ msgid "" "Protocols `." msgstr "" -#: ../../library/asyncio-subprocess.rst:124 +#: ../../library/asyncio-subprocess.rst:126 msgid "Constants" msgstr "常數" -#: ../../library/asyncio-subprocess.rst:129 +#: ../../library/asyncio-subprocess.rst:131 msgid "Can be passed to the *stdin*, *stdout* or *stderr* parameters." msgstr "" -#: ../../library/asyncio-subprocess.rst:131 +#: ../../library/asyncio-subprocess.rst:133 msgid "" "If *PIPE* is passed to *stdin* argument, the :attr:`Process.stdin ` attribute will point to a :class:`StreamWriter` " -"instance." +"subprocess.Process.stdin>` attribute will point to a :class:`~asyncio." +"StreamWriter` instance." msgstr "" -#: ../../library/asyncio-subprocess.rst:135 +#: ../../library/asyncio-subprocess.rst:137 msgid "" "If *PIPE* is passed to *stdout* or *stderr* arguments, the :attr:`Process." "stdout ` and :attr:`Process.stderr " "` attributes will point to :class:" -"`StreamReader` instances." +"`~asyncio.StreamReader` instances." msgstr "" -#: ../../library/asyncio-subprocess.rst:143 +#: ../../library/asyncio-subprocess.rst:145 msgid "" "Special value that can be used as the *stderr* argument and indicates that " "standard error should be redirected into standard output." msgstr "" -#: ../../library/asyncio-subprocess.rst:149 +#: ../../library/asyncio-subprocess.rst:151 msgid "" "Special value that can be used as the *stdin*, *stdout* or *stderr* argument " "to process creation functions. It indicates that the special file :data:`os." "devnull` will be used for the corresponding subprocess stream." msgstr "" -#: ../../library/asyncio-subprocess.rst:155 +#: ../../library/asyncio-subprocess.rst:157 msgid "Interacting with Subprocesses" msgstr "" -#: ../../library/asyncio-subprocess.rst:157 +#: ../../library/asyncio-subprocess.rst:159 msgid "" "Both :func:`create_subprocess_exec` and :func:`create_subprocess_shell` " "functions return instances of the *Process* class. *Process* is a high-" @@ -237,61 +238,62 @@ msgid "" "their completion." msgstr "" -#: ../../library/asyncio-subprocess.rst:165 +#: ../../library/asyncio-subprocess.rst:167 msgid "" -"An object that wraps OS processes created by the :func:" -"`create_subprocess_exec` and :func:`create_subprocess_shell` functions." +"An object that wraps OS processes created by the :func:`~asyncio." +"create_subprocess_exec` and :func:`~asyncio.create_subprocess_shell` " +"functions." msgstr "" -#: ../../library/asyncio-subprocess.rst:169 +#: ../../library/asyncio-subprocess.rst:171 msgid "" "This class is designed to have a similar API to the :class:`subprocess." "Popen` class, but there are some notable differences:" msgstr "" -#: ../../library/asyncio-subprocess.rst:173 +#: ../../library/asyncio-subprocess.rst:175 msgid "" "unlike Popen, Process instances do not have an equivalent to the :meth:" "`~subprocess.Popen.poll` method;" msgstr "" -#: ../../library/asyncio-subprocess.rst:176 +#: ../../library/asyncio-subprocess.rst:178 msgid "" "the :meth:`~asyncio.subprocess.Process.communicate` and :meth:`~asyncio." "subprocess.Process.wait` methods don't have a *timeout* parameter: use the :" "func:`~asyncio.wait_for` function;" msgstr "" -#: ../../library/asyncio-subprocess.rst:180 +#: ../../library/asyncio-subprocess.rst:182 msgid "" "the :meth:`Process.wait() ` method is " "asynchronous, whereas :meth:`subprocess.Popen.wait` method is implemented as " "a blocking busy loop;" msgstr "" -#: ../../library/asyncio-subprocess.rst:184 +#: ../../library/asyncio-subprocess.rst:186 msgid "the *universal_newlines* parameter is not supported." msgstr "" -#: ../../library/asyncio-subprocess.rst:186 +#: ../../library/asyncio-subprocess.rst:188 msgid "This class is :ref:`not thread safe `." msgstr "" -#: ../../library/asyncio-subprocess.rst:188 +#: ../../library/asyncio-subprocess.rst:190 msgid "" "See also the :ref:`Subprocess and Threads ` " "section." msgstr "" -#: ../../library/asyncio-subprocess.rst:193 +#: ../../library/asyncio-subprocess.rst:196 msgid "Wait for the child process to terminate." msgstr "" -#: ../../library/asyncio-subprocess.rst:195 +#: ../../library/asyncio-subprocess.rst:198 msgid "Set and return the :attr:`returncode` attribute." msgstr "" -#: ../../library/asyncio-subprocess.rst:199 +#: ../../library/asyncio-subprocess.rst:202 msgid "" "This method can deadlock when using ``stdout=PIPE`` or ``stderr=PIPE`` and " "the child process generates so much output that it blocks waiting for the OS " @@ -299,37 +301,37 @@ msgid "" "using pipes to avoid this condition." msgstr "" -#: ../../library/asyncio-subprocess.rst:207 +#: ../../library/asyncio-subprocess.rst:211 msgid "Interact with process:" msgstr "" -#: ../../library/asyncio-subprocess.rst:209 +#: ../../library/asyncio-subprocess.rst:213 msgid "send data to *stdin* (if *input* is not ``None``);" msgstr "" -#: ../../library/asyncio-subprocess.rst:210 +#: ../../library/asyncio-subprocess.rst:214 msgid "closes *stdin*;" msgstr "" -#: ../../library/asyncio-subprocess.rst:211 +#: ../../library/asyncio-subprocess.rst:215 msgid "read data from *stdout* and *stderr*, until EOF is reached;" msgstr "" -#: ../../library/asyncio-subprocess.rst:212 +#: ../../library/asyncio-subprocess.rst:216 msgid "wait for process to terminate." msgstr "" -#: ../../library/asyncio-subprocess.rst:214 +#: ../../library/asyncio-subprocess.rst:218 msgid "" "The optional *input* argument is the data (:class:`bytes` object) that will " "be sent to the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:217 +#: ../../library/asyncio-subprocess.rst:221 msgid "Return a tuple ``(stdout_data, stderr_data)``." msgstr "" -#: ../../library/asyncio-subprocess.rst:219 +#: ../../library/asyncio-subprocess.rst:223 msgid "" "If either :exc:`BrokenPipeError` or :exc:`ConnectionResetError` exception is " "raised when writing *input* into *stdin*, the exception is ignored. This " @@ -337,7 +339,7 @@ msgid "" "*stdin*." msgstr "" -#: ../../library/asyncio-subprocess.rst:224 +#: ../../library/asyncio-subprocess.rst:228 msgid "" "If it is desired to send data to the process' *stdin*, the process needs to " "be created with ``stdin=PIPE``. Similarly, to get anything other than " @@ -345,75 +347,76 @@ msgid "" "``stdout=PIPE`` and/or ``stderr=PIPE`` arguments." msgstr "" -#: ../../library/asyncio-subprocess.rst:230 +#: ../../library/asyncio-subprocess.rst:234 msgid "" "Note, that the data read is buffered in memory, so do not use this method if " "the data size is large or unlimited." msgstr "" -#: ../../library/asyncio-subprocess.rst:235 -msgid "*stdin* gets closed when `input=None` too." +#: ../../library/asyncio-subprocess.rst:239 +msgid "*stdin* gets closed when ``input=None`` too." msgstr "" -#: ../../library/asyncio-subprocess.rst:239 +#: ../../library/asyncio-subprocess.rst:243 msgid "Sends the signal *signal* to the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:243 +#: ../../library/asyncio-subprocess.rst:247 msgid "" "On Windows, :py:const:`~signal.SIGTERM` is an alias for :meth:`terminate`. " "``CTRL_C_EVENT`` and ``CTRL_BREAK_EVENT`` can be sent to processes started " "with a *creationflags* parameter which includes ``CREATE_NEW_PROCESS_GROUP``." msgstr "" -#: ../../library/asyncio-subprocess.rst:250 +#: ../../library/asyncio-subprocess.rst:254 msgid "Stop the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:252 +#: ../../library/asyncio-subprocess.rst:256 msgid "" "On POSIX systems this method sends :py:const:`~signal.SIGTERM` to the child " "process." msgstr "" -#: ../../library/asyncio-subprocess.rst:255 +#: ../../library/asyncio-subprocess.rst:259 msgid "" "On Windows the Win32 API function :c:func:`!TerminateProcess` is called to " "stop the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:260 +#: ../../library/asyncio-subprocess.rst:264 msgid "Kill the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:262 +#: ../../library/asyncio-subprocess.rst:266 msgid "" -"On POSIX systems this method sends :py:data:`SIGKILL` to the child process." +"On POSIX systems this method sends :py:data:`~signal.SIGKILL` to the child " +"process." msgstr "" -#: ../../library/asyncio-subprocess.rst:265 +#: ../../library/asyncio-subprocess.rst:269 msgid "On Windows this method is an alias for :meth:`terminate`." msgstr "" -#: ../../library/asyncio-subprocess.rst:269 +#: ../../library/asyncio-subprocess.rst:273 msgid "" -"Standard input stream (:class:`StreamWriter`) or ``None`` if the process was " -"created with ``stdin=None``." +"Standard input stream (:class:`~asyncio.StreamWriter`) or ``None`` if the " +"process was created with ``stdin=None``." msgstr "" -#: ../../library/asyncio-subprocess.rst:274 +#: ../../library/asyncio-subprocess.rst:278 msgid "" -"Standard output stream (:class:`StreamReader`) or ``None`` if the process " -"was created with ``stdout=None``." +"Standard output stream (:class:`~asyncio.StreamReader`) or ``None`` if the " +"process was created with ``stdout=None``." msgstr "" -#: ../../library/asyncio-subprocess.rst:279 +#: ../../library/asyncio-subprocess.rst:283 msgid "" -"Standard error stream (:class:`StreamReader`) or ``None`` if the process was " -"created with ``stderr=None``." +"Standard error stream (:class:`~asyncio.StreamReader`) or ``None`` if the " +"process was created with ``stderr=None``." msgstr "" -#: ../../library/asyncio-subprocess.rst:284 +#: ../../library/asyncio-subprocess.rst:288 msgid "" "Use the :meth:`communicate` method rather than :attr:`process.stdin.write() " "`, :attr:`await process.stdout.read() ` or :attr:`await " @@ -421,93 +424,94 @@ msgid "" "pausing reading or writing and blocking the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:293 +#: ../../library/asyncio-subprocess.rst:297 msgid "Process identification number (PID)." msgstr "" -#: ../../library/asyncio-subprocess.rst:295 +#: ../../library/asyncio-subprocess.rst:299 msgid "" -"Note that for processes created by the :func:`create_subprocess_shell` " -"function, this attribute is the PID of the spawned shell." +"Note that for processes created by the :func:`~asyncio." +"create_subprocess_shell` function, this attribute is the PID of the spawned " +"shell." msgstr "" -#: ../../library/asyncio-subprocess.rst:300 +#: ../../library/asyncio-subprocess.rst:304 msgid "Return code of the process when it exits." msgstr "" -#: ../../library/asyncio-subprocess.rst:302 +#: ../../library/asyncio-subprocess.rst:306 msgid "A ``None`` value indicates that the process has not terminated yet." msgstr "" -#: ../../library/asyncio-subprocess.rst:304 +#: ../../library/asyncio-subprocess.rst:308 msgid "" "A negative value ``-N`` indicates that the child was terminated by signal " "``N`` (POSIX only)." msgstr "" -#: ../../library/asyncio-subprocess.rst:311 +#: ../../library/asyncio-subprocess.rst:315 msgid "Subprocess and Threads" msgstr "子行程與線程" -#: ../../library/asyncio-subprocess.rst:313 +#: ../../library/asyncio-subprocess.rst:317 msgid "" "Standard asyncio event loop supports running subprocesses from different " "threads by default." msgstr "" -#: ../../library/asyncio-subprocess.rst:316 +#: ../../library/asyncio-subprocess.rst:320 msgid "" "On Windows subprocesses are provided by :class:`ProactorEventLoop` only " "(default), :class:`SelectorEventLoop` has no subprocess support." msgstr "" -#: ../../library/asyncio-subprocess.rst:319 +#: ../../library/asyncio-subprocess.rst:323 msgid "" "On UNIX *child watchers* are used for subprocess finish waiting, see :ref:" "`asyncio-watchers` for more info." msgstr "" -#: ../../library/asyncio-subprocess.rst:325 +#: ../../library/asyncio-subprocess.rst:329 msgid "" "UNIX switched to use :class:`ThreadedChildWatcher` for spawning subprocesses " "from different threads without any limitation." msgstr "" -#: ../../library/asyncio-subprocess.rst:328 +#: ../../library/asyncio-subprocess.rst:332 msgid "" "Spawning a subprocess with *inactive* current child watcher raises :exc:" "`RuntimeError`." msgstr "" -#: ../../library/asyncio-subprocess.rst:331 +#: ../../library/asyncio-subprocess.rst:335 msgid "" "Note that alternative event loop implementations might have own limitations; " "please refer to their documentation." msgstr "" -#: ../../library/asyncio-subprocess.rst:336 +#: ../../library/asyncio-subprocess.rst:340 msgid "" "The :ref:`Concurrency and multithreading in asyncio ` section." msgstr "" -#: ../../library/asyncio-subprocess.rst:341 +#: ../../library/asyncio-subprocess.rst:345 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-subprocess.rst:343 +#: ../../library/asyncio-subprocess.rst:347 msgid "" "An example using the :class:`~asyncio.subprocess.Process` class to control a " "subprocess and the :class:`StreamReader` class to read from its standard " "output." msgstr "" -#: ../../library/asyncio-subprocess.rst:349 +#: ../../library/asyncio-subprocess.rst:353 msgid "" "The subprocess is created by the :func:`create_subprocess_exec` function::" msgstr "" -#: ../../library/asyncio-subprocess.rst:352 +#: ../../library/asyncio-subprocess.rst:356 msgid "" "import asyncio\n" "import sys\n" @@ -533,7 +537,7 @@ msgid "" "print(f\"Current date: {date}\")" msgstr "" -#: ../../library/asyncio-subprocess.rst:376 +#: ../../library/asyncio-subprocess.rst:380 msgid "" "See also the :ref:`same example ` written " "using low-level APIs." diff --git a/library/asyncio-sync.po b/library/asyncio-sync.po index f7068e20fe..f55686cbb8 100644 --- a/library/asyncio-sync.po +++ b/library/asyncio-sync.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-30 00:14+0000\n" +"POT-Creation-Date: 2025-02-23 00:15+0000\n" "PO-Revision-Date: 2022-02-09 19:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -107,8 +107,8 @@ msgid "" " # access shared state" msgstr "" -#: ../../library/asyncio-sync.rst:56 ../../library/asyncio-sync.rst:199 -#: ../../library/asyncio-sync.rst:304 +#: ../../library/asyncio-sync.rst:56 ../../library/asyncio-sync.rst:201 +#: ../../library/asyncio-sync.rst:309 msgid "which is equivalent to::" msgstr "這等價於: ::" @@ -124,17 +124,17 @@ msgid "" " lock.release()" msgstr "" -#: ../../library/asyncio-sync.rst:67 ../../library/asyncio-sync.rst:112 -#: ../../library/asyncio-sync.rst:187 ../../library/asyncio-sync.rst:292 -#: ../../library/asyncio-sync.rst:347 +#: ../../library/asyncio-sync.rst:67 ../../library/asyncio-sync.rst:113 +#: ../../library/asyncio-sync.rst:189 ../../library/asyncio-sync.rst:297 +#: ../../library/asyncio-sync.rst:353 msgid "Removed the *loop* parameter." msgstr "移除 ``loop`` 參數。" -#: ../../library/asyncio-sync.rst:72 +#: ../../library/asyncio-sync.rst:73 msgid "Acquire the lock." msgstr "獲得鎖。" -#: ../../library/asyncio-sync.rst:74 +#: ../../library/asyncio-sync.rst:75 msgid "" "This method waits until the lock is *unlocked*, sets it to *locked* and " "returns ``True``." @@ -142,7 +142,7 @@ msgstr "" "此方法會持續等待直到鎖的狀態成為 *unlocked*,並將其設置為 *locked* 和回傳 " "``True``。" -#: ../../library/asyncio-sync.rst:77 +#: ../../library/asyncio-sync.rst:78 msgid "" "When more than one coroutine is blocked in :meth:`acquire` waiting for the " "lock to be unlocked, only one coroutine eventually proceeds." @@ -150,45 +150,45 @@ msgstr "" "當多於一個的協程 (coroutine) 在 :meth:`acquire` 中等待解鎖而被阻塞,最終只會" "有其中的一個被處理。" -#: ../../library/asyncio-sync.rst:81 +#: ../../library/asyncio-sync.rst:82 msgid "" "Acquiring a lock is *fair*: the coroutine that proceeds will be the first " "coroutine that started waiting on the lock." msgstr "" "鎖的獲取方式是\\ *公平*\\ 的:被處理的協程會是最早開始等待解鎖的那一個。" -#: ../../library/asyncio-sync.rst:86 +#: ../../library/asyncio-sync.rst:87 msgid "Release the lock." msgstr "釋放鎖。" -#: ../../library/asyncio-sync.rst:88 +#: ../../library/asyncio-sync.rst:89 msgid "When the lock is *locked*, reset it to *unlocked* and return." msgstr "如果鎖的狀態為 *locked* 則將其重置為 *unlocked* 並回傳。" -#: ../../library/asyncio-sync.rst:90 +#: ../../library/asyncio-sync.rst:91 msgid "If the lock is *unlocked*, a :exc:`RuntimeError` is raised." msgstr "如果鎖的狀態為 *unlocked* 則 :exc:`RuntimeError` 會被引發。" -#: ../../library/asyncio-sync.rst:94 +#: ../../library/asyncio-sync.rst:95 msgid "Return ``True`` if the lock is *locked*." msgstr "如果鎖的狀態為 *locked* 則回傳 ``True``。" -#: ../../library/asyncio-sync.rst:98 +#: ../../library/asyncio-sync.rst:99 msgid "Event" msgstr "Event" -#: ../../library/asyncio-sync.rst:102 +#: ../../library/asyncio-sync.rst:103 msgid "An event object. Not thread-safe." msgstr "一個事件 (event) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:104 +#: ../../library/asyncio-sync.rst:105 msgid "" "An asyncio event can be used to notify multiple asyncio tasks that some " "event has happened." msgstr "" "一個 asyncio 事件可以被用於通知多個有發生某些事件於其中的 asyncio 任務。" -#: ../../library/asyncio-sync.rst:107 +#: ../../library/asyncio-sync.rst:108 msgid "" "An Event object manages an internal flag that can be set to *true* with the :" "meth:`~Event.set` method and reset to *false* with the :meth:`clear` " @@ -200,11 +200,11 @@ msgstr "" "wait` 方法會被阻塞 (block) 直到該旗標被設為 *true*。該旗標初始設置為 " "*false*。" -#: ../../library/asyncio-sync.rst:117 ../../library/asyncio-sync.rst:371 +#: ../../library/asyncio-sync.rst:118 ../../library/asyncio-sync.rst:377 msgid "Example::" msgstr "範例: ::" -#: ../../library/asyncio-sync.rst:119 +#: ../../library/asyncio-sync.rst:120 msgid "" "async def waiter(event):\n" " print('waiting for it ...')\n" @@ -228,11 +228,11 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-sync.rst:142 +#: ../../library/asyncio-sync.rst:144 msgid "Wait until the event is set." msgstr "持續等待直到事件被設置。" -#: ../../library/asyncio-sync.rst:144 +#: ../../library/asyncio-sync.rst:146 msgid "" "If the event is set, return ``True`` immediately. Otherwise block until " "another task calls :meth:`~Event.set`." @@ -240,19 +240,19 @@ msgstr "" "如果事件有被設置則立刻回傳 ``True``。否則持續阻塞直到另一個任務呼叫 :meth:" "`~Event.set`。" -#: ../../library/asyncio-sync.rst:149 +#: ../../library/asyncio-sync.rst:151 msgid "Set the event." msgstr "設置事件。" -#: ../../library/asyncio-sync.rst:151 +#: ../../library/asyncio-sync.rst:153 msgid "All tasks waiting for event to be set will be immediately awakened." msgstr "所有正在等待事件被設置的任務會立即被喚醒。" -#: ../../library/asyncio-sync.rst:156 +#: ../../library/asyncio-sync.rst:158 msgid "Clear (unset) the event." msgstr "清除(還原)事件。" -#: ../../library/asyncio-sync.rst:158 +#: ../../library/asyncio-sync.rst:160 msgid "" "Tasks awaiting on :meth:`~Event.wait` will now block until the :meth:`~Event." "set` method is called again." @@ -260,19 +260,19 @@ msgstr "" "正透過 :meth:`~Event.wait` 等待的 Tasks 現在會持續阻塞直到 :meth:`~Event." "set` 方法再次被呼叫。" -#: ../../library/asyncio-sync.rst:163 +#: ../../library/asyncio-sync.rst:165 msgid "Return ``True`` if the event is set." msgstr "如果事件有被設置則回傳 ``True``。" -#: ../../library/asyncio-sync.rst:167 +#: ../../library/asyncio-sync.rst:169 msgid "Condition" msgstr "Condition" -#: ../../library/asyncio-sync.rst:171 +#: ../../library/asyncio-sync.rst:173 msgid "A Condition object. Not thread-safe." msgstr "一個條件 (codition) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:173 +#: ../../library/asyncio-sync.rst:175 msgid "" "An asyncio condition primitive can be used by a task to wait for some event " "to happen and then get exclusive access to a shared resource." @@ -280,7 +280,7 @@ msgstr "" "一個 asyncio 條件原始物件可以被任務用來等待某事件發生,並獲得一個共享資源的獨" "佔存取權。" -#: ../../library/asyncio-sync.rst:177 +#: ../../library/asyncio-sync.rst:179 msgid "" "In essence, a Condition object combines the functionality of an :class:" "`Event` and a :class:`Lock`. It is possible to have multiple Condition " @@ -292,7 +292,7 @@ msgstr "" "個 Condition 物件共享一個 Lock 是有可能發生的,這能夠協調關注同一共享資源的不" "同狀態以獲取其獨佔存取權的多個任務。" -#: ../../library/asyncio-sync.rst:183 +#: ../../library/asyncio-sync.rst:185 msgid "" "The optional *lock* argument must be a :class:`Lock` object or ``None``. In " "the latter case a new Lock object is created automatically." @@ -300,12 +300,12 @@ msgstr "" "可選的 *lock* 引數必須是一個 :class:`Lock` 物件或者為 ``None``。如為後者則一" "個新的 Lock 物件會被自動建立。" -#: ../../library/asyncio-sync.rst:190 +#: ../../library/asyncio-sync.rst:192 msgid "" "The preferred way to use a Condition is an :keyword:`async with` statement::" msgstr "使用 Condition 的推薦方式是透過 :keyword:`async with` 陳述式: ::" -#: ../../library/asyncio-sync.rst:193 +#: ../../library/asyncio-sync.rst:195 msgid "" "cond = asyncio.Condition()\n" "\n" @@ -314,7 +314,7 @@ msgid "" " await cond.wait()" msgstr "" -#: ../../library/asyncio-sync.rst:201 +#: ../../library/asyncio-sync.rst:203 msgid "" "cond = asyncio.Condition()\n" "\n" @@ -326,11 +326,11 @@ msgid "" " cond.release()" msgstr "" -#: ../../library/asyncio-sync.rst:212 +#: ../../library/asyncio-sync.rst:215 msgid "Acquire the underlying lock." msgstr "獲取底層的鎖。" -#: ../../library/asyncio-sync.rst:214 +#: ../../library/asyncio-sync.rst:217 msgid "" "This method waits until the underlying lock is *unlocked*, sets it to " "*locked* and returns ``True``." @@ -338,7 +338,7 @@ msgstr "" "此方法會持續等待直到底層的鎖為 *unlocked*,並將其設為 *locked* 並回傳 " "``True``。" -#: ../../library/asyncio-sync.rst:219 +#: ../../library/asyncio-sync.rst:222 msgid "" "Wake up *n* tasks (1 by default) waiting on this condition. If fewer than " "*n* tasks are waiting they are all awakened." @@ -346,7 +346,7 @@ msgstr "" "喚醒至多 *n* 個正在等待此條件的任務(預設為 1),如果少於 *n* 個任務則全部被" "喚醒。" -#: ../../library/asyncio-sync.rst:222 ../../library/asyncio-sync.rst:237 +#: ../../library/asyncio-sync.rst:225 ../../library/asyncio-sync.rst:240 msgid "" "The lock must be acquired before this method is called and released shortly " "after. If called with an *unlocked* lock a :exc:`RuntimeError` error is " @@ -355,31 +355,31 @@ msgstr "" "在此方法被呼叫前必須先獲得鎖,並在之後立刻將其釋放。如果呼叫於一個 " "*unlocked* 的鎖則 :exc:`RuntimeError` 錯誤會被引發。" -#: ../../library/asyncio-sync.rst:228 +#: ../../library/asyncio-sync.rst:231 msgid "Return ``True`` if the underlying lock is acquired." msgstr "如果已獲取底層的鎖則回傳 ``True``。" -#: ../../library/asyncio-sync.rst:232 +#: ../../library/asyncio-sync.rst:235 msgid "Wake up all tasks waiting on this condition." msgstr "喚醒所有正在等待此條件的任務。" -#: ../../library/asyncio-sync.rst:234 +#: ../../library/asyncio-sync.rst:237 msgid "This method acts like :meth:`notify`, but wakes up all waiting tasks." msgstr "這個方法的行為就像 :meth:`notify`,但會喚醒所有正在等待的任務。" -#: ../../library/asyncio-sync.rst:243 +#: ../../library/asyncio-sync.rst:246 msgid "Release the underlying lock." msgstr "釋放底層的鎖。" -#: ../../library/asyncio-sync.rst:245 +#: ../../library/asyncio-sync.rst:248 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." msgstr "當調用於一個未被解開的鎖之上時,會引發一個 :exc:`RuntimeError`。" -#: ../../library/asyncio-sync.rst:250 +#: ../../library/asyncio-sync.rst:254 msgid "Wait until notified." msgstr "持續等待直到被通知 (notify)。" -#: ../../library/asyncio-sync.rst:252 +#: ../../library/asyncio-sync.rst:256 msgid "" "If the calling task has not acquired the lock when this method is called, a :" "exc:`RuntimeError` is raised." @@ -387,7 +387,7 @@ msgstr "" "當此方法被呼叫時,如果呼叫它的任務還沒有獲取鎖的話,:exc:`RuntimeError` 會被" "引發。" -#: ../../library/asyncio-sync.rst:255 +#: ../../library/asyncio-sync.rst:259 msgid "" "This method releases the underlying lock, and then blocks until it is " "awakened by a :meth:`notify` or :meth:`notify_all` call. Once awakened, the " @@ -397,7 +397,7 @@ msgstr "" "`notify_all` 的呼叫所喚醒。一但被喚醒,Condition 會重新獲取該鎖且此方法會回" "傳 ``True``。" -#: ../../library/asyncio-sync.rst:260 +#: ../../library/asyncio-sync.rst:264 msgid "" "Note that a task *may* return from this call spuriously, which is why the " "caller should always re-check the state and be prepared to :meth:`~Condition." @@ -405,11 +405,11 @@ msgid "" "wait_for` instead." msgstr "" -#: ../../library/asyncio-sync.rst:267 +#: ../../library/asyncio-sync.rst:272 msgid "Wait until a predicate becomes *true*." msgstr "持續等待直到謂語 (predicate) 成為 *true*。" -#: ../../library/asyncio-sync.rst:269 +#: ../../library/asyncio-sync.rst:274 msgid "" "The predicate must be a callable which result will be interpreted as a " "boolean value. The method will repeatedly :meth:`~Condition.wait` until the " @@ -419,15 +419,15 @@ msgstr "" "重複地 :meth:`~Condition.wait` 直到謂語求值結果為 *true*。最終的值即為回傳" "值。" -#: ../../library/asyncio-sync.rst:276 +#: ../../library/asyncio-sync.rst:281 msgid "Semaphore" msgstr "Semaphore" -#: ../../library/asyncio-sync.rst:280 +#: ../../library/asyncio-sync.rst:285 msgid "A Semaphore object. Not thread-safe." msgstr "一個旗號 (semaphore) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:282 +#: ../../library/asyncio-sync.rst:287 msgid "" "A semaphore manages an internal counter which is decremented by each :meth:" "`acquire` call and incremented by each :meth:`release` call. The counter can " @@ -438,7 +438,7 @@ msgstr "" "呼叫 :meth:`release` 時增加一。此計數器永遠不會少於零;當 :meth:`acquire` 發" "現它是零時,它會持續阻塞並等待某任務呼叫 :meth:`release`。" -#: ../../library/asyncio-sync.rst:288 +#: ../../library/asyncio-sync.rst:293 msgid "" "The optional *value* argument gives the initial value for the internal " "counter (``1`` by default). If the given value is less than ``0`` a :exc:" @@ -447,12 +447,12 @@ msgstr "" "可選的 *value* 引數給定了內部計數器的初始值(預設為 ``1``\\ )。如給定的值少" "於 ``0`` 則 :exc:`ValueError` 會被引發。" -#: ../../library/asyncio-sync.rst:295 +#: ../../library/asyncio-sync.rst:300 msgid "" "The preferred way to use a Semaphore is an :keyword:`async with` statement::" msgstr "使用 Semaphore 的推薦方式是透過 :keyword:`async with` 陳述式: ::" -#: ../../library/asyncio-sync.rst:298 +#: ../../library/asyncio-sync.rst:303 msgid "" "sem = asyncio.Semaphore(10)\n" "\n" @@ -461,7 +461,7 @@ msgid "" " # work with shared resource" msgstr "" -#: ../../library/asyncio-sync.rst:306 +#: ../../library/asyncio-sync.rst:311 msgid "" "sem = asyncio.Semaphore(10)\n" "\n" @@ -473,11 +473,11 @@ msgid "" " sem.release()" msgstr "" -#: ../../library/asyncio-sync.rst:317 +#: ../../library/asyncio-sync.rst:323 msgid "Acquire a semaphore." msgstr "獲取一個旗號。" -#: ../../library/asyncio-sync.rst:319 +#: ../../library/asyncio-sync.rst:325 msgid "" "If the internal counter is greater than zero, decrement it by one and return " "``True`` immediately. If it is zero, wait until a :meth:`release` is called " @@ -486,11 +486,11 @@ msgstr "" "如果內部計數器大於零,將其減一並立刻回傳 ``True``。如果為零,則持續等待直到 :" "meth:`release` 被呼叫,並回傳 ``True``。" -#: ../../library/asyncio-sync.rst:325 +#: ../../library/asyncio-sync.rst:331 msgid "Returns ``True`` if semaphore can not be acquired immediately." msgstr "如果旗號無法立即被取得則回傳 ``True``。" -#: ../../library/asyncio-sync.rst:329 +#: ../../library/asyncio-sync.rst:335 msgid "" "Release a semaphore, incrementing the internal counter by one. Can wake up a " "task waiting to acquire the semaphore." @@ -498,7 +498,7 @@ msgstr "" "釋放一個旗號,並為其內部的計數器數值增加一。可以把一個正在等待獲取旗號的任務" "叫醒。" -#: ../../library/asyncio-sync.rst:332 +#: ../../library/asyncio-sync.rst:338 msgid "" "Unlike :class:`BoundedSemaphore`, :class:`Semaphore` allows making more " "``release()`` calls than ``acquire()`` calls." @@ -506,15 +506,15 @@ msgstr "" "和 :class:`BoundedSemaphore` 不同,:class:`Semaphore` 允許 ``release()`` 的呼" "叫次數多於 ``acquire()``。" -#: ../../library/asyncio-sync.rst:337 +#: ../../library/asyncio-sync.rst:343 msgid "BoundedSemaphore" msgstr "BoundedSemaphore" -#: ../../library/asyncio-sync.rst:341 +#: ../../library/asyncio-sync.rst:347 msgid "A bounded semaphore object. Not thread-safe." msgstr "一個有界的旗號物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:343 +#: ../../library/asyncio-sync.rst:349 msgid "" "Bounded Semaphore is a version of :class:`Semaphore` that raises a :exc:" "`ValueError` in :meth:`~Semaphore.release` if it increases the internal " @@ -524,15 +524,15 @@ msgstr "" "加至大於初始 *value* 值的話,:exc:`ValueError` 會在 :meth:`~Semaphore." "release` 時被引發。" -#: ../../library/asyncio-sync.rst:352 +#: ../../library/asyncio-sync.rst:358 msgid "Barrier" msgstr "Barrier" -#: ../../library/asyncio-sync.rst:356 +#: ../../library/asyncio-sync.rst:362 msgid "A barrier object. Not thread-safe." msgstr "一個屏障 (barrier) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:358 +#: ../../library/asyncio-sync.rst:364 msgid "" "A barrier is a simple synchronization primitive that allows to block until " "*parties* number of tasks are waiting on it. Tasks can wait on the :meth:" @@ -541,17 +541,17 @@ msgid "" "waiting tasks would unblock simultaneously." msgstr "" -#: ../../library/asyncio-sync.rst:364 +#: ../../library/asyncio-sync.rst:370 msgid "" ":keyword:`async with` can be used as an alternative to awaiting on :meth:" "`~Barrier.wait`." msgstr "" -#: ../../library/asyncio-sync.rst:367 +#: ../../library/asyncio-sync.rst:373 msgid "The barrier can be reused any number of times." msgstr "" -#: ../../library/asyncio-sync.rst:373 +#: ../../library/asyncio-sync.rst:379 msgid "" "async def example_barrier():\n" " # barrier with 3 parties\n" @@ -575,11 +575,11 @@ msgid "" "asyncio.run(example_barrier())" msgstr "" -#: ../../library/asyncio-sync.rst:394 +#: ../../library/asyncio-sync.rst:400 msgid "Result of this example is::" msgstr "" -#: ../../library/asyncio-sync.rst:396 +#: ../../library/asyncio-sync.rst:402 msgid "" "\n" "\n" @@ -591,27 +591,27 @@ msgstr "" "barrier passed\n" "" -#: ../../library/asyncio-sync.rst:405 +#: ../../library/asyncio-sync.rst:412 msgid "" "Pass the barrier. When all the tasks party to the barrier have called this " "function, they are all unblocked simultaneously." msgstr "" -#: ../../library/asyncio-sync.rst:408 +#: ../../library/asyncio-sync.rst:415 msgid "" "When a waiting or blocked task in the barrier is cancelled, this task exits " "the barrier which stays in the same state. If the state of the barrier is " "\"filling\", the number of waiting task decreases by 1." msgstr "" -#: ../../library/asyncio-sync.rst:413 +#: ../../library/asyncio-sync.rst:420 msgid "" "The return value is an integer in the range of 0 to ``parties-1``, different " "for each task. This can be used to select a task to do some special " "housekeeping, e.g.::" msgstr "" -#: ../../library/asyncio-sync.rst:417 +#: ../../library/asyncio-sync.rst:424 msgid "" "...\n" "async with barrier as position:\n" @@ -620,26 +620,26 @@ msgid "" " print('End of *draining phase*')" msgstr "" -#: ../../library/asyncio-sync.rst:423 +#: ../../library/asyncio-sync.rst:430 msgid "" "This method may raise a :class:`BrokenBarrierError` exception if the barrier " "is broken or reset while a task is waiting. It could raise a :exc:" "`CancelledError` if a task is cancelled." msgstr "" -#: ../../library/asyncio-sync.rst:429 +#: ../../library/asyncio-sync.rst:437 msgid "" "Return the barrier to the default, empty state. Any tasks waiting on it " "will receive the :class:`BrokenBarrierError` exception." msgstr "" -#: ../../library/asyncio-sync.rst:432 +#: ../../library/asyncio-sync.rst:440 msgid "" "If a barrier is broken it may be better to just leave it and create a new " "one." msgstr "" -#: ../../library/asyncio-sync.rst:436 +#: ../../library/asyncio-sync.rst:445 msgid "" "Put the barrier into a broken state. This causes any active or future calls " "to :meth:`~Barrier.wait` to fail with the :class:`BrokenBarrierError`. Use " @@ -647,25 +647,25 @@ msgid "" "waiting tasks." msgstr "" -#: ../../library/asyncio-sync.rst:443 +#: ../../library/asyncio-sync.rst:452 msgid "The number of tasks required to pass the barrier." msgstr "" -#: ../../library/asyncio-sync.rst:447 +#: ../../library/asyncio-sync.rst:456 msgid "The number of tasks currently waiting in the barrier while filling." msgstr "" -#: ../../library/asyncio-sync.rst:451 +#: ../../library/asyncio-sync.rst:460 msgid "A boolean that is ``True`` if the barrier is in the broken state." msgstr "" -#: ../../library/asyncio-sync.rst:456 +#: ../../library/asyncio-sync.rst:465 msgid "" "This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" "`Barrier` object is reset or broken." msgstr "" -#: ../../library/asyncio-sync.rst:464 +#: ../../library/asyncio-sync.rst:473 msgid "" "Acquiring a lock using ``await lock`` or ``yield from lock`` and/or :keyword:" "`with` statement (``with await lock``, ``with (yield from lock)``) was " diff --git a/library/asyncio-task.po b/library/asyncio-task.po index 61341b2013..301332b792 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-13 00:14+0000\n" +"POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -435,11 +435,11 @@ msgid "" " task.add_done_callback(background_tasks.discard)" msgstr "" -#: ../../library/asyncio-task.rst:287 ../../library/asyncio-task.rst:1188 +#: ../../library/asyncio-task.rst:287 ../../library/asyncio-task.rst:1192 msgid "Added the *name* parameter." msgstr "新增 *name* 參數。" -#: ../../library/asyncio-task.rst:290 ../../library/asyncio-task.rst:1195 +#: ../../library/asyncio-task.rst:290 ../../library/asyncio-task.rst:1199 msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" @@ -502,9 +502,9 @@ msgstr "" msgid "Close the given coroutine if the task group is not active." msgstr "" -#: ../../library/asyncio-task.rst:345 ../../library/asyncio-task.rst:550 -#: ../../library/asyncio-task.rst:723 ../../library/asyncio-task.rst:781 -#: ../../library/asyncio-task.rst:807 ../../library/asyncio-task.rst:847 +#: ../../library/asyncio-task.rst:345 ../../library/asyncio-task.rst:551 +#: ../../library/asyncio-task.rst:724 ../../library/asyncio-task.rst:782 +#: ../../library/asyncio-task.rst:808 ../../library/asyncio-task.rst:849 msgid "Example::" msgstr "範例: ::" @@ -658,34 +658,34 @@ msgstr "" msgid "Sleeping" msgstr "" -#: ../../library/asyncio-task.rst:469 +#: ../../library/asyncio-task.rst:470 msgid "Block for *delay* seconds." msgstr "" -#: ../../library/asyncio-task.rst:471 +#: ../../library/asyncio-task.rst:472 msgid "" "If *result* is provided, it is returned to the caller when the coroutine " "completes." msgstr "" -#: ../../library/asyncio-task.rst:474 +#: ../../library/asyncio-task.rst:475 msgid "" "``sleep()`` always suspends the current task, allowing other tasks to run." msgstr "" -#: ../../library/asyncio-task.rst:477 +#: ../../library/asyncio-task.rst:478 msgid "" "Setting the delay to 0 provides an optimized path to allow other tasks to " "run. This can be used by long-running functions to avoid blocking the event " "loop for the full duration of the function call." msgstr "" -#: ../../library/asyncio-task.rst:483 +#: ../../library/asyncio-task.rst:484 msgid "" "Example of coroutine displaying the current date every second for 5 seconds::" msgstr "" -#: ../../library/asyncio-task.rst:486 +#: ../../library/asyncio-task.rst:487 msgid "" "import asyncio\n" "import datetime\n" @@ -715,40 +715,40 @@ msgstr "" "\n" "asyncio.run(display_date())" -#: ../../library/asyncio-task.rst:501 ../../library/asyncio-task.rst:599 -#: ../../library/asyncio-task.rst:698 ../../library/asyncio-task.rst:872 -#: ../../library/asyncio-task.rst:926 ../../library/asyncio-task.rst:983 +#: ../../library/asyncio-task.rst:502 ../../library/asyncio-task.rst:600 +#: ../../library/asyncio-task.rst:699 ../../library/asyncio-task.rst:874 +#: ../../library/asyncio-task.rst:929 ../../library/asyncio-task.rst:986 msgid "Removed the *loop* parameter." msgstr "移除 *loop* 參數。" -#: ../../library/asyncio-task.rst:504 +#: ../../library/asyncio-task.rst:505 msgid "Raises :exc:`ValueError` if *delay* is :data:`~math.nan`." msgstr "" -#: ../../library/asyncio-task.rst:509 +#: ../../library/asyncio-task.rst:510 msgid "Running Tasks Concurrently" msgstr "" -#: ../../library/asyncio-task.rst:513 +#: ../../library/asyncio-task.rst:514 msgid "" "Run :ref:`awaitable objects ` in the *aws* sequence " "*concurrently*." msgstr "" -#: ../../library/asyncio-task.rst:516 +#: ../../library/asyncio-task.rst:517 msgid "" "If any awaitable in *aws* is a coroutine, it is automatically scheduled as a " "Task." msgstr "" -#: ../../library/asyncio-task.rst:519 +#: ../../library/asyncio-task.rst:520 msgid "" "If all awaitables are completed successfully, the result is an aggregate " "list of returned values. The order of result values corresponds to the " "order of awaitables in *aws*." msgstr "" -#: ../../library/asyncio-task.rst:523 +#: ../../library/asyncio-task.rst:524 msgid "" "If *return_exceptions* is ``False`` (default), the first raised exception is " "immediately propagated to the task that awaits on ``gather()``. Other " @@ -756,19 +756,19 @@ msgid "" "run." msgstr "" -#: ../../library/asyncio-task.rst:528 +#: ../../library/asyncio-task.rst:529 msgid "" "If *return_exceptions* is ``True``, exceptions are treated the same as " "successful results, and aggregated in the result list." msgstr "" -#: ../../library/asyncio-task.rst:531 +#: ../../library/asyncio-task.rst:532 msgid "" "If ``gather()`` is *cancelled*, all submitted awaitables (that have not " "completed yet) are also *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:534 +#: ../../library/asyncio-task.rst:535 msgid "" "If any Task or Future from the *aws* sequence is *cancelled*, it is treated " "as if it raised :exc:`CancelledError` -- the ``gather()`` call is **not** " @@ -776,7 +776,7 @@ msgid "" "submitted Task/Future to cause other Tasks/Futures to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:541 +#: ../../library/asyncio-task.rst:542 msgid "" "A new alternative to create and run tasks concurrently and wait for their " "completion is :class:`asyncio.TaskGroup`. *TaskGroup* provides stronger " @@ -786,7 +786,7 @@ msgid "" "tasks)." msgstr "" -#: ../../library/asyncio-task.rst:552 +#: ../../library/asyncio-task.rst:553 msgid "" "import asyncio\n" "\n" @@ -825,7 +825,7 @@ msgid "" "# [2, 6, 24]" msgstr "" -#: ../../library/asyncio-task.rst:588 +#: ../../library/asyncio-task.rst:589 msgid "" "If *return_exceptions* is false, cancelling gather() after it has been " "marked done won't cancel any submitted awaitables. For instance, gather can " @@ -834,28 +834,28 @@ msgid "" "the awaitables) from gather won't cancel any other awaitables." msgstr "" -#: ../../library/asyncio-task.rst:595 +#: ../../library/asyncio-task.rst:596 msgid "" "If the *gather* itself is cancelled, the cancellation is propagated " "regardless of *return_exceptions*." msgstr "" -#: ../../library/asyncio-task.rst:602 +#: ../../library/asyncio-task.rst:603 msgid "" "Deprecation warning is emitted if no positional arguments are provided or " "not all positional arguments are Future-like objects and there is no running " "event loop." msgstr "" -#: ../../library/asyncio-task.rst:611 +#: ../../library/asyncio-task.rst:612 msgid "Eager Task Factory" msgstr "" -#: ../../library/asyncio-task.rst:615 +#: ../../library/asyncio-task.rst:616 msgid "A task factory for eager task execution." msgstr "" -#: ../../library/asyncio-task.rst:617 +#: ../../library/asyncio-task.rst:618 msgid "" "When using this factory (via :meth:`loop.set_task_factory(asyncio." "eager_task_factory) `), coroutines begin execution " @@ -865,13 +865,13 @@ msgid "" "synchronously." msgstr "" -#: ../../library/asyncio-task.rst:623 +#: ../../library/asyncio-task.rst:624 msgid "" "A common example where this is beneficial is coroutines which employ caching " "or memoization to avoid actual I/O when possible." msgstr "" -#: ../../library/asyncio-task.rst:628 +#: ../../library/asyncio-task.rst:629 msgid "" "Immediate execution of the coroutine is a semantic change. If the coroutine " "returns or raises, the task is never scheduled to the event loop. If the " @@ -880,46 +880,46 @@ msgid "" "the application's task execution order is likely to change." msgstr "" -#: ../../library/asyncio-task.rst:639 +#: ../../library/asyncio-task.rst:640 msgid "" "Create an eager task factory, similar to :func:`eager_task_factory`, using " "the provided *custom_task_constructor* when creating a new task instead of " "the default :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:643 +#: ../../library/asyncio-task.rst:644 msgid "" "*custom_task_constructor* must be a *callable* with the signature matching " "the signature of :class:`Task.__init__ `. The callable must return a :" "class:`asyncio.Task`-compatible object." msgstr "" -#: ../../library/asyncio-task.rst:647 +#: ../../library/asyncio-task.rst:648 msgid "" "This function returns a *callable* intended to be used as a task factory of " "an event loop via :meth:`loop.set_task_factory(factory) `)." msgstr "" -#: ../../library/asyncio-task.rst:654 +#: ../../library/asyncio-task.rst:655 msgid "Shielding From Cancellation" msgstr "" -#: ../../library/asyncio-task.rst:658 +#: ../../library/asyncio-task.rst:659 msgid "" "Protect an :ref:`awaitable object ` from being :meth:" "`cancelled `." msgstr "" -#: ../../library/asyncio-task.rst:661 ../../library/asyncio-task.rst:827 +#: ../../library/asyncio-task.rst:662 ../../library/asyncio-task.rst:829 msgid "If *aw* is a coroutine it is automatically scheduled as a Task." msgstr "" -#: ../../library/asyncio-task.rst:663 +#: ../../library/asyncio-task.rst:664 msgid "The statement::" msgstr "" -#: ../../library/asyncio-task.rst:665 +#: ../../library/asyncio-task.rst:666 msgid "" "task = asyncio.create_task(something())\n" "res = await shield(task)" @@ -927,15 +927,15 @@ msgstr "" "task = asyncio.create_task(something())\n" "res = await shield(task)" -#: ../../library/asyncio-task.rst:668 +#: ../../library/asyncio-task.rst:669 msgid "is equivalent to::" msgstr "" -#: ../../library/asyncio-task.rst:670 +#: ../../library/asyncio-task.rst:671 msgid "res = await something()" msgstr "res = await something()" -#: ../../library/asyncio-task.rst:672 +#: ../../library/asyncio-task.rst:673 msgid "" "*except* that if the coroutine containing it is cancelled, the Task running " "in ``something()`` is not cancelled. From the point of view of " @@ -944,20 +944,20 @@ msgid "" "`CancelledError`." msgstr "" -#: ../../library/asyncio-task.rst:678 +#: ../../library/asyncio-task.rst:679 msgid "" "If ``something()`` is cancelled by other means (i.e. from within itself) " "that would also cancel ``shield()``." msgstr "" -#: ../../library/asyncio-task.rst:681 +#: ../../library/asyncio-task.rst:682 msgid "" "If it is desired to completely ignore cancellation (not recommended) the " "``shield()`` function should be combined with a try/except clause, as " "follows::" msgstr "" -#: ../../library/asyncio-task.rst:685 +#: ../../library/asyncio-task.rst:686 msgid "" "task = asyncio.create_task(something())\n" "try:\n" @@ -971,7 +971,7 @@ msgstr "" "except CancelledError:\n" " res = None" -#: ../../library/asyncio-task.rst:693 +#: ../../library/asyncio-task.rst:694 msgid "" "Save a reference to tasks passed to this function, to avoid a task " "disappearing mid-execution. The event loop only keeps weak references to " @@ -979,36 +979,36 @@ msgid "" "any time, even before it's done." msgstr "" -#: ../../library/asyncio-task.rst:701 +#: ../../library/asyncio-task.rst:702 msgid "" "Deprecation warning is emitted if *aw* is not Future-like object and there " "is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:707 +#: ../../library/asyncio-task.rst:708 msgid "Timeouts" msgstr "" -#: ../../library/asyncio-task.rst:711 +#: ../../library/asyncio-task.rst:712 msgid "" "Return an :ref:`asynchronous context manager ` that " "can be used to limit the amount of time spent waiting on something." msgstr "" -#: ../../library/asyncio-task.rst:715 +#: ../../library/asyncio-task.rst:716 msgid "" "*delay* can either be ``None``, or a float/int number of seconds to wait. If " "*delay* is ``None``, no time limit will be applied; this can be useful if " "the delay is unknown when the context manager is created." msgstr "" -#: ../../library/asyncio-task.rst:720 +#: ../../library/asyncio-task.rst:721 msgid "" "In either case, the context manager can be rescheduled after creation using :" "meth:`Timeout.reschedule`." msgstr "" -#: ../../library/asyncio-task.rst:725 +#: ../../library/asyncio-task.rst:726 msgid "" "async def main():\n" " async with asyncio.timeout(10):\n" @@ -1018,7 +1018,7 @@ msgstr "" " async with asyncio.timeout(10):\n" " await long_running_task()" -#: ../../library/asyncio-task.rst:729 +#: ../../library/asyncio-task.rst:730 msgid "" "If ``long_running_task`` takes more than 10 seconds to complete, the context " "manager will cancel the current task and handle the resulting :exc:`asyncio." @@ -1026,18 +1026,18 @@ msgid "" "can be caught and handled." msgstr "" -#: ../../library/asyncio-task.rst:736 +#: ../../library/asyncio-task.rst:737 msgid "" "The :func:`asyncio.timeout` context manager is what transforms the :exc:" "`asyncio.CancelledError` into a :exc:`TimeoutError`, which means the :exc:" "`TimeoutError` can only be caught *outside* of the context manager." msgstr "" -#: ../../library/asyncio-task.rst:741 +#: ../../library/asyncio-task.rst:742 msgid "Example of catching :exc:`TimeoutError`::" msgstr "" -#: ../../library/asyncio-task.rst:743 +#: ../../library/asyncio-task.rst:744 msgid "" "async def main():\n" " try:\n" @@ -1049,48 +1049,48 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:752 +#: ../../library/asyncio-task.rst:753 msgid "" "The context manager produced by :func:`asyncio.timeout` can be rescheduled " "to a different deadline and inspected." msgstr "" -#: ../../library/asyncio-task.rst:757 +#: ../../library/asyncio-task.rst:758 msgid "" "An :ref:`asynchronous context manager ` for " "cancelling overdue coroutines." msgstr "" -#: ../../library/asyncio-task.rst:760 +#: ../../library/asyncio-task.rst:761 msgid "" "``when`` should be an absolute time at which the context should time out, as " "measured by the event loop's clock:" msgstr "" -#: ../../library/asyncio-task.rst:763 +#: ../../library/asyncio-task.rst:764 msgid "If ``when`` is ``None``, the timeout will never trigger." msgstr "" -#: ../../library/asyncio-task.rst:764 +#: ../../library/asyncio-task.rst:765 msgid "" "If ``when < loop.time()``, the timeout will trigger on the next iteration of " "the event loop." msgstr "" -#: ../../library/asyncio-task.rst:769 +#: ../../library/asyncio-task.rst:770 msgid "" "Return the current deadline, or ``None`` if the current deadline is not set." msgstr "" -#: ../../library/asyncio-task.rst:774 +#: ../../library/asyncio-task.rst:775 msgid "Reschedule the timeout." msgstr "" -#: ../../library/asyncio-task.rst:778 +#: ../../library/asyncio-task.rst:779 msgid "Return whether the context manager has exceeded its deadline (expired)." msgstr "" -#: ../../library/asyncio-task.rst:783 +#: ../../library/asyncio-task.rst:784 msgid "" "async def main():\n" " try:\n" @@ -1108,17 +1108,17 @@ msgid "" " print(\"Looks like we haven't finished on time.\")" msgstr "" -#: ../../library/asyncio-task.rst:798 +#: ../../library/asyncio-task.rst:799 msgid "Timeout context managers can be safely nested." msgstr "" -#: ../../library/asyncio-task.rst:804 +#: ../../library/asyncio-task.rst:805 msgid "" "Similar to :func:`asyncio.timeout`, except *when* is the absolute time to " "stop waiting, or ``None``." msgstr "" -#: ../../library/asyncio-task.rst:809 +#: ../../library/asyncio-task.rst:810 msgid "" "async def main():\n" " loop = get_running_loop()\n" @@ -1132,41 +1132,41 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:824 +#: ../../library/asyncio-task.rst:826 msgid "" "Wait for the *aw* :ref:`awaitable ` to complete with a " "timeout." msgstr "" -#: ../../library/asyncio-task.rst:829 +#: ../../library/asyncio-task.rst:831 msgid "" "*timeout* can either be ``None`` or a float or int number of seconds to wait " "for. If *timeout* is ``None``, block until the future completes." msgstr "" -#: ../../library/asyncio-task.rst:833 +#: ../../library/asyncio-task.rst:835 msgid "" "If a timeout occurs, it cancels the task and raises :exc:`TimeoutError`." msgstr "" -#: ../../library/asyncio-task.rst:836 +#: ../../library/asyncio-task.rst:838 msgid "" "To avoid the task :meth:`cancellation `, wrap it in :func:" "`shield`." msgstr "" -#: ../../library/asyncio-task.rst:839 +#: ../../library/asyncio-task.rst:841 msgid "" "The function will wait until the future is actually cancelled, so the total " "wait time may exceed the *timeout*. If an exception happens during " "cancellation, it is propagated." msgstr "" -#: ../../library/asyncio-task.rst:843 +#: ../../library/asyncio-task.rst:845 msgid "If the wait is cancelled, the future *aw* is also cancelled." msgstr "" -#: ../../library/asyncio-task.rst:849 +#: ../../library/asyncio-task.rst:851 msgid "" "async def eternity():\n" " # Sleep for one hour\n" @@ -1187,107 +1187,107 @@ msgid "" "# timeout!" msgstr "" -#: ../../library/asyncio-task.rst:867 +#: ../../library/asyncio-task.rst:869 msgid "" "When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be " "cancelled. Previously, it raised :exc:`TimeoutError` immediately." msgstr "" -#: ../../library/asyncio-task.rst:875 +#: ../../library/asyncio-task.rst:877 msgid "Raises :exc:`TimeoutError` instead of :exc:`asyncio.TimeoutError`." msgstr "引發 :exc:`TimeoutError` 而不是 :exc:`asyncio.TimeoutError`。" -#: ../../library/asyncio-task.rst:880 +#: ../../library/asyncio-task.rst:882 msgid "Waiting Primitives" msgstr "" -#: ../../library/asyncio-task.rst:884 +#: ../../library/asyncio-task.rst:887 msgid "" "Run :class:`~asyncio.Future` and :class:`~asyncio.Task` instances in the " "*aws* iterable concurrently and block until the condition specified by " "*return_when*." msgstr "" -#: ../../library/asyncio-task.rst:888 +#: ../../library/asyncio-task.rst:891 msgid "The *aws* iterable must not be empty." msgstr "" -#: ../../library/asyncio-task.rst:890 +#: ../../library/asyncio-task.rst:893 msgid "Returns two sets of Tasks/Futures: ``(done, pending)``." msgstr "" -#: ../../library/asyncio-task.rst:892 +#: ../../library/asyncio-task.rst:895 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-task.rst:894 +#: ../../library/asyncio-task.rst:897 msgid "done, pending = await asyncio.wait(aws)" msgstr "done, pending = await asyncio.wait(aws)" -#: ../../library/asyncio-task.rst:896 +#: ../../library/asyncio-task.rst:899 msgid "" "*timeout* (a float or int), if specified, can be used to control the maximum " "number of seconds to wait before returning." msgstr "" -#: ../../library/asyncio-task.rst:899 +#: ../../library/asyncio-task.rst:902 msgid "" "Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks " "that aren't done when the timeout occurs are simply returned in the second " "set." msgstr "" -#: ../../library/asyncio-task.rst:903 +#: ../../library/asyncio-task.rst:906 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "" -#: ../../library/asyncio-task.rst:909 +#: ../../library/asyncio-task.rst:912 msgid "Constant" msgstr "常數" -#: ../../library/asyncio-task.rst:910 +#: ../../library/asyncio-task.rst:913 msgid "Description" msgstr "描述" -#: ../../library/asyncio-task.rst:913 +#: ../../library/asyncio-task.rst:916 msgid "The function will return when any future finishes or is cancelled." msgstr "" -#: ../../library/asyncio-task.rst:916 +#: ../../library/asyncio-task.rst:919 msgid "" "The function will return when any future finishes by raising an exception. " "If no future raises an exception then it is equivalent to :const:" "`ALL_COMPLETED`." msgstr "" -#: ../../library/asyncio-task.rst:921 +#: ../../library/asyncio-task.rst:924 msgid "The function will return when all futures finish or are cancelled." msgstr "" -#: ../../library/asyncio-task.rst:923 +#: ../../library/asyncio-task.rst:926 msgid "" "Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the futures " "when a timeout occurs." msgstr "" -#: ../../library/asyncio-task.rst:929 +#: ../../library/asyncio-task.rst:932 msgid "Passing coroutine objects to ``wait()`` directly is forbidden." msgstr "" -#: ../../library/asyncio-task.rst:932 ../../library/asyncio-task.rst:990 +#: ../../library/asyncio-task.rst:935 ../../library/asyncio-task.rst:993 msgid "Added support for generators yielding tasks." msgstr "" -#: ../../library/asyncio-task.rst:938 +#: ../../library/asyncio-task.rst:941 msgid "" "Run :ref:`awaitable objects ` in the *aws* iterable " "concurrently. The returned object can be iterated to obtain the results of " "the awaitables as they finish." msgstr "" -#: ../../library/asyncio-task.rst:942 +#: ../../library/asyncio-task.rst:945 msgid "" "The object returned by ``as_completed()`` can be iterated as an :term:" "`asynchronous iterator` or a plain :term:`iterator`. When asynchronous " @@ -1296,7 +1296,7 @@ msgid "" "tasks with their results. Example::" msgstr "" -#: ../../library/asyncio-task.rst:948 +#: ../../library/asyncio-task.rst:951 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -1313,20 +1313,20 @@ msgid "" " print(\"IPv4 connection established.\")" msgstr "" -#: ../../library/asyncio-task.rst:962 +#: ../../library/asyncio-task.rst:965 msgid "" "During asynchronous iteration, implicitly-created tasks will be yielded for " "supplied awaitables that aren't tasks or futures." msgstr "" -#: ../../library/asyncio-task.rst:965 +#: ../../library/asyncio-task.rst:968 msgid "" "When used as a plain iterator, each iteration yields a new coroutine that " "returns the result or raises the exception of the next completed awaitable. " "This pattern is compatible with Python versions older than 3.13::" msgstr "" -#: ../../library/asyncio-task.rst:969 +#: ../../library/asyncio-task.rst:972 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -1339,34 +1339,34 @@ msgid "" " reader, writer = await next_connect" msgstr "" -#: ../../library/asyncio-task.rst:979 +#: ../../library/asyncio-task.rst:982 msgid "" "A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables " "are done. This is raised by the ``async for`` loop during asynchronous " "iteration or by the coroutines yielded during plain iteration." msgstr "" -#: ../../library/asyncio-task.rst:986 +#: ../../library/asyncio-task.rst:989 msgid "" "Deprecation warning is emitted if not all awaitable objects in the *aws* " "iterable are Future-like objects and there is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:993 +#: ../../library/asyncio-task.rst:996 msgid "" "The result can now be used as either an :term:`asynchronous iterator` or as " "a plain :term:`iterator` (previously it was only a plain iterator)." msgstr "" -#: ../../library/asyncio-task.rst:999 +#: ../../library/asyncio-task.rst:1002 msgid "Running in Threads" msgstr "" -#: ../../library/asyncio-task.rst:1003 +#: ../../library/asyncio-task.rst:1007 msgid "Asynchronously run function *func* in a separate thread." msgstr "" -#: ../../library/asyncio-task.rst:1005 +#: ../../library/asyncio-task.rst:1009 msgid "" "Any \\*args and \\*\\*kwargs supplied for this function are directly passed " "to *func*. Also, the current :class:`contextvars.Context` is propagated, " @@ -1374,19 +1374,19 @@ msgid "" "separate thread." msgstr "" -#: ../../library/asyncio-task.rst:1010 +#: ../../library/asyncio-task.rst:1014 msgid "" "Return a coroutine that can be awaited to get the eventual result of *func*." msgstr "" -#: ../../library/asyncio-task.rst:1012 +#: ../../library/asyncio-task.rst:1016 msgid "" "This coroutine function is primarily intended to be used for executing IO-" "bound functions/methods that would otherwise block the event loop if they " "were run in the main thread. For example::" msgstr "" -#: ../../library/asyncio-task.rst:1016 +#: ../../library/asyncio-task.rst:1020 msgid "" "def blocking_io():\n" " print(f\"start blocking_io at {time.strftime('%X')}\")\n" @@ -1415,7 +1415,7 @@ msgid "" "# finished main at 19:50:54" msgstr "" -#: ../../library/asyncio-task.rst:1042 +#: ../../library/asyncio-task.rst:1046 msgid "" "Directly calling ``blocking_io()`` in any coroutine would block the event " "loop for its duration, resulting in an additional 1 second of run time. " @@ -1423,7 +1423,7 @@ msgid "" "thread without blocking the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1049 +#: ../../library/asyncio-task.rst:1053 msgid "" "Due to the :term:`GIL`, ``asyncio.to_thread()`` can typically only be used " "to make IO-bound functions non-blocking. However, for extension modules that " @@ -1431,27 +1431,27 @@ msgid "" "``asyncio.to_thread()`` can also be used for CPU-bound functions." msgstr "" -#: ../../library/asyncio-task.rst:1058 +#: ../../library/asyncio-task.rst:1062 msgid "Scheduling From Other Threads" msgstr "" -#: ../../library/asyncio-task.rst:1062 +#: ../../library/asyncio-task.rst:1066 msgid "Submit a coroutine to the given event loop. Thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:1064 +#: ../../library/asyncio-task.rst:1068 msgid "" "Return a :class:`concurrent.futures.Future` to wait for the result from " "another OS thread." msgstr "" -#: ../../library/asyncio-task.rst:1067 +#: ../../library/asyncio-task.rst:1071 msgid "" "This function is meant to be called from a different OS thread than the one " "where the event loop is running. Example::" msgstr "" -#: ../../library/asyncio-task.rst:1070 +#: ../../library/asyncio-task.rst:1074 msgid "" "# Create a coroutine\n" "coro = asyncio.sleep(1, result=3)\n" @@ -1463,13 +1463,13 @@ msgid "" "assert future.result(timeout) == 3" msgstr "" -#: ../../library/asyncio-task.rst:1079 +#: ../../library/asyncio-task.rst:1083 msgid "" "If an exception is raised in the coroutine, the returned Future will be " "notified. It can also be used to cancel the task in the event loop::" msgstr "" -#: ../../library/asyncio-task.rst:1083 +#: ../../library/asyncio-task.rst:1087 msgid "" "try:\n" " result = future.result(timeout)\n" @@ -1482,59 +1482,59 @@ msgid "" " print(f'The coroutine returned: {result!r}')" msgstr "" -#: ../../library/asyncio-task.rst:1093 +#: ../../library/asyncio-task.rst:1097 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "" -#: ../../library/asyncio-task.rst:1096 +#: ../../library/asyncio-task.rst:1100 msgid "" "Unlike other asyncio functions this function requires the *loop* argument to " "be passed explicitly." msgstr "" -#: ../../library/asyncio-task.rst:1103 +#: ../../library/asyncio-task.rst:1107 msgid "Introspection" msgstr "" -#: ../../library/asyncio-task.rst:1108 +#: ../../library/asyncio-task.rst:1112 msgid "" "Return the currently running :class:`Task` instance, or ``None`` if no task " "is running." msgstr "" -#: ../../library/asyncio-task.rst:1111 +#: ../../library/asyncio-task.rst:1115 msgid "" "If *loop* is ``None`` :func:`get_running_loop` is used to get the current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1119 +#: ../../library/asyncio-task.rst:1123 msgid "Return a set of not yet finished :class:`Task` objects run by the loop." msgstr "" -#: ../../library/asyncio-task.rst:1122 +#: ../../library/asyncio-task.rst:1126 msgid "" "If *loop* is ``None``, :func:`get_running_loop` is used for getting current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1130 +#: ../../library/asyncio-task.rst:1134 msgid "Return ``True`` if *obj* is a coroutine object." msgstr "" -#: ../../library/asyncio-task.rst:1136 +#: ../../library/asyncio-task.rst:1140 msgid "Task Object" msgstr "" -#: ../../library/asyncio-task.rst:1140 +#: ../../library/asyncio-task.rst:1144 msgid "" "A :class:`Future-like ` object that runs a Python :ref:`coroutine " "`. Not thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:1143 +#: ../../library/asyncio-task.rst:1147 msgid "" "Tasks are used to run coroutines in event loops. If a coroutine awaits on a " "Future, the Task suspends the execution of the coroutine and waits for the " @@ -1542,21 +1542,21 @@ msgid "" "wrapped coroutine resumes." msgstr "" -#: ../../library/asyncio-task.rst:1149 +#: ../../library/asyncio-task.rst:1153 msgid "" "Event loops use cooperative scheduling: an event loop runs one Task at a " "time. While a Task awaits for the completion of a Future, the event loop " "runs other Tasks, callbacks, or performs IO operations." msgstr "" -#: ../../library/asyncio-task.rst:1154 +#: ../../library/asyncio-task.rst:1158 msgid "" "Use the high-level :func:`asyncio.create_task` function to create Tasks, or " "the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. " "Manual instantiation of Tasks is discouraged." msgstr "" -#: ../../library/asyncio-task.rst:1159 +#: ../../library/asyncio-task.rst:1163 msgid "" "To cancel a running Task use the :meth:`cancel` method. Calling it will " "cause the Task to throw a :exc:`CancelledError` exception into the wrapped " @@ -1564,20 +1564,20 @@ msgid "" "cancellation, the Future object will be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1164 +#: ../../library/asyncio-task.rst:1168 msgid "" ":meth:`cancelled` can be used to check if the Task was cancelled. The method " "returns ``True`` if the wrapped coroutine did not suppress the :exc:" "`CancelledError` exception and was actually cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1169 +#: ../../library/asyncio-task.rst:1173 msgid "" ":class:`asyncio.Task` inherits from :class:`Future` all of its APIs except :" "meth:`Future.set_result` and :meth:`Future.set_exception`." msgstr "" -#: ../../library/asyncio-task.rst:1173 +#: ../../library/asyncio-task.rst:1177 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *coro* to run in. If no *context* is " @@ -1585,7 +1585,7 @@ msgid "" "in the copied context." msgstr "" -#: ../../library/asyncio-task.rst:1178 +#: ../../library/asyncio-task.rst:1182 msgid "" "An optional keyword-only *eager_start* argument allows eagerly starting the " "execution of the :class:`asyncio.Task` at task creation time. If set to " @@ -1595,96 +1595,96 @@ msgid "" "eagerly and will skip scheduling to the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1185 +#: ../../library/asyncio-task.rst:1189 msgid "Added support for the :mod:`contextvars` module." msgstr "" -#: ../../library/asyncio-task.rst:1191 +#: ../../library/asyncio-task.rst:1195 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" -#: ../../library/asyncio-task.rst:1198 +#: ../../library/asyncio-task.rst:1202 msgid "Added the *eager_start* parameter." msgstr "新增 *eager_start* 參數。" -#: ../../library/asyncio-task.rst:1203 +#: ../../library/asyncio-task.rst:1207 msgid "Return ``True`` if the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1205 +#: ../../library/asyncio-task.rst:1209 msgid "" "A Task is *done* when the wrapped coroutine either returned a value, raised " "an exception, or the Task was cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1210 +#: ../../library/asyncio-task.rst:1214 msgid "Return the result of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1212 +#: ../../library/asyncio-task.rst:1216 msgid "" "If the Task is *done*, the result of the wrapped coroutine is returned (or " "if the coroutine raised an exception, that exception is re-raised.)" msgstr "" -#: ../../library/asyncio-task.rst:1216 ../../library/asyncio-task.rst:1230 +#: ../../library/asyncio-task.rst:1220 ../../library/asyncio-task.rst:1234 msgid "" "If the Task has been *cancelled*, this method raises a :exc:`CancelledError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1219 +#: ../../library/asyncio-task.rst:1223 msgid "" "If the Task's result isn't yet available, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" -#: ../../library/asyncio-task.rst:1224 +#: ../../library/asyncio-task.rst:1228 msgid "Return the exception of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1226 +#: ../../library/asyncio-task.rst:1230 msgid "" "If the wrapped coroutine raised an exception that exception is returned. If " "the wrapped coroutine returned normally this method returns ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1233 +#: ../../library/asyncio-task.rst:1237 msgid "" "If the Task isn't *done* yet, this method raises an :exc:`InvalidStateError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1238 +#: ../../library/asyncio-task.rst:1242 msgid "Add a callback to be run when the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1240 ../../library/asyncio-task.rst:1249 +#: ../../library/asyncio-task.rst:1244 ../../library/asyncio-task.rst:1253 msgid "This method should only be used in low-level callback-based code." msgstr "" -#: ../../library/asyncio-task.rst:1242 +#: ../../library/asyncio-task.rst:1246 msgid "" "See the documentation of :meth:`Future.add_done_callback` for more details." msgstr "" -#: ../../library/asyncio-task.rst:1247 +#: ../../library/asyncio-task.rst:1251 msgid "Remove *callback* from the callbacks list." msgstr "" -#: ../../library/asyncio-task.rst:1251 +#: ../../library/asyncio-task.rst:1255 msgid "" "See the documentation of :meth:`Future.remove_done_callback` for more " "details." msgstr "" -#: ../../library/asyncio-task.rst:1256 +#: ../../library/asyncio-task.rst:1260 msgid "Return the list of stack frames for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1258 +#: ../../library/asyncio-task.rst:1262 msgid "" "If the wrapped coroutine is not done, this returns the stack where it is " "suspended. If the coroutine has completed successfully or was cancelled, " @@ -1692,15 +1692,15 @@ msgid "" "this returns the list of traceback frames." msgstr "" -#: ../../library/asyncio-task.rst:1264 +#: ../../library/asyncio-task.rst:1268 msgid "The frames are always ordered from oldest to newest." msgstr "" -#: ../../library/asyncio-task.rst:1266 +#: ../../library/asyncio-task.rst:1270 msgid "Only one stack frame is returned for a suspended coroutine." msgstr "" -#: ../../library/asyncio-task.rst:1268 +#: ../../library/asyncio-task.rst:1272 msgid "" "The optional *limit* argument sets the maximum number of frames to return; " "by default all available frames are returned. The ordering of the returned " @@ -1709,81 +1709,87 @@ msgid "" "are returned. (This matches the behavior of the traceback module.)" msgstr "" -#: ../../library/asyncio-task.rst:1277 +#: ../../library/asyncio-task.rst:1281 msgid "Print the stack or traceback for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1279 +#: ../../library/asyncio-task.rst:1283 msgid "" "This produces output similar to that of the traceback module for the frames " "retrieved by :meth:`get_stack`." msgstr "" -#: ../../library/asyncio-task.rst:1282 +#: ../../library/asyncio-task.rst:1286 msgid "The *limit* argument is passed to :meth:`get_stack` directly." msgstr "" -#: ../../library/asyncio-task.rst:1284 +#: ../../library/asyncio-task.rst:1288 msgid "" "The *file* argument is an I/O stream to which the output is written; by " "default output is written to :data:`sys.stdout`." msgstr "" -#: ../../library/asyncio-task.rst:1289 +#: ../../library/asyncio-task.rst:1293 msgid "Return the coroutine object wrapped by the :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:1293 +#: ../../library/asyncio-task.rst:1297 msgid "" "This will return ``None`` for Tasks which have already completed eagerly. " "See the :ref:`Eager Task Factory `." msgstr "" -#: ../../library/asyncio-task.rst:1300 +#: ../../library/asyncio-task.rst:1304 msgid "Newly added eager task execution means result may be ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1304 +#: ../../library/asyncio-task.rst:1308 msgid "" "Return the :class:`contextvars.Context` object associated with the task." msgstr "" -#: ../../library/asyncio-task.rst:1311 +#: ../../library/asyncio-task.rst:1315 msgid "Return the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1313 +#: ../../library/asyncio-task.rst:1317 msgid "" "If no name has been explicitly assigned to the Task, the default asyncio " "Task implementation generates a default name during instantiation." msgstr "" -#: ../../library/asyncio-task.rst:1321 +#: ../../library/asyncio-task.rst:1325 msgid "Set the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1323 +#: ../../library/asyncio-task.rst:1327 msgid "" "The *value* argument can be any object, which is then converted to a string." msgstr "" -#: ../../library/asyncio-task.rst:1326 +#: ../../library/asyncio-task.rst:1330 msgid "" "In the default Task implementation, the name will be visible in the :func:" "`repr` output of a task object." msgstr "" -#: ../../library/asyncio-task.rst:1333 +#: ../../library/asyncio-task.rst:1337 msgid "Request the Task to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1335 +#: ../../library/asyncio-task.rst:1339 +msgid "" +"If the Task is already *done* or *cancelled*, return ``False``, otherwise, " +"return ``True``." +msgstr "" + +#: ../../library/asyncio-task.rst:1342 msgid "" -"This arranges for a :exc:`CancelledError` exception to be thrown into the " -"wrapped coroutine on the next cycle of the event loop." +"The method arranges for a :exc:`CancelledError` exception to be thrown into " +"the wrapped coroutine on the next cycle of the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1338 +#: ../../library/asyncio-task.rst:1345 msgid "" "The coroutine then has a chance to clean up or even deny the request by " "suppressing the exception with a :keyword:`try` ... ... ``except " @@ -1795,21 +1801,21 @@ msgid "" "addition to catching the exception." msgstr "" -#: ../../library/asyncio-task.rst:1348 +#: ../../library/asyncio-task.rst:1355 msgid "Added the *msg* parameter." msgstr "新增 *msg* 參數。" -#: ../../library/asyncio-task.rst:1351 +#: ../../library/asyncio-task.rst:1358 msgid "The ``msg`` parameter is propagated from cancelled task to its awaiter." msgstr "" -#: ../../library/asyncio-task.rst:1356 +#: ../../library/asyncio-task.rst:1363 msgid "" "The following example illustrates how coroutines can intercept the " "cancellation request::" msgstr "" -#: ../../library/asyncio-task.rst:1359 +#: ../../library/asyncio-task.rst:1366 msgid "" "async def cancel_me():\n" " print('cancel_me(): before sleep')\n" @@ -1846,32 +1852,32 @@ msgid "" "# main(): cancel_me is cancelled now" msgstr "" -#: ../../library/asyncio-task.rst:1395 +#: ../../library/asyncio-task.rst:1402 msgid "Return ``True`` if the Task is *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:1397 +#: ../../library/asyncio-task.rst:1404 msgid "" "The Task is *cancelled* when the cancellation was requested with :meth:" "`cancel` and the wrapped coroutine propagated the :exc:`CancelledError` " "exception thrown into it." msgstr "" -#: ../../library/asyncio-task.rst:1403 +#: ../../library/asyncio-task.rst:1410 msgid "Decrement the count of cancellation requests to this Task." msgstr "" -#: ../../library/asyncio-task.rst:1405 +#: ../../library/asyncio-task.rst:1412 msgid "Returns the remaining number of cancellation requests." msgstr "" -#: ../../library/asyncio-task.rst:1407 +#: ../../library/asyncio-task.rst:1414 msgid "" "Note that once execution of a cancelled task completed, further calls to :" "meth:`uncancel` are ineffective." msgstr "" -#: ../../library/asyncio-task.rst:1412 +#: ../../library/asyncio-task.rst:1419 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. In particular, if a Task gets successfully uncancelled, this " @@ -1880,7 +1886,7 @@ msgid "" "respective structured block. For example::" msgstr "" -#: ../../library/asyncio-task.rst:1419 +#: ../../library/asyncio-task.rst:1426 msgid "" "async def make_request_with_timeout():\n" " try:\n" @@ -1894,7 +1900,7 @@ msgid "" " await unrelated_code()" msgstr "" -#: ../../library/asyncio-task.rst:1430 +#: ../../library/asyncio-task.rst:1437 msgid "" "While the block with ``make_request()`` and ``make_another_request()`` might " "get cancelled due to the timeout, ``unrelated_code()`` should continue " @@ -1903,14 +1909,14 @@ msgid "" "similar fashion." msgstr "" -#: ../../library/asyncio-task.rst:1436 +#: ../../library/asyncio-task.rst:1443 msgid "" "If end-user code is, for some reason, suppressing cancellation by catching :" "exc:`CancelledError`, it needs to call this method to remove the " "cancellation state." msgstr "" -#: ../../library/asyncio-task.rst:1440 +#: ../../library/asyncio-task.rst:1447 msgid "" "When this method decrements the cancellation count to zero, the method " "checks if a previous :meth:`cancel` call had arranged for :exc:" @@ -1919,17 +1925,17 @@ msgid "" "``_must_cancel`` flag)." msgstr "" -#: ../../library/asyncio-task.rst:1446 +#: ../../library/asyncio-task.rst:1453 msgid "Changed to rescind pending cancellation requests upon reaching zero." msgstr "" -#: ../../library/asyncio-task.rst:1451 +#: ../../library/asyncio-task.rst:1458 msgid "" "Return the number of pending cancellation requests to this Task, i.e., the " "number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls." msgstr "" -#: ../../library/asyncio-task.rst:1455 +#: ../../library/asyncio-task.rst:1462 msgid "" "Note that if this number is greater than zero but the Task is still " "executing, :meth:`cancelled` will still return ``False``. This is because " @@ -1938,7 +1944,7 @@ msgid "" "to zero." msgstr "" -#: ../../library/asyncio-task.rst:1461 +#: ../../library/asyncio-task.rst:1468 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. See :meth:`uncancel` for more details." diff --git a/library/calendar.po b/library/calendar.po index 02ae510536..c84c360010 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -647,7 +647,7 @@ msgid "" "Aliases for the months of the year, where ``JANUARY`` is ``1`` and " "``DECEMBER`` is ``12``." msgstr "" -"一年內每個月的別名,其中 ``JANUARY`` 是 ``ㄅ`` 而 ``DECEMBER`` 是 ``12``。" +"一年內每個月的別名,其中 ``JANUARY`` 是 ``1`` 而 ``DECEMBER`` 是 ``12``。" #: ../../library/calendar.rst:531 msgid "" diff --git a/library/cmath.po b/library/cmath.po index ba28b03e18..b52f4d174e 100644 --- a/library/cmath.po +++ b/library/cmath.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-05 00:13+0000\n" +"POT-Creation-Date: 2025-04-07 00:15+0000\n" "PO-Revision-Date: 2024-03-14 09:26+0800\n" "Last-Translator: Enkai Huang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -87,10 +87,301 @@ msgstr "" "1.4142135623730951j" #: ../../library/cmath.rst:42 -msgid "Conversions to and from polar coordinates" +#, fuzzy +msgid "**Conversions to and from polar coordinates**" msgstr "轉換到極座標和從極座標做轉換" #: ../../library/cmath.rst:44 +msgid ":func:`phase(z) `" +msgstr "" + +#: ../../library/cmath.rst:44 +#, fuzzy +msgid "Return the phase of *z*" +msgstr "回傳 *x* 的正弦值。" + +#: ../../library/cmath.rst:45 +msgid ":func:`polar(z) `" +msgstr "" + +#: ../../library/cmath.rst:45 +#, fuzzy +msgid "Return the representation of *z* in polar coordinates" +msgstr "轉換到極座標和從極座標做轉換" + +#: ../../library/cmath.rst:46 +msgid ":func:`rect(r, phi) `" +msgstr "" + +#: ../../library/cmath.rst:46 +#, fuzzy +msgid "Return the complex number *z* with polar coordinates *r* and *phi*" +msgstr "" +"透過極座標 *r* 和 *phi* 回傳複數 *x*。相當於 ``complex(r * math.cos(phi), r " +"* math.sin(phi))``。" + +#: ../../library/cmath.rst:48 +#, fuzzy +msgid "**Power and logarithmic functions**" +msgstr "冪函數和對數函數" + +#: ../../library/cmath.rst:50 +msgid ":func:`exp(z) `" +msgstr "" + +#: ../../library/cmath.rst:50 +#, fuzzy +msgid "Return *e* raised to the power *z*" +msgstr "回傳 *x* 的正切值。" + +#: ../../library/cmath.rst:51 +msgid ":func:`log(z[, base]) `" +msgstr "" + +#: ../../library/cmath.rst:51 +msgid "Return the logarithm of *z* to the given *base* (*e* by default)" +msgstr "" + +#: ../../library/cmath.rst:52 +msgid ":func:`log10(z) `" +msgstr "" + +#: ../../library/cmath.rst:52 +#, fuzzy +msgid "Return the base-10 logarithm of *z*" +msgstr "回傳 *x* 的正弦值。" + +#: ../../library/cmath.rst:53 +msgid ":func:`sqrt(z) `" +msgstr "" + +#: ../../library/cmath.rst:53 +#, fuzzy +msgid "Return the square root of *z*" +msgstr "回傳 *x* 的正弦值。" + +#: ../../library/cmath.rst:55 +#, fuzzy +msgid "**Trigonometric functions**" +msgstr "三角函數" + +#: ../../library/cmath.rst:57 +msgid ":func:`acos(z) `" +msgstr "" + +#: ../../library/cmath.rst:57 +#, fuzzy +msgid "Return the arc cosine of *z*" +msgstr "回傳 *x* 的餘弦值。" + +#: ../../library/cmath.rst:58 +msgid ":func:`asin(z) `" +msgstr "" + +#: ../../library/cmath.rst:58 +#, fuzzy +msgid "Return the arc sine of *z*" +msgstr "回傳 *x* 的餘弦值。" + +#: ../../library/cmath.rst:59 +msgid ":func:`atan(z) `" +msgstr "" + +#: ../../library/cmath.rst:59 +#, fuzzy +msgid "Return the arc tangent of *z*" +msgstr "回傳 *x* 的正切值。" + +#: ../../library/cmath.rst:60 +msgid ":func:`cos(z) `" +msgstr "" + +#: ../../library/cmath.rst:60 +#, fuzzy +msgid "Return the cosine of *z*" +msgstr "回傳 *x* 的餘弦值。" + +#: ../../library/cmath.rst:61 +msgid ":func:`sin(z) `" +msgstr "" + +#: ../../library/cmath.rst:61 +#, fuzzy +msgid "Return the sine of *z*" +msgstr "回傳 *x* 的正弦值。" + +#: ../../library/cmath.rst:62 +msgid ":func:`tan(z) `" +msgstr "" + +#: ../../library/cmath.rst:62 +#, fuzzy +msgid "Return the tangent of *z*" +msgstr "回傳 *x* 的正切值。" + +#: ../../library/cmath.rst:64 +#, fuzzy +msgid "**Hyperbolic functions**" +msgstr "雙曲函數" + +#: ../../library/cmath.rst:66 +msgid ":func:`acosh(z) `" +msgstr "" + +#: ../../library/cmath.rst:66 +#, fuzzy +msgid "Return the inverse hyperbolic cosine of *z*" +msgstr "回傳 *x* 的反雙曲餘弦值。" + +#: ../../library/cmath.rst:67 +msgid ":func:`asinh(z) `" +msgstr "" + +#: ../../library/cmath.rst:67 +#, fuzzy +msgid "Return the inverse hyperbolic sine of *z*" +msgstr "回傳 *x* 的反雙曲正弦值。" + +#: ../../library/cmath.rst:68 +msgid ":func:`atanh(z) `" +msgstr "" + +#: ../../library/cmath.rst:68 +#, fuzzy +msgid "Return the inverse hyperbolic tangent of *z*" +msgstr "回傳 *x* 的反雙曲正切值。" + +#: ../../library/cmath.rst:69 +msgid ":func:`cosh(z) `" +msgstr "" + +#: ../../library/cmath.rst:69 +#, fuzzy +msgid "Return the hyperbolic cosine of *z*" +msgstr "回傳 *x* 的反雙曲餘弦值。" + +#: ../../library/cmath.rst:70 +msgid ":func:`sinh(z) `" +msgstr "" + +#: ../../library/cmath.rst:70 +#, fuzzy +msgid "Return the hyperbolic sine of *z*" +msgstr "回傳 *x* 的反雙曲正弦值。" + +#: ../../library/cmath.rst:71 +msgid ":func:`tanh(z) `" +msgstr "" + +#: ../../library/cmath.rst:71 +#, fuzzy +msgid "Return the hyperbolic tangent of *z*" +msgstr "回傳 *x* 的反雙曲正切值。" + +#: ../../library/cmath.rst:73 +#, fuzzy +msgid "**Classification functions**" +msgstr "分類函式" + +#: ../../library/cmath.rst:75 +msgid ":func:`isfinite(z) `" +msgstr "" + +#: ../../library/cmath.rst:75 +msgid "Check if all components of *z* are finite" +msgstr "" + +#: ../../library/cmath.rst:76 +msgid ":func:`isinf(z) `" +msgstr "" + +#: ../../library/cmath.rst:76 +msgid "Check if any component of *z* is infinite" +msgstr "" + +#: ../../library/cmath.rst:77 +msgid ":func:`isnan(z) `" +msgstr "" + +#: ../../library/cmath.rst:77 +msgid "Check if any component of *z* is a NaN" +msgstr "" + +#: ../../library/cmath.rst:78 +msgid ":func:`isclose(a, b, *, rel_tol, abs_tol) `" +msgstr "" + +#: ../../library/cmath.rst:78 +#, fuzzy +msgid "Check if the values *a* and *b* are close to each other" +msgstr "如果 *a* 和 *b* 的值相互接近,則回傳 ``True``,否則回傳 ``False``。" + +#: ../../library/cmath.rst:80 +#, fuzzy +msgid "**Constants**" +msgstr "常數" + +#: ../../library/cmath.rst:82 +msgid ":data:`pi`" +msgstr "" + +#: ../../library/cmath.rst:82 +msgid "*π* = 3.141592..." +msgstr "" + +#: ../../library/cmath.rst:83 +msgid ":data:`e`" +msgstr "" + +#: ../../library/cmath.rst:83 +msgid "*e* = 2.718281..." +msgstr "" + +#: ../../library/cmath.rst:84 +msgid ":data:`tau`" +msgstr "" + +#: ../../library/cmath.rst:84 +msgid "*τ* = 2\\ *π* = 6.283185..." +msgstr "" + +#: ../../library/cmath.rst:85 +msgid ":data:`inf`" +msgstr "" + +#: ../../library/cmath.rst:85 +msgid "Positive infinity" +msgstr "" + +#: ../../library/cmath.rst:86 +msgid ":data:`infj`" +msgstr "" + +#: ../../library/cmath.rst:86 +msgid "Pure imaginary infinity" +msgstr "" + +#: ../../library/cmath.rst:87 +msgid ":data:`nan`" +msgstr "" + +#: ../../library/cmath.rst:87 +msgid "\"Not a number\" (NaN)" +msgstr "" + +#: ../../library/cmath.rst:88 +msgid ":data:`nanj`" +msgstr "" + +#: ../../library/cmath.rst:88 +msgid "Pure imaginary NaN" +msgstr "" + +#: ../../library/cmath.rst:93 +msgid "Conversions to and from polar coordinates" +msgstr "轉換到極座標和從極座標做轉換" + +#: ../../library/cmath.rst:95 msgid "" "A Python complex number ``z`` is stored internally using *rectangular* or " "*Cartesian* coordinates. It is completely determined by its *real part* ``z." @@ -99,7 +390,7 @@ msgstr "" "Python 複數 ``z`` 是用 *直角坐標* 或 *笛卡爾坐標* 儲存在內部的。它完全是由其 " "*實部* ``z.real`` 和 *虛部* ``z.imag`` 所決定。" -#: ../../library/cmath.rst:48 +#: ../../library/cmath.rst:99 msgid "" "*Polar coordinates* give an alternative way to represent a complex number. " "In polar coordinates, a complex number *z* is defined by the modulus *r* and " @@ -112,26 +403,27 @@ msgstr "" "*r* 和相位角 (phase) *phi* 定義。絕對值 *r* 是從 *z* 到原點的距離,而相位角 " "*phi* 是從正 x 軸到連接原點到 *z* 的線段的逆時針角度(以弧度為單位)。" -#: ../../library/cmath.rst:55 +#: ../../library/cmath.rst:106 msgid "" "The following functions can be used to convert from the native rectangular " "coordinates to polar coordinates and back." msgstr "以下的函式可用於原始直角座標與極座標之間的相互轉換。" -#: ../../library/cmath.rst:60 +#: ../../library/cmath.rst:111 +#, fuzzy msgid "" -"Return the phase of *x* (also known as the *argument* of *x*), as a float. " -"``phase(x)`` is equivalent to ``math.atan2(x.imag, x.real)``. The result " +"Return the phase of *z* (also known as the *argument* of *z*), as a float. " +"``phase(z)`` is equivalent to ``math.atan2(z.imag, z.real)``. The result " "lies in the range [-\\ *π*, *π*], and the branch cut for this operation lies " "along the negative real axis. The sign of the result is the same as the " -"sign of ``x.imag``, even when ``x.imag`` is zero::" +"sign of ``z.imag``, even when ``z.imag`` is zero::" msgstr "" "以浮點數的形式回傳 *x* 的相位角(也稱為 *x* 的 *引數* )。 ``phase(x)`` 等價" "於 ``math.atan2(x.imag, x.real)``。結果將位於 [-\\ *π*, *π*] 的範圍內,且此操" "作的分枝切割將位於負實軸上。結果的符號會與 ``x.imag`` 的符號相同,即使 ``x." "imag`` 為零: ::" -#: ../../library/cmath.rst:66 +#: ../../library/cmath.rst:117 msgid "" ">>> phase(complex(-1.0, 0.0))\n" "3.141592653589793\n" @@ -143,171 +435,193 @@ msgstr "" ">>> phase(complex(-1.0, -0.0))\n" "-3.141592653589793" -#: ../../library/cmath.rst:74 +#: ../../library/cmath.rst:125 +#, fuzzy msgid "" -"The modulus (absolute value) of a complex number *x* can be computed using " +"The modulus (absolute value) of a complex number *z* can be computed using " "the built-in :func:`abs` function. There is no separate :mod:`cmath` module " "function for this operation." msgstr "" "複數 *x* 的絕對值可以使用內建的 :func:`abs` 函式計算。沒有單獨的 :mod:" "`cmath` 模組函式適用於此操作。" -#: ../../library/cmath.rst:81 +#: ../../library/cmath.rst:132 +#, fuzzy msgid "" -"Return the representation of *x* in polar coordinates. Returns a pair ``(r, " -"phi)`` where *r* is the modulus of *x* and phi is the phase of *x*. " -"``polar(x)`` is equivalent to ``(abs(x), phase(x))``." +"Return the representation of *z* in polar coordinates. Returns a pair ``(r, " +"phi)`` where *r* is the modulus of *z* and *phi* is the phase of *z*. " +"``polar(z)`` is equivalent to ``(abs(z), phase(z))``." msgstr "" "回傳 *x* 在極座標中的表達方式。回傳一組數對 ``(r, phi)``, *r* 是 *x* 的絕對" "值, *phi* 是 *x* 的相位角。 ``polar(x)`` 相當於 ``(abs(x), phase(x))``。" -#: ../../library/cmath.rst:89 +#: ../../library/cmath.rst:140 +#, fuzzy msgid "" -"Return the complex number *x* with polar coordinates *r* and *phi*. " +"Return the complex number *z* with polar coordinates *r* and *phi*. " "Equivalent to ``complex(r * math.cos(phi), r * math.sin(phi))``." msgstr "" "透過極座標 *r* 和 *phi* 回傳複數 *x*。相當於 ``complex(r * math.cos(phi), r " "* math.sin(phi))``。" -#: ../../library/cmath.rst:94 +#: ../../library/cmath.rst:145 msgid "Power and logarithmic functions" msgstr "冪函數和對數函數" -#: ../../library/cmath.rst:98 +#: ../../library/cmath.rst:149 +#, fuzzy msgid "" -"Return *e* raised to the power *x*, where *e* is the base of natural " +"Return *e* raised to the power *z*, where *e* is the base of natural " "logarithms." msgstr "回傳 *e* 的 *x* 次方,其中 *e* 是自然對數的底數。" -#: ../../library/cmath.rst:104 +#: ../../library/cmath.rst:155 +#, fuzzy msgid "" -"Returns the logarithm of *x* to the given *base*. If the *base* is not " -"specified, returns the natural logarithm of *x*. There is one branch cut, " +"Return the logarithm of *z* to the given *base*. If the *base* is not " +"specified, returns the natural logarithm of *z*. There is one branch cut, " "from 0 along the negative real axis to -∞." msgstr "" "回傳 *x* 給定 *base* 的對數。如果未指定 *base*,則傳回 *x* 的自然對數。存在一" "條分枝切割,從 0 沿負實數軸到 -∞。" -#: ../../library/cmath.rst:111 +#: ../../library/cmath.rst:162 +#, fuzzy msgid "" -"Return the base-10 logarithm of *x*. This has the same branch cut as :func:" +"Return the base-10 logarithm of *z*. This has the same branch cut as :func:" "`log`." msgstr "回傳 *x* 以 10 為底的對數。它與 :func:`log` 具有相同的分枝切割。" -#: ../../library/cmath.rst:117 +#: ../../library/cmath.rst:168 +#, fuzzy msgid "" -"Return the square root of *x*. This has the same branch cut as :func:`log`." +"Return the square root of *z*. This has the same branch cut as :func:`log`." msgstr "回傳 *x* 的平方根。它與 :func:`log` 具有相同的分枝切割。" -#: ../../library/cmath.rst:121 +#: ../../library/cmath.rst:172 msgid "Trigonometric functions" msgstr "三角函數" -#: ../../library/cmath.rst:125 +#: ../../library/cmath.rst:176 +#, fuzzy msgid "" -"Return the arc cosine of *x*. There are two branch cuts: One extends right " +"Return the arc cosine of *z*. There are two branch cuts: One extends right " "from 1 along the real axis to ∞. The other extends left from -1 along the " "real axis to -∞." msgstr "" "回傳 *x* 的反餘弦值。存在兩條分枝切割:一條是從 1 沿著實數軸向右延伸到 ∞。另" "一條從 -1 沿實數軸向左延伸到 -∞。" -#: ../../library/cmath.rst:132 +#: ../../library/cmath.rst:183 +#, fuzzy msgid "" -"Return the arc sine of *x*. This has the same branch cuts as :func:`acos`." +"Return the arc sine of *z*. This has the same branch cuts as :func:`acos`." msgstr "回傳 *x* 的反正弦值。它與 :func:`acos` 具有相同的分枝切割。" -#: ../../library/cmath.rst:137 +#: ../../library/cmath.rst:188 +#, fuzzy msgid "" -"Return the arc tangent of *x*. There are two branch cuts: One extends from " +"Return the arc tangent of *z*. There are two branch cuts: One extends from " "``1j`` along the imaginary axis to ``∞j``. The other extends from ``-1j`` " "along the imaginary axis to ``-∞j``." msgstr "" "回傳 *x* 的反正切值。有兩條分枝切割:一條是從 ``1j`` 沿著虛軸延伸到 ``∞j``。" "另一條從 ``-1j`` 沿著虛軸延伸到 ``-∞j``。" -#: ../../library/cmath.rst:144 -msgid "Return the cosine of *x*." +#: ../../library/cmath.rst:195 +#, fuzzy +msgid "Return the cosine of *z*." msgstr "回傳 *x* 的餘弦值。" -#: ../../library/cmath.rst:149 -msgid "Return the sine of *x*." +#: ../../library/cmath.rst:200 +#, fuzzy +msgid "Return the sine of *z*." msgstr "回傳 *x* 的正弦值。" -#: ../../library/cmath.rst:154 -msgid "Return the tangent of *x*." +#: ../../library/cmath.rst:205 +#, fuzzy +msgid "Return the tangent of *z*." msgstr "回傳 *x* 的正切值。" -#: ../../library/cmath.rst:158 +#: ../../library/cmath.rst:209 msgid "Hyperbolic functions" msgstr "雙曲函數" -#: ../../library/cmath.rst:162 +#: ../../library/cmath.rst:213 +#, fuzzy msgid "" -"Return the inverse hyperbolic cosine of *x*. There is one branch cut, " +"Return the inverse hyperbolic cosine of *z*. There is one branch cut, " "extending left from 1 along the real axis to -∞." msgstr "" "回傳 *x* 的反雙曲餘弦值。存在一條分枝切割,從 1 沿實數軸向左延伸到 -∞。" -#: ../../library/cmath.rst:168 +#: ../../library/cmath.rst:219 +#, fuzzy msgid "" -"Return the inverse hyperbolic sine of *x*. There are two branch cuts: One " +"Return the inverse hyperbolic sine of *z*. There are two branch cuts: One " "extends from ``1j`` along the imaginary axis to ``∞j``. The other extends " "from ``-1j`` along the imaginary axis to ``-∞j``." msgstr "" "回傳 *x* 的反雙曲正弦值。存在兩條分枝切割:一條是從 ``1j`` 沿著虛軸延伸到 " "``∞j``。另一條從 ``-1j`` 沿著虛軸延伸到 ``-∞j``。" -#: ../../library/cmath.rst:175 +#: ../../library/cmath.rst:226 +#, fuzzy msgid "" -"Return the inverse hyperbolic tangent of *x*. There are two branch cuts: One " +"Return the inverse hyperbolic tangent of *z*. There are two branch cuts: One " "extends from ``1`` along the real axis to ``∞``. The other extends from " "``-1`` along the real axis to ``-∞``." msgstr "" "回傳 *x* 的反雙曲正切值。存在兩條分枝切割:一條是從 ``1`` 沿著實數軸延伸到 " "``∞``。另一條從 ``-1`` 沿著實數軸延伸到 ``-∞``。" -#: ../../library/cmath.rst:182 -msgid "Return the hyperbolic cosine of *x*." +#: ../../library/cmath.rst:233 +#, fuzzy +msgid "Return the hyperbolic cosine of *z*." msgstr "回傳 *x* 的反雙曲餘弦值。" -#: ../../library/cmath.rst:187 -msgid "Return the hyperbolic sine of *x*." +#: ../../library/cmath.rst:238 +#, fuzzy +msgid "Return the hyperbolic sine of *z*." msgstr "回傳 *x* 的反雙曲正弦值。" -#: ../../library/cmath.rst:192 -msgid "Return the hyperbolic tangent of *x*." +#: ../../library/cmath.rst:243 +#, fuzzy +msgid "Return the hyperbolic tangent of *z*." msgstr "回傳 *x* 的反雙曲正切值。" -#: ../../library/cmath.rst:196 +#: ../../library/cmath.rst:247 msgid "Classification functions" msgstr "分類函式" -#: ../../library/cmath.rst:200 +#: ../../library/cmath.rst:251 +#, fuzzy msgid "" -"Return ``True`` if both the real and imaginary parts of *x* are finite, and " +"Return ``True`` if both the real and imaginary parts of *z* are finite, and " "``False`` otherwise." msgstr "如果 *x* 的實部和虛部都是有限的,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/cmath.rst:208 +#: ../../library/cmath.rst:259 +#, fuzzy msgid "" -"Return ``True`` if either the real or the imaginary part of *x* is an " +"Return ``True`` if either the real or the imaginary part of *z* is an " "infinity, and ``False`` otherwise." msgstr "如果 *x* 的實部或虛部是無窮大,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/cmath.rst:214 +#: ../../library/cmath.rst:265 +#, fuzzy msgid "" -"Return ``True`` if either the real or the imaginary part of *x* is a NaN, " +"Return ``True`` if either the real or the imaginary part of *z* is a NaN, " "and ``False`` otherwise." msgstr "如果 *x* 的實部或虛部為 NaN,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/cmath.rst:220 +#: ../../library/cmath.rst:271 msgid "" "Return ``True`` if the values *a* and *b* are close to each other and " "``False`` otherwise." msgstr "如果 *a* 和 *b* 的值相互接近,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/cmath.rst:223 +#: ../../library/cmath.rst:274 msgid "" "Whether or not two values are considered close is determined according to " "given absolute and relative tolerances. If no errors occur, the result will " @@ -316,7 +630,7 @@ msgstr "" "兩數是否足夠接近取決於給定的絕對及相對容許偏差 (tolerance)。如果沒有錯誤發" "生,結果將為:``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``。" -#: ../../library/cmath.rst:227 +#: ../../library/cmath.rst:278 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " @@ -330,7 +644,7 @@ msgstr "" "設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須不為負" "且小於 ``1.0``。" -#: ../../library/cmath.rst:234 +#: ../../library/cmath.rst:285 msgid "" "*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " "nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " @@ -339,7 +653,7 @@ msgid "" "to the call." msgstr "" -#: ../../library/cmath.rst:240 +#: ../../library/cmath.rst:291 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " @@ -350,49 +664,49 @@ msgstr "" "處理。更明確地說,``NaN`` 不會與包含自身在內的任何數字足夠接近,而 ``inf`` " "及 ``-inf`` 皆只與自身接近。" -#: ../../library/cmath.rst:249 +#: ../../library/cmath.rst:300 msgid ":pep:`485` -- A function for testing approximate equality" msgstr ":pep:`485` ── 用於測試近似相等的函式" -#: ../../library/cmath.rst:253 +#: ../../library/cmath.rst:304 msgid "Constants" msgstr "常數" -#: ../../library/cmath.rst:257 +#: ../../library/cmath.rst:308 msgid "The mathematical constant *π*, as a float." msgstr "數學常數 *π*,作為一個浮點數。" -#: ../../library/cmath.rst:262 +#: ../../library/cmath.rst:313 msgid "The mathematical constant *e*, as a float." msgstr "數學常數 *e*,作為一個浮點數。" -#: ../../library/cmath.rst:267 +#: ../../library/cmath.rst:318 msgid "The mathematical constant *τ*, as a float." msgstr "數學常數 *τ*,作為一個浮點數。" -#: ../../library/cmath.rst:274 +#: ../../library/cmath.rst:325 msgid "Floating-point positive infinity. Equivalent to ``float('inf')``." msgstr "正無窮大的浮點數。相當於 ``float('inf')``。" -#: ../../library/cmath.rst:281 +#: ../../library/cmath.rst:332 msgid "" "Complex number with zero real part and positive infinity imaginary part. " "Equivalent to ``complex(0.0, float('inf'))``." msgstr "實部為零和虛部為正無窮的複數。相當於 ``complex(0.0, float('inf'))``。" -#: ../../library/cmath.rst:289 +#: ../../library/cmath.rst:340 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to " "``float('nan')``." msgstr "浮點「非數字」 (NaN) 值。相當於 ``float('nan')``。" -#: ../../library/cmath.rst:297 +#: ../../library/cmath.rst:348 msgid "" "Complex number with zero real part and NaN imaginary part. Equivalent to " "``complex(0.0, float('nan'))``." msgstr "實部為零和虛部為 NaN 的複數。相當於 ``complex(0.0, float('nan'))``。" -#: ../../library/cmath.rst:305 +#: ../../library/cmath.rst:356 msgid "" "Note that the selection of functions is similar, but not identical, to that " "in module :mod:`math`. The reason for having two modules is that some users " @@ -408,7 +722,7 @@ msgstr "" "sqrt(-1)`` 引發異常,也不願它回傳複數。另請注意, :mod:`cmath` 中所定義的函式" "始終都會回傳複數,即使答案可以表示為實數(在這種情況下,複數的虛部為零)。" -#: ../../library/cmath.rst:313 +#: ../../library/cmath.rst:364 msgid "" "A note on branch cuts: They are curves along which the given function fails " "to be continuous. They are a necessary feature of many complex functions. " @@ -423,17 +737,17 @@ msgstr "" "所有關於複變函數的(不是太初級的)書籍以獲得啟發。對於如何正確地基於數值目的" "選擇分枝切割的相關訊息,以下內容應該是一個很好的參考:" -#: ../../library/cmath.rst:323 +#: ../../library/cmath.rst:374 msgid "" "Kahan, W: Branch cuts for complex elementary functions; or, Much ado about " "nothing's sign bit. In Iserles, A., and Powell, M. (eds.), The state of the " "art in numerical analysis. Clarendon Press (1987) pp165--211." msgstr "" -#: ../../library/cmath.rst:303 +#: ../../library/cmath.rst:354 msgid "module" msgstr "module(模組)" -#: ../../library/cmath.rst:303 +#: ../../library/cmath.rst:354 msgid "math" msgstr "math(數學)" diff --git a/library/cmdline.po b/library/cmdline.po index 51d4a6fe87..b02a619ba9 100644 --- a/library/cmdline.po +++ b/library/cmdline.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 23:08+0000\n" +"POT-Creation-Date: 2025-03-17 00:15+0000\n" "PO-Revision-Date: 2023-10-14 16:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -62,8 +62,9 @@ msgid ":ref:`dis `" msgstr ":ref:`dis `" #: ../../library/cmdline.rst:16 -msgid ":mod:`doctest`" -msgstr ":mod:`doctest`" +#, fuzzy +msgid ":ref:`doctest `" +msgstr ":ref:`ast `" #: ../../library/cmdline.rst:17 msgid ":mod:`!encodings.rot_13`" @@ -232,3 +233,6 @@ msgstr ":ref:`zipfile `" #: ../../library/cmdline.rst:59 msgid "See also the :ref:`Python command-line interface `." msgstr "另請見 :ref:`Python 命令列介面 `。" + +#~ msgid ":mod:`doctest`" +#~ msgstr ":mod:`doctest`" diff --git a/library/codecs.po b/library/codecs.po index 90de1fd8dd..d12006bce7 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-04-13 00:40+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1537,7 +1537,7 @@ msgstr "855, IBM855" #: ../../library/codecs.rst:1106 ../../library/codecs.rst:1154 #: ../../library/codecs.rst:1219 ../../library/codecs.rst:1256 -msgid "Bulgarian, Byelorussian, Macedonian, Russian, Serbian" +msgid "Belarusian, Bulgarian, Macedonian, Russian, Serbian" msgstr "" #: ../../library/codecs.rst:1109 diff --git a/library/collections.abc.po b/library/collections.abc.po index 1edc583b3e..e680b63eff 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-07 00:14+0000\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,8 +33,8 @@ msgstr "**原始碼:**\\ :source:`Lib/_collections_abc.py`" msgid "" "This module provides :term:`abstract base classes ` " "that can be used to test whether a class provides a particular interface; " -"for example, whether it is :term:`hashable` or whether it is " -"a :term:`mapping`." +"for example, whether it is :term:`hashable` or whether it is a :term:" +"`mapping`." msgstr "" #: ../../library/collections.abc.rst:27 @@ -45,7 +45,7 @@ msgstr "" #: ../../library/collections.abc.rst:30 msgid "" -"1) A newly written class can inherit directly from one of the abstract base " +"A newly written class can inherit directly from one of the abstract base " "classes. The class must supply the required abstract methods. The " "remaining mixin methods come from inheritance and can be overridden if " "desired. Other methods may be added as needed:" @@ -71,7 +71,7 @@ msgstr "" #: ../../library/collections.abc.rst:50 msgid "" -"2) Existing classes and built-in classes can be registered as \"virtual " +"Existing classes and built-in classes can be registered as \"virtual " "subclasses\" of the ABCs. Those classes should define the full API " "including all of the abstract methods and all of the mixin methods. This " "lets users rely on :func:`issubclass` or :func:`isinstance` tests to " @@ -104,18 +104,18 @@ msgstr "" msgid "" "In this example, class :class:`!D` does not need to define ``__contains__``, " "``__iter__``, and ``__reversed__`` because the :ref:`in-operator " -"`, the :term:`iteration ` logic, and " -"the :func:`reversed` function automatically fall back to using " -"``__getitem__`` and ``__len__``." +"`, the :term:`iteration ` logic, and the :func:" +"`reversed` function automatically fall back to using ``__getitem__`` and " +"``__len__``." msgstr "" #: ../../library/collections.abc.rst:82 msgid "" -"3) Some simple interfaces are directly recognizable by the presence of the " +"Some simple interfaces are directly recognizable by the presence of the " "required methods (unless those methods have been set to :const:`None`):" msgstr "" -#: ../../library/collections.abc.rst:86 +#: ../../library/collections.abc.rst:85 msgid "" "class E:\n" " def __iter__(self): ...\n" @@ -125,7 +125,7 @@ msgstr "" " def __iter__(self): ...\n" " def __next__(self): ..." -#: ../../library/collections.abc.rst:92 +#: ../../library/collections.abc.rst:91 msgid "" ">>> issubclass(E, Iterable)\n" "True\n" @@ -137,7 +137,7 @@ msgstr "" ">>> isinstance(E(), Iterable)\n" "True" -#: ../../library/collections.abc.rst:99 +#: ../../library/collections.abc.rst:98 msgid "" "Complex interfaces do not support this last technique because an interface " "is more than just the presence of method names. Interfaces specify " @@ -147,178 +147,178 @@ msgid "" "insufficient for distinguishing a :class:`Sequence` from a :class:`Mapping`." msgstr "" -#: ../../library/collections.abc.rst:107 +#: ../../library/collections.abc.rst:106 msgid "" "These abstract classes now support ``[]``. See :ref:`types-genericalias` " "and :pep:`585`." msgstr "" -#: ../../library/collections.abc.rst:114 +#: ../../library/collections.abc.rst:113 msgid "Collections Abstract Base Classes" msgstr "" -#: ../../library/collections.abc.rst:116 +#: ../../library/collections.abc.rst:115 msgid "" "The collections module offers the following :term:`ABCs `:" msgstr "" -#: ../../library/collections.abc.rst:121 +#: ../../library/collections.abc.rst:120 msgid "ABC" msgstr "ABC" -#: ../../library/collections.abc.rst:121 +#: ../../library/collections.abc.rst:120 msgid "Inherits from" msgstr "" -#: ../../library/collections.abc.rst:121 +#: ../../library/collections.abc.rst:120 msgid "Abstract Methods" msgstr "" -#: ../../library/collections.abc.rst:121 +#: ../../library/collections.abc.rst:120 msgid "Mixin Methods" msgstr "" -#: ../../library/collections.abc.rst:123 +#: ../../library/collections.abc.rst:122 msgid ":class:`Container` [1]_" msgstr ":class:`Container` [1]_" -#: ../../library/collections.abc.rst:123 +#: ../../library/collections.abc.rst:122 msgid "``__contains__``" msgstr "``__contains__``" -#: ../../library/collections.abc.rst:124 +#: ../../library/collections.abc.rst:123 msgid ":class:`Hashable` [1]_" msgstr ":class:`Hashable` [1]_" -#: ../../library/collections.abc.rst:124 +#: ../../library/collections.abc.rst:123 msgid "``__hash__``" msgstr "``__hash__``" -#: ../../library/collections.abc.rst:125 +#: ../../library/collections.abc.rst:124 msgid ":class:`Iterable` [1]_ [2]_" msgstr ":class:`Iterable` [1]_ [2]_" -#: ../../library/collections.abc.rst:125 ../../library/collections.abc.rst:126 +#: ../../library/collections.abc.rst:124 ../../library/collections.abc.rst:125 msgid "``__iter__``" msgstr "``__iter__``" -#: ../../library/collections.abc.rst:126 +#: ../../library/collections.abc.rst:125 msgid ":class:`Iterator` [1]_" msgstr ":class:`Iterator` [1]_" -#: ../../library/collections.abc.rst:126 ../../library/collections.abc.rst:127 +#: ../../library/collections.abc.rst:125 ../../library/collections.abc.rst:126 msgid ":class:`Iterable`" msgstr ":class:`Iterable`" -#: ../../library/collections.abc.rst:126 +#: ../../library/collections.abc.rst:125 msgid "``__next__``" msgstr "``__next__``" -#: ../../library/collections.abc.rst:127 +#: ../../library/collections.abc.rst:126 msgid ":class:`Reversible` [1]_" msgstr ":class:`Reversible` [1]_" -#: ../../library/collections.abc.rst:127 +#: ../../library/collections.abc.rst:126 msgid "``__reversed__``" msgstr "``__reversed__``" -#: ../../library/collections.abc.rst:128 +#: ../../library/collections.abc.rst:127 msgid ":class:`Generator` [1]_" msgstr ":class:`Generator` [1]_" -#: ../../library/collections.abc.rst:128 +#: ../../library/collections.abc.rst:127 msgid ":class:`Iterator`" msgstr ":class:`Iterator`" -#: ../../library/collections.abc.rst:128 ../../library/collections.abc.rst:177 +#: ../../library/collections.abc.rst:127 ../../library/collections.abc.rst:176 msgid "``send``, ``throw``" msgstr "``send``、``throw``" -#: ../../library/collections.abc.rst:128 +#: ../../library/collections.abc.rst:127 msgid "``close``, ``__iter__``, ``__next__``" msgstr "``close``、``__iter__``、``__next__``" -#: ../../library/collections.abc.rst:129 +#: ../../library/collections.abc.rst:128 msgid ":class:`Sized` [1]_" msgstr ":class:`Sized` [1]_" -#: ../../library/collections.abc.rst:129 +#: ../../library/collections.abc.rst:128 msgid "``__len__``" msgstr "``__len__``" -#: ../../library/collections.abc.rst:130 +#: ../../library/collections.abc.rst:129 msgid ":class:`Callable` [1]_" msgstr ":class:`Callable` [1]_" -#: ../../library/collections.abc.rst:130 +#: ../../library/collections.abc.rst:129 msgid "``__call__``" msgstr "``__call__``" -#: ../../library/collections.abc.rst:131 +#: ../../library/collections.abc.rst:130 msgid ":class:`Collection` [1]_" msgstr ":class:`Collection` [1]_" -#: ../../library/collections.abc.rst:131 +#: ../../library/collections.abc.rst:130 msgid ":class:`Sized`, :class:`Iterable`, :class:`Container`" msgstr ":class:`Sized`、:class:`Iterable`、:class:`Container`" -#: ../../library/collections.abc.rst:131 ../../library/collections.abc.rst:147 +#: ../../library/collections.abc.rst:130 ../../library/collections.abc.rst:146 msgid "``__contains__``, ``__iter__``, ``__len__``" msgstr "``__contains__``、``__iter__``、``__len__``" -#: ../../library/collections.abc.rst:135 ../../library/collections.abc.rst:138 -#: ../../library/collections.abc.rst:144 +#: ../../library/collections.abc.rst:134 ../../library/collections.abc.rst:137 +#: ../../library/collections.abc.rst:143 msgid ":class:`Sequence`" msgstr ":class:`Sequence`" -#: ../../library/collections.abc.rst:135 +#: ../../library/collections.abc.rst:134 msgid ":class:`Reversible`, :class:`Collection`" msgstr ":class:`Reversible`, :class:`Collection`" -#: ../../library/collections.abc.rst:135 ../../library/collections.abc.rst:144 +#: ../../library/collections.abc.rst:134 ../../library/collections.abc.rst:143 msgid "``__getitem__``, ``__len__``" msgstr "``__getitem__``、``__len__``" -#: ../../library/collections.abc.rst:135 +#: ../../library/collections.abc.rst:134 msgid "" "``__contains__``, ``__iter__``, ``__reversed__``, ``index``, and ``count``" msgstr "" "``__contains__``、``__iter__``、``__reversed__``、``index`` 和 ``count``" -#: ../../library/collections.abc.rst:138 +#: ../../library/collections.abc.rst:137 msgid ":class:`MutableSequence`" msgstr ":class:`MutableSequence`" -#: ../../library/collections.abc.rst:138 +#: ../../library/collections.abc.rst:137 msgid "" "``__getitem__``, ``__setitem__``, ``__delitem__``, ``__len__``, ``insert``" msgstr "" "``__getitem__``、``__setitem__``、``__delitem__``、``__len__``、``insert``" -#: ../../library/collections.abc.rst:138 +#: ../../library/collections.abc.rst:137 msgid "" "Inherited :class:`Sequence` methods and ``append``, ``clear``, ``reverse``, " "``extend``, ``pop``, ``remove``, and ``__iadd__``" msgstr "" -#: ../../library/collections.abc.rst:144 +#: ../../library/collections.abc.rst:143 msgid ":class:`ByteString`" msgstr ":class:`ByteString`" -#: ../../library/collections.abc.rst:144 +#: ../../library/collections.abc.rst:143 msgid "Inherited :class:`Sequence` methods" msgstr "" -#: ../../library/collections.abc.rst:147 ../../library/collections.abc.rst:152 +#: ../../library/collections.abc.rst:146 ../../library/collections.abc.rst:151 msgid ":class:`Set`" msgstr ":class:`Set`" -#: ../../library/collections.abc.rst:147 ../../library/collections.abc.rst:158 +#: ../../library/collections.abc.rst:146 ../../library/collections.abc.rst:157 msgid ":class:`Collection`" msgstr ":class:`Collection`" -#: ../../library/collections.abc.rst:147 +#: ../../library/collections.abc.rst:146 msgid "" "``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, ``__gt__``, ``__ge__``, " "``__and__``, ``__or__``, ``__sub__``, ``__rsub__``, ``__xor__``, " @@ -328,29 +328,29 @@ msgstr "" "``__and__``、``__or__``、``__sub__``、``__rsub__``、``__xor__``、" "``__rxor__`` 和 ``isdisjoint``" -#: ../../library/collections.abc.rst:152 +#: ../../library/collections.abc.rst:151 msgid ":class:`MutableSet`" msgstr ":class:`MutableSet`" -#: ../../library/collections.abc.rst:152 +#: ../../library/collections.abc.rst:151 msgid "``__contains__``, ``__iter__``, ``__len__``, ``add``, ``discard``" msgstr "``__contains__``、``__iter__``、``__len__``、``add``、``discard``" -#: ../../library/collections.abc.rst:152 +#: ../../library/collections.abc.rst:151 msgid "" "Inherited :class:`Set` methods and ``clear``, ``pop``, ``remove``, " "``__ior__``, ``__iand__``, ``__ixor__``, and ``__isub__``" msgstr "" -#: ../../library/collections.abc.rst:158 ../../library/collections.abc.rst:162 +#: ../../library/collections.abc.rst:157 ../../library/collections.abc.rst:161 msgid ":class:`Mapping`" msgstr ":class:`Mapping`" -#: ../../library/collections.abc.rst:158 +#: ../../library/collections.abc.rst:157 msgid "``__getitem__``, ``__iter__``, ``__len__``" msgstr "``__getitem__``、``__iter__``、``__len__``" -#: ../../library/collections.abc.rst:158 +#: ../../library/collections.abc.rst:157 msgid "" "``__contains__``, ``keys``, ``items``, ``values``, ``get``, ``__eq__``, and " "``__ne__``" @@ -358,128 +358,128 @@ msgstr "" "``__contains__``、``keys``、``items``、``values``、``get``、``__eq__`` 和 " "``__ne__``" -#: ../../library/collections.abc.rst:162 +#: ../../library/collections.abc.rst:161 msgid ":class:`MutableMapping`" msgstr ":class:`MutableMapping`" -#: ../../library/collections.abc.rst:162 +#: ../../library/collections.abc.rst:161 msgid "" "``__getitem__``, ``__setitem__``, ``__delitem__``, ``__iter__``, ``__len__``" msgstr "" "``__getitem__``、``__setitem__``、``__delitem__``、``__iter__``、``__len__``" -#: ../../library/collections.abc.rst:162 +#: ../../library/collections.abc.rst:161 msgid "" "Inherited :class:`Mapping` methods and ``pop``, ``popitem``, ``clear``, " "``update``, and ``setdefault``" msgstr "" -#: ../../library/collections.abc.rst:169 +#: ../../library/collections.abc.rst:168 msgid ":class:`MappingView`" msgstr ":class:`MappingView`" -#: ../../library/collections.abc.rst:169 +#: ../../library/collections.abc.rst:168 msgid ":class:`Sized`" msgstr ":class:`Sized`" -#: ../../library/collections.abc.rst:169 +#: ../../library/collections.abc.rst:168 msgid "``__init__``, ``__len__`` and ``__repr__``" msgstr "``__init__``、``__len__`` 和 ``__repr__``" -#: ../../library/collections.abc.rst:170 +#: ../../library/collections.abc.rst:169 msgid ":class:`ItemsView`" msgstr ":class:`ItemsView`" -#: ../../library/collections.abc.rst:170 ../../library/collections.abc.rst:172 +#: ../../library/collections.abc.rst:169 ../../library/collections.abc.rst:171 msgid ":class:`MappingView`, :class:`Set`" msgstr ":class:`MappingView`、:class:`Set`" -#: ../../library/collections.abc.rst:170 ../../library/collections.abc.rst:172 -#: ../../library/collections.abc.rst:174 +#: ../../library/collections.abc.rst:169 ../../library/collections.abc.rst:171 +#: ../../library/collections.abc.rst:173 msgid "``__contains__``, ``__iter__``" msgstr "``__contains__``、``__iter__``" -#: ../../library/collections.abc.rst:172 +#: ../../library/collections.abc.rst:171 msgid ":class:`KeysView`" msgstr ":class:`KeysView`" -#: ../../library/collections.abc.rst:174 +#: ../../library/collections.abc.rst:173 msgid ":class:`ValuesView`" msgstr ":class:`ValuesView`" -#: ../../library/collections.abc.rst:174 +#: ../../library/collections.abc.rst:173 msgid ":class:`MappingView`, :class:`Collection`" msgstr ":class:`MappingView`、:class:`Collection`" -#: ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:175 msgid ":class:`Awaitable` [1]_" msgstr ":class:`Awaitable` [1]_" -#: ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:175 msgid "``__await__``" msgstr "``__await__``" -#: ../../library/collections.abc.rst:177 +#: ../../library/collections.abc.rst:176 msgid ":class:`Coroutine` [1]_" msgstr ":class:`Coroutine` [1]_" -#: ../../library/collections.abc.rst:177 +#: ../../library/collections.abc.rst:176 msgid ":class:`Awaitable`" msgstr ":class:`Awaitable`" -#: ../../library/collections.abc.rst:177 +#: ../../library/collections.abc.rst:176 msgid "``close``" msgstr "``close``" -#: ../../library/collections.abc.rst:178 +#: ../../library/collections.abc.rst:177 msgid ":class:`AsyncIterable` [1]_" msgstr ":class:`AsyncIterable` [1]_" -#: ../../library/collections.abc.rst:178 ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:177 ../../library/collections.abc.rst:178 msgid "``__aiter__``" msgstr "``__aiter__``" -#: ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:178 msgid ":class:`AsyncIterator` [1]_" msgstr ":class:`AsyncIterator` [1]_" -#: ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:178 msgid ":class:`AsyncIterable`" msgstr ":class:`AsyncIterable`" -#: ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:178 msgid "``__anext__``" msgstr "``__anext__``" -#: ../../library/collections.abc.rst:180 +#: ../../library/collections.abc.rst:179 msgid ":class:`AsyncGenerator` [1]_" msgstr ":class:`AsyncGenerator` [1]_" -#: ../../library/collections.abc.rst:180 +#: ../../library/collections.abc.rst:179 msgid ":class:`AsyncIterator`" msgstr ":class:`AsyncIterator`" -#: ../../library/collections.abc.rst:180 +#: ../../library/collections.abc.rst:179 msgid "``asend``, ``athrow``" msgstr "``asend``、``athrow``" -#: ../../library/collections.abc.rst:180 +#: ../../library/collections.abc.rst:179 msgid "``aclose``, ``__aiter__``, ``__anext__``" msgstr "``aclose``、``__aiter__``、``__anext__``" -#: ../../library/collections.abc.rst:181 +#: ../../library/collections.abc.rst:180 msgid ":class:`Buffer` [1]_" msgstr ":class:`Buffer` [1]_" -#: ../../library/collections.abc.rst:181 +#: ../../library/collections.abc.rst:180 msgid "``__buffer__``" msgstr "``__buffer__``" -#: ../../library/collections.abc.rst:186 +#: ../../library/collections.abc.rst:185 msgid "Footnotes" msgstr "註腳" -#: ../../library/collections.abc.rst:187 +#: ../../library/collections.abc.rst:186 msgid "" "These ABCs override :meth:`~abc.ABCMeta.__subclasshook__` to support testing " "an interface by verifying the required methods are present and have not been " @@ -487,214 +487,211 @@ msgid "" "interfaces require registration or direct subclassing." msgstr "" -#: ../../library/collections.abc.rst:193 +#: ../../library/collections.abc.rst:192 msgid "" "Checking ``isinstance(obj, Iterable)`` detects classes that are registered " "as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but " "it does not detect classes that iterate with the :meth:`~object.__getitem__` " -"method. The only reliable way to determine whether an object " -"is :term:`iterable` is to call ``iter(obj)``." +"method. The only reliable way to determine whether an object is :term:" +"`iterable` is to call ``iter(obj)``." msgstr "" -#: ../../library/collections.abc.rst:201 +#: ../../library/collections.abc.rst:200 msgid "Collections Abstract Base Classes -- Detailed Descriptions" msgstr "" -#: ../../library/collections.abc.rst:206 +#: ../../library/collections.abc.rst:205 msgid "ABC for classes that provide the :meth:`~object.__contains__` method." msgstr "" -#: ../../library/collections.abc.rst:210 +#: ../../library/collections.abc.rst:209 msgid "ABC for classes that provide the :meth:`~object.__hash__` method." msgstr "" -#: ../../library/collections.abc.rst:214 +#: ../../library/collections.abc.rst:213 msgid "ABC for classes that provide the :meth:`~object.__len__` method." msgstr "" -#: ../../library/collections.abc.rst:218 +#: ../../library/collections.abc.rst:217 msgid "ABC for classes that provide the :meth:`~object.__call__` method." msgstr "" -#: ../../library/collections.abc.rst:220 +#: ../../library/collections.abc.rst:219 msgid "" "See :ref:`annotating-callables` for details on how to use :class:`!Callable` " "in type annotations." msgstr "" -#: ../../library/collections.abc.rst:225 +#: ../../library/collections.abc.rst:224 msgid "ABC for classes that provide the :meth:`~container.__iter__` method." msgstr "" -#: ../../library/collections.abc.rst:227 +#: ../../library/collections.abc.rst:226 msgid "" "Checking ``isinstance(obj, Iterable)`` detects classes that are registered " "as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but " "it does not detect classes that iterate with the :meth:`~object.__getitem__` " -"method. The only reliable way to determine whether an object " -"is :term:`iterable` is to call ``iter(obj)``." +"method. The only reliable way to determine whether an object is :term:" +"`iterable` is to call ``iter(obj)``." msgstr "" -#: ../../library/collections.abc.rst:236 +#: ../../library/collections.abc.rst:235 msgid "ABC for sized iterable container classes." msgstr "" -#: ../../library/collections.abc.rst:242 +#: ../../library/collections.abc.rst:241 msgid "" -"ABC for classes that provide the :meth:`~iterator.__iter__` " -"and :meth:`~iterator.__next__` methods. See also the definition " -"of :term:`iterator`." +"ABC for classes that provide the :meth:`~iterator.__iter__` and :meth:" +"`~iterator.__next__` methods. See also the definition of :term:`iterator`." msgstr "" -#: ../../library/collections.abc.rst:248 +#: ../../library/collections.abc.rst:247 msgid "" "ABC for iterable classes that also provide the :meth:`~object.__reversed__` " "method." msgstr "" -#: ../../library/collections.abc.rst:255 +#: ../../library/collections.abc.rst:254 msgid "" -"ABC for :term:`generator` classes that implement the protocol defined " -"in :pep:`342` that extends :term:`iterators ` with " -"the :meth:`~generator.send`, :meth:`~generator.throw` " -"and :meth:`~generator.close` methods." +"ABC for :term:`generator` classes that implement the protocol defined in :" +"pep:`342` that extends :term:`iterators ` with the :meth:" +"`~generator.send`, :meth:`~generator.throw` and :meth:`~generator.close` " +"methods." msgstr "" -#: ../../library/collections.abc.rst:260 +#: ../../library/collections.abc.rst:259 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on " -"using :class:`!Generator` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`!Generator` in type annotations." msgstr "" -#: ../../library/collections.abc.rst:269 +#: ../../library/collections.abc.rst:268 msgid "ABCs for read-only and mutable :term:`sequences `." msgstr "" -#: ../../library/collections.abc.rst:271 +#: ../../library/collections.abc.rst:270 msgid "" -"Implementation note: Some of the mixin methods, such " -"as :meth:`~container.__iter__`, :meth:`~object.__reversed__` " -"and :meth:`index`, make repeated calls to the " -"underlying :meth:`~object.__getitem__` method. Consequently, " +"Implementation note: Some of the mixin methods, such as :meth:`~container." +"__iter__`, :meth:`~object.__reversed__` and :meth:`index`, make repeated " +"calls to the underlying :meth:`~object.__getitem__` method. Consequently, " "if :meth:`~object.__getitem__` is implemented with constant access speed, " "the mixin methods will have linear performance; however, if the underlying " "method is linear (as it would be with a linked list), the mixins will have " "quadratic performance and will likely need to be overridden." msgstr "" -#: ../../library/collections.abc.rst:280 +#: ../../library/collections.abc.rst:279 msgid "The index() method added support for *stop* and *start* arguments." msgstr "" -#: ../../library/collections.abc.rst:284 +#: ../../library/collections.abc.rst:283 msgid "" "The :class:`ByteString` ABC has been deprecated. For use in typing, prefer a " "union, like ``bytes | bytearray``, or :class:`collections.abc.Buffer`. For " "use as an ABC, prefer :class:`Sequence` or :class:`collections.abc.Buffer`." msgstr "" -#: ../../library/collections.abc.rst:293 +#: ../../library/collections.abc.rst:292 msgid "ABCs for read-only and mutable :ref:`sets `." msgstr "" -#: ../../library/collections.abc.rst:298 +#: ../../library/collections.abc.rst:297 msgid "ABCs for read-only and mutable :term:`mappings `." msgstr "" -#: ../../library/collections.abc.rst:305 +#: ../../library/collections.abc.rst:304 msgid "" "ABCs for mapping, items, keys, and values :term:`views `." msgstr "" -#: ../../library/collections.abc.rst:309 +#: ../../library/collections.abc.rst:308 msgid "" "ABC for :term:`awaitable` objects, which can be used in :keyword:`await` " -"expressions. Custom implementations must provide " -"the :meth:`~object.__await__` method." +"expressions. Custom implementations must provide the :meth:`~object." +"__await__` method." msgstr "" -#: ../../library/collections.abc.rst:313 +#: ../../library/collections.abc.rst:312 msgid "" -":term:`Coroutine ` objects and instances of " -"the :class:`~collections.abc.Coroutine` ABC are all instances of this ABC." +":term:`Coroutine ` objects and instances of the :class:" +"`~collections.abc.Coroutine` ABC are all instances of this ABC." msgstr "" -#: ../../library/collections.abc.rst:317 +#: ../../library/collections.abc.rst:316 msgid "" "In CPython, generator-based coroutines (:term:`generators ` " "decorated with :func:`@types.coroutine `) are *awaitables*, " "even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Awaitable)`` for them will return ``False``. " -"Use :func:`inspect.isawaitable` to detect them." +"``isinstance(gencoro, Awaitable)`` for them will return ``False``. Use :func:" +"`inspect.isawaitable` to detect them." msgstr "" -#: ../../library/collections.abc.rst:327 +#: ../../library/collections.abc.rst:326 msgid "" "ABC for :term:`coroutine` compatible classes. These implement the following " -"methods, defined in :ref:`coroutine-" -"objects`: :meth:`~coroutine.send`, :meth:`~coroutine.throw`, " -"and :meth:`~coroutine.close`. Custom implementations must also " -"implement :meth:`~object.__await__`. All :class:`Coroutine` instances are " -"also instances of :class:`Awaitable`." +"methods, defined in :ref:`coroutine-objects`: :meth:`~coroutine.send`, :meth:" +"`~coroutine.throw`, and :meth:`~coroutine.close`. Custom implementations " +"must also implement :meth:`~object.__await__`. All :class:`Coroutine` " +"instances are also instances of :class:`Awaitable`." msgstr "" -#: ../../library/collections.abc.rst:335 +#: ../../library/collections.abc.rst:334 msgid "" "In CPython, generator-based coroutines (:term:`generators ` " "decorated with :func:`@types.coroutine `) are *awaitables*, " "even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Coroutine)`` for them will return ``False``. " -"Use :func:`inspect.isawaitable` to detect them." +"``isinstance(gencoro, Coroutine)`` for them will return ``False``. Use :func:" +"`inspect.isawaitable` to detect them." msgstr "" -#: ../../library/collections.abc.rst:341 +#: ../../library/collections.abc.rst:340 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on " -"using :class:`!Coroutine` in type annotations. The variance and order of " -"type parameters correspond to those of :class:`Generator`." +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`!Coroutine` in type annotations. The variance and order of type parameters " +"correspond to those of :class:`Generator`." msgstr "" -#: ../../library/collections.abc.rst:350 +#: ../../library/collections.abc.rst:349 msgid "" "ABC for classes that provide an ``__aiter__`` method. See also the " "definition of :term:`asynchronous iterable`." msgstr "" -#: ../../library/collections.abc.rst:357 +#: ../../library/collections.abc.rst:356 msgid "" "ABC for classes that provide ``__aiter__`` and ``__anext__`` methods. See " "also the definition of :term:`asynchronous iterator`." msgstr "" -#: ../../library/collections.abc.rst:364 +#: ../../library/collections.abc.rst:363 msgid "" "ABC for :term:`asynchronous generator` classes that implement the protocol " "defined in :pep:`525` and :pep:`492`." msgstr "" -#: ../../library/collections.abc.rst:367 +#: ../../library/collections.abc.rst:366 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on " -"using :class:`!AsyncGenerator` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`!AsyncGenerator` in type annotations." msgstr "" -#: ../../library/collections.abc.rst:374 +#: ../../library/collections.abc.rst:373 msgid "" "ABC for classes that provide the :meth:`~object.__buffer__` method, " "implementing the :ref:`buffer protocol `. See :pep:`688`." msgstr "" -#: ../../library/collections.abc.rst:380 +#: ../../library/collections.abc.rst:379 msgid "Examples and Recipes" msgstr "" -#: ../../library/collections.abc.rst:382 +#: ../../library/collections.abc.rst:381 msgid "" "ABCs allow us to ask classes or instances if they provide particular " "functionality, for example::" msgstr "" -#: ../../library/collections.abc.rst:385 +#: ../../library/collections.abc.rst:384 msgid "" "size = None\n" "if isinstance(myvar, collections.abc.Sized):\n" @@ -704,18 +701,17 @@ msgstr "" "if isinstance(myvar, collections.abc.Sized):\n" " size = len(myvar)" -#: ../../library/collections.abc.rst:389 +#: ../../library/collections.abc.rst:388 msgid "" "Several of the ABCs are also useful as mixins that make it easier to develop " "classes supporting container APIs. For example, to write a class supporting " "the full :class:`Set` API, it is only necessary to supply the three " -"underlying abstract " -"methods: :meth:`~object.__contains__`, :meth:`~container.__iter__`, " -"and :meth:`~object.__len__`. The ABC supplies the remaining methods such " -"as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" +"underlying abstract methods: :meth:`~object.__contains__`, :meth:`~container." +"__iter__`, and :meth:`~object.__len__`. The ABC supplies the remaining " +"methods such as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" msgstr "" -#: ../../library/collections.abc.rst:396 +#: ../../library/collections.abc.rst:395 msgid "" "class ListBasedSet(collections.abc.Set):\n" " ''' Alternate set implementation favoring space over speed\n" @@ -741,31 +737,31 @@ msgid "" "automatically" msgstr "" -#: ../../library/collections.abc.rst:418 +#: ../../library/collections.abc.rst:417 msgid "Notes on using :class:`Set` and :class:`MutableSet` as a mixin:" msgstr "" -#: ../../library/collections.abc.rst:421 +#: ../../library/collections.abc.rst:420 msgid "" "Since some set operations create new sets, the default mixin methods need a " "way to create new instances from an :term:`iterable`. The class constructor " "is assumed to have a signature in the form ``ClassName(iterable)``. That " -"assumption is factored-out to an internal :class:`classmethod` " -"called :meth:`!_from_iterable` which calls ``cls(iterable)`` to produce a " -"new set. If the :class:`Set` mixin is being used in a class with a different " -"constructor signature, you will need to override :meth:`!_from_iterable` " -"with a classmethod or regular method that can construct new instances from " -"an iterable argument." +"assumption is factored-out to an internal :class:`classmethod` called :meth:" +"`!_from_iterable` which calls ``cls(iterable)`` to produce a new set. If " +"the :class:`Set` mixin is being used in a class with a different constructor " +"signature, you will need to override :meth:`!_from_iterable` with a " +"classmethod or regular method that can construct new instances from an " +"iterable argument." msgstr "" -#: ../../library/collections.abc.rst:432 +#: ../../library/collections.abc.rst:431 msgid "" "To override the comparisons (presumably for speed, as the semantics are " "fixed), redefine :meth:`~object.__le__` and :meth:`~object.__ge__`, then the " "other operations will automatically follow suit." msgstr "" -#: ../../library/collections.abc.rst:438 +#: ../../library/collections.abc.rst:437 msgid "" "The :class:`Set` mixin provides a :meth:`!_hash` method to compute a hash " "value for the set; however, :meth:`~object.__hash__` is not defined because " @@ -774,12 +770,12 @@ msgid "" "define ``__hash__ = Set._hash``." msgstr "" -#: ../../library/collections.abc.rst:446 +#: ../../library/collections.abc.rst:445 msgid "" "`OrderedSet recipe `_ for an " "example built on :class:`MutableSet`." msgstr "" -#: ../../library/collections.abc.rst:449 +#: ../../library/collections.abc.rst:448 msgid "For more about ABCs, see the :mod:`abc` module and :pep:`3119`." msgstr "關於 ABC 的更多資訊請見 :mod:`abc` module 和 :pep:`3119`。" diff --git a/library/collections.po b/library/collections.po index abc99d12e2..7edb1a7b92 100644 --- a/library/collections.po +++ b/library/collections.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-03 00:15+0000\n" +"POT-Creation-Date: 2025-03-04 00:14+0000\n" "PO-Revision-Date: 2024-01-22 21:42+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1183,10 +1183,11 @@ msgstr "" "`~object.__getitem__` 所傳遞。" #: ../../library/collections.rst:750 +#, fuzzy msgid "" "Note that :meth:`__missing__` is *not* called for any operations besides :" -"meth:`~object.__getitem__`. This means that :meth:`get` will, like normal " -"dictionaries, return ``None`` as a default rather than using :attr:" +"meth:`~object.__getitem__`. This means that :meth:`~dict.get` will, like " +"normal dictionaries, return ``None`` as a default rather than using :attr:" "`default_factory`." msgstr "" "注意,:meth:`__missing__` *不會*\\ 被 :meth:`~object.__getitem__` 以外的其他" @@ -1206,7 +1207,7 @@ msgstr "" "此屬性為 :meth:`__missing__` 方法所使用。如果有引數被傳入建構函式,則此屬性會" "被初始化成第一個引數,如未提供引數則被初始化為 ``None``。" -#: ../../library/collections.rst:765 ../../library/collections.rst:1191 +#: ../../library/collections.rst:765 ../../library/collections.rst:1192 msgid "" "Added merge (``|``) and update (``|=``) operators, specified in :pep:`584`." msgstr "新增合併 (``|``) 和更新 (``|=``) 運算子,請見 :pep:`584`。" @@ -1295,12 +1296,14 @@ msgstr "" "來存取欄位的能力。" #: ../../library/collections.rst:849 +#, fuzzy msgid "" "Returns a new tuple subclass named *typename*. The new subclass is used to " "create tuple-like objects that have fields accessible by attribute lookup as " "well as being indexable and iterable. Instances of the subclass also have a " -"helpful docstring (with typename and field_names) and a helpful :meth:" -"`__repr__` method which lists the tuple contents in a ``name=value`` format." +"helpful docstring (with *typename* and *field_names*) and a helpful :meth:" +"`~object.__repr__` method which lists the tuple contents in a ``name=value`` " +"format." msgstr "" "回傳一個名為 *typename* 的新 tuple 子類別。這個新的子類別被用於建立類似 " "tuple 的物件,可以透過屬性名稱來存取欄位,它同時也是可索引 (indexable) 和可疊" @@ -1308,7 +1311,7 @@ msgstr "" "位名 field_names)和一個好用的 :meth:`__repr__` 方法,可將 tuple 內容以 " "``name=value`` 格式列出。" -#: ../../library/collections.rst:855 +#: ../../library/collections.rst:856 msgid "" "The *field_names* are a sequence of strings such as ``['x', 'y']``. " "Alternatively, *field_names* can be a single string with each fieldname " @@ -1317,7 +1320,7 @@ msgstr "" "*field_names* 是一個像 ``['x', 'y']`` 一樣的字串序列。*field_names* 也可以是" "一個用空白或逗號分隔各個欄位名稱的字串,比如 ``'x y'`` 或者 ``'x, y'``。" -#: ../../library/collections.rst:859 +#: ../../library/collections.rst:860 msgid "" "Any valid Python identifier may be used for a fieldname except for names " "starting with an underscore. Valid identifiers consist of letters, digits, " @@ -1329,7 +1332,7 @@ msgstr "" "詞 :mod:`keyword`,例如 *class*、*for*、*return*、*global*、*pass* 或 " "*raise*。" -#: ../../library/collections.rst:865 +#: ../../library/collections.rst:866 msgid "" "If *rename* is true, invalid fieldnames are automatically replaced with " "positional names. For example, ``['abc', 'def', 'ghi', 'abc']`` is " @@ -1340,7 +1343,7 @@ msgstr "" "'def', 'ghi', 'abc']`` 會被轉換成 ``['abc', '_1', 'ghi', '_3']``,移除了關鍵" "字 ``def`` 和重複欄位名 ``abc``。" -#: ../../library/collections.rst:870 +#: ../../library/collections.rst:871 msgid "" "*defaults* can be ``None`` or an :term:`iterable` of default values. Since " "fields with a default value must come after any fields without a default, " @@ -1354,7 +1357,7 @@ msgstr "" "如 fieldnames 為 ``['x', 'y', 'z']`` 且 defaults 為 ``(1, 2)``,那麼 ``x`` 就" "必須被給定一個引數,``y`` 被預設為 ``1``,``z`` 則被預設為 ``2``。" -#: ../../library/collections.rst:877 +#: ../../library/collections.rst:878 msgid "" "If *module* is defined, the :attr:`~type.__module__` attribute of the named " "tuple is set to that value." @@ -1362,7 +1365,7 @@ msgstr "" "如果 *module* 值有被定義,named tuple 的 :attr:`~type.__module__` 屬性就被設" "定為該值。" -#: ../../library/collections.rst:880 +#: ../../library/collections.rst:881 msgid "" "Named tuple instances do not have per-instance dictionaries, so they are " "lightweight and require no more memory than regular tuples." @@ -1370,17 +1373,17 @@ msgstr "" "Named tuple 實例中沒有字典,所以它們更加輕量,且和一般 tuple 相比佔用更少記憶" "體。" -#: ../../library/collections.rst:883 +#: ../../library/collections.rst:884 msgid "" "To support pickling, the named tuple class should be assigned to a variable " "that matches *typename*." msgstr "要支援 pickle,應將 named tuple 類別賦值給一個符合 *typename* 的變數。" -#: ../../library/collections.rst:886 +#: ../../library/collections.rst:887 msgid "Added support for *rename*." msgstr "新增對於 *rename* 的支援。" -#: ../../library/collections.rst:889 +#: ../../library/collections.rst:890 msgid "" "The *verbose* and *rename* parameters became :ref:`keyword-only arguments " "`." @@ -1388,20 +1391,23 @@ msgstr "" "*verbose* 和 *rename* 參數成為\\ :ref:`僅限關鍵字引數 `。" -#: ../../library/collections.rst:893 +#: ../../library/collections.rst:894 msgid "Added the *module* parameter." msgstr "新增 *module* 參數。" -#: ../../library/collections.rst:896 -msgid "Removed the *verbose* parameter and the :attr:`_source` attribute." +#: ../../library/collections.rst:897 +#, fuzzy +msgid "Removed the *verbose* parameter and the :attr:`!_source` attribute." msgstr "移除 *verbose* 參數和 :attr:`_source` 屬性。" -#: ../../library/collections.rst:899 +#: ../../library/collections.rst:900 +#, fuzzy msgid "" -"Added the *defaults* parameter and the :attr:`_field_defaults` attribute." +"Added the *defaults* parameter and the :attr:`~somenamedtuple." +"_field_defaults` attribute." msgstr "新增 *defaults* 參數和 :attr:`_field_defaults` 屬性。" -#: ../../library/collections.rst:903 +#: ../../library/collections.rst:904 msgid "" ">>> # Basic example\n" ">>> Point = namedtuple('Point', ['x', 'y'])\n" @@ -1418,7 +1424,7 @@ msgid "" "Point(x=11, y=22)" msgstr "" -#: ../../library/collections.rst:919 +#: ../../library/collections.rst:920 msgid "" "Named tuples are especially useful for assigning field names to result " "tuples returned by the :mod:`csv` or :mod:`sqlite3` modules::" @@ -1426,7 +1432,7 @@ msgstr "" "Named tuple 在賦予欄位名稱於 :mod:`csv` 或 :mod:`sqlite3` 模組回傳之 tuple 時" "相當有用: ::" -#: ../../library/collections.rst:922 +#: ../../library/collections.rst:923 msgid "" "EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, " "paygrade')\n" @@ -1460,7 +1466,7 @@ msgstr "" "for emp in map(EmployeeRecord._make, cursor.fetchall()):\n" " print(emp.name, emp.title)" -#: ../../library/collections.rst:935 +#: ../../library/collections.rst:936 msgid "" "In addition to the methods inherited from tuples, named tuples support three " "additional methods and two attributes. To prevent conflicts with field " @@ -1469,12 +1475,12 @@ msgstr "" "除了繼承自 tuple 的方法,named tuple 還支援三個額外的方法和兩個屬性。為了防止" "欄位名稱有衝突,方法和屬性的名稱以底線開頭。" -#: ../../library/collections.rst:941 +#: ../../library/collections.rst:942 msgid "" "Class method that makes a new instance from an existing sequence or iterable." msgstr "從已存在的序列或可疊代物件建立一個新實例的類別方法。" -#: ../../library/collections.rst:943 +#: ../../library/collections.rst:944 msgid "" ">>> t = [11, 22]\n" ">>> Point._make(t)\n" @@ -1484,13 +1490,13 @@ msgstr "" ">>> Point._make(t)\n" "Point(x=11, y=22)" -#: ../../library/collections.rst:951 +#: ../../library/collections.rst:952 msgid "" "Return a new :class:`dict` which maps field names to their corresponding " "values:" msgstr "回傳一個將欄位名稱對映至對應值的 :class:`dict`:" -#: ../../library/collections.rst:954 +#: ../../library/collections.rst:955 msgid "" ">>> p = Point(x=11, y=22)\n" ">>> p._asdict()\n" @@ -1500,11 +1506,11 @@ msgstr "" ">>> p._asdict()\n" "{'x': 11, 'y': 22}" -#: ../../library/collections.rst:960 +#: ../../library/collections.rst:961 msgid "Returns an :class:`OrderedDict` instead of a regular :class:`dict`." msgstr "回傳一個 :class:`OrderedDict` 而非 :class:`dict`。" -#: ../../library/collections.rst:963 +#: ../../library/collections.rst:964 msgid "" "Returns a regular :class:`dict` instead of an :class:`OrderedDict`. As of " "Python 3.7, regular dicts are guaranteed to be ordered. If the extra " @@ -1515,13 +1521,13 @@ msgstr "" "dict 已經保證有順序性,如果需要 :class:`OrderedDict` 所專屬的特性,推薦的解法" "是將結果專換成所需的類型:``OrderedDict(nt._asdict())``。" -#: ../../library/collections.rst:972 +#: ../../library/collections.rst:973 msgid "" "Return a new instance of the named tuple replacing specified fields with new " "values::" msgstr "回傳一個新的 named tuple 實例,並將指定欄位替換為新的值: ::" -#: ../../library/collections.rst:975 +#: ../../library/collections.rst:976 msgid "" ">>> p = Point(x=11, y=22)\n" ">>> p._replace(x=33)\n" @@ -1539,18 +1545,18 @@ msgstr "" "... inventory[partnum] = record._replace(price=newprices[partnum], " "timestamp=time.now())" -#: ../../library/collections.rst:982 +#: ../../library/collections.rst:983 msgid "" "Named tuples are also supported by generic function :func:`copy.replace`." msgstr "" -#: ../../library/collections.rst:984 +#: ../../library/collections.rst:985 msgid "" "Raise :exc:`TypeError` instead of :exc:`ValueError` for invalid keyword " "arguments." msgstr "" -#: ../../library/collections.rst:990 +#: ../../library/collections.rst:991 msgid "" "Tuple of strings listing the field names. Useful for introspection and for " "creating new named tuple types from existing named tuples." @@ -1558,7 +1564,7 @@ msgstr "" "列出 tuple 欄位名稱的字串,用於自我檢查或是從現有 named tuple 建立一個新的 " "named tuple 型別。" -#: ../../library/collections.rst:993 +#: ../../library/collections.rst:994 msgid "" ">>> p._fields # view the field names\n" "('x', 'y')\n" @@ -1569,11 +1575,11 @@ msgid "" "Pixel(x=11, y=22, red=128, green=255, blue=0)" msgstr "" -#: ../../library/collections.rst:1005 +#: ../../library/collections.rst:1006 msgid "Dictionary mapping field names to default values." msgstr "將欄位名稱對映至預設值的字典。" -#: ../../library/collections.rst:1007 +#: ../../library/collections.rst:1008 msgid "" ">>> Account = namedtuple('Account', ['type', 'balance'], defaults=[0])\n" ">>> Account._field_defaults\n" @@ -1587,13 +1593,13 @@ msgstr "" ">>> Account('premium')\n" "Account(type='premium', balance=0)" -#: ../../library/collections.rst:1015 +#: ../../library/collections.rst:1016 msgid "" "To retrieve a field whose name is stored in a string, use the :func:" "`getattr` function:" msgstr "要取得這個名稱存於字串的欄位,要使用 :func:`getattr` 函式:" -#: ../../library/collections.rst:1021 +#: ../../library/collections.rst:1022 msgid "" "To convert a dictionary to a named tuple, use the double-star-operator (as " "described in :ref:`tut-unpacking-arguments`):" @@ -1601,7 +1607,7 @@ msgstr "" "(如\\ :ref:`tut-unpacking-arguments`\\ 所述)將一個字典轉換成 named tuple," "要使用 \\*\\* 雙星號運算子:" -#: ../../library/collections.rst:1028 +#: ../../library/collections.rst:1029 msgid "" "Since a named tuple is a regular Python class, it is easy to add or change " "functionality with a subclass. Here is how to add a calculated field and a " @@ -1610,7 +1616,7 @@ msgstr "" "因為一個 named tuple 是一個常規的 Python 類別,我們可以很容易的透過子類別來新" "增或更改功能,以下是如何新增一個計算得到的欄位和固定寬度的輸出列印格式:" -#: ../../library/collections.rst:1032 +#: ../../library/collections.rst:1033 msgid "" ">>> class Point(namedtuple('Point', ['x', 'y'])):\n" "... __slots__ = ()\n" @@ -1640,7 +1646,7 @@ msgstr "" "Point: x= 3.000 y= 4.000 hypot= 5.000\n" "Point: x=14.000 y= 0.714 hypot=14.018" -#: ../../library/collections.rst:1047 +#: ../../library/collections.rst:1048 msgid "" "The subclass shown above sets ``__slots__`` to an empty tuple. This helps " "keep memory requirements low by preventing the creation of instance " @@ -1649,7 +1655,7 @@ msgstr "" "上面的子類別將 ``__slots__`` 設定為空 tuple,這樣一來就防止了字典實例被建立," "因而保持了較低的記憶體用量。" -#: ../../library/collections.rst:1050 +#: ../../library/collections.rst:1051 msgid "" "Subclassing is not useful for adding new, stored fields. Instead, simply " "create a new named tuple type from the :attr:`~somenamedtuple._fields` " @@ -1658,17 +1664,17 @@ msgstr "" "子類別化無法用於增加新的、已被儲存的欄位,應當透過 :attr:`~somenamedtuple." "_fields` 屬性以建立一個新的 named tuple 來實現:" -#: ../../library/collections.rst:1055 +#: ../../library/collections.rst:1056 msgid "" "Docstrings can be customized by making direct assignments to the ``__doc__`` " "fields:" msgstr "透過直接賦值給 ``__doc__``,可以自訂說明文件字串:" -#: ../../library/collections.rst:1064 +#: ../../library/collections.rst:1065 msgid "Property docstrings became writeable." msgstr "文件字串屬性變成可寫入。" -#: ../../library/collections.rst:1069 +#: ../../library/collections.rst:1070 msgid "" "See :class:`typing.NamedTuple` for a way to add type hints for named " "tuples. It also provides an elegant notation using the :keyword:`class` " @@ -1677,7 +1683,7 @@ msgstr "" "關於為 named tuple 新增型別提示的方法,請參閱 :class:`typing.NamedTuple`,它" "運用 :keyword:`class` 關鍵字以提供了一個簡潔的表示法: ::" -#: ../../library/collections.rst:1073 +#: ../../library/collections.rst:1074 msgid "" "class Component(NamedTuple):\n" " part_number: int\n" @@ -1689,7 +1695,7 @@ msgstr "" " weight: float\n" " description: Optional[str] = None" -#: ../../library/collections.rst:1078 +#: ../../library/collections.rst:1079 msgid "" "See :meth:`types.SimpleNamespace` for a mutable namespace based on an " "underlying dictionary instead of a tuple." @@ -1697,7 +1703,7 @@ msgstr "" "關於以 dict 而非 tuple 為底層的可變命名空間,請參考 :meth:`types." "SimpleNamespace`。" -#: ../../library/collections.rst:1081 +#: ../../library/collections.rst:1082 msgid "" "The :mod:`dataclasses` module provides a decorator and functions for " "automatically adding generated special methods to user-defined classes." @@ -1705,11 +1711,11 @@ msgstr "" ":mod:`dataclasses` 模組提供了一個裝飾器和一些函式,用於自動將被生成的特殊方法" "新增到使用者定義的類別中。" -#: ../../library/collections.rst:1086 +#: ../../library/collections.rst:1087 msgid ":class:`OrderedDict` objects" msgstr ":class:`OrderedDict` 物件" -#: ../../library/collections.rst:1088 +#: ../../library/collections.rst:1089 msgid "" "Ordered dictionaries are just like regular dictionaries but have some extra " "capabilities relating to ordering operations. They have become less " @@ -1720,11 +1726,11 @@ msgstr "" "功能,但由於內建的 :class:`dict` 類別現在已經有記憶插入順序的能力(Python " "3.7 中確保了這種新行為),它們變得不那麼重要了。" -#: ../../library/collections.rst:1094 +#: ../../library/collections.rst:1095 msgid "Some differences from :class:`dict` still remain:" msgstr "仍存在一些與 :class:`dict` 的不同之處:" -#: ../../library/collections.rst:1096 +#: ../../library/collections.rst:1097 msgid "" "The regular :class:`dict` was designed to be very good at mapping " "operations. Tracking insertion order was secondary." @@ -1732,7 +1738,7 @@ msgstr "" "常規的 :class:`dict` 被設計成非常擅長於對映相關操作,追蹤插入的順序為次要目" "標。" -#: ../../library/collections.rst:1099 +#: ../../library/collections.rst:1100 msgid "" "The :class:`OrderedDict` was designed to be good at reordering operations. " "Space efficiency, iteration speed, and the performance of update operations " @@ -1741,7 +1747,7 @@ msgstr "" ":class:`OrderedDict` 則被設計成擅長於重新排序相關的操作,空間效率、疊代速度和" "更新操作的效能則為次要設計目標。" -#: ../../library/collections.rst:1103 +#: ../../library/collections.rst:1104 msgid "" "The :class:`OrderedDict` algorithm can handle frequent reordering operations " "better than :class:`dict`. As shown in the recipes below, this makes it " @@ -1750,12 +1756,12 @@ msgstr "" ":class:`OrderedDict` 比起 :class:`dict` 更適合處理頻繁的重新排序操作,如在下" "方用法中所示,這讓它適合用於多種 LRU cache 的實作中。" -#: ../../library/collections.rst:1107 +#: ../../library/collections.rst:1108 msgid "" "The equality operation for :class:`OrderedDict` checks for matching order." msgstr ":class:`OrderedDict` 之相等性運算會檢查順序是否相同。" -#: ../../library/collections.rst:1109 +#: ../../library/collections.rst:1110 msgid "" "A regular :class:`dict` can emulate the order sensitive equality test with " "``p == q and all(k1 == k2 for k1, k2 in zip(p, q))``." @@ -1763,15 +1769,17 @@ msgstr "" "一個一般的 :class:`dict` 可以用 ``p == q and all(k1 == k2 for k1, k2 in " "zip(p, q))`` 來效仿有檢查順序的相等性運算。" -#: ../../library/collections.rst:1112 +#: ../../library/collections.rst:1113 +#, fuzzy msgid "" -"The :meth:`popitem` method of :class:`OrderedDict` has a different " -"signature. It accepts an optional argument to specify which item is popped." +"The :meth:`~OrderedDict.popitem` method of :class:`OrderedDict` has a " +"different signature. It accepts an optional argument to specify which item " +"is popped." msgstr "" ":class:`OrderedDict` 類別的 :meth:`popitem` 方法有不同的函式簽名 " "(signature),它接受傳入一個選擇性引數來指定要移除哪個元素。" -#: ../../library/collections.rst:1115 +#: ../../library/collections.rst:1116 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=True)`` " "with ``d.popitem()`` which is guaranteed to pop the rightmost (last) item." @@ -1779,7 +1787,7 @@ msgstr "" "一個一般的 :class:`dict` 可以用 ``d.popitem()`` 來效仿 OrderedDict 的 ``od." "popitem(last=True)``,這保證會移除最右邊(最後一個)的元素。" -#: ../../library/collections.rst:1118 +#: ../../library/collections.rst:1119 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=False)`` " "with ``(k := next(iter(d)), d.pop(k))`` which will return and remove the " @@ -1789,15 +1797,16 @@ msgstr "" "OrderedDict 的 ``od.popitem(last=False)``,若最左邊(第一個)的元素存在,則將" "其回傳並移除。" -#: ../../library/collections.rst:1122 +#: ../../library/collections.rst:1123 +#, fuzzy msgid "" -":class:`OrderedDict` has a :meth:`move_to_end` method to efficiently " -"reposition an element to an endpoint." +":class:`OrderedDict` has a :meth:`~OrderedDict.move_to_end` method to " +"efficiently reposition an element to an endpoint." msgstr "" ":class:`OrderedDict` 有個 :meth:`move_to_end` 方法可有效率地將一個元素重新排" "列到任一端。" -#: ../../library/collections.rst:1125 +#: ../../library/collections.rst:1126 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.move_to_end(k, " "last=True)`` with ``d[k] = d.pop(k)`` which will move the key and its " @@ -1807,7 +1816,7 @@ msgstr "" "``od.move_to_end(k, last=True)``,這會將該鍵與其對應到的值移動至最右(最後" "面)的位置。" -#: ../../library/collections.rst:1129 +#: ../../library/collections.rst:1130 msgid "" "A regular :class:`dict` does not have an efficient equivalent for " "OrderedDict's ``od.move_to_end(k, last=False)`` which moves the key and its " @@ -1817,18 +1826,20 @@ msgstr "" "last=False)`` 等價的有效方式,這是將鍵與其對應到的值移動至最左(最前面)位置" "的方法。" -#: ../../library/collections.rst:1133 -msgid "Until Python 3.8, :class:`dict` lacked a :meth:`__reversed__` method." +#: ../../library/collections.rst:1134 +#, fuzzy +msgid "" +"Until Python 3.8, :class:`dict` lacked a :meth:`~object.__reversed__` method." msgstr "在 Python 3.8 之前,:class:`dict` 並沒有 :meth:`__reversed__` 方法。" -#: ../../library/collections.rst:1138 +#: ../../library/collections.rst:1139 msgid "" "Return an instance of a :class:`dict` subclass that has methods specialized " "for rearranging dictionary order." msgstr "" "回傳一個 :class:`dict` 子類別的實例,它具有專門用於重新排列字典順序的方法。" -#: ../../library/collections.rst:1145 +#: ../../library/collections.rst:1146 msgid "" "The :meth:`popitem` method for ordered dictionaries returns and removes a " "(key, value) pair. The pairs are returned in :abbr:`LIFO (last-in, first-" @@ -1840,7 +1851,7 @@ msgstr "" "回傳鍵值對,否則就按 :abbr:`FIFO (first-in, first-out)` 先進先出的順序回傳鍵" "值對。" -#: ../../library/collections.rst:1152 +#: ../../library/collections.rst:1153 msgid "" "Move an existing *key* to either end of an ordered dictionary. The item is " "moved to the right end if *last* is true (the default) or to the beginning " @@ -1850,7 +1861,7 @@ msgstr "" "設值)則將元素移至右端;如果 *last* 為假值則將元素移至左端。如果 *key* 不存在" "則會引發 :exc:`KeyError`:" -#: ../../library/collections.rst:1157 +#: ../../library/collections.rst:1158 msgid "" ">>> d = OrderedDict.fromkeys('abcde')\n" ">>> d.move_to_end('b')\n" @@ -1868,7 +1879,7 @@ msgstr "" ">>> ''.join(d)\n" "'bacde'" -#: ../../library/collections.rst:1169 +#: ../../library/collections.rst:1170 msgid "" "In addition to the usual mapping methods, ordered dictionaries also support " "reverse iteration using :func:`reversed`." @@ -1876,7 +1887,7 @@ msgstr "" "除了普通的對映方法,ordered dictionary 還支援了透過 :func:`reversed` 來做倒序" "疊代。" -#: ../../library/collections.rst:1174 +#: ../../library/collections.rst:1175 msgid "" "Equality tests between :class:`OrderedDict` objects are order-sensitive and " "are roughly equivalent to ``list(od1.items())==list(od2.items())``." @@ -1884,7 +1895,7 @@ msgstr "" ":class:`OrderedDict` 物件之間的相等性運算是會檢查順序是否相同的,大致等價於 " "``list(od1.items())==list(od2.items())``。" -#: ../../library/collections.rst:1177 +#: ../../library/collections.rst:1178 msgid "" "Equality tests between :class:`OrderedDict` objects and other :class:" "`~collections.abc.Mapping` objects are order-insensitive like regular " @@ -1895,7 +1906,7 @@ msgstr "" "等性運算則像普通字典一樣不考慮順序性,這使得 :class:`OrderedDict` 可於任何字" "典可使用的時機中被替換掉。" -#: ../../library/collections.rst:1182 +#: ../../library/collections.rst:1183 msgid "" "The items, keys, and values :term:`views ` of :class:" "`OrderedDict` now support reverse iteration using :func:`reversed`." @@ -1903,19 +1914,21 @@ msgstr "" ":class:`OrderedDict` 的項 (item)、鍵與值之\\ :term:`視圖 `\\ 現在可透過 :func:`reversed` 來倒序疊代。" -#: ../../library/collections.rst:1186 +#: ../../library/collections.rst:1187 +#, fuzzy msgid "" "With the acceptance of :pep:`468`, order is retained for keyword arguments " -"passed to the :class:`OrderedDict` constructor and its :meth:`update` method." +"passed to the :class:`OrderedDict` constructor and its :meth:`~dict.update` " +"method." msgstr "" "隨著 :pep:`468` 被核可,被傳入給 :class:`OrderedDict` 建構函式與其 :meth:" "`update` 方法的關鍵字引數之順序被保留了下來。" -#: ../../library/collections.rst:1196 +#: ../../library/collections.rst:1197 msgid ":class:`OrderedDict` Examples and Recipes" msgstr ":class:`OrderedDict` 範例與用法" -#: ../../library/collections.rst:1198 +#: ../../library/collections.rst:1199 msgid "" "It is straightforward to create an ordered dictionary variant that remembers " "the order the keys were *last* inserted. If a new entry overwrites an " @@ -1925,7 +1938,7 @@ msgstr "" "建立一個能夠記住鍵\\ *最後*\\ 插入順序的 ordered dictionary 變體很簡單。如果" "新條目覆蓋了現有條目,則原本插入位置會被更改並移動至末端: ::" -#: ../../library/collections.rst:1203 +#: ../../library/collections.rst:1204 msgid "" "class LastUpdatedOrderedDict(OrderedDict):\n" " 'Store items in the order the keys were last added'\n" @@ -1935,7 +1948,7 @@ msgid "" " self.move_to_end(key)" msgstr "" -#: ../../library/collections.rst:1210 +#: ../../library/collections.rst:1211 msgid "" "An :class:`OrderedDict` would also be useful for implementing variants of :" "func:`functools.lru_cache`:" @@ -1943,7 +1956,7 @@ msgstr "" ":class:`OrderedDict` 在實現一個 :func:`functools.lru_cache` 的變形版本時也非" "常有用:" -#: ../../library/collections.rst:1213 +#: ../../library/collections.rst:1214 msgid "" "from collections import OrderedDict\n" "from time import time\n" @@ -1970,7 +1983,7 @@ msgid "" " return result" msgstr "" -#: ../../library/collections.rst:1240 +#: ../../library/collections.rst:1241 msgid "" "class MultiHitLRUCache:\n" " \"\"\" LRU cache that defers caching a result until\n" @@ -2008,11 +2021,11 @@ msgid "" " return result" msgstr "" -#: ../../library/collections.rst:1309 +#: ../../library/collections.rst:1310 msgid ":class:`UserDict` objects" msgstr ":class:`UserDict` 物件" -#: ../../library/collections.rst:1311 +#: ../../library/collections.rst:1312 msgid "" "The class, :class:`UserDict` acts as a wrapper around dictionary objects. " "The need for this class has been partially supplanted by the ability to " @@ -2023,7 +2036,7 @@ msgstr "" "`dict` 建立子類別,這個類別的需求已部分被滿足,不過這個類別使用起來更方便,因" "為被包裝的字典可以作為其屬性來存取。" -#: ../../library/collections.rst:1319 +#: ../../library/collections.rst:1320 msgid "" "Class that simulates a dictionary. The instance's contents are kept in a " "regular dictionary, which is accessible via the :attr:`data` attribute of :" @@ -2035,23 +2048,23 @@ msgstr "" "`data` 屬性來做存取。如果有提供 *initialdata*,:attr:`data` 屬性會被初始化為" "其值;要注意指到 *initialdata* 的參照不會被保留,使其可被用於其他目的。" -#: ../../library/collections.rst:1325 +#: ../../library/collections.rst:1326 msgid "" "In addition to supporting the methods and operations of mappings, :class:" "`UserDict` instances provide the following attribute:" msgstr "" "除了支援作為對映所需的方法與操作,:class:`UserDict` 實例提供了以下屬性:" -#: ../../library/collections.rst:1330 +#: ../../library/collections.rst:1331 msgid "" "A real dictionary used to store the contents of the :class:`UserDict` class." msgstr "一個真實的字典,用於儲存 :class:`UserDict` 類別的資料內容。" -#: ../../library/collections.rst:1336 +#: ../../library/collections.rst:1337 msgid ":class:`UserList` objects" msgstr ":class:`UserList` 物件" -#: ../../library/collections.rst:1338 +#: ../../library/collections.rst:1339 msgid "" "This class acts as a wrapper around list objects. It is a useful base class " "for your own list-like classes which can inherit from them and override " @@ -2062,7 +2075,7 @@ msgstr "" "入新方法來定義你所需的一個類似於 list 的類別。如此一來,我們可以為 list 加入" "新的特性。" -#: ../../library/collections.rst:1343 +#: ../../library/collections.rst:1344 msgid "" "The need for this class has been partially supplanted by the ability to " "subclass directly from :class:`list`; however, this class can be easier to " @@ -2071,7 +2084,7 @@ msgstr "" "因為已經可以直接自 :class:`list` 建立子類別,這個類別的需求已部分被滿足,不過" "這個類別使用起來更方便,因為被包裝的 list 可以作為其屬性來存取。" -#: ../../library/collections.rst:1349 +#: ../../library/collections.rst:1350 msgid "" "Class that simulates a list. The instance's contents are kept in a regular " "list, which is accessible via the :attr:`data` attribute of :class:" @@ -2084,20 +2097,20 @@ msgstr "" "list ``[]``。*list* 可以是任何 iterable,例如一個真實的 Python list 或是一" "個 :class:`UserList` 物件。" -#: ../../library/collections.rst:1355 +#: ../../library/collections.rst:1356 msgid "" "In addition to supporting the methods and operations of mutable sequences, :" "class:`UserList` instances provide the following attribute:" msgstr "除了支援可變序列的方法與操作,:class:`UserList` 實例提供了以下屬性:" -#: ../../library/collections.rst:1360 +#: ../../library/collections.rst:1361 msgid "" "A real :class:`list` object used to store the contents of the :class:" "`UserList` class." msgstr "" "一個真實的 :class:`list` 物件,用於儲存 :class:`UserList` 類別的資料內容。" -#: ../../library/collections.rst:1363 +#: ../../library/collections.rst:1364 msgid "" "**Subclassing requirements:** Subclasses of :class:`UserList` are expected " "to offer a constructor which can be called with either no arguments or one " @@ -2111,7 +2124,7 @@ msgstr "" "例,為了達成上述目的,它假設建構函式可傳入單一參數來呼叫,該參數即是做為數據" "來源的一個序列物件。" -#: ../../library/collections.rst:1370 +#: ../../library/collections.rst:1371 msgid "" "If a derived class does not wish to comply with this requirement, all of the " "special methods supported by this class will need to be overridden; please " @@ -2121,11 +2134,11 @@ msgstr "" "如果希望一個自此獲得的子類別不遵從上述要求,那所有該類別支援的特殊方法則必須" "被覆寫;請參考原始碼來理解在這情況下哪些方法是必須提供的。" -#: ../../library/collections.rst:1376 +#: ../../library/collections.rst:1377 msgid ":class:`UserString` objects" msgstr ":class:`UserString` 物件" -#: ../../library/collections.rst:1378 +#: ../../library/collections.rst:1379 msgid "" "The class, :class:`UserString` acts as a wrapper around string objects. The " "need for this class has been partially supplanted by the ability to subclass " @@ -2136,7 +2149,7 @@ msgstr "" "建立子類別,這個類別的需求已經部分被滿足,不過這個類別使用起來更方便,因為被" "包裝的字串可以作為其屬性來存取。" -#: ../../library/collections.rst:1386 +#: ../../library/collections.rst:1387 msgid "" "Class that simulates a string object. The instance's content is kept in a " "regular string object, which is accessible via the :attr:`data` attribute " @@ -2148,21 +2161,21 @@ msgstr "" "的 :attr:`data` 屬性來做存取。實例內容被初始化為 *seq* 的複製,*seq* 引數可以" "是任何可被內建函式 :func:`str` 轉換成字串的物件。" -#: ../../library/collections.rst:1393 +#: ../../library/collections.rst:1394 msgid "" "In addition to supporting the methods and operations of strings, :class:" "`UserString` instances provide the following attribute:" msgstr "" "除了支援字串的方法和操作以外,:class:`UserString` 實例也提供了以下屬性:" -#: ../../library/collections.rst:1398 +#: ../../library/collections.rst:1399 msgid "" "A real :class:`str` object used to store the contents of the :class:" "`UserString` class." msgstr "" "一個真實的 :class:`str` 物件,用來儲存 :class:`UserString` 類別的資料內容。" -#: ../../library/collections.rst:1401 +#: ../../library/collections.rst:1402 msgid "" "New methods ``__getnewargs__``, ``__rmod__``, ``casefold``, ``format_map``, " "``isprintable``, and ``maketrans``." diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index 8bec6881d5..ec0330b804 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -41,10 +41,10 @@ msgstr "" #: ../../library/concurrent.futures.rst:17 msgid "" -"The asynchronous execution can be performed with threads, using :class:" -"`ThreadPoolExecutor`, or separate processes, using :class:" -"`ProcessPoolExecutor`. Both implement the same interface, which is defined " -"by the abstract :class:`Executor` class." +"The asynchronous execution can be performed with threads, " +"using :class:`ThreadPoolExecutor`, or separate processes, " +"using :class:`ProcessPoolExecutor`. Both implement the same interface, " +"which is defined by the abstract :class:`Executor` class." msgstr "" "非同步執行可以透過 :class:`ThreadPoolExecutor` 來使用執行緒 (thread) 執行,或" "透過 :class:`ProcessPoolExecutor` 來使用單獨行程 (process) 執行。兩者都實作了" @@ -81,9 +81,7 @@ msgid "" "callable. ::" msgstr "" "為可呼叫物件 *fn* 排程來以 ``fn(*args, **kwargs)`` 的形式執行並回傳一個表示可" -"呼叫的執行的 :class:`Future` 物件。\n" -"\n" -"::" +"呼叫的執行的 :class:`Future` 物件。 ::" #: ../../library/concurrent.futures.rst:38 msgid "" @@ -111,11 +109,11 @@ msgstr "*fn* 是非同步執行的,並且對 *fn* 的多次呼叫可以並行 #: ../../library/concurrent.futures.rst:51 msgid "" -"The returned iterator raises a :exc:`TimeoutError` if :meth:`~iterator." -"__next__` is called and the result isn't available after *timeout* seconds " -"from the original call to :meth:`Executor.map`. *timeout* can be an int or a " -"float. If *timeout* is not specified or ``None``, there is no limit to the " -"wait time." +"The returned iterator raises a :exc:`TimeoutError` " +"if :meth:`~iterator.__next__` is called and the result isn't available after " +"*timeout* seconds from the original call to :meth:`Executor.map`. *timeout* " +"can be an int or a float. If *timeout* is not specified or ``None``, there " +"is no limit to the wait time." msgstr "" "如果 :meth:`~iterator.__next__` 被呼叫,且在原先呼叫 :meth:`Executor.map` 的 " "*timeout* 秒後結果仍不可用,回傳的疊代器就會引發 :exc:`TimeoutError`。" @@ -140,8 +138,8 @@ msgstr "" "使用 :class:`ProcessPoolExecutor` 時,此方法將 *iterables* 分成許多分塊 " "(chunks),並將其作為獨立的任務來提交給池 (pool)。可以透過將 *chunksize* 設定" "為正整數來指定這些分塊的(約略)大小。對於非常長的可疊代物件,*chunksize* 使" -"用較大的值(與預設大小 1 相比)可以顯著提高性能。對於 :class:" -"`ThreadPoolExecutor`,*chunksize* 無效。" +"用較大的值(與預設大小 1 相比)可以顯著提高性能。對" +"於 :class:`ThreadPoolExecutor`,*chunksize* 無效。" #: ../../library/concurrent.futures.rst:68 msgid "Added the *chunksize* argument." @@ -150,13 +148,13 @@ msgstr "新增 *chunksize* 引數。" #: ../../library/concurrent.futures.rst:73 msgid "" "Signal the executor that it should free any resources that it is using when " -"the currently pending futures are done executing. Calls to :meth:`Executor." -"submit` and :meth:`Executor.map` made after shutdown will raise :exc:" -"`RuntimeError`." +"the currently pending futures are done executing. Calls " +"to :meth:`Executor.submit` and :meth:`Executor.map` made after shutdown will " +"raise :exc:`RuntimeError`." msgstr "" "向 executor 發出訊號 (signal),表明它應該在當前未定 (pending) 的 future 完成" -"執行時釋放它正在使用的任何資源。在關閉後呼叫 :meth:`Executor.submit` 和 :" -"meth:`Executor.map` 將引發 :exc:`RuntimeError`。" +"執行時釋放它正在使用的任何資源。在關閉後呼叫 :meth:`Executor.submit` " +"和 :meth:`Executor.map` 將引發 :exc:`RuntimeError`。" #: ../../library/concurrent.futures.rst:78 msgid "" @@ -195,9 +193,10 @@ msgstr "" #: ../../library/concurrent.futures.rst:95 msgid "" -"You can avoid having to call this method explicitly if you use the :keyword:" -"`with` statement, which will shutdown the :class:`Executor` (waiting as if :" -"meth:`Executor.shutdown` were called with *wait* set to ``True``)::" +"You can avoid having to call this method explicitly if you use " +"the :keyword:`with` statement, which will shutdown the :class:`Executor` " +"(waiting as if :meth:`Executor.shutdown` were called with *wait* set to " +"``True``)::" msgstr "" "如果使用 :keyword:`with` 陳述句,你就可以不用明確地呼叫此方法,這將會自己關" "閉 :class:`Executor`\\(如同呼叫 :meth:`Executor.shutdown` 時 *wait* 被設定" @@ -311,16 +310,16 @@ msgid "" msgstr "" "*initializer* 是一個可選的可呼叫物件,在每個工作執行緒開始時呼叫; " "*initargs* 是傳遞給 initializer 的引數元組 (tuple)。如果 *initializer* 引發例" -"外,所有當前未定的作業以及任何向池中提交 (submit) 更多作業的嘗試都將引發 :" -"exc:`~concurrent.futures.thread.BrokenThreadPool`。" +"外,所有當前未定的作業以及任何向池中提交 (submit) 更多作業的嘗試都將引" +"發 :exc:`~concurrent.futures.thread.BrokenThreadPool`。" #: ../../library/concurrent.futures.rst:166 msgid "" "If *max_workers* is ``None`` or not given, it will default to the number of " -"processors on the machine, multiplied by ``5``, assuming that :class:" -"`ThreadPoolExecutor` is often used to overlap I/O instead of CPU work and " -"the number of workers should be higher than the number of workers for :class:" -"`ProcessPoolExecutor`." +"processors on the machine, multiplied by ``5``, assuming " +"that :class:`ThreadPoolExecutor` is often used to overlap I/O instead of CPU " +"work and the number of workers should be higher than the number of workers " +"for :class:`ProcessPoolExecutor`." msgstr "" "如果 *max_workers* 為 ``None`` 或未給定,它將預設為機器上的處理器數量乘以 " "``5``,這假定了 :class:`ThreadPoolExecutor` 通常用於 I/O 重疊而非 CPU 密集的" @@ -329,9 +328,9 @@ msgstr "" #: ../../library/concurrent.futures.rst:174 msgid "" -"Added the *thread_name_prefix* parameter to allow users to control the :" -"class:`threading.Thread` names for worker threads created by the pool for " -"easier debugging." +"Added the *thread_name_prefix* parameter to allow users to control " +"the :class:`threading.Thread` names for worker threads created by the pool " +"for easier debugging." msgstr "" "新增 *thread_name_prefix* 參數以允許使用者控制由池所建立的工作執行緒 (worker " "thread) 的 :class:`threading.Thread` 名稱,以便於除錯。" @@ -362,8 +361,8 @@ msgstr "" #: ../../library/concurrent.futures.rst:191 msgid "" -"Default value of *max_workers* is changed to ``min(32, (os." -"process_cpu_count() or 1) + 4)``." +"Default value of *max_workers* is changed to ``min(32, " +"(os.process_cpu_count() or 1) + 4)``." msgstr "" #: ../../library/concurrent.futures.rst:199 @@ -408,15 +407,15 @@ msgstr "ProcessPoolExecutor" #: ../../library/concurrent.futures.rst:233 msgid "" "The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that " -"uses a pool of processes to execute calls asynchronously. :class:" -"`ProcessPoolExecutor` uses the :mod:`multiprocessing` module, which allows " -"it to side-step the :term:`Global Interpreter Lock ` but also means that only picklable objects can be executed and " -"returned." +"uses a pool of processes to execute calls " +"asynchronously. :class:`ProcessPoolExecutor` uses the :mod:`multiprocessing` " +"module, which allows it to side-step the :term:`Global Interpreter Lock " +"` but also means that only picklable objects can be " +"executed and returned." msgstr "" ":class:`ProcessPoolExecutor` 類別是一個 :class:`Executor` 的子類別,它使用行" -"程池來非同步地執行呼叫。:class:`ProcessPoolExecutor` 使用了 :mod:" -"`multiprocessing` 模組,這允許它避開\\ :term:`全域直譯器鎖 (Global " +"程池來非同步地執行呼叫。:class:`ProcessPoolExecutor` 使用" +"了 :mod:`multiprocessing` 模組,這允許它避開\\ :term:`全域直譯器鎖 (Global " "Interpreter Lock) `,但也意味著只能執行和回傳可被 " "pickle 的 (picklable) 物件。" @@ -426,9 +425,9 @@ msgid "" "means that :class:`ProcessPoolExecutor` will not work in the interactive " "interpreter." msgstr "" -"``__main__`` 模組必須可以被工作子行程 (worker subprocess) 引入。這意味著 :" -"class:`ProcessPoolExecutor` 將無法在交互式直譯器 (interactive interpreter) 中" -"工作。" +"``__main__`` 模組必須可以被工作子行程 (worker subprocess) 引入。這意味" +"著 :class:`ProcessPoolExecutor` 將無法在交互式直譯器 (interactive " +"interpreter) 中工作。" #: ../../library/concurrent.futures.rst:243 msgid "" @@ -450,18 +449,18 @@ msgid "" "the default chosen will be at most ``61``, even if more processors are " "available. *mp_context* can be a :mod:`multiprocessing` context or ``None``. " "It will be used to launch the workers. If *mp_context* is ``None`` or not " -"given, the default :mod:`multiprocessing` context is used. See :ref:" -"`multiprocessing-start-methods`." +"given, the default :mod:`multiprocessing` context is used. " +"See :ref:`multiprocessing-start-methods`." msgstr "" "一個 :class:`Executor` 子類別,它使用了最多有 *max_workers* 個行程的池來非同" "步地執行呼叫。如果 *max_workers* 為 ``None`` 或未給定,它將被預設為機器上的處" "理器數量。如果 *max_workers* 小於或等於 ``0``,則會引發 :exc:`ValueError`。" -"在 Windows 上,*max_workers* 必須小於或等於 ``61``。如果不是,則會引發 :exc:" -"`ValueError`。如果 *max_workers* 為 ``None``,則預設選擇最多為 ``61``,即便有" -"更多處理器可用。*mp_context* 可以是 :mod:`multiprocessing` 情境 (context) 或 " -"``None``。它將用於啟動 worker。如果 *mp_context* 為 ``None`` 或未給定,則使用" -"預設的 :mod:`multiprocessing` 情境。請見 :ref:`multiprocessing-start-" -"methods`。" +"在 Windows 上,*max_workers* 必須小於或等於 ``61``。如果不是,則會引" +"發 :exc:`ValueError`。如果 *max_workers* 為 ``None``,則預設選擇最多為 " +"``61``,即便有更多處理器可用。*mp_context* 可以是 :mod:`multiprocessing` 情" +"境 (context) 或 ``None``。它將用於啟動 worker。如果 *mp_context* 為 ``None`` " +"或未給定,則使用預設的 :mod:`multiprocessing` 情境。請" +"見 :ref:`multiprocessing-start-methods`。" #: ../../library/concurrent.futures.rst:262 msgid "" @@ -473,8 +472,8 @@ msgid "" msgstr "" "*initializer* 是一個可選的可呼叫物件,在每個工作行程 (worker process) 開始時" "呼叫;*initargs* 是傳遞給 initializer 的引數元組。如果 *initializer* 引發例" -"外,所有當前未定的作業以及任何向池中提交更多作業的嘗試都將引發 :exc:" -"`~concurrent.futures.process.BrokenProcessPool`。" +"外,所有當前未定的作業以及任何向池中提交更多作業的嘗試都將引" +"發 :exc:`~concurrent.futures.process.BrokenProcessPool`。" #: ../../library/concurrent.futures.rst:268 msgid "" @@ -494,14 +493,15 @@ msgstr "" #: ../../library/concurrent.futures.rst:276 msgid "" -"When one of the worker processes terminates abruptly, a :exc:`~concurrent." -"futures.process.BrokenProcessPool` error is now raised. Previously, " -"behaviour was undefined but operations on the executor or its futures would " -"often freeze or deadlock." +"When one of the worker processes terminates abruptly, " +"a :exc:`~concurrent.futures.process.BrokenProcessPool` error is now raised. " +"Previously, behaviour was undefined but operations on the executor or its " +"futures would often freeze or deadlock." msgstr "" -"當其中一個工作行程突然終止時,現在會引發 :exc:`~concurrent.futures.process." -"BrokenProcessPool` 錯誤。在過去,此行為是未定義的 (undefined),但對 executor " -"或其 future 的操作經常會發生凍結或死鎖。" +"當其中一個工作行程突然終止時,現在會引" +"發 :exc:`~concurrent.futures.process.BrokenProcessPool` 錯誤。在過去,此行為" +"是未定義的 (undefined),但對 executor 或其 future 的操作經常會發生凍結或死" +"鎖。" #: ../../library/concurrent.futures.rst:283 msgid "" @@ -515,13 +515,13 @@ msgid "" "The default :mod:`multiprocessing` start method (see :ref:`multiprocessing-" "start-methods`) will change away from *fork* in Python 3.14. Code that " "requires *fork* be used for their :class:`ProcessPoolExecutor` should " -"explicitly specify that by passing a ``mp_context=multiprocessing." -"get_context(\"fork\")`` parameter." +"explicitly specify that by passing a " +"``mp_context=multiprocessing.get_context(\"fork\")`` parameter." msgstr "" "預設的 :mod:`multiprocessing` 啟動方法(請參閱 :ref:`multiprocessing-start-" -"methods`\\ )將不再是 Python 3.14 中的 *fork*。需要 *fork* 用於其 :class:" -"`ProcessPoolExecutor` 的程式碼應透過傳遞 ``mp_context=multiprocessing." -"get_context(\"fork\")`` 參數來明確指定。" +"methods`\\ )將不再是 Python 3.14 中的 *fork*。需要 *fork* 用於" +"其 :class:`ProcessPoolExecutor` 的程式碼應透過傳遞 " +"``mp_context=multiprocessing.get_context(\"fork\")`` 參數來明確指定。" #: ../../library/concurrent.futures.rst:297 msgid "" @@ -532,11 +532,12 @@ msgstr "" #: ../../library/concurrent.futures.rst:301 msgid "" -"On POSIX systems, if your application has multiple threads and the :mod:" -"`multiprocessing` context uses the ``\"fork\"`` start method: The :func:`os." -"fork` function called internally to spawn workers may raise a :exc:" -"`DeprecationWarning`. Pass a *mp_context* configured to use a different " -"start method. See the :func:`os.fork` documentation for further explanation." +"On POSIX systems, if your application has multiple threads and " +"the :mod:`multiprocessing` context uses the ``\"fork\"`` start method: " +"The :func:`os.fork` function called internally to spawn workers may raise " +"a :exc:`DeprecationWarning`. Pass a *mp_context* configured to use a " +"different start method. See the :func:`os.fork` documentation for further " +"explanation." msgstr "" "在 POSIX 系統上,如果你的應用程式有多個執行緒並且 :mod:`multiprocessing` 情境" "使用了 ``\"fork\"`` 啟動方法:內部呼叫以產生 worker 的 :func:`os.fork` 函式可" @@ -545,8 +546,8 @@ msgstr "" #: ../../library/concurrent.futures.rst:309 msgid "" -"*max_workers* uses :func:`os.process_cpu_count` by default, instead of :func:" -"`os.cpu_count`." +"*max_workers* uses :func:`os.process_cpu_count` by default, instead " +"of :func:`os.cpu_count`." msgstr "" #: ../../library/concurrent.futures.rst:316 @@ -630,8 +631,8 @@ msgid "" "The :class:`Future` class encapsulates the asynchronous execution of a " "callable. :class:`Future` instances are created by :meth:`Executor.submit`." msgstr "" -":class:`Future` 類別封裝了可呼叫物件的非同步執行。:class:`Future` 實例由 :" -"meth:`Executor.submit` 建立。" +":class:`Future` 類別封裝了可呼叫物件的非同步執行。:class:`Future` 實例" +"由 :meth:`Executor.submit` 建立。" #: ../../library/concurrent.futures.rst:361 msgid "" @@ -736,8 +737,8 @@ msgstr "如果 future 已經完成或被取消,*fn* 將立即被呼叫。" #: ../../library/concurrent.futures.rst:429 msgid "" -"The following :class:`Future` methods are meant for use in unit tests and :" -"class:`Executor` implementations." +"The following :class:`Future` methods are meant for use in unit tests " +"and :class:`Executor` implementations." msgstr "以下 :class:`Future` 方法旨在用於單元測試和 :class:`Executor` 實作。" #: ../../library/concurrent.futures.rst:434 @@ -751,14 +752,14 @@ msgstr "" #: ../../library/concurrent.futures.rst:438 msgid "" -"If the method returns ``False`` then the :class:`Future` was cancelled, i." -"e. :meth:`Future.cancel` was called and returned ``True``. Any threads " +"If the method returns ``False`` then the :class:`Future` was cancelled, " +"i.e. :meth:`Future.cancel` was called and returned ``True``. Any threads " "waiting on the :class:`Future` completing (i.e. through :func:`as_completed` " "or :func:`wait`) will be woken up." msgstr "" -"如果該方法回傳 ``False`` 則 :class:`Future` 已被取消,即 :meth:`Future." -"cancel` 被呼叫並回傳 ``True``。任何等待 :class:`Future` 完成的執行緒(即透" -"過 :func:`as_completed` 或 :func:`wait`)將被喚醒。" +"如果該方法回傳 ``False`` 則 :class:`Future` 已被取消," +"即 :meth:`Future.cancel` 被呼叫並回傳 ``True``。任何等待 :class:`Future` 完成" +"的執行緒(即透過 :func:`as_completed` 或 :func:`wait`)將被喚醒。" #: ../../library/concurrent.futures.rst:443 msgid "" @@ -771,11 +772,12 @@ msgstr "" #: ../../library/concurrent.futures.rst:447 msgid "" -"This method can only be called once and cannot be called after :meth:`Future." -"set_result` or :meth:`Future.set_exception` have been called." +"This method can only be called once and cannot be called " +"after :meth:`Future.set_result` or :meth:`Future.set_exception` have been " +"called." msgstr "" -"此方法只能呼叫一次,且不能在呼叫 :meth:`Future.set_result` 或 :meth:`Future." -"set_exception` 之後呼叫。" +"此方法只能呼叫一次,且不能在呼叫 :meth:`Future.set_result` " +"或 :meth:`Future.set_exception` 之後呼叫。" #: ../../library/concurrent.futures.rst:453 msgid "" @@ -792,16 +794,16 @@ msgstr "此方法只能在 :class:`Executor` 實作中和單元測試中使用 #: ../../library/concurrent.futures.rst:459 #: ../../library/concurrent.futures.rst:472 msgid "" -"This method raises :exc:`concurrent.futures.InvalidStateError` if the :class:" -"`Future` is already done." +"This method raises :exc:`concurrent.futures.InvalidStateError` if " +"the :class:`Future` is already done." msgstr "" -"如果 :class:`Future` 已經完成,此方法會引發 :exc:`concurrent.futures." -"InvalidStateError`。" +"如果 :class:`Future` 已經完成,此方法會引" +"發 :exc:`concurrent.futures.InvalidStateError`。" #: ../../library/concurrent.futures.rst:466 msgid "" -"Sets the result of the work associated with the :class:`Future` to the :" -"class:`Exception` *exception*." +"Sets the result of the work associated with the :class:`Future` to " +"the :class:`Exception` *exception*." msgstr "" "將與 :class:`Future` 關聯的工作結果設定為 :class:`Exception` *exception*。" @@ -811,13 +813,13 @@ msgstr "模組函式" #: ../../library/concurrent.futures.rst:482 msgid "" -"Wait for the :class:`Future` instances (possibly created by different :class:" -"`Executor` instances) given by *fs* to complete. Duplicate futures given to " -"*fs* are removed and will be returned only once. Returns a named 2-tuple of " -"sets. The first set, named ``done``, contains the futures that completed " -"(finished or cancelled futures) before the wait completed. The second set, " -"named ``not_done``, contains the futures that did not complete (pending or " -"running futures)." +"Wait for the :class:`Future` instances (possibly created by " +"different :class:`Executor` instances) given by *fs* to complete. Duplicate " +"futures given to *fs* are removed and will be returned only once. Returns a " +"named 2-tuple of sets. The first set, named ``done``, contains the futures " +"that completed (finished or cancelled futures) before the wait completed. " +"The second set, named ``not_done``, contains the futures that did not " +"complete (pending or running futures)." msgstr "" "等待 *fs* 給定的 :class:`Future` 實例(可能由不同的 :class:`Executor` 實例建" "立)完成。提供給 *fs* 的重複 future 將被刪除,並且只會回傳一次。回傳一個集合" @@ -855,8 +857,8 @@ msgstr "當任何 future 完成或被取消時,該函式就會回傳。" #: ../../library/concurrent.futures.rst:507 msgid "" "The function will return when any future finishes by raising an exception. " -"If no future raises an exception then it is equivalent to :const:" -"`ALL_COMPLETED`." +"If no future raises an exception then it is equivalent " +"to :const:`ALL_COMPLETED`." msgstr "" "該函式會在任何 future 透過引發例外而完結時回傳。如果 future 沒有引發例外,那" "麼它等同於 :const:`ALL_COMPLETED`。" @@ -880,10 +882,10 @@ msgstr "" "回傳由 *fs* 給定的 :class:`Future` 實例(可能由不同的 :class:`Executor` 實例" "建立)的疊代器,它在完成時產生 future(已完成或被取消的 future)。*fs* 給定的" "任何重複的 future 將只被回傳一次。呼叫 :func:`as_completed` 之前完成的任何 " -"future 將首先產生。如果 :meth:`~iterator.__next__` 被呼叫,並且在原先呼叫 :" -"func:`as_completed` 的 *timeout* 秒後結果仍不可用,則回傳的疊代器會引發 :exc:" -"`TimeoutError`。*timeout* 可以是整數或浮點數。如果未指定 *timeout* 或為 " -"``None``,則等待時間就沒有限制。" +"future 將首先產生。如果 :meth:`~iterator.__next__` 被呼叫,並且在原先呼" +"叫 :func:`as_completed` 的 *timeout* 秒後結果仍不可用,則回傳的疊代器會引" +"發 :exc:`TimeoutError`。*timeout* 可以是整數或浮點數。如果未指定 *timeout* 或" +"為 ``None``,則等待時間就沒有限制。" #: ../../library/concurrent.futures.rst:529 msgid ":pep:`3148` -- futures - execute computations asynchronously" @@ -932,20 +934,22 @@ msgstr "當前狀態下不允許的 future 操作被執行時而引發。" #: ../../library/concurrent.futures.rst:572 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor`, this exception class " -"is raised when one of the workers of a :class:`~concurrent.futures." -"ThreadPoolExecutor` has failed initializing." +"is raised when one of the workers of " +"a :class:`~concurrent.futures.ThreadPoolExecutor` has failed initializing." msgstr "" -"衍生自 :exc:`~concurrent.futures.BrokenExecutor`,當 :class:`~concurrent." -"futures.ThreadPoolExecutor` 的其中一個 worker 初始化失敗時會引發此例外類別。" +"衍生自 :exc:`~concurrent.futures.BrokenExecutor`," +"當 :class:`~concurrent.futures.ThreadPoolExecutor` 的其中一個 worker 初始化失" +"敗時會引發此例外類別。" #: ../../library/concurrent.futures.rst:583 msgid "" -"Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly :exc:" -"`RuntimeError`), this exception class is raised when one of the workers of " -"a :class:`~concurrent.futures.ProcessPoolExecutor` has terminated in a non-" -"clean fashion (for example, if it was killed from the outside)." +"Derived from :exc:`~concurrent.futures.BrokenExecutor` " +"(formerly :exc:`RuntimeError`), this exception class is raised when one of " +"the workers of a :class:`~concurrent.futures.ProcessPoolExecutor` has " +"terminated in a non-clean fashion (for example, if it was killed from the " +"outside)." msgstr "" -"衍生自 :exc:`~concurrent.futures.BrokenExecutor`\\(以前為 :exc:" -"`RuntimeError`),當 :class:`~concurrent.futures.ProcessPoolExecutor` 的其中" -"一個 worker 以不乾淨的方式終止時將引發此例外類別(例如它是從外面被 kill 掉" -"的)。" +"衍生自 :exc:`~concurrent.futures.BrokenExecutor`\\(以前" +"為 :exc:`RuntimeError`)," +"當 :class:`~concurrent.futures.ProcessPoolExecutor` 的其中一個 worker 以不乾" +"淨的方式終止時將引發此例外類別(例如它是從外面被 kill 掉的)。" diff --git a/library/configparser.po b/library/configparser.po index 1cf79e0a29..294bd9d97d 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-06 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -183,7 +183,7 @@ msgid "" "'no'\n" ">>> topsecret['Port']\n" "'50022'\n" -">>> for key in config['forge.example']: \n" +">>> for key in config['forge.example']:\n" "... print(key)\n" "user\n" "compressionlevel\n" @@ -213,7 +213,7 @@ msgstr "" "'no'\n" ">>> topsecret['Port']\n" "'50022'\n" -">>> for key in config['forge.example']: \n" +">>> for key in config['forge.example']:\n" "... print(key)\n" "user\n" "compressionlevel\n" @@ -233,12 +233,12 @@ msgstr "" #: ../../library/configparser.rst:148 ../../library/configparser.rst:1003 msgid "" -"It is possible to read several configurations into a single :class:" -"`ConfigParser`, where the most recently added configuration has the highest " -"priority. Any conflicting keys are taken from the more recent configuration " -"while the previously existing keys are retained. The example below reads in " -"an ``override.ini`` file, which will override any conflicting keys from the " -"``example.ini`` file." +"It is possible to read several configurations into a " +"single :class:`ConfigParser`, where the most recently added configuration " +"has the highest priority. Any conflicting keys are taken from the more " +"recent configuration while the previously existing keys are retained. The " +"example below reads in an ``override.ini`` file, which will override any " +"conflicting keys from the ``example.ini`` file." msgstr "" #: ../../library/configparser.rst:155 ../../library/configparser.rst:1010 @@ -384,10 +384,10 @@ msgstr "" #: ../../library/configparser.rst:241 msgid "" -"One more thing to be aware of is that the parser-level :meth:`~ConfigParser." -"get` method provides a custom, more complex interface, maintained for " -"backwards compatibility. When using this method, a fallback value can be " -"provided via the ``fallback`` keyword-only argument:" +"One more thing to be aware of is that the parser-" +"level :meth:`~ConfigParser.get` method provides a custom, more complex " +"interface, maintained for backwards compatibility. When using this method, " +"a fallback value can be provided via the ``fallback`` keyword-only argument:" msgstr "" #: ../../library/configparser.rst:246 @@ -399,9 +399,9 @@ msgstr "" #: ../../library/configparser.rst:252 msgid "" -"The same ``fallback`` argument can be used with the :meth:`~ConfigParser." -"getint`, :meth:`~ConfigParser.getfloat` and :meth:`~ConfigParser.getboolean` " -"methods, for example:" +"The same ``fallback`` argument can be used with " +"the :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat` " +"and :meth:`~ConfigParser.getboolean` methods, for example:" msgstr "" #: ../../library/configparser.rst:256 @@ -587,8 +587,8 @@ msgstr "" #: ../../library/configparser.rst:396 msgid "" -"With ``interpolation`` set to ``None``, the parser would simply return " -"``%(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/" +"With ``interpolation`` set to ``None``, the parser would simply return ``%" +"(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/" "lumberjack`` as the value of ``my_dir``." msgstr "" @@ -597,9 +597,9 @@ msgid "" "An alternative handler for interpolation which implements a more advanced " "syntax, used for instance in ``zc.buildout``. Extended interpolation is " "using ``${section:option}`` to denote a value from a foreign section. " -"Interpolation can span multiple levels. For convenience, if the ``section:" -"`` part is omitted, interpolation defaults to the current section (and " -"possibly the default values from the special section)." +"Interpolation can span multiple levels. For convenience, if the " +"``section:`` part is omitted, interpolation defaults to the current section " +"(and possibly the default values from the special section)." msgstr "" #: ../../library/configparser.rst:411 @@ -668,8 +668,8 @@ msgstr "" #: ../../library/configparser.rst:451 msgid "" "Mapping protocol access is a generic name for functionality that enables " -"using custom objects as if they were dictionaries. In case of :mod:" -"`configparser`, the mapping interface implementation is using the " +"using custom objects as if they were dictionaries. In case " +"of :mod:`configparser`, the mapping interface implementation is using the " "``parser['section']['option']`` notation." msgstr "" @@ -685,9 +685,9 @@ msgstr "" #: ../../library/configparser.rst:462 msgid "" ":mod:`configparser` objects behave as close to actual dictionaries as " -"possible. The mapping interface is complete and adheres to the :class:" -"`~collections.abc.MutableMapping` ABC. However, there are a few differences " -"that should be taken into account:" +"possible. The mapping interface is complete and adheres to " +"the :class:`~collections.abc.MutableMapping` ABC. However, there are a few " +"differences that should be taken into account:" msgstr "" #: ../../library/configparser.rst:467 @@ -709,8 +709,8 @@ msgstr "" #: ../../library/configparser.rst:475 msgid "" -"All sections include ``DEFAULTSECT`` values as well which means that ``." -"clear()`` on a section may not leave the section visibly empty. This is " +"All sections include ``DEFAULTSECT`` values as well which means that " +"``.clear()`` on a section may not leave the section visibly empty. This is " "because default values cannot be deleted from the section (because " "technically they are not there). If they are overridden in the section, " "deleting causes the default value to be visible again. Trying to delete a " @@ -744,10 +744,10 @@ msgstr "" msgid "" "``parser.items()`` is compatible with the mapping protocol (returns a list " "of *section_name*, *section_proxy* pairs including the DEFAULTSECT). " -"However, this method can also be invoked with arguments: ``parser." -"items(section, raw, vars)``. The latter call returns a list of *option*, " -"*value* pairs for a specified ``section``, with all interpolations expanded " -"(unless ``raw=True`` is provided)." +"However, this method can also be invoked with arguments: " +"``parser.items(section, raw, vars)``. The latter call returns a list of " +"*option*, *value* pairs for a specified ``section``, with all interpolations " +"expanded (unless ``raw=True`` is provided)." msgstr "" #: ../../library/configparser.rst:501 @@ -790,8 +790,8 @@ msgstr "" #: ../../library/configparser.rst:525 msgid "" -"Hint: if you want to specify default values for a specific section, use :" -"meth:`~ConfigParser.read_dict` before you read the actual file." +"Hint: if you want to specify default values for a specific section, " +"use :meth:`~ConfigParser.read_dict` before you read the actual file." msgstr "" #: ../../library/configparser.rst:528 @@ -909,8 +909,8 @@ msgstr "" #: ../../library/configparser.rst:603 msgid "" -"See also the *space_around_delimiters* argument to :meth:`ConfigParser." -"write`." +"See also the *space_around_delimiters* argument " +"to :meth:`ConfigParser.write`." msgstr "" #: ../../library/configparser.rst:606 @@ -996,9 +996,10 @@ msgstr "" #: ../../library/configparser.rst:669 msgid "" "When set to ``True``, the parser will not allow for any section or option " -"duplicates while reading from a single source (using :meth:`~ConfigParser." -"read_file`, :meth:`~ConfigParser.read_string` or :meth:`~ConfigParser." -"read_dict`). It is recommended to use strict parsers in new applications." +"duplicates while reading from a single source " +"(using :meth:`~ConfigParser.read_file`, :meth:`~ConfigParser.read_string` " +"or :meth:`~ConfigParser.read_dict`). It is recommended to use strict " +"parsers in new applications." msgstr "" #: ../../library/configparser.rst:674 @@ -1054,9 +1055,9 @@ msgid "" "other valid section name. Some typical values include: ``\"general\"`` or " "``\"common\"``. The name provided is used for recognizing default sections " "when reading from any source and is used when writing configuration back to " -"a file. Its current value can be retrieved using the ``parser_instance." -"default_section`` attribute and may be modified at runtime (i.e. to convert " -"files from one format to another)." +"a file. Its current value can be retrieved using the " +"``parser_instance.default_section`` attribute and may be modified at runtime " +"(i.e. to convert files from one format to another)." msgstr "" #: ../../library/configparser.rst:715 @@ -1069,8 +1070,8 @@ msgid "" "through the *interpolation* argument. ``None`` can be used to turn off " "interpolation completely, ``ExtendedInterpolation()`` provides a more " "advanced variant inspired by ``zc.buildout``. More on the subject in the " -"`dedicated documentation section <#interpolation-of-values>`_. :class:" -"`RawConfigParser` has a default value of ``None``." +"`dedicated documentation section <#interpolation-of-" +"values>`_. :class:`RawConfigParser` has a default value of ``None``." msgstr "" #: ../../library/configparser.rst:724 @@ -1084,9 +1085,9 @@ msgid "" "and :meth:`~ConfigParser.getboolean` are implemented. Should other getters " "be desirable, users may define them in a subclass or pass a dictionary where " "each key is a name of the converter and each value is a callable " -"implementing said conversion. For instance, passing ``{'decimal': decimal." -"Decimal}`` would add :meth:`!getdecimal` on both the parser object and all " -"section proxies. In other words, it will be possible to write both " +"implementing said conversion. For instance, passing ``{'decimal': " +"decimal.Decimal}`` would add :meth:`!getdecimal` on both the parser object " +"and all section proxies. In other words, it will be possible to write both " "``parser_instance.getdecimal('section', 'key', fallback=0)`` and " "``parser_instance['section'].getdecimal('key', 0)``." msgstr "" @@ -1404,13 +1405,13 @@ msgstr "" msgid "" "When *strict* is ``True`` (the default), the parser won't allow for any " "section or option duplicates while reading from a single source (file, " -"string or dictionary), raising :exc:`DuplicateSectionError` or :exc:" -"`DuplicateOptionError`. When *empty_lines_in_values* is ``False`` (default: " -"``True``), each empty line marks the end of an option. Otherwise, internal " -"empty lines of a multiline option are kept as part of the value. When " -"*allow_no_value* is ``True`` (default: ``False``), options without values " -"are accepted; the value held for these is ``None`` and they are serialized " -"without the trailing delimiter." +"string or dictionary), raising :exc:`DuplicateSectionError` " +"or :exc:`DuplicateOptionError`. When *empty_lines_in_values* is ``False`` " +"(default: ``True``), each empty line marks the end of an option. Otherwise, " +"internal empty lines of a multiline option are kept as part of the value. " +"When *allow_no_value* is ``True`` (default: ``False``), options without " +"values are accepted; the value held for these is ``None`` and they are " +"serialized without the trailing delimiter." msgstr "" #: ../../library/configparser.rst:974 @@ -1434,11 +1435,11 @@ msgstr "" #: ../../library/configparser.rst:987 msgid "" -"All option names used in interpolation will be passed through the :meth:" -"`optionxform` method just like any other option name reference. For " -"example, using the default implementation of :meth:`optionxform` (which " -"converts option names to lower case), the values ``foo %(bar)s`` and ``foo " -"%(BAR)s`` are equivalent." +"All option names used in interpolation will be passed through " +"the :meth:`optionxform` method just like any other option name reference. " +"For example, using the default implementation of :meth:`optionxform` (which " +"converts option names to lower case), the values ``foo %(bar)s`` and ``foo %" +"(BAR)s`` are equivalent." msgstr "" #: ../../library/configparser.rst:993 @@ -1528,9 +1529,9 @@ msgstr "" #: ../../library/configparser.rst:1090 msgid "" -"If the given *section* exists, and contains the given *option*, return :" -"const:`True`; otherwise return :const:`False`. If the specified *section* " -"is :const:`None` or an empty string, DEFAULT is assumed." +"If the given *section* exists, and contains the given *option*, " +"return :const:`True`; otherwise return :const:`False`. If the specified " +"*section* is :const:`None` or an empty string, DEFAULT is assumed." msgstr "" #: ../../library/configparser.rst:1097 @@ -1554,8 +1555,8 @@ msgstr "" msgid "" "If none of the named files exist, the :class:`ConfigParser` instance will " "contain an empty dataset. An application which requires initial values to " -"be loaded from a file should load the required file or files using :meth:" -"`read_file` before calling :meth:`read` for any optional files::" +"be loaded from a file should load the required file or files " +"using :meth:`read_file` before calling :meth:`read` for any optional files::" msgstr "" #: ../../library/configparser.rst:1115 @@ -1679,9 +1680,9 @@ msgid "" "``'1'``, ``'yes'``, ``'true'``, and ``'on'``, which cause this method to " "return ``True``, and ``'0'``, ``'no'``, ``'false'``, and ``'off'``, which " "cause it to return ``False``. These string values are checked in a case-" -"insensitive manner. Any other value will cause it to raise :exc:" -"`ValueError`. See :meth:`get` for explanation of *raw*, *vars* and " -"*fallback*." +"insensitive manner. Any other value will cause it to " +"raise :exc:`ValueError`. See :meth:`get` for explanation of *raw*, *vars* " +"and *fallback*." msgstr "" #: ../../library/configparser.rst:1219 @@ -1693,8 +1694,8 @@ msgstr "" #: ../../library/configparser.rst:1222 msgid "" "Otherwise, return a list of *name*, *value* pairs for the options in the " -"given *section*. Optional arguments have the same meaning as for the :meth:" -"`get` method." +"given *section*. Optional arguments have the same meaning as for " +"the :meth:`get` method." msgstr "" #: ../../library/configparser.rst:1226 @@ -1779,9 +1780,9 @@ msgstr "" #: ../../library/configparser.rst:1296 msgid "" -"The maximum depth for recursive interpolation for :meth:`~configparser." -"ConfigParser.get` when the *raw* parameter is false. This is relevant only " -"when the default *interpolation* is used." +"The maximum depth for recursive interpolation " +"for :meth:`~configparser.ConfigParser.get` when the *raw* parameter is " +"false. This is relevant only when the default *interpolation* is used." msgstr "" #: ../../library/configparser.rst:1304 @@ -1819,9 +1820,9 @@ msgstr "" #: ../../library/configparser.rst:1353 msgid "" "If the given section exists, set the given option to the specified value; " -"otherwise raise :exc:`NoSectionError`. While it is possible to use :class:" -"`RawConfigParser` (or :class:`ConfigParser` with *raw* parameters set to " -"true) for *internal* storage of non-string values, full functionality " +"otherwise raise :exc:`NoSectionError`. While it is possible to " +"use :class:`RawConfigParser` (or :class:`ConfigParser` with *raw* parameters " +"set to true) for *internal* storage of non-string values, full functionality " "(including interpolation and output to files) can only be achieved using " "string values." msgstr "" @@ -1855,8 +1856,8 @@ msgstr "" #: ../../library/configparser.rst:1385 msgid "" -"Added the optional *source* and *lineno* attributes and parameters to :meth:" -"`!__init__`." +"Added the optional *source* and *lineno* attributes and parameters " +"to :meth:`!__init__`." msgstr "" #: ../../library/configparser.rst:1392 @@ -1882,8 +1883,8 @@ msgstr "" #: ../../library/configparser.rst:1412 msgid "" "Exception raised when string interpolation cannot be completed because the " -"number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass of :" -"exc:`InterpolationError`." +"number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass " +"of :exc:`InterpolationError`." msgstr "" #: ../../library/configparser.rst:1419 diff --git a/library/constants.po b/library/constants.po index 9fd1624475..c3432348ca 100644 --- a/library/constants.po +++ b/library/constants.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2025-03-04 00:14+0000\n" "PO-Revision-Date: 2021-11-19 23:36+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -96,16 +96,17 @@ msgid "See :ref:`implementing-the-arithmetic-operations` for examples." msgstr "請參見 :ref:`implementing-the-arithmetic-operations` 以找到更多範例。" #: ../../library/constants.rst:51 +#, fuzzy msgid "" -"``NotImplementedError`` and :data:`!NotImplemented` are not interchangeable, " -"even though they have similar names and purposes. See :exc:" -"`NotImplementedError` for details on when to use it." +":data:`!NotImplemented` and :exc:`!NotImplementedError` are not " +"interchangeable. This constant should only be used as described above; see :" +"exc:`NotImplementedError` for details on correct usage of the exception." msgstr "" "``NotImplementedError`` 與 :data:`!NotImplemented` 並不一樣且不可互換。即使它" "們有相似的名稱與用途。欲知更多如何使用它們的細節,請參見 :exc:" "`NotImplementedError`。" -#: ../../library/constants.rst:55 +#: ../../library/constants.rst:56 msgid "" "Evaluating :data:`!NotImplemented` in a boolean context is deprecated. While " "it currently evaluates as true, it will emit a :exc:`DeprecationWarning`. It " @@ -115,7 +116,7 @@ msgstr "" "被解讀成 true,但會發出一個 :exc:`DeprecationWarning`。在未來版本的 Python 將" "會拋出 :exc:`TypeError`。" -#: ../../library/constants.rst:64 +#: ../../library/constants.rst:65 msgid "" "The same as the ellipsis literal \"``...``\". Special value used mostly in " "conjunction with extended slicing syntax for user-defined container data " @@ -126,7 +127,7 @@ msgstr "" "伸切片語法 (extended slicing syntax)。``Ellipsis`` 是型別 :data:`types." "EllipsisType` 的唯一實例。" -#: ../../library/constants.rst:71 +#: ../../library/constants.rst:72 msgid "" "This constant is true if Python was not started with an :option:`-O` option. " "See also the :keyword:`assert` statement." @@ -134,7 +135,7 @@ msgstr "" "如果 Python 沒有被以 :option:`-O` 選項啟動,則此常數為 true。請參見 :keyword:" "`assert` 陳述式。" -#: ../../library/constants.rst:77 +#: ../../library/constants.rst:78 msgid "" "The names :data:`None`, :data:`False`, :data:`True` and :data:`__debug__` " "cannot be reassigned (assignments to them, even as an attribute name, raise :" @@ -144,11 +145,11 @@ msgstr "" "重新賦值的(任何對它們的賦值,即使是屬性的名稱,也會拋出 :exc:" "`SyntaxError`)。因此,它們可以被視為”真正的”常數。" -#: ../../library/constants.rst:85 +#: ../../library/constants.rst:86 msgid "Constants added by the :mod:`site` module" msgstr "由 :mod:`site` module(模組)所添增的常數" -#: ../../library/constants.rst:87 +#: ../../library/constants.rst:88 msgid "" "The :mod:`site` module (which is imported automatically during startup, " "except if the :option:`-S` command-line option is given) adds several " @@ -159,7 +160,7 @@ msgstr "" "指令行選項)會添增一些常數到內建命名空間 (built-in namespace) 中。它們在互動" "式直譯器中是很有幫助的,但不應該在程式 (programs) 中被使用。" -#: ../../library/constants.rst:95 +#: ../../library/constants.rst:96 msgid "" "Objects that when printed, print a message like \"Use quit() or Ctrl-D (i.e. " "EOF) to exit\", and when called, raise :exc:`SystemExit` with the specified " @@ -168,7 +169,7 @@ msgstr "" "當印出物件時,會印出一個訊息: \"Use quit() or Ctrl-D (i.e. EOF) to exit\" 。" "當被呼叫時,則會拋出 :exc:`SystemExit` 並帶有指定的返回碼(exit code)。" -#: ../../library/constants.rst:102 +#: ../../library/constants.rst:103 msgid "" "Object that when printed, prints the message \"Type help() for interactive " "help, or help(object) for help about object.\", and when called, acts as " @@ -178,13 +179,13 @@ msgstr "" "help(object) for help about object.\",並在呼叫時按所述的方式操作 :func:" "`elsewhere `。" -#: ../../library/constants.rst:109 +#: ../../library/constants.rst:110 msgid "" "Objects that when printed or called, print the text of copyright or credits, " "respectively." msgstr "當印出或是呼叫此物件時,分別會印出版權與致謝的文字。" -#: ../../library/constants.rst:114 +#: ../../library/constants.rst:115 msgid "" "Object that when printed, prints the message \"Type license() to see the " "full license text\", and when called, displays the full license text in a " @@ -193,10 +194,10 @@ msgstr "" "當印出此物件時,會印出訊息 \"Type license() to see the full license text\"," "並在呼叫時以分頁形式印出完整的許可證文字(一次一整個畫面)。" -#: ../../library/constants.rst:61 +#: ../../library/constants.rst:62 msgid "..." msgstr "..." -#: ../../library/constants.rst:61 +#: ../../library/constants.rst:62 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" diff --git a/library/contextlib.po b/library/contextlib.po index 5785f5506e..8be0c9becc 100644 --- a/library/contextlib.po +++ b/library/contextlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-04-11 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -73,7 +73,7 @@ msgid "" "While many objects natively support use in with statements, sometimes a " "resource needs to be managed that isn't a context manager in its own right, " "and doesn't implement a ``close()`` method for use with ``contextlib." -"closing``" +"closing``." msgstr "" #: ../../library/contextlib.rst:54 @@ -982,37 +982,37 @@ msgid "" "be used instead." msgstr "" -#: ../../library/contextlib.rst:634 +#: ../../library/contextlib.rst:635 msgid "" "Similar to :meth:`ExitStack.enter_context` but expects an asynchronous " "context manager." msgstr "" -#: ../../library/contextlib.rst:637 +#: ../../library/contextlib.rst:638 msgid "" "Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm* is not an " "asynchronous context manager." msgstr "" -#: ../../library/contextlib.rst:643 +#: ../../library/contextlib.rst:644 msgid "" "Similar to :meth:`ExitStack.push` but expects either an asynchronous context " "manager or a coroutine function." msgstr "" -#: ../../library/contextlib.rst:648 +#: ../../library/contextlib.rst:649 msgid "Similar to :meth:`ExitStack.callback` but expects a coroutine function." msgstr "" -#: ../../library/contextlib.rst:652 +#: ../../library/contextlib.rst:654 msgid "Similar to :meth:`ExitStack.close` but properly handles awaitables." msgstr "" -#: ../../library/contextlib.rst:654 +#: ../../library/contextlib.rst:656 msgid "Continuing the example for :func:`asynccontextmanager`::" msgstr "" -#: ../../library/contextlib.rst:656 +#: ../../library/contextlib.rst:658 msgid "" "async with AsyncExitStack() as stack:\n" " connections = [await stack.enter_async_context(get_connection())\n" @@ -1022,21 +1022,21 @@ msgid "" " # later in the list raise an exception." msgstr "" -#: ../../library/contextlib.rst:666 +#: ../../library/contextlib.rst:668 msgid "Examples and Recipes" msgstr "" -#: ../../library/contextlib.rst:668 +#: ../../library/contextlib.rst:670 msgid "" "This section describes some examples and recipes for making effective use of " "the tools provided by :mod:`contextlib`." msgstr "" -#: ../../library/contextlib.rst:673 +#: ../../library/contextlib.rst:675 msgid "Supporting a variable number of context managers" msgstr "" -#: ../../library/contextlib.rst:675 +#: ../../library/contextlib.rst:677 msgid "" "The primary use case for :class:`ExitStack` is the one given in the class " "documentation: supporting a variable number of context managers and other " @@ -1046,7 +1046,7 @@ msgid "" "of the context managers being optional::" msgstr "" -#: ../../library/contextlib.rst:682 +#: ../../library/contextlib.rst:684 msgid "" "with ExitStack() as stack:\n" " for resource in resources:\n" @@ -1057,18 +1057,18 @@ msgid "" " # Perform operations that use the acquired resources" msgstr "" -#: ../../library/contextlib.rst:690 +#: ../../library/contextlib.rst:692 msgid "" "As shown, :class:`ExitStack` also makes it quite easy to use :keyword:`with` " "statements to manage arbitrary resources that don't natively support the " "context management protocol." msgstr "" -#: ../../library/contextlib.rst:696 +#: ../../library/contextlib.rst:698 msgid "Catching exceptions from ``__enter__`` methods" msgstr "" -#: ../../library/contextlib.rst:698 +#: ../../library/contextlib.rst:700 msgid "" "It is occasionally desirable to catch exceptions from an ``__enter__`` " "method implementation, *without* inadvertently catching exceptions from the :" @@ -1077,7 +1077,7 @@ msgid "" "be separated slightly in order to allow this::" msgstr "" -#: ../../library/contextlib.rst:704 +#: ../../library/contextlib.rst:706 msgid "" "stack = ExitStack()\n" "try:\n" @@ -1089,7 +1089,7 @@ msgid "" " # Handle normal case" msgstr "" -#: ../../library/contextlib.rst:713 +#: ../../library/contextlib.rst:715 msgid "" "Actually needing to do this is likely to indicate that the underlying API " "should be providing a direct resource management interface for use with :" @@ -1100,25 +1100,25 @@ msgid "" "`with` statement." msgstr "" -#: ../../library/contextlib.rst:723 +#: ../../library/contextlib.rst:725 msgid "Cleaning up in an ``__enter__`` implementation" msgstr "" -#: ../../library/contextlib.rst:725 +#: ../../library/contextlib.rst:727 msgid "" "As noted in the documentation of :meth:`ExitStack.push`, this method can be " "useful in cleaning up an already allocated resource if later steps in the :" "meth:`~object.__enter__` implementation fail." msgstr "" -#: ../../library/contextlib.rst:729 +#: ../../library/contextlib.rst:731 msgid "" "Here's an example of doing this for a context manager that accepts resource " "acquisition and release functions, along with an optional validation " "function, and maps them to the context management protocol::" msgstr "" -#: ../../library/contextlib.rst:733 +#: ../../library/contextlib.rst:735 msgid "" "from contextlib import contextmanager, AbstractContextManager, ExitStack\n" "\n" @@ -1156,11 +1156,11 @@ msgid "" " self.release_resource()" msgstr "" -#: ../../library/contextlib.rst:769 +#: ../../library/contextlib.rst:771 msgid "Replacing any use of ``try-finally`` and flag variables" msgstr "" -#: ../../library/contextlib.rst:771 +#: ../../library/contextlib.rst:773 msgid "" "A pattern you will sometimes see is a ``try-finally`` statement with a flag " "variable to indicate whether or not the body of the ``finally`` clause " @@ -1168,7 +1168,7 @@ msgid "" "by using an ``except`` clause instead), it looks something like this::" msgstr "" -#: ../../library/contextlib.rst:776 +#: ../../library/contextlib.rst:778 msgid "" "cleanup_needed = True\n" "try:\n" @@ -1188,21 +1188,21 @@ msgstr "" " if cleanup_needed:\n" " cleanup_resources()" -#: ../../library/contextlib.rst:785 +#: ../../library/contextlib.rst:787 msgid "" "As with any ``try`` statement based code, this can cause problems for " "development and review, because the setup code and the cleanup code can end " "up being separated by arbitrarily long sections of code." msgstr "" -#: ../../library/contextlib.rst:789 +#: ../../library/contextlib.rst:791 msgid "" ":class:`ExitStack` makes it possible to instead register a callback for " "execution at the end of a ``with`` statement, and then later decide to skip " "executing that callback::" msgstr "" -#: ../../library/contextlib.rst:793 +#: ../../library/contextlib.rst:795 msgid "" "from contextlib import ExitStack\n" "\n" @@ -1220,19 +1220,19 @@ msgstr "" " if result:\n" " stack.pop_all()" -#: ../../library/contextlib.rst:801 +#: ../../library/contextlib.rst:803 msgid "" "This allows the intended cleanup behaviour to be made explicit up front, " "rather than requiring a separate flag variable." msgstr "" -#: ../../library/contextlib.rst:804 +#: ../../library/contextlib.rst:806 msgid "" "If a particular application uses this pattern a lot, it can be simplified " "even further by means of a small helper class::" msgstr "" -#: ../../library/contextlib.rst:807 +#: ../../library/contextlib.rst:809 msgid "" "from contextlib import ExitStack\n" "\n" @@ -1264,14 +1264,14 @@ msgstr "" " if result:\n" " cb.cancel()" -#: ../../library/contextlib.rst:822 +#: ../../library/contextlib.rst:824 msgid "" "If the resource cleanup isn't already neatly bundled into a standalone " "function, then it is still possible to use the decorator form of :meth:" "`ExitStack.callback` to declare the resource cleanup in advance::" msgstr "" -#: ../../library/contextlib.rst:827 +#: ../../library/contextlib.rst:829 msgid "" "from contextlib import ExitStack\n" "\n" @@ -1293,24 +1293,24 @@ msgstr "" " if result:\n" " stack.pop_all()" -#: ../../library/contextlib.rst:837 +#: ../../library/contextlib.rst:839 msgid "" "Due to the way the decorator protocol works, a callback function declared " "this way cannot take any parameters. Instead, any resources to be released " "must be accessed as closure variables." msgstr "" -#: ../../library/contextlib.rst:843 +#: ../../library/contextlib.rst:845 msgid "Using a context manager as a function decorator" msgstr "" -#: ../../library/contextlib.rst:845 +#: ../../library/contextlib.rst:847 msgid "" ":class:`ContextDecorator` makes it possible to use a context manager in both " "an ordinary ``with`` statement and also as a function decorator." msgstr "" -#: ../../library/contextlib.rst:848 +#: ../../library/contextlib.rst:850 msgid "" "For example, it is sometimes useful to wrap functions or groups of " "statements with a logger that can track the time of entry and time of exit. " @@ -1319,7 +1319,7 @@ msgid "" "in a single definition::" msgstr "" -#: ../../library/contextlib.rst:854 +#: ../../library/contextlib.rst:856 msgid "" "from contextlib import ContextDecorator\n" "import logging\n" @@ -1351,11 +1351,11 @@ msgstr "" " def __exit__(self, exc_type, exc, exc_tb):\n" " logging.info('Exiting: %s', self.name)" -#: ../../library/contextlib.rst:869 +#: ../../library/contextlib.rst:871 msgid "Instances of this class can be used as both a context manager::" msgstr "" -#: ../../library/contextlib.rst:871 +#: ../../library/contextlib.rst:873 msgid "" "with track_entry_and_exit('widget loader'):\n" " print('Some time consuming activity goes here')\n" @@ -1365,11 +1365,11 @@ msgstr "" " print('Some time consuming activity goes here')\n" " load_widget()" -#: ../../library/contextlib.rst:875 +#: ../../library/contextlib.rst:877 msgid "And also as a function decorator::" msgstr "" -#: ../../library/contextlib.rst:877 +#: ../../library/contextlib.rst:879 msgid "" "@track_entry_and_exit('widget loader')\n" "def activity():\n" @@ -1381,7 +1381,7 @@ msgstr "" " print('Some time consuming activity goes here')\n" " load_widget()" -#: ../../library/contextlib.rst:882 +#: ../../library/contextlib.rst:884 msgid "" "Note that there is one additional limitation when using context managers as " "function decorators: there's no way to access the return value of :meth:" @@ -1389,21 +1389,21 @@ msgid "" "use an explicit ``with`` statement." msgstr "" -#: ../../library/contextlib.rst:889 +#: ../../library/contextlib.rst:891 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../library/contextlib.rst:890 +#: ../../library/contextlib.rst:892 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../library/contextlib.rst:896 +#: ../../library/contextlib.rst:898 msgid "Single use, reusable and reentrant context managers" msgstr "" -#: ../../library/contextlib.rst:898 +#: ../../library/contextlib.rst:900 msgid "" "Most context managers are written in a way that means they can only be used " "effectively in a :keyword:`with` statement once. These single use context " @@ -1411,28 +1411,28 @@ msgid "" "them a second time will trigger an exception or otherwise not work correctly." msgstr "" -#: ../../library/contextlib.rst:904 +#: ../../library/contextlib.rst:906 msgid "" "This common limitation means that it is generally advisable to create " "context managers directly in the header of the :keyword:`with` statement " "where they are used (as shown in all of the usage examples above)." msgstr "" -#: ../../library/contextlib.rst:908 +#: ../../library/contextlib.rst:910 msgid "" "Files are an example of effectively single use context managers, since the " "first :keyword:`with` statement will close the file, preventing any further " "IO operations using that file object." msgstr "" -#: ../../library/contextlib.rst:912 +#: ../../library/contextlib.rst:914 msgid "" "Context managers created using :func:`contextmanager` are also single use " "context managers, and will complain about the underlying generator failing " "to yield if an attempt is made to use them a second time::" msgstr "" -#: ../../library/contextlib.rst:916 +#: ../../library/contextlib.rst:918 msgid "" ">>> from contextlib import contextmanager\n" ">>> @contextmanager\n" @@ -1474,11 +1474,11 @@ msgstr "" " ...\n" "RuntimeError: generator didn't yield" -#: ../../library/contextlib.rst:940 +#: ../../library/contextlib.rst:942 msgid "Reentrant context managers" msgstr "" -#: ../../library/contextlib.rst:942 +#: ../../library/contextlib.rst:944 msgid "" "More sophisticated context managers may be \"reentrant\". These context " "managers can not only be used in multiple :keyword:`with` statements, but " @@ -1486,14 +1486,14 @@ msgid "" "the same context manager." msgstr "" -#: ../../library/contextlib.rst:947 +#: ../../library/contextlib.rst:949 msgid "" ":class:`threading.RLock` is an example of a reentrant context manager, as " "are :func:`suppress`, :func:`redirect_stdout`, and :func:`chdir`. Here's a " "very simple example of reentrant use::" msgstr "" -#: ../../library/contextlib.rst:951 +#: ../../library/contextlib.rst:953 msgid "" ">>> from contextlib import redirect_stdout\n" ">>> from io import StringIO\n" @@ -1525,14 +1525,14 @@ msgstr "" "This is written to the stream rather than stdout\n" "This is also written to the stream" -#: ../../library/contextlib.rst:966 +#: ../../library/contextlib.rst:968 msgid "" "Real world examples of reentrancy are more likely to involve multiple " "functions calling each other and hence be far more complicated than this " "example." msgstr "" -#: ../../library/contextlib.rst:970 +#: ../../library/contextlib.rst:972 msgid "" "Note also that being reentrant is *not* the same thing as being thread " "safe. :func:`redirect_stdout`, for example, is definitely not thread safe, " @@ -1540,11 +1540,11 @@ msgid "" "stdout` to a different stream." msgstr "" -#: ../../library/contextlib.rst:979 +#: ../../library/contextlib.rst:981 msgid "Reusable context managers" msgstr "" -#: ../../library/contextlib.rst:981 +#: ../../library/contextlib.rst:983 msgid "" "Distinct from both single use and reentrant context managers are " "\"reusable\" context managers (or, to be completely explicit, \"reusable, " @@ -1554,21 +1554,21 @@ msgid "" "manager instance has already been used in a containing with statement." msgstr "" -#: ../../library/contextlib.rst:988 +#: ../../library/contextlib.rst:990 msgid "" ":class:`threading.Lock` is an example of a reusable, but not reentrant, " "context manager (for a reentrant lock, it is necessary to use :class:" "`threading.RLock` instead)." msgstr "" -#: ../../library/contextlib.rst:992 +#: ../../library/contextlib.rst:994 msgid "" "Another example of a reusable, but not reentrant, context manager is :class:" "`ExitStack`, as it invokes *all* currently registered callbacks when leaving " "any with statement, regardless of where those callbacks were added::" msgstr "" -#: ../../library/contextlib.rst:997 +#: ../../library/contextlib.rst:999 msgid "" ">>> from contextlib import ExitStack\n" ">>> stack = ExitStack()\n" @@ -1622,7 +1622,7 @@ msgstr "" "Callback: from outer context\n" "Leaving outer context" -#: ../../library/contextlib.rst:1023 +#: ../../library/contextlib.rst:1025 msgid "" "As the output from the example shows, reusing a single stack object across " "multiple with statements works correctly, but attempting to nest them will " @@ -1630,13 +1630,13 @@ msgid "" "which is unlikely to be desirable behaviour." msgstr "" -#: ../../library/contextlib.rst:1028 +#: ../../library/contextlib.rst:1030 msgid "" "Using separate :class:`ExitStack` instances instead of reusing a single " "instance avoids that problem::" msgstr "" -#: ../../library/contextlib.rst:1031 +#: ../../library/contextlib.rst:1033 msgid "" ">>> from contextlib import ExitStack\n" ">>> with ExitStack() as outer_stack:\n" diff --git a/library/ctypes.po b/library/ctypes.po index 233c1e14ac..86164ffb4f 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-23 00:14+0000\n" +"POT-Creation-Date: 2025-02-21 00:13+0000\n" "PO-Revision-Date: 2023-04-26 02:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -48,9 +47,10 @@ msgstr "" #: ../../library/ctypes.rst:27 msgid "" "Note: Some code samples reference the ctypes :class:`c_int` type. On " -"platforms where ``sizeof(long) == sizeof(int)`` it is an alias to :class:" -"`c_long`. So, you should not be confused if :class:`c_long` is printed if " -"you would expect :class:`c_int` --- they are actually the same type." +"platforms where ``sizeof(long) == sizeof(int)`` it is an alias " +"to :class:`c_long`. So, you should not be confused if :class:`c_long` is " +"printed if you would expect :class:`c_int` --- they are actually the same " +"type." msgstr "" #: ../../library/ctypes.rst:35 @@ -76,8 +76,8 @@ msgstr "" #: ../../library/ctypes.rst:48 msgid "" -"Windows errors used to raise :exc:`WindowsError`, which is now an alias of :" -"exc:`OSError`." +"Windows errors used to raise :exc:`WindowsError`, which is now an alias " +"of :exc:`OSError`." msgstr "" #: ../../library/ctypes.rst:53 @@ -90,19 +90,19 @@ msgstr "" #: ../../library/ctypes.rst:57 msgid "" ">>> from ctypes import *\n" -">>> print(windll.kernel32) \n" +">>> print(windll.kernel32)\n" "\n" -">>> print(cdll.msvcrt) \n" +">>> print(cdll.msvcrt)\n" "\n" -">>> libc = cdll.msvcrt \n" +">>> libc = cdll.msvcrt\n" ">>>" msgstr "" ">>> from ctypes import *\n" -">>> print(windll.kernel32) \n" +">>> print(windll.kernel32)\n" "\n" -">>> print(cdll.msvcrt) \n" +">>> print(cdll.msvcrt)\n" "\n" -">>> libc = cdll.msvcrt \n" +">>> libc = cdll.msvcrt\n" ">>>" #: ../../library/ctypes.rst:65 @@ -128,17 +128,17 @@ msgstr "" #: ../../library/ctypes.rst:79 msgid "" -">>> cdll.LoadLibrary(\"libc.so.6\") \n" +">>> cdll.LoadLibrary(\"libc.so.6\")\n" "\n" -">>> libc = CDLL(\"libc.so.6\") \n" -">>> libc \n" +">>> libc = CDLL(\"libc.so.6\")\n" +">>> libc\n" "\n" ">>>" msgstr "" -">>> cdll.LoadLibrary(\"libc.so.6\") \n" +">>> cdll.LoadLibrary(\"libc.so.6\")\n" "\n" -">>> libc = CDLL(\"libc.so.6\") \n" -">>> libc \n" +">>> libc = CDLL(\"libc.so.6\")\n" +">>> libc\n" "\n" ">>>" @@ -154,9 +154,9 @@ msgstr "" msgid "" ">>> libc.printf\n" "<_FuncPtr object at 0x...>\n" -">>> print(windll.kernel32.GetModuleHandleA) \n" +">>> print(windll.kernel32.GetModuleHandleA)\n" "<_FuncPtr object at 0x...>\n" -">>> print(windll.kernel32.MyOwnFunction) \n" +">>> print(windll.kernel32.MyOwnFunction)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"ctypes.py\", line 239, in __getattr__\n" @@ -166,9 +166,9 @@ msgid "" msgstr "" ">>> libc.printf\n" "<_FuncPtr object at 0x...>\n" -">>> print(windll.kernel32.GetModuleHandleA) \n" +">>> print(windll.kernel32.GetModuleHandleA)\n" "<_FuncPtr object at 0x...>\n" -">>> print(windll.kernel32.MyOwnFunction) \n" +">>> print(windll.kernel32.MyOwnFunction)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"ctypes.py\", line 239, in __getattr__\n" @@ -209,17 +209,17 @@ msgstr "" #: ../../library/ctypes.rst:125 msgid "" "Sometimes, dlls export functions with names which aren't valid Python " -"identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to use :func:" -"`getattr` to retrieve the function::" +"identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to " +"use :func:`getattr` to retrieve the function::" msgstr "" #: ../../library/ctypes.rst:129 msgid "" -">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\") \n" +">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\")\n" "<_FuncPtr object at 0x...>\n" ">>>" msgstr "" -">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\") \n" +">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\")\n" "<_FuncPtr object at 0x...>\n" ">>>" @@ -232,9 +232,9 @@ msgstr "" #: ../../library/ctypes.rst:136 msgid "" -">>> cdll.kernel32[1] \n" +">>> cdll.kernel32[1]\n" "<_FuncPtr object at 0x...>\n" -">>> cdll.kernel32[0] \n" +">>> cdll.kernel32[0]\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"ctypes.py\", line 310, in __getitem__\n" @@ -242,9 +242,9 @@ msgid "" "AttributeError: function ordinal 0 not found\n" ">>>" msgstr "" -">>> cdll.kernel32[1] \n" +">>> cdll.kernel32[1]\n" "<_FuncPtr object at 0x...>\n" -">>> cdll.kernel32[0] \n" +">>> cdll.kernel32[0]\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"ctypes.py\", line 310, in __getitem__\n" @@ -265,10 +265,10 @@ msgstr "" #: ../../library/ctypes.rst:155 msgid "" -">>> print(libc.rand()) \n" +">>> print(libc.rand())\n" "1804289383" msgstr "" -">>> print(libc.rand()) \n" +">>> print(libc.rand())\n" "1804289383" #: ../../library/ctypes.rst:158 @@ -280,11 +280,11 @@ msgstr "" #: ../../library/ctypes.rst:161 msgid "" -">>> print(hex(windll.kernel32.GetModuleHandleA(None))) \n" +">>> print(hex(windll.kernel32.GetModuleHandleA(None)))\n" "0x1d000000\n" ">>>" msgstr "" -">>> print(hex(windll.kernel32.GetModuleHandleA(None))) \n" +">>> print(hex(windll.kernel32.GetModuleHandleA(None)))\n" "0x1d000000\n" ">>>" @@ -296,28 +296,28 @@ msgstr "" #: ../../library/ctypes.rst:168 msgid "" -">>> cdll.kernel32.GetModuleHandleA(None) \n" +">>> cdll.kernel32.GetModuleHandleA(None)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "ValueError: Procedure probably called with not enough arguments (4 bytes " "missing)\n" ">>>\n" "\n" -">>> windll.msvcrt.printf(b\"spam\") \n" +">>> windll.msvcrt.printf(b\"spam\")\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "ValueError: Procedure probably called with too many arguments (4 bytes in " "excess)\n" ">>>" msgstr "" -">>> cdll.kernel32.GetModuleHandleA(None) \n" +">>> cdll.kernel32.GetModuleHandleA(None)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "ValueError: Procedure probably called with not enough arguments (4 bytes " "missing)\n" ">>>\n" "\n" -">>> windll.msvcrt.printf(b\"spam\") \n" +">>> windll.msvcrt.printf(b\"spam\")\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "ValueError: Procedure probably called with too many arguments (4 bytes in " @@ -339,13 +339,13 @@ msgstr "" #: ../../library/ctypes.rst:187 msgid "" -">>> windll.kernel32.GetModuleHandleA(32) \n" +">>> windll.kernel32.GetModuleHandleA(32)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "OSError: exception: access violation reading 0x00000020\n" ">>>" msgstr "" -">>> windll.kernel32.GetModuleHandleA(32) \n" +">>> windll.kernel32.GetModuleHandleA(32)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "OSError: exception: access violation reading 0x00000020\n" @@ -364,10 +364,10 @@ msgid "" "``None``, integers, bytes objects and (unicode) strings are the only native " "Python objects that can directly be used as parameters in these function " "calls. ``None`` is passed as a C ``NULL`` pointer, bytes objects and strings " -"are passed as pointer to the memory block that contains their data (:c:expr:" -"`char *` or :c:expr:`wchar_t *`). Python integers are passed as the " -"platform's default C :c:expr:`int` type, their value is masked to fit into " -"the C type." +"are passed as pointer to the memory block that contains their data " +"(:c:expr:`char *` or :c:expr:`wchar_t *`). Python integers are passed as " +"the platform's default C :c:expr:`int` type, their value is masked to fit " +"into the C type." msgstr "" #: ../../library/ctypes.rst:205 @@ -664,10 +664,10 @@ msgstr "" #: ../../library/ctypes.rst:292 msgid "" -"Assigning a new value to instances of the pointer types :class:`c_char_p`, :" -"class:`c_wchar_p`, and :class:`c_void_p` changes the *memory location* they " -"point to, *not the contents* of the memory block (of course not, because " -"Python bytes objects are immutable)::" +"Assigning a new value to instances of the pointer " +"types :class:`c_char_p`, :class:`c_wchar_p`, and :class:`c_void_p` changes " +"the *memory location* they point to, *not the contents* of the memory block " +"(of course not, because Python string objects are immutable)::" msgstr "" #: ../../library/ctypes.rst:297 @@ -691,11 +691,11 @@ msgstr "" #: ../../library/ctypes.rst:312 msgid "" "You should be careful, however, not to pass them to functions expecting " -"pointers to mutable memory. If you need mutable memory blocks, ctypes has a :" -"func:`create_string_buffer` function which creates these in various ways. " -"The current memory block contents can be accessed (or changed) with the " -"``raw`` property; if you want to access it as NUL terminated string, use the " -"``value`` property::" +"pointers to mutable memory. If you need mutable memory blocks, ctypes has " +"a :func:`create_string_buffer` function which creates these in various " +"ways. The current memory block contents can be accessed (or changed) with " +"the ``raw`` property; if you want to access it as NUL terminated string, use " +"the ``value`` property::" msgstr "" #: ../../library/ctypes.rst:319 @@ -734,9 +734,9 @@ msgstr "" #: ../../library/ctypes.rst:347 msgid "" -"Note that printf prints to the real standard output channel, *not* to :data:" -"`sys.stdout`, so these examples will only work at the console prompt, not " -"from within *IDLE* or *PythonWin*::" +"Note that printf prints to the real standard output channel, *not* " +"to :data:`sys.stdout`, so these examples will only work at the console " +"prompt, not from within *IDLE* or *PythonWin*::" msgstr "" #: ../../library/ctypes.rst:351 @@ -931,13 +931,13 @@ msgstr "" msgid "" "If you have defined your own classes which you pass to function calls, you " "have to implement a :meth:`~_CData.from_param` class method for them to be " -"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. The :meth:" -"`~_CData.from_param` class method receives the Python object passed to the " -"function call, it should do a typecheck or whatever is needed to make sure " -"this object is acceptable, and then return the object itself, its :attr:`!" -"_as_parameter_` attribute, or whatever you want to pass as the C function " -"argument in this case. Again, the result should be an integer, string, " -"bytes, a :mod:`ctypes` instance, or an object with an :attr:`!" +"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. " +"The :meth:`~_CData.from_param` class method receives the Python object " +"passed to the function call, it should do a typecheck or whatever is needed " +"to make sure this object is acceptable, and then return the object itself, " +"its :attr:`!_as_parameter_` attribute, or whatever you want to pass as the C " +"function argument in this case. Again, the result should be an integer, " +"string, bytes, a :mod:`ctypes` instance, or an object with an :attr:`!" "_as_parameter_` attribute." msgstr "" @@ -954,9 +954,10 @@ msgstr "" #: ../../library/ctypes.rst:482 msgid "" -"The C prototype of :c:func:`time` is ``time_t time(time_t *)``. Because :c:" -"type:`time_t` might be of a different type than the default return type :c:" -"expr:`int`, you should specify the :attr:`!restype` attribute::" +"The C prototype of :c:func:`time` is ``time_t time(time_t *)``. " +"Because :c:type:`time_t` might be of a different type than the default " +"return type :c:expr:`int`, you should specify the :attr:`!restype` " +"attribute::" msgstr "" #: ../../library/ctypes.rst:486 @@ -979,10 +980,10 @@ msgstr "" #: ../../library/ctypes.rst:494 msgid "" -">>> print(libc.time(None)) \n" +">>> print(libc.time(None))\n" "1150640792" msgstr "" -">>> print(libc.time(None)) \n" +">>> print(libc.time(None))\n" "1150640792" #: ../../library/ctypes.rst:497 @@ -994,7 +995,7 @@ msgstr "" #: ../../library/ctypes.rst:500 msgid "" ">>> strchr = libc.strchr\n" -">>> strchr(b\"abcdef\", ord(\"d\")) \n" +">>> strchr(b\"abcdef\", ord(\"d\"))\n" "8059983\n" ">>> strchr.restype = c_char_p # c_char_p is a pointer to a string\n" ">>> strchr(b\"abcdef\", ord(\"d\"))\n" @@ -1004,7 +1005,7 @@ msgid "" ">>>" msgstr "" ">>> strchr = libc.strchr\n" -">>> strchr(b\"abcdef\", ord(\"d\")) \n" +">>> strchr(b\"abcdef\", ord(\"d\"))\n" "8059983\n" ">>> strchr.restype = c_char_p # c_char_p 一個字串的指標\n" ">>> strchr(b\"abcdef\", ord(\"d\"))\n" @@ -1062,34 +1063,34 @@ msgstr "" #: ../../library/ctypes.rst:535 msgid "" -">>> GetModuleHandle = windll.kernel32.GetModuleHandleA \n" +">>> GetModuleHandle = windll.kernel32.GetModuleHandleA\n" ">>> def ValidHandle(value):\n" "... if value == 0:\n" "... raise WinError()\n" "... return value\n" "...\n" ">>>\n" -">>> GetModuleHandle.restype = ValidHandle \n" -">>> GetModuleHandle(None) \n" +">>> GetModuleHandle.restype = ValidHandle\n" +">>> GetModuleHandle(None)\n" "486539264\n" -">>> GetModuleHandle(\"something silly\") \n" +">>> GetModuleHandle(\"something silly\")\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"\", line 3, in ValidHandle\n" "OSError: [Errno 126] The specified module could not be found.\n" ">>>" msgstr "" -">>> GetModuleHandle = windll.kernel32.GetModuleHandleA \n" +">>> GetModuleHandle = windll.kernel32.GetModuleHandleA\n" ">>> def ValidHandle(value):\n" "... if value == 0:\n" "... raise WinError()\n" "... return value\n" "...\n" ">>>\n" -">>> GetModuleHandle.restype = ValidHandle \n" -">>> GetModuleHandle(None) \n" +">>> GetModuleHandle.restype = ValidHandle\n" +">>> GetModuleHandle(None)\n" "486539264\n" -">>> GetModuleHandle(\"something silly\") \n" +">>> GetModuleHandle(\"something silly\")\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"\", line 3, in ValidHandle\n" @@ -1126,10 +1127,10 @@ msgstr "" #: ../../library/ctypes.rst:571 msgid "" ":mod:`ctypes` exports the :func:`byref` function which is used to pass " -"parameters by reference. The same effect can be achieved with the :func:" -"`pointer` function, although :func:`pointer` does a lot more work since it " -"constructs a real pointer object, so it is faster to use :func:`byref` if " -"you don't need the pointer object in Python itself::" +"parameters by reference. The same effect can be achieved with " +"the :func:`pointer` function, although :func:`pointer` does a lot more work " +"since it constructs a real pointer object, so it is faster to " +"use :func:`byref` if you don't need the pointer object in Python itself::" msgstr "" #: ../../library/ctypes.rst:577 @@ -1164,11 +1165,11 @@ msgstr "" #: ../../library/ctypes.rst:595 msgid "" -"Structures and unions must derive from the :class:`Structure` and :class:" -"`Union` base classes which are defined in the :mod:`ctypes` module. Each " -"subclass must define a :attr:`~Structure._fields_` attribute. :attr:`!" -"_fields_` must be a list of *2-tuples*, containing a *field name* and a " -"*field type*." +"Structures and unions must derive from the :class:`Structure` " +"and :class:`Union` base classes which are defined in the :mod:`ctypes` " +"module. Each subclass must define a :attr:`~Structure._fields_` " +"attribute. :attr:`!_fields_` must be a list of *2-tuples*, containing a " +"*field name* and a *field type*." msgstr "" #: ../../library/ctypes.rst:600 @@ -1305,23 +1306,23 @@ msgstr "" #: ../../library/ctypes.rst:667 msgid "" "By default, Structure and Union fields are aligned in the same way the C " -"compiler does it. It is possible to override this behavior by specifying a :" -"attr:`~Structure._pack_` class attribute in the subclass definition. This " +"compiler does it. It is possible to override this behavior by specifying " +"a :attr:`~Structure._pack_` class attribute in the subclass definition. This " "must be set to a positive integer and specifies the maximum alignment for " "the fields. This is what ``#pragma pack(n)`` also does in MSVC. It is also " "possible to set a minimum alignment for how the subclass itself is packed in " "the same way ``#pragma align(n)`` works in MSVC. This can be achieved by " -"specifying a ::attr:`~Structure._align_` class attribute in the subclass " +"specifying a :attr:`~Structure._align_` class attribute in the subclass " "definition." msgstr "" #: ../../library/ctypes.rst:677 msgid "" ":mod:`ctypes` uses the native byte order for Structures and Unions. To " -"build structures with non-native byte order, you can use one of the :class:" -"`BigEndianStructure`, :class:`LittleEndianStructure`, :class:" -"`BigEndianUnion`, and :class:`LittleEndianUnion` base classes. These " -"classes cannot contain pointer fields." +"build structures with non-native byte order, you can use one of " +"the :class:`BigEndianStructure`, :class:`LittleEndianStructure`, :class:`BigEndianUnion`, " +"and :class:`LittleEndianUnion` base classes. These classes cannot contain " +"pointer fields." msgstr "" #: ../../library/ctypes.rst:687 @@ -1460,8 +1461,8 @@ msgstr "" #: ../../library/ctypes.rst:759 msgid "" -"Pointer instances are created by calling the :func:`pointer` function on a :" -"mod:`ctypes` type::" +"Pointer instances are created by calling the :func:`pointer` function on " +"a :mod:`ctypes` type::" msgstr "" #: ../../library/ctypes.rst:762 @@ -1846,8 +1847,8 @@ msgstr "" #: ../../library/ctypes.rst:958 msgid "" "because the new ``class cell`` is not available in the class statement " -"itself. In :mod:`ctypes`, we can define the ``cell`` class and set the :attr:" -"`~Structure._fields_` attribute later, after the class statement::" +"itself. In :mod:`ctypes`, we can define the ``cell`` class and set " +"the :attr:`~Structure._fields_` attribute later, after the class statement::" msgstr "" #: ../../library/ctypes.rst:962 @@ -2009,7 +2010,7 @@ msgstr "結果為: ::" #: ../../library/ctypes.rst:1043 msgid "" -">>> qsort(ia, len(ia), sizeof(c_int), cmp_func) \n" +">>> qsort(ia, len(ia), sizeof(c_int), cmp_func)\n" "py_cmp_func 5 1\n" "py_cmp_func 33 99\n" "py_cmp_func 7 33\n" @@ -2017,7 +2018,7 @@ msgid "" "py_cmp_func 1 7\n" ">>>" msgstr "" -">>> qsort(ia, len(ia), sizeof(c_int), cmp_func) \n" +">>> qsort(ia, len(ia), sizeof(c_int), cmp_func)\n" "py_cmp_func 5 1\n" "py_cmp_func 33 99\n" "py_cmp_func 7 33\n" @@ -2036,7 +2037,7 @@ msgid "" "... return a[0] - b[0]\n" "...\n" ">>>\n" -">>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func)) \n" +">>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func))\n" "py_cmp_func 5 1\n" "py_cmp_func 33 99\n" "py_cmp_func 7 33\n" @@ -2049,7 +2050,7 @@ msgstr "" "... return a[0] - b[0]\n" "...\n" ">>>\n" -">>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func)) \n" +">>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func))\n" "py_cmp_func 5 1\n" "py_cmp_func 33 99\n" "py_cmp_func 7 33\n" @@ -2606,13 +2607,14 @@ msgstr "" #: ../../library/ctypes.rst:1376 msgid "" "On Windows creating a :class:`CDLL` instance may fail even if the DLL name " -"exists. When a dependent DLL of the loaded DLL is not found, a :exc:" -"`OSError` error is raised with the message *\"[WinError 126] The specified " -"module could not be found\".* This error message does not contain the name " -"of the missing DLL because the Windows API does not return this information " -"making this error hard to diagnose. To resolve this error and determine " -"which DLL is not found, you need to find the list of dependent DLLs and " -"determine which one is not found using Windows debugging and tracing tools." +"exists. When a dependent DLL of the loaded DLL is not found, " +"a :exc:`OSError` error is raised with the message *\"[WinError 126] The " +"specified module could not be found\".* This error message does not contain " +"the name of the missing DLL because the Windows API does not return this " +"information making this error hard to diagnose. To resolve this error and " +"determine which DLL is not found, you need to find the list of dependent " +"DLLs and determine which one is not found using Windows debugging and " +"tracing tools." msgstr "" #: ../../library/ctypes.rst:1388 ../../library/ctypes.rst:1413 @@ -2648,8 +2650,8 @@ msgstr "" #: ../../library/ctypes.rst:1407 msgid "" -":exc:`WindowsError` used to be raised, which is now an alias of :exc:" -"`OSError`." +":exc:`WindowsError` used to be raised, which is now an alias " +"of :exc:`OSError`." msgstr "" #: ../../library/ctypes.rst:1418 @@ -2698,11 +2700,12 @@ msgstr "" #: ../../library/ctypes.rst:1458 msgid "" "The *use_errno* parameter, when set to true, enables a ctypes mechanism that " -"allows accessing the system :data:`errno` error number in a safe way. :mod:" -"`ctypes` maintains a thread-local copy of the system's :data:`errno` " -"variable; if you call foreign functions created with ``use_errno=True`` then " -"the :data:`errno` value before the function call is swapped with the ctypes " -"private copy, the same happens immediately after the function call." +"allows accessing the system :data:`errno` error number in a safe " +"way. :mod:`ctypes` maintains a thread-local copy of the " +"system's :data:`errno` variable; if you call foreign functions created with " +"``use_errno=True`` then the :data:`errno` value before the function call is " +"swapped with the ctypes private copy, the same happens immediately after the " +"function call." msgstr "" #: ../../library/ctypes.rst:1465 @@ -2715,10 +2718,11 @@ msgstr "" #: ../../library/ctypes.rst:1469 msgid "" "The *use_last_error* parameter, when set to true, enables the same mechanism " -"for the Windows error code which is managed by the :func:`GetLastError` and :" -"func:`!SetLastError` Windows API functions; :func:`ctypes.get_last_error` " -"and :func:`ctypes.set_last_error` are used to request and change the ctypes " -"private copy of the windows error code." +"for the Windows error code which is managed by the :func:`GetLastError` " +"and :func:`!SetLastError` Windows API " +"functions; :func:`ctypes.get_last_error` and :func:`ctypes.set_last_error` " +"are used to request and change the ctypes private copy of the windows error " +"code." msgstr "" #: ../../library/ctypes.rst:1475 @@ -2802,8 +2806,8 @@ msgstr "" #: ../../library/ctypes.rst:1540 msgid "" -"Class which loads shared libraries. *dlltype* should be one of the :class:" -"`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." +"Class which loads shared libraries. *dlltype* should be one of " +"the :class:`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." msgstr "" #: ../../library/ctypes.rst:1543 @@ -2849,9 +2853,9 @@ msgstr "" #: ../../library/ctypes.rst:1589 msgid "" "An instance of :class:`PyDLL` that exposes Python C API functions as " -"attributes. Note that all these functions are assumed to return C :c:expr:" -"`int`, which is of course not always the truth, so you have to assign the " -"correct :attr:`!restype` attribute to use these functions." +"attributes. Note that all these functions are assumed to return " +"C :c:expr:`int`, which is of course not always the truth, so you have to " +"assign the correct :attr:`!restype` attribute to use these functions." msgstr "" #: ../../library/ctypes.rst:1594 ../../library/ctypes.rst:1596 @@ -2863,9 +2867,9 @@ msgstr "" #: ../../library/ctypes.rst:1600 ../../library/ctypes.rst:1602 msgid "" -"Accessing a function on a loaded library raises an auditing event ``ctypes." -"dlsym`` with arguments ``library`` (the library object) and ``name`` (the " -"symbol's name as a string or integer)." +"Accessing a function on a loaded library raises an auditing event " +"``ctypes.dlsym`` with arguments ``library`` (the library object) and " +"``name`` (the symbol's name as a string or integer)." msgstr "" #: ../../library/ctypes.rst:1606 ../../library/ctypes.rst:1608 @@ -2947,12 +2951,12 @@ msgstr "" #: ../../library/ctypes.rst:1664 msgid "" -"When a foreign function is called, each actual argument is passed to the :" -"meth:`~_CData.from_param` class method of the items in the :attr:`argtypes` " -"tuple, this method allows adapting the actual argument to an object that the " -"foreign function accepts. For example, a :class:`c_char_p` item in the :" -"attr:`argtypes` tuple will convert a string passed as argument into a bytes " -"object using ctypes conversion rules." +"When a foreign function is called, each actual argument is passed to " +"the :meth:`~_CData.from_param` class method of the items in " +"the :attr:`argtypes` tuple, this method allows adapting the actual argument " +"to an object that the foreign function accepts. For example, " +"a :class:`c_char_p` item in the :attr:`argtypes` tuple will convert a string " +"passed as argument into a bytes object using ctypes conversion rules." msgstr "" #: ../../library/ctypes.rst:1671 @@ -3004,9 +3008,9 @@ msgstr "" msgid "" "On Windows, when a foreign function call raises a system exception (for " "example, due to an access violation), it will be captured and replaced with " -"a suitable Python exception. Further, an auditing event ``ctypes." -"set_exception`` with argument ``code`` will be raised, allowing an audit " -"hook to replace the exception with its own." +"a suitable Python exception. Further, an auditing event " +"``ctypes.set_exception`` with argument ``code`` will be raised, allowing an " +"audit hook to replace the exception with its own." msgstr "" #: ../../library/ctypes.rst:1715 ../../library/ctypes.rst:1717 @@ -3035,9 +3039,10 @@ msgstr "" msgid "" "The returned function prototype creates functions that use the standard C " "calling convention. The function will release the GIL during the call. If " -"*use_errno* is set to true, the ctypes private copy of the system :data:" -"`errno` variable is exchanged with the real :data:`errno` value before and " -"after the call; *use_last_error* does the same for the Windows error code." +"*use_errno* is set to true, the ctypes private copy of the " +"system :data:`errno` variable is exchanged with the real :data:`errno` value " +"before and after the call; *use_last_error* does the same for the Windows " +"error code." msgstr "" #: ../../library/ctypes.rst:1746 @@ -3101,8 +3106,8 @@ msgstr "" #: ../../library/ctypes.rst:1802 msgid "" -"*paramflags* must be a tuple of the same length as :attr:`~_CFuncPtr." -"argtypes`." +"*paramflags* must be a tuple of the same length " +"as :attr:`~_CFuncPtr.argtypes`." msgstr "" #: ../../library/ctypes.rst:1804 @@ -3325,8 +3330,8 @@ msgid "" "Raises an :ref:`auditing event ` ``ctypes.addressof`` with " "argument ``obj``." msgstr "" -"引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` ``ctypes." -"addressof``。" +"引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` " +"``ctypes.addressof``。" #: ../../library/ctypes.rst:1917 msgid "" @@ -3473,8 +3478,8 @@ msgstr "" #: ../../library/ctypes.rst:2039 msgid "" -"Returns the current value of the ctypes-private copy of the system :data:" -"`errno` variable in the calling thread." +"Returns the current value of the ctypes-private copy of the " +"system :data:`errno` variable in the calling thread." msgstr "" #: ../../library/ctypes.rst:2042 @@ -3549,8 +3554,8 @@ msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_errno`` with " "argument ``errno``." msgstr "" -"引發一個附帶引數 ``errno`` 的\\ :ref:`稽核事件 ` ``ctypes." -"set_errno``。" +"引發一個附帶引數 ``errno`` 的\\ :ref:`稽核事件 ` " +"``ctypes.set_errno``。" #: ../../library/ctypes.rst:2102 msgid "" @@ -3564,8 +3569,8 @@ msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with " "argument ``error``." msgstr "" -"引發一個附帶引數 ``error`` 的\\ :ref:`稽核事件 ` ``ctypes." -"set_last_error``。" +"引發一個附帶引數 ``error`` 的\\ :ref:`稽核事件 ` " +"``ctypes.set_last_error``。" #: ../../library/ctypes.rst:2113 msgid "" @@ -3584,15 +3589,16 @@ msgid "" "Raises an :ref:`auditing event ` ``ctypes.string_at`` with " "arguments ``ptr``, ``size``." msgstr "" -"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." -"string_at``。" +"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` " +"``ctypes.string_at``。" #: ../../library/ctypes.rst:2128 msgid "" "This function is probably the worst-named thing in ctypes. It creates an " "instance of :exc:`OSError`. If *code* is not specified, ``GetLastError`` is " -"called to determine the error code. If *descr* is not specified, :func:" -"`FormatError` is called to get a textual description of the error." +"called to determine the error code. If *descr* is not " +"specified, :func:`FormatError` is called to get a textual description of the " +"error." msgstr "" #: ../../library/ctypes.rst:2136 @@ -3613,8 +3619,8 @@ msgid "" "Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with " "arguments ``ptr``, ``size``." msgstr "" -"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." -"wstring_at``。" +"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` " +"``ctypes.wstring_at``。" #: ../../library/ctypes.rst:2154 msgid "Data types" @@ -3624,9 +3630,9 @@ msgstr "" msgid "" "This non-public class is the common base class of all ctypes data types. " "Among other things, all ctypes type instances contain a memory block that " -"hold C compatible data; the address of the memory block is returned by the :" -"func:`addressof` helper function. Another instance variable is exposed as :" -"attr:`_objects`; this contains other Python objects that need to be kept " +"hold C compatible data; the address of the memory block is returned by " +"the :func:`addressof` helper function. Another instance variable is exposed " +"as :attr:`_objects`; this contains other Python objects that need to be kept " "alive in case the memory block contains pointers." msgstr "" @@ -3641,8 +3647,8 @@ msgid "" "This method returns a ctypes instance that shares the buffer of the *source* " "object. The *source* object must support the writeable buffer interface. " "The optional *offset* parameter specifies an offset into the source buffer " -"in bytes; the default is zero. If the source buffer is not large enough a :" -"exc:`ValueError` is raised." +"in bytes; the default is zero. If the source buffer is not large enough " +"a :exc:`ValueError` is raised." msgstr "" #: ../../library/ctypes.rst:2177 ../../library/ctypes.rst:2187 @@ -3669,8 +3675,9 @@ msgstr "" #: ../../library/ctypes.rst:2194 ../../library/ctypes.rst:2196 msgid "" -"This method, and others that indirectly call this method, raises an :ref:" -"`auditing event ` ``ctypes.cdata`` with argument ``address``." +"This method, and others that indirectly call this method, raises " +"an :ref:`auditing event ` ``ctypes.cdata`` with argument " +"``address``." msgstr "" #: ../../library/ctypes.rst:2202 @@ -3702,9 +3709,9 @@ msgstr "" #: ../../library/ctypes.rst:2221 msgid "" "Sometimes ctypes data instances do not own the memory block they contain, " -"instead they share part of the memory block of a base object. The :attr:" -"`_b_base_` read-only member is the root ctypes object that owns the memory " -"block." +"instead they share part of the memory block of a base object. " +"The :attr:`_b_base_` read-only member is the root ctypes object that owns " +"the memory block." msgstr "" #: ../../library/ctypes.rst:2228 @@ -3725,8 +3732,8 @@ msgstr "" msgid "" "This non-public class is the base class of all fundamental ctypes data " "types. It is mentioned here because it contains the common attributes of the " -"fundamental ctypes data types. :class:`_SimpleCData` is a subclass of :" -"class:`_CData`, so it inherits their methods and attributes. ctypes data " +"fundamental ctypes data types. :class:`_SimpleCData` is a subclass " +"of :class:`_CData`, so it inherits their methods and attributes. ctypes data " "types that are not and do not contain pointers can now be pickled." msgstr "" @@ -3822,8 +3829,8 @@ msgstr "" #: ../../library/ctypes.rst:2331 msgid "" -"Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias for :" -"class:`c_byte`." +"Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias " +"for :class:`c_byte`." msgstr "" #: ../../library/ctypes.rst:2337 @@ -3972,9 +3979,9 @@ msgstr "" #: ../../library/ctypes.rst:2486 msgid "" "The :mod:`!ctypes.wintypes` module provides quite some other Windows " -"specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, or :c:" -"type:`!DWORD`. Some useful structures like :c:type:`!MSG` or :c:type:`!RECT` " -"are also defined." +"specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, " +"or :c:type:`!DWORD`. Some useful structures like :c:type:`!MSG` or :c:type:`!" +"RECT` are also defined." msgstr "" #: ../../library/ctypes.rst:2494 @@ -4014,9 +4021,9 @@ msgstr "" #: ../../library/ctypes.rst:2531 msgid "" "Concrete structure and union types must be created by subclassing one of " -"these types, and at least define a :attr:`_fields_` class variable. :mod:" -"`ctypes` will create :term:`descriptor`\\s which allow reading and writing " -"the fields by direct attribute accesses. These are the" +"these types, and at least define a :attr:`_fields_` class " +"variable. :mod:`ctypes` will create :term:`descriptor`\\s which allow " +"reading and writing the fields by direct attribute accesses. These are the" msgstr "" #: ../../library/ctypes.rst:2539 @@ -4078,9 +4085,9 @@ msgstr "" #: ../../library/ctypes.rst:2572 msgid "" "An optional small integer that allows overriding the alignment of structure " -"fields in the instance. :attr:`_pack_` must already be defined when :attr:" -"`_fields_` is assigned, otherwise it will have no effect. Setting this " -"attribute to 0 is the same as not setting it at all." +"fields in the instance. :attr:`_pack_` must already be defined " +"when :attr:`_fields_` is assigned, otherwise it will have no effect. Setting " +"this attribute to 0 is the same as not setting it at all." msgstr "" #: ../../library/ctypes.rst:2580 @@ -4092,16 +4099,16 @@ msgstr "" #: ../../library/ctypes.rst:2588 msgid "" -"An optional sequence that lists the names of unnamed (anonymous) fields. :" -"attr:`_anonymous_` must be already defined when :attr:`_fields_` is " +"An optional sequence that lists the names of unnamed (anonymous) " +"fields. :attr:`_anonymous_` must be already defined when :attr:`_fields_` is " "assigned, otherwise it will have no effect." msgstr "" #: ../../library/ctypes.rst:2592 msgid "" -"The fields listed in this variable must be structure or union type fields. :" -"mod:`ctypes` will create descriptors in the structure type that allows " -"accessing the nested fields directly, without the need to create the " +"The fields listed in this variable must be structure or union type " +"fields. :mod:`ctypes` will create descriptors in the structure type that " +"allows accessing the nested fields directly, without the need to create the " "structure or union field." msgstr "" @@ -4156,9 +4163,9 @@ msgstr "" #: ../../library/ctypes.rst:2622 msgid "" "It is possible to define sub-subclasses of structures, they inherit the " -"fields of the base class. If the subclass definition has a separate :attr:" -"`_fields_` variable, the fields specified in this are appended to the fields " -"of the base class." +"fields of the base class. If the subclass definition has a " +"separate :attr:`_fields_` variable, the fields specified in this are " +"appended to the fields of the base class." msgstr "" #: ../../library/ctypes.rst:2627 @@ -4181,9 +4188,9 @@ msgstr "" #: ../../library/ctypes.rst:2644 msgid "" -"The recommended way to create concrete array types is by multiplying any :" -"mod:`ctypes` data type with a non-negative integer. Alternatively, you can " -"subclass this type and define :attr:`_length_` and :attr:`_type_` class " +"The recommended way to create concrete array types is by multiplying " +"any :mod:`ctypes` data type with a non-negative integer. Alternatively, you " +"can subclass this type and define :attr:`_length_` and :attr:`_type_` class " "variables. Array elements can be read and written using standard subscript " "and slice accesses; for slice reads, the resulting object is *not* itself " "an :class:`Array`." @@ -4192,8 +4199,8 @@ msgstr "" #: ../../library/ctypes.rst:2654 msgid "" "A positive integer specifying the number of elements in the array. Out-of-" -"range subscripts result in an :exc:`IndexError`. Will be returned by :func:" -"`len`." +"range subscripts result in an :exc:`IndexError`. Will be returned " +"by :func:`len`." msgstr "" #: ../../library/ctypes.rst:2661 @@ -4208,8 +4215,8 @@ msgstr "" #: ../../library/ctypes.rst:2669 msgid "" -"Create an array. Equivalent to ``type * length``, where *type* is a :mod:" -"`ctypes` data type and *length* an integer." +"Create an array. Equivalent to ``type * length``, where *type* is " +"a :mod:`ctypes` data type and *length* an integer." msgstr "" #: ../../library/ctypes.rst:2673 @@ -4231,10 +4238,10 @@ msgstr "" #: ../../library/ctypes.rst:2685 msgid "" "If a pointer points to an array, its elements can be read and written using " -"standard subscript and slice accesses. Pointer objects have no size, so :" -"func:`len` will raise :exc:`TypeError`. Negative subscripts will read from " -"the memory *before* the pointer (as in C), and out-of-range subscripts will " -"probably crash with an access violation (if you're lucky)." +"standard subscript and slice accesses. Pointer objects have no size, " +"so :func:`len` will raise :exc:`TypeError`. Negative subscripts will read " +"from the memory *before* the pointer (as in C), and out-of-range subscripts " +"will probably crash with an access violation (if you're lucky)." msgstr "" #: ../../library/ctypes.rst:2695 diff --git a/library/dataclasses.po b/library/dataclasses.po index f6f692492e..e992340efe 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2023-02-11 15:02+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,7 +33,7 @@ msgid "" msgstr "" "該模組提供了一個裝飾器和函式,用於自動新增生成的\\ :term:`特殊方法 `,例如 :meth:`~object.__init__` 和 :meth:`~object.__repr__` 到使用者" -"定義的類。它最初在 :pep:`557` 中描述。" +"定義的類別。它最初在 :pep:`557` 中描述。" #: ../../library/dataclasses.rst:19 #, fuzzy @@ -79,8 +79,8 @@ msgid "" "Note that this method is automatically added to the class: it is not " "directly specified in the :class:`!InventoryItem` definition shown above." msgstr "" -"請注意,此方法會自動新增到類中:它不會在上面顯示的“InventoryItem”定義中直接指" -"定。" +"請注意,此方法會自動新增到類別中:它不會在上面顯示的 :class:`!InventoryItem` " +"定義中直接指定。" #: ../../library/dataclasses.rst:47 msgid "Module contents" @@ -103,8 +103,8 @@ msgid "" "`. With two exceptions described below, nothing in " "``@dataclass`` examines the type specified in the variable annotation." msgstr "" -"``@dataclass`` 裝飾器檢查類以找到 ``field``\\s。 ``field`` 被定義為具有 :" -"term:`type annotation ` 的類變數。除了下面描述的兩個例" +"``@dataclass`` 裝飾器檢查類別以找到 ``field``\\s。 ``field`` 被定義為具有 :" +"term:`type annotation ` 的類別變數。除了下面描述的兩個例" "外,``@dataclass`` 中沒有任何內容檢查變數註釋中指定的型別。" #: ../../library/dataclasses.rst:60 @@ -112,10 +112,9 @@ msgstr "" msgid "" "The order of the fields in all of the generated methods is the order in " "which they appear in the class definition." -msgstr "所有生成的方法中欄位的順序是它們在類定義中出現的順序。" +msgstr "所有生成的方法中欄位的順序是它們在類別定義中出現的順序。" #: ../../library/dataclasses.rst:63 -#, fuzzy msgid "" "The ``@dataclass`` decorator will add various \"dunder\" methods to the " "class, described below. If any of the added methods already exist in the " @@ -123,9 +122,9 @@ msgid "" "decorator returns the same class that it is called on; no new class is " "created." msgstr "" -"``@dataclass`` 裝飾器將向類新增各種“dunder”方法,如下所述。如果類中已存在任何" -"新增的方法,則行為取決於參數,如下所述。裝飾器回傳呼叫它的同一個類;沒有建立" -"新類。" +"如下所述,``@dataclass`` 裝飾器會向類別新增各種 \"dunder\" 方法。如果類別中已" +"存在任何新增的方法,則行為會取決於參數,如下方文件所述。裝飾器會回傳呼叫它的" +"同一個類別;不會建立新類別。" #: ../../library/dataclasses.rst:69 #, fuzzy @@ -153,6 +152,19 @@ msgid "" "class C:\n" " ..." msgstr "" +"@dataclass\n" +"class C:\n" +" ...\n" +"\n" +"@dataclass()\n" +"class C:\n" +" ...\n" +"\n" +"@dataclass(init=True, repr=True, eq=True, order=False, unsafe_hash=False, " +"frozen=False,\n" +" match_args=True, kw_only=False, slots=False, weakref_slot=False)\n" +"class C:\n" +" ..." #: ../../library/dataclasses.rst:87 msgid "The parameters to ``@dataclass`` are:" @@ -169,7 +181,7 @@ msgstr "*init*:如果為真(預設值),將生成一個 :meth:`~object.__ #, fuzzy msgid "" "If the class already defines :meth:`!__init__`, this parameter is ignored." -msgstr "如果該類已經定義了 :meth:`!__init__`,則忽略此參數。" +msgstr "如果該類別已經定義了 :meth:`!__init__`,則忽略此參數。" #: ../../library/dataclasses.rst:95 #, fuzzy @@ -182,15 +194,14 @@ msgid "" "quantity_on_hand=10)``." msgstr "" "*repr*:如果為真(預設值),將生成一個 :meth:`__repr__` 方法。生成的 repr 字" -"串將包含類名以及每個欄位的名稱和 repr,按照它們在類中定義的順序排列。不包括標" -"記為從 repr 中排除的欄位。例如:``InventoryItem(name='widget', " +"串將包含類別名稱以及每個欄位的名稱和 repr,按照它們在類別中定義的順序排列。不" +"包括標記為從 repr 中排除的欄位。例如:``InventoryItem(name='widget', " "unit_price=3.0, quantity_on_hand=10)``。" #: ../../library/dataclasses.rst:102 -#, fuzzy msgid "" "If the class already defines :meth:`!__repr__`, this parameter is ignored." -msgstr "如果該類已經定義了 :meth:`!__repr__`,則忽略此參數。" +msgstr "如果該類別已經定義了 :meth:`!__repr__`,則此參數會被忽略。" #: ../../library/dataclasses.rst:105 #, fuzzy @@ -201,13 +212,12 @@ msgid "" "type." msgstr "" "*eq*:如果為真(預設值),將生成一個 :meth:`~object.__eq__` 方法。此方法按順" -"序比較類,就好像它是其欄位的元組一樣。比較中的兩個實例必須屬於同一型別。" +"序比較類別,就好像它是其欄位的元組一樣。比較中的兩個實例必須屬於同一型別。" #: ../../library/dataclasses.rst:110 -#, fuzzy msgid "" "If the class already defines :meth:`!__eq__`, this parameter is ignored." -msgstr "如果該類已經定義了 :meth:`!__eq__`,則忽略此參數。" +msgstr "如果該類別已經定義了 :meth:`!__eq__`,則此參數會被忽略。" #: ../../library/dataclasses.rst:113 #, fuzzy @@ -220,16 +230,15 @@ msgid "" msgstr "" "*order*:如果為真(預設為 ``False``),:meth:`~object.__lt__`、:meth:" "`~object.__le__`、:meth:`~object.__gt__` 和 :meth:`~object.__ge__` 方法將是產" -"生。它們按順序比較類,就好像它是其欄位的元組一樣。比較中的兩個實例必須屬於同" -"一型別。如果 *order* 為真且 *eq* 為假,則會引發 :exc:`ValueError`。" +"生。它們按順序比較類別,就好像它是其欄位的元組一樣。比較中的兩個實例必須屬於" +"同一型別。如果 *order* 為真且 *eq* 為假,則會引發 :exc:`ValueError`。" #: ../../library/dataclasses.rst:120 -#, fuzzy msgid "" "If the class already defines any of :meth:`!__lt__`, :meth:`!__le__`, :meth:" "`!__gt__`, or :meth:`!__ge__`, then :exc:`TypeError` is raised." msgstr "" -"如果該類已經定義了 :meth:`!__lt__`、:meth:`!__le__`、:meth:`!__gt__` 或 :" +"如果該類別已經定義了 :meth:`!__lt__`、:meth:`!__le__`、:meth:`!__gt__` 或 :" "meth:`!__ge__` 中的任何一個,則引發 :exc:`TypeError`。" #: ../../library/dataclasses.rst:124 @@ -252,9 +261,9 @@ msgid "" "flags in the ``@dataclass`` decorator." msgstr "" ":meth:`!__hash__` 由內建的 :meth:`hash` 使用,當對像被新增到散列集合(如字典" -"和集合)時。擁有 :meth:`!__hash__` 意味著該類的實例是不可變的。可變性是一個複" -"雜的屬性,它取決於程序員的意圖 :meth:`!__eq__` 的存在和行為,以及 dataclass " -"裝飾器中的 *eq* 和 *frozen* 旗標的值." +"和集合)時。擁有 :meth:`!__hash__` 意味著該類別的實例是不可變的。可變性是一個" +"複雜的屬性,它取決於程序員的意圖 :meth:`!__eq__` 的存在和行為,以及 " +"dataclass 裝飾器中的 *eq* 和 *frozen* 旗標的值." #: ../../library/dataclasses.rst:134 #, fuzzy @@ -267,8 +276,8 @@ msgid "" msgstr "" "預設情況下,``@dataclass`` 不會隱式新增 :meth:`~object.__hash__` 方法,除非這" "樣做是安全的。它也不會新增或更改現有的明確定義的 :meth:`!__hash__` 方法。設定" -"類屬性 ``__hash__ = None`` 對 Python 具有特定含義,如 :meth:`!__hash__` 文檔" -"中所述。" +"類別屬性 ``__hash__ = None`` 對 Python 具有特定含義,如 :meth:`!__hash__` 文" +"檔中所述。" #: ../../library/dataclasses.rst:140 #, fuzzy @@ -283,8 +292,8 @@ msgstr "" "如果 :meth:`!__hash__` 沒有明確定義,或者如果它被設定為 ``None``,那麼 " "``@dataclass`` *可能* 新增一個隱式的 :meth:`!__hash__` 方法。雖然不推薦,但你" "可以強制 ``@dataclass`` 使用 ``unsafe_hash=True`` 建立一個 :meth:`!__hash__` " -"方法。如果你的類在邏輯上是不可變的但仍然可以改變,則可能是這種情況。這是一個" -"特殊的用例,應該仔細考慮。" +"方法。如果你的類別在邏輯上是不可變的但仍然可以改變,則可能是這種情況。這是一" +"個特殊的用例,應該仔細考慮。" #: ../../library/dataclasses.rst:147 #, fuzzy @@ -312,8 +321,8 @@ msgstr "" "如果 *eq* 和 *frozen* 都為真,預設情況下 ``@dataclass`` 會為你生成一個:meth:" "`!__hash__` 方法。如果 ``eq`` 為真且 ``frozen`` 為假,:meth:`!__hash__` 將被" "設定為 ``None``,將其標記為不可散列(它是不可散列的,因為它是可變的)。如果 " -"``eq`` 為假,:meth:`!__hash__` 將保持不變,這意味著將使用超類的 :meth:`!" -"__hash__` 方法(如果超類是 :class:`object`,這意味著它將回退到基於 id 的散" +"``eq`` 為假,:meth:`!__hash__` 將保持不變,這意味著將使用超類別的 :meth:`!" +"__hash__` 方法(如果超類別是 :class:`object`,這意味著它將回退到基於 id 的散" "列)。" #: ../../library/dataclasses.rst:160 @@ -326,21 +335,22 @@ msgid "" msgstr "" "*frozen*:如果為真(預設為 ``False``),分配給欄位將產生例外。這模擬了只讀的" "凍結實例。如果 :meth:`~object.__setattr__` 或 :meth:`~object.__delattr__` 在" -"類中定義,則 :exc:`TypeError` 被引發。請參閱下面的討論。" +"類別中定義,則 :exc:`TypeError` 被引發。請參閱下面的討論。" #: ../../library/dataclasses.rst:165 #, fuzzy msgid "" "*match_args*: If true (the default is ``True``), the :attr:`~object." -"__match_args__` tuple will be created from the list of parameters to the " -"generated :meth:`~object.__init__` method (even if :meth:`!__init__` is not " -"generated, see above). If false, or if :attr:`!__match_args__` is already " -"defined in the class, then :attr:`!__match_args__` will not be generated." +"__match_args__` tuple will be created from the list of non keyword-only " +"parameters to the generated :meth:`~object.__init__` method (even if :meth:`!" +"__init__` is not generated, see above). If false, or if :attr:`!" +"__match_args__` is already defined in the class, then :attr:`!" +"__match_args__` will not be generated." msgstr "" "*match_args*:如果為真(預設為 ``True``),``__match_args__`` 元組將從參數列" "表建立到生成的 :meth:`~object.__init__` 方法(即使 :meth: `!__init__` 未生" -"成,見上文)。如果為 false,或者類中已經定義了 :attr:`!__match_args__`,則不" -"會生成 :attr:`!__match_args__`。" +"成,見上文)。如果為 false,或者類別中已經定義了 :attr:`!__match_args__`,則" +"不會生成 :attr:`!__match_args__`。" #: ../../library/dataclasses.rst:174 #, fuzzy @@ -349,9 +359,8 @@ msgid "" "marked as keyword-only. If a field is marked as keyword-only, then the only " "effect is that the :meth:`~object.__init__` parameter generated from a " "keyword-only field must be specified with a keyword when :meth:`!__init__` " -"is called. There is no effect on any other aspect of dataclasses. See the :" -"term:`parameter` glossary entry for details. Also see the :const:`KW_ONLY` " -"section." +"is called. See the :term:`parameter` glossary entry for details. Also see " +"the :const:`KW_ONLY` section." msgstr "" "``kw_only``:如果為 true(預設值為 ``False``),則所有欄位將被標記為僅限關鍵" "字。如果一個欄位被標記為僅限關鍵字,那麼唯一的影響是從僅限關鍵字欄位生成的 :" @@ -359,7 +368,11 @@ msgstr "" "類別的任何其他方面都沒有影響。有關詳細資訊,請參閱 :term:`parameter` 詞彙表條" "目。另請參閱 :const:`KW_ONLY` 部分。" -#: ../../library/dataclasses.rst:185 +#: ../../library/dataclasses.rst:182 +msgid "Keyword-only fields are not included in :attr:`!__match_args__`." +msgstr "" + +#: ../../library/dataclasses.rst:186 #, fuzzy msgid "" "*slots*: If true (the default is ``False``), :attr:`~object.__slots__` " @@ -368,10 +381,10 @@ msgid "" "exc:`TypeError` is raised." msgstr "" "``slots``:如果為 true(預設為 ``False``),將生成 :attr:`~object.__slots__` " -"屬性並回傳新類而不是原始類。如果 :attr:`!__slots__` 已經在類中定義,則 :exc:" -"`TypeError` 被引發。" +"屬性並回傳新類別而不是原始類別。如果 :attr:`!__slots__` 已經在類別中定義," +"則 :exc:`TypeError` 被引發。" -#: ../../library/dataclasses.rst:191 +#: ../../library/dataclasses.rst:192 #, fuzzy msgid "" "Calling no-arg :func:`super` in dataclasses using ``slots=True`` will result " @@ -380,10 +393,10 @@ msgid "" "valid workaround. See :gh:`90562` for full details." msgstr "" "``slots``:如果為 true(預設為 ``False``),將生成 :attr:`~object.__slots__` " -"屬性並回傳新類而不是原始類。如果 :attr:`!__slots__` 已經在類中定義,則 :exc:" -"`TypeError` 被引發。" +"屬性並回傳新類別而不是原始類別。如果 :attr:`!__slots__` 已經在類別中定義," +"則 :exc:`TypeError` 被引發。" -#: ../../library/dataclasses.rst:198 +#: ../../library/dataclasses.rst:199 msgid "" "Passing parameters to a base class :meth:`~object.__init_subclass__` when " "using ``slots=True`` will result in a :exc:`TypeError`. Either use " @@ -391,7 +404,7 @@ msgid "" "workaround. See :gh:`91126` for full details." msgstr "" -#: ../../library/dataclasses.rst:206 +#: ../../library/dataclasses.rst:207 #, fuzzy msgid "" "If a field name is already included in the :attr:`!__slots__` of a base " @@ -407,7 +420,7 @@ msgstr "" "夠確定繼承的插槽,基底類別 :attr:`!__slots__` 可以是任何可疊代的,但*不是*疊" "代器。" -#: ../../library/dataclasses.rst:216 +#: ../../library/dataclasses.rst:217 #, fuzzy msgid "" "*weakref_slot*: If true (the default is ``False``), add a slot named " @@ -419,14 +432,14 @@ msgstr "" "插槽,這是使實例可弱引用所必需的。在沒有指定 ``slots=True`` 的情況下指定 " "``weakref_slot=True`` 是錯誤的。" -#: ../../library/dataclasses.rst:224 +#: ../../library/dataclasses.rst:225 #, fuzzy msgid "" "``field``\\s may optionally specify a default value, using normal Python " "syntax::" msgstr "``field``\\s 可以選擇指定一個預設值,使用普通的 Python 語法: ::" -#: ../../library/dataclasses.rst:227 +#: ../../library/dataclasses.rst:228 msgid "" "@dataclass\n" "class C:\n" @@ -434,7 +447,7 @@ msgid "" " b: int = 0 # assign a default value for 'b'" msgstr "" -#: ../../library/dataclasses.rst:232 +#: ../../library/dataclasses.rst:233 #, fuzzy msgid "" "In this example, both :attr:`!a` and :attr:`!b` will be included in the " @@ -443,11 +456,11 @@ msgstr "" "在此示例中,:attr:`!a` 和 :attr:`!b` 都將包含在新增的 :meth:`~object." "__init__` 方法中,該方法將定義為: ::" -#: ../../library/dataclasses.rst:235 +#: ../../library/dataclasses.rst:236 msgid "def __init__(self, a: int, b: int = 0):" -msgstr "" +msgstr "def __init__(self, a: int, b: int = 0):" -#: ../../library/dataclasses.rst:237 +#: ../../library/dataclasses.rst:238 #, fuzzy msgid "" ":exc:`TypeError` will be raised if a field without a default value follows a " @@ -455,9 +468,9 @@ msgid "" "class, or as a result of class inheritance." msgstr "" ":exc:`TypeError` 如果沒有預設值的欄位跟在具有預設值的欄位之後,將引發。無論這" -"發生在單個類中還是作為類繼承的結果,都是如此。" +"發生在單個類別中還是作為類別繼承的結果,都是如此。" -#: ../../library/dataclasses.rst:243 +#: ../../library/dataclasses.rst:244 #, fuzzy msgid "" "For common and simple use cases, no other functionality is required. There " @@ -470,7 +483,7 @@ msgstr "" "位資訊。為了滿足這種對附加資訊的需求,你可以通過呼叫提供的 :func:`!field` 函" "式來替換預設欄位值。例如: ::" -#: ../../library/dataclasses.rst:249 +#: ../../library/dataclasses.rst:250 msgid "" "@dataclass\n" "class C:\n" @@ -479,8 +492,14 @@ msgid "" "c = C()\n" "c.mylist += [1, 2, 3]" msgstr "" +"@dataclass\n" +"class C:\n" +" mylist: list[int] = field(default_factory=list)\n" +"\n" +"c = C()\n" +"c.mylist += [1, 2, 3]" -#: ../../library/dataclasses.rst:256 +#: ../../library/dataclasses.rst:257 #, fuzzy msgid "" "As shown above, the :const:`MISSING` value is a sentinel object used to " @@ -489,14 +508,14 @@ msgid "" "meaning. No code should directly use the :const:`MISSING` value." msgstr "" "如上所示,:const:`MISSING` 值是一個哨兵物件,用於檢測某些參數是否由使用者提" -"供。使用此標記是因為“None”對於某些具有不同含義的參數是有效值。任何程式碼都不" -"應直接使用 :const:`MISSING` 值。" +"供。使用此標記是因為 ``None`` 對於某些具有不同含義的參數是有效值。任何程式碼" +"都不應直接使用 :const:`MISSING` 值。" -#: ../../library/dataclasses.rst:261 +#: ../../library/dataclasses.rst:262 msgid "The parameters to :func:`!field` are:" msgstr ":func:`!field` 的參數是:" -#: ../../library/dataclasses.rst:263 +#: ../../library/dataclasses.rst:264 #, fuzzy msgid "" "*default*: If provided, this will be the default value for this field. This " @@ -506,7 +525,7 @@ msgstr "" "*default*:如果提供,這將是該欄位的預設值。這是必需的,因為 :meth:`!field` 呼" "叫本身會替換預設值的正常位置。" -#: ../../library/dataclasses.rst:267 +#: ../../library/dataclasses.rst:268 #, fuzzy msgid "" "*default_factory*: If provided, it must be a zero-argument callable that " @@ -519,7 +538,7 @@ msgstr "" "時將被呼叫。除其他用途外,這可用於指定具有可變預設值的欄位,如下所述。同時指" "定 *default* 和 *default_factory* 是錯誤的。" -#: ../../library/dataclasses.rst:273 +#: ../../library/dataclasses.rst:274 #, fuzzy msgid "" "*init*: If true (the default), this field is included as a parameter to the " @@ -528,7 +547,7 @@ msgstr "" "*init*:如果為 true(預設值),則此欄位將作為生成的 :meth:`~object.__init__` " "方法的參數包含在內。" -#: ../../library/dataclasses.rst:276 +#: ../../library/dataclasses.rst:277 #, fuzzy msgid "" "*repr*: If true (the default), this field is included in the string returned " @@ -537,21 +556,23 @@ msgstr "" "*repr*:如果為真(預設值),則此欄位包含在生成的 :meth:`~object.__repr__` 方" "法回傳的字串中。" -#: ../../library/dataclasses.rst:279 +#: ../../library/dataclasses.rst:280 #, fuzzy msgid "" "*hash*: This can be a bool or ``None``. If true, this field is included in " -"the generated :meth:`~object.__hash__` method. If ``None`` (the default), " -"use the value of *compare*: this would normally be the expected behavior. A " -"field should be considered in the hash if it's used for comparisons. " -"Setting this value to anything other than ``None`` is discouraged." +"the generated :meth:`~object.__hash__` method. If false, this field is " +"excluded from the generated :meth:`~object.__hash__`. If ``None`` (the " +"default), use the value of *compare*: this would normally be the expected " +"behavior, since a field should be included in the hash if it's used for " +"comparisons. Setting this value to anything other than ``None`` is " +"discouraged." msgstr "" "*hash*:這可以是 bool 或 ``None``。如果為真,則此欄位包含在生成的 :meth:" -"`__hash__` 方法中。如果“無”(預設值),則使用“比較”的值:這通常是預期的行為。" -"如果一個欄位用於比較,則應在雜湊中考慮該欄位。不鼓勵將此值設定為“無”以外的任" -"何值。" +"`__hash__` 方法中。如果 ``None``\\ (預設值),則使用\\ *比較*\\ 的值:這通常" +"是預期的行為。如果一個欄位用於比較,則應在雜湊中考慮該欄位。不鼓勵將此值設定" +"為 ``None`` 以外的任何值。" -#: ../../library/dataclasses.rst:286 +#: ../../library/dataclasses.rst:288 #, fuzzy msgid "" "One possible reason to set ``hash=False`` but ``compare=True`` would be if a " @@ -564,7 +585,7 @@ msgstr "" "湊值的成本很高,則需要該欄位進行相等性測試,並且還有其他欄位有助於型別的雜湊" "值。即使一個欄位被排除在雜湊之外,它仍然會被用於比較。" -#: ../../library/dataclasses.rst:292 +#: ../../library/dataclasses.rst:294 #, fuzzy msgid "" "*compare*: If true (the default), this field is included in the generated " @@ -574,7 +595,7 @@ msgstr "" "*compare*:如果為真(預設值),則此欄位包含在生成的相等和比較方法中(:meth:" "`~object.__eq__`、:meth:`~object.__gt__` 等)。" -#: ../../library/dataclasses.rst:296 +#: ../../library/dataclasses.rst:298 #, fuzzy msgid "" "*metadata*: This can be a mapping or ``None``. ``None`` is treated as an " @@ -589,7 +610,7 @@ msgstr "" "不被資料類別使用,而是作為第三方擴充機制提供的。多個第三方可以各自擁有自己的" "密鑰,用作元資料中的命名空間。" -#: ../../library/dataclasses.rst:304 +#: ../../library/dataclasses.rst:306 #, fuzzy msgid "" "*kw_only*: If true, this field will be marked as keyword-only. This is used " @@ -599,6 +620,10 @@ msgstr "" "`~object.__init__` 方法的參數時使用。" #: ../../library/dataclasses.rst:310 +msgid "Keyword-only fields are also not included in :attr:`!__match_args__`." +msgstr "" + +#: ../../library/dataclasses.rst:314 #, fuzzy msgid "" "If the default value of a field is specified by a call to :func:`!field`, " @@ -614,7 +639,7 @@ msgstr "" "在 :func:`@dataclass ` 裝飾器運行後,類別屬性將全部包含欄位的預設" "值,就像預設值本身已指定一樣。例如,在: ::" -#: ../../library/dataclasses.rst:319 +#: ../../library/dataclasses.rst:323 msgid "" "@dataclass\n" "class C:\n" @@ -623,8 +648,14 @@ msgid "" " z: int = field(repr=False, default=10)\n" " t: int = 20" msgstr "" +"@dataclass\n" +"class C:\n" +" x: int\n" +" y: int = field(repr=False)\n" +" z: int = field(repr=False, default=10)\n" +" t: int = 20" -#: ../../library/dataclasses.rst:326 +#: ../../library/dataclasses.rst:330 #, fuzzy msgid "" "The class attribute :attr:`!C.z` will be ``10``, the class attribute :attr:`!" @@ -634,7 +665,7 @@ msgstr "" "類別屬性 :attr:`!C.z` 將為 ``10``,類別屬性 :attr:`!C.t` 將為 ``20``,類別屬" "性 :attr:`!C.x` 和 :attr:`!C.y` 將不會放。" -#: ../../library/dataclasses.rst:332 +#: ../../library/dataclasses.rst:336 #, fuzzy msgid "" ":class:`!Field` objects describe each defined field. These objects are " @@ -646,15 +677,15 @@ msgstr "" "`fields` 模組級方法回傳(見下文)。使用者不應該直接實例化 :class:`!Field` 物" "件。它記錄的屬性是:" -#: ../../library/dataclasses.rst:337 +#: ../../library/dataclasses.rst:341 msgid ":attr:`!name`: The name of the field." msgstr ":attr:`!name`:欄位的名稱。" -#: ../../library/dataclasses.rst:338 +#: ../../library/dataclasses.rst:342 msgid ":attr:`!type`: The type of the field." msgstr ":attr:`!type`:欄位的型別。" -#: ../../library/dataclasses.rst:339 +#: ../../library/dataclasses.rst:343 #, fuzzy msgid "" ":attr:`!default`, :attr:`!default_factory`, :attr:`!init`, :attr:`!repr`, :" @@ -665,14 +696,23 @@ msgstr "" "attr:`!hash`、:attr:`!compare`, :attr:`!metadata` 和 :attr:`!kw_only` 有與它" "們在 :func:`field` 函式中的含義和值相同。" -#: ../../library/dataclasses.rst:343 +#: ../../library/dataclasses.rst:347 #, fuzzy msgid "" "Other attributes may exist, but they are private and must not be inspected " "or relied on." msgstr "可能存在其他屬性,但它們是私有的,不得檢查或依賴。" -#: ../../library/dataclasses.rst:348 +#: ../../library/dataclasses.rst:352 +msgid "" +"``InitVar[T]`` type annotations describe variables that are :ref:`init-only " +"`. Fields annotated with :class:`!InitVar` " +"are considered pseudo-fields, and thus are neither returned by the :func:" +"`fields` function nor used in any way except adding them as parameters to :" +"meth:`~object.__init__` and an optional :meth:`__post_init__`." +msgstr "" + +#: ../../library/dataclasses.rst:361 #, fuzzy msgid "" "Returns a tuple of :class:`Field` objects that define the fields for this " @@ -684,7 +724,7 @@ msgstr "" "實例。如果未傳遞資料類別或其中一個實例,則引發 :exc:`TypeError`。不回傳 " "``ClassVar`` 或 ``InitVar`` 的偽欄位。" -#: ../../library/dataclasses.rst:355 +#: ../../library/dataclasses.rst:368 #, fuzzy msgid "" "Converts the dataclass *obj* to a dict (by using the factory function " @@ -696,12 +736,12 @@ msgstr "" "都被轉換為其欄位的字典,作為 ``name: value`` 對。資料類別、字典、列表和元組被" "遞迴到。其他物件使用 :func:`copy.deepcopy` 複製。" -#: ../../library/dataclasses.rst:361 +#: ../../library/dataclasses.rst:374 #, fuzzy msgid "Example of using :func:`!asdict` on nested dataclasses::" msgstr "在嵌套資料類別上使用 :func:`!asdict` 的範例: ::" -#: ../../library/dataclasses.rst:363 +#: ../../library/dataclasses.rst:376 msgid "" "@dataclass\n" "class Point:\n" @@ -718,23 +758,37 @@ msgid "" "c = C([Point(0, 0), Point(10, 4)])\n" "assert asdict(c) == {'mylist': [{'x': 0, 'y': 0}, {'x': 10, 'y': 4}]}" msgstr "" +"@dataclass\n" +"class Point:\n" +" x: int\n" +" y: int\n" +"\n" +"@dataclass\n" +"class C:\n" +" mylist: list[Point]\n" +"\n" +"p = Point(10, 20)\n" +"assert asdict(p) == {'x': 10, 'y': 20}\n" +"\n" +"c = C([Point(0, 0), Point(10, 4)])\n" +"assert asdict(c) == {'mylist': [{'x': 0, 'y': 0}, {'x': 10, 'y': 4}]}" -#: ../../library/dataclasses.rst:378 ../../library/dataclasses.rst:398 +#: ../../library/dataclasses.rst:391 ../../library/dataclasses.rst:411 #, fuzzy msgid "To create a shallow copy, the following workaround may be used::" msgstr "要建立淺複製,可以使用以下解決方法:" -#: ../../library/dataclasses.rst:380 +#: ../../library/dataclasses.rst:393 msgid "{field.name: getattr(obj, field.name) for field in fields(obj)}" msgstr "" -#: ../../library/dataclasses.rst:382 +#: ../../library/dataclasses.rst:395 #, fuzzy msgid "" ":func:`!asdict` raises :exc:`TypeError` if *obj* is not a dataclass instance." msgstr ":func:`!asdict` 如果 *obj* 不是資料類別實例,則引發 :exc:`TypeError`。" -#: ../../library/dataclasses.rst:387 +#: ../../library/dataclasses.rst:400 #, fuzzy msgid "" "Converts the dataclass *obj* to a tuple (by using the factory function " @@ -746,21 +800,23 @@ msgstr "" "都被轉換為其欄位值的元組。資料類別、字典、列表和元組被遞迴到。其他物件使用 :" "func:`copy.deepcopy` 複製。" -#: ../../library/dataclasses.rst:393 +#: ../../library/dataclasses.rst:406 msgid "Continuing from the previous example::" msgstr "從前面的例子繼續: ::" -#: ../../library/dataclasses.rst:395 +#: ../../library/dataclasses.rst:408 msgid "" "assert astuple(p) == (10, 20)\n" "assert astuple(c) == ([(0, 0), (10, 4)],)" msgstr "" +"assert astuple(p) == (10, 20)\n" +"assert astuple(c) == ([(0, 0), (10, 4)],)" -#: ../../library/dataclasses.rst:400 +#: ../../library/dataclasses.rst:413 msgid "tuple(getattr(obj, field.name) for field in dataclasses.fields(obj))" -msgstr "" +msgstr "tuple(getattr(obj, field.name) for field in dataclasses.fields(obj))" -#: ../../library/dataclasses.rst:402 +#: ../../library/dataclasses.rst:415 #, fuzzy msgid "" ":func:`!astuple` raises :exc:`TypeError` if *obj* is not a dataclass " @@ -768,7 +824,7 @@ msgid "" msgstr "" ":func:`!astuple` 如果 *obj* 不是資料類別實例,則引發 :exc:`TypeError`。" -#: ../../library/dataclasses.rst:407 +#: ../../library/dataclasses.rst:420 #, fuzzy msgid "" "Creates a new dataclass with name *cls_name*, fields as defined in *fields*, " @@ -788,13 +844,13 @@ msgstr "" "``kw_only`` 的值, ``slots`` 和 ``weakref_slot`` 與它們在 :func:`dataclass` 中" "的含義相同。" -#: ../../library/dataclasses.rst:417 +#: ../../library/dataclasses.rst:430 msgid "" "If *module* is defined, the :attr:`!__module__` attribute of the dataclass " "is set to that value. By default, it is set to the module name of the caller." msgstr "" -#: ../../library/dataclasses.rst:421 +#: ../../library/dataclasses.rst:434 #, fuzzy msgid "" "This function is not strictly required, because any Python mechanism for " @@ -802,11 +858,11 @@ msgid "" "`@dataclass ` function to convert that class to a dataclass. " "This function is provided as a convenience. For example::" msgstr "" -"這個函式不是嚴格要求的,因為任何使用 ``__annotations__`` 建立新類的 Python 機" -"制都可以應用 :func:`dataclass` 函式將該類轉換為資料類別。提供此功能是為了方" -"便。例如: ::" +"這個函式不是嚴格要求的,因為任何使用 ``__annotations__`` 建立新類別的 Python " +"機制都可以應用 :func:`dataclass` 函式將該類別轉換為資料類別。提供此功能是為了" +"方便。例如: ::" -#: ../../library/dataclasses.rst:427 +#: ../../library/dataclasses.rst:440 msgid "" "C = make_dataclass('C',\n" " [('x', int),\n" @@ -814,12 +870,17 @@ msgid "" " ('z', int, field(default=5))],\n" " namespace={'add_one': lambda self: self.x + 1})" msgstr "" +"C = make_dataclass('C',\n" +" [('x', int),\n" +" 'y',\n" +" ('z', int, field(default=5))],\n" +" namespace={'add_one': lambda self: self.x + 1})" -#: ../../library/dataclasses.rst:433 +#: ../../library/dataclasses.rst:446 msgid "Is equivalent to::" msgstr "相當於: ::" -#: ../../library/dataclasses.rst:435 +#: ../../library/dataclasses.rst:448 msgid "" "@dataclass\n" "class C:\n" @@ -831,7 +892,7 @@ msgid "" " return self.x + 1" msgstr "" -#: ../../library/dataclasses.rst:446 +#: ../../library/dataclasses.rst:459 #, fuzzy msgid "" "Creates a new object of the same type as *obj*, replacing fields with values " @@ -843,7 +904,7 @@ msgstr "" "``obj`` 不是資料類別,則引發 :exc:`TypeError`。如果 ``changes`` 中的值未指定" "欄位,則引發 :exc:`TypeError`。" -#: ../../library/dataclasses.rst:451 +#: ../../library/dataclasses.rst:464 #, fuzzy msgid "" "The newly returned object is created by calling the :meth:`~object.__init__` " @@ -853,7 +914,7 @@ msgstr "" "新回傳的對像是通過呼叫資料類別的 :meth:`~object.__init__` 方法建立的。這確" "保 :meth:`__post_init__`(如果存在)也被呼叫。" -#: ../../library/dataclasses.rst:455 +#: ../../library/dataclasses.rst:468 #, fuzzy msgid "" "Init-only variables without default values, if any exist, must be specified " @@ -863,7 +924,7 @@ msgstr "" "沒有預設值的僅初始化變數(如果存在)必須在呼叫 :func:`replace` 時指定,以便它" "們可以傳遞給 :meth:`__init__` 和 :meth:`__post_init__`。" -#: ../../library/dataclasses.rst:459 +#: ../../library/dataclasses.rst:472 #, fuzzy msgid "" "It is an error for *changes* to contain any fields that are defined as " @@ -872,7 +933,7 @@ msgstr "" "*changes* 包含任何定義為具有 ``init=False`` 的欄位是錯誤的。在這種情況下將引" "發 :exc:`ValueError`。" -#: ../../library/dataclasses.rst:463 +#: ../../library/dataclasses.rst:476 #, fuzzy msgid "" "Be forewarned about how ``init=False`` fields work during a call to :func:`!" @@ -885,17 +946,17 @@ msgid "" msgstr "" "預先警告 ``init=False`` 欄位在呼叫 :func:`!replace` 期間是如何工作的。它們不" "是從源物件複製的,而是在 :meth:`__post_init__` 中初始化的,如果它們被初始化的" -"話。預計 ``init=False`` 欄位將很少被明智地使用。如果使用它們,使用替代的類構" -"造函式可能是明智的,或者可能是處理實例複製的自定義:func:`!replace` (或類似命" -"名的)方法。" +"話。預計 ``init=False`` 欄位將很少被明智地使用。如果使用它們,使用替代的類別" +"建構函式可能是明智的,或者可能是處理實例複製的自定義:func:`!replace` (或類似" +"命名的)方法。" -#: ../../library/dataclasses.rst:472 +#: ../../library/dataclasses.rst:485 msgid "" "Dataclass instances are also supported by generic function :func:`copy." "replace`." msgstr "" -#: ../../library/dataclasses.rst:476 +#: ../../library/dataclasses.rst:489 #, fuzzy msgid "" "Return ``True`` if its parameter is a dataclass (including subclasses of a " @@ -903,28 +964,28 @@ msgid "" msgstr "" "如果它的參數是一個資料類別或一個實例,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/dataclasses.rst:479 +#: ../../library/dataclasses.rst:492 #, fuzzy msgid "" "If you need to know if a class is an instance of a dataclass (and not a " "dataclass itself), then add a further check for ``not isinstance(obj, " "type)``::" msgstr "" -"如果你需要知道一個類是否是資料類別的實例(而不是資料類別本身),那麼新增一個" -"進一步的檢查 ``not isinstance(obj, type)``: ::" +"如果你需要知道一個類別是否是資料類別的實例(而不是資料類別本身),那麼新增一" +"個進一步的檢查 ``not isinstance(obj, type)``: ::" -#: ../../library/dataclasses.rst:483 +#: ../../library/dataclasses.rst:496 msgid "" "def is_dataclass_instance(obj):\n" " return is_dataclass(obj) and not isinstance(obj, type)" msgstr "" -#: ../../library/dataclasses.rst:488 +#: ../../library/dataclasses.rst:501 #, fuzzy msgid "A sentinel value signifying a missing default or default_factory." msgstr "表示缺少 default 或 default_factory 的標記值。" -#: ../../library/dataclasses.rst:492 +#: ../../library/dataclasses.rst:505 #, fuzzy msgid "" "A sentinel value used as a type annotation. Any fields after a pseudo-field " @@ -938,16 +999,16 @@ msgstr "" "用作型別註釋的標記值。型別為 :const:`!KW_ONLY` 的偽欄位之後的任何欄位都被標記" "為僅關鍵字欄位。請注意,:const:`!KW_ONLY` 型別的偽欄位將被完全忽略。這包括此" "類欄位的名稱。按照慣例,名稱 ``_`` 用於 :const:`!KW_ONLY` 欄位。僅關鍵字欄位" -"表示 :meth:`~object.__init__` 參數,在實例化類時必須將其指定為關鍵字。" +"表示 :meth:`~object.__init__` 參數,在實例化類別時必須將其指定為關鍵字。" -#: ../../library/dataclasses.rst:501 +#: ../../library/dataclasses.rst:514 #, fuzzy msgid "" "In this example, the fields ``y`` and ``z`` will be marked as keyword-only " "fields::" msgstr "在此示例中,欄位 ``y`` 和 ``z`` 將被標記為僅關鍵字欄位: ::" -#: ../../library/dataclasses.rst:503 +#: ../../library/dataclasses.rst:516 msgid "" "@dataclass\n" "class Point:\n" @@ -958,15 +1019,23 @@ msgid "" "\n" "p = Point(0, y=1.5, z=2.0)" msgstr "" +"@dataclass\n" +"class Point:\n" +" x: float\n" +" _: KW_ONLY\n" +" y: float\n" +" z: float\n" +"\n" +"p = Point(0, y=1.5, z=2.0)" -#: ../../library/dataclasses.rst:512 +#: ../../library/dataclasses.rst:525 #, fuzzy msgid "" "In a single dataclass, it is an error to specify more than one field whose " "type is :const:`!KW_ONLY`." msgstr "在單個資料類別中,指定多個型別為 :const:`!KW_ONLY` 的欄位是錯誤的。" -#: ../../library/dataclasses.rst:519 +#: ../../library/dataclasses.rst:532 #, fuzzy msgid "" "Raised when an implicitly defined :meth:`~object.__setattr__` or :meth:" @@ -976,12 +1045,12 @@ msgstr "" "當在使用 frozen=True 定義的資料類別上呼叫隱式定義的 :meth:`__setattr__` 或 :" "meth:`__delattr__` 時引發。它是 :exc:`AttributeError` 的子類別。" -#: ../../library/dataclasses.rst:526 +#: ../../library/dataclasses.rst:539 #, fuzzy msgid "Post-init processing" msgstr "初始化後處理" -#: ../../library/dataclasses.rst:530 +#: ../../library/dataclasses.rst:543 #, fuzzy msgid "" "When defined on the class, it will be called by the generated :meth:`~object." @@ -992,19 +1061,19 @@ msgid "" "automatically be called." msgstr "" "生成的 :meth:`~object.__init__` 程式碼將呼叫一個名為 :meth:`!self." -"__post_init__` 的方法,如果 :meth:`!__post_init__` 是在類上定義的。它通常被稱" -"為 ``self.!__post_init__()``。但是,如果定義了任何 ``InitVar`` 欄位,它們也將" -"按照它們在類中定義的順序傳遞給 :meth:`!__post_init__` 。如果沒有生成 :meth:`!" -"__init__` 方法,那麼 :meth:`!__post_init__` 將不會被自動呼叫。" +"__post_init__` 的方法,如果 :meth:`!__post_init__` 是在類別上定義的。它通常被" +"稱為 ``self.!__post_init__()``。但是,如果定義了任何 ``InitVar`` 欄位,它們也" +"將按照它們在類別中定義的順序傳遞給 :meth:`!__post_init__` 。如果沒有生成 :" +"meth:`!__init__` 方法,那麼 :meth:`!__post_init__` 將不會被自動呼叫。" -#: ../../library/dataclasses.rst:537 +#: ../../library/dataclasses.rst:550 #, fuzzy msgid "" "Among other uses, this allows for initializing field values that depend on " "one or more other fields. For example::" msgstr "在其他用途中,這允許初始化依賴於一個或多個其他欄位的欄位值。例如: ::" -#: ../../library/dataclasses.rst:540 +#: ../../library/dataclasses.rst:553 msgid "" "@dataclass\n" "class C:\n" @@ -1015,8 +1084,16 @@ msgid "" " def __post_init__(self):\n" " self.c = self.a + self.b" msgstr "" +"@dataclass\n" +"class C:\n" +" a: float\n" +" b: float\n" +" c: float = field(init=False)\n" +"\n" +" def __post_init__(self):\n" +" self.c = self.a + self.b" -#: ../../library/dataclasses.rst:549 +#: ../../library/dataclasses.rst:562 #, fuzzy msgid "" "The :meth:`~object.__init__` method generated by :func:`@dataclass " @@ -1028,7 +1105,7 @@ msgstr "" "類別 :meth:`!__init__` 方法。如果基底類別有一個必須呼叫的 :meth:`!__init__` " "方法,通常在 :meth:`__post_init__` 方法中呼叫此方法: ::" -#: ../../library/dataclasses.rst:554 +#: ../../library/dataclasses.rst:567 msgid "" "class Rectangle:\n" " def __init__(self, height, width):\n" @@ -1042,18 +1119,29 @@ msgid "" " def __post_init__(self):\n" " super().__init__(self.side, self.side)" msgstr "" +"class Rectangle:\n" +" def __init__(self, height, width):\n" +" self.height = height\n" +" self.width = width\n" +"\n" +"@dataclass\n" +"class Square(Rectangle):\n" +" side: float\n" +"\n" +" def __post_init__(self):\n" +" super().__init__(self.side, self.side)" -#: ../../library/dataclasses.rst:566 +#: ../../library/dataclasses.rst:579 #, fuzzy msgid "" "Note, however, that in general the dataclass-generated :meth:`!__init__` " "methods don't need to be called, since the derived dataclass will take care " "of initializing all fields of any base class that is a dataclass itself." msgstr "" -"但是請注意,通常不需要呼叫資料類別生成的 :meth:`!__init__` 方法,因為派生資料" +"但是請注意,通常不需要呼叫資料類別生成的 :meth:`!__init__` 方法,因為衍生資料" "類別將負責初始化作為資料類別本身的任何基底類別的所有欄位。" -#: ../../library/dataclasses.rst:570 +#: ../../library/dataclasses.rst:583 #, fuzzy msgid "" "See the section below on init-only variables for ways to pass parameters to :" @@ -1063,11 +1151,11 @@ msgstr "" "請參閱下面有關僅初始化變數的部分,了解將參數傳遞給 :meth:`!__post_init__` 的" "方法。另請參閱有關 :func:`replace` 如何處理 ``init=False`` 欄位的警告。" -#: ../../library/dataclasses.rst:577 +#: ../../library/dataclasses.rst:590 msgid "Class variables" msgstr "類別變數" -#: ../../library/dataclasses.rst:579 +#: ../../library/dataclasses.rst:592 #, fuzzy msgid "" "One of the few places where :func:`@dataclass ` actually inspects " @@ -1079,23 +1167,23 @@ msgid "" "`fields` function." msgstr "" ":func:`@dataclass ` 實際檢查欄位型別的少數地方之一是確定欄位是否" -"是 :pep:`526` 中定義的類變數。它通過檢查欄位的型別是否為 :data:`typing." +"是 :pep:`526` 中定義的類別變數。它通過檢查欄位的型別是否為 :data:`typing." "ClassVar` 來做到這一點。如果一個欄位是一個 ``ClassVar``,它就被排除在考慮之" "外,並被資料類別機制忽略。模組級 :func:`fields` 函式不會回傳此類別 " "``ClassVar`` 偽欄位。" -#: ../../library/dataclasses.rst:590 +#: ../../library/dataclasses.rst:603 #, fuzzy msgid "Init-only variables" msgstr "僅初始化變數" -#: ../../library/dataclasses.rst:592 +#: ../../library/dataclasses.rst:605 #, fuzzy msgid "" "Another place where :func:`@dataclass ` inspects a type " "annotation is to determine if a field is an init-only variable. It does " -"this by seeing if the type of a field is of type ``dataclasses.InitVar``. " -"If a field is an ``InitVar``, it is considered a pseudo-field called an init-" +"this by seeing if the type of a field is of type :class:`InitVar`. If a " +"field is an :class:`InitVar`, it is considered a pseudo-field called an init-" "only field. As it is not a true field, it is not returned by the module-" "level :func:`fields` function. Init-only fields are added as parameters to " "the generated :meth:`~object.__init__` method, and are passed to the " @@ -1107,16 +1195,16 @@ msgstr "" "是一個 ``InitVar``,它被認為是一個偽欄位,稱為 init-only 欄位。由於它不是真正" "的欄位,因此它不會由模組級 fields 函式回傳。 Init-only 欄位作為參數新增到生成" "的 :meth:`~object.__init__` 方法,並傳遞給可選的 :meth:`__post_init__` 方法。" -"它們不被資料類使用。" +"它們不被資料類別使用。" -#: ../../library/dataclasses.rst:602 +#: ../../library/dataclasses.rst:615 #, fuzzy msgid "" "For example, suppose a field will be initialized from a database, if a value " "is not provided when creating the class::" -msgstr "例如,假設一個欄位將從資料庫中初始化,如果在建立類時沒有提供值: ::" +msgstr "例如,假設一個欄位將從資料庫中初始化,如果在建立類別時沒有提供值: ::" -#: ../../library/dataclasses.rst:605 +#: ../../library/dataclasses.rst:618 msgid "" "@dataclass\n" "class C:\n" @@ -1130,8 +1218,19 @@ msgid "" "\n" "c = C(10, database=my_database)" msgstr "" +"@dataclass\n" +"class C:\n" +" i: int\n" +" j: int | None = None\n" +" database: InitVar[DatabaseType | None] = None\n" +"\n" +" def __post_init__(self, database):\n" +" if self.j is None and database is not None:\n" +" self.j = database.lookup('j')\n" +"\n" +"c = C(10, database=my_database)" -#: ../../library/dataclasses.rst:617 +#: ../../library/dataclasses.rst:630 #, fuzzy msgid "" "In this case, :func:`fields` will return :class:`Field` objects for :attr:`!" @@ -1140,11 +1239,11 @@ msgstr "" "在這種情況下,:func:`fields` 將為 :attr:`!i` 和 :attr:`!j` 回傳 :class:" "`Field` 物件,但不會為 :attr:`!database` 回傳。" -#: ../../library/dataclasses.rst:623 +#: ../../library/dataclasses.rst:636 msgid "Frozen instances" msgstr "凍結實例" -#: ../../library/dataclasses.rst:625 +#: ../../library/dataclasses.rst:638 #, fuzzy msgid "" "It is not possible to create truly immutable Python objects. However, by " @@ -1155,10 +1254,10 @@ msgid "" msgstr "" "不可能建立真正不可變的 Python 物件。但是,通過將 ``frozen=True`` 傳遞給 :" "func:`@dataclass ` 裝飾器,你可以模擬不變性。在這種情況下,資料類" -"別將向類新增 :meth:`~object.__setattr__` 和 :meth:`~object.__delattr__` 方" +"別將向類別新增 :meth:`~object.__setattr__` 和 :meth:`~object.__delattr__` 方" "法。這些方法在呼叫時會引發 :exc:`FrozenInstanceError`。" -#: ../../library/dataclasses.rst:631 +#: ../../library/dataclasses.rst:644 #, fuzzy msgid "" "There is a tiny performance penalty when using ``frozen=True``: :meth:" @@ -1168,11 +1267,11 @@ msgstr "" "使用 ``frozen=True`` 時有一個微小的性能損失::meth:`~object.__init__` 不能使" "用簡單賦值來初始化欄位,必須使用 :meth:`!object.__setattr__`。" -#: ../../library/dataclasses.rst:640 +#: ../../library/dataclasses.rst:653 msgid "Inheritance" msgstr "繼承" -#: ../../library/dataclasses.rst:642 +#: ../../library/dataclasses.rst:655 #, fuzzy msgid "" "When the dataclass is being created by the :func:`@dataclass ` " @@ -1185,12 +1284,12 @@ msgid "" "order, derived classes override base classes. An example::" msgstr "" "當 :func:`@dataclass ` 裝飾器建立資料類別時,它會以反向 MRO(即" -"從 :class:`object` 開始)查看該類的所有基底類別,並且對於它找到的每個資料類" +"從 :class:`object` 開始)查看該類別的所有基底類別,並且對於它找到的每個資料類" "別,將該基底類別中的欄位新增到欄位的有序對映中。新增所有基底類別欄位後,它會" "將自己的欄位新增到有序對映中。所有生成的方法都將使用這種組合的、計算的有序欄" -"位對映。因為欄位是按插入順序排列的,所以派生類會覆蓋基底類別。一個例子: ::" +"位對映。因為欄位是按插入順序排列的,所以衍生類別會覆蓋基底類別。一個例子: ::" -#: ../../library/dataclasses.rst:652 +#: ../../library/dataclasses.rst:665 msgid "" "@dataclass\n" "class Base:\n" @@ -1202,8 +1301,17 @@ msgid "" " z: int = 10\n" " x: int = 15" msgstr "" +"@dataclass\n" +"class Base:\n" +" x: Any = 15.0\n" +" y: int = 0\n" +"\n" +"@dataclass\n" +"class C(Base):\n" +" z: int = 10\n" +" x: int = 15" -#: ../../library/dataclasses.rst:662 +#: ../../library/dataclasses.rst:675 #, fuzzy msgid "" "The final list of fields is, in order, :attr:`!x`, :attr:`!y`, :attr:`!z`. " @@ -1213,23 +1321,23 @@ msgstr "" "最終的欄位列表按順序為 :attr:`!x`、:attr:`!y`、:attr:`!z`。:attr:`!x` 的最終" "型別是 :class:`int`,如類別 :class:`!C` 中指定的那樣。" -#: ../../library/dataclasses.rst:665 +#: ../../library/dataclasses.rst:678 #, fuzzy msgid "" "The generated :meth:`~object.__init__` method for :class:`!C` will look " "like::" msgstr "為 :class:`!C` 生成的 :meth:`~object.__init__` 方法將如下所示: ::" -#: ../../library/dataclasses.rst:667 +#: ../../library/dataclasses.rst:680 msgid "def __init__(self, x: int = 15, y: int = 0, z: int = 10):" -msgstr "" +msgstr "def __init__(self, x: int = 15, y: int = 0, z: int = 10):" -#: ../../library/dataclasses.rst:670 +#: ../../library/dataclasses.rst:683 #, fuzzy msgid "Re-ordering of keyword-only parameters in :meth:`!__init__`" msgstr ":meth:`!__init__` 中僅關鍵字參數的重新排序" -#: ../../library/dataclasses.rst:672 +#: ../../library/dataclasses.rst:685 #, fuzzy msgid "" "After the parameters needed for :meth:`~object.__init__` are computed, any " @@ -1241,7 +1349,7 @@ msgstr "" "僅關鍵字)參數之後。這是如何在 Python 中實作僅關鍵字參數的要求:它們必須位於" "非僅關鍵字參數之後。" -#: ../../library/dataclasses.rst:678 +#: ../../library/dataclasses.rst:691 #, fuzzy msgid "" "In this example, :attr:`!Base.y`, :attr:`!Base.w`, and :attr:`!D.t` are " @@ -1251,7 +1359,7 @@ msgstr "" "在此示例中,:attr:`!Base.y`、:attr:`!Base.w` 和 :attr:`!D.t` 是僅限關鍵字的欄" "位,:attr:`!Base.x` 和 :attr:`!D.z` 是常規欄位: ::" -#: ../../library/dataclasses.rst:681 +#: ../../library/dataclasses.rst:694 msgid "" "@dataclass\n" "class Base:\n" @@ -1265,40 +1373,53 @@ msgid "" " z: int = 10\n" " t: int = field(kw_only=True, default=0)" msgstr "" +"@dataclass\n" +"class Base:\n" +" x: Any = 15.0\n" +" _: KW_ONLY\n" +" y: int = 0\n" +" w: int = 1\n" +"\n" +"@dataclass\n" +"class D(Base):\n" +" z: int = 10\n" +" t: int = field(kw_only=True, default=0)" -#: ../../library/dataclasses.rst:693 +#: ../../library/dataclasses.rst:706 #, fuzzy msgid "The generated :meth:`!__init__` method for :class:`!D` will look like::" msgstr "為 :class:`!D` 生成的 :meth:`!__init__` 方法將如下所示: ::" -#: ../../library/dataclasses.rst:695 +#: ../../library/dataclasses.rst:708 msgid "" "def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: " "int = 0):" msgstr "" +"def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: " +"int = 0):" -#: ../../library/dataclasses.rst:697 +#: ../../library/dataclasses.rst:710 #, fuzzy msgid "" "Note that the parameters have been re-ordered from how they appear in the " "list of fields: parameters derived from regular fields are followed by " "parameters derived from keyword-only fields." msgstr "" -"請注意,參數已根據它們在欄位列表中的顯示方式重新排序:從常規欄位派生的參數後" -"跟從僅關鍵字欄位派生的參數。" +"請注意,參數已根據它們在欄位列表中的顯示方式重新排序:從常規欄位衍生的參數後" +"跟從僅關鍵字欄位衍生的參數。" -#: ../../library/dataclasses.rst:701 +#: ../../library/dataclasses.rst:714 #, fuzzy msgid "" "The relative ordering of keyword-only parameters is maintained in the re-" "ordered :meth:`!__init__` parameter list." msgstr "僅關鍵字參數的相對順序在重新排序的 :meth:`!__init__` 參數列表中維護。" -#: ../../library/dataclasses.rst:706 +#: ../../library/dataclasses.rst:719 msgid "Default factory functions" msgstr "預設工廠函式" -#: ../../library/dataclasses.rst:708 +#: ../../library/dataclasses.rst:721 #, fuzzy msgid "" "If a :func:`field` specifies a *default_factory*, it is called with zero " @@ -1308,11 +1429,11 @@ msgstr "" "如果 :func:`field` 指定了 *default_factory*,當需要該欄位的預設值時,它會以零" "引數呼叫。例如,要建立列表的新實例,請使用: ::" -#: ../../library/dataclasses.rst:712 +#: ../../library/dataclasses.rst:725 msgid "mylist: list = field(default_factory=list)" -msgstr "" +msgstr "mylist: list = field(default_factory=list)" -#: ../../library/dataclasses.rst:714 +#: ../../library/dataclasses.rst:727 #, fuzzy msgid "" "If a field is excluded from :meth:`~object.__init__` (using ``init=False``) " @@ -1325,11 +1446,11 @@ msgstr "" "位還指定了 ``default_factory``,那麼預設工廠函式將始終從生成的 :meth:" "`__init__ 中呼叫`功能。發生這種情況是因為沒有其他方法可以為該欄位賦予初始值。" -#: ../../library/dataclasses.rst:721 +#: ../../library/dataclasses.rst:734 msgid "Mutable default values" msgstr "可變預設值" -#: ../../library/dataclasses.rst:723 +#: ../../library/dataclasses.rst:736 #, fuzzy msgid "" "Python stores default member variable values in class attributes. Consider " @@ -1337,7 +1458,7 @@ msgid "" msgstr "" "Python 將預設成員變數值存儲在類別屬性中。考慮這個例子,不使用資料類別: ::" -#: ../../library/dataclasses.rst:726 +#: ../../library/dataclasses.rst:739 msgid "" "class C:\n" " x = []\n" @@ -1351,8 +1472,19 @@ msgid "" "assert o1.x == [1, 2]\n" "assert o1.x is o2.x" msgstr "" +"class C:\n" +" x = []\n" +" def add(self, element):\n" +" self.x.append(element)\n" +"\n" +"o1 = C()\n" +"o2 = C()\n" +"o1.add(1)\n" +"o2.add(2)\n" +"assert o1.x == [1, 2]\n" +"assert o1.x is o2.x" -#: ../../library/dataclasses.rst:738 +#: ../../library/dataclasses.rst:751 #, fuzzy msgid "" "Note that the two instances of class :class:`!C` share the same class " @@ -1361,12 +1493,12 @@ msgstr "" "請注意,類別 :class:`!C` 的兩個實例共享同一個類別變數 :attr:`!x`,正如預期的" "那樣。" -#: ../../library/dataclasses.rst:741 +#: ../../library/dataclasses.rst:754 #, fuzzy msgid "Using dataclasses, *if* this code was valid::" msgstr "使用資料類別,*如果*此程式碼有效: ::" -#: ../../library/dataclasses.rst:743 +#: ../../library/dataclasses.rst:756 msgid "" "@dataclass\n" "class D:\n" @@ -1374,12 +1506,17 @@ msgid "" " def add(self, element):\n" " self.x.append(element)" msgstr "" +"@dataclass\n" +"class D:\n" +" x: list = [] # 這段程式碼會引發 ValueError\n" +" def add(self, element):\n" +" self.x.append(element)" -#: ../../library/dataclasses.rst:749 +#: ../../library/dataclasses.rst:762 msgid "it would generate code similar to::" msgstr "它會生成類似的程式碼: ::" -#: ../../library/dataclasses.rst:751 +#: ../../library/dataclasses.rst:764 msgid "" "class D:\n" " x = []\n" @@ -1390,8 +1527,16 @@ msgid "" "\n" "assert D().x is D().x" msgstr "" +"class D:\n" +" x = []\n" +" def __init__(self, x=x):\n" +" self.x = x\n" +" def add(self, element):\n" +" self.x.append(element)\n" +"\n" +"assert D().x is D().x" -#: ../../library/dataclasses.rst:760 +#: ../../library/dataclasses.rst:773 #, fuzzy msgid "" "This has the same issue as the original example using class :class:`!C`. " @@ -1405,20 +1550,20 @@ msgid "" "partial solution, but it does protect against many common errors." msgstr "" "這與使用類別 :class:`!C` 的原始示例存在相同的問題。也就是說,類別 :class:`!" -"D` 的兩個實例在建立類實例時沒有為 :attr:`!x` 指定值,它們將共享 :attr:`!x` 的" -"同一個副本。因為資料類別只是使用普通的 Python 類建立,所以它們也有這種行為。" -"資料類別沒有通用的方法來檢測這種情況。相反,如果 :func:`dataclass` 裝飾器檢測" -"到不可散列的預設參數,它將引發 :exc:`TypeError`。假設是如果一個值是不可散列" -"的,那麼它就是可變的。這是一個部分解決方案,但它確實可以防止許多常見錯誤。" +"D` 的兩個實例在建立類別實例時沒有為 :attr:`!x` 指定值,它們將共享 :attr:`!x` " +"的同一個副本。因為資料類別只是使用普通的 Python 類別建立,所以它們也有這種行" +"為。資料類別沒有通用的方法來檢測這種情況。相反,如果 :func:`dataclass` 裝飾器" +"檢測到不可散列的預設參數,它將引發 :exc:`TypeError`。假設是如果一個值是不可散" +"列的,那麼它就是可變的。這是一個部分解決方案,但它確實可以防止許多常見錯誤。" -#: ../../library/dataclasses.rst:771 +#: ../../library/dataclasses.rst:784 #, fuzzy msgid "" "Using default factory functions is a way to create new instances of mutable " "types as default values for fields::" msgstr "使用預設工廠函式是一種建立可變型別的新實例作為欄位預設值的方法: ::" -#: ../../library/dataclasses.rst:774 +#: ../../library/dataclasses.rst:787 msgid "" "@dataclass\n" "class D:\n" @@ -1426,8 +1571,13 @@ msgid "" "\n" "assert D().x is not D().x" msgstr "" +"@dataclass\n" +"class D:\n" +" x: list = field(default_factory=list)\n" +"\n" +"assert D().x is not D().x" -#: ../../library/dataclasses.rst:780 +#: ../../library/dataclasses.rst:793 #, fuzzy msgid "" "Instead of looking for and disallowing objects of type :class:`list`, :class:" @@ -1437,12 +1587,12 @@ msgstr "" "不再查找和禁止型別為 :class:`list`、:class:`dict` 或 :class:`set` 的物件,現" "在不允許使用不可散列的對像作為預設值。不可散列性用於近似可變性。" -#: ../../library/dataclasses.rst:787 +#: ../../library/dataclasses.rst:800 #, fuzzy msgid "Descriptor-typed fields" msgstr "描述器型別的欄位" -#: ../../library/dataclasses.rst:789 +#: ../../library/dataclasses.rst:802 #, fuzzy msgid "" "Fields that are assigned :ref:`descriptor objects ` as their " @@ -1450,7 +1600,7 @@ msgid "" msgstr "" "指定為\\ :ref:`描述器物件 `\\ 作為預設值的欄位具有以下特殊行為:" -#: ../../library/dataclasses.rst:792 +#: ../../library/dataclasses.rst:805 #, fuzzy msgid "" "The value for the field passed to the dataclass's :meth:`~object.__init__` " @@ -1460,7 +1610,7 @@ msgstr "" "傳遞給資料類別的 :meth:`~object.__init__` 方法的欄位值被傳遞給描述器的 :meth:" "`~object.__set__` 方法,而不是覆蓋描述器物件。" -#: ../../library/dataclasses.rst:796 +#: ../../library/dataclasses.rst:809 #, fuzzy msgid "" "Similarly, when getting or setting the field, the descriptor's :meth:" @@ -1470,7 +1620,7 @@ msgstr "" "同樣,在獲取或設定欄位時,將呼叫描述器的 :meth:`~object.__get__` 或 :meth:`!" "__set__` 方法,而不是回傳或覆蓋描述器物件。" -#: ../../library/dataclasses.rst:800 +#: ../../library/dataclasses.rst:813 #, fuzzy msgid "" "To determine whether a field contains a default value, :func:`@dataclass " @@ -1480,13 +1630,13 @@ msgid "" "default. On the other hand, if the descriptor raises :exc:`AttributeError` " "in this situation, no default value will be provided for the field." msgstr "" -"為了確定一個欄位是否包含預設值,:func:`@dataclass ` 將使用其類訪問" -"形式呼叫描述器的 :meth:`!__get__` 方法(即 ``descriptor.__get__(obj=None, " +"為了確定一個欄位是否包含預設值,:func:`@dataclass ` 將使用其類別訪" +"問形式呼叫描述器的 :meth:`!__get__` 方法(即 ``descriptor.__get__(obj=None, " "type=cls)``。如果在這種情況下,描述器回傳一個值,它將用作欄位的預設值。另一方" "面,如果描述器在這種情況下引發 :exc:`AttributeError`,則不會為該欄位提供預設" "值。" -#: ../../library/dataclasses.rst:810 +#: ../../library/dataclasses.rst:823 msgid "" "class IntConversionDescriptor:\n" " def __init__(self, *, default):\n" @@ -1514,8 +1664,33 @@ msgid "" "i.quantity_on_hand = 2.5 # calls __set__ with 2.5\n" "print(i.quantity_on_hand) # 2" msgstr "" +"class IntConversionDescriptor:\n" +" def __init__(self, *, default):\n" +" self._default = default\n" +"\n" +" def __set_name__(self, owner, name):\n" +" self._name = \"_\" + name\n" +"\n" +" def __get__(self, obj, type):\n" +" if obj is None:\n" +" return self._default\n" +"\n" +" return getattr(obj, self._name, self._default)\n" +"\n" +" def __set__(self, obj, value):\n" +" setattr(obj, self._name, int(value))\n" +"\n" +"@dataclass\n" +"class InventoryItem:\n" +" quantity_on_hand: IntConversionDescriptor = " +"IntConversionDescriptor(default=100)\n" +"\n" +"i = InventoryItem()\n" +"print(i.quantity_on_hand) # 100\n" +"i.quantity_on_hand = 2.5 # 以 2.5 呼叫 __set__\n" +"print(i.quantity_on_hand) # 2" -#: ../../library/dataclasses.rst:835 +#: ../../library/dataclasses.rst:848 #, fuzzy msgid "" "Note that if a field is annotated with a descriptor type, but is not " diff --git a/library/datetime.po b/library/datetime.po index d1b39481c8..1bec6171ca 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-04-09 00:15+0000\n" "PO-Revision-Date: 2023-08-07 10:20+0800\n" "Last-Translator: Griiid \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1078,8 +1078,8 @@ msgstr "" #: ../../library/datetime.rst:669 msgid "" -"Return a date with the same value, except for those parameters given new " -"values by whichever keyword arguments are specified." +"Return a new :class:`date` object with the same values, but with specified " +"parameters updated." msgstr "" #: ../../library/datetime.rst:672 ../../library/datetime.rst:1937 @@ -1100,8 +1100,8 @@ msgstr "" #: ../../library/datetime.rst:679 msgid "" -":class:`date` objects are also supported by generic function :func:`copy." -"replace`." +"The generic function :func:`copy.replace` also supports :class:`date` " +"objects." msgstr "" #: ../../library/datetime.rst:685 ../../library/datetime.rst:1405 @@ -1331,7 +1331,7 @@ msgid "" "\n" ">>> # Methods for to extracting 'components' under different calendars\n" ">>> t = d.timetuple()\n" -">>> for i in t: \n" +">>> for i in t:\n" "... print(i)\n" "2002 # year\n" "3 # month\n" @@ -1343,7 +1343,7 @@ msgid "" "70 # 70th day in the year\n" "-1\n" ">>> ic = d.isocalendar()\n" -">>> for i in ic: \n" +">>> for i in ic:\n" "... print(i)\n" "2002 # ISO year\n" "11 # ISO week number\n" @@ -1664,7 +1664,7 @@ msgid "" ">>> datetime.fromisoformat('2011-11-04 00:05:23.283+00:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, tzinfo=datetime.timezone." "utc)\n" -">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00') \n" +">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23,\n" " tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" msgstr "" @@ -1686,7 +1686,7 @@ msgstr "" ">>> datetime.fromisoformat('2011-11-04 00:05:23.283+00:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, tzinfo=datetime.timezone." "utc)\n" -">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00') \n" +">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23,\n" " tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" @@ -1745,7 +1745,7 @@ msgid "" ">>> date_string = \"02/29\"\n" ">>> when = datetime.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # " "Avoids leap year bug.\n" -">>> when.strftime(\"%B %d\") \n" +">>> when.strftime(\"%B %d\")\n" "'February 29'" msgstr "" @@ -1957,10 +1957,10 @@ msgstr "" #: ../../library/datetime.rst:1318 msgid "" -"Return a datetime with the same attributes, except for those attributes " -"given new values by whichever keyword arguments are specified. Note that " -"``tzinfo=None`` can be specified to create a naive datetime from an aware " -"datetime with no conversion of date and time data." +"Return a new :class:`datetime` object with the same attributes, but with " +"specified parameters updated. Note that ``tzinfo=None`` can be specified to " +"create a naive datetime from an aware datetime with no conversion of date " +"and time data." msgstr "" #: ../../library/datetime.rst:1323 @@ -2310,14 +2310,14 @@ msgstr "" #: ../../library/datetime.rst:1563 msgid "" ">>> from datetime import datetime\n" -">>> datetime.now().isoformat(timespec='minutes') \n" +">>> datetime.now().isoformat(timespec='minutes')\n" "'2002-12-25T00:00'\n" ">>> dt = datetime(2015, 1, 1, 12, 30, 59, 0)\n" ">>> dt.isoformat(timespec='microseconds')\n" "'2015-01-01T12:30:59.000000'" msgstr "" ">>> from datetime import datetime\n" -">>> datetime.now().isoformat(timespec='minutes') \n" +">>> datetime.now().isoformat(timespec='minutes')\n" "'2002-12-25T00:00'\n" ">>> dt = datetime(2015, 1, 1, 12, 30, 59, 0)\n" ">>> dt.isoformat(timespec='microseconds')\n" @@ -2394,9 +2394,9 @@ msgid "" "datetime.datetime(2005, 7, 14, 12, 30)\n" "\n" ">>> # Using datetime.now()\n" -">>> datetime.now() \n" +">>> datetime.now()\n" "datetime.datetime(2007, 12, 6, 16, 29, 43, 79043) # GMT +1\n" -">>> datetime.now(timezone.utc) \n" +">>> datetime.now(timezone.utc)\n" "datetime.datetime(2007, 12, 6, 15, 29, 43, 79060, tzinfo=datetime.timezone." "utc)\n" "\n" @@ -2407,7 +2407,7 @@ msgid "" "\n" ">>> # Using datetime.timetuple() to get tuple of all attributes\n" ">>> tt = dt.timetuple()\n" -">>> for it in tt: \n" +">>> for it in tt:\n" "... print(it)\n" "...\n" "2006 # year\n" @@ -2422,7 +2422,7 @@ msgid "" "\n" ">>> # Date in ISO format\n" ">>> ic = dt.isocalendar()\n" -">>> for it in ic: \n" +">>> for it in ic:\n" "... print(it)\n" "...\n" "2006 # ISO year\n" @@ -2677,10 +2677,10 @@ msgstr "" #: ../../library/datetime.rst:1896 msgid "" -"Return a :class:`.time` with the same value, except for those attributes " -"given new values by whichever keyword arguments are specified. Note that " -"``tzinfo=None`` can be specified to create a naive :class:`.time` from an " -"aware :class:`.time`, without conversion of the time data." +"Return a new :class:`.time` with the same values, but with specified " +"parameters updated. Note that ``tzinfo=None`` can be specified to create a " +"naive :class:`.time` from an aware :class:`.time`, without conversion of the " +"time data." msgstr "" #: ../../library/datetime.rst:1901 diff --git a/library/dbm.po b/library/dbm.po index a3a5e9c26d..473658aa90 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-12 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -599,7 +599,7 @@ msgstr "" #: ../../library/dbm.rst:457 msgid "" "Synchronize the on-disk directory and data files. This method is called by " -"the :meth:`Shelve.sync` method." +"the :meth:`shelve.Shelf.sync` method." msgstr "" #: ../../library/dbm.rst:462 diff --git a/library/dis.po b/library/dis.po index 74ac573ea5..3ac2a3280a 100644 --- a/library/dis.po +++ b/library/dis.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-03 00:15+0000\n" +"POT-Creation-Date: 2025-04-19 00:14+0000\n" "PO-Revision-Date: 2018-07-27 16:55+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -152,43 +152,43 @@ msgstr "" msgid "Show inline caches." msgstr "" -#: ../../library/dis.rst:104 +#: ../../library/dis.rst:106 msgid "Show offsets of instructions." msgstr "" -#: ../../library/dis.rst:106 +#: ../../library/dis.rst:110 msgid "" "If :file:`infile` is specified, its disassembled code will be written to " "stdout. Otherwise, disassembly is performed on compiled source code received " "from stdin." msgstr "" -#: ../../library/dis.rst:110 +#: ../../library/dis.rst:114 msgid "Bytecode analysis" msgstr "" -#: ../../library/dis.rst:114 +#: ../../library/dis.rst:118 msgid "" "The bytecode analysis API allows pieces of Python code to be wrapped in a :" "class:`Bytecode` object that provides easy access to details of the compiled " "code." msgstr "" -#: ../../library/dis.rst:121 +#: ../../library/dis.rst:125 msgid "" "Analyse the bytecode corresponding to a function, generator, asynchronous " "generator, coroutine, method, string of source code, or a code object (as " "returned by :func:`compile`)." msgstr "" -#: ../../library/dis.rst:125 +#: ../../library/dis.rst:129 msgid "" "This is a convenience wrapper around many of the functions listed below, " "most notably :func:`get_instructions`, as iterating over a :class:`Bytecode` " "instance yields the bytecode operations as :class:`Instruction` instances." msgstr "" -#: ../../library/dis.rst:129 ../../library/dis.rst:326 +#: ../../library/dis.rst:133 ../../library/dis.rst:330 msgid "" "If *first_line* is not ``None``, it indicates the line number that should be " "reported for the first source line in the disassembled code. Otherwise, the " @@ -196,73 +196,73 @@ msgid "" "code object." msgstr "" -#: ../../library/dis.rst:134 +#: ../../library/dis.rst:138 msgid "" "If *current_offset* is not ``None``, it refers to an instruction offset in " "the disassembled code. Setting this means :meth:`.dis` will display a " "\"current instruction\" marker against the specified opcode." msgstr "" -#: ../../library/dis.rst:138 +#: ../../library/dis.rst:142 msgid "" "If *show_caches* is ``True``, :meth:`.dis` will display inline cache entries " "used by the interpreter to specialize the bytecode." msgstr "" -#: ../../library/dis.rst:141 +#: ../../library/dis.rst:145 msgid "" "If *adaptive* is ``True``, :meth:`.dis` will display specialized bytecode " "that may be different from the original bytecode." msgstr "" -#: ../../library/dis.rst:144 +#: ../../library/dis.rst:148 msgid "" "If *show_offsets* is ``True``, :meth:`.dis` will include instruction offsets " "in the output." msgstr "" -#: ../../library/dis.rst:149 +#: ../../library/dis.rst:153 msgid "" "Construct a :class:`Bytecode` instance from the given traceback, setting " "*current_offset* to the instruction responsible for the exception." msgstr "" -#: ../../library/dis.rst:154 +#: ../../library/dis.rst:158 msgid "The compiled code object." msgstr "" -#: ../../library/dis.rst:158 +#: ../../library/dis.rst:162 msgid "The first source line of the code object (if available)" msgstr "" -#: ../../library/dis.rst:162 +#: ../../library/dis.rst:166 msgid "" "Return a formatted view of the bytecode operations (the same as printed by :" "func:`dis.dis`, but returned as a multi-line string)." msgstr "" -#: ../../library/dis.rst:167 +#: ../../library/dis.rst:171 msgid "" "Return a formatted multi-line string with detailed information about the " "code object, like :func:`code_info`." msgstr "" -#: ../../library/dis.rst:170 ../../library/dis.rst:210 -#: ../../library/dis.rst:262 +#: ../../library/dis.rst:174 ../../library/dis.rst:214 +#: ../../library/dis.rst:266 msgid "This can now handle coroutine and asynchronous generator objects." msgstr "" -#: ../../library/dis.rst:173 ../../library/dis.rst:265 -#: ../../library/dis.rst:282 ../../library/dis.rst:312 -#: ../../library/dis.rst:335 +#: ../../library/dis.rst:177 ../../library/dis.rst:269 +#: ../../library/dis.rst:286 ../../library/dis.rst:316 +#: ../../library/dis.rst:339 msgid "Added the *show_caches* and *adaptive* parameters." msgstr "新增 *show_caches* 與 *adaptive* 參數。" -#: ../../library/dis.rst:176 +#: ../../library/dis.rst:180 msgid "Example:" msgstr "範例:" -#: ../../library/dis.rst:178 +#: ../../library/dis.rst:182 msgid "" ">>> bytecode = dis.Bytecode(myfunc)\n" ">>> for instr in bytecode:\n" @@ -284,11 +284,11 @@ msgstr "" "CALL\n" "RETURN_VALUE" -#: ../../library/dis.rst:192 +#: ../../library/dis.rst:196 msgid "Analysis functions" msgstr "" -#: ../../library/dis.rst:194 +#: ../../library/dis.rst:198 msgid "" "The :mod:`dis` module also defines the following analysis functions that " "convert the input directly to the desired output. They can be useful if only " @@ -296,39 +296,39 @@ msgid "" "isn't useful:" msgstr "" -#: ../../library/dis.rst:200 +#: ../../library/dis.rst:204 msgid "" "Return a formatted multi-line string with detailed code object information " "for the supplied function, generator, asynchronous generator, coroutine, " "method, source code string or code object." msgstr "" -#: ../../library/dis.rst:204 +#: ../../library/dis.rst:208 msgid "" "Note that the exact contents of code info strings are highly implementation " "dependent and they may change arbitrarily across Python VMs or Python " "releases." msgstr "" -#: ../../library/dis.rst:216 +#: ../../library/dis.rst:220 msgid "" "Print detailed code object information for the supplied function, method, " "source code string or code object to *file* (or ``sys.stdout`` if *file* is " "not specified)." msgstr "" -#: ../../library/dis.rst:220 +#: ../../library/dis.rst:224 msgid "" "This is a convenient shorthand for ``print(code_info(x), file=file)``, " "intended for interactive exploration at the interpreter prompt." msgstr "" -#: ../../library/dis.rst:225 ../../library/dis.rst:256 -#: ../../library/dis.rst:279 ../../library/dis.rst:309 +#: ../../library/dis.rst:229 ../../library/dis.rst:260 +#: ../../library/dis.rst:283 ../../library/dis.rst:313 msgid "Added *file* parameter." msgstr "新增 *file* 參數。" -#: ../../library/dis.rst:231 +#: ../../library/dis.rst:235 msgid "" "Disassemble the *x* object. *x* can denote either a module, a class, a " "method, a function, a generator, an asynchronous generator, a coroutine, a " @@ -344,103 +344,103 @@ msgid "" "disassembles the last traceback." msgstr "" -#: ../../library/dis.rst:244 ../../library/dis.rst:276 -#: ../../library/dis.rst:306 +#: ../../library/dis.rst:248 ../../library/dis.rst:280 +#: ../../library/dis.rst:310 msgid "" "The disassembly is written as text to the supplied *file* argument if " "provided and to ``sys.stdout`` otherwise." msgstr "" -#: ../../library/dis.rst:247 +#: ../../library/dis.rst:251 msgid "" "The maximal depth of recursion is limited by *depth* unless it is ``None``. " "``depth=0`` means no recursion." msgstr "" -#: ../../library/dis.rst:250 +#: ../../library/dis.rst:254 msgid "" "If *show_caches* is ``True``, this function will display inline cache " "entries used by the interpreter to specialize the bytecode." msgstr "" -#: ../../library/dis.rst:253 +#: ../../library/dis.rst:257 msgid "" "If *adaptive* is ``True``, this function will display specialized bytecode " "that may be different from the original bytecode." msgstr "" -#: ../../library/dis.rst:259 +#: ../../library/dis.rst:263 msgid "Implemented recursive disassembling and added *depth* parameter." msgstr "" -#: ../../library/dis.rst:272 +#: ../../library/dis.rst:276 msgid "" "Disassemble the top-of-stack function of a traceback, using the last " "traceback if none was passed. The instruction causing the exception is " "indicated." msgstr "" -#: ../../library/dis.rst:285 ../../library/dis.rst:315 +#: ../../library/dis.rst:289 ../../library/dis.rst:319 msgid "Added the *show_offsets* parameter." msgstr "新增 *show_offsets* 參數。" -#: ../../library/dis.rst:292 +#: ../../library/dis.rst:296 msgid "" "Disassemble a code object, indicating the last instruction if *lasti* was " "provided. The output is divided in the following columns:" msgstr "" -#: ../../library/dis.rst:295 +#: ../../library/dis.rst:299 msgid "the line number, for the first instruction of each line" msgstr "" -#: ../../library/dis.rst:296 +#: ../../library/dis.rst:300 msgid "the current instruction, indicated as ``-->``," msgstr "" -#: ../../library/dis.rst:297 +#: ../../library/dis.rst:301 msgid "a labelled instruction, indicated with ``>>``," msgstr "" -#: ../../library/dis.rst:298 +#: ../../library/dis.rst:302 msgid "the address of the instruction," msgstr "" -#: ../../library/dis.rst:299 +#: ../../library/dis.rst:303 msgid "the operation code name," msgstr "" -#: ../../library/dis.rst:300 +#: ../../library/dis.rst:304 msgid "operation parameters, and" msgstr "" -#: ../../library/dis.rst:301 +#: ../../library/dis.rst:305 msgid "interpretation of the parameters in parentheses." msgstr "" -#: ../../library/dis.rst:303 +#: ../../library/dis.rst:307 msgid "" "The parameter interpretation recognizes local and global variable names, " "constant values, branch targets, and compare operators." msgstr "" -#: ../../library/dis.rst:320 +#: ../../library/dis.rst:324 msgid "" "Return an iterator over the instructions in the supplied function, method, " "source code string or code object." msgstr "" -#: ../../library/dis.rst:323 +#: ../../library/dis.rst:327 msgid "" "The iterator generates a series of :class:`Instruction` named tuples giving " "the details of each operation in the supplied code." msgstr "" -#: ../../library/dis.rst:331 +#: ../../library/dis.rst:335 msgid "The *adaptive* parameter works as it does in :func:`dis`." msgstr "" -#: ../../library/dis.rst:338 +#: ../../library/dis.rst:342 msgid "" "The *show_caches* parameter is deprecated and has no effect. The iterator " "generates the :class:`Instruction` instances with the *cache_info* field " @@ -448,7 +448,7 @@ msgid "" "generates separate items for the cache entries." msgstr "" -#: ../../library/dis.rst:346 +#: ../../library/dis.rst:350 msgid "" "This generator function uses the :meth:`~codeobject.co_lines` method of the :" "ref:`code object ` *code* to find the offsets which are starts " @@ -456,33 +456,33 @@ msgid "" "pairs." msgstr "" -#: ../../library/dis.rst:351 +#: ../../library/dis.rst:355 msgid "Line numbers can be decreasing. Before, they were always increasing." msgstr "" -#: ../../library/dis.rst:354 +#: ../../library/dis.rst:358 msgid "" "The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of the :" "attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` " "attributes of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:359 +#: ../../library/dis.rst:363 msgid "" "Line numbers can be ``None`` for bytecode that does not map to source lines." msgstr "" -#: ../../library/dis.rst:365 +#: ../../library/dis.rst:369 msgid "" "Detect all offsets in the raw compiled bytecode string *code* which are jump " "targets, and return a list of these offsets." msgstr "" -#: ../../library/dis.rst:371 +#: ../../library/dis.rst:375 msgid "Compute the stack effect of *opcode* with argument *oparg*." msgstr "" -#: ../../library/dis.rst:373 +#: ../../library/dis.rst:377 msgid "" "If the code has a jump target and *jump* is ``True``, :func:`~stack_effect` " "will return the stack effect of jumping. If *jump* is ``False``, it will " @@ -490,11 +490,11 @@ msgid "" "it will return the maximal stack effect of both cases." msgstr "" -#: ../../library/dis.rst:380 +#: ../../library/dis.rst:384 msgid "Added *jump* parameter." msgstr "新增 *jump* 參數。" -#: ../../library/dis.rst:383 +#: ../../library/dis.rst:387 msgid "" "If ``oparg`` is omitted (or ``None``), the stack effect is now returned for " "``oparg=0``. Previously this was an error for opcodes that use their arg. It " @@ -502,170 +502,178 @@ msgid "" "does not use it; the ``oparg`` in this case is ignored." msgstr "" -#: ../../library/dis.rst:393 +#: ../../library/dis.rst:397 msgid "Python Bytecode Instructions" msgstr "" -#: ../../library/dis.rst:395 +#: ../../library/dis.rst:399 msgid "" "The :func:`get_instructions` function and :class:`Bytecode` class provide " "details of bytecode instructions as :class:`Instruction` instances:" msgstr "" -#: ../../library/dis.rst:400 +#: ../../library/dis.rst:404 msgid "Details for a bytecode operation" msgstr "" -#: ../../library/dis.rst:404 +#: ../../library/dis.rst:408 msgid "" "numeric code for operation, corresponding to the opcode values listed below " "and the bytecode values in the :ref:`opcode_collections`." msgstr "" -#: ../../library/dis.rst:410 +#: ../../library/dis.rst:414 msgid "human readable name for operation" msgstr "" -#: ../../library/dis.rst:415 +#: ../../library/dis.rst:419 msgid "" "numeric code for the base operation if operation is specialized; otherwise " "equal to :data:`opcode`" msgstr "" -#: ../../library/dis.rst:421 +#: ../../library/dis.rst:425 msgid "" "human readable name for the base operation if operation is specialized; " "otherwise equal to :data:`opname`" msgstr "" -#: ../../library/dis.rst:427 +#: ../../library/dis.rst:431 msgid "numeric argument to operation (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:431 +#: ../../library/dis.rst:435 msgid "alias for :data:`arg`" msgstr "" -#: ../../library/dis.rst:435 +#: ../../library/dis.rst:439 msgid "resolved arg value (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:440 +#: ../../library/dis.rst:444 msgid "" "human readable description of operation argument (if any), otherwise an " "empty string." msgstr "" -#: ../../library/dis.rst:446 +#: ../../library/dis.rst:450 msgid "start index of operation within bytecode sequence" msgstr "" -#: ../../library/dis.rst:451 +#: ../../library/dis.rst:455 msgid "" "start index of operation within bytecode sequence, including prefixed " "``EXTENDED_ARG`` operations if present; otherwise equal to :data:`offset`" msgstr "" -#: ../../library/dis.rst:457 +#: ../../library/dis.rst:461 msgid "start index of the cache entries following the operation" msgstr "" -#: ../../library/dis.rst:462 +#: ../../library/dis.rst:466 msgid "end index of the cache entries following the operation" msgstr "" -#: ../../library/dis.rst:467 +#: ../../library/dis.rst:471 msgid "``True`` if this opcode starts a source line, otherwise ``False``" msgstr "" -#: ../../library/dis.rst:472 +#: ../../library/dis.rst:476 msgid "" "source line number associated with this opcode (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:477 +#: ../../library/dis.rst:481 msgid "``True`` if other code jumps to here, otherwise ``False``" msgstr "" -#: ../../library/dis.rst:482 +#: ../../library/dis.rst:486 msgid "" "bytecode index of the jump target if this is a jump operation, otherwise " "``None``" msgstr "" -#: ../../library/dis.rst:488 +#: ../../library/dis.rst:492 msgid "" ":class:`dis.Positions` object holding the start and end locations that are " "covered by this instruction." msgstr "" -#: ../../library/dis.rst:503 -msgid "Field ``positions`` is added." +#: ../../library/dis.rst:497 +msgid "" +"Information about the cache entries of this instruction, as triplets of the " +"form ``(name, size, data)``, where the ``name`` and ``size`` describe the " +"cache format and data is the contents of the cache. ``cache_info`` is " +"``None`` if the instruction does not have caches." msgstr "" #: ../../library/dis.rst:507 +msgid "Field ``positions`` is added." +msgstr "" + +#: ../../library/dis.rst:511 msgid "Changed field ``starts_line``." msgstr "" -#: ../../library/dis.rst:509 +#: ../../library/dis.rst:513 msgid "" "Added fields ``start_offset``, ``cache_offset``, ``end_offset``, " "``baseopname``, ``baseopcode``, ``jump_target``, ``oparg``, ``line_number`` " "and ``cache_info``." msgstr "" -#: ../../library/dis.rst:516 +#: ../../library/dis.rst:520 msgid "" "In case the information is not available, some fields might be ``None``." msgstr "" -#: ../../library/dis.rst:526 +#: ../../library/dis.rst:530 msgid "" "The Python compiler currently generates the following bytecode instructions." msgstr "" -#: ../../library/dis.rst:529 +#: ../../library/dis.rst:533 msgid "**General instructions**" msgstr "" -#: ../../library/dis.rst:531 +#: ../../library/dis.rst:535 msgid "" "In the following, We will refer to the interpreter stack as ``STACK`` and " "describe operations on it as if it was a Python list. The top of the stack " "corresponds to ``STACK[-1]`` in this language." msgstr "" -#: ../../library/dis.rst:537 +#: ../../library/dis.rst:541 msgid "" "Do nothing code. Used as a placeholder by the bytecode optimizer, and to " "generate line tracing events." msgstr "" -#: ../../library/dis.rst:543 +#: ../../library/dis.rst:547 msgid "Removes the top-of-stack item::" msgstr "" -#: ../../library/dis.rst:545 +#: ../../library/dis.rst:549 msgid "STACK.pop()" msgstr "STACK.pop()" -#: ../../library/dis.rst:550 +#: ../../library/dis.rst:554 msgid "" "Removes the top-of-stack item. Equivalent to ``POP_TOP``. Used to clean up " "at the end of loops, hence the name." msgstr "" -#: ../../library/dis.rst:559 +#: ../../library/dis.rst:563 msgid "Implements ``del STACK[-2]``. Used to clean up when a generator exits." msgstr "" -#: ../../library/dis.rst:567 +#: ../../library/dis.rst:571 msgid "" "Push the i-th item to the top of the stack without removing it from its " "original location::" msgstr "" -#: ../../library/dis.rst:570 +#: ../../library/dis.rst:574 msgid "" "assert i > 0\n" "STACK.append(STACK[-i])" @@ -673,15 +681,15 @@ msgstr "" "assert i > 0\n" "STACK.append(STACK[-i])" -#: ../../library/dis.rst:578 +#: ../../library/dis.rst:582 msgid "Swap the top of the stack with the i-th element::" msgstr "" -#: ../../library/dis.rst:580 +#: ../../library/dis.rst:584 msgid "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" msgstr "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" -#: ../../library/dis.rst:587 +#: ../../library/dis.rst:591 msgid "" "Rather than being an actual instruction, this opcode is used to mark extra " "space for the interpreter to cache useful data directly in the bytecode " @@ -689,86 +697,86 @@ msgid "" "viewed with ``show_caches=True``." msgstr "" -#: ../../library/dis.rst:592 +#: ../../library/dis.rst:596 msgid "" "Logically, this space is part of the preceding instruction. Many opcodes " "expect to be followed by an exact number of caches, and will instruct the " "interpreter to skip over them at runtime." msgstr "" -#: ../../library/dis.rst:596 +#: ../../library/dis.rst:600 msgid "" "Populated caches can look like arbitrary instructions, so great care should " "be taken when reading or modifying raw, adaptive bytecode containing " "quickened data." msgstr "" -#: ../../library/dis.rst:603 +#: ../../library/dis.rst:607 msgid "**Unary operations**" msgstr "" -#: ../../library/dis.rst:605 +#: ../../library/dis.rst:609 msgid "" "Unary operations take the top of the stack, apply the operation, and push " "the result back on the stack." msgstr "" -#: ../../library/dis.rst:611 +#: ../../library/dis.rst:615 msgid "Implements ``STACK[-1] = -STACK[-1]``." msgstr "" -#: ../../library/dis.rst:616 +#: ../../library/dis.rst:620 msgid "Implements ``STACK[-1] = not STACK[-1]``." msgstr "" -#: ../../library/dis.rst:618 ../../library/dis.rst:1314 -#: ../../library/dis.rst:1330 +#: ../../library/dis.rst:622 ../../library/dis.rst:1318 +#: ../../library/dis.rst:1334 msgid "This instruction now requires an exact :class:`bool` operand." msgstr "" -#: ../../library/dis.rst:624 +#: ../../library/dis.rst:628 msgid "Implements ``STACK[-1] = ~STACK[-1]``." msgstr "" -#: ../../library/dis.rst:629 +#: ../../library/dis.rst:633 msgid "Implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:634 +#: ../../library/dis.rst:638 msgid "" "If ``STACK[-1]`` is a :term:`generator iterator` or :term:`coroutine` object " "it is left as is. Otherwise, implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:642 +#: ../../library/dis.rst:646 msgid "Implements ``STACK[-1] = bool(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:647 +#: ../../library/dis.rst:651 msgid "**Binary and in-place operations**" msgstr "" -#: ../../library/dis.rst:649 +#: ../../library/dis.rst:653 msgid "" "Binary operations remove the top two items from the stack (``STACK[-1]`` and " "``STACK[-2]``). They perform the operation, then put the result back on the " "stack." msgstr "" -#: ../../library/dis.rst:652 +#: ../../library/dis.rst:656 msgid "" "In-place operations are like binary operations, but the operation is done in-" "place when ``STACK[-2]`` supports it, and the resulting ``STACK[-1]`` may be " "(but does not have to be) the original ``STACK[-2]``." msgstr "" -#: ../../library/dis.rst:659 +#: ../../library/dis.rst:663 msgid "" "Implements the binary and in-place operators (depending on the value of " "*op*)::" msgstr "" -#: ../../library/dis.rst:662 +#: ../../library/dis.rst:666 msgid "" "rhs = STACK.pop()\n" "lhs = STACK.pop()\n" @@ -778,17 +786,17 @@ msgstr "" "lhs = STACK.pop()\n" "STACK.append(lhs op rhs)" -#: ../../library/dis.rst:671 ../../library/dis.rst:680 -#: ../../library/dis.rst:690 ../../library/dis.rst:698 -#: ../../library/dis.rst:710 ../../library/dis.rst:798 -#: ../../library/dis.rst:808 ../../library/dis.rst:818 -#: ../../library/dis.rst:1042 ../../library/dis.rst:1053 -#: ../../library/dis.rst:1157 ../../library/dis.rst:1169 -#: ../../library/dis.rst:1181 +#: ../../library/dis.rst:675 ../../library/dis.rst:684 +#: ../../library/dis.rst:694 ../../library/dis.rst:702 +#: ../../library/dis.rst:714 ../../library/dis.rst:802 +#: ../../library/dis.rst:812 ../../library/dis.rst:822 +#: ../../library/dis.rst:1046 ../../library/dis.rst:1057 +#: ../../library/dis.rst:1161 ../../library/dis.rst:1173 +#: ../../library/dis.rst:1185 msgid "Implements::" msgstr "" -#: ../../library/dis.rst:673 +#: ../../library/dis.rst:677 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -798,7 +806,7 @@ msgstr "" "container = STACK.pop()\n" "STACK.append(container[key])" -#: ../../library/dis.rst:682 +#: ../../library/dis.rst:686 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -810,7 +818,7 @@ msgstr "" "value = STACK.pop()\n" "container[key] = value" -#: ../../library/dis.rst:692 +#: ../../library/dis.rst:696 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -820,7 +828,7 @@ msgstr "" "container = STACK.pop()\n" "del container[key]" -#: ../../library/dis.rst:700 +#: ../../library/dis.rst:704 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -832,7 +840,7 @@ msgstr "" "container = STACK.pop()\n" "STACK.append(container[start:end])" -#: ../../library/dis.rst:712 +#: ../../library/dis.rst:716 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -846,11 +854,11 @@ msgstr "" "values = STACK.pop()\n" "container[start:end] = value" -#: ../../library/dis.rst:721 +#: ../../library/dis.rst:725 msgid "**Coroutine opcodes**" msgstr "" -#: ../../library/dis.rst:725 +#: ../../library/dis.rst:729 msgid "" "Implements ``STACK[-1] = get_awaitable(STACK[-1])``, where " "``get_awaitable(o)`` returns ``o`` if ``o`` is a coroutine object or a " @@ -858,39 +866,39 @@ msgid "" "resolves ``o.__await__``." msgstr "" -#: ../../library/dis.rst:730 +#: ../../library/dis.rst:734 msgid "" "If the ``where`` operand is nonzero, it indicates where the instruction " "occurs:" msgstr "" -#: ../../library/dis.rst:733 +#: ../../library/dis.rst:737 msgid "``1``: After a call to ``__aenter__``" msgstr "" -#: ../../library/dis.rst:734 +#: ../../library/dis.rst:738 msgid "``2``: After a call to ``__aexit__``" msgstr "" -#: ../../library/dis.rst:738 +#: ../../library/dis.rst:742 msgid "Previously, this instruction did not have an oparg." msgstr "" -#: ../../library/dis.rst:744 +#: ../../library/dis.rst:748 msgid "Implements ``STACK[-1] = STACK[-1].__aiter__()``." msgstr "" -#: ../../library/dis.rst:747 +#: ../../library/dis.rst:751 msgid "Returning awaitable objects from ``__aiter__`` is no longer supported." msgstr "" -#: ../../library/dis.rst:754 +#: ../../library/dis.rst:758 msgid "" "Implement ``STACK.append(get_awaitable(STACK[-1].__anext__()))`` to the " "stack. See ``GET_AWAITABLE`` for details about ``get_awaitable``." msgstr "" -#: ../../library/dis.rst:762 +#: ../../library/dis.rst:766 msgid "" "Terminates an :keyword:`async for` loop. Handles an exception raised when " "awaiting a next item. The stack contains the async iterable in ``STACK[-2]`` " @@ -898,13 +906,13 @@ msgid "" "is not :exc:`StopAsyncIteration`, it is re-raised." msgstr "" -#: ../../library/dis.rst:769 ../../library/dis.rst:877 -#: ../../library/dis.rst:888 +#: ../../library/dis.rst:773 ../../library/dis.rst:881 +#: ../../library/dis.rst:892 msgid "" "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:775 +#: ../../library/dis.rst:779 msgid "" "Handles an exception raised during a :meth:`~generator.throw` or :meth:" "`~generator.close` call through the current frame. If ``STACK[-1]`` is an " @@ -912,21 +920,21 @@ msgid "" "its ``value`` member. Otherwise, re-raise ``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:785 +#: ../../library/dis.rst:789 msgid "" "Resolves ``__aenter__`` and ``__aexit__`` from ``STACK[-1]``. Pushes " "``__aexit__`` and result of ``__aenter__()`` to the stack::" msgstr "" -#: ../../library/dis.rst:788 +#: ../../library/dis.rst:792 msgid "STACK.extend((__aexit__, __aenter__())" msgstr "STACK.extend((__aexit__, __aenter__())" -#: ../../library/dis.rst:794 +#: ../../library/dis.rst:798 msgid "**Miscellaneous opcodes**" msgstr "" -#: ../../library/dis.rst:800 +#: ../../library/dis.rst:804 msgid "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" @@ -934,11 +942,11 @@ msgstr "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" -#: ../../library/dis.rst:803 +#: ../../library/dis.rst:807 msgid "Used to implement set comprehensions." msgstr "" -#: ../../library/dis.rst:810 +#: ../../library/dis.rst:814 msgid "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" @@ -946,11 +954,11 @@ msgstr "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" -#: ../../library/dis.rst:813 +#: ../../library/dis.rst:817 msgid "Used to implement list comprehensions." msgstr "" -#: ../../library/dis.rst:820 +#: ../../library/dis.rst:824 msgid "" "value = STACK.pop()\n" "key = STACK.pop()\n" @@ -960,17 +968,17 @@ msgstr "" "key = STACK.pop()\n" "dict.__setitem__(STACK[-i], key, value)" -#: ../../library/dis.rst:824 +#: ../../library/dis.rst:828 msgid "Used to implement dict comprehensions." msgstr "" -#: ../../library/dis.rst:827 +#: ../../library/dis.rst:831 msgid "" "Map value is ``STACK[-1]`` and map key is ``STACK[-2]``. Before, those were " "reversed." msgstr "" -#: ../../library/dis.rst:831 +#: ../../library/dis.rst:835 msgid "" "For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` and :opcode:" "`MAP_ADD` instructions, while the added value or key/value pair is popped " @@ -978,35 +986,35 @@ msgid "" "further iterations of the loop." msgstr "" -#: ../../library/dis.rst:839 +#: ../../library/dis.rst:843 msgid "Returns with ``STACK[-1]`` to the caller of the function." msgstr "" -#: ../../library/dis.rst:844 +#: ../../library/dis.rst:848 msgid "Returns with ``co_consts[consti]`` to the caller of the function." msgstr "" -#: ../../library/dis.rst:851 +#: ../../library/dis.rst:855 msgid "Yields ``STACK.pop()`` from a :term:`generator`." msgstr "" -#: ../../library/dis.rst:853 +#: ../../library/dis.rst:857 msgid "oparg set to be the stack depth." msgstr "" -#: ../../library/dis.rst:856 +#: ../../library/dis.rst:860 msgid "" "oparg set to be the exception block depth, for efficient closing of " "generators." msgstr "" -#: ../../library/dis.rst:859 +#: ../../library/dis.rst:863 msgid "" "oparg is ``1`` if this instruction is part of a yield-from or await, and " "``0`` otherwise." msgstr "" -#: ../../library/dis.rst:865 +#: ../../library/dis.rst:869 msgid "" "Checks whether ``__annotations__`` is defined in ``locals()``, if not it is " "set up to an empty ``dict``. This opcode is only emitted if a class or " @@ -1014,39 +1022,39 @@ msgid "" "statically." msgstr "" -#: ../../library/dis.rst:875 +#: ../../library/dis.rst:879 msgid "" "Pops a value from the stack, which is used to restore the exception state." msgstr "" -#: ../../library/dis.rst:882 +#: ../../library/dis.rst:886 msgid "" "Re-raises the exception currently on top of the stack. If oparg is non-zero, " "pops an additional value from the stack which is used to set :attr:`~frame." "f_lasti` of the current frame." msgstr "" -#: ../../library/dis.rst:893 +#: ../../library/dis.rst:897 msgid "" "Pops a value from the stack. Pushes the current exception to the top of the " "stack. Pushes the value originally popped back to the stack. Used in " "exception handlers." msgstr "" -#: ../../library/dis.rst:901 +#: ../../library/dis.rst:905 msgid "" "Performs exception matching for ``except``. Tests whether the ``STACK[-2]`` " "is an exception matching ``STACK[-1]``. Pops ``STACK[-1]`` and pushes the " "boolean result of the test." msgstr "" -#: ../../library/dis.rst:909 +#: ../../library/dis.rst:913 msgid "" "Performs exception matching for ``except*``. Applies ``split(STACK[-1])`` on " "the exception group representing ``STACK[-2]``." msgstr "" -#: ../../library/dis.rst:912 +#: ../../library/dis.rst:916 msgid "" "In case of a match, pops two items from the stack and pushes the non-" "matching subgroup (``None`` in case of full match) followed by the matching " @@ -1054,7 +1062,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/dis.rst:921 +#: ../../library/dis.rst:925 msgid "" "Calls the function in position 4 on the stack with arguments (type, val, tb) " "representing the exception at the top of the stack. Used to implement the " @@ -1062,25 +1070,25 @@ msgid "" "occurred in a :keyword:`with` statement." msgstr "" -#: ../../library/dis.rst:928 +#: ../../library/dis.rst:932 msgid "" "The ``__exit__`` function is in position 4 of the stack rather than 7. " "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:935 +#: ../../library/dis.rst:939 msgid "" "Pushes :exc:`AssertionError` onto the stack. Used by the :keyword:`assert` " "statement." msgstr "" -#: ../../library/dis.rst:943 +#: ../../library/dis.rst:947 msgid "" "Pushes :func:`!builtins.__build_class__` onto the stack. It is later called " "to construct a class." msgstr "" -#: ../../library/dis.rst:949 +#: ../../library/dis.rst:953 msgid "" "This opcode performs several operations before a with block starts. First, " "it loads :meth:`~object.__exit__` from the context manager and pushes it " @@ -1089,13 +1097,13 @@ msgid "" "``__enter__()`` method is pushed onto the stack." msgstr "" -#: ../../library/dis.rst:960 +#: ../../library/dis.rst:964 msgid "" "Perform ``STACK.append(len(STACK[-1]))``. Used in :keyword:`match` " "statements where comparison with structure of pattern is needed." msgstr "" -#: ../../library/dis.rst:968 +#: ../../library/dis.rst:972 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Mapping` (or, " "more technically: if it has the :c:macro:`Py_TPFLAGS_MAPPING` flag set in " @@ -1103,7 +1111,7 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:978 +#: ../../library/dis.rst:982 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Sequence` and is " "*not* an instance of :class:`str`/:class:`bytes`/:class:`bytearray` (or, " @@ -1112,20 +1120,20 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:988 +#: ../../library/dis.rst:992 msgid "" "``STACK[-1]`` is a tuple of mapping keys, and ``STACK[-2]`` is the match " "subject. If ``STACK[-2]`` contains all of the keys in ``STACK[-1]``, push a :" "class:`tuple` containing the corresponding values. Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:994 ../../library/dis.rst:1686 +#: ../../library/dis.rst:998 ../../library/dis.rst:1684 msgid "" "Previously, this instruction also pushed a boolean value indicating success " "(``True``) or failure (``False``)." msgstr "" -#: ../../library/dis.rst:1001 +#: ../../library/dis.rst:1005 msgid "" "Implements ``name = STACK.pop()``. *namei* is the index of *name* in the " "attribute :attr:`~codeobject.co_names` of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:1014 +#: ../../library/dis.rst:1018 msgid "" "Unpacks ``STACK[-1]`` into *count* individual values, which are put onto the " "stack right-to-left. Require there to be exactly *count* values.::" msgstr "" -#: ../../library/dis.rst:1017 +#: ../../library/dis.rst:1021 msgid "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" @@ -1153,7 +1161,7 @@ msgstr "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" -#: ../../library/dis.rst:1023 +#: ../../library/dis.rst:1027 msgid "" "Implements assignment with a starred target: Unpacks an iterable in " "``STACK[-1]`` into individual values, where the total number of values can " @@ -1161,11 +1169,11 @@ msgid "" "will be a list of all leftover items." msgstr "" -#: ../../library/dis.rst:1028 +#: ../../library/dis.rst:1032 msgid "The number of values before and after the list value is limited to 255." msgstr "" -#: ../../library/dis.rst:1030 +#: ../../library/dis.rst:1034 msgid "" "The number of values before the list value is encoded in the argument of the " "opcode. The number of values after the list if any is encoded using an " @@ -1174,13 +1182,13 @@ msgid "" "list value, the high byte of *counts* the number of values after it." msgstr "" -#: ../../library/dis.rst:1036 +#: ../../library/dis.rst:1040 msgid "" "The extracted values are put onto the stack right-to-left, i.e. ``a, *b, c = " "d`` will be stored after execution as ``STACK.extend((a, b, c))``." msgstr "" -#: ../../library/dis.rst:1044 +#: ../../library/dis.rst:1048 msgid "" "obj = STACK.pop()\n" "value = STACK.pop()\n" @@ -1190,13 +1198,13 @@ msgstr "" "value = STACK.pop()\n" "obj.name = value" -#: ../../library/dis.rst:1048 +#: ../../library/dis.rst:1052 msgid "" "where *namei* is the index of name in :attr:`~codeobject.co_names` of the :" "ref:`code object `." msgstr "" -#: ../../library/dis.rst:1055 +#: ../../library/dis.rst:1059 msgid "" "obj = STACK.pop()\n" "del obj.name" @@ -1204,38 +1212,38 @@ msgstr "" "obj = STACK.pop()\n" "del obj.name" -#: ../../library/dis.rst:1058 +#: ../../library/dis.rst:1062 msgid "" "where *namei* is the index of name into :attr:`~codeobject.co_names` of the :" "ref:`code object `." msgstr "" -#: ../../library/dis.rst:1064 +#: ../../library/dis.rst:1068 msgid "Works as :opcode:`STORE_NAME`, but stores the name as a global." msgstr "" -#: ../../library/dis.rst:1069 +#: ../../library/dis.rst:1073 msgid "Works as :opcode:`DELETE_NAME`, but deletes a global name." msgstr "" -#: ../../library/dis.rst:1074 +#: ../../library/dis.rst:1078 msgid "Pushes ``co_consts[consti]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1079 +#: ../../library/dis.rst:1083 msgid "" "Pushes the value associated with ``co_names[namei]`` onto the stack. The " "name is looked up within the locals, then the globals, then the builtins." msgstr "" -#: ../../library/dis.rst:1085 +#: ../../library/dis.rst:1089 msgid "" "Pushes a reference to the locals dictionary onto the stack. This is used to " "prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` and :" "opcode:`LOAD_FROM_DICT_OR_GLOBALS`." msgstr "" -#: ../../library/dis.rst:1094 +#: ../../library/dis.rst:1098 msgid "" "Pops a mapping off the stack and looks up the value for ``co_names[namei]``. " "If the name is not found there, looks it up in the globals and then the " @@ -1244,13 +1252,13 @@ msgid "" "bodies." msgstr "" -#: ../../library/dis.rst:1105 +#: ../../library/dis.rst:1109 msgid "" "Creates a tuple consuming *count* items from the stack, and pushes the " "resulting tuple onto the stack::" msgstr "" -#: ../../library/dis.rst:1108 +#: ../../library/dis.rst:1112 msgid "" "if count == 0:\n" " value = ()\n" @@ -1268,41 +1276,41 @@ msgstr "" "\n" "STACK.append(value)" -#: ../../library/dis.rst:1119 +#: ../../library/dis.rst:1123 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a list." msgstr "" -#: ../../library/dis.rst:1124 +#: ../../library/dis.rst:1128 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a set." msgstr "" -#: ../../library/dis.rst:1129 +#: ../../library/dis.rst:1133 msgid "" "Pushes a new dictionary object onto the stack. Pops ``2 * count`` items so " "that the dictionary holds *count* entries: ``{..., STACK[-4]: STACK[-3], " "STACK[-2]: STACK[-1]}``." msgstr "" -#: ../../library/dis.rst:1133 +#: ../../library/dis.rst:1137 msgid "" "The dictionary is created from stack items instead of creating an empty " "dictionary pre-sized to hold *count* items." msgstr "" -#: ../../library/dis.rst:1140 +#: ../../library/dis.rst:1144 msgid "" "The version of :opcode:`BUILD_MAP` specialized for constant keys. Pops the " "top element on the stack which contains a tuple of keys, then starting from " "``STACK[-2]``, pops *count* values to form values in the built dictionary." msgstr "" -#: ../../library/dis.rst:1149 +#: ../../library/dis.rst:1153 msgid "" "Concatenates *count* strings from the stack and pushes the resulting string " "onto the stack." msgstr "" -#: ../../library/dis.rst:1159 +#: ../../library/dis.rst:1163 msgid "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" @@ -1310,11 +1318,11 @@ msgstr "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" -#: ../../library/dis.rst:1162 +#: ../../library/dis.rst:1166 msgid "Used to build lists." msgstr "" -#: ../../library/dis.rst:1171 +#: ../../library/dis.rst:1175 msgid "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" @@ -1322,11 +1330,11 @@ msgstr "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" -#: ../../library/dis.rst:1174 +#: ../../library/dis.rst:1178 msgid "Used to build sets." msgstr "" -#: ../../library/dis.rst:1183 +#: ../../library/dis.rst:1187 msgid "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" @@ -1334,21 +1342,21 @@ msgstr "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" -#: ../../library/dis.rst:1186 +#: ../../library/dis.rst:1190 msgid "Used to build dicts." msgstr "" -#: ../../library/dis.rst:1193 +#: ../../library/dis.rst:1197 msgid "Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys." msgstr "" -#: ../../library/dis.rst:1200 +#: ../../library/dis.rst:1204 msgid "" "If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with " "``getattr(STACK[-1], co_names[namei>>1])``." msgstr "" -#: ../../library/dis.rst:1203 +#: ../../library/dis.rst:1207 msgid "" "If the low bit of ``namei`` is set, this will attempt to load a method named " "``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is " @@ -1360,76 +1368,76 @@ msgid "" "pushed." msgstr "" -#: ../../library/dis.rst:1212 +#: ../../library/dis.rst:1216 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is pushed to " "the stack before the attribute or unbound method respectively." msgstr "" -#: ../../library/dis.rst:1219 +#: ../../library/dis.rst:1223 msgid "" "This opcode implements :func:`super`, both in its zero-argument and two-" "argument forms (e.g. ``super().method()``, ``super().attr`` and ``super(cls, " "self).method()``, ``super(cls, self).attr``)." msgstr "" -#: ../../library/dis.rst:1223 +#: ../../library/dis.rst:1227 msgid "It pops three values from the stack (from top of stack down):" msgstr "" -#: ../../library/dis.rst:1225 +#: ../../library/dis.rst:1229 msgid "``self``: the first argument to the current method" msgstr "" -#: ../../library/dis.rst:1226 +#: ../../library/dis.rst:1230 msgid "``cls``: the class within which the current method was defined" msgstr "" -#: ../../library/dis.rst:1227 +#: ../../library/dis.rst:1231 msgid "the global ``super``" msgstr "" -#: ../../library/dis.rst:1229 +#: ../../library/dis.rst:1233 msgid "" "With respect to its argument, it works similarly to :opcode:`LOAD_ATTR`, " "except that ``namei`` is shifted left by 2 bits instead of 1." msgstr "" -#: ../../library/dis.rst:1232 +#: ../../library/dis.rst:1236 msgid "" "The low bit of ``namei`` signals to attempt a method load, as with :opcode:" "`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded method. When " "it is unset a single value is pushed to the stack." msgstr "" -#: ../../library/dis.rst:1236 +#: ../../library/dis.rst:1240 msgid "" "The second-low bit of ``namei``, if set, means that this was a two-argument " "call to :func:`super` (unset means zero-argument)." msgstr "" -#: ../../library/dis.rst:1244 +#: ../../library/dis.rst:1248 msgid "" "Performs a Boolean operation. The operation name can be found in " "``cmp_op[opname >> 5]``. If the fifth-lowest bit of ``opname`` is set " "(``opname & 16``), the result should be coerced to ``bool``." msgstr "" -#: ../../library/dis.rst:1248 +#: ../../library/dis.rst:1252 msgid "" "The fifth-lowest bit of the oparg now indicates a forced conversion to :" "class:`bool`." msgstr "" -#: ../../library/dis.rst:1255 +#: ../../library/dis.rst:1259 msgid "Performs ``is`` comparison, or ``is not`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1262 +#: ../../library/dis.rst:1266 msgid "Performs ``in`` comparison, or ``not in`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1269 +#: ../../library/dis.rst:1273 msgid "" "Imports the module ``co_names[namei]``. ``STACK[-1]`` and ``STACK[-2]`` are " "popped and provide the *fromlist* and *level* arguments of :func:" @@ -1438,68 +1446,62 @@ msgid "" "opcode:`STORE_FAST` instruction modifies the namespace." msgstr "" -#: ../../library/dis.rst:1277 +#: ../../library/dis.rst:1281 msgid "" "Loads the attribute ``co_names[namei]`` from the module found in " "``STACK[-1]``. The resulting object is pushed onto the stack, to be " "subsequently stored by a :opcode:`STORE_FAST` instruction." msgstr "" -#: ../../library/dis.rst:1284 +#: ../../library/dis.rst:1288 msgid "Increments bytecode counter by *delta*." msgstr "" -#: ../../library/dis.rst:1289 +#: ../../library/dis.rst:1293 msgid "Decrements bytecode counter by *delta*. Checks for interrupts." msgstr "" -#: ../../library/dis.rst:1296 +#: ../../library/dis.rst:1300 msgid "Decrements bytecode counter by *delta*. Does not check for interrupts." msgstr "" -#: ../../library/dis.rst:1303 +#: ../../library/dis.rst:1307 msgid "" "If ``STACK[-1]`` is true, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1306 ../../library/dis.rst:1322 +#: ../../library/dis.rst:1310 ../../library/dis.rst:1326 msgid "" "The oparg is now a relative delta rather than an absolute target. This " "opcode is a pseudo-instruction, replaced in final bytecode by the directed " "versions (forward/backward)." msgstr "" -#: ../../library/dis.rst:1311 ../../library/dis.rst:1327 -#: ../../library/dis.rst:1343 ../../library/dis.rst:1357 +#: ../../library/dis.rst:1315 ../../library/dis.rst:1331 +#: ../../library/dis.rst:1344 ../../library/dis.rst:1355 msgid "This is no longer a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1319 +#: ../../library/dis.rst:1323 msgid "" "If ``STACK[-1]`` is false, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1335 +#: ../../library/dis.rst:1339 msgid "" "If ``STACK[-1]`` is not ``None``, increments the bytecode counter by " "*delta*. ``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1338 ../../library/dis.rst:1352 -msgid "" -"This opcode is a pseudo-instruction, replaced in final bytecode by the " -"directed versions (forward/backward)." -msgstr "" - -#: ../../library/dis.rst:1349 +#: ../../library/dis.rst:1350 msgid "" "If ``STACK[-1]`` is ``None``, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1362 +#: ../../library/dis.rst:1360 msgid "" "``STACK[-1]`` is an :term:`iterator`. Call its :meth:`~iterator.__next__` " "method. If this yields a new value, push it on the stack (leaving the " @@ -1507,91 +1509,91 @@ msgid "" "code counter is incremented by *delta*." msgstr "" -#: ../../library/dis.rst:1367 +#: ../../library/dis.rst:1365 msgid "Up until 3.11 the iterator was popped when it was exhausted." msgstr "" -#: ../../library/dis.rst:1372 +#: ../../library/dis.rst:1370 msgid "Loads the global named ``co_names[namei>>1]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1374 +#: ../../library/dis.rst:1372 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` is pushed to the stack " "before the global variable." msgstr "" -#: ../../library/dis.rst:1380 +#: ../../library/dis.rst:1378 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1382 +#: ../../library/dis.rst:1380 msgid "" "This opcode is now only used in situations where the local variable is " "guaranteed to be initialized. It cannot raise :exc:`UnboundLocalError`." msgstr "" -#: ../../library/dis.rst:1388 +#: ../../library/dis.rst:1386 msgid "" "Pushes references to ``co_varnames[var_nums >> 4]`` and " "``co_varnames[var_nums & 15]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1395 +#: ../../library/dis.rst:1393 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack, " "raising an :exc:`UnboundLocalError` if the local variable has not been " "initialized." msgstr "" -#: ../../library/dis.rst:1403 +#: ../../library/dis.rst:1401 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or " "pushes ``NULL`` onto the stack if the local variable has not been " "initialized) and sets ``co_varnames[var_num]`` to ``NULL``." msgstr "" -#: ../../library/dis.rst:1411 +#: ../../library/dis.rst:1409 msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1415 +#: ../../library/dis.rst:1413 msgid "" "Stores ``STACK[-1]`` into ``co_varnames[var_nums >> 4]`` and ``STACK[-2]`` " "into ``co_varnames[var_nums & 15]``." msgstr "" -#: ../../library/dis.rst:1422 +#: ../../library/dis.rst:1420 msgid "" "Stores ``STACK.pop()`` into the local ``co_varnames[var_nums >> 4]`` and " "pushes a reference to the local ``co_varnames[var_nums & 15]`` onto the " "stack." msgstr "" -#: ../../library/dis.rst:1430 +#: ../../library/dis.rst:1428 msgid "Deletes local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1435 +#: ../../library/dis.rst:1433 msgid "" "Creates a new cell in slot ``i``. If that slot is nonempty then that value " "is stored into the new cell." msgstr "" -#: ../../library/dis.rst:1443 +#: ../../library/dis.rst:1441 msgid "" "Loads the cell contained in slot ``i`` of the \"fast locals\" storage. " "Pushes a reference to the object the cell contains on the stack." msgstr "" -#: ../../library/dis.rst:1446 ../../library/dis.rst:1468 -#: ../../library/dis.rst:1479 +#: ../../library/dis.rst:1444 ../../library/dis.rst:1466 +#: ../../library/dis.rst:1477 msgid "" "``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." msgstr "" -#: ../../library/dis.rst:1452 +#: ../../library/dis.rst:1450 msgid "" "Pops a mapping off the stack and looks up the name associated with slot " "``i`` of the \"fast locals\" storage in this mapping. If the name is not " @@ -1602,112 +1604,112 @@ msgid "" "class bodies." msgstr "" -#: ../../library/dis.rst:1465 +#: ../../library/dis.rst:1463 msgid "" "Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1474 +#: ../../library/dis.rst:1472 msgid "" "Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " "Used by the :keyword:`del` statement." msgstr "" -#: ../../library/dis.rst:1485 +#: ../../library/dis.rst:1483 msgid "" "Copies the ``n`` :term:`free (closure) variables ` from " "the closure into the frame. Removes the need for special code on the " "caller's side when calling closures." msgstr "" -#: ../../library/dis.rst:1494 +#: ../../library/dis.rst:1492 msgid "" "Raises an exception using one of the 3 forms of the ``raise`` statement, " "depending on the value of *argc*:" msgstr "" -#: ../../library/dis.rst:1497 +#: ../../library/dis.rst:1495 msgid "0: ``raise`` (re-raise previous exception)" msgstr "" -#: ../../library/dis.rst:1498 +#: ../../library/dis.rst:1496 msgid "" "1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1499 +#: ../../library/dis.rst:1497 msgid "" "2: ``raise STACK[-2] from STACK[-1]`` (raise exception instance or type at " "``STACK[-2]`` with ``__cause__`` set to ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1505 +#: ../../library/dis.rst:1503 msgid "" "Calls a callable object with the number of arguments specified by ``argc``. " "On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1508 ../../library/dis.rst:1532 +#: ../../library/dis.rst:1506 ../../library/dis.rst:1530 msgid "The callable" msgstr "" -#: ../../library/dis.rst:1509 ../../library/dis.rst:1533 +#: ../../library/dis.rst:1507 ../../library/dis.rst:1531 msgid "``self`` or ``NULL``" msgstr "" -#: ../../library/dis.rst:1510 ../../library/dis.rst:1534 +#: ../../library/dis.rst:1508 ../../library/dis.rst:1532 msgid "The remaining positional arguments" msgstr "" -#: ../../library/dis.rst:1512 +#: ../../library/dis.rst:1510 msgid "``argc`` is the total of the positional arguments, excluding ``self``." msgstr "" -#: ../../library/dis.rst:1514 +#: ../../library/dis.rst:1512 msgid "" "``CALL`` pops all arguments and the callable object off the stack, calls the " "callable object with those arguments, and pushes the return value returned " "by the callable object." msgstr "" -#: ../../library/dis.rst:1520 +#: ../../library/dis.rst:1518 msgid "The callable now always appears at the same position on the stack." msgstr "" -#: ../../library/dis.rst:1523 +#: ../../library/dis.rst:1521 msgid "Calls with keyword arguments are now handled by :opcode:`CALL_KW`." msgstr "" -#: ../../library/dis.rst:1529 +#: ../../library/dis.rst:1527 msgid "" "Calls a callable object with the number of arguments specified by ``argc``, " "including one or more named arguments. On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1535 +#: ../../library/dis.rst:1533 msgid "The named arguments" msgstr "" -#: ../../library/dis.rst:1536 +#: ../../library/dis.rst:1534 msgid "A :class:`tuple` of keyword argument names" msgstr "" -#: ../../library/dis.rst:1538 +#: ../../library/dis.rst:1536 msgid "" "``argc`` is the total of the positional and named arguments, excluding " "``self``. The length of the tuple of keyword argument names is the number of " "named arguments." msgstr "" -#: ../../library/dis.rst:1541 +#: ../../library/dis.rst:1539 msgid "" "``CALL_KW`` pops all arguments, the keyword names, and the callable object " "off the stack, calls the callable object with those arguments, and pushes " "the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1550 +#: ../../library/dis.rst:1548 msgid "" "Calls a callable object with variable set of positional and keyword " "arguments. If the lowest bit of *flags* is set, the top of the stack " @@ -1719,33 +1721,33 @@ msgid "" "arguments, and pushes the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1565 +#: ../../library/dis.rst:1563 msgid "" "Pushes a ``NULL`` to the stack. Used in the call sequence to match the " "``NULL`` pushed by :opcode:`LOAD_METHOD` for non-method calls." msgstr "" -#: ../../library/dis.rst:1574 +#: ../../library/dis.rst:1572 msgid "" "Pushes a new function object on the stack built from the code object at " "``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:1576 +#: ../../library/dis.rst:1574 msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" msgstr "" -#: ../../library/dis.rst:1579 +#: ../../library/dis.rst:1577 msgid "Qualified name at ``STACK[-1]`` was removed." msgstr "" -#: ../../library/dis.rst:1582 +#: ../../library/dis.rst:1580 msgid "" "Extra function attributes on the stack, signaled by oparg flags, were " "removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." msgstr "" -#: ../../library/dis.rst:1589 +#: ../../library/dis.rst:1587 msgid "" "Sets an attribute on a function object. Expects the function at " "``STACK[-1]`` and the attribute value to set at ``STACK[-2]``; consumes both " @@ -1753,42 +1755,42 @@ msgid "" "attribute to set:" msgstr "" -#: ../../library/dis.rst:1593 +#: ../../library/dis.rst:1591 msgid "" "``0x01`` a tuple of default values for positional-only and positional-or-" "keyword parameters in positional order" msgstr "" -#: ../../library/dis.rst:1595 +#: ../../library/dis.rst:1593 msgid "``0x02`` a dictionary of keyword-only parameters' default values" msgstr "" -#: ../../library/dis.rst:1596 +#: ../../library/dis.rst:1594 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" -#: ../../library/dis.rst:1597 +#: ../../library/dis.rst:1595 msgid "``0x08`` a tuple containing cells for free variables, making a closure" msgstr "" -#: ../../library/dis.rst:1606 +#: ../../library/dis.rst:1604 msgid "" "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " "implements::" msgstr "" -#: ../../library/dis.rst:1608 +#: ../../library/dis.rst:1606 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" "STACK.append(slice(start, end))" msgstr "" -#: ../../library/dis.rst:1612 +#: ../../library/dis.rst:1610 msgid "if it is 3, implements::" msgstr "" -#: ../../library/dis.rst:1614 +#: ../../library/dis.rst:1612 msgid "" "step = STACK.pop()\n" "end = STACK.pop()\n" @@ -1800,11 +1802,11 @@ msgstr "" "start = STACK.pop()\n" "STACK.append(slice(start, end, step))" -#: ../../library/dis.rst:1619 +#: ../../library/dis.rst:1617 msgid "See the :func:`slice` built-in function for more information." msgstr "" -#: ../../library/dis.rst:1624 +#: ../../library/dis.rst:1622 msgid "" "Prefixes any opcode which has an argument too big to fit into the default " "one byte. *ext* holds an additional byte which act as higher bits in the " @@ -1812,11 +1814,11 @@ msgid "" "allowed, forming an argument from two-byte to four-byte." msgstr "" -#: ../../library/dis.rst:1632 +#: ../../library/dis.rst:1630 msgid "Convert value to a string, depending on ``oparg``::" msgstr "" -#: ../../library/dis.rst:1634 +#: ../../library/dis.rst:1632 msgid "" "value = STACK.pop()\n" "result = func(value)\n" @@ -1826,28 +1828,28 @@ msgstr "" "result = func(value)\n" "STACK.append(result)" -#: ../../library/dis.rst:1638 +#: ../../library/dis.rst:1636 msgid "``oparg == 1``: call :func:`str` on *value*" msgstr "" -#: ../../library/dis.rst:1639 +#: ../../library/dis.rst:1637 msgid "``oparg == 2``: call :func:`repr` on *value*" msgstr "" -#: ../../library/dis.rst:1640 +#: ../../library/dis.rst:1638 msgid "``oparg == 3``: call :func:`ascii` on *value*" msgstr "" -#: ../../library/dis.rst:1642 ../../library/dis.rst:1655 -#: ../../library/dis.rst:1668 +#: ../../library/dis.rst:1640 ../../library/dis.rst:1653 +#: ../../library/dis.rst:1666 msgid "Used for implementing formatted literal strings (f-strings)." msgstr "" -#: ../../library/dis.rst:1649 +#: ../../library/dis.rst:1647 msgid "Formats the value on top of stack::" msgstr "" -#: ../../library/dis.rst:1651 +#: ../../library/dis.rst:1649 msgid "" "value = STACK.pop()\n" "result = value.__format__(\"\")\n" @@ -1857,11 +1859,11 @@ msgstr "" "result = value.__format__(\"\")\n" "STACK.append(result)" -#: ../../library/dis.rst:1661 +#: ../../library/dis.rst:1659 msgid "Formats the given value with the given format spec::" msgstr "" -#: ../../library/dis.rst:1663 +#: ../../library/dis.rst:1661 msgid "" "spec = STACK.pop()\n" "value = STACK.pop()\n" @@ -1873,14 +1875,14 @@ msgstr "" "result = value.__format__(spec)\n" "STACK.append(result)" -#: ../../library/dis.rst:1675 +#: ../../library/dis.rst:1673 msgid "" "``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the " "class being matched against, and ``STACK[-3]`` is the match subject. " "*count* is the number of positional sub-patterns." msgstr "" -#: ../../library/dis.rst:1679 +#: ../../library/dis.rst:1677 msgid "" "Pop ``STACK[-1]``, ``STACK[-2]``, and ``STACK[-3]``. If ``STACK[-3]`` is an " "instance of ``STACK[-2]`` and has the positional and keyword attributes " @@ -1888,219 +1890,219 @@ msgid "" "Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:1693 +#: ../../library/dis.rst:1691 msgid "A no-op. Performs internal tracing, debugging and optimization checks." msgstr "" -#: ../../library/dis.rst:1695 +#: ../../library/dis.rst:1693 msgid "" "The ``context`` oparand consists of two parts. The lowest two bits indicate " "where the ``RESUME`` occurs:" msgstr "" -#: ../../library/dis.rst:1698 +#: ../../library/dis.rst:1696 msgid "" "``0`` The start of a function, which is neither a generator, coroutine nor " "an async generator" msgstr "" -#: ../../library/dis.rst:1700 +#: ../../library/dis.rst:1698 msgid "``1`` After a ``yield`` expression" msgstr "" -#: ../../library/dis.rst:1701 +#: ../../library/dis.rst:1699 msgid "``2`` After a ``yield from`` expression" msgstr "" -#: ../../library/dis.rst:1702 +#: ../../library/dis.rst:1700 msgid "``3`` After an ``await`` expression" msgstr "" -#: ../../library/dis.rst:1704 +#: ../../library/dis.rst:1702 msgid "" "The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` " "otherwise." msgstr "" -#: ../../library/dis.rst:1709 +#: ../../library/dis.rst:1707 msgid "The oparg value changed to include information about except-depth" msgstr "" -#: ../../library/dis.rst:1715 +#: ../../library/dis.rst:1713 msgid "" "Create a generator, coroutine, or async generator from the current frame. " "Used as first opcode of in code object for the above mentioned callables. " "Clear the current frame and return the newly created generator." msgstr "" -#: ../../library/dis.rst:1724 +#: ../../library/dis.rst:1722 msgid "" "Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield " "from`` and ``await`` statements." msgstr "" -#: ../../library/dis.rst:1727 +#: ../../library/dis.rst:1725 msgid "" "If the call raises :exc:`StopIteration`, pop the top value from the stack, " "push the exception's ``value`` attribute, and increment the bytecode counter " "by *delta*." msgstr "" -#: ../../library/dis.rst:1736 +#: ../../library/dis.rst:1734 msgid "" "This is not really an opcode. It identifies the dividing line between " "opcodes in the range [0,255] which don't use their argument and those that " "do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." msgstr "" -#: ../../library/dis.rst:1740 +#: ../../library/dis.rst:1738 msgid "" "If your application uses pseudo instructions or specialized instructions, " "use the :data:`hasarg` collection instead." msgstr "" -#: ../../library/dis.rst:1743 +#: ../../library/dis.rst:1741 msgid "" "Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` " "ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." msgstr "" -#: ../../library/dis.rst:1747 +#: ../../library/dis.rst:1745 msgid "" "Pseudo instructions were added to the :mod:`dis` module, and for them it is " "not true that comparison with ``HAVE_ARGUMENT`` indicates whether they use " "their arg." msgstr "" -#: ../../library/dis.rst:1752 +#: ../../library/dis.rst:1750 msgid "Use :data:`hasarg` instead." msgstr "" -#: ../../library/dis.rst:1757 +#: ../../library/dis.rst:1755 msgid "" "Calls an intrinsic function with one argument. Passes ``STACK[-1]`` as the " "argument and sets ``STACK[-1]`` to the result. Used to implement " "functionality that is not performance critical." msgstr "" -#: ../../library/dis.rst:1761 ../../library/dis.rst:1815 +#: ../../library/dis.rst:1759 ../../library/dis.rst:1813 msgid "The operand determines which intrinsic function is called:" msgstr "" -#: ../../library/dis.rst:1764 ../../library/dis.rst:1818 +#: ../../library/dis.rst:1762 ../../library/dis.rst:1816 msgid "Operand" msgstr "運算元" -#: ../../library/dis.rst:1764 ../../library/dis.rst:1818 +#: ../../library/dis.rst:1762 ../../library/dis.rst:1816 msgid "Description" msgstr "描述" -#: ../../library/dis.rst:1766 +#: ../../library/dis.rst:1764 msgid "``INTRINSIC_1_INVALID``" msgstr "``INTRINSIC_1_INVALID``" -#: ../../library/dis.rst:1766 ../../library/dis.rst:1820 +#: ../../library/dis.rst:1764 ../../library/dis.rst:1818 msgid "Not valid" msgstr "" -#: ../../library/dis.rst:1768 +#: ../../library/dis.rst:1766 msgid "``INTRINSIC_PRINT``" msgstr "``INTRINSIC_PRINT``" -#: ../../library/dis.rst:1768 +#: ../../library/dis.rst:1766 msgid "Prints the argument to standard out. Used in the REPL." msgstr "" -#: ../../library/dis.rst:1771 +#: ../../library/dis.rst:1769 msgid "``INTRINSIC_IMPORT_STAR``" msgstr "``INTRINSIC_IMPORT_STAR``" -#: ../../library/dis.rst:1771 +#: ../../library/dis.rst:1769 msgid "Performs ``import *`` for the named module." msgstr "" -#: ../../library/dis.rst:1774 +#: ../../library/dis.rst:1772 msgid "``INTRINSIC_STOPITERATION_ERROR``" msgstr "``INTRINSIC_STOPITERATION_ERROR``" -#: ../../library/dis.rst:1774 +#: ../../library/dis.rst:1772 msgid "Extracts the return value from a ``StopIteration`` exception." msgstr "" -#: ../../library/dis.rst:1777 +#: ../../library/dis.rst:1775 msgid "``INTRINSIC_ASYNC_GEN_WRAP``" msgstr "``INTRINSIC_ASYNC_GEN_WRAP``" -#: ../../library/dis.rst:1777 +#: ../../library/dis.rst:1775 msgid "Wraps an async generator value" msgstr "" -#: ../../library/dis.rst:1779 +#: ../../library/dis.rst:1777 msgid "``INTRINSIC_UNARY_POSITIVE``" msgstr "``INTRINSIC_UNARY_POSITIVE``" -#: ../../library/dis.rst:1779 +#: ../../library/dis.rst:1777 msgid "Performs the unary ``+`` operation" msgstr "" -#: ../../library/dis.rst:1782 +#: ../../library/dis.rst:1780 msgid "``INTRINSIC_LIST_TO_TUPLE``" msgstr "``INTRINSIC_LIST_TO_TUPLE``" -#: ../../library/dis.rst:1782 +#: ../../library/dis.rst:1780 msgid "Converts a list to a tuple" msgstr "" -#: ../../library/dis.rst:1784 +#: ../../library/dis.rst:1782 msgid "``INTRINSIC_TYPEVAR``" msgstr "``INTRINSIC_TYPEVAR``" -#: ../../library/dis.rst:1784 +#: ../../library/dis.rst:1782 msgid "Creates a :class:`typing.TypeVar`" msgstr "" -#: ../../library/dis.rst:1786 +#: ../../library/dis.rst:1784 msgid "``INTRINSIC_PARAMSPEC``" msgstr "``INTRINSIC_PARAMSPEC``" -#: ../../library/dis.rst:1786 +#: ../../library/dis.rst:1784 msgid "Creates a :class:`typing.ParamSpec`" msgstr "" -#: ../../library/dis.rst:1789 +#: ../../library/dis.rst:1787 msgid "``INTRINSIC_TYPEVARTUPLE``" msgstr "``INTRINSIC_TYPEVARTUPLE``" -#: ../../library/dis.rst:1789 +#: ../../library/dis.rst:1787 msgid "Creates a :class:`typing.TypeVarTuple`" msgstr "" -#: ../../library/dis.rst:1792 +#: ../../library/dis.rst:1790 msgid "``INTRINSIC_SUBSCRIPT_GENERIC``" msgstr "``INTRINSIC_SUBSCRIPT_GENERIC``" -#: ../../library/dis.rst:1792 +#: ../../library/dis.rst:1790 msgid "Returns :class:`typing.Generic` subscripted with the argument" msgstr "" -#: ../../library/dis.rst:1795 +#: ../../library/dis.rst:1793 msgid "``INTRINSIC_TYPEALIAS``" msgstr "``INTRINSIC_TYPEALIAS``" -#: ../../library/dis.rst:1795 +#: ../../library/dis.rst:1793 msgid "" "Creates a :class:`typing.TypeAliasType`; used in the :keyword:`type` " "statement. The argument is a tuple of the type alias's name, type " "parameters, and value." msgstr "" -#: ../../library/dis.rst:1807 +#: ../../library/dis.rst:1805 msgid "" "Calls an intrinsic function with two arguments. Used to implement " "functionality that is not performance critical::" msgstr "" -#: ../../library/dis.rst:1810 +#: ../../library/dis.rst:1808 msgid "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" @@ -2112,61 +2114,61 @@ msgstr "" "result = intrinsic2(arg1, arg2)\n" "STACK.append(result)" -#: ../../library/dis.rst:1820 +#: ../../library/dis.rst:1818 msgid "``INTRINSIC_2_INVALID``" msgstr "``INTRINSIC_2_INVALID``" -#: ../../library/dis.rst:1822 +#: ../../library/dis.rst:1820 msgid "``INTRINSIC_PREP_RERAISE_STAR``" msgstr "``INTRINSIC_PREP_RERAISE_STAR``" -#: ../../library/dis.rst:1822 +#: ../../library/dis.rst:1820 msgid "Calculates the :exc:`ExceptionGroup` to raise from a ``try-except*``." msgstr "" -#: ../../library/dis.rst:1826 +#: ../../library/dis.rst:1824 msgid "``INTRINSIC_TYPEVAR_WITH_BOUND``" msgstr "``INTRINSIC_TYPEVAR_WITH_BOUND``" -#: ../../library/dis.rst:1826 +#: ../../library/dis.rst:1824 msgid "Creates a :class:`typing.TypeVar` with a bound." msgstr "" -#: ../../library/dis.rst:1829 +#: ../../library/dis.rst:1827 msgid "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" msgstr "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" -#: ../../library/dis.rst:1829 +#: ../../library/dis.rst:1827 msgid "Creates a :class:`typing.TypeVar` with constraints." msgstr "" -#: ../../library/dis.rst:1833 +#: ../../library/dis.rst:1831 msgid "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" msgstr "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" -#: ../../library/dis.rst:1833 +#: ../../library/dis.rst:1831 msgid "Sets the ``__type_params__`` attribute of a function." msgstr "" -#: ../../library/dis.rst:1840 +#: ../../library/dis.rst:1838 msgid "**Pseudo-instructions**" msgstr "" -#: ../../library/dis.rst:1842 +#: ../../library/dis.rst:1840 msgid "" "These opcodes do not appear in Python bytecode. They are used by the " "compiler but are replaced by real opcodes or removed before bytecode is " "generated." msgstr "" -#: ../../library/dis.rst:1847 +#: ../../library/dis.rst:1845 msgid "" "Set up an exception handler for the following code block. If an exception " "occurs, the value stack level is restored to its current state and control " "is transferred to the exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1854 +#: ../../library/dis.rst:1852 msgid "" "Like ``SETUP_FINALLY``, but in case of an exception also pushes the last " "instruction (``lasti``) to the stack so that ``RERAISE`` can restore it. If " @@ -2175,91 +2177,91 @@ msgid "" "exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1863 +#: ../../library/dis.rst:1861 msgid "" "Like ``SETUP_CLEANUP``, but in case of an exception one more item is popped " "from the stack before control is transferred to the exception handler at " "``target``." msgstr "" -#: ../../library/dis.rst:1867 +#: ../../library/dis.rst:1865 msgid "" "This variant is used in :keyword:`with` and :keyword:`async with` " "constructs, which push the return value of the context manager's :meth:" "`~object.__enter__` or :meth:`~object.__aenter__` to the stack." msgstr "" -#: ../../library/dis.rst:1874 +#: ../../library/dis.rst:1872 msgid "" "Marks the end of the code block associated with the last ``SETUP_FINALLY``, " "``SETUP_CLEANUP`` or ``SETUP_WITH``." msgstr "" -#: ../../library/dis.rst:1880 +#: ../../library/dis.rst:1878 msgid "" "Undirected relative jump instructions which are replaced by their directed " "(forward/backward) counterparts by the assembler." msgstr "" -#: ../../library/dis.rst:1885 +#: ../../library/dis.rst:1883 msgid "" "Pushes a reference to the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1888 +#: ../../library/dis.rst:1886 msgid "" "Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." msgstr "" -#: ../../library/dis.rst:1890 +#: ../../library/dis.rst:1888 msgid "This opcode is now a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1896 +#: ../../library/dis.rst:1894 msgid "" "Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode with a " "flag set in the arg." msgstr "" -#: ../../library/dis.rst:1903 +#: ../../library/dis.rst:1901 msgid "Opcode collections" msgstr "" -#: ../../library/dis.rst:1905 +#: ../../library/dis.rst:1903 msgid "" "These collections are provided for automatic introspection of bytecode " "instructions:" msgstr "" -#: ../../library/dis.rst:1908 +#: ../../library/dis.rst:1906 msgid "" "The collections now contain pseudo instructions and instrumented " "instructions as well. These are opcodes with values ``>= MIN_PSEUDO_OPCODE`` " "and ``>= MIN_INSTRUMENTED_OPCODE``." msgstr "" -#: ../../library/dis.rst:1915 +#: ../../library/dis.rst:1913 msgid "Sequence of operation names, indexable using the bytecode." msgstr "" -#: ../../library/dis.rst:1920 +#: ../../library/dis.rst:1918 msgid "Dictionary mapping operation names to bytecodes." msgstr "" -#: ../../library/dis.rst:1925 +#: ../../library/dis.rst:1923 msgid "Sequence of all compare operation names." msgstr "" -#: ../../library/dis.rst:1930 +#: ../../library/dis.rst:1928 msgid "Sequence of bytecodes that use their argument." msgstr "" -#: ../../library/dis.rst:1937 +#: ../../library/dis.rst:1935 msgid "Sequence of bytecodes that access a constant." msgstr "" -#: ../../library/dis.rst:1942 +#: ../../library/dis.rst:1940 msgid "" "Sequence of bytecodes that access a :term:`free (closure) variable `. 'free' in this context refers to names in the current scope that " @@ -2268,47 +2270,47 @@ msgid "" "scopes." msgstr "" -#: ../../library/dis.rst:1950 +#: ../../library/dis.rst:1948 msgid "Sequence of bytecodes that access an attribute by name." msgstr "" -#: ../../library/dis.rst:1955 +#: ../../library/dis.rst:1953 msgid "Sequence of bytecodes that have a jump target. All jumps are relative." msgstr "" -#: ../../library/dis.rst:1962 +#: ../../library/dis.rst:1960 msgid "Sequence of bytecodes that access a local variable." msgstr "" -#: ../../library/dis.rst:1967 +#: ../../library/dis.rst:1965 msgid "Sequence of bytecodes of Boolean operations." msgstr "" -#: ../../library/dis.rst:1971 +#: ../../library/dis.rst:1969 msgid "Sequence of bytecodes that set an exception handler." msgstr "" -#: ../../library/dis.rst:1978 +#: ../../library/dis.rst:1976 msgid "Sequence of bytecodes that have a relative jump target." msgstr "" -#: ../../library/dis.rst:1980 +#: ../../library/dis.rst:1978 msgid "All jumps are now relative. Use :data:`hasjump`." msgstr "" -#: ../../library/dis.rst:1986 +#: ../../library/dis.rst:1984 msgid "Sequence of bytecodes that have an absolute jump target." msgstr "" -#: ../../library/dis.rst:1988 +#: ../../library/dis.rst:1986 msgid "All jumps are now relative. This list is empty." msgstr "" -#: ../../library/dis.rst:1604 +#: ../../library/dis.rst:1602 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/dis.rst:1604 +#: ../../library/dis.rst:1602 msgid "slice" msgstr "slice(切片)" diff --git a/library/doctest.po b/library/doctest.po index fda2f389c6..fb18a89516 100644 --- a/library/doctest.po +++ b/library/doctest.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-17 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,7 +42,7 @@ msgstr "" msgid "" "To perform regression testing by verifying that interactive examples from a " "test file or a test object work as expected." -msgstr "" +msgstr "透過驗證測試檔案或測試物件中的互動式範例是否按預期運作來執行迴歸測試。" #: ../../library/doctest.rst:26 msgid "" @@ -166,7 +166,6 @@ msgid "And so on, eventually ending with:" msgstr "" #: ../../library/doctest.rst:116 -#, fuzzy msgid "" "Trying:\n" " factorial(1e100)\n" @@ -191,10 +190,10 @@ msgstr "" " OverflowError: n too large\n" "ok\n" "2 items passed all tests:\n" -" 1 tests in __main__\n" -" 8 tests in __main__.factorial\n" -"9 tests in 2 items.\n" -"9 passed and 0 failed.\n" +" 1 test in __main__\n" +" 6 tests in __main__.factorial\n" +"7 tests in 2 items.\n" +"7 passed.\n" "Test passed.\n" "$" @@ -273,39 +272,27 @@ msgstr "" #: ../../library/doctest.rst:176 msgid "" -"There is also a command line shortcut for running :func:`testmod`. You can " -"instruct the Python interpreter to run the doctest module directly from the " -"standard library and pass the module name(s) on the command line::" +"There is also a command line shortcut for running :func:`testmod`, see " +"section :ref:`doctest-cli`." msgstr "" -#: ../../library/doctest.rst:180 -msgid "python -m doctest -v example.py" -msgstr "python -m doctest -v example.py" - -#: ../../library/doctest.rst:182 -msgid "" -"This will import :file:`example.py` as a standalone module and run :func:" -"`testmod` on it. Note that this may not work correctly if the file is part " -"of a package and imports other submodules from that package." -msgstr "" - -#: ../../library/doctest.rst:186 +#: ../../library/doctest.rst:179 msgid "" "For more information on :func:`testmod`, see section :ref:`doctest-basic-" "api`." msgstr "" -#: ../../library/doctest.rst:192 +#: ../../library/doctest.rst:185 msgid "Simple Usage: Checking Examples in a Text File" msgstr "" -#: ../../library/doctest.rst:194 +#: ../../library/doctest.rst:187 msgid "" "Another simple application of doctest is testing interactive examples in a " "text file. This can be done with the :func:`testfile` function::" msgstr "" -#: ../../library/doctest.rst:197 +#: ../../library/doctest.rst:190 msgid "" "import doctest\n" "doctest.testfile(\"example.txt\")" @@ -313,7 +300,7 @@ msgstr "" "import doctest\n" "doctest.testfile(\"example.txt\")" -#: ../../library/doctest.rst:200 +#: ../../library/doctest.rst:193 msgid "" "That short script executes and verifies any interactive Python examples " "contained in the file :file:`example.txt`. The file content is treated as " @@ -321,7 +308,7 @@ msgid "" "Python program! For example, perhaps :file:`example.txt` contains this:" msgstr "" -#: ../../library/doctest.rst:205 +#: ../../library/doctest.rst:198 msgid "" "The ``example`` module\n" "======================\n" @@ -355,13 +342,13 @@ msgstr "" " >>> factorial(6)\n" " 120" -#: ../../library/doctest.rst:223 +#: ../../library/doctest.rst:216 msgid "" "Running ``doctest.testfile(\"example.txt\")`` then finds the error in this " "documentation::" msgstr "" -#: ../../library/doctest.rst:226 +#: ../../library/doctest.rst:219 msgid "" "File \"./example.txt\", line 14, in example.txt\n" "Failed example:\n" @@ -379,7 +366,7 @@ msgstr "" "Got:\n" " 720" -#: ../../library/doctest.rst:234 +#: ../../library/doctest.rst:227 msgid "" "As with :func:`testmod`, :func:`testfile` won't display anything unless an " "example fails. If an example does fail, then the failing example(s) and the " @@ -387,7 +374,7 @@ msgid "" "func:`testmod`." msgstr "" -#: ../../library/doctest.rst:239 +#: ../../library/doctest.rst:232 msgid "" "By default, :func:`testfile` looks for files in the calling module's " "directory. See section :ref:`doctest-basic-api` for a description of the " @@ -395,40 +382,79 @@ msgid "" "locations." msgstr "" -#: ../../library/doctest.rst:243 +#: ../../library/doctest.rst:236 msgid "" "Like :func:`testmod`, :func:`testfile`'s verbosity can be set with the ``-" "v`` command-line switch or with the optional keyword argument *verbose*." msgstr "" -#: ../../library/doctest.rst:247 +#: ../../library/doctest.rst:240 msgid "" -"There is also a command line shortcut for running :func:`testfile`. You can " -"instruct the Python interpreter to run the doctest module directly from the " -"standard library and pass the file name(s) on the command line::" +"There is also a command line shortcut for running :func:`testfile`, see " +"section :ref:`doctest-cli`." +msgstr "" + +#: ../../library/doctest.rst:243 +msgid "" +"For more information on :func:`testfile`, see section :ref:`doctest-basic-" +"api`." +msgstr "" + +#: ../../library/doctest.rst:249 +msgid "Command-line Usage" msgstr "" #: ../../library/doctest.rst:251 -msgid "python -m doctest -v example.txt" -msgstr "python -m doctest -v example.txt" +msgid "" +"The :mod:`doctest` module can be invoked as a script from the command line:" +msgstr "" #: ../../library/doctest.rst:253 +msgid "python -m doctest [-v] [-o OPTION] [-f] file [file ...]" +msgstr "" + +#: ../../library/doctest.rst:261 msgid "" -"Because the file name does not end with :file:`.py`, :mod:`doctest` infers " -"that it must be run with :func:`testfile`, not :func:`testmod`." +"Detailed report of all examples tried is printed to standard output, along " +"with assorted summaries at the end::" msgstr "" -#: ../../library/doctest.rst:256 +#: ../../library/doctest.rst:264 +msgid "python -m doctest -v example.py" +msgstr "python -m doctest -v example.py" + +#: ../../library/doctest.rst:266 msgid "" -"For more information on :func:`testfile`, see section :ref:`doctest-basic-" -"api`." +"This will import :file:`example.py` as a standalone module and run :func:" +"`testmod` on it. Note that this may not work correctly if the file is part " +"of a package and imports other submodules from that package." +msgstr "" + +#: ../../library/doctest.rst:270 +msgid "" +"If the file name does not end with :file:`.py`, :mod:`!doctest` infers that " +"it must be run with :func:`testfile` instead::" +msgstr "" + +#: ../../library/doctest.rst:273 +msgid "python -m doctest -v example.txt" +msgstr "python -m doctest -v example.txt" + +#: ../../library/doctest.rst:277 +msgid "" +"Option flags control various aspects of doctest's behavior, see section :ref:" +"`doctest-options`." +msgstr "" + +#: ../../library/doctest.rst:284 +msgid "This is shorthand for ``-o FAIL_FAST``." msgstr "" -#: ../../library/doctest.rst:262 +#: ../../library/doctest.rst:292 msgid "How It Works" msgstr "" -#: ../../library/doctest.rst:264 +#: ../../library/doctest.rst:294 msgid "" "This section examines in detail how doctest works: which docstrings it looks " "at, how it finds interactive examples, what execution context it uses, how " @@ -438,17 +464,17 @@ msgid "" "see the following sections." msgstr "" -#: ../../library/doctest.rst:275 +#: ../../library/doctest.rst:305 msgid "Which Docstrings Are Examined?" msgstr "" -#: ../../library/doctest.rst:277 +#: ../../library/doctest.rst:307 msgid "" "The module docstring, and all function, class and method docstrings are " "searched. Objects imported into the module are not searched." msgstr "" -#: ../../library/doctest.rst:280 +#: ../../library/doctest.rst:310 msgid "" "In addition, there are cases when you want tests to be part of a module but " "not part of the help text, which requires that the tests not be included in " @@ -461,11 +487,11 @@ msgid "" "__test__.K``." msgstr "" -#: ../../library/doctest.rst:289 +#: ../../library/doctest.rst:319 msgid "For example, place this block of code at the top of :file:`example.py`:" msgstr "" -#: ../../library/doctest.rst:291 +#: ../../library/doctest.rst:321 msgid "" "__test__ = {\n" " 'numbers': \"\"\"\n" @@ -487,7 +513,7 @@ msgstr "" "\"\"\"\n" "}" -#: ../../library/doctest.rst:303 +#: ../../library/doctest.rst:333 msgid "" "The value of ``example.__test__[\"numbers\"]`` will be treated as a " "docstring and all the tests inside it will be run. It is important to note " @@ -496,24 +522,24 @@ msgid "" "scanned for tests." msgstr "" -#: ../../library/doctest.rst:309 +#: ../../library/doctest.rst:339 msgid "" "Any classes found are recursively searched similarly, to test docstrings in " "their contained methods and nested classes." msgstr "" -#: ../../library/doctest.rst:316 +#: ../../library/doctest.rst:346 msgid "How are Docstring Examples Recognized?" msgstr "" -#: ../../library/doctest.rst:318 +#: ../../library/doctest.rst:348 msgid "" "In most cases a copy-and-paste of an interactive console session works fine, " "but doctest isn't trying to do an exact emulation of any specific Python " "shell." msgstr "" -#: ../../library/doctest.rst:323 +#: ../../library/doctest.rst:353 msgid "" ">>> # comments are ignored\n" ">>> x = 12\n" @@ -547,18 +573,18 @@ msgstr "" "NO!!!\n" ">>>" -#: ../../library/doctest.rst:343 +#: ../../library/doctest.rst:373 msgid "" "Any expected output must immediately follow the final ``'>>> '`` or ``'... " "'`` line containing the code, and the expected output (if any) extends to " "the next ``'>>> '`` or all-whitespace line." msgstr "" -#: ../../library/doctest.rst:347 +#: ../../library/doctest.rst:377 msgid "The fine print:" msgstr "" -#: ../../library/doctest.rst:349 +#: ../../library/doctest.rst:379 msgid "" "Expected output cannot contain an all-whitespace line, since such a line is " "taken to signal the end of expected output. If expected output does contain " @@ -566,7 +592,7 @@ msgid "" "line is expected." msgstr "" -#: ../../library/doctest.rst:354 +#: ../../library/doctest.rst:384 msgid "" "All hard tab characters are expanded to spaces, using 8-column tab stops. " "Tabs in output generated by the tested code are not modified. Because any " @@ -581,20 +607,20 @@ msgid "" "`DocTestParser` class." msgstr "" -#: ../../library/doctest.rst:366 +#: ../../library/doctest.rst:396 msgid "" "Output to stdout is captured, but not output to stderr (exception tracebacks " "are captured via a different means)." msgstr "" -#: ../../library/doctest.rst:369 +#: ../../library/doctest.rst:399 msgid "" "If you continue a line via backslashing in an interactive session, or for " "any other reason use a backslash, you should use a raw docstring, which will " "preserve your backslashes exactly as you type them::" msgstr "" -#: ../../library/doctest.rst:373 +#: ../../library/doctest.rst:403 msgid "" ">>> def f(x):\n" "... r'''Backslashes in a raw docstring: m\\n'''\n" @@ -603,7 +629,7 @@ msgid "" "Backslashes in a raw docstring: m\\n" msgstr "" -#: ../../library/doctest.rst:379 +#: ../../library/doctest.rst:409 msgid "" "Otherwise, the backslash will be interpreted as part of the string. For " "example, the ``\\n`` above would be interpreted as a newline character. " @@ -611,7 +637,7 @@ msgid "" "use a raw string)::" msgstr "" -#: ../../library/doctest.rst:383 +#: ../../library/doctest.rst:413 msgid "" ">>> def f(x):\n" "... '''Backslashes in a raw docstring: m\\\\n'''\n" @@ -620,11 +646,11 @@ msgid "" "Backslashes in a raw docstring: m\\n" msgstr "" -#: ../../library/doctest.rst:389 +#: ../../library/doctest.rst:419 msgid "The starting column doesn't matter::" msgstr "" -#: ../../library/doctest.rst:391 +#: ../../library/doctest.rst:421 msgid "" ">>> assert \"Easy!\"\n" " >>> import math\n" @@ -636,17 +662,17 @@ msgstr "" " >>> math.floor(1.9)\n" " 1" -#: ../../library/doctest.rst:396 +#: ../../library/doctest.rst:426 msgid "" "and as many leading whitespace characters are stripped from the expected " "output as appeared in the initial ``'>>> '`` line that started the example." msgstr "" -#: ../../library/doctest.rst:403 +#: ../../library/doctest.rst:433 msgid "What's the Execution Context?" msgstr "" -#: ../../library/doctest.rst:405 +#: ../../library/doctest.rst:435 msgid "" "By default, each time :mod:`doctest` finds a docstring to test, it uses a " "*shallow copy* of :mod:`!M`'s globals, so that running tests doesn't change " @@ -657,17 +683,17 @@ msgid "" "defined in other docstrings." msgstr "" -#: ../../library/doctest.rst:413 +#: ../../library/doctest.rst:443 msgid "" "You can force use of your own dict as the execution context by passing " "``globs=your_dict`` to :func:`testmod` or :func:`testfile` instead." msgstr "" -#: ../../library/doctest.rst:420 +#: ../../library/doctest.rst:450 msgid "What About Exceptions?" msgstr "" -#: ../../library/doctest.rst:422 +#: ../../library/doctest.rst:452 msgid "" "No problem, provided that the traceback is the only output produced by the " "example: just paste in the traceback. [#]_ Since tracebacks contain details " @@ -676,11 +702,11 @@ msgid "" "it accepts." msgstr "" -#: ../../library/doctest.rst:428 +#: ../../library/doctest.rst:458 msgid "Simple example::" msgstr "簡單範例: ::" -#: ../../library/doctest.rst:430 +#: ../../library/doctest.rst:460 msgid "" ">>> [1, 2, 3].remove(42)\n" "Traceback (most recent call last):\n" @@ -692,20 +718,20 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: list.remove(x): x not in list" -#: ../../library/doctest.rst:435 +#: ../../library/doctest.rst:465 msgid "" "That doctest succeeds if :exc:`ValueError` is raised, with the ``list." "remove(x): x not in list`` detail as shown." msgstr "" -#: ../../library/doctest.rst:438 +#: ../../library/doctest.rst:468 msgid "" "The expected output for an exception must start with a traceback header, " "which may be either of the following two lines, indented the same as the " "first line of the example::" msgstr "" -#: ../../library/doctest.rst:442 +#: ../../library/doctest.rst:472 msgid "" "Traceback (most recent call last):\n" "Traceback (innermost last):" @@ -713,14 +739,14 @@ msgstr "" "Traceback (most recent call last):\n" "Traceback (innermost last):" -#: ../../library/doctest.rst:445 +#: ../../library/doctest.rst:475 msgid "" "The traceback header is followed by an optional traceback stack, whose " "contents are ignored by doctest. The traceback stack is typically omitted, " "or copied verbatim from an interactive session." msgstr "" -#: ../../library/doctest.rst:449 +#: ../../library/doctest.rst:479 msgid "" "The traceback stack is followed by the most interesting part: the line(s) " "containing the exception type and detail. This is usually the last line of " @@ -728,7 +754,7 @@ msgid "" "multi-line detail::" msgstr "" -#: ../../library/doctest.rst:454 +#: ../../library/doctest.rst:484 msgid "" ">>> raise ValueError('multi\\n line\\ndetail')\n" "Traceback (most recent call last):\n" @@ -737,21 +763,27 @@ msgid "" " line\n" "detail" msgstr "" +">>> raise ValueError('multi\\n line\\ndetail')\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: multi\n" +" line\n" +"detail" -#: ../../library/doctest.rst:461 +#: ../../library/doctest.rst:491 msgid "" "The last three lines (starting with :exc:`ValueError`) are compared against " "the exception's type and detail, and the rest are ignored." msgstr "" -#: ../../library/doctest.rst:464 +#: ../../library/doctest.rst:494 msgid "" "Best practice is to omit the traceback stack, unless it adds significant " "documentation value to the example. So the last example is probably better " "as::" msgstr "" -#: ../../library/doctest.rst:467 +#: ../../library/doctest.rst:497 msgid "" ">>> raise ValueError('multi\\n line\\ndetail')\n" "Traceback (most recent call last):\n" @@ -760,8 +792,14 @@ msgid "" " line\n" "detail" msgstr "" +">>> raise ValueError('multi\\n line\\ndetail')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: multi\n" +" line\n" +"detail" -#: ../../library/doctest.rst:474 +#: ../../library/doctest.rst:504 msgid "" "Note that tracebacks are treated very specially. In particular, in the " "rewritten example, the use of ``...`` is independent of doctest's :const:" @@ -770,11 +808,11 @@ msgid "" "transcript of a Monty Python skit." msgstr "" -#: ../../library/doctest.rst:480 +#: ../../library/doctest.rst:510 msgid "Some details you should read once, but won't need to remember:" msgstr "" -#: ../../library/doctest.rst:482 +#: ../../library/doctest.rst:512 msgid "" "Doctest can't guess whether your expected output came from an exception " "traceback or from ordinary printing. So, e.g., an example that expects " @@ -784,7 +822,7 @@ msgid "" "create real problems." msgstr "" -#: ../../library/doctest.rst:489 +#: ../../library/doctest.rst:519 msgid "" "Each line of the traceback stack (if present) must be indented further than " "the first line of the example, *or* start with a non-alphanumeric character. " @@ -793,14 +831,14 @@ msgid "" "course this does the right thing for genuine tracebacks." msgstr "" -#: ../../library/doctest.rst:495 +#: ../../library/doctest.rst:525 msgid "" "When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified, " "everything following the leftmost colon and any module information in the " "exception name is ignored." msgstr "" -#: ../../library/doctest.rst:499 +#: ../../library/doctest.rst:529 msgid "" "The interactive shell omits the traceback header line for some :exc:" "`SyntaxError`\\ s. But doctest uses the traceback header line to " @@ -809,13 +847,13 @@ msgid "" "need to manually add the traceback header line to your test example." msgstr "" -#: ../../library/doctest.rst:507 +#: ../../library/doctest.rst:537 msgid "" "For some exceptions, Python displays the position of the error using ``^`` " "markers and tildes::" msgstr "" -#: ../../library/doctest.rst:510 +#: ../../library/doctest.rst:540 msgid "" ">>> 1 + None\n" " File \"\", line 1\n" @@ -829,7 +867,7 @@ msgstr "" " ~~^~~~~~\n" "TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" -#: ../../library/doctest.rst:516 +#: ../../library/doctest.rst:546 msgid "" "Since the lines showing the position of the error come before the exception " "type and detail, they are not checked by doctest. For example, the " @@ -837,7 +875,7 @@ msgid "" "location::" msgstr "" -#: ../../library/doctest.rst:520 +#: ../../library/doctest.rst:550 msgid "" ">>> 1 + None\n" " File \"\", line 1\n" @@ -851,11 +889,11 @@ msgstr "" " ^~~~~~~~\n" "TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" -#: ../../library/doctest.rst:531 +#: ../../library/doctest.rst:561 msgid "Option Flags" msgstr "可選旗標" -#: ../../library/doctest.rst:533 +#: ../../library/doctest.rst:563 msgid "" "A number of option flags control various aspects of doctest's behavior. " "Symbolic names for the flags are supplied as module constants, which can be :" @@ -865,17 +903,13 @@ msgid "" "option." msgstr "" -#: ../../library/doctest.rst:539 -msgid "The ``-o`` command line option." -msgstr "" - -#: ../../library/doctest.rst:542 +#: ../../library/doctest.rst:569 msgid "" "The first group of options define test semantics, controlling aspects of how " "doctest decides whether actual output matches an example's expected output:" msgstr "" -#: ../../library/doctest.rst:548 +#: ../../library/doctest.rst:575 msgid "" "By default, if an expected output block contains just ``1``, an actual " "output block containing just ``1`` or just ``True`` is considered to be a " @@ -887,7 +921,7 @@ msgid "" "not for several years." msgstr "" -#: ../../library/doctest.rst:560 +#: ../../library/doctest.rst:587 msgid "" "By default, if an expected output block contains a line containing only the " "string ````, then that line will match a blank line in the actual " @@ -896,7 +930,7 @@ msgid "" "`DONT_ACCEPT_BLANKLINE` is specified, this substitution is not allowed." msgstr "" -#: ../../library/doctest.rst:569 +#: ../../library/doctest.rst:596 msgid "" "When specified, all sequences of whitespace (blanks and newlines) are " "treated as equal. Any sequence of whitespace within the expected output " @@ -906,7 +940,7 @@ msgid "" "across multiple lines in your source." msgstr "" -#: ../../library/doctest.rst:580 +#: ../../library/doctest.rst:607 msgid "" "When specified, an ellipsis marker (``...``) in the expected output can " "match any substring in the actual output. This includes substrings that " @@ -915,14 +949,14 @@ msgid "" "matched too much!\" surprises that ``.*`` is prone to in regular expressions." msgstr "" -#: ../../library/doctest.rst:589 +#: ../../library/doctest.rst:616 msgid "" "When specified, doctests expecting exceptions pass so long as an exception " "of the expected type is raised, even if the details (message and fully " "qualified exception name) don't match." msgstr "" -#: ../../library/doctest.rst:593 +#: ../../library/doctest.rst:620 msgid "" "For example, an example expecting ``ValueError: 42`` will pass if the actual " "exception raised is ``ValueError: 3*14``, but will fail if, say, a :exc:" @@ -932,7 +966,7 @@ msgid "" "these variations will work with the flag specified:" msgstr "" -#: ../../library/doctest.rst:601 +#: ../../library/doctest.rst:628 msgid "" ">>> raise Exception('message')\n" "Traceback (most recent call last):\n" @@ -958,20 +992,20 @@ msgstr "" "Traceback (most recent call last):\n" "__main__.Exception: message" -#: ../../library/doctest.rst:615 +#: ../../library/doctest.rst:642 msgid "" "Note that :const:`ELLIPSIS` can also be used to ignore the details of the " "exception message, but such a test may still fail based on whether the " "module name is present or matches exactly." msgstr "" -#: ../../library/doctest.rst:619 +#: ../../library/doctest.rst:646 msgid "" ":const:`IGNORE_EXCEPTION_DETAIL` now also ignores any information relating " "to the module containing the exception under test." msgstr "" -#: ../../library/doctest.rst:626 +#: ../../library/doctest.rst:653 msgid "" "When specified, do not run the example at all. This can be useful in " "contexts where doctest examples serve as both documentation and test cases, " @@ -980,32 +1014,32 @@ msgid "" "might depend on resources which would be unavailable to the test driver." msgstr "" -#: ../../library/doctest.rst:632 +#: ../../library/doctest.rst:659 msgid "" "The SKIP flag can also be used for temporarily \"commenting out\" examples." msgstr "" -#: ../../library/doctest.rst:637 +#: ../../library/doctest.rst:664 msgid "A bitmask or'ing together all the comparison flags above." msgstr "" -#: ../../library/doctest.rst:639 +#: ../../library/doctest.rst:666 msgid "The second group of options controls how test failures are reported:" msgstr "" -#: ../../library/doctest.rst:644 +#: ../../library/doctest.rst:671 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "are displayed using a unified diff." msgstr "" -#: ../../library/doctest.rst:650 +#: ../../library/doctest.rst:677 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "will be displayed using a context diff." msgstr "" -#: ../../library/doctest.rst:656 +#: ../../library/doctest.rst:683 msgid "" "When specified, differences are computed by ``difflib.Differ``, using the " "same algorithm as the popular :file:`ndiff.py` utility. This is the only " @@ -1015,7 +1049,7 @@ msgid "" "mismatching column positions." msgstr "" -#: ../../library/doctest.rst:665 +#: ../../library/doctest.rst:692 msgid "" "When specified, display the first failing example in each doctest, but " "suppress output for all remaining examples. This will prevent doctest from " @@ -1026,7 +1060,7 @@ msgid "" "of failures reported; only the output is suppressed." msgstr "" -#: ../../library/doctest.rst:676 +#: ../../library/doctest.rst:703 msgid "" "When specified, exit after the first failing example and don't attempt to " "run the remaining examples. Thus, the number of failures reported will be at " @@ -1034,23 +1068,17 @@ msgid "" "first failure won't even produce debugging output." msgstr "" -#: ../../library/doctest.rst:681 -msgid "" -"The doctest command line accepts the option ``-f`` as a shorthand for ``-o " -"FAIL_FAST``." -msgstr "" - -#: ../../library/doctest.rst:689 +#: ../../library/doctest.rst:711 msgid "A bitmask or'ing together all the reporting flags above." msgstr "" -#: ../../library/doctest.rst:692 +#: ../../library/doctest.rst:714 msgid "" "There is also a way to register new option flag names, though this isn't " "useful unless you intend to extend :mod:`doctest` internals via subclassing:" msgstr "" -#: ../../library/doctest.rst:698 +#: ../../library/doctest.rst:720 msgid "" "Create a new option flag with a given name, and return the new flag's " "integer value. :func:`register_optionflag` can be used when subclassing :" @@ -1059,39 +1087,39 @@ msgid "" "be called using the following idiom::" msgstr "" -#: ../../library/doctest.rst:704 +#: ../../library/doctest.rst:726 msgid "MY_FLAG = register_optionflag('MY_FLAG')" msgstr "MY_FLAG = register_optionflag('MY_FLAG')" -#: ../../library/doctest.rst:714 +#: ../../library/doctest.rst:736 msgid "Directives" msgstr "" -#: ../../library/doctest.rst:716 +#: ../../library/doctest.rst:738 msgid "" "Doctest directives may be used to modify the :ref:`option flags ` for an individual example. Doctest directives are special Python " "comments following an example's source code:" msgstr "" -#: ../../library/doctest.rst:727 +#: ../../library/doctest.rst:749 msgid "" "Whitespace is not allowed between the ``+`` or ``-`` and the directive " "option name. The directive option name can be any of the option flag names " "explained above." msgstr "" -#: ../../library/doctest.rst:731 +#: ../../library/doctest.rst:753 msgid "" "An example's doctest directives modify doctest's behavior for that single " "example. Use ``+`` to enable the named behavior, or ``-`` to disable it." msgstr "" -#: ../../library/doctest.rst:734 +#: ../../library/doctest.rst:756 msgid "For example, this test passes:" msgstr "" -#: ../../library/doctest.rst:736 +#: ../../library/doctest.rst:758 msgid "" ">>> print(list(range(20))) # doctest: +NORMALIZE_WHITESPACE\n" "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,\n" @@ -1101,7 +1129,7 @@ msgstr "" "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,\n" "10, 11, 12, 13, 14, 15, 16, 17, 18, 19]" -#: ../../library/doctest.rst:743 +#: ../../library/doctest.rst:765 msgid "" "Without the directive it would fail, both because the actual output doesn't " "have two blanks before the single-digit list elements, and because the " @@ -1109,7 +1137,7 @@ msgid "" "a directive to do so:" msgstr "" -#: ../../library/doctest.rst:748 +#: ../../library/doctest.rst:770 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "[0, 1, ..., 18, 19]" @@ -1117,13 +1145,13 @@ msgstr "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "[0, 1, ..., 18, 19]" -#: ../../library/doctest.rst:754 +#: ../../library/doctest.rst:776 msgid "" "Multiple directives can be used on a single physical line, separated by " "commas:" msgstr "" -#: ../../library/doctest.rst:757 +#: ../../library/doctest.rst:779 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" @@ -1131,13 +1159,13 @@ msgstr "" ">>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" -#: ../../library/doctest.rst:763 +#: ../../library/doctest.rst:785 msgid "" "If multiple directive comments are used for a single example, then they are " "combined:" msgstr "" -#: ../../library/doctest.rst:766 +#: ../../library/doctest.rst:788 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "... # doctest: +NORMALIZE_WHITESPACE\n" @@ -1147,14 +1175,14 @@ msgstr "" "... # doctest: +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" -#: ../../library/doctest.rst:773 +#: ../../library/doctest.rst:795 msgid "" "As the previous example shows, you can add ``...`` lines to your example " "containing only directives. This can be useful when an example is too long " "for a directive to comfortably fit on the same line:" msgstr "" -#: ../../library/doctest.rst:777 +#: ../../library/doctest.rst:799 msgid "" ">>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40)))\n" "... # doctest: +ELLIPSIS\n" @@ -1164,7 +1192,7 @@ msgstr "" "... # doctest: +ELLIPSIS\n" "[0, ..., 4, 10, ..., 19, 30, ..., 39]" -#: ../../library/doctest.rst:784 +#: ../../library/doctest.rst:806 msgid "" "Note that since all options are disabled by default, and directives apply " "only to the example they appear in, enabling options (via ``+`` in a " @@ -1174,11 +1202,11 @@ msgid "" "be useful." msgstr "" -#: ../../library/doctest.rst:794 +#: ../../library/doctest.rst:816 msgid "Warnings" msgstr "警告" -#: ../../library/doctest.rst:796 +#: ../../library/doctest.rst:818 msgid "" ":mod:`doctest` is serious about requiring exact matches in expected output. " "If even a single character doesn't match, the test fails. This will " @@ -1188,7 +1216,7 @@ msgid "" "test like ::" msgstr "" -#: ../../library/doctest.rst:802 +#: ../../library/doctest.rst:824 msgid "" ">>> foo()\n" "{\"spam\", \"eggs\"}" @@ -1196,11 +1224,11 @@ msgstr "" ">>> foo()\n" "{\"spam\", \"eggs\"}" -#: ../../library/doctest.rst:805 +#: ../../library/doctest.rst:827 msgid "is vulnerable! One workaround is to do ::" msgstr "" -#: ../../library/doctest.rst:807 +#: ../../library/doctest.rst:829 msgid "" ">>> foo() == {\"spam\", \"eggs\"}\n" "True" @@ -1208,11 +1236,11 @@ msgstr "" ">>> foo() == {\"spam\", \"eggs\"}\n" "True" -#: ../../library/doctest.rst:810 +#: ../../library/doctest.rst:832 msgid "instead. Another is to do ::" msgstr "" -#: ../../library/doctest.rst:812 +#: ../../library/doctest.rst:834 msgid "" ">>> d = sorted(foo())\n" ">>> d\n" @@ -1222,29 +1250,29 @@ msgstr "" ">>> d\n" "['eggs', 'spam']" -#: ../../library/doctest.rst:816 +#: ../../library/doctest.rst:838 msgid "There are others, but you get the idea." msgstr "" -#: ../../library/doctest.rst:818 +#: ../../library/doctest.rst:840 msgid "Another bad idea is to print things that embed an object address, like" msgstr "" -#: ../../library/doctest.rst:820 +#: ../../library/doctest.rst:842 msgid "" -">>> id(1.0) # certain to fail some of the time \n" +">>> id(1.0) # certain to fail some of the time\n" "7948648\n" ">>> class C: pass\n" -">>> C() # the default repr() for instances embeds an address \n" +">>> C() # the default repr() for instances embeds an address\n" "" msgstr "" -#: ../../library/doctest.rst:828 +#: ../../library/doctest.rst:850 msgid "" "The :const:`ELLIPSIS` directive gives a nice approach for the last example:" msgstr "" -#: ../../library/doctest.rst:830 +#: ../../library/doctest.rst:852 msgid "" ">>> C() # doctest: +ELLIPSIS\n" "" @@ -1252,14 +1280,14 @@ msgstr "" ">>> C() # doctest: +ELLIPSIS\n" "" -#: ../../library/doctest.rst:836 +#: ../../library/doctest.rst:858 msgid "" "Floating-point numbers are also subject to small output variations across " "platforms, because Python defers to the platform C library for float " "formatting, and C libraries vary widely in quality here. ::" msgstr "" -#: ../../library/doctest.rst:840 +#: ../../library/doctest.rst:862 msgid "" ">>> 1./7 # risky\n" "0.14285714285714285\n" @@ -1269,29 +1297,29 @@ msgid "" "0.142857" msgstr "" -#: ../../library/doctest.rst:847 +#: ../../library/doctest.rst:869 msgid "" "Numbers of the form ``I/2.**J`` are safe across all platforms, and I often " "contrive doctest examples to produce numbers of that form::" msgstr "" -#: ../../library/doctest.rst:850 +#: ../../library/doctest.rst:872 msgid "" ">>> 3./4 # utterly safe\n" "0.75" msgstr "" -#: ../../library/doctest.rst:853 +#: ../../library/doctest.rst:875 msgid "" "Simple fractions are also easier for people to understand, and that makes " "for better documentation." msgstr "" -#: ../../library/doctest.rst:860 +#: ../../library/doctest.rst:882 msgid "Basic API" msgstr "基礎 API" -#: ../../library/doctest.rst:862 +#: ../../library/doctest.rst:884 msgid "" "The functions :func:`testmod` and :func:`testfile` provide a simple " "interface to doctest that should be sufficient for most basic uses. For a " @@ -1299,25 +1327,25 @@ msgid "" "simple-testmod` and :ref:`doctest-simple-testfile`." msgstr "" -#: ../../library/doctest.rst:870 +#: ../../library/doctest.rst:892 msgid "" "All arguments except *filename* are optional, and should be specified in " "keyword form." msgstr "" -#: ../../library/doctest.rst:873 +#: ../../library/doctest.rst:895 msgid "" "Test examples in the file named *filename*. Return ``(failure_count, " "test_count)``." msgstr "" -#: ../../library/doctest.rst:876 +#: ../../library/doctest.rst:898 msgid "" "Optional argument *module_relative* specifies how the filename should be " "interpreted:" msgstr "" -#: ../../library/doctest.rst:879 +#: ../../library/doctest.rst:901 msgid "" "If *module_relative* is ``True`` (the default), then *filename* specifies an " "OS-independent module-relative path. By default, this path is relative to " @@ -1327,20 +1355,20 @@ msgid "" "absolute path (i.e., it may not begin with ``/``)." msgstr "" -#: ../../library/doctest.rst:886 +#: ../../library/doctest.rst:908 msgid "" "If *module_relative* is ``False``, then *filename* specifies an OS-specific " "path. The path may be absolute or relative; relative paths are resolved " "with respect to the current working directory." msgstr "" -#: ../../library/doctest.rst:890 +#: ../../library/doctest.rst:912 msgid "" "Optional argument *name* gives the name of the test; by default, or if " "``None``, ``os.path.basename(filename)`` is used." msgstr "" -#: ../../library/doctest.rst:893 +#: ../../library/doctest.rst:915 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for a module-" @@ -1349,7 +1377,7 @@ msgid "" "is an error to specify *package* if *module_relative* is ``False``." msgstr "" -#: ../../library/doctest.rst:899 +#: ../../library/doctest.rst:921 msgid "" "Optional argument *globs* gives a dict to be used as the globals when " "executing examples. A new shallow copy of this dict is created for the " @@ -1357,7 +1385,7 @@ msgid "" "``None``, a new empty dict is used." msgstr "" -#: ../../library/doctest.rst:904 +#: ../../library/doctest.rst:926 msgid "" "Optional argument *extraglobs* gives a dict merged into the globals used to " "execute examples. This works like :meth:`dict.update`: if *globs* and " @@ -1370,27 +1398,27 @@ msgid "" "tested." msgstr "" -#: ../../library/doctest.rst:913 +#: ../../library/doctest.rst:935 msgid "" "Optional argument *verbose* prints lots of stuff if true, and prints only " "failures if false; by default, or if ``None``, it's true if and only if ``'-" "v'`` is in ``sys.argv``." msgstr "" -#: ../../library/doctest.rst:917 +#: ../../library/doctest.rst:939 msgid "" "Optional argument *report* prints a summary at the end when true, else " "prints nothing at the end. In verbose mode, the summary is detailed, else " "the summary is very brief (in fact, empty if all tests passed)." msgstr "" -#: ../../library/doctest.rst:921 +#: ../../library/doctest.rst:943 msgid "" "Optional argument *optionflags* (default value 0) takes the :ref:`bitwise OR " "` of option flags. See section :ref:`doctest-options`." msgstr "" -#: ../../library/doctest.rst:925 +#: ../../library/doctest.rst:947 msgid "" "Optional argument *raise_on_error* defaults to false. If true, an exception " "is raised upon the first failure or unexpected exception in an example. " @@ -1398,33 +1426,33 @@ msgid "" "continue running examples." msgstr "" -#: ../../library/doctest.rst:930 ../../library/doctest.rst:1072 +#: ../../library/doctest.rst:952 ../../library/doctest.rst:1094 msgid "" "Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) " "that should be used to extract tests from the files. It defaults to a " "normal parser (i.e., ``DocTestParser()``)." msgstr "" -#: ../../library/doctest.rst:934 ../../library/doctest.rst:1076 +#: ../../library/doctest.rst:956 ../../library/doctest.rst:1098 msgid "" "Optional argument *encoding* specifies an encoding that should be used to " "convert the file to unicode." msgstr "" -#: ../../library/doctest.rst:940 +#: ../../library/doctest.rst:962 msgid "" "All arguments are optional, and all except for *m* should be specified in " "keyword form." msgstr "" -#: ../../library/doctest.rst:943 +#: ../../library/doctest.rst:965 msgid "" "Test examples in docstrings in functions and classes reachable from module " "*m* (or module :mod:`__main__` if *m* is not supplied or is ``None``), " "starting with ``m.__doc__``." msgstr "" -#: ../../library/doctest.rst:947 +#: ../../library/doctest.rst:969 msgid "" "Also test examples reachable from dict ``m.__test__``, if it exists. ``m." "__test__`` maps names (strings) to functions, classes and strings; function " @@ -1432,22 +1460,22 @@ msgid "" "directly, as if they were docstrings." msgstr "" -#: ../../library/doctest.rst:952 +#: ../../library/doctest.rst:974 msgid "" "Only docstrings attached to objects belonging to module *m* are searched." msgstr "" -#: ../../library/doctest.rst:954 +#: ../../library/doctest.rst:976 msgid "Return ``(failure_count, test_count)``." msgstr "" -#: ../../library/doctest.rst:956 +#: ../../library/doctest.rst:978 msgid "" "Optional argument *name* gives the name of the module; by default, or if " "``None``, ``m.__name__`` is used." msgstr "" -#: ../../library/doctest.rst:959 +#: ../../library/doctest.rst:981 msgid "" "Optional argument *exclude_empty* defaults to false. If true, objects for " "which no doctests are found are excluded from consideration. The default is " @@ -1458,39 +1486,39 @@ msgid "" "defaults to true." msgstr "" -#: ../../library/doctest.rst:967 +#: ../../library/doctest.rst:989 msgid "" "Optional arguments *extraglobs*, *verbose*, *report*, *optionflags*, " "*raise_on_error*, and *globs* are the same as for function :func:`testfile` " "above, except that *globs* defaults to ``m.__dict__``." msgstr "" -#: ../../library/doctest.rst:974 +#: ../../library/doctest.rst:996 msgid "" "Test examples associated with object *f*; for example, *f* may be a string, " "a module, a function, or a class object." msgstr "" -#: ../../library/doctest.rst:977 +#: ../../library/doctest.rst:999 msgid "" "A shallow copy of dictionary argument *globs* is used for the execution " "context." msgstr "" -#: ../../library/doctest.rst:979 +#: ../../library/doctest.rst:1001 msgid "" "Optional argument *name* is used in failure messages, and defaults to " "``\"NoName\"``." msgstr "" -#: ../../library/doctest.rst:982 +#: ../../library/doctest.rst:1004 msgid "" "If optional argument *verbose* is true, output is generated even if there " "are no failures. By default, output is generated only in case of an example " "failure." msgstr "" -#: ../../library/doctest.rst:985 +#: ../../library/doctest.rst:1007 msgid "" "Optional argument *compileflags* gives the set of flags that should be used " "by the Python compiler when running the examples. By default, or if " @@ -1498,16 +1526,16 @@ msgid "" "found in *globs*." msgstr "" -#: ../../library/doctest.rst:989 +#: ../../library/doctest.rst:1011 msgid "" "Optional argument *optionflags* works as for function :func:`testfile` above." msgstr "" -#: ../../library/doctest.rst:995 +#: ../../library/doctest.rst:1017 msgid "Unittest API" msgstr "" -#: ../../library/doctest.rst:997 +#: ../../library/doctest.rst:1019 msgid "" "As your collection of doctest'ed modules grows, you'll want a way to run all " "their doctests systematically. :mod:`doctest` provides two functions that " @@ -1517,7 +1545,7 @@ msgid "" "your test module::" msgstr "" -#: ../../library/doctest.rst:1003 +#: ../../library/doctest.rst:1025 msgid "" "import unittest\n" "import doctest\n" @@ -1535,19 +1563,19 @@ msgstr "" " tests.addTests(doctest.DocTestSuite(my_module_with_doctests))\n" " return tests" -#: ../../library/doctest.rst:1011 +#: ../../library/doctest.rst:1033 msgid "" "There are two main functions for creating :class:`unittest.TestSuite` " "instances from text files and modules with doctests:" msgstr "" -#: ../../library/doctest.rst:1017 +#: ../../library/doctest.rst:1039 msgid "" "Convert doctest tests from one or more text files to a :class:`unittest." "TestSuite`." msgstr "" -#: ../../library/doctest.rst:1020 +#: ../../library/doctest.rst:1042 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs the interactive examples in each file. If an example in " @@ -1558,21 +1586,21 @@ msgid "" "marked as skipped." msgstr "" -#: ../../library/doctest.rst:1027 +#: ../../library/doctest.rst:1049 msgid "Pass one or more paths (as strings) to text files to be examined." msgstr "" -#: ../../library/doctest.rst:1029 +#: ../../library/doctest.rst:1051 msgid "Options may be provided as keyword arguments:" msgstr "" -#: ../../library/doctest.rst:1031 +#: ../../library/doctest.rst:1053 msgid "" "Optional argument *module_relative* specifies how the filenames in *paths* " "should be interpreted:" msgstr "" -#: ../../library/doctest.rst:1034 +#: ../../library/doctest.rst:1056 msgid "" "If *module_relative* is ``True`` (the default), then each filename in " "*paths* specifies an OS-independent module-relative path. By default, this " @@ -1583,14 +1611,14 @@ msgid "" "``)." msgstr "" -#: ../../library/doctest.rst:1042 +#: ../../library/doctest.rst:1064 msgid "" "If *module_relative* is ``False``, then each filename in *paths* specifies " "an OS-specific path. The path may be absolute or relative; relative paths " "are resolved with respect to the current working directory." msgstr "" -#: ../../library/doctest.rst:1046 +#: ../../library/doctest.rst:1068 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for module-" @@ -1600,7 +1628,7 @@ msgid "" "``False``." msgstr "" -#: ../../library/doctest.rst:1053 +#: ../../library/doctest.rst:1075 msgid "" "Optional argument *setUp* specifies a set-up function for the test suite. " "This is called before running the tests in each file. The *setUp* function " @@ -1608,7 +1636,7 @@ msgid "" "test globals as the *globs* attribute of the test passed." msgstr "" -#: ../../library/doctest.rst:1058 +#: ../../library/doctest.rst:1080 msgid "" "Optional argument *tearDown* specifies a tear-down function for the test " "suite. This is called after running the tests in each file. The *tearDown* " @@ -1616,14 +1644,14 @@ msgid "" "access the test globals as the *globs* attribute of the test passed." msgstr "" -#: ../../library/doctest.rst:1063 ../../library/doctest.rst:1098 +#: ../../library/doctest.rst:1085 ../../library/doctest.rst:1120 msgid "" "Optional argument *globs* is a dictionary containing the initial global " "variables for the tests. A new copy of this dictionary is created for each " "test. By default, *globs* is a new empty dictionary." msgstr "" -#: ../../library/doctest.rst:1067 +#: ../../library/doctest.rst:1089 msgid "" "Optional argument *optionflags* specifies the default doctest options for " "the tests, created by or-ing together individual option flags. See section :" @@ -1631,17 +1659,17 @@ msgid "" "for a better way to set reporting options." msgstr "" -#: ../../library/doctest.rst:1079 +#: ../../library/doctest.rst:1101 msgid "" "The global ``__file__`` is added to the globals provided to doctests loaded " "from a text file using :func:`DocFileSuite`." msgstr "" -#: ../../library/doctest.rst:1085 +#: ../../library/doctest.rst:1107 msgid "Convert doctest tests for a module to a :class:`unittest.TestSuite`." msgstr "" -#: ../../library/doctest.rst:1087 +#: ../../library/doctest.rst:1109 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs each doctest in the module. If any of the doctests fail, " @@ -1651,42 +1679,42 @@ msgid "" "skipped, then the synthesized unit test is also marked as skipped." msgstr "" -#: ../../library/doctest.rst:1094 +#: ../../library/doctest.rst:1116 msgid "" "Optional argument *module* provides the module to be tested. It can be a " "module object or a (possibly dotted) module name. If not specified, the " "module calling this function is used." msgstr "" -#: ../../library/doctest.rst:1102 +#: ../../library/doctest.rst:1124 msgid "" "Optional argument *extraglobs* specifies an extra set of global variables, " "which is merged into *globs*. By default, no extra globals are used." msgstr "" -#: ../../library/doctest.rst:1105 +#: ../../library/doctest.rst:1127 msgid "" "Optional argument *test_finder* is the :class:`DocTestFinder` object (or a " "drop-in replacement) that is used to extract doctests from the module." msgstr "" -#: ../../library/doctest.rst:1108 +#: ../../library/doctest.rst:1130 msgid "" "Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as " "for function :func:`DocFileSuite` above." msgstr "" -#: ../../library/doctest.rst:1111 +#: ../../library/doctest.rst:1133 msgid "This function uses the same search technique as :func:`testmod`." msgstr "" -#: ../../library/doctest.rst:1113 +#: ../../library/doctest.rst:1135 msgid "" ":func:`DocTestSuite` returns an empty :class:`unittest.TestSuite` if " "*module* contains no docstrings instead of raising :exc:`ValueError`." msgstr "" -#: ../../library/doctest.rst:1119 +#: ../../library/doctest.rst:1141 msgid "" "When doctests which have been converted to unit tests by :func:" "`DocFileSuite` or :func:`DocTestSuite` fail, this exception is raised " @@ -1694,7 +1722,7 @@ msgid "" "approximate) line number." msgstr "" -#: ../../library/doctest.rst:1123 +#: ../../library/doctest.rst:1145 msgid "" "Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` " "out of :class:`!doctest.DocTestCase` instances, and :class:`!DocTestCase` is " @@ -1703,14 +1731,14 @@ msgid "" "questions about the exact details of :mod:`unittest` integration." msgstr "" -#: ../../library/doctest.rst:1129 +#: ../../library/doctest.rst:1151 msgid "" "Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out " "of :class:`!doctest.DocFileCase` instances, and :class:`!DocFileCase` is a " "subclass of :class:`!DocTestCase`." msgstr "" -#: ../../library/doctest.rst:1133 +#: ../../library/doctest.rst:1155 msgid "" "So both ways of creating a :class:`unittest.TestSuite` run instances of :" "class:`!DocTestCase`. This is important for a subtle reason: when you run :" @@ -1723,23 +1751,23 @@ msgid "" "through :mod:`unittest` to :mod:`doctest` test runners." msgstr "" -#: ../../library/doctest.rst:1143 +#: ../../library/doctest.rst:1165 msgid "" "For this reason, :mod:`doctest` also supports a notion of :mod:`doctest` " "reporting flags specific to :mod:`unittest` support, via this function:" msgstr "" -#: ../../library/doctest.rst:1149 +#: ../../library/doctest.rst:1171 msgid "Set the :mod:`doctest` reporting flags to use." msgstr "" -#: ../../library/doctest.rst:1151 +#: ../../library/doctest.rst:1173 msgid "" "Argument *flags* takes the :ref:`bitwise OR ` of option flags. See " "section :ref:`doctest-options`. Only \"reporting flags\" can be used." msgstr "" -#: ../../library/doctest.rst:1154 +#: ../../library/doctest.rst:1176 msgid "" "This is a module-global setting, and affects all future doctests run by " "module :mod:`unittest`: the :meth:`!runTest` method of :class:`!" @@ -1753,17 +1781,17 @@ msgid "" "`!doctest`'s :mod:`unittest` reporting flags are ignored." msgstr "" -#: ../../library/doctest.rst:1165 +#: ../../library/doctest.rst:1187 msgid "" "The value of the :mod:`unittest` reporting flags in effect before the " "function was called is returned by the function." msgstr "" -#: ../../library/doctest.rst:1172 +#: ../../library/doctest.rst:1194 msgid "Advanced API" msgstr "" -#: ../../library/doctest.rst:1174 +#: ../../library/doctest.rst:1196 msgid "" "The basic API is a simple wrapper that's intended to make doctest easy to " "use. It is fairly flexible, and should meet most users' needs; however, if " @@ -1771,62 +1799,62 @@ msgid "" "doctest's capabilities, then you should use the advanced API." msgstr "" -#: ../../library/doctest.rst:1179 +#: ../../library/doctest.rst:1201 msgid "" "The advanced API revolves around two container classes, which are used to " "store the interactive examples extracted from doctest cases:" msgstr "" -#: ../../library/doctest.rst:1182 +#: ../../library/doctest.rst:1204 msgid "" ":class:`Example`: A single Python :term:`statement`, paired with its " "expected output." msgstr "" -#: ../../library/doctest.rst:1185 +#: ../../library/doctest.rst:1207 msgid "" ":class:`DocTest`: A collection of :class:`Example`\\ s, typically extracted " "from a single docstring or text file." msgstr "" -#: ../../library/doctest.rst:1188 +#: ../../library/doctest.rst:1210 msgid "" "Additional processing classes are defined to find, parse, and run, and check " "doctest examples:" msgstr "" -#: ../../library/doctest.rst:1191 +#: ../../library/doctest.rst:1213 msgid "" ":class:`DocTestFinder`: Finds all docstrings in a given module, and uses a :" "class:`DocTestParser` to create a :class:`DocTest` from every docstring that " "contains interactive examples." msgstr "" -#: ../../library/doctest.rst:1195 +#: ../../library/doctest.rst:1217 msgid "" ":class:`DocTestParser`: Creates a :class:`DocTest` object from a string " "(such as an object's docstring)." msgstr "" -#: ../../library/doctest.rst:1198 +#: ../../library/doctest.rst:1220 msgid "" ":class:`DocTestRunner`: Executes the examples in a :class:`DocTest`, and " "uses an :class:`OutputChecker` to verify their output." msgstr "" -#: ../../library/doctest.rst:1201 +#: ../../library/doctest.rst:1223 msgid "" ":class:`OutputChecker`: Compares the actual output from a doctest example " "with the expected output, and decides whether they match." msgstr "" -#: ../../library/doctest.rst:1204 +#: ../../library/doctest.rst:1226 msgid "" "The relationships among these processing classes are summarized in the " "following diagram::" msgstr "" -#: ../../library/doctest.rst:1207 +#: ../../library/doctest.rst:1229 msgid "" " list of:\n" "+------+ +---------+\n" @@ -1846,30 +1874,30 @@ msgstr "" " DocTestParser | Example | OutputChecker\n" " +---------+" -#: ../../library/doctest.rst:1220 +#: ../../library/doctest.rst:1242 msgid "DocTest Objects" msgstr "DocTest 物件" -#: ../../library/doctest.rst:1225 +#: ../../library/doctest.rst:1247 msgid "" "A collection of doctest examples that should be run in a single namespace. " "The constructor arguments are used to initialize the attributes of the same " "names." msgstr "" -#: ../../library/doctest.rst:1229 +#: ../../library/doctest.rst:1251 msgid "" ":class:`DocTest` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1235 +#: ../../library/doctest.rst:1257 msgid "" "A list of :class:`Example` objects encoding the individual interactive " "Python examples that should be run by this test." msgstr "" -#: ../../library/doctest.rst:1241 +#: ../../library/doctest.rst:1263 msgid "" "The namespace (aka globals) that the examples should be run in. This is a " "dictionary mapping names to values. Any changes to the namespace made by " @@ -1877,57 +1905,57 @@ msgid "" "`globs` after the test is run." msgstr "" -#: ../../library/doctest.rst:1249 +#: ../../library/doctest.rst:1271 msgid "" "A string name identifying the :class:`DocTest`. Typically, this is the name " "of the object or file that the test was extracted from." msgstr "" -#: ../../library/doctest.rst:1255 +#: ../../library/doctest.rst:1277 msgid "" "The name of the file that this :class:`DocTest` was extracted from; or " "``None`` if the filename is unknown, or if the :class:`DocTest` was not " "extracted from a file." msgstr "" -#: ../../library/doctest.rst:1262 +#: ../../library/doctest.rst:1284 msgid "" "The line number within :attr:`filename` where this :class:`DocTest` begins, " "or ``None`` if the line number is unavailable. This line number is zero-" "based with respect to the beginning of the file." msgstr "" -#: ../../library/doctest.rst:1269 +#: ../../library/doctest.rst:1291 msgid "" "The string that the test was extracted from, or ``None`` if the string is " "unavailable, or if the test was not extracted from a string." msgstr "" -#: ../../library/doctest.rst:1276 +#: ../../library/doctest.rst:1298 msgid "Example Objects" msgstr "Example 物件" -#: ../../library/doctest.rst:1281 +#: ../../library/doctest.rst:1303 msgid "" "A single interactive example, consisting of a Python statement and its " "expected output. The constructor arguments are used to initialize the " "attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1286 +#: ../../library/doctest.rst:1308 msgid "" ":class:`Example` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1292 +#: ../../library/doctest.rst:1314 msgid "" "A string containing the example's source code. This source code consists of " "a single Python statement, and always ends with a newline; the constructor " "adds a newline when necessary." msgstr "" -#: ../../library/doctest.rst:1299 +#: ../../library/doctest.rst:1321 msgid "" "The expected output from running the example's source code (either from " "stdout, or a traceback in case of exception). :attr:`want` ends with a " @@ -1935,7 +1963,7 @@ msgid "" "The constructor adds a newline when necessary." msgstr "" -#: ../../library/doctest.rst:1307 +#: ../../library/doctest.rst:1329 msgid "" "The exception message generated by the example, if the example is expected " "to generate an exception; or ``None`` if it is not expected to generate an " @@ -1944,20 +1972,20 @@ msgid "" "unless it's ``None``. The constructor adds a newline if needed." msgstr "" -#: ../../library/doctest.rst:1316 +#: ../../library/doctest.rst:1338 msgid "" "The line number within the string containing this example where the example " "begins. This line number is zero-based with respect to the beginning of the " "containing string." msgstr "" -#: ../../library/doctest.rst:1323 +#: ../../library/doctest.rst:1345 msgid "" "The example's indentation in the containing string, i.e., the number of " "space characters that precede the example's first prompt." msgstr "" -#: ../../library/doctest.rst:1329 +#: ../../library/doctest.rst:1351 msgid "" "A dictionary mapping from option flags to ``True`` or ``False``, which is " "used to override default options for this example. Any option flags not " @@ -1966,11 +1994,11 @@ msgid "" "default, no options are set." msgstr "" -#: ../../library/doctest.rst:1339 +#: ../../library/doctest.rst:1361 msgid "DocTestFinder objects" msgstr "DocTestFinder 物件" -#: ../../library/doctest.rst:1344 +#: ../../library/doctest.rst:1366 msgid "" "A processing class used to extract the :class:`DocTest`\\ s that are " "relevant to a given object, from its docstring and the docstrings of its " @@ -1978,48 +2006,48 @@ msgid "" "classes, functions, methods, staticmethods, classmethods, and properties." msgstr "" -#: ../../library/doctest.rst:1349 +#: ../../library/doctest.rst:1371 msgid "" "The optional argument *verbose* can be used to display the objects searched " "by the finder. It defaults to ``False`` (no output)." msgstr "" -#: ../../library/doctest.rst:1352 +#: ../../library/doctest.rst:1374 msgid "" "The optional argument *parser* specifies the :class:`DocTestParser` object " "(or a drop-in replacement) that is used to extract doctests from docstrings." msgstr "" -#: ../../library/doctest.rst:1355 +#: ../../library/doctest.rst:1377 msgid "" "If the optional argument *recurse* is false, then :meth:`DocTestFinder.find` " "will only examine the given object, and not any contained objects." msgstr "" -#: ../../library/doctest.rst:1358 +#: ../../library/doctest.rst:1380 msgid "" "If the optional argument *exclude_empty* is false, then :meth:`DocTestFinder." "find` will include tests for objects with empty docstrings." msgstr "" -#: ../../library/doctest.rst:1362 +#: ../../library/doctest.rst:1384 msgid ":class:`DocTestFinder` defines the following method:" msgstr "" -#: ../../library/doctest.rst:1367 +#: ../../library/doctest.rst:1389 msgid "" "Return a list of the :class:`DocTest`\\ s that are defined by *obj*'s " "docstring, or by any of its contained objects' docstrings." msgstr "" -#: ../../library/doctest.rst:1370 +#: ../../library/doctest.rst:1392 msgid "" "The optional argument *name* specifies the object's name; this name will be " "used to construct names for the returned :class:`DocTest`\\ s. If *name* is " "not specified, then ``obj.__name__`` is used." msgstr "" -#: ../../library/doctest.rst:1374 +#: ../../library/doctest.rst:1396 msgid "" "The optional parameter *module* is the module that contains the given " "object. If the module is not specified or is ``None``, then the test finder " @@ -2027,26 +2055,26 @@ msgid "" "module is used:" msgstr "" -#: ../../library/doctest.rst:1378 +#: ../../library/doctest.rst:1400 msgid "As a default namespace, if *globs* is not specified." msgstr "" -#: ../../library/doctest.rst:1380 +#: ../../library/doctest.rst:1402 msgid "" "To prevent the DocTestFinder from extracting DocTests from objects that are " "imported from other modules. (Contained objects with modules other than " "*module* are ignored.)" msgstr "" -#: ../../library/doctest.rst:1384 +#: ../../library/doctest.rst:1406 msgid "To find the name of the file containing the object." msgstr "" -#: ../../library/doctest.rst:1386 +#: ../../library/doctest.rst:1408 msgid "To help find the line number of the object within its file." msgstr "" -#: ../../library/doctest.rst:1388 +#: ../../library/doctest.rst:1410 msgid "" "If *module* is ``False``, no attempt to find the module will be made. This " "is obscure, of use mostly in testing doctest itself: if *module* is " @@ -2055,7 +2083,7 @@ msgid "" "contained objects will (recursively) be searched for doctests." msgstr "" -#: ../../library/doctest.rst:1394 +#: ../../library/doctest.rst:1416 msgid "" "The globals for each :class:`DocTest` is formed by combining *globs* and " "*extraglobs* (bindings in *extraglobs* override bindings in *globs*). A new " @@ -2065,34 +2093,34 @@ msgid "" "defaults to ``{}``." msgstr "" -#: ../../library/doctest.rst:1405 +#: ../../library/doctest.rst:1427 msgid "DocTestParser objects" msgstr "DocTestParser 物件" -#: ../../library/doctest.rst:1410 +#: ../../library/doctest.rst:1432 msgid "" "A processing class used to extract interactive examples from a string, and " "use them to create a :class:`DocTest` object." msgstr "" -#: ../../library/doctest.rst:1414 +#: ../../library/doctest.rst:1436 msgid ":class:`DocTestParser` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1419 +#: ../../library/doctest.rst:1441 msgid "" "Extract all doctest examples from the given string, and collect them into a :" "class:`DocTest` object." msgstr "" -#: ../../library/doctest.rst:1422 +#: ../../library/doctest.rst:1444 msgid "" "*globs*, *name*, *filename*, and *lineno* are attributes for the new :class:" "`DocTest` object. See the documentation for :class:`DocTest` for more " "information." msgstr "" -#: ../../library/doctest.rst:1429 +#: ../../library/doctest.rst:1451 msgid "" "Extract all doctest examples from the given string, and return them as a " "list of :class:`Example` objects. Line numbers are 0-based. The optional " @@ -2100,7 +2128,7 @@ msgid "" "error messages." msgstr "" -#: ../../library/doctest.rst:1436 +#: ../../library/doctest.rst:1458 msgid "" "Divide the given string into examples and intervening text, and return them " "as a list of alternating :class:`Example`\\ s and strings. Line numbers for " @@ -2108,34 +2136,33 @@ msgid "" "name identifying this string, and is only used for error messages." msgstr "" -#: ../../library/doctest.rst:1443 -#, fuzzy +#: ../../library/doctest.rst:1465 msgid "TestResults objects" -msgstr "DocTestRunner 物件" +msgstr "TestResults 物件" -#: ../../library/doctest.rst:1450 +#: ../../library/doctest.rst:1472 msgid "Number of failed tests." msgstr "" -#: ../../library/doctest.rst:1454 +#: ../../library/doctest.rst:1476 msgid "Number of attempted tests." msgstr "" -#: ../../library/doctest.rst:1458 +#: ../../library/doctest.rst:1480 msgid "Number of skipped tests." msgstr "" -#: ../../library/doctest.rst:1466 +#: ../../library/doctest.rst:1488 msgid "DocTestRunner objects" msgstr "DocTestRunner 物件" -#: ../../library/doctest.rst:1471 +#: ../../library/doctest.rst:1493 msgid "" "A processing class used to execute and verify the interactive examples in a :" "class:`DocTest`." msgstr "" -#: ../../library/doctest.rst:1474 +#: ../../library/doctest.rst:1496 msgid "" "The comparison between expected outputs and actual outputs is done by an :" "class:`OutputChecker`. This comparison may be customized with a number of " @@ -2145,7 +2172,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/doctest.rst:1480 +#: ../../library/doctest.rst:1502 msgid "" "The test runner's display output can be controlled in two ways. First, an " "output function can be passed to :meth:`run`; this function will be called " @@ -2156,14 +2183,14 @@ msgid "" "`report_unexpected_exception`, and :meth:`report_failure`." msgstr "" -#: ../../library/doctest.rst:1488 +#: ../../library/doctest.rst:1510 msgid "" "The optional keyword argument *checker* specifies the :class:`OutputChecker` " "object (or drop-in replacement) that should be used to compare the expected " "outputs to the actual outputs of doctest examples." msgstr "" -#: ../../library/doctest.rst:1492 +#: ../../library/doctest.rst:1514 msgid "" "The optional keyword argument *verbose* controls the :class:" "`DocTestRunner`'s verbosity. If *verbose* is ``True``, then information is " @@ -2172,14 +2199,14 @@ msgid "" "verbose output is used iff the command-line switch ``-v`` is used." msgstr "" -#: ../../library/doctest.rst:1498 +#: ../../library/doctest.rst:1520 msgid "" "The optional keyword argument *optionflags* can be used to control how the " "test runner compares expected output to actual output, and how it displays " "failures. For more information, see section :ref:`doctest-options`." msgstr "" -#: ../../library/doctest.rst:1502 +#: ../../library/doctest.rst:1524 msgid "" "The test runner accumulates statistics. The aggregated number of attempted, " "failed and skipped examples is also available via the :attr:`tries`, :attr:" @@ -2187,53 +2214,53 @@ msgid "" "`summarize` methods return a :class:`TestResults` instance." msgstr "" -#: ../../library/doctest.rst:1507 +#: ../../library/doctest.rst:1529 msgid ":class:`DocTestRunner` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1512 +#: ../../library/doctest.rst:1534 msgid "" "Report that the test runner is about to process the given example. This " "method is provided to allow subclasses of :class:`DocTestRunner` to " "customize their output; it should not be called directly." msgstr "" -#: ../../library/doctest.rst:1516 +#: ../../library/doctest.rst:1538 msgid "" "*example* is the example about to be processed. *test* is the test " "*containing example*. *out* is the output function that was passed to :meth:" "`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1523 +#: ../../library/doctest.rst:1545 msgid "" "Report that the given example ran successfully. This method is provided to " "allow subclasses of :class:`DocTestRunner` to customize their output; it " "should not be called directly." msgstr "" -#: ../../library/doctest.rst:1527 ../../library/doctest.rst:1538 +#: ../../library/doctest.rst:1549 ../../library/doctest.rst:1560 msgid "" "*example* is the example about to be processed. *got* is the actual output " "from the example. *test* is the test containing *example*. *out* is the " "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1534 +#: ../../library/doctest.rst:1556 msgid "" "Report that the given example failed. This method is provided to allow " "subclasses of :class:`DocTestRunner` to customize their output; it should " "not be called directly." msgstr "" -#: ../../library/doctest.rst:1545 +#: ../../library/doctest.rst:1567 msgid "" "Report that the given example raised an unexpected exception. This method is " "provided to allow subclasses of :class:`DocTestRunner` to customize their " "output; it should not be called directly." msgstr "" -#: ../../library/doctest.rst:1549 +#: ../../library/doctest.rst:1571 msgid "" "*example* is the example about to be processed. *exc_info* is a tuple " "containing information about the unexpected exception (as returned by :func:" @@ -2241,14 +2268,14 @@ msgid "" "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1557 +#: ../../library/doctest.rst:1579 msgid "" "Run the examples in *test* (a :class:`DocTest` object), and display the " "results using the writer function *out*. Return a :class:`TestResults` " "instance." msgstr "" -#: ../../library/doctest.rst:1561 +#: ../../library/doctest.rst:1583 msgid "" "The examples are run in the namespace ``test.globs``. If *clear_globs* is " "true (the default), then this namespace will be cleared after the test runs, " @@ -2256,55 +2283,54 @@ msgid "" "after the test completes, then use *clear_globs=False*." msgstr "" -#: ../../library/doctest.rst:1566 +#: ../../library/doctest.rst:1588 msgid "" "*compileflags* gives the set of flags that should be used by the Python " "compiler when running the examples. If not specified, then it will default " "to the set of future-import flags that apply to *globs*." msgstr "" -#: ../../library/doctest.rst:1570 +#: ../../library/doctest.rst:1592 msgid "" "The output of each example is checked using the :class:`DocTestRunner`'s " "output checker, and the results are formatted by the :meth:`!DocTestRunner." "report_\\*` methods." msgstr "" -#: ../../library/doctest.rst:1577 +#: ../../library/doctest.rst:1599 msgid "" "Print a summary of all the test cases that have been run by this " "DocTestRunner, and return a :class:`TestResults` instance." msgstr "" -#: ../../library/doctest.rst:1580 +#: ../../library/doctest.rst:1602 msgid "" "The optional *verbose* argument controls how detailed the summary is. If " "the verbosity is not specified, then the :class:`DocTestRunner`'s verbosity " "is used." msgstr "" -#: ../../library/doctest.rst:1584 -#, fuzzy +#: ../../library/doctest.rst:1606 msgid ":class:`DocTestParser` has the following attributes:" -msgstr ":exc:`DocTestFailure` 定義了以下屬性:" +msgstr ":class:`DocTestParser` 有以下屬性:" -#: ../../library/doctest.rst:1588 +#: ../../library/doctest.rst:1610 msgid "Number of attempted examples." msgstr "" -#: ../../library/doctest.rst:1592 +#: ../../library/doctest.rst:1614 msgid "Number of failed examples." msgstr "" -#: ../../library/doctest.rst:1596 +#: ../../library/doctest.rst:1618 msgid "Number of skipped examples." msgstr "" -#: ../../library/doctest.rst:1604 +#: ../../library/doctest.rst:1626 msgid "OutputChecker objects" msgstr "OutputChecker 物件" -#: ../../library/doctest.rst:1609 +#: ../../library/doctest.rst:1631 msgid "" "A class used to check the whether the actual output from a doctest example " "matches the expected output. :class:`OutputChecker` defines two methods: :" @@ -2313,11 +2339,11 @@ msgid "" "string describing the differences between two outputs." msgstr "" -#: ../../library/doctest.rst:1616 +#: ../../library/doctest.rst:1638 msgid ":class:`OutputChecker` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1620 +#: ../../library/doctest.rst:1642 msgid "" "Return ``True`` iff the actual output from an example (*got*) matches the " "expected output (*want*). These strings are always considered to match if " @@ -2326,28 +2352,28 @@ msgid "" "`doctest-options` for more information about option flags." msgstr "" -#: ../../library/doctest.rst:1629 +#: ../../library/doctest.rst:1651 msgid "" "Return a string describing the differences between the expected output for a " "given example (*example*) and the actual output (*got*). *optionflags* is " "the set of option flags used to compare *want* and *got*." msgstr "" -#: ../../library/doctest.rst:1637 +#: ../../library/doctest.rst:1659 msgid "Debugging" msgstr "" -#: ../../library/doctest.rst:1639 +#: ../../library/doctest.rst:1661 msgid "Doctest provides several mechanisms for debugging doctest examples:" msgstr "" -#: ../../library/doctest.rst:1641 +#: ../../library/doctest.rst:1663 msgid "" "Several functions convert doctests to executable Python programs, which can " "be run under the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1644 +#: ../../library/doctest.rst:1666 msgid "" "The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that " "raises an exception for the first failing example, containing information " @@ -2355,13 +2381,13 @@ msgid "" "debugging on the example." msgstr "" -#: ../../library/doctest.rst:1649 +#: ../../library/doctest.rst:1671 msgid "" "The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :" "meth:`debug` method defined by :class:`unittest.TestCase`." msgstr "" -#: ../../library/doctest.rst:1652 +#: ../../library/doctest.rst:1674 msgid "" "You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll " "drop into the Python debugger when that line is executed. Then you can " @@ -2369,7 +2395,7 @@ msgid "" "`a.py` contains just this module docstring::" msgstr "" -#: ../../library/doctest.rst:1657 +#: ../../library/doctest.rst:1679 msgid "" "\"\"\"\n" ">>> def f(x):\n" @@ -2391,11 +2417,11 @@ msgstr "" "9\n" "\"\"\"" -#: ../../library/doctest.rst:1667 +#: ../../library/doctest.rst:1689 msgid "Then an interactive Python session may look like this::" msgstr "" -#: ../../library/doctest.rst:1669 +#: ../../library/doctest.rst:1691 msgid "" ">>> import a, doctest\n" ">>> doctest.testmod(a)\n" @@ -2457,17 +2483,17 @@ msgstr "" "(0, 3)\n" ">>>" -#: ../../library/doctest.rst:1700 +#: ../../library/doctest.rst:1722 msgid "" "Functions that convert doctests to Python code, and possibly run the " "synthesized code under the debugger:" msgstr "" -#: ../../library/doctest.rst:1706 +#: ../../library/doctest.rst:1728 msgid "Convert text with examples to a script." msgstr "" -#: ../../library/doctest.rst:1708 +#: ../../library/doctest.rst:1730 msgid "" "Argument *s* is a string containing doctest examples. The string is " "converted to a Python script, where doctest examples in *s* are converted to " @@ -2475,7 +2501,7 @@ msgid "" "generated script is returned as a string. For example, ::" msgstr "" -#: ../../library/doctest.rst:1713 +#: ../../library/doctest.rst:1735 msgid "" "import doctest\n" "print(doctest.script_from_examples(r\"\"\"\n" @@ -2488,11 +2514,11 @@ msgid "" "\"\"\"))" msgstr "" -#: ../../library/doctest.rst:1723 +#: ../../library/doctest.rst:1745 msgid "displays::" msgstr "" -#: ../../library/doctest.rst:1725 +#: ../../library/doctest.rst:1747 msgid "" "# Set x and y to 1 and 2.\n" "x, y = 1, 2\n" @@ -2503,18 +2529,18 @@ msgid "" "## 3" msgstr "" -#: ../../library/doctest.rst:1733 +#: ../../library/doctest.rst:1755 msgid "" "This function is used internally by other functions (see below), but can " "also be useful when you want to transform an interactive Python session into " "a Python script." msgstr "" -#: ../../library/doctest.rst:1740 +#: ../../library/doctest.rst:1762 msgid "Convert the doctest for an object to a script." msgstr "" -#: ../../library/doctest.rst:1742 +#: ../../library/doctest.rst:1764 msgid "" "Argument *module* is a module object, or dotted name of a module, containing " "the object whose doctests are of interest. Argument *name* is the name " @@ -2524,7 +2550,7 @@ msgid "" "module :file:`a.py` contains a top-level function :func:`!f`, then ::" msgstr "" -#: ../../library/doctest.rst:1749 +#: ../../library/doctest.rst:1771 msgid "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" @@ -2532,17 +2558,17 @@ msgstr "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" -#: ../../library/doctest.rst:1752 +#: ../../library/doctest.rst:1774 msgid "" "prints a script version of function :func:`!f`'s docstring, with doctests " "converted to code, and the rest placed in comments." msgstr "" -#: ../../library/doctest.rst:1758 +#: ../../library/doctest.rst:1780 msgid "Debug the doctests for an object." msgstr "" -#: ../../library/doctest.rst:1760 +#: ../../library/doctest.rst:1782 msgid "" "The *module* and *name* arguments are the same as for function :func:" "`testsource` above. The synthesized Python script for the named object's " @@ -2550,13 +2576,13 @@ msgid "" "the control of the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1765 +#: ../../library/doctest.rst:1787 msgid "" "A shallow copy of ``module.__dict__`` is used for both local and global " "execution context." msgstr "" -#: ../../library/doctest.rst:1768 +#: ../../library/doctest.rst:1790 msgid "" "Optional argument *pm* controls whether post-mortem debugging is used. If " "*pm* has a true value, the script file is run directly, and the debugger " @@ -2568,30 +2594,30 @@ msgid "" "to :func:`pdb.run`." msgstr "" -#: ../../library/doctest.rst:1779 +#: ../../library/doctest.rst:1801 msgid "Debug the doctests in a string." msgstr "" -#: ../../library/doctest.rst:1781 +#: ../../library/doctest.rst:1803 msgid "" "This is like function :func:`debug` above, except that a string containing " "doctest examples is specified directly, via the *src* argument." msgstr "" -#: ../../library/doctest.rst:1784 +#: ../../library/doctest.rst:1806 msgid "" "Optional argument *pm* has the same meaning as in function :func:`debug` " "above." msgstr "" -#: ../../library/doctest.rst:1786 +#: ../../library/doctest.rst:1808 msgid "" "Optional argument *globs* gives a dictionary to use as both local and global " "execution context. If not specified, or ``None``, an empty dictionary is " "used. If specified, a shallow copy of the dictionary is used." msgstr "" -#: ../../library/doctest.rst:1791 +#: ../../library/doctest.rst:1813 msgid "" "The :class:`DebugRunner` class, and the special exceptions it may raise, are " "of most interest to testing framework authors, and will only be sketched " @@ -2599,7 +2625,7 @@ msgid "" "(which is a doctest!) for more details:" msgstr "" -#: ../../library/doctest.rst:1799 +#: ../../library/doctest.rst:1821 msgid "" "A subclass of :class:`DocTestRunner` that raises an exception as soon as a " "failure is encountered. If an unexpected exception occurs, an :exc:" @@ -2609,89 +2635,89 @@ msgid "" "the actual output." msgstr "" -#: ../../library/doctest.rst:1806 +#: ../../library/doctest.rst:1828 msgid "" "For information about the constructor parameters and methods, see the " "documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-" "api`." msgstr "" -#: ../../library/doctest.rst:1809 +#: ../../library/doctest.rst:1831 msgid "" "There are two exceptions that may be raised by :class:`DebugRunner` " "instances:" msgstr "" -#: ../../library/doctest.rst:1814 +#: ../../library/doctest.rst:1836 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example's actual output did not match its expected output. The constructor " "arguments are used to initialize the attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1818 +#: ../../library/doctest.rst:1840 msgid ":exc:`DocTestFailure` defines the following attributes:" msgstr ":exc:`DocTestFailure` 定義了以下屬性:" -#: ../../library/doctest.rst:1823 ../../library/doctest.rst:1847 +#: ../../library/doctest.rst:1845 ../../library/doctest.rst:1869 msgid "The :class:`DocTest` object that was being run when the example failed." msgstr "" -#: ../../library/doctest.rst:1828 ../../library/doctest.rst:1852 +#: ../../library/doctest.rst:1850 ../../library/doctest.rst:1874 msgid "The :class:`Example` that failed." msgstr "" -#: ../../library/doctest.rst:1833 +#: ../../library/doctest.rst:1855 msgid "The example's actual output." msgstr "" -#: ../../library/doctest.rst:1838 +#: ../../library/doctest.rst:1860 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example raised an unexpected exception. The constructor arguments are used " "to initialize the attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1842 +#: ../../library/doctest.rst:1864 msgid ":exc:`UnexpectedException` defines the following attributes:" msgstr "" -#: ../../library/doctest.rst:1857 +#: ../../library/doctest.rst:1879 msgid "" "A tuple containing information about the unexpected exception, as returned " "by :func:`sys.exc_info`." msgstr "" -#: ../../library/doctest.rst:1864 +#: ../../library/doctest.rst:1886 msgid "Soapbox" msgstr "" -#: ../../library/doctest.rst:1866 +#: ../../library/doctest.rst:1888 msgid "" "As mentioned in the introduction, :mod:`doctest` has grown to have three " "primary uses:" msgstr "" -#: ../../library/doctest.rst:1869 +#: ../../library/doctest.rst:1891 msgid "Checking examples in docstrings." msgstr "" -#: ../../library/doctest.rst:1871 +#: ../../library/doctest.rst:1893 msgid "Regression testing." msgstr "" -#: ../../library/doctest.rst:1873 +#: ../../library/doctest.rst:1895 msgid "Executable documentation / literate testing." msgstr "" -#: ../../library/doctest.rst:1875 +#: ../../library/doctest.rst:1897 msgid "" "These uses have different requirements, and it is important to distinguish " "them. In particular, filling your docstrings with obscure test cases makes " "for bad documentation." msgstr "" -#: ../../library/doctest.rst:1879 +#: ../../library/doctest.rst:1901 msgid "" "When writing a docstring, choose docstring examples with care. There's an " "art to this that needs to be learned---it may not be natural at first. " @@ -2703,7 +2729,7 @@ msgid "" "\"harmless\" change." msgstr "" -#: ../../library/doctest.rst:1887 +#: ../../library/doctest.rst:1909 msgid "" "Doctest also makes an excellent tool for regression testing, especially if " "you don't skimp on explanatory text. By interleaving prose and examples, it " @@ -2724,13 +2750,13 @@ msgid "" "different results, blurring the distinction between testing and explaining." msgstr "" -#: ../../library/doctest.rst:1905 +#: ../../library/doctest.rst:1927 msgid "" "Regression testing is best confined to dedicated objects or files. There " "are several options for organizing tests:" msgstr "" -#: ../../library/doctest.rst:1908 +#: ../../library/doctest.rst:1930 msgid "" "Write text files containing test cases as interactive examples, and test the " "files using :func:`testfile` or :func:`DocFileSuite`. This is recommended, " @@ -2738,7 +2764,7 @@ msgid "" "doctest." msgstr "" -#: ../../library/doctest.rst:1913 +#: ../../library/doctest.rst:1935 msgid "" "Define functions named ``_regrtest_topic`` that consist of single " "docstrings, containing test cases for the named topics. These functions can " @@ -2746,13 +2772,13 @@ msgid "" "test file." msgstr "" -#: ../../library/doctest.rst:1917 +#: ../../library/doctest.rst:1939 msgid "" "Define a ``__test__`` dictionary mapping from regression test topics to " "docstrings containing test cases." msgstr "" -#: ../../library/doctest.rst:1920 +#: ../../library/doctest.rst:1942 msgid "" "When you have placed your tests in a module, the module can itself be the " "test runner. When a test fails, you can arrange for your test runner to re-" @@ -2760,8 +2786,7 @@ msgid "" "example of such a test runner::" msgstr "" -#: ../../library/doctest.rst:1925 -#, fuzzy +#: ../../library/doctest.rst:1947 msgid "" "if __name__ == '__main__':\n" " import doctest\n" @@ -2791,55 +2816,58 @@ msgstr "" " optionflags=flags)\n" " else:\n" " fail, total = doctest.testmod(optionflags=flags)\n" -" print(\"{} failures out of {} tests\".format(fail, total))" +" print(f\"{fail} failures out of {total} tests\")" -#: ../../library/doctest.rst:1942 +#: ../../library/doctest.rst:1964 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" -#: ../../library/doctest.rst:1943 +#: ../../library/doctest.rst:1965 msgid "" "Examples containing both expected output and an exception are not supported. " "Trying to guess where one ends and the other begins is too error-prone, and " "that also makes for a confusing test." msgstr "" -#: ../../library/doctest.rst:339 +#: ../../library/doctest.rst:369 msgid ">>>" msgstr ">>>" -#: ../../library/doctest.rst:339 +#: ../../library/doctest.rst:369 msgid "interpreter prompt" msgstr "interpreter prompt(直譯器提示)" -#: ../../library/doctest.rst:339 ../../library/doctest.rst:577 +#: ../../library/doctest.rst:369 ../../library/doctest.rst:604 msgid "..." msgstr "..." -#: ../../library/doctest.rst:505 +#: ../../library/doctest.rst:535 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../library/doctest.rst:505 +#: ../../library/doctest.rst:535 msgid "marker" msgstr "marker(標記)" -#: ../../library/doctest.rst:557 +#: ../../library/doctest.rst:584 msgid "" msgstr "" -#: ../../library/doctest.rst:577 ../../library/doctest.rst:707 +#: ../../library/doctest.rst:604 ../../library/doctest.rst:729 msgid "in doctests" msgstr "於 doctests 中" -#: ../../library/doctest.rst:707 +#: ../../library/doctest.rst:729 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/doctest.rst:707 +#: ../../library/doctest.rst:729 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../library/doctest.rst:707 +#: ../../library/doctest.rst:729 msgid "- (minus)" msgstr "- (減號)" + +#~ msgid "The ``-o`` command line option." +#~ msgstr " ``-o`` 命令列選項。" diff --git a/library/email.errors.po b/library/email.errors.po index 4e9e91bc1f..2709c6bc47 100644 --- a/library/email.errors.po +++ b/library/email.errors.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-07 00:03+0000\n" +"POT-Creation-Date: 2025-03-04 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -64,40 +64,31 @@ msgstr "" #: ../../library/email.errors.rst:48 msgid "" -"Raised when a payload is added to a :class:`~email.message.Message` object " -"using :meth:`add_payload`, but the payload is already a scalar and the " -"message's :mailheader:`Content-Type` main type is not either :mimetype:" -"`multipart` or missing. :exc:`MultipartConversionError` multiply inherits " -"from :exc:`MessageError` and the built-in :exc:`TypeError`." +"Raised if the :meth:`~email.message.Message.attach` method is called on an " +"instance of a class derived from :class:`~email.mime.nonmultipart." +"MIMENonMultipart` (e.g. :class:`~email.mime.image.MIMEImage`). :exc:" +"`MultipartConversionError` multiply inherits from :exc:`MessageError` and " +"the built-in :exc:`TypeError`." msgstr "" -#: ../../library/email.errors.rst:54 -msgid "" -"Since :meth:`Message.add_payload` is deprecated, this exception is rarely " -"raised in practice. However the exception may also be raised if the :meth:" -"`~email.message.Message.attach` method is called on an instance of a class " -"derived from :class:`~email.mime.nonmultipart.MIMENonMultipart` (e.g. :class:" -"`~email.mime.image.MIMEImage`)." -msgstr "" - -#: ../../library/email.errors.rst:64 +#: ../../library/email.errors.rst:58 msgid "" "Raised when an error occurs when the :mod:`~email.generator` outputs headers." msgstr "" -#: ../../library/email.errors.rst:70 +#: ../../library/email.errors.rst:64 msgid "" "This is the base class for all defects found when parsing email messages. It " "is derived from :exc:`ValueError`." msgstr "" -#: ../../library/email.errors.rst:75 +#: ../../library/email.errors.rst:69 msgid "" "This is the base class for all defects found when parsing email headers. It " "is derived from :exc:`MessageDefect`." msgstr "" -#: ../../library/email.errors.rst:78 +#: ../../library/email.errors.rst:72 msgid "" "Here is the list of the defects that the :class:`~email.parser.FeedParser` " "can find while parsing messages. Note that the defects are added to the " @@ -107,90 +98,84 @@ msgid "" "not." msgstr "" -#: ../../library/email.errors.rst:84 +#: ../../library/email.errors.rst:78 msgid "" "All defect classes are subclassed from :class:`email.errors.MessageDefect`." msgstr "" -#: ../../library/email.errors.rst:86 +#: ../../library/email.errors.rst:82 msgid "" -":class:`NoBoundaryInMultipartDefect` -- A message claimed to be a multipart, " -"but had no :mimetype:`boundary` parameter." +"A message claimed to be a multipart, but had no :mimetype:`boundary` " +"parameter." msgstr "" -#: ../../library/email.errors.rst:89 +#: ../../library/email.errors.rst:87 msgid "" -":class:`StartBoundaryNotFoundDefect` -- The start boundary claimed in the :" -"mailheader:`Content-Type` header was never found." +"The start boundary claimed in the :mailheader:`Content-Type` header was " +"never found." msgstr "" #: ../../library/email.errors.rst:92 msgid "" -":class:`CloseBoundaryNotFoundDefect` -- A start boundary was found, but no " -"corresponding close boundary was ever found." +"A start boundary was found, but no corresponding close boundary was ever " +"found." msgstr "" -#: ../../library/email.errors.rst:97 -msgid "" -":class:`FirstHeaderLineIsContinuationDefect` -- The message had a " -"continuation line as its first header line." +#: ../../library/email.errors.rst:99 +msgid "The message had a continuation line as its first header line." msgstr "" -#: ../../library/email.errors.rst:100 -msgid "" -":class:`MisplacedEnvelopeHeaderDefect` - A \"Unix From\" header was found in " -"the middle of a header block." +#: ../../library/email.errors.rst:103 +msgid "A \"Unix From\" header was found in the middle of a header block." msgstr "" -#: ../../library/email.errors.rst:103 +#: ../../library/email.errors.rst:107 msgid "" -":class:`MissingHeaderBodySeparatorDefect` - A line was found while parsing " -"headers that had no leading white space but contained no ':'. Parsing " -"continues assuming that the line represents the first line of the body." +"A line was found while parsing headers that had no leading white space but " +"contained no ':'. Parsing continues assuming that the line represents the " +"first line of the body." msgstr "" -#: ../../library/email.errors.rst:109 +#: ../../library/email.errors.rst:115 msgid "" -":class:`MalformedHeaderDefect` -- A header was found that was missing a " -"colon, or was otherwise malformed." +"A header was found that was missing a colon, or was otherwise malformed." msgstr "" -#: ../../library/email.errors.rst:112 +#: ../../library/email.errors.rst:117 msgid "This defect has not been used for several Python versions." msgstr "" -#: ../../library/email.errors.rst:115 +#: ../../library/email.errors.rst:122 msgid "" -":class:`MultipartInvariantViolationDefect` -- A message claimed to be a :" -"mimetype:`multipart`, but no subparts were found. Note that when a message " -"has this defect, its :meth:`~email.message.Message.is_multipart` method may " -"return ``False`` even though its content type claims to be :mimetype:" -"`multipart`." +"A message claimed to be a :mimetype:`multipart`, but no subparts were found. " +"Note that when a message has this defect, its :meth:`~email.message.Message." +"is_multipart` method may return ``False`` even though its content type " +"claims to be :mimetype:`multipart`." msgstr "" -#: ../../library/email.errors.rst:120 +#: ../../library/email.errors.rst:129 msgid "" -":class:`InvalidBase64PaddingDefect` -- When decoding a block of base64 " -"encoded bytes, the padding was not correct. Enough padding is added to " -"perform the decode, but the resulting decoded bytes may be invalid." +"When decoding a block of base64 encoded bytes, the padding was not correct. " +"Enough padding is added to perform the decode, but the resulting decoded " +"bytes may be invalid." msgstr "" -#: ../../library/email.errors.rst:124 +#: ../../library/email.errors.rst:135 msgid "" -":class:`InvalidBase64CharactersDefect` -- When decoding a block of base64 " -"encoded bytes, characters outside the base64 alphabet were encountered. The " -"characters are ignored, but the resulting decoded bytes may be invalid." +"When decoding a block of base64 encoded bytes, characters outside the base64 " +"alphabet were encountered. The characters are ignored, but the resulting " +"decoded bytes may be invalid." msgstr "" -#: ../../library/email.errors.rst:128 +#: ../../library/email.errors.rst:141 msgid "" -":class:`InvalidBase64LengthDefect` -- When decoding a block of base64 " -"encoded bytes, the number of non-padding base64 characters was invalid (1 " -"more than a multiple of 4). The encoded block was kept as-is." +"When decoding a block of base64 encoded bytes, the number of non-padding " +"base64 characters was invalid (1 more than a multiple of 4). The encoded " +"block was kept as-is." msgstr "" -#: ../../library/email.errors.rst:132 +#: ../../library/email.errors.rst:147 msgid "" -":class:`InvalidDateDefect` -- When decoding an invalid or unparsable date " -"field. The original value is kept as-is." +"When decoding an invalid or unparsable date field. The original value is " +"kept as-is." msgstr "" diff --git a/library/email.examples.po b/library/email.examples.po index fe74e43133..f027517443 100644 --- a/library/email.examples.po +++ b/library/email.examples.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-08 00:14+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -337,7 +337,7 @@ msgid "" " recette\n" " sera sûrement un très bon repas.\n" "

\n" -" \n" +" \n" " \n" "\n" "\"\"\".format(asparagus_cid=asparagus_cid[1:-1]), subtype='html')\n" diff --git a/library/email.parser.po b/library/email.parser.po index 69565e928d..770ac9a254 100644 --- a/library/email.parser.po +++ b/library/email.parser.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -44,35 +43,35 @@ msgid "" "root :class:`~email.message.EmailMessage` instance of the object structure. " "For simple, non-MIME messages the payload of this root object will likely be " "a string containing the text of the message. For MIME messages, the root " -"object will return ``True`` from its :meth:`~email.message.EmailMessage." -"is_multipart` method, and the subparts can be accessed via the payload " -"manipulation methods, such as :meth:`~email.message.EmailMessage.get_body`, :" -"meth:`~email.message.EmailMessage.iter_parts`, and :meth:`~email.message." -"EmailMessage.walk`." +"object will return ``True`` from " +"its :meth:`~email.message.EmailMessage.is_multipart` method, and the " +"subparts can be accessed via the payload manipulation methods, such " +"as :meth:`~email.message.EmailMessage.get_body`, :meth:`~email.message.EmailMessage.iter_parts`, " +"and :meth:`~email.message.EmailMessage.walk`." msgstr "" #: ../../library/email.parser.rst:30 msgid "" -"There are actually two parser interfaces available for use, the :class:" -"`Parser` API and the incremental :class:`FeedParser` API. The :class:" -"`Parser` API is most useful if you have the entire text of the message in " -"memory, or if the entire message lives in a file on the file system. :class:" -"`FeedParser` is more appropriate when you are reading the message from a " -"stream which might block waiting for more input (such as reading an email " -"message from a socket). The :class:`FeedParser` can consume and parse the " -"message incrementally, and only returns the root object when you close the " -"parser." +"There are actually two parser interfaces available for use, " +"the :class:`Parser` API and the incremental :class:`FeedParser` API. " +"The :class:`Parser` API is most useful if you have the entire text of the " +"message in memory, or if the entire message lives in a file on the file " +"system. :class:`FeedParser` is more appropriate when you are reading the " +"message from a stream which might block waiting for more input (such as " +"reading an email message from a socket). The :class:`FeedParser` can " +"consume and parse the message incrementally, and only returns the root " +"object when you close the parser." msgstr "" #: ../../library/email.parser.rst:39 msgid "" "Note that the parser can be extended in limited ways, and of course you can " "implement your own parser completely from scratch. All of the logic that " -"connects the :mod:`email` package's bundled parser and the :class:`~email." -"message.EmailMessage` class is embodied in the :class:`~email.policy.Policy` " -"class, so a custom parser can create message object trees any way it finds " -"necessary by implementing custom versions of the appropriate :class:`!" -"Policy` methods." +"connects the :mod:`email` package's bundled parser and " +"the :class:`~email.message.EmailMessage` class is embodied in " +"the :class:`~email.policy.Policy` class, so a custom parser can create " +"message object trees any way it finds necessary by implementing custom " +"versions of the appropriate :class:`!Policy` methods." msgstr "" #: ../../library/email.parser.rst:49 @@ -84,11 +83,11 @@ msgid "" "The :class:`BytesFeedParser`, imported from the :mod:`email.feedparser` " "module, provides an API that is conducive to incremental parsing of email " "messages, such as would be necessary when reading the text of an email " -"message from a source that can block (such as a socket). The :class:" -"`BytesFeedParser` can of course be used to parse an email message fully " -"contained in a :term:`bytes-like object`, string, or file, but the :class:" -"`BytesParser` API may be more convenient for such use cases. The semantics " -"and results of the two parser APIs are identical." +"message from a source that can block (such as a socket). " +"The :class:`BytesFeedParser` can of course be used to parse an email message " +"fully contained in a :term:`bytes-like object`, string, or file, but " +"the :class:`BytesParser` API may be more convenient for such use cases. The " +"semantics and results of the two parser APIs are identical." msgstr "" #: ../../library/email.parser.rst:60 @@ -98,10 +97,10 @@ msgid "" "to retrieve the root message object. The :class:`BytesFeedParser` is " "extremely accurate when parsing standards-compliant messages, and it does a " "very good job of parsing non-compliant messages, providing information about " -"how a message was deemed broken. It will populate a message object's :attr:" -"`~email.message.EmailMessage.defects` attribute with a list of any problems " -"it found in a message. See the :mod:`email.errors` module for the list of " -"defects that it can find." +"how a message was deemed broken. It will populate a message " +"object's :attr:`~email.message.EmailMessage.defects` attribute with a list " +"of any problems it found in a message. See the :mod:`email.errors` module " +"for the list of defects that it can find." msgstr "" #: ../../library/email.parser.rst:70 @@ -111,21 +110,21 @@ msgstr "" #: ../../library/email.parser.rst:75 msgid "" "Create a :class:`BytesFeedParser` instance. Optional *_factory* is a no-" -"argument callable; if not specified use the :attr:`~email.policy.Policy." -"message_factory` from the *policy*. Call *_factory* whenever a new message " -"object is needed." +"argument callable; if not specified use " +"the :attr:`~email.policy.Policy.message_factory` from the *policy*. Call " +"*_factory* whenever a new message object is needed." msgstr "" #: ../../library/email.parser.rst:80 msgid "" "If *policy* is specified use the rules it specifies to update the " -"representation of the message. If *policy* is not set, use the :class:" -"`compat32 ` policy, which maintains backward " -"compatibility with the Python 3.2 version of the email package and provides :" -"class:`~email.message.Message` as the default factory. All other policies " -"provide :class:`~email.message.EmailMessage` as the default *_factory*. For " -"more information on what else *policy* controls, see the :mod:`~email." -"policy` documentation." +"representation of the message. If *policy* is not set, use " +"the :class:`compat32 ` policy, which maintains " +"backward compatibility with the Python 3.2 version of the email package and " +"provides :class:`~email.message.Message` as the default factory. All other " +"policies provide :class:`~email.message.EmailMessage` as the default " +"*_factory*. For more information on what else *policy* controls, see " +"the :mod:`~email.policy` documentation." msgstr "" #: ../../library/email.parser.rst:89 ../../library/email.parser.rst:145 @@ -160,10 +159,10 @@ msgstr "" #: ../../library/email.parser.rst:116 msgid "" -"Works like :class:`BytesFeedParser` except that the input to the :meth:" -"`~BytesFeedParser.feed` method must be a string. This is of limited " -"utility, since the only way for such a message to be valid is for it to " -"contain only ASCII text or, if :attr:`~email.policy.Policy.utf8` is " +"Works like :class:`BytesFeedParser` except that the input to " +"the :meth:`~BytesFeedParser.feed` method must be a string. This is of " +"limited utility, since the only way for such a message to be valid is for it " +"to contain only ASCII text or, if :attr:`~email.policy.Policy.utf8` is " "``True``, no binary attachments." msgstr "" @@ -176,13 +175,13 @@ msgid "" "The :class:`BytesParser` class, imported from the :mod:`email.parser` " "module, provides an API that can be used to parse a message when the " "complete contents of the message are available in a :term:`bytes-like " -"object` or file. The :mod:`email.parser` module also provides :class:" -"`Parser` for parsing strings, and header-only parsers, :class:" -"`BytesHeaderParser` and :class:`HeaderParser`, which can be used if you're " -"only interested in the headers of the message. :class:`BytesHeaderParser` " -"and :class:`HeaderParser` can be much faster in these situations, since they " -"do not attempt to parse the message body, instead setting the payload to the " -"raw body." +"object` or file. The :mod:`email.parser` module also " +"provides :class:`Parser` for parsing strings, and header-only " +"parsers, :class:`BytesHeaderParser` and :class:`HeaderParser`, which can be " +"used if you're only interested in the headers of the " +"message. :class:`BytesHeaderParser` and :class:`HeaderParser` can be much " +"faster in these situations, since they do not attempt to parse the message " +"body, instead setting the payload to the raw body." msgstr "" #: ../../library/email.parser.rst:141 @@ -206,8 +205,8 @@ msgstr "" #: ../../library/email.parser.rst:156 msgid "" "Read all the data from the binary file-like object *fp*, parse the resulting " -"bytes, and return the message object. *fp* must support both the :meth:`~io." -"IOBase.readline` and the :meth:`~io.IOBase.read` methods." +"bytes, and return the message object. *fp* must support both " +"the :meth:`~io.IOBase.readline` and the :meth:`~io.IOBase.read` methods." msgstr "" #: ../../library/email.parser.rst:161 @@ -217,8 +216,8 @@ msgid "" "and header continuation lines, optionally preceded by an envelope header. " "The header block is terminated either by the end of the data or by a blank " "line. Following the header block is the body of the message (which may " -"contain MIME-encoded subparts, including subparts with a :mailheader:" -"`Content-Transfer-Encoding` of ``8bit``)." +"contain MIME-encoded subparts, including subparts with " +"a :mailheader:`Content-Transfer-Encoding` of ``8bit``)." msgstr "" #: ../../library/email.parser.rst:169 @@ -231,9 +230,9 @@ msgstr "" #: ../../library/email.parser.rst:176 msgid "" "Similar to the :meth:`parse` method, except it takes a :term:`bytes-like " -"object` instead of a file-like object. Calling this method on a :term:" -"`bytes-like object` is equivalent to wrapping *bytes* in a :class:`~io." -"BytesIO` instance first and calling :meth:`parse`." +"object` instead of a file-like object. Calling this method on " +"a :term:`bytes-like object` is equivalent to wrapping *bytes* in " +"a :class:`~io.BytesIO` instance first and calling :meth:`parse`." msgstr "" #: ../../library/email.parser.rst:181 ../../library/email.parser.rst:221 @@ -267,16 +266,16 @@ msgstr "" #: ../../library/email.parser.rst:210 msgid "" -"Other than the text mode requirement, this method operates like :meth:" -"`BytesParser.parse`." +"Other than the text mode requirement, this method operates " +"like :meth:`BytesParser.parse`." msgstr "" #: ../../library/email.parser.rst:216 msgid "" "Similar to the :meth:`parse` method, except it takes a string object instead " "of a file-like object. Calling this method on a string is equivalent to " -"wrapping *text* in a :class:`~io.StringIO` instance first and calling :meth:" -"`parse`." +"wrapping *text* in a :class:`~io.StringIO` instance first and " +"calling :meth:`parse`." msgstr "" #: ../../library/email.parser.rst:226 @@ -330,10 +329,10 @@ msgstr "" #: ../../library/email.parser.rst:286 msgid "" ">>> import email\n" -">>> msg = email.message_from_bytes(myBytes) " +">>> msg = email.message_from_bytes(myBytes)" msgstr "" ">>> import email\n" -">>> msg = email.message_from_bytes(myBytes) " +">>> msg = email.message_from_bytes(myBytes)" #: ../../library/email.parser.rst:291 msgid "Additional notes" @@ -347,37 +346,39 @@ msgstr "" msgid "" "Most non-\\ :mimetype:`multipart` type messages are parsed as a single " "message object with a string payload. These objects will return ``False`` " -"for :meth:`~email.message.EmailMessage.is_multipart`, and :meth:`~email." -"message.EmailMessage.iter_parts` will yield an empty list." +"for :meth:`~email.message.EmailMessage.is_multipart`, " +"and :meth:`~email.message.EmailMessage.iter_parts` will yield an empty list." msgstr "" #: ../../library/email.parser.rst:300 msgid "" "All :mimetype:`multipart` type messages will be parsed as a container " "message object with a list of sub-message objects for their payload. The " -"outer container message will return ``True`` for :meth:`~email.message." -"EmailMessage.is_multipart`, and :meth:`~email.message.EmailMessage." -"iter_parts` will yield a list of subparts." +"outer container message will return ``True`` " +"for :meth:`~email.message.EmailMessage.is_multipart`, " +"and :meth:`~email.message.EmailMessage.iter_parts` will yield a list of " +"subparts." msgstr "" #: ../../library/email.parser.rst:306 msgid "" -"Most messages with a content type of :mimetype:`message/\\*` (such as :" -"mimetype:`message/delivery-status` and :mimetype:`message/rfc822`) will also " -"be parsed as container object containing a list payload of length 1. Their :" -"meth:`~email.message.EmailMessage.is_multipart` method will return ``True``. " -"The single element yielded by :meth:`~email.message.EmailMessage.iter_parts` " -"will be a sub-message object." +"Most messages with a content type of :mimetype:`message/\\*` (such " +"as :mimetype:`message/delivery-status` and :mimetype:`message/rfc822`) will " +"also be parsed as container object containing a list payload of length 1. " +"Their :meth:`~email.message.EmailMessage.is_multipart` method will return " +"``True``. The single element yielded " +"by :meth:`~email.message.EmailMessage.iter_parts` will be a sub-message " +"object." msgstr "" #: ../../library/email.parser.rst:313 msgid "" "Some non-standards-compliant messages may not be internally consistent about " -"their :mimetype:`multipart`\\ -edness. Such messages may have a :mailheader:" -"`Content-Type` header of type :mimetype:`multipart`, but their :meth:`~email." -"message.EmailMessage.is_multipart` method may return ``False``. If such " -"messages were parsed with the :class:`~email.parser.FeedParser`, they will " -"have an instance of the :class:`~email.errors." -"MultipartInvariantViolationDefect` class in their *defects* attribute list. " -"See :mod:`email.errors` for details." +"their :mimetype:`multipart`\\ -edness. Such messages may have " +"a :mailheader:`Content-Type` header of type :mimetype:`multipart`, but " +"their :meth:`~email.message.EmailMessage.is_multipart` method may return " +"``False``. If such messages were parsed with " +"the :class:`~email.parser.FeedParser`, they will have an instance of " +"the :class:`~email.errors.MultipartInvariantViolationDefect` class in their " +"*defects* attribute list. See :mod:`email.errors` for details." msgstr "" diff --git a/library/ensurepip.po b/library/ensurepip.po index ada8cd86dc..7618e87423 100644 --- a/library/ensurepip.po +++ b/library/ensurepip.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -91,20 +91,20 @@ msgstr "" msgid "Command line interface" msgstr "命令列介面" -#: ../../library/ensurepip.rst:46 +#: ../../library/ensurepip.rst:48 msgid "" "The command line interface is invoked using the interpreter's ``-m`` switch." msgstr "使用直譯器 (interpreter) 的 ``-m`` 來調用命令列介面" -#: ../../library/ensurepip.rst:48 +#: ../../library/ensurepip.rst:50 msgid "The simplest possible invocation is::" msgstr "最簡單可行的調用: ::" -#: ../../library/ensurepip.rst:50 +#: ../../library/ensurepip.rst:52 msgid "python -m ensurepip" msgstr "python -m ensurepip" -#: ../../library/ensurepip.rst:52 +#: ../../library/ensurepip.rst:54 msgid "" "This invocation will install ``pip`` if it is not already installed, but " "otherwise does nothing. To ensure the installed version of ``pip`` is at " @@ -115,11 +115,11 @@ msgstr "" "upgrade`` 參數來確保 ``pip`` 的安裝版本至少為當前 ``ensurepip`` 中最新可用的" "版本: ::" -#: ../../library/ensurepip.rst:57 +#: ../../library/ensurepip.rst:59 msgid "python -m ensurepip --upgrade" msgstr "python -m ensurepip --upgrade" -#: ../../library/ensurepip.rst:59 +#: ../../library/ensurepip.rst:61 msgid "" "By default, ``pip`` is installed into the current virtual environment (if " "one is active) or into the system site packages (if there is no active " @@ -129,25 +129,25 @@ msgstr "" "預設上,``pip`` 會被安裝至當前虛擬環境(若已啟動虛擬環境)或系統端的套件(若" "沒有啟動的虛擬環境)。安裝位置可透過兩個額外的命令列選項來控制:" -#: ../../library/ensurepip.rst:64 +#: ../../library/ensurepip.rst:68 msgid "" -":samp:`--root {dir}`: Installs ``pip`` relative to the given root directory " -"rather than the root of the currently active virtual environment (if any) or " -"the default root for the current Python installation." +"Installs ``pip`` relative to the given root directory rather than the root " +"of the currently active virtual environment (if any) or the default root for " +"the current Python installation." msgstr "" -"``--root ``:安裝 ``pip`` 到給定的根目錄 (root directory) 的相對路徑,而" -"不是當前虛擬環境(若存在)的根目錄,或當前 Python 安裝版所預設的根目錄。" +"安裝 ``pip`` 到給定的根目錄 (root directory) 的相對路徑,而不是當前虛擬環境" +"(若存在)的根目錄,或當前 Python 安裝版所預設的根目錄。" -#: ../../library/ensurepip.rst:67 +#: ../../library/ensurepip.rst:74 msgid "" -"``--user``: Installs ``pip`` into the user site packages directory rather " -"than globally for the current Python installation (this option is not " -"permitted inside an active virtual environment)." +"Installs ``pip`` into the user site packages directory rather than globally " +"for the current Python installation (this option is not permitted inside an " +"active virtual environment)." msgstr "" -"``--user`` :安裝 ``pip`` 到使用者端的套件目錄,而不是全域安裝到當前的 " -"Python 安裝版(此選項不允許在一啟動的虛擬環境中使用)。" +"安裝 ``pip`` 到使用者端的套件目錄,而不是全域安裝到當前的 Python 安裝版(此選" +"項不允許在一啟動的虛擬環境中使用)。" -#: ../../library/ensurepip.rst:71 +#: ../../library/ensurepip.rst:78 msgid "" "By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where X.Y " "stands for the version of Python used to invoke ``ensurepip``). The scripts " @@ -156,45 +156,42 @@ msgstr "" "預設會安裝 ``pipX`` 和 ``pipX.Y`` 腳本(X.Y 代表用來調用 ``ensurepip`` 的 " "Python 之版本)。安裝的腳本可透過兩個額外的命令列選項來控制:" -#: ../../library/ensurepip.rst:76 +#: ../../library/ensurepip.rst:85 msgid "" -"``--altinstall``: if an alternate installation is requested, the ``pipX`` " -"script will *not* be installed." -msgstr "" -"``--altinstall``:若要求一個替代安裝版,則\\ *不會*\\ 安裝 ``pipX`` 腳本。" +"If an alternate installation is requested, the ``pipX`` script will *not* be " +"installed." +msgstr "若要求一個替代安裝版,則\\ *不會*\\ 安裝 ``pipX`` 腳本。" -#: ../../library/ensurepip.rst:79 +#: ../../library/ensurepip.rst:90 msgid "" -"``--default-pip``: if a \"default pip\" installation is requested, the " -"``pip`` script will be installed in addition to the two regular scripts." -msgstr "" -"``--default-pip``: 若要求安裝「預設 pip」,則會安裝 ``pip`` 腳本,及 2 個常" -"規腳本。" +"If a \"default pip\" installation is requested, the ``pip`` script will be " +"installed in addition to the two regular scripts." +msgstr "若要求安裝「預設 pip」,則會安裝 ``pip`` 腳本,及 2 個常規腳本。" -#: ../../library/ensurepip.rst:82 +#: ../../library/ensurepip.rst:93 msgid "" "Providing both of the script selection options will trigger an exception." msgstr "提供兩種指令選項將會導致例外 (exception) 。" -#: ../../library/ensurepip.rst:86 +#: ../../library/ensurepip.rst:96 msgid "Module API" msgstr "模組 API" -#: ../../library/ensurepip.rst:88 +#: ../../library/ensurepip.rst:98 msgid ":mod:`ensurepip` exposes two functions for programmatic use:" msgstr ":mod:`ensurepip` 開放了兩個用於編寫程式的函式:" -#: ../../library/ensurepip.rst:92 +#: ../../library/ensurepip.rst:102 msgid "" "Returns a string specifying the available version of pip that will be " "installed when bootstrapping an environment." msgstr "回傳一個字串,用以標明初始建置時,安裝的 pip 的可行版本號。" -#: ../../library/ensurepip.rst:99 +#: ../../library/ensurepip.rst:109 msgid "Bootstraps ``pip`` into the current or designated environment." msgstr "在當前或指定的環境之中建立 ``pip``。" -#: ../../library/ensurepip.rst:101 +#: ../../library/ensurepip.rst:111 msgid "" "*root* specifies an alternative root directory to install relative to. If " "*root* is ``None``, then installation uses the default install location for " @@ -203,64 +200,64 @@ msgstr "" "*root* 指定一個替代的根目錄,作為安裝的相對路徑。若 *root* 為 ``None``,則安" "裝使用當前環境的預設安裝位置。" -#: ../../library/ensurepip.rst:105 +#: ../../library/ensurepip.rst:115 msgid "" "*upgrade* indicates whether or not to upgrade an existing installation of an " "earlier version of ``pip`` to the available version." msgstr "*upgrade* 指出是否要將一個既有的較早版本的 ``pip`` 升級至可用的新版。" -#: ../../library/ensurepip.rst:108 +#: ../../library/ensurepip.rst:118 msgid "" "*user* indicates whether to use the user scheme rather than installing " "globally." msgstr "*user* 指出是否要使用使用者的安裝方案而不是全域安裝。" -#: ../../library/ensurepip.rst:111 +#: ../../library/ensurepip.rst:121 msgid "" "By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where X.Y " "stands for the current version of Python)." msgstr "預設會安裝 ``pipX`` 和 ``pipX.Y`` 腳本(X.Y 代表 Python 的當前版本)。" -#: ../../library/ensurepip.rst:114 +#: ../../library/ensurepip.rst:124 msgid "If *altinstall* is set, then ``pipX`` will *not* be installed." msgstr "如果啟用了 *altinstall*,則不會安裝 ``pipX``。" -#: ../../library/ensurepip.rst:116 +#: ../../library/ensurepip.rst:126 msgid "" "If *default_pip* is set, then ``pip`` will be installed in addition to the " "two regular scripts." msgstr "如果啟用了 *default_pip*,則會安裝 ``pip``,以及 2 個常規腳本。" -#: ../../library/ensurepip.rst:119 +#: ../../library/ensurepip.rst:129 msgid "" "Setting both *altinstall* and *default_pip* will trigger :exc:`ValueError`." msgstr "同時啟用 *altinstall* 跟 *default_pip*,將會觸發 :exc:`ValueError`。" -#: ../../library/ensurepip.rst:122 +#: ../../library/ensurepip.rst:132 msgid "" "*verbosity* controls the level of output to :data:`sys.stdout` from the " "bootstrapping operation." msgstr "" "*verbosity* 用來控制初始建置操作內,對於 :data:`sys.stdout` 的輸出等級。" -#: ../../library/ensurepip.rst:125 +#: ../../library/ensurepip.rst:135 msgid "" "Raises an :ref:`auditing event ` ``ensurepip.bootstrap`` with " "argument ``root``." msgstr "" -"引發一個附帶引數 ``root`` 的\\ :ref:`稽核事件 ` ``ensurepip." -"bootstrap``。" +"引發一個附帶引數 ``root`` 的\\ :ref:`稽核事件 ` " +"``ensurepip.bootstrap``。" -#: ../../library/ensurepip.rst:129 +#: ../../library/ensurepip.rst:139 msgid "" -"The bootstrapping process has side effects on both ``sys.path`` and ``os." -"environ``. Invoking the command line interface in a subprocess instead " +"The bootstrapping process has side effects on both ``sys.path`` and " +"``os.environ``. Invoking the command line interface in a subprocess instead " "allows these side effects to be avoided." msgstr "" "初始建置的過程對於 ``sys.path`` 及 ``os.environ`` 均有副作用。改為在一子行程 " "(subprocess) 調用命令列介面可避免這些副作用。" -#: ../../library/ensurepip.rst:135 +#: ../../library/ensurepip.rst:145 msgid "" "The bootstrapping process may install additional modules required by " "``pip``, but other software should not assume those dependencies will always " diff --git a/library/exceptions.po b/library/exceptions.po index c3f246ac87..64a312c981 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-04 00:13+0000\n" +"POT-Creation-Date: 2025-03-04 00:14+0000\n" "PO-Revision-Date: 2024-12-20 16:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -24,13 +24,12 @@ msgstr "內建的例外" #: ../../library/exceptions.rst:10 msgid "" -"In Python, all exceptions must be instances of a class that derives " -"from :class:`BaseException`. In a :keyword:`try` statement with " -"an :keyword:`except` clause that mentions a particular class, that clause " -"also handles any exception classes derived from that class (but not " -"exception classes from which *it* is derived). Two exception classes that " -"are not related via subclassing are never equivalent, even if they have the " -"same name." +"In Python, all exceptions must be instances of a class that derives from :" +"class:`BaseException`. In a :keyword:`try` statement with an :keyword:" +"`except` clause that mentions a particular class, that clause also handles " +"any exception classes derived from that class (but not exception classes " +"from which *it* is derived). Two exception classes that are not related via " +"subclassing are never equivalent, even if they have the same name." msgstr "" "在 Python 中,所有例外必須是從 :class:`BaseException` 衍生的類別的實例。在陳" "述式 :keyword:`try` 搭配 :keyword:`except` 子句裡提到一個特定的類別時,那個子" @@ -67,10 +66,10 @@ msgstr "" #: ../../library/exceptions.rst:31 msgid "" "The built-in exception classes can be subclassed to define new exceptions; " -"programmers are encouraged to derive new exceptions from " -"the :exc:`Exception` class or one of its subclasses, and not " -"from :exc:`BaseException`. More information on defining exceptions is " -"available in the Python Tutorial under :ref:`tut-userexceptions`." +"programmers are encouraged to derive new exceptions from the :exc:" +"`Exception` class or one of its subclasses, and not from :exc:" +"`BaseException`. More information on defining exceptions is available in " +"the Python Tutorial under :ref:`tut-userexceptions`." msgstr "" "可以從內建的例外類別定義新的例外子類別;程式設計師被鼓勵從 :exc:`Exception` " "類別或其子類別衍生新的例外,而不是從 :exc:`BaseException` 來衍生。更多關於定" @@ -90,13 +89,13 @@ msgstr "三個例外物件上的屬性提供關於引發此例外的情境的資 msgid "" "When raising a new exception while another exception is already being " "handled, the new exception's :attr:`!__context__` attribute is automatically " -"set to the handled exception. An exception may be handled when " -"an :keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` " -"statement, is used." +"set to the handled exception. An exception may be handled when an :keyword:" +"`except` or :keyword:`finally` clause, or a :keyword:`with` statement, is " +"used." msgstr "" "當引發一個新的例外而同時有另一個例外已經正在被處理時,這個新例外的 :attr:`!" -"__context__` 屬性會自動被設成那個已處理的例外。當使用 :keyword:`except` " -"或 :keyword:`finally` 子句或 :keyword:`with` 陳述式的時候例外會被處理。" +"__context__` 屬性會自動被設成那個已處理的例外。當使用 :keyword:`except` 或 :" +"keyword:`finally` 子句或 :keyword:`with` 陳述式的時候例外會被處理。" #: ../../library/exceptions.rst:59 msgid "" @@ -122,11 +121,11 @@ msgid "" "introspection when debugging." msgstr "" "在 :keyword:`from` 後面的運算式必須是一個例外或 ``None``。它將會被設定" -"成所引發例外的 :attr:`!__cause__`。設定 :attr:`!__cause__` 也隱含地設" -"定 :attr:`!__suppress_context__` 屬性為 ``True``,因此使用 ``raise new_exc " -"from None`` 實際上會以新的例外取代舊的例外以利於顯示(例如轉" -"換 :exc:`KeyError` 為 :exc:`AttributeError`),同時保持舊的例外可以透" -"過 :attr:`!__context__` 取得以方便 debug 的時候檢查。" +"成所引發例外的 :attr:`!__cause__`。設定 :attr:`!__cause__` 也隱含地設定 :" +"attr:`!__suppress_context__` 屬性為 ``True``,因此使用 ``raise new_exc from " +"None`` 實際上會以新的例外取代舊的例外以利於顯示(例如轉換 :exc:`KeyError` " +"為 :exc:`AttributeError`),同時保持舊的例外可以透過 :attr:`!__context__` 取" +"得以方便 debug 的時候檢查。" #: ../../library/exceptions.rst:74 msgid "" @@ -168,18 +167,17 @@ msgstr "" #: ../../library/exceptions.rst:95 msgid "" -"Most built-in exceptions are implemented in C for efficiency, " -"see: :source:`Objects/exceptions.c`. Some have custom memory layouts which " -"makes it impossible to create a subclass that inherits from multiple " -"exception types. The memory layout of a type is an implementation detail and " -"might change between Python versions, leading to new conflicts in the " -"future. Therefore, it's recommended to avoid subclassing multiple exception " -"types altogether." +"Most built-in exceptions are implemented in C for efficiency, see: :source:" +"`Objects/exceptions.c`. Some have custom memory layouts which makes it " +"impossible to create a subclass that inherits from multiple exception types. " +"The memory layout of a type is an implementation detail and might change " +"between Python versions, leading to new conflicts in the future. Therefore, " +"it's recommended to avoid subclassing multiple exception types altogether." msgstr "" -"為了效率,大部分的內建例外使用 C 來實作,參考 :source:`Objects/" -"exceptions.c`。一些例外有客製化的記憶體佈局,使其不可能建立一個繼承多種例外型" -"別的子類別。型別的記憶體佈局是實作細節且可能會在不同 Python 版本間改變,造成" -"未來新的衝突。因此,總之建議避免繼承多種例外型別。" +"為了效率,大部分的內建例外使用 C 來實作,參考 :source:`Objects/exceptions." +"c`。一些例外有客製化的記憶體佈局,使其不可能建立一個繼承多種例外型別的子類" +"別。型別的記憶體佈局是實作細節且可能會在不同 Python 版本間改變,造成未來新的" +"衝突。因此,總之建議避免繼承多種例外型別。" #: ../../library/exceptions.rst:105 msgid "Base classes" @@ -194,14 +192,14 @@ msgstr "以下的例外大部分被用在當作其他例外的基底類別。" #: ../../library/exceptions.rst:111 msgid "" "The base class for all built-in exceptions. It is not meant to be directly " -"inherited by user-defined classes (for that, use :exc:`Exception`). " -"If :func:`str` is called on an instance of this class, the representation of " -"the argument(s) to the instance are returned, or the empty string when there " +"inherited by user-defined classes (for that, use :exc:`Exception`). If :" +"func:`str` is called on an instance of this class, the representation of the " +"argument(s) to the instance are returned, or the empty string when there " "were no arguments." msgstr "" -"所有內建例外的基底類別。這不是為了讓使用者定義的類別直接繼承(可以使" -"用 :exc:`Exception`)。如果在這個類別的實例上呼叫 :func:`str`,會回傳實例的引" -"數的表示,或者沒有引數的時候會回傳空字串。" +"所有內建例外的基底類別。這不是為了讓使用者定義的類別直接繼承(可以使用 :exc:" +"`Exception`)。如果在這個類別的實例上呼叫 :func:`str`,會回傳實例的引數的表" +"示,或者沒有引數的時候會回傳空字串。" #: ../../library/exceptions.rst:119 msgid "" @@ -264,9 +262,8 @@ msgstr "" #: ../../library/exceptions.rst:157 msgid "" -"A list of the notes of this exception, which were added " -"with :meth:`add_note`. This attribute is created when :meth:`add_note` is " -"called." +"A list of the notes of this exception, which were added with :meth:" +"`add_note`. This attribute is created when :meth:`add_note` is called." msgstr "" "該例外的備註串列,使用 :meth:`add_note` 來新增。此屬性在 :meth:`add_note` 被" "呼叫的時候建立。" @@ -282,12 +279,11 @@ msgstr "" #: ../../library/exceptions.rst:171 msgid "" "The base class for those built-in exceptions that are raised for various " -"arithmetic " -"errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:`FloatingPointError`." +"arithmetic errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:" +"`FloatingPointError`." msgstr "" -"各種運算錯誤所引發的那些內建例" -"外::exc:`OverflowError`、:exc:`ZeroDivisionError`、:exc:`FloatingPointError` " -"的基底類別。" +"各種運算錯誤所引發的那些內建例外::exc:`OverflowError`、:exc:" +"`ZeroDivisionError`、:exc:`FloatingPointError` 的基底類別。" #: ../../library/exceptions.rst:178 msgid "" @@ -303,9 +299,8 @@ msgid "" "on a mapping or sequence is invalid: :exc:`IndexError`, :exc:`KeyError`. " "This can be raised directly by :func:`codecs.lookup`." msgstr "" -"當使用在對映或序列上的鍵或索引是無效的時候所引發的例" -"外::exc:`IndexError`、:exc:`KeyError` 的基底類別。這可以" -"被 :func:`codecs.lookup` 直接引發。" +"當使用在對映或序列上的鍵或索引是無效的時候所引發的例外::exc:`IndexError`、:" +"exc:`KeyError` 的基底類別。這可以被 :func:`codecs.lookup` 直接引發。" #: ../../library/exceptions.rst:190 msgid "Concrete exceptions" @@ -346,9 +341,8 @@ msgstr "新增 :attr:`name` 與 :attr:`obj` 屬性。" #: ../../library/exceptions.rst:217 msgid "" "Raised when the :func:`input` function hits an end-of-file condition (EOF) " -"without reading any data. (N.B.: the :meth:`io.IOBase.read` " -"and :meth:`io.IOBase.readline` methods return an empty string when they hit " -"EOF.)" +"without reading any data. (N.B.: the :meth:`io.IOBase.read` and :meth:`io." +"IOBase.readline` methods return an empty string when they hit EOF.)" msgstr "" "當 :func:`input` 函式在沒有讀到任何資料而到達檔案結尾 (end-of-file, EOF) 條件" "的時候被引發。(注意::meth:`io.IOBase.read` 和 :meth:`io.IOBase.readline` 方" @@ -360,15 +354,14 @@ msgstr "目前沒有被使用。" #: ../../library/exceptions.rst:229 msgid "" -"Raised when a :term:`generator` or :term:`coroutine` is closed; " -"see :meth:`generator.close` and :meth:`coroutine.close`. It directly " -"inherits from :exc:`BaseException` instead of :exc:`Exception` since it is " -"technically not an error." +"Raised when a :term:`generator` or :term:`coroutine` is closed; see :meth:" +"`generator.close` and :meth:`coroutine.close`. It directly inherits from :" +"exc:`BaseException` instead of :exc:`Exception` since it is technically not " +"an error." msgstr "" -"當 :term:`generator` 或 :term:`coroutine` 被關閉的時候被引發;參" -"考 :meth:`generator.close` 和 :meth:`coroutine.close`。此例外直接繼承" -"自 :exc:`BaseException` 而不是 :exc:`Exception`,因為技術上來說這不是一個錯" -"誤。" +"當 :term:`generator` 或 :term:`coroutine` 被關閉的時候被引發;參考 :meth:" +"`generator.close` 和 :meth:`coroutine.close`。此例外直接繼承自 :exc:" +"`BaseException` 而不是 :exc:`Exception`,因為技術上來說這不是一個錯誤。" #: ../../library/exceptions.rst:237 msgid "" @@ -400,8 +393,8 @@ msgstr "新增 :attr:`name` 與 :attr:`path` 屬性。" #: ../../library/exceptions.rst:257 msgid "" "A subclass of :exc:`ImportError` which is raised by :keyword:`import` when a " -"module could not be located. It is also raised when ``None`` is found " -"in :data:`sys.modules`." +"module could not be located. It is also raised when ``None`` is found in :" +"data:`sys.modules`." msgstr "" ":exc:`ImportError` 的子類別,當模組不能被定位的時候會被 :keyword:`import` 所" "引發。當在 :data:`sys.modules` 裡找到 ``None`` 時也會被引發。" @@ -423,16 +416,16 @@ msgstr "當對映(字典)的鍵無法在已存在的鍵的集合中被找到 #: ../../library/exceptions.rst:282 msgid "" -"Raised when the user hits the interrupt key (normally :kbd:`Control-C` " -"or :kbd:`Delete`). During execution, a check for interrupts is made " -"regularly. The exception inherits from :exc:`BaseException` so as to not be " +"Raised when the user hits the interrupt key (normally :kbd:`Control-C` or :" +"kbd:`Delete`). During execution, a check for interrupts is made regularly. " +"The exception inherits from :exc:`BaseException` so as to not be " "accidentally caught by code that catches :exc:`Exception` and thus prevent " "the interpreter from exiting." msgstr "" -"當使用者輸入中斷鍵 (interrupt key)(一般來說是 :kbd:`Control-C` " -"或 :kbd:`Delete`)時會被引發。在執行過程中,會定期檢查是否產生中斷。此例外繼" -"承自 :exc:`BaseException` 以防止意外地被捕捉 :exc:`Exception` 的程式碼所捕" -"捉,而因此讓直譯器無法結束。" +"當使用者輸入中斷鍵 (interrupt key)(一般來說是 :kbd:`Control-C` 或 :kbd:" +"`Delete`)時會被引發。在執行過程中,會定期檢查是否產生中斷。此例外繼承自 :" +"exc:`BaseException` 以防止意外地被捕捉 :exc:`Exception` 的程式碼所捕捉,而因" +"此讓直譯器無法結束。" #: ../../library/exceptions.rst:290 msgid "" @@ -443,20 +436,19 @@ msgid "" "avoid raising it entirely. (See :ref:`handlers-and-exceptions`.)" msgstr "" "捕捉 :exc:`KeyboardInterrupt` 需要特殊的考量。因為它可以在無法預期的時間點被" -"引發,可能在某些情況下讓正在跑的程式處在一個不一致的狀態。一般來說最好" -"讓 :exc:`KeyboardInterrupt` 越快結束程式越好,或者完全避免引發它。(參" -"考 :ref:`handlers-and-exceptions`。)" +"引發,可能在某些情況下讓正在跑的程式處在一個不一致的狀態。一般來說最好讓 :" +"exc:`KeyboardInterrupt` 越快結束程式越好,或者完全避免引發它。(參考 :ref:" +"`handlers-and-exceptions`。)" #: ../../library/exceptions.rst:300 msgid "" "Raised when an operation runs out of memory but the situation may still be " "rescued (by deleting some objects). The associated value is a string " "indicating what kind of (internal) operation ran out of memory. Note that " -"because of the underlying memory management architecture " -"(C's :c:func:`malloc` function), the interpreter may not always be able to " -"completely recover from this situation; it nevertheless raises an exception " -"so that a stack traceback can be printed, in case a run-away program was the " -"cause." +"because of the underlying memory management architecture (C's :c:func:" +"`malloc` function), the interpreter may not always be able to completely " +"recover from this situation; it nevertheless raises an exception so that a " +"stack traceback can be printed, in case a run-away program was the cause." msgstr "" "當一個操作用光了記憶體但情況還可能被修復 (rescued)(透過刪除一些物件)的時候" "被引發。關聯值是一個字串,表示什麼類型的(內部)操作用光了記憶體。需注意的是" @@ -507,184 +499,184 @@ msgstr "" "子或方法保持未定義,或者如果是子類別的話將其設成 :data:`None`。" #: ../../library/exceptions.rst:338 +#, fuzzy msgid "" -"``NotImplementedError`` and :data:`NotImplemented` are not interchangeable, " -"even though they have similar names and purposes. See :data:`!" -"NotImplemented` for details on when to use it." +":exc:`!NotImplementedError` and :data:`!NotImplemented` are not " +"interchangeable. This exception should only be used as described above; see :" +"data:`NotImplemented` for details on correct usage of the built-in constant." msgstr "" "``NotImplementedError`` 和 :data:`NotImplemented` 雖然有相似的名稱和目的但並" "不是可互換的。參考 :data:`!NotImplemented` 裡關於何時使用的細節。" -#: ../../library/exceptions.rst:347 +#: ../../library/exceptions.rst:349 msgid "" "This exception is raised when a system function returns a system-related " -"error, including I/O failures such as \"file not found\" or \"disk full\" " -"(not for illegal argument types or other incidental errors)." +"error, including I/O failures such as \"file not found\" or \"disk " +"full\" (not for illegal argument types or other incidental errors)." msgstr "" "當系統函式回傳系統相關錯誤,包含像\"找不到檔案\"或\"硬碟已滿\"的 I/O 失敗會引" "發此例外(而非不合法的引數或其他次要的錯誤)。" -#: ../../library/exceptions.rst:351 +#: ../../library/exceptions.rst:353 msgid "" "The second form of the constructor sets the corresponding attributes, " "described below. The attributes default to :const:`None` if not specified. " -"For backwards compatibility, if three arguments are passed, " -"the :attr:`~BaseException.args` attribute contains only a 2-tuple of the " -"first two constructor arguments." +"For backwards compatibility, if three arguments are passed, the :attr:" +"`~BaseException.args` attribute contains only a 2-tuple of the first two " +"constructor arguments." msgstr "" -"建構函式的第二種形式會設定以下描述的相對應屬性。如果沒有給定則屬性預設" -"為 :const:`None`。為了向後相容,如果傳入三個引" -"數,:attr:`~BaseException.args` 屬性只會是包含建構函式前兩個引數的雙元素元" -"組。" +"建構函式的第二種形式會設定以下描述的相對應屬性。如果沒有給定則屬性預設為 :" +"const:`None`。為了向後相容,如果傳入三個引數,:attr:`~BaseException.args` 屬" +"性只會是包含建構函式前兩個引數的雙元素元組。" -#: ../../library/exceptions.rst:357 +#: ../../library/exceptions.rst:359 msgid "" "The constructor often actually returns a subclass of :exc:`OSError`, as " "described in `OS exceptions`_ below. The particular subclass depends on the " -"final :attr:`.errno` value. This behaviour only occurs when " -"constructing :exc:`OSError` directly or via an alias, and is not inherited " -"when subclassing." +"final :attr:`.errno` value. This behaviour only occurs when constructing :" +"exc:`OSError` directly or via an alias, and is not inherited when " +"subclassing." msgstr "" "如同下面的\\ `作業系統例外 `_\\ 所描述,實際上建構函式通常回" "傳 :exc:`OSError` 的子類別。會依據最後 :attr:`.errno` 的值決定特定子類別。這" "個行為只發生在直接建構 :exc:`OSError` 或透過別名,且產生子類別的時候不會被繼" "承。" -#: ../../library/exceptions.rst:365 +#: ../../library/exceptions.rst:367 msgid "A numeric error code from the C variable :c:data:`errno`." msgstr "從 C 變數 :c:data:`errno` 而來的數值錯誤代碼。" -#: ../../library/exceptions.rst:369 +#: ../../library/exceptions.rst:371 msgid "" -"Under Windows, this gives you the native Windows error code. " -"The :attr:`.errno` attribute is then an approximate translation, in POSIX " -"terms, of that native error code." +"Under Windows, this gives you the native Windows error code. The :attr:`." +"errno` attribute is then an approximate translation, in POSIX terms, of that " +"native error code." msgstr "" "在 Windows 下,這會提供你原生的 Windows 錯誤代碼。而 :attr:`.errno` 屬性是一" "個該原生錯誤代碼對於 POSIX 來說的近似翻譯。" -#: ../../library/exceptions.rst:373 +#: ../../library/exceptions.rst:375 msgid "" -"Under Windows, if the *winerror* constructor argument is an integer, " -"the :attr:`.errno` attribute is determined from the Windows error code, and " -"the *errno* argument is ignored. On other platforms, the *winerror* " -"argument is ignored, and the :attr:`winerror` attribute does not exist." +"Under Windows, if the *winerror* constructor argument is an integer, the :" +"attr:`.errno` attribute is determined from the Windows error code, and the " +"*errno* argument is ignored. On other platforms, the *winerror* argument is " +"ignored, and the :attr:`winerror` attribute does not exist." msgstr "" "在 Windows 下,如果建構函式引數 *winerror* 是整數,則 :attr:`.errno` 屬性會根" "據該 Windows 錯誤代碼來決定,且 *errno* 引數會被忽略。在其他平台上," "*winerror* 引數會被忽略,而 :attr:`winerror` 屬性會不存在。" -#: ../../library/exceptions.rst:381 +#: ../../library/exceptions.rst:383 msgid "" "The corresponding error message, as provided by the operating system. It is " -"formatted by the C functions :c:func:`perror` under POSIX, " -"and :c:func:`FormatMessage` under Windows." +"formatted by the C functions :c:func:`perror` under POSIX, and :c:func:" +"`FormatMessage` under Windows." msgstr "" "作業系統提供的對應錯誤訊息。在 POSIX 下會使用 C 函式 :c:func:`perror` 做格式" "化,而在 Windows 下會使用 :c:func:`FormatMessage`。" -#: ../../library/exceptions.rst:389 +#: ../../library/exceptions.rst:391 msgid "" -"For exceptions that involve a file system path (such as :func:`open` " -"or :func:`os.unlink`), :attr:`filename` is the file name passed to the " -"function. For functions that involve two file system paths (such " -"as :func:`os.rename`), :attr:`filename2` corresponds to the second file name " -"passed to the function." +"For exceptions that involve a file system path (such as :func:`open` or :" +"func:`os.unlink`), :attr:`filename` is the file name passed to the function. " +"For functions that involve two file system paths (such as :func:`os." +"rename`), :attr:`filename2` corresponds to the second file name passed to " +"the function." msgstr "" -"對於包含檔案系統路徑的例外(像是 :func:`open` " -"或 :func:`os.unlink`),:attr:`filename` 是傳入函式的檔案名稱。對於包含兩個檔" -"案系統路徑的函式(像是 :func:`os.rename`),:attr:`filename2` 對應到傳入函式" -"的第二個檔案名稱。" +"對於包含檔案系統路徑的例外(像是 :func:`open` 或 :func:`os.unlink`),:attr:" +"`filename` 是傳入函式的檔案名稱。對於包含兩個檔案系統路徑的函式(像是 :func:" +"`os.rename`),:attr:`filename2` 對應到傳入函式的第二個檔案名稱。" -#: ../../library/exceptions.rst:396 +#: ../../library/exceptions.rst:398 msgid "" -":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket.error`, :exc:`select.error` " -"and :exc:`mmap.error` have been merged into :exc:`OSError`, and the " -"constructor may return a subclass." +":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket." +"error`, :exc:`select.error` and :exc:`mmap.error` have been merged into :exc:" +"`OSError`, and the constructor may return a subclass." msgstr "" -":exc:`EnvironmentError`、:exc:`IOError`、:exc:`WindowsError`、:exc:`socket.error`、:exc:`select.error` " -"及 :exc:`mmap.error` 已合併進 :exc:`OSError`,而建構函式可能會回傳子類別。" +":exc:`EnvironmentError`、:exc:`IOError`、:exc:`WindowsError`、:exc:`socket." +"error`、:exc:`select.error` 及 :exc:`mmap.error` 已合併進 :exc:`OSError`,而" +"建構函式可能會回傳子類別。" -#: ../../library/exceptions.rst:402 +#: ../../library/exceptions.rst:404 msgid "" "The :attr:`filename` attribute is now the original file name passed to the " -"function, instead of the name encoded to or decoded from " -"the :term:`filesystem encoding and error handler`. Also, the *filename2* " -"constructor argument and attribute was added." +"function, instead of the name encoded to or decoded from the :term:" +"`filesystem encoding and error handler`. Also, the *filename2* constructor " +"argument and attribute was added." msgstr "" ":attr:`filename` 屬性現在是傳入函式的原始檔名,而不是從\\ :term:`檔案系統編碼" "和錯誤處理函式 `\\ 編碼或解碼過的名" "稱。並且新增 *filename2* 建構函式引數與屬性。" -#: ../../library/exceptions.rst:411 +#: ../../library/exceptions.rst:413 msgid "" "Raised when the result of an arithmetic operation is too large to be " -"represented. This cannot occur for integers (which would rather " -"raise :exc:`MemoryError` than give up). However, for historical reasons, " -"OverflowError is sometimes raised for integers that are outside a required " -"range. Because of the lack of standardization of floating-point exception " -"handling in C, most floating-point operations are not checked." +"represented. This cannot occur for integers (which would rather raise :exc:" +"`MemoryError` than give up). However, for historical reasons, OverflowError " +"is sometimes raised for integers that are outside a required range. " +"Because of the lack of standardization of floating-point exception handling " +"in C, most floating-point operations are not checked." msgstr "" "當運算操作的結果太大而無法表示的時候會引發此例外。這不會發生在整數上(會改成" "引發 :exc:`MemoryError` 而不是放棄)。然而,因為一些歷史因素,OverflowError " "有時候會因為整數在要求範圍之外而引發。因為在 C 裡面缺乏浮點數例外處理的標準" "化,大部分的浮點數運算都沒有被檢查。" -#: ../../library/exceptions.rst:421 +#: ../../library/exceptions.rst:423 msgid "" "This exception is derived from :exc:`RuntimeError`. It is raised when an " "operation is blocked during interpreter shutdown also known as :term:`Python " "finalization `." msgstr "" -"此例外衍生自 :exc:`RuntimeError`。當一個操作在直譯器關閉(也稱" -"作 :term:`Python 最終化 (Python finalization) `)期間" -"被阻塞會引發此例外。" +"此例外衍生自 :exc:`RuntimeError`。當一個操作在直譯器關閉(也稱作 :term:" +"`Python 最終化 (Python finalization) `)期間被阻塞會引" +"發此例外。" -#: ../../library/exceptions.rst:425 +#: ../../library/exceptions.rst:427 msgid "" -"Examples of operations which can be blocked with " -"a :exc:`PythonFinalizationError` during the Python finalization:" +"Examples of operations which can be blocked with a :exc:" +"`PythonFinalizationError` during the Python finalization:" msgstr "" "在 Python 最終化期間,能夠以 :exc:`PythonFinalizationError` 被阻塞的操作範" "例:" -#: ../../library/exceptions.rst:428 +#: ../../library/exceptions.rst:430 msgid "Creating a new Python thread." msgstr "建立新的 Python 執行緒。" -#: ../../library/exceptions.rst:429 +#: ../../library/exceptions.rst:431 msgid ":func:`os.fork`." msgstr ":func:`os.fork`。" -#: ../../library/exceptions.rst:431 +#: ../../library/exceptions.rst:433 msgid "See also the :func:`sys.is_finalizing` function." msgstr "也可以參閱 :func:`sys.is_finalizing` 函式。" -#: ../../library/exceptions.rst:433 ../../library/exceptions.rst:443 +#: ../../library/exceptions.rst:435 ../../library/exceptions.rst:445 msgid "Previously, a plain :exc:`RuntimeError` was raised." msgstr "在之前,會引發一般的 :exc:`RuntimeError`。" -#: ../../library/exceptions.rst:439 +#: ../../library/exceptions.rst:441 msgid "" "This exception is derived from :exc:`RuntimeError`. It is raised when the " -"interpreter detects that the maximum recursion depth " -"(see :func:`sys.getrecursionlimit`) is exceeded." +"interpreter detects that the maximum recursion depth (see :func:`sys." +"getrecursionlimit`) is exceeded." msgstr "" -"此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參" -"考 :func:`sys.getrecursionlimit`)時會引發此例外。" +"此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參考 :" +"func:`sys.getrecursionlimit`)時會引發此例外。" -#: ../../library/exceptions.rst:449 +#: ../../library/exceptions.rst:451 msgid "" -"This exception is raised when a weak reference proxy, created by " -"the :func:`weakref.proxy` function, is used to access an attribute of the " -"referent after it has been garbage collected. For more information on weak " +"This exception is raised when a weak reference proxy, created by the :func:" +"`weakref.proxy` function, is used to access an attribute of the referent " +"after it has been garbage collected. For more information on weak " "references, see the :mod:`weakref` module." msgstr "" "當一個被 :func:`weakref.proxy` 函式建立的弱參照代理 (weak reference proxy) 被" "用來存取已經被垃圾回收 (garbage collected) 的參照物屬性時會引發此例外。更多關" "於弱參照的資訊參考 :mod:`weakref` 模組。" -#: ../../library/exceptions.rst:457 +#: ../../library/exceptions.rst:459 msgid "" "Raised when an error is detected that doesn't fall in any of the other " "categories. The associated value is a string indicating what precisely went " @@ -693,51 +685,50 @@ msgstr "" "當偵測到一個不屬於任何其他種類的錯誤時會引發此例外。關聯值是一個表示確切什麼" "地方出錯的字串。" -#: ../../library/exceptions.rst:464 +#: ../../library/exceptions.rst:466 msgid "" -"Raised by built-in function :func:`next` and " -"an :term:`iterator`\\'s :meth:`~iterator.__next__` method to signal that " -"there are no further items produced by the iterator." +"Raised by built-in function :func:`next` and an :term:`iterator`\\'s :meth:" +"`~iterator.__next__` method to signal that there are no further items " +"produced by the iterator." msgstr "" "會被內建函式 :func:`next` 及 :term:`iterator` 的 :meth:`~iterator.__next__` " "方法引發,用來表示疊代器沒有更多項目可以產生。" -#: ../../library/exceptions.rst:470 +#: ../../library/exceptions.rst:472 msgid "" "The exception object has a single attribute :attr:`!value`, which is given " -"as an argument when constructing the exception, and defaults " -"to :const:`None`." +"as an argument when constructing the exception, and defaults to :const:" +"`None`." msgstr "" -"此例外物件有單一屬性 :attr:`!value`,當建構此例外時會以引數給定,預設" -"為 :const:`None`。" +"此例外物件有單一屬性 :attr:`!value`,當建構此例外時會以引數給定,預設為 :" +"const:`None`。" -#: ../../library/exceptions.rst:474 +#: ../../library/exceptions.rst:476 msgid "" -"When a :term:`generator` or :term:`coroutine` function returns, a " -"new :exc:`StopIteration` instance is raised, and the value returned by the " -"function is used as the :attr:`value` parameter to the constructor of the " -"exception." +"When a :term:`generator` or :term:`coroutine` function returns, a new :exc:" +"`StopIteration` instance is raised, and the value returned by the function " +"is used as the :attr:`value` parameter to the constructor of the exception." msgstr "" -"當 :term:`generator` 或 :term:`coroutine` 函式回傳時,新" -"的 :exc:`StopIteration` 實例會被引發,而該函式的回傳值會被用來當作此例外建構" -"函式的 :attr:`value` 參數。" +"當 :term:`generator` 或 :term:`coroutine` 函式回傳時,新的 :exc:" +"`StopIteration` 實例會被引發,而該函式的回傳值會被用來當作此例外建構函式的 :" +"attr:`value` 參數。" -#: ../../library/exceptions.rst:479 +#: ../../library/exceptions.rst:481 msgid "" "If a generator code directly or indirectly raises :exc:`StopIteration`, it " "is converted into a :exc:`RuntimeError` (retaining the :exc:`StopIteration` " "as the new exception's cause)." msgstr "" -"如果產生器程式直接或間接引發 :exc:`StopIteration`,則其會被轉換" -"成 :exc:`RuntimeError`\\ (保留 :exc:`StopIteration` 作為新例外的成因)。" +"如果產生器程式直接或間接引發 :exc:`StopIteration`,則其會被轉換成 :exc:" +"`RuntimeError`\\ (保留 :exc:`StopIteration` 作為新例外的成因)。" -#: ../../library/exceptions.rst:483 +#: ../../library/exceptions.rst:485 msgid "" "Added ``value`` attribute and the ability for generator functions to use it " "to return a value." msgstr "新增 ``value`` 屬性且產生器函式可以用它來回傳值。" -#: ../../library/exceptions.rst:487 +#: ../../library/exceptions.rst:489 msgid "" "Introduced the RuntimeError transformation via ``from __future__ import " "generator_stop``, see :pep:`479`." @@ -745,7 +736,7 @@ msgstr "" "透過 ``from __future__ import generator_stop`` 引入 RuntimeError 的轉換,參" "考 :pep:`479`。" -#: ../../library/exceptions.rst:491 +#: ../../library/exceptions.rst:493 msgid "" "Enable :pep:`479` for all code by default: a :exc:`StopIteration` error " "raised in a generator is transformed into a :exc:`RuntimeError`." @@ -753,7 +744,7 @@ msgstr "" "預設對所有程式啟用 :pep:`479`:在產生器引發的 :exc:`StopIteration` 錯誤會轉換" "成 :exc:`RuntimeError`。" -#: ../../library/exceptions.rst:497 +#: ../../library/exceptions.rst:499 msgid "" "Must be raised by :meth:`~object.__anext__` method of an :term:`asynchronous " "iterator` object to stop the iteration." @@ -761,18 +752,18 @@ msgstr "" "此例外必須被 :term:`asynchronous iterator` 物件的 :meth:`~object.__anext__` " "方法引發來停止疊代。" -#: ../../library/exceptions.rst:504 +#: ../../library/exceptions.rst:506 msgid "" -"Raised when the parser encounters a syntax error. This may occur in " -"an :keyword:`import` statement, in a call to the built-in " -"functions :func:`compile`, :func:`exec`, or :func:`eval`, or when reading " -"the initial script or standard input (also interactively)." +"Raised when the parser encounters a syntax error. This may occur in an :" +"keyword:`import` statement, in a call to the built-in functions :func:" +"`compile`, :func:`exec`, or :func:`eval`, or when reading the initial script " +"or standard input (also interactively)." msgstr "" "當剖析器遇到語法錯誤時會引發此例外。這可能發生在 :keyword:`import` 陳述式、在" "呼叫內建函式 :func:`compile`、:func:`exec` 或 :func:`eval` 的時候,或者在讀取" "初始腳本或標準輸入(也包含互動式)的時候。" -#: ../../library/exceptions.rst:510 +#: ../../library/exceptions.rst:512 msgid "" "The :func:`str` of the exception instance returns only the error message. " "Details is a tuple whose members are also available as separate attributes." @@ -780,18 +771,18 @@ msgstr "" "例外實例的 :func:`str` 只回傳錯誤訊息。Details 是個元組,其成員也能夠以分開的" "屬性取得。" -#: ../../library/exceptions.rst:515 +#: ../../library/exceptions.rst:517 msgid "The name of the file the syntax error occurred in." msgstr "發生語法錯誤所在的檔案名稱。" -#: ../../library/exceptions.rst:519 +#: ../../library/exceptions.rst:521 msgid "" "Which line number in the file the error occurred in. This is 1-indexed: the " "first line in the file has a ``lineno`` of 1." msgstr "" "發生錯誤所在檔案的列號。這是以 1 開始的索引:檔案第一列的 ``lineno`` 是 1。" -#: ../../library/exceptions.rst:524 +#: ../../library/exceptions.rst:526 msgid "" "The column in the line where the error occurred. This is 1-indexed: the " "first character in the line has an ``offset`` of 1." @@ -799,11 +790,11 @@ msgstr "" "發生錯誤所在該列的欄號 (column)。這是以 1 開始的索引:該列第一個字元的 " "``offset`` 是 1。" -#: ../../library/exceptions.rst:529 +#: ../../library/exceptions.rst:531 msgid "The source code text involved in the error." msgstr "涉及該錯誤的原始程式碼文字。" -#: ../../library/exceptions.rst:533 +#: ../../library/exceptions.rst:535 msgid "" "Which line number in the file the error occurred ends in. This is 1-indexed: " "the first line in the file has a ``lineno`` of 1." @@ -811,7 +802,7 @@ msgstr "" "發生錯誤所在檔案的結束列號。這是以 1 開始的索引:檔案第一列的 ``lineno`` 是 " "1。" -#: ../../library/exceptions.rst:538 +#: ../../library/exceptions.rst:540 msgid "" "The column in the end line where the error occurred finishes. This is 1-" "indexed: the first character in the line has an ``offset`` of 1." @@ -819,7 +810,7 @@ msgstr "" "發生錯誤所在該結束列的欄號。這是以 1 開始的索引:該列第一個字元的 ``offset`` " "是 1。" -#: ../../library/exceptions.rst:541 +#: ../../library/exceptions.rst:543 msgid "" "For errors in f-string fields, the message is prefixed by \"f-string: \" and " "the offsets are offsets in a text constructed from the replacement " @@ -830,39 +821,39 @@ msgstr "" "(offset) 是從替代表達式建構的文字的偏移量。例如編譯 f'Bad {a b} field' 會得到" "這個 args 屬性:('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))。" -#: ../../library/exceptions.rst:546 +#: ../../library/exceptions.rst:548 msgid "Added the :attr:`end_lineno` and :attr:`end_offset` attributes." msgstr "新增 :attr:`end_lineno` 與 :attr:`end_offset` 屬性。" -#: ../../library/exceptions.rst:551 +#: ../../library/exceptions.rst:553 msgid "" "Base class for syntax errors related to incorrect indentation. This is a " "subclass of :exc:`SyntaxError`." msgstr "" "與不正確的縮排有關的語法錯誤的基礎類別。這是 :exc:`SyntaxError` 的子類別。" -#: ../../library/exceptions.rst:557 +#: ../../library/exceptions.rst:559 msgid "" "Raised when indentation contains an inconsistent use of tabs and spaces. " "This is a subclass of :exc:`IndentationError`." msgstr "" -"當縮排包含製表符號 (tab) 和空白的不一致用法時會引發此例外。這" -"是 :exc:`IndentationError` 的子類別。" +"當縮排包含製表符號 (tab) 和空白的不一致用法時會引發此例外。這是 :exc:" +"`IndentationError` 的子類別。" -#: ../../library/exceptions.rst:563 +#: ../../library/exceptions.rst:565 msgid "" "Raised when the interpreter finds an internal error, but the situation does " "not look so serious to cause it to abandon all hope. The associated value is " -"a string indicating what went wrong (in low-level terms). " -"In :term:`CPython`, this could be raised by incorrectly using Python's C " -"API, such as returning a ``NULL`` value without an exception set." +"a string indicating what went wrong (in low-level terms). In :term:" +"`CPython`, this could be raised by incorrectly using Python's C API, such as " +"returning a ``NULL`` value without an exception set." msgstr "" "當直譯器找到一個內部錯誤,但該情況看起來沒有嚴重到要讓它放棄所有的希望時會引" -"發此例外。關聯值是一個表示什麼地方出錯的字串(以低階的方式表達)。" -"在 :term:`CPython` 中,這可能是因為錯誤地使用 Python 的 C API,例如回傳一個 " -"``NULL`` 值而沒有設定例外。" +"發此例外。關聯值是一個表示什麼地方出錯的字串(以低階的方式表達)。在 :term:" +"`CPython` 中,這可能是因為錯誤地使用 Python 的 C API,例如回傳一個 ``NULL`` " +"值而沒有設定例外。" -#: ../../library/exceptions.rst:569 +#: ../../library/exceptions.rst:571 msgid "" "If you're confident that this exception wasn't your fault, or the fault of a " "package you're using, you should report this to the author or maintainer of " @@ -877,28 +868,28 @@ msgstr "" "互動式 Python 會話的開頭被印出)、確切的錯誤訊息(該例外的關聯值)及如果可能" "的話,觸發此錯誤的程式來源。" -#: ../../library/exceptions.rst:580 +#: ../../library/exceptions.rst:582 msgid "" "This exception is raised by the :func:`sys.exit` function. It inherits " "from :exc:`BaseException` instead of :exc:`Exception` so that it is not " "accidentally caught by code that catches :exc:`Exception`. This allows the " "exception to properly propagate up and cause the interpreter to exit. When " "it is not handled, the Python interpreter exits; no stack traceback is " -"printed. The constructor accepts the same optional argument passed " -"to :func:`sys.exit`. If the value is an integer, it specifies the system " -"exit status (passed to C's :c:func:`exit` function); if it is ``None``, the " -"exit status is zero; if it has another type (such as a string), the object's " -"value is printed and the exit status is one." -msgstr "" -"此例外會被 :func:`sys.exit` 函式引發。它繼承自 :exc:`BaseException` 而不" -"是 :exc:`Exception` 因此不會被捕捉 :exc:`Exception` 的程式意外地捕捉。這允許" -"例外可以正確地向上傳遞並導致直譯器結束。當它未被處理時,Python 直譯器會結束;" -"不會印出堆疊回溯。建構函式接受跟傳入 :func:`sys.exit` 一樣的可選引數。如果該" -"值是整數,它會指定系統的結束狀態(傳入 C 的 :c:func:`exit` 函式 );如果它是 " +"printed. The constructor accepts the same optional argument passed to :func:" +"`sys.exit`. If the value is an integer, it specifies the system exit status " +"(passed to C's :c:func:`exit` function); if it is ``None``, the exit status " +"is zero; if it has another type (such as a string), the object's value is " +"printed and the exit status is one." +msgstr "" +"此例外會被 :func:`sys.exit` 函式引發。它繼承自 :exc:`BaseException` 而不是 :" +"exc:`Exception` 因此不會被捕捉 :exc:`Exception` 的程式意外地捕捉。這允許例外" +"可以正確地向上傳遞並導致直譯器結束。當它未被處理時,Python 直譯器會結束;不會" +"印出堆疊回溯。建構函式接受跟傳入 :func:`sys.exit` 一樣的可選引數。如果該值是" +"整數,它會指定系統的結束狀態(傳入 C 的 :c:func:`exit` 函式 );如果它是 " "``None``,結束狀態會是 0;如果它是其他型別(例如字串),則物件的值會被印出而" "結束狀態是 1。" -#: ../../library/exceptions.rst:591 +#: ../../library/exceptions.rst:593 msgid "" "A call to :func:`sys.exit` is translated into an exception so that clean-up " "handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be " @@ -909,16 +900,16 @@ msgid "" msgstr "" "對 :func:`sys.exit` 的呼叫會轉譯成例外讓負責清理的處理函式(:keyword:`try` 陳" "述式的 :keyword:`finally` 子句)可以被執行,且讓除錯器可以在不冒著失去控制的" -"風險下執行腳本。如果在絕對有必要立即結束的情況(例如在子行程呼叫" -"完 :func:`os.fork` 之後 )可以使用 :func:`os._exit` 函式。" +"風險下執行腳本。如果在絕對有必要立即結束的情況(例如在子行程呼叫完 :func:`os." +"fork` 之後 )可以使用 :func:`os._exit` 函式。" -#: ../../library/exceptions.rst:600 +#: ../../library/exceptions.rst:602 msgid "" "The exit status or error message that is passed to the constructor. " "(Defaults to ``None``.)" msgstr "傳入建構函式的結束狀態或錯誤訊息。(預設是 ``None``。 )" -#: ../../library/exceptions.rst:606 +#: ../../library/exceptions.rst:608 msgid "" "Raised when an operation or function is applied to an object of " "inappropriate type. The associated value is a string giving details about " @@ -927,7 +918,7 @@ msgstr "" "當一個操作或函式被用在不適合的型別的物件時會引發此例外。關聯值是一個字串,提" "供關於不相符型別的細節。" -#: ../../library/exceptions.rst:609 +#: ../../library/exceptions.rst:611 msgid "" "This exception may be raised by user code to indicate that an attempted " "operation on an object is not supported, and is not meant to be. If an " @@ -938,27 +929,27 @@ msgstr "" "這樣做。如果一個物件有意要支援某個給定的操作但尚未提供實作,該引發的正確例外" "是 :exc:`NotImplementedError`。" -#: ../../library/exceptions.rst:614 +#: ../../library/exceptions.rst:616 msgid "" -"Passing arguments of the wrong type (e.g. passing a :class:`list` when " -"an :class:`int` is expected) should result in a :exc:`TypeError`, but " -"passing arguments with the wrong value (e.g. a number outside expected " -"boundaries) should result in a :exc:`ValueError`." +"Passing arguments of the wrong type (e.g. passing a :class:`list` when an :" +"class:`int` is expected) should result in a :exc:`TypeError`, but passing " +"arguments with the wrong value (e.g. a number outside expected boundaries) " +"should result in a :exc:`ValueError`." msgstr "" "傳入錯誤型別的引數(例如當預期傳入 :class:`int` 卻傳入 :class:`list`)應該要" "導致 :exc:`TypeError`,但傳入帶有錯誤值的引數(例如超出預期範圍的數值)應該要" "導致 :exc:`ValueError`。" -#: ../../library/exceptions.rst:621 +#: ../../library/exceptions.rst:623 msgid "" "Raised when a reference is made to a local variable in a function or method, " -"but no value has been bound to that variable. This is a subclass " -"of :exc:`NameError`." +"but no value has been bound to that variable. This is a subclass of :exc:" +"`NameError`." msgstr "" "當在函式或方法裡引用某個區域變數,但該變數尚未被繫結到任何值的時候會引發此例" "外。這是 :exc:`NameError` 的子類別。" -#: ../../library/exceptions.rst:628 +#: ../../library/exceptions.rst:630 msgid "" "Raised when a Unicode-related encoding or decoding error occurs. It is a " "subclass of :exc:`ValueError`." @@ -966,36 +957,36 @@ msgstr "" "當 Unicode 相關的編碼或解碼錯誤發生時會引發此例外。這是 :exc:`ValueError` 的" "子類別。" -#: ../../library/exceptions.rst:631 +#: ../../library/exceptions.rst:633 msgid "" ":exc:`UnicodeError` has attributes that describe the encoding or decoding " "error. For example, ``err.object[err.start:err.end]`` gives the particular " "invalid input that the codec failed on." msgstr "" -":exc:`UnicodeError` 有屬性描述編碼或解碼錯誤。例如 " -"``err.object[err.start:err.end]`` 會提供讓編解碼器失敗的具體無效輸入。" +":exc:`UnicodeError` 有屬性描述編碼或解碼錯誤。例如 ``err.object[err.start:" +"err.end]`` 會提供讓編解碼器失敗的具體無效輸入。" -#: ../../library/exceptions.rst:637 +#: ../../library/exceptions.rst:639 msgid "The name of the encoding that raised the error." msgstr "引發錯誤的編碼名稱。" -#: ../../library/exceptions.rst:641 +#: ../../library/exceptions.rst:643 msgid "A string describing the specific codec error." msgstr "描述特定編解碼器錯誤的字串。" -#: ../../library/exceptions.rst:645 +#: ../../library/exceptions.rst:647 msgid "The object the codec was attempting to encode or decode." msgstr "編解碼器嘗試編碼或解碼的物件。" -#: ../../library/exceptions.rst:649 +#: ../../library/exceptions.rst:651 msgid "The first index of invalid data in :attr:`object`." msgstr "在 :attr:`object` 中無效資料的開始索引。" -#: ../../library/exceptions.rst:653 +#: ../../library/exceptions.rst:655 msgid "The index after the last invalid data in :attr:`object`." msgstr "在 :attr:`object` 中最後的無效資料後的索引。" -#: ../../library/exceptions.rst:658 +#: ../../library/exceptions.rst:660 msgid "" "Raised when a Unicode-related error occurs during encoding. It is a " "subclass of :exc:`UnicodeError`." @@ -1003,7 +994,7 @@ msgstr "" "在編碼當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:664 +#: ../../library/exceptions.rst:666 msgid "" "Raised when a Unicode-related error occurs during decoding. It is a " "subclass of :exc:`UnicodeError`." @@ -1011,7 +1002,7 @@ msgstr "" "在解碼當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:670 +#: ../../library/exceptions.rst:672 msgid "" "Raised when a Unicode-related error occurs during translating. It is a " "subclass of :exc:`UnicodeError`." @@ -1019,7 +1010,7 @@ msgstr "" "在轉譯當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:676 +#: ../../library/exceptions.rst:678 msgid "" "Raised when an operation or function receives an argument that has the right " "type but an inappropriate value, and the situation is not described by a " @@ -1028,7 +1019,7 @@ msgstr "" "當一個操作或函式收到引數是正確型別但是不適合的值,且該情況無法被更精確的例外" "例如 :exc:`IndexError` 所描述時會引發此例外。" -#: ../../library/exceptions.rst:683 +#: ../../library/exceptions.rst:685 msgid "" "Raised when the second argument of a division or modulo operation is zero. " "The associated value is a string indicating the type of the operands and the " @@ -1037,47 +1028,47 @@ msgstr "" "當除法或模數運算 (modulo operation) 的第二個引數是 0 的時候會引發此例外。關聯" "值是一個字串,表示運算元及運算的類型。" -#: ../../library/exceptions.rst:688 +#: ../../library/exceptions.rst:690 msgid "" "The following exceptions are kept for compatibility with previous versions; " "starting from Python 3.3, they are aliases of :exc:`OSError`." msgstr "" -"以下例外是為了相容於之前版本而保留;從 Python 3.3 開始,它們" -"是 :exc:`OSError` 的別名。" +"以下例外是為了相容於之前版本而保留;從 Python 3.3 開始,它們是 :exc:" +"`OSError` 的別名。" -#: ../../library/exceptions.rst:697 +#: ../../library/exceptions.rst:699 msgid "Only available on Windows." msgstr "僅限於在 Windows 中使用。" -#: ../../library/exceptions.rst:701 +#: ../../library/exceptions.rst:703 msgid "OS exceptions" msgstr "作業系統例外" -#: ../../library/exceptions.rst:703 +#: ../../library/exceptions.rst:705 msgid "" "The following exceptions are subclasses of :exc:`OSError`, they get raised " "depending on the system error code." msgstr "以下的例外是 :exc:`OSError` 的子類別,它們根據系統錯誤代碼來引發。" -#: ../../library/exceptions.rst:708 +#: ../../library/exceptions.rst:710 msgid "" "Raised when an operation would block on an object (e.g. socket) set for non-" -"blocking operation. Corresponds " -"to :c:data:`errno` :py:const:`~errno.EAGAIN`, :py:const:`~errno.EALREADY`, :py:const:`~errno.EWOULDBLOCK` " -"and :py:const:`~errno.EINPROGRESS`." +"blocking operation. Corresponds to :c:data:`errno` :py:const:`~errno." +"EAGAIN`, :py:const:`~errno.EALREADY`, :py:const:`~errno.EWOULDBLOCK` and :py:" +"const:`~errno.EINPROGRESS`." msgstr "" "當設置為非阻塞操作的物件(例如 socket)上的操作將要阻塞時會引發此例外。對應" -"到 :c:data:`errno` :py:const:`~errno.EAGAIN`、:py:const:`~errno.EALREADY`、:py:const:`~errno.EWOULDBLOCK` " -"及 :py:const:`~errno.EINPROGRESS`。" +"到 :c:data:`errno` :py:const:`~errno.EAGAIN`、:py:const:`~errno.EALREADY`、:" +"py:const:`~errno.EWOULDBLOCK` 及 :py:const:`~errno.EINPROGRESS`。" -#: ../../library/exceptions.rst:713 +#: ../../library/exceptions.rst:715 msgid "" "In addition to those of :exc:`OSError`, :exc:`BlockingIOError` can have one " "more attribute:" msgstr "" "除了 :exc:`OSError` 的那些屬性之外,:exc:`BlockingIOError` 有多一個屬性:" -#: ../../library/exceptions.rst:718 +#: ../../library/exceptions.rst:720 msgid "" "An integer containing the number of characters written to the stream before " "it blocked. This attribute is available when using the buffered I/O classes " @@ -1086,58 +1077,56 @@ msgstr "" "一個整數,內容為在其阻塞之前,已寫進串流的字元數。當使用 :mod:`io` 模組裡的緩" "衝 I/O 類別時這個屬性是可用的。" -#: ../../library/exceptions.rst:724 +#: ../../library/exceptions.rst:726 msgid "" -"Raised when an operation on a child process failed. Corresponds " -"to :c:data:`errno` :py:const:`~errno.ECHILD`." +"Raised when an operation on a child process failed. Corresponds to :c:data:" +"`errno` :py:const:`~errno.ECHILD`." msgstr "" -"當子行程上的操作失敗時會引發此例外。對應" -"到 :c:data:`errno` :py:const:`~errno.ECHILD`。" +"當子行程上的操作失敗時會引發此例外。對應到 :c:data:`errno` :py:const:`~errno." +"ECHILD`。" -#: ../../library/exceptions.rst:729 +#: ../../library/exceptions.rst:731 msgid "A base class for connection-related issues." msgstr "連線相關問題的基礎類別。" -#: ../../library/exceptions.rst:731 +#: ../../library/exceptions.rst:733 msgid "" -"Subclasses " -"are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:`ConnectionRefusedError` " -"and :exc:`ConnectionResetError`." +"Subclasses are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:" +"`ConnectionRefusedError` and :exc:`ConnectionResetError`." msgstr "" -"子類別" -"有 :exc:`BrokenPipeError`、:exc:`ConnectionAbortedError`、:exc:`ConnectionRefusedError` " -"及 :exc:`ConnectionResetError`。" +"子類別有 :exc:`BrokenPipeError`、:exc:`ConnectionAbortedError`、:exc:" +"`ConnectionRefusedError` 及 :exc:`ConnectionResetError`。" -#: ../../library/exceptions.rst:736 +#: ../../library/exceptions.rst:738 msgid "" "A subclass of :exc:`ConnectionError`, raised when trying to write on a pipe " "while the other end has been closed, or trying to write on a socket which " -"has been shutdown for writing. Corresponds " -"to :c:data:`errno` :py:const:`~errno.EPIPE` and :py:const:`~errno.ESHUTDOWN`." +"has been shutdown for writing. Corresponds to :c:data:`errno` :py:const:" +"`~errno.EPIPE` and :py:const:`~errno.ESHUTDOWN`." msgstr "" ":exc:`ConnectionError` 的子類別,當嘗試寫入管道 (pipe) 同時另一端已經被關閉時" -"會引發此例外,或者當嘗試寫入已關閉寫入的 socket 時也會引發。對應" -"到 :c:data:`errno` :py:const:`~errno.EPIPE` 及 :py:const:`~errno.ESHUTDOWN`。" +"會引發此例外,或者當嘗試寫入已關閉寫入的 socket 時也會引發。對應到 :c:data:" +"`errno` :py:const:`~errno.EPIPE` 及 :py:const:`~errno.ESHUTDOWN`。" -#: ../../library/exceptions.rst:743 +#: ../../library/exceptions.rst:745 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " -"aborted by the peer. Corresponds " -"to :c:data:`errno` :py:const:`~errno.ECONNABORTED`." +"aborted by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." +"ECONNABORTED`." msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線的嘗試被對等端點 (peer) 中斷時會引" "發此例外。對應到 :c:data:`errno` :py:const:`~errno.ECONNABORTED`。" -#: ../../library/exceptions.rst:749 +#: ../../library/exceptions.rst:751 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " -"refused by the peer. Corresponds " -"to :c:data:`errno` :py:const:`~errno.ECONNREFUSED`." +"refused by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." +"ECONNREFUSED`." msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線的嘗試被對等端點拒絕時會引發此例" "外。對應到 :c:data:`errno` :py:const:`~errno.ECONNREFUSED`。" -#: ../../library/exceptions.rst:755 +#: ../../library/exceptions.rst:757 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection is reset by " "the peer. Corresponds to :c:data:`errno` :py:const:`~errno.ECONNRESET`." @@ -1145,146 +1134,146 @@ msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線被對等端點重置時會引發此例外。對應" "到 :c:data:`errno` :py:const:`~errno.ECONNRESET`。" -#: ../../library/exceptions.rst:761 +#: ../../library/exceptions.rst:763 msgid "" "Raised when trying to create a file or directory which already exists. " "Corresponds to :c:data:`errno` :py:const:`~errno.EEXIST`." msgstr "" -"當嘗試建立已存在的檔案或目錄時會引發此例外。對應" -"到 :c:data:`errno` :py:const:`~errno.EEXIST`。" +"當嘗試建立已存在的檔案或目錄時會引發此例外。對應到 :c:data:`errno` :py:const:" +"`~errno.EEXIST`。" -#: ../../library/exceptions.rst:766 +#: ../../library/exceptions.rst:768 msgid "" "Raised when a file or directory is requested but doesn't exist. Corresponds " "to :c:data:`errno` :py:const:`~errno.ENOENT`." msgstr "" -"當請求不存在的檔案或目錄時會引發此例外。對應" -"到 :c:data:`errno` :py:const:`~errno.ENOENT`。" +"當請求不存在的檔案或目錄時會引發此例外。對應到 :c:data:`errno` :py:const:" +"`~errno.ENOENT`。" -#: ../../library/exceptions.rst:771 +#: ../../library/exceptions.rst:773 msgid "" "Raised when a system call is interrupted by an incoming signal. Corresponds " "to :c:data:`errno` :py:const:`~errno.EINTR`." msgstr "" -"當系統呼叫被傳入的信號中斷時會引發此例外。對應" -"到 :c:data:`errno` :py:const:`~errno.EINTR`。" +"當系統呼叫被傳入的信號中斷時會引發此例外。對應到 :c:data:`errno` :py:const:" +"`~errno.EINTR`。" -#: ../../library/exceptions.rst:774 +#: ../../library/exceptions.rst:776 msgid "" "Python now retries system calls when a syscall is interrupted by a signal, " "except if the signal handler raises an exception (see :pep:`475` for the " "rationale), instead of raising :exc:`InterruptedError`." msgstr "" -"現在當 syscall 被信號中斷時 Python 會重試系統呼叫而不會引" -"發 :exc:`InterruptedError`,除非信號處理器引發例外(理由可參考 :pep:`475`)。" +"現在當 syscall 被信號中斷時 Python 會重試系統呼叫而不會引發 :exc:" +"`InterruptedError`,除非信號處理器引發例外(理由可參考 :pep:`475`)。" -#: ../../library/exceptions.rst:781 +#: ../../library/exceptions.rst:783 msgid "" "Raised when a file operation (such as :func:`os.remove`) is requested on a " "directory. Corresponds to :c:data:`errno` :py:const:`~errno.EISDIR`." msgstr "" -"當在目錄上請求檔案操作(例如 :func:`os.remove`)時會引發此例外。對應" -"到 :c:data:`errno` :py:const:`~errno.EISDIR`。" +"當在目錄上請求檔案操作(例如 :func:`os.remove`)時會引發此例外。對應到 :c:" +"data:`errno` :py:const:`~errno.EISDIR`。" -#: ../../library/exceptions.rst:787 +#: ../../library/exceptions.rst:789 msgid "" "Raised when a directory operation (such as :func:`os.listdir`) is requested " "on something which is not a directory. On most POSIX platforms, it may also " "be raised if an operation attempts to open or traverse a non-directory file " -"as if it were a directory. Corresponds " -"to :c:data:`errno` :py:const:`~errno.ENOTDIR`." +"as if it were a directory. Corresponds to :c:data:`errno` :py:const:`~errno." +"ENOTDIR`." msgstr "" "當在某個不是目錄的東西上請求目錄操作(例如 :func:`os.listdir`)時會引發此例" "外。在大多數的 POSIX 平台上,如果嘗試操作開啟或遍歷一個當作目錄的非目錄檔案也" "會引發此例外。對應到 :c:data:`errno` :py:const:`~errno.ENOTDIR`。" -#: ../../library/exceptions.rst:795 +#: ../../library/exceptions.rst:797 msgid "" "Raised when trying to run an operation without the adequate access rights - " -"for example filesystem permissions. Corresponds " -"to :c:data:`errno` :py:const:`~errno.EACCES`, :py:const:`~errno.EPERM`, " -"and :py:const:`~errno.ENOTCAPABLE`." +"for example filesystem permissions. Corresponds to :c:data:`errno` :py:const:" +"`~errno.EACCES`, :py:const:`~errno.EPERM`, and :py:const:`~errno." +"ENOTCAPABLE`." msgstr "" "當嘗試執行一個沒有合乎存取權限的操作時會引發此例外 — 例如檔案系統權限。對應" -"到 :c:data:`errno` :py:const:`~errno.EACCES`、:py:const:`~errno.EPERM` " -"及 :py:const:`~errno.ENOTCAPABLE`。" +"到 :c:data:`errno` :py:const:`~errno.EACCES`、:py:const:`~errno.EPERM` 及 :" +"py:const:`~errno.ENOTCAPABLE`。" -#: ../../library/exceptions.rst:800 +#: ../../library/exceptions.rst:802 msgid "" -"WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped " -"to :exc:`PermissionError`." +"WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped to :exc:" +"`PermissionError`." msgstr "" "WASI 的 :py:const:`~errno.ENOTCAPABLE` 現在對應到 :exc:`PermissionError`。" -#: ../../library/exceptions.rst:806 +#: ../../library/exceptions.rst:808 msgid "" -"Raised when a given process doesn't exist. Corresponds " -"to :c:data:`errno` :py:const:`~errno.ESRCH`." +"Raised when a given process doesn't exist. Corresponds to :c:data:`errno` :" +"py:const:`~errno.ESRCH`." msgstr "" -"當給定的行程不存在時會引發此例外。對應" -"到 :c:data:`errno` :py:const:`~errno.ESRCH`。" +"當給定的行程不存在時會引發此例外。對應到 :c:data:`errno` :py:const:`~errno." +"ESRCH`。" -#: ../../library/exceptions.rst:811 +#: ../../library/exceptions.rst:813 msgid "" -"Raised when a system function timed out at the system level. Corresponds " -"to :c:data:`errno` :py:const:`~errno.ETIMEDOUT`." +"Raised when a system function timed out at the system level. Corresponds to :" +"c:data:`errno` :py:const:`~errno.ETIMEDOUT`." msgstr "" -"當系統函式在系統層級超時會引發此例外。對應" -"到 :c:data:`errno` :py:const:`~errno.ETIMEDOUT`。" +"當系統函式在系統層級超時會引發此例外。對應到 :c:data:`errno` :py:const:" +"`~errno.ETIMEDOUT`。" -#: ../../library/exceptions.rst:814 +#: ../../library/exceptions.rst:816 msgid "All the above :exc:`OSError` subclasses were added." msgstr "加入以上所有的 :exc:`OSError` 子類別。" -#: ../../library/exceptions.rst:820 +#: ../../library/exceptions.rst:822 msgid ":pep:`3151` - Reworking the OS and IO exception hierarchy" msgstr ":pep:`3151` — 改寫作業系統與 IO 例外階層" -#: ../../library/exceptions.rst:826 +#: ../../library/exceptions.rst:828 msgid "Warnings" msgstr "警告" -#: ../../library/exceptions.rst:828 +#: ../../library/exceptions.rst:830 msgid "" -"The following exceptions are used as warning categories; see " -"the :ref:`warning-categories` documentation for more details." +"The following exceptions are used as warning categories; see the :ref:" +"`warning-categories` documentation for more details." msgstr "" "以下的例外是當作警告的種類使用;更多細節參考 :ref:`warning-categories` 文件。" -#: ../../library/exceptions.rst:833 +#: ../../library/exceptions.rst:835 msgid "Base class for warning categories." msgstr "警告種類的基礎類別。" -#: ../../library/exceptions.rst:838 +#: ../../library/exceptions.rst:840 msgid "Base class for warnings generated by user code." msgstr "使用者程式碼產生的警告的基礎類別。" -#: ../../library/exceptions.rst:843 +#: ../../library/exceptions.rst:845 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for other Python developers." msgstr "關於已棄用功能的警告的基礎類別,且當那些警告是針對其他 Python 開發者。" -#: ../../library/exceptions.rst:846 +#: ../../library/exceptions.rst:848 msgid "" -"Ignored by the default warning filters, except in the ``__main__`` module " -"(:pep:`565`). Enabling the :ref:`Python Development Mode ` shows " -"this warning." +"Ignored by the default warning filters, except in the ``__main__`` module (:" +"pep:`565`). Enabling the :ref:`Python Development Mode ` shows this " +"warning." msgstr "" -"會被預設的警告過濾器忽略,在 ``__main__`` 模組裡除外 (:pep:`565`)。啟" -"用 :ref:`Python 開發模式 `\\ 會顯示此警告。" +"會被預設的警告過濾器忽略,在 ``__main__`` 模組裡除外 (:pep:`565`)。啟用 :ref:" +"`Python 開發模式 `\\ 會顯示此警告。" -#: ../../library/exceptions.rst:850 ../../library/exceptions.rst:866 +#: ../../library/exceptions.rst:852 ../../library/exceptions.rst:868 msgid "The deprecation policy is described in :pep:`387`." msgstr "棄用原則描述在 :pep:`387` 裡。" -#: ../../library/exceptions.rst:855 +#: ../../library/exceptions.rst:857 msgid "" "Base class for warnings about features which are obsolete and expected to be " "deprecated in the future, but are not deprecated at the moment." msgstr "關於過時且預期未來要被棄用,但目前尚未被棄用的功能的警告的基礎類別。" -#: ../../library/exceptions.rst:859 +#: ../../library/exceptions.rst:861 msgid "" "This class is rarely used as emitting a warning about a possible upcoming " "deprecation is unusual, and :exc:`DeprecationWarning` is preferred for " @@ -1293,8 +1282,8 @@ msgstr "" "因為發出關於可能即將被棄用的警告是不尋常的,此類別很少被使用,而對已經被棄用" "的情況會優先使用 :exc:`DeprecationWarning`。" -#: ../../library/exceptions.rst:863 ../../library/exceptions.rst:889 -#: ../../library/exceptions.rst:916 +#: ../../library/exceptions.rst:865 ../../library/exceptions.rst:891 +#: ../../library/exceptions.rst:918 msgid "" "Ignored by the default warning filters. Enabling the :ref:`Python " "Development Mode ` shows this warning." @@ -1302,15 +1291,15 @@ msgstr "" "會被預設的警告過濾器忽略。啟用 :ref:`Python 開發模式 `\\ 會顯示此警" "告。" -#: ../../library/exceptions.rst:871 +#: ../../library/exceptions.rst:873 msgid "Base class for warnings about dubious syntax." msgstr "關於可疑語法的警告的基礎類別。" -#: ../../library/exceptions.rst:876 +#: ../../library/exceptions.rst:878 msgid "Base class for warnings about dubious runtime behavior." msgstr "關於可疑執行環境行為的警告的基礎類別。" -#: ../../library/exceptions.rst:881 +#: ../../library/exceptions.rst:883 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for end users of applications that are written in Python." @@ -1318,36 +1307,36 @@ msgstr "" "關於已棄用功能的警告的基礎類別,且當那些警告是針對以 Python 寫的應用程式的終" "端使用者。" -#: ../../library/exceptions.rst:887 +#: ../../library/exceptions.rst:889 msgid "Base class for warnings about probable mistakes in module imports." msgstr "關於在模組引入的可能錯誤的警告的基礎類別。" -#: ../../library/exceptions.rst:895 +#: ../../library/exceptions.rst:897 msgid "Base class for warnings related to Unicode." msgstr "Unicode 相關警告的基礎類別。" -#: ../../library/exceptions.rst:900 +#: ../../library/exceptions.rst:902 msgid "Base class for warnings related to encodings." msgstr "編碼相關警告的基礎類別。" -#: ../../library/exceptions.rst:902 +#: ../../library/exceptions.rst:904 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節參考\\ :ref:`io-encoding-warning`。" -#: ../../library/exceptions.rst:909 +#: ../../library/exceptions.rst:911 msgid "" "Base class for warnings related to :class:`bytes` and :class:`bytearray`." msgstr ":class:`bytes` 及 :class:`bytearray` 相關警告的基礎類別。" -#: ../../library/exceptions.rst:914 +#: ../../library/exceptions.rst:916 msgid "Base class for warnings related to resource usage." msgstr "資源用法相關警告的基礎類別。" -#: ../../library/exceptions.rst:925 +#: ../../library/exceptions.rst:927 msgid "Exception groups" msgstr "例外群組" -#: ../../library/exceptions.rst:927 +#: ../../library/exceptions.rst:929 msgid "" "The following are used when it is necessary to raise multiple unrelated " "exceptions. They are part of the exception hierarchy so they can be handled " @@ -1359,48 +1348,46 @@ msgstr "" "所有其他例外一樣使用 :keyword:`except` 來處理。此外,它們會以包含的例外型別為" "基礎來比對其子群組而被 :keyword:`except*` 辨認出來。" -#: ../../library/exceptions.rst:936 +#: ../../library/exceptions.rst:938 msgid "" "Both of these exception types wrap the exceptions in the sequence ``excs``. " "The ``msg`` parameter must be a string. The difference between the two " "classes is that :exc:`BaseExceptionGroup` extends :exc:`BaseException` and " -"it can wrap any exception, while :exc:`ExceptionGroup` " -"extends :exc:`Exception` and it can only wrap subclasses " -"of :exc:`Exception`. This design is so that ``except Exception`` catches " -"an :exc:`ExceptionGroup` but not :exc:`BaseExceptionGroup`." +"it can wrap any exception, while :exc:`ExceptionGroup` extends :exc:" +"`Exception` and it can only wrap subclasses of :exc:`Exception`. This design " +"is so that ``except Exception`` catches an :exc:`ExceptionGroup` but not :" +"exc:`BaseExceptionGroup`." msgstr "" "這兩個例外型別都將例外包裝在序列 ``excs`` 中。``msg`` 參數必須是字串。這兩個" "類別的差異是 :exc:`BaseExceptionGroup` 擴充了 :exc:`BaseException` 且可以包裝" -"任何例外,而 :exc:`ExceptionGroup` 擴充了 :exc:`Exception` 且只能包" -"裝 :exc:`Exception` 的子類別。這個設計使得 ``except Exception`` 可以捕" -"捉 :exc:`ExceptionGroup` 但不能捕捉 :exc:`BaseExceptionGroup`。" +"任何例外,而 :exc:`ExceptionGroup` 擴充了 :exc:`Exception` 且只能包裝 :exc:" +"`Exception` 的子類別。這個設計使得 ``except Exception`` 可以捕捉 :exc:" +"`ExceptionGroup` 但不能捕捉 :exc:`BaseExceptionGroup`。" -#: ../../library/exceptions.rst:944 +#: ../../library/exceptions.rst:946 msgid "" "The :exc:`BaseExceptionGroup` constructor returns an :exc:`ExceptionGroup` " -"rather than a :exc:`BaseExceptionGroup` if all contained exceptions " -"are :exc:`Exception` instances, so it can be used to make the selection " -"automatic. The :exc:`ExceptionGroup` constructor, on the other hand, raises " -"a :exc:`TypeError` if any contained exception is not an :exc:`Exception` " -"subclass." +"rather than a :exc:`BaseExceptionGroup` if all contained exceptions are :exc:" +"`Exception` instances, so it can be used to make the selection automatic. " +"The :exc:`ExceptionGroup` constructor, on the other hand, raises a :exc:" +"`TypeError` if any contained exception is not an :exc:`Exception` subclass." msgstr "" "如果所有包含的例外都是 :exc:`Exception` 實例,:exc:`BaseExceptionGroup` 建構" "函式會回傳 :exc:`ExceptionGroup` 而不是 :exc:`BaseExceptionGroup`,因此可以被" -"使用來讓這樣的選擇自動化。另一方面來說,如果任何包含的例外不" -"是 :exc:`Exception` 的子類別,:exc:`ExceptionGroup` 建構函式會引" -"發 :exc:`TypeError`。" +"使用來讓這樣的選擇自動化。另一方面來說,如果任何包含的例外不是 :exc:" +"`Exception` 的子類別,:exc:`ExceptionGroup` 建構函式會引發 :exc:`TypeError`。" -#: ../../library/exceptions.rst:953 +#: ../../library/exceptions.rst:955 msgid "The ``msg`` argument to the constructor. This is a read-only attribute." msgstr "建構函式的 ``msg`` 引數。這是一個唯讀的屬性。" -#: ../../library/exceptions.rst:957 +#: ../../library/exceptions.rst:959 msgid "" "A tuple of the exceptions in the ``excs`` sequence given to the constructor. " "This is a read-only attribute." msgstr "指定給建構函式 ``excs`` 序列中的例外組成的元組。這是一個唯讀的屬性。" -#: ../../library/exceptions.rst:962 +#: ../../library/exceptions.rst:964 msgid "" "Returns an exception group that contains only the exceptions from the " "current group that match *condition*, or ``None`` if the result is empty." @@ -1408,7 +1395,7 @@ msgstr "" "回傳只包含從現有群組比對到 *condition* 的例外的例外群組,或者當結果為空時回" "傳 ``None``。" -#: ../../library/exceptions.rst:965 +#: ../../library/exceptions.rst:967 msgid "" "The condition can be an exception type or tuple of exception types, in which " "case each exception is checked for a match using the same check that is used " @@ -1421,20 +1408,20 @@ msgstr "" "物件(除了型別物件之外),其接受一個例外作為單一引數,而如果該例外應該在子群" "組中就回傳 true。" -#: ../../library/exceptions.rst:971 +#: ../../library/exceptions.rst:973 msgid "" "The nesting structure of the current exception is preserved in the result, " -"as are the values of " -"its :attr:`message`, :attr:`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException.__context__` " -"and :attr:`~BaseException.__notes__` fields. Empty nested groups are omitted " -"from the result." +"as are the values of its :attr:`message`, :attr:`~BaseException." +"__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException." +"__context__` and :attr:`~BaseException.__notes__` fields. Empty nested " +"groups are omitted from the result." msgstr "" -"現有例外的巢狀結構會保留在結果裡," -"其 :attr:`message`、:attr:`~BaseException.__traceback__`、:attr:`~BaseException.__cause__`、:attr:`~BaseException.__context__` " -"及 :attr:`~BaseException.__notes__` 欄位的值也一樣。空的巢狀群組會從結果裡排" -"除。" +"現有例外的巢狀結構會保留在結果裡,其 :attr:`message`、:attr:`~BaseException." +"__traceback__`、:attr:`~BaseException.__cause__`、:attr:`~BaseException." +"__context__` 及 :attr:`~BaseException.__notes__` 欄位的值也一樣。空的巢狀群組" +"會從結果裡排除。" -#: ../../library/exceptions.rst:978 +#: ../../library/exceptions.rst:980 msgid "" "The condition is checked for all exceptions in the nested exception group, " "including the top-level and any nested exception groups. If the condition is " @@ -1443,11 +1430,11 @@ msgstr "" "條件會對巢狀例外群組裡的所有例外做檢查,包括頂層及任何巢狀的例外群組。如果條" "件對這樣的例外群組為 true,它會被完整包含在結果裡。" -#: ../../library/exceptions.rst:982 +#: ../../library/exceptions.rst:984 msgid "``condition`` can be any callable which is not a type object." msgstr "``condition`` 可以是任何不是型別物件的可呼叫物件。" -#: ../../library/exceptions.rst:987 +#: ../../library/exceptions.rst:989 msgid "" "Like :meth:`subgroup`, but returns the pair ``(match, rest)`` where " "``match`` is ``subgroup(condition)`` and ``rest`` is the remaining non-" @@ -1456,13 +1443,13 @@ msgstr "" "像 :meth:`subgroup` 一樣,但回傳一對 ``(match, rest)``,其中 ``match`` 是 " "``subgroup(condition)`` 而 ``rest`` 是剩下沒有比對到的部分。" -#: ../../library/exceptions.rst:993 +#: ../../library/exceptions.rst:995 msgid "" "Returns an exception group with the same :attr:`message`, but which wraps " "the exceptions in ``excs``." msgstr "回傳有相同 :attr:`message` 但將例外包裝在 ``excs`` 的例外群組。" -#: ../../library/exceptions.rst:996 +#: ../../library/exceptions.rst:998 msgid "" "This method is used by :meth:`subgroup` and :meth:`split`, which are used in " "various contexts to break up an exception group. A subclass needs to " @@ -1470,23 +1457,23 @@ msgid "" "instances of the subclass rather than :exc:`ExceptionGroup`." msgstr "" "此方法被 :meth:`subgroup` 及 :meth:`split` 使用,被用來在各種情境下拆分例外群" -"組。子類別需要覆寫它來讓 :meth:`subgroup` 及 :meth:`split` 回傳子類別而不" -"是 :exc:`ExceptionGroup` 的實例。" +"組。子類別需要覆寫它來讓 :meth:`subgroup` 及 :meth:`split` 回傳子類別而不是 :" +"exc:`ExceptionGroup` 的實例。" -#: ../../library/exceptions.rst:1002 +#: ../../library/exceptions.rst:1004 msgid "" -":meth:`subgroup` and :meth:`split` copy " -"the :attr:`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException.__context__` " -"and :attr:`~BaseException.__notes__` fields from the original exception " -"group to the one returned by :meth:`derive`, so these fields do not need to " -"be updated by :meth:`derive`." +":meth:`subgroup` and :meth:`split` copy the :attr:`~BaseException." +"__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException." +"__context__` and :attr:`~BaseException.__notes__` fields from the original " +"exception group to the one returned by :meth:`derive`, so these fields do " +"not need to be updated by :meth:`derive`." msgstr "" -":meth:`subgroup` 及 :meth:`split` 會從原始的例外群組複" -"製 :attr:`~BaseException.__traceback__`、:attr:`~BaseException.__cause__`、:attr:`~BaseException.__context__` " -"和 :attr:`~BaseException.__notes__` 欄位到 :meth:`derive` 所回傳的例外群組" -"上,因此這些欄位不需要被 :meth:`derive` 更新。" +":meth:`subgroup` 及 :meth:`split` 會從原始的例外群組複製 :attr:" +"`~BaseException.__traceback__`、:attr:`~BaseException.__cause__`、:attr:" +"`~BaseException.__context__` 和 :attr:`~BaseException.__notes__` 欄位到 :" +"meth:`derive` 所回傳的例外群組上,因此這些欄位不需要被 :meth:`derive` 更新。" -#: ../../library/exceptions.rst:1009 +#: ../../library/exceptions.rst:1011 msgid "" ">>> class MyGroup(ExceptionGroup):\n" "... def derive(self, excs):\n" @@ -1540,7 +1527,7 @@ msgstr "" ">>> exc.__traceback__ is match.__traceback__ is rest.__traceback__\n" "True" -#: ../../library/exceptions.rst:1035 +#: ../../library/exceptions.rst:1037 msgid "" "Note that :exc:`BaseExceptionGroup` defines :meth:`~object.__new__`, so " "subclasses that need a different constructor signature need to override that " @@ -1552,7 +1539,7 @@ msgstr "" "建構函式簽名的子類別需要覆寫它而不是 :meth:`~object.__init__`。例如下面定義了" "一個例外群組子類別接受 exit_code 並從中建構群組的訊息。: ::" -#: ../../library/exceptions.rst:1041 +#: ../../library/exceptions.rst:1043 msgid "" "class Errors(ExceptionGroup):\n" " def __new__(cls, errors, exit_code):\n" @@ -1572,24 +1559,24 @@ msgstr "" " def derive(self, excs):\n" " return Errors(excs, self.exit_code)" -#: ../../library/exceptions.rst:1050 +#: ../../library/exceptions.rst:1052 msgid "" "Like :exc:`ExceptionGroup`, any subclass of :exc:`BaseExceptionGroup` which " -"is also a subclass of :exc:`Exception` can only wrap instances " -"of :exc:`Exception`." +"is also a subclass of :exc:`Exception` can only wrap instances of :exc:" +"`Exception`." msgstr "" "像 :exc:`ExceptionGroup` 一樣,任何 :exc:`BaseExceptionGroup` 的子類別且也" "是 :exc:`Exception` 的子類別只能包裝 :exc:`Exception` 的實例。" -#: ../../library/exceptions.rst:1058 +#: ../../library/exceptions.rst:1060 msgid "Exception hierarchy" msgstr "例外階層" -#: ../../library/exceptions.rst:1060 +#: ../../library/exceptions.rst:1062 msgid "The class hierarchy for built-in exceptions is:" msgstr "內建例外的類別階層如下:" -#: ../../library/exceptions.rst:1062 +#: ../../library/exceptions.rst:1064 msgid "" "BaseException\n" " ├── BaseExceptionGroup\n" @@ -1770,10 +1757,10 @@ msgstr "__suppress_context__(例外屬性)" msgid "assert" msgstr "assert" -#: ../../library/exceptions.rst:345 +#: ../../library/exceptions.rst:347 msgid "module" msgstr "module(模組)" -#: ../../library/exceptions.rst:345 +#: ../../library/exceptions.rst:347 msgid "errno" msgstr "errno" diff --git a/library/filecmp.po b/library/filecmp.po index ca8839f45d..350f3717b1 100644 --- a/library/filecmp.po +++ b/library/filecmp.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -87,8 +87,8 @@ msgstr "" #: ../../library/filecmp.rst:51 msgid "" -"The *shallow* parameter has the same meaning and default value as for :func:" -"`filecmp.cmp`." +"The *shallow* parameter has the same meaning and default value as " +"for :func:`filecmp.cmp`." msgstr "" #: ../../library/filecmp.rst:54 @@ -112,9 +112,9 @@ msgstr "" #: ../../library/filecmp.rst:75 msgid "" "Construct a new directory comparison object, to compare the directories *a* " -"and *b*. *ignore* is a list of names to ignore, and defaults to :const:" -"`filecmp.DEFAULT_IGNORES`. *hide* is a list of names to hide, and defaults " -"to ``[os.curdir, os.pardir]``." +"and *b*. *ignore* is a list of names to ignore, and defaults " +"to :const:`filecmp.DEFAULT_IGNORES`. *hide* is a list of names to hide, and " +"defaults to ``[os.curdir, os.pardir]``." msgstr "" #: ../../library/filecmp.rst:80 @@ -251,8 +251,8 @@ msgid "" "... for sub_dcmp in dcmp.subdirs.values():\n" "... print_diff_files(sub_dcmp)\n" "...\n" -">>> dcmp = dircmp('dir1', 'dir2') \n" -">>> print_diff_files(dcmp) " +">>> dcmp = dircmp('dir1', 'dir2')\n" +">>> print_diff_files(dcmp)" msgstr "" ">>> from filecmp import dircmp\n" ">>> def print_diff_files(dcmp):\n" @@ -262,5 +262,5 @@ msgstr "" "... for sub_dcmp in dcmp.subdirs.values():\n" "... print_diff_files(sub_dcmp)\n" "...\n" -">>> dcmp = dircmp('dir1', 'dir2') \n" -">>> print_diff_files(dcmp) " +">>> dcmp = dircmp('dir1', 'dir2')\n" +">>> print_diff_files(dcmp)" diff --git a/library/functional.po b/library/functional.po index d8cea9f862..89f98aafb8 100644 --- a/library/functional.po +++ b/library/functional.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -21,13 +20,15 @@ msgstr "" #: ../../library/functional.rst:3 msgid "Functional Programming Modules" -msgstr "函式編程模組" +msgstr "函式程式設計模組" #: ../../library/functional.rst:5 msgid "" "The modules described in this chapter provide functions and classes that " "support a functional programming style, and general operations on callables." msgstr "" +"本章節所描述的模組提供了支援函式程式設計風格的函式和類別,以及對可呼叫物件的" +"一般操作。" #: ../../library/functional.rst:8 msgid "The following modules are documented in this chapter:" diff --git a/library/functions.po b/library/functions.po index aec90b86d9..63a0384af5 100644 --- a/library/functions.po +++ b/library/functions.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-31 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2024-05-06 17:06+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -460,9 +460,9 @@ msgid "" "iterator. If *default* is given, it is returned if the iterator is " "exhausted, otherwise :exc:`StopAsyncIteration` is raised." msgstr "" -"呼叫 *async_iterator* 的 :meth:`~object.__anext__` 方法,回傳 :term:" -"`awaitable`。等待返回疊代器的下一個值。如果指定 *default*,當疊代器結束時會返" -"回該值,否則會引發 :exc:`StopAsyncIteration` 。" +"呼叫 *async_iterator* 的 :meth:`~object.__anext__` 方法,回" +"傳 :term:`awaitable`。等待返回疊代器的下一個值。如果指定 *default*,當疊代器" +"結束時會返回該值,否則會引發 :exc:`StopAsyncIteration` 。" #: ../../library/functions.rst:104 msgid "" @@ -489,9 +489,9 @@ msgstr "" #: ../../library/functions.rst:116 msgid "" "As :func:`repr`, return a string containing a printable representation of an " -"object, but escape the non-ASCII characters in the string returned by :func:" -"`repr` using ``\\x``, ``\\u``, or ``\\U`` escapes. This generates a string " -"similar to that returned by :func:`repr` in Python 2." +"object, but escape the non-ASCII characters in the string returned " +"by :func:`repr` using ``\\x``, ``\\u``, or ``\\U`` escapes. This generates " +"a string similar to that returned by :func:`repr` in Python 2." msgstr "" "就像函式 :func:`repr`,回傳一個表示物件的字串,但是 :func:`repr` 回傳的字串中" "非 ASCII 編碼的字元會被跳脫 (escape),像是 ``\\x``、``\\u`` 和 ``\\U``。這個" @@ -505,8 +505,8 @@ msgid "" "integer. Some examples:" msgstr "" "將一個整數轉變為一個前綴為 \"0b\" 的二進位制字串。結果是一個有效的 Python 運" -"算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:`~object." -"__index__` method 回傳一個整數。舉例來說:" +"算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定" +"義 :meth:`~object.__index__` method 回傳一個整數。舉例來說:" #: ../../library/functions.rst:134 msgid "" @@ -524,9 +524,9 @@ msgid "" "Return a Boolean value, i.e. one of ``True`` or ``False``. The argument is " "converted using the standard :ref:`truth testing procedure `. If the " "argument is false or omitted, this returns ``False``; otherwise, it returns " -"``True``. The :class:`bool` class is a subclass of :class:`int` (see :ref:" -"`typesnumeric`). It cannot be subclassed further. Its only instances are " -"``False`` and ``True`` (see :ref:`typebool`)." +"``True``. The :class:`bool` class is a subclass of :class:`int` " +"(see :ref:`typesnumeric`). It cannot be subclassed further. Its only " +"instances are ``False`` and ``True`` (see :ref:`typebool`)." msgstr "" "回傳一個布林值,即 ``True`` 或者 ``False``。引數會使用標準的\\ :ref:`真值測試" "程序 `\\ 來轉換。如果引數為假或者被省略,則回傳 ``False``;其他情況回" @@ -551,18 +551,18 @@ msgid "" "not accessible, this function will raise :exc:`RuntimeError`." msgstr "" "這個函式將呼叫 :func:`sys.breakpointhook` 函式,並將 ``args`` 和 ``kws`` 傳遞" -"給它。這將有效地讓你在特定的呼叫點進入除錯器。預設情況下,``sys." -"breakpointhook()`` 呼叫 :func:`pdb.set_trace` 不須帶任何引數。這樣的設計是為" -"了方便使用者,讓他們不需要額外地導入 :mod:`pdb` 模組或輸入太多程式就可以進入" -"除錯器。然而,可以將 :func:`sys.breakpointhook` 設置為其他函式,並且 :func:" -"`breakpoint` 將自動呼叫該函式,讓你進入所選擇的除錯器。如果無法存取 :func:" -"`sys.breakpointhook` 這個函式,則此函式將引發 :exc:`RuntimeError`。" +"給它。這將有效地讓你在特定的呼叫點進入除錯器。預設情況下," +"``sys.breakpointhook()`` 呼叫 :func:`pdb.set_trace` 不須帶任何引數。這樣的設" +"計是為了方便使用者,讓他們不需要額外地導入 :mod:`pdb` 模組或輸入太多程式就可" +"以進入除錯器。然而,可以將 :func:`sys.breakpointhook` 設置為其他函式,並" +"且 :func:`breakpoint` 將自動呼叫該函式,讓你進入所選擇的除錯器。如果無法存" +"取 :func:`sys.breakpointhook` 這個函式,則此函式將引發 :exc:`RuntimeError`。" #: ../../library/functions.rst:173 msgid "" -"By default, the behavior of :func:`breakpoint` can be changed with the :" -"envvar:`PYTHONBREAKPOINT` environment variable. See :func:`sys." -"breakpointhook` for usage details." +"By default, the behavior of :func:`breakpoint` can be changed with " +"the :envvar:`PYTHONBREAKPOINT` environment variable. " +"See :func:`sys.breakpointhook` for usage details." msgstr "" "預設情況下,:func:`breakpoint` 的行為可以透過 :envvar:`PYTHONBREAKPOINT` 環境" "變數來更改。有關使用詳情,請參考 :func:`sys.breakpointhook`。" @@ -589,9 +589,9 @@ msgid "" "as most methods that the :class:`bytes` type has, see :ref:`bytes-methods`." msgstr "" "回傳一個新的 bytes 陣列。:class:`bytearray` class 是一個可變的整數序列,包含" -"範圍為 0 <= x < 256 的整數。它有可變序列大部分常見的 method(如在 :ref:" -"`typesseq-mutable` 中所述),同時也有 :class:`bytes` 型別大部分的 method,參" -"見 :ref:`bytes-methods`。" +"範圍為 0 <= x < 256 的整數。它有可變序列大部分常見的 method(如" +"在 :ref:`typesseq-mutable` 中所述),同時也有 :class:`bytes` 型別大部分的 " +"method,參見 :ref:`bytes-methods`。" #: ../../library/functions.rst:195 msgid "" @@ -644,8 +644,8 @@ msgstr "可參考 :ref:`binaryseq` 和 :ref:`typebytearray`。" #: ../../library/functions.rst:222 msgid "" "Return a new \"bytes\" object which is an immutable sequence of integers in " -"the range ``0 <= x < 256``. :class:`bytes` is an immutable version of :" -"class:`bytearray` -- it has the same non-mutating methods and the same " +"the range ``0 <= x < 256``. :class:`bytes` is an immutable version " +"of :class:`bytearray` -- it has the same non-mutating methods and the same " "indexing and slicing behavior." msgstr "" "回傳一個新的 \"bytes\" 物件,會是一個元素是範圍為 ``0 <= x < 256`` 整數的不可" @@ -667,11 +667,12 @@ msgstr "可參考 :ref:`binaryseq`、:ref:`typebytes` 和 :ref:`bytes-methods` #: ../../library/functions.rst:236 msgid "" -"Return :const:`True` if the *object* argument appears callable, :const:" -"`False` if not. If this returns ``True``, it is still possible that a call " -"fails, but if it is ``False``, calling *object* will never succeed. Note " -"that classes are callable (calling a class returns a new instance); " -"instances are callable if their class has a :meth:`~object.__call__` method." +"Return :const:`True` if the *object* argument appears " +"callable, :const:`False` if not. If this returns ``True``, it is still " +"possible that a call fails, but if it is ``False``, calling *object* will " +"never succeed. Note that classes are callable (calling a class returns a new " +"instance); instances are callable if their class has " +"a :meth:`~object.__call__` method." msgstr "" "如果引數 *object* 是可呼叫的,回傳 :const:`True`,否則回傳 :const:`False`。如" "果回傳 ``True``,呼叫仍可能會失敗;但如果回傳 ``False``,則呼叫 *object* 肯定" @@ -726,8 +727,8 @@ msgstr "" #: ../../library/functions.rst:269 msgid "" -"The ``@classmethod`` form is a function :term:`decorator` -- see :ref:" -"`function` for details." +"The ``@classmethod`` form is a function :term:`decorator` -- " +"see :ref:`function` for details." msgstr "" "``@classmethod`` 語法是一個函式 :term:`decorator` — 參見 :ref:`function` 中關" "於函式定義的詳細介紹。" @@ -755,31 +756,30 @@ msgstr "" #: ../../library/functions.rst:281 msgid "" -"Class methods can now wrap other :term:`descriptors ` such as :" -"func:`property`." +"Class methods can now wrap other :term:`descriptors ` such " +"as :func:`property`." msgstr "" -"Class methods 現在可以包裝其他\\ :term:`描述器 `,例如 :func:" -"`property`" +"Class methods 現在可以包裝其他\\ :term:`描述器 `,例" +"如 :func:`property`" #: ../../library/functions.rst:285 msgid "" -"Class methods now inherit the method attributes (:attr:`~function." -"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" -"attr:`~function.__doc__` and :attr:`~function.__annotations__`) and have a " -"new ``__wrapped__`` attribute." +"Class methods now inherit the method attributes " +"(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " +"and :attr:`~function.__annotations__`) and have a new ``__wrapped__`` " +"attribute." msgstr "" -"Class method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" -"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." -"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " -"``__wrapped__`` 屬性。" +"Class method 現在繼承了 method 屬性" +"(:attr:`~function.__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function.__doc__` " +"和 :attr:`~function.__annotations__`),並擁有一個新的 ``__wrapped__`` 屬性。" #: ../../library/functions.rst:292 msgid "" "Class methods can no longer wrap other :term:`descriptors ` such " "as :func:`property`." msgstr "" -"Class methods 不能再包裝其他的\\ :term:`描述器 `,例如 :func:" -"`property`。" +"Class methods 不能再包裝其他的\\ :term:`描述器 `,例" +"如 :func:`property`。" #: ../../library/functions.rst:299 msgid "" @@ -788,9 +788,9 @@ msgid "" "string, a byte string, or an AST object. Refer to the :mod:`ast` module " "documentation for information on how to work with AST objects." msgstr "" -"將 *source* 編譯成程式碼或 AST 物件。程式碼物件可以被 :func:`exec` 或 :func:" -"`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。參見 :mod:" -"`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" +"將 *source* 編譯成程式碼或 AST 物件。程式碼物件可以被 :func:`exec` " +"或 :func:`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。" +"參見 :mod:`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" #: ../../library/functions.rst:304 msgid "" @@ -816,38 +816,40 @@ msgstr "" #: ../../library/functions.rst:314 msgid "" -"The optional arguments *flags* and *dont_inherit* control which :ref:" -"`compiler options ` should be activated and which :ref:" -"`future features ` should be allowed. If neither is present (or both " -"are zero) the code is compiled with the same flags that affect the code that " -"is calling :func:`compile`. If the *flags* argument is given and " -"*dont_inherit* is not (or is zero) then the compiler options and the future " -"statements specified by the *flags* argument are used in addition to those " -"that would be used anyway. If *dont_inherit* is a non-zero integer then the " -"*flags* argument is it -- the flags (future features and compiler options) " -"in the surrounding code are ignored." +"The optional arguments *flags* and *dont_inherit* control " +"which :ref:`compiler options ` should be activated and " +"which :ref:`future features ` should be allowed. If neither is " +"present (or both are zero) the code is compiled with the same flags that " +"affect the code that is calling :func:`compile`. If the *flags* argument is " +"given and *dont_inherit* is not (or is zero) then the compiler options and " +"the future statements specified by the *flags* argument are used in addition " +"to those that would be used anyway. If *dont_inherit* is a non-zero integer " +"then the *flags* argument is it -- the flags (future features and compiler " +"options) in the surrounding code are ignored." msgstr "" "可選引數 *flags* 和 *dont_inherit* 控制啟用哪個\\ :ref:`編譯器選項 `\\ 以及允許哪個\\ :ref:`未來功能 `。如果兩者都不存在" "(或兩者都為零),則會呼叫與 :func:`compile` 相同旗標的程式碼來編譯。如果給" "定 *flags* 引數而未給定 *dont_inherit*(或為零)則無論如何都會使用由 *flags* " "引數所指定的編譯器選項和未來陳述式。如果 *dont_inherit* 是一個非零整數,則使" -"用 *flags* 引數 -- 周圍程式碼中的旗標(未來功能和編譯器選項)將被忽略。" +"用 *flags* 引數 -- 周圍程式碼中的旗標(未來功能和編譯器選項)將被忽略。" #: ../../library/functions.rst:325 msgid "" "Compiler options and future statements are specified by bits which can be " "bitwise ORed together to specify multiple options. The bitfield required to " -"specify a given future feature can be found as the :attr:`~__future__." -"_Feature.compiler_flag` attribute on the :class:`~__future__._Feature` " -"instance in the :mod:`__future__` module. :ref:`Compiler flags ` can be found in :mod:`ast` module, with ``PyCF_`` prefix." +"specify a given future feature can be found as " +"the :attr:`~__future__._Feature.compiler_flag` attribute on " +"the :class:`~__future__._Feature` instance in the :mod:`__future__` " +"module. :ref:`Compiler flags ` can be found " +"in :mod:`ast` module, with ``PyCF_`` prefix." msgstr "" "編譯器選項和 future 陳述式使用 bits 來表示,可以一起被位元操作 OR 來表示複數" -"個選項。需要被具體定義特徵的位元域可以透過 :mod:`__future__` module 中 :" -"class:`~__future__._Feature` 實例中的 :attr:`~__future__._Feature." -"compiler_flag` 屬性來獲得。:ref:`編譯器旗標 `\\ 可以在 :" -"mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名稱。" +"個選項。需要被具體定義特徵的位元域可以透過 :mod:`__future__` module " +"中 :class:`~__future__._Feature` 實例中" +"的 :attr:`~__future__._Feature.compiler_flag` 屬性來獲得。:ref:`編譯器旗標 " +"`\\ 可以在 :mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名" +"稱。" #: ../../library/functions.rst:333 msgid "" @@ -857,8 +859,8 @@ msgid "" "optimization; ``__debug__`` is true), ``1`` (asserts are removed, " "``__debug__`` is false) or ``2`` (docstrings are removed too)." msgstr "" -"引數 *optimize* 用來指定編譯器的最佳化級別;預設值 ``-1`` 選擇與直譯器的 :" -"option:`-O` 選項相同的最佳化級別。其他級別為 ``0``\\ (沒有最佳化;\\ " +"引數 *optimize* 用來指定編譯器的最佳化級別;預設值 ``-1`` 選擇與直譯器" +"的 :option:`-O` 選項相同的最佳化級別。其他級別為 ``0``\\ (沒有最佳化;\\ " "``__debug__`` 為真值)、``1``\\ (assert 被刪除,``__debug__`` 為假值)或 " "``2``\\ (說明字串 (docstring) 也被刪除)。" @@ -872,8 +874,8 @@ msgstr "" #: ../../library/functions.rst:342 msgid "" -"If you want to parse Python code into its AST representation, see :func:`ast." -"parse`." +"If you want to parse Python code into its AST representation, " +"see :func:`ast.parse`." msgstr "如果你想解析 Python 程式碼為 AST 運算式,請參閱 :func:`ast.parse`。" #: ../../library/functions.rst:345 ../../library/functions.rst:347 @@ -889,8 +891,8 @@ msgstr "" msgid "" "When compiling a string with multi-line code in ``'single'`` or ``'eval'`` " "mode, input must be terminated by at least one newline character. This is " -"to facilitate detection of incomplete and complete statements in the :mod:" -"`code` module." +"to facilitate detection of incomplete and complete statements in " +"the :mod:`code` module." msgstr "" "在 ``'single'`` 或 ``'eval'`` 模式編譯多行程式碼時,輸入必須以至少一個換行符" "結尾。這使 :mod:`code` module 更容易檢測陳述式的完整性。" @@ -983,23 +985,23 @@ msgid "" "and ``')'``, which are ignored. The string must not contain whitespace " "between ``'+'``, ``'-'``, the ``'j'`` or ``'J'`` suffix, and the decimal " "number. For example, ``complex('1+2j')`` is fine, but ``complex('1 + 2j')`` " -"raises :exc:`ValueError`. More precisely, the input must conform to the :" -"token:`~float:complexvalue` production rule in the following grammar, after " -"parentheses and leading and trailing whitespace characters are removed:" +"raises :exc:`ValueError`. More precisely, the input must conform to " +"the :token:`~float:complexvalue` production rule in the following grammar, " +"after parentheses and leading and trailing whitespace characters are removed:" msgstr "" #: ../../library/functions.rst:424 msgid "" "If the argument is a number, the constructor serves as a numeric conversion " "like :class:`int` and :class:`float`. For a general Python object ``x``, " -"``complex(x)`` delegates to ``x.__complex__()``. If :meth:`~object." -"__complex__` is not defined then it falls back to :meth:`~object.__float__`. " -"If :meth:`!__float__` is not defined then it falls back to :meth:`~object." -"__index__`." +"``complex(x)`` delegates to ``x.__complex__()``. " +"If :meth:`~object.__complex__` is not defined then it falls back " +"to :meth:`~object.__float__`. If :meth:`!__float__` is not defined then it " +"falls back to :meth:`~object.__index__`." msgstr "" "如果引數是一個數字,則建構函式會像 :class:`int` 和 :class:`float` 一樣進行數" -"值轉換。對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 ``x." -"__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall " +"值轉換。對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 " +"``x.__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall " "back) 到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未定義,則會再回" "退到 :meth:`~object.__index__`。" @@ -1029,8 +1031,8 @@ msgstr "可以使用底線將程式碼文字中的數字進行分組。" #: ../../library/functions.rst:450 msgid "" -"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` and :" -"meth:`~object.__float__` are not defined." +"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` " +"and :meth:`~object.__float__` are not defined." msgstr "" "如果 :meth:`~object.__complex__` 和 :meth:`~object.__float__` 未定義,則會回" "退到 :meth:`~object.__index__`。" @@ -1058,8 +1060,8 @@ msgstr "" #: ../../library/functions.rst:473 msgid "" -"For other containers see the built-in :class:`list`, :class:`set`, and :" -"class:`tuple` classes, as well as the :mod:`collections` module." +"For other containers see the built-in :class:`list`, :class:`set`, " +"and :class:`tuple` classes, as well as the :mod:`collections` module." msgstr "" "其他容器型別,請參見內建的 :class:`list`、:class:`set` 和 :class:`tuple` " "class,以及 :mod:`collections` module。" @@ -1077,9 +1079,9 @@ msgstr "" msgid "" "If the object has a method named :meth:`~object.__dir__`, this method will " "be called and must return the list of attributes. This allows objects that " -"implement a custom :func:`~object.__getattr__` or :func:`~object." -"__getattribute__` function to customize the way :func:`dir` reports their " -"attributes." +"implement a custom :func:`~object.__getattr__` " +"or :func:`~object.__getattribute__` function to customize the " +"way :func:`dir` reports their attributes." msgstr "" "如果物件有一個名為 :meth:`~object.__dir__` 的 method,那麼該 method 將被呼" "叫,並且必須回傳一個屬性列表。這允許實現自定義 :func:`~object.__getattr__` " @@ -1091,12 +1093,12 @@ msgid "" "If the object does not provide :meth:`~object.__dir__`, the function tries " "its best to gather information from the object's :attr:`~object.__dict__` " "attribute, if defined, and from its type object. The resulting list is not " -"necessarily complete and may be inaccurate when the object has a custom :" -"func:`~object.__getattr__`." +"necessarily complete and may be inaccurate when the object has a " +"custom :func:`~object.__getattr__`." msgstr "" -"如果物件不提供 :meth:`~object.__dir__`,這個函式會嘗試從物件已定義的 :attr:" -"`~object.__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的,如果物件有" -"自定義 :func:`~object.__getattr__`,那結果可能不準確。" +"如果物件不提供 :meth:`~object.__dir__`,這個函式會嘗試從物件已定義" +"的 :attr:`~object.__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的," +"如果物件有自定義 :func:`~object.__getattr__`,那結果可能不準確。" #: ../../library/functions.rst:496 msgid "" @@ -1153,30 +1155,30 @@ msgid "" "consisting of their quotient and remainder when using integer division. " "With mixed operand types, the rules for binary arithmetic operators apply. " "For integers, the result is the same as ``(a // b, a % b)``. For floating-" -"point numbers the result is ``(q, a % b)``, where *q* is usually ``math." -"floor(a / b)`` but may be 1 less than that. In any case ``q * b + a % b`` " -"is very close to *a*, if ``a % b`` is non-zero it has the same sign as *b*, " -"and ``0 <= abs(a % b) < abs(b)``." +"point numbers the result is ``(q, a % b)``, where *q* is usually " +"``math.floor(a / b)`` but may be 1 less than that. In any case ``q * b + a " +"% b`` is very close to *a*, if ``a % b`` is non-zero it has the same sign as " +"*b*, and ``0 <= abs(a % b) < abs(b)``." msgstr "" "它將兩個(非複數)數字作為引數,並在執行整數除法時回傳一對商和餘數。對於混合" "運算元型別,適用二進位算術運算子的規則。對於整數,運算結果和 ``(a // b, a % " -"b)`` 一致。對於浮點數,運算結果是 ``(q, a % b)``,*q* 通常是 ``math." -"floor(a / b)`` 但可能會比 1 小。在任何情況下,``q * b + a % b`` 和 *a* 基本相" -"等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % b) < " -"abs(b)``。" +"b)`` 一致。對於浮點數,運算結果是 ``(q, a % b)``,*q* 通常是 " +"``math.floor(a / b)`` 但可能會比 1 小。在任何情況下,``q * b + a % b`` 和 " +"*a* 基本相等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % " +"b) < abs(b)``。" #: ../../library/functions.rst:552 msgid "" -"Return an enumerate object. *iterable* must be a sequence, an :term:" -"`iterator`, or some other object which supports iteration. The :meth:" -"`~iterator.__next__` method of the iterator returned by :func:`enumerate` " -"returns a tuple containing a count (from *start* which defaults to 0) and " -"the values obtained from iterating over *iterable*." +"Return an enumerate object. *iterable* must be a sequence, " +"an :term:`iterator`, or some other object which supports iteration. " +"The :meth:`~iterator.__next__` method of the iterator returned " +"by :func:`enumerate` returns a tuple containing a count (from *start* which " +"defaults to 0) and the values obtained from iterating over *iterable*." msgstr "" "回傳一個列舉 (enumerate) 物件。*iterable* 必須是一個序列、:term:`iterator` 或" -"其他支援疊代的物件。:func:`enumerate` 回傳之 iterator 的 :meth:`~iterator." -"__next__` method 回傳一個 tuple(元組),裡面包含一個計數值(從 *start* 開" -"始,預設為 0)和透過疊代 *iterable* 獲得的值。" +"其他支援疊代的物件。:func:`enumerate` 回傳之 iterator " +"的 :meth:`~iterator.__next__` method 回傳一個 tuple(元組),裡面包含一個計數" +"值(從 *start* 開始,預設為 0)和透過疊代 *iterable* 獲得的值。" #: ../../library/functions.rst:564 msgid "Equivalent to::" @@ -1243,14 +1245,14 @@ msgid "" "reference to the dictionary of the built-in module :mod:`builtins` is " "inserted under that key before *expression* is parsed. That way you can " "control what builtins are available to the executed code by inserting your " -"own ``__builtins__`` dictionary into *globals* before passing it to :func:" -"`eval`. If the *locals* mapping is omitted it defaults to the *globals* " -"dictionary. If both mappings are omitted, the expression is executed with " -"the *globals* and *locals* in the environment where :func:`eval` is called. " -"Note, *eval()* will only have access to the :term:`nested scopes ` (non-locals) in the enclosing environment if they are already " -"referenced in the scope that is calling :func:`eval` (e.g. via a :keyword:" -"`nonlocal` statement)." +"own ``__builtins__`` dictionary into *globals* before passing it " +"to :func:`eval`. If the *locals* mapping is omitted it defaults to the " +"*globals* dictionary. If both mappings are omitted, the expression is " +"executed with the *globals* and *locals* in the environment " +"where :func:`eval` is called. Note, *eval()* will only have access to " +"the :term:`nested scopes ` (non-locals) in the enclosing " +"environment if they are already referenced in the scope that is " +"calling :func:`eval` (e.g. via a :keyword:`nonlocal` statement)." msgstr "" "*expression* 引數會被視為一條 Python 運算式(技術上而言,是條件列表)來剖析及" "求值,而 *globals* 和 *locals* 對映分別用作全域和區域命名空間。如果 " @@ -1258,11 +1260,11 @@ msgstr "" "析之前,將為該鍵插入對內建 :mod:`builtins` module dictionary 的引用。這麼一" "來,在將 ``__builtins__`` dictionary 傳入 :func:`eval` 之前,你可以透過將它插" "入 *globals* 來控制你需要哪些內建函式來執行程式碼。如果 *locals* 對映被省略," -"那它的預設值是 *globals* dictionary。如果兩個對映都被省略,則以在 :func:" -"`eval` 被呼叫的環境中的 *globals* 和 *locals* 執行運算式。請注意,*eval()* 在" -"封閉 (enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-" -"locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透過 :keyword:" -"`nonlocal` 陳述式)。" +"那它的預設值是 *globals* dictionary。如果兩個對映都被省略,則以" +"在 :func:`eval` 被呼叫的環境中的 *globals* 和 *locals* 執行運算式。請注意," +"*eval()* 在封閉 (enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透" +"過 :keyword:`nonlocal` 陳述式)。" #: ../../library/functions.rst:612 msgid "Example:" @@ -1287,8 +1289,8 @@ msgid "" "pass around for use by :func:`eval` or :func:`exec`." msgstr "" "提示::func:`exec` 函式支援動態執行陳述式。:func:`globals` 和 :func:`locals` " -"函式分別回傳當前的全域性和局部性 dictionary,它們對於將引數傳遞給 :func:" -"`eval` 或 :func:`exec` 可能會方便許多。" +"函式分別回傳當前的全域性和局部性 dictionary,它們對於將引數傳遞" +"給 :func:`eval` 或 :func:`exec` 可能會方便許多。" #: ../../library/functions.rst:628 msgid "" @@ -1330,18 +1332,18 @@ msgid "" "as a suite of Python statements which is then executed (unless a syntax " "error occurs). [#]_ If it is a code object, it is simply executed. In all " "cases, the code that's executed is expected to be valid as file input (see " -"the section :ref:`file-input` in the Reference Manual). Be aware that the :" -"keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return` statements may " -"not be used outside of function definitions even within the context of code " -"passed to the :func:`exec` function. The return value is ``None``." +"the section :ref:`file-input` in the Reference Manual). Be aware that " +"the :keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return` statements " +"may not be used outside of function definitions even within the context of " +"code passed to the :func:`exec` function. The return value is ``None``." msgstr "" "這個函式支援動態執行 Python 程式碼。*source* 必須是字串或者程式碼物件。如果是" "字串,那麼該字串將被剖析為一系列 Python 陳述式並執行(除非發生語法錯誤)。" "[#]_ 如果是程式碼物件,它將被直接執行。無論哪種情況,被執行的程式碼都需要和檔" "案輸入一樣是有效的(可參閱語言參考手冊中關於\\ :ref:`file-input`\\ 的章節)。" -"請注意,即使在傳遞給 :func:`exec` 函式的程式碼的上下文中,:keyword:" -"`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在函式之外使" -"用。該函式回傳值是 ``None``。" +"請注意,即使在傳遞給 :func:`exec` 函式的程式碼的上下文" +"中,:keyword:`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在" +"函式之外使用。該函式回傳值是 ``None``。" #: ../../library/functions.rst:668 msgid "" @@ -1371,9 +1373,9 @@ msgstr "" #: ../../library/functions.rst:684 msgid "" "If the *globals* dictionary does not contain a value for the key " -"``__builtins__``, a reference to the dictionary of the built-in module :mod:" -"`builtins` is inserted under that key. That way you can control what " -"builtins are available to the executed code by inserting your own " +"``__builtins__``, a reference to the dictionary of the built-in " +"module :mod:`builtins` is inserted under that key. That way you can control " +"what builtins are available to the executed code by inserting your own " "``__builtins__`` dictionary into *globals* before passing it to :func:`exec`." msgstr "" "如果 *globals* dictionary 不包含 ``__builtins__`` 鍵值,則將為該鍵插入對內" @@ -1408,9 +1410,9 @@ msgid "" "Pass an explicit *locals* dictionary if you need to see effects of the code " "on *locals* after function :func:`exec` returns." msgstr "" -"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣。如果你想在 :" -"func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 *locals* " -"dictionary 。" +"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣。如果你想" +"在 :func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 " +"*locals* dictionary 。" #: ../../library/functions.rst:713 msgid "Added the *closure* parameter." @@ -1510,9 +1512,9 @@ msgstr "" #: ../../library/functions.rst:796 msgid "" -"For a general Python object ``x``, ``float(x)`` delegates to ``x." -"__float__()``. If :meth:`~object.__float__` is not defined then it falls " -"back to :meth:`~object.__index__`." +"For a general Python object ``x``, ``float(x)`` delegates to " +"``x.__float__()``. If :meth:`~object.__float__` is not defined then it " +"falls back to :meth:`~object.__index__`." msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 會委派給 ``x.__float__()``。如果未" "定義 :meth:`~object.__float__` 則會回退到 :meth:`~object.__index__`。" @@ -1540,8 +1542,8 @@ msgid "" "is used by most built-in types: :ref:`formatspec`." msgstr "" "將 *value* 轉換為 *format_spec* 控制的 \"格式化\" 表示。*format_spec* 的解釋" -"取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語法::ref:" -"`formatspec`。" +"取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語" +"法::ref:`formatspec`。" #: ../../library/functions.rst:825 msgid "" @@ -1553,12 +1555,12 @@ msgstr "" #: ../../library/functions.rst:828 msgid "" -"A call to ``format(value, format_spec)`` is translated to ``type(value)." -"__format__(value, format_spec)`` which bypasses the instance dictionary when " -"searching for the value's :meth:`~object.__format__` method. A :exc:" -"`TypeError` exception is raised if the method search reaches :mod:`object` " -"and the *format_spec* is non-empty, or if either the *format_spec* or the " -"return value are not strings." +"A call to ``format(value, format_spec)`` is translated to " +"``type(value).__format__(value, format_spec)`` which bypasses the instance " +"dictionary when searching for the value's :meth:`~object.__format__` method. " +"A :exc:`TypeError` exception is raised if the method search " +"reaches :mod:`object` and the *format_spec* is non-empty, or if either the " +"*format_spec* or the return value are not strings." msgstr "" "呼叫 ``format(value, format_spec)`` 會轉換成 ``type(value).__format__(value, " "format_spec)``,當搜尋 value 的 :meth:`~object.__format__` method 時,會忽略" @@ -1570,23 +1572,24 @@ msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." msgstr "" -"當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引發 :" -"exc:`TypeError`。" +"當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引" +"發 :exc:`TypeError`。" #: ../../library/functions.rst:844 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " -"*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" -"ref:`types-set` for documentation about this class." +"*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` " +"and :ref:`types-set` for documentation about this class." msgstr "" "回傳一個新的 :class:`frozenset` 物件,它包含選擇性引數 *iterable* 中的元素。" -"``frozenset`` 是一個內建的 class。有關此 class 的文件,請參閱 :class:" -"`frozenset` 和 :ref:`types-set`。" +"``frozenset`` 是一個內建的 class。有關此 class 的文件,請參" +"閱 :class:`frozenset` 和 :ref:`types-set`。" #: ../../library/functions.rst:848 msgid "" -"For other containers see the built-in :class:`set`, :class:`list`, :class:" -"`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module." +"For other containers see the built-" +"in :class:`set`, :class:`list`, :class:`tuple`, and :class:`dict` classes, " +"as well as the :mod:`collections` module." msgstr "" "請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " "class,以及 :mod:`collections` module 來了解其它的容器。" @@ -1602,16 +1605,16 @@ msgid "" msgstr "" "回傳 *object* 之具名屬性的值。*name* 必須是字串。如果該字串是物件屬性之一的名" "稱,則回傳該屬性的值。例如,``getattr(x, 'foobar')`` 等同於 ``x.foobar``。如" -"果指定的屬性不存在,且提供了 *default* 值,則回傳其值,否則引發 :exc:" -"`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" -"`setattr`)。" +"果指定的屬性不存在,且提供了 *default* 值,則回傳其值,否則引" +"發 :exc:`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請" +"見 :func:`setattr`)。" #: ../../library/functions.rst:865 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " -"with two leading underscores) name in order to retrieve it with :func:" -"`getattr`." +"with two leading underscores) name in order to retrieve it " +"with :func:`getattr`." msgstr "" "由於\\ :ref:`私有名稱改編 (private name mangling) ` 是" "發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" @@ -1650,8 +1653,9 @@ msgstr "" #: ../../library/functions.rst:895 msgid "" -"For objects with custom :meth:`~object.__hash__` methods, note that :func:" -"`hash` truncates the return value based on the bit width of the host machine." +"For objects with custom :meth:`~object.__hash__` methods, note " +"that :func:`hash` truncates the return value based on the bit width of the " +"host machine." msgstr "" "請注意,如果物件帶有自訂的 :meth:`~object.__hash__` 方法,:func:`hash` 將根據" "運行機器的位元長度來截斷回傳值。" @@ -1697,12 +1701,12 @@ msgstr "" #: ../../library/functions.rst:923 msgid "" "Convert an integer number to a lowercase hexadecimal string prefixed with " -"\"0x\". If *x* is not a Python :class:`int` object, it has to define an :" -"meth:`~object.__index__` method that returns an integer. Some examples:" +"\"0x\". If *x* is not a Python :class:`int` object, it has to define " +"an :meth:`~object.__index__` method that returns an integer. Some examples:" msgstr "" -"將整數轉換為以 \"0x\" 為前綴的小寫十六進位制字串。如果 *x* 不是 Python :" -"class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並且回傳一" -"個整數。舉例來說:" +"將整數轉換為以 \"0x\" 為前綴的小寫十六進位制字串。如果 *x* 不是 " +"Python :class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並" +"且回傳一個整數。舉例來說:" #: ../../library/functions.rst:932 msgid "" @@ -1721,8 +1725,8 @@ msgstr "另請參閱 :func:`int` 將十六進位制字串轉換為以 16 為基 #: ../../library/functions.rst:949 msgid "" -"To obtain a hexadecimal string representation for a float, use the :meth:" -"`float.hex` method." +"To obtain a hexadecimal string representation for a float, use " +"the :meth:`float.hex` method." msgstr "" "如果要獲取浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" @@ -1760,14 +1764,14 @@ msgstr "" #: ../../library/functions.rst:973 msgid "" -">>> s = input('--> ') \n" +">>> s = input('--> ')\n" "--> Monty Python's Flying Circus\n" -">>> s \n" +">>> s\n" "\"Monty Python's Flying Circus\"" msgstr "" -">>> s = input('--> ') \n" +">>> s = input('--> ')\n" "--> Monty Python's Flying Circus\n" -">>> s \n" +">>> s\n" "\"Monty Python's Flying Circus\"" #: ../../library/functions.rst:978 @@ -1830,11 +1834,11 @@ msgstr "" #: ../../library/functions.rst:1015 msgid "" -"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x." -"__int__()``. If the argument defines :meth:`~object.__index__`, it returns " -"``x.__index__()``. If the argument defines :meth:`~object.__trunc__`, it " -"returns ``x.__trunc__()``. For floating-point numbers, this truncates " -"towards zero." +"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns " +"``x.__int__()``. If the argument defines :meth:`~object.__index__`, it " +"returns ``x.__index__()``. If the argument " +"defines :meth:`~object.__trunc__`, it returns ``x.__trunc__()``. For " +"floating-point numbers, this truncates towards zero." msgstr "" "如果引數定義了 :meth:`~object.__int__`,則 ``int(x)`` 回傳 ``x.__int__()``。" "如果引數定義了 :meth:`~object.__index__` 則回傳 ``x.__index__()``。如果引數定" @@ -1849,10 +1853,10 @@ msgid "" "``-`` (with no space in between), have leading zeros, be surrounded by " "whitespace, and have single underscores interspersed between digits." msgstr "" -"如果引數不是數字或如果有給定 *base*,則它必須是個字串、:class:`bytes` 或 :" -"class:`bytearray` 實例,表示基數 (radix) *base* 中的整數。可選地,字串之前可" -"以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、或在" -"數字間有單一底線。" +"如果引數不是數字或如果有給定 *base*,則它必須是個字串、:class:`bytes` " +"或 :class:`bytearray` 實例,表示基數 (radix) *base* 中的整數。可選地,字串之" +"前可以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、" +"或在數字間有單一底線。" #: ../../library/functions.rst:1027 msgid "" @@ -1882,15 +1886,15 @@ msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" #: ../../library/functions.rst:1040 msgid "" -"If *base* is not an instance of :class:`int` and the *base* object has a :" -"meth:`base.__index__ ` method, that method is called to " +"If *base* is not an instance of :class:`int` and the *base* object has " +"a :meth:`base.__index__ ` method, that method is called to " "obtain an integer for the base. Previous versions used :meth:`base.__int__ " "` instead of :meth:`base.__index__ `." msgstr "" "如果 *base* 不是 :class:`int` 的實例,但 *base* 物件有 :meth:`base.__index__ " "` method,則會呼叫該 method 來獲取此進位制所需的整數。以前" -"的版本使用 :meth:`base.__int__ ` 而不是 :meth:`base." -"__index__ `。" +"的版本使用 :meth:`base.__int__ ` 而不" +"是 :meth:`base.__index__ `。" #: ../../library/functions.rst:1050 msgid "The first parameter is now positional-only." @@ -1912,14 +1916,14 @@ msgid "" ":class:`int` string inputs and string representations can be limited to help " "avoid denial of service attacks. A :exc:`ValueError` is raised when the " "limit is exceeded while converting a string to an :class:`int` or when " -"converting an :class:`int` into a string would exceed the limit. See the :" -"ref:`integer string conversion length limitation ` " +"converting an :class:`int` into a string would exceed the limit. See " +"the :ref:`integer string conversion length limitation ` " "documentation." msgstr "" ":class:`int` 的字串輸入和字串表示法可以被限制,以避免阻斷服務攻擊 (denial of " -"service attack)。在字串 *x* 轉換為 :class:`int` 時已超出限制,或是在 :class:" -"`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱\\ :ref:`整" -"數字串轉換的長度限制 `\\ 說明文件。" +"service attack)。在字串 *x* 轉換為 :class:`int` 時已超出限制,或是" +"在 :class:`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱" +"\\ :ref:`整數字串轉換的長度限制 `\\ 說明文件。" #: ../../library/functions.rst:1069 msgid "" @@ -1929,18 +1933,18 @@ msgid "" "the function always returns ``False``. If *classinfo* is a tuple of type " "objects (or recursively, other such tuples) or a :ref:`types-union` of " "multiple types, return ``True`` if *object* is an instance of any of the " -"types. If *classinfo* is not a type or tuple of types and such tuples, a :" -"exc:`TypeError` exception is raised. :exc:`TypeError` may not be raised for " -"an invalid type if an earlier check succeeds." -msgstr "" -"如果 *object* 引數是 *classinfo* 引數的實例,或者是(直接、間接或 :term:" -"`virtual `)subclass 的實例,則回傳 ``True``。如果 " -"*object* 不是給定型別的物件,函式始終回傳 ``False``。如果 *classinfo* 是包含" -"物件型別的 tuple(或多個遞迴 tuple)或一個包含多種型別的 :ref:`types-union`," -"若 *object* 是其中的任何一個物件的實例則回傳 ``True``。如果 *classinfo* 既不" -"是型別,也不是型別 tuple 或型別的遞迴 tuple,那麼會引發 :exc:`TypeError` 異" -"常。若是先前檢查已經成功,:exc:`TypeError` 可能不會再因為不合格的型別而被引" -"發。" +"types. If *classinfo* is not a type or tuple of types and such tuples, " +"a :exc:`TypeError` exception is raised. :exc:`TypeError` may not be raised " +"for an invalid type if an earlier check succeeds." +msgstr "" +"如果 *object* 引數是 *classinfo* 引數的實例,或者是(直接、間接" +"或 :term:`virtual `)subclass 的實例,則回傳 ``True``。" +"如果 *object* 不是給定型別的物件,函式始終回傳 ``False``。如果 *classinfo* 是" +"包含物件型別的 tuple(或多個遞迴 tuple)或一個包含多種型別的 :ref:`types-" +"union`,若 *object* 是其中的任何一個物件的實例則回傳 ``True``。如果 " +"*classinfo* 既不是型別,也不是型別 tuple 或型別的遞迴 tuple,那麼會引" +"發 :exc:`TypeError` 異常。若是先前檢查已經成功,:exc:`TypeError` 可能不會再因" +"為不合格的型別而被引發。" #: ../../library/functions.rst:1080 ../../library/functions.rst:1094 msgid "*classinfo* can be a :ref:`types-union`." @@ -1948,27 +1952,27 @@ msgstr "*classinfo* 可以是一個 :ref:`types-union`。" #: ../../library/functions.rst:1086 msgid "" -"Return ``True`` if *class* is a subclass (direct, indirect, or :term:" -"`virtual `) of *classinfo*. A class is considered a " -"subclass of itself. *classinfo* may be a tuple of class objects (or " -"recursively, other such tuples) or a :ref:`types-union`, in which case " +"Return ``True`` if *class* is a subclass (direct, indirect, " +"or :term:`virtual `) of *classinfo*. A class is " +"considered a subclass of itself. *classinfo* may be a tuple of class objects " +"(or recursively, other such tuples) or a :ref:`types-union`, in which case " "return ``True`` if *class* is a subclass of any entry in *classinfo*. In " "any other case, a :exc:`TypeError` exception is raised." msgstr "" "如果 *class* 是 *classinfo* 的 subclass(直接、間接或 :term:`virtual " "`),則回傳 ``True``。*classinfo* 可以是 class 物件的 " "tuple(或遞迴地其他類似 tuple)或是一個 :ref:`types-union`,此時若 *class* " -"是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引發 :" -"exc:`TypeError`。" +"是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引" +"發 :exc:`TypeError`。" #: ../../library/functions.rst:1101 msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " -"second argument, *object* must be a collection object which supports the :" -"term:`iterable` protocol (the :meth:`~object.__iter__` method), or it must " -"support the sequence protocol (the :meth:`~object.__getitem__` method with " -"integer arguments starting at ``0``). If it does not support either of " +"second argument, *object* must be a collection object which supports " +"the :term:`iterable` protocol (the :meth:`~object.__iter__` method), or it " +"must support the sequence protocol (the :meth:`~object.__getitem__` method " +"with integer arguments starting at ``0``). If it does not support either of " "those protocols, :exc:`TypeError` is raised. If the second argument, " "*sentinel*, is given, then *object* must be a callable object. The iterator " "created in this case will call *object* with no arguments for each call to " @@ -1977,13 +1981,13 @@ msgid "" "returned." msgstr "" "回傳一個 :term:`iterator` 物件。根據是否存在第二個引數,第一個引數的意義是非" -"常不同的。如果沒有第二個引數,*object* 必須是支援 :term:`iterable` 協定(有 :" -"meth:`~object.__iter__` method)的集合物件,或必須支援序列協定(有 :meth:" -"`~object.__getitem__` 方法,且數字引數從 ``0`` 開始)。如果它不支援這些協定," -"會引發 :exc:`TypeError`。如果有第二個引數 *sentinel*,那麼 *object* 必須是可" -"呼叫的物件,這種情況下生成的 iterator,每次疊代呼叫 :meth:`~iterator." -"__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 *sentinel* 則引發 :" -"exc:`StopIteration`,否則回傳呼叫結果。" +"常不同的。如果沒有第二個引數,*object* 必須是支援 :term:`iterable` 協定" +"(有 :meth:`~object.__iter__` method)的集合物件,或必須支援序列協定" +"(有 :meth:`~object.__getitem__` 方法,且數字引數從 ``0`` 開始)。如果它不支" +"援這些協定,會引發 :exc:`TypeError`。如果有第二個引數 *sentinel*,那麼 " +"*object* 必須是可呼叫的物件,這種情況下生成的 iterator,每次疊代呼" +"叫 :meth:`~iterator.__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 " +"*sentinel* 則引發 :exc:`StopIteration`,否則回傳呼叫結果。" #: ../../library/functions.rst:1115 msgid "See also :ref:`typeiter`." @@ -2021,8 +2025,8 @@ msgstr "" #: ../../library/functions.rst:1135 msgid "" -"``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." -"maxsize`, such as :class:`range(2 ** 100) `." +"``len`` raises :exc:`OverflowError` on lengths larger " +"than :data:`sys.maxsize`, such as :class:`range(2 ** 100) `." msgstr "" "如果物件長度大於 :data:`sys.maxsize`,像是 :class:`range(2 ** 100) `," "則 ``len`` 會引發 :exc:`OverflowError`。" @@ -2045,8 +2049,8 @@ msgstr "" #: ../../library/functions.rst:1154 msgid "" "At module scope, as well as when using :func:`exec` or :func:`eval` with a " -"single namespace, this function returns the same namespace as :func:" -"`globals`." +"single namespace, this function returns the same namespace " +"as :func:`globals`." msgstr "" #: ../../library/functions.rst:1158 @@ -2107,10 +2111,10 @@ msgstr "" #: ../../library/functions.rst:1193 msgid "" "As part of :pep:`667`, the semantics of mutating the mapping objects " -"returned from this function are now defined. The behavior in :term:" -"`optimized scopes ` is now as described above. Aside from " -"being defined, the behaviour in other scopes remains unchanged from previous " -"versions." +"returned from this function are now defined. The behavior " +"in :term:`optimized scopes ` is now as described above. " +"Aside from being defined, the behaviour in other scopes remains unchanged " +"from previous versions." msgstr "" #: ../../library/functions.rst:1203 @@ -2148,20 +2152,20 @@ msgid "" "There are two optional keyword-only arguments. The *key* argument specifies " "a one-argument ordering function like that used for :meth:`list.sort`. The " "*default* argument specifies an object to return if the provided iterable is " -"empty. If the iterable is empty and *default* is not provided, a :exc:" -"`ValueError` is raised." +"empty. If the iterable is empty and *default* is not provided, " +"a :exc:`ValueError` is raised." msgstr "" "這個函式有兩個選擇性的僅限關鍵字引數。*key* 引數能指定單一引數所使用的排序函" "式,如同 :meth:`list.sort` 的使用方式。*default* 引數是當 iterable 為空時回傳" -"的物件。如果 iterable 為空,並且沒有提供 *default*,則會引發 :exc:" -"`ValueError`。" +"的物件。如果 iterable 為空,並且沒有提供 *default*,則會引" +"發 :exc:`ValueError`。" #: ../../library/functions.rst:1229 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " -"such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and ``heapq." -"nlargest(1, iterable, key=keyfunc)``." +"such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and " +"``heapq.nlargest(1, iterable, key=keyfunc)``." msgstr "" "如果有多個最大元素,則此函式將回傳第一個找到的。這和其他穩定排序工具如 " "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " @@ -2177,8 +2181,8 @@ msgstr "*key* 可以為 ``None``。" #: ../../library/functions.rst:1245 msgid "" -"Return a \"memory view\" object created from the given argument. See :ref:" -"`typememoryview` for more information." +"Return a \"memory view\" object created from the given argument. " +"See :ref:`typememoryview` for more information." msgstr "" "回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參" "閱\\ :ref:`typememoryview`。" @@ -2211,13 +2215,14 @@ msgstr "" #: ../../library/functions.rst:1282 msgid "" -"Retrieve the next item from the :term:`iterator` by calling its :meth:" -"`~iterator.__next__` method. If *default* is given, it is returned if the " -"iterator is exhausted, otherwise :exc:`StopIteration` is raised." +"Retrieve the next item from the :term:`iterator` by calling " +"its :meth:`~iterator.__next__` method. If *default* is given, it is " +"returned if the 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:1289 msgid "" @@ -2246,8 +2251,8 @@ msgid "" "integer. For example:" msgstr "" "將一個整數轉變為一個前綴為 \"0o\" 的八進位制字串。回傳結果是一個有效的 " -"Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" -"`~object.__index__` method 回傳一個整數。舉例來說:" +"Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定" +"義 :meth:`~object.__index__` method 回傳一個整數。舉例來說:" #: ../../library/functions.rst:1313 msgid "" @@ -2288,18 +2293,18 @@ msgid "" "already exists), ``'x'`` for exclusive creation, and ``'a'`` for appending " "(which on *some* Unix systems, means that *all* writes append to the end of " "the file regardless of the current seek position). In text mode, if " -"*encoding* is not specified the encoding used is platform-dependent: :func:" -"`locale.getencoding` is called to get the current locale encoding. (For " -"reading and writing raw bytes use binary mode and leave *encoding* " -"unspecified.) The available modes are:" +"*encoding* is not specified the encoding used is platform-" +"dependent: :func:`locale.getencoding` is called to get the current locale " +"encoding. (For reading and writing raw bytes use binary mode and leave " +"*encoding* unspecified.) The available modes are:" msgstr "" "*mode* 是一個選擇性字串,用於指定開啟檔案的模式。預設值是 ``'r'``,這意味著它" "以文字模式開啟並讀取。其他常見模式有:寫入 ``'w'``\\ (會捨去已經存在的檔" "案)、唯一性建立 ``'x'``、追加寫入 ``'a'``\\ (在\\ *一些* Unix 系統上,無論" "當前的檔案指標在什麼位置,*所有* 寫入都會追加到檔案末尾)。在文字模式,如果沒" -"有指定 *encoding*,則根據電腦平臺來決定使用的編碼:呼叫 :func:`locale." -"getencoding` 來獲取當前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模" -"式且不要指定 *encoding*。)可用的模式有:" +"有指定 *encoding*,則根據電腦平臺來決定使用的編碼:呼" +"叫 :func:`locale.getencoding` 來獲取當前的本地編碼。(要讀取和寫入原始 " +"bytes,請使用二進位制模式且不要指定 *encoding*。)可用的模式有:" #: ../../library/functions.rst:1357 msgid "Character" @@ -2429,9 +2434,9 @@ msgid "" "systems, the buffer will typically be 4096 or 8192 bytes long." msgstr "" "二進制檔案會以固定大小的區塊進行緩衝;緩衝區的大小是使用啟發式嘗試 " -"(heuristic trying) 來決定底層設備的「區塊大小」,並會回退到 :attr:`io." -"DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 8192 個位元" -"組。" +"(heuristic trying) 來決定底層設備的「區塊大小」,並會回退" +"到 :attr:`io.DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 " +"8192 個位元組。" #: ../../library/functions.rst:1401 msgid "" @@ -2460,8 +2465,9 @@ msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled—this cannot be used in binary mode. A variety of " "standard error handlers are available (listed under :ref:`error-handlers`), " -"though any error handling name that has been registered with :func:`codecs." -"register_error` is also valid. The standard names include:" +"though any error handling name that has been registered " +"with :func:`codecs.register_error` is also valid. The standard names " +"include:" msgstr "" "*errors* 是一個選擇性的字串,用於指定要如何處理編碼和解碼的錯誤——它不能在二進" "制模式下使用。有許多不同的標準錯誤處理程式(error handler,在\\ :ref:`error-" @@ -2555,10 +2561,10 @@ msgstr "" #: ../../library/functions.rst:1463 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " -"characters written are translated to the system default line separator, :" -"data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no translation " -"takes place. If *newline* is any of the other legal values, any ``'\\n'`` " -"characters written are translated to the given string." +"characters written are translated to the system default line " +"separator, :data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no " +"translation takes place. If *newline* is any of the other legal values, any " +"``'\\n'`` characters written are translated to the given string." msgstr "" "將輸出寫入資料串流時,如果 *newline* 是 ``None``,則被寫入的任何 ``'\\n'`` 字" "元都會轉換為系統預設的行分隔符號 :data:`os.linesep`。如果 *newline* 是 " @@ -2595,8 +2601,8 @@ msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" #: ../../library/functions.rst:1482 msgid "" -"The following example uses the :ref:`dir_fd ` parameter of the :func:" -"`os.open` function to open a file relative to a given directory::" +"The following example uses the :ref:`dir_fd ` parameter of " +"the :func:`os.open` function to open a file relative to a given directory::" msgstr "" "下面的範例使用 :func:`os.open` 函式回傳值當作 :ref:`dir_fd ` 的參數," "從給定的目錄中用相對路徑開啟檔案: ::" @@ -2618,35 +2624,35 @@ msgstr "" msgid "" "The type of :term:`file object` returned by the :func:`open` function " "depends on the mode. When :func:`open` is used to open a file in a text " -"mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass of :" -"class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When used " -"to open a file in a binary mode with buffering, the returned class is a " +"mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass " +"of :class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When " +"used to open a file in a binary mode with buffering, the returned class is a " "subclass of :class:`io.BufferedIOBase`. The exact class varies: in read " "binary mode, it returns an :class:`io.BufferedReader`; in write binary and " "append binary modes, it returns an :class:`io.BufferedWriter`, and in read/" "write mode, it returns an :class:`io.BufferedRandom`. When buffering is " -"disabled, the raw stream, a subclass of :class:`io.RawIOBase`, :class:`io." -"FileIO`, is returned." +"disabled, the raw stream, a subclass " +"of :class:`io.RawIOBase`, :class:`io.FileIO`, is returned." msgstr "" ":func:`open` 函式回傳的 :term:`file object` 型別取決於模式。當 :func:`open` " "是在文字模式中開啟檔案時(``'w'``、``'r'``、``'wt'``、``'rt'`` 等),它會回" -"傳 :class:`io.TextIOBase` 的一個 subclass(具體來說,就是 :class:`io." -"TextIOWrapper`)。使用有緩衝的二進制模式開啟檔案時,回傳的 class 則會是 :" -"class:`io.BufferedIOBase` 的 subclass。確切的 class 各不相同:在讀取的二進制" -"模式,它會回傳 :class:`io.BufferedReader`;在寫入和附加的二進制模式,它會回" -"傳 :class:`io.BufferedWriter`,而在讀/寫模式,它會回傳 :class:`io." -"BufferedRandom`。當緩衝被停用時,會回傳原始資料串流 :class:`io.FileIO`,它" -"是 :class:`io.RawIOBase` 的一個 subclass。" +"傳 :class:`io.TextIOBase` 的一個 subclass(具體來說,就" +"是 :class:`io.TextIOWrapper`)。使用有緩衝的二進制模式開啟檔案時,回傳的 " +"class 則會是 :class:`io.BufferedIOBase` 的 subclass。確切的 class 各不相同:" +"在讀取的二進制模式,它會回傳 :class:`io.BufferedReader`;在寫入和附加的二進制" +"模式,它會回傳 :class:`io.BufferedWriter`,而在讀/寫模式,它會回" +"傳 :class:`io.BufferedRandom`。當緩衝被停用時,會回傳原始資料串" +"流 :class:`io.FileIO`,它是 :class:`io.RawIOBase` 的一個 subclass。" #: ../../library/functions.rst:1516 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " -"(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" -"`tempfile`, and :mod:`shutil`." +"(where :func:`open` is " +"declared), :mod:`os`, :mod:`os.path`, :mod:`tempfile`, and :mod:`shutil`." msgstr "" -"另請參閱檔案操作模組,例如 :mod:`fileinput`、:mod:`io`\\ (定義了 :func:" -"`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:" -"`shutil`。" +"另請參閱檔案操作模組,例如 :mod:`fileinput`、:mod:`io`\\ (定義" +"了 :func:`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以" +"及 :mod:`shutil`。" #: ../../library/functions.rst:1520 msgid "" @@ -2679,8 +2685,8 @@ msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." msgstr "" -"如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引發 :exc:" -"`FileExistsError`。" +"如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引" +"發 :exc:`FileExistsError`。" #: ../../library/functions.rst:1535 msgid "The file is now non-inheritable." @@ -2689,8 +2695,8 @@ msgstr "檔案在此版本開始是不可繼承的。" #: ../../library/functions.rst:1539 msgid "" "If the system call is interrupted and the signal handler does not raise an " -"exception, the function now retries the system call instead of raising an :" -"exc:`InterruptedError` exception (see :pep:`475` for the rationale)." +"exception, the function now retries the system call instead of raising " +"an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" "如果系統呼叫被中斷,但訊號處理程式沒有引發例外,此函式現在會重試系統呼叫,而" "不是引發 :exc:`InterruptedError` 例外(原因詳見 :pep:`475`)。" @@ -2705,8 +2711,8 @@ msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" #: ../../library/functions.rst:1547 msgid "" -"On Windows, opening a console buffer may return a subclass of :class:`io." -"RawIOBase` other than :class:`io.FileIO`." +"On Windows, opening a console buffer may return a subclass " +"of :class:`io.RawIOBase` other than :class:`io.FileIO`." msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" @@ -2747,9 +2753,9 @@ msgid "" "2)`` returns ``100``, but ``pow(10, -2)`` returns ``0.01``. For a negative " "base of type :class:`int` or :class:`float` and a non-integral exponent, a " "complex result is delivered. For example, ``pow(-9, 0.5)`` returns a value " -"close to ``3j``. Whereas, for a negative base of type :class:`int` or :class:" -"`float` with an integral exponent, a float result is delivered. For example, " -"``pow(-9, 2.0)`` returns ``81.0``." +"close to ``3j``. Whereas, for a negative base of type :class:`int` " +"or :class:`float` with an integral exponent, a float result is delivered. " +"For example, ``pow(-9, 2.0)`` returns ``81.0``." msgstr "" "引數必須是數值型別。對於混合型別的運算元,會套用二元算術運算子的強制轉型 " "(coercion) 規則。對於 :class:`int` 運算元,運算結果會(在強制轉型後)與運算元" @@ -2757,9 +2763,9 @@ msgstr "" "並得到浮點數的結果。例如,``pow(10, 2)`` 會回傳 ``100``,但 ``pow(10, -2)`` " "會回傳 ``0.01``。如果底數 (base) 是型別為 :class:`int` 或 :class:`float` 的負" "數且指數 (exponent) 不是整數,則會得到一個複數的結果,例如 ``pow(-9, 0.5)`` " -"會回傳一個接近 ``3j`` 的值。如果底數 (base) 是型別為 :class:`int` 或 :class:" -"`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 ``pow(-9, 2.0)`` " -"會回傳 ``81.0``。" +"會回傳一個接近 ``3j`` 的值。如果底數 (base) 是型別為 :class:`int` " +"或 :class:`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 " +"``pow(-9, 2.0)`` 會回傳 ``81.0``。" #: ../../library/functions.rst:1580 msgid "" @@ -2910,12 +2916,12 @@ msgstr "" msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " -"possible to create read-only properties easily using :func:`property` as a :" -"term:`decorator`::" +"possible to create read-only properties easily using :func:`property` as " +"a :term:`decorator`::" msgstr "" "如果有給定 *doc*,它將會是 property 屬性的說明字串。否則,property 會複製 " -"*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使用 :func:" -"`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" +"*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使" +"用 :func:`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" #: ../../library/functions.rst:1660 msgid "" @@ -3046,10 +3052,10 @@ msgstr "" #: ../../library/functions.rst:1754 msgid "" -"Return a reverse :term:`iterator`. *seq* must be an object which has a :" -"meth:`~object.__reversed__` method or supports the sequence protocol (the :" -"meth:`~object.__len__` method and the :meth:`~object.__getitem__` method " -"with integer arguments starting at ``0``)." +"Return a reverse :term:`iterator`. *seq* must be an object which has " +"a :meth:`~object.__reversed__` method or supports the sequence protocol " +"(the :meth:`~object.__len__` method and the :meth:`~object.__getitem__` " +"method with integer arguments starting at ``0``)." msgstr "" #: ../../library/functions.rst:1762 @@ -3072,8 +3078,8 @@ msgstr "" #: ../../library/functions.rst:1775 msgid "" -"For a general Python object ``number``, ``round`` delegates to ``number." -"__round__``." +"For a general Python object ``number``, ``round`` delegates to " +"``number.__round__``." msgstr "" #: ../../library/functions.rst:1780 @@ -3094,9 +3100,9 @@ msgstr "" #: ../../library/functions.rst:1796 msgid "" -"For other containers see the built-in :class:`frozenset`, :class:`list`, :" -"class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " -"module." +"For other containers see the built-" +"in :class:`frozenset`, :class:`list`, :class:`tuple`, and :class:`dict` " +"classes, as well as the :mod:`collections` module." msgstr "" #: ../../library/functions.rst:1803 @@ -3111,10 +3117,10 @@ msgstr "" #: ../../library/functions.rst:1809 msgid "" "*name* need not be a Python identifier as defined in :ref:`identifiers` " -"unless the object chooses to enforce that, for example in a custom :meth:" -"`~object.__getattribute__` or via :attr:`~object.__slots__`. An attribute " -"whose name is not an identifier will not be accessible using the dot " -"notation, but is accessible through :func:`getattr` etc.." +"unless the object chooses to enforce that, for example in a " +"custom :meth:`~object.__getattribute__` or via :attr:`~object.__slots__`. An " +"attribute whose name is not an identifier will not be accessible using the " +"dot notation, but is accessible through :func:`getattr` etc.." msgstr "" #: ../../library/functions.rst:1817 @@ -3142,14 +3148,16 @@ msgstr "" #: ../../library/functions.rst:1839 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " -"example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" -"`itertools.islice` for an alternate version that returns an :term:`iterator`." +"example: ``a[start:stop:step]`` or ``a[start:stop, i]``. " +"See :func:`itertools.islice` for an alternate version that returns " +"an :term:`iterator`." msgstr "" #: ../../library/functions.rst:1844 msgid "" -"Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:" -"`~slice.stop`, and :attr:`~slice.step` are hashable)." +"Slice objects are now :term:`hashable` " +"(provided :attr:`~slice.start`, :attr:`~slice.stop`, and :attr:`~slice.step` " +"are hashable)." msgstr "" #: ../../library/functions.rst:1850 @@ -3164,8 +3172,9 @@ msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" #: ../../library/functions.rst:1854 msgid "" "*key* specifies a function of one argument that is used to extract a " -"comparison key from each element in *iterable* (for example, ``key=str." -"lower``). The default value is ``None`` (compare the elements directly)." +"comparison key from each element in *iterable* (for example, " +"``key=str.lower``). The default value is ``None`` (compare the elements " +"directly)." msgstr "" #: ../../library/functions.rst:1858 @@ -3227,8 +3236,8 @@ msgstr "" #: ../../library/functions.rst:1891 msgid "" -"The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" -"`function` for details." +"The ``@staticmethod`` form is a function :term:`decorator` -- " +"see :ref:`function` for details." msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" @@ -3236,9 +3245,9 @@ msgstr "" #: ../../library/functions.rst:1894 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " -"an instance (such as ``C().f()``). Moreover, the static method :term:" -"`descriptor` is also callable, so it can be used in the class definition " -"(such as ``f()``)." +"an instance (such as ``C().f()``). Moreover, the static " +"method :term:`descriptor` is also callable, so it can be used in the class " +"definition (such as ``f()``)." msgstr "" #: ../../library/functions.rst:1899 @@ -3277,15 +3286,15 @@ msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" #: ../../library/functions.rst:1917 msgid "" -"Static methods now inherit the method attributes (:attr:`~function." -"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" -"attr:`~function.__doc__` and :attr:`~function.__annotations__`), have a new " -"``__wrapped__`` attribute, and are now callable as regular functions." +"Static methods now inherit the method attributes " +"(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " +"and :attr:`~function.__annotations__`), have a new ``__wrapped__`` " +"attribute, and are now callable as regular functions." msgstr "" -"Static method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" -"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." -"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " -"``__wrapped__`` 屬性,且為如一般函式的可呼叫物件。" +"Static method 現在繼承了 method 屬性" +"(:attr:`~function.__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function.__doc__` " +"和 :attr:`~function.__annotations__`),並擁有一個新的 ``__wrapped__`` 屬性," +"且為如一般函式的可呼叫物件。" #: ../../library/functions.rst:1933 msgid "" @@ -3308,10 +3317,10 @@ msgstr "" #: ../../library/functions.rst:1945 msgid "" "For some use cases, there are good alternatives to :func:`sum`. The " -"preferred, fast way to concatenate a sequence of strings is by calling ``''." -"join(sequence)``. To add floating-point values with extended precision, " -"see :func:`math.fsum`\\. To concatenate a series of iterables, consider " -"using :func:`itertools.chain`." +"preferred, fast way to concatenate a sequence of strings is by calling " +"``''.join(sequence)``. To add floating-point values with extended " +"precision, see :func:`math.fsum`\\. To concatenate a series of iterables, " +"consider using :func:`itertools.chain`." msgstr "" #: ../../library/functions.rst:1951 @@ -3339,17 +3348,17 @@ msgstr "" #: ../../library/functions.rst:1969 msgid "" -"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -" -"> A -> object`` and the value of *type* is ``B``, then :func:`super` " +"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C " +"-> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" #: ../../library/functions.rst:1973 msgid "" "The :attr:`~type.__mro__` attribute of the class corresponding to " -"*object_or_type* lists the method resolution search order used by both :func:" -"`getattr` and :func:`super`. The attribute is dynamic and can change " -"whenever the inheritance hierarchy is updated." +"*object_or_type* lists the method resolution search order used by " +"both :func:`getattr` and :func:`super`. The attribute is dynamic and can " +"change whenever the inheritance hierarchy is updated." msgstr "" #: ../../library/functions.rst:1978 @@ -3432,9 +3441,9 @@ msgstr "" #: ../../library/functions.rst:2031 msgid "" -"For practical suggestions on how to design cooperative classes using :func:" -"`super`, see `guide to using super() `_." +"For practical suggestions on how to design cooperative classes " +"using :func:`super`, see `guide to using super() `_." msgstr "" #: ../../library/functions.rst:2041 @@ -3446,8 +3455,8 @@ msgstr "" #: ../../library/functions.rst:2050 msgid "" "With one argument, return the type of an *object*. The return value is a " -"type object and generally the same object as returned by :attr:`object." -"__class__`." +"type object and generally the same object as returned " +"by :attr:`object.__class__`." msgstr "" #: ../../library/functions.rst:2054 @@ -3464,9 +3473,9 @@ msgid "" "tuple contains the base classes and becomes the :attr:`~type.__bases__` " "attribute; if empty, :class:`object`, the ultimate base of all classes, is " "added. The *dict* dictionary contains attribute and method definitions for " -"the class body; it may be copied or wrapped before becoming the :attr:`~type." -"__dict__` attribute. The following two statements create identical :class:`!" -"type` objects:" +"the class body; it may be copied or wrapped before becoming " +"the :attr:`~type.__dict__` attribute. The following two statements create " +"identical :class:`!type` objects:" msgstr "" #: ../../library/functions.rst:2072 @@ -3509,10 +3518,11 @@ msgstr "" #: ../../library/functions.rst:2094 msgid "" -"Objects such as modules and instances have an updateable :attr:`~object." -"__dict__` attribute; however, other objects may have write restrictions on " -"their :attr:`!__dict__` attributes (for example, classes use a :class:`types." -"MappingProxyType` to prevent direct dictionary updates)." +"Objects such as modules and instances have an " +"updateable :attr:`~object.__dict__` attribute; however, other objects may " +"have write restrictions on their :attr:`!__dict__` attributes (for example, " +"classes use a :class:`types.MappingProxyType` to prevent direct dictionary " +"updates)." msgstr "" #: ../../library/functions.rst:2099 @@ -3567,15 +3577,15 @@ msgstr "" #: ../../library/functions.rst:2128 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " -"columns into rows. This is similar to `transposing a matrix `_." +"columns into rows. This is similar to `transposing a matrix `_." msgstr "" #: ../../library/functions.rst:2132 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " -"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" -"`list`." +"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in " +"a :class:`list`." msgstr "" #: ../../library/functions.rst:2136 @@ -3632,8 +3642,8 @@ msgstr "" #: ../../library/functions.rst:2177 msgid "" "Shorter iterables can be padded with a constant value to make all the " -"iterables have the same length. This is done by :func:`itertools." -"zip_longest`." +"iterables have the same length. This is done " +"by :func:`itertools.zip_longest`." msgstr "" #: ../../library/functions.rst:2181 @@ -3913,29 +3923,3 @@ msgstr "import(引入)" #: ../../library/functions.rst:2209 msgid "builtins" msgstr "builtins(內建)" - -#~ msgid "" -#~ "Most users should just pass a *globals* argument and never *locals*. If " -#~ "exec gets two separate objects as *globals* and *locals*, the code will " -#~ "be executed as if it were embedded in a class definition." -#~ msgstr "" -#~ "大部分使用者只需要傳入 *globals* 引數,而不用傳遞 *locals*。如果 exec 有" -#~ "兩個不同的 *globals* 和 *locals* 物件,程式碼就像嵌入在 class 定義中一樣執" -#~ "行。" - -#~ msgid "" -#~ "Update and return a dictionary representing the current local symbol " -#~ "table. Free variables are returned by :func:`locals` when it is called in " -#~ "function blocks, but not in class blocks. Note that at the module level, :" -#~ "func:`locals` and :func:`globals` are the same dictionary." -#~ msgstr "" -#~ "更新並回傳表示當前本地符號表的 dictionary。在函式區塊而不是 class 區塊中呼" -#~ "叫 :func:`locals` 時會回傳自由變數。請注意,在 module 階層中,:func:" -#~ "`locals` 和 :func:`globals` 是相同的 dictionary。" - -#~ msgid "" -#~ "The contents of this dictionary should not be modified; changes may not " -#~ "affect the values of local and free variables used by the interpreter." -#~ msgstr "" -#~ "此 dictionary 的內容不應該被更動;更改可能不會影響直譯器使用的本地變數或自" -#~ "由變數的值。" diff --git a/library/gzip.po b/library/gzip.po index d2643f46da..80000614b1 100644 --- a/library/gzip.po +++ b/library/gzip.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-11 00:15+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-" @@ -105,7 +105,7 @@ msgstr "" msgid "Added support for the ``'x'``, ``'xb'`` and ``'xt'`` modes." msgstr "新增 ``'x'``、``'xb'`` 和 ``'xt'`` 模式的支援。" -#: ../../library/gzip.rst:59 ../../library/gzip.rst:175 +#: ../../library/gzip.rst:59 ../../library/gzip.rst:173 msgid "Accepts a :term:`path-like object`." msgstr "接受\\ :term:`類路徑物件 `。" @@ -201,27 +201,26 @@ msgstr ":class:`GzipFile` 也提供了以下的方法和屬性:" #: ../../library/gzip.rst:124 msgid "" -"Read *n* uncompressed bytes without advancing the file position. At most one " -"single read on the compressed stream is done to satisfy the call. The " -"number of bytes returned may be more or less than requested." +"Read *n* uncompressed bytes without advancing the file position. The number " +"of bytes returned may be more or less than requested." msgstr "" -#: ../../library/gzip.rst:129 +#: ../../library/gzip.rst:127 msgid "" "While calling :meth:`peek` does not change the file position of the :class:" "`GzipFile`, it may change the position of the underlying file object (e.g. " "if the :class:`GzipFile` was constructed with the *fileobj* parameter)." msgstr "" -#: ../../library/gzip.rst:138 +#: ../../library/gzip.rst:136 msgid "``'rb'`` for reading and ``'wb'`` for writing." msgstr "" -#: ../../library/gzip.rst:140 +#: ../../library/gzip.rst:138 msgid "In previous versions it was an integer ``1`` or ``2``." msgstr "" -#: ../../library/gzip.rst:145 +#: ../../library/gzip.rst:143 msgid "" "When decompressing, this attribute is set to the last timestamp in the most " "recently read header. It is an integer, holding the number of seconds since " @@ -229,62 +228,62 @@ msgid "" "reading any headers is ``None``." msgstr "" -#: ../../library/gzip.rst:152 +#: ../../library/gzip.rst:150 msgid "" "The path to the gzip file on disk, as a :class:`str` or :class:`bytes`. " "Equivalent to the output of :func:`os.fspath` on the original input path, " "with no other normalization, resolution or expansion." msgstr "" -#: ../../library/gzip.rst:156 +#: ../../library/gzip.rst:154 msgid "" "Support for the :keyword:`with` statement was added, along with the *mtime* " "constructor argument and :attr:`mtime` attribute." msgstr "" -#: ../../library/gzip.rst:160 +#: ../../library/gzip.rst:158 msgid "Support for zero-padded and unseekable files was added." msgstr "" -#: ../../library/gzip.rst:163 +#: ../../library/gzip.rst:161 msgid "The :meth:`io.BufferedIOBase.read1` method is now implemented." msgstr ":meth:`io.BufferedIOBase.read1` 方法現在已有實作。" -#: ../../library/gzip.rst:166 +#: ../../library/gzip.rst:164 msgid "Added support for the ``'x'`` and ``'xb'`` modes." msgstr "新增 ``'x'`` 和 ``'xb'`` 模式的支援。" -#: ../../library/gzip.rst:169 +#: ../../library/gzip.rst:167 msgid "" "Added support for writing arbitrary :term:`bytes-like objects `. The :meth:`~io.BufferedIOBase.read` method now accepts an argument " "of ``None``." msgstr "" -#: ../../library/gzip.rst:178 +#: ../../library/gzip.rst:176 msgid "" "Opening :class:`GzipFile` for writing without specifying the *mode* argument " "is deprecated." msgstr "" -#: ../../library/gzip.rst:182 +#: ../../library/gzip.rst:180 msgid "" "Remove the ``filename`` attribute, use the :attr:`~GzipFile.name` attribute " "instead." msgstr "" -#: ../../library/gzip.rst:189 +#: ../../library/gzip.rst:187 msgid "" "Compress the *data*, returning a :class:`bytes` object containing the " "compressed data. *compresslevel* and *mtime* have the same meaning as in " "the :class:`GzipFile` constructor above." msgstr "" -#: ../../library/gzip.rst:194 +#: ../../library/gzip.rst:192 msgid "Added the *mtime* parameter for reproducible output." msgstr "" -#: ../../library/gzip.rst:196 +#: ../../library/gzip.rst:194 msgid "" "Speed is improved by compressing all data at once instead of in a streamed " "fashion. Calls with *mtime* set to ``0`` are delegated to :func:`zlib." @@ -293,13 +292,13 @@ msgid "" "underlying zlib implementation." msgstr "" -#: ../../library/gzip.rst:203 +#: ../../library/gzip.rst:201 msgid "" "The gzip header OS byte is guaranteed to be set to 255 when this function is " "used as was the case in 3.10 and earlier." msgstr "" -#: ../../library/gzip.rst:209 +#: ../../library/gzip.rst:207 msgid "" "Decompress the *data*, returning a :class:`bytes` object containing the " "uncompressed data. This function is capable of decompressing multi-member " @@ -308,21 +307,21 @@ msgid "" "*wbits* set to 31 is faster." msgstr "" -#: ../../library/gzip.rst:216 +#: ../../library/gzip.rst:214 msgid "" "Speed is improved by decompressing members at once in memory instead of in a " "streamed fashion." msgstr "" -#: ../../library/gzip.rst:223 +#: ../../library/gzip.rst:221 msgid "Examples of usage" msgstr "用法範例" -#: ../../library/gzip.rst:225 +#: ../../library/gzip.rst:223 msgid "Example of how to read a compressed file::" msgstr "如何讀取壓縮檔案的範例: ::" -#: ../../library/gzip.rst:227 +#: ../../library/gzip.rst:225 msgid "" "import gzip\n" "with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" @@ -332,11 +331,11 @@ msgstr "" "with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" " file_content = f.read()" -#: ../../library/gzip.rst:231 +#: ../../library/gzip.rst:229 msgid "Example of how to create a compressed GZIP file::" msgstr "如何建立一個壓縮的 GZIP 檔案的範例: ::" -#: ../../library/gzip.rst:233 +#: ../../library/gzip.rst:231 msgid "" "import gzip\n" "content = b\"Lots of content here\"\n" @@ -348,11 +347,11 @@ msgstr "" "with gzip.open('/home/joe/file.txt.gz', 'wb') as f:\n" " f.write(content)" -#: ../../library/gzip.rst:238 +#: ../../library/gzip.rst:236 msgid "Example of how to GZIP compress an existing file::" msgstr "如何壓縮一個已存在的檔案的範例: ::" -#: ../../library/gzip.rst:240 +#: ../../library/gzip.rst:238 msgid "" "import gzip\n" "import shutil\n" @@ -366,11 +365,11 @@ msgstr "" " with gzip.open('/home/joe/file.txt.gz', 'wb') as f_out:\n" " shutil.copyfileobj(f_in, f_out)" -#: ../../library/gzip.rst:246 +#: ../../library/gzip.rst:244 msgid "Example of how to GZIP compress a binary string::" msgstr "如何壓縮一個二進位字串的範例: ::" -#: ../../library/gzip.rst:248 +#: ../../library/gzip.rst:246 msgid "" "import gzip\n" "s_in = b\"Lots of content here\"\n" @@ -380,56 +379,56 @@ msgstr "" "s_in = b\"Lots of content here\"\n" "s_out = gzip.compress(s_in)" -#: ../../library/gzip.rst:254 +#: ../../library/gzip.rst:252 msgid "Module :mod:`zlib`" msgstr ":mod:`zlib` 模組" -#: ../../library/gzip.rst:255 +#: ../../library/gzip.rst:253 msgid "" "The basic data compression module needed to support the :program:`gzip` file " "format." msgstr "" -#: ../../library/gzip.rst:264 +#: ../../library/gzip.rst:262 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/gzip.rst:266 +#: ../../library/gzip.rst:264 msgid "" "The :mod:`gzip` module provides a simple command line interface to compress " "or decompress files." msgstr "" -#: ../../library/gzip.rst:269 +#: ../../library/gzip.rst:267 msgid "Once executed the :mod:`gzip` module keeps the input file(s)." msgstr "" -#: ../../library/gzip.rst:273 +#: ../../library/gzip.rst:271 msgid "" "Add a new command line interface with a usage. By default, when you will " "execute the CLI, the default compression level is 6." msgstr "" -#: ../../library/gzip.rst:277 +#: ../../library/gzip.rst:275 msgid "Command line options" msgstr "命令列選項" -#: ../../library/gzip.rst:281 +#: ../../library/gzip.rst:279 msgid "If *file* is not specified, read from :data:`sys.stdin`." msgstr "如果未指定 *file*,則從 :data:`sys.stdin` 讀取。" -#: ../../library/gzip.rst:285 +#: ../../library/gzip.rst:283 msgid "Indicates the fastest compression method (less compression)." msgstr "" -#: ../../library/gzip.rst:289 +#: ../../library/gzip.rst:287 msgid "Indicates the slowest compression method (best compression)." msgstr "" -#: ../../library/gzip.rst:293 +#: ../../library/gzip.rst:291 msgid "Decompress the given file." msgstr "解壓縮指定的檔案。" -#: ../../library/gzip.rst:297 +#: ../../library/gzip.rst:295 msgid "Show the help message." msgstr "顯示幫助訊息。" diff --git a/library/heapq.po b/library/heapq.po index 859f7606c5..247538547e 100644 --- a/library/heapq.po +++ b/library/heapq.po @@ -123,8 +123,8 @@ msgstr "在線性時間內將 list *x* 轉為 heap,且過程不會申請額外 #: ../../library/heapq.rst:71 msgid "" "Pop and return the smallest item from the *heap*, and also push the new " -"*item*. The heap size doesn't change. If the heap is empty, :exc:" -"`IndexError` is raised." +"*item*. The heap size doesn't change. If the heap is " +"empty, :exc:`IndexError` is raised." msgstr "" "從 *heap* 取出並回傳最小的元素,接著將新的 *item* 放進heap。heap 的大小不會改" "變。如果 heap 是空的會產生 :exc:`IndexError` 錯誤。" @@ -220,26 +220,26 @@ msgid "" "Return a list with the *n* smallest elements from the dataset defined by " "*iterable*. *key*, if provided, specifies a function of one argument that " "is used to extract a comparison key from each element in *iterable* (for " -"example, ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key)[:" -"n]``." +"example, ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key)" +"[:n]``." msgstr "" "回傳一個包含資料 *iterable* 中前 *n* 小元素的 list 。如果有指定 *key* 引數," "*key* 會是只有一個引數的函式,用來從每一個在 *iterable* 中的元素提取一個比較" -"的依據(例如 ``key=str.lower`` )。效果相當於 ``sorted(iterable, key=key)[:" -"n]`` 。" +"的依據(例如 ``key=str.lower`` )。效果相當於 ``sorted(iterable, key=key)" +"[:n]`` 。" #: ../../library/heapq.rst:130 msgid "" "The latter two functions perform best for smaller values of *n*. For larger " "values, it is more efficient to use the :func:`sorted` function. Also, when " -"``n==1``, it is more efficient to use the built-in :func:`min` and :func:" -"`max` functions. If repeated usage of these functions is required, consider " -"turning the iterable into an actual heap." +"``n==1``, it is more efficient to use the built-in :func:`min` " +"and :func:`max` functions. If repeated usage of these functions is " +"required, consider turning the iterable into an actual heap." msgstr "" -"後兩個函式在 *n* 值比較小時有最好的表現。對於較大的 *n* 值,只用 :func:" -"`sorted` 函式會更有效率。同樣地,當 ``n==1`` 時,使用內建函式 :func:`min` " -"和 :func:`max` 會有更好的效率。如果需要重複使用這些函式,可以考慮將 iterable " -"轉成真正的 heap 。" +"後兩個函式在 *n* 值比較小時有最好的表現。對於較大的 *n* 值,只" +"用 :func:`sorted` 函式會更有效率。同樣地,當 ``n==1`` 時,使用內建函" +"式 :func:`min` 和 :func:`max` 會有更好的效率。如果需要重複使用這些函式,可以" +"考慮將 iterable 轉成真正的 heap 。" #: ../../library/heapq.rst:138 msgid "Basic Examples" @@ -358,10 +358,10 @@ msgid "" "returned in the order they were added. And since no two entry counts are the " "same, the tuple comparison will never attempt to directly compare two tasks." msgstr "" -"一個針對前兩個問題的解法是:儲存一個包含 priority 、 entry count 和 task 三個" -"元素的 tuple 。兩個 task 有相同 priority 時, entry count 會讓兩個 task 能根" -"據加入的順序排序。因為沒有任何兩個 task 擁有相同的 entry count ,所以永遠不會" -"直接使用 task 做比較。" +"一個針對前兩個問題的解法是:儲存一個包含 priority、entry count 和 task 三個元" +"素的 tuple 。兩個 task 有相同 priority 時,entry count 會讓兩個 task 能根據加" +"入的順序排序。因為沒有任何兩個 task 擁有相同的 entry count,所以永遠不會直接" +"使用 task 做比較。" #: ../../library/heapq.rst:192 msgid "" @@ -439,6 +439,33 @@ msgid "" " return task\n" " raise KeyError('pop from an empty priority queue')" msgstr "" +"pq = [] # 在 heap 中的 entry 串列\n" +"entry_finder = {} # task 對應到 entry 的對映\n" +"REMOVED = '' # 被刪除的 task 的佔位器\n" +"counter = itertools.count() # 唯一的序列計數\n" +"\n" +"def add_task(task, priority=0):\n" +" '新增一個 task 或更新一個已存在 task 的 priority'\n" +" if task in entry_finder:\n" +" remove_task(task)\n" +" count = next(counter)\n" +" entry = [priority, count, task]\n" +" entry_finder[task] = entry\n" +" heappush(pq, entry)\n" +"\n" +"def remove_task(task):\n" +" '將一個已存在的 task 標記為 REMOVED。如果找不到會引發 KeyError。'\n" +" entry = entry_finder.pop(task)\n" +" entry[-1] = REMOVED\n" +"\n" +"def pop_task():\n" +" '移除並回傳最低 priority 的 task。如果 heap 是空的會引發 KeyError。'\n" +" while pq:\n" +" priority, count, task = heappop(pq)\n" +" if task is not REMOVED:\n" +" del entry_finder[task]\n" +" return task\n" +" raise KeyError('從空的優先佇列中 pop 出元素')" #: ../../library/heapq.rst:241 msgid "Theory" diff --git a/library/html.po b/library/html.po index 5da95baaf8..a8f42a9973 100644 --- a/library/html.po +++ b/library/html.po @@ -20,7 +20,7 @@ msgstr "" #: ../../library/html.rst:2 msgid ":mod:`!html` --- HyperText Markup Language support" -msgstr ":mod:`!html` --- 超連結標記語言 (HTML) 支援" +msgstr ":mod:`!html` --- 超文本標記語言 (HTML) 支援" #: ../../library/html.rst:7 msgid "**Source code:** :source:`Lib/html/__init__.py`" @@ -45,11 +45,11 @@ msgstr "" #: ../../library/html.rst:26 msgid "" -"Convert all named and numeric character references (e.g. ``>``, ``>" -"``, ``>``) in the string *s* to the corresponding Unicode characters. " -"This function uses the rules defined by the HTML 5 standard for both valid " -"and invalid character references, and the :data:`list of HTML 5 named " -"character references `." +"Convert all named and numeric character references (e.g. ``>``, " +"``>``, ``>``) in the string *s* to the corresponding Unicode " +"characters. This function uses the rules defined by the HTML 5 standard for " +"both valid and invalid character references, and the :data:`list of HTML 5 " +"named character references `." msgstr "" "將字串 *s* 中所有附名 (named) 且為數值的 (numeric) 字元參照(如: ``>``、 " "``>``、``>`` )轉換為對應的 Unicode 字元。此函式針對有效及無效的字元" diff --git a/library/http.cookiejar.po b/library/http.cookiejar.po index 6184715dab..8614f5b523 100644 --- a/library/http.cookiejar.po +++ b/library/http.cookiejar.po @@ -36,11 +36,11 @@ msgstr "" #: ../../library/http.cookiejar.rst:19 msgid "" -"Both the regular Netscape cookie protocol and the protocol defined by :rfc:" -"`2965` are handled. RFC 2965 handling is switched off by default. :rfc:" -"`2109` cookies are parsed as Netscape cookies and subsequently treated " -"either as Netscape or RFC 2965 cookies according to the 'policy' in effect. " -"Note that the great majority of cookies on the internet are Netscape " +"Both the regular Netscape cookie protocol and the protocol defined " +"by :rfc:`2965` are handled. RFC 2965 handling is switched off by " +"default. :rfc:`2109` cookies are parsed as Netscape cookies and subsequently " +"treated either as Netscape or RFC 2965 cookies according to the 'policy' in " +"effect. Note that the great majority of cookies on the internet are Netscape " "cookies. :mod:`http.cookiejar` attempts to follow the de-facto Netscape " "cookie protocol (which differs substantially from that set out in the " "original Netscape specification), including taking note of the ``max-age`` " @@ -49,11 +49,11 @@ msgstr "" #: ../../library/http.cookiejar.rst:31 msgid "" -"The various named parameters found in :mailheader:`Set-Cookie` and :" -"mailheader:`Set-Cookie2` headers (eg. ``domain`` and ``expires``) are " +"The various named parameters found in :mailheader:`Set-Cookie` " +"and :mailheader:`Set-Cookie2` headers (eg. ``domain`` and ``expires``) are " "conventionally referred to as :dfn:`attributes`. To distinguish them from " -"Python attributes, the documentation for this module uses the term :dfn:" -"`cookie-attribute` instead." +"Python attributes, the documentation for this module uses the " +"term :dfn:`cookie-attribute` instead." msgstr "" #: ../../library/http.cookiejar.rst:38 @@ -126,8 +126,8 @@ msgid "" "a sequence of the only domains for which we accept and return cookies. " "*secure_protocols* is a sequence of protocols for which secure cookies can " "be added to. By default *https* and *wss* (secure websocket) are considered " -"secure protocols. For all other arguments, see the documentation for :class:" -"`CookiePolicy` and :class:`DefaultCookiePolicy` objects." +"secure protocols. For all other arguments, see the documentation " +"for :class:`CookiePolicy` and :class:`DefaultCookiePolicy` objects." msgstr "" #: ../../library/http.cookiejar.rst:98 @@ -138,17 +138,17 @@ msgid "" "attribute of 1) are treated according to the RFC 2965 rules. However, if " "RFC 2965 handling is turned off or :attr:`rfc2109_as_netscape` is ``True``, " "RFC 2109 cookies are 'downgraded' by the :class:`CookieJar` instance to " -"Netscape cookies, by setting the :attr:`version` attribute of the :class:" -"`Cookie` instance to 0. :class:`DefaultCookiePolicy` also provides some " -"parameters to allow some fine-tuning of policy." +"Netscape cookies, by setting the :attr:`version` attribute of " +"the :class:`Cookie` instance to 0. :class:`DefaultCookiePolicy` also " +"provides some parameters to allow some fine-tuning of policy." msgstr "" #: ../../library/http.cookiejar.rst:111 msgid "" "This class represents Netscape, :rfc:`2109` and :rfc:`2965` cookies. It is " -"not expected that users of :mod:`http.cookiejar` construct their own :class:" -"`Cookie` instances. Instead, if necessary, call :meth:`make_cookies` on a :" -"class:`CookieJar` instance." +"not expected that users of :mod:`http.cookiejar` construct their " +"own :class:`Cookie` instances. Instead, if necessary, " +"call :meth:`make_cookies` on a :class:`CookieJar` instance." msgstr "" #: ../../library/http.cookiejar.rst:119 @@ -165,8 +165,9 @@ msgstr ":mod:`http.cookies` 模組" #: ../../library/http.cookiejar.rst:123 msgid "" -"HTTP cookie classes, principally useful for server-side code. The :mod:" -"`http.cookiejar` and :mod:`http.cookies` modules do not depend on each other." +"HTTP cookie classes, principally useful for server-side code. " +"The :mod:`http.cookiejar` and :mod:`http.cookies` modules do not depend on " +"each other." msgstr "" #: ../../library/http.cookiejar.rst:127 @@ -227,7 +228,7 @@ msgstr ":class:`CookieJar` 擁有以下方法:" #: ../../library/http.cookiejar.rst:158 msgid "Add correct :mailheader:`Cookie` header to *request*." -msgstr "" +msgstr "將正確的 :mailheader:`Cookie` 標頭加入 *request*。" #: ../../library/http.cookiejar.rst:160 msgid "" @@ -240,10 +241,10 @@ msgstr "" #: ../../library/http.cookiejar.rst:164 msgid "" "The *request* object (usually a :class:`urllib.request.Request` instance) " -"must support the methods :meth:`get_full_url`, :meth:`has_header`, :meth:" -"`get_header`, :meth:`header_items`, :meth:`add_unredirected_header` and the " -"attributes :attr:`host`, :attr:`!type`, :attr:`unverifiable` and :attr:" -"`origin_req_host` as documented by :mod:`urllib.request`." +"must support the " +"methods :meth:`get_full_url`, :meth:`has_header`, :meth:`get_header`, :meth:`header_items`, :meth:`add_unredirected_header` " +"and the attributes :attr:`host`, :attr:`!type`, :attr:`unverifiable` " +"and :attr:`origin_req_host` as documented by :mod:`urllib.request`." msgstr "" #: ../../library/http.cookiejar.rst:172 ../../library/http.cookiejar.rst:198 @@ -254,32 +255,34 @@ msgstr "" #: ../../library/http.cookiejar.rst:178 msgid "" -"Extract cookies from HTTP *response* and store them in the :class:" -"`CookieJar`, where allowed by policy." +"Extract cookies from HTTP *response* and store them in " +"the :class:`CookieJar`, where allowed by policy." msgstr "" #: ../../library/http.cookiejar.rst:181 msgid "" -"The :class:`CookieJar` will look for allowable :mailheader:`Set-Cookie` and :" -"mailheader:`Set-Cookie2` headers in the *response* argument, and store " +"The :class:`CookieJar` will look for allowable :mailheader:`Set-Cookie` " +"and :mailheader:`Set-Cookie2` headers in the *response* argument, and store " "cookies as appropriate (subject to the :meth:`CookiePolicy.set_ok` method's " "approval)." msgstr "" #: ../../library/http.cookiejar.rst:185 msgid "" -"The *response* object (usually the result of a call to :meth:`urllib.request." -"urlopen`, or similar) should support an :meth:`info` method, which returns " -"an :class:`email.message.Message` instance." +"The *response* object (usually the result of a call " +"to :meth:`urllib.request.urlopen`, or similar) should support " +"an :meth:`info` method, which returns an :class:`email.message.Message` " +"instance." msgstr "" #: ../../library/http.cookiejar.rst:189 msgid "" "The *request* object (usually a :class:`urllib.request.Request` instance) " -"must support the method :meth:`get_full_url` and the attributes :attr:" -"`host`, :attr:`unverifiable` and :attr:`origin_req_host`, as documented by :" -"mod:`urllib.request`. The request is used to set default values for cookie-" -"attributes as well as for checking that the cookie is allowed to be set." +"must support the method :meth:`get_full_url` and the " +"attributes :attr:`host`, :attr:`unverifiable` and :attr:`origin_req_host`, " +"as documented by :mod:`urllib.request`. The request is used to set default " +"values for cookie-attributes as well as for checking that the cookie is " +"allowed to be set." msgstr "" #: ../../library/http.cookiejar.rst:203 @@ -309,7 +312,7 @@ msgstr "" #: ../../library/http.cookiejar.rst:227 msgid "Clear some cookies." -msgstr "" +msgstr "清除一些 cookies。" #: ../../library/http.cookiejar.rst:229 msgid "" @@ -322,7 +325,7 @@ msgstr "" #: ../../library/http.cookiejar.rst:235 msgid "Raises :exc:`KeyError` if no matching cookie exists." -msgstr "" +msgstr "如果沒有符合的 cookie 存在,則引發 :exc:`KeyError`。" #: ../../library/http.cookiejar.rst:240 msgid "Discard all session cookies." @@ -349,7 +352,7 @@ msgstr "" #: ../../library/http.cookiejar.rst:255 msgid "Save cookies to a file." -msgstr "" +msgstr "將 cookies 儲存到檔案中。" #: ../../library/http.cookiejar.rst:257 msgid "" @@ -361,8 +364,8 @@ msgstr "" msgid "" "*filename* is the name of file in which to save cookies. If *filename* is " "not specified, :attr:`self.filename` is used (whose default is the value " -"passed to the constructor, if any); if :attr:`self.filename` is :const:" -"`None`, :exc:`ValueError` is raised." +"passed to the constructor, if any); if :attr:`self.filename` " +"is :const:`None`, :exc:`ValueError` is raised." msgstr "" #: ../../library/http.cookiejar.rst:265 @@ -374,32 +377,32 @@ msgstr "" #: ../../library/http.cookiejar.rst:268 msgid "" "The file is overwritten if it already exists, thus wiping all the cookies it " -"contains. Saved cookies can be restored later using the :meth:`load` or :" -"meth:`revert` methods." +"contains. Saved cookies can be restored later using the :meth:`load` " +"or :meth:`revert` methods." msgstr "" #: ../../library/http.cookiejar.rst:275 msgid "Load cookies from a file." -msgstr "" +msgstr "從檔案中載入 cookies。" #: ../../library/http.cookiejar.rst:277 msgid "Old cookies are kept unless overwritten by newly loaded ones." -msgstr "" +msgstr "舊的 cookies 會被保留,除非被新載入的 cookies 覆蓋。" #: ../../library/http.cookiejar.rst:279 msgid "Arguments are as for :meth:`save`." -msgstr "" +msgstr "引數與 :meth:`save` 相同。" #: ../../library/http.cookiejar.rst:281 msgid "" -"The named file must be in the format understood by the class, or :exc:" -"`LoadError` will be raised. Also, :exc:`OSError` may be raised, for example " -"if the file does not exist." +"The named file must be in the format understood by the class, " +"or :exc:`LoadError` will be raised. Also, :exc:`OSError` may be raised, for " +"example if the file does not exist." msgstr "" #: ../../library/http.cookiejar.rst:285 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." -msgstr "" +msgstr "以前會引發 :exc:`IOError`,現在它是 :exc:`OSError` 的別名。" #: ../../library/http.cookiejar.rst:291 msgid "Clear all cookies and reload cookies from a saved file." @@ -413,7 +416,7 @@ msgstr "" #: ../../library/http.cookiejar.rst:296 msgid ":class:`FileCookieJar` instances have the following public attributes:" -msgstr "" +msgstr ":class:`FileCookieJar` 實例擁有以下公開屬性:" #: ../../library/http.cookiejar.rst:301 msgid "" @@ -493,8 +496,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:366 msgid "" "*cookie* is a :class:`Cookie` instance. *request* is an object implementing " -"the interface defined by the documentation for :meth:`CookieJar." -"extract_cookies`." +"the interface defined by the documentation " +"for :meth:`CookieJar.extract_cookies`." msgstr "" #: ../../library/http.cookiejar.rst:373 @@ -505,8 +508,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:375 msgid "" "*cookie* is a :class:`Cookie` instance. *request* is an object implementing " -"the interface defined by the documentation for :meth:`CookieJar." -"add_cookie_header`." +"the interface defined by the documentation " +"for :meth:`CookieJar.add_cookie_header`." msgstr "" #: ../../library/http.cookiejar.rst:382 @@ -524,12 +527,13 @@ msgstr "" #: ../../library/http.cookiejar.rst:389 msgid "" -"If :meth:`domain_return_ok` returns true for the cookie domain, :meth:" -"`path_return_ok` is called for the cookie path. Otherwise, :meth:" -"`path_return_ok` and :meth:`return_ok` are never called for that cookie " -"domain. If :meth:`path_return_ok` returns true, :meth:`return_ok` is called " -"with the :class:`Cookie` object itself for a full check. Otherwise, :meth:" -"`return_ok` is never called for that cookie path." +"If :meth:`domain_return_ok` returns true for the cookie " +"domain, :meth:`path_return_ok` is called for the cookie path. " +"Otherwise, :meth:`path_return_ok` and :meth:`return_ok` are never called for " +"that cookie domain. If :meth:`path_return_ok` returns " +"true, :meth:`return_ok` is called with the :class:`Cookie` object itself for " +"a full check. Otherwise, :meth:`return_ok` is never called for that cookie " +"path." msgstr "" #: ../../library/http.cookiejar.rst:396 @@ -554,19 +558,19 @@ msgstr "關於 :meth:`domain_return_ok` 請見文件。" #: ../../library/http.cookiejar.rst:410 msgid "" -"In addition to implementing the methods above, implementations of the :class:" -"`CookiePolicy` interface must also supply the following attributes, " -"indicating which protocols should be used, and how. All of these attributes " -"may be assigned to." +"In addition to implementing the methods above, implementations of " +"the :class:`CookiePolicy` interface must also supply the following " +"attributes, indicating which protocols should be used, and how. All of " +"these attributes may be assigned to." msgstr "" #: ../../library/http.cookiejar.rst:418 msgid "Implement Netscape protocol." -msgstr "" +msgstr "實作 Netscape 協定。" #: ../../library/http.cookiejar.rst:423 msgid "Implement :rfc:`2965` protocol." -msgstr "" +msgstr "實作 :rfc:`2965` 協定。" #: ../../library/http.cookiejar.rst:428 msgid "" @@ -640,8 +644,8 @@ msgid "" "A domain blocklist and allowlist is provided (both off by default). Only " "domains not in the blocklist and present in the allowlist (if the allowlist " "is active) participate in cookie setting and returning. Use the " -"*blocked_domains* constructor argument, and :meth:`blocked_domains` and :" -"meth:`set_blocked_domains` methods (and the corresponding argument and " +"*blocked_domains* constructor argument, and :meth:`blocked_domains` " +"and :meth:`set_blocked_domains` methods (and the corresponding argument and " "methods for *allowed_domains*). If you set an allowlist, you can turn it " "off again by setting it to :const:`None`." msgstr "" @@ -652,11 +656,12 @@ msgid "" "cookie domain to be matched. For example, ``\"example.com\"`` matches a " "blocklist entry of ``\"example.com\"``, but ``\"www.example.com\"`` does " "not. Domains that do start with a dot are matched by more specific domains " -"too. For example, both ``\"www.example.com\"`` and ``\"www.coyote.example." -"com\"`` match ``\".example.com\"`` (but ``\"example.com\"`` itself does " -"not). IP addresses are an exception, and must match exactly. For example, " -"if blocked_domains contains ``\"192.168.1.2\"`` and ``\".168.1.2\"``, " -"192.168.1.2 is blocked, but 193.168.1.2 is not." +"too. For example, both ``\"www.example.com\"`` and " +"``\"www.coyote.example.com\"`` match ``\".example.com\"`` (but " +"``\"example.com\"`` itself does not). IP addresses are an exception, and " +"must match exactly. For example, if blocked_domains contains " +"``\"192.168.1.2\"`` and ``\".168.1.2\"``, 192.168.1.2 is blocked, but " +"193.168.1.2 is not." msgstr "" #: ../../library/http.cookiejar.rst:483 @@ -704,10 +709,10 @@ msgid "" "If true, request that the :class:`CookieJar` instance downgrade :rfc:`2109` " "cookies (ie. cookies received in a :mailheader:`Set-Cookie` header with a " "version cookie-attribute of 1) to Netscape cookies by setting the version " -"attribute of the :class:`Cookie` instance to 0. The default value is :const:" -"`None`, in which case RFC 2109 cookies are downgraded if and only if :rfc:" -"`2965` handling is turned off. Therefore, RFC 2109 cookies are downgraded " -"by default." +"attribute of the :class:`Cookie` instance to 0. The default value " +"is :const:`None`, in which case RFC 2109 cookies are downgraded if and only " +"if :rfc:`2965` handling is turned off. Therefore, RFC 2109 cookies are " +"downgraded by default." msgstr "" #: ../../library/http.cookiejar.rst:532 @@ -767,8 +772,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:580 msgid "" -"When setting cookies, the 'host prefix' must not contain a dot (eg. ``www." -"foo.bar.com`` can't set a cookie for ``.bar.com``, because ``www.foo`` " +"When setting cookies, the 'host prefix' must not contain a dot (eg. " +"``www.foo.bar.com`` can't set a cookie for ``.bar.com``, because ``www.foo`` " "contains a dot)." msgstr "" @@ -824,10 +829,10 @@ msgstr "" #: ../../library/http.cookiejar.rst:630 msgid "" -"Integer or :const:`None`. Netscape cookies have :attr:`version` 0. :rfc:" -"`2965` and :rfc:`2109` cookies have a ``version`` cookie-attribute of 1. " -"However, note that :mod:`http.cookiejar` may 'downgrade' RFC 2109 cookies to " -"Netscape cookies, in which case :attr:`version` is 0." +"Integer or :const:`None`. Netscape cookies have :attr:`version` " +"0. :rfc:`2965` and :rfc:`2109` cookies have a ``version`` cookie-attribute " +"of 1. However, note that :mod:`http.cookiejar` may 'downgrade' RFC 2109 " +"cookies to Netscape cookies, in which case :attr:`version` is 0." msgstr "" #: ../../library/http.cookiejar.rst:638 @@ -840,8 +845,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:648 msgid "" -"String representing a port or a set of ports (eg. '80', or '80,8080'), or :" -"const:`None`." +"String representing a port or a set of ports (eg. '80', or '80,8080'), " +"or :const:`None`." msgstr "" #: ../../library/http.cookiejar.rst:654 @@ -858,8 +863,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:669 msgid "" -"Integer expiry date in seconds since epoch, or :const:`None`. See also the :" -"meth:`is_expired` method." +"Integer expiry date in seconds since epoch, or :const:`None`. See also " +"the :meth:`is_expired` method." msgstr "" #: ../../library/http.cookiejar.rst:675 @@ -868,8 +873,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:680 msgid "" -"String comment from the server explaining the function of this cookie, or :" -"const:`None`." +"String comment from the server explaining the function of this cookie, " +"or :const:`None`." msgstr "" #: ../../library/http.cookiejar.rst:686 @@ -947,14 +952,14 @@ msgstr "" msgid "" "import http.cookiejar, urllib.request\n" "cj = http.cookiejar.CookieJar()\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com/\")" msgstr "" "import http.cookiejar, urllib.request\n" "cj = http.cookiejar.CookieJar()\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com/\")" #: ../../library/http.cookiejar.rst:754 @@ -968,18 +973,18 @@ msgstr "" msgid "" "import os, http.cookiejar, urllib.request\n" "cj = http.cookiejar.MozillaCookieJar()\n" -"cj.load(os.path.join(os.path.expanduser(\"~\"), \".netscape\", \"cookies." -"txt\"))\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"cj.load(os.path.join(os.path.expanduser(\"~\"), \".netscape\", " +"\"cookies.txt\"))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com/\")" msgstr "" "import os, http.cookiejar, urllib.request\n" "cj = http.cookiejar.MozillaCookieJar()\n" -"cj.load(os.path.join(os.path.expanduser(\"~\"), \".netscape\", \"cookies." -"txt\"))\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"cj.load(os.path.join(os.path.expanduser(\"~\"), \".netscape\", " +"\"cookies.txt\"))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com/\")" #: ../../library/http.cookiejar.rst:763 @@ -998,8 +1003,8 @@ msgid "" " rfc2965=True, strict_ns_domain=Policy.DomainStrict,\n" " blocked_domains=[\"ads.net\", \".ads.net\"])\n" "cj = CookieJar(policy)\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com/\")" msgstr "" "import urllib.request\n" @@ -1008,6 +1013,6 @@ msgstr "" " rfc2965=True, strict_ns_domain=Policy.DomainStrict,\n" " blocked_domains=[\"ads.net\", \".ads.net\"])\n" "cj = CookieJar(policy)\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com/\")" diff --git a/library/http.server.po b/library/http.server.po index e9346abbd1..2780d7a51a 100644 --- a/library/http.server.po +++ b/library/http.server.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-03-16 00:15+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-" @@ -541,92 +541,21 @@ msgid "" "attribute :attr:`index_pages`." msgstr "" -#: ../../library/http.server.rst:423 -msgid "" -":mod:`http.server` can also be invoked directly using the :option:`-m` " -"switch of the interpreter. Similar to the previous example, this serves " -"files relative to the current directory::" -msgstr "" - -#: ../../library/http.server.rst:427 -msgid "python -m http.server" -msgstr "python -m http.server" - -#: ../../library/http.server.rst:429 -msgid "" -"The server listens to port 8000 by default. The default can be overridden by " -"passing the desired port number as an argument::" -msgstr "" - -#: ../../library/http.server.rst:432 -msgid "python -m http.server 9000" -msgstr "python -m http.server 9000" - -#: ../../library/http.server.rst:434 -msgid "" -"By default, the server binds itself to all interfaces. The option ``-b/--" -"bind`` specifies a specific address to which it should bind. Both IPv4 and " -"IPv6 addresses are supported. For example, the following command causes the " -"server to bind to localhost only::" -msgstr "" - -#: ../../library/http.server.rst:439 -msgid "python -m http.server --bind 127.0.0.1" -msgstr "python -m http.server --bind 127.0.0.1" - -#: ../../library/http.server.rst:441 -msgid "Added the ``--bind`` option." -msgstr "新增 ``--bind`` 選項。" - -#: ../../library/http.server.rst:444 -msgid "Support IPv6 in the ``--bind`` option." -msgstr "於 ``--bind`` 選項中支援 IPv6。" - -#: ../../library/http.server.rst:447 -msgid "" -"By default, the server uses the current directory. The option ``-d/--" -"directory`` specifies a directory to which it should serve the files. For " -"example, the following command uses a specific directory::" -msgstr "" - -#: ../../library/http.server.rst:451 -msgid "python -m http.server --directory /tmp/" -msgstr "python -m http.server --directory /tmp/" - -#: ../../library/http.server.rst:453 -msgid "Added the ``--directory`` option." -msgstr "新增 ``--directory`` 選項。" - -#: ../../library/http.server.rst:456 -msgid "" -"By default, the server is conformant to HTTP/1.0. The option ``-p/--" -"protocol`` specifies the HTTP version to which the server is conformant. For " -"example, the following command runs an HTTP/1.1 conformant server::" -msgstr "" - -#: ../../library/http.server.rst:460 -msgid "python -m http.server --protocol HTTP/1.1" -msgstr "python -m http.server --protocol HTTP/1.1" - -#: ../../library/http.server.rst:462 -msgid "Added the ``--protocol`` option." -msgstr "新增 ``--protocol`` 選項。" - -#: ../../library/http.server.rst:467 +#: ../../library/http.server.rst:424 msgid "" "This class is used to serve either files or output of CGI scripts from the " "current directory and below. Note that mapping HTTP hierarchic structure to " "local directory structure is exactly as in :class:`SimpleHTTPRequestHandler`." msgstr "" -#: ../../library/http.server.rst:473 +#: ../../library/http.server.rst:430 msgid "" "CGI scripts run by the :class:`CGIHTTPRequestHandler` class cannot execute " "redirects (HTTP code 302), because code 200 (script output follows) is sent " "prior to execution of the CGI script. This pre-empts the status code." msgstr "" -#: ../../library/http.server.rst:478 +#: ../../library/http.server.rst:435 msgid "" "The class will however, run the CGI script, instead of serving it as a file, " "if it guesses it to be a CGI script. Only directory-based CGI are used --- " @@ -634,41 +563,41 @@ msgid "" "denoting CGI scripts." msgstr "" -#: ../../library/http.server.rst:483 +#: ../../library/http.server.rst:440 msgid "" "The :func:`do_GET` and :func:`do_HEAD` functions are modified to run CGI " "scripts and serve the output, instead of serving files, if the request leads " "to somewhere below the ``cgi_directories`` path." msgstr "" -#: ../../library/http.server.rst:487 +#: ../../library/http.server.rst:444 msgid "The :class:`CGIHTTPRequestHandler` defines the following data member:" msgstr "" -#: ../../library/http.server.rst:491 +#: ../../library/http.server.rst:448 msgid "" "This defaults to ``['/cgi-bin', '/htbin']`` and describes directories to " "treat as containing CGI scripts." msgstr "" -#: ../../library/http.server.rst:494 +#: ../../library/http.server.rst:451 msgid "The :class:`CGIHTTPRequestHandler` defines the following method:" msgstr "" -#: ../../library/http.server.rst:498 +#: ../../library/http.server.rst:455 msgid "" "This method serves the ``'POST'`` request type, only allowed for CGI " "scripts. Error 501, \"Can only POST to CGI scripts\", is output when trying " "to POST to a non-CGI url." msgstr "" -#: ../../library/http.server.rst:502 +#: ../../library/http.server.rst:459 msgid "" "Note that CGI scripts will be run with UID of user nobody, for security " "reasons. Problems with the CGI script will be translated to error 403." msgstr "" -#: ../../library/http.server.rst:507 +#: ../../library/http.server.rst:464 msgid "" ":class:`CGIHTTPRequestHandler` is being removed in 3.15. CGI has not been " "considered a good way to do things for well over a decade. This code has " @@ -677,41 +606,110 @@ msgid "" "server-security>`." msgstr "" +#: ../../library/http.server.rst:474 +msgid "Command-line interface" +msgstr "" + +#: ../../library/http.server.rst:476 +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::" +msgstr "" + +#: ../../library/http.server.rst:480 +#, fuzzy +msgid "python -m http.server [OPTIONS] [port]" +msgstr "python -m http.server" + +#: ../../library/http.server.rst:482 +msgid "The following options are accepted:" +msgstr "" + +#: ../../library/http.server.rst:488 +msgid "" +"The server listens to port 8000 by default. The default can be overridden by " +"passing the desired port number as an argument::" +msgstr "" + +#: ../../library/http.server.rst:491 +msgid "python -m http.server 9000" +msgstr "python -m http.server 9000" + +#: ../../library/http.server.rst:495 +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::" +msgstr "" + +#: ../../library/http.server.rst:500 +msgid "python -m http.server --bind 127.0.0.1" +msgstr "python -m http.server --bind 127.0.0.1" + +#: ../../library/http.server.rst:504 +msgid "Support IPv6 in the ``--bind`` option." +msgstr "於 ``--bind`` 選項中支援 IPv6。" + +#: ../../library/http.server.rst:509 +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::" +msgstr "" + #: ../../library/http.server.rst:513 +msgid "python -m http.server --directory /tmp/" +msgstr "python -m http.server --directory /tmp/" + +#: ../../library/http.server.rst:519 +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::" +msgstr "" + +#: ../../library/http.server.rst:523 +msgid "python -m http.server --protocol HTTP/1.1" +msgstr "python -m http.server --protocol HTTP/1.1" + +#: ../../library/http.server.rst:529 msgid "" ":class:`CGIHTTPRequestHandler` can be enabled in the command line by passing " "the ``--cgi`` option::" msgstr "" -#: ../../library/http.server.rst:516 +#: ../../library/http.server.rst:532 msgid "python -m http.server --cgi" msgstr "python -m http.server --cgi" -#: ../../library/http.server.rst:520 +#: ../../library/http.server.rst:536 msgid "" ":mod:`http.server` command line ``--cgi`` support is being removed because :" "class:`CGIHTTPRequestHandler` is being removed." msgstr "" -#: ../../library/http.server.rst:525 +#: ../../library/http.server.rst:541 msgid "" -":class:`CGIHTTPRequestHandler` and the ``--cgi`` command line option are not " +":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:532 -msgid "Security Considerations" +#: ../../library/http.server.rst:549 +#, fuzzy +msgid "Security considerations" msgstr "安全性注意事項" -#: ../../library/http.server.rst:536 +#: ../../library/http.server.rst:553 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:540 +#: ../../library/http.server.rst:557 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 :" @@ -720,7 +718,7 @@ msgid "" "codes to your terminal." msgstr "" -#: ../../library/http.server.rst:546 +#: ../../library/http.server.rst:563 msgid "Control characters are scrubbed in stderr logs." msgstr "" @@ -748,10 +746,19 @@ msgstr "URL(統一資源定位器)" msgid "httpd" msgstr "httpd" -#: ../../library/http.server.rst:534 +#: ../../library/http.server.rst:551 msgid "http.server" msgstr "http.server" -#: ../../library/http.server.rst:534 +#: ../../library/http.server.rst:551 msgid "security" msgstr "security(安全)" + +#~ msgid "Added the ``--bind`` option." +#~ msgstr "新增 ``--bind`` 選項。" + +#~ msgid "Added the ``--directory`` option." +#~ msgstr "新增 ``--directory`` 選項。" + +#~ msgid "Added the ``--protocol`` option." +#~ msgstr "新增 ``--protocol`` 選項。" diff --git a/library/idle.po b/library/idle.po index 66d6e0817f..e68ee42b2f 100644 --- a/library/idle.po +++ b/library/idle.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-25 00:14+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-" @@ -18,59 +17,64 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: ../../library/idle.rst:4 ../../library/idle.rst:10 -msgid "IDLE" -msgstr "IDLE" +#: ../../library/idle.rst:4 +msgid "IDLE --- Python editor and shell" +msgstr "IDLE --- Python 編輯器與 shell" #: ../../library/idle.rst:8 msgid "**Source code:** :source:`Lib/idlelib/`" msgstr "**原始碼:**\\ :source:`Lib/idlelib/`" -#: ../../library/idle.rst:17 +#: ../../library/idle.rst:20 msgid "IDLE is Python's Integrated Development and Learning Environment." msgstr "" +"IDLE 是 Python 的整合開發與學習環境 (Integrated Development and Learning " +"Environment)。" -#: ../../library/idle.rst:19 +#: ../../library/idle.rst:22 msgid "IDLE has the following features:" -msgstr "" +msgstr "IDLE 具有以下功能:" -#: ../../library/idle.rst:21 +#: ../../library/idle.rst:24 msgid "cross-platform: works mostly the same on Windows, Unix, and macOS" -msgstr "" +msgstr "跨平台:在 Windows、Unix 和 macOS 上的運作大致相同" -#: ../../library/idle.rst:23 +#: ../../library/idle.rst:26 msgid "" "Python shell window (interactive interpreter) with colorizing of code input, " "output, and error messages" msgstr "" +"Python shell window(互動式解譯器)提供有色彩的程式碼輸入、輸出和錯誤訊息" -#: ../../library/idle.rst:26 +#: ../../library/idle.rst:29 msgid "" "multi-window text editor with multiple undo, Python colorizing, smart " "indent, call tips, auto completion, and other features" msgstr "" +"多視窗文字編輯器,具有多次復原、Python 語法上色、智慧縮排、呼叫提示、自動完成" +"等功能" -#: ../../library/idle.rst:29 +#: ../../library/idle.rst:32 msgid "" "search within any window, replace within editor windows, and search through " "multiple files (grep)" -msgstr "" +msgstr "能在任何視窗中搜尋、編輯器視窗中取代文字,以及搜尋多個檔案 (grep)" -#: ../../library/idle.rst:32 +#: ../../library/idle.rst:35 msgid "" "debugger with persistent breakpoints, stepping, and viewing of global and " "local namespaces" -msgstr "" +msgstr "具有持久性斷點、能夠逐步執行和檢視全域和區域命名空間的除錯器" -#: ../../library/idle.rst:35 +#: ../../library/idle.rst:38 msgid "configuration, browsers, and other dialogs" -msgstr "" +msgstr "設定、瀏覽器和其他對話框" -#: ../../library/idle.rst:38 +#: ../../library/idle.rst:41 msgid "Menus" msgstr "目錄" -#: ../../library/idle.rst:40 +#: ../../library/idle.rst:43 msgid "" "IDLE has two main window types, the Shell window and the Editor window. It " "is possible to have multiple editor windows simultaneously. On Windows and " @@ -78,81 +82,81 @@ msgid "" "which window type it is associated with." msgstr "" -#: ../../library/idle.rst:45 +#: ../../library/idle.rst:48 msgid "" "Output windows, such as used for Edit => Find in Files, are a subtype of " "editor window. They currently have the same top menu but a different " "default title and context menu." msgstr "" -#: ../../library/idle.rst:49 +#: ../../library/idle.rst:52 msgid "" "On macOS, there is one application menu. It dynamically changes according " "to the window currently selected. It has an IDLE menu, and some entries " "described below are moved around to conform to Apple guidelines." msgstr "" -#: ../../library/idle.rst:54 +#: ../../library/idle.rst:57 msgid "File menu (Shell and Editor)" msgstr "" -#: ../../library/idle.rst:56 +#: ../../library/idle.rst:59 msgid "New File" msgstr "新增檔案" -#: ../../library/idle.rst:57 +#: ../../library/idle.rst:60 msgid "Create a new file editing window." msgstr "" -#: ../../library/idle.rst:59 +#: ../../library/idle.rst:62 msgid "Open..." msgstr "" -#: ../../library/idle.rst:60 +#: ../../library/idle.rst:63 msgid "Open an existing file with an Open dialog." msgstr "" -#: ../../library/idle.rst:62 +#: ../../library/idle.rst:65 msgid "Open Module..." msgstr "" -#: ../../library/idle.rst:63 +#: ../../library/idle.rst:66 msgid "Open an existing module (searches sys.path)." msgstr "" -#: ../../library/idle.rst:65 +#: ../../library/idle.rst:68 msgid "Recent Files" msgstr "" -#: ../../library/idle.rst:66 +#: ../../library/idle.rst:69 msgid "Open a list of recent files. Click one to open it." msgstr "" -#: ../../library/idle.rst:72 +#: ../../library/idle.rst:75 msgid "Module Browser" msgstr "" -#: ../../library/idle.rst:73 +#: ../../library/idle.rst:76 msgid "" "Show functions, classes, and methods in the current Editor file in a tree " "structure. In the shell, open a module first." msgstr "" -#: ../../library/idle.rst:76 +#: ../../library/idle.rst:79 msgid "Path Browser" msgstr "" -#: ../../library/idle.rst:77 +#: ../../library/idle.rst:80 msgid "" "Show sys.path directories, modules, functions, classes and methods in a tree " "structure." msgstr "" -#: ../../library/idle.rst:80 +#: ../../library/idle.rst:83 msgid "Save" msgstr "" -#: ../../library/idle.rst:81 +#: ../../library/idle.rst:84 msgid "" "Save the current window to the associated file, if there is one. Windows " "that have been changed since being opened or last saved have a \\* before " @@ -160,11 +164,11 @@ msgid "" "instead." msgstr "" -#: ../../library/idle.rst:86 +#: ../../library/idle.rst:89 msgid "Save As..." msgstr "" -#: ../../library/idle.rst:87 +#: ../../library/idle.rst:90 msgid "" "Save the current window with a Save As dialog. The file saved becomes the " "new associated file for the window. (If your file namager is set to hide " @@ -173,283 +177,283 @@ msgid "" "text files, except that on macOS Aqua,'.py' is added for all files.)" msgstr "" -#: ../../library/idle.rst:93 +#: ../../library/idle.rst:96 msgid "Save Copy As..." msgstr "" -#: ../../library/idle.rst:94 +#: ../../library/idle.rst:97 msgid "" "Save the current window to different file without changing the associated " "file. (See Save As note above about filename extensions.)" msgstr "" -#: ../../library/idle.rst:97 +#: ../../library/idle.rst:100 msgid "Print Window" msgstr "" -#: ../../library/idle.rst:98 +#: ../../library/idle.rst:101 msgid "Print the current window to the default printer." msgstr "" -#: ../../library/idle.rst:100 +#: ../../library/idle.rst:103 msgid "Close Window" msgstr "" -#: ../../library/idle.rst:101 +#: ../../library/idle.rst:104 msgid "" "Close the current window (if an unsaved editor, ask to save; if an unsaved " "Shell, ask to quit execution). Calling ``exit()`` or ``close()`` in the " "Shell window also closes Shell. If this is the only window, also exit IDLE." msgstr "" -#: ../../library/idle.rst:105 +#: ../../library/idle.rst:108 msgid "Exit IDLE" msgstr "離開 IDLE" -#: ../../library/idle.rst:106 +#: ../../library/idle.rst:109 msgid "Close all windows and quit IDLE (ask to save unsaved edit windows)." msgstr "" -#: ../../library/idle.rst:109 +#: ../../library/idle.rst:112 msgid "Edit menu (Shell and Editor)" msgstr "" -#: ../../library/idle.rst:111 +#: ../../library/idle.rst:114 msgid "Undo" msgstr "" -#: ../../library/idle.rst:112 +#: ../../library/idle.rst:115 msgid "" "Undo the last change to the current window. A maximum of 1000 changes may " "be undone." msgstr "" -#: ../../library/idle.rst:115 +#: ../../library/idle.rst:118 msgid "Redo" msgstr "" -#: ../../library/idle.rst:116 +#: ../../library/idle.rst:119 msgid "Redo the last undone change to the current window." msgstr "" -#: ../../library/idle.rst:118 +#: ../../library/idle.rst:121 msgid "Select All" msgstr "Select All(選擇全部)" -#: ../../library/idle.rst:119 +#: ../../library/idle.rst:122 msgid "Select the entire contents of the current window." msgstr "" -#: ../../library/idle.rst:121 ../../library/idle.rst:353 -#: ../../library/idle.rst:367 +#: ../../library/idle.rst:124 ../../library/idle.rst:356 +#: ../../library/idle.rst:370 msgid "Cut" msgstr "Cut(剪下)" -#: ../../library/idle.rst:122 ../../library/idle.rst:368 +#: ../../library/idle.rst:125 ../../library/idle.rst:371 msgid "" "Copy selection into the system-wide clipboard; then delete the selection." msgstr "" -#: ../../library/idle.rst:124 ../../library/idle.rst:353 -#: ../../library/idle.rst:370 +#: ../../library/idle.rst:127 ../../library/idle.rst:356 +#: ../../library/idle.rst:373 msgid "Copy" msgstr "Copy(複製)" -#: ../../library/idle.rst:125 ../../library/idle.rst:371 +#: ../../library/idle.rst:128 ../../library/idle.rst:374 msgid "Copy selection into the system-wide clipboard." msgstr "" -#: ../../library/idle.rst:127 ../../library/idle.rst:353 -#: ../../library/idle.rst:373 +#: ../../library/idle.rst:130 ../../library/idle.rst:356 +#: ../../library/idle.rst:376 msgid "Paste" msgstr "Paste(貼上)" -#: ../../library/idle.rst:128 ../../library/idle.rst:374 +#: ../../library/idle.rst:131 ../../library/idle.rst:377 msgid "Insert contents of the system-wide clipboard into the current window." msgstr "" -#: ../../library/idle.rst:130 +#: ../../library/idle.rst:133 msgid "The clipboard functions are also available in context menus." msgstr "" -#: ../../library/idle.rst:132 +#: ../../library/idle.rst:135 msgid "Find..." msgstr "" -#: ../../library/idle.rst:133 +#: ../../library/idle.rst:136 msgid "Open a search dialog with many options" msgstr "" -#: ../../library/idle.rst:135 +#: ../../library/idle.rst:138 msgid "Find Again" msgstr "" -#: ../../library/idle.rst:136 +#: ../../library/idle.rst:139 msgid "Repeat the last search, if there is one." msgstr "" -#: ../../library/idle.rst:138 +#: ../../library/idle.rst:141 msgid "Find Selection" msgstr "" -#: ../../library/idle.rst:139 +#: ../../library/idle.rst:142 msgid "Search for the currently selected string, if there is one." msgstr "" -#: ../../library/idle.rst:141 +#: ../../library/idle.rst:144 msgid "Find in Files..." msgstr "" -#: ../../library/idle.rst:142 +#: ../../library/idle.rst:145 msgid "Open a file search dialog. Put results in a new output window." msgstr "" -#: ../../library/idle.rst:144 +#: ../../library/idle.rst:147 msgid "Replace..." msgstr "" -#: ../../library/idle.rst:145 +#: ../../library/idle.rst:148 msgid "Open a search-and-replace dialog." msgstr "" -#: ../../library/idle.rst:147 +#: ../../library/idle.rst:150 msgid "Go to Line" msgstr "" -#: ../../library/idle.rst:148 +#: ../../library/idle.rst:151 msgid "" "Move the cursor to the beginning of the line requested and make that line " "visible. A request past the end of the file goes to the end. Clear any " "selection and update the line and column status." msgstr "" -#: ../../library/idle.rst:152 +#: ../../library/idle.rst:155 msgid "Show Completions" msgstr "" -#: ../../library/idle.rst:153 +#: ../../library/idle.rst:156 msgid "" "Open a scrollable list allowing selection of existing names. See :ref:" "`Completions ` in the Editing and navigation section below." msgstr "" -#: ../../library/idle.rst:156 +#: ../../library/idle.rst:159 msgid "Expand Word" msgstr "" -#: ../../library/idle.rst:157 +#: ../../library/idle.rst:160 msgid "" "Expand a prefix you have typed to match a full word in the same window; " "repeat to get a different expansion." msgstr "" -#: ../../library/idle.rst:160 +#: ../../library/idle.rst:163 msgid "Show Call Tip" msgstr "" -#: ../../library/idle.rst:161 +#: ../../library/idle.rst:164 msgid "" "After an unclosed parenthesis for a function, open a small window with " "function parameter hints. See :ref:`Calltips ` in the Editing and " "navigation section below." msgstr "" -#: ../../library/idle.rst:165 +#: ../../library/idle.rst:168 msgid "Show Surrounding Parens" msgstr "" -#: ../../library/idle.rst:166 +#: ../../library/idle.rst:169 msgid "Highlight the surrounding parenthesis." msgstr "" -#: ../../library/idle.rst:171 +#: ../../library/idle.rst:174 msgid "Format menu (Editor window only)" msgstr "" -#: ../../library/idle.rst:173 +#: ../../library/idle.rst:176 msgid "Format Paragraph" msgstr "" -#: ../../library/idle.rst:174 +#: ../../library/idle.rst:177 msgid "" "Reformat the current blank-line-delimited paragraph in comment block or " "multiline string or selected line in a string. All lines in the paragraph " "will be formatted to less than N columns, where N defaults to 72." msgstr "" -#: ../../library/idle.rst:178 +#: ../../library/idle.rst:181 msgid "Indent Region" msgstr "" -#: ../../library/idle.rst:179 +#: ../../library/idle.rst:182 msgid "Shift selected lines right by the indent width (default 4 spaces)." msgstr "" -#: ../../library/idle.rst:181 +#: ../../library/idle.rst:184 msgid "Dedent Region" msgstr "" -#: ../../library/idle.rst:182 +#: ../../library/idle.rst:185 msgid "Shift selected lines left by the indent width (default 4 spaces)." msgstr "" -#: ../../library/idle.rst:184 +#: ../../library/idle.rst:187 msgid "Comment Out Region" msgstr "" -#: ../../library/idle.rst:185 +#: ../../library/idle.rst:188 msgid "Insert ## in front of selected lines." msgstr "" -#: ../../library/idle.rst:187 +#: ../../library/idle.rst:190 msgid "Uncomment Region" msgstr "" -#: ../../library/idle.rst:188 +#: ../../library/idle.rst:191 msgid "Remove leading # or ## from selected lines." msgstr "" -#: ../../library/idle.rst:190 +#: ../../library/idle.rst:193 msgid "Tabify Region" msgstr "" -#: ../../library/idle.rst:191 +#: ../../library/idle.rst:194 msgid "" "Turn *leading* stretches of spaces into tabs. (Note: We recommend using 4 " "space blocks to indent Python code.)" msgstr "" -#: ../../library/idle.rst:194 +#: ../../library/idle.rst:197 msgid "Untabify Region" msgstr "" -#: ../../library/idle.rst:195 +#: ../../library/idle.rst:198 msgid "Turn *all* tabs into the correct number of spaces." msgstr "" -#: ../../library/idle.rst:197 +#: ../../library/idle.rst:200 msgid "Toggle Tabs" msgstr "" -#: ../../library/idle.rst:198 +#: ../../library/idle.rst:201 msgid "Open a dialog to switch between indenting with spaces and tabs." msgstr "" -#: ../../library/idle.rst:200 +#: ../../library/idle.rst:203 msgid "New Indent Width" msgstr "" -#: ../../library/idle.rst:201 +#: ../../library/idle.rst:204 msgid "" "Open a dialog to change indent width. The accepted default by the Python " "community is 4 spaces." msgstr "" -#: ../../library/idle.rst:204 +#: ../../library/idle.rst:207 msgid "Strip Trailing Chitespace" msgstr "" -#: ../../library/idle.rst:205 +#: ../../library/idle.rst:208 msgid "" "Remove trailing space and other whitespace characters after the last non-" "whitespace character of a line by applying str.rstrip to each line, " @@ -457,15 +461,15 @@ msgid "" "extra newlines at the end of the file." msgstr "" -#: ../../library/idle.rst:214 +#: ../../library/idle.rst:217 msgid "Run menu (Editor window only)" msgstr "" -#: ../../library/idle.rst:218 +#: ../../library/idle.rst:221 msgid "Run Module" msgstr "" -#: ../../library/idle.rst:219 +#: ../../library/idle.rst:222 msgid "" "Do :ref:`Check Module `. If no error, restart the shell to " "clean the environment, then execute the module. Output is displayed in the " @@ -475,22 +479,22 @@ msgid "" "similar to executing a file with ``python -i file`` at a command line." msgstr "" -#: ../../library/idle.rst:229 +#: ../../library/idle.rst:232 msgid "Run... Customized" msgstr "" -#: ../../library/idle.rst:230 +#: ../../library/idle.rst:233 msgid "" "Same as :ref:`Run Module `, but run the module with customized " "settings. *Command Line Arguments* extend :data:`sys.argv` as if passed on " "a command line. The module can be run in the Shell without restarting." msgstr "" -#: ../../library/idle.rst:236 +#: ../../library/idle.rst:239 msgid "Check Module" msgstr "" -#: ../../library/idle.rst:237 +#: ../../library/idle.rst:240 msgid "" "Check the syntax of the module currently open in the Editor window. If the " "module has not been saved IDLE will either prompt the user to save or " @@ -499,70 +503,70 @@ msgid "" "window." msgstr "" -#: ../../library/idle.rst:245 +#: ../../library/idle.rst:248 msgid "Python Shell" msgstr "" -#: ../../library/idle.rst:246 +#: ../../library/idle.rst:249 msgid "Open or wake up the Python Shell window." msgstr "" -#: ../../library/idle.rst:250 +#: ../../library/idle.rst:253 msgid "Shell menu (Shell window only)" msgstr "" -#: ../../library/idle.rst:252 +#: ../../library/idle.rst:255 msgid "View Last Restart" msgstr "" -#: ../../library/idle.rst:253 +#: ../../library/idle.rst:256 msgid "Scroll the shell window to the last Shell restart." msgstr "" -#: ../../library/idle.rst:255 +#: ../../library/idle.rst:258 msgid "Restart Shell" msgstr "" -#: ../../library/idle.rst:256 +#: ../../library/idle.rst:259 msgid "" "Restart the shell to clean the environment and reset display and exception " "handling." msgstr "" -#: ../../library/idle.rst:258 +#: ../../library/idle.rst:261 msgid "Previous History" msgstr "" -#: ../../library/idle.rst:259 +#: ../../library/idle.rst:262 msgid "" "Cycle through earlier commands in history which match the current entry." msgstr "" -#: ../../library/idle.rst:261 +#: ../../library/idle.rst:264 msgid "Next History" msgstr "" -#: ../../library/idle.rst:262 +#: ../../library/idle.rst:265 msgid "Cycle through later commands in history which match the current entry." msgstr "" -#: ../../library/idle.rst:264 +#: ../../library/idle.rst:267 msgid "Interrupt Execution" msgstr "" -#: ../../library/idle.rst:265 +#: ../../library/idle.rst:268 msgid "Stop a running program." msgstr "" -#: ../../library/idle.rst:268 +#: ../../library/idle.rst:271 msgid "Debug menu (Shell window only)" msgstr "" -#: ../../library/idle.rst:270 +#: ../../library/idle.rst:273 msgid "Go to File/Line" msgstr "" -#: ../../library/idle.rst:271 +#: ../../library/idle.rst:274 msgid "" "Look on the current line. with the cursor, and the line above for a filename " "and line number. If found, open the file if not already open, and show the " @@ -571,45 +575,45 @@ msgid "" "Shell window and Output windows." msgstr "" -#: ../../library/idle.rst:281 +#: ../../library/idle.rst:284 msgid "Debugger (toggle)" msgstr "" -#: ../../library/idle.rst:282 +#: ../../library/idle.rst:285 msgid "" "When activated, code entered in the Shell or run from an Editor will run " "under the debugger. In the Editor, breakpoints can be set with the context " "menu. This feature is still incomplete and somewhat experimental." msgstr "" -#: ../../library/idle.rst:286 +#: ../../library/idle.rst:289 msgid "Stack Viewer" msgstr "" -#: ../../library/idle.rst:287 +#: ../../library/idle.rst:290 msgid "" "Show the stack traceback of the last exception in a tree widget, with access " "to locals and globals." msgstr "" -#: ../../library/idle.rst:290 +#: ../../library/idle.rst:293 msgid "Auto-open Stack Viewer" msgstr "" -#: ../../library/idle.rst:291 +#: ../../library/idle.rst:294 msgid "" "Toggle automatically opening the stack viewer on an unhandled exception." msgstr "" -#: ../../library/idle.rst:294 +#: ../../library/idle.rst:297 msgid "Options menu (Shell and Editor)" msgstr "" -#: ../../library/idle.rst:296 +#: ../../library/idle.rst:299 msgid "Configure IDLE" msgstr "" -#: ../../library/idle.rst:297 +#: ../../library/idle.rst:300 msgid "" "Open a configuration dialog and change preferences for the following: fonts, " "indentation, keybindings, text color themes, startup windows and size, " @@ -618,39 +622,39 @@ msgid "" "see :ref:`Setting preferences ` under Help and preferences." msgstr "" -#: ../../library/idle.rst:304 +#: ../../library/idle.rst:307 msgid "" "Most configuration options apply to all windows or all future windows. The " "option items below only apply to the active window." msgstr "" -#: ../../library/idle.rst:307 +#: ../../library/idle.rst:310 msgid "Show/Hide Code Context (Editor Window only)" msgstr "" -#: ../../library/idle.rst:308 +#: ../../library/idle.rst:311 msgid "" "Open a pane at the top of the edit window which shows the block context of " "the code which has scrolled above the top of the window. See :ref:`Code " "Context ` in the Editing and Navigation section below." msgstr "" -#: ../../library/idle.rst:313 +#: ../../library/idle.rst:316 msgid "Show/Hide Line Numbers (Editor Window only)" msgstr "" -#: ../../library/idle.rst:314 +#: ../../library/idle.rst:317 msgid "" "Open a column to the left of the edit window which shows the number of each " "line of text. The default is off, which may be changed in the preferences " "(see :ref:`Setting preferences `)." msgstr "" -#: ../../library/idle.rst:318 +#: ../../library/idle.rst:321 msgid "Zoom/Restore Height" msgstr "" -#: ../../library/idle.rst:319 +#: ../../library/idle.rst:322 msgid "" "Toggles the window between normal size and maximum height. The initial size " "defaults to 40 lines by 80 chars unless changed on the General tab of the " @@ -660,74 +664,74 @@ msgid "" "no effect when a window is maximized." msgstr "" -#: ../../library/idle.rst:327 +#: ../../library/idle.rst:330 msgid "Window menu (Shell and Editor)" msgstr "" -#: ../../library/idle.rst:329 +#: ../../library/idle.rst:332 msgid "" "Lists the names of all open windows; select one to bring it to the " "foreground (deiconifying it if necessary)." msgstr "" -#: ../../library/idle.rst:333 +#: ../../library/idle.rst:336 msgid "Help menu (Shell and Editor)" msgstr "" -#: ../../library/idle.rst:335 +#: ../../library/idle.rst:338 msgid "About IDLE" -msgstr "" +msgstr "關於 IDLE" -#: ../../library/idle.rst:336 +#: ../../library/idle.rst:339 msgid "Display version, copyright, license, credits, and more." msgstr "" -#: ../../library/idle.rst:338 +#: ../../library/idle.rst:341 msgid "IDLE Help" msgstr "" -#: ../../library/idle.rst:339 +#: ../../library/idle.rst:342 msgid "" "Display this IDLE document, detailing the menu options, basic editing and " "navigation, and other tips." msgstr "" -#: ../../library/idle.rst:342 +#: ../../library/idle.rst:345 msgid "Python Docs" msgstr "" -#: ../../library/idle.rst:343 +#: ../../library/idle.rst:346 msgid "" "Access local Python documentation, if installed, or start a web browser and " "open docs.python.org showing the latest Python documentation." msgstr "" -#: ../../library/idle.rst:346 +#: ../../library/idle.rst:349 msgid "Turtle Demo" msgstr "" -#: ../../library/idle.rst:347 +#: ../../library/idle.rst:350 msgid "Run the turtledemo module with example Python code and turtle drawings." msgstr "" -#: ../../library/idle.rst:349 +#: ../../library/idle.rst:352 msgid "" "Additional help sources may be added here with the Configure IDLE dialog " "under the General tab. See the :ref:`Help sources ` subsection " "below for more on Help menu choices." msgstr "" -#: ../../library/idle.rst:362 +#: ../../library/idle.rst:365 msgid "Context menus" msgstr "" -#: ../../library/idle.rst:364 +#: ../../library/idle.rst:367 msgid "" "Open a context menu by right-clicking in a window (Control-click on macOS). " "Context menus have the standard clipboard functions also on the Edit menu." msgstr "" -#: ../../library/idle.rst:376 +#: ../../library/idle.rst:379 msgid "" "Editor windows also have breakpoint functions. Lines with a breakpoint set " "are specially marked. Breakpoints only have an effect when running under " @@ -735,66 +739,66 @@ msgid "" "directory." msgstr "" -#: ../../library/idle.rst:353 ../../library/idle.rst:381 +#: ../../library/idle.rst:356 ../../library/idle.rst:384 msgid "Set Breakpoint" msgstr "" -#: ../../library/idle.rst:382 +#: ../../library/idle.rst:385 msgid "Set a breakpoint on the current line." msgstr "" -#: ../../library/idle.rst:353 ../../library/idle.rst:384 +#: ../../library/idle.rst:356 ../../library/idle.rst:387 msgid "Clear Breakpoint" msgstr "" -#: ../../library/idle.rst:385 +#: ../../library/idle.rst:388 msgid "Clear the breakpoint on that line." msgstr "" -#: ../../library/idle.rst:387 +#: ../../library/idle.rst:390 msgid "Shell and Output windows also have the following." msgstr "" -#: ../../library/idle.rst:389 +#: ../../library/idle.rst:392 msgid "Go to file/line" msgstr "" -#: ../../library/idle.rst:390 +#: ../../library/idle.rst:393 msgid "Same as in Debug menu." msgstr "" -#: ../../library/idle.rst:392 +#: ../../library/idle.rst:395 msgid "" "The Shell window also has an output squeezing facility explained in the " "*Python Shell window* subsection below." msgstr "" -#: ../../library/idle.rst:395 +#: ../../library/idle.rst:398 msgid "Squeeze" msgstr "" -#: ../../library/idle.rst:396 +#: ../../library/idle.rst:399 msgid "" "If the cursor is over an output line, squeeze all the output between the " "code above and the prompt below down to a 'Squeezed text' label." msgstr "" -#: ../../library/idle.rst:403 +#: ../../library/idle.rst:406 msgid "Editing and Navigation" msgstr "" -#: ../../library/idle.rst:406 +#: ../../library/idle.rst:409 msgid "Editor windows" msgstr "" -#: ../../library/idle.rst:408 +#: ../../library/idle.rst:411 msgid "" "IDLE may open editor windows when it starts, depending on settings and how " "you start IDLE. Thereafter, use the File menu. There can be only one open " "editor window for a given file." msgstr "" -#: ../../library/idle.rst:412 +#: ../../library/idle.rst:415 msgid "" "The title bar contains the name of the file, the full path, and the version " "of Python and IDLE running the window. The status bar contains the line " @@ -802,17 +806,17 @@ msgid "" "numbers with 0." msgstr "" -#: ../../library/idle.rst:417 +#: ../../library/idle.rst:420 msgid "" "IDLE assumes that files with a known .py* extension contain Python code and " "that other files do not. Run Python code with the Run menu." msgstr "" -#: ../../library/idle.rst:421 +#: ../../library/idle.rst:424 msgid "Key bindings" msgstr "" -#: ../../library/idle.rst:423 +#: ../../library/idle.rst:426 msgid "" "The IDLE insertion cursor is a thin vertical bar between character " "positions. When characters are entered, the insertion cursor and everything " @@ -820,7 +824,7 @@ msgid "" "the new space." msgstr "" -#: ../../library/idle.rst:428 +#: ../../library/idle.rst:431 msgid "" "Several non-character keys move the cursor and possibly delete characters. " "Deletion does not puts text on the clipboard, but IDLE has an undo list. " @@ -829,52 +833,52 @@ msgid "" "discussions assume that the keys have not been re-bound to something else.)" msgstr "" -#: ../../library/idle.rst:435 +#: ../../library/idle.rst:438 msgid "Arrow keys move the cursor one character or line." msgstr "" -#: ../../library/idle.rst:437 +#: ../../library/idle.rst:440 msgid "" ":kbd:`C-LeftArrow` and :kbd:`C-RightArrow` moves left or right one word." msgstr "" -#: ../../library/idle.rst:439 +#: ../../library/idle.rst:442 msgid ":kbd:`Home` and :kbd:`End` go to the beginning or end of the line." msgstr "" -#: ../../library/idle.rst:441 +#: ../../library/idle.rst:444 msgid ":kbd:`Page Up` and :kbd:`Page Down` go up or down one screen." msgstr "" -#: ../../library/idle.rst:443 +#: ../../library/idle.rst:446 msgid ":kbd:`C-Home` and :kbd:`C-End` go to beginning or end of the file." msgstr "" -#: ../../library/idle.rst:445 +#: ../../library/idle.rst:448 msgid "" ":kbd:`Backspace` and :kbd:`Del` (or :kbd:`C-d`) delete the previous or next " "character." msgstr "" -#: ../../library/idle.rst:448 +#: ../../library/idle.rst:451 msgid ":kbd:`C-Backspace` and :kbd:`C-Del` delete one word left or right." msgstr "" -#: ../../library/idle.rst:450 +#: ../../library/idle.rst:453 msgid ":kbd:`C-k` deletes ('kills') everything to the right." msgstr "" -#: ../../library/idle.rst:452 +#: ../../library/idle.rst:455 msgid "" "Standard keybindings (like :kbd:`C-c` to copy and :kbd:`C-v` to paste) may " "work. Keybindings are selected in the Configure IDLE dialog." msgstr "" -#: ../../library/idle.rst:456 +#: ../../library/idle.rst:459 msgid "Automatic indentation" msgstr "" -#: ../../library/idle.rst:458 +#: ../../library/idle.rst:461 msgid "" "After a block-opening statement, the next line is indented by 4 spaces (in " "the Python Shell window by one tab). After certain keywords (break, return " @@ -884,17 +888,17 @@ msgid "" "tabs are restricted to four spaces due to Tcl/Tk limitations." msgstr "" -#: ../../library/idle.rst:465 +#: ../../library/idle.rst:468 msgid "" "See also the indent/dedent region commands on the :ref:`Format menu `." msgstr "" -#: ../../library/idle.rst:469 +#: ../../library/idle.rst:472 msgid "Search and Replace" msgstr "" -#: ../../library/idle.rst:471 +#: ../../library/idle.rst:474 msgid "" "Any selection becomes a search target. However, only selections within a " "line work because searches are only performed within lines with the terminal " @@ -902,11 +906,11 @@ msgid "" "interpreted according to the Python re module." msgstr "" -#: ../../library/idle.rst:479 +#: ../../library/idle.rst:482 msgid "Completions" msgstr "" -#: ../../library/idle.rst:481 +#: ../../library/idle.rst:484 msgid "" "Completions are supplied, when requested and available, for module names, " "attributes of classes or functions, or filenames. Each request method " @@ -919,7 +923,7 @@ msgid "" "box. A double click within the box selects and closes." msgstr "" -#: ../../library/idle.rst:492 +#: ../../library/idle.rst:495 msgid "" "One way to open a box is to type a key character and wait for a predefined " "interval. This defaults to 2 seconds; customize it in the settings dialog. " @@ -931,7 +935,7 @@ msgid "" "directory name and a separator." msgstr "" -#: ../../library/idle.rst:502 +#: ../../library/idle.rst:505 msgid "" "Instead of waiting, or after a box is closed, open a completion box " "immediately with Show Completions on the Edit menu. The default hot key is :" @@ -942,7 +946,7 @@ msgid "" "directory." msgstr "" -#: ../../library/idle.rst:510 +#: ../../library/idle.rst:513 msgid "" "Hitting :kbd:`Tab` after a prefix usually has the same effect as Show " "Completions. (With no prefix, it indents.) However, if there is only one " @@ -950,14 +954,14 @@ msgid "" "without opening a box." msgstr "" -#: ../../library/idle.rst:515 +#: ../../library/idle.rst:518 msgid "" "Invoking 'Show Completions', or hitting :kbd:`Tab` after a prefix, outside " "of a string and without a preceding '.' opens a box with keywords, builtin " "names, and available module-level names." msgstr "" -#: ../../library/idle.rst:519 +#: ../../library/idle.rst:522 msgid "" "When editing code in an editor (as oppose to Shell), increase the available " "module-level names by running your code and not restarting the Shell " @@ -965,18 +969,18 @@ msgid "" "file. This also increases possible attribute completions." msgstr "" -#: ../../library/idle.rst:525 +#: ../../library/idle.rst:528 msgid "" "Completion boxes initially exclude names beginning with '_' or, for modules, " "not included in '__all__'. The hidden names can be accessed by typing '_' " "after '.', either before or after the box is opened." msgstr "" -#: ../../library/idle.rst:532 +#: ../../library/idle.rst:535 msgid "Calltips" msgstr "" -#: ../../library/idle.rst:534 +#: ../../library/idle.rst:537 msgid "" "A calltip is shown automatically when one types :kbd:`(` after the name of " "an *accessible* function. A function name expression may include dots and " @@ -986,7 +990,7 @@ msgid "" "or enter its shortcut to display a calltip." msgstr "" -#: ../../library/idle.rst:541 +#: ../../library/idle.rst:544 msgid "" "The calltip consists of the function's signature and docstring up to the " "latter's first blank line or the fifth non-blank line. (Some builtin " @@ -995,14 +999,14 @@ msgid "" "or name (keyword) only. Details are subject to change." msgstr "" -#: ../../library/idle.rst:547 +#: ../../library/idle.rst:550 msgid "" "In Shell, the accessible functions depends on what modules have been " "imported into the user process, including those imported by Idle itself, and " "which definitions have been run, all since the last restart." msgstr "" -#: ../../library/idle.rst:551 +#: ../../library/idle.rst:554 msgid "" "For example, restart the Shell and enter ``itertools.count(``. A calltip " "appears because Idle imports itertools into the user process for its own " @@ -1012,18 +1016,18 @@ msgid "" "display a calltip." msgstr "" -#: ../../library/idle.rst:558 +#: ../../library/idle.rst:561 msgid "" "In an editor, import statements have no effect until one runs the file. One " "might want to run a file after writing import statements, after adding " "function definitions, or after opening an existing file." msgstr "" -#: ../../library/idle.rst:565 +#: ../../library/idle.rst:568 msgid "Code Context" msgstr "" -#: ../../library/idle.rst:567 +#: ../../library/idle.rst:570 msgid "" "Within an editor window containing Python code, code context can be toggled " "in order to show or hide a pane at the top of the window. When shown, this " @@ -1037,23 +1041,23 @@ msgid "" "the top of the editor." msgstr "" -#: ../../library/idle.rst:578 +#: ../../library/idle.rst:581 msgid "" "The text and background colors for the context pane can be configured under " "the Highlights tab in the Configure IDLE dialog." msgstr "" -#: ../../library/idle.rst:582 +#: ../../library/idle.rst:585 msgid "Shell window" msgstr "" -#: ../../library/idle.rst:584 +#: ../../library/idle.rst:587 msgid "" "In IDLE's Shell, enter, edit, and recall complete statements. (Most consoles " "and terminals only work with a single physical line at a time)." msgstr "" -#: ../../library/idle.rst:587 +#: ../../library/idle.rst:590 msgid "" "Submit a single-line statement for execution by hitting :kbd:`Return` with " "the cursor anywhere on the line. If a line is extended with Backslash (:kbd:" @@ -1061,7 +1065,7 @@ msgid "" "compound statement by entering a blank line after the statement." msgstr "" -#: ../../library/idle.rst:593 +#: ../../library/idle.rst:596 msgid "" "When one pastes code into Shell, it is not compiled and possibly executed " "until one hits :kbd:`Return`, as specified above. One may edit pasted code " @@ -1070,7 +1074,7 @@ msgid "" "one." msgstr "" -#: ../../library/idle.rst:599 +#: ../../library/idle.rst:602 msgid "" "Lines containing ``RESTART`` mean that the user execution process has been " "re-started. This occurs when the user execution process has crashed, when " @@ -1078,38 +1082,38 @@ msgid "" "window." msgstr "" -#: ../../library/idle.rst:604 +#: ../../library/idle.rst:607 msgid "" "The editing features described in previous subsections work when entering " "code interactively. IDLE's Shell window also responds to the following:" msgstr "" -#: ../../library/idle.rst:607 +#: ../../library/idle.rst:610 msgid ":kbd:`C-c` attempts to interrupt statement execution (but may fail)." msgstr "" -#: ../../library/idle.rst:609 +#: ../../library/idle.rst:612 msgid ":kbd:`C-d` closes Shell if typed at a ``>>>`` prompt." msgstr "" -#: ../../library/idle.rst:611 +#: ../../library/idle.rst:614 msgid "" ":kbd:`Alt-p` and :kbd:`Alt-n` (:kbd:`C-p` and :kbd:`C-n` on macOS) retrieve " "to the current prompt the previous or next previously entered statement that " "matches anything already typed." msgstr "" -#: ../../library/idle.rst:615 +#: ../../library/idle.rst:618 msgid "" ":kbd:`Return` while the cursor is on any previous statement appends the " "latter to anything already typed at the prompt." msgstr "" -#: ../../library/idle.rst:619 +#: ../../library/idle.rst:622 msgid "Text colors" msgstr "" -#: ../../library/idle.rst:621 +#: ../../library/idle.rst:624 msgid "" "Idle defaults to black on white text, but colors text with special meanings. " "For the shell, these are shell output, shell error, user output, and user " @@ -1119,7 +1123,7 @@ msgid "" "(when present), found text (when possible), and selected text." msgstr "" -#: ../../library/idle.rst:628 +#: ../../library/idle.rst:631 msgid "" "IDLE also highlights the :ref:`soft keywords ` :keyword:" "`match`, :keyword:`case `, and :keyword:`_ ` in " @@ -1128,7 +1132,7 @@ msgid "" "patterns." msgstr "" -#: ../../library/idle.rst:634 +#: ../../library/idle.rst:637 msgid "" "Text coloring is done in the background, so uncolorized text is occasionally " "visible. To change the color scheme, use the Configure IDLE dialog " @@ -1136,11 +1140,11 @@ msgid "" "and text in popups and dialogs is not user-configurable." msgstr "" -#: ../../library/idle.rst:641 +#: ../../library/idle.rst:644 msgid "Startup and Code Execution" msgstr "" -#: ../../library/idle.rst:643 +#: ../../library/idle.rst:646 msgid "" "Upon startup with the ``-s`` option, IDLE will execute the file referenced " "by the environment variables :envvar:`IDLESTARTUP` or :envvar:" @@ -1152,7 +1156,7 @@ msgid "" "modules." msgstr "" -#: ../../library/idle.rst:651 +#: ../../library/idle.rst:654 msgid "" "In addition, ``Tk`` also loads a startup file if it is present. Note that " "the Tk file is loaded unconditionally. This additional file is ``.Idle.py`` " @@ -1161,61 +1165,90 @@ msgid "" "importing functions to be used from IDLE's Python shell." msgstr "" -#: ../../library/idle.rst:658 +#: ../../library/idle.rst:661 msgid "Command line usage" msgstr "命令列用法" -#: ../../library/idle.rst:660 -msgid "" -"idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] " -"[arg] ...\n" -"\n" -"-c command run command in the shell window\n" -"-d enable debugger and open shell window\n" -"-e open editor window\n" -"-h print help message with legal combinations and exit\n" -"-i open shell window\n" -"-r file run file in shell window\n" -"-s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window\n" -"-t title set title of shell window\n" -"- run stdin in shell (- must be last option before args)" -msgstr "" -"idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] " -"[arg] ...\n" -"\n" -"-c command run command in the shell window\n" -"-d enable debugger and open shell window\n" -"-e open editor window\n" -"-h print help message with legal combinations and exit\n" -"-i open shell window\n" -"-r file run file in shell window\n" -"-s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window\n" -"-t title set title of shell window\n" -"- run stdin in shell (- must be last option before args)" - -#: ../../library/idle.rst:674 -msgid "If there are arguments:" -msgstr "" - -#: ../../library/idle.rst:676 -msgid "" -"If ``-``, ``-c``, or ``r`` is used, all arguments are placed in ``sys." -"argv[1:...]`` and ``sys.argv[0]`` is set to ``''``, ``'-c'``, or ``'-r'``. " -"No editor window is opened, even if that is the default set in the Options " -"dialog." +#: ../../library/idle.rst:665 +msgid "" +"IDLE can be invoked from the command line with various options. The general " +"syntax is:" +msgstr "" + +#: ../../library/idle.rst:667 +msgid "python -m idlelib [options] [file ...]" msgstr "" -#: ../../library/idle.rst:681 +#: ../../library/idle.rst:671 +msgid "The following options are available:" +msgstr "" + +#: ../../library/idle.rst:675 msgid "" -"Otherwise, arguments are files opened for editing and ``sys.argv`` reflects " -"the arguments passed to IDLE itself." +"Run the specified Python command in the shell window. For example, pass ``-c " +"\"print('Hello, World!')\"``. On Windows, the outer quotes must be double " +"quotes as shown." +msgstr "" + +#: ../../library/idle.rst:681 +msgid "Enable the debugger and open the shell window." msgstr "" #: ../../library/idle.rst:685 +msgid "Open an editor window." +msgstr "" + +#: ../../library/idle.rst:689 +msgid "Print a help message with legal combinations of options and exit." +msgstr "" + +#: ../../library/idle.rst:693 +msgid "Open a shell window." +msgstr "" + +#: ../../library/idle.rst:697 +msgid "Run the specified file in the shell window." +msgstr "" + +#: ../../library/idle.rst:701 +msgid "" +"Run the startup file (as defined by the environment variables :envvar:" +"`IDLESTARTUP` or :envvar:`PYTHONSTARTUP`) before opening the shell window." +msgstr "" + +#: ../../library/idle.rst:705 +msgid "Set the title of the shell window." +msgstr "" + +#: ../../library/idle.rst:709 +msgid "" +"Read and execute standard input in the shell window. This option must be the " +"last one before any arguments." +msgstr "" + +#: ../../library/idle.rst:711 +msgid "If arguments are provided:" +msgstr "" + +#: ../../library/idle.rst:713 +msgid "" +"If ``-``, ``-c``, or ``-r`` is used, all arguments are placed in ``sys." +"argv[1:]``, and ``sys.argv[0]`` is set to ``''``, ``'-c'``, or ``'-r'`` " +"respectively. No editor window is opened, even if that is the default set in " +"the *Options* dialog." +msgstr "" + +#: ../../library/idle.rst:716 +msgid "" +"Otherwise, arguments are treated as files to be opened for editing, and " +"``sys.argv`` reflects the arguments passed to IDLE itself." +msgstr "" + +#: ../../library/idle.rst:720 msgid "Startup failure" msgstr "" -#: ../../library/idle.rst:687 +#: ../../library/idle.rst:722 msgid "" "IDLE uses a socket to communicate between the IDLE GUI process and the user " "code execution process. A connection must be established whenever the Shell " @@ -1225,7 +1258,7 @@ msgid "" "directs the user here. It then exits." msgstr "" -#: ../../library/idle.rst:694 +#: ../../library/idle.rst:729 msgid "" "One specific connection failure on Unix systems results from misconfigured " "masquerading rules somewhere in a system's network setup. When IDLE is " @@ -1235,7 +1268,7 @@ msgid "" "``tcplisten `` in another." msgstr "" -#: ../../library/idle.rst:702 +#: ../../library/idle.rst:737 msgid "" "A common cause of failure is a user-written file with the same name as a " "standard library module, such as *random.py* and *tkinter.py*. When such a " @@ -1244,7 +1277,7 @@ msgid "" "file." msgstr "" -#: ../../library/idle.rst:708 +#: ../../library/idle.rst:743 msgid "" "Though less common than in the past, an antivirus or firewall program may " "stop the connection. If the program cannot be taught to allow the " @@ -1254,7 +1287,7 @@ msgid "" "connections." msgstr "" -#: ../../library/idle.rst:715 +#: ../../library/idle.rst:750 msgid "" "Python installation issues occasionally stop IDLE: multiple versions can " "clash, or a single installation might need admin access. If one undo the " @@ -1262,7 +1295,7 @@ msgid "" "completely remove Python and start over." msgstr "" -#: ../../library/idle.rst:720 +#: ../../library/idle.rst:755 msgid "" "A zombie pythonw.exe process could be a problem. On Windows, use Task " "Manager to check for one and stop it if there is. Sometimes a restart " @@ -1271,7 +1304,7 @@ msgid "" "may fix a temporary problem." msgstr "" -#: ../../library/idle.rst:726 +#: ../../library/idle.rst:761 msgid "" "When IDLE first starts, it attempts to read user configuration files in ``~/." "idlerc/`` (~ is one's home directory). If there is a problem, an error " @@ -1282,14 +1315,14 @@ msgid "" "with the settings dialog." msgstr "" -#: ../../library/idle.rst:734 +#: ../../library/idle.rst:769 msgid "" "If IDLE quits with no message, and it was not started from a console, try " "starting it from a console or terminal (``python -m idlelib``) and see if " "this results in an error message." msgstr "" -#: ../../library/idle.rst:738 +#: ../../library/idle.rst:773 msgid "" "On Unix-based systems with tcl/tk older than ``8.6.11`` (see ``About IDLE``) " "certain characters of certain fonts can cause a tk failure with a message to " @@ -1298,11 +1331,11 @@ msgid "" "upgrade tcl/tk, then re-configure IDLE to use a font that works better." msgstr "" -#: ../../library/idle.rst:746 +#: ../../library/idle.rst:781 msgid "Running user code" msgstr "" -#: ../../library/idle.rst:748 +#: ../../library/idle.rst:783 msgid "" "With rare exceptions, the result of executing Python code with IDLE is " "intended to be the same as executing the same code by the default method, " @@ -1312,7 +1345,7 @@ msgid "" "``threading.active_count()`` returns 2 instead of 1." msgstr "" -#: ../../library/idle.rst:755 +#: ../../library/idle.rst:790 msgid "" "By default, IDLE runs user code in a separate OS process rather than in the " "user interface process that runs the shell and editor. In the execution " @@ -1322,7 +1355,7 @@ msgid "" "__stderr__`` are not touched, but may be ``None``." msgstr "" -#: ../../library/idle.rst:762 +#: ../../library/idle.rst:797 msgid "" "Sending print output from one process to a text widget in another is slower " "than printing to a system terminal in the same process. This has the most " @@ -1334,7 +1367,7 @@ msgid "" "fields and lines." msgstr "" -#: ../../library/idle.rst:771 +#: ../../library/idle.rst:806 msgid "" "IDLE's standard stream replacements are not inherited by subprocesses " "created in the execution process, whether directly by user code or by " @@ -1345,14 +1378,14 @@ msgid "" "attached to that window for input and output." msgstr "" -#: ../../library/idle.rst:780 +#: ../../library/idle.rst:815 msgid "" "If ``sys`` is reset by user code, such as with ``importlib.reload(sys)``, " "IDLE's changes are lost and input from the keyboard and output to the screen " "will not work correctly." msgstr "" -#: ../../library/idle.rst:784 +#: ../../library/idle.rst:819 msgid "" "When Shell has the focus, it controls the keyboard and screen. This is " "normally transparent, but functions that directly access the keyboard and " @@ -1360,7 +1393,7 @@ msgid "" "determine whether a key has been pressed and if so, which." msgstr "" -#: ../../library/idle.rst:789 +#: ../../library/idle.rst:824 msgid "" "The IDLE code running in the execution process adds frames to the call stack " "that would not be there otherwise. IDLE wraps ``sys.getrecursionlimit`` and " @@ -1368,17 +1401,17 @@ msgid "" "frames." msgstr "" -#: ../../library/idle.rst:794 +#: ../../library/idle.rst:829 msgid "" "When user code raises SystemExit either directly or by calling sys.exit, " "IDLE returns to a Shell prompt instead of exiting." msgstr "" -#: ../../library/idle.rst:798 +#: ../../library/idle.rst:833 msgid "User output in Shell" msgstr "" -#: ../../library/idle.rst:800 +#: ../../library/idle.rst:835 msgid "" "When a program outputs text, the result is determined by the corresponding " "output device. When IDLE executes user code, ``sys.stdout`` and ``sys." @@ -1388,7 +1421,7 @@ msgid "" "rather than production runs." msgstr "" -#: ../../library/idle.rst:807 +#: ../../library/idle.rst:842 msgid "" "For instance, Shell never throws away output. A program that sends " "unlimited output to Shell will eventually fill memory, resulting in a memory " @@ -1397,7 +1430,7 @@ msgid "" "lines, with 300 the default." msgstr "" -#: ../../library/idle.rst:813 +#: ../../library/idle.rst:848 msgid "" "A Tk Text widget, and hence IDLE's Shell, displays characters (codepoints) " "in the BMP (Basic Multilingual Plane) subset of Unicode. Which characters " @@ -1411,7 +1444,7 @@ msgid "" "spacing behavior.) ::" msgstr "" -#: ../../library/idle.rst:823 +#: ../../library/idle.rst:858 msgid "" ">>> s = 'a\\tb\\a<\\x02><\\r>\\bc\\nd' # Enter 22 chars.\n" ">>> len(s)\n" @@ -1422,7 +1455,7 @@ msgid "" "# Result varies by OS and font. Try it." msgstr "" -#: ../../library/idle.rst:831 +#: ../../library/idle.rst:866 msgid "" "The ``repr`` function is used for interactive echo of expression values. It " "returns an altered version of the input string in which control codes, some " @@ -1431,13 +1464,13 @@ msgid "" "regardless of how they are displayed." msgstr "" -#: ../../library/idle.rst:837 +#: ../../library/idle.rst:872 msgid "" "Normal and error output are generally kept separate (on separate lines) from " "code input and each other. They each get different highlight colors." msgstr "" -#: ../../library/idle.rst:840 +#: ../../library/idle.rst:875 msgid "" "For SyntaxError tracebacks, the normal '^' marking where the error was " "detected is replaced by coloring the text with an error highlight. When code " @@ -1446,7 +1479,7 @@ msgid "" "opened if necessary." msgstr "" -#: ../../library/idle.rst:846 +#: ../../library/idle.rst:881 msgid "" "Shell has a special facility for squeezing output lines down to a 'Squeezed " "text' label. This is done automatically for output over N lines (N = 50 by " @@ -1455,18 +1488,18 @@ msgid "" "on the output. This can be useful lines long enough to slow down scrolling." msgstr "" -#: ../../library/idle.rst:854 +#: ../../library/idle.rst:889 msgid "" "Squeezed output is expanded in place by double-clicking the label. It can " "also be sent to the clipboard or a separate view window by right-clicking " "the label." msgstr "" -#: ../../library/idle.rst:859 +#: ../../library/idle.rst:894 msgid "Developing tkinter applications" msgstr "" -#: ../../library/idle.rst:861 +#: ../../library/idle.rst:896 msgid "" "IDLE is intentionally different from standard Python in order to facilitate " "development of tkinter programs. Enter ``import tkinter as tk; root = tk." @@ -1478,7 +1511,7 @@ msgid "" "changes in standard Python until one enters ``root.update()``." msgstr "" -#: ../../library/idle.rst:870 +#: ../../library/idle.rst:905 msgid "" "Most tkinter programs run ``root.mainloop()``, which usually does not return " "until the tk app is destroyed. If the program is run with ``python -i`` or " @@ -1486,7 +1519,7 @@ msgid "" "``mainloop()`` returns, at which time there is nothing left to interact with." msgstr "" -#: ../../library/idle.rst:876 +#: ../../library/idle.rst:911 msgid "" "When running a tkinter program from an IDLE editor, one can comment out the " "mainloop call. One then gets a shell prompt immediately and can interact " @@ -1494,11 +1527,11 @@ msgid "" "mainloop call when running in standard Python." msgstr "" -#: ../../library/idle.rst:882 +#: ../../library/idle.rst:917 msgid "Running without a subprocess" msgstr "" -#: ../../library/idle.rst:884 +#: ../../library/idle.rst:919 msgid "" "By default, IDLE executes user code in a separate subprocess via a socket, " "which uses the internal loopback interface. This connection is not " @@ -1506,7 +1539,7 @@ msgid "" "firewall software complains anyway, you can ignore it." msgstr "" -#: ../../library/idle.rst:889 +#: ../../library/idle.rst:924 msgid "" "If the attempt to make the socket connection fails, Idle will notify you. " "Such failures are sometimes transient, but if persistent, the problem may be " @@ -1515,7 +1548,7 @@ msgid "" "command line switch." msgstr "" -#: ../../library/idle.rst:895 +#: ../../library/idle.rst:930 msgid "" "If IDLE is started with the -n command line switch it will run in a single " "process and will not create the subprocess which runs the RPC Python " @@ -1529,15 +1562,15 @@ msgid "" "at all possible." msgstr "" -#: ../../library/idle.rst:910 +#: ../../library/idle.rst:945 msgid "Help and Preferences" msgstr "" -#: ../../library/idle.rst:915 +#: ../../library/idle.rst:950 msgid "Help sources" msgstr "" -#: ../../library/idle.rst:917 +#: ../../library/idle.rst:952 msgid "" "Help menu entry \"IDLE Help\" displays a formatted html version of the IDLE " "chapter of the Library Reference. The result, in a read-only tkinter text " @@ -1547,7 +1580,7 @@ msgid "" "the opened box." msgstr "" -#: ../../library/idle.rst:925 +#: ../../library/idle.rst:960 msgid "" "Help menu entry \"Python Docs\" opens the extensive sources of help, " "including tutorials, available at ``docs.python.org/x.y``, where 'x.y' is " @@ -1556,17 +1589,17 @@ msgid "" "instead." msgstr "" -#: ../../library/idle.rst:931 +#: ../../library/idle.rst:966 msgid "" "Selected URLs can be added or removed from the help menu at any time using " "the General tab of the Configure IDLE dialog." msgstr "" -#: ../../library/idle.rst:937 +#: ../../library/idle.rst:972 msgid "Setting preferences" -msgstr "" +msgstr "設定偏好" -#: ../../library/idle.rst:939 +#: ../../library/idle.rst:974 msgid "" "The font preferences, highlighting, keys, and general preferences can be " "changed via Configure IDLE on the Option menu. Non-default user settings are " @@ -1575,7 +1608,7 @@ msgid "" "or more of the files in ``.idlerc``." msgstr "" -#: ../../library/idle.rst:945 +#: ../../library/idle.rst:980 msgid "" "On the Font tab, see the text sample for the effect of font face and size on " "multiple characters in multiple languages. Edit the sample to add other " @@ -1584,7 +1617,7 @@ msgid "" "them to the top of the sample and try changing first size and then font." msgstr "" -#: ../../library/idle.rst:952 +#: ../../library/idle.rst:987 msgid "" "On the Highlights and Keys tab, select a built-in or custom color theme and " "key set. To use a newer built-in color theme or key set with older IDLEs, " @@ -1592,22 +1625,22 @@ msgid "" "IDLEs." msgstr "" -#: ../../library/idle.rst:958 +#: ../../library/idle.rst:993 msgid "IDLE on macOS" -msgstr "" +msgstr "macOS 上的 IDLE" -#: ../../library/idle.rst:960 +#: ../../library/idle.rst:995 msgid "" "Under System Preferences: Dock, one can set \"Prefer tabs when opening " "documents\" to \"Always\". This setting is not compatible with the tk/" "tkinter GUI framework used by IDLE, and it breaks a few IDLE features." msgstr "" -#: ../../library/idle.rst:965 +#: ../../library/idle.rst:1000 msgid "Extensions" msgstr "" -#: ../../library/idle.rst:967 +#: ../../library/idle.rst:1002 msgid "" "IDLE contains an extension facility. Preferences for extensions can be " "changed with the Extensions tab of the preferences dialog. See the beginning " @@ -1616,21 +1649,21 @@ msgid "" "testing." msgstr "" -#: ../../library/idle.rst:975 -msgid "idlelib" -msgstr "idlelib" +#: ../../library/idle.rst:1010 +msgid "idlelib --- implementation of IDLE application" +msgstr "" -#: ../../library/idle.rst:980 +#: ../../library/idle.rst:1015 msgid "**Source code:** :source:`Lib/idlelib`" msgstr "**原始碼:**\\ :source:`Lib/idlelib/`" -#: ../../library/idle.rst:984 +#: ../../library/idle.rst:1019 msgid "" "The Lib/idlelib package implements the IDLE application. See the rest of " "this page for how to use IDLE." msgstr "" -#: ../../library/idle.rst:987 +#: ../../library/idle.rst:1022 msgid "" "The files in idlelib are described in idlelib/README.txt. Access it either " "in idlelib or click Help => About IDLE on the IDLE menu. This file also " @@ -1639,6 +1672,10 @@ msgid "" "changes can be backported (see :pep:`434`)." msgstr "" +#: ../../library/idle.rst:10 +msgid "IDLE" +msgstr "IDLE" + #: ../../library/idle.rst:10 msgid "Python Editor" msgstr "Python Editor(Python 編輯器)" @@ -1647,26 +1684,56 @@ msgstr "Python Editor(Python 編輯器)" msgid "Integrated Development Environment" msgstr "Integrated Development Environment(整合開發環境)" -#: ../../library/idle.rst:68 +#: ../../library/idle.rst:71 msgid "Module browser" msgstr "Module browser(模組瀏覽器)" -#: ../../library/idle.rst:68 +#: ../../library/idle.rst:71 msgid "Path browser" msgstr "Path browser(路徑瀏覽器)" -#: ../../library/idle.rst:210 +#: ../../library/idle.rst:213 msgid "Run script" msgstr "Run script(執行腳本)" -#: ../../library/idle.rst:277 +#: ../../library/idle.rst:280 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/idle.rst:277 +#: ../../library/idle.rst:280 msgid "stack viewer" msgstr "stack viewer(堆疊檢視器)" -#: ../../library/idle.rst:353 +#: ../../library/idle.rst:356 msgid "breakpoints" msgstr "breakpoints(中斷點)" + +#~ msgid "" +#~ "idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] " +#~ "[arg] ...\n" +#~ "\n" +#~ "-c command run command in the shell window\n" +#~ "-d enable debugger and open shell window\n" +#~ "-e open editor window\n" +#~ "-h print help message with legal combinations and exit\n" +#~ "-i open shell window\n" +#~ "-r file run file in shell window\n" +#~ "-s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window\n" +#~ "-t title set title of shell window\n" +#~ "- run stdin in shell (- must be last option before args)" +#~ msgstr "" +#~ "idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] " +#~ "[arg] ...\n" +#~ "\n" +#~ "-c command run command in the shell window\n" +#~ "-d enable debugger and open shell window\n" +#~ "-e open editor window\n" +#~ "-h print help message with legal combinations and exit\n" +#~ "-i open shell window\n" +#~ "-r file run file in shell window\n" +#~ "-s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window\n" +#~ "-t title set title of shell window\n" +#~ "- run stdin in shell (- must be last option before args)" + +#~ msgid "idlelib" +#~ msgstr "idlelib" diff --git a/library/importlib.metadata.po b/library/importlib.metadata.po index 16d9154e59..32a230af5d 100644 --- a/library/importlib.metadata.po +++ b/library/importlib.metadata.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-03-28 00:16+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-" @@ -113,13 +113,13 @@ msgstr "" #: ../../library/importlib.metadata.rst:82 msgid "" "(example) $ python\n" -">>> from importlib.metadata import version \n" -">>> version('wheel') \n" +">>> from importlib.metadata import version\n" +">>> version('wheel')\n" "'0.32.3'" msgstr "" "(example) $ python\n" -">>> from importlib.metadata import version \n" -">>> version('wheel') \n" +">>> from importlib.metadata import version\n" +">>> version('wheel')\n" "'0.32.3'" #: ../../library/importlib.metadata.rst:89 @@ -136,7 +136,7 @@ msgstr "" #: ../../library/importlib.metadata.rst:95 msgid "" -">>> list(metadata('wheel')) \n" +">>> list(metadata('wheel'))\n" "['Metadata-Version', 'Name', 'Version', 'Summary', 'Home-page', 'Author', " "'Author-email', 'Maintainer', 'Maintainer-email', 'License', 'Project-URL', " "'Project-URL', 'Project-URL', 'Keywords', 'Platform', 'Classifier', " @@ -145,7 +145,7 @@ msgid "" "'Classifier', 'Requires-Python', 'Provides-Extra', 'Requires-Dist', " "'Requires-Dist']" msgstr "" -">>> list(metadata('wheel')) \n" +">>> list(metadata('wheel'))\n" "['Metadata-Version', 'Name', 'Version', 'Summary', 'Home-page', 'Author', " "'Author-email', 'Maintainer', 'Maintainer-email', 'License', 'Project-URL', " "'Project-URL', 'Project-URL', 'Keywords', 'Platform', 'Classifier', " @@ -225,8 +225,8 @@ msgid "Query all entry points::" msgstr "" #: ../../library/importlib.metadata.rst:152 -msgid ">>> eps = entry_points() " -msgstr ">>> eps = entry_points() " +msgid ">>> eps = entry_points()" +msgstr ">>> eps = entry_points()" #: ../../library/importlib.metadata.rst:154 msgid "" @@ -237,11 +237,11 @@ msgstr "" #: ../../library/importlib.metadata.rst:158 msgid "" -">>> sorted(eps.groups) \n" +">>> sorted(eps.groups)\n" "['console_scripts', 'distutils.commands', 'distutils.setup_keywords', " "'egg_info.writers', 'setuptools.installation']" msgstr "" -">>> sorted(eps.groups) \n" +">>> sorted(eps.groups)\n" "['console_scripts', 'distutils.commands', 'distutils.setup_keywords', " "'egg_info.writers', 'setuptools.installation']" @@ -253,8 +253,8 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:165 -msgid ">>> scripts = eps.select(group='console_scripts') " -msgstr ">>> scripts = eps.select(group='console_scripts') " +msgid ">>> scripts = eps.select(group='console_scripts')" +msgstr ">>> scripts = eps.select(group='console_scripts')" #: ../../library/importlib.metadata.rst:167 msgid "" @@ -263,8 +263,8 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:170 -msgid ">>> scripts = entry_points(group='console_scripts') " -msgstr ">>> scripts = entry_points(group='console_scripts') " +msgid ">>> scripts = entry_points(group='console_scripts')" +msgstr ">>> scripts = entry_points(group='console_scripts')" #: ../../library/importlib.metadata.rst:172 msgid "" @@ -273,13 +273,13 @@ msgstr "" #: ../../library/importlib.metadata.rst:174 msgid "" -">>> 'wheel' in scripts.names \n" +">>> 'wheel' in scripts.names\n" "True\n" -">>> wheel = scripts['wheel'] " +">>> wheel = scripts['wheel']" msgstr "" -">>> 'wheel' in scripts.names \n" +">>> 'wheel' in scripts.names\n" "True\n" -">>> wheel = scripts['wheel'] " +">>> wheel = scripts['wheel']" #: ../../library/importlib.metadata.rst:178 msgid "Equivalently, query for that entry point during selection::" @@ -287,11 +287,11 @@ msgstr "" #: ../../library/importlib.metadata.rst:180 msgid "" -">>> (wheel,) = entry_points(group='console_scripts', name='wheel') \n" -">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel') " +">>> (wheel,) = entry_points(group='console_scripts', name='wheel')\n" +">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel')" msgstr "" -">>> (wheel,) = entry_points(group='console_scripts', name='wheel') \n" -">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel') " +">>> (wheel,) = entry_points(group='console_scripts', name='wheel')\n" +">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel')" #: ../../library/importlib.metadata.rst:183 msgid "Inspect the resolved entry point::" @@ -299,28 +299,28 @@ msgstr "" #: ../../library/importlib.metadata.rst:185 msgid "" -">>> wheel \n" +">>> wheel\n" "EntryPoint(name='wheel', value='wheel.cli:main', group='console_scripts')\n" -">>> wheel.module \n" +">>> wheel.module\n" "'wheel.cli'\n" -">>> wheel.attr \n" +">>> wheel.attr\n" "'main'\n" -">>> wheel.extras \n" +">>> wheel.extras\n" "[]\n" -">>> main = wheel.load() \n" -">>> main \n" +">>> main = wheel.load()\n" +">>> main\n" "" msgstr "" -">>> wheel \n" +">>> wheel\n" "EntryPoint(name='wheel', value='wheel.cli:main', group='console_scripts')\n" -">>> wheel.module \n" +">>> wheel.module\n" "'wheel.cli'\n" -">>> wheel.attr \n" +">>> wheel.attr\n" "'main'\n" -">>> wheel.extras \n" +">>> wheel.extras\n" "[]\n" -">>> main = wheel.load() \n" -">>> main \n" +">>> main = wheel.load()\n" +">>> main\n" "" #: ../../library/importlib.metadata.rst:197 @@ -359,10 +359,10 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:226 -#: ../../library/importlib.metadata.rst:274 -#: ../../library/importlib.metadata.rst:295 -#: ../../library/importlib.metadata.rst:358 -#: ../../library/importlib.metadata.rst:409 +#: ../../library/importlib.metadata.rst:275 +#: ../../library/importlib.metadata.rst:296 +#: ../../library/importlib.metadata.rst:359 +#: ../../library/importlib.metadata.rst:410 msgid "" "Raises :exc:`PackageNotFoundError` if the named distribution package is not " "installed in the current Python environment." @@ -389,8 +389,8 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:240 -msgid ">>> wheel_metadata = metadata('wheel') " -msgstr ">>> wheel_metadata = metadata('wheel') " +msgid ">>> wheel_metadata = metadata('wheel')" +msgstr ">>> wheel_metadata = metadata('wheel')" #: ../../library/importlib.metadata.rst:242 msgid "" @@ -400,10 +400,10 @@ msgstr "" #: ../../library/importlib.metadata.rst:245 msgid "" -">>> wheel_metadata['Requires-Python'] \n" +">>> wheel_metadata['Requires-Python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" msgstr "" -">>> wheel_metadata['Requires-Python'] \n" +">>> wheel_metadata['Requires-Python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" #: ../../library/importlib.metadata.rst:248 @@ -421,7 +421,7 @@ msgstr "" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" #: ../../library/importlib.metadata.rst:254 -#: ../../library/importlib.metadata.rst:452 +#: ../../library/importlib.metadata.rst:453 msgid "" "The full set of available metadata is not described here. See the PyPA `Core " "metadata specification `__ for the named " +"distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:277 +#: ../../library/importlib.metadata.rst:278 msgid "" "The :func:`!version` function is the quickest way to get a `Distribution " "Package `_'s version number, as a string::" msgstr "" -#: ../../library/importlib.metadata.rst:281 +#: ../../library/importlib.metadata.rst:282 msgid "" -">>> version('wheel') \n" +">>> version('wheel')\n" "'0.32.3'" msgstr "" -">>> version('wheel') \n" +">>> version('wheel')\n" "'0.32.3'" -#: ../../library/importlib.metadata.rst:288 +#: ../../library/importlib.metadata.rst:289 msgid "Distribution files" msgstr "" -#: ../../library/importlib.metadata.rst:292 +#: ../../library/importlib.metadata.rst:293 msgid "" "Return the full set of files contained within the named distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:298 +#: ../../library/importlib.metadata.rst:299 msgid "" "Returns :const:`None` if the distribution is found but the installation " "database records reporting the files associated with the distribuion package " "are missing." msgstr "" -#: ../../library/importlib.metadata.rst:304 +#: ../../library/importlib.metadata.rst:305 msgid "" "A :class:`pathlib.PurePath` derived object with additional ``dist``, " "``size``, and ``hash`` properties corresponding to the distribution " "package's installation metadata for that file." msgstr "" -#: ../../library/importlib.metadata.rst:308 +#: ../../library/importlib.metadata.rst:309 msgid "" "The :func:`!files` function takes a `Distribution Package `_ name and returns " @@ -494,35 +495,35 @@ msgid "" "class:`PackagePath` instance. For example::" msgstr "" -#: ../../library/importlib.metadata.rst:313 +#: ../../library/importlib.metadata.rst:314 msgid "" -">>> util = [p for p in files('wheel') if 'util.py' in str(p)][0] \n" -">>> util \n" +">>> util = [p for p in files('wheel') if 'util.py' in str(p)][0]\n" +">>> util\n" "PackagePath('wheel/util.py')\n" -">>> util.size \n" +">>> util.size\n" "859\n" -">>> util.dist \n" +">>> util.dist\n" "\n" -">>> util.hash \n" +">>> util.hash\n" "" msgstr "" -">>> util = [p for p in files('wheel') if 'util.py' in str(p)][0] \n" -">>> util \n" +">>> util = [p for p in files('wheel') if 'util.py' in str(p)][0]\n" +">>> util\n" "PackagePath('wheel/util.py')\n" -">>> util.size \n" +">>> util.size\n" "859\n" -">>> util.dist \n" +">>> util.dist\n" "\n" -">>> util.hash \n" +">>> util.hash\n" "" -#: ../../library/importlib.metadata.rst:323 +#: ../../library/importlib.metadata.rst:324 msgid "Once you have the file, you can also read its contents::" msgstr "" -#: ../../library/importlib.metadata.rst:325 +#: ../../library/importlib.metadata.rst:326 msgid "" -">>> print(util.read_text()) \n" +">>> print(util.read_text())\n" "import base64\n" "import sys\n" "...\n" @@ -531,7 +532,7 @@ msgid "" " return s.encode('utf-8')\n" " return s" msgstr "" -">>> print(util.read_text()) \n" +">>> print(util.read_text())\n" "import base64\n" "import sys\n" "...\n" @@ -540,21 +541,21 @@ msgstr "" " return s.encode('utf-8')\n" " return s" -#: ../../library/importlib.metadata.rst:334 +#: ../../library/importlib.metadata.rst:335 msgid "" "You can also use the :meth:`!locate` method to get the absolute path to the " "file::" msgstr "" -#: ../../library/importlib.metadata.rst:337 +#: ../../library/importlib.metadata.rst:338 msgid "" -">>> util.locate() \n" +">>> util.locate()\n" "PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')" msgstr "" -">>> util.locate() \n" +">>> util.locate()\n" "PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')" -#: ../../library/importlib.metadata.rst:340 +#: ../../library/importlib.metadata.rst:341 msgid "" "In the case where the metadata file listing files (``RECORD`` or ``SOURCES." "txt``) is missing, :func:`!files` will return :const:`None`. The caller may " @@ -564,49 +565,49 @@ msgid "" "distribution is not known to have the metadata present." msgstr "" -#: ../../library/importlib.metadata.rst:351 +#: ../../library/importlib.metadata.rst:352 msgid "Distribution requirements" msgstr "" -#: ../../library/importlib.metadata.rst:355 +#: ../../library/importlib.metadata.rst:356 msgid "" "Return the declared dependency specifiers for the named distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:361 +#: ../../library/importlib.metadata.rst:362 msgid "" "To get the full set of requirements for a `Distribution Package `_, use " "the :func:`!requires` function::" msgstr "" -#: ../../library/importlib.metadata.rst:365 +#: ../../library/importlib.metadata.rst:366 msgid "" -">>> requires('wheel') \n" +">>> requires('wheel')\n" "[\"pytest (>=3.0.0) ; extra == 'test'\", \"pytest-cov ; extra == 'test'\"]" msgstr "" -">>> requires('wheel') \n" +">>> requires('wheel')\n" "[\"pytest (>=3.0.0) ; extra == 'test'\", \"pytest-cov ; extra == 'test'\"]" -#: ../../library/importlib.metadata.rst:373 +#: ../../library/importlib.metadata.rst:374 msgid "Mapping import to distribution packages" msgstr "" -#: ../../library/importlib.metadata.rst:377 +#: ../../library/importlib.metadata.rst:378 msgid "" "Return a mapping from the top level module and import package names found " "via :data:`sys.meta_path` to the names of the distribution packages (if any) " "that provide the corresponding files." msgstr "" -#: ../../library/importlib.metadata.rst:381 +#: ../../library/importlib.metadata.rst:382 msgid "" "To allow for namespace packages (which may have members provided by multiple " "distribution packages), each top level import name maps to a list of " "distribution names rather than mapping directly to a single name." msgstr "" -#: ../../library/importlib.metadata.rst:385 +#: ../../library/importlib.metadata.rst:386 msgid "" "A convenience method to resolve the `Distribution Package `_ name (or names, " @@ -615,7 +616,7 @@ msgid "" "glossary/#term-Import-Package>`_::" msgstr "" -#: ../../library/importlib.metadata.rst:390 +#: ../../library/importlib.metadata.rst:391 msgid "" ">>> packages_distributions()\n" "{'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': " @@ -625,110 +626,110 @@ msgstr "" "{'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': " "['jaraco.classes', 'jaraco.functools'], ...}" -#: ../../library/importlib.metadata.rst:393 +#: ../../library/importlib.metadata.rst:394 msgid "" "Some editable installs, `do not supply top-level names `_, and thus this function is not " "reliable with such installs." msgstr "" -#: ../../library/importlib.metadata.rst:402 +#: ../../library/importlib.metadata.rst:403 msgid "Distributions" msgstr "" -#: ../../library/importlib.metadata.rst:406 +#: ../../library/importlib.metadata.rst:407 msgid "" "Return a :class:`Distribution` instance describing the named distribution " "package." msgstr "" -#: ../../library/importlib.metadata.rst:414 +#: ../../library/importlib.metadata.rst:415 msgid "Details of an installed distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:416 +#: ../../library/importlib.metadata.rst:417 msgid "" "Note: different :class:`!Distribution` instances do not currently compare " "equal, even if they relate to the same installed distribution and " "accordingly have the same attributes." msgstr "" -#: ../../library/importlib.metadata.rst:420 +#: ../../library/importlib.metadata.rst:421 msgid "" "While the module level API described above is the most common and convenient " "usage, you can get all of that information from the :class:`!Distribution` " "class. :class:`!Distribution` is an abstract object that represents the " "metadata for a Python `Distribution Package `_. You can get the concreate :" +"latest/glossary/#term-Distribution-Package>`_. You can get the concrete :" "class:`!Distribution` subclass instance for an installed distribution " "package by calling the :func:`distribution` function::" msgstr "" -#: ../../library/importlib.metadata.rst:427 +#: ../../library/importlib.metadata.rst:428 msgid "" -">>> from importlib.metadata import distribution \n" -">>> dist = distribution('wheel') \n" -">>> type(dist) \n" +">>> from importlib.metadata import distribution\n" +">>> dist = distribution('wheel')\n" +">>> type(dist)\n" "" msgstr "" -">>> from importlib.metadata import distribution \n" -">>> dist = distribution('wheel') \n" -">>> type(dist) \n" +">>> from importlib.metadata import distribution\n" +">>> dist = distribution('wheel')\n" +">>> type(dist)\n" "" -#: ../../library/importlib.metadata.rst:432 +#: ../../library/importlib.metadata.rst:433 msgid "" "Thus, an alternative way to get the version number is through the :class:`!" "Distribution` instance::" msgstr "" -#: ../../library/importlib.metadata.rst:435 +#: ../../library/importlib.metadata.rst:436 msgid "" -">>> dist.version \n" +">>> dist.version\n" "'0.32.3'" msgstr "" -">>> dist.version \n" +">>> dist.version\n" "'0.32.3'" -#: ../../library/importlib.metadata.rst:438 +#: ../../library/importlib.metadata.rst:439 msgid "" "There are all kinds of additional metadata available on :class:`!" "Distribution` instances::" msgstr "" -#: ../../library/importlib.metadata.rst:441 +#: ../../library/importlib.metadata.rst:442 msgid "" -">>> dist.metadata['Requires-Python'] \n" +">>> dist.metadata['Requires-Python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'\n" -">>> dist.metadata['License'] \n" +">>> dist.metadata['License']\n" "'MIT'" msgstr "" -">>> dist.metadata['Requires-Python'] \n" +">>> dist.metadata['Requires-Python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'\n" -">>> dist.metadata['License'] \n" +">>> dist.metadata['License']\n" "'MIT'" -#: ../../library/importlib.metadata.rst:446 +#: ../../library/importlib.metadata.rst:447 msgid "" "For editable packages, an ``origin`` property may present :pep:`610` " "metadata::" msgstr "" -#: ../../library/importlib.metadata.rst:449 +#: ../../library/importlib.metadata.rst:450 msgid "" ">>> dist.origin.url\n" "'file:///path/to/wheel-0.32.3.editable-py3-none-any.whl'" msgstr "" -#: ../../library/importlib.metadata.rst:455 +#: ../../library/importlib.metadata.rst:456 msgid "The ``.origin`` property was added." msgstr "新增 ``.origin`` 屬性 (property)。" -#: ../../library/importlib.metadata.rst:459 +#: ../../library/importlib.metadata.rst:460 msgid "Distribution Discovery" msgstr "" -#: ../../library/importlib.metadata.rst:461 +#: ../../library/importlib.metadata.rst:462 msgid "" "By default, this package provides built-in support for discovery of metadata " "for file system and zip file `Distribution Package `_ metadata is not available through :" @@ -763,14 +764,14 @@ msgid "" "on :data:`sys.meta_path`." msgstr "" -#: ../../library/importlib.metadata.rst:480 +#: ../../library/importlib.metadata.rst:481 msgid "" "By default ``importlib.metadata`` installs a finder for distribution " "packages found on the file system. This finder doesn't actually find any " "*distributions*, but it can find their metadata." msgstr "" -#: ../../library/importlib.metadata.rst:485 +#: ../../library/importlib.metadata.rst:486 msgid "" "The abstract class :py:class:`importlib.abc.MetaPathFinder` defines the " "interface expected of finders by Python's import system. ``importlib." @@ -780,7 +781,7 @@ msgid "" "base class, which defines this abstract method::" msgstr "" -#: ../../library/importlib.metadata.rst:493 +#: ../../library/importlib.metadata.rst:494 msgid "" "@abc.abstractmethod\n" "def find_distributions(context=DistributionFinder.Context()):\n" @@ -789,14 +790,14 @@ msgid "" " \"\"\"" msgstr "" -#: ../../library/importlib.metadata.rst:499 +#: ../../library/importlib.metadata.rst:500 msgid "" "The ``DistributionFinder.Context`` object provides ``.path`` and ``.name`` " "properties indicating the path to search and name to match and may supply " "other relevant context." msgstr "" -#: ../../library/importlib.metadata.rst:503 +#: ../../library/importlib.metadata.rst:504 msgid "" "What this means in practice is that to support finding distribution package " "metadata in locations other than the file system, subclass ``Distribution`` " @@ -805,17 +806,17 @@ msgid "" "method." msgstr "" -#: ../../library/importlib.metadata.rst:510 +#: ../../library/importlib.metadata.rst:511 msgid "Example" msgstr "" -#: ../../library/importlib.metadata.rst:512 +#: ../../library/importlib.metadata.rst:513 msgid "" "Consider for example a custom finder that loads Python modules from a " "database::" msgstr "" -#: ../../library/importlib.metadata.rst:515 +#: ../../library/importlib.metadata.rst:516 msgid "" "class DatabaseImporter(importlib.abc.MetaPathFinder):\n" " def __init__(self, db):\n" @@ -827,14 +828,14 @@ msgid "" "sys.meta_path.append(DatabaseImporter(connect_db(...)))" msgstr "" -#: ../../library/importlib.metadata.rst:524 +#: ../../library/importlib.metadata.rst:525 msgid "" "That importer now presumably provides importable modules from a database, " "but it provides no metadata or entry points. For this custom importer to " "provide metadata, it would also need to implement ``DistributionFinder``::" msgstr "" -#: ../../library/importlib.metadata.rst:529 +#: ../../library/importlib.metadata.rst:530 msgid "" "from importlib.metadata import DistributionFinder\n" "\n" @@ -847,7 +848,7 @@ msgid "" " yield DatabaseDistribution(dist_record)" msgstr "" -#: ../../library/importlib.metadata.rst:539 +#: ../../library/importlib.metadata.rst:540 msgid "" "In this way, ``query_distributions`` would return records for each " "distribution served by the database matching the query. For example, if " @@ -856,7 +857,7 @@ msgid "" "``Context(name=None)``." msgstr "" -#: ../../library/importlib.metadata.rst:545 +#: ../../library/importlib.metadata.rst:546 msgid "" "For the sake of simplicity, this example ignores ``context.path``\\. The " "``path`` attribute defaults to ``sys.path`` and is the set of import paths " @@ -869,11 +870,11 @@ msgid "" "``context.path`` and only yield ``Distribution``\\ s pertinent to that path." msgstr "" -#: ../../library/importlib.metadata.rst:556 +#: ../../library/importlib.metadata.rst:557 msgid "``DatabaseDistribution``, then, would look something like::" msgstr "" -#: ../../library/importlib.metadata.rst:558 +#: ../../library/importlib.metadata.rst:559 msgid "" "class DatabaseDistribution(importlib.metadata.Distribution):\n" " def __init__(self, record):\n" @@ -896,14 +897,14 @@ msgid "" " raise RuntimeError(\"This distribution has no file system\")" msgstr "" -#: ../../library/importlib.metadata.rst:578 +#: ../../library/importlib.metadata.rst:579 msgid "" "This basic implementation should provide metadata and entry points for " "packages served by the ``DatabaseImporter``, assuming that the ``record`` " "supplies suitable ``.name``, ``.version``, and ``.entry_points`` attributes." msgstr "" -#: ../../library/importlib.metadata.rst:583 +#: ../../library/importlib.metadata.rst:584 msgid "" "The ``DatabaseDistribution`` may also provide other metadata files, like " "``RECORD`` (required for ``Distribution.files``) or override the " diff --git a/library/importlib.po b/library/importlib.po index bdfc300dcf..4c36d9ea83 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,9 +43,9 @@ msgid "" "to comprehend than one implemented in a programming language other than " "Python." msgstr "" -"第一是提供 Python 原始碼中 :keyword:`import` 陳述式的實作(因此,也延伸到 :" -"func:`__import__` 函式)。這讓 :keyword:`!import` 實作可以移植到任何 Python " -"直譯器。同時,這也提供了一個比用其他程式語言實作更容易理解的版本。 " +"第一是提供 Python 原始碼中 :keyword:`import` 陳述式的實作(因此,也延伸" +"到 :func:`__import__` 函式)。這讓 :keyword:`!import` 實作可以移植到任何 " +"Python 直譯器。同時,這也提供了一個比用其他程式語言實作更容易理解的版本。" #: ../../library/importlib.rst:29 msgid "" @@ -89,8 +89,8 @@ msgstr "" #: ../../library/importlib.rst:47 msgid "" "Original specification of packages. Some semantics have changed since the " -"writing of this document (e.g. redirecting based on ``None`` in :data:`sys." -"modules`)." +"writing of this document (e.g. redirecting based on ``None`` " +"in :data:`sys.modules`)." msgstr "" #: ../../library/importlib.rst:51 @@ -231,11 +231,11 @@ msgstr "" #: ../../library/importlib.rst:115 msgid "" -"The :func:`import_module` function acts as a simplifying wrapper around :" -"func:`importlib.__import__`. This means all semantics of the function are " -"derived from :func:`importlib.__import__`. The most important difference " -"between these two functions is that :func:`import_module` returns the " -"specified package or module (e.g. ``pkg.mod``), while :func:`__import__` " +"The :func:`import_module` function acts as a simplifying wrapper " +"around :func:`importlib.__import__`. This means all semantics of the " +"function are derived from :func:`importlib.__import__`. The most important " +"difference between these two functions is that :func:`import_module` returns " +"the specified package or module (e.g. ``pkg.mod``), while :func:`__import__` " "returns the top-level package or module (e.g. ``pkg``)." msgstr "" @@ -347,11 +347,11 @@ msgstr "" #: ../../library/importlib.rst:193 msgid "" -"If a module imports objects from another module using :keyword:`from` ... :" -"keyword:`import` ..., calling :func:`reload` for the other module does not " -"redefine the objects imported from it --- one way around this is to re-" -"execute the :keyword:`!from` statement, another is to use :keyword:`!import` " -"and qualified names (*module.name*) instead." +"If a module imports objects from another module " +"using :keyword:`from` ... :keyword:`import` ..., calling :func:`reload` for " +"the other module does not redefine the objects imported from it --- one way " +"around this is to re-execute the :keyword:`!from` statement, another is to " +"use :keyword:`!import` and qualified names (*module.name*) instead." msgstr "" #: ../../library/importlib.rst:199 @@ -364,8 +364,8 @@ msgstr "" #: ../../library/importlib.rst:205 msgid "" -":exc:`ModuleNotFoundError` is raised when the module being reloaded lacks a :" -"class:`~importlib.machinery.ModuleSpec`." +":exc:`ModuleNotFoundError` is raised when the module being reloaded lacks " +"a :class:`~importlib.machinery.ModuleSpec`." msgstr "" #: ../../library/importlib.rst:211 @@ -444,26 +444,27 @@ msgstr "" msgid "" "An abstract base class representing a :term:`path entry finder`. Though it " "bears some similarities to :class:`MetaPathFinder`, ``PathEntryFinder`` is " -"meant for use only within the path-based import subsystem provided by :class:" -"`importlib.machinery.PathFinder`." +"meant for use only within the path-based import subsystem provided " +"by :class:`importlib.machinery.PathFinder`." msgstr "" #: ../../library/importlib.rst:285 msgid "" "An abstract method for finding a :term:`spec ` for the " -"specified module. The finder will search for the module only within the :" -"term:`path entry` to which it is assigned. If a spec cannot be found, " +"specified module. The finder will search for the module only within " +"the :term:`path entry` to which it is assigned. If a spec cannot be found, " "``None`` is returned. When passed in, ``target`` is a module object that " -"the finder may use to make a more educated guess about what spec to return. :" -"func:`importlib.util.spec_from_loader` may be useful for implementing " -"concrete ``PathEntryFinders``." +"the finder may use to make a more educated guess about what spec to " +"return. :func:`importlib.util.spec_from_loader` may be useful for " +"implementing concrete ``PathEntryFinders``." msgstr "" #: ../../library/importlib.rst:297 msgid "" "An optional method which, when called, should invalidate any internal cache " -"used by the finder. Used by :meth:`importlib.machinery.PathFinder." -"invalidate_caches` when invalidating the caches of all cached finders." +"used by the finder. Used " +"by :meth:`importlib.machinery.PathFinder.invalidate_caches` when " +"invalidating the caches of all cached finders." msgstr "" #: ../../library/importlib.rst:305 @@ -474,9 +475,9 @@ msgstr "" #: ../../library/importlib.rst:308 msgid "" -"Loaders that wish to support resource reading should implement a :meth:" -"`get_resource_reader` method as specified by :class:`importlib.resources.abc." -"ResourceReader`." +"Loaders that wish to support resource reading should implement " +"a :meth:`get_resource_reader` method as specified " +"by :class:`importlib.resources.abc.ResourceReader`." msgstr "" #: ../../library/importlib.rst:312 @@ -498,8 +499,8 @@ msgstr "" msgid "" "An abstract method that executes the module in its own namespace when a " "module is imported or reloaded. The module should already be initialized " -"when :meth:`exec_module` is called. When this method exists, :meth:" -"`create_module` must be defined." +"when :meth:`exec_module` is called. When this method " +"exists, :meth:`create_module` must be defined." msgstr "" #: ../../library/importlib.rst:336 @@ -508,8 +509,9 @@ msgstr ":meth:`create_module` 也必須被定義。" #: ../../library/importlib.rst:341 msgid "" -"A legacy method for loading a module. If the module cannot be loaded, :exc:" -"`ImportError` is raised, otherwise the loaded module is returned." +"A legacy method for loading a module. If the module cannot be " +"loaded, :exc:`ImportError` is raised, otherwise the loaded module is " +"returned." msgstr "" #: ../../library/importlib.rst:345 @@ -567,67 +569,69 @@ msgstr "" #: ../../library/importlib.rst:373 msgid "" -"The recommended API for loading a module is :meth:`exec_module` (and :meth:" -"`create_module`). Loaders should implement it instead of :meth:" -"`load_module`. The import machinery takes care of all the other " +"The recommended API for loading a module is :meth:`exec_module` " +"(and :meth:`create_module`). Loaders should implement it instead " +"of :meth:`load_module`. The import machinery takes care of all the other " "responsibilities of :meth:`load_module` when :meth:`exec_module` is " "implemented." msgstr "" -#: ../../library/importlib.rst:383 ../../library/importlib.rst:631 +#: ../../library/importlib.rst:383 ../../library/importlib.rst:636 msgid "*Superseded by TraversableResources*" msgstr "" #: ../../library/importlib.rst:385 msgid "" -"An abstract base class for a :term:`loader` which implements the optional :" -"pep:`302` protocol for loading arbitrary resources from the storage back-end." +"An abstract base class for a :term:`loader` which implements the " +"optional :pep:`302` protocol for loading arbitrary resources from the " +"storage back-end." msgstr "" #: ../../library/importlib.rst:389 msgid "" -"This ABC is deprecated in favour of supporting resource loading through :" -"class:`importlib.resources.abc.TraversableResources`." +"This ABC is deprecated in favour of supporting resource loading " +"through :class:`importlib.resources.abc.TraversableResources`." msgstr "" -#: ../../library/importlib.rst:395 +#: ../../library/importlib.rst:396 msgid "" "An abstract method to return the bytes for the data located at *path*. " "Loaders that have a file-like storage back-end that allows storing arbitrary " "data can implement this abstract method to give direct access to the data " "stored. :exc:`OSError` is to be raised if the *path* cannot be found. The " -"*path* is expected to be constructed using a module's :attr:`~module." -"__file__` attribute or an item from a package's :attr:`~module.__path__`." +"*path* is expected to be constructed using a " +"module's :attr:`~module.__file__` attribute or an item from a " +"package's :attr:`~module.__path__`." msgstr "" -#: ../../library/importlib.rst:404 +#: ../../library/importlib.rst:405 msgid "Raises :exc:`OSError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:410 +#: ../../library/importlib.rst:411 msgid "" -"An abstract base class for a :term:`loader` which implements the optional :" -"pep:`302` protocol for loaders that inspect modules." +"An abstract base class for a :term:`loader` which implements the " +"optional :pep:`302` protocol for loaders that inspect modules." msgstr "" -#: ../../library/importlib.rst:415 +#: ../../library/importlib.rst:416 msgid "" "Return the code object for a module, or ``None`` if the module does not have " "a code object (as would be the case, for example, for a built-in module). " "Raise an :exc:`ImportError` if loader cannot find the requested module." msgstr "" -#: ../../library/importlib.rst:421 +#: ../../library/importlib.rst:422 msgid "" "While the method has a default implementation, it is suggested that it be " "overridden if possible for performance." msgstr "" -#: ../../library/importlib.rst:427 +#: ../../library/importlib.rst:428 msgid "No longer abstract and a concrete implementation is provided." msgstr "" -#: ../../library/importlib.rst:432 +#: ../../library/importlib.rst:434 msgid "" "An abstract method to return the source of a module. It is returned as a " "text string using :term:`universal newlines`, translating all recognized " @@ -636,233 +640,234 @@ msgid "" "cannot find the module specified." msgstr "" -#: ../../library/importlib.rst:438 ../../library/importlib.rst:447 -#: ../../library/importlib.rst:497 +#: ../../library/importlib.rst:440 ../../library/importlib.rst:449 +#: ../../library/importlib.rst:500 msgid "Raises :exc:`ImportError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:443 +#: ../../library/importlib.rst:445 msgid "" "An optional method to return a true value if the module is a package, a " "false value otherwise. :exc:`ImportError` is raised if the :term:`loader` " "cannot find the module." msgstr "" -#: ../../library/importlib.rst:452 +#: ../../library/importlib.rst:454 msgid "Create a code object from Python source." msgstr "" -#: ../../library/importlib.rst:454 +#: ../../library/importlib.rst:456 msgid "" -"The *data* argument can be whatever the :func:`compile` function supports (i." -"e. string or bytes). The *path* argument should be the \"path\" to where the " -"source code originated from, which can be an abstract concept (e.g. location " -"in a zip file)." +"The *data* argument can be whatever the :func:`compile` function supports " +"(i.e. string or bytes). The *path* argument should be the \"path\" to where " +"the source code originated from, which can be an abstract concept (e.g. " +"location in a zip file)." msgstr "" -#: ../../library/importlib.rst:459 +#: ../../library/importlib.rst:461 msgid "" "With the subsequent code object one can execute it in a module by running " "``exec(code, module.__dict__)``." msgstr "" -#: ../../library/importlib.rst:464 +#: ../../library/importlib.rst:466 msgid "Made the method static." msgstr "" -#: ../../library/importlib.rst:469 +#: ../../library/importlib.rst:471 msgid "Implementation of :meth:`Loader.exec_module`." msgstr ":meth:`Loader.exec_module` 的實作。" -#: ../../library/importlib.rst:475 +#: ../../library/importlib.rst:477 msgid "Implementation of :meth:`Loader.load_module`." msgstr ":meth:`Loader.load_module` 的實作。" -#: ../../library/importlib.rst:477 +#: ../../library/importlib.rst:479 msgid "use :meth:`exec_module` instead." msgstr "請改用 :meth:`exec_module`。" -#: ../../library/importlib.rst:483 +#: ../../library/importlib.rst:485 msgid "" "An abstract base class which inherits from :class:`InspectLoader` that, when " "implemented, helps a module to be executed as a script. The ABC represents " "an optional :pep:`302` protocol." msgstr "" -#: ../../library/importlib.rst:489 +#: ../../library/importlib.rst:492 msgid "" "An abstract method that is to return the value of :attr:`~module.__file__` " "for the specified module. If no path is available, :exc:`ImportError` is " "raised." msgstr "" -#: ../../library/importlib.rst:493 +#: ../../library/importlib.rst:496 msgid "" "If source code is available, then the method should return the path to the " "source file, regardless of whether a bytecode was used to load the module." msgstr "" -#: ../../library/importlib.rst:503 +#: ../../library/importlib.rst:506 msgid "" -"An abstract base class which inherits from :class:`ResourceLoader` and :" -"class:`ExecutionLoader`, providing concrete implementations of :meth:" -"`ResourceLoader.get_data` and :meth:`ExecutionLoader.get_filename`." +"An abstract base class which inherits from :class:`ResourceLoader` " +"and :class:`ExecutionLoader`, providing concrete implementations " +"of :meth:`ResourceLoader.get_data` and :meth:`ExecutionLoader.get_filename`." msgstr "" -#: ../../library/importlib.rst:507 +#: ../../library/importlib.rst:510 msgid "" "The *fullname* argument is a fully resolved name of the module the loader is " "to handle. The *path* argument is the path to the file for the module." msgstr "" -#: ../../library/importlib.rst:514 +#: ../../library/importlib.rst:517 msgid "The name of the module the loader can handle." msgstr "" -#: ../../library/importlib.rst:518 +#: ../../library/importlib.rst:521 msgid "Path to the file of the module." msgstr "" -#: ../../library/importlib.rst:522 +#: ../../library/importlib.rst:525 msgid "Calls super's ``load_module()``." msgstr "" -#: ../../library/importlib.rst:524 +#: ../../library/importlib.rst:527 msgid "Use :meth:`Loader.exec_module` instead." msgstr "" -#: ../../library/importlib.rst:529 ../../library/importlib.rst:1124 +#: ../../library/importlib.rst:533 ../../library/importlib.rst:1140 msgid "Returns :attr:`path`." msgstr "" -#: ../../library/importlib.rst:533 +#: ../../library/importlib.rst:538 msgid "Reads *path* as a binary file and returns the bytes from it." msgstr "" -#: ../../library/importlib.rst:538 +#: ../../library/importlib.rst:543 msgid "" "An abstract base class for implementing source (and optionally bytecode) " -"file loading. The class inherits from both :class:`ResourceLoader` and :" -"class:`ExecutionLoader`, requiring the implementation of:" +"file loading. The class inherits from both :class:`ResourceLoader` " +"and :class:`ExecutionLoader`, requiring the implementation of:" msgstr "" -#: ../../library/importlib.rst:542 +#: ../../library/importlib.rst:547 msgid ":meth:`ResourceLoader.get_data`" msgstr ":meth:`ResourceLoader.get_data`" -#: ../../library/importlib.rst:543 +#: ../../library/importlib.rst:548 msgid ":meth:`ExecutionLoader.get_filename`" msgstr ":meth:`ExecutionLoader.get_filename`" -#: ../../library/importlib.rst:544 +#: ../../library/importlib.rst:549 msgid "" "Should only return the path to the source file; sourceless loading is not " "supported." msgstr "" -#: ../../library/importlib.rst:547 +#: ../../library/importlib.rst:552 msgid "" "The abstract methods defined by this class are to add optional bytecode file " -"support. Not implementing these optional methods (or causing them to raise :" -"exc:`NotImplementedError`) causes the loader to only work with source code. " -"Implementing the methods allows the loader to work with source *and* " +"support. Not implementing these optional methods (or causing them to " +"raise :exc:`NotImplementedError`) causes the loader to only work with source " +"code. Implementing the methods allows the loader to work with source *and* " "bytecode files; it does not allow for *sourceless* loading where only " "bytecode is provided. Bytecode files are an optimization to speed up " "loading by removing the parsing step of Python's compiler, and so no " "bytecode-specific API is exposed." msgstr "" -#: ../../library/importlib.rst:558 +#: ../../library/importlib.rst:563 msgid "" "Optional abstract method which returns a :class:`dict` containing metadata " "about the specified path. Supported dictionary keys are:" msgstr "" -#: ../../library/importlib.rst:561 +#: ../../library/importlib.rst:566 msgid "" "``'mtime'`` (mandatory): an integer or floating-point number representing " "the modification time of the source code;" msgstr "" -#: ../../library/importlib.rst:563 +#: ../../library/importlib.rst:568 msgid "``'size'`` (optional): the size in bytes of the source code." msgstr "" -#: ../../library/importlib.rst:565 +#: ../../library/importlib.rst:570 msgid "" "Any other keys in the dictionary are ignored, to allow for future " "extensions. If the path cannot be handled, :exc:`OSError` is raised." msgstr "" -#: ../../library/importlib.rst:570 ../../library/importlib.rst:583 +#: ../../library/importlib.rst:575 ../../library/importlib.rst:588 msgid "Raise :exc:`OSError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:575 +#: ../../library/importlib.rst:580 msgid "" "Optional abstract method which returns the modification time for the " "specified path." msgstr "" -#: ../../library/importlib.rst:578 +#: ../../library/importlib.rst:583 msgid "" "This method is deprecated in favour of :meth:`path_stats`. You don't have " "to implement it, but it is still available for compatibility purposes. " "Raise :exc:`OSError` if the path cannot be handled." msgstr "" -#: ../../library/importlib.rst:588 +#: ../../library/importlib.rst:593 msgid "" "Optional abstract method which writes the specified bytes to a file path. " "Any intermediate directories which do not exist are to be created " "automatically." msgstr "" -#: ../../library/importlib.rst:592 +#: ../../library/importlib.rst:597 msgid "" -"When writing to the path fails because the path is read-only (:const:`errno." -"EACCES`/:exc:`PermissionError`), do not propagate the exception." +"When writing to the path fails because the path is read-only " +"(:const:`errno.EACCES`/:exc:`PermissionError`), do not propagate the " +"exception." msgstr "" -#: ../../library/importlib.rst:596 +#: ../../library/importlib.rst:601 msgid "No longer raises :exc:`NotImplementedError` when called." msgstr "" -#: ../../library/importlib.rst:601 +#: ../../library/importlib.rst:606 msgid "Concrete implementation of :meth:`InspectLoader.get_code`." msgstr "" -#: ../../library/importlib.rst:605 +#: ../../library/importlib.rst:610 msgid "Concrete implementation of :meth:`Loader.exec_module`." msgstr "" -#: ../../library/importlib.rst:611 +#: ../../library/importlib.rst:616 msgid "Concrete implementation of :meth:`Loader.load_module`." msgstr "" -#: ../../library/importlib.rst:613 +#: ../../library/importlib.rst:618 msgid "Use :meth:`exec_module` instead." msgstr "" -#: ../../library/importlib.rst:618 +#: ../../library/importlib.rst:623 msgid "Concrete implementation of :meth:`InspectLoader.get_source`." msgstr "" -#: ../../library/importlib.rst:622 +#: ../../library/importlib.rst:627 msgid "" "Concrete implementation of :meth:`InspectLoader.is_package`. A module is " -"determined to be a package if its file path (as provided by :meth:" -"`ExecutionLoader.get_filename`) is a file named ``__init__`` when the file " -"extension is removed **and** the module name itself does not end in " +"determined to be a package if its file path (as provided " +"by :meth:`ExecutionLoader.get_filename`) is a file named ``__init__`` when " +"the file extension is removed **and** the module name itself does not end in " "``__init__``." msgstr "" -#: ../../library/importlib.rst:633 +#: ../../library/importlib.rst:638 msgid "" "An :term:`abstract base class` to provide the ability to read *resources*." msgstr "" -#: ../../library/importlib.rst:636 +#: ../../library/importlib.rst:641 msgid "" "From the perspective of this ABC, a *resource* is a binary artifact that is " "shipped within a package. Typically this is something like a data file that " @@ -872,11 +877,11 @@ msgid "" "file versus on the file system." msgstr "" -#: ../../library/importlib.rst:644 +#: ../../library/importlib.rst:649 msgid "" -"For any of methods of this class, a *resource* argument is expected to be a :" -"term:`path-like object` which represents conceptually just a file name. This " -"means that no subdirectory paths should be included in the *resource* " +"For any of methods of this class, a *resource* argument is expected to be " +"a :term:`path-like object` which represents conceptually just a file name. " +"This means that no subdirectory paths should be included in the *resource* " "argument. This is because the location of the package the reader is for, " "acts as the \"directory\". Hence the metaphor for directories and file names " "is packages and resources, respectively. This is also why instances of this " @@ -884,7 +889,7 @@ msgid "" "potentially representing multiple packages or a module)." msgstr "" -#: ../../library/importlib.rst:655 +#: ../../library/importlib.rst:660 msgid "" "Loaders that wish to support resource reading are expected to provide a " "method called ``get_resource_reader(fullname)`` which returns an object " @@ -893,45 +898,45 @@ msgid "" "with this ABC should only be returned when the specified module is a package." msgstr "" -#: ../../library/importlib.rst:664 ../../library/importlib.rst:774 +#: ../../library/importlib.rst:669 ../../library/importlib.rst:789 msgid "Use :class:`importlib.resources.abc.TraversableResources` instead." msgstr "" -#: ../../library/importlib.rst:669 +#: ../../library/importlib.rst:675 msgid "" "Returns an opened, :term:`file-like object` for binary reading of the " "*resource*." msgstr "" -#: ../../library/importlib.rst:672 +#: ../../library/importlib.rst:678 msgid "If the resource cannot be found, :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/importlib.rst:677 +#: ../../library/importlib.rst:684 msgid "Returns the file system path to the *resource*." msgstr "" -#: ../../library/importlib.rst:679 +#: ../../library/importlib.rst:686 msgid "" -"If the resource does not concretely exist on the file system, raise :exc:" -"`FileNotFoundError`." +"If the resource does not concretely exist on the file system, " +"raise :exc:`FileNotFoundError`." msgstr "" -#: ../../library/importlib.rst:684 +#: ../../library/importlib.rst:692 msgid "" -"Returns ``True`` if the named *name* is considered a resource. :exc:" -"`FileNotFoundError` is raised if *name* does not exist." +"Returns ``True`` if the named *name* is considered a " +"resource. :exc:`FileNotFoundError` is raised if *name* does not exist." msgstr "" -#: ../../library/importlib.rst:689 +#: ../../library/importlib.rst:698 msgid "" "Returns an :term:`iterable` of strings over the contents of the package. Do " "note that it is not required that all names returned by the iterator be " -"actual resources, e.g. it is acceptable to return names for which :meth:" -"`is_resource` would be false." +"actual resources, e.g. it is acceptable to return names for " +"which :meth:`is_resource` would be false." msgstr "" -#: ../../library/importlib.rst:695 +#: ../../library/importlib.rst:704 msgid "" "Allowing non-resource names to be returned is to allow for situations where " "how a package and its resources are stored are known a priori and the non-" @@ -940,254 +945,258 @@ msgid "" "stored on the file system then those subdirectory names can be used directly." msgstr "" -#: ../../library/importlib.rst:703 +#: ../../library/importlib.rst:712 msgid "The abstract method returns an iterable of no items." msgstr "" -#: ../../library/importlib.rst:708 +#: ../../library/importlib.rst:717 msgid "" "An object with a subset of :class:`pathlib.Path` methods suitable for " "traversing directories and opening files." msgstr "" -#: ../../library/importlib.rst:711 +#: ../../library/importlib.rst:720 msgid "" -"For a representation of the object on the file-system, use :meth:`importlib." -"resources.as_file`." +"For a representation of the object on the file-system, " +"use :meth:`importlib.resources.as_file`." msgstr "" -#: ../../library/importlib.rst:716 +#: ../../library/importlib.rst:725 msgid "Use :class:`importlib.resources.abc.Traversable` instead." msgstr "" -#: ../../library/importlib.rst:721 +#: ../../library/importlib.rst:730 msgid "Abstract. The base name of this object without any parent references." msgstr "" -#: ../../library/importlib.rst:725 +#: ../../library/importlib.rst:735 msgid "Yield ``Traversable`` objects in ``self``." msgstr "" -#: ../../library/importlib.rst:729 +#: ../../library/importlib.rst:740 msgid "Return ``True`` if ``self`` is a directory." msgstr "" -#: ../../library/importlib.rst:733 +#: ../../library/importlib.rst:745 msgid "Return ``True`` if ``self`` is a file." msgstr "" -#: ../../library/importlib.rst:737 +#: ../../library/importlib.rst:750 msgid "Return Traversable child in ``self``." msgstr "" -#: ../../library/importlib.rst:741 +#: ../../library/importlib.rst:755 msgid "Return ``Traversable`` child in ``self``." msgstr "" -#: ../../library/importlib.rst:745 +#: ../../library/importlib.rst:760 msgid "" "*mode* may be 'r' or 'rb' to open as text or binary. Return a handle " "suitable for reading (same as :attr:`pathlib.Path.open`)." msgstr "" -#: ../../library/importlib.rst:748 +#: ../../library/importlib.rst:763 msgid "" -"When opening as text, accepts encoding parameters such as those accepted by :" -"class:`io.TextIOWrapper`." +"When opening as text, accepts encoding parameters such as those accepted " +"by :class:`io.TextIOWrapper`." msgstr "" -#: ../../library/importlib.rst:753 +#: ../../library/importlib.rst:768 msgid "Read contents of ``self`` as bytes." msgstr "" -#: ../../library/importlib.rst:757 +#: ../../library/importlib.rst:772 msgid "Read contents of ``self`` as text." msgstr "" -#: ../../library/importlib.rst:762 +#: ../../library/importlib.rst:777 msgid "" -"An abstract base class for resource readers capable of serving the :meth:" -"`importlib.resources.files` interface. Subclasses :class:`importlib." -"resources.abc.ResourceReader` and provides concrete implementations of the :" -"class:`importlib.resources.abc.ResourceReader`'s abstract methods. " +"An abstract base class for resource readers capable of serving " +"the :meth:`importlib.resources.files` interface. " +"Subclasses :class:`importlib.resources.abc.ResourceReader` and provides " +"concrete implementations of " +"the :class:`importlib.resources.abc.ResourceReader`'s abstract methods. " "Therefore, any loader supplying :class:`importlib.abc.TraversableResources` " "also supplies ResourceReader." msgstr "" -#: ../../library/importlib.rst:769 +#: ../../library/importlib.rst:784 msgid "" "Loaders that wish to support resource reading are expected to implement this " "interface." msgstr "" -#: ../../library/importlib.rst:779 +#: ../../library/importlib.rst:795 msgid "" "Returns a :class:`importlib.resources.abc.Traversable` object for the loaded " "package." msgstr "" -#: ../../library/importlib.rst:785 +#: ../../library/importlib.rst:801 msgid ":mod:`importlib.machinery` -- Importers and path hooks" msgstr "" -#: ../../library/importlib.rst:790 +#: ../../library/importlib.rst:806 msgid "**Source code:** :source:`Lib/importlib/machinery.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/machinery.py`" -#: ../../library/importlib.rst:794 +#: ../../library/importlib.rst:810 msgid "" "This module contains the various objects that help :keyword:`import` find " "and load modules." msgstr "" -#: ../../library/importlib.rst:799 +#: ../../library/importlib.rst:815 msgid "" "A list of strings representing the recognized file suffixes for source " "modules." msgstr "" -#: ../../library/importlib.rst:806 +#: ../../library/importlib.rst:822 msgid "" "A list of strings representing the file suffixes for non-optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:811 ../../library/importlib.rst:821 +#: ../../library/importlib.rst:827 ../../library/importlib.rst:837 msgid "Use :const:`BYTECODE_SUFFIXES` instead." msgstr "" -#: ../../library/importlib.rst:816 +#: ../../library/importlib.rst:832 msgid "" "A list of strings representing the file suffixes for optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:826 +#: ../../library/importlib.rst:842 msgid "" "A list of strings representing the recognized file suffixes for bytecode " "modules (including the leading dot)." msgstr "" -#: ../../library/importlib.rst:831 +#: ../../library/importlib.rst:847 msgid "The value is no longer dependent on ``__debug__``." msgstr "" -#: ../../library/importlib.rst:836 +#: ../../library/importlib.rst:852 msgid "" "A list of strings representing the recognized file suffixes for extension " "modules." msgstr "" -#: ../../library/importlib.rst:843 +#: ../../library/importlib.rst:859 msgid "" "Returns a combined list of strings representing all file suffixes for " "modules recognized by the standard import machinery. This is a helper for " "code which simply needs to know if a filesystem path potentially refers to a " -"module without needing any details on the kind of module (for example, :func:" -"`inspect.getmodulename`)." +"module without needing any details on the kind of module (for " +"example, :func:`inspect.getmodulename`)." msgstr "" -#: ../../library/importlib.rst:854 +#: ../../library/importlib.rst:870 msgid "" "An :term:`importer` for built-in modules. All known built-in modules are " -"listed in :data:`sys.builtin_module_names`. This class implements the :class:" -"`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." +"listed in :data:`sys.builtin_module_names`. This class implements " +"the :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:859 ../../library/importlib.rst:873 -#: ../../library/importlib.rst:886 ../../library/importlib.rst:901 +#: ../../library/importlib.rst:875 ../../library/importlib.rst:889 +#: ../../library/importlib.rst:902 ../../library/importlib.rst:917 msgid "" "Only class methods are defined by this class to alleviate the need for " "instantiation." msgstr "" -#: ../../library/importlib.rst:862 +#: ../../library/importlib.rst:878 msgid "" -"As part of :pep:`489`, the builtin importer now implements :meth:`Loader." -"create_module` and :meth:`Loader.exec_module`" +"As part of :pep:`489`, the builtin importer now " +"implements :meth:`Loader.create_module` and :meth:`Loader.exec_module`" msgstr "" -#: ../../library/importlib.rst:869 +#: ../../library/importlib.rst:885 msgid "" -"An :term:`importer` for frozen modules. This class implements the :class:" -"`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." +"An :term:`importer` for frozen modules. This class implements " +"the :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:876 +#: ../../library/importlib.rst:892 msgid "" "Gained :meth:`~Loader.create_module` and :meth:`~Loader.exec_module` methods." msgstr "" -#: ../../library/importlib.rst:883 +#: ../../library/importlib.rst:899 msgid "" ":term:`Finder ` for modules declared in the Windows registry. This " "class implements the :class:`importlib.abc.MetaPathFinder` ABC." msgstr "" -#: ../../library/importlib.rst:891 +#: ../../library/importlib.rst:907 msgid "" "Use :mod:`site` configuration instead. Future versions of Python may not " "enable this finder by default." msgstr "" -#: ../../library/importlib.rst:898 +#: ../../library/importlib.rst:914 msgid "" "A :term:`Finder ` for :data:`sys.path` and package ``__path__`` " "attributes. This class implements the :class:`importlib.abc.MetaPathFinder` " "ABC." msgstr "" -#: ../../library/importlib.rst:906 +#: ../../library/importlib.rst:922 msgid "" "Class method that attempts to find a :term:`spec ` for the " "module specified by *fullname* on :data:`sys.path` or, if defined, on " -"*path*. For each path entry that is searched, :data:`sys." -"path_importer_cache` is checked. If a non-false object is found then it is " -"used as the :term:`path entry finder` to look for the module being searched " -"for. If no entry is found in :data:`sys.path_importer_cache`, then :data:" -"`sys.path_hooks` is searched for a finder for the path entry and, if found, " -"is stored in :data:`sys.path_importer_cache` along with being queried about " -"the module. If no finder is ever found then ``None`` is both stored in the " -"cache and returned." +"*path*. For each path entry that is " +"searched, :data:`sys.path_importer_cache` is checked. If a non-false object " +"is found then it is used as the :term:`path entry finder` to look for the " +"module being searched for. If no entry is found " +"in :data:`sys.path_importer_cache`, then :data:`sys.path_hooks` is searched " +"for a finder for the path entry and, if found, is stored " +"in :data:`sys.path_importer_cache` along with being queried about the " +"module. If no finder is ever found then ``None`` is both stored in the cache " +"and returned." msgstr "" -#: ../../library/importlib.rst:920 +#: ../../library/importlib.rst:936 msgid "" "If the current working directory -- represented by an empty string -- is no " -"longer valid then ``None`` is returned but no value is cached in :data:`sys." -"path_importer_cache`." +"longer valid then ``None`` is returned but no value is cached " +"in :data:`sys.path_importer_cache`." msgstr "" -#: ../../library/importlib.rst:927 +#: ../../library/importlib.rst:943 msgid "" "Calls :meth:`importlib.abc.PathEntryFinder.invalidate_caches` on all finders " "stored in :data:`sys.path_importer_cache` that define the method. Otherwise " "entries in :data:`sys.path_importer_cache` set to ``None`` are deleted." msgstr "" -#: ../../library/importlib.rst:932 +#: ../../library/importlib.rst:948 msgid "Entries of ``None`` in :data:`sys.path_importer_cache` are deleted." msgstr "" -#: ../../library/importlib.rst:935 +#: ../../library/importlib.rst:951 msgid "" "Calls objects in :data:`sys.path_hooks` with the current working directory " "for ``''`` (i.e. the empty string)." msgstr "" -#: ../../library/importlib.rst:942 +#: ../../library/importlib.rst:958 msgid "" "A concrete implementation of :class:`importlib.abc.PathEntryFinder` which " "caches results from the file system." msgstr "" -#: ../../library/importlib.rst:945 +#: ../../library/importlib.rst:961 msgid "" "The *path* argument is the directory for which the finder is in charge of " "searching." msgstr "" -#: ../../library/importlib.rst:948 +#: ../../library/importlib.rst:964 msgid "" "The *loader_details* argument is a variable number of 2-item tuples each " "containing a loader and a sequence of file suffixes the loader recognizes. " @@ -1195,7 +1204,7 @@ msgid "" "module's name and the path to the file found." msgstr "" -#: ../../library/importlib.rst:953 +#: ../../library/importlib.rst:969 msgid "" "The finder will cache the directory contents as necessary, making stat calls " "for each module search to verify the cache is not outdated. Because cache " @@ -1208,166 +1217,166 @@ msgid "" "to call :func:`importlib.invalidate_caches`." msgstr "" -#: ../../library/importlib.rst:967 +#: ../../library/importlib.rst:983 msgid "The path the finder will search in." msgstr "" -#: ../../library/importlib.rst:971 +#: ../../library/importlib.rst:987 msgid "Attempt to find the spec to handle *fullname* within :attr:`path`." msgstr "" -#: ../../library/importlib.rst:977 +#: ../../library/importlib.rst:993 msgid "Clear out the internal cache." msgstr "" -#: ../../library/importlib.rst:981 +#: ../../library/importlib.rst:997 msgid "" "A class method which returns a closure for use on :data:`sys.path_hooks`. An " "instance of :class:`FileFinder` is returned by the closure using the path " "argument given to the closure directly and *loader_details* indirectly." msgstr "" -#: ../../library/importlib.rst:986 +#: ../../library/importlib.rst:1002 msgid "" -"If the argument to the closure is not an existing directory, :exc:" -"`ImportError` is raised." +"If the argument to the closure is not an existing " +"directory, :exc:`ImportError` is raised." msgstr "" -#: ../../library/importlib.rst:992 +#: ../../library/importlib.rst:1008 msgid "" "A concrete implementation of :class:`importlib.abc.SourceLoader` by " "subclassing :class:`importlib.abc.FileLoader` and providing some concrete " "implementations of other methods." msgstr "" -#: ../../library/importlib.rst:1000 +#: ../../library/importlib.rst:1016 msgid "The name of the module that this loader will handle." msgstr "" -#: ../../library/importlib.rst:1004 +#: ../../library/importlib.rst:1020 msgid "The path to the source file." msgstr "" -#: ../../library/importlib.rst:1008 +#: ../../library/importlib.rst:1024 msgid "Return ``True`` if :attr:`path` appears to be for a package." msgstr "" -#: ../../library/importlib.rst:1012 +#: ../../library/importlib.rst:1028 msgid "" "Concrete implementation of :meth:`importlib.abc.SourceLoader.path_stats`." msgstr "" -#: ../../library/importlib.rst:1016 +#: ../../library/importlib.rst:1032 msgid "Concrete implementation of :meth:`importlib.abc.SourceLoader.set_data`." msgstr "" -#: ../../library/importlib.rst:1020 ../../library/importlib.rst:1063 +#: ../../library/importlib.rst:1036 ../../library/importlib.rst:1079 msgid "" "Concrete implementation of :meth:`importlib.abc.Loader.load_module` where " "specifying the name of the module to load is optional." msgstr "" -#: ../../library/importlib.rst:1025 ../../library/importlib.rst:1068 +#: ../../library/importlib.rst:1041 ../../library/importlib.rst:1084 msgid "Use :meth:`importlib.abc.Loader.exec_module` instead." msgstr "" -#: ../../library/importlib.rst:1030 +#: ../../library/importlib.rst:1046 msgid "" "A concrete implementation of :class:`importlib.abc.FileLoader` which can " "import bytecode files (i.e. no source code files exist)." msgstr "" -#: ../../library/importlib.rst:1033 +#: ../../library/importlib.rst:1049 msgid "" "Please note that direct use of bytecode files (and thus not source code " "files) inhibits your modules from being usable by all Python implementations " "or new versions of Python which change the bytecode format." msgstr "" -#: ../../library/importlib.rst:1042 +#: ../../library/importlib.rst:1058 msgid "The name of the module the loader will handle." msgstr "" -#: ../../library/importlib.rst:1046 +#: ../../library/importlib.rst:1062 msgid "The path to the bytecode file." msgstr "" -#: ../../library/importlib.rst:1050 +#: ../../library/importlib.rst:1066 msgid "Determines if the module is a package based on :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1054 +#: ../../library/importlib.rst:1070 msgid "Returns the code object for :attr:`name` created from :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1058 +#: ../../library/importlib.rst:1074 msgid "" "Returns ``None`` as bytecode files have no source when this loader is used." msgstr "" -#: ../../library/importlib.rst:1073 +#: ../../library/importlib.rst:1089 msgid "" "A concrete implementation of :class:`importlib.abc.ExecutionLoader` for " "extension modules." msgstr "" -#: ../../library/importlib.rst:1076 +#: ../../library/importlib.rst:1092 msgid "" "The *fullname* argument specifies the name of the module the loader is to " "support. The *path* argument is the path to the extension module's file." msgstr "" -#: ../../library/importlib.rst:1079 +#: ../../library/importlib.rst:1095 msgid "" "Note that, by default, importing an extension module will fail in " "subinterpreters if it doesn't implement multi-phase init (see :pep:`489`), " "even if it would otherwise import successfully." msgstr "" -#: ../../library/importlib.rst:1085 +#: ../../library/importlib.rst:1101 msgid "Multi-phase init is now required for use in subinterpreters." msgstr "" -#: ../../library/importlib.rst:1090 ../../library/importlib.rst:1276 +#: ../../library/importlib.rst:1106 ../../library/importlib.rst:1292 msgid "Name of the module the loader supports." msgstr "" -#: ../../library/importlib.rst:1094 +#: ../../library/importlib.rst:1110 msgid "Path to the extension module." msgstr "" -#: ../../library/importlib.rst:1098 +#: ../../library/importlib.rst:1114 msgid "" -"Creates the module object from the given specification in accordance with :" -"pep:`489`." +"Creates the module object from the given specification in accordance " +"with :pep:`489`." msgstr "" -#: ../../library/importlib.rst:1105 +#: ../../library/importlib.rst:1121 msgid "Initializes the given module object in accordance with :pep:`489`." msgstr "" -#: ../../library/importlib.rst:1111 +#: ../../library/importlib.rst:1127 msgid "" "Returns ``True`` if the file path points to a package's ``__init__`` module " "based on :const:`EXTENSION_SUFFIXES`." msgstr "" -#: ../../library/importlib.rst:1116 +#: ../../library/importlib.rst:1132 msgid "Returns ``None`` as extension modules lack a code object." msgstr "" -#: ../../library/importlib.rst:1120 +#: ../../library/importlib.rst:1136 msgid "Returns ``None`` as extension modules do not have source code." msgstr "" -#: ../../library/importlib.rst:1131 +#: ../../library/importlib.rst:1147 msgid "" "A concrete implementation of :class:`importlib.abc.InspectLoader` for " "namespace packages. This is an alias for a private class and is only made " "public for introspecting the ``__loader__`` attribute on namespace packages::" msgstr "" -#: ../../library/importlib.rst:1136 +#: ../../library/importlib.rst:1152 msgid "" ">>> from importlib.machinery import NamespaceLoader\n" ">>> import my_namespace\n" @@ -1385,7 +1394,7 @@ msgstr "" ">>> isinstance(my_namespace.__loader__, importlib.abc.Loader)\n" "True" -#: ../../library/importlib.rst:1149 +#: ../../library/importlib.rst:1165 msgid "" "A specification for a module's import-system-related state. This is " "typically exposed as the module's :attr:`~module.__spec__` attribute. Many " @@ -1394,39 +1403,40 @@ msgid "" "the *values* are usually equivalent, they can differ since there is no " "synchronization between the two objects. For example, it is possible to " "update the module's :attr:`~module.__file__` at runtime and this will not be " -"automatically reflected in the module's :attr:`__spec__.origin `, and vice versa." +"automatically reflected in the module's :attr:`__spec__.origin " +"`, and vice versa." msgstr "" -#: ../../library/importlib.rst:1163 +#: ../../library/importlib.rst:1179 msgid "" -"The module's fully qualified name (see :attr:`module.__name__`). The :term:" -"`finder` should always set this attribute to a non-empty string." +"The module's fully qualified name (see :attr:`module.__name__`). " +"The :term:`finder` should always set this attribute to a non-empty string." msgstr "" -#: ../../library/importlib.rst:1168 +#: ../../library/importlib.rst:1184 msgid "" "The :term:`loader` used to load the module (see :attr:`module.__loader__`). " "The :term:`finder` should always set this attribute." msgstr "" -#: ../../library/importlib.rst:1173 +#: ../../library/importlib.rst:1189 msgid "" -"The location the :term:`loader` should use to load the module (see :attr:" -"`module.__file__`). For example, for modules loaded from a ``.py`` file this " -"is the filename. The :term:`finder` should always set this attribute to a " -"meaningful value for the :term:`loader` to use. In the uncommon case that " -"there is not one (like for namespace packages), it should be set to ``None``." +"The location the :term:`loader` should use to load the module " +"(see :attr:`module.__file__`). For example, for modules loaded from a " +"``.py`` file this is the filename. The :term:`finder` should always set this " +"attribute to a meaningful value for the :term:`loader` to use. In the " +"uncommon case that there is not one (like for namespace packages), it should " +"be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1182 +#: ../../library/importlib.rst:1198 msgid "" "A (possibly empty) :term:`sequence` of strings enumerating the locations in " "which a package's submodules will be found (see :attr:`module.__path__`). " "Most of the time there will only be a single directory in this list." msgstr "" -#: ../../library/importlib.rst:1187 +#: ../../library/importlib.rst:1203 msgid "" "The :term:`finder` should set this attribute to a sequence, even an empty " "one, to indicate to the import system that the module is a package. It " @@ -1434,41 +1444,42 @@ msgid "" "later to a special object for namespace packages." msgstr "" -#: ../../library/importlib.rst:1195 +#: ../../library/importlib.rst:1211 msgid "" "The :term:`finder` may set this attribute to an object containing " "additional, module-specific data to use when loading the module. Otherwise " "it should be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1201 +#: ../../library/importlib.rst:1217 msgid "" -"The filename of a compiled version of the module's code (see :attr:`module." -"__cached__`). The :term:`finder` should always set this attribute but it may " -"be ``None`` for modules that do not need compiled code stored." +"The filename of a compiled version of the module's code " +"(see :attr:`module.__cached__`). The :term:`finder` should always set this " +"attribute but it may be ``None`` for modules that do not need compiled code " +"stored." msgstr "" -#: ../../library/importlib.rst:1208 +#: ../../library/importlib.rst:1224 msgid "" "(Read-only) The fully qualified name of the package the module is in (or the " "empty string for a top-level module). See :attr:`module.__package__`. If the " "module is a package then this is the same as :attr:`name`." msgstr "" -#: ../../library/importlib.rst:1215 +#: ../../library/importlib.rst:1231 msgid "" "``True`` if the spec's :attr:`origin` refers to a loadable location, " "``False`` otherwise. This value impacts how :attr:`!origin` is interpreted " "and how the module's :attr:`~module.__file__` is populated." msgstr "" -#: ../../library/importlib.rst:1222 +#: ../../library/importlib.rst:1238 msgid "" "A specialization of :class:`importlib.machinery.ExtensionFileLoader` that is " "able to load extension modules in Framework format." msgstr "" -#: ../../library/importlib.rst:1225 +#: ../../library/importlib.rst:1241 msgid "" "For compatibility with the iOS App Store, *all* binary modules in an iOS app " "must be dynamic libraries, contained in a framework with appropriate " @@ -1477,37 +1488,37 @@ msgid "" "material outside the Frameworks folder." msgstr "" -#: ../../library/importlib.rst:1231 +#: ../../library/importlib.rst:1247 msgid "" "To accommodate this requirement, when running on iOS, extension module " "binaries are *not* packaged as ``.so`` files on ``sys.path``, but as " "individual standalone frameworks. To discover those frameworks, this loader " "is be registered against the ``.fwork`` file extension, with a ``.fwork`` " -"file acting as a placeholder in the original location of the binary on ``sys." -"path``. The ``.fwork`` file contains the path of the actual binary in the " -"``Frameworks`` folder, relative to the app bundle. To allow for resolving a " -"framework-packaged binary back to the original location, the framework is " -"expected to contain a ``.origin`` file that contains the location of the ``." -"fwork`` file, relative to the app bundle." +"file acting as a placeholder in the original location of the binary on " +"``sys.path``. The ``.fwork`` file contains the path of the actual binary in " +"the ``Frameworks`` folder, relative to the app bundle. To allow for " +"resolving a framework-packaged binary back to the original location, the " +"framework is expected to contain a ``.origin`` file that contains the " +"location of the ``.fwork`` file, relative to the app bundle." msgstr "" -#: ../../library/importlib.rst:1242 +#: ../../library/importlib.rst:1258 msgid "" "For example, consider the case of an import ``from foo.bar import _whiz``, " "where ``_whiz`` is implemented with the binary module ``sources/foo/bar/" -"_whiz.abi3.so``, with ``sources`` being the location registered on ``sys." -"path``, relative to the application bundle. This module *must* be " +"_whiz.abi3.so``, with ``sources`` being the location registered on " +"``sys.path``, relative to the application bundle. This module *must* be " "distributed as ``Frameworks/foo.bar._whiz.framework/foo.bar._whiz`` " "(creating the framework name from the full import path of the module), with " "an ``Info.plist`` file in the ``.framework`` directory identifying the " "binary as a framework. The ``foo.bar._whiz`` module would be represented in " "the original location with a ``sources/foo/bar/_whiz.abi3.fwork`` marker " "file, containing the path ``Frameworks/foo.bar._whiz/foo.bar._whiz``. The " -"framework would also contain ``Frameworks/foo.bar._whiz.framework/foo.bar." -"_whiz.origin``, containing the path to the ``.fwork`` file." +"framework would also contain ``Frameworks/foo.bar._whiz.framework/" +"foo.bar._whiz.origin``, containing the path to the ``.fwork`` file." msgstr "" -#: ../../library/importlib.rst:1256 +#: ../../library/importlib.rst:1272 msgid "" "When a module is loaded with this loader, the ``__file__`` for the module " "will report as the location of the ``.fwork`` file. This allows code to use " @@ -1516,7 +1527,7 @@ msgid "" "in the ``.framework`` folder." msgstr "" -#: ../../library/importlib.rst:1262 +#: ../../library/importlib.rst:1278 msgid "" "The Xcode project building the app is responsible for converting any ``.so`` " "files from wherever they exist in the ``PYTHONPATH`` into frameworks in the " @@ -1527,45 +1538,45 @@ msgid "" "details on how to construct this build step." msgstr "" -#: ../../library/importlib.rst:1272 +#: ../../library/importlib.rst:1288 msgid "Availability" msgstr "" -#: ../../library/importlib.rst:1280 +#: ../../library/importlib.rst:1296 msgid "Path to the ``.fwork`` file for the extension module." msgstr "" -#: ../../library/importlib.rst:1284 +#: ../../library/importlib.rst:1300 msgid ":mod:`importlib.util` -- Utility code for importers" msgstr "" -#: ../../library/importlib.rst:1290 +#: ../../library/importlib.rst:1306 msgid "**Source code:** :source:`Lib/importlib/util.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/util.py`" -#: ../../library/importlib.rst:1294 +#: ../../library/importlib.rst:1310 msgid "" "This module contains the various objects that help in the construction of " "an :term:`importer`." msgstr "" -#: ../../library/importlib.rst:1299 +#: ../../library/importlib.rst:1315 msgid "" "The bytes which represent the bytecode version number. If you need help with " "loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`." msgstr "" -#: ../../library/importlib.rst:1306 +#: ../../library/importlib.rst:1322 msgid "" "Return the :pep:`3147`/:pep:`488` path to the byte-compiled file associated " "with the source *path*. For example, if *path* is ``/foo/bar/baz.py`` the " "return value would be ``/foo/bar/__pycache__/baz.cpython-32.pyc`` for Python " -"3.2. The ``cpython-32`` string comes from the current magic tag (see :func:" -"`get_tag`; if :attr:`sys.implementation.cache_tag` is not defined then :exc:" -"`NotImplementedError` will be raised)." +"3.2. The ``cpython-32`` string comes from the current magic tag " +"(see :func:`get_tag`; if :attr:`sys.implementation.cache_tag` is not defined " +"then :exc:`NotImplementedError` will be raised)." msgstr "" -#: ../../library/importlib.rst:1313 +#: ../../library/importlib.rst:1329 msgid "" "The *optimization* parameter is used to specify the optimization level of " "the bytecode file. An empty string represents no optimization, so ``/foo/bar/" @@ -1573,12 +1584,12 @@ msgid "" "``/foo/bar/__pycache__/baz.cpython-32.pyc``. ``None`` causes the " "interpreter's optimization level to be used. Any other value's string " "representation is used, so ``/foo/bar/baz.py`` with an *optimization* of " -"``2`` will lead to the bytecode path of ``/foo/bar/__pycache__/baz." -"cpython-32.opt-2.pyc``. The string representation of *optimization* can only " -"be alphanumeric, else :exc:`ValueError` is raised." +"``2`` will lead to the bytecode path of ``/foo/bar/__pycache__/" +"baz.cpython-32.opt-2.pyc``. The string representation of *optimization* can " +"only be alphanumeric, else :exc:`ValueError` is raised." msgstr "" -#: ../../library/importlib.rst:1323 +#: ../../library/importlib.rst:1339 msgid "" "The *debug_override* parameter is deprecated and can be used to override the " "system's value for ``__debug__``. A ``True`` value is the equivalent of " @@ -1587,60 +1598,63 @@ msgid "" "are not ``None`` then :exc:`TypeError` is raised." msgstr "" -#: ../../library/importlib.rst:1331 +#: ../../library/importlib.rst:1347 msgid "" "The *optimization* parameter was added and the *debug_override* parameter " "was deprecated." msgstr "" -#: ../../library/importlib.rst:1335 ../../library/importlib.rst:1351 -#: ../../library/importlib.rst:1440 +#: ../../library/importlib.rst:1351 ../../library/importlib.rst:1367 +#: ../../library/importlib.rst:1456 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/importlib.rst:1341 +#: ../../library/importlib.rst:1357 msgid "" "Given the *path* to a :pep:`3147` file name, return the associated source " -"code file path. For example, if *path* is ``/foo/bar/__pycache__/baz." -"cpython-32.pyc`` the returned path would be ``/foo/bar/baz.py``. *path* " +"code file path. For example, if *path* is ``/foo/bar/__pycache__/" +"baz.cpython-32.pyc`` the returned path would be ``/foo/bar/baz.py``. *path* " "need not exist, however if it does not conform to :pep:`3147` or :pep:`488` " -"format, a :exc:`ValueError` is raised. If :attr:`sys.implementation." -"cache_tag` is not defined, :exc:`NotImplementedError` is raised." +"format, a :exc:`ValueError` is raised. " +"If :attr:`sys.implementation.cache_tag` is not " +"defined, :exc:`NotImplementedError` is raised." msgstr "" -#: ../../library/importlib.rst:1356 +#: ../../library/importlib.rst:1372 msgid "" "Decode the given bytes representing source code and return it as a string " -"with universal newlines (as required by :meth:`importlib.abc.InspectLoader." -"get_source`)." +"with universal newlines (as required " +"by :meth:`importlib.abc.InspectLoader.get_source`)." msgstr "" -#: ../../library/importlib.rst:1364 +#: ../../library/importlib.rst:1380 msgid "Resolve a relative module name to an absolute one." msgstr "" -#: ../../library/importlib.rst:1366 +#: ../../library/importlib.rst:1382 msgid "" "If **name** has no leading dots, then **name** is simply returned. This " -"allows for usage such as ``importlib.util.resolve_name('sys', __spec__." -"parent)`` without doing a check to see if the **package** argument is needed." +"allows for usage such as ``importlib.util.resolve_name('sys', " +"__spec__.parent)`` without doing a check to see if the **package** argument " +"is needed." msgstr "" -#: ../../library/importlib.rst:1371 +#: ../../library/importlib.rst:1387 msgid "" ":exc:`ImportError` is raised if **name** is a relative module name but " -"**package** is a false value (e.g. ``None`` or the empty string). :exc:" -"`ImportError` is also raised if a relative name would escape its containing " -"package (e.g. requesting ``..bacon`` from within the ``spam`` package)." +"**package** is a false value (e.g. ``None`` or the empty " +"string). :exc:`ImportError` is also raised if a relative name would escape " +"its containing package (e.g. requesting ``..bacon`` from within the ``spam`` " +"package)." msgstr "" -#: ../../library/importlib.rst:1379 +#: ../../library/importlib.rst:1395 msgid "" "To improve consistency with import statements, raise :exc:`ImportError` " "instead of :exc:`ValueError` for invalid relative import attempts." msgstr "" -#: ../../library/importlib.rst:1386 +#: ../../library/importlib.rst:1402 msgid "" "Find the :term:`spec ` for a module, optionally relative to the " "specified **package** name. If the module is in :data:`sys.modules`, then " @@ -1650,30 +1664,30 @@ msgid "" "if no spec is found." msgstr "" -#: ../../library/importlib.rst:1393 +#: ../../library/importlib.rst:1409 msgid "" "If **name** is for a submodule (contains a dot), the parent module is " "automatically imported." msgstr "" -#: ../../library/importlib.rst:1396 +#: ../../library/importlib.rst:1412 msgid "**name** and **package** work the same as for :func:`import_module`." msgstr "" -#: ../../library/importlib.rst:1400 +#: ../../library/importlib.rst:1416 msgid "" "Raises :exc:`ModuleNotFoundError` instead of :exc:`AttributeError` if " "**package** is in fact not a package (i.e. lacks a :attr:`~module.__path__` " "attribute)." msgstr "" -#: ../../library/importlib.rst:1407 +#: ../../library/importlib.rst:1423 msgid "" "Create a new module based on **spec** and :meth:`spec.loader.create_module " "`." msgstr "" -#: ../../library/importlib.rst:1410 +#: ../../library/importlib.rst:1426 msgid "" "If :meth:`spec.loader.create_module ` " "does not return ``None``, then any pre-existing attributes will not be " @@ -1681,23 +1695,23 @@ msgid "" "accessing **spec** or setting an attribute on the module." msgstr "" -#: ../../library/importlib.rst:1415 +#: ../../library/importlib.rst:1431 msgid "" "This function is preferred over using :class:`types.ModuleType` to create a " "new module as **spec** is used to set as many import-controlled attributes " "on the module as possible." msgstr "" -#: ../../library/importlib.rst:1423 +#: ../../library/importlib.rst:1439 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on a loader. The parameters have the same meaning as they do " -"for ModuleSpec. The function uses available :term:`loader` APIs, such as :" -"meth:`InspectLoader.is_package`, to fill in any missing information on the " -"spec." +"for ModuleSpec. The function uses available :term:`loader` APIs, such " +"as :meth:`InspectLoader.is_package`, to fill in any missing information on " +"the spec." msgstr "" -#: ../../library/importlib.rst:1433 +#: ../../library/importlib.rst:1449 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on the path to a file. Missing information will be filled in " @@ -1705,14 +1719,14 @@ msgid "" "module will be file-based." msgstr "" -#: ../../library/importlib.rst:1445 +#: ../../library/importlib.rst:1461 msgid "" "Return the hash of *source_bytes* as bytes. A hash-based ``.pyc`` file " "embeds the :func:`source_hash` of the corresponding source file's contents " "in its header." msgstr "" -#: ../../library/importlib.rst:1453 +#: ../../library/importlib.rst:1469 msgid "" "A context manager that can temporarily skip the compatibility check for " "extension modules. By default the check is enabled and will fail when a " @@ -1721,46 +1735,49 @@ msgid "" "interpreter GIL, when imported in an interpreter with its own GIL." msgstr "" -#: ../../library/importlib.rst:1460 +#: ../../library/importlib.rst:1476 msgid "" "Note that this function is meant to accommodate an unusual case; one which " "is likely to eventually go away. There's is a pretty good chance this is " "not what you were looking for." msgstr "" -#: ../../library/importlib.rst:1464 +#: ../../library/importlib.rst:1480 msgid "" "You can get the same effect as this function by implementing the basic " "interface of multi-phase init (:pep:`489`) and lying about support for " "multiple interpreters (or per-interpreter GIL)." msgstr "" +"你可以透過實作多階段初始化的基本介面 (:pep:`489`) 並假稱有多個直譯器(或直譯" +"器各別持有的 GIL)的支援,來達到與此函式相同的效果。" -#: ../../library/importlib.rst:1469 +#: ../../library/importlib.rst:1485 msgid "" "Using this function to disable the check can lead to unexpected behavior and " "even crashes. It should only be used during extension module development." msgstr "" -#: ../../library/importlib.rst:1477 +#: ../../library/importlib.rst:1493 msgid "" "A class which postpones the execution of the loader of a module until the " "module has an attribute accessed." msgstr "" -#: ../../library/importlib.rst:1480 +#: ../../library/importlib.rst:1496 msgid "" -"This class **only** works with loaders that define :meth:`~importlib.abc." -"Loader.exec_module` as control over what module type is used for the module " -"is required. For those same reasons, the loader's :meth:`~importlib.abc." -"Loader.create_module` method must return ``None`` or a type for which its " -"``__class__`` attribute can be mutated along with not using :term:`slots " -"<__slots__>`. Finally, modules which substitute the object placed into :data:" -"`sys.modules` will not work as there is no way to properly replace the " -"module references throughout the interpreter safely; :exc:`ValueError` is " -"raised if such a substitution is detected." +"This class **only** works with loaders that " +"define :meth:`~importlib.abc.Loader.exec_module` as control over what module " +"type is used for the module is required. For those same reasons, the " +"loader's :meth:`~importlib.abc.Loader.create_module` method must return " +"``None`` or a type for which its ``__class__`` attribute can be mutated " +"along with not using :term:`slots <__slots__>`. Finally, modules which " +"substitute the object placed into :data:`sys.modules` will not work as there " +"is no way to properly replace the module references throughout the " +"interpreter safely; :exc:`ValueError` is raised if such a substitution is " +"detected." msgstr "" -#: ../../library/importlib.rst:1491 +#: ../../library/importlib.rst:1507 msgid "" "For projects where startup time is critical, this class allows for " "potentially minimizing the cost of loading a module if it is never used. For " @@ -1769,21 +1786,21 @@ msgid "" "postponed and thus occurring out of context." msgstr "" -#: ../../library/importlib.rst:1499 +#: ../../library/importlib.rst:1515 msgid "" "Began calling :meth:`~importlib.abc.Loader.create_module`, removing the " -"compatibility warning for :class:`importlib.machinery.BuiltinImporter` and :" -"class:`importlib.machinery.ExtensionFileLoader`." +"compatibility warning for :class:`importlib.machinery.BuiltinImporter` " +"and :class:`importlib.machinery.ExtensionFileLoader`." msgstr "" -#: ../../library/importlib.rst:1506 +#: ../../library/importlib.rst:1522 msgid "" "A class method which returns a callable that creates a lazy loader. This is " "meant to be used in situations where the loader is passed by class instead " "of by instance. ::" msgstr "" -#: ../../library/importlib.rst:1511 +#: ../../library/importlib.rst:1527 msgid "" "suffixes = importlib.machinery.SOURCE_SUFFIXES\n" "loader = importlib.machinery.SourceFileLoader\n" @@ -1795,20 +1812,20 @@ msgstr "" "lazy_loader = importlib.util.LazyLoader.factory(loader)\n" "finder = importlib.machinery.FileFinder(path, (lazy_loader, suffixes))" -#: ../../library/importlib.rst:1519 +#: ../../library/importlib.rst:1535 msgid "Examples" msgstr "範例" -#: ../../library/importlib.rst:1522 +#: ../../library/importlib.rst:1538 msgid "Importing programmatically" msgstr "" -#: ../../library/importlib.rst:1524 +#: ../../library/importlib.rst:1540 msgid "" "To programmatically import a module, use :func:`importlib.import_module`. ::" msgstr "" -#: ../../library/importlib.rst:1527 +#: ../../library/importlib.rst:1543 msgid "" "import importlib\n" "\n" @@ -1818,23 +1835,23 @@ msgstr "" "\n" "itertools = importlib.import_module('itertools')" -#: ../../library/importlib.rst:1533 +#: ../../library/importlib.rst:1549 msgid "Checking if a module can be imported" msgstr "" -#: ../../library/importlib.rst:1535 +#: ../../library/importlib.rst:1551 msgid "" "If you need to find out if a module can be imported without actually doing " "the import, then you should use :func:`importlib.util.find_spec`." msgstr "" -#: ../../library/importlib.rst:1538 +#: ../../library/importlib.rst:1554 msgid "" -"Note that if ``name`` is a submodule (contains a dot), :func:`importlib.util." -"find_spec` will import the parent module. ::" +"Note that if ``name`` is a submodule (contains a " +"dot), :func:`importlib.util.find_spec` will import the parent module. ::" msgstr "" -#: ../../library/importlib.rst:1542 +#: ../../library/importlib.rst:1558 msgid "" "import importlib.util\n" "import sys\n" @@ -1854,27 +1871,27 @@ msgid "" " print(f\"can't find the {name!r} module\")" msgstr "" -#: ../../library/importlib.rst:1561 +#: ../../library/importlib.rst:1577 msgid "Importing a source file directly" msgstr "" -#: ../../library/importlib.rst:1563 +#: ../../library/importlib.rst:1579 msgid "" "This recipe should be used with caution: it is an approximation of an import " -"statement where the file path is specified directly, rather than :data:`sys." -"path` being searched. Alternatives should first be considered first, such as " -"modifying :data:`sys.path` when a proper module is required, or using :func:" -"`runpy.run_path` when the global namespace resulting from running a Python " -"file is appropriate." +"statement where the file path is specified directly, rather " +"than :data:`sys.path` being searched. Alternatives should first be " +"considered first, such as modifying :data:`sys.path` when a proper module is " +"required, or using :func:`runpy.run_path` when the global namespace " +"resulting from running a Python file is appropriate." msgstr "" -#: ../../library/importlib.rst:1570 +#: ../../library/importlib.rst:1586 msgid "" "To import a Python source file directly from a path, use the following " "recipe::" msgstr "" -#: ../../library/importlib.rst:1572 +#: ../../library/importlib.rst:1588 msgid "" "import importlib.util\n" "import sys\n" @@ -1897,15 +1914,15 @@ msgid "" "json = import_from_path(module_name, file_path)" msgstr "" -#: ../../library/importlib.rst:1594 +#: ../../library/importlib.rst:1610 msgid "Implementing lazy imports" msgstr "" -#: ../../library/importlib.rst:1596 +#: ../../library/importlib.rst:1612 msgid "The example below shows how to implement lazy imports::" msgstr "" -#: ../../library/importlib.rst:1598 +#: ../../library/importlib.rst:1614 msgid "" ">>> import importlib.util\n" ">>> import sys\n" @@ -1925,25 +1942,26 @@ msgid "" "False" msgstr "" -#: ../../library/importlib.rst:1617 +#: ../../library/importlib.rst:1633 msgid "Setting up an importer" msgstr "" -#: ../../library/importlib.rst:1619 +#: ../../library/importlib.rst:1635 msgid "" -"For deep customizations of import, you typically want to implement an :term:" -"`importer`. This means managing both the :term:`finder` and :term:`loader` " -"side of things. For finders there are two flavours to choose from depending " -"on your needs: a :term:`meta path finder` or a :term:`path entry finder`. " -"The former is what you would put on :data:`sys.meta_path` while the latter " -"is what you create using a :term:`path entry hook` on :data:`sys.path_hooks` " -"which works with :data:`sys.path` entries to potentially create a finder. " -"This example will show you how to register your own importers so that import " -"will use them (for creating an importer for yourself, read the documentation " -"for the appropriate classes defined within this package)::" +"For deep customizations of import, you typically want to implement " +"an :term:`importer`. This means managing both the :term:`finder` " +"and :term:`loader` side of things. For finders there are two flavours to " +"choose from depending on your needs: a :term:`meta path finder` or " +"a :term:`path entry finder`. The former is what you would put " +"on :data:`sys.meta_path` while the latter is what you create using " +"a :term:`path entry hook` on :data:`sys.path_hooks` which works " +"with :data:`sys.path` entries to potentially create a finder. This example " +"will show you how to register your own importers so that import will use " +"them (for creating an importer for yourself, read the documentation for the " +"appropriate classes defined within this package)::" msgstr "" -#: ../../library/importlib.rst:1630 +#: ../../library/importlib.rst:1646 msgid "" "import importlib.machinery\n" "import sys\n" @@ -1967,11 +1985,11 @@ msgid "" "sys.path_hooks.append(SpamPathEntryFinder.path_hook(loader_details))" msgstr "" -#: ../../library/importlib.rst:1651 +#: ../../library/importlib.rst:1667 msgid "Approximating :func:`importlib.import_module`" msgstr "" -#: ../../library/importlib.rst:1653 +#: ../../library/importlib.rst:1669 msgid "" "Import itself is implemented in Python code, making it possible to expose " "most of the import machinery through importlib. The following helps " @@ -1979,7 +1997,7 @@ msgid "" "approximate implementation of :func:`importlib.import_module`::" msgstr "" -#: ../../library/importlib.rst:1659 +#: ../../library/importlib.rst:1675 msgid "" "import importlib.util\n" "import sys\n" @@ -2012,11 +2030,11 @@ msgid "" " return module" msgstr "" -#: ../../library/importlib.rst:424 +#: ../../library/importlib.rst:425 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/importlib.rst:424 +#: ../../library/importlib.rst:425 msgid "importlib.abc.InspectLoader.get_source method" msgstr "importlib.abc.InspectLoader.get_source 方法" diff --git a/library/importlib.resources.abc.po b/library/importlib.resources.abc.po index f000c0ec12..0f8fe4133b 100644 --- a/library/importlib.resources.abc.po +++ b/library/importlib.resources.abc.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-22 08:51+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-" @@ -69,33 +69,33 @@ msgstr "" msgid "Use :class:`importlib.resources.abc.TraversableResources` instead." msgstr "" -#: ../../library/importlib.resources.abc.rst:51 +#: ../../library/importlib.resources.abc.rst:52 msgid "" "Returns an opened, :term:`file-like object` for binary reading of the " "*resource*." msgstr "" -#: ../../library/importlib.resources.abc.rst:54 +#: ../../library/importlib.resources.abc.rst:55 msgid "If the resource cannot be found, :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/importlib.resources.abc.rst:59 +#: ../../library/importlib.resources.abc.rst:61 msgid "Returns the file system path to the *resource*." msgstr "" -#: ../../library/importlib.resources.abc.rst:61 +#: ../../library/importlib.resources.abc.rst:63 msgid "" "If the resource does not concretely exist on the file system, raise :exc:" "`FileNotFoundError`." msgstr "" -#: ../../library/importlib.resources.abc.rst:66 +#: ../../library/importlib.resources.abc.rst:69 msgid "" "Returns ``True`` if the named *name* is considered a resource. :exc:" "`FileNotFoundError` is raised if *name* does not exist." msgstr "" -#: ../../library/importlib.resources.abc.rst:71 +#: ../../library/importlib.resources.abc.rst:75 msgid "" "Returns an :term:`iterable` of strings over the contents of the package. Do " "note that it is not required that all names returned by the iterator be " @@ -103,7 +103,7 @@ msgid "" "`is_resource` would be false." msgstr "" -#: ../../library/importlib.resources.abc.rst:77 +#: ../../library/importlib.resources.abc.rst:81 msgid "" "Allowing non-resource names to be returned is to allow for situations where " "how a package and its resources are stored are known a priori and the non-" @@ -112,52 +112,52 @@ msgid "" "stored on the file system then those subdirectory names can be used directly." msgstr "" -#: ../../library/importlib.resources.abc.rst:85 +#: ../../library/importlib.resources.abc.rst:89 msgid "The abstract method returns an iterable of no items." msgstr "" -#: ../../library/importlib.resources.abc.rst:90 +#: ../../library/importlib.resources.abc.rst:94 msgid "" "An object with a subset of :class:`pathlib.Path` methods suitable for " "traversing directories and opening files." msgstr "" -#: ../../library/importlib.resources.abc.rst:93 +#: ../../library/importlib.resources.abc.rst:97 msgid "" "For a representation of the object on the file-system, use :meth:`importlib." "resources.as_file`." msgstr "" -#: ../../library/importlib.resources.abc.rst:98 +#: ../../library/importlib.resources.abc.rst:102 msgid "Abstract. The base name of this object without any parent references." msgstr "" -#: ../../library/importlib.resources.abc.rst:102 +#: ../../library/importlib.resources.abc.rst:107 msgid "Yield Traversable objects in self." msgstr "" -#: ../../library/importlib.resources.abc.rst:106 +#: ../../library/importlib.resources.abc.rst:112 msgid "Return ``True`` if self is a directory." msgstr "" -#: ../../library/importlib.resources.abc.rst:110 +#: ../../library/importlib.resources.abc.rst:117 msgid "Return ``True`` if self is a file." msgstr "" -#: ../../library/importlib.resources.abc.rst:114 +#: ../../library/importlib.resources.abc.rst:122 msgid "" "Traverse directories according to *pathsegments* and return the result as :" "class:`!Traversable`." msgstr "" -#: ../../library/importlib.resources.abc.rst:117 +#: ../../library/importlib.resources.abc.rst:125 msgid "" "Each *pathsegments* argument may contain multiple names separated by forward " "slashes (``/``, ``posixpath.sep`` ). For example, the following are " "equivalent::" msgstr "" -#: ../../library/importlib.resources.abc.rst:121 +#: ../../library/importlib.resources.abc.rst:129 msgid "" "files.joinpath('subdir', 'subsuddir', 'file.txt')\n" "files.joinpath('subdir/subsuddir/file.txt')" @@ -165,7 +165,7 @@ msgstr "" "files.joinpath('subdir', 'subsuddir', 'file.txt')\n" "files.joinpath('subdir/subsuddir/file.txt')" -#: ../../library/importlib.resources.abc.rst:124 +#: ../../library/importlib.resources.abc.rst:132 msgid "" "Note that some :class:`!Traversable` implementations might not be updated to " "the latest version of the protocol. For compatibility with such " @@ -173,42 +173,42 @@ msgid "" "call to ``joinpath``. For example::" msgstr "" -#: ../../library/importlib.resources.abc.rst:129 +#: ../../library/importlib.resources.abc.rst:137 msgid "files.joinpath('subdir').joinpath('subsubdir').joinpath('file.txt')" msgstr "files.joinpath('subdir').joinpath('subsubdir').joinpath('file.txt')" -#: ../../library/importlib.resources.abc.rst:133 +#: ../../library/importlib.resources.abc.rst:141 msgid "" "``joinpath`` accepts multiple *pathsegments*, and these segments may contain " "forward slashes as path separators. Previously, only a single *child* " "argument was accepted." msgstr "" -#: ../../library/importlib.resources.abc.rst:139 +#: ../../library/importlib.resources.abc.rst:148 msgid "Return Traversable child in self. Equivalent to ``joinpath(child)``." msgstr "" -#: ../../library/importlib.resources.abc.rst:144 +#: ../../library/importlib.resources.abc.rst:154 msgid "" "*mode* may be 'r' or 'rb' to open as text or binary. Return a handle " "suitable for reading (same as :attr:`pathlib.Path.open`)." msgstr "" -#: ../../library/importlib.resources.abc.rst:147 +#: ../../library/importlib.resources.abc.rst:157 msgid "" "When opening as text, accepts encoding parameters such as those accepted by :" "class:`io.TextIOWrapper`." msgstr "" -#: ../../library/importlib.resources.abc.rst:152 +#: ../../library/importlib.resources.abc.rst:162 msgid "Read contents of self as bytes." msgstr "" -#: ../../library/importlib.resources.abc.rst:156 +#: ../../library/importlib.resources.abc.rst:166 msgid "Read contents of self as text." msgstr "" -#: ../../library/importlib.resources.abc.rst:161 +#: ../../library/importlib.resources.abc.rst:171 msgid "" "An abstract base class for resource readers capable of serving the :meth:" "`importlib.resources.files` interface. Subclasses :class:`ResourceReader` " @@ -217,13 +217,13 @@ msgid "" "TraversableResources` also supplies :class:`!ResourceReader`." msgstr "" -#: ../../library/importlib.resources.abc.rst:168 +#: ../../library/importlib.resources.abc.rst:178 msgid "" "Loaders that wish to support resource reading are expected to implement this " "interface." msgstr "" -#: ../../library/importlib.resources.abc.rst:173 +#: ../../library/importlib.resources.abc.rst:184 msgid "" "Returns a :class:`importlib.resources.abc.Traversable` object for the loaded " "package." diff --git a/library/itertools.po b/library/itertools.po index 9da2ed2ccd..03caf99389 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-07 15:02+0800\n" +"POT-Creation-Date: 2025-04-19 00:14+0000\n" "PO-Revision-Date: 2024-08-16 15:01+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -488,10 +488,10 @@ msgid "" "www.ramseysolutions.com/real-estate/amortization-schedule>`_, accumulate the " "interest and apply payments:" msgstr "" -"*function* 引數可以被設定為 :func:`min` 以得到連續的最小值,設定" -"為 :func:`max` 以得到連續的最大值,或者設定為 :func:`operator.mul` 以得到連續" -"的乘積。也可以透過累積利息和付款來建立\\ `攤銷表 (Amortization tables) " -"`_ :" +"*function* 引數可以被設定為 :func:`min` 以得到連續的最小值,設定為 :func:" +"`max` 以得到連續的最大值,或者設定為 :func:`operator.mul` 以得到連續的乘積。" +"也可以透過累積利息和付款來建立\\ `攤銷表 (Amortization tables) `_ :" #: ../../library/itertools.rst:136 msgid "" @@ -630,9 +630,9 @@ msgstr "從輸入 *iterable* 中回傳長度為 *r* 的元素的子序列。" #: ../../library/itertools.rst:227 msgid "" "The output is a subsequence of :func:`product` keeping only entries that are " -"subsequences of the *iterable*. The length of the output is given " -"by :func:`math.comb` which computes ``n! / r! / (n - r)!`` when ``0 ≤ r ≤ " -"n`` or zero when ``r > n``." +"subsequences of the *iterable*. The length of the output is given by :func:" +"`math.comb` which computes ``n! / r! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero " +"when ``r > n``." msgstr "" "輸出是 :func:`product` 的子序列,僅保留作為 *iterable* 子序列的條目。輸出的長" "度由 :func:`math.comb` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / r! / (n - r)!" @@ -758,8 +758,8 @@ msgstr "" #: ../../library/itertools.rst:323 msgid "" "Make an iterator that returns evenly spaced values beginning with *start*. " -"Can be used with :func:`map` to generate consecutive data points or " -"with :func:`zip` to add sequence numbers. Roughly equivalent to::" +"Can be used with :func:`map` to generate consecutive data points or with :" +"func:`zip` to add sequence numbers. Roughly equivalent to::" msgstr "" "建立一個疊代器,回傳從 *start* 開始的等差的值。可以與 :func:`map` 一起使用來" "產生連續的資料點,或與 :func:`zip` 一起使用來增加序列號。大致等價於: ::" @@ -939,9 +939,9 @@ msgstr "" #: ../../library/itertools.rst:420 msgid "" "The returned group is itself an iterator that shares the underlying iterable " -"with :func:`groupby`. Because the source is shared, when " -"the :func:`groupby` object is advanced, the previous group is no longer " -"visible. So, if that data is needed later, it should be stored as a list::" +"with :func:`groupby`. Because the source is shared, when the :func:" +"`groupby` object is advanced, the previous group is no longer visible. So, " +"if that data is needed later, it should be stored as a list::" msgstr "" "回傳的群組本身是一個與 :func:`groupby` 共享底層可疊代物件的疊代器。由於來源是" "共享的,當 :func:`groupby` 物件前進時,前一個群組將不再可見。因此,如果之後需" @@ -1146,11 +1146,11 @@ msgstr "" #: ../../library/itertools.rst:536 msgid "" -"Return successive *r* length `permutations of elements `_ from the *iterable*." +"Return successive *r* length `permutations of elements `_ from the *iterable*." msgstr "" -"回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 `_ 。" +"回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 `_ 。" #: ../../library/itertools.rst:539 msgid "" @@ -1163,13 +1163,13 @@ msgstr "" #: ../../library/itertools.rst:543 msgid "" "The output is a subsequence of :func:`product` where entries with repeated " -"elements have been filtered out. The length of the output is given " -"by :func:`math.perm` which computes ``n! / (n - r)!`` when ``0 ≤ r ≤ n`` or " -"zero when ``r > n``." +"elements have been filtered out. The length of the output is given by :func:" +"`math.perm` which computes ``n! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero when " +"``r > n``." msgstr "" -"輸出是 :func:`product` 的子序列,其中重複元素的條目已被濾除。輸出的長度" -"由 :func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 " -"``r > n`` 時為零。" +"輸出是 :func:`product` 的子序列,其中重複元素的條目已被濾除。輸出的長度由 :" +"func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 ``r " +"> n`` 時為零。" #: ../../library/itertools.rst:548 msgid "" @@ -1432,15 +1432,14 @@ msgid "" "the input iterator and there is no way to access it. This could be an issue " "if an application wants to further consume the input iterator after " "*takewhile* has been run to exhaustion. To work around this problem, " -"consider using `more-itertools before_and_after() `_ instead." +"consider using `more-itertools before_and_after() `_ instead." msgstr "" "注意,第一個不符合條件判斷的元素將從輸入疊代器中被消耗,且無法再存取它。如果" "應用程式希望在 *takewhile* 耗盡後進一步消耗輸入疊代器,這可能會是個問題。為了" "解決這個問題,可以考慮使用 `more-itertools 中的 before_and_after() `_ 作為替代。" +"more-itertools.readthedocs.io/en/stable/api.html#more_itertools." +"before_and_after>`_ 作為替代。" #: ../../library/itertools.rst:691 msgid "Return *n* independent iterators from a single iterable." @@ -1486,9 +1485,9 @@ msgstr "" msgid "" "When the input *iterable* is already a tee iterator object, all members of " "the return tuple are constructed as if they had been produced by the " -"upstream :func:`tee` call. This \"flattening step\" allows " -"nested :func:`tee` calls to share the same underlying data chain and to have " -"a single update step rather than a chain of calls." +"upstream :func:`tee` call. This \"flattening step\" allows nested :func:" +"`tee` calls to share the same underlying data chain and to have a single " +"update step rather than a chain of calls." msgstr "" #: ../../library/itertools.rst:734 @@ -1522,19 +1521,19 @@ msgid "" "even if the original *iterable* is threadsafe." msgstr "" "``tee`` 疊代器不是執行緒安全 (threadsafe) 的。當同時使用由同一個 :func:`tee` " -"呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引" -"發 :exc:`RuntimeError`。" +"呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引發 :exc:" +"`RuntimeError`。" #: ../../library/itertools.rst:758 msgid "" "This itertool may require significant auxiliary storage (depending on how " "much temporary data needs to be stored). In general, if one iterator uses " -"most or all of the data before another iterator starts, it is faster to " -"use :func:`list` instead of :func:`tee`." +"most or all of the data before another iterator starts, it is faster to use :" +"func:`list` instead of :func:`tee`." msgstr "" "此 itertool 可能需要大量的輔助儲存空間(取決於需要儲存多少臨時資料)。通常如" -"果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使" -"用 :func:`list` 會比 :func:`tee` 更快。" +"果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使用 :func:" +"`list` 會比 :func:`tee` 更快。" #: ../../library/itertools.rst:766 msgid "Make an iterator that aggregates elements from each of the *iterables*." @@ -1600,9 +1599,9 @@ msgstr "" #: ../../library/itertools.rst:798 msgid "" -"If one of the iterables is potentially infinite, then " -"the :func:`zip_longest` function should be wrapped with something that " -"limits the number of calls (for example :func:`islice` or :func:`takewhile`)." +"If one of the iterables is potentially infinite, then the :func:" +"`zip_longest` function should be wrapped with something that limits the " +"number of calls (for example :func:`islice` or :func:`takewhile`)." msgstr "" "如果其中一個 iterables 可能是無限的,那麼應該用別的可以限制呼叫次數的方法來包" "裝 :func:`zip_longest` 函式(例如 :func:`islice` 或 :func:`takewhile`)。" @@ -1625,16 +1624,16 @@ msgid "" "``chain.from_iterable`` is related to the concept of flattening. The " "recipes also give ideas about ways that the tools can be combined — for " "example, how ``starmap()`` and ``repeat()`` can work together. The recipes " -"also show patterns for using itertools with the :mod:`operator` " -"and :mod:`collections` modules as well as with the built-in itertools such " -"as ``map()``, ``filter()``, ``reversed()``, and ``enumerate()``." +"also show patterns for using itertools with the :mod:`operator` and :mod:" +"`collections` modules as well as with the built-in itertools such as " +"``map()``, ``filter()``, ``reversed()``, and ``enumerate()``." msgstr "" "itertools 應用技巧的主要目的是教學。這些應用技巧展示了對單個工具進行思考的各" "種方式 —— 例如,``chain.from_iterable`` 與攤平 (flattening) 的概念相關。這些" "應用技巧還提供了組合使用工具的想法 —— 例如,``starmap()`` 和 ``repeat()`` 如" -"何一起工作。另外還展示了將 itertools 與 :mod:`operator` " -"和 :mod:`collections` 模組一同使用以及與內建 itertools(如 ``map()``、" -"``filter()``、``reversed()`` 和 ``enumerate()``)一同使用的模式。" +"何一起工作。另外還展示了將 itertools 與 :mod:`operator` 和 :mod:" +"`collections` 模組一同使用以及與內建 itertools(如 ``map()``、``filter()``、" +"``reversed()`` 和 ``enumerate()``)一同使用的模式。" #: ../../library/itertools.rst:820 msgid "" @@ -1653,8 +1652,8 @@ msgid "" "Substantially all of these recipes and many, many others can be installed " "from the :pypi:`more-itertools` project found on the Python Package Index::" msgstr "" -"幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上" -"的 :pypi:`more-itertools` 專案中安裝: ::" +"幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上的 :" +"pypi:`more-itertools` 專案中安裝: ::" #: ../../library/itertools.rst:829 msgid "python -m pip install more-itertools" @@ -1675,8 +1674,8 @@ msgstr "" "可疊代物件一次性引入記憶體,能保持優異的記憶體性能。以\\ `函式風格 " "(functional style) `_ 將工具連接在一起,能將程式碼的數量維持在較少的情況。透過優先使" -"用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和" -"\\ :term:`產生器 `,則能保持高速度。" +"用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和\\ :" +"term:`產生器 `,則能保持高速度。" #: ../../library/itertools.rst:839 msgid "" @@ -1857,6 +1856,12 @@ msgstr "以下的應用技巧具有更多的數學風格:" #: ../../library/itertools.rst:1010 msgid "" +"def multinomial(*counts):\n" +" \"Number of distinct arrangements of a multiset.\"\n" +" # Counter('abracadabra').values() → 5 2 2 1 1\n" +" # multinomial(5, 2, 2, 1, 1) → 83160\n" +" return prod(map(comb, accumulate(counts), counts))\n" +"\n" "def powerset(iterable):\n" " \"Subsequences of the iterable from shortest to longest.\"\n" " # powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)\n" @@ -1973,13 +1978,7 @@ msgid "" " # totient(12) → 4 because len([1, 5, 7, 11]) == 4\n" " for prime in set(factor(n)):\n" " n -= n // prime\n" -" return n\n" -"\n" -"def multinomial(*counts):\n" -" \"Number of distinct arrangements of a multiset.\"\n" -" # Counter('abracadabra').values() -> 5 2 1 1 2\n" -" # multinomial(5, 2, 1, 1, 2) → 83160\n" -" return prod(map(comb, accumulate(counts), counts))" +" return n" msgstr "" #~ msgid "" diff --git a/library/json.po b/library/json.po index 5c7cb4ed9f..64070df707 100644 --- a/library/json.po +++ b/library/json.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-09 00:13+0000\n" +"POT-Creation-Date: 2025-04-09 00:15+0000\n" "PO-Revision-Date: 2023-08-05 15:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,12 +30,12 @@ msgstr "**原始碼:**\\ :source:`Lib/json/__init__.py`" #: ../../library/json.rst:14 msgid "" -"`JSON (JavaScript Object Notation) `_, specified " -"by :rfc:`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 `_, specified by :rfc:" +"`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 `_, is a " -"lightweight data interchange format inspired by `JavaScript `_ object literal syntax (although it is " -"not a strict subset of JavaScript [#rfc-errata]_ )." +"lightweight data interchange format inspired by `JavaScript `_ object literal syntax (although it is not a " +"strict subset of JavaScript [#rfc-errata]_ )." msgstr "" "`JSON (JavaScript Object Notation) `_ 是一個輕量化的資料交" "換格式,在 :rfc:`7159`\\ (其廢棄了 :rfc:`4627`\\ )及 `ECMA-404 >> import json\n" ">>> def custom_json(obj):\n" "... if isinstance(obj, complex):\n" -"... return {'__complex__': True, 'real': obj.real, 'imag': " -"obj.imag}\n" +"... return {'__complex__': True, 'real': obj.real, 'imag': obj." +"imag}\n" "... raise TypeError(f'Cannot serialize object of {type(obj)}')\n" "...\n" ">>> json.dumps(1 + 2j, default=custom_json)\n" @@ -284,8 +284,8 @@ msgid "" "conversion table `." msgstr "" "參考這個 :ref:`Python-to-JSON 轉換表 `\\ 將 *obj* 序列化為" -"符合 JSON 格式的串流,並寫入到 *fp* (一個支援 ``.write()`` 方法" -"的 :term:`file-like object`)" +"符合 JSON 格式的串流,並寫入到 *fp* (一個支援 ``.write()`` 方法的 :term:" +"`file-like object`)" # SkyLull: 我想這裡的 "framed protocol" 指的是 # https://peps.python.org/pep-3154/#framing @@ -316,9 +316,9 @@ msgstr "" #: ../../library/json.rst:173 msgid "" -"If ``True``, keys that are not of a basic type " -"(:class:`str`, :class:`int`, :class:`float`, :class:`bool`, ``None``) will " -"be skipped instead of raising a :exc:`TypeError`. Default ``False``." +"If ``True``, keys that are not of a basic type (:class:`str`, :class:`int`, :" +"class:`float`, :class:`bool`, ``None``) will be skipped instead of raising " +"a :exc:`TypeError`. Default ``False``." msgstr "" #: ../../library/json.rst:179 @@ -380,8 +380,8 @@ msgstr "" #: ../../library/json.rst:222 msgid "" "A function that is called for objects that can't otherwise be serialized. It " -"should return a JSON encodable version of the object or raise " -"a :exc:`TypeError`. If ``None`` (the default), :exc:`!TypeError` is raised." +"should return a JSON encodable version of the object or raise a :exc:" +"`TypeError`. If ``None`` (the default), :exc:`!TypeError` is raised." msgstr "" #: ../../library/json.rst:229 @@ -406,11 +406,11 @@ msgstr "" #: ../../library/json.rst:248 msgid "" "Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion " -"table `. The arguments have the same meaning as " -"in :func:`dump`." +"table `. The arguments have the same meaning as in :func:" +"`dump`." msgstr "" -"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格" -"式 :class:`str`。這個引數的作用與 :func:`dump` 中的同名引數意義相同。" +"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格式 :" +"class:`str`。這個引數的作用與 :func:`dump` 中的同名引數意義相同。" #: ../../library/json.rst:254 msgid "" @@ -442,8 +442,8 @@ msgstr "" #: ../../library/json.rst:273 msgid "" "If set, a custom JSON decoder. Additional keyword arguments to :func:`!load` " -"will be passed to the constructor of *cls*. If ``None`` (the " -"default), :class:`!JSONDecoder` is used." +"will be passed to the constructor of *cls*. If ``None`` (the default), :" +"class:`!JSONDecoder` is used." msgstr "" #: ../../library/json.rst:280 @@ -479,8 +479,8 @@ msgstr "" msgid "" "If set, a function that is called with the string of every JSON float to be " "decoded. If ``None`` (the default), it is equivalent to ``float(num_str)``. " -"This can be used to parse JSON floats into custom datatypes, for " -"example :class:`decimal.Decimal`." +"This can be used to parse JSON floats into custom datatypes, for example :" +"class:`decimal.Decimal`." msgstr "" "*parse_float* 為可選函式,每個要被解碼的 JSON 浮點數字串都會改用這個參數給定" "的函式來進行解碼。預設情況這等效於 ``float(num_str)``。這個參數可用於將 JSON " @@ -491,8 +491,8 @@ msgstr "" msgid "" "If set, a function that is called with the string of every JSON int to be " "decoded. If ``None`` (the default), it is equivalent to ``int(num_str)``. " -"This can be used to parse JSON integers into custom datatypes, for " -"example :class:`float`." +"This can be used to parse JSON integers into custom datatypes, for example :" +"class:`float`." msgstr "" "*parse_int* 為可選函式,當解碼 JSON 整數字串時會被呼叫。預設情況等效於 " "``int(num_str)``。這個參數可用於將 JSON 中的整數解碼或剖析為另一種資料型別" @@ -517,8 +517,8 @@ msgstr "" #, fuzzy msgid "When the data being deserialized is not a valid JSON document." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" -"發 :exc:`JSONDecodeError` 例外。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" +"`JSONDecodeError` 例外。" #: ../../library/json.rst:327 #, fuzzy @@ -526,8 +526,8 @@ msgid "" "When the data being deserialized does not contain UTF-8, UTF-16 or UTF-32 " "encoded data." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" -"發 :exc:`JSONDecodeError` 例外。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" +"`JSONDecodeError` 例外。" #: ../../library/json.rst:333 msgid "Added the optional *object_pairs_hook* parameter." @@ -564,9 +564,9 @@ msgid "" "containing a JSON document) to a Python object using this :ref:`conversion " "table `." msgstr "" -"使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件" -"的 :class:`str`、:class:`bytes` 或 :class:`bytearray` 的實例(instance))去" -"序列化(deserialize)為一個 Python 物件" +"使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件的 :" +"class:`str`、:class:`bytes` 或 :class:`bytearray` 的實例(instance))去序列" +"化(deserialize)為一個 Python 物件" #: ../../library/json.rst:355 msgid "" @@ -676,8 +676,8 @@ msgstr "" msgid "" "*object_hook* is an optional function that will be called with the result of " "every JSON object decoded and its return value will be used in place of the " -"given :class:`dict`. This can be used to provide custom deserializations " -"(e.g. to support `JSON-RPC `_ class hinting)." +"given :class:`dict`. This can be used to provide custom deserializations (e." +"g. to support `JSON-RPC `_ class hinting)." msgstr "" "*object_hook* 是一個可選函式,其接受一個解碼後的 JSON 物件作為輸入,並使用其" "回傳值來取代原先的 :class:`dict`。這個功能可用於提供自訂的去序列化(例如支援 " @@ -687,9 +687,9 @@ msgstr "" msgid "" "*object_pairs_hook* is an optional function that will be called with the " "result of every JSON object decoded with an ordered list of pairs. The " -"return value of *object_pairs_hook* will be used instead of " -"the :class:`dict`. This feature can be used to implement custom decoders. " -"If *object_hook* is also defined, the *object_pairs_hook* takes priority." +"return value of *object_pairs_hook* will be used instead of the :class:" +"`dict`. This feature can be used to implement custom decoders. If " +"*object_hook* is also defined, the *object_pairs_hook* takes priority." msgstr "" #: ../../library/json.rst:408 @@ -741,11 +741,11 @@ msgstr "" #: ../../library/json.rst:430 msgid "" -"If the data being deserialized is not a valid JSON document, " -"a :exc:`JSONDecodeError` will be raised." +"If the data being deserialized is not a valid JSON document, a :exc:" +"`JSONDecodeError` will be raised." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" -"發 :exc:`JSONDecodeError` 例外。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" +"`JSONDecodeError` 例外。" #: ../../library/json.rst:433 ../../library/json.rst:534 msgid "All parameters are now :ref:`keyword-only `." @@ -809,8 +809,8 @@ msgstr "" #: ../../library/json.rst:483 msgid "" -"To extend this to recognize other objects, subclass and implement " -"a :meth:`~JSONEncoder.default` method with another method that returns a " +"To extend this to recognize other objects, subclass and implement a :meth:" +"`~JSONEncoder.default` method with another method that returns a " "serializable object for ``o`` if possible, otherwise it should call the " "superclass implementation (to raise :exc:`TypeError`)." msgstr "" @@ -819,15 +819,16 @@ msgstr "" "JSONEncoder.default 方法(以引發 :exc:`TypeError` 例外)。" #: ../../library/json.rst:488 +#, fuzzy msgid "" "If *skipkeys* is false (the default), a :exc:`TypeError` will be raised when " -"trying to encode keys that are " -"not :class:`str`, :class:`int`, :class:`float` or ``None``. If *skipkeys* " -"is true, such items are simply skipped." +"trying to encode keys that are not :class:`str`, :class:`int`, :class:" +"`float`, :class:`bool` or ``None``. If *skipkeys* is true, such items are " +"simply skipped." msgstr "" -"若 *skipkeys* 為 false(預設值),則當在編碼不" -"是 :class:`str`、:class:`int`、:class:`float` 或 ``None`` 的鍵值時,將引" -"發 :exc:`TypeError`。如果 *skipkeys* 為 true,這些項目將直接被跳過。" +"若 *skipkeys* 為 false(預設值),則當在編碼不是 :class:`str`、:class:" +"`int`、:class:`float` 或 ``None`` 的鍵值時,將引發 :exc:`TypeError`。如果 " +"*skipkeys* 為 true,這些項目將直接被跳過。" #: ../../library/json.rst:492 msgid "" @@ -846,8 +847,8 @@ msgid "" "Otherwise, no such check takes place." msgstr "" "如果 *check_circular* 為 true(預設值),則會在編碼期間檢查串列(list)、字典" -"(dict)和自訂編碼物件的循環參照,以防止無限遞迴(一個會導" -"致 :exc:`RecursionError` 例外的問題)。否則不會進行此類檢查。" +"(dict)和自訂編碼物件的循環參照,以防止無限遞迴(一個會導致 :exc:" +"`RecursionError` 例外的問題)。否則不會進行此類檢查。" #: ../../library/json.rst:501 msgid "" @@ -901,8 +902,8 @@ msgstr "" msgid "" "If specified, *default* should be a function that gets called for objects " "that can't otherwise be serialized. It should return a JSON encodable " -"version of the object or raise a :exc:`TypeError`. If not " -"specified, :exc:`TypeError` is raised." +"version of the object or raise a :exc:`TypeError`. If not specified, :exc:" +"`TypeError` is raised." msgstr "" "如果有指定本參數,*default* 會是一個遭遇無法序列化的物件時會被呼叫的函式。它" "應該回傳該物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會直接" @@ -911,19 +912,19 @@ msgstr "" #: ../../library/json.rst:540 msgid "" "Implement this method in a subclass such that it returns a serializable " -"object for *o*, or calls the base implementation (to raise " -"a :exc:`TypeError`)." +"object for *o*, or calls the base implementation (to raise a :exc:" +"`TypeError`)." msgstr "" "在任意一個子類別裡實作這個方法時須讓其回傳一個可序列化的物件 *o* ,或呼叫原始" "的實作以引發 :exc:`TypeError` 例外。" #: ../../library/json.rst:544 msgid "" -"For example, to support arbitrary iterators, you could " -"implement :meth:`~JSONEncoder.default` like this::" +"For example, to support arbitrary iterators, you could implement :meth:" +"`~JSONEncoder.default` like this::" msgstr "" -"舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子" -"的 :meth:`~JSONEncoder.default`: ::" +"舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子的 :meth:" +"`~JSONEncoder.default`: ::" #: ../../library/json.rst:547 msgid "" @@ -1069,9 +1070,8 @@ msgid "" "`, and thus does not otherwise directly address the issue of character " "encodings." msgstr "" -"除了 *ensure_ascii* 選項參數之外,本模組嚴格遵循 Python 物件" -"與 :class:`Unicode strings ` 之間的轉換規範,因此並不另外處理字元編碼的" -"問題。" +"除了 *ensure_ascii* 選項參數之外,本模組嚴格遵循 Python 物件與 :class:" +"`Unicode strings ` 之間的轉換規範,因此並不另外處理字元編碼的問題。" #: ../../library/json.rst:641 msgid "" @@ -1091,8 +1091,8 @@ msgid "" "The RFC does not explicitly forbid JSON strings which contain byte sequences " "that don't correspond to valid Unicode characters (e.g. unpaired UTF-16 " "surrogates), but it does note that they may cause interoperability problems. " -"By default, this module accepts and outputs (when present in the " -"original :class:`str`) code points for such sequences." +"By default, this module accepts and outputs (when present in the original :" +"class:`str`) code points for such sequences." msgstr "" "RFC 並未明確禁止 JSON 文件包含無法對應有效 Unicode 字元的位元組序列(例如未配" "對的 UTF-16 代理對(surrogate pairs)),但這個特性的確可能會引起相容性問題。" @@ -1250,12 +1250,11 @@ msgstr "" #: ../../library/json.rst:744 msgid "" -"If the optional ``infile`` and ``outfile`` arguments are not " -"specified, :data:`sys.stdin` and :data:`sys.stdout` will be used " -"respectively:" +"If the optional ``infile`` and ``outfile`` arguments are not specified, :" +"data:`sys.stdin` and :data:`sys.stdout` will be used respectively:" msgstr "" -"如果沒有指定可選引數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` " -"和 :data:`sys.stdout` 將各自做為輸入和輸出的預設值。" +"如果沒有指定可選引數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` 和 :" +"data:`sys.stdout` 將各自做為輸入和輸出的預設值。" #: ../../library/json.rst:747 msgid "" @@ -1318,8 +1317,8 @@ msgid "" "Write the output of the *infile* to the given *outfile*. Otherwise, write it " "to :data:`sys.stdout`." msgstr "" -"將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入" -"到 :data:`sys.stdout`。" +"將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入到 :data:`sys." +"stdout`。" #: ../../library/json.rst:792 msgid "Sort the output of dictionaries alphabetically by key." diff --git a/library/language.po b/library/language.po index fd197d5ad7..faf9fb5c18 100644 --- a/library/language.po +++ b/library/language.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -28,6 +27,8 @@ msgid "" "language. These modules support tokenizing, parsing, syntax analysis, " "bytecode disassembly, and various other facilities." msgstr "" +"Python 提供了許多模組來協助處理 Python 語言。這些模組支援標記化、剖析、語法分" +"析、位元碼反組譯,以及其他各種設施。" #: ../../library/language.rst:11 msgid "These modules include:" diff --git a/library/logging.handlers.po b/library/logging.handlers.po index c735ab982e..e8b7682ec7 100644 --- a/library/logging.handlers.po +++ b/library/logging.handlers.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1608,36 +1608,41 @@ msgid "" "process." msgstr "" -#: ../../library/logging.handlers.rst:1177 +#: ../../library/logging.handlers.rst:1175 +msgid "" +"Raises :exc:`RuntimeError` if called and the listener is already running." +msgstr "" + +#: ../../library/logging.handlers.rst:1181 msgid "Stops the listener." msgstr "" -#: ../../library/logging.handlers.rst:1179 +#: ../../library/logging.handlers.rst:1183 msgid "" "This asks the thread to terminate, and then waits for it to do so. Note that " "if you don't call this before your application exits, there may be some " "records still left on the queue, which won't be processed." msgstr "" -#: ../../library/logging.handlers.rst:1185 +#: ../../library/logging.handlers.rst:1189 msgid "" "Writes a sentinel to the queue to tell the listener to quit. This " "implementation uses ``put_nowait()``. You may want to override this method " "if you want to use timeouts or work with custom queue implementations." msgstr "" -#: ../../library/logging.handlers.rst:1195 +#: ../../library/logging.handlers.rst:1199 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../library/logging.handlers.rst:1196 +#: ../../library/logging.handlers.rst:1200 msgid "API reference for the logging module." msgstr "" -#: ../../library/logging.handlers.rst:1198 +#: ../../library/logging.handlers.rst:1202 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../library/logging.handlers.rst:1199 +#: ../../library/logging.handlers.rst:1203 msgid "Configuration API for the logging module." msgstr "" diff --git a/library/logging.po b/library/logging.po index c11c77e048..b1f72fc580 100644 --- a/library/logging.po +++ b/library/logging.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-02-25 00:14+0000\n" "PO-Revision-Date: 2024-03-28 22:40+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -791,18 +791,20 @@ msgid "" msgstr "" #: ../../library/logging.rst:565 -msgid "Sets the :class:`Formatter` for this handler to *fmt*." +msgid "" +"Sets the formatter for this handler to *fmt*. The *fmt* argument must be a :" +"class:`Formatter` instance or ``None``." msgstr "" -#: ../../library/logging.rst:570 +#: ../../library/logging.rst:571 msgid "Adds the specified filter *filter* to this handler." msgstr "" -#: ../../library/logging.rst:575 +#: ../../library/logging.rst:576 msgid "Removes the specified filter *filter* from this handler." msgstr "" -#: ../../library/logging.rst:580 +#: ../../library/logging.rst:581 msgid "" "Apply this handler's filters to the record and return ``True`` if the record " "is to be processed. The filters are consulted in turn, until one of them " @@ -811,28 +813,33 @@ msgid "" "record." msgstr "" -#: ../../library/logging.rst:589 +#: ../../library/logging.rst:590 msgid "" "Ensure all logging output has been flushed. This version does nothing and is " "intended to be implemented by subclasses." msgstr "" -#: ../../library/logging.rst:595 +#: ../../library/logging.rst:596 msgid "" "Tidy up any resources used by the handler. This version does no output but " -"removes the handler from an internal list of handlers which is closed when :" -"func:`shutdown` is called. Subclasses should ensure that this gets called " -"from overridden :meth:`close` methods." +"removes the handler from an internal map of handlers, which is used for " +"handler lookup by name." +msgstr "" + +#: ../../library/logging.rst:600 +msgid "" +"Subclasses should ensure that this gets called from overridden :meth:`close` " +"methods." msgstr "" -#: ../../library/logging.rst:603 +#: ../../library/logging.rst:606 msgid "" "Conditionally emits the specified logging record, depending on filters which " "may have been added to the handler. Wraps the actual emission of the record " "with acquisition/release of the I/O thread lock." msgstr "" -#: ../../library/logging.rst:610 +#: ../../library/logging.rst:613 msgid "" "This method should be called from handlers when an exception is encountered " "during an :meth:`emit` call. If the module-level attribute :data:" @@ -845,20 +852,20 @@ msgid "" "is more useful during development)." msgstr "" -#: ../../library/logging.rst:623 +#: ../../library/logging.rst:626 msgid "" "Do formatting for a record - if a formatter is set, use it. Otherwise, use " "the default formatter for the module." msgstr "" -#: ../../library/logging.rst:629 +#: ../../library/logging.rst:632 msgid "" "Do whatever it takes to actually log the specified logging record. This " "version is intended to be implemented by subclasses and so raises a :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/logging.rst:633 +#: ../../library/logging.rst:636 msgid "" "This method is called after a handler-level lock is acquired, which is " "released after this method returns. When you override this method, note that " @@ -867,13 +874,13 @@ msgid "" "Specifically:" msgstr "" -#: ../../library/logging.rst:639 +#: ../../library/logging.rst:642 msgid "" "Logging configuration APIs acquire the module-level lock, and then " "individual handler-level locks as those handlers are configured." msgstr "" -#: ../../library/logging.rst:642 +#: ../../library/logging.rst:645 msgid "" "Many logging APIs lock the module-level lock. If such an API is called from " "this method, it could cause a deadlock if a configuration call is made on " @@ -883,16 +890,16 @@ msgid "" "method, the handler-level lock has already been acquired)." msgstr "" -#: ../../library/logging.rst:649 +#: ../../library/logging.rst:652 msgid "" "For a list of handlers included as standard, see :mod:`logging.handlers`." msgstr "" -#: ../../library/logging.rst:654 +#: ../../library/logging.rst:657 msgid "Formatter Objects" msgstr "" -#: ../../library/logging.rst:660 +#: ../../library/logging.rst:663 msgid "" "Responsible for converting a :class:`LogRecord` to an output string to be " "interpreted by a human or external system." @@ -902,7 +909,7 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/logging.rst:663 +#: ../../library/logging.rst:666 msgid "" "A format string in the given *style* for the logged output as a whole. The " "possible mapping keys are drawn from the :class:`LogRecord` object's :ref:" @@ -910,14 +917,14 @@ msgid "" "is just the logged message." msgstr "" -#: ../../library/logging.rst:671 +#: ../../library/logging.rst:674 msgid "" "A format string in the given *style* for the date/time portion of the logged " "output. If not specified, the default described in :meth:`formatTime` is " "used." msgstr "" -#: ../../library/logging.rst:676 +#: ../../library/logging.rst:679 msgid "" "Can be one of ``'%'``, ``'{'`` or ``'$'`` and determines how the format " "string will be merged with its data: using one of :ref:`old-string-" @@ -928,32 +935,32 @@ msgid "" "use ``{``- and ``$``-formatting for log messages." msgstr "" -#: ../../library/logging.rst:686 +#: ../../library/logging.rst:689 msgid "" "If ``True`` (the default), incorrect or mismatched *fmt* and *style* will " "raise a :exc:`ValueError`; for example, ``logging.Formatter('%(asctime)s - " "%(message)s', style='{')``." msgstr "" -#: ../../library/logging.rst:691 +#: ../../library/logging.rst:694 msgid "" "A dictionary with default values to use in custom fields. For example, " "``logging.Formatter('%(ip)s %(message)s', defaults={\"ip\": None})``" msgstr "" -#: ../../library/logging.rst:696 +#: ../../library/logging.rst:699 msgid "Added the *style* parameter." msgstr "新增 *style* 參數。" -#: ../../library/logging.rst:699 +#: ../../library/logging.rst:702 msgid "Added the *validate* parameter." msgstr "新增 *validate* 參數。" -#: ../../library/logging.rst:702 +#: ../../library/logging.rst:705 msgid "Added the *defaults* parameter." msgstr "新增 *defaults* 參數。" -#: ../../library/logging.rst:708 +#: ../../library/logging.rst:711 msgid "" "The record's attribute dictionary is used as the operand to a string " "formatting operation. Returns the resulting string. Before formatting the " @@ -972,13 +979,13 @@ msgid "" "recalculates it afresh." msgstr "" -#: ../../library/logging.rst:724 +#: ../../library/logging.rst:727 msgid "" "If stack information is available, it's appended after the exception " "information, using :meth:`formatStack` to transform it if necessary." msgstr "" -#: ../../library/logging.rst:730 +#: ../../library/logging.rst:733 msgid "" "This method should be called from :meth:`format` by a formatter which wants " "to make use of a formatted time. This method can be overridden in formatters " @@ -991,7 +998,7 @@ msgid "" "resulting string is returned." msgstr "" -#: ../../library/logging.rst:740 +#: ../../library/logging.rst:743 msgid "" "This function uses a user-configurable function to convert the creation time " "to a tuple. By default, :func:`time.localtime` is used; to change this for a " @@ -1001,7 +1008,7 @@ msgid "" "be shown in GMT, set the ``converter`` attribute in the ``Formatter`` class." msgstr "" -#: ../../library/logging.rst:748 +#: ../../library/logging.rst:751 msgid "" "Previously, the default format was hard-coded as in this example: " "``2010-09-06 22:38:15,292`` where the part before the comma is handled by a " @@ -1016,11 +1023,11 @@ msgid "" "the millisecond value)." msgstr "" -#: ../../library/logging.rst:761 +#: ../../library/logging.rst:764 msgid "The ``default_msec_format`` can be ``None``." msgstr "" -#: ../../library/logging.rst:766 +#: ../../library/logging.rst:769 msgid "" "Formats the specified exception information (a standard exception tuple as " "returned by :func:`sys.exc_info`) as a string. This default implementation " @@ -1028,14 +1035,14 @@ msgid "" "returned." msgstr "" -#: ../../library/logging.rst:773 +#: ../../library/logging.rst:776 msgid "" "Formats the specified stack information (a string as returned by :func:" "`traceback.print_stack`, but with the last newline removed) as a string. " "This default implementation just returns the input value." msgstr "" -#: ../../library/logging.rst:779 +#: ../../library/logging.rst:782 msgid "" "A base formatter class suitable for subclassing when you want to format a " "number of records. You can pass a :class:`Formatter` instance which you want " @@ -1044,7 +1051,7 @@ msgid "" "used as the line formatter." msgstr "" -#: ../../library/logging.rst:787 +#: ../../library/logging.rst:790 msgid "" "Return a header for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " @@ -1052,14 +1059,14 @@ msgid "" "separator line." msgstr "" -#: ../../library/logging.rst:794 +#: ../../library/logging.rst:797 msgid "" "Return a footer for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " "specific behaviour, e.g. to show the count of records or a separator line." msgstr "" -#: ../../library/logging.rst:801 +#: ../../library/logging.rst:804 msgid "" "Return formatted text for a list of *records*. The base implementation just " "returns the empty string if there are no records; otherwise, it returns the " @@ -1067,11 +1074,11 @@ msgid "" "and the footer." msgstr "" -#: ../../library/logging.rst:809 +#: ../../library/logging.rst:812 msgid "Filter Objects" msgstr "" -#: ../../library/logging.rst:811 +#: ../../library/logging.rst:814 msgid "" "``Filters`` can be used by ``Handlers`` and ``Loggers`` for more " "sophisticated filtering than is provided by levels. The base filter class " @@ -1081,7 +1088,7 @@ msgid "" "If initialized with the empty string, all events are passed." msgstr "" -#: ../../library/logging.rst:821 +#: ../../library/logging.rst:824 msgid "" "Returns an instance of the :class:`Filter` class. If *name* is specified, it " "names a logger which, together with its children, will have its events " @@ -1089,7 +1096,7 @@ msgid "" "event." msgstr "" -#: ../../library/logging.rst:828 +#: ../../library/logging.rst:831 msgid "" "Is the specified record to be logged? Returns false for no, true for yes. " "Filters can either modify log records in-place or return a completely " @@ -1097,7 +1104,7 @@ msgid "" "future processing of the event." msgstr "" -#: ../../library/logging.rst:833 +#: ../../library/logging.rst:836 msgid "" "Note that filters attached to handlers are consulted before an event is " "emitted by the handler, whereas filters attached to loggers are consulted " @@ -1107,13 +1114,13 @@ msgid "" "setting, unless the filter has also been applied to those descendant loggers." msgstr "" -#: ../../library/logging.rst:840 +#: ../../library/logging.rst:843 msgid "" "You don't actually need to subclass ``Filter``: you can pass any instance " "which has a ``filter`` method with the same semantics." msgstr "" -#: ../../library/logging.rst:843 +#: ../../library/logging.rst:846 msgid "" "You don't need to create specialized ``Filter`` classes, or use other " "classes with a ``filter`` method: you can use a function (or other callable) " @@ -1124,7 +1131,7 @@ msgid "" "value should conform to that returned by :meth:`~Filter.filter`." msgstr "" -#: ../../library/logging.rst:853 +#: ../../library/logging.rst:856 msgid "" "You can now return a :class:`LogRecord` instance from filters to replace the " "log record rather than modifying it in place. This allows filters attached " @@ -1132,7 +1139,7 @@ msgid "" "having side effects on other handlers." msgstr "" -#: ../../library/logging.rst:859 +#: ../../library/logging.rst:862 msgid "" "Although filters are used primarily to filter records based on more " "sophisticated criteria than levels, they get to see every record which is " @@ -1144,11 +1151,11 @@ msgid "" "contextual information into logs (see :ref:`filters-contextual`)." msgstr "" -#: ../../library/logging.rst:872 +#: ../../library/logging.rst:875 msgid "LogRecord Objects" msgstr "LogRecord 物件" -#: ../../library/logging.rst:874 +#: ../../library/logging.rst:877 msgid "" ":class:`LogRecord` instances are created automatically by the :class:" "`Logger` every time something is logged, and can be created manually via :" @@ -1156,17 +1163,17 @@ msgid "" "wire)." msgstr "" -#: ../../library/logging.rst:882 +#: ../../library/logging.rst:885 msgid "Contains all the information pertinent to the event being logged." msgstr "" -#: ../../library/logging.rst:884 +#: ../../library/logging.rst:887 msgid "" "The primary information is passed in *msg* and *args*, which are combined " "using ``msg % args`` to create the :attr:`!message` attribute of the record." msgstr "" -#: ../../library/logging.rst:888 +#: ../../library/logging.rst:891 msgid "" "The name of the logger used to log the event represented by this :class:`!" "LogRecord`. Note that the logger name in the :class:`!LogRecord` will always " @@ -1174,7 +1181,7 @@ msgid "" "different (ancestor) logger." msgstr "" -#: ../../library/logging.rst:896 +#: ../../library/logging.rst:899 msgid "" "The :ref:`numeric level ` of the logging event (such as ``10`` for " "``DEBUG``, ``20`` for ``INFO``, etc). Note that this is converted to *two* " @@ -1182,46 +1189,46 @@ msgid "" "attr:`!levelname` for the corresponding level name." msgstr "" -#: ../../library/logging.rst:903 +#: ../../library/logging.rst:906 msgid "" "The full string path of the source file where the logging call was made." msgstr "" -#: ../../library/logging.rst:907 +#: ../../library/logging.rst:910 msgid "The line number in the source file where the logging call was made." msgstr "" -#: ../../library/logging.rst:911 +#: ../../library/logging.rst:914 msgid "" "The event description message, which can be a %-format string with " "placeholders for variable data, or an arbitrary object (see :ref:`arbitrary-" "object-messages`)." msgstr "" -#: ../../library/logging.rst:916 +#: ../../library/logging.rst:919 msgid "" "Variable data to merge into the *msg* argument to obtain the event " "description." msgstr "" -#: ../../library/logging.rst:920 +#: ../../library/logging.rst:923 msgid "" "An exception tuple with the current exception information, as returned by :" "func:`sys.exc_info`, or ``None`` if no exception information is available." msgstr "" -#: ../../library/logging.rst:925 +#: ../../library/logging.rst:928 msgid "" "The name of the function or method from which the logging call was invoked." msgstr "" -#: ../../library/logging.rst:929 +#: ../../library/logging.rst:932 msgid "" "A text string representing stack information from the base of the stack in " "the current thread, up to the logging call." msgstr "" -#: ../../library/logging.rst:936 +#: ../../library/logging.rst:939 msgid "" "Returns the message for this :class:`LogRecord` instance after merging any " "user-supplied arguments with the message. If the user-supplied message " @@ -1230,7 +1237,7 @@ msgid "" "whose ``__str__`` method can return the actual format string to be used." msgstr "" -#: ../../library/logging.rst:943 +#: ../../library/logging.rst:946 msgid "" "The creation of a :class:`LogRecord` has been made more configurable by " "providing a factory which is used to create the record. The factory can be " @@ -1238,13 +1245,13 @@ msgid "" "this for the factory's signature)." msgstr "" -#: ../../library/logging.rst:949 +#: ../../library/logging.rst:952 msgid "" "This functionality can be used to inject your own values into a :class:" "`LogRecord` at creation time. You can use the following pattern::" msgstr "" -#: ../../library/logging.rst:952 +#: ../../library/logging.rst:955 msgid "" "old_factory = logging.getLogRecordFactory()\n" "\n" @@ -1264,18 +1271,18 @@ msgstr "" "\n" "logging.setLogRecordFactory(record_factory)" -#: ../../library/logging.rst:961 +#: ../../library/logging.rst:964 msgid "" "With this pattern, multiple factories could be chained, and as long as they " "don't overwrite each other's attributes or unintentionally overwrite the " "standard attributes listed above, there should be no surprises." msgstr "" -#: ../../library/logging.rst:970 +#: ../../library/logging.rst:973 msgid "LogRecord attributes" msgstr "LogRecord 屬性" -#: ../../library/logging.rst:972 +#: ../../library/logging.rst:975 msgid "" "The LogRecord has a number of attributes, most of which are derived from the " "parameters to the constructor. (Note that the names do not always correspond " @@ -1286,7 +1293,7 @@ msgid "" "style format string." msgstr "" -#: ../../library/logging.rst:980 +#: ../../library/logging.rst:983 msgid "" "If you are using {}-formatting (:func:`str.format`), you can use ``{attrname}" "`` as the placeholder in the format string. If you are using $-formatting (:" @@ -1294,7 +1301,7 @@ msgid "" "course, replace ``attrname`` with the actual attribute name you want to use." msgstr "" -#: ../../library/logging.rst:986 +#: ../../library/logging.rst:989 msgid "" "In the case of {}-formatting, you can specify formatting flags by placing " "them after the attribute name, separated from it with a colon. For example: " @@ -1303,318 +1310,318 @@ msgid "" "on the options available to you." msgstr "" -#: ../../library/logging.rst:993 +#: ../../library/logging.rst:996 msgid "Attribute name" msgstr "屬性名稱" -#: ../../library/logging.rst:993 ../../library/logging.rst:1363 +#: ../../library/logging.rst:996 ../../library/logging.rst:1366 msgid "Format" msgstr "格式" -#: ../../library/logging.rst:993 ../../library/logging.rst:1363 +#: ../../library/logging.rst:996 ../../library/logging.rst:1366 msgid "Description" msgstr "描述" -#: ../../library/logging.rst:0 ../../library/logging.rst:995 +#: ../../library/logging.rst:0 ../../library/logging.rst:998 msgid "args" msgstr "args" -#: ../../library/logging.rst:995 ../../library/logging.rst:1009 -#: ../../library/logging.rst:1037 ../../library/logging.rst:1055 +#: ../../library/logging.rst:998 ../../library/logging.rst:1012 +#: ../../library/logging.rst:1040 ../../library/logging.rst:1058 msgid "You shouldn't need to format this yourself." msgstr "你不應該需要自己格式化它。" -#: ../../library/logging.rst:995 +#: ../../library/logging.rst:998 msgid "" "The tuple of arguments merged into ``msg`` to produce ``message``, or a dict " "whose values are used for the merge (when there is only one argument, and it " "is a dictionary)." msgstr "" -#: ../../library/logging.rst:1000 +#: ../../library/logging.rst:1003 msgid "asctime" msgstr "asctime" -#: ../../library/logging.rst:1000 +#: ../../library/logging.rst:1003 msgid "``%(asctime)s``" msgstr "``%(asctime)s``" -#: ../../library/logging.rst:1000 +#: ../../library/logging.rst:1003 msgid "" "Human-readable time when the :class:`LogRecord` was created. By default " "this is of the form '2003-07-08 16:49:45,896' (the numbers after the comma " "are millisecond portion of the time)." msgstr "" -#: ../../library/logging.rst:1006 +#: ../../library/logging.rst:1009 msgid "created" msgstr "created" -#: ../../library/logging.rst:1006 +#: ../../library/logging.rst:1009 msgid "``%(created)f``" msgstr "``%(created)f``" -#: ../../library/logging.rst:1006 +#: ../../library/logging.rst:1009 msgid "" "Time when the :class:`LogRecord` was created (as returned by :func:`time." "time_ns` / 1e9)." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1009 +#: ../../library/logging.rst:0 ../../library/logging.rst:1012 msgid "exc_info" msgstr "exc_info" -#: ../../library/logging.rst:1009 +#: ../../library/logging.rst:1012 msgid "" "Exception tuple (à la ``sys.exc_info``) or, if no exception has occurred, " "``None``." msgstr "" -#: ../../library/logging.rst:1012 +#: ../../library/logging.rst:1015 msgid "filename" msgstr "filename" -#: ../../library/logging.rst:1012 +#: ../../library/logging.rst:1015 msgid "``%(filename)s``" msgstr "``%(filename)s``" -#: ../../library/logging.rst:1012 +#: ../../library/logging.rst:1015 msgid "Filename portion of ``pathname``." msgstr "``pathname`` 的檔案名稱部分。" -#: ../../library/logging.rst:1014 +#: ../../library/logging.rst:1017 msgid "funcName" msgstr "funcName" -#: ../../library/logging.rst:1014 +#: ../../library/logging.rst:1017 msgid "``%(funcName)s``" msgstr "``%(funcName)s``" -#: ../../library/logging.rst:1014 +#: ../../library/logging.rst:1017 msgid "Name of function containing the logging call." msgstr "" -#: ../../library/logging.rst:1016 +#: ../../library/logging.rst:1019 msgid "levelname" msgstr "levelname" -#: ../../library/logging.rst:1016 +#: ../../library/logging.rst:1019 msgid "``%(levelname)s``" msgstr "``%(levelname)s``" -#: ../../library/logging.rst:1016 +#: ../../library/logging.rst:1019 msgid "" "Text logging level for the message (``'DEBUG'``, ``'INFO'``, ``'WARNING'``, " "``'ERROR'``, ``'CRITICAL'``)." msgstr "" -#: ../../library/logging.rst:1020 +#: ../../library/logging.rst:1023 msgid "levelno" msgstr "levelno" -#: ../../library/logging.rst:1020 +#: ../../library/logging.rst:1023 msgid "``%(levelno)s``" msgstr "``%(levelno)s``" -#: ../../library/logging.rst:1020 +#: ../../library/logging.rst:1023 msgid "" "Numeric logging level for the message (:const:`DEBUG`, :const:`INFO`, :const:" "`WARNING`, :const:`ERROR`, :const:`CRITICAL`)." msgstr "" -#: ../../library/logging.rst:1025 +#: ../../library/logging.rst:1028 msgid "lineno" msgstr "lineno" -#: ../../library/logging.rst:1025 +#: ../../library/logging.rst:1028 msgid "``%(lineno)d``" msgstr "``%(lineno)d``" -#: ../../library/logging.rst:1025 +#: ../../library/logging.rst:1028 msgid "Source line number where the logging call was issued (if available)." msgstr "" -#: ../../library/logging.rst:1028 +#: ../../library/logging.rst:1031 msgid "message" msgstr "message" -#: ../../library/logging.rst:1028 +#: ../../library/logging.rst:1031 msgid "``%(message)s``" msgstr "``%(message)s``" -#: ../../library/logging.rst:1028 +#: ../../library/logging.rst:1031 msgid "" "The logged message, computed as ``msg % args``. This is set when :meth:" "`Formatter.format` is invoked." msgstr "" -#: ../../library/logging.rst:1032 +#: ../../library/logging.rst:1035 msgid "module" msgstr "模組" -#: ../../library/logging.rst:1032 +#: ../../library/logging.rst:1035 msgid "``%(module)s``" msgstr "``%(module)s``" -#: ../../library/logging.rst:1032 +#: ../../library/logging.rst:1035 msgid "Module (name portion of ``filename``)." msgstr "模組(``filename`` 的名稱部分)。" -#: ../../library/logging.rst:1034 +#: ../../library/logging.rst:1037 msgid "msecs" msgstr "msecs" -#: ../../library/logging.rst:1034 +#: ../../library/logging.rst:1037 msgid "``%(msecs)d``" msgstr "``%(msecs)d``" -#: ../../library/logging.rst:1034 +#: ../../library/logging.rst:1037 msgid "" "Millisecond portion of the time when the :class:`LogRecord` was created." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1037 +#: ../../library/logging.rst:0 ../../library/logging.rst:1040 msgid "msg" msgstr "msg" -#: ../../library/logging.rst:1037 +#: ../../library/logging.rst:1040 msgid "" "The format string passed in the original logging call. Merged with ``args`` " "to produce ``message``, or an arbitrary object (see :ref:`arbitrary-object-" "messages`)." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1042 +#: ../../library/logging.rst:0 ../../library/logging.rst:1045 msgid "name" msgstr "name" -#: ../../library/logging.rst:1042 +#: ../../library/logging.rst:1045 msgid "``%(name)s``" msgstr "``%(name)s``" -#: ../../library/logging.rst:1042 +#: ../../library/logging.rst:1045 msgid "Name of the logger used to log the call." msgstr "" -#: ../../library/logging.rst:1044 +#: ../../library/logging.rst:1047 msgid "pathname" msgstr "pathname" -#: ../../library/logging.rst:1044 +#: ../../library/logging.rst:1047 msgid "``%(pathname)s``" msgstr "``%(pathname)s``" -#: ../../library/logging.rst:1044 +#: ../../library/logging.rst:1047 msgid "" "Full pathname of the source file where the logging call was issued (if " "available)." msgstr "" -#: ../../library/logging.rst:1047 +#: ../../library/logging.rst:1050 msgid "process" msgstr "process" -#: ../../library/logging.rst:1047 +#: ../../library/logging.rst:1050 msgid "``%(process)d``" msgstr "``%(process)d``" -#: ../../library/logging.rst:1047 +#: ../../library/logging.rst:1050 msgid "Process ID (if available)." msgstr "行程 ID(如果可用)。" -#: ../../library/logging.rst:1049 +#: ../../library/logging.rst:1052 msgid "processName" msgstr "processName" -#: ../../library/logging.rst:1049 +#: ../../library/logging.rst:1052 msgid "``%(processName)s``" msgstr "``%(processName)s``" -#: ../../library/logging.rst:1049 +#: ../../library/logging.rst:1052 msgid "Process name (if available)." msgstr "行程名稱(如果可用)。" -#: ../../library/logging.rst:1051 +#: ../../library/logging.rst:1054 msgid "relativeCreated" msgstr "relativeCreated" -#: ../../library/logging.rst:1051 +#: ../../library/logging.rst:1054 msgid "``%(relativeCreated)d``" msgstr "``%(relativeCreated)d``" -#: ../../library/logging.rst:1051 +#: ../../library/logging.rst:1054 msgid "" "Time in milliseconds when the LogRecord was created, relative to the time " "the logging module was loaded." msgstr "" -#: ../../library/logging.rst:1055 +#: ../../library/logging.rst:1058 msgid "stack_info" msgstr "stack_info" -#: ../../library/logging.rst:1055 +#: ../../library/logging.rst:1058 msgid "" "Stack frame information (where available) from the bottom of the stack in " "the current thread, up to and including the stack frame of the logging call " "which resulted in the creation of this record." msgstr "" -#: ../../library/logging.rst:1061 +#: ../../library/logging.rst:1064 msgid "thread" msgstr "thread" -#: ../../library/logging.rst:1061 +#: ../../library/logging.rst:1064 msgid "``%(thread)d``" msgstr "``%(thread)d``" -#: ../../library/logging.rst:1061 +#: ../../library/logging.rst:1064 msgid "Thread ID (if available)." msgstr "執行緒 ID(如果可用)。" -#: ../../library/logging.rst:1063 +#: ../../library/logging.rst:1066 msgid "threadName" msgstr "threadName" -#: ../../library/logging.rst:1063 +#: ../../library/logging.rst:1066 msgid "``%(threadName)s``" msgstr "``%(threadName)s``" -#: ../../library/logging.rst:1063 +#: ../../library/logging.rst:1066 msgid "Thread name (if available)." msgstr "" -#: ../../library/logging.rst:1065 +#: ../../library/logging.rst:1068 msgid "taskName" msgstr "taskName" -#: ../../library/logging.rst:1065 +#: ../../library/logging.rst:1068 msgid "``%(taskName)s``" msgstr "``%(taskName)s``" -#: ../../library/logging.rst:1065 +#: ../../library/logging.rst:1068 msgid ":class:`asyncio.Task` name (if available)." msgstr "" -#: ../../library/logging.rst:1068 +#: ../../library/logging.rst:1071 msgid "*processName* was added." msgstr "新增 *processName*。" -#: ../../library/logging.rst:1071 +#: ../../library/logging.rst:1074 msgid "*taskName* was added." msgstr "新增 *taskName*。" -#: ../../library/logging.rst:1077 +#: ../../library/logging.rst:1080 msgid "LoggerAdapter Objects" msgstr "LoggerAdapter 物件" -#: ../../library/logging.rst:1079 +#: ../../library/logging.rst:1082 msgid "" ":class:`LoggerAdapter` instances are used to conveniently pass contextual " "information into logging calls. For a usage example, see the section on :ref:" "`adding contextual information to your logging output `." msgstr "" -#: ../../library/logging.rst:1085 +#: ../../library/logging.rst:1088 msgid "" "Returns an instance of :class:`LoggerAdapter` initialized with an " "underlying :class:`Logger` instance, a dict-like object (*extra*), and a " @@ -1624,7 +1631,7 @@ msgid "" "calls and only use the one of the :class:`LoggerAdapter` instance" msgstr "" -#: ../../library/logging.rst:1094 +#: ../../library/logging.rst:1097 msgid "" "Modifies the message and/or keyword arguments passed to a logging call in " "order to insert contextual information. This implementation takes the object " @@ -1633,15 +1640,15 @@ msgid "" "(possibly modified) versions of the arguments passed in." msgstr "" -#: ../../library/logging.rst:1102 +#: ../../library/logging.rst:1105 msgid "Delegates to the underlying :attr:`!manager` on *logger*." msgstr "" -#: ../../library/logging.rst:1106 +#: ../../library/logging.rst:1109 msgid "Delegates to the underlying :meth:`!_log` method on *logger*." msgstr "" -#: ../../library/logging.rst:1108 +#: ../../library/logging.rst:1111 msgid "" "In addition to the above, :class:`LoggerAdapter` supports the following " "methods of :class:`Logger`: :meth:`~Logger.debug`, :meth:`~Logger.info`, :" @@ -1653,28 +1660,28 @@ msgid "" "interchangeably." msgstr "" -#: ../../library/logging.rst:1119 +#: ../../library/logging.rst:1122 msgid "" "The :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`, :meth:" "`~Logger.setLevel` and :meth:`~Logger.hasHandlers` methods were added to :" "class:`LoggerAdapter`. These methods delegate to the underlying logger." msgstr "" -#: ../../library/logging.rst:1125 +#: ../../library/logging.rst:1128 msgid "" "Attribute :attr:`!manager` and method :meth:`!_log` were added, which " "delegate to the underlying logger and allow adapters to be nested." msgstr "" -#: ../../library/logging.rst:1130 +#: ../../library/logging.rst:1133 msgid "The *merge_extra* argument was added." msgstr "新增 *merge_extra* 引數。" -#: ../../library/logging.rst:1134 +#: ../../library/logging.rst:1137 msgid "Thread Safety" msgstr "執行緒安全" -#: ../../library/logging.rst:1136 +#: ../../library/logging.rst:1139 msgid "" "The logging module is intended to be thread-safe without any special work " "needing to be done by its clients. It achieves this though using threading " @@ -1683,7 +1690,7 @@ msgid "" "O." msgstr "" -#: ../../library/logging.rst:1141 +#: ../../library/logging.rst:1144 msgid "" "If you are implementing asynchronous signal handlers using the :mod:`signal` " "module, you may not be able to use logging from within such handlers. This " @@ -1691,17 +1698,17 @@ msgid "" "always re-entrant, and so cannot be invoked from such signal handlers." msgstr "" -#: ../../library/logging.rst:1148 +#: ../../library/logging.rst:1151 msgid "Module-Level Functions" msgstr "模組層級函式" -#: ../../library/logging.rst:1150 +#: ../../library/logging.rst:1153 msgid "" "In addition to the classes described above, there are a number of module-" "level functions." msgstr "" -#: ../../library/logging.rst:1156 +#: ../../library/logging.rst:1159 msgid "" "Return a logger with the specified name or, if name is ``None``, return the " "root logger of the hierarchy. If specified, the name is typically a dot-" @@ -1711,14 +1718,14 @@ msgid "" "for not doing that, as mentioned in :ref:`logger`." msgstr "" -#: ../../library/logging.rst:1163 +#: ../../library/logging.rst:1166 msgid "" "All calls to this function with a given name return the same logger " "instance. This means that logger instances never need to be passed between " "different parts of an application." msgstr "" -#: ../../library/logging.rst:1170 +#: ../../library/logging.rst:1173 msgid "" "Return either the standard :class:`Logger` class, or the last class passed " "to :func:`setLoggerClass`. This function may be called from within a new " @@ -1727,7 +1734,7 @@ msgid "" "example::" msgstr "" -#: ../../library/logging.rst:1175 +#: ../../library/logging.rst:1178 msgid "" "class MyLogger(logging.getLoggerClass()):\n" " # ... override behaviour here" @@ -1735,37 +1742,37 @@ msgstr "" "class MyLogger(logging.getLoggerClass()):\n" " # ... 在這裡覆蓋其行為" -#: ../../library/logging.rst:1181 +#: ../../library/logging.rst:1184 msgid "Return a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1183 +#: ../../library/logging.rst:1186 msgid "" "This function has been provided, along with :func:`setLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1188 +#: ../../library/logging.rst:1191 msgid "" "See :func:`setLogRecordFactory` for more information about the how the " "factory is called." msgstr "" -#: ../../library/logging.rst:1193 +#: ../../library/logging.rst:1196 msgid "" "This is a convenience function that calls :meth:`Logger.debug`, on the root " "logger. The handling of the arguments is in every way identical to what is " "described in that method." msgstr "" -#: ../../library/logging.rst:1197 +#: ../../library/logging.rst:1200 msgid "" "The only difference is that if the root logger has no handlers, then :func:" "`basicConfig` is called, prior to calling ``debug`` on the root logger." msgstr "" -#: ../../library/logging.rst:1200 +#: ../../library/logging.rst:1203 msgid "" "For very short scripts or quick demonstrations of ``logging`` facilities, " "``debug`` and the other module-level functions may be convenient. However, " @@ -1775,38 +1782,38 @@ msgid "" "described at the beginnning of this documentation." msgstr "" -#: ../../library/logging.rst:1210 +#: ../../library/logging.rst:1213 msgid "" "Logs a message with level :const:`INFO` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1216 +#: ../../library/logging.rst:1219 msgid "" "Logs a message with level :const:`WARNING` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1219 +#: ../../library/logging.rst:1222 msgid "" "There is an obsolete function ``warn`` which is functionally identical to " "``warning``. As ``warn`` is deprecated, please do not use it - use " "``warning`` instead." msgstr "" -#: ../../library/logging.rst:1226 +#: ../../library/logging.rst:1229 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1232 +#: ../../library/logging.rst:1235 msgid "" "Logs a message with level :const:`CRITICAL` on the root logger. The " "arguments and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1238 +#: ../../library/logging.rst:1241 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`. Exception info is " @@ -1814,13 +1821,13 @@ msgid "" "exception handler." msgstr "" -#: ../../library/logging.rst:1244 +#: ../../library/logging.rst:1247 msgid "" "Logs a message with level *level* on the root logger. The arguments and " "behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1249 +#: ../../library/logging.rst:1252 msgid "" "Provides an overriding level *level* for all loggers which takes precedence " "over the logger's own level. When the need arises to temporarily throttle " @@ -1834,7 +1841,7 @@ msgid "" "individual loggers." msgstr "" -#: ../../library/logging.rst:1260 +#: ../../library/logging.rst:1263 msgid "" "Note that if you have defined any custom logging level higher than " "``CRITICAL`` (this is not recommended), you won't be able to rely on the " @@ -1842,13 +1849,13 @@ msgid "" "a suitable value." msgstr "" -#: ../../library/logging.rst:1265 +#: ../../library/logging.rst:1268 msgid "" "The *level* parameter was defaulted to level ``CRITICAL``. See :issue:" "`28524` for more information about this change." msgstr "" -#: ../../library/logging.rst:1271 +#: ../../library/logging.rst:1274 msgid "" "Associates level *level* with text *levelName* in an internal dictionary, " "which is used to map numeric levels to a textual representation, for example " @@ -1858,24 +1865,24 @@ msgid "" "and they should increase in increasing order of severity." msgstr "" -#: ../../library/logging.rst:1278 +#: ../../library/logging.rst:1281 msgid "" "If you are thinking of defining your own levels, please see the section on :" "ref:`custom-levels`." msgstr "" -#: ../../library/logging.rst:1283 +#: ../../library/logging.rst:1286 msgid "" "Returns a mapping from level names to their corresponding logging levels. " "For example, the string \"CRITICAL\" maps to :const:`CRITICAL`. The returned " "mapping is copied from an internal mapping on each call to this function." msgstr "" -#: ../../library/logging.rst:1291 +#: ../../library/logging.rst:1294 msgid "Returns the textual or numeric representation of logging level *level*." msgstr "" -#: ../../library/logging.rst:1293 +#: ../../library/logging.rst:1296 msgid "" "If *level* is one of the predefined levels :const:`CRITICAL`, :const:" "`ERROR`, :const:`WARNING`, :const:`INFO` or :const:`DEBUG` then you get the " @@ -1885,20 +1892,20 @@ msgid "" "the corresponding string representation is returned." msgstr "" -#: ../../library/logging.rst:1300 +#: ../../library/logging.rst:1303 msgid "" "The *level* parameter also accepts a string representation of the level such " "as 'INFO'. In such cases, this functions returns the corresponding numeric " "value of the level." msgstr "" -#: ../../library/logging.rst:1304 +#: ../../library/logging.rst:1307 msgid "" "If no matching numeric or string value is passed in, the string 'Level %s' % " "level is returned." msgstr "" -#: ../../library/logging.rst:1307 +#: ../../library/logging.rst:1310 msgid "" "Levels are internally integers (as they need to be compared in the logging " "logic). This function is used to convert between an integer level and the " @@ -1907,7 +1914,7 @@ msgid "" "vice versa." msgstr "" -#: ../../library/logging.rst:1313 +#: ../../library/logging.rst:1316 msgid "" "In Python versions earlier than 3.4, this function could also be passed a " "text level, and would return the corresponding numeric value of the level. " @@ -1915,17 +1922,17 @@ msgid "" "Python 3.4, but reinstated in 3.4.2 due to retain backward compatibility." msgstr "" -#: ../../library/logging.rst:1321 +#: ../../library/logging.rst:1324 msgid "" "Returns a handler with the specified *name*, or ``None`` if there is no " "handler with that name." msgstr "" -#: ../../library/logging.rst:1328 +#: ../../library/logging.rst:1331 msgid "Returns an immutable set of all known handler names." msgstr "" -#: ../../library/logging.rst:1334 +#: ../../library/logging.rst:1337 msgid "" "Creates and returns a new :class:`LogRecord` instance whose attributes are " "defined by *attrdict*. This function is useful for taking a pickled :class:" @@ -1933,7 +1940,7 @@ msgid "" "as a :class:`LogRecord` instance at the receiving end." msgstr "" -#: ../../library/logging.rst:1342 +#: ../../library/logging.rst:1345 msgid "" "Does basic configuration for the logging system by creating a :class:" "`StreamHandler` with a default :class:`Formatter` and adding it to the root " @@ -1942,13 +1949,13 @@ msgid "" "no handlers are defined for the root logger." msgstr "" -#: ../../library/logging.rst:1348 +#: ../../library/logging.rst:1351 msgid "" "This function does nothing if the root logger already has handlers " "configured, unless the keyword argument *force* is set to ``True``." msgstr "" -#: ../../library/logging.rst:1351 +#: ../../library/logging.rst:1354 msgid "" "This function should be called from the main thread before other threads are " "started. In versions of Python prior to 2.7.1 and 3.2, if this function is " @@ -1957,54 +1964,54 @@ msgid "" "unexpected results such as messages being duplicated in the log." msgstr "" -#: ../../library/logging.rst:1358 +#: ../../library/logging.rst:1361 msgid "The following keyword arguments are supported." msgstr "支援以下的關鍵字引數。" -#: ../../library/logging.rst:1365 +#: ../../library/logging.rst:1368 msgid "*filename*" msgstr "*filename*" -#: ../../library/logging.rst:1365 +#: ../../library/logging.rst:1368 msgid "" "Specifies that a :class:`FileHandler` be created, using the specified " "filename, rather than a :class:`StreamHandler`." msgstr "" -#: ../../library/logging.rst:1369 +#: ../../library/logging.rst:1372 msgid "*filemode*" msgstr "*filemode*" -#: ../../library/logging.rst:1369 +#: ../../library/logging.rst:1372 msgid "" "If *filename* is specified, open the file in this :ref:`mode `. " "Defaults to ``'a'``." msgstr "" -#: ../../library/logging.rst:1373 +#: ../../library/logging.rst:1376 msgid "*format*" msgstr "*format*" -#: ../../library/logging.rst:1373 +#: ../../library/logging.rst:1376 msgid "" "Use the specified format string for the handler. Defaults to attributes " "``levelname``, ``name`` and ``message`` separated by colons." msgstr "" -#: ../../library/logging.rst:1378 +#: ../../library/logging.rst:1381 msgid "*datefmt*" msgstr "*datefmt*" -#: ../../library/logging.rst:1378 +#: ../../library/logging.rst:1381 msgid "" "Use the specified date/time format, as accepted by :func:`time.strftime`." msgstr "" -#: ../../library/logging.rst:1381 +#: ../../library/logging.rst:1384 msgid "*style*" msgstr "*style*" -#: ../../library/logging.rst:1381 +#: ../../library/logging.rst:1384 msgid "" "If *format* is specified, use this style for the format string. One of " "``'%'``, ``'{'`` or ``'$'`` for :ref:`printf-style `." msgstr "" -#: ../../library/logging.rst:1392 +#: ../../library/logging.rst:1395 msgid "*stream*" msgstr "*stream*" -#: ../../library/logging.rst:1392 +#: ../../library/logging.rst:1395 msgid "" "Use the specified stream to initialize the :class:`StreamHandler`. Note that " "this argument is incompatible with *filename* - if both are present, a " "``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1398 +#: ../../library/logging.rst:1401 msgid "*handlers*" msgstr "*handlers*" -#: ../../library/logging.rst:1398 +#: ../../library/logging.rst:1401 msgid "" "If specified, this should be an iterable of already created handlers to add " "to the root logger. Any handlers which don't already have a formatter set " @@ -2044,33 +2051,33 @@ msgid "" "present, a ``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1407 +#: ../../library/logging.rst:1410 msgid "*force*" msgstr "*force*" -#: ../../library/logging.rst:1407 +#: ../../library/logging.rst:1410 msgid "" "If this keyword argument is specified as true, any existing handlers " "attached to the root logger are removed and closed, before carrying out the " "configuration as specified by the other arguments." msgstr "" -#: ../../library/logging.rst:1413 +#: ../../library/logging.rst:1416 msgid "*encoding*" msgstr "*encoding*" -#: ../../library/logging.rst:1413 +#: ../../library/logging.rst:1416 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " "the output file." msgstr "" -#: ../../library/logging.rst:1418 +#: ../../library/logging.rst:1421 msgid "*errors*" msgstr "*errors*" -#: ../../library/logging.rst:1418 +#: ../../library/logging.rst:1421 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " @@ -2079,39 +2086,39 @@ msgid "" "`open`, which means that it will be treated the same as passing 'errors'." msgstr "" -#: ../../library/logging.rst:1429 +#: ../../library/logging.rst:1432 msgid "The *style* argument was added." msgstr "新增 *style* 引數。" -#: ../../library/logging.rst:1432 +#: ../../library/logging.rst:1435 msgid "" "The *handlers* argument was added. Additional checks were added to catch " "situations where incompatible arguments are specified (e.g. *handlers* " "together with *stream* or *filename*, or *stream* together with *filename*)." msgstr "" -#: ../../library/logging.rst:1438 +#: ../../library/logging.rst:1441 msgid "The *force* argument was added." msgstr "新增 *force* 引數。" -#: ../../library/logging.rst:1441 +#: ../../library/logging.rst:1444 msgid "The *encoding* and *errors* arguments were added." msgstr "新增 *encoding* 與 *errors* 引數。" -#: ../../library/logging.rst:1446 +#: ../../library/logging.rst:1449 msgid "" "Informs the logging system to perform an orderly shutdown by flushing and " "closing all handlers. This should be called at application exit and no " "further use of the logging system should be made after this call." msgstr "" -#: ../../library/logging.rst:1450 +#: ../../library/logging.rst:1453 msgid "" "When the logging module is imported, it registers this function as an exit " "handler (see :mod:`atexit`), so normally there's no need to do that manually." msgstr "" -#: ../../library/logging.rst:1457 +#: ../../library/logging.rst:1460 msgid "" "Tells the logging system to use the class *klass* when instantiating a " "logger. The class should define :meth:`!__init__` such that only a name " @@ -2123,32 +2130,32 @@ msgid "" "loggers." msgstr "" -#: ../../library/logging.rst:1468 +#: ../../library/logging.rst:1471 msgid "Set a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1470 +#: ../../library/logging.rst:1473 msgid "The factory callable to be used to instantiate a log record." msgstr "" -#: ../../library/logging.rst:1472 +#: ../../library/logging.rst:1475 msgid "" "This function has been provided, along with :func:`getLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1477 +#: ../../library/logging.rst:1480 msgid "The factory has the following signature:" msgstr "" -#: ../../library/logging.rst:1479 +#: ../../library/logging.rst:1482 msgid "" "``factory(name, level, fn, lno, msg, args, exc_info, func=None, sinfo=None, " "**kwargs)``" msgstr "" -#: ../../library/logging.rst:1481 +#: ../../library/logging.rst:1484 msgid "The logger name." msgstr "" @@ -2156,7 +2163,7 @@ msgstr "" msgid "level" msgstr "" -#: ../../library/logging.rst:1482 +#: ../../library/logging.rst:1485 msgid "The logging level (numeric)." msgstr "" @@ -2164,7 +2171,7 @@ msgstr "" msgid "fn" msgstr "fn" -#: ../../library/logging.rst:1483 +#: ../../library/logging.rst:1486 msgid "The full pathname of the file where the logging call was made." msgstr "" @@ -2172,19 +2179,19 @@ msgstr "" msgid "lno" msgstr "lno" -#: ../../library/logging.rst:1484 +#: ../../library/logging.rst:1487 msgid "The line number in the file where the logging call was made." msgstr "" -#: ../../library/logging.rst:1485 +#: ../../library/logging.rst:1488 msgid "The logging message." msgstr "" -#: ../../library/logging.rst:1486 +#: ../../library/logging.rst:1489 msgid "The arguments for the logging message." msgstr "" -#: ../../library/logging.rst:1487 +#: ../../library/logging.rst:1490 msgid "An exception tuple, or ``None``." msgstr "" @@ -2192,7 +2199,7 @@ msgstr "" msgid "func" msgstr "func" -#: ../../library/logging.rst:1488 +#: ../../library/logging.rst:1491 msgid "The name of the function or method which invoked the logging call." msgstr "" @@ -2200,7 +2207,7 @@ msgstr "" msgid "sinfo" msgstr "sinfo" -#: ../../library/logging.rst:1490 +#: ../../library/logging.rst:1493 msgid "" "A stack traceback such as is provided by :func:`traceback.print_stack`, " "showing the call hierarchy." @@ -2210,15 +2217,15 @@ msgstr "" msgid "kwargs" msgstr "kwargs" -#: ../../library/logging.rst:1492 +#: ../../library/logging.rst:1495 msgid "Additional keyword arguments." msgstr "額外的關鍵字引數。" -#: ../../library/logging.rst:1496 +#: ../../library/logging.rst:1499 msgid "Module-Level Attributes" msgstr "模組層級屬性" -#: ../../library/logging.rst:1500 +#: ../../library/logging.rst:1503 msgid "" "A \"handler of last resort\" is available through this attribute. This is a :" "class:`StreamHandler` writing to ``sys.stderr`` with a level of ``WARNING``, " @@ -2229,15 +2236,15 @@ msgid "" "reason, ``lastResort`` can be set to ``None``." msgstr "" -#: ../../library/logging.rst:1512 +#: ../../library/logging.rst:1515 msgid "Used to see if exceptions during handling should be propagated." msgstr "" -#: ../../library/logging.rst:1514 +#: ../../library/logging.rst:1517 msgid "Default: ``True``." msgstr "" -#: ../../library/logging.rst:1516 +#: ../../library/logging.rst:1519 msgid "" "If :data:`raiseExceptions` is ``False``, exceptions get silently ignored. " "This is what is mostly wanted for a logging system - most users will not " @@ -2245,22 +2252,22 @@ msgid "" "application errors." msgstr "" -#: ../../library/logging.rst:1523 +#: ../../library/logging.rst:1526 msgid "Integration with the warnings module" msgstr "" -#: ../../library/logging.rst:1525 +#: ../../library/logging.rst:1528 msgid "" "The :func:`captureWarnings` function can be used to integrate :mod:`logging` " "with the :mod:`warnings` module." msgstr "" -#: ../../library/logging.rst:1530 +#: ../../library/logging.rst:1533 msgid "" "This function is used to turn the capture of warnings by logging on and off." msgstr "" -#: ../../library/logging.rst:1533 +#: ../../library/logging.rst:1536 msgid "" "If *capture* is ``True``, warnings issued by the :mod:`warnings` module will " "be redirected to the logging system. Specifically, a warning will be " @@ -2269,46 +2276,46 @@ msgid "" "`WARNING`." msgstr "" -#: ../../library/logging.rst:1538 +#: ../../library/logging.rst:1541 msgid "" "If *capture* is ``False``, the redirection of warnings to the logging system " "will stop, and warnings will be redirected to their original destinations (i." "e. those in effect before ``captureWarnings(True)`` was called)." msgstr "" -#: ../../library/logging.rst:1545 +#: ../../library/logging.rst:1548 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../library/logging.rst:1546 +#: ../../library/logging.rst:1549 msgid "Configuration API for the logging module." msgstr "" -#: ../../library/logging.rst:1548 +#: ../../library/logging.rst:1551 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../library/logging.rst:1549 +#: ../../library/logging.rst:1552 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../library/logging.rst:1551 +#: ../../library/logging.rst:1554 msgid ":pep:`282` - A Logging System" msgstr "" -#: ../../library/logging.rst:1552 +#: ../../library/logging.rst:1555 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "" -#: ../../library/logging.rst:1555 +#: ../../library/logging.rst:1558 msgid "" "`Original Python logging package `_" msgstr "" -#: ../../library/logging.rst:1556 +#: ../../library/logging.rst:1559 msgid "" "This is the original source for the :mod:`logging` package. The version of " "the package available from this site is suitable for use with Python 1.5.2, " diff --git a/library/mailbox.po b/library/mailbox.po index 5a8a09d14a..44c110bdc8 100644 --- a/library/mailbox.po +++ b/library/mailbox.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-24 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -426,7 +426,7 @@ msgid "" "addition to the following:" msgstr "" -#: ../../library/mailbox.rst:376 ../../library/mailbox.rst:654 +#: ../../library/mailbox.rst:376 ../../library/mailbox.rst:669 msgid "Return a list of the names of all folders." msgstr "" @@ -443,7 +443,7 @@ msgid "" "instance representing it." msgstr "" -#: ../../library/mailbox.rst:394 ../../library/mailbox.rst:672 +#: ../../library/mailbox.rst:394 ../../library/mailbox.rst:687 msgid "" "Delete the folder whose name is *folder*. If the folder contains any " "messages, a :exc:`NotEmptyError` exception will be raised and the folder " @@ -664,55 +664,64 @@ msgid "" "remarks:" msgstr "" -#: ../../library/mailbox.rst:592 +#: ../../library/mailbox.rst:592 ../../library/mailbox.rst:602 +#: ../../library/mailbox.rst:608 ../../library/mailbox.rst:871 +#: ../../library/mailbox.rst:881 +msgid "" +"Note: This method has an extra parameter (*from_*) compared with other " +"classes. The first line of an mbox file entry is the Unix \"From \" line. If " +"*from_* is False, the first line of the file is dropped." +msgstr "" + +#: ../../library/mailbox.rst:598 msgid "" "Using the file after calling :meth:`~Mailbox.flush` or :meth:`~Mailbox." "close` on the :class:`!mbox` instance may yield unpredictable results or " "raise an exception." msgstr "" -#: ../../library/mailbox.rst:600 ../../library/mailbox.rst:813 -#: ../../library/mailbox.rst:864 +#: ../../library/mailbox.rst:615 ../../library/mailbox.rst:828 +#: ../../library/mailbox.rst:889 msgid "" "Three locking mechanisms are used---dot locking and, if available, the :c:" "func:`!flock` and :c:func:`!lockf` system calls." msgstr "" -#: ../../library/mailbox.rst:606 +#: ../../library/mailbox.rst:621 msgid "" "`mbox man page from tin `_" msgstr "" -#: ../../library/mailbox.rst:607 +#: ../../library/mailbox.rst:622 msgid "A specification of the format, with details on locking." msgstr "" -#: ../../library/mailbox.rst:609 +#: ../../library/mailbox.rst:624 msgid "" "`Configuring Netscape Mail on Unix: Why The Content-Length Format is Bad " "`_" msgstr "" -#: ../../library/mailbox.rst:610 +#: ../../library/mailbox.rst:625 msgid "An argument for using the original mbox format rather than a variation." msgstr "" -#: ../../library/mailbox.rst:612 +#: ../../library/mailbox.rst:627 msgid "" "`\"mbox\" is a family of several mutually incompatible mailbox formats " "`_" msgstr "" -#: ../../library/mailbox.rst:613 +#: ../../library/mailbox.rst:628 msgid "A history of mbox variations." msgstr "" -#: ../../library/mailbox.rst:619 +#: ../../library/mailbox.rst:634 msgid ":class:`!MH` objects" msgstr ":class:`!MH` 物件" -#: ../../library/mailbox.rst:624 +#: ../../library/mailbox.rst:639 msgid "" "A subclass of :class:`Mailbox` for mailboxes in MH format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -722,7 +731,7 @@ msgid "" "is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:631 +#: ../../library/mailbox.rst:646 msgid "" "MH is a directory-based mailbox format invented for the MH Message Handling " "System, a mail user agent. Each message in an MH mailbox resides in its own " @@ -733,7 +742,7 @@ msgid "" "called :file:`.mh_sequences` in each folder." msgstr "" -#: ../../library/mailbox.rst:639 +#: ../../library/mailbox.rst:654 msgid "" "The :class:`!MH` class manipulates MH mailboxes, but it does not attempt to " "emulate all of :program:`mh`'s behaviors. In particular, it does not modify " @@ -741,67 +750,67 @@ msgid "" "are used by :program:`mh` to store its state and configuration." msgstr "" -#: ../../library/mailbox.rst:644 +#: ../../library/mailbox.rst:659 msgid "" ":class:`!MH` instances have all of the methods of :class:`Mailbox` in " "addition to the following:" msgstr "" -#: ../../library/mailbox.rst:649 +#: ../../library/mailbox.rst:664 msgid "Supported folders that don't contain a :file:`.mh_sequences` file." msgstr "" -#: ../../library/mailbox.rst:659 +#: ../../library/mailbox.rst:674 msgid "" "Return an :class:`!MH` instance representing the folder whose name is " "*folder*. A :exc:`NoSuchMailboxError` exception is raised if the folder does " "not exist." msgstr "" -#: ../../library/mailbox.rst:666 +#: ../../library/mailbox.rst:681 msgid "" "Create a folder whose name is *folder* and return an :class:`!MH` instance " "representing it." msgstr "" -#: ../../library/mailbox.rst:679 +#: ../../library/mailbox.rst:694 msgid "" "Return a dictionary of sequence names mapped to key lists. If there are no " "sequences, the empty dictionary is returned." msgstr "" -#: ../../library/mailbox.rst:685 +#: ../../library/mailbox.rst:700 msgid "" "Re-define the sequences that exist in the mailbox based upon *sequences*, a " "dictionary of names mapped to key lists, like returned by :meth:" "`get_sequences`." msgstr "" -#: ../../library/mailbox.rst:692 +#: ../../library/mailbox.rst:707 msgid "" "Rename messages in the mailbox as necessary to eliminate gaps in numbering. " "Entries in the sequences list are updated correspondingly." msgstr "" -#: ../../library/mailbox.rst:697 +#: ../../library/mailbox.rst:712 msgid "" "Already-issued keys are invalidated by this operation and should not be " "subsequently used." msgstr "" -#: ../../library/mailbox.rst:700 +#: ../../library/mailbox.rst:715 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!MH` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:708 +#: ../../library/mailbox.rst:723 msgid "" "These methods immediately delete the message. The MH convention of marking a " "message for deletion by prepending a comma to its name is not used." msgstr "" -#: ../../library/mailbox.rst:715 +#: ../../library/mailbox.rst:730 msgid "" "Three locking mechanisms are used---dot locking and, if available, the :c:" "func:`!flock` and :c:func:`!lockf` system calls. For MH mailboxes, locking " @@ -810,51 +819,51 @@ msgid "" "files." msgstr "" -#: ../../library/mailbox.rst:724 +#: ../../library/mailbox.rst:739 msgid "" "Depending upon the host platform, it may not be possible to remove the " "underlying message while the returned file remains open." msgstr "" -#: ../../library/mailbox.rst:730 +#: ../../library/mailbox.rst:745 msgid "" "All changes to MH mailboxes are immediately applied, so this method does " "nothing." msgstr "" -#: ../../library/mailbox.rst:736 +#: ../../library/mailbox.rst:751 msgid "" ":class:`!MH` instances do not keep any open files, so this method is " "equivalent to :meth:`unlock`." msgstr "" -#: ../../library/mailbox.rst:742 +#: ../../library/mailbox.rst:757 msgid "`nmh - Message Handling System `_" msgstr "" -#: ../../library/mailbox.rst:743 +#: ../../library/mailbox.rst:758 msgid "" "Home page of :program:`nmh`, an updated version of the original :program:" "`mh`." msgstr "" -#: ../../library/mailbox.rst:745 +#: ../../library/mailbox.rst:760 msgid "" "`MH & nmh: Email for Users & Programmers `_" msgstr "" -#: ../../library/mailbox.rst:746 +#: ../../library/mailbox.rst:761 msgid "" "A GPL-licensed book on :program:`mh` and :program:`nmh`, with some " "information on the mailbox format." msgstr "" -#: ../../library/mailbox.rst:753 +#: ../../library/mailbox.rst:768 msgid ":class:`!Babyl` objects" msgstr ":class:`!Babyl` 物件" -#: ../../library/mailbox.rst:758 +#: ../../library/mailbox.rst:773 msgid "" "A subclass of :class:`Mailbox` for mailboxes in Babyl format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -864,7 +873,7 @@ msgid "" "mailbox is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:765 +#: ../../library/mailbox.rst:780 msgid "" "Babyl is a single-file mailbox format used by the Rmail mail user agent " "included with Emacs. The beginning of a message is indicated by a line " @@ -874,7 +883,7 @@ msgid "" "Underscore (``'\\037'``) character." msgstr "" -#: ../../library/mailbox.rst:772 +#: ../../library/mailbox.rst:787 msgid "" "Messages in a Babyl mailbox have two sets of headers, original headers and " "so-called visible headers. Visible headers are typically a subset of the " @@ -885,31 +894,31 @@ msgid "" "in the Babyl options section." msgstr "" -#: ../../library/mailbox.rst:780 +#: ../../library/mailbox.rst:795 msgid "" ":class:`!Babyl` instances have all of the methods of :class:`Mailbox` in " "addition to the following:" msgstr "" -#: ../../library/mailbox.rst:786 +#: ../../library/mailbox.rst:801 msgid "" "Return a list of the names of all user-defined labels used in the mailbox." msgstr "" -#: ../../library/mailbox.rst:790 +#: ../../library/mailbox.rst:805 msgid "" "The actual messages are inspected to determine which labels exist in the " "mailbox rather than consulting the list of labels in the Babyl options " "section, but the Babyl section is updated whenever the mailbox is modified." msgstr "" -#: ../../library/mailbox.rst:795 +#: ../../library/mailbox.rst:810 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!Babyl` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:801 +#: ../../library/mailbox.rst:816 msgid "" "In Babyl mailboxes, the headers of a message are not stored contiguously " "with the body of the message. To generate a file-like representation, the " @@ -919,30 +928,30 @@ msgid "" "memory compared to a string representation." msgstr "" -#: ../../library/mailbox.rst:819 +#: ../../library/mailbox.rst:834 msgid "" "`Format of Version 5 Babyl Files `_" msgstr "" -#: ../../library/mailbox.rst:820 +#: ../../library/mailbox.rst:835 msgid "A specification of the Babyl format." msgstr "" -#: ../../library/mailbox.rst:822 +#: ../../library/mailbox.rst:837 msgid "" "`Reading Mail with Rmail `_" msgstr "" -#: ../../library/mailbox.rst:823 +#: ../../library/mailbox.rst:838 msgid "The Rmail manual, with some information on Babyl semantics." msgstr "" -#: ../../library/mailbox.rst:829 +#: ../../library/mailbox.rst:844 msgid ":class:`!MMDF` objects" msgstr ":class:`!MMDF` 物件" -#: ../../library/mailbox.rst:834 +#: ../../library/mailbox.rst:849 msgid "" "A subclass of :class:`Mailbox` for mailboxes in MMDF format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -952,7 +961,7 @@ msgid "" "mailbox is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:841 +#: ../../library/mailbox.rst:856 msgid "" "MMDF is a single-file mailbox format invented for the Multichannel " "Memorandum Distribution Facility, a mail transfer agent. Each message is in " @@ -965,52 +974,52 @@ msgid "" "subsequent messages." msgstr "" -#: ../../library/mailbox.rst:850 +#: ../../library/mailbox.rst:865 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!MMDF` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:856 +#: ../../library/mailbox.rst:877 msgid "" "Using the file after calling :meth:`~Mailbox.flush` or :meth:`~Mailbox." "close` on the :class:`!MMDF` instance may yield unpredictable results or " "raise an exception." msgstr "" -#: ../../library/mailbox.rst:870 +#: ../../library/mailbox.rst:895 msgid "" "`mmdf man page from tin `_" msgstr "" -#: ../../library/mailbox.rst:871 +#: ../../library/mailbox.rst:896 msgid "" "A specification of MMDF format from the documentation of tin, a newsreader." msgstr "" -#: ../../library/mailbox.rst:873 +#: ../../library/mailbox.rst:898 msgid "`MMDF `_" msgstr "`MMDF `_" -#: ../../library/mailbox.rst:874 +#: ../../library/mailbox.rst:899 msgid "" "A Wikipedia article describing the Multichannel Memorandum Distribution " "Facility." msgstr "" -#: ../../library/mailbox.rst:881 +#: ../../library/mailbox.rst:906 msgid ":class:`!Message` objects" msgstr ":class:`!Message` 物件" -#: ../../library/mailbox.rst:886 +#: ../../library/mailbox.rst:911 msgid "" "A subclass of the :mod:`email.message` module's :class:`~email.message." "Message`. Subclasses of :class:`!mailbox.Message` add mailbox-format-" "specific state and behavior." msgstr "" -#: ../../library/mailbox.rst:890 +#: ../../library/mailbox.rst:915 msgid "" "If *message* is omitted, the new instance is created in a default, empty " "state. If *message* is an :class:`email.message.Message` instance, its " @@ -1022,7 +1031,7 @@ msgid "" "compatibility." msgstr "" -#: ../../library/mailbox.rst:899 +#: ../../library/mailbox.rst:924 msgid "" "The format-specific state and behaviors offered by subclasses vary, but in " "general it is only the properties that are not specific to a particular " @@ -1034,7 +1043,7 @@ msgid "" "important is retained, because it applies to the message itself." msgstr "" -#: ../../library/mailbox.rst:908 +#: ../../library/mailbox.rst:933 msgid "" "There is no requirement that :class:`!Message` instances be used to " "represent messages retrieved using :class:`Mailbox` instances. In some " @@ -1045,17 +1054,17 @@ msgid "" "initialized." msgstr "" -#: ../../library/mailbox.rst:919 +#: ../../library/mailbox.rst:944 msgid ":class:`!MaildirMessage` objects" msgstr ":class:`!MaildirMessage` 物件" -#: ../../library/mailbox.rst:924 +#: ../../library/mailbox.rst:949 msgid "" "A message with Maildir-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:927 +#: ../../library/mailbox.rst:952 msgid "" "Typically, a mail user agent application moves all of the messages in the :" "file:`new` subdirectory to the :file:`cur` subdirectory after the first time " @@ -1069,128 +1078,128 @@ msgid "" "flags for Maildir messages are as follows:" msgstr "" -#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1106 -#: ../../library/mailbox.rst:1477 +#: ../../library/mailbox.rst:964 ../../library/mailbox.rst:1131 +#: ../../library/mailbox.rst:1502 msgid "Flag" msgstr "" -#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1106 -#: ../../library/mailbox.rst:1477 +#: ../../library/mailbox.rst:964 ../../library/mailbox.rst:1131 +#: ../../library/mailbox.rst:1502 msgid "Meaning" msgstr "含義" -#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1106 -#: ../../library/mailbox.rst:1257 ../../library/mailbox.rst:1344 -#: ../../library/mailbox.rst:1477 +#: ../../library/mailbox.rst:964 ../../library/mailbox.rst:1131 +#: ../../library/mailbox.rst:1282 ../../library/mailbox.rst:1369 +#: ../../library/mailbox.rst:1502 msgid "Explanation" msgstr "" -#: ../../library/mailbox.rst:941 ../../library/mailbox.rst:1112 -#: ../../library/mailbox.rst:1483 +#: ../../library/mailbox.rst:966 ../../library/mailbox.rst:1137 +#: ../../library/mailbox.rst:1508 msgid "D" msgstr "D" -#: ../../library/mailbox.rst:941 +#: ../../library/mailbox.rst:966 msgid "Draft" msgstr "" -#: ../../library/mailbox.rst:941 +#: ../../library/mailbox.rst:966 msgid "Under composition" msgstr "" -#: ../../library/mailbox.rst:943 ../../library/mailbox.rst:1114 -#: ../../library/mailbox.rst:1485 +#: ../../library/mailbox.rst:968 ../../library/mailbox.rst:1139 +#: ../../library/mailbox.rst:1510 msgid "F" msgstr "F" -#: ../../library/mailbox.rst:943 ../../library/mailbox.rst:1114 -#: ../../library/mailbox.rst:1485 +#: ../../library/mailbox.rst:968 ../../library/mailbox.rst:1139 +#: ../../library/mailbox.rst:1510 msgid "Flagged" msgstr "" -#: ../../library/mailbox.rst:943 ../../library/mailbox.rst:1114 -#: ../../library/mailbox.rst:1263 ../../library/mailbox.rst:1485 +#: ../../library/mailbox.rst:968 ../../library/mailbox.rst:1139 +#: ../../library/mailbox.rst:1288 ../../library/mailbox.rst:1510 msgid "Marked as important" msgstr "" -#: ../../library/mailbox.rst:945 +#: ../../library/mailbox.rst:970 msgid "P" msgstr "P" -#: ../../library/mailbox.rst:945 +#: ../../library/mailbox.rst:970 msgid "Passed" msgstr "" -#: ../../library/mailbox.rst:945 +#: ../../library/mailbox.rst:970 msgid "Forwarded, resent, or bounced" msgstr "" -#: ../../library/mailbox.rst:947 ../../library/mailbox.rst:1108 -#: ../../library/mailbox.rst:1479 +#: ../../library/mailbox.rst:972 ../../library/mailbox.rst:1133 +#: ../../library/mailbox.rst:1504 msgid "R" msgstr "R" -#: ../../library/mailbox.rst:947 +#: ../../library/mailbox.rst:972 msgid "Replied" msgstr "" -#: ../../library/mailbox.rst:947 ../../library/mailbox.rst:1116 -#: ../../library/mailbox.rst:1261 ../../library/mailbox.rst:1352 -#: ../../library/mailbox.rst:1487 +#: ../../library/mailbox.rst:972 ../../library/mailbox.rst:1141 +#: ../../library/mailbox.rst:1286 ../../library/mailbox.rst:1377 +#: ../../library/mailbox.rst:1512 msgid "Replied to" msgstr "" -#: ../../library/mailbox.rst:949 +#: ../../library/mailbox.rst:974 msgid "S" msgstr "S" -#: ../../library/mailbox.rst:949 +#: ../../library/mailbox.rst:974 msgid "Seen" msgstr "" -#: ../../library/mailbox.rst:949 ../../library/mailbox.rst:1108 -#: ../../library/mailbox.rst:1479 +#: ../../library/mailbox.rst:974 ../../library/mailbox.rst:1133 +#: ../../library/mailbox.rst:1504 msgid "Read" msgstr "" -#: ../../library/mailbox.rst:951 +#: ../../library/mailbox.rst:976 msgid "T" msgstr "T" -#: ../../library/mailbox.rst:951 +#: ../../library/mailbox.rst:976 msgid "Trashed" msgstr "" -#: ../../library/mailbox.rst:951 ../../library/mailbox.rst:1112 -#: ../../library/mailbox.rst:1348 ../../library/mailbox.rst:1483 +#: ../../library/mailbox.rst:976 ../../library/mailbox.rst:1137 +#: ../../library/mailbox.rst:1373 ../../library/mailbox.rst:1508 msgid "Marked for subsequent deletion" msgstr "" -#: ../../library/mailbox.rst:954 +#: ../../library/mailbox.rst:979 msgid ":class:`!MaildirMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:959 +#: ../../library/mailbox.rst:984 msgid "" "Return either \"new\" (if the message should be stored in the :file:`new` " "subdirectory) or \"cur\" (if the message should be stored in the :file:`cur` " "subdirectory)." msgstr "" -#: ../../library/mailbox.rst:965 +#: ../../library/mailbox.rst:990 msgid "" "A message is typically moved from :file:`new` to :file:`cur` after its " "mailbox has been accessed, whether or not the message has been read. A " "message ``msg`` has been read if ``\"S\" in msg.get_flags()`` is ``True``." msgstr "" -#: ../../library/mailbox.rst:973 +#: ../../library/mailbox.rst:998 msgid "" "Set the subdirectory the message should be stored in. Parameter *subdir* " "must be either \"new\" or \"cur\"." msgstr "" -#: ../../library/mailbox.rst:979 +#: ../../library/mailbox.rst:1004 msgid "" "Return a string specifying the flags that are currently set. If the message " "complies with the standard Maildir format, the result is the concatenation " @@ -1199,11 +1208,11 @@ msgid "" "flags are set or if \"info\" contains experimental semantics." msgstr "" -#: ../../library/mailbox.rst:989 +#: ../../library/mailbox.rst:1014 msgid "Set the flags specified by *flags* and unset all others." msgstr "" -#: ../../library/mailbox.rst:994 +#: ../../library/mailbox.rst:1019 msgid "" "Set the flag(s) specified by *flag* without changing other flags. To add " "more than one flag at a time, *flag* may be a string of more than one " @@ -1211,7 +1220,7 @@ msgid "" "experimental information rather than flags." msgstr "" -#: ../../library/mailbox.rst:1002 +#: ../../library/mailbox.rst:1027 msgid "" "Unset the flag(s) specified by *flag* without changing other flags. To " "remove more than one flag at a time, *flag* maybe a string of more than one " @@ -1219,30 +1228,30 @@ msgid "" "the current \"info\" is not modified." msgstr "" -#: ../../library/mailbox.rst:1010 +#: ../../library/mailbox.rst:1035 msgid "" "Return the delivery date of the message as a floating-point number " "representing seconds since the epoch." msgstr "" -#: ../../library/mailbox.rst:1016 +#: ../../library/mailbox.rst:1041 msgid "" "Set the delivery date of the message to *date*, a floating-point number " "representing seconds since the epoch." msgstr "" -#: ../../library/mailbox.rst:1022 +#: ../../library/mailbox.rst:1047 msgid "" "Return a string containing the \"info\" for a message. This is useful for " "accessing and modifying \"info\" that is experimental (i.e., not a list of " "flags)." msgstr "" -#: ../../library/mailbox.rst:1029 +#: ../../library/mailbox.rst:1054 msgid "Set \"info\" to *info*, which should be a string." msgstr "" -#: ../../library/mailbox.rst:1031 +#: ../../library/mailbox.rst:1056 msgid "" "When a :class:`!MaildirMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1250,176 +1259,176 @@ msgid "" "take place:" msgstr "" -#: ../../library/mailbox.rst:1037 ../../library/mailbox.rst:1055 -#: ../../library/mailbox.rst:1070 ../../library/mailbox.rst:1177 -#: ../../library/mailbox.rst:1194 ../../library/mailbox.rst:1209 -#: ../../library/mailbox.rst:1225 ../../library/mailbox.rst:1292 -#: ../../library/mailbox.rst:1307 ../../library/mailbox.rst:1321 -#: ../../library/mailbox.rst:1418 ../../library/mailbox.rst:1435 -#: ../../library/mailbox.rst:1449 ../../library/mailbox.rst:1549 -#: ../../library/mailbox.rst:1566 ../../library/mailbox.rst:1581 -#: ../../library/mailbox.rst:1597 +#: ../../library/mailbox.rst:1062 ../../library/mailbox.rst:1080 +#: ../../library/mailbox.rst:1095 ../../library/mailbox.rst:1202 +#: ../../library/mailbox.rst:1219 ../../library/mailbox.rst:1234 +#: ../../library/mailbox.rst:1250 ../../library/mailbox.rst:1317 +#: ../../library/mailbox.rst:1332 ../../library/mailbox.rst:1346 +#: ../../library/mailbox.rst:1443 ../../library/mailbox.rst:1460 +#: ../../library/mailbox.rst:1474 ../../library/mailbox.rst:1574 +#: ../../library/mailbox.rst:1591 ../../library/mailbox.rst:1606 +#: ../../library/mailbox.rst:1622 msgid "Resulting state" msgstr "" -#: ../../library/mailbox.rst:1037 ../../library/mailbox.rst:1307 -#: ../../library/mailbox.rst:1435 +#: ../../library/mailbox.rst:1062 ../../library/mailbox.rst:1332 +#: ../../library/mailbox.rst:1460 msgid ":class:`mboxMessage` or :class:`MMDFMessage` state" msgstr "" -#: ../../library/mailbox.rst:1040 ../../library/mailbox.rst:1057 -#: ../../library/mailbox.rst:1072 ../../library/mailbox.rst:1181 -#: ../../library/mailbox.rst:1553 +#: ../../library/mailbox.rst:1065 ../../library/mailbox.rst:1082 +#: ../../library/mailbox.rst:1097 ../../library/mailbox.rst:1206 +#: ../../library/mailbox.rst:1578 msgid "\"cur\" subdirectory" msgstr "" -#: ../../library/mailbox.rst:1040 ../../library/mailbox.rst:1181 -#: ../../library/mailbox.rst:1198 ../../library/mailbox.rst:1213 -#: ../../library/mailbox.rst:1229 ../../library/mailbox.rst:1553 -#: ../../library/mailbox.rst:1570 ../../library/mailbox.rst:1585 -#: ../../library/mailbox.rst:1601 +#: ../../library/mailbox.rst:1065 ../../library/mailbox.rst:1206 +#: ../../library/mailbox.rst:1223 ../../library/mailbox.rst:1238 +#: ../../library/mailbox.rst:1254 ../../library/mailbox.rst:1578 +#: ../../library/mailbox.rst:1595 ../../library/mailbox.rst:1610 +#: ../../library/mailbox.rst:1626 msgid "O flag" msgstr "" -#: ../../library/mailbox.rst:1042 ../../library/mailbox.rst:1061 -#: ../../library/mailbox.rst:1185 ../../library/mailbox.rst:1200 -#: ../../library/mailbox.rst:1233 ../../library/mailbox.rst:1298 -#: ../../library/mailbox.rst:1314 ../../library/mailbox.rst:1557 -#: ../../library/mailbox.rst:1572 ../../library/mailbox.rst:1605 +#: ../../library/mailbox.rst:1067 ../../library/mailbox.rst:1086 +#: ../../library/mailbox.rst:1210 ../../library/mailbox.rst:1225 +#: ../../library/mailbox.rst:1258 ../../library/mailbox.rst:1323 +#: ../../library/mailbox.rst:1339 ../../library/mailbox.rst:1582 +#: ../../library/mailbox.rst:1597 ../../library/mailbox.rst:1630 msgid "F flag" msgstr "" -#: ../../library/mailbox.rst:1044 ../../library/mailbox.rst:1046 -#: ../../library/mailbox.rst:1063 ../../library/mailbox.rst:1078 -#: ../../library/mailbox.rst:1179 ../../library/mailbox.rst:1187 -#: ../../library/mailbox.rst:1227 ../../library/mailbox.rst:1296 -#: ../../library/mailbox.rst:1424 ../../library/mailbox.rst:1551 -#: ../../library/mailbox.rst:1559 ../../library/mailbox.rst:1599 +#: ../../library/mailbox.rst:1069 ../../library/mailbox.rst:1071 +#: ../../library/mailbox.rst:1088 ../../library/mailbox.rst:1103 +#: ../../library/mailbox.rst:1204 ../../library/mailbox.rst:1212 +#: ../../library/mailbox.rst:1252 ../../library/mailbox.rst:1321 +#: ../../library/mailbox.rst:1449 ../../library/mailbox.rst:1576 +#: ../../library/mailbox.rst:1584 ../../library/mailbox.rst:1624 msgid "R flag" msgstr "" -#: ../../library/mailbox.rst:1044 ../../library/mailbox.rst:1187 -#: ../../library/mailbox.rst:1202 ../../library/mailbox.rst:1217 -#: ../../library/mailbox.rst:1235 ../../library/mailbox.rst:1312 -#: ../../library/mailbox.rst:1442 ../../library/mailbox.rst:1559 -#: ../../library/mailbox.rst:1574 ../../library/mailbox.rst:1589 -#: ../../library/mailbox.rst:1607 +#: ../../library/mailbox.rst:1069 ../../library/mailbox.rst:1212 +#: ../../library/mailbox.rst:1227 ../../library/mailbox.rst:1242 +#: ../../library/mailbox.rst:1260 ../../library/mailbox.rst:1337 +#: ../../library/mailbox.rst:1467 ../../library/mailbox.rst:1584 +#: ../../library/mailbox.rst:1599 ../../library/mailbox.rst:1614 +#: ../../library/mailbox.rst:1632 msgid "A flag" msgstr "" -#: ../../library/mailbox.rst:1046 ../../library/mailbox.rst:1179 -#: ../../library/mailbox.rst:1551 +#: ../../library/mailbox.rst:1071 ../../library/mailbox.rst:1204 +#: ../../library/mailbox.rst:1576 msgid "S flag" msgstr "" -#: ../../library/mailbox.rst:1048 ../../library/mailbox.rst:1080 -#: ../../library/mailbox.rst:1183 ../../library/mailbox.rst:1422 -#: ../../library/mailbox.rst:1555 +#: ../../library/mailbox.rst:1073 ../../library/mailbox.rst:1105 +#: ../../library/mailbox.rst:1208 ../../library/mailbox.rst:1447 +#: ../../library/mailbox.rst:1580 msgid "T flag" msgstr "" -#: ../../library/mailbox.rst:1048 ../../library/mailbox.rst:1183 -#: ../../library/mailbox.rst:1215 ../../library/mailbox.rst:1231 -#: ../../library/mailbox.rst:1440 ../../library/mailbox.rst:1555 -#: ../../library/mailbox.rst:1587 ../../library/mailbox.rst:1603 +#: ../../library/mailbox.rst:1073 ../../library/mailbox.rst:1208 +#: ../../library/mailbox.rst:1240 ../../library/mailbox.rst:1256 +#: ../../library/mailbox.rst:1465 ../../library/mailbox.rst:1580 +#: ../../library/mailbox.rst:1612 ../../library/mailbox.rst:1628 msgid "D flag" msgstr "" -#: ../../library/mailbox.rst:1051 +#: ../../library/mailbox.rst:1076 msgid "" "When a :class:`!MaildirMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1055 ../../library/mailbox.rst:1194 -#: ../../library/mailbox.rst:1449 ../../library/mailbox.rst:1566 +#: ../../library/mailbox.rst:1080 ../../library/mailbox.rst:1219 +#: ../../library/mailbox.rst:1474 ../../library/mailbox.rst:1591 msgid ":class:`MHMessage` state" msgstr "" -#: ../../library/mailbox.rst:1057 ../../library/mailbox.rst:1198 -#: ../../library/mailbox.rst:1294 ../../library/mailbox.rst:1310 -#: ../../library/mailbox.rst:1323 ../../library/mailbox.rst:1451 -#: ../../library/mailbox.rst:1570 +#: ../../library/mailbox.rst:1082 ../../library/mailbox.rst:1223 +#: ../../library/mailbox.rst:1319 ../../library/mailbox.rst:1335 +#: ../../library/mailbox.rst:1348 ../../library/mailbox.rst:1476 +#: ../../library/mailbox.rst:1595 msgid "\"unseen\" sequence" msgstr "" -#: ../../library/mailbox.rst:1059 ../../library/mailbox.rst:1074 +#: ../../library/mailbox.rst:1084 ../../library/mailbox.rst:1099 msgid "\"cur\" subdirectory and S flag" msgstr "" -#: ../../library/mailbox.rst:1059 ../../library/mailbox.rst:1196 -#: ../../library/mailbox.rst:1568 +#: ../../library/mailbox.rst:1084 ../../library/mailbox.rst:1221 +#: ../../library/mailbox.rst:1593 msgid "no \"unseen\" sequence" msgstr "" -#: ../../library/mailbox.rst:1061 ../../library/mailbox.rst:1200 -#: ../../library/mailbox.rst:1298 ../../library/mailbox.rst:1314 -#: ../../library/mailbox.rst:1572 +#: ../../library/mailbox.rst:1086 ../../library/mailbox.rst:1225 +#: ../../library/mailbox.rst:1323 ../../library/mailbox.rst:1339 +#: ../../library/mailbox.rst:1597 msgid "\"flagged\" sequence" msgstr "" -#: ../../library/mailbox.rst:1063 ../../library/mailbox.rst:1202 -#: ../../library/mailbox.rst:1296 ../../library/mailbox.rst:1312 -#: ../../library/mailbox.rst:1325 ../../library/mailbox.rst:1453 -#: ../../library/mailbox.rst:1574 +#: ../../library/mailbox.rst:1088 ../../library/mailbox.rst:1227 +#: ../../library/mailbox.rst:1321 ../../library/mailbox.rst:1337 +#: ../../library/mailbox.rst:1350 ../../library/mailbox.rst:1478 +#: ../../library/mailbox.rst:1599 msgid "\"replied\" sequence" msgstr "" -#: ../../library/mailbox.rst:1066 +#: ../../library/mailbox.rst:1091 msgid "" "When a :class:`!MaildirMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1070 ../../library/mailbox.rst:1209 -#: ../../library/mailbox.rst:1321 ../../library/mailbox.rst:1581 +#: ../../library/mailbox.rst:1095 ../../library/mailbox.rst:1234 +#: ../../library/mailbox.rst:1346 ../../library/mailbox.rst:1606 msgid ":class:`BabylMessage` state" msgstr "" -#: ../../library/mailbox.rst:1072 ../../library/mailbox.rst:1213 -#: ../../library/mailbox.rst:1323 ../../library/mailbox.rst:1420 -#: ../../library/mailbox.rst:1438 ../../library/mailbox.rst:1451 -#: ../../library/mailbox.rst:1585 +#: ../../library/mailbox.rst:1097 ../../library/mailbox.rst:1238 +#: ../../library/mailbox.rst:1348 ../../library/mailbox.rst:1445 +#: ../../library/mailbox.rst:1463 ../../library/mailbox.rst:1476 +#: ../../library/mailbox.rst:1610 msgid "\"unseen\" label" msgstr "" -#: ../../library/mailbox.rst:1074 ../../library/mailbox.rst:1211 -#: ../../library/mailbox.rst:1583 +#: ../../library/mailbox.rst:1099 ../../library/mailbox.rst:1236 +#: ../../library/mailbox.rst:1608 msgid "no \"unseen\" label" msgstr "" -#: ../../library/mailbox.rst:1076 ../../library/mailbox.rst:1426 +#: ../../library/mailbox.rst:1101 ../../library/mailbox.rst:1451 msgid "P flag" msgstr "" -#: ../../library/mailbox.rst:1076 +#: ../../library/mailbox.rst:1101 msgid "\"forwarded\" or \"resent\" label" msgstr "" -#: ../../library/mailbox.rst:1078 ../../library/mailbox.rst:1217 -#: ../../library/mailbox.rst:1325 ../../library/mailbox.rst:1424 -#: ../../library/mailbox.rst:1442 ../../library/mailbox.rst:1453 -#: ../../library/mailbox.rst:1589 +#: ../../library/mailbox.rst:1103 ../../library/mailbox.rst:1242 +#: ../../library/mailbox.rst:1350 ../../library/mailbox.rst:1449 +#: ../../library/mailbox.rst:1467 ../../library/mailbox.rst:1478 +#: ../../library/mailbox.rst:1614 msgid "\"answered\" label" msgstr "" -#: ../../library/mailbox.rst:1080 ../../library/mailbox.rst:1215 -#: ../../library/mailbox.rst:1422 ../../library/mailbox.rst:1440 -#: ../../library/mailbox.rst:1587 +#: ../../library/mailbox.rst:1105 ../../library/mailbox.rst:1240 +#: ../../library/mailbox.rst:1447 ../../library/mailbox.rst:1465 +#: ../../library/mailbox.rst:1612 msgid "\"deleted\" label" msgstr "" -#: ../../library/mailbox.rst:1087 +#: ../../library/mailbox.rst:1112 msgid ":class:`!mboxMessage` objects" msgstr ":class:`!mboxMessage` 物件" -#: ../../library/mailbox.rst:1092 +#: ../../library/mailbox.rst:1117 msgid "" "A message with mbox-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1095 +#: ../../library/mailbox.rst:1120 msgid "" "Messages in an mbox mailbox are stored together in a single file. The " "sender's envelope address and the time of delivery are typically stored in a " @@ -1430,53 +1439,53 @@ msgid "" "typically stored in :mailheader:`Status` and :mailheader:`X-Status` headers." msgstr "" -#: ../../library/mailbox.rst:1103 +#: ../../library/mailbox.rst:1128 msgid "Conventional flags for mbox messages are as follows:" msgstr "" -#: ../../library/mailbox.rst:1110 ../../library/mailbox.rst:1481 +#: ../../library/mailbox.rst:1135 ../../library/mailbox.rst:1506 msgid "O" msgstr "O" -#: ../../library/mailbox.rst:1110 ../../library/mailbox.rst:1481 +#: ../../library/mailbox.rst:1135 ../../library/mailbox.rst:1506 msgid "Old" msgstr "" -#: ../../library/mailbox.rst:1110 ../../library/mailbox.rst:1481 +#: ../../library/mailbox.rst:1135 ../../library/mailbox.rst:1506 msgid "Previously detected by MUA" msgstr "" -#: ../../library/mailbox.rst:1112 ../../library/mailbox.rst:1483 +#: ../../library/mailbox.rst:1137 ../../library/mailbox.rst:1508 msgid "Deleted" msgstr "" -#: ../../library/mailbox.rst:1116 ../../library/mailbox.rst:1487 +#: ../../library/mailbox.rst:1141 ../../library/mailbox.rst:1512 msgid "A" msgstr "A" -#: ../../library/mailbox.rst:1116 ../../library/mailbox.rst:1487 +#: ../../library/mailbox.rst:1141 ../../library/mailbox.rst:1512 msgid "Answered" msgstr "" -#: ../../library/mailbox.rst:1119 ../../library/mailbox.rst:1490 +#: ../../library/mailbox.rst:1144 ../../library/mailbox.rst:1515 msgid "" "The \"R\" and \"O\" flags are stored in the :mailheader:`Status` header, and " "the \"D\", \"F\", and \"A\" flags are stored in the :mailheader:`X-Status` " "header. The flags and headers typically appear in the order mentioned." msgstr "" -#: ../../library/mailbox.rst:1123 +#: ../../library/mailbox.rst:1148 msgid ":class:`!mboxMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:1128 ../../library/mailbox.rst:1500 +#: ../../library/mailbox.rst:1153 ../../library/mailbox.rst:1525 msgid "" "Return a string representing the \"From \" line that marks the start of the " "message in an mbox mailbox. The leading \"From \" and the trailing newline " "are excluded." msgstr "" -#: ../../library/mailbox.rst:1135 ../../library/mailbox.rst:1507 +#: ../../library/mailbox.rst:1160 ../../library/mailbox.rst:1532 msgid "" "Set the \"From \" line to *from_*, which should be specified without a " "leading \"From \" or trailing newline. For convenience, *time_* may be " @@ -1486,7 +1495,7 @@ msgid "" "func:`time.gmtime`)." msgstr "" -#: ../../library/mailbox.rst:1145 ../../library/mailbox.rst:1517 +#: ../../library/mailbox.rst:1170 ../../library/mailbox.rst:1542 msgid "" "Return a string specifying the flags that are currently set. If the message " "complies with the conventional format, the result is the concatenation in " @@ -1494,28 +1503,28 @@ msgid "" "``'D'``, ``'F'``, and ``'A'``." msgstr "" -#: ../../library/mailbox.rst:1153 ../../library/mailbox.rst:1525 +#: ../../library/mailbox.rst:1178 ../../library/mailbox.rst:1550 msgid "" "Set the flags specified by *flags* and unset all others. Parameter *flags* " "should be the concatenation in any order of zero or more occurrences of each " "of ``'R'``, ``'O'``, ``'D'``, ``'F'``, and ``'A'``." msgstr "" -#: ../../library/mailbox.rst:1160 ../../library/mailbox.rst:1532 +#: ../../library/mailbox.rst:1185 ../../library/mailbox.rst:1557 msgid "" "Set the flag(s) specified by *flag* without changing other flags. To add " "more than one flag at a time, *flag* may be a string of more than one " "character." msgstr "" -#: ../../library/mailbox.rst:1167 ../../library/mailbox.rst:1539 +#: ../../library/mailbox.rst:1192 ../../library/mailbox.rst:1564 msgid "" "Unset the flag(s) specified by *flag* without changing other flags. To " "remove more than one flag at a time, *flag* maybe a string of more than one " "character." msgstr "" -#: ../../library/mailbox.rst:1171 +#: ../../library/mailbox.rst:1196 msgid "" "When an :class:`!mboxMessage` instance is created based upon a :class:" "`MaildirMessage` instance, a \"From \" line is generated based upon the :" @@ -1523,50 +1532,50 @@ msgid "" "conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1177 ../../library/mailbox.rst:1292 -#: ../../library/mailbox.rst:1418 ../../library/mailbox.rst:1549 +#: ../../library/mailbox.rst:1202 ../../library/mailbox.rst:1317 +#: ../../library/mailbox.rst:1443 ../../library/mailbox.rst:1574 msgid ":class:`MaildirMessage` state" msgstr "" -#: ../../library/mailbox.rst:1190 +#: ../../library/mailbox.rst:1215 msgid "" "When an :class:`!mboxMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1196 ../../library/mailbox.rst:1211 -#: ../../library/mailbox.rst:1568 ../../library/mailbox.rst:1583 +#: ../../library/mailbox.rst:1221 ../../library/mailbox.rst:1236 +#: ../../library/mailbox.rst:1593 ../../library/mailbox.rst:1608 msgid "R flag and O flag" msgstr "" -#: ../../library/mailbox.rst:1205 +#: ../../library/mailbox.rst:1230 msgid "" "When an :class:`!mboxMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1220 +#: ../../library/mailbox.rst:1245 msgid "" "When a :class:`!mboxMessage` instance is created based upon an :class:" "`MMDFMessage` instance, the \"From \" line is copied and all flags directly " "correspond:" msgstr "" -#: ../../library/mailbox.rst:1225 +#: ../../library/mailbox.rst:1250 msgid ":class:`MMDFMessage` state" msgstr "" -#: ../../library/mailbox.rst:1242 +#: ../../library/mailbox.rst:1267 msgid ":class:`!MHMessage` objects" msgstr ":class:`!MHMessage` 物件" -#: ../../library/mailbox.rst:1247 +#: ../../library/mailbox.rst:1272 msgid "" "A message with MH-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1250 +#: ../../library/mailbox.rst:1275 msgid "" "MH messages do not support marks or flags in the traditional sense, but they " "do support sequences, which are logical groupings of arbitrary messages. " @@ -1575,57 +1584,57 @@ msgid "" "formats, as follows:" msgstr "" -#: ../../library/mailbox.rst:1257 +#: ../../library/mailbox.rst:1282 msgid "Sequence" msgstr "" -#: ../../library/mailbox.rst:1259 ../../library/mailbox.rst:1346 +#: ../../library/mailbox.rst:1284 ../../library/mailbox.rst:1371 msgid "unseen" msgstr "" -#: ../../library/mailbox.rst:1259 ../../library/mailbox.rst:1346 +#: ../../library/mailbox.rst:1284 ../../library/mailbox.rst:1371 msgid "Not read, but previously detected by MUA" msgstr "" -#: ../../library/mailbox.rst:1261 +#: ../../library/mailbox.rst:1286 msgid "replied" msgstr "" -#: ../../library/mailbox.rst:1263 +#: ../../library/mailbox.rst:1288 msgid "flagged" msgstr "" -#: ../../library/mailbox.rst:1266 +#: ../../library/mailbox.rst:1291 msgid ":class:`!MHMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:1271 +#: ../../library/mailbox.rst:1296 msgid "Return a list of the names of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1276 +#: ../../library/mailbox.rst:1301 msgid "Set the list of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1281 +#: ../../library/mailbox.rst:1306 msgid "Add *sequence* to the list of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1286 +#: ../../library/mailbox.rst:1311 msgid "Remove *sequence* from the list of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1288 +#: ../../library/mailbox.rst:1313 msgid "" "When an :class:`!MHMessage` instance is created based upon a :class:" "`MaildirMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1294 ../../library/mailbox.rst:1420 +#: ../../library/mailbox.rst:1319 ../../library/mailbox.rst:1445 msgid "no S flag" msgstr "" -#: ../../library/mailbox.rst:1301 +#: ../../library/mailbox.rst:1326 msgid "" "When an :class:`!MHMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1633,110 +1642,110 @@ msgid "" "take place:" msgstr "" -#: ../../library/mailbox.rst:1310 ../../library/mailbox.rst:1438 +#: ../../library/mailbox.rst:1335 ../../library/mailbox.rst:1463 msgid "no R flag" msgstr "" -#: ../../library/mailbox.rst:1317 +#: ../../library/mailbox.rst:1342 msgid "" "When an :class:`!MHMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1332 +#: ../../library/mailbox.rst:1357 msgid ":class:`!BabylMessage` objects" msgstr ":class:`!BabylMessage` 物件" -#: ../../library/mailbox.rst:1337 +#: ../../library/mailbox.rst:1362 msgid "" "A message with Babyl-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1340 +#: ../../library/mailbox.rst:1365 msgid "" "Certain message labels, called :dfn:`attributes`, are defined by convention " "to have special meanings. The attributes are as follows:" msgstr "" -#: ../../library/mailbox.rst:1344 +#: ../../library/mailbox.rst:1369 msgid "Label" msgstr "" -#: ../../library/mailbox.rst:1348 +#: ../../library/mailbox.rst:1373 msgid "deleted" msgstr "" -#: ../../library/mailbox.rst:1350 +#: ../../library/mailbox.rst:1375 msgid "filed" msgstr "" -#: ../../library/mailbox.rst:1350 +#: ../../library/mailbox.rst:1375 msgid "Copied to another file or mailbox" msgstr "" -#: ../../library/mailbox.rst:1352 +#: ../../library/mailbox.rst:1377 msgid "answered" msgstr "" -#: ../../library/mailbox.rst:1354 +#: ../../library/mailbox.rst:1379 msgid "forwarded" msgstr "" -#: ../../library/mailbox.rst:1354 +#: ../../library/mailbox.rst:1379 msgid "Forwarded" msgstr "" -#: ../../library/mailbox.rst:1356 +#: ../../library/mailbox.rst:1381 msgid "edited" msgstr "" -#: ../../library/mailbox.rst:1356 +#: ../../library/mailbox.rst:1381 msgid "Modified by the user" msgstr "" -#: ../../library/mailbox.rst:1358 +#: ../../library/mailbox.rst:1383 msgid "resent" msgstr "" -#: ../../library/mailbox.rst:1358 +#: ../../library/mailbox.rst:1383 msgid "Resent" msgstr "" -#: ../../library/mailbox.rst:1361 +#: ../../library/mailbox.rst:1386 msgid "" "By default, Rmail displays only visible headers. The :class:`!BabylMessage` " "class, though, uses the original headers because they are more complete. " "Visible headers may be accessed explicitly if desired." msgstr "" -#: ../../library/mailbox.rst:1365 +#: ../../library/mailbox.rst:1390 msgid ":class:`!BabylMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:1370 +#: ../../library/mailbox.rst:1395 msgid "Return a list of labels on the message." msgstr "" -#: ../../library/mailbox.rst:1375 +#: ../../library/mailbox.rst:1400 msgid "Set the list of labels on the message to *labels*." msgstr "" -#: ../../library/mailbox.rst:1380 +#: ../../library/mailbox.rst:1405 msgid "Add *label* to the list of labels on the message." msgstr "" -#: ../../library/mailbox.rst:1385 +#: ../../library/mailbox.rst:1410 msgid "Remove *label* from the list of labels on the message." msgstr "" -#: ../../library/mailbox.rst:1390 +#: ../../library/mailbox.rst:1415 msgid "" "Return a :class:`Message` instance whose headers are the message's visible " "headers and whose body is empty." msgstr "" -#: ../../library/mailbox.rst:1396 +#: ../../library/mailbox.rst:1421 msgid "" "Set the message's visible headers to be the same as the headers in " "*message*. Parameter *visible* should be a :class:`Message` instance, an :" @@ -1744,7 +1753,7 @@ msgid "" "(which should be open in text mode)." msgstr "" -#: ../../library/mailbox.rst:1404 +#: ../../library/mailbox.rst:1429 msgid "" "When a :class:`!BabylMessage` instance's original headers are modified, the " "visible headers are not automatically modified to correspond. This method " @@ -1757,17 +1766,17 @@ msgid "" "visible headers." msgstr "" -#: ../../library/mailbox.rst:1414 +#: ../../library/mailbox.rst:1439 msgid "" "When a :class:`!BabylMessage` instance is created based upon a :class:" "`MaildirMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1426 +#: ../../library/mailbox.rst:1451 msgid "\"forwarded\" label" msgstr "" -#: ../../library/mailbox.rst:1429 +#: ../../library/mailbox.rst:1454 msgid "" "When a :class:`!BabylMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1775,23 +1784,23 @@ msgid "" "take place:" msgstr "" -#: ../../library/mailbox.rst:1445 +#: ../../library/mailbox.rst:1470 msgid "" "When a :class:`!BabylMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1460 +#: ../../library/mailbox.rst:1485 msgid ":class:`!MMDFMessage` objects" msgstr ":class:`!MMDFMessage` 物件" -#: ../../library/mailbox.rst:1465 +#: ../../library/mailbox.rst:1490 msgid "" "A message with MMDF-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1468 +#: ../../library/mailbox.rst:1493 msgid "" "As with message in an mbox mailbox, MMDF messages are stored with the " "sender's address and the delivery date in an initial line beginning with " @@ -1799,19 +1808,19 @@ msgid "" "typically stored in :mailheader:`Status` and :mailheader:`X-Status` headers." msgstr "" -#: ../../library/mailbox.rst:1473 +#: ../../library/mailbox.rst:1498 msgid "" "Conventional flags for MMDF messages are identical to those of mbox message " "and are as follows:" msgstr "" -#: ../../library/mailbox.rst:1494 +#: ../../library/mailbox.rst:1519 msgid "" ":class:`!MMDFMessage` instances offer the following methods, which are " "identical to those offered by :class:`mboxMessage`:" msgstr "" -#: ../../library/mailbox.rst:1543 +#: ../../library/mailbox.rst:1568 msgid "" "When an :class:`!MMDFMessage` instance is created based upon a :class:" "`MaildirMessage` instance, a \"From \" line is generated based upon the :" @@ -1819,43 +1828,43 @@ msgid "" "conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1562 +#: ../../library/mailbox.rst:1587 msgid "" "When an :class:`!MMDFMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1577 +#: ../../library/mailbox.rst:1602 msgid "" "When an :class:`!MMDFMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1592 +#: ../../library/mailbox.rst:1617 msgid "" "When an :class:`!MMDFMessage` instance is created based upon an :class:" "`mboxMessage` instance, the \"From \" line is copied and all flags directly " "correspond:" msgstr "" -#: ../../library/mailbox.rst:1597 +#: ../../library/mailbox.rst:1622 msgid ":class:`mboxMessage` state" msgstr "" -#: ../../library/mailbox.rst:1612 +#: ../../library/mailbox.rst:1637 msgid "Exceptions" msgstr "例外" -#: ../../library/mailbox.rst:1614 +#: ../../library/mailbox.rst:1639 msgid "" "The following exception classes are defined in the :mod:`!mailbox` module:" msgstr "" -#: ../../library/mailbox.rst:1619 +#: ../../library/mailbox.rst:1644 msgid "The based class for all other module-specific exceptions." msgstr "" -#: ../../library/mailbox.rst:1624 +#: ../../library/mailbox.rst:1649 msgid "" "Raised when a mailbox is expected but is not found, such as when " "instantiating a :class:`Mailbox` subclass with a path that does not exist " @@ -1863,13 +1872,13 @@ msgid "" "that does not exist." msgstr "" -#: ../../library/mailbox.rst:1631 +#: ../../library/mailbox.rst:1656 msgid "" "Raised when a mailbox is not empty but is expected to be, such as when " "deleting a folder that contains messages." msgstr "" -#: ../../library/mailbox.rst:1637 +#: ../../library/mailbox.rst:1662 msgid "" "Raised when some mailbox-related condition beyond the control of the program " "causes it to be unable to proceed, such as when failing to acquire a lock " @@ -1877,23 +1886,23 @@ msgid "" "name already exists." msgstr "" -#: ../../library/mailbox.rst:1645 +#: ../../library/mailbox.rst:1670 msgid "" "Raised when the data in a file cannot be parsed, such as when an :class:`MH` " "instance attempts to read a corrupted :file:`.mh_sequences` file." msgstr "" -#: ../../library/mailbox.rst:1652 +#: ../../library/mailbox.rst:1677 msgid "Examples" msgstr "範例" -#: ../../library/mailbox.rst:1654 +#: ../../library/mailbox.rst:1679 msgid "" "A simple example of printing the subjects of all messages in a mailbox that " "seem interesting::" msgstr "" -#: ../../library/mailbox.rst:1657 +#: ../../library/mailbox.rst:1682 msgid "" "import mailbox\n" "for message in mailbox.mbox('~/mbox'):\n" @@ -1907,13 +1916,13 @@ msgstr "" " if subject and 'python' in subject.lower():\n" " print(subject)" -#: ../../library/mailbox.rst:1663 +#: ../../library/mailbox.rst:1688 msgid "" "To copy all mail from a Babyl mailbox to an MH mailbox, converting all of " "the format-specific information that can be converted::" msgstr "" -#: ../../library/mailbox.rst:1666 +#: ../../library/mailbox.rst:1691 msgid "" "import mailbox\n" "destination = mailbox.MH('~/Mail')\n" @@ -1931,7 +1940,7 @@ msgstr "" "destination.flush()\n" "destination.unlock()" -#: ../../library/mailbox.rst:1674 +#: ../../library/mailbox.rst:1699 msgid "" "This example sorts mail from several mailing lists into different mailboxes, " "being careful to avoid mail corruption due to concurrent modification by " @@ -1939,7 +1948,7 @@ msgid "" "termination due to malformed messages in the mailbox::" msgstr "" -#: ../../library/mailbox.rst:1679 +#: ../../library/mailbox.rst:1704 msgid "" "import mailbox\n" "import email.errors\n" diff --git a/library/markup.po b/library/markup.po index 6804f0d603..357746f4d1 100644 --- a/library/markup.po +++ b/library/markup.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -20,7 +19,7 @@ msgstr "" #: ../../library/markup.rst:5 msgid "Structured Markup Processing Tools" -msgstr "" +msgstr "結構化標記處理工具" #: ../../library/markup.rst:7 msgid "" @@ -29,3 +28,7 @@ msgid "" "Generalized Markup Language (SGML) and the Hypertext Markup Language (HTML), " "and several interfaces for working with the Extensible Markup Language (XML)." msgstr "" +"Python 支援多種模組來處理各種形式的結構化資料標記。這包括用於處理標準通用標記" +"語言 (SGML, Standard Generalized Markup Language) 和超文本標記語言 (HTML, " +"Hypertext Markup Language) 的模組,以及用於處理可擴展標記語言 (XML, " +"Extensible Markup Language) 的幾個介面。" diff --git a/library/marshal.po b/library/marshal.po index 03ab684ed4..08adbd79f4 100644 --- a/library/marshal.po +++ b/library/marshal.po @@ -34,34 +34,35 @@ msgid "" "are undocumented on purpose; it may change between Python versions (although " "it rarely does). [#]_" msgstr "" -"此 module(模組)包含一個能以二進位制格式來讀寫 Python 值的函式。這種格式是 " -"Python 專屬但獨立於機器架構的(例如,你可以在一臺 PC 上寫入某個 Python 值,再" -"將檔案傳到一臺 Mac 上並在那裡讀取它)。這種格式的細節是有意地不在文件上說明" -"的;它可能在不同 Python 版本中被改變(雖然這種情況極少發生)。[#]_" +"此模組包含一個能以二進位制格式來讀寫 Python 值的函式。這種格式是 Python 專屬" +"但獨立於機器架構的(例如,你可以在一臺 PC 上寫入某個 Python 值,再將檔案傳到" +"一臺 Mac 上並在那裡讀取它)。這種格式的細節是有意地不在文件上說明的;它可能在" +"不同 Python 版本中被改變(雖然這種情況極少發生)。[#]_" #: ../../library/marshal.rst:21 -#, fuzzy msgid "" "This is not a general \"persistence\" module. For general persistence and " "transfer of Python objects through RPC calls, see the modules :mod:`pickle` " "and :mod:`shelve`. The :mod:`marshal` module exists mainly to support " -"reading and writing the \"pseudo-compiled\" code for Python modules of :file:" -"`.pyc` files. Therefore, the Python maintainers reserve the right to modify " -"the marshal format in backward incompatible ways should the need arise. The " -"format of code objects is not compatible between Python versions, even if " -"the version of the format is the same. De-serializing a code object in the " -"incorrect Python version has undefined behavior. If you're serializing and " -"de-serializing Python objects, use the :mod:`pickle` module instead -- the " -"performance is comparable, version independence is guaranteed, and pickle " -"supports a substantially wider range of objects than marshal." +"reading and writing the \"pseudo-compiled\" code for Python modules " +"of :file:`.pyc` files. Therefore, the Python maintainers reserve the right " +"to modify the marshal format in backward incompatible ways should the need " +"arise. The format of code objects is not compatible between Python versions, " +"even if the version of the format is the same. De-serializing a code object " +"in the incorrect Python version has undefined behavior. If you're " +"serializing and de-serializing Python objects, use the :mod:`pickle` module " +"instead -- the performance is comparable, version independence is " +"guaranteed, and pickle supports a substantially wider range of objects than " +"marshal." msgstr "" -"這不是一個通用「持續性 (persistence)」module 。關於通用持續性以及透過 RPC 呼" -"叫傳遞 Python 物件,請參閱 :mod:`pickle` 和 :mod:`shelve` 等 module 。:mod:" -"`marshal` module 主要是為了支援用來讀寫「偽編譯 (pseudo-compiled)」 :file:`." -"pyc` 檔案的 Python module。因此,Python 維護者保留了在必要時以不向後相容的方" -"式修改 marshal 格式的權利。如果你要序列化和反序列化 Python 物件,請改用 :mod:" -"`pickle` module -- 其執行效率相當、有保證版本獨立性,且實質上 pickle 還支援" -"比 marshal 更多樣的物件。" +"這不是一個通用「持久性 (persistence)」模組。關於通用持久性以及透過 RPC 呼叫傳" +"遞 Python 物件,請參閱 :mod:`pickle` 和 :mod:`shelve` 等模組。:mod:`marshal` " +"模組主要是為了支援用來讀寫 :file:`.pyc` 檔案之 Python 模組的「偽編譯 (pseudo-" +"compiled)」程式碼。因此,Python 維護者保留了在必要時以不向後相容的方式修改 " +"marshal 格式的權利。程式碼物件的格式在不同 Python 版本間是不相容的,即使格式" +"版本相同。在不正確的 Python 版本中反序列化程式碼物件會有未定義的行為。如果你" +"要序列化和反序列化 Python 物件,請改用 :mod:`pickle` 模組 -- 其執行效率相當、" +"有保證版本獨立性,且實質上 pickle 還支援比 marshal 更多樣的物件。" #: ../../library/marshal.rst:37 msgid "" @@ -69,7 +70,7 @@ msgid "" "maliciously constructed data. Never unmarshal data received from an " "untrusted or unauthenticated source." msgstr "" -":mod:`marshal` module 對於錯誤或惡意構建的資料來說是不安全的。永遠不要 " +":mod:`marshal` 模組對於錯誤或惡意構建的資料來說是不安全的。永遠不要 " "unmarshal 來自不受信任的或來源未經驗證的資料。" #: ../../library/marshal.rst:43 @@ -81,20 +82,20 @@ msgid "" "bytearrays, tuples, lists, sets, frozensets, dictionaries, and code objects " "(if *allow_code* is true), where it should be understood that tuples, lists, " "sets, frozensets and dictionaries are only supported as long as the values " -"contained therein are themselves supported. The singletons :const:`None`, :" -"const:`Ellipsis` and :exc:`StopIteration` can also be marshalled and " -"unmarshalled. For format *version* lower than 3, recursive lists, sets and " -"dictionaries cannot be written (see below)." +"contained therein are themselves supported. The " +"singletons :const:`None`, :const:`Ellipsis` and :exc:`StopIteration` can " +"also be marshalled and unmarshalled. For format *version* lower than 3, " +"recursive lists, sets and dictionaries cannot be written (see below)." msgstr "" -"不是所有 Python 物件型別都有支援;一般來說,此 module 只能寫入和讀取不依賴於" -"特定 Python 調用 (invocation) 的物件。下列型別是有支援的:布林 (boolean)、整" -"數、浮點數 (floating-point number)、複數、字串、位元組串 (bytes)、位元組陣列 " +"不是所有 Python 物件型別都有支援;一般來說,此模組只能寫入和讀取不依賴於特定 " +"Python 調用 (invocation) 的物件。下列型別是有支援的:布林 (boolean)、整數、浮" +"點數 (floating-point number)、複數、字串、位元組串 (bytes)、位元組陣列 " "(bytearray)、元組 (tuple)、list、集合 (set)、凍結集合 (frozenset)、" "dictionary 和程式碼物件(如 *allow_code* 為 true),需要了解的一點是元組、" "list、集合、凍結集合和 dictionary 只在其所包含的值也屬於這些型別時才會支援。" -"單例 (singleton) 物件 :const:`None`、:const:`Ellipsis` 和 :exc:" -"`StopIteration` 也可以被 marshal 和 unmarshal。對於 *version* 低於 3 的格式," -"遞迴 list、集合和 dictionary 無法被寫入(見下文)。" +"單例 (singleton) 物件 :const:`None`、:const:`Ellipsis` " +"和 :exc:`StopIteration` 也可以被 marshal 和 unmarshal。對於 *version* 低於 3 " +"的格式,遞迴 list、集合和 dictionary 無法被寫入(見下文)。" #: ../../library/marshal.rst:56 msgid "" @@ -105,7 +106,7 @@ msgstr "" #: ../../library/marshal.rst:59 msgid "The module defines these functions:" -msgstr "這個 module 定義了以下函式:" +msgstr "這個模組定義了以下函式:" #: ../../library/marshal.rst:64 msgid "" @@ -117,16 +118,16 @@ msgstr "" #: ../../library/marshal.rst:67 msgid "" -"If the value has (or contains an object that has) an unsupported type, a :" -"exc:`ValueError` exception is raised --- but garbage data will also be " -"written to the file. The object will not be properly read back by :func:" -"`load`. :ref:`Code objects ` are only supported if " +"If the value has (or contains an object that has) an unsupported type, " +"a :exc:`ValueError` exception is raised --- but garbage data will also be " +"written to the file. The object will not be properly read back " +"by :func:`load`. :ref:`Code objects ` are only supported if " "*allow_code* is true." msgstr "" "如果值具有(或其所包含的物件具有)不支援的型別,則會引發 :exc:`ValueError` 例" -"外 --- 但是垃圾資料 (garbage data) 也將寫入檔案,物件也無法正確地透過 :func:" -"`load` 重新讀取。:ref:`程式碼物件 `\\ 只有在 *allow_code* 為 " -"true 時才會支援。" +"外 --- 但是垃圾資料 (garbage data) 也將寫入檔案,物件也無法正確地透" +"過 :func:`load` 重新讀取。:ref:`程式碼物件 `\\ 只有在 " +"*allow_code* 為 true 時才會支援。" #: ../../library/marshal.rst:72 msgid "" @@ -151,14 +152,15 @@ msgstr "新增 *allow_code* 參數。" msgid "" "Read one value from the open file and return it. If no valid value is read " "(e.g. because the data has a different Python version's incompatible marshal " -"format), raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. :ref:" -"`Code objects ` are only supported if *allow_code* is true. " -"The file must be a readable :term:`binary file`." +"format), raise :exc:`EOFError`, :exc:`ValueError` " +"or :exc:`TypeError`. :ref:`Code objects ` are only supported " +"if *allow_code* is true. The file must be a readable :term:`binary file`." msgstr "" "從開啟的檔案讀取一個值並回傳。如果讀不到有效的值(例如,由於資料為不同 " -"Python 版本的不相容 marshal 格式),則會引發 :exc:`EOFError`、:exc:" -"`ValueError` 或 :exc:`TypeError`。:ref:`程式碼物件 `\\ 只有在 " -"*allow_code* 為 true 時才會支援。檔案必須為可讀取的 :term:`binary file`。" +"Python 版本的不相容 marshal 格式),則會引" +"發 :exc:`EOFError`、:exc:`ValueError` 或 :exc:`TypeError`。:ref:`程式碼物件 " +"`\\ 只有在 *allow_code* 為 true 時才會支援。檔案必須為可讀取" +"的 :term:`binary file`。" #: ../../library/marshal.rst:89 msgid "" @@ -168,8 +170,9 @@ msgstr "引發一個沒有附帶引數的\\ :ref:`稽核事件 ` ``mar #: ../../library/marshal.rst:93 msgid "" -"If an object containing an unsupported type was marshalled with :func:" -"`dump`, :func:`load` will substitute ``None`` for the unmarshallable type." +"If an object containing an unsupported type was marshalled " +"with :func:`dump`, :func:`load` will substitute ``None`` for the " +"unmarshallable type." msgstr "" "如果透過 :func:`dump` marshal 了一個包含不支援型別的物件,:func:`load` 會將不" "可 marshal 的型別替換為 ``None``。" @@ -191,9 +194,9 @@ msgid "" "is true." msgstr "" "回傳將透過 ``dump(value, file)`` 來被寫入一個檔案的位元組串物件,其值必須是有" -"支援的型別,如果值(或其包含的任一物件)為不支援的型別則會引發 :exc:" -"`ValueError`。:ref:`程式碼物件 `\\ 只有在 *allow_code* 為 true " -"時才會支援。" +"支援的型別,如果值(或其包含的任一物件)為不支援的型別則會引" +"發 :exc:`ValueError`。:ref:`程式碼物件 `\\ 只有在 *allow_code* " +"為 true 時才會支援。" #: ../../library/marshal.rst:112 msgid "" @@ -204,22 +207,22 @@ msgstr "*version* 引數指明 ``dumps`` 應當使用的資料型別(見下文 #: ../../library/marshal.rst:123 msgid "" "Convert the :term:`bytes-like object` to a value. If no valid value is " -"found, raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. :ref:" -"`Code objects ` are only supported if *allow_code* is true. " -"Extra bytes in the input are ignored." +"found, raise :exc:`EOFError`, :exc:`ValueError` " +"or :exc:`TypeError`. :ref:`Code objects ` are only supported " +"if *allow_code* is true. Extra bytes in the input are ignored." msgstr "" -"將 :term:`bytes-like object` 轉換為一個值。如果找不到有效的值,則會引發 :exc:" -"`EOFError`、:exc:`ValueError` 或 :exc:`TypeError`。:ref:`程式碼物件 `\\ 只有在 *allow_code* 為 true 時才會支援。輸入中額外的位元組串會被" -"忽略。" +"將 :term:`bytes-like object` 轉換為一個值。如果找不到有效的值,則會引" +"發 :exc:`EOFError`、:exc:`ValueError` 或 :exc:`TypeError`。:ref:`程式碼物件 " +"`\\ 只有在 *allow_code* 為 true 時才會支援。輸入中額外的位元組" +"串會被忽略。" #: ../../library/marshal.rst:128 msgid "" "Raises an :ref:`auditing event ` ``marshal.loads`` with argument " "``bytes``." msgstr "" -"引發一個附帶引數 ``bytes`` 的\\ :ref:`稽核事件 ` ``marshal." -"loads``。" +"引發一個附帶引數 ``bytes`` 的\\ :ref:`稽核事件 ` " +"``marshal.loads``。" #: ../../library/marshal.rst:132 msgid "" @@ -240,7 +243,7 @@ msgid "" "for floating-point numbers. Version 3 adds support for object instancing and " "recursion. The current version is 4." msgstr "" -"表示 module 所使用的格式。第 0 版為歷史格式,第 1 版共享了駐留字串 (interned " +"表示模組所使用的格式。第 0 版為歷史格式,第 1 版共享了駐留字串 (interned " "string),第 2 版對浮點數使用二進位制格式。第 3 版添加了對於物件實例化和遞迴的" "支援。目前使用的是第 4 版。" @@ -256,7 +259,7 @@ msgid "" "marshal\" means to convert some data from internal to external form (in an " "RPC buffer for instance) and \"unmarshalling\" for the reverse process." msgstr "" -"此 module 的名稱來源於 Modula-3 (及其他語言) 的設計者所使用的術語,他們使用 " +"此模組的名稱來源於 Modula-3 (及其他語言) 的設計者所使用的術語,他們使用 " "\"marshal\" 來表示自包含 (self-contained) 形式資料的傳輸。嚴格來說,將資料從" "內部形式轉換為外部形式 (例如用於 RPC 緩衝區) 稱為 \"marshal\",而其反向過程則" "稱為 \"unmarshal\"。" diff --git a/library/math.po b/library/math.po index c6ffeda216..1c6cb27a07 100644 --- a/library/math.po +++ b/library/math.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-05 00:15+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2024-04-26 15:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -548,8 +548,8 @@ msgstr ":func:`lgamma(x) `" #: ../../library/math.rst:112 msgid "" -"Natural logarithm of the absolute value of the `Gamma function `_ at *x*" +"Natural logarithm of the absolute value of the `Gamma function `_ at *x*" msgstr "" #: ../../library/math.rst:114 @@ -622,11 +622,11 @@ msgstr "" #: ../../library/math.rst:139 ../../library/math.rst:205 msgid "" -"Raises :exc:`TypeError` if either of the arguments are not integers. " -"Raises :exc:`ValueError` if either of the arguments are negative." +"Raises :exc:`TypeError` if either of the arguments are not integers. Raises :" +"exc:`ValueError` if either of the arguments are negative." msgstr "" -"當任一參數非整數型別時會引發 :exc:`TypeError`。當任一參數為負數時會引" -"發 :exc:`ValueError`。" +"當任一參數非整數型別時會引發 :exc:`TypeError`。當任一參數為負數時會引發 :exc:" +"`ValueError`。" #: ../../library/math.rst:147 msgid "" @@ -714,12 +714,12 @@ msgstr "" #: ../../library/math.rst:216 msgid "" "Return the ceiling of *x*, the smallest integer greater than or equal to " -"*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ " -"`, which should return an :class:`~numbers.Integral` value." +"*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ `, which should return an :class:`~numbers.Integral` value." msgstr "" "回傳 *x* 經上取整的值,即大於或等於 *x* 的最小整數。若 *x* 並非浮點數,此函式" -"將委派給 :meth:`x.__ceil__ `,並回" -"傳 :class:`~numbers.Integral` 型別的值。" +"將委派給 :meth:`x.__ceil__ `,並回傳 :class:`~numbers." +"Integral` 型別的值。" #: ../../library/math.rst:223 msgid "Return the absolute value of *x*." @@ -732,8 +732,8 @@ msgid "" "which should return an :class:`~numbers.Integral` value." msgstr "" "回傳 *x* 經下取整的值,即小於或等於 *x* 的最大整數。若 *x* 並非浮點數,此函式" -"將委派給 :meth:`x.__floor__ `,並回" -"傳 :class:`~numbers.Integral` 型別的值。" +"將委派給 :meth:`x.__floor__ `,並回傳 :class:`~numbers." +"Integral` 型別的值。" #: ../../library/math.rst:235 msgid "" @@ -820,8 +820,8 @@ msgid "" "Return *x* with the fractional part removed, leaving the integer part. This " "rounds toward 0: ``trunc()`` is equivalent to :func:`floor` for positive " "*x*, and equivalent to :func:`ceil` for negative *x*. If *x* is not a float, " -"delegates to :meth:`x.__trunc__ `, which should return " -"an :class:`~numbers.Integral` value." +"delegates to :meth:`x.__trunc__ `, which should return an :" +"class:`~numbers.Integral` value." msgstr "" #: ../../library/math.rst:306 @@ -898,9 +898,9 @@ msgstr "" msgid "" "*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " "nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " -"as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any ``x`` and " -"rel_tol less than ``1.0``. So add an appropriate positive abs_tol argument " -"to the call." +"as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any nonzero ``x`` " +"and *rel_tol* less than ``1.0``. So add an appropriate positive *abs_tol* " +"argument to the call." msgstr "" #: ../../library/math.rst:357 @@ -941,8 +941,8 @@ msgstr "" #: ../../library/math.rst:390 msgid "" -"Return ``x * (2**i)``. This is essentially the inverse of " -"function :func:`frexp`." +"Return ``x * (2**i)``. This is essentially the inverse of function :func:" +"`frexp`." msgstr "回傳 ``x * (2**i)``。此函式本質上為 :func:`frexp` 的反函式。" #: ../../library/math.rst:396 @@ -1000,8 +1000,8 @@ msgstr "若 *x* 為正無限值,回傳 *x*。" #: ../../library/math.rst:422 msgid "" "If *x* is equal to zero, return the smallest positive *denormalized* " -"representable float (smaller than the minimum positive *normalized* " -"float, :data:`sys.float_info.min `)." +"representable float (smaller than the minimum positive *normalized* float, :" +"data:`sys.float_info.min `)." msgstr "" #: ../../library/math.rst:425 @@ -1024,8 +1024,8 @@ msgstr "" #: ../../library/math.rst:434 msgid "" -"See also :func:`math.nextafter` and :data:`sys.float_info.epsilon " -"`." +"See also :func:`math.nextafter` and :data:`sys.float_info.epsilon `." msgstr "" #: ../../library/math.rst:441 @@ -1159,9 +1159,9 @@ msgstr "" #: ../../library/math.rst:565 msgid "" "For further discussion and two alternative approaches, see the `ASPN " -"cookbook recipes for accurate floating-point summation `_\\." +"cookbook recipes for accurate floating-point summation `_\\." msgstr "" "更深入的討論及兩種替代做法請參閱 `ASPN cookbook recipes 精準的浮點數總和 " "`_。" @@ -1264,8 +1264,8 @@ msgid "" "``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " "this angle with the positive X axis. The point of :func:`atan2` is that the " "signs of both inputs are known to it, so it can compute the correct quadrant " -"for the angle. For example, ``atan(1)`` and ``atan2(1, 1)`` are both ``pi/" -"4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." +"for the angle. For example, ``atan(1)`` and ``atan2(1, 1)`` are both " +"``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." msgstr "" #: ../../library/math.rst:664 @@ -1328,8 +1328,8 @@ msgstr "" #: ../../library/math.rst:722 msgid "" "The :func:`erf` function can be used to compute traditional statistical " -"functions such as the `cumulative standard normal distribution `_::" +"functions such as the `cumulative standard normal distribution `_::" msgstr "" #: ../../library/math.rst:726 @@ -1383,8 +1383,8 @@ msgstr "" #: ../../library/math.rst:786 msgid "" -"A floating-point positive infinity. (For negative infinity, use ``-" -"math.inf``.) Equivalent to the output of ``float('inf')``." +"A floating-point positive infinity. (For negative infinity, use ``-math." +"inf``.) Equivalent to the output of ``float('inf')``." msgstr "" #: ../../library/math.rst:794 @@ -1405,15 +1405,15 @@ msgstr "" msgid "" "The :mod:`math` module consists mostly of thin wrappers around the platform " "C math library functions. Behavior in exceptional cases follows Annex F of " -"the C99 standard where appropriate. The current implementation will " -"raise :exc:`ValueError` for invalid operations like ``sqrt(-1.0)`` or " -"``log(0.0)`` (where C99 Annex F recommends signaling invalid operation or " -"divide-by-zero), and :exc:`OverflowError` for results that overflow (for " -"example, ``exp(1000.0)``). A NaN will not be returned from any of the " -"functions above unless one or more of the input arguments was a NaN; in that " -"case, most functions will return a NaN, but (again following C99 Annex F) " -"there are some exceptions to this rule, for example ``pow(float('nan'), " -"0.0)`` or ``hypot(float('nan'), float('inf'))``." +"the C99 standard where appropriate. The current implementation will raise :" +"exc:`ValueError` for invalid operations like ``sqrt(-1.0)`` or ``log(0.0)`` " +"(where C99 Annex F recommends signaling invalid operation or divide-by-" +"zero), and :exc:`OverflowError` for results that overflow (for example, " +"``exp(1000.0)``). A NaN will not be returned from any of the functions " +"above unless one or more of the input arguments was a NaN; in that case, " +"most functions will return a NaN, but (again following C99 Annex F) there " +"are some exceptions to this rule, for example ``pow(float('nan'), 0.0)`` or " +"``hypot(float('nan'), float('inf'))``." msgstr "" #: ../../library/math.rst:832 diff --git a/library/modulefinder.po b/library/modulefinder.po index e4f1f62d68..ae4cd98992 100644 --- a/library/modulefinder.po +++ b/library/modulefinder.po @@ -139,6 +139,19 @@ msgid "" "print('Modules not imported:')\n" "print('\\n'.join(finder.badmodules.keys()))" msgstr "" +"from modulefinder import ModuleFinder\n" +"\n" +"finder = ModuleFinder()\n" +"finder.run_script('bacon.py')\n" +"\n" +"print('載入模組:')\n" +"for name, mod in finder.modules.items():\n" +" print('%s: ' % name, end='')\n" +" print(','.join(list(mod.globalnames.keys())[:3]))\n" +"\n" +"print('-'*50)\n" +"print('模組沒有被引入:')\n" +"print('\\n'.join(finder.badmodules.keys()))" #: ../../library/modulefinder.rst:94 msgid "Sample output (may vary depending on the architecture)::" @@ -164,7 +177,7 @@ msgid "" "guido.python.ham\n" "baconhameggs" msgstr "" -"Loaded modules:\n" +"載入模組:\n" "_types:\n" "copyreg: _inverted_registry,_slotnames,__all__\n" "re._compiler: isstring,_sre,_optimize_unicode\n" @@ -178,6 +191,6 @@ msgstr "" "array:\n" "types: __module__,IntType,TypeType\n" "---------------------------------------------------\n" -"Modules not imported:\n" +"模組沒有被引入:\n" "guido.python.ham\n" "baconhameggs" diff --git a/library/modules.po b/library/modules.po index 147e11b561..551ff94e39 100644 --- a/library/modules.po +++ b/library/modules.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -27,7 +26,9 @@ msgid "" "The modules described in this chapter provide new ways to import other " "Python modules and hooks for customizing the import process." msgstr "" +"本章節所描述的模組提供了引入其他 Python 模組的新方法,以及用於自訂引入過程的 " +"hook。" #: ../../library/modules.rst:10 msgid "The full list of modules described in this chapter is:" -msgstr "" +msgstr "本章節所描述的完整模組列表為:" diff --git a/library/numbers.po b/library/numbers.po index 221858c2e6..db32c6ca63 100644 --- a/library/numbers.po +++ b/library/numbers.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: 2022-11-16 04:57+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -72,19 +72,19 @@ msgstr "為抽象的。取得該數值的實數部分。" msgid "Abstract. Retrieves the imaginary component of this number." msgstr "為抽象的。取得該數值的虛數部分。" -#: ../../library/numbers.rst:43 +#: ../../library/numbers.rst:44 msgid "" "Abstract. Returns the complex conjugate. For example, ``(1+3j).conjugate() " "== (1-3j)``." msgstr "為抽象的。回傳共軛複數,例如 ``(1+3j).conjugate() == (1-3j)``。" -#: ../../library/numbers.rst:48 +#: ../../library/numbers.rst:49 msgid "" "To :class:`Complex`, :class:`!Real` adds the operations that work on real " "numbers." msgstr "相對於 :class:`Complex`,:class:`!Real` 加入了只有實數才能進行的操作。" -#: ../../library/numbers.rst:51 +#: ../../library/numbers.rst:52 msgid "" "In short, those are: a conversion to :class:`float`, :func:`math.trunc`, :" "func:`round`, :func:`math.floor`, :func:`math.ceil`, :func:`divmod`, ``//``, " @@ -94,7 +94,7 @@ msgstr "" "`math.floor`、:func:`math.ceil`、:func:`divmod`、``//``、``%``、 ``<``、" "``<=``、``>``、和 ``>=``。" -#: ../../library/numbers.rst:55 +#: ../../library/numbers.rst:56 msgid "" "Real also provides defaults for :func:`complex`, :attr:`~Complex.real`, :" "attr:`~Complex.imag`, and :meth:`~Complex.conjugate`." @@ -102,7 +102,7 @@ msgstr "" "實數同樣提供 :func:`complex`、:attr:`~Complex.real`、:attr:`~Complex.imag` " "和 :meth:`~Complex.conjugate` 的預設值。" -#: ../../library/numbers.rst:61 +#: ../../library/numbers.rst:62 msgid "" "Subtypes :class:`Real` and adds :attr:`~Rational.numerator` and :attr:" "`~Rational.denominator` properties. It also provides a default for :func:" @@ -111,7 +111,7 @@ msgstr "" ":class:`Real` 的子型別,並增加了 :attr:`~Rational.numerator` 和 :attr:" "`~Rational.denominator` 這兩種特性。它也會提供 :func:`float` 的預設值。" -#: ../../library/numbers.rst:65 +#: ../../library/numbers.rst:66 msgid "" "The :attr:`~Rational.numerator` and :attr:`~Rational.denominator` values " "should be instances of :class:`Integral` and should be in lowest terms with :" @@ -120,11 +120,11 @@ msgstr "" ":attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 的值必須是 :" "class:`Integral` 的實例且 :attr:`~Rational.denominator` 要是正數。" -#: ../../library/numbers.rst:71 ../../library/numbers.rst:75 +#: ../../library/numbers.rst:72 ../../library/numbers.rst:76 msgid "Abstract." msgstr "為抽象的。" -#: ../../library/numbers.rst:80 +#: ../../library/numbers.rst:81 msgid "" "Subtypes :class:`Rational` and adds a conversion to :class:`int`. Provides " "defaults for :func:`float`, :attr:`~Rational.numerator`, and :attr:" @@ -136,11 +136,11 @@ msgstr "" "預設值。為 :func:`pow` 方法增加了求餘 (modulus) 和位元字串運算 (bit-string " "operations) 的抽象方法:``<<``、``>>``、``&``、``^``、``|``、``~``。" -#: ../../library/numbers.rst:88 +#: ../../library/numbers.rst:89 msgid "Notes for type implementers" msgstr "給型別實作者的註記" -#: ../../library/numbers.rst:90 +#: ../../library/numbers.rst:91 msgid "" "Implementers should be careful to make equal numbers equal and hash them to " "the same values. This may be subtle if there are two different extensions of " @@ -151,7 +151,7 @@ msgstr "" "同的實數擴充時,這可能是很微妙的。例如,:class:`fractions.Fraction` 底下的 :" "func:`hash` 實作如下: ::" -#: ../../library/numbers.rst:95 +#: ../../library/numbers.rst:96 msgid "" "def __hash__(self):\n" " if self.denominator == 1:\n" @@ -165,12 +165,22 @@ msgid "" " # simple fractions.\n" " return hash((self.numerator, self.denominator))" msgstr "" +"def __hash__(self):\n" +" if self.denominator == 1:\n" +" # 正確處理整數。\n" +" return hash(self.numerator)\n" +" # 檢查費時,但絕對正確。\n" +" if self == float(self):\n" +" return hash(float(self))\n" +" else:\n" +" # 使用 tuple 的雜湊值以避免簡單分數上的高碰撞率。\n" +" return hash((self.numerator, self.denominator))" -#: ../../library/numbers.rst:109 +#: ../../library/numbers.rst:110 msgid "Adding More Numeric ABCs" msgstr "加入更多數值 ABC" -#: ../../library/numbers.rst:111 +#: ../../library/numbers.rst:112 msgid "" "There are, of course, more possible ABCs for numbers, and this would be a " "poor hierarchy if it precluded the possibility of adding those. You can add " @@ -179,7 +189,7 @@ msgstr "" "當然,還有更多用於數值的 ABC,如果不加入它們就不會有健全的階層。你可以在 :" "class:`Complex` 和 :class:`Real` 中加入 ``MyFoo``,像是: ::" -#: ../../library/numbers.rst:116 +#: ../../library/numbers.rst:117 msgid "" "class MyFoo(Complex): ...\n" "MyFoo.register(Real)" @@ -187,11 +197,11 @@ msgstr "" "class MyFoo(Complex): ...\n" "MyFoo.register(Real)" -#: ../../library/numbers.rst:123 +#: ../../library/numbers.rst:124 msgid "Implementing the arithmetic operations" msgstr "實作算術操作" -#: ../../library/numbers.rst:125 +#: ../../library/numbers.rst:126 msgid "" "We want to implement the arithmetic operations so that mixed-mode operations " "either call an implementation whose author knew about the types of both " @@ -204,7 +214,7 @@ msgstr "" "子型別,這意味著 :meth:`~object.__add__` 和 :meth:`~object.__radd__` 必須用如" "下方式定義: ::" -#: ../../library/numbers.rst:132 +#: ../../library/numbers.rst:133 msgid "" "class MyIntegral(Integral):\n" "\n" @@ -254,7 +264,7 @@ msgstr "" " else:\n" " return NotImplemented" -#: ../../library/numbers.rst:157 +#: ../../library/numbers.rst:158 msgid "" "There are 5 different cases for a mixed-type operation on subclasses of :" "class:`Complex`. I'll refer to all of the above code that doesn't refer to " @@ -267,13 +277,13 @@ msgstr "" "(boilerplate)」。``a`` 是 :class:`Complex` 之子型別 ``A`` 的實例 (``a : A <: " "Complex``),同時 ``b : B <: Complex``。我將要計算 ``a + b``:" -#: ../../library/numbers.rst:164 +#: ../../library/numbers.rst:165 msgid "" "If ``A`` defines an :meth:`~object.__add__` which accepts ``b``, all is well." msgstr "" "如果 ``A`` 有定義成一個接受 ``b`` 的 :meth:`~object.__add__`,不會發生問題。" -#: ../../library/numbers.rst:166 +#: ../../library/numbers.rst:167 msgid "" "If ``A`` falls back to the boilerplate code, and it were to return a value " "from :meth:`~object.__add__`, we'd miss the possibility that ``B`` defines a " @@ -286,14 +296,14 @@ msgstr "" "回傳一個來自 :meth:`!__add__` 的 :data:`NotImplemented`。(或者 ``A`` 可能完" "全不實作 :meth:`!__add__`。)" -#: ../../library/numbers.rst:172 +#: ../../library/numbers.rst:173 msgid "" "Then ``B``'s :meth:`~object.__radd__` gets a chance. If it accepts ``a``, " "all is well." msgstr "" "接著看 ``B`` 的 :meth:`~object.__radd__`。如果它接受 ``a`` ,不會發生問題。" -#: ../../library/numbers.rst:174 +#: ../../library/numbers.rst:175 msgid "" "If it falls back to the boilerplate, there are no more possible methods to " "try, so this is where the default implementation should live." @@ -301,7 +311,7 @@ msgstr "" "如果沒有成功回退到模板,就沒有更多的方法可以去嘗試,因此這裡將使用預設的實" "作。" -#: ../../library/numbers.rst:177 +#: ../../library/numbers.rst:178 msgid "" "If ``B <: A``, Python tries ``B.__radd__`` before ``A.__add__``. This is ok, " "because it was implemented with knowledge of ``A``, so it can handle those " @@ -311,7 +321,7 @@ msgstr "" "的,因為它是透過對 ``A`` 的理解而實作的,所以這可以在交給 :class:`Complex` 之" "前處理好這些實例。" -#: ../../library/numbers.rst:182 +#: ../../library/numbers.rst:183 msgid "" "If ``A <: Complex`` and ``B <: Real`` without sharing any other knowledge, " "then the appropriate shared operation is the one involving the built in :" @@ -322,7 +332,7 @@ msgstr "" "當的共享操作會涉及內建的 :class:`complex`,並且分別用到 :meth:`~object." "__radd__`,因此 ``a+b == b+a``。" -#: ../../library/numbers.rst:187 +#: ../../library/numbers.rst:188 msgid "" "Because most of the operations on any given type will be very similar, it " "can be useful to define a helper function which generates the forward and " @@ -333,7 +343,7 @@ msgstr "" "(forward) 與向後 (reverse) 實例的輔助函式可能會非常有用。例如,:class:" "`fractions.Fraction` 使用了: ::" -#: ../../library/numbers.rst:192 +#: ../../library/numbers.rst:193 msgid "" "def _operator_fallbacks(monomorphic_operator, fallback_operator):\n" " def forward(a, b):\n" diff --git a/library/operator.po b/library/operator.po index 3df309831a..f41345c35c 100644 --- a/library/operator.po +++ b/library/operator.po @@ -32,12 +32,12 @@ msgstr "**原始碼:**\\ :source:`Lib/operator.py`" #: ../../library/operator.rst:18 msgid "" "The :mod:`operator` module exports a set of efficient functions " -"corresponding to the intrinsic operators of Python. For example, ``operator." -"add(x, y)`` is equivalent to the expression ``x+y``. Many function names are " -"those used for special methods, without the double underscores. For " -"backward compatibility, many of these have a variant with the double " -"underscores kept. The variants without the double underscores are preferred " -"for clarity." +"corresponding to the intrinsic operators of Python. For example, " +"``operator.add(x, y)`` is equivalent to the expression ``x+y``. Many " +"function names are those used for special methods, without the double " +"underscores. For backward compatibility, many of these have a variant with " +"the double underscores kept. The variants without the double underscores are " +"preferred for clarity." msgstr "" ":mod:`operator` module(模組)提供了一套與 Python 原生運算子對應的高效率函" "式。例如,``operator.add(x, y)`` 與表示式 ``x+y`` 相同。許多函式名與特殊方法" @@ -64,8 +64,8 @@ msgid "" "``eq(a, b)`` is equivalent to ``a == b``, ``ne(a, b)`` is equivalent to ``a !" "= b``, ``gt(a, b)`` is equivalent to ``a > b`` and ``ge(a, b)`` is " "equivalent to ``a >= b``. Note that these functions can return any value, " -"which may or may not be interpretable as a Boolean value. See :ref:" -"`comparisons` for more information about rich comparisons." +"which may or may not be interpretable as a Boolean value. " +"See :ref:`comparisons` for more information about rich comparisons." msgstr "" "在 *a* 和 *b* 之間進行 \"rich comparison\"。具體來說,``lt(a, b)`` 與 ``a < " "b`` 相同,``le(a, b)`` 與 ``a <= b`` 相同,``eq(a, b)`` 與 ``a == b`` 相同," @@ -84,8 +84,8 @@ msgstr "" msgid "" "Return the outcome of :keyword:`not` *obj*. (Note that there is no :meth:`!" "__not__` method for object instances; only the interpreter core defines this " -"operation. The result is affected by the :meth:`~object.__bool__` and :meth:" -"`~object.__len__` methods.)" +"operation. The result is affected by the :meth:`~object.__bool__` " +"and :meth:`~object.__len__` methods.)" msgstr "" "回傳 :keyword:`not` *obj* 的結果。(請注意物件實例並沒有 :meth:`!__not__` " "method(方法);只有直譯器核心定義此操作。結果會受 :meth:`~object.__bool__` " @@ -234,16 +234,16 @@ msgid "" "actual length, then an estimate using :meth:`object.__length_hint__`, and " "finally return the default value." msgstr "" -"回傳物件 *obj* 的估計長度。首先嘗試回傳其實際長度,再使用 :meth:`object." -"__length_hint__` 得出估計值,最後才是回傳預設值。" +"回傳物件 *obj* 的估計長度。首先嘗試回傳其實際長度,再使" +"用 :meth:`object.__length_hint__` 得出估計值,最後才是回傳預設值。" #: ../../library/operator.rst:254 msgid "The following operation works with callables:" -msgstr "" +msgstr "以下操作適用於可呼叫物件:" #: ../../library/operator.rst:259 msgid "Return ``obj(*args, **kwargs)``." -msgstr "" +msgstr "回傳 ``obj(*args, **kwargs)``。" #: ../../library/operator.rst:264 msgid "" @@ -253,8 +253,9 @@ msgid "" "other functions that expect a function argument." msgstr "" ":mod:`operator` module 還定義了一些用於常規屬性和條目查詢的工具。這些工具適合" -"用來編寫快速欄位提取器以作為 :func:`map`、:func:`sorted`、:meth:`itertools." -"groupby` 或其他需要函式引數的函式之引數。" +"用來編寫快速欄位提取器以作" +"為 :func:`map`、:func:`sorted`、:meth:`itertools.groupby` 或其他需要函式引數" +"的函式之引數。" #: ../../library/operator.rst:273 msgid "" @@ -271,8 +272,8 @@ msgstr "在 ``f = attrgetter('name')`` 之後,呼叫 ``f(b)`` 將回傳 ``b.na #: ../../library/operator.rst:279 msgid "" -"After ``f = attrgetter('name', 'date')``, the call ``f(b)`` returns ``(b." -"name, b.date)``." +"After ``f = attrgetter('name', 'date')``, the call ``f(b)`` returns " +"``(b.name, b.date)``." msgstr "" "在 ``f = attrgetter('name', 'date')`` 之後,呼叫 ``f(b)`` 將回傳 ``(b.name, " "b.date)``。" @@ -309,6 +310,22 @@ msgid "" " obj = getattr(obj, name)\n" " return obj" msgstr "" +"def attrgetter(*items):\n" +" if any(not isinstance(item, str) for item in items):\n" +" raise TypeError('屬性名稱必須是一個字串')\n" +" if len(items) == 1:\n" +" attr = items[0]\n" +" def g(obj):\n" +" return resolve_attr(obj, attr)\n" +" else:\n" +" def g(obj):\n" +" return tuple(resolve_attr(obj, attr) for attr in items)\n" +" return g\n" +"\n" +"def resolve_attr(obj, attr):\n" +" for name in attr.split(\".\"):\n" +" obj = getattr(obj, name)\n" +" return obj" #: ../../library/operator.rst:308 msgid "" @@ -355,9 +372,10 @@ msgstr "" #: ../../library/operator.rst:329 msgid "" -"The items can be any type accepted by the operand's :meth:`~object." -"__getitem__` method. Dictionaries accept any :term:`hashable` value. " -"Lists, tuples, and strings accept an index or a slice:" +"The items can be any type accepted by the " +"operand's :meth:`~object.__getitem__` method. Dictionaries accept " +"any :term:`hashable` value. Lists, tuples, and strings accept an index or a " +"slice:" msgstr "" "傳入的條目可以為運算元的 :meth:`~object.__getitem__` 所接受的任何型別。" "dictionary(字典)接受任意\\ :term:`可雜湊 `\\ 的值。list、tupple " @@ -389,8 +407,8 @@ msgid "" "After ``f = methodcaller('name', 'foo', bar=1)``, the call ``f(b)`` returns " "``b.name('foo', bar=1)``." msgstr "" -"在 ``f = methodcaller('name', 'foo', bar=1)`` 之後,呼叫 ``f(b)`` 將回傳 ``b." -"name('foo', bar=1)``。" +"在 ``f = methodcaller('name', 'foo', bar=1)`` 之後,呼叫 ``f(b)`` 將回傳 " +"``b.name('foo', bar=1)``。" #: ../../library/operator.rst:367 msgid "" @@ -843,9 +861,9 @@ msgid "" "y``." msgstr "" "許多運算都有「原地」版本。以下列出的是提供對原地運算子(與一般語法相比)更底" -"層存取的函式,例如 :term:`statement` ``x += y`` 相當於 ``x = operator." -"iadd(x, y)``。換一種方式來講就是 ``z = operator.iadd(x, y)`` 等價於複合陳述" -"式 ``z = x; z += y``。" +"層存取的函式,例如 :term:`statement` ``x += y`` 相當於 ``x = " +"operator.iadd(x, y)``。換一種方式來講就是 ``z = operator.iadd(x, y)`` 等價於" +"複合陳述式 ``z = x; z += y``。" #: ../../library/operator.rst:465 msgid "" diff --git a/library/os.po b/library/os.po index 8e5e0369c7..b2f2e44c90 100644 --- a/library/os.po +++ b/library/os.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-19 00:15+0000\n" +"POT-Creation-Date: 2025-03-30 00:15+0000\n" "PO-Revision-Date: 2024-04-29 15:24+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -200,8 +200,8 @@ msgid "" ":func:`locale.getpreferredencoding` returns ``'utf-8'`` (the *do_setlocale* " "argument has no effect)." msgstr "" -":func:`locale.getpreferredencoding` 回傳 ``'utf-8'``\\ (*do_setlocale* " -"引數並無任何效果)。" +":func:`locale.getpreferredencoding` 回傳 ``'utf-8'``\\ (*do_setlocale* 引數" +"並無任何效果)。" #: ../../library/os.rst:119 msgid "" @@ -216,9 +216,7 @@ msgstr "" msgid "" "On Unix, :func:`os.device_encoding` returns ``'utf-8'`` rather than the " "device encoding." -msgstr "" -"在 Unix 中,:func:`os.device_encoding` 回傳 ``'utf-8'`` 而非" -"裝置編碼。" +msgstr "在 Unix 中,:func:`os.device_encoding` 回傳 ``'utf-8'`` 而非裝置編碼。" #: ../../library/os.rst:127 msgid "" @@ -226,9 +224,8 @@ msgid "" "envvar:`PYTHONIOENCODING` (just as they can be in the default locale-aware " "mode)." msgstr "" -"請注意,在 UTF-8 模式中,標準的串流設定會被 " -":envvar:`PYTHONIOENCODING` 覆蓋(如同在預設在地化覺察 " -"模式一樣)。" +"請注意,在 UTF-8 模式中,標準的串流設定會被 :envvar:`PYTHONIOENCODING` 覆蓋" +"(如同在預設在地化覺察 模式一樣)。" #: ../../library/os.rst:131 msgid "" @@ -240,13 +237,11 @@ msgstr "" msgid "" "Command line arguments, environment variables and filenames are decoded to " "text using the UTF-8 encoding." -msgstr "" -"命令列引數、環境變數及檔案名稱會以 UTF-8 編碼形式來被解碼成文字。" +msgstr "命令列引數、環境變數及檔案名稱會以 UTF-8 編碼形式來被解碼成文字。" #: ../../library/os.rst:136 msgid ":func:`os.fsdecode` and :func:`os.fsencode` use the UTF-8 encoding." -msgstr "" -":func:`os.fsdecode` 和 :func:`os.fsencode` 使用 UTF-8 編碼。" +msgstr ":func:`os.fsdecode` 和 :func:`os.fsencode` 使用 UTF-8 編碼。" #: ../../library/os.rst:137 msgid "" @@ -314,93 +309,93 @@ msgid "" "Return the filename corresponding to the controlling terminal of the process." msgstr "" -#: ../../library/os.rst:181 ../../library/os.rst:322 ../../library/os.rst:337 -#: ../../library/os.rst:358 ../../library/os.rst:367 ../../library/os.rst:376 -#: ../../library/os.rst:389 ../../library/os.rst:398 ../../library/os.rst:426 -#: ../../library/os.rst:434 ../../library/os.rst:442 ../../library/os.rst:462 -#: ../../library/os.rst:480 ../../library/os.rst:491 ../../library/os.rst:503 -#: ../../library/os.rst:512 ../../library/os.rst:522 ../../library/os.rst:533 -#: ../../library/os.rst:545 ../../library/os.rst:579 ../../library/os.rst:586 -#: ../../library/os.rst:593 ../../library/os.rst:602 ../../library/os.rst:639 -#: ../../library/os.rst:652 ../../library/os.rst:661 ../../library/os.rst:678 -#: ../../library/os.rst:687 ../../library/os.rst:694 ../../library/os.rst:703 -#: ../../library/os.rst:712 ../../library/os.rst:719 ../../library/os.rst:726 -#: ../../library/os.rst:735 ../../library/os.rst:792 ../../library/os.rst:831 -#: ../../library/os.rst:953 ../../library/os.rst:979 ../../library/os.rst:992 -#: ../../library/os.rst:1009 ../../library/os.rst:1027 -#: ../../library/os.rst:1038 ../../library/os.rst:1061 -#: ../../library/os.rst:1082 ../../library/os.rst:1094 -#: ../../library/os.rst:1105 ../../library/os.rst:1118 -#: ../../library/os.rst:1139 ../../library/os.rst:1160 -#: ../../library/os.rst:1172 ../../library/os.rst:1183 -#: ../../library/os.rst:1244 ../../library/os.rst:1367 -#: ../../library/os.rst:1379 ../../library/os.rst:1393 -#: ../../library/os.rst:1403 ../../library/os.rst:1418 -#: ../../library/os.rst:1433 ../../library/os.rst:1446 -#: ../../library/os.rst:1463 ../../library/os.rst:1489 -#: ../../library/os.rst:1506 ../../library/os.rst:1520 -#: ../../library/os.rst:1535 ../../library/os.rst:1547 -#: ../../library/os.rst:1574 ../../library/os.rst:1586 -#: ../../library/os.rst:1596 ../../library/os.rst:1610 -#: ../../library/os.rst:1662 ../../library/os.rst:1682 -#: ../../library/os.rst:1691 ../../library/os.rst:1703 -#: ../../library/os.rst:1738 ../../library/os.rst:1762 -#: ../../library/os.rst:1772 ../../library/os.rst:1780 -#: ../../library/os.rst:1789 ../../library/os.rst:1800 -#: ../../library/os.rst:1837 ../../library/os.rst:1864 -#: ../../library/os.rst:1915 ../../library/os.rst:1921 -#: ../../library/os.rst:2087 ../../library/os.rst:2164 -#: ../../library/os.rst:2181 ../../library/os.rst:2195 -#: ../../library/os.rst:2221 ../../library/os.rst:2239 -#: ../../library/os.rst:2255 ../../library/os.rst:2271 -#: ../../library/os.rst:2334 ../../library/os.rst:2358 -#: ../../library/os.rst:2378 ../../library/os.rst:2514 -#: ../../library/os.rst:2536 ../../library/os.rst:2580 -#: ../../library/os.rst:2592 ../../library/os.rst:2614 -#: ../../library/os.rst:3322 ../../library/os.rst:3456 -#: ../../library/os.rst:3479 ../../library/os.rst:3493 -#: ../../library/os.rst:3713 ../../library/os.rst:3738 -#: ../../library/os.rst:3763 ../../library/os.rst:3817 -#: ../../library/os.rst:3826 ../../library/os.rst:3835 -#: ../../library/os.rst:3843 ../../library/os.rst:3852 -#: ../../library/os.rst:3861 ../../library/os.rst:3933 -#: ../../library/os.rst:3996 ../../library/os.rst:4006 -#: ../../library/os.rst:4024 ../../library/os.rst:4033 -#: ../../library/os.rst:4043 ../../library/os.rst:4053 -#: ../../library/os.rst:4063 ../../library/os.rst:4074 -#: ../../library/os.rst:4219 ../../library/os.rst:4288 -#: ../../library/os.rst:4323 ../../library/os.rst:4331 -#: ../../library/os.rst:4338 ../../library/os.rst:4345 -#: ../../library/os.rst:4352 ../../library/os.rst:4359 -#: ../../library/os.rst:4366 ../../library/os.rst:4373 -#: ../../library/os.rst:4381 ../../library/os.rst:4389 -#: ../../library/os.rst:4396 ../../library/os.rst:4403 -#: ../../library/os.rst:4412 ../../library/os.rst:4420 -#: ../../library/os.rst:4428 ../../library/os.rst:4435 -#: ../../library/os.rst:4442 ../../library/os.rst:4491 -#: ../../library/os.rst:4518 ../../library/os.rst:4541 -#: ../../library/os.rst:4557 ../../library/os.rst:4564 -#: ../../library/os.rst:4575 ../../library/os.rst:4585 -#: ../../library/os.rst:4594 ../../library/os.rst:4626 -#: ../../library/os.rst:4734 ../../library/os.rst:4750 -#: ../../library/os.rst:4783 ../../library/os.rst:4852 -#: ../../library/os.rst:4871 ../../library/os.rst:4882 -#: ../../library/os.rst:4894 ../../library/os.rst:4939 -#: ../../library/os.rst:4976 ../../library/os.rst:4999 -#: ../../library/os.rst:5020 ../../library/os.rst:5054 -#: ../../library/os.rst:5095 ../../library/os.rst:5115 -#: ../../library/os.rst:5129 ../../library/os.rst:5146 -#: ../../library/os.rst:5161 ../../library/os.rst:5172 -#: ../../library/os.rst:5184 ../../library/os.rst:5197 -#: ../../library/os.rst:5206 ../../library/os.rst:5216 -#: ../../library/os.rst:5229 ../../library/os.rst:5264 -#: ../../library/os.rst:5280 ../../library/os.rst:5291 -#: ../../library/os.rst:5303 ../../library/os.rst:5310 -#: ../../library/os.rst:5319 ../../library/os.rst:5328 -#: ../../library/os.rst:5337 ../../library/os.rst:5346 -#: ../../library/os.rst:5498 ../../library/os.rst:5507 -#: ../../library/os.rst:5531 ../../library/os.rst:5558 -#: ../../library/os.rst:5567 ../../library/os.rst:5690 +#: ../../library/os.rst:181 ../../library/os.rst:323 ../../library/os.rst:338 +#: ../../library/os.rst:359 ../../library/os.rst:368 ../../library/os.rst:377 +#: ../../library/os.rst:390 ../../library/os.rst:399 ../../library/os.rst:427 +#: ../../library/os.rst:435 ../../library/os.rst:443 ../../library/os.rst:463 +#: ../../library/os.rst:481 ../../library/os.rst:492 ../../library/os.rst:504 +#: ../../library/os.rst:513 ../../library/os.rst:523 ../../library/os.rst:534 +#: ../../library/os.rst:546 ../../library/os.rst:580 ../../library/os.rst:587 +#: ../../library/os.rst:594 ../../library/os.rst:603 ../../library/os.rst:640 +#: ../../library/os.rst:653 ../../library/os.rst:662 ../../library/os.rst:679 +#: ../../library/os.rst:688 ../../library/os.rst:695 ../../library/os.rst:704 +#: ../../library/os.rst:713 ../../library/os.rst:720 ../../library/os.rst:727 +#: ../../library/os.rst:736 ../../library/os.rst:793 ../../library/os.rst:832 +#: ../../library/os.rst:954 ../../library/os.rst:980 ../../library/os.rst:993 +#: ../../library/os.rst:1010 ../../library/os.rst:1028 +#: ../../library/os.rst:1039 ../../library/os.rst:1062 +#: ../../library/os.rst:1083 ../../library/os.rst:1095 +#: ../../library/os.rst:1106 ../../library/os.rst:1119 +#: ../../library/os.rst:1140 ../../library/os.rst:1161 +#: ../../library/os.rst:1173 ../../library/os.rst:1184 +#: ../../library/os.rst:1245 ../../library/os.rst:1368 +#: ../../library/os.rst:1380 ../../library/os.rst:1394 +#: ../../library/os.rst:1404 ../../library/os.rst:1419 +#: ../../library/os.rst:1434 ../../library/os.rst:1447 +#: ../../library/os.rst:1464 ../../library/os.rst:1490 +#: ../../library/os.rst:1507 ../../library/os.rst:1521 +#: ../../library/os.rst:1536 ../../library/os.rst:1548 +#: ../../library/os.rst:1575 ../../library/os.rst:1587 +#: ../../library/os.rst:1597 ../../library/os.rst:1611 +#: ../../library/os.rst:1663 ../../library/os.rst:1683 +#: ../../library/os.rst:1692 ../../library/os.rst:1704 +#: ../../library/os.rst:1739 ../../library/os.rst:1763 +#: ../../library/os.rst:1773 ../../library/os.rst:1781 +#: ../../library/os.rst:1790 ../../library/os.rst:1801 +#: ../../library/os.rst:1838 ../../library/os.rst:1865 +#: ../../library/os.rst:1916 ../../library/os.rst:1922 +#: ../../library/os.rst:2088 ../../library/os.rst:2165 +#: ../../library/os.rst:2182 ../../library/os.rst:2196 +#: ../../library/os.rst:2222 ../../library/os.rst:2240 +#: ../../library/os.rst:2256 ../../library/os.rst:2272 +#: ../../library/os.rst:2335 ../../library/os.rst:2359 +#: ../../library/os.rst:2379 ../../library/os.rst:2515 +#: ../../library/os.rst:2537 ../../library/os.rst:2581 +#: ../../library/os.rst:2593 ../../library/os.rst:2615 +#: ../../library/os.rst:3323 ../../library/os.rst:3457 +#: ../../library/os.rst:3480 ../../library/os.rst:3494 +#: ../../library/os.rst:3714 ../../library/os.rst:3739 +#: ../../library/os.rst:3764 ../../library/os.rst:3818 +#: ../../library/os.rst:3827 ../../library/os.rst:3836 +#: ../../library/os.rst:3844 ../../library/os.rst:3853 +#: ../../library/os.rst:3862 ../../library/os.rst:3934 +#: ../../library/os.rst:3997 ../../library/os.rst:4007 +#: ../../library/os.rst:4025 ../../library/os.rst:4034 +#: ../../library/os.rst:4044 ../../library/os.rst:4054 +#: ../../library/os.rst:4064 ../../library/os.rst:4075 +#: ../../library/os.rst:4220 ../../library/os.rst:4289 +#: ../../library/os.rst:4324 ../../library/os.rst:4332 +#: ../../library/os.rst:4339 ../../library/os.rst:4346 +#: ../../library/os.rst:4353 ../../library/os.rst:4360 +#: ../../library/os.rst:4367 ../../library/os.rst:4374 +#: ../../library/os.rst:4382 ../../library/os.rst:4390 +#: ../../library/os.rst:4397 ../../library/os.rst:4404 +#: ../../library/os.rst:4413 ../../library/os.rst:4421 +#: ../../library/os.rst:4429 ../../library/os.rst:4436 +#: ../../library/os.rst:4443 ../../library/os.rst:4492 +#: ../../library/os.rst:4519 ../../library/os.rst:4542 +#: ../../library/os.rst:4558 ../../library/os.rst:4565 +#: ../../library/os.rst:4576 ../../library/os.rst:4586 +#: ../../library/os.rst:4595 ../../library/os.rst:4627 +#: ../../library/os.rst:4735 ../../library/os.rst:4751 +#: ../../library/os.rst:4784 ../../library/os.rst:4853 +#: ../../library/os.rst:4872 ../../library/os.rst:4883 +#: ../../library/os.rst:4895 ../../library/os.rst:4940 +#: ../../library/os.rst:4977 ../../library/os.rst:5000 +#: ../../library/os.rst:5021 ../../library/os.rst:5055 +#: ../../library/os.rst:5096 ../../library/os.rst:5116 +#: ../../library/os.rst:5130 ../../library/os.rst:5147 +#: ../../library/os.rst:5162 ../../library/os.rst:5173 +#: ../../library/os.rst:5185 ../../library/os.rst:5198 +#: ../../library/os.rst:5207 ../../library/os.rst:5217 +#: ../../library/os.rst:5230 ../../library/os.rst:5265 +#: ../../library/os.rst:5281 ../../library/os.rst:5292 +#: ../../library/os.rst:5304 ../../library/os.rst:5311 +#: ../../library/os.rst:5320 ../../library/os.rst:5329 +#: ../../library/os.rst:5338 ../../library/os.rst:5347 +#: ../../library/os.rst:5499 ../../library/os.rst:5508 +#: ../../library/os.rst:5532 ../../library/os.rst:5559 +#: ../../library/os.rst:5568 ../../library/os.rst:5691 msgid "Availability" msgstr "" @@ -447,8 +442,8 @@ msgid "" "Calling :func:`putenv` directly does not change :data:`os.environ`, so it's " "better to modify :data:`os.environ`." msgstr "" -"呼叫 :func:`putenv` 並不會改變 :data:`os.environ`," -"所以建議直接修改 :data:`os.environ`。" +"呼叫 :func:`putenv` 並不會改變 :data:`os.environ`,所以建議直接修改 :data:" +"`os.environ`。" #: ../../library/os.rst:216 msgid "" @@ -531,17 +526,17 @@ msgid "" "e.g. :class:`pathlib.PurePath`." msgstr "" -#: ../../library/os.rst:304 +#: ../../library/os.rst:305 msgid "Return the file system path representation of the object." msgstr "" -#: ../../library/os.rst:306 +#: ../../library/os.rst:307 msgid "" "The method should only return a :class:`str` or :class:`bytes` object, with " "the preference being for :class:`str`." msgstr "" -#: ../../library/os.rst:312 +#: ../../library/os.rst:313 msgid "" "Return the value of the environment variable *key* as a string if it exists, " "or *default* if it doesn't. *key* is a string. Note that since :func:" @@ -550,14 +545,14 @@ msgid "" "changes." msgstr "" -#: ../../library/os.rst:318 +#: ../../library/os.rst:319 msgid "" "On Unix, keys and values are decoded with :func:`sys.getfilesystemencoding` " "and ``'surrogateescape'`` error handler. Use :func:`os.getenvb` if you would " "like to use a different encoding." msgstr "" -#: ../../library/os.rst:327 +#: ../../library/os.rst:328 msgid "" "Return the value of the environment variable *key* as bytes if it exists, or " "*default* if it doesn't. *key* must be bytes. Note that since :func:" @@ -566,13 +561,13 @@ msgid "" "environment changes." msgstr "" -#: ../../library/os.rst:334 +#: ../../library/os.rst:335 msgid "" ":func:`getenvb` is only available if :const:`supports_bytes_environ` is " "``True``." msgstr "" -#: ../../library/os.rst:344 +#: ../../library/os.rst:345 msgid "" "Returns the list of directories that will be searched for a named " "executable, similar to a shell, when launching a process. *env*, when " @@ -580,28 +575,28 @@ msgid "" "in. By default, when *env* is ``None``, :data:`environ` is used." msgstr "" -#: ../../library/os.rst:355 +#: ../../library/os.rst:356 msgid "" "Return the effective group id of the current process. This corresponds to " "the \"set id\" bit on the file being executed in the current process." msgstr "" -#: ../../library/os.rst:365 +#: ../../library/os.rst:366 msgid "Return the current process's effective user id." msgstr "" -#: ../../library/os.rst:374 +#: ../../library/os.rst:375 msgid "Return the real group id of the current process." msgstr "" -#: ../../library/os.rst:378 ../../library/os.rst:451 ../../library/os.rst:535 -#: ../../library/os.rst:758 +#: ../../library/os.rst:379 ../../library/os.rst:452 ../../library/os.rst:536 +#: ../../library/os.rst:759 msgid "" "The function is a stub on WASI, see :ref:`wasm-availability` for more " "information." msgstr "" -#: ../../library/os.rst:384 +#: ../../library/os.rst:385 msgid "" "Return list of group ids that *user* belongs to. If *group* is not in the " "list, it is included; typically, *group* is specified as the group ID field " @@ -609,12 +604,12 @@ msgid "" "potentially omitted." msgstr "" -#: ../../library/os.rst:396 +#: ../../library/os.rst:397 msgid "" "Return list of supplemental group ids associated with the current process." msgstr "" -#: ../../library/os.rst:402 +#: ../../library/os.rst:403 msgid "" "On macOS, :func:`getgroups` behavior differs somewhat from other Unix " "platforms. If the Python interpreter was built with a deployment target of " @@ -631,7 +626,7 @@ msgid "" "get_config_var`." msgstr "" -#: ../../library/os.rst:419 +#: ../../library/os.rst:420 msgid "" "Return the name of the user logged in on the controlling terminal of the " "process. For most purposes, it is more useful to use :func:`getpass." @@ -640,32 +635,32 @@ msgid "" "getpwuid(os.getuid())[0]`` to get the login name of the current real user id." msgstr "" -#: ../../library/os.rst:431 +#: ../../library/os.rst:432 msgid "" "Return the process group id of the process with process id *pid*. If *pid* " "is 0, the process group id of the current process is returned." msgstr "" -#: ../../library/os.rst:440 +#: ../../library/os.rst:441 msgid "Return the id of the current process group." msgstr "" -#: ../../library/os.rst:449 +#: ../../library/os.rst:450 msgid "Return the current process id." msgstr "" -#: ../../library/os.rst:458 +#: ../../library/os.rst:459 msgid "" "Return the parent's process id. When the parent process has exited, on Unix " "the id returned is the one of the init process (1), on Windows it is still " "the same id, which may be already reused by another process." msgstr "" -#: ../../library/os.rst:464 +#: ../../library/os.rst:465 msgid "Added support for Windows." msgstr "新增對 Windows 的支援。" -#: ../../library/os.rst:472 +#: ../../library/os.rst:473 msgid "" "Get program scheduling priority. The value *which* is one of :const:" "`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* is " @@ -676,42 +671,42 @@ msgid "" "user ID of the calling process." msgstr "" -#: ../../library/os.rst:489 ../../library/os.rst:501 +#: ../../library/os.rst:490 ../../library/os.rst:502 msgid "" "Parameters for the :func:`getpriority` and :func:`setpriority` functions." msgstr "" -#: ../../library/os.rst:509 +#: ../../library/os.rst:510 msgid "" "Return a tuple (ruid, euid, suid) denoting the current process's real, " "effective, and saved user ids." msgstr "" -#: ../../library/os.rst:519 +#: ../../library/os.rst:520 msgid "" "Return a tuple (rgid, egid, sgid) denoting the current process's real, " "effective, and saved group ids." msgstr "" -#: ../../library/os.rst:531 +#: ../../library/os.rst:532 msgid "Return the current process's real user id." msgstr "" -#: ../../library/os.rst:541 +#: ../../library/os.rst:542 msgid "" "Call the system initgroups() to initialize the group access list with all of " "the groups of which the specified username is a member, plus the specified " "group id." msgstr "" -#: ../../library/os.rst:554 +#: ../../library/os.rst:555 msgid "" "Set the environment variable named *key* to the string *value*. Such " "changes to the environment affect subprocesses started with :func:`os." "system`, :func:`popen` or :func:`fork` and :func:`execv`." msgstr "" -#: ../../library/os.rst:558 +#: ../../library/os.rst:559 msgid "" "Assignments to items in :data:`os.environ` are automatically translated into " "corresponding calls to :func:`putenv`; however, calls to :func:`putenv` " @@ -721,13 +716,13 @@ msgid "" "in their implementations." msgstr "" -#: ../../library/os.rst:566 +#: ../../library/os.rst:567 msgid "" "On some platforms, including FreeBSD and macOS, setting ``environ`` may " "cause memory leaks. Refer to the system documentation for :c:func:`!putenv`." msgstr "" -#: ../../library/os.rst:569 +#: ../../library/os.rst:570 msgid "" "Raises an :ref:`auditing event ` ``os.putenv`` with arguments " "``key``, ``value``." @@ -735,24 +730,23 @@ msgstr "" "引發一個附帶引數 ``key``、``value`` 的\\ :ref:`稽核事件 ` ``os." "putenv``。" -#: ../../library/os.rst:571 +#: ../../library/os.rst:572 msgid "The function is now always available." -msgstr "" -"此函式現在都會是可用的。" +msgstr "此函式現在都會是可用的。" -#: ../../library/os.rst:577 +#: ../../library/os.rst:578 msgid "Set the current process's effective group id." msgstr "" -#: ../../library/os.rst:584 +#: ../../library/os.rst:585 msgid "Set the current process's effective user id." msgstr "" -#: ../../library/os.rst:591 +#: ../../library/os.rst:592 msgid "Set the current process' group id." msgstr "" -#: ../../library/os.rst:598 +#: ../../library/os.rst:599 msgid "" "Set the list of supplemental group ids associated with the current process " "to *groups*. *groups* must be a sequence, and each element must be an " @@ -760,7 +754,7 @@ msgid "" "the superuser." msgstr "" -#: ../../library/os.rst:604 +#: ../../library/os.rst:605 msgid "" "On macOS, the length of *groups* may not exceed the system-defined maximum " "number of effective group ids, typically 16. See the documentation for :func:" @@ -768,13 +762,13 @@ msgid "" "calling setgroups()." msgstr "" -#: ../../library/os.rst:611 +#: ../../library/os.rst:612 msgid "" "Reassociate the current thread with a Linux namespace. See the :manpage:" "`setns(2)` and :manpage:`namespaces(7)` man pages for more details." msgstr "" -#: ../../library/os.rst:615 +#: ../../library/os.rst:616 msgid "" "If *fd* refers to a :file:`/proc/{pid}/ns/` link, ``setns()`` reassociates " "the calling thread with the namespace associated with that link, and " @@ -783,7 +777,7 @@ msgid "" "constraints)." msgstr "" -#: ../../library/os.rst:622 +#: ../../library/os.rst:623 msgid "" "Since Linux 5.8, *fd* may refer to a PID file descriptor obtained from :func:" "`~os.pidfd_open`. In this case, ``setns()`` reassociates the calling thread " @@ -794,19 +788,19 @@ msgid "" "memberships in unspecified namespaces are left unchanged." msgstr "" -#: ../../library/os.rst:631 +#: ../../library/os.rst:632 msgid "" "*fd* can be any object with a :meth:`~io.IOBase.fileno` method, or a raw " "file descriptor." msgstr "" -#: ../../library/os.rst:633 +#: ../../library/os.rst:634 msgid "" "This example reassociates the thread with the ``init`` process's network " "namespace::" msgstr "" -#: ../../library/os.rst:635 +#: ../../library/os.rst:636 msgid "" "fd = os.open(\"/proc/1/ns/net\", os.O_RDONLY)\n" "os.setns(fd, os.CLONE_NEWNET)\n" @@ -816,25 +810,25 @@ msgstr "" "os.setns(fd, os.CLONE_NEWNET)\n" "os.close(fd)" -#: ../../library/os.rst:645 +#: ../../library/os.rst:646 msgid "The :func:`~os.unshare` function." msgstr ":func:`~os.unshare` 函式。" -#: ../../library/os.rst:649 +#: ../../library/os.rst:650 msgid "" "Call the system call :c:func:`!setpgrp` or ``setpgrp(0, 0)`` depending on " "which version is implemented (if any). See the Unix manual for the " "semantics." msgstr "" -#: ../../library/os.rst:657 +#: ../../library/os.rst:658 msgid "" "Call the system call :c:func:`!setpgid` to set the process group id of the " "process with id *pid* to the process group with id *pgrp*. See the Unix " "manual for the semantics." msgstr "" -#: ../../library/os.rst:668 +#: ../../library/os.rst:669 msgid "" "Set program scheduling priority. The value *which* is one of :const:" "`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* is " @@ -847,96 +841,96 @@ msgid "" "scheduling." msgstr "" -#: ../../library/os.rst:685 +#: ../../library/os.rst:686 msgid "Set the current process's real and effective group ids." msgstr "" -#: ../../library/os.rst:692 +#: ../../library/os.rst:693 msgid "Set the current process's real, effective, and saved group ids." msgstr "" -#: ../../library/os.rst:701 +#: ../../library/os.rst:702 msgid "Set the current process's real, effective, and saved user ids." msgstr "" -#: ../../library/os.rst:710 +#: ../../library/os.rst:711 msgid "Set the current process's real and effective user ids." msgstr "" -#: ../../library/os.rst:717 +#: ../../library/os.rst:718 msgid "" "Call the system call :c:func:`!getsid`. See the Unix manual for the " "semantics." msgstr "" -#: ../../library/os.rst:724 +#: ../../library/os.rst:725 msgid "" "Call the system call :c:func:`!setsid`. See the Unix manual for the " "semantics." msgstr "" -#: ../../library/os.rst:733 +#: ../../library/os.rst:734 msgid "Set the current process's user id." msgstr "" -#: ../../library/os.rst:741 +#: ../../library/os.rst:742 msgid "" "Return the error message corresponding to the error code in *code*. On " "platforms where :c:func:`!strerror` returns ``NULL`` when given an unknown " "error number, :exc:`ValueError` is raised." msgstr "" -#: ../../library/os.rst:748 +#: ../../library/os.rst:749 msgid "" "``True`` if the native OS type of the environment is bytes (eg. ``False`` on " "Windows)." msgstr "" -#: ../../library/os.rst:756 +#: ../../library/os.rst:757 msgid "Set the current numeric umask and return the previous umask." msgstr "" -#: ../../library/os.rst:768 +#: ../../library/os.rst:769 msgid "" "Returns information identifying the current operating system. The return " "value is an object with five attributes:" msgstr "" -#: ../../library/os.rst:771 +#: ../../library/os.rst:772 msgid ":attr:`sysname` - operating system name" msgstr ":attr:`sysname` - 作業系統名稱" -#: ../../library/os.rst:772 +#: ../../library/os.rst:773 msgid ":attr:`nodename` - name of machine on network (implementation-defined)" msgstr "" -#: ../../library/os.rst:773 +#: ../../library/os.rst:774 msgid ":attr:`release` - operating system release" msgstr "" -#: ../../library/os.rst:774 +#: ../../library/os.rst:775 msgid ":attr:`version` - operating system version" msgstr ":attr:`version` - 作業系統版本" -#: ../../library/os.rst:775 +#: ../../library/os.rst:776 msgid ":attr:`machine` - hardware identifier" msgstr "" -#: ../../library/os.rst:777 +#: ../../library/os.rst:778 msgid "" "For backwards compatibility, this object is also iterable, behaving like a " "five-tuple containing :attr:`sysname`, :attr:`nodename`, :attr:`release`, :" "attr:`version`, and :attr:`machine` in that order." msgstr "" -#: ../../library/os.rst:782 +#: ../../library/os.rst:783 msgid "" "Some systems truncate :attr:`nodename` to 8 characters or to the leading " "component; a better way to get the hostname is :func:`socket.gethostname` " "or even ``socket.gethostbyaddr(socket.gethostname())``." msgstr "" -#: ../../library/os.rst:787 +#: ../../library/os.rst:788 msgid "" "On macOS, iOS and Android, this returns the *kernel* name and version (i.e., " "``'Darwin'`` on macOS and iOS; ``'Linux'`` on Android). :func:`platform." @@ -944,20 +938,20 @@ msgid "" "on iOS and Android." msgstr "" -#: ../../library/os.rst:794 ../../library/os.rst:5001 +#: ../../library/os.rst:795 ../../library/os.rst:5002 msgid "" "Return type changed from a tuple to a tuple-like object with named " "attributes." msgstr "" -#: ../../library/os.rst:803 +#: ../../library/os.rst:804 msgid "" "Unset (delete) the environment variable named *key*. Such changes to the " "environment affect subprocesses started with :func:`os.system`, :func:" "`popen` or :func:`fork` and :func:`execv`." msgstr "" -#: ../../library/os.rst:807 +#: ../../library/os.rst:808 msgid "" "Deletion of items in :data:`os.environ` is automatically translated into a " "corresponding call to :func:`unsetenv`; however, calls to :func:`unsetenv` " @@ -965,18 +959,18 @@ msgid "" "items of :data:`os.environ`." msgstr "" -#: ../../library/os.rst:812 +#: ../../library/os.rst:813 msgid "" "Raises an :ref:`auditing event ` ``os.unsetenv`` with argument " "``key``." msgstr "" "引發一個附帶引數 ``key`` 的\\ :ref:`稽核事件 ` ``os.unsetenv``。" -#: ../../library/os.rst:814 +#: ../../library/os.rst:815 msgid "The function is now always available and is also available on Windows." msgstr "" -#: ../../library/os.rst:820 +#: ../../library/os.rst:821 msgid "" "Disassociate parts of the process execution context, and move them into a " "newly created namespace. See the :manpage:`unshare(2)` man page for more " @@ -987,28 +981,28 @@ msgid "" "are made to the calling process's execution context." msgstr "" -#: ../../library/os.rst:837 +#: ../../library/os.rst:838 msgid "The :func:`~os.setns` function." msgstr ":func:`~os.setns` 函式。" -#: ../../library/os.rst:841 +#: ../../library/os.rst:842 msgid "" "Flags to the :func:`unshare` function, if the implementation supports them. " "See :manpage:`unshare(2)` in the Linux manual for their exact effect and " "availability." msgstr "" -#: ../../library/os.rst:864 +#: ../../library/os.rst:865 msgid "File Object Creation" msgstr "" -#: ../../library/os.rst:866 +#: ../../library/os.rst:867 msgid "" "These functions create new :term:`file objects `. (See also :" "func:`~os.open` for opening file descriptors.)" msgstr "" -#: ../../library/os.rst:872 +#: ../../library/os.rst:873 msgid "" "Return an open file object connected to the file descriptor *fd*. This is " "an alias of the :func:`open` built-in function and accepts the same " @@ -1016,16 +1010,16 @@ msgid "" "must always be an integer." msgstr "" -#: ../../library/os.rst:881 +#: ../../library/os.rst:882 msgid "File Descriptor Operations" msgstr "" -#: ../../library/os.rst:883 +#: ../../library/os.rst:884 msgid "" "These functions operate on I/O streams referenced using file descriptors." msgstr "" -#: ../../library/os.rst:885 +#: ../../library/os.rst:886 msgid "" "File descriptors are small integers corresponding to a file that has been " "opened by the current process. For example, standard input is usually file " @@ -1035,7 +1029,7 @@ msgid "" "pipes are also referenced by file descriptors." msgstr "" -#: ../../library/os.rst:892 +#: ../../library/os.rst:893 msgid "" "The :meth:`~io.IOBase.fileno` method can be used to obtain the file " "descriptor associated with a :term:`file object` when required. Note that " @@ -1043,11 +1037,11 @@ msgid "" "ignoring aspects such as internal buffering of data." msgstr "" -#: ../../library/os.rst:900 +#: ../../library/os.rst:901 msgid "Close file descriptor *fd*." msgstr "" -#: ../../library/os.rst:904 +#: ../../library/os.rst:905 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To close a " @@ -1055,13 +1049,13 @@ msgid "" "`popen` or :func:`fdopen`, use its :meth:`~io.IOBase.close` method." msgstr "" -#: ../../library/os.rst:912 +#: ../../library/os.rst:913 msgid "" "Close all file descriptors from *fd_low* (inclusive) to *fd_high* " "(exclusive), ignoring errors. Equivalent to (but much faster than)::" msgstr "" -#: ../../library/os.rst:915 +#: ../../library/os.rst:916 msgid "" "for fd in range(fd_low, fd_high):\n" " try:\n" @@ -1075,7 +1069,7 @@ msgstr "" " except OSError:\n" " pass" -#: ../../library/os.rst:924 +#: ../../library/os.rst:925 msgid "" "Copy *count* bytes from file descriptor *src*, starting from offset " "*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " @@ -1083,14 +1077,14 @@ msgid "" "respectively for *offset_dst*." msgstr "" -#: ../../library/os.rst:929 +#: ../../library/os.rst:930 msgid "" "In Linux kernel older than 5.3, the files pointed to by *src* and *dst* must " "reside in the same filesystem, otherwise an :exc:`OSError` is raised with :" "attr:`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" -#: ../../library/os.rst:933 +#: ../../library/os.rst:934 msgid "" "This copy is done without the additional cost of transferring data from the " "kernel to user space and then back into the kernel. Additionally, some " @@ -1100,19 +1094,19 @@ msgid "" "(in the case of NFS)." msgstr "" -#: ../../library/os.rst:940 +#: ../../library/os.rst:941 msgid "" "The function copies bytes between two file descriptors. Text options, like " "the encoding and the line ending, are ignored." msgstr "" -#: ../../library/os.rst:943 +#: ../../library/os.rst:944 msgid "" "The return value is the amount of bytes copied. This could be less than the " "amount requested." msgstr "" -#: ../../library/os.rst:948 +#: ../../library/os.rst:949 msgid "" "On Linux, :func:`os.copy_file_range` should not be used for copying a range " "of a pseudo file from a special filesystem like procfs and sysfs. It will " @@ -1120,39 +1114,39 @@ msgid "" "known Linux kernel issue." msgstr "" -#: ../../library/os.rst:960 +#: ../../library/os.rst:961 msgid "" "Return a string describing the encoding of the device associated with *fd* " "if it is connected to a terminal; else return :const:`None`." msgstr "" -#: ../../library/os.rst:963 +#: ../../library/os.rst:964 msgid "" "On Unix, if the :ref:`Python UTF-8 Mode ` is enabled, return " "``'UTF-8'`` rather than the device encoding." msgstr "" -#: ../../library/os.rst:966 +#: ../../library/os.rst:967 msgid "On Unix, the function now implements the Python UTF-8 Mode." msgstr "" -#: ../../library/os.rst:972 +#: ../../library/os.rst:973 msgid "" "Return a duplicate of file descriptor *fd*. The new file descriptor is :ref:" "`non-inheritable `." msgstr "" -#: ../../library/os.rst:975 +#: ../../library/os.rst:976 msgid "" "On Windows, when duplicating a standard stream (0: stdin, 1: stdout, 2: " "stderr), the new file descriptor is :ref:`inheritable `." msgstr "" -#: ../../library/os.rst:981 ../../library/os.rst:1266 +#: ../../library/os.rst:982 ../../library/os.rst:1267 msgid "The new file descriptor is now non-inheritable." msgstr "" -#: ../../library/os.rst:987 +#: ../../library/os.rst:988 msgid "" "Duplicate file descriptor *fd* to *fd2*, closing the latter first if " "necessary. Return *fd2*. The new file descriptor is :ref:`inheritable " @@ -1160,23 +1154,23 @@ msgid "" "``False``." msgstr "" -#: ../../library/os.rst:994 +#: ../../library/os.rst:995 msgid "Add the optional *inheritable* parameter." -msgstr "" +msgstr "新增可選用的參數 *inheritable*。" -#: ../../library/os.rst:997 +#: ../../library/os.rst:998 msgid "Return *fd2* on success. Previously, ``None`` was always returned." msgstr "" -#: ../../library/os.rst:1003 +#: ../../library/os.rst:1004 msgid "" "Change the mode of the file given by *fd* to the numeric *mode*. See the " "docs for :func:`chmod` for possible values of *mode*. As of Python 3.3, " "this is equivalent to ``os.chmod(fd, mode)``." msgstr "" -#: ../../library/os.rst:1007 ../../library/os.rst:2136 -#: ../../library/os.rst:2237 +#: ../../library/os.rst:1008 ../../library/os.rst:2137 +#: ../../library/os.rst:2238 msgid "" "Raises an :ref:`auditing event ` ``os.chmod`` with arguments " "``path``, ``mode``, ``dir_fd``." @@ -1184,28 +1178,28 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.chmod``。" -#: ../../library/os.rst:1011 ../../library/os.rst:1029 -#: ../../library/os.rst:1120 ../../library/os.rst:1705 -#: ../../library/os.rst:2133 ../../library/os.rst:2166 -#: ../../library/os.rst:3458 +#: ../../library/os.rst:1012 ../../library/os.rst:1030 +#: ../../library/os.rst:1121 ../../library/os.rst:1706 +#: ../../library/os.rst:2134 ../../library/os.rst:2167 +#: ../../library/os.rst:3459 msgid "" "The function is limited on WASI, see :ref:`wasm-availability` for more " "information." msgstr "" -#: ../../library/os.rst:1014 ../../library/os.rst:2244 +#: ../../library/os.rst:1015 ../../library/os.rst:2245 msgid "Added support on Windows." msgstr "新增對 Windows 的支援。" -#: ../../library/os.rst:1020 +#: ../../library/os.rst:1021 msgid "" "Change the owner and group id of the file given by *fd* to the numeric *uid* " "and *gid*. To leave one of the ids unchanged, set it to -1. See :func:" "`chown`. As of Python 3.3, this is equivalent to ``os.chown(fd, uid, gid)``." msgstr "" -#: ../../library/os.rst:1025 ../../library/os.rst:2162 -#: ../../library/os.rst:2253 +#: ../../library/os.rst:1026 ../../library/os.rst:2163 +#: ../../library/os.rst:2254 msgid "" "Raises an :ref:`auditing event ` ``os.chown`` with arguments " "``path``, ``uid``, ``gid``, ``dir_fd``." @@ -1213,17 +1207,17 @@ msgstr "" "引發一個附帶引數 ``path``、``uid``、``gid``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.chown``。" -#: ../../library/os.rst:1035 +#: ../../library/os.rst:1036 msgid "" "Force write of file with filedescriptor *fd* to disk. Does not force update " "of metadata." msgstr "" -#: ../../library/os.rst:1041 +#: ../../library/os.rst:1042 msgid "This function is not available on MacOS." msgstr "" -#: ../../library/os.rst:1046 +#: ../../library/os.rst:1047 msgid "" "Return system configuration information relevant to an open file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -1234,7 +1228,7 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:1054 ../../library/os.rst:2572 +#: ../../library/os.rst:1055 ../../library/os.rst:2573 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " @@ -1242,53 +1236,53 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:1059 +#: ../../library/os.rst:1060 msgid "As of Python 3.3, this is equivalent to ``os.pathconf(fd, name)``." msgstr "" -#: ../../library/os.rst:1066 +#: ../../library/os.rst:1067 msgid "" "Get the status of the file descriptor *fd*. Return a :class:`stat_result` " "object." msgstr "" -#: ../../library/os.rst:1069 +#: ../../library/os.rst:1070 msgid "As of Python 3.3, this is equivalent to ``os.stat(fd)``." msgstr "" -#: ../../library/os.rst:1073 ../../library/os.rst:2400 +#: ../../library/os.rst:1074 ../../library/os.rst:2401 msgid "The :func:`.stat` function." msgstr "" -#: ../../library/os.rst:1078 +#: ../../library/os.rst:1079 msgid "" "Return information about the filesystem containing the file associated with " "file descriptor *fd*, like :func:`statvfs`. As of Python 3.3, this is " "equivalent to ``os.statvfs(fd)``." msgstr "" -#: ../../library/os.rst:1087 +#: ../../library/os.rst:1088 msgid "" "Force write of file with filedescriptor *fd* to disk. On Unix, this calls " "the native :c:func:`!fsync` function; on Windows, the MS :c:func:`!_commit` " "function." msgstr "" -#: ../../library/os.rst:1090 +#: ../../library/os.rst:1091 msgid "" "If you're starting with a buffered Python :term:`file object` *f*, first do " "``f.flush()``, and then do ``os.fsync(f.fileno())``, to ensure that all " "internal buffers associated with *f* are written to disk." msgstr "" -#: ../../library/os.rst:1099 +#: ../../library/os.rst:1100 msgid "" "Truncate the file corresponding to file descriptor *fd*, so that it is at " "most *length* bytes in size. As of Python 3.3, this is equivalent to ``os." "truncate(fd, length)``." msgstr "" -#: ../../library/os.rst:1103 +#: ../../library/os.rst:1104 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``fd``, ``length``." @@ -1296,46 +1290,46 @@ msgstr "" "引發一個附帶引數 ``fd``、``length`` 的\\ :ref:`稽核事件 ` ``os." "truncate``。" -#: ../../library/os.rst:1107 ../../library/os.rst:3497 +#: ../../library/os.rst:1108 ../../library/os.rst:3498 msgid "Added support for Windows" msgstr "新增對 Windows 的支援" -#: ../../library/os.rst:1113 +#: ../../library/os.rst:1114 msgid "" "Get the blocking mode of the file descriptor: ``False`` if the :data:" "`O_NONBLOCK` flag is set, ``True`` if the flag is cleared." msgstr "" -#: ../../library/os.rst:1116 +#: ../../library/os.rst:1117 msgid "See also :func:`set_blocking` and :meth:`socket.socket.setblocking`." msgstr "另請參閱 :func:`set_blocking` 與 :meth:`socket.socket.setblocking`。" -#: ../../library/os.rst:1123 ../../library/os.rst:1708 +#: ../../library/os.rst:1124 ../../library/os.rst:1709 msgid "On Windows, this function is limited to pipes." msgstr "" -#: ../../library/os.rst:1127 ../../library/os.rst:1712 +#: ../../library/os.rst:1128 ../../library/os.rst:1713 msgid "Added support for pipes on Windows." msgstr "新增對 Windows 上的 pipe 支援。" -#: ../../library/os.rst:1133 +#: ../../library/os.rst:1134 msgid "" "Grant access to the slave pseudo-terminal device associated with the master " "pseudo-terminal device to which the file descriptor *fd* refers. The file " "descriptor *fd* is not closed upon failure." msgstr "" -#: ../../library/os.rst:1137 +#: ../../library/os.rst:1138 msgid "Calls the C standard library function :c:func:`grantpt`." msgstr "" -#: ../../library/os.rst:1146 +#: ../../library/os.rst:1147 msgid "" "Return ``True`` if the file descriptor *fd* is open and connected to a tty(-" "like) device, else ``False``." msgstr "" -#: ../../library/os.rst:1152 +#: ../../library/os.rst:1153 msgid "" "Apply, test or remove a POSIX lock on an open file descriptor. *fd* is an " "open file descriptor. *cmd* specifies the command to use - one of :data:" @@ -1343,7 +1337,7 @@ msgid "" "specifies the section of the file to lock." msgstr "" -#: ../../library/os.rst:1158 +#: ../../library/os.rst:1159 msgid "" "Raises an :ref:`auditing event ` ``os.lockf`` with arguments " "``fd``, ``cmd``, ``len``." @@ -1351,119 +1345,119 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``len`` 的\\ :ref:`稽核事件 ` " "``os.lockf``。" -#: ../../library/os.rst:1170 +#: ../../library/os.rst:1171 msgid "Flags that specify what action :func:`lockf` will take." msgstr "" -#: ../../library/os.rst:1179 +#: ../../library/os.rst:1180 msgid "" "Prepare the tty of which fd is a file descriptor for a new login session. " "Make the calling process a session leader; make the tty the controlling tty, " "the stdin, the stdout, and the stderr of the calling process; close fd." msgstr "" -#: ../../library/os.rst:1190 +#: ../../library/os.rst:1191 msgid "" "Set the current position of file descriptor *fd* to position *pos*, modified " "by *whence*, and return the new position in bytes relative to the start of " "the file. Valid values for *whence* are:" msgstr "" -#: ../../library/os.rst:1195 +#: ../../library/os.rst:1196 msgid "" ":const:`SEEK_SET` or ``0`` -- set *pos* relative to the beginning of the file" msgstr "" -#: ../../library/os.rst:1196 +#: ../../library/os.rst:1197 msgid "" ":const:`SEEK_CUR` or ``1`` -- set *pos* relative to the current file position" msgstr "" -#: ../../library/os.rst:1197 +#: ../../library/os.rst:1198 msgid ":const:`SEEK_END` or ``2`` -- set *pos* relative to the end of the file" msgstr "" -#: ../../library/os.rst:1198 +#: ../../library/os.rst:1199 msgid "" ":const:`SEEK_HOLE` -- set *pos* to the next data location, relative to *pos*" msgstr "" -#: ../../library/os.rst:1199 +#: ../../library/os.rst:1200 msgid "" ":const:`SEEK_DATA` -- set *pos* to the next data hole, relative to *pos*" msgstr "" -#: ../../library/os.rst:1203 +#: ../../library/os.rst:1204 msgid "Add support for :const:`!SEEK_HOLE` and :const:`!SEEK_DATA`." msgstr "" -#: ../../library/os.rst:1210 +#: ../../library/os.rst:1211 msgid "" "Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` " "method on :term:`file-like objects `, for whence to adjust the " "file position indicator." msgstr "" -#: ../../library/os.rst:1214 +#: ../../library/os.rst:1215 msgid ":const:`SEEK_SET`" msgstr ":const:`SEEK_SET`" -#: ../../library/os.rst:1215 +#: ../../library/os.rst:1216 msgid "Adjust the file position relative to the beginning of the file." msgstr "" -#: ../../library/os.rst:1216 +#: ../../library/os.rst:1217 msgid ":const:`SEEK_CUR`" msgstr ":const:`SEEK_CUR`" -#: ../../library/os.rst:1217 +#: ../../library/os.rst:1218 msgid "Adjust the file position relative to the current file position." msgstr "" -#: ../../library/os.rst:1218 +#: ../../library/os.rst:1219 msgid ":const:`SEEK_END`" msgstr ":const:`SEEK_END`" -#: ../../library/os.rst:1219 +#: ../../library/os.rst:1220 msgid "Adjust the file position relative to the end of the file." msgstr "" -#: ../../library/os.rst:1221 +#: ../../library/os.rst:1222 msgid "Their values are 0, 1, and 2, respectively." msgstr "" -#: ../../library/os.rst:1227 +#: ../../library/os.rst:1228 msgid "" "Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` " "method on :term:`file-like objects `, for seeking file data and " "holes on sparsely allocated files." msgstr "" -#: ../../library/os.rst:1231 +#: ../../library/os.rst:1232 msgid ":data:`!SEEK_DATA`" msgstr ":data:`!SEEK_DATA`" -#: ../../library/os.rst:1232 +#: ../../library/os.rst:1233 msgid "" "Adjust the file offset to the next location containing data, relative to the " "seek position." msgstr "" -#: ../../library/os.rst:1235 +#: ../../library/os.rst:1236 msgid ":data:`!SEEK_HOLE`" msgstr ":data:`!SEEK_HOLE`" -#: ../../library/os.rst:1236 +#: ../../library/os.rst:1237 msgid "" "Adjust the file offset to the next location containing a hole, relative to " "the seek position. A hole is defined as a sequence of zeros." msgstr "" -#: ../../library/os.rst:1242 +#: ../../library/os.rst:1243 msgid "These operations only make sense for filesystems that support them." msgstr "" -#: ../../library/os.rst:1251 +#: ../../library/os.rst:1252 msgid "" "Open the file *path* and set various flags according to *flags* and possibly " "its mode according to *mode*. When computing *mode*, the current umask " @@ -1471,7 +1465,7 @@ msgid "" "file. The new file descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:1256 +#: ../../library/os.rst:1257 msgid "" "For a description of the flag and mode values, see the C run-time " "documentation; flag constants (like :const:`O_RDONLY` and :const:`O_WRONLY`) " @@ -1479,13 +1473,13 @@ msgid "" "const:`O_BINARY` is needed to open files in binary mode." msgstr "" -#: ../../library/os.rst:1261 +#: ../../library/os.rst:1262 msgid "" "This function can support :ref:`paths relative to directory descriptors " "` with the *dir_fd* parameter." msgstr "" -#: ../../library/os.rst:1264 +#: ../../library/os.rst:1265 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." @@ -1493,7 +1487,7 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " "` ``open``。" -#: ../../library/os.rst:1271 +#: ../../library/os.rst:1272 msgid "" "This function is intended for low-level I/O. For normal usage, use the " "built-in function :func:`open`, which returns a :term:`file object` with :" @@ -1501,41 +1495,41 @@ msgid "" "a file descriptor in a file object, use :func:`fdopen`." msgstr "" -#: ../../library/os.rst:1276 ../../library/os.rst:2405 -#: ../../library/os.rst:2445 ../../library/os.rst:2516 -#: ../../library/os.rst:2538 ../../library/os.rst:2619 -#: ../../library/os.rst:2649 ../../library/os.rst:2756 -#: ../../library/os.rst:3513 +#: ../../library/os.rst:1277 ../../library/os.rst:2406 +#: ../../library/os.rst:2446 ../../library/os.rst:2517 +#: ../../library/os.rst:2539 ../../library/os.rst:2620 +#: ../../library/os.rst:2650 ../../library/os.rst:2757 +#: ../../library/os.rst:3514 msgid "Added the *dir_fd* parameter." msgstr "新增 *dir_fd* 參數。" -#: ../../library/os.rst:1279 ../../library/os.rst:1630 -#: ../../library/os.rst:1819 ../../library/os.rst:5097 +#: ../../library/os.rst:1280 ../../library/os.rst:1631 +#: ../../library/os.rst:1820 ../../library/os.rst:5098 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the function now retries the system call instead of raising an :" "exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: ../../library/os.rst:1284 ../../library/os.rst:2029 -#: ../../library/os.rst:2061 ../../library/os.rst:2092 -#: ../../library/os.rst:2142 ../../library/os.rst:2183 -#: ../../library/os.rst:2223 ../../library/os.rst:2241 -#: ../../library/os.rst:2257 ../../library/os.rst:2316 -#: ../../library/os.rst:2408 ../../library/os.rst:2448 -#: ../../library/os.rst:2492 ../../library/os.rst:2519 -#: ../../library/os.rst:2541 ../../library/os.rst:2582 -#: ../../library/os.rst:2652 ../../library/os.rst:2671 -#: ../../library/os.rst:2759 ../../library/os.rst:3049 -#: ../../library/os.rst:3336 ../../library/os.rst:3500 -#: ../../library/os.rst:3516 ../../library/os.rst:3556 -#: ../../library/os.rst:3656 ../../library/os.rst:3717 -#: ../../library/os.rst:4114 ../../library/os.rst:4294 -#: ../../library/os.rst:4859 +#: ../../library/os.rst:1285 ../../library/os.rst:2030 +#: ../../library/os.rst:2062 ../../library/os.rst:2093 +#: ../../library/os.rst:2143 ../../library/os.rst:2184 +#: ../../library/os.rst:2224 ../../library/os.rst:2242 +#: ../../library/os.rst:2258 ../../library/os.rst:2317 +#: ../../library/os.rst:2409 ../../library/os.rst:2449 +#: ../../library/os.rst:2493 ../../library/os.rst:2520 +#: ../../library/os.rst:2542 ../../library/os.rst:2583 +#: ../../library/os.rst:2653 ../../library/os.rst:2672 +#: ../../library/os.rst:2760 ../../library/os.rst:3050 +#: ../../library/os.rst:3337 ../../library/os.rst:3501 +#: ../../library/os.rst:3517 ../../library/os.rst:3557 +#: ../../library/os.rst:3657 ../../library/os.rst:3718 +#: ../../library/os.rst:4115 ../../library/os.rst:4295 +#: ../../library/os.rst:4860 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:1287 +#: ../../library/os.rst:1288 msgid "" "The following constants are options for the *flags* parameter to the :func:" "`~os.open` function. They can be combined using the bitwise OR operator ``|" @@ -1545,45 +1539,45 @@ msgid "" "on Windows." msgstr "" -#: ../../library/os.rst:1302 +#: ../../library/os.rst:1303 msgid "The above constants are available on Unix and Windows." msgstr "" -#: ../../library/os.rst:1313 +#: ../../library/os.rst:1314 msgid "The above constants are only available on Unix." msgstr "" -#: ../../library/os.rst:1315 +#: ../../library/os.rst:1316 msgid "Add :data:`O_CLOEXEC` constant." msgstr "" -#: ../../library/os.rst:1326 +#: ../../library/os.rst:1327 msgid "The above constants are only available on Windows." msgstr "" -#: ../../library/os.rst:1333 +#: ../../library/os.rst:1334 msgid "The above constants are only available on macOS." msgstr "" -#: ../../library/os.rst:1335 +#: ../../library/os.rst:1336 msgid "" "Add :data:`O_EVTONLY`, :data:`O_FSYNC`, :data:`O_SYMLINK` and :data:" "`O_NOFOLLOW_ANY` constants." msgstr "" -#: ../../library/os.rst:1349 +#: ../../library/os.rst:1350 msgid "" "The above constants are extensions and not present if they are not defined " "by the C library." msgstr "" -#: ../../library/os.rst:1352 +#: ../../library/os.rst:1353 msgid "" "Add :data:`O_PATH` on systems that support it. Add :data:`O_TMPFILE`, only " "available on Linux Kernel 3.11 or newer." msgstr "" -#: ../../library/os.rst:1362 +#: ../../library/os.rst:1363 msgid "" "Open a new pseudo-terminal pair. Return a pair of file descriptors " "``(master, slave)`` for the pty and the tty, respectively. The new file " @@ -1591,18 +1585,18 @@ msgid "" "more portable approach, use the :mod:`pty` module." msgstr "" -#: ../../library/os.rst:1369 ../../library/os.rst:1381 +#: ../../library/os.rst:1370 ../../library/os.rst:1382 msgid "The new file descriptors are now non-inheritable." msgstr "" -#: ../../library/os.rst:1375 +#: ../../library/os.rst:1376 msgid "" "Create a pipe. Return a pair of file descriptors ``(r, w)`` usable for " "reading and writing, respectively. The new file descriptor is :ref:`non-" "inheritable `." msgstr "" -#: ../../library/os.rst:1387 +#: ../../library/os.rst:1388 msgid "" "Create a pipe with *flags* set atomically. *flags* can be constructed by " "ORing together one or more of these values: :data:`O_NONBLOCK`, :data:" @@ -1610,13 +1604,13 @@ msgid "" "and writing, respectively." msgstr "" -#: ../../library/os.rst:1400 +#: ../../library/os.rst:1401 msgid "" "Ensures that enough disk space is allocated for the file specified by *fd* " "starting from *offset* and continuing for *len* bytes." msgstr "" -#: ../../library/os.rst:1410 +#: ../../library/os.rst:1411 msgid "" "Announces an intention to access data in a specific pattern thus allowing " "the kernel to make optimizations. The advice applies to the region of the " @@ -1627,43 +1621,43 @@ msgid "" "`POSIX_FADV_DONTNEED`." msgstr "" -#: ../../library/os.rst:1430 +#: ../../library/os.rst:1431 msgid "" "Flags that can be used in *advice* in :func:`posix_fadvise` that specify the " "access pattern that is likely to be used." msgstr "" -#: ../../library/os.rst:1440 +#: ../../library/os.rst:1441 msgid "" "Read at most *n* bytes from file descriptor *fd* at a position of *offset*, " "leaving the file offset unchanged." msgstr "" -#: ../../library/os.rst:1443 ../../library/os.rst:1619 +#: ../../library/os.rst:1444 ../../library/os.rst:1620 msgid "" "Return a bytestring containing the bytes read. If the end of the file " "referred to by *fd* has been reached, an empty bytes object is returned." msgstr "" -#: ../../library/os.rst:1453 +#: ../../library/os.rst:1454 msgid "Open and return a file descriptor for a master pseudo-terminal device." msgstr "" -#: ../../library/os.rst:1455 +#: ../../library/os.rst:1456 msgid "" "Calls the C standard library function :c:func:`posix_openpt`. The *oflag* " "argument is used to set file status flags and file access modes as specified " "in the manual page of :c:func:`posix_openpt` of your system." msgstr "" -#: ../../library/os.rst:1459 +#: ../../library/os.rst:1460 msgid "" "The returned file descriptor is :ref:`non-inheritable `. If " "the value :data:`O_CLOEXEC` is available on the system, it is added to " "*oflag*." msgstr "" -#: ../../library/os.rst:1470 +#: ../../library/os.rst:1471 msgid "" "Read from a file descriptor *fd* at a position of *offset* into mutable :" "term:`bytes-like objects ` *buffers*, leaving the file " @@ -1671,92 +1665,92 @@ msgid "" "move on to the next buffer in the sequence to hold the rest of the data." msgstr "" -#: ../../library/os.rst:1475 ../../library/os.rst:1560 +#: ../../library/os.rst:1476 ../../library/os.rst:1561 msgid "" "The flags argument contains a bitwise OR of zero or more of the following " "flags:" msgstr "" -#: ../../library/os.rst:1478 +#: ../../library/os.rst:1479 msgid ":data:`RWF_HIPRI`" msgstr ":data:`RWF_HIPRI`" -#: ../../library/os.rst:1479 +#: ../../library/os.rst:1480 msgid ":data:`RWF_NOWAIT`" msgstr ":data:`RWF_NOWAIT`" -#: ../../library/os.rst:1481 ../../library/os.rst:1756 +#: ../../library/os.rst:1482 ../../library/os.rst:1757 msgid "" "Return the total number of bytes actually read which can be less than the " "total capacity of all the objects." msgstr "" -#: ../../library/os.rst:1484 ../../library/os.rst:1569 -#: ../../library/os.rst:1759 ../../library/os.rst:1834 +#: ../../library/os.rst:1485 ../../library/os.rst:1570 +#: ../../library/os.rst:1760 ../../library/os.rst:1835 msgid "" "The operating system may set a limit (:func:`sysconf` value " "``'SC_IOV_MAX'``) on the number of buffers that can be used." msgstr "" -#: ../../library/os.rst:1487 +#: ../../library/os.rst:1488 msgid "Combine the functionality of :func:`os.readv` and :func:`os.pread`." msgstr "" -#: ../../library/os.rst:1491 ../../library/os.rst:1576 +#: ../../library/os.rst:1492 ../../library/os.rst:1577 msgid "Using flags requires Linux >= 4.6." msgstr "" -#: ../../library/os.rst:1498 +#: ../../library/os.rst:1499 msgid "" "Do not wait for data which is not immediately available. If this flag is " "specified, the system call will return instantly if it would have to read " "data from the backing storage or wait for a lock." msgstr "" -#: ../../library/os.rst:1502 +#: ../../library/os.rst:1503 msgid "" "If some data was successfully read, it will return the number of bytes read. " "If no bytes were read, it will return ``-1`` and set errno to :const:`errno." "EAGAIN`." msgstr "" -#: ../../library/os.rst:1513 +#: ../../library/os.rst:1514 msgid "" "High priority read/write. Allows block-based filesystems to use polling of " "the device, which provides lower latency, but may use additional resources." msgstr "" -#: ../../library/os.rst:1517 +#: ../../library/os.rst:1518 msgid "" "Currently, on Linux, this feature is usable only on a file descriptor opened " "using the :data:`O_DIRECT` flag." msgstr "" -#: ../../library/os.rst:1527 +#: ../../library/os.rst:1528 msgid "" "Return the name of the slave pseudo-terminal device associated with the " "master pseudo-terminal device to which the file descriptor *fd* refers. The " "file descriptor *fd* is not closed upon failure." msgstr "" -#: ../../library/os.rst:1531 +#: ../../library/os.rst:1532 msgid "" "Calls the reentrant C standard library function :c:func:`ptsname_r` if it is " "available; otherwise, the C standard library function :c:func:`ptsname`, " "which is not guaranteed to be thread-safe, is called." msgstr "" -#: ../../library/os.rst:1542 +#: ../../library/os.rst:1543 msgid "" "Write the bytestring in *str* to file descriptor *fd* at position of " "*offset*, leaving the file offset unchanged." msgstr "" -#: ../../library/os.rst:1545 ../../library/os.rst:1809 +#: ../../library/os.rst:1546 ../../library/os.rst:1810 msgid "Return the number of bytes actually written." msgstr "" -#: ../../library/os.rst:1554 +#: ../../library/os.rst:1555 msgid "" "Write the *buffers* contents to file descriptor *fd* at an offset *offset*, " "leaving the file offset unchanged. *buffers* must be a sequence of :term:" @@ -1765,39 +1759,39 @@ msgid "" "the second, and so on." msgstr "" -#: ../../library/os.rst:1563 +#: ../../library/os.rst:1564 msgid ":data:`RWF_DSYNC`" msgstr ":data:`RWF_DSYNC`" -#: ../../library/os.rst:1564 +#: ../../library/os.rst:1565 msgid ":data:`RWF_SYNC`" msgstr ":data:`RWF_SYNC`" -#: ../../library/os.rst:1565 +#: ../../library/os.rst:1566 msgid ":data:`RWF_APPEND`" msgstr ":data:`RWF_APPEND`" -#: ../../library/os.rst:1567 +#: ../../library/os.rst:1568 msgid "Return the total number of bytes actually written." msgstr "" -#: ../../library/os.rst:1572 +#: ../../library/os.rst:1573 msgid "Combine the functionality of :func:`os.writev` and :func:`os.pwrite`." msgstr "" -#: ../../library/os.rst:1583 +#: ../../library/os.rst:1584 msgid "" "Provide a per-write equivalent of the :data:`O_DSYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: ../../library/os.rst:1593 +#: ../../library/os.rst:1594 msgid "" "Provide a per-write equivalent of the :data:`O_SYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: ../../library/os.rst:1603 +#: ../../library/os.rst:1604 msgid "" "Provide a per-write equivalent of the :data:`O_APPEND` :func:`os.open` flag. " "This flag is meaningful only for :func:`os.pwritev`, and its effect applies " @@ -1807,11 +1801,11 @@ msgid "" "*offset* is updated." msgstr "" -#: ../../library/os.rst:1617 +#: ../../library/os.rst:1618 msgid "Read at most *n* bytes from file descriptor *fd*." msgstr "" -#: ../../library/os.rst:1624 +#: ../../library/os.rst:1625 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To read a \"file " @@ -1820,26 +1814,26 @@ msgid "" "`~file.readline` methods." msgstr "" -#: ../../library/os.rst:1639 +#: ../../library/os.rst:1640 msgid "" "Copy *count* bytes from file descriptor *in_fd* to file descriptor *out_fd* " "starting at *offset*. Return the number of bytes sent. When EOF is reached " "return ``0``." msgstr "" -#: ../../library/os.rst:1643 +#: ../../library/os.rst:1644 msgid "" "The first function notation is supported by all platforms that define :func:" "`sendfile`." msgstr "" -#: ../../library/os.rst:1646 +#: ../../library/os.rst:1647 msgid "" "On Linux, if *offset* is given as ``None``, the bytes are read from the " "current position of *in_fd* and the position of *in_fd* is updated." msgstr "" -#: ../../library/os.rst:1649 +#: ../../library/os.rst:1650 msgid "" "The second case may be used on macOS and FreeBSD where *headers* and " "*trailers* are arbitrary sequences of buffers that are written before and " @@ -1847,58 +1841,58 @@ msgid "" "case." msgstr "" -#: ../../library/os.rst:1653 +#: ../../library/os.rst:1654 msgid "" "On macOS and FreeBSD, a value of ``0`` for *count* specifies to send until " "the end of *in_fd* is reached." msgstr "" -#: ../../library/os.rst:1656 +#: ../../library/os.rst:1657 msgid "" "All platforms support sockets as *out_fd* file descriptor, and some " "platforms allow other types (e.g. regular file, pipe) as well." msgstr "" -#: ../../library/os.rst:1659 +#: ../../library/os.rst:1660 msgid "" "Cross-platform applications should not use *headers*, *trailers* and *flags* " "arguments." msgstr "" -#: ../../library/os.rst:1666 +#: ../../library/os.rst:1667 msgid "" "For a higher-level wrapper of :func:`sendfile`, see :meth:`socket.socket." "sendfile`." msgstr "" -#: ../../library/os.rst:1671 +#: ../../library/os.rst:1672 msgid "Parameters *out* and *in* was renamed to *out_fd* and *in_fd*." msgstr "" -#: ../../library/os.rst:1679 +#: ../../library/os.rst:1680 msgid "" "Parameters to the :func:`sendfile` function, if the implementation supports " "them." msgstr "" -#: ../../library/os.rst:1688 +#: ../../library/os.rst:1689 msgid "" "Parameter to the :func:`sendfile` function, if the implementation supports " "it. The data won't be cached in the virtual memory and will be freed " "afterwards." msgstr "" -#: ../../library/os.rst:1698 +#: ../../library/os.rst:1699 msgid "" "Set the blocking mode of the specified file descriptor. Set the :data:" "`O_NONBLOCK` flag if blocking is ``False``, clear the flag otherwise." msgstr "" -#: ../../library/os.rst:1701 +#: ../../library/os.rst:1702 msgid "See also :func:`get_blocking` and :meth:`socket.socket.setblocking`." msgstr "另請參閱 :func:`get_blocking` 與 :meth:`socket.socket.setblocking`。" -#: ../../library/os.rst:1718 +#: ../../library/os.rst:1719 msgid "" "Transfer *count* bytes from file descriptor *src*, starting from offset " "*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " @@ -1910,7 +1904,7 @@ msgid "" "`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" -#: ../../library/os.rst:1727 +#: ../../library/os.rst:1728 msgid "" "This copy is done without the additional cost of transferring data from the " "kernel to user space and then back into the kernel. Additionally, some " @@ -1918,7 +1912,7 @@ msgid "" "files are opened as binary." msgstr "" -#: ../../library/os.rst:1732 +#: ../../library/os.rst:1733 msgid "" "Upon successful completion, returns the number of bytes spliced to or from " "the pipe. A return value of 0 means end of input. If *src* refers to a pipe, " @@ -1927,7 +1921,7 @@ msgid "" "the pipe." msgstr "" -#: ../../library/os.rst:1751 +#: ../../library/os.rst:1752 msgid "" "Read from a file descriptor *fd* into a number of mutable :term:`bytes-like " "objects ` *buffers*. Transfer data into each buffer until " @@ -1935,41 +1929,41 @@ msgid "" "rest of the data." msgstr "" -#: ../../library/os.rst:1769 +#: ../../library/os.rst:1770 msgid "" "Return the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`)." msgstr "" -#: ../../library/os.rst:1777 +#: ../../library/os.rst:1778 msgid "" "Set the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`) to *pg*." msgstr "" -#: ../../library/os.rst:1785 +#: ../../library/os.rst:1786 msgid "" "Return a string which specifies the terminal device associated with file " "descriptor *fd*. If *fd* is not associated with a terminal device, an " "exception is raised." msgstr "" -#: ../../library/os.rst:1794 +#: ../../library/os.rst:1795 msgid "" "Unlock the slave pseudo-terminal device associated with the master pseudo-" "terminal device to which the file descriptor *fd* refers. The file " "descriptor *fd* is not closed upon failure." msgstr "" -#: ../../library/os.rst:1798 +#: ../../library/os.rst:1799 msgid "Calls the C standard library function :c:func:`unlockpt`." msgstr "" -#: ../../library/os.rst:1807 +#: ../../library/os.rst:1808 msgid "Write the bytestring in *str* to file descriptor *fd*." msgstr "" -#: ../../library/os.rst:1813 +#: ../../library/os.rst:1814 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To write a " @@ -1978,7 +1972,7 @@ msgid "" "its :meth:`~file.write` method." msgstr "" -#: ../../library/os.rst:1827 +#: ../../library/os.rst:1828 msgid "" "Write the contents of *buffers* to file descriptor *fd*. *buffers* must be a " "sequence of :term:`bytes-like objects `. Buffers are " @@ -1986,70 +1980,70 @@ msgid "" "before proceeding to the second, and so on." msgstr "" -#: ../../library/os.rst:1832 +#: ../../library/os.rst:1833 msgid "Returns the total number of bytes actually written." msgstr "" -#: ../../library/os.rst:1845 +#: ../../library/os.rst:1846 msgid "Querying the size of a terminal" msgstr "" -#: ../../library/os.rst:1851 +#: ../../library/os.rst:1852 msgid "" "Return the size of the terminal window as ``(columns, lines)``, tuple of " "type :class:`terminal_size`." msgstr "" -#: ../../library/os.rst:1854 +#: ../../library/os.rst:1855 msgid "" "The optional argument ``fd`` (default ``STDOUT_FILENO``, or standard output) " "specifies which file descriptor should be queried." msgstr "" -#: ../../library/os.rst:1857 +#: ../../library/os.rst:1858 msgid "" "If the file descriptor is not connected to a terminal, an :exc:`OSError` is " "raised." msgstr "" -#: ../../library/os.rst:1860 +#: ../../library/os.rst:1861 msgid "" ":func:`shutil.get_terminal_size` is the high-level function which should " "normally be used, ``os.get_terminal_size`` is the low-level implementation." msgstr "" -#: ../../library/os.rst:1868 +#: ../../library/os.rst:1869 msgid "" "A subclass of tuple, holding ``(columns, lines)`` of the terminal window " "size." msgstr "" -#: ../../library/os.rst:1872 +#: ../../library/os.rst:1873 msgid "Width of the terminal window in characters." msgstr "" -#: ../../library/os.rst:1876 +#: ../../library/os.rst:1877 msgid "Height of the terminal window in characters." msgstr "" -#: ../../library/os.rst:1882 +#: ../../library/os.rst:1883 msgid "Inheritance of File Descriptors" msgstr "" -#: ../../library/os.rst:1886 +#: ../../library/os.rst:1887 msgid "" "A file descriptor has an \"inheritable\" flag which indicates if the file " "descriptor can be inherited by child processes. Since Python 3.4, file " "descriptors created by Python are non-inheritable by default." msgstr "" -#: ../../library/os.rst:1890 +#: ../../library/os.rst:1891 msgid "" "On UNIX, non-inheritable file descriptors are closed in child processes at " "the execution of a new program, other file descriptors are inherited." msgstr "" -#: ../../library/os.rst:1893 +#: ../../library/os.rst:1894 msgid "" "On Windows, non-inheritable handles and file descriptors are closed in child " "processes, except for standard streams (file descriptors 0, 1 and 2: stdin, " @@ -2060,38 +2054,38 @@ msgid "" "only inherited if the *close_fds* parameter is ``False``." msgstr "" -#: ../../library/os.rst:1901 +#: ../../library/os.rst:1902 msgid "On WebAssembly platforms, the file descriptor cannot be modified." msgstr "" -#: ../../library/os.rst:1905 +#: ../../library/os.rst:1906 msgid "" "Get the \"inheritable\" flag of the specified file descriptor (a boolean)." msgstr "" -#: ../../library/os.rst:1909 +#: ../../library/os.rst:1910 msgid "Set the \"inheritable\" flag of the specified file descriptor." msgstr "" -#: ../../library/os.rst:1913 +#: ../../library/os.rst:1914 msgid "Get the \"inheritable\" flag of the specified handle (a boolean)." msgstr "" -#: ../../library/os.rst:1919 +#: ../../library/os.rst:1920 msgid "Set the \"inheritable\" flag of the specified handle." msgstr "" -#: ../../library/os.rst:1927 +#: ../../library/os.rst:1928 msgid "Files and Directories" msgstr "" -#: ../../library/os.rst:1929 +#: ../../library/os.rst:1930 msgid "" "On some Unix platforms, many of these functions support one or more of these " "features:" msgstr "" -#: ../../library/os.rst:1934 +#: ../../library/os.rst:1935 msgid "" "**specifying a file descriptor:** Normally the *path* argument provided to " "functions in the :mod:`os` module must be a string specifying a file path. " @@ -2102,7 +2096,7 @@ msgid "" "``chdir``).)" msgstr "" -#: ../../library/os.rst:1942 +#: ../../library/os.rst:1943 msgid "" "You can check whether or not *path* can be specified as a file descriptor " "for a particular function on your platform using :data:`os.supports_fd`. If " @@ -2110,13 +2104,13 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1947 +#: ../../library/os.rst:1948 msgid "" "If the function also supports *dir_fd* or *follow_symlinks* arguments, it's " "an error to specify one of those when supplying *path* as a file descriptor." msgstr "" -#: ../../library/os.rst:1952 +#: ../../library/os.rst:1953 msgid "" "**paths relative to directory descriptors:** If *dir_fd* is not ``None``, it " "should be a file descriptor referring to a directory, and the path to " @@ -2127,14 +2121,14 @@ msgid "" "``access``)." msgstr "" -#: ../../library/os.rst:1959 +#: ../../library/os.rst:1960 msgid "" "You can check whether or not *dir_fd* is supported for a particular function " "on your platform using :data:`os.supports_dir_fd`. If it's unavailable, " "using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1965 +#: ../../library/os.rst:1966 msgid "" "**not following symlinks:** If *follow_symlinks* is ``False``, and the last " "element of the path to operate on is a symbolic link, the function will " @@ -2143,14 +2137,14 @@ msgid "" "function.)" msgstr "" -#: ../../library/os.rst:1971 +#: ../../library/os.rst:1972 msgid "" "You can check whether or not *follow_symlinks* is supported for a particular " "function on your platform using :data:`os.supports_follow_symlinks`. If it's " "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1979 +#: ../../library/os.rst:1980 msgid "" "Use the real uid/gid to test for access to *path*. Note that most " "operations will use the effective uid/gid, therefore this routine can be " @@ -2162,13 +2156,13 @@ msgid "" "manpage:`access(2)` for more information." msgstr "" -#: ../../library/os.rst:1988 +#: ../../library/os.rst:1989 msgid "" "This function can support specifying :ref:`paths relative to directory " "descriptors ` and :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:1991 +#: ../../library/os.rst:1992 msgid "" "If *effective_ids* is ``True``, :func:`access` will perform its access " "checks using the effective uid/gid instead of the real uid/gid. " @@ -2177,7 +2171,7 @@ msgid "" "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1999 +#: ../../library/os.rst:2000 msgid "" "Using :func:`access` to check if a user is authorized to e.g. open a file " "before actually doing so using :func:`open` creates a security hole, because " @@ -2186,7 +2180,7 @@ msgid "" "For example::" msgstr "" -#: ../../library/os.rst:2005 +#: ../../library/os.rst:2006 msgid "" "if os.access(\"myfile\", os.R_OK):\n" " with open(\"myfile\") as fp:\n" @@ -2198,11 +2192,11 @@ msgstr "" " return fp.read()\n" "return \"some default data\"" -#: ../../library/os.rst:2010 +#: ../../library/os.rst:2011 msgid "is better written as::" msgstr "" -#: ../../library/os.rst:2012 +#: ../../library/os.rst:2013 msgid "" "try:\n" " fp = open(\"myfile\")\n" @@ -2220,113 +2214,113 @@ msgstr "" " with fp:\n" " return fp.read()" -#: ../../library/os.rst:2022 +#: ../../library/os.rst:2023 msgid "" "I/O operations may fail even when :func:`access` indicates that they would " "succeed, particularly for operations on network filesystems which may have " "permissions semantics beyond the usual POSIX permission-bit model." msgstr "" -#: ../../library/os.rst:2026 +#: ../../library/os.rst:2027 msgid "Added the *dir_fd*, *effective_ids*, and *follow_symlinks* parameters." msgstr "新增 *dir_fd*、*effective_ids* 與 *follow_symlinks* 參數。" -#: ../../library/os.rst:2038 +#: ../../library/os.rst:2039 msgid "" "Values to pass as the *mode* parameter of :func:`access` to test the " "existence, readability, writability and executability of *path*, " "respectively." msgstr "" -#: ../../library/os.rst:2047 +#: ../../library/os.rst:2048 msgid "Change the current working directory to *path*." msgstr "" -#: ../../library/os.rst:2049 +#: ../../library/os.rst:2050 msgid "" "This function can support :ref:`specifying a file descriptor `. " "The descriptor must refer to an opened directory, not an open file." msgstr "" -#: ../../library/os.rst:2052 +#: ../../library/os.rst:2053 msgid "" "This function can raise :exc:`OSError` and subclasses such as :exc:" "`FileNotFoundError`, :exc:`PermissionError`, and :exc:`NotADirectoryError`." msgstr "" -#: ../../library/os.rst:2055 ../../library/os.rst:2193 +#: ../../library/os.rst:2056 ../../library/os.rst:2194 msgid "" "Raises an :ref:`auditing event ` ``os.chdir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.chdir``。" -#: ../../library/os.rst:2057 +#: ../../library/os.rst:2058 msgid "" "Added support for specifying *path* as a file descriptor on some platforms." msgstr "" -#: ../../library/os.rst:2067 +#: ../../library/os.rst:2068 msgid "" "Set the flags of *path* to the numeric *flags*. *flags* may take a " "combination (bitwise OR) of the following values (as defined in the :mod:" "`stat` module):" msgstr "" -#: ../../library/os.rst:2070 +#: ../../library/os.rst:2071 msgid ":const:`stat.UF_NODUMP`" msgstr ":const:`stat.UF_NODUMP`" -#: ../../library/os.rst:2071 +#: ../../library/os.rst:2072 msgid ":const:`stat.UF_IMMUTABLE`" msgstr ":const:`stat.UF_IMMUTABLE`" -#: ../../library/os.rst:2072 +#: ../../library/os.rst:2073 msgid ":const:`stat.UF_APPEND`" msgstr ":const:`stat.UF_APPEND`" -#: ../../library/os.rst:2073 +#: ../../library/os.rst:2074 msgid ":const:`stat.UF_OPAQUE`" msgstr ":const:`stat.UF_OPAQUE`" -#: ../../library/os.rst:2074 +#: ../../library/os.rst:2075 msgid ":const:`stat.UF_NOUNLINK`" msgstr ":const:`stat.UF_NOUNLINK`" -#: ../../library/os.rst:2075 +#: ../../library/os.rst:2076 msgid ":const:`stat.UF_COMPRESSED`" msgstr ":const:`stat.UF_COMPRESSED`" -#: ../../library/os.rst:2076 +#: ../../library/os.rst:2077 msgid ":const:`stat.UF_HIDDEN`" msgstr ":const:`stat.UF_HIDDEN`" -#: ../../library/os.rst:2077 +#: ../../library/os.rst:2078 msgid ":const:`stat.SF_ARCHIVED`" msgstr ":const:`stat.SF_ARCHIVED`" -#: ../../library/os.rst:2078 +#: ../../library/os.rst:2079 msgid ":const:`stat.SF_IMMUTABLE`" msgstr ":const:`stat.SF_IMMUTABLE`" -#: ../../library/os.rst:2079 +#: ../../library/os.rst:2080 msgid ":const:`stat.SF_APPEND`" msgstr ":const:`stat.SF_APPEND`" -#: ../../library/os.rst:2080 +#: ../../library/os.rst:2081 msgid ":const:`stat.SF_NOUNLINK`" msgstr ":const:`stat.SF_NOUNLINK`" -#: ../../library/os.rst:2081 +#: ../../library/os.rst:2082 msgid ":const:`stat.SF_SNAPSHOT`" msgstr ":const:`stat.SF_SNAPSHOT`" -#: ../../library/os.rst:2083 +#: ../../library/os.rst:2084 msgid "" "This function can support :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:2085 ../../library/os.rst:2219 +#: ../../library/os.rst:2086 ../../library/os.rst:2220 msgid "" "Raises an :ref:`auditing event ` ``os.chflags`` with arguments " "``path``, ``flags``." @@ -2334,102 +2328,102 @@ msgstr "" "引發一個附帶引數 ``path``、``flags`` 的\\ :ref:`稽核事件 ` ``os." "chflags``。" -#: ../../library/os.rst:2089 +#: ../../library/os.rst:2090 msgid "Added the *follow_symlinks* parameter." msgstr "新增 *follow_symlinks* 參數。" -#: ../../library/os.rst:2098 +#: ../../library/os.rst:2099 msgid "" "Change the mode of *path* to the numeric *mode*. *mode* may take one of the " "following values (as defined in the :mod:`stat` module) or bitwise ORed " "combinations of them:" msgstr "" -#: ../../library/os.rst:2102 +#: ../../library/os.rst:2103 msgid ":const:`stat.S_ISUID`" msgstr ":const:`stat.S_ISUID`" -#: ../../library/os.rst:2103 +#: ../../library/os.rst:2104 msgid ":const:`stat.S_ISGID`" msgstr ":const:`stat.S_ISGID`" -#: ../../library/os.rst:2104 +#: ../../library/os.rst:2105 msgid ":const:`stat.S_ENFMT`" msgstr ":const:`stat.S_ENFMT`" -#: ../../library/os.rst:2105 +#: ../../library/os.rst:2106 msgid ":const:`stat.S_ISVTX`" msgstr ":const:`stat.S_ISVTX`" -#: ../../library/os.rst:2106 +#: ../../library/os.rst:2107 msgid ":const:`stat.S_IREAD`" msgstr ":const:`stat.S_IREAD`" -#: ../../library/os.rst:2107 +#: ../../library/os.rst:2108 msgid ":const:`stat.S_IWRITE`" msgstr ":const:`stat.S_IWRITE`" -#: ../../library/os.rst:2108 +#: ../../library/os.rst:2109 msgid ":const:`stat.S_IEXEC`" msgstr ":const:`stat.S_IEXEC`" -#: ../../library/os.rst:2109 +#: ../../library/os.rst:2110 msgid ":const:`stat.S_IRWXU`" msgstr ":const:`stat.S_IRWXU`" -#: ../../library/os.rst:2110 +#: ../../library/os.rst:2111 msgid ":const:`stat.S_IRUSR`" msgstr ":const:`stat.S_IRUSR`" -#: ../../library/os.rst:2111 +#: ../../library/os.rst:2112 msgid ":const:`stat.S_IWUSR`" msgstr ":const:`stat.S_IWUSR`" -#: ../../library/os.rst:2112 +#: ../../library/os.rst:2113 msgid ":const:`stat.S_IXUSR`" msgstr ":const:`stat.S_IXUSR`" -#: ../../library/os.rst:2113 +#: ../../library/os.rst:2114 msgid ":const:`stat.S_IRWXG`" msgstr ":const:`stat.S_IRWXG`" -#: ../../library/os.rst:2114 +#: ../../library/os.rst:2115 msgid ":const:`stat.S_IRGRP`" msgstr ":const:`stat.S_IRGRP`" -#: ../../library/os.rst:2115 +#: ../../library/os.rst:2116 msgid ":const:`stat.S_IWGRP`" msgstr ":const:`stat.S_IWGRP`" -#: ../../library/os.rst:2116 +#: ../../library/os.rst:2117 msgid ":const:`stat.S_IXGRP`" msgstr ":const:`stat.S_IXGRP`" -#: ../../library/os.rst:2117 +#: ../../library/os.rst:2118 msgid ":const:`stat.S_IRWXO`" msgstr ":const:`stat.S_IRWXO`" -#: ../../library/os.rst:2118 +#: ../../library/os.rst:2119 msgid ":const:`stat.S_IROTH`" msgstr ":const:`stat.S_IROTH`" -#: ../../library/os.rst:2119 +#: ../../library/os.rst:2120 msgid ":const:`stat.S_IWOTH`" msgstr ":const:`stat.S_IWOTH`" -#: ../../library/os.rst:2120 +#: ../../library/os.rst:2121 msgid ":const:`stat.S_IXOTH`" msgstr ":const:`stat.S_IXOTH`" -#: ../../library/os.rst:2122 ../../library/os.rst:2155 -#: ../../library/os.rst:3546 +#: ../../library/os.rst:2123 ../../library/os.rst:2156 +#: ../../library/os.rst:3547 msgid "" "This function can support :ref:`specifying a file descriptor `, :" "ref:`paths relative to directory descriptors ` and :ref:`not " "following symlinks `." msgstr "" -#: ../../library/os.rst:2128 +#: ../../library/os.rst:2129 msgid "" "Although Windows supports :func:`chmod`, you can only set the file's read-" "only flag with it (via the ``stat.S_IWRITE`` and ``stat.S_IREAD`` constants " @@ -2437,68 +2431,68 @@ msgid "" "value of *follow_symlinks* is ``False`` on Windows." msgstr "" -#: ../../library/os.rst:2138 ../../library/os.rst:2169 +#: ../../library/os.rst:2139 ../../library/os.rst:2170 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd* and *follow_symlinks* arguments." msgstr "" -#: ../../library/os.rst:2145 +#: ../../library/os.rst:2146 msgid "" "Added support for a file descriptor and the *follow_symlinks* argument on " "Windows." msgstr "" -#: ../../library/os.rst:2152 +#: ../../library/os.rst:2153 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. To " "leave one of the ids unchanged, set it to -1." msgstr "" -#: ../../library/os.rst:2159 +#: ../../library/os.rst:2160 msgid "" "See :func:`shutil.chown` for a higher-level function that accepts names in " "addition to numeric ids." msgstr "" -#: ../../library/os.rst:2173 +#: ../../library/os.rst:2174 msgid "Supports a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:2179 +#: ../../library/os.rst:2180 msgid "Change the root directory of the current process to *path*." msgstr "" -#: ../../library/os.rst:2189 +#: ../../library/os.rst:2190 msgid "" "Change the current working directory to the directory represented by the " "file descriptor *fd*. The descriptor must refer to an opened directory, not " "an open file. As of Python 3.3, this is equivalent to ``os.chdir(fd)``." msgstr "" -#: ../../library/os.rst:2200 +#: ../../library/os.rst:2201 msgid "Return a string representing the current working directory." msgstr "" -#: ../../library/os.rst:2205 +#: ../../library/os.rst:2206 msgid "Return a bytestring representing the current working directory." msgstr "" -#: ../../library/os.rst:2207 +#: ../../library/os.rst:2208 msgid "" "The function now uses the UTF-8 encoding on Windows, rather than the ANSI " "code page: see :pep:`529` for the rationale. The function is no longer " "deprecated on Windows." msgstr "" -#: ../../library/os.rst:2215 +#: ../../library/os.rst:2216 msgid "" "Set the flags of *path* to the numeric *flags*, like :func:`chflags`, but do " "not follow symbolic links. As of Python 3.3, this is equivalent to ``os." "chflags(path, flags, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2229 +#: ../../library/os.rst:2230 msgid "" "Change the mode of *path* to the numeric *mode*. If path is a symlink, this " "affects the symlink rather than the target. See the docs for :func:`chmod` " @@ -2506,31 +2500,31 @@ msgid "" "chmod(path, mode, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2234 +#: ../../library/os.rst:2235 msgid "" "``lchmod()`` is not part of POSIX, but Unix implementations may have it if " "changing the mode of symbolic links is supported." msgstr "" -#: ../../library/os.rst:2249 +#: ../../library/os.rst:2250 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. " "This function will not follow symbolic links. As of Python 3.3, this is " "equivalent to ``os.chown(path, uid, gid, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2263 +#: ../../library/os.rst:2264 msgid "Create a hard link pointing to *src* named *dst*." msgstr "" -#: ../../library/os.rst:2265 +#: ../../library/os.rst:2266 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " "supply :ref:`paths relative to directory descriptors `, and :ref:" "`not following symlinks `." msgstr "" -#: ../../library/os.rst:2269 +#: ../../library/os.rst:2270 msgid "" "Raises an :ref:`auditing event ` ``os.link`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." @@ -2538,20 +2532,20 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``src_dir_fd``、``dst_dir_fd`` 的\\ :ref:`" "稽核事件 ` ``os.link``。" -#: ../../library/os.rst:2273 ../../library/os.rst:4543 +#: ../../library/os.rst:2274 ../../library/os.rst:4544 msgid "Added Windows support." msgstr "新支援 Windows。" -#: ../../library/os.rst:2276 +#: ../../library/os.rst:2277 msgid "Added the *src_dir_fd*, *dst_dir_fd*, and *follow_symlinks* parameters." msgstr "新增 *src_dir_fd*、*dst_dir_fd* 與 *follow_symlinks* 參數。" -#: ../../library/os.rst:2279 ../../library/os.rst:2703 -#: ../../library/os.rst:2740 ../../library/os.rst:3468 +#: ../../library/os.rst:2280 ../../library/os.rst:2704 +#: ../../library/os.rst:2741 ../../library/os.rst:3469 msgid "Accepts a :term:`path-like object` for *src* and *dst*." msgstr "" -#: ../../library/os.rst:2285 +#: ../../library/os.rst:2286 msgid "" "Return a list containing the names of the entries in the directory given by " "*path*. The list is in arbitrary order, and does not include the special " @@ -2560,7 +2554,7 @@ msgid "" "function, whether a name for that file be included is unspecified." msgstr "" -#: ../../library/os.rst:2291 +#: ../../library/os.rst:2292 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the " @@ -2568,42 +2562,42 @@ msgid "" "circumstances, they will be of type ``str``." msgstr "" -#: ../../library/os.rst:2296 ../../library/os.rst:2788 +#: ../../library/os.rst:2297 ../../library/os.rst:2789 msgid "" "This function can also support :ref:`specifying a file descriptor " "`; the file descriptor must refer to a directory." msgstr "" -#: ../../library/os.rst:2299 +#: ../../library/os.rst:2300 msgid "" "Raises an :ref:`auditing event ` ``os.listdir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.listdir``。" -#: ../../library/os.rst:2302 +#: ../../library/os.rst:2303 msgid "To encode ``str`` filenames to ``bytes``, use :func:`~os.fsencode`." msgstr "" -#: ../../library/os.rst:2306 +#: ../../library/os.rst:2307 msgid "" "The :func:`scandir` function returns directory entries along with file " "attribute information, giving better performance for many common use cases." msgstr "" -#: ../../library/os.rst:2310 +#: ../../library/os.rst:2311 msgid "The *path* parameter became optional." msgstr "" -#: ../../library/os.rst:2313 ../../library/os.rst:3327 +#: ../../library/os.rst:2314 ../../library/os.rst:3328 msgid "Added support for specifying *path* as an open file descriptor." msgstr "" -#: ../../library/os.rst:2322 +#: ../../library/os.rst:2323 msgid "Return a list containing the names of drives on a Windows system." msgstr "" -#: ../../library/os.rst:2324 +#: ../../library/os.rst:2325 msgid "" "A drive name typically looks like ``'C:\\\\'``. Not every drive name will be " "associated with a volume, and some may be inaccessible for a variety of " @@ -2611,22 +2605,22 @@ msgid "" "function does not test for access." msgstr "" -#: ../../library/os.rst:2329 +#: ../../library/os.rst:2330 msgid "May raise :exc:`OSError` if an error occurs collecting the drive names." msgstr "" -#: ../../library/os.rst:2332 +#: ../../library/os.rst:2333 msgid "" "Raises an :ref:`auditing event ` ``os.listdrives`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.listdrives``。" -#: ../../library/os.rst:2341 +#: ../../library/os.rst:2342 msgid "" "Return a list containing the mount points for a volume on a Windows system." msgstr "" -#: ../../library/os.rst:2344 +#: ../../library/os.rst:2345 msgid "" "*volume* must be represented as a GUID path, like those returned by :func:" "`os.listvolumes`. Volumes may be mounted in multiple locations or not at " @@ -2634,19 +2628,19 @@ msgid "" "associated with a volume will not be returned by this function." msgstr "" -#: ../../library/os.rst:2350 +#: ../../library/os.rst:2351 msgid "" "The mount points return by this function will be absolute paths, and may be " "longer than the drive name." msgstr "" -#: ../../library/os.rst:2353 +#: ../../library/os.rst:2354 msgid "" "Raises :exc:`OSError` if the volume is not recognized or if an error occurs " "collecting the paths." msgstr "" -#: ../../library/os.rst:2356 +#: ../../library/os.rst:2357 msgid "" "Raises an :ref:`auditing event ` ``os.listmounts`` with argument " "``volume``." @@ -2654,11 +2648,11 @@ msgstr "" "引發一個附帶引數 ``volume`` 的\\ :ref:`稽核事件 ` ``os." "listmounts``。" -#: ../../library/os.rst:2365 +#: ../../library/os.rst:2366 msgid "Return a list containing the volumes in the system." msgstr "" -#: ../../library/os.rst:2367 +#: ../../library/os.rst:2368 msgid "" "Volumes are typically represented as a GUID path that looks like ``\\\\?" "\\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\\``. Files can usually be " @@ -2667,49 +2661,49 @@ msgid "" "function is to retrieve mount points using :func:`os.listmounts`." msgstr "" -#: ../../library/os.rst:2374 +#: ../../library/os.rst:2375 msgid "May raise :exc:`OSError` if an error occurs collecting the volumes." msgstr "" -#: ../../library/os.rst:2376 +#: ../../library/os.rst:2377 msgid "" "Raises an :ref:`auditing event ` ``os.listvolumes`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.listvolumes``。" -#: ../../library/os.rst:2385 +#: ../../library/os.rst:2386 msgid "" "Perform the equivalent of an :c:func:`!lstat` system call on the given path. " "Similar to :func:`~os.stat`, but does not follow symbolic links. Return a :" "class:`stat_result` object." msgstr "" -#: ../../library/os.rst:2389 +#: ../../library/os.rst:2390 msgid "" "On platforms that do not support symbolic links, this is an alias for :func:" "`~os.stat`." msgstr "" -#: ../../library/os.rst:2392 +#: ../../library/os.rst:2393 msgid "" "As of Python 3.3, this is equivalent to ``os.stat(path, dir_fd=dir_fd, " "follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2395 ../../library/os.rst:2437 -#: ../../library/os.rst:2505 ../../library/os.rst:2533 -#: ../../library/os.rst:2607 +#: ../../library/os.rst:2396 ../../library/os.rst:2438 +#: ../../library/os.rst:2506 ../../library/os.rst:2534 +#: ../../library/os.rst:2608 msgid "" "This function can also support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: ../../library/os.rst:2402 ../../library/os.rst:2616 -#: ../../library/os.rst:3461 +#: ../../library/os.rst:2403 ../../library/os.rst:2617 +#: ../../library/os.rst:3462 msgid "Added support for Windows 6.0 (Vista) symbolic links." msgstr "" -#: ../../library/os.rst:2411 +#: ../../library/os.rst:2412 msgid "" "On Windows, now opens reparse points that represent another path (name " "surrogates), including symbolic links and directory junctions. Other kinds " @@ -2717,18 +2711,18 @@ msgid "" "stat`." msgstr "" -#: ../../library/os.rst:2420 +#: ../../library/os.rst:2421 msgid "Create a directory named *path* with numeric mode *mode*." msgstr "" -#: ../../library/os.rst:2422 +#: ../../library/os.rst:2423 msgid "" "If the directory already exists, :exc:`FileExistsError` is raised. If a " "parent directory in the path does not exist, :exc:`FileNotFoundError` is " "raised." msgstr "" -#: ../../library/os.rst:2427 +#: ../../library/os.rst:2428 msgid "" "On some systems, *mode* is ignored. Where it is used, the current umask " "value is first masked out. If bits other than the last 9 (i.e. the last 3 " @@ -2737,20 +2731,20 @@ msgid "" "call :func:`chmod` explicitly to set them." msgstr "" -#: ../../library/os.rst:2433 +#: ../../library/os.rst:2434 msgid "" "On Windows, a *mode* of ``0o700`` is specifically handled to apply access " "control to the new directory such that only the current user and " "administrators have access. Other values of *mode* are ignored." msgstr "" -#: ../../library/os.rst:2440 +#: ../../library/os.rst:2441 msgid "" "It is also possible to create temporary directories; see the :mod:`tempfile` " "module's :func:`tempfile.mkdtemp` function." msgstr "" -#: ../../library/os.rst:2443 ../../library/os.rst:2480 +#: ../../library/os.rst:2444 ../../library/os.rst:2481 msgid "" "Raises an :ref:`auditing event ` ``os.mkdir`` with arguments " "``path``, ``mode``, ``dir_fd``." @@ -2758,17 +2752,17 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.mkdir``。" -#: ../../library/os.rst:2451 +#: ../../library/os.rst:2452 msgid "Windows now handles a *mode* of ``0o700``." msgstr "" -#: ../../library/os.rst:2461 +#: ../../library/os.rst:2462 msgid "" "Recursive directory creation function. Like :func:`mkdir`, but makes all " "intermediate-level directories needed to contain the leaf directory." msgstr "" -#: ../../library/os.rst:2464 +#: ../../library/os.rst:2465 msgid "" "The *mode* parameter is passed to :func:`mkdir` for creating the leaf " "directory; see :ref:`the mkdir() description ` for how it is " @@ -2777,27 +2771,27 @@ msgid "" "file permission bits of existing parent directories are not changed." msgstr "" -#: ../../library/os.rst:2470 +#: ../../library/os.rst:2471 msgid "" "If *exist_ok* is ``False`` (the default), a :exc:`FileExistsError` is raised " "if the target directory already exists." msgstr "" -#: ../../library/os.rst:2475 +#: ../../library/os.rst:2476 msgid "" ":func:`makedirs` will become confused if the path elements to create " "include :data:`pardir` (eg. \"..\" on UNIX systems)." msgstr "" -#: ../../library/os.rst:2478 +#: ../../library/os.rst:2479 msgid "This function handles UNC paths correctly." msgstr "" -#: ../../library/os.rst:2482 +#: ../../library/os.rst:2483 msgid "Added the *exist_ok* parameter." msgstr "新增 *exist_ok* 參數。" -#: ../../library/os.rst:2487 +#: ../../library/os.rst:2488 msgid "" "Before Python 3.4.1, if *exist_ok* was ``True`` and the directory existed, :" "func:`makedirs` would still raise an error if *mode* did not match the mode " @@ -2805,19 +2799,19 @@ msgid "" "safely, it was removed in Python 3.4.1. See :issue:`21082`." msgstr "" -#: ../../library/os.rst:2495 +#: ../../library/os.rst:2496 msgid "" "The *mode* argument no longer affects the file permission bits of newly " "created intermediate-level directories." msgstr "" -#: ../../library/os.rst:2502 +#: ../../library/os.rst:2503 msgid "" "Create a FIFO (a named pipe) named *path* with numeric mode *mode*. The " "current umask value is first masked out from the mode." msgstr "" -#: ../../library/os.rst:2508 +#: ../../library/os.rst:2509 msgid "" "FIFOs are pipes that can be accessed like regular files. FIFOs exist until " "they are deleted (for example with :func:`os.unlink`). Generally, FIFOs are " @@ -2827,7 +2821,7 @@ msgid "" "rendezvous point." msgstr "" -#: ../../library/os.rst:2525 +#: ../../library/os.rst:2526 msgid "" "Create a filesystem node (file, device special file or named pipe) named " "*path*. *mode* specifies both the permissions to use and the type of node to " @@ -2838,23 +2832,23 @@ msgid "" "`os.makedev`), otherwise it is ignored." msgstr "" -#: ../../library/os.rst:2547 +#: ../../library/os.rst:2548 msgid "" "Extract the device major number from a raw device number (usually the :attr:" "`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" -#: ../../library/os.rst:2553 +#: ../../library/os.rst:2554 msgid "" "Extract the device minor number from a raw device number (usually the :attr:" "`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" -#: ../../library/os.rst:2559 +#: ../../library/os.rst:2560 msgid "Compose a raw device number from the major and minor device numbers." msgstr "" -#: ../../library/os.rst:2564 +#: ../../library/os.rst:2565 msgid "" "Return system configuration information relevant to a named file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -2865,20 +2859,20 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:2577 ../../library/os.rst:3320 -#: ../../library/os.rst:3489 +#: ../../library/os.rst:2578 ../../library/os.rst:3321 +#: ../../library/os.rst:3490 msgid "" "This function can support :ref:`specifying a file descriptor `." msgstr "" -#: ../../library/os.rst:2588 +#: ../../library/os.rst:2589 msgid "" "Dictionary mapping names accepted by :func:`pathconf` and :func:`fpathconf` " "to the integer values defined for those names by the host operating system. " "This can be used to determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:2597 +#: ../../library/os.rst:2598 msgid "" "Return a string representing the path to which the symbolic link points. " "The result may be either an absolute or relative pathname; if it is " @@ -2886,7 +2880,7 @@ msgid "" "join(os.path.dirname(path), result)``." msgstr "" -#: ../../library/os.rst:2602 +#: ../../library/os.rst:2603 msgid "" "If the *path* is a string object (directly or indirectly through a :class:" "`PathLike` interface), the result will also be a string object, and the call " @@ -2894,42 +2888,42 @@ msgid "" "indirectly), the result will be a bytes object." msgstr "" -#: ../../library/os.rst:2610 +#: ../../library/os.rst:2611 msgid "" "When trying to resolve a path that may contain links, use :func:`~os.path." "realpath` to properly handle recursion and platform differences." msgstr "" -#: ../../library/os.rst:2622 +#: ../../library/os.rst:2623 msgid "Accepts a :term:`path-like object` on Unix." msgstr "" -#: ../../library/os.rst:2625 +#: ../../library/os.rst:2626 msgid "Accepts a :term:`path-like object` and a bytes object on Windows." msgstr "" -#: ../../library/os.rst:2628 +#: ../../library/os.rst:2629 msgid "" "Added support for directory junctions, and changed to return the " "substitution path (which typically includes ``\\\\?\\`` prefix) rather than " "the optional \"print name\" field that was previously returned." msgstr "" -#: ../../library/os.rst:2634 +#: ../../library/os.rst:2635 msgid "" "Remove (delete) the file *path*. If *path* is a directory, an :exc:" "`OSError` is raised. Use :func:`rmdir` to remove directories. If the file " "does not exist, a :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/os.rst:2638 ../../library/os.rst:2751 -#: ../../library/os.rst:3440 +#: ../../library/os.rst:2639 ../../library/os.rst:2752 +#: ../../library/os.rst:3441 msgid "" "This function can support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: ../../library/os.rst:2641 +#: ../../library/os.rst:2642 msgid "" "On Windows, attempting to remove a file that is in use causes an exception " "to be raised; on Unix, the directory entry is removed but the storage " @@ -2937,12 +2931,12 @@ msgid "" "longer in use." msgstr "" -#: ../../library/os.rst:2645 +#: ../../library/os.rst:2646 msgid "This function is semantically identical to :func:`unlink`." msgstr "" -#: ../../library/os.rst:2647 ../../library/os.rst:2669 -#: ../../library/os.rst:3511 +#: ../../library/os.rst:2648 ../../library/os.rst:2670 +#: ../../library/os.rst:3512 msgid "" "Raises an :ref:`auditing event ` ``os.remove`` with arguments " "``path``, ``dir_fd``." @@ -2950,7 +2944,7 @@ msgstr "" "引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` ``os." "remove``。" -#: ../../library/os.rst:2660 +#: ../../library/os.rst:2661 msgid "" "Remove directories recursively. Works like :func:`rmdir` except that, if " "the leaf directory is successfully removed, :func:`removedirs` tries to " @@ -2962,20 +2956,20 @@ msgid "" "could not be successfully removed." msgstr "" -#: ../../library/os.rst:2677 +#: ../../library/os.rst:2678 msgid "" "Rename the file or directory *src* to *dst*. If *dst* exists, the operation " "will fail with an :exc:`OSError` subclass in a number of cases:" msgstr "" -#: ../../library/os.rst:2680 +#: ../../library/os.rst:2681 msgid "" "On Windows, if *dst* exists a :exc:`FileExistsError` is always raised. The " "operation may fail if *src* and *dst* are on different filesystems. Use :" "func:`shutil.move` to support moves to a different filesystem." msgstr "" -#: ../../library/os.rst:2684 +#: ../../library/os.rst:2685 msgid "" "On Unix, if *src* is a file and *dst* is a directory or vice-versa, an :exc:" "`IsADirectoryError` or a :exc:`NotADirectoryError` will be raised " @@ -2987,20 +2981,20 @@ msgid "" "operation (this is a POSIX requirement)." msgstr "" -#: ../../library/os.rst:2693 ../../library/os.rst:2733 +#: ../../library/os.rst:2694 ../../library/os.rst:2734 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " "supply :ref:`paths relative to directory descriptors `." msgstr "" -#: ../../library/os.rst:2696 +#: ../../library/os.rst:2697 msgid "" "If you want cross-platform overwriting of the destination, use :func:" "`replace`." msgstr "" -#: ../../library/os.rst:2698 ../../library/os.rst:2719 -#: ../../library/os.rst:2736 +#: ../../library/os.rst:2699 ../../library/os.rst:2720 +#: ../../library/os.rst:2737 msgid "" "Raises an :ref:`auditing event ` ``os.rename`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." @@ -3008,11 +3002,11 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``src_dir_fd``、``dst_dir_fd`` 的\\ :ref:`" "稽核事件 ` ``os.rename``。" -#: ../../library/os.rst:2700 +#: ../../library/os.rst:2701 msgid "Added the *src_dir_fd* and *dst_dir_fd* parameters." msgstr "新增 *src_dir_fd* 與 *dst_dir_fd* 參數。" -#: ../../library/os.rst:2709 +#: ../../library/os.rst:2710 msgid "" "Recursive directory or file renaming function. Works like :func:`rename`, " "except creation of any intermediate directories needed to make the new " @@ -3021,17 +3015,17 @@ msgid "" "using :func:`removedirs`." msgstr "" -#: ../../library/os.rst:2716 +#: ../../library/os.rst:2717 msgid "" "This function can fail with the new directory structure made if you lack " "permissions needed to remove the leaf directory or file." msgstr "" -#: ../../library/os.rst:2721 +#: ../../library/os.rst:2722 msgid "Accepts a :term:`path-like object` for *old* and *new*." msgstr "" -#: ../../library/os.rst:2727 +#: ../../library/os.rst:2728 msgid "" "Rename the file or directory *src* to *dst*. If *dst* is a non-empty " "directory, :exc:`OSError` will be raised. If *dst* exists and is a file, it " @@ -3040,7 +3034,7 @@ msgid "" "renaming will be an atomic operation (this is a POSIX requirement)." msgstr "" -#: ../../library/os.rst:2746 +#: ../../library/os.rst:2747 msgid "" "Remove (delete) the directory *path*. If the directory does not exist or is " "not empty, a :exc:`FileNotFoundError` or an :exc:`OSError` is raised " @@ -3048,7 +3042,7 @@ msgid "" "rmtree` can be used." msgstr "" -#: ../../library/os.rst:2754 +#: ../../library/os.rst:2755 msgid "" "Raises an :ref:`auditing event ` ``os.rmdir`` with arguments " "``path``, ``dir_fd``." @@ -3056,7 +3050,7 @@ msgstr "" "引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` ``os." "rmdir``。" -#: ../../library/os.rst:2765 +#: ../../library/os.rst:2766 msgid "" "Return an iterator of :class:`os.DirEntry` objects corresponding to the " "entries in the directory given by *path*. The entries are yielded in " @@ -3066,7 +3060,7 @@ msgid "" "unspecified." msgstr "" -#: ../../library/os.rst:2772 +#: ../../library/os.rst:2773 msgid "" "Using :func:`scandir` instead of :func:`listdir` can significantly increase " "the performance of code that also needs file type or file attribute " @@ -3078,7 +3072,7 @@ msgid "" "Unix but only requires one for symbolic links on Windows." msgstr "" -#: ../../library/os.rst:2782 +#: ../../library/os.rst:2783 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the type " @@ -3087,31 +3081,31 @@ msgid "" "they will be of type ``str``." msgstr "" -#: ../../library/os.rst:2791 +#: ../../library/os.rst:2792 msgid "" "Raises an :ref:`auditing event ` ``os.scandir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.scandir``。" -#: ../../library/os.rst:2793 +#: ../../library/os.rst:2794 msgid "" "The :func:`scandir` iterator supports the :term:`context manager` protocol " "and has the following method:" msgstr "" -#: ../../library/os.rst:2798 +#: ../../library/os.rst:2799 msgid "Close the iterator and free acquired resources." msgstr "" -#: ../../library/os.rst:2800 +#: ../../library/os.rst:2801 msgid "" "This is called automatically when the iterator is exhausted or garbage " "collected, or when an error happens during iterating. However it is " "advisable to call it explicitly or use the :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:2807 +#: ../../library/os.rst:2808 msgid "" "The following example shows a simple use of :func:`scandir` to display all " "the files (excluding directories) in the given *path* that don't start with " @@ -3119,7 +3113,7 @@ msgid "" "system call::" msgstr "" -#: ../../library/os.rst:2812 +#: ../../library/os.rst:2813 msgid "" "with os.scandir(path) as it:\n" " for entry in it:\n" @@ -3131,7 +3125,7 @@ msgstr "" " if not entry.name.startswith('.') and entry.is_file():\n" " print(entry.name)" -#: ../../library/os.rst:2819 +#: ../../library/os.rst:2820 msgid "" "On Unix-based systems, :func:`scandir` uses the system's `opendir() `_ and " @@ -3142,7 +3136,7 @@ msgid "" "desktop/aa364428(v=vs.85).aspx>`_ functions." msgstr "" -#: ../../library/os.rst:2831 +#: ../../library/os.rst:2832 msgid "" "Added support for the :term:`context manager` protocol and the :func:" "`~scandir.close` method. If a :func:`scandir` iterator is neither exhausted " @@ -3150,28 +3144,28 @@ msgid "" "destructor." msgstr "" -#: ../../library/os.rst:2837 +#: ../../library/os.rst:2838 msgid "The function accepts a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:2839 +#: ../../library/os.rst:2840 msgid "Added support for :ref:`file descriptors ` on Unix." msgstr "" -#: ../../library/os.rst:2845 +#: ../../library/os.rst:2846 msgid "" "Object yielded by :func:`scandir` to expose the file path and other file " "attributes of a directory entry." msgstr "" -#: ../../library/os.rst:2848 +#: ../../library/os.rst:2849 msgid "" ":func:`scandir` will provide as much of this information as possible without " "making additional system calls. When a ``stat()`` or ``lstat()`` system call " "is made, the ``os.DirEntry`` object will cache the result." msgstr "" -#: ../../library/os.rst:2852 +#: ../../library/os.rst:2853 msgid "" "``os.DirEntry`` instances are not intended to be stored in long-lived data " "structures; if you know the file metadata has changed or if a long time has " @@ -3179,7 +3173,7 @@ msgid "" "up-to-date information." msgstr "" -#: ../../library/os.rst:2857 +#: ../../library/os.rst:2858 msgid "" "Because the ``os.DirEntry`` methods can make operating system calls, they " "may also raise :exc:`OSError`. If you need very fine-grained control over " @@ -3187,29 +3181,29 @@ msgid "" "methods and handle as appropriate." msgstr "" -#: ../../library/os.rst:2862 +#: ../../library/os.rst:2863 msgid "" "To be directly usable as a :term:`path-like object`, ``os.DirEntry`` " "implements the :class:`PathLike` interface." msgstr "" -#: ../../library/os.rst:2865 +#: ../../library/os.rst:2866 msgid "Attributes and methods on a ``os.DirEntry`` instance are as follows:" msgstr "" -#: ../../library/os.rst:2869 +#: ../../library/os.rst:2870 msgid "" "The entry's base filename, relative to the :func:`scandir` *path* argument." msgstr "" -#: ../../library/os.rst:2872 +#: ../../library/os.rst:2873 msgid "" "The :attr:`name` attribute will be ``bytes`` if the :func:`scandir` *path* " "argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." "fsdecode` to decode byte filenames." msgstr "" -#: ../../library/os.rst:2878 +#: ../../library/os.rst:2879 msgid "" "The entry's full path name: equivalent to ``os.path.join(scandir_path, entry." "name)`` where *scandir_path* is the :func:`scandir` *path* argument. The " @@ -3219,51 +3213,51 @@ msgid "" "attribute." msgstr "" -#: ../../library/os.rst:2885 +#: ../../library/os.rst:2886 msgid "" "The :attr:`path` attribute will be ``bytes`` if the :func:`scandir` *path* " "argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." "fsdecode` to decode byte filenames." msgstr "" -#: ../../library/os.rst:2891 +#: ../../library/os.rst:2892 msgid "Return the inode number of the entry." msgstr "" -#: ../../library/os.rst:2893 +#: ../../library/os.rst:2894 msgid "" "The result is cached on the ``os.DirEntry`` object. Use ``os.stat(entry." "path, follow_symlinks=False).st_ino`` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2897 +#: ../../library/os.rst:2898 msgid "" "On the first, uncached call, a system call is required on Windows but not on " "Unix." msgstr "" -#: ../../library/os.rst:2902 +#: ../../library/os.rst:2903 msgid "" "Return ``True`` if this entry is a directory or a symbolic link pointing to " "a directory; return ``False`` if the entry is or points to any other kind of " "file, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2906 +#: ../../library/os.rst:2907 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "directory (without following symlinks); return ``False`` if the entry is any " "other kind of file or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2910 +#: ../../library/os.rst:2911 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` along " "with :func:`stat.S_ISDIR` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2914 +#: ../../library/os.rst:2915 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, for non-symlinks, neither Windows or Unix require a system " @@ -3273,46 +3267,46 @@ msgid "" "is ``False``." msgstr "" -#: ../../library/os.rst:2921 ../../library/os.rst:2951 +#: ../../library/os.rst:2922 ../../library/os.rst:2952 msgid "" "This method can raise :exc:`OSError`, such as :exc:`PermissionError`, but :" "exc:`FileNotFoundError` is caught and not raised." msgstr "" -#: ../../library/os.rst:2926 +#: ../../library/os.rst:2927 msgid "" "Return ``True`` if this entry is a file or a symbolic link pointing to a " "file; return ``False`` if the entry is or points to a directory or other non-" "file entry, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2930 +#: ../../library/os.rst:2931 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "file (without following symlinks); return ``False`` if the entry is a " "directory or other non-file entry, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2934 +#: ../../library/os.rst:2935 msgid "" "The result is cached on the ``os.DirEntry`` object. Caching, system calls " "made, and exceptions raised are as per :func:`~os.DirEntry.is_dir`." msgstr "" -#: ../../library/os.rst:2939 +#: ../../library/os.rst:2940 msgid "" "Return ``True`` if this entry is a symbolic link (even if broken); return " "``False`` if the entry points to a directory or any kind of file, or if it " "doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2943 +#: ../../library/os.rst:2944 msgid "" "The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." "islink` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2946 +#: ../../library/os.rst:2947 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, neither Windows or Unix require a system call, except on " @@ -3320,48 +3314,48 @@ msgid "" "``dirent.d_type == DT_UNKNOWN``." msgstr "" -#: ../../library/os.rst:2956 +#: ../../library/os.rst:2957 msgid "" "Return ``True`` if this entry is a junction (even if broken); return " "``False`` if the entry points to a regular directory, any kind of file, a " "symlink, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2960 +#: ../../library/os.rst:2961 msgid "" "The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." "isjunction` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2967 +#: ../../library/os.rst:2968 msgid "" "Return a :class:`stat_result` object for this entry. This method follows " "symbolic links by default; to stat a symbolic link add the " "``follow_symlinks=False`` argument." msgstr "" -#: ../../library/os.rst:2971 +#: ../../library/os.rst:2972 msgid "" "On Unix, this method always requires a system call. On Windows, it only " "requires a system call if *follow_symlinks* is ``True`` and the entry is a " "reparse point (for example, a symbolic link or directory junction)." msgstr "" -#: ../../library/os.rst:2976 +#: ../../library/os.rst:2977 msgid "" "On Windows, the ``st_ino``, ``st_dev`` and ``st_nlink`` attributes of the :" "class:`stat_result` are always set to zero. Call :func:`os.stat` to get " "these attributes." msgstr "" -#: ../../library/os.rst:2980 +#: ../../library/os.rst:2981 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` to fetch " "up-to-date information." msgstr "" -#: ../../library/os.rst:2984 +#: ../../library/os.rst:2985 msgid "" "Note that there is a nice correspondence between several attributes and " "methods of ``os.DirEntry`` and of :class:`pathlib.Path`. In particular, the " @@ -3369,13 +3363,13 @@ msgid "" "``is_file()``, ``is_symlink()``, ``is_junction()``, and ``stat()`` methods." msgstr "" -#: ../../library/os.rst:2992 +#: ../../library/os.rst:2993 msgid "" "Added support for the :class:`~os.PathLike` interface. Added support for :" "class:`bytes` paths on Windows." msgstr "" -#: ../../library/os.rst:2996 +#: ../../library/os.rst:2997 msgid "" "The ``st_ctime`` attribute of a stat result is deprecated on Windows. The " "file creation time is properly available as ``st_birthtime``, and in the " @@ -3383,7 +3377,7 @@ msgid "" "time, if available." msgstr "" -#: ../../library/os.rst:3005 +#: ../../library/os.rst:3006 msgid "" "Get the status of a file or a file descriptor. Perform the equivalent of a :" "c:func:`stat` system call on the given path. *path* may be specified as " @@ -3392,21 +3386,21 @@ msgid "" "`stat_result` object." msgstr "" -#: ../../library/os.rst:3011 +#: ../../library/os.rst:3012 msgid "" "This function normally follows symlinks; to stat a symlink add the argument " "``follow_symlinks=False``, or use :func:`lstat`." msgstr "" -#: ../../library/os.rst:3014 ../../library/os.rst:4093 -#: ../../library/os.rst:4109 ../../library/os.rst:4125 -#: ../../library/os.rst:4145 +#: ../../library/os.rst:3015 ../../library/os.rst:4094 +#: ../../library/os.rst:4110 ../../library/os.rst:4126 +#: ../../library/os.rst:4146 msgid "" "This function can support :ref:`specifying a file descriptor ` and :" "ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:3017 +#: ../../library/os.rst:3018 msgid "" "On Windows, passing ``follow_symlinks=False`` will disable following all " "name-surrogate reparse points, which includes symlinks and directory " @@ -3420,11 +3414,11 @@ msgid "" "junction points, which will raise the usual exceptions." msgstr "" -#: ../../library/os.rst:3030 ../../library/os.rst:3800 +#: ../../library/os.rst:3031 ../../library/os.rst:3801 msgid "Example::" msgstr "範例: ::" -#: ../../library/os.rst:3032 +#: ../../library/os.rst:3033 msgid "" ">>> import os\n" ">>> statinfo = os.stat('somefile.txt')\n" @@ -3444,17 +3438,17 @@ msgstr "" ">>> statinfo.st_size\n" "264" -#: ../../library/os.rst:3043 +#: ../../library/os.rst:3044 msgid ":func:`fstat` and :func:`lstat` functions." msgstr ":func:`fstat` 和 :func:`lstat` 函式。" -#: ../../library/os.rst:3045 +#: ../../library/os.rst:3046 msgid "" "Added the *dir_fd* and *follow_symlinks* parameters, specifying a file " "descriptor instead of a path." msgstr "新增 *dir_fd* 與 *follow_symlinks* 參數,指定一個檔案描述器而非路徑。" -#: ../../library/os.rst:3052 +#: ../../library/os.rst:3053 msgid "" "On Windows, all reparse points that can be resolved by the operating system " "are now followed, and passing ``follow_symlinks=False`` disables following " @@ -3464,122 +3458,122 @@ msgid "" "of raising an error." msgstr "" -#: ../../library/os.rst:3063 +#: ../../library/os.rst:3064 msgid "" "Object whose attributes correspond roughly to the members of the :c:struct:" "`stat` structure. It is used for the result of :func:`os.stat`, :func:`os." "fstat` and :func:`os.lstat`." msgstr "" -#: ../../library/os.rst:3067 +#: ../../library/os.rst:3068 msgid "Attributes:" msgstr "屬性:" -#: ../../library/os.rst:3071 +#: ../../library/os.rst:3072 msgid "File mode: file type and file mode bits (permissions)." msgstr "" -#: ../../library/os.rst:3075 +#: ../../library/os.rst:3076 msgid "" "Platform dependent, but if non-zero, uniquely identifies the file for a " "given value of ``st_dev``. Typically:" msgstr "" -#: ../../library/os.rst:3078 +#: ../../library/os.rst:3079 msgid "the inode number on Unix," msgstr "" -#: ../../library/os.rst:3079 +#: ../../library/os.rst:3080 msgid "" "the `file index `_ on " "Windows" msgstr "" -#: ../../library/os.rst:3085 +#: ../../library/os.rst:3086 msgid "Identifier of the device on which this file resides." msgstr "" -#: ../../library/os.rst:3089 +#: ../../library/os.rst:3090 msgid "Number of hard links." msgstr "" -#: ../../library/os.rst:3093 +#: ../../library/os.rst:3094 msgid "User identifier of the file owner." msgstr "" -#: ../../library/os.rst:3097 +#: ../../library/os.rst:3098 msgid "Group identifier of the file owner." msgstr "" -#: ../../library/os.rst:3101 +#: ../../library/os.rst:3102 msgid "" "Size of the file in bytes, if it is a regular file or a symbolic link. The " "size of a symbolic link is the length of the pathname it contains, without a " "terminating null byte." msgstr "" -#: ../../library/os.rst:3105 +#: ../../library/os.rst:3106 msgid "Timestamps:" msgstr "" -#: ../../library/os.rst:3109 +#: ../../library/os.rst:3110 msgid "Time of most recent access expressed in seconds." msgstr "" -#: ../../library/os.rst:3113 +#: ../../library/os.rst:3114 msgid "Time of most recent content modification expressed in seconds." msgstr "" -#: ../../library/os.rst:3117 +#: ../../library/os.rst:3118 msgid "Time of most recent metadata change expressed in seconds." msgstr "" -#: ../../library/os.rst:3119 +#: ../../library/os.rst:3120 msgid "" "``st_ctime`` is deprecated on Windows. Use ``st_birthtime`` for the file " "creation time. In the future, ``st_ctime`` will contain the time of the most " "recent metadata change, as for other platforms." msgstr "" -#: ../../library/os.rst:3126 +#: ../../library/os.rst:3127 msgid "Time of most recent access expressed in nanoseconds as an integer." msgstr "" -#: ../../library/os.rst:3132 +#: ../../library/os.rst:3133 msgid "" "Time of most recent content modification expressed in nanoseconds as an " "integer." msgstr "" -#: ../../library/os.rst:3139 +#: ../../library/os.rst:3140 msgid "" "Time of most recent metadata change expressed in nanoseconds as an integer." msgstr "" -#: ../../library/os.rst:3144 +#: ../../library/os.rst:3145 msgid "" "``st_ctime_ns`` is deprecated on Windows. Use ``st_birthtime_ns`` for the " "file creation time. In the future, ``st_ctime`` will contain the time of the " "most recent metadata change, as for other platforms." msgstr "" -#: ../../library/os.rst:3151 +#: ../../library/os.rst:3152 msgid "" "Time of file creation expressed in seconds. This attribute is not always " "available, and may raise :exc:`AttributeError`." msgstr "" -#: ../../library/os.rst:3154 +#: ../../library/os.rst:3155 msgid "``st_birthtime`` is now available on Windows." msgstr "" -#: ../../library/os.rst:3159 +#: ../../library/os.rst:3160 msgid "" "Time of file creation expressed in nanoseconds as an integer. This attribute " "is not always available, and may raise :exc:`AttributeError`." msgstr "" -#: ../../library/os.rst:3167 +#: ../../library/os.rst:3168 msgid "" "The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, :" "attr:`st_ctime` and :attr:`st_birthtime` attributes depend on the operating " @@ -3589,7 +3583,7 @@ msgid "" "details." msgstr "" -#: ../../library/os.rst:3174 +#: ../../library/os.rst:3175 msgid "" "Similarly, although :attr:`st_atime_ns`, :attr:`st_mtime_ns`, :attr:" "`st_ctime_ns` and :attr:`st_birthtime_ns` are always expressed in " @@ -3602,74 +3596,74 @@ msgid "" "`st_birthtime_ns`." msgstr "" -#: ../../library/os.rst:3184 +#: ../../library/os.rst:3185 msgid "" "On some Unix systems (such as Linux), the following attributes may also be " "available:" msgstr "" -#: ../../library/os.rst:3189 +#: ../../library/os.rst:3190 msgid "" "Number of 512-byte blocks allocated for file. This may be smaller than :attr:" "`st_size`/512 when the file has holes." msgstr "" -#: ../../library/os.rst:3194 +#: ../../library/os.rst:3195 msgid "" "\"Preferred\" blocksize for efficient file system I/O. Writing to a file in " "smaller chunks may cause an inefficient read-modify-rewrite." msgstr "" -#: ../../library/os.rst:3199 +#: ../../library/os.rst:3200 msgid "Type of device if an inode device." msgstr "" -#: ../../library/os.rst:3203 +#: ../../library/os.rst:3204 msgid "User defined flags for file." msgstr "" -#: ../../library/os.rst:3205 +#: ../../library/os.rst:3206 msgid "" "On other Unix systems (such as FreeBSD), the following attributes may be " "available (but may be only filled out if root tries to use them):" msgstr "" -#: ../../library/os.rst:3210 +#: ../../library/os.rst:3211 msgid "File generation number." msgstr "" -#: ../../library/os.rst:3212 +#: ../../library/os.rst:3213 msgid "" "On Solaris and derivatives, the following attributes may also be available:" msgstr "" -#: ../../library/os.rst:3217 +#: ../../library/os.rst:3218 msgid "" "String that uniquely identifies the type of the filesystem that contains the " "file." msgstr "" -#: ../../library/os.rst:3220 +#: ../../library/os.rst:3221 msgid "On macOS systems, the following attributes may also be available:" msgstr "" -#: ../../library/os.rst:3224 +#: ../../library/os.rst:3225 msgid "Real size of the file." msgstr "" -#: ../../library/os.rst:3228 +#: ../../library/os.rst:3229 msgid "Creator of the file." msgstr "" -#: ../../library/os.rst:3232 +#: ../../library/os.rst:3233 msgid "File type." msgstr "" -#: ../../library/os.rst:3234 +#: ../../library/os.rst:3235 msgid "On Windows systems, the following attributes are also available:" msgstr "" -#: ../../library/os.rst:3238 +#: ../../library/os.rst:3239 msgid "" "Windows file attributes: ``dwFileAttributes`` member of the " "``BY_HANDLE_FILE_INFORMATION`` structure returned by :c:func:`!" @@ -3677,7 +3671,7 @@ msgid "" "FILE_ATTRIBUTE_ARCHIVE>` constants in the :mod:`stat` module." msgstr "" -#: ../../library/os.rst:3248 +#: ../../library/os.rst:3249 msgid "" "When :attr:`st_file_attributes` has the :const:`~stat." "FILE_ATTRIBUTE_REPARSE_POINT` set, this field contains the tag identifying " @@ -3685,14 +3679,14 @@ msgid "" "IO_REPARSE_TAG_SYMLINK>` constants in the :mod:`stat` module." msgstr "" -#: ../../library/os.rst:3253 +#: ../../library/os.rst:3254 msgid "" "The standard module :mod:`stat` defines functions and constants that are " "useful for extracting information from a :c:struct:`stat` structure. (On " "Windows, some items are filled with dummy values.)" msgstr "" -#: ../../library/os.rst:3257 +#: ../../library/os.rst:3258 msgid "" "For backward compatibility, a :class:`stat_result` instance is also " "accessible as a tuple of at least 10 integers giving the most important (and " @@ -3704,49 +3698,49 @@ msgid "" "class:`stat_result` as a tuple always returns integers." msgstr "" -#: ../../library/os.rst:3266 +#: ../../library/os.rst:3267 msgid "Windows now returns the file index as :attr:`st_ino` when available." msgstr "" -#: ../../library/os.rst:3270 +#: ../../library/os.rst:3271 msgid "Added the :attr:`st_fstype` member to Solaris/derivatives." msgstr "" -#: ../../library/os.rst:3273 +#: ../../library/os.rst:3274 msgid "Added the :attr:`st_reparse_tag` member on Windows." msgstr "在 Windows 上新增 :attr:`st_reparse_tag` 成員。" -#: ../../library/os.rst:3276 +#: ../../library/os.rst:3277 msgid "" "On Windows, the :attr:`st_mode` member now identifies special files as :" "const:`S_IFCHR`, :const:`S_IFIFO` or :const:`S_IFBLK` as appropriate." msgstr "" -#: ../../library/os.rst:3281 +#: ../../library/os.rst:3282 msgid "" "On Windows, :attr:`st_ctime` is deprecated. Eventually, it will contain the " "last metadata change time, for consistency with other platforms, but for now " "still contains creation time. Use :attr:`st_birthtime` for the creation time." msgstr "" -#: ../../library/os.rst:3287 +#: ../../library/os.rst:3288 msgid "" "On Windows, :attr:`st_ino` may now be up to 128 bits, depending on the file " "system. Previously it would not be above 64 bits, and larger file " "identifiers would be arbitrarily packed." msgstr "" -#: ../../library/os.rst:3291 +#: ../../library/os.rst:3292 msgid "" "On Windows, :attr:`st_rdev` no longer returns a value. Previously it would " "contain the same as :attr:`st_dev`, which was incorrect." msgstr "" -#: ../../library/os.rst:3294 +#: ../../library/os.rst:3295 msgid "Added the :attr:`st_birthtime` member on Windows." msgstr "在 Windows 上新增 :attr:`st_birthtime` 成員。" -#: ../../library/os.rst:3299 +#: ../../library/os.rst:3300 msgid "" "Perform a :c:func:`!statvfs` system call on the given path. The return " "value is an object whose attributes describe the filesystem on the given " @@ -3756,7 +3750,7 @@ msgid "" "`f_favail`, :attr:`f_flag`, :attr:`f_namemax`, :attr:`f_fsid`." msgstr "" -#: ../../library/os.rst:3306 +#: ../../library/os.rst:3307 msgid "" "Two module-level constants are defined for the :attr:`f_flag` attribute's " "bit-flags: if :const:`ST_RDONLY` is set, the filesystem is mounted read-" @@ -3764,7 +3758,7 @@ msgid "" "are disabled or not supported." msgstr "" -#: ../../library/os.rst:3311 +#: ../../library/os.rst:3312 msgid "" "Additional module-level constants are defined for GNU/glibc based systems. " "These are :const:`ST_NODEV` (disallow access to device special files), :" @@ -3777,11 +3771,11 @@ msgid "" "relative to mtime/ctime)." msgstr "" -#: ../../library/os.rst:3324 +#: ../../library/os.rst:3325 msgid "The :const:`ST_RDONLY` and :const:`ST_NOSUID` constants were added." msgstr "新增 :const:`ST_RDONLY` 與 :const:`ST_NOSUID` 常數。" -#: ../../library/os.rst:3330 +#: ../../library/os.rst:3331 msgid "" "The :const:`ST_NODEV`, :const:`ST_NOEXEC`, :const:`ST_SYNCHRONOUS`, :const:" "`ST_MANDLOCK`, :const:`ST_WRITE`, :const:`ST_APPEND`, :const:" @@ -3789,11 +3783,11 @@ msgid "" "`ST_RELATIME` constants were added." msgstr "" -#: ../../library/os.rst:3339 +#: ../../library/os.rst:3340 msgid "Added the :attr:`f_fsid` attribute." msgstr "新增 :attr:`f_fsid` 屬性。" -#: ../../library/os.rst:3345 +#: ../../library/os.rst:3346 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept an open file descriptor for their *dir_fd* parameter. Different " @@ -3805,7 +3799,7 @@ msgid "" "(Specifying ``None`` for *dir_fd* is always supported on all platforms.)" msgstr "" -#: ../../library/os.rst:3355 +#: ../../library/os.rst:3356 msgid "" "To check whether a particular function accepts an open file descriptor for " "its *dir_fd* parameter, use the ``in`` operator on ``supports_dir_fd``. As " @@ -3813,17 +3807,17 @@ msgid "" "open file descriptors for *dir_fd* on the local platform::" msgstr "" -#: ../../library/os.rst:3360 +#: ../../library/os.rst:3361 msgid "os.stat in os.supports_dir_fd" msgstr "os.stat in os.supports_dir_fd" -#: ../../library/os.rst:3362 +#: ../../library/os.rst:3363 msgid "" "Currently *dir_fd* parameters only work on Unix platforms; none of them work " "on Windows." msgstr "" -#: ../../library/os.rst:3370 +#: ../../library/os.rst:3371 msgid "" "A :class:`set` object indicating whether :func:`os.access` permits " "specifying ``True`` for its *effective_ids* parameter on the local platform. " @@ -3832,23 +3826,23 @@ msgid "" "func:`os.access`; otherwise it will be empty." msgstr "" -#: ../../library/os.rst:3376 +#: ../../library/os.rst:3377 msgid "" "This expression evaluates to ``True`` if :func:`os.access` supports " "``effective_ids=True`` on the local platform::" msgstr "" -#: ../../library/os.rst:3379 +#: ../../library/os.rst:3380 msgid "os.access in os.supports_effective_ids" msgstr "os.access in os.supports_effective_ids" -#: ../../library/os.rst:3381 +#: ../../library/os.rst:3382 msgid "" "Currently *effective_ids* is only supported on Unix platforms; it does not " "work on Windows." msgstr "" -#: ../../library/os.rst:3389 +#: ../../library/os.rst:3390 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "permit specifying their *path* parameter as an open file descriptor on the " @@ -3857,7 +3851,7 @@ msgid "" "*path* arguments is not available on all platforms Python supports." msgstr "" -#: ../../library/os.rst:3396 +#: ../../library/os.rst:3397 msgid "" "To determine whether a particular function permits specifying an open file " "descriptor for its *path* parameter, use the ``in`` operator on " @@ -3866,11 +3860,11 @@ msgid "" "platform::" msgstr "" -#: ../../library/os.rst:3402 +#: ../../library/os.rst:3403 msgid "os.chdir in os.supports_fd" msgstr "os.chdir in os.supports_fd" -#: ../../library/os.rst:3409 +#: ../../library/os.rst:3410 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept ``False`` for their *follow_symlinks* parameter on the local " @@ -3883,7 +3877,7 @@ msgid "" "on all platforms.)" msgstr "" -#: ../../library/os.rst:3419 +#: ../../library/os.rst:3420 msgid "" "To check whether a particular function accepts ``False`` for its " "*follow_symlinks* parameter, use the ``in`` operator on " @@ -3892,15 +3886,15 @@ msgid "" "stat` on the local platform::" msgstr "" -#: ../../library/os.rst:3425 +#: ../../library/os.rst:3426 msgid "os.stat in os.supports_follow_symlinks" msgstr "os.stat in os.supports_follow_symlinks" -#: ../../library/os.rst:3432 +#: ../../library/os.rst:3433 msgid "Create a symbolic link pointing to *src* named *dst*." msgstr "" -#: ../../library/os.rst:3434 +#: ../../library/os.rst:3435 msgid "" "On Windows, a symlink represents either a file or a directory, and does not " "morph to the target dynamically. If the target is present, the type of the " @@ -3910,7 +3904,7 @@ msgid "" "ignored." msgstr "" -#: ../../library/os.rst:3445 +#: ../../library/os.rst:3446 msgid "" "On newer versions of Windows 10, unprivileged accounts can create symlinks " "if Developer Mode is enabled. When Developer Mode is not available/enabled, " @@ -3918,12 +3912,12 @@ msgid "" "must be run as an administrator." msgstr "" -#: ../../library/os.rst:3451 +#: ../../library/os.rst:3452 msgid "" ":exc:`OSError` is raised when the function is called by an unprivileged user." msgstr "" -#: ../../library/os.rst:3454 +#: ../../library/os.rst:3455 msgid "" "Raises an :ref:`auditing event ` ``os.symlink`` with arguments " "``src``, ``dst``, ``dir_fd``." @@ -3931,27 +3925,27 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.symlink``。" -#: ../../library/os.rst:3464 +#: ../../library/os.rst:3465 msgid "" "Added the *dir_fd* parameter, and now allow *target_is_directory* on non-" "Windows platforms." msgstr "" -#: ../../library/os.rst:3471 +#: ../../library/os.rst:3472 msgid "Added support for unelevated symlinks on Windows with Developer Mode." msgstr "" -#: ../../library/os.rst:3477 +#: ../../library/os.rst:3478 msgid "Force write of everything to disk." msgstr "" -#: ../../library/os.rst:3486 +#: ../../library/os.rst:3487 msgid "" "Truncate the file corresponding to *path*, so that it is at most *length* " "bytes in size." msgstr "" -#: ../../library/os.rst:3491 +#: ../../library/os.rst:3492 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``path``, ``length``." @@ -3959,46 +3953,46 @@ msgstr "" "引發一個附帶引數 ``path``、``length`` 的\\ :ref:`稽核事件 ` ``os." "truncate``。" -#: ../../library/os.rst:3506 +#: ../../library/os.rst:3507 msgid "" "Remove (delete) the file *path*. This function is semantically identical " "to :func:`remove`; the ``unlink`` name is its traditional Unix name. Please " "see the documentation for :func:`remove` for further information." msgstr "" -#: ../../library/os.rst:3522 +#: ../../library/os.rst:3523 msgid "Set the access and modified times of the file specified by *path*." msgstr "" -#: ../../library/os.rst:3524 +#: ../../library/os.rst:3525 msgid "" ":func:`utime` takes two optional parameters, *times* and *ns*. These specify " "the times set on *path* and are used as follows:" msgstr "" -#: ../../library/os.rst:3527 +#: ../../library/os.rst:3528 msgid "" "If *ns* is specified, it must be a 2-tuple of the form ``(atime_ns, " "mtime_ns)`` where each member is an int expressing nanoseconds." msgstr "" -#: ../../library/os.rst:3530 +#: ../../library/os.rst:3531 msgid "" "If *times* is not ``None``, it must be a 2-tuple of the form ``(atime, " "mtime)`` where each member is an int or float expressing seconds." msgstr "" -#: ../../library/os.rst:3533 +#: ../../library/os.rst:3534 msgid "" "If *times* is ``None`` and *ns* is unspecified, this is equivalent to " "specifying ``ns=(atime_ns, mtime_ns)`` where both times are the current time." msgstr "" -#: ../../library/os.rst:3537 +#: ../../library/os.rst:3538 msgid "It is an error to specify tuples for both *times* and *ns*." msgstr "" -#: ../../library/os.rst:3539 +#: ../../library/os.rst:3540 msgid "" "Note that the exact times you set here may not be returned by a subsequent :" "func:`~os.stat` call, depending on the resolution with which your operating " @@ -4008,7 +4002,7 @@ msgid "" "func:`utime`." msgstr "" -#: ../../library/os.rst:3550 +#: ../../library/os.rst:3551 msgid "" "Raises an :ref:`auditing event ` ``os.utime`` with arguments " "``path``, ``times``, ``ns``, ``dir_fd``." @@ -4016,13 +4010,13 @@ msgstr "" "引發一個附帶引數 ``path``、``times``、``ns``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.utime``。" -#: ../../library/os.rst:3552 +#: ../../library/os.rst:3553 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd*, *follow_symlinks*, and *ns* parameters." msgstr "" -#: ../../library/os.rst:3566 +#: ../../library/os.rst:3567 msgid "" "Generate the file names in a directory tree by walking the tree either top-" "down or bottom-up. For each directory in the tree rooted at directory *top* " @@ -4030,7 +4024,7 @@ msgid "" "filenames)``." msgstr "" -#: ../../library/os.rst:3571 +#: ../../library/os.rst:3572 msgid "" "*dirpath* is a string, the path to the directory. *dirnames* is a list of " "the names of the subdirectories in *dirpath* (including symlinks to " @@ -4044,7 +4038,7 @@ msgid "" "unspecified." msgstr "" -#: ../../library/os.rst:3582 +#: ../../library/os.rst:3583 msgid "" "If optional argument *topdown* is ``True`` or not specified, the triple for " "a directory is generated before the triples for any of its subdirectories " @@ -4055,7 +4049,7 @@ msgid "" "its subdirectories are generated." msgstr "" -#: ../../library/os.rst:3590 +#: ../../library/os.rst:3591 msgid "" "When *topdown* is ``True``, the caller can modify the *dirnames* list in-" "place (perhaps using :keyword:`del` or slice assignment), and :func:`walk` " @@ -4068,7 +4062,7 @@ msgid "" "itself is generated." msgstr "" -#: ../../library/os.rst:3599 +#: ../../library/os.rst:3600 msgid "" "By default, errors from the :func:`scandir` call are ignored. If optional " "argument *onerror* is specified, it should be a function; it will be called " @@ -4078,54 +4072,54 @@ msgid "" "object." msgstr "" -#: ../../library/os.rst:3605 +#: ../../library/os.rst:3606 msgid "" "By default, :func:`walk` will not walk down into symbolic links that resolve " "to directories. Set *followlinks* to ``True`` to visit directories pointed " "to by symlinks, on systems that support them." msgstr "" -#: ../../library/os.rst:3611 +#: ../../library/os.rst:3612 msgid "" "Be aware that setting *followlinks* to ``True`` can lead to infinite " "recursion if a link points to a parent directory of itself. :func:`walk` " "does not keep track of the directories it visited already." msgstr "" -#: ../../library/os.rst:3617 +#: ../../library/os.rst:3618 msgid "" "If you pass a relative pathname, don't change the current working directory " "between resumptions of :func:`walk`. :func:`walk` never changes the current " "directory, and assumes that its caller doesn't either." msgstr "" -#: ../../library/os.rst:3621 ../../library/os.rst:3683 +#: ../../library/os.rst:3622 ../../library/os.rst:3684 msgid "" "This example displays the number of bytes taken by non-directory files in " "each directory under the starting directory, except that it doesn't look " -"under any CVS subdirectory::" +"under any ``__pycache__`` subdirectory::" msgstr "" -#: ../../library/os.rst:3625 +#: ../../library/os.rst:3626 msgid "" "import os\n" "from os.path import join, getsize\n" -"for root, dirs, files in os.walk('python/Lib/email'):\n" +"for root, dirs, files in os.walk('python/Lib/xml'):\n" " print(root, \"consumes\", end=\" \")\n" " print(sum(getsize(join(root, name)) for name in files), end=\" \")\n" " print(\"bytes in\", len(files), \"non-directory files\")\n" -" if 'CVS' in dirs:\n" -" dirs.remove('CVS') # don't visit CVS directories" +" if '__pycache__' in dirs:\n" +" dirs.remove('__pycache__') # don't visit __pycache__ directories" msgstr "" -#: ../../library/os.rst:3634 +#: ../../library/os.rst:3635 msgid "" "In the next example (simple implementation of :func:`shutil.rmtree`), " "walking the tree bottom-up is essential, :func:`rmdir` doesn't allow " "deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3638 +#: ../../library/os.rst:3639 msgid "" "# Delete everything reachable from the directory named in \"top\",\n" "# assuming there are no symbolic links.\n" @@ -4140,7 +4134,7 @@ msgid "" "os.rmdir(top)" msgstr "" -#: ../../library/os.rst:3650 +#: ../../library/os.rst:3651 msgid "" "Raises an :ref:`auditing event ` ``os.walk`` with arguments " "``top``, ``topdown``, ``onerror``, ``followlinks``." @@ -4148,25 +4142,25 @@ msgstr "" "引發一個附帶引數 ``top``、``topdown``、``onerror``、``followlinks`` 的\\ :" "ref:`稽核事件 ` ``os.walk``。" -#: ../../library/os.rst:3652 +#: ../../library/os.rst:3653 msgid "" "This function now calls :func:`os.scandir` instead of :func:`os.listdir`, " "making it faster by reducing the number of calls to :func:`os.stat`." msgstr "" -#: ../../library/os.rst:3666 +#: ../../library/os.rst:3667 msgid "" "This behaves exactly like :func:`walk`, except that it yields a 4-tuple " "``(dirpath, dirnames, filenames, dirfd)``, and it supports ``dir_fd``." msgstr "" -#: ../../library/os.rst:3669 +#: ../../library/os.rst:3670 msgid "" "*dirpath*, *dirnames* and *filenames* are identical to :func:`walk` output, " "and *dirfd* is a file descriptor referring to the directory *dirpath*." msgstr "" -#: ../../library/os.rst:3672 +#: ../../library/os.rst:3673 msgid "" "This function always supports :ref:`paths relative to directory descriptors " "` and :ref:`not following symlinks `. Note however " @@ -4174,32 +4168,32 @@ msgid "" "*follow_symlinks* is ``False``." msgstr "" -#: ../../library/os.rst:3679 +#: ../../library/os.rst:3680 msgid "" "Since :func:`fwalk` yields file descriptors, those are only valid until the " "next iteration step, so you should duplicate them (e.g. with :func:`dup`) if " "you want to keep them longer." msgstr "" -#: ../../library/os.rst:3687 +#: ../../library/os.rst:3688 msgid "" "import os\n" -"for root, dirs, files, rootfd in os.fwalk('python/Lib/email'):\n" +"for root, dirs, files, rootfd in os.fwalk('python/Lib/xml'):\n" " print(root, \"consumes\", end=\"\")\n" " print(sum([os.stat(name, dir_fd=rootfd).st_size for name in files]),\n" " end=\"\")\n" " print(\"bytes in\", len(files), \"non-directory files\")\n" -" if 'CVS' in dirs:\n" -" dirs.remove('CVS') # don't visit CVS directories" +" if '__pycache__' in dirs:\n" +" dirs.remove('__pycache__') # don't visit __pycache__ directories" msgstr "" -#: ../../library/os.rst:3696 +#: ../../library/os.rst:3697 msgid "" "In the next example, walking the tree bottom-up is essential: :func:`rmdir` " "doesn't allow deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3700 +#: ../../library/os.rst:3701 msgid "" "# Delete everything reachable from the directory named in \"top\",\n" "# assuming there are no symbolic links.\n" @@ -4213,7 +4207,7 @@ msgid "" " os.rmdir(name, dir_fd=rootfd)" msgstr "" -#: ../../library/os.rst:3711 +#: ../../library/os.rst:3712 msgid "" "Raises an :ref:`auditing event ` ``os.fwalk`` with arguments " "``top``, ``topdown``, ``onerror``, ``follow_symlinks``, ``dir_fd``." @@ -4221,11 +4215,11 @@ msgstr "" "引發一個附帶引數 ``top``、``topdown``、``onerror``、``follow_symlinks``、" "``dir_fd`` 的\\ :ref:`稽核事件 ` ``os.fwalk``。" -#: ../../library/os.rst:3720 +#: ../../library/os.rst:3721 msgid "Added support for :class:`bytes` paths." msgstr "新增對 :class:`bytes` 路徑的支援。" -#: ../../library/os.rst:3726 +#: ../../library/os.rst:3727 msgid "" "Create an anonymous file and return a file descriptor that refers to it. " "*flags* must be one of the ``os.MFD_*`` constants available on the system " @@ -4233,7 +4227,7 @@ msgid "" "descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3731 +#: ../../library/os.rst:3732 msgid "" "The name supplied in *name* is used as a filename and will be displayed as " "the target of the corresponding symbolic link in the directory ``/proc/self/" @@ -4243,15 +4237,15 @@ msgid "" "side effects." msgstr "" -#: ../../library/os.rst:3761 +#: ../../library/os.rst:3762 msgid "These flags can be passed to :func:`memfd_create`." msgstr "這些旗標可以傳給 :func:`memfd_create`。" -#: ../../library/os.rst:3765 +#: ../../library/os.rst:3766 msgid "The ``MFD_HUGE*`` flags are only available since Linux 4.14." msgstr "``MFD_HUGE*`` 旗標僅在 Linux 4.14 以上可用。" -#: ../../library/os.rst:3772 +#: ../../library/os.rst:3773 msgid "" "Create and return an event file descriptor. The file descriptors supports " "raw :func:`read` and :func:`write` with a buffer size of 8, :func:`~select." @@ -4260,7 +4254,7 @@ msgid "" "ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3778 +#: ../../library/os.rst:3779 msgid "" "*initval* is the initial value of the event counter. The initial value must " "be a 32 bit unsigned integer. Please note that the initial value is limited " @@ -4268,39 +4262,39 @@ msgid "" "integer with a maximum value of 2\\ :sup:`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3783 +#: ../../library/os.rst:3784 msgid "" "*flags* can be constructed from :const:`EFD_CLOEXEC`, :const:`EFD_NONBLOCK`, " "and :const:`EFD_SEMAPHORE`." msgstr "" -#: ../../library/os.rst:3786 +#: ../../library/os.rst:3787 msgid "" "If :const:`EFD_SEMAPHORE` is specified and the event counter is non-zero, :" "func:`eventfd_read` returns 1 and decrements the counter by one." msgstr "" -#: ../../library/os.rst:3789 +#: ../../library/os.rst:3790 msgid "" "If :const:`EFD_SEMAPHORE` is not specified and the event counter is non-" "zero, :func:`eventfd_read` returns the current event counter value and " "resets the counter to zero." msgstr "" -#: ../../library/os.rst:3793 +#: ../../library/os.rst:3794 msgid "" "If the event counter is zero and :const:`EFD_NONBLOCK` is not specified, :" "func:`eventfd_read` blocks." msgstr "" -#: ../../library/os.rst:3796 +#: ../../library/os.rst:3797 msgid "" ":func:`eventfd_write` increments the event counter. Write blocks if the " "write operation would increment the counter to a value larger than 2\\ :sup:" "`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3802 +#: ../../library/os.rst:3803 msgid "" "import os\n" "\n" @@ -4318,64 +4312,64 @@ msgid "" " os.close(fd)" msgstr "" -#: ../../library/os.rst:3823 +#: ../../library/os.rst:3824 msgid "" "Read value from an :func:`eventfd` file descriptor and return a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3832 +#: ../../library/os.rst:3833 msgid "" "Add value to an :func:`eventfd` file descriptor. *value* must be a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3841 +#: ../../library/os.rst:3842 msgid "Set close-on-exec flag for new :func:`eventfd` file descriptor." msgstr "" -#: ../../library/os.rst:3849 +#: ../../library/os.rst:3850 msgid "" "Set :const:`O_NONBLOCK` status flag for new :func:`eventfd` file descriptor." msgstr "設定新的 :func:`eventfd` 檔案描述器的 :const:`O_NONBLOCK` 狀態旗標。" -#: ../../library/os.rst:3858 +#: ../../library/os.rst:3859 msgid "" "Provide semaphore-like semantics for reads from an :func:`eventfd` file " "descriptor. On read the internal counter is decremented by one." msgstr "" -#: ../../library/os.rst:3869 +#: ../../library/os.rst:3870 msgid "Timer File Descriptors" msgstr "" -#: ../../library/os.rst:3873 +#: ../../library/os.rst:3874 msgid "" "These functions provide support for Linux's *timer file descriptor* API. " "Naturally, they are all only available on Linux." msgstr "" -#: ../../library/os.rst:3878 +#: ../../library/os.rst:3879 msgid "Create and return a timer file descriptor (*timerfd*)." msgstr "" -#: ../../library/os.rst:3880 +#: ../../library/os.rst:3881 msgid "The file descriptor returned by :func:`timerfd_create` supports:" msgstr "" -#: ../../library/os.rst:3882 +#: ../../library/os.rst:3883 msgid ":func:`read`" msgstr ":func:`read`" -#: ../../library/os.rst:3883 +#: ../../library/os.rst:3884 msgid ":func:`~select.select`" msgstr ":func:`~select.select`" -#: ../../library/os.rst:3884 +#: ../../library/os.rst:3885 msgid ":func:`~select.poll`" msgstr ":func:`~select.poll`" -#: ../../library/os.rst:3886 +#: ../../library/os.rst:3887 msgid "" "The file descriptor's :func:`read` method can be called with a buffer size " "of 8. If the timer has already expired one or more times, :func:`read` " @@ -4384,31 +4378,31 @@ msgid "" "byteorder)``." msgstr "" -#: ../../library/os.rst:3891 +#: ../../library/os.rst:3892 msgid "" ":func:`~select.select` and :func:`~select.poll` can be used to wait until " "timer expires and the file descriptor is readable." msgstr "" -#: ../../library/os.rst:3894 +#: ../../library/os.rst:3895 msgid "" "*clockid* must be a valid :ref:`clock ID `, as " "defined in the :py:mod:`time` module:" msgstr "" -#: ../../library/os.rst:3897 +#: ../../library/os.rst:3898 msgid ":const:`time.CLOCK_REALTIME`" msgstr ":const:`time.CLOCK_REALTIME`" -#: ../../library/os.rst:3898 +#: ../../library/os.rst:3899 msgid ":const:`time.CLOCK_MONOTONIC`" msgstr ":const:`time.CLOCK_MONOTONIC`" -#: ../../library/os.rst:3899 +#: ../../library/os.rst:3900 msgid ":const:`time.CLOCK_BOOTTIME` (Since Linux 3.15 for timerfd_create)" msgstr "" -#: ../../library/os.rst:3901 +#: ../../library/os.rst:3902 msgid "" "If *clockid* is :const:`time.CLOCK_REALTIME`, a settable system-wide real-" "time clock is used. If system clock is changed, timer setting need to be " @@ -4416,35 +4410,35 @@ msgid "" "`TFD_TIMER_CANCEL_ON_SET`." msgstr "" -#: ../../library/os.rst:3906 +#: ../../library/os.rst:3907 msgid "" "If *clockid* is :const:`time.CLOCK_MONOTONIC`, a non-settable monotonically " "increasing clock is used. Even if the system clock is changed, the timer " "setting will not be affected." msgstr "" -#: ../../library/os.rst:3910 +#: ../../library/os.rst:3911 msgid "" "If *clockid* is :const:`time.CLOCK_BOOTTIME`, same as :const:`time." "CLOCK_MONOTONIC` except it includes any time that the system is suspended." msgstr "" -#: ../../library/os.rst:3913 +#: ../../library/os.rst:3914 msgid "" "The file descriptor's behaviour can be modified by specifying a *flags* " "value. Any of the following variables may used, combined using bitwise OR " "(the ``|`` operator):" msgstr "" -#: ../../library/os.rst:3917 +#: ../../library/os.rst:3918 msgid ":const:`TFD_NONBLOCK`" msgstr ":const:`TFD_NONBLOCK`" -#: ../../library/os.rst:3918 +#: ../../library/os.rst:3919 msgid ":const:`TFD_CLOEXEC`" msgstr ":const:`TFD_CLOEXEC`" -#: ../../library/os.rst:3920 +#: ../../library/os.rst:3921 msgid "" "If :const:`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks until the " "timer expires. If it is set as a flag, :func:`read` doesn't block, but If " @@ -4452,46 +4446,46 @@ msgid "" "raises :class:`OSError` with ``errno`` is set to :const:`errno.EAGAIN`." msgstr "" -#: ../../library/os.rst:3926 +#: ../../library/os.rst:3927 msgid ":const:`TFD_CLOEXEC` is always set by Python automatically." msgstr "" -#: ../../library/os.rst:3928 +#: ../../library/os.rst:3929 msgid "" "The file descriptor must be closed with :func:`os.close` when it is no " "longer needed, or else the file descriptor will be leaked." msgstr "" -#: ../../library/os.rst:3931 +#: ../../library/os.rst:3932 msgid "The :manpage:`timerfd_create(2)` man page." msgstr ":manpage:`timerfd_create(2)` 手冊頁。" -#: ../../library/os.rst:3940 +#: ../../library/os.rst:3941 msgid "" "Alter a timer file descriptor's internal timer. This function operates the " "same interval timer as :func:`timerfd_settime_ns`." msgstr "" -#: ../../library/os.rst:3943 +#: ../../library/os.rst:3944 msgid "*fd* must be a valid timer file descriptor." msgstr "" -#: ../../library/os.rst:3945 +#: ../../library/os.rst:3946 msgid "" "The timer's behaviour can be modified by specifying a *flags* value. Any of " "the following variables may used, combined using bitwise OR (the ``|`` " "operator):" msgstr "" -#: ../../library/os.rst:3949 +#: ../../library/os.rst:3950 msgid ":const:`TFD_TIMER_ABSTIME`" msgstr ":const:`TFD_TIMER_ABSTIME`" -#: ../../library/os.rst:3950 +#: ../../library/os.rst:3951 msgid ":const:`TFD_TIMER_CANCEL_ON_SET`" msgstr ":const:`TFD_TIMER_CANCEL_ON_SET`" -#: ../../library/os.rst:3952 +#: ../../library/os.rst:3953 msgid "" "The timer is disabled by setting *initial* to zero (``0``). If *initial* is " "equal to or greater than zero, the timer is enabled. If *initial* is less " @@ -4499,20 +4493,20 @@ msgid "" "const:`errno.EINVAL`" msgstr "" -#: ../../library/os.rst:3957 +#: ../../library/os.rst:3958 msgid "" "By default the timer will fire when *initial* seconds have elapsed. (If " "*initial* is zero, timer will fire immediately.)" msgstr "" -#: ../../library/os.rst:3960 +#: ../../library/os.rst:3961 msgid "" "However, if the :const:`TFD_TIMER_ABSTIME` flag is set, the timer will fire " "when the timer's clock (set by *clockid* in :func:`timerfd_create`) reaches " "*initial* seconds." msgstr "" -#: ../../library/os.rst:3964 +#: ../../library/os.rst:3965 msgid "" "The timer's interval is set by the *interval* :py:class:`float`. If " "*interval* is zero, the timer only fires once, on the initial expiration. If " @@ -4522,7 +4516,7 @@ msgid "" "EINVAL`" msgstr "" -#: ../../library/os.rst:3971 +#: ../../library/os.rst:3972 msgid "" "If the :const:`TFD_TIMER_CANCEL_ON_SET` flag is set along with :const:" "`TFD_TIMER_ABSTIME` and the clock for this timer is :const:`time." @@ -4531,86 +4525,86 @@ msgid "" "ECANCELED." msgstr "" -#: ../../library/os.rst:3977 +#: ../../library/os.rst:3978 msgid "" "Linux manages system clock as UTC. A daylight-savings time transition is " "done by changing time offset only and doesn't cause discontinuous system " "clock change." msgstr "" -#: ../../library/os.rst:3981 +#: ../../library/os.rst:3982 msgid "" "Discontinuous system clock change will be caused by the following events:" msgstr "" -#: ../../library/os.rst:3983 +#: ../../library/os.rst:3984 msgid "``settimeofday``" msgstr "``settimeofday``" -#: ../../library/os.rst:3984 +#: ../../library/os.rst:3985 msgid "``clock_settime``" msgstr "``clock_settime``" -#: ../../library/os.rst:3985 +#: ../../library/os.rst:3986 msgid "set the system date and time by ``date`` command" msgstr "" -#: ../../library/os.rst:3987 +#: ../../library/os.rst:3988 msgid "" "Return a two-item tuple of (``next_expiration``, ``interval``) from the " "previous timer state, before this function executed." msgstr "" -#: ../../library/os.rst:3992 +#: ../../library/os.rst:3993 msgid "" ":manpage:`timerfd_create(2)`, :manpage:`timerfd_settime(2)`, :manpage:" "`settimeofday(2)`, :manpage:`clock_settime(2)`, and :manpage:`date(1)`." msgstr "" -#: ../../library/os.rst:4003 +#: ../../library/os.rst:4004 msgid "" "Similar to :func:`timerfd_settime`, but use time as nanoseconds. This " "function operates the same interval timer as :func:`timerfd_settime`." msgstr "" -#: ../../library/os.rst:4013 +#: ../../library/os.rst:4014 msgid "Return a two-item tuple of floats (``next_expiration``, ``interval``)." msgstr "" -#: ../../library/os.rst:4015 +#: ../../library/os.rst:4016 msgid "" "``next_expiration`` denotes the relative time until next the timer next " "fires, regardless of if the :const:`TFD_TIMER_ABSTIME` flag is set." msgstr "" -#: ../../library/os.rst:4018 +#: ../../library/os.rst:4019 msgid "" "``interval`` denotes the timer's interval. If zero, the timer will only fire " "once, after ``next_expiration`` seconds have elapsed." msgstr "" -#: ../../library/os.rst:4022 +#: ../../library/os.rst:4023 msgid ":manpage:`timerfd_gettime(2)`" msgstr ":manpage:`timerfd_gettime(2)`" -#: ../../library/os.rst:4031 +#: ../../library/os.rst:4032 msgid "Similar to :func:`timerfd_gettime`, but return time as nanoseconds." msgstr "" -#: ../../library/os.rst:4039 +#: ../../library/os.rst:4040 msgid "" "A flag for the :func:`timerfd_create` function, which sets the :const:" "`O_NONBLOCK` status flag for the new timer file descriptor. If :const:" "`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks." msgstr "" -#: ../../library/os.rst:4049 +#: ../../library/os.rst:4050 msgid "" "A flag for the :func:`timerfd_create` function, If :const:`TFD_CLOEXEC` is " "set as a flag, set close-on-exec flag for new file descriptor." msgstr "" -#: ../../library/os.rst:4059 +#: ../../library/os.rst:4060 msgid "" "A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " "functions. If this flag is set, *initial* is interpreted as an absolute " @@ -4618,22 +4612,22 @@ msgid "" "Epoch)." msgstr "" -#: ../../library/os.rst:4069 +#: ../../library/os.rst:4070 msgid "" "A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " "functions along with :const:`TFD_TIMER_ABSTIME`. The timer is cancelled when " "the time of the underlying clock changes discontinuously." msgstr "" -#: ../../library/os.rst:4080 +#: ../../library/os.rst:4081 msgid "Linux extended attributes" msgstr "" -#: ../../library/os.rst:4084 +#: ../../library/os.rst:4085 msgid "These functions are all available on Linux only." msgstr "" -#: ../../library/os.rst:4088 +#: ../../library/os.rst:4089 msgid "" "Return the value of the extended filesystem attribute *attribute* for " "*path*. *attribute* can be bytes or str (directly or indirectly through the :" @@ -4641,7 +4635,7 @@ msgid "" "encoding." msgstr "" -#: ../../library/os.rst:4096 +#: ../../library/os.rst:4097 msgid "" "Raises an :ref:`auditing event ` ``os.getxattr`` with arguments " "``path``, ``attribute``." @@ -4649,12 +4643,12 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.getxattr``。" -#: ../../library/os.rst:4098 ../../library/os.rst:4130 -#: ../../library/os.rst:4155 +#: ../../library/os.rst:4099 ../../library/os.rst:4131 +#: ../../library/os.rst:4156 msgid "Accepts a :term:`path-like object` for *path* and *attribute*." msgstr "" -#: ../../library/os.rst:4104 +#: ../../library/os.rst:4105 msgid "" "Return a list of the extended filesystem attributes on *path*. The " "attributes in the list are represented as strings decoded with the " @@ -4662,14 +4656,14 @@ msgid "" "the current directory." msgstr "" -#: ../../library/os.rst:4112 +#: ../../library/os.rst:4113 msgid "" "Raises an :ref:`auditing event ` ``os.listxattr`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.listxattr``。" -#: ../../library/os.rst:4120 +#: ../../library/os.rst:4121 msgid "" "Removes the extended filesystem attribute *attribute* from *path*. " "*attribute* should be bytes or str (directly or indirectly through the :" @@ -4677,7 +4671,7 @@ msgid "" "`filesystem encoding and error handler`." msgstr "" -#: ../../library/os.rst:4128 +#: ../../library/os.rst:4129 msgid "" "Raises an :ref:`auditing event ` ``os.removexattr`` with arguments " "``path``, ``attribute``." @@ -4685,7 +4679,7 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.removexattr``。" -#: ../../library/os.rst:4136 +#: ../../library/os.rst:4137 msgid "" "Set the extended filesystem attribute *attribute* on *path* to *value*. " "*attribute* must be a bytes or str with no embedded NULs (directly or " @@ -4697,13 +4691,13 @@ msgid "" "will not be created and ``EEXISTS`` will be raised." msgstr "" -#: ../../library/os.rst:4150 +#: ../../library/os.rst:4151 msgid "" "A bug in Linux kernel versions less than 2.6.39 caused the flags argument to " "be ignored on some filesystems." msgstr "" -#: ../../library/os.rst:4153 +#: ../../library/os.rst:4154 msgid "" "Raises an :ref:`auditing event ` ``os.setxattr`` with arguments " "``path``, ``attribute``, ``value``, ``flags``." @@ -4711,33 +4705,33 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute``、``value``、``flags`` 的\\ :ref:`稽" "核事件 ` ``os.setxattr``。" -#: ../../library/os.rst:4161 +#: ../../library/os.rst:4162 msgid "" "The maximum size the value of an extended attribute can be. Currently, this " "is 64 KiB on Linux." msgstr "" -#: ../../library/os.rst:4167 +#: ../../library/os.rst:4168 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must create an attribute." msgstr "" -#: ../../library/os.rst:4173 +#: ../../library/os.rst:4174 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must replace an existing attribute." msgstr "" -#: ../../library/os.rst:4180 +#: ../../library/os.rst:4181 msgid "Process Management" msgstr "行程管理" -#: ../../library/os.rst:4182 +#: ../../library/os.rst:4183 msgid "These functions may be used to create and manage processes." msgstr "" -#: ../../library/os.rst:4184 +#: ../../library/os.rst:4185 msgid "" "The various :func:`exec\\* ` functions take a list of arguments for " "the new program loaded into the process. In each case, the first of these " @@ -4748,7 +4742,7 @@ msgid "" "standard output; ``foo`` will seem to be ignored." msgstr "" -#: ../../library/os.rst:4195 +#: ../../library/os.rst:4196 msgid "" "Generate a :const:`SIGABRT` signal to the current process. On Unix, the " "default behavior is to produce a core dump; on Windows, the process " @@ -4757,31 +4751,31 @@ msgid "" "`SIGABRT` with :func:`signal.signal`." msgstr "" -#: ../../library/os.rst:4204 +#: ../../library/os.rst:4205 msgid "Add a path to the DLL search path." msgstr "" -#: ../../library/os.rst:4206 +#: ../../library/os.rst:4207 msgid "" "This search path is used when resolving dependencies for imported extension " "modules (the module itself is resolved through :data:`sys.path`), and also " "by :mod:`ctypes`." msgstr "" -#: ../../library/os.rst:4210 +#: ../../library/os.rst:4211 msgid "" "Remove the directory by calling **close()** on the returned object or using " "it in a :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:4213 +#: ../../library/os.rst:4214 msgid "" "See the `Microsoft documentation `_ for more information about how " "DLLs are loaded." msgstr "" -#: ../../library/os.rst:4217 +#: ../../library/os.rst:4218 msgid "" "Raises an :ref:`auditing event ` ``os.add_dll_directory`` with " "argument ``path``." @@ -4789,7 +4783,7 @@ msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os." "add_dll_directory``。" -#: ../../library/os.rst:4221 +#: ../../library/os.rst:4222 msgid "" "Previous versions of CPython would resolve DLLs using the default behavior " "for the current process. This led to inconsistencies, such as only sometimes " @@ -4797,14 +4791,14 @@ msgid "" "such as ``AddDllDirectory`` having no effect." msgstr "" -#: ../../library/os.rst:4228 +#: ../../library/os.rst:4229 msgid "" "In 3.8, the two primary ways DLLs are loaded now explicitly override the " "process-wide behavior to ensure consistency. See the :ref:`porting notes " "` for information on updating libraries." msgstr "" -#: ../../library/os.rst:4243 +#: ../../library/os.rst:4244 msgid "" "These functions all execute a new program, replacing the current process; " "they do not return. On Unix, the new executable is loaded into the current " @@ -4812,7 +4806,7 @@ msgid "" "reported as :exc:`OSError` exceptions." msgstr "" -#: ../../library/os.rst:4248 +#: ../../library/os.rst:4249 msgid "" "The current process is replaced immediately. Open file objects and " "descriptors are not flushed, so if there may be data buffered on these open " @@ -4820,7 +4814,7 @@ msgid "" "fsync` before calling an :func:`exec\\* ` function." msgstr "" -#: ../../library/os.rst:4254 +#: ../../library/os.rst:4255 msgid "" "The \"l\" and \"v\" variants of the :func:`exec\\* ` functions differ " "in how command-line arguments are passed. The \"l\" variants are perhaps " @@ -4833,7 +4827,7 @@ msgid "" "is not enforced." msgstr "" -#: ../../library/os.rst:4263 +#: ../../library/os.rst:4264 msgid "" "The variants which include a \"p\" near the end (:func:`execlp`, :func:" "`execlpe`, :func:`execvp`, and :func:`execvpe`) will use the :envvar:`PATH` " @@ -4847,7 +4841,7 @@ msgid "" "even on Windows, as plain names will not be resolved." msgstr "" -#: ../../library/os.rst:4274 +#: ../../library/os.rst:4275 msgid "" "For :func:`execle`, :func:`execlpe`, :func:`execve`, and :func:`execvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -4857,7 +4851,7 @@ msgid "" "process to inherit the environment of the current process." msgstr "" -#: ../../library/os.rst:4281 +#: ../../library/os.rst:4282 msgid "" "For :func:`execve` on some platforms, *path* may also be specified as an " "open file descriptor. This functionality may not be supported on your " @@ -4866,7 +4860,7 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/os.rst:4286 +#: ../../library/os.rst:4287 msgid "" "Raises an :ref:`auditing event ` ``os.exec`` with arguments " "``path``, ``args``, ``env``." @@ -4874,25 +4868,25 @@ msgstr "" "引發一個附帶引數 ``path``、``args``、``env`` 的\\ :ref:`稽核事件 ` " "``os.exec``。" -#: ../../library/os.rst:4290 +#: ../../library/os.rst:4291 msgid "" "Added support for specifying *path* as an open file descriptor for :func:" "`execve`." msgstr "" -#: ../../library/os.rst:4299 +#: ../../library/os.rst:4300 msgid "" "Exit the process with status *n*, without calling cleanup handlers, flushing " "stdio buffers, etc." msgstr "" -#: ../../library/os.rst:4304 +#: ../../library/os.rst:4305 msgid "" "The standard way to exit is :func:`sys.exit(n) `. :func:`!_exit` " "should normally only be used in the child process after a :func:`fork`." msgstr "" -#: ../../library/os.rst:4307 +#: ../../library/os.rst:4308 msgid "" "The following exit codes are defined and can be used with :func:`_exit`, " "although they are not required. These are typically used for system " @@ -4900,139 +4894,139 @@ msgid "" "delivery program." msgstr "" -#: ../../library/os.rst:4313 +#: ../../library/os.rst:4314 msgid "" "Some of these may not be available on all Unix platforms, since there is " "some variation. These constants are defined where they are defined by the " "underlying platform." msgstr "" -#: ../../library/os.rst:4320 +#: ../../library/os.rst:4321 msgid "" "Exit code that means no error occurred. May be taken from the defined value " "of ``EXIT_SUCCESS`` on some platforms. Generally has a value of zero." msgstr "" -#: ../../library/os.rst:4328 +#: ../../library/os.rst:4329 msgid "" "Exit code that means the command was used incorrectly, such as when the " "wrong number of arguments are given." msgstr "" -#: ../../library/os.rst:4336 +#: ../../library/os.rst:4337 msgid "Exit code that means the input data was incorrect." msgstr "" -#: ../../library/os.rst:4343 +#: ../../library/os.rst:4344 msgid "Exit code that means an input file did not exist or was not readable." msgstr "" -#: ../../library/os.rst:4350 +#: ../../library/os.rst:4351 msgid "Exit code that means a specified user did not exist." msgstr "" -#: ../../library/os.rst:4357 +#: ../../library/os.rst:4358 msgid "Exit code that means a specified host did not exist." msgstr "" -#: ../../library/os.rst:4364 +#: ../../library/os.rst:4365 msgid "Exit code that means that a required service is unavailable." msgstr "" -#: ../../library/os.rst:4371 +#: ../../library/os.rst:4372 msgid "Exit code that means an internal software error was detected." msgstr "" -#: ../../library/os.rst:4378 +#: ../../library/os.rst:4379 msgid "" "Exit code that means an operating system error was detected, such as the " "inability to fork or create a pipe." msgstr "" -#: ../../library/os.rst:4386 +#: ../../library/os.rst:4387 msgid "" "Exit code that means some system file did not exist, could not be opened, or " "had some other kind of error." msgstr "" -#: ../../library/os.rst:4394 +#: ../../library/os.rst:4395 msgid "Exit code that means a user specified output file could not be created." msgstr "" -#: ../../library/os.rst:4401 +#: ../../library/os.rst:4402 msgid "" "Exit code that means that an error occurred while doing I/O on some file." msgstr "" -#: ../../library/os.rst:4408 +#: ../../library/os.rst:4409 msgid "" "Exit code that means a temporary failure occurred. This indicates something " "that may not really be an error, such as a network connection that couldn't " "be made during a retryable operation." msgstr "" -#: ../../library/os.rst:4417 +#: ../../library/os.rst:4418 msgid "" "Exit code that means that a protocol exchange was illegal, invalid, or not " "understood." msgstr "" -#: ../../library/os.rst:4425 +#: ../../library/os.rst:4426 msgid "" "Exit code that means that there were insufficient permissions to perform the " "operation (but not intended for file system problems)." msgstr "" -#: ../../library/os.rst:4433 +#: ../../library/os.rst:4434 msgid "Exit code that means that some kind of configuration error occurred." msgstr "" -#: ../../library/os.rst:4440 +#: ../../library/os.rst:4441 msgid "Exit code that means something like \"an entry was not found\"." msgstr "" -#: ../../library/os.rst:4447 +#: ../../library/os.rst:4448 msgid "" "Fork a child process. Return ``0`` in the child and the child's process id " "in the parent. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4450 +#: ../../library/os.rst:4451 msgid "" "Note that some platforms including FreeBSD <= 6.3 and Cygwin have known " "issues when using ``fork()`` from a thread." msgstr "" -#: ../../library/os.rst:4453 +#: ../../library/os.rst:4454 msgid "" "Raises an :ref:`auditing event ` ``os.fork`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.fork``。" -#: ../../library/os.rst:4457 +#: ../../library/os.rst:4458 msgid "" "If you use TLS sockets in an application calling ``fork()``, see the warning " "in the :mod:`ssl` documentation." msgstr "" -#: ../../library/os.rst:4462 ../../library/os.rst:4506 +#: ../../library/os.rst:4463 ../../library/os.rst:4507 msgid "" "On macOS the use of this function is unsafe when mixed with using higher-" "level system APIs, and that includes using :mod:`urllib.request`." msgstr "" -#: ../../library/os.rst:4465 +#: ../../library/os.rst:4466 msgid "" "Calling ``fork()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4469 +#: ../../library/os.rst:4470 msgid "" "If Python is able to detect that your process has multiple threads, :func:" "`os.fork` now raises a :exc:`DeprecationWarning`." msgstr "" -#: ../../library/os.rst:4473 +#: ../../library/os.rst:4474 msgid "" "We chose to surface this as a warning, when detectable, to better inform " "developers of a design problem that the POSIX platform specifically notes as " @@ -5043,21 +5037,21 @@ msgid "" "``free``)." msgstr "" -#: ../../library/os.rst:4482 +#: ../../library/os.rst:4483 msgid "" "Users of macOS or users of libc or malloc implementations other than those " "typically found in glibc to date are among those already more likely to " "experience deadlocks running such code." msgstr "" -#: ../../library/os.rst:4486 +#: ../../library/os.rst:4487 msgid "" "See `this discussion on fork being incompatible with threads `_ for technical details of why we're surfacing " "this longstanding platform compatibility problem to developers." msgstr "" -#: ../../library/os.rst:4496 +#: ../../library/os.rst:4497 msgid "" "Fork a child process, using a new pseudo-terminal as the child's controlling " "terminal. Return a pair of ``(pid, fd)``, where *pid* is ``0`` in the child, " @@ -5066,31 +5060,31 @@ msgid "" "the :mod:`pty` module. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4502 +#: ../../library/os.rst:4503 msgid "" "Raises an :ref:`auditing event ` ``os.forkpty`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.forkpty``。" -#: ../../library/os.rst:4509 +#: ../../library/os.rst:4510 msgid "" "Calling ``forkpty()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4513 +#: ../../library/os.rst:4514 msgid "" "If Python is able to detect that your process has multiple threads, this now " "raises a :exc:`DeprecationWarning`. See the longer explanation on :func:`os." "fork`." msgstr "" -#: ../../library/os.rst:4527 +#: ../../library/os.rst:4528 msgid "" "Send signal *sig* to the process *pid*. Constants for the specific signals " "available on the host platform are defined in the :mod:`signal` module." msgstr "" -#: ../../library/os.rst:4530 +#: ../../library/os.rst:4531 msgid "" "Windows: The :const:`signal.CTRL_C_EVENT` and :const:`signal." "CTRL_BREAK_EVENT` signals are special signals which can only be sent to " @@ -5100,11 +5094,11 @@ msgid "" "be set to *sig*." msgstr "" -#: ../../library/os.rst:4537 +#: ../../library/os.rst:4538 msgid "See also :func:`signal.pthread_kill`." msgstr "另請參閱 :func:`signal.pthread_kill`。" -#: ../../library/os.rst:4539 +#: ../../library/os.rst:4540 msgid "" "Raises an :ref:`auditing event ` ``os.kill`` with arguments " "``pid``, ``sig``." @@ -5112,11 +5106,11 @@ msgstr "" "引發一個附帶引數 ``pid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." "kill``。" -#: ../../library/os.rst:4553 +#: ../../library/os.rst:4554 msgid "Send the signal *sig* to the process group *pgid*." msgstr "" -#: ../../library/os.rst:4555 +#: ../../library/os.rst:4556 msgid "" "Raises an :ref:`auditing event ` ``os.killpg`` with arguments " "``pgid``, ``sig``." @@ -5124,23 +5118,23 @@ msgstr "" "引發一個附帶引數 ``pgid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." "killpg``。" -#: ../../library/os.rst:4562 +#: ../../library/os.rst:4563 msgid "" "Add *increment* to the process's \"niceness\". Return the new niceness." msgstr "" -#: ../../library/os.rst:4569 +#: ../../library/os.rst:4570 msgid "" "Return a file descriptor referring to the process *pid* with *flags* set. " "This descriptor can be used to perform process management without races and " "signals." msgstr "" -#: ../../library/os.rst:4573 +#: ../../library/os.rst:4574 msgid "See the :manpage:`pidfd_open(2)` man page for more details." msgstr "更多細節請見 :manpage:`pidfd_open(2)` 手冊頁。" -#: ../../library/os.rst:4580 +#: ../../library/os.rst:4581 msgid "" "This flag indicates that the file descriptor will be non-blocking. If the " "process referred to by the file descriptor has not yet terminated, then an " @@ -5148,13 +5142,13 @@ msgid "" "immediately return the error :const:`~errno.EAGAIN` rather than blocking." msgstr "" -#: ../../library/os.rst:4591 +#: ../../library/os.rst:4592 msgid "" "Lock program segments into memory. The value of *op* (defined in ````) determines which segments are locked." msgstr "" -#: ../../library/os.rst:4599 +#: ../../library/os.rst:4600 msgid "" "Open a pipe to or from command *cmd*. The return value is an open file " "object connected to the pipe, which can be read or written depending on " @@ -5164,7 +5158,7 @@ msgid "" "rather than bytes." msgstr "" -#: ../../library/os.rst:4607 +#: ../../library/os.rst:4608 msgid "" "The ``close`` method returns :const:`None` if the subprocess exited " "successfully, or the subprocess's return code if there was an error. On " @@ -5176,57 +5170,57 @@ msgid "" "contains the signed integer return code from the child process." msgstr "" -#: ../../library/os.rst:4617 +#: ../../library/os.rst:4618 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the ``close`` " "method result (exit status) into an exit code if it is not ``None``. On " "Windows, the ``close`` method result is directly the exit code (or ``None``)." msgstr "" -#: ../../library/os.rst:4622 +#: ../../library/os.rst:4623 msgid "" "This is implemented using :class:`subprocess.Popen`; see that class's " "documentation for more powerful ways to manage and communicate with " "subprocesses." msgstr "" -#: ../../library/os.rst:4629 +#: ../../library/os.rst:4630 msgid "" "The :ref:`Python UTF-8 Mode ` affects encodings used for *cmd* " "and pipe contents." msgstr "" -#: ../../library/os.rst:4632 +#: ../../library/os.rst:4633 msgid "" ":func:`popen` is a simple wrapper around :class:`subprocess.Popen`. Use :" "class:`subprocess.Popen` or :func:`subprocess.run` to control options like " "encodings." msgstr "" -#: ../../library/os.rst:4641 +#: ../../library/os.rst:4642 msgid "Wraps the :c:func:`!posix_spawn` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4643 +#: ../../library/os.rst:4644 msgid "" "Most users should use :func:`subprocess.run` instead of :func:`posix_spawn`." msgstr "" -#: ../../library/os.rst:4645 +#: ../../library/os.rst:4646 msgid "" "The positional-only arguments *path*, *args*, and *env* are similar to :func:" "`execve`. *env* is allowed to be ``None``, in which case current process' " "environment is used." msgstr "" -#: ../../library/os.rst:4649 +#: ../../library/os.rst:4650 msgid "" "The *path* parameter is the path to the executable file. The *path* should " "contain a directory. Use :func:`posix_spawnp` to pass an executable file " "without directory." msgstr "" -#: ../../library/os.rst:4653 +#: ../../library/os.rst:4654 msgid "" "The *file_actions* argument may be a sequence of tuples describing actions " "to take on specific file descriptors in the child process between the C " @@ -5235,39 +5229,39 @@ msgid "" "describing the remaining tuple elements:" msgstr "" -#: ../../library/os.rst:4661 +#: ../../library/os.rst:4662 msgid "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" msgstr "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" -#: ../../library/os.rst:4663 +#: ../../library/os.rst:4664 msgid "Performs ``os.dup2(os.open(path, flags, mode), fd)``." msgstr "" -#: ../../library/os.rst:4667 +#: ../../library/os.rst:4668 msgid "(``os.POSIX_SPAWN_CLOSE``, *fd*)" msgstr "(``os.POSIX_SPAWN_CLOSE``, *fd*)" -#: ../../library/os.rst:4669 +#: ../../library/os.rst:4670 msgid "Performs ``os.close(fd)``." msgstr "" -#: ../../library/os.rst:4673 +#: ../../library/os.rst:4674 msgid "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" msgstr "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" -#: ../../library/os.rst:4675 +#: ../../library/os.rst:4676 msgid "Performs ``os.dup2(fd, new_fd)``." msgstr "" -#: ../../library/os.rst:4679 +#: ../../library/os.rst:4680 msgid "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" msgstr "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" -#: ../../library/os.rst:4681 +#: ../../library/os.rst:4682 msgid "Performs ``os.closerange(fd, INF)``." msgstr "" -#: ../../library/os.rst:4683 +#: ../../library/os.rst:4684 msgid "" "These tuples correspond to the C library :c:func:`!" "posix_spawn_file_actions_addopen`, :c:func:`!" @@ -5277,7 +5271,7 @@ msgid "" "c:func:`!posix_spawn` call itself." msgstr "" -#: ../../library/os.rst:4690 +#: ../../library/os.rst:4691 msgid "" "The *setpgroup* argument will set the process group of the child to the " "value specified. If the value specified is 0, the child's process group ID " @@ -5286,7 +5280,7 @@ msgid "" "corresponds to the C library :c:macro:`!POSIX_SPAWN_SETPGROUP` flag." msgstr "" -#: ../../library/os.rst:4696 +#: ../../library/os.rst:4697 msgid "" "If the *resetids* argument is ``True`` it will reset the effective UID and " "GID of the child to the real UID and GID of the parent process. If the " @@ -5297,7 +5291,7 @@ msgid "" "library :c:macro:`!POSIX_SPAWN_RESETIDS` flag." msgstr "" -#: ../../library/os.rst:4704 +#: ../../library/os.rst:4705 msgid "" "If the *setsid* argument is ``True``, it will create a new session ID for " "``posix_spawn``. *setsid* requires :c:macro:`!POSIX_SPAWN_SETSID` or :c:" @@ -5305,7 +5299,7 @@ msgid "" "is raised." msgstr "" -#: ../../library/os.rst:4709 +#: ../../library/os.rst:4710 msgid "" "The *setsigmask* argument will set the signal mask to the signal set " "specified. If the parameter is not used, then the child inherits the " @@ -5313,14 +5307,14 @@ msgid "" "POSIX_SPAWN_SETSIGMASK` flag." msgstr "" -#: ../../library/os.rst:4714 +#: ../../library/os.rst:4715 msgid "" "The *sigdef* argument will reset the disposition of all signals in the set " "specified. This argument corresponds to the C library :c:macro:`!" "POSIX_SPAWN_SETSIGDEF` flag." msgstr "" -#: ../../library/os.rst:4718 +#: ../../library/os.rst:4719 msgid "" "The *scheduler* argument must be a tuple containing the (optional) scheduler " "policy and an instance of :class:`sched_param` with the scheduler " @@ -5330,7 +5324,7 @@ msgid "" "POSIX_SPAWN_SETSCHEDULER` flags." msgstr "" -#: ../../library/os.rst:4725 ../../library/os.rst:4746 +#: ../../library/os.rst:4726 ../../library/os.rst:4747 msgid "" "Raises an :ref:`auditing event ` ``os.posix_spawn`` with arguments " "``path``, ``argv``, ``env``." @@ -5338,79 +5332,79 @@ msgstr "" "引發一個附帶引數 ``path``、``argv``、``env`` 的\\ :ref:`稽核事件 ` " "``os.posix_spawn``。" -#: ../../library/os.rst:4729 +#: ../../library/os.rst:4730 msgid "" "*env* parameter accepts ``None``. ``os.POSIX_SPAWN_CLOSEFROM`` is available " "on platforms where :c:func:`!posix_spawn_file_actions_addclosefrom_np` " "exists." msgstr "" -#: ../../library/os.rst:4740 +#: ../../library/os.rst:4741 msgid "Wraps the :c:func:`!posix_spawnp` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4742 +#: ../../library/os.rst:4743 msgid "" "Similar to :func:`posix_spawn` except that the system searches for the " "*executable* file in the list of directories specified by the :envvar:`PATH` " "environment variable (in the same way as for ``execvp(3)``)." msgstr "" -#: ../../library/os.rst:4752 +#: ../../library/os.rst:4753 msgid "See :func:`posix_spawn` documentation." msgstr "見 :func:`posix_spawn` 文件。" -#: ../../library/os.rst:4758 +#: ../../library/os.rst:4759 msgid "" "Register callables to be executed when a new child process is forked using :" "func:`os.fork` or similar process cloning APIs. The parameters are optional " "and keyword-only. Each specifies a different call point." msgstr "" -#: ../../library/os.rst:4763 +#: ../../library/os.rst:4764 msgid "*before* is a function called before forking a child process." msgstr "" -#: ../../library/os.rst:4764 +#: ../../library/os.rst:4765 msgid "" "*after_in_parent* is a function called from the parent process after forking " "a child process." msgstr "" -#: ../../library/os.rst:4766 +#: ../../library/os.rst:4767 msgid "*after_in_child* is a function called from the child process." msgstr "" -#: ../../library/os.rst:4768 +#: ../../library/os.rst:4769 msgid "" "These calls are only made if control is expected to return to the Python " "interpreter. A typical :mod:`subprocess` launch will not trigger them as " "the child is not going to re-enter the interpreter." msgstr "" -#: ../../library/os.rst:4772 +#: ../../library/os.rst:4773 msgid "" "Functions registered for execution before forking are called in reverse " "registration order. Functions registered for execution after forking " "(either in the parent or in the child) are called in registration order." msgstr "" -#: ../../library/os.rst:4777 +#: ../../library/os.rst:4778 msgid "" "Note that :c:func:`fork` calls made by third-party C code may not call those " "functions, unless it explicitly calls :c:func:`PyOS_BeforeFork`, :c:func:" "`PyOS_AfterFork_Parent` and :c:func:`PyOS_AfterFork_Child`." msgstr "" -#: ../../library/os.rst:4781 +#: ../../library/os.rst:4782 msgid "There is no way to unregister a function." msgstr "" -#: ../../library/os.rst:4797 +#: ../../library/os.rst:4798 msgid "Execute the program *path* in a new process." msgstr "" -#: ../../library/os.rst:4799 +#: ../../library/os.rst:4800 msgid "" "(Note that the :mod:`subprocess` module provides more powerful facilities " "for spawning new processes and retrieving their results; using that module " @@ -5418,7 +5412,7 @@ msgid "" "`subprocess-replacements` section.)" msgstr "" -#: ../../library/os.rst:4804 +#: ../../library/os.rst:4805 msgid "" "If *mode* is :const:`P_NOWAIT`, this function returns the process id of the " "new process; if *mode* is :const:`P_WAIT`, returns the process's exit code " @@ -5427,13 +5421,13 @@ msgid "" "handle, so can be used with the :func:`waitpid` function." msgstr "" -#: ../../library/os.rst:4810 +#: ../../library/os.rst:4811 msgid "" "Note on VxWorks, this function doesn't return ``-signal`` when the new " "process is killed. Instead it raises OSError exception." msgstr "" -#: ../../library/os.rst:4813 +#: ../../library/os.rst:4814 msgid "" "The \"l\" and \"v\" variants of the :func:`spawn\\* ` functions " "differ in how command-line arguments are passed. The \"l\" variants are " @@ -5445,7 +5439,7 @@ msgid "" "to the child process must start with the name of the command being run." msgstr "" -#: ../../library/os.rst:4822 +#: ../../library/os.rst:4823 msgid "" "The variants which include a second \"p\" near the end (:func:`spawnlp`, :" "func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) will use the :envvar:" @@ -5458,7 +5452,7 @@ msgid "" "appropriate absolute or relative path." msgstr "" -#: ../../library/os.rst:4832 +#: ../../library/os.rst:4833 msgid "" "For :func:`spawnle`, :func:`spawnlpe`, :func:`spawnve`, and :func:`spawnvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -5470,13 +5464,13 @@ msgid "" "values will cause the function to fail, with a return value of ``127``." msgstr "" -#: ../../library/os.rst:4841 +#: ../../library/os.rst:4842 msgid "" "As an example, the following calls to :func:`spawnlp` and :func:`spawnvpe` " "are equivalent::" msgstr "" -#: ../../library/os.rst:4844 +#: ../../library/os.rst:4845 msgid "" "import os\n" "os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')\n" @@ -5490,7 +5484,7 @@ msgstr "" "L = ['cp', 'index.html', '/dev/null']\n" "os.spawnvpe(os.P_WAIT, 'cp', L, os.environ)" -#: ../../library/os.rst:4850 +#: ../../library/os.rst:4851 msgid "" "Raises an :ref:`auditing event ` ``os.spawn`` with arguments " "``mode``, ``path``, ``args``, ``env``." @@ -5498,7 +5492,7 @@ msgstr "" "引發一個附帶引數 ``mode``、``path``、``args``、``env`` 的\\ :ref:`稽核事件 " "` ``os.spawn``。" -#: ../../library/os.rst:4854 +#: ../../library/os.rst:4855 msgid "" ":func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp` and :func:`spawnvpe` are " "not available on Windows. :func:`spawnle` and :func:`spawnve` are not " @@ -5506,7 +5500,7 @@ msgid "" "instead." msgstr "" -#: ../../library/os.rst:4866 +#: ../../library/os.rst:4867 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If either of these values is given, the :func:" @@ -5514,7 +5508,7 @@ msgid "" "been created, with the process id as the return value." msgstr "" -#: ../../library/os.rst:4876 +#: ../../library/os.rst:4877 msgid "" "Possible value for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If this is given as *mode*, the :func:`spawn\\* " @@ -5523,7 +5517,7 @@ msgid "" "successful, or ``-signal`` if a signal kills the process." msgstr "" -#: ../../library/os.rst:4888 +#: ../../library/os.rst:4889 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. These are less portable than those listed above. :" @@ -5533,11 +5527,11 @@ msgid "" "function will not return." msgstr "" -#: ../../library/os.rst:4899 +#: ../../library/os.rst:4900 msgid "Start a file with its associated application." msgstr "" -#: ../../library/os.rst:4901 +#: ../../library/os.rst:4902 msgid "" "When *operation* is not specified, this acts like double-clicking the file " "in Windows Explorer, or giving the file name as an argument to the :program:" @@ -5545,7 +5539,7 @@ msgid "" "whatever application (if any) its extension is associated." msgstr "" -#: ../../library/os.rst:4906 +#: ../../library/os.rst:4907 msgid "" "When another *operation* is given, it must be a \"command verb\" that " "specifies what should be done with the file. Common verbs documented by " @@ -5553,28 +5547,28 @@ msgid "" "as well as ``'explore'`` and ``'find'`` (to be used on directories)." msgstr "" -#: ../../library/os.rst:4911 +#: ../../library/os.rst:4912 msgid "" "When launching an application, specify *arguments* to be passed as a single " "string. This argument may have no effect when using this function to launch " "a document." msgstr "" -#: ../../library/os.rst:4915 +#: ../../library/os.rst:4916 msgid "" "The default working directory is inherited, but may be overridden by the " "*cwd* argument. This should be an absolute path. A relative *path* will be " "resolved against this argument." msgstr "" -#: ../../library/os.rst:4919 +#: ../../library/os.rst:4920 msgid "" "Use *show_cmd* to override the default window style. Whether this has any " "effect will depend on the application being launched. Values are integers as " "supported by the Win32 :c:func:`!ShellExecute` function." msgstr "" -#: ../../library/os.rst:4923 +#: ../../library/os.rst:4924 msgid "" ":func:`startfile` returns as soon as the associated application is launched. " "There is no option to wait for the application to close, and no way to " @@ -5585,14 +5579,14 @@ msgid "" "encoded for Win32." msgstr "" -#: ../../library/os.rst:4931 +#: ../../library/os.rst:4932 msgid "" "To reduce interpreter startup overhead, the Win32 :c:func:`!ShellExecute` " "function is not resolved until this function is first called. If the " "function cannot be resolved, :exc:`NotImplementedError` will be raised." msgstr "" -#: ../../library/os.rst:4935 +#: ../../library/os.rst:4936 msgid "" "Raises an :ref:`auditing event ` ``os.startfile`` with arguments " "``path``, ``operation``." @@ -5600,7 +5594,7 @@ msgstr "" "引發一個附帶引數 ``path``、``operation`` 的\\ :ref:`稽核事件 ` " "``os.startfile``。" -#: ../../library/os.rst:4937 +#: ../../library/os.rst:4938 msgid "" "Raises an :ref:`auditing event ` ``os.startfile/2`` with arguments " "``path``, ``operation``, ``arguments``, ``cwd``, ``show_cmd``." @@ -5608,13 +5602,13 @@ msgstr "" "引發一個附帶引數 ``path``、``operation``、``arguments``、``cwd``、" "``show_cmd`` 的\\ :ref:`稽核事件 ` ``os.startfile/2``。" -#: ../../library/os.rst:4941 +#: ../../library/os.rst:4942 msgid "" "Added the *arguments*, *cwd* and *show_cmd* arguments, and the ``os." "startfile/2`` audit event." msgstr "" -#: ../../library/os.rst:4948 +#: ../../library/os.rst:4949 msgid "" "Execute the command (a string) in a subshell. This is implemented by " "calling the Standard C function :c:func:`system`, and has the same " @@ -5625,13 +5619,13 @@ msgid "" "value of the Python function is system-dependent." msgstr "" -#: ../../library/os.rst:4956 +#: ../../library/os.rst:4957 msgid "" "On Unix, the return value is the exit status of the process encoded in the " "format specified for :func:`wait`." msgstr "" -#: ../../library/os.rst:4959 +#: ../../library/os.rst:4960 msgid "" "On Windows, the return value is that returned by the system shell after " "running *command*. The shell is given by the Windows environment variable :" @@ -5640,7 +5634,7 @@ msgid "" "shell documentation." msgstr "" -#: ../../library/os.rst:4965 +#: ../../library/os.rst:4966 msgid "" "The :mod:`subprocess` module provides more powerful facilities for spawning " "new processes and retrieving their results; using that module is preferable " @@ -5648,54 +5642,54 @@ msgid "" "the :mod:`subprocess` documentation for some helpful recipes." msgstr "" -#: ../../library/os.rst:4970 +#: ../../library/os.rst:4971 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the result " "(exit status) into an exit code. On Windows, the result is directly the exit " "code." msgstr "" -#: ../../library/os.rst:4974 +#: ../../library/os.rst:4975 msgid "" "Raises an :ref:`auditing event ` ``os.system`` with argument " "``command``." msgstr "" "引發一個附帶引數 ``command`` 的\\ :ref:`稽核事件 ` ``os.system``。" -#: ../../library/os.rst:4981 +#: ../../library/os.rst:4982 msgid "" "Returns the current global process times. The return value is an object with " "five attributes:" msgstr "" -#: ../../library/os.rst:4984 +#: ../../library/os.rst:4985 msgid ":attr:`!user` - user time" msgstr ":attr:`!user` - 使用者時間" -#: ../../library/os.rst:4985 +#: ../../library/os.rst:4986 msgid ":attr:`!system` - system time" msgstr ":attr:`!system` - 系統時間" -#: ../../library/os.rst:4986 +#: ../../library/os.rst:4987 msgid ":attr:`!children_user` - user time of all child processes" msgstr ":attr:`!children_user` - 所有子行程的使用者時間" -#: ../../library/os.rst:4987 +#: ../../library/os.rst:4988 msgid ":attr:`!children_system` - system time of all child processes" msgstr ":attr:`!children_system` - 所有子行程的系統時間" -#: ../../library/os.rst:4988 +#: ../../library/os.rst:4989 msgid ":attr:`!elapsed` - elapsed real time since a fixed point in the past" msgstr "" -#: ../../library/os.rst:4990 +#: ../../library/os.rst:4991 msgid "" "For backwards compatibility, this object also behaves like a five-tuple " "containing :attr:`!user`, :attr:`!system`, :attr:`!children_user`, :attr:`!" "children_system`, and :attr:`!elapsed` in that order." msgstr "" -#: ../../library/os.rst:4994 +#: ../../library/os.rst:4995 msgid "" "See the Unix manual page :manpage:`times(2)` and `times(3) `_ manual page on Unix or `the " @@ -5705,7 +5699,7 @@ msgid "" "attributes are zero." msgstr "" -#: ../../library/os.rst:5008 +#: ../../library/os.rst:5009 msgid "" "Wait for completion of a child process, and return a tuple containing its " "pid and exit status indication: a 16-bit number, whose low byte is the " @@ -5714,87 +5708,87 @@ msgid "" "if a core file was produced." msgstr "" -#: ../../library/os.rst:5014 +#: ../../library/os.rst:5015 msgid "" "If there are no children that could be waited for, :exc:`ChildProcessError` " "is raised." msgstr "" -#: ../../library/os.rst:5017 ../../library/os.rst:5092 +#: ../../library/os.rst:5018 ../../library/os.rst:5093 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exit code." msgstr "" -#: ../../library/os.rst:5024 +#: ../../library/os.rst:5025 msgid "" "The other :func:`!wait*` functions documented below can be used to wait for " "the completion of a specific child process and have more options. :func:" "`waitpid` is the only one also available on Windows." msgstr "" -#: ../../library/os.rst:5031 +#: ../../library/os.rst:5032 msgid "Wait for the completion of a child process." msgstr "" -#: ../../library/os.rst:5033 +#: ../../library/os.rst:5034 msgid "" "*idtype* can be :data:`P_PID`, :data:`P_PGID`, :data:`P_ALL`, or (on Linux) :" "data:`P_PIDFD`. The interpretation of *id* depends on it; see their " "individual descriptions." msgstr "" -#: ../../library/os.rst:5036 +#: ../../library/os.rst:5037 msgid "" "*options* is an OR combination of flags. At least one of :data:`WEXITED`, :" "data:`WSTOPPED` or :data:`WCONTINUED` is required; :data:`WNOHANG` and :data:" "`WNOWAIT` are additional optional flags." msgstr "" -#: ../../library/os.rst:5040 +#: ../../library/os.rst:5041 msgid "" "The return value is an object representing the data contained in the :c:type:" "`siginfo_t` structure with the following attributes:" msgstr "" -#: ../../library/os.rst:5043 +#: ../../library/os.rst:5044 msgid ":attr:`!si_pid` (process ID)" msgstr "" -#: ../../library/os.rst:5044 +#: ../../library/os.rst:5045 msgid ":attr:`!si_uid` (real user ID of the child)" msgstr "" -#: ../../library/os.rst:5045 +#: ../../library/os.rst:5046 msgid ":attr:`!si_signo` (always :const:`~signal.SIGCHLD`)" msgstr "" -#: ../../library/os.rst:5046 +#: ../../library/os.rst:5047 msgid "" ":attr:`!si_status` (the exit status or signal number, depending on :attr:`!" "si_code`)" msgstr "" -#: ../../library/os.rst:5047 +#: ../../library/os.rst:5048 msgid ":attr:`!si_code` (see :data:`CLD_EXITED` for possible values)" msgstr "" -#: ../../library/os.rst:5049 +#: ../../library/os.rst:5050 msgid "" "If :data:`WNOHANG` is specified and there are no matching children in the " "requested state, ``None`` is returned. Otherwise, if there are no matching " "children that could be waited for, :exc:`ChildProcessError` is raised." msgstr "" -#: ../../library/os.rst:5058 +#: ../../library/os.rst:5059 msgid "This function is now available on macOS as well." msgstr "" -#: ../../library/os.rst:5064 +#: ../../library/os.rst:5065 msgid "The details of this function differ on Unix and Windows." msgstr "" -#: ../../library/os.rst:5066 +#: ../../library/os.rst:5067 msgid "" "On Unix: Wait for completion of a child process given by process id *pid*, " "and return a tuple containing its process id and exit status indication " @@ -5803,7 +5797,7 @@ msgid "" "operation." msgstr "" -#: ../../library/os.rst:5071 +#: ../../library/os.rst:5072 msgid "" "If *pid* is greater than ``0``, :func:`waitpid` requests status information " "for that specific process. If *pid* is ``0``, the request is for the status " @@ -5813,7 +5807,7 @@ msgid "" "group ``-pid`` (the absolute value of *pid*)." msgstr "" -#: ../../library/os.rst:5078 +#: ../../library/os.rst:5079 msgid "" "*options* is an OR combination of flags. If it contains :data:`WNOHANG` and " "there are no matching children in the requested state, ``(0, 0)`` is " @@ -5822,7 +5816,7 @@ msgid "" "are :data:`WUNTRACED` and :data:`WCONTINUED`." msgstr "" -#: ../../library/os.rst:5084 +#: ../../library/os.rst:5085 msgid "" "On Windows: Wait for completion of a process given by process handle *pid*, " "and return a tuple containing *pid*, and its exit status shifted left by 8 " @@ -5834,7 +5828,7 @@ msgid "" "process handles." msgstr "" -#: ../../library/os.rst:5105 +#: ../../library/os.rst:5106 msgid "" "Similar to :func:`waitpid`, except no process id argument is given and a 3-" "element tuple containing the child's process id, exit status indication, and " @@ -5843,13 +5837,13 @@ msgid "" "same as that provided to :func:`waitpid` and :func:`wait4`." msgstr "" -#: ../../library/os.rst:5112 ../../library/os.rst:5126 +#: ../../library/os.rst:5113 ../../library/os.rst:5127 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exitcode." msgstr "" -#: ../../library/os.rst:5120 +#: ../../library/os.rst:5121 msgid "" "Similar to :func:`waitpid`, except a 3-element tuple, containing the child's " "process id, exit status indication, and resource usage information is " @@ -5858,118 +5852,118 @@ msgid "" "to :func:`waitpid`." msgstr "" -#: ../../library/os.rst:5137 +#: ../../library/os.rst:5138 msgid "" "These are the possible values for *idtype* in :func:`waitid`. They affect " "how *id* is interpreted:" msgstr "" -#: ../../library/os.rst:5140 +#: ../../library/os.rst:5141 msgid ":data:`!P_PID` - wait for the child whose PID is *id*." msgstr "" -#: ../../library/os.rst:5141 +#: ../../library/os.rst:5142 msgid ":data:`!P_PGID` - wait for any child whose progress group ID is *id*." msgstr "" -#: ../../library/os.rst:5142 +#: ../../library/os.rst:5143 msgid ":data:`!P_ALL` - wait for any child; *id* is ignored." msgstr "" -#: ../../library/os.rst:5143 +#: ../../library/os.rst:5144 msgid "" ":data:`!P_PIDFD` - wait for the child identified by the file descriptor *id* " "(a process file descriptor created with :func:`pidfd_open`)." msgstr "" -#: ../../library/os.rst:5148 +#: ../../library/os.rst:5149 msgid ":data:`!P_PIDFD` is only available on Linux >= 5.4." msgstr "" -#: ../../library/os.rst:5151 +#: ../../library/os.rst:5152 msgid "The :data:`!P_PIDFD` constant." msgstr "" -#: ../../library/os.rst:5157 +#: ../../library/os.rst:5158 msgid "" "This *options* flag for :func:`waitpid`, :func:`wait3`, :func:`wait4`, and :" "func:`waitid` causes child processes to be reported if they have been " "continued from a job control stop since they were last reported." msgstr "" -#: ../../library/os.rst:5166 +#: ../../library/os.rst:5167 msgid "" "This *options* flag for :func:`waitid` causes child processes that have " "terminated to be reported." msgstr "" -#: ../../library/os.rst:5169 +#: ../../library/os.rst:5170 msgid "" "The other ``wait*`` functions always report children that have terminated, " "so this option is not available for them." msgstr "" -#: ../../library/os.rst:5179 +#: ../../library/os.rst:5180 msgid "" "This *options* flag for :func:`waitid` causes child processes that have been " "stopped by the delivery of a signal to be reported." msgstr "" -#: ../../library/os.rst:5182 ../../library/os.rst:5214 +#: ../../library/os.rst:5183 ../../library/os.rst:5215 msgid "This option is not available for the other ``wait*`` functions." msgstr "" -#: ../../library/os.rst:5191 +#: ../../library/os.rst:5192 msgid "" "This *options* flag for :func:`waitpid`, :func:`wait3`, and :func:`wait4` " "causes child processes to also be reported if they have been stopped but " "their current state has not been reported since they were stopped." msgstr "" -#: ../../library/os.rst:5195 +#: ../../library/os.rst:5196 msgid "This option is not available for :func:`waitid`." msgstr "" -#: ../../library/os.rst:5202 +#: ../../library/os.rst:5203 msgid "" "This *options* flag causes :func:`waitpid`, :func:`wait3`, :func:`wait4`, " "and :func:`waitid` to return right away if no child process status is " "available immediately." msgstr "" -#: ../../library/os.rst:5211 +#: ../../library/os.rst:5212 msgid "" "This *options* flag causes :func:`waitid` to leave the child in a waitable " "state, so that a later :func:`!wait*` call can be used to retrieve the child " "status information again." msgstr "" -#: ../../library/os.rst:5226 +#: ../../library/os.rst:5227 msgid "" "These are the possible values for :attr:`!si_code` in the result returned " "by :func:`waitid`." msgstr "" -#: ../../library/os.rst:5233 +#: ../../library/os.rst:5234 msgid "Added :data:`CLD_KILLED` and :data:`CLD_STOPPED` values." msgstr "" -#: ../../library/os.rst:5239 +#: ../../library/os.rst:5240 msgid "Convert a wait status to an exit code." msgstr "" -#: ../../library/os.rst:5241 +#: ../../library/os.rst:5242 msgid "On Unix:" msgstr "" -#: ../../library/os.rst:5243 +#: ../../library/os.rst:5244 msgid "" "If the process exited normally (if ``WIFEXITED(status)`` is true), return " "the process exit status (return ``WEXITSTATUS(status)``): result greater " "than or equal to 0." msgstr "" -#: ../../library/os.rst:5246 +#: ../../library/os.rst:5247 msgid "" "If the process was terminated by a signal (if ``WIFSIGNALED(status)`` is " "true), return ``-signum`` where *signum* is the number of the signal that " @@ -5977,15 +5971,15 @@ msgid "" "than 0." msgstr "" -#: ../../library/os.rst:5250 +#: ../../library/os.rst:5251 msgid "Otherwise, raise a :exc:`ValueError`." msgstr "" -#: ../../library/os.rst:5252 +#: ../../library/os.rst:5253 msgid "On Windows, return *status* shifted right by 8 bits." msgstr "" -#: ../../library/os.rst:5254 +#: ../../library/os.rst:5255 msgid "" "On Unix, if the process is being traced or if :func:`waitpid` was called " "with :data:`WUNTRACED` option, the caller must first check if " @@ -5993,226 +5987,226 @@ msgid "" "``WIFSTOPPED(status)`` is true." msgstr "" -#: ../../library/os.rst:5261 +#: ../../library/os.rst:5262 msgid "" ":func:`WIFEXITED`, :func:`WEXITSTATUS`, :func:`WIFSIGNALED`, :func:" "`WTERMSIG`, :func:`WIFSTOPPED`, :func:`WSTOPSIG` functions." msgstr "" -#: ../../library/os.rst:5269 +#: ../../library/os.rst:5270 msgid "" "The following functions take a process status code as returned by :func:" "`system`, :func:`wait`, or :func:`waitpid` as a parameter. They may be used " "to determine the disposition of a process." msgstr "" -#: ../../library/os.rst:5275 +#: ../../library/os.rst:5276 msgid "" "Return ``True`` if a core dump was generated for the process, otherwise " "return ``False``." msgstr "" -#: ../../library/os.rst:5278 ../../library/os.rst:5344 +#: ../../library/os.rst:5279 ../../library/os.rst:5345 msgid "This function should be employed only if :func:`WIFSIGNALED` is true." msgstr "" -#: ../../library/os.rst:5285 +#: ../../library/os.rst:5286 msgid "" "Return ``True`` if a stopped child has been resumed by delivery of :const:" "`~signal.SIGCONT` (if the process has been continued from a job control " "stop), otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5289 +#: ../../library/os.rst:5290 msgid "See :data:`WCONTINUED` option." msgstr "參閱 :data:`WCONTINUED` 選項。" -#: ../../library/os.rst:5296 +#: ../../library/os.rst:5297 msgid "" "Return ``True`` if the process was stopped by delivery of a signal, " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5299 +#: ../../library/os.rst:5300 msgid "" ":func:`WIFSTOPPED` only returns ``True`` if the :func:`waitpid` call was " "done using :data:`WUNTRACED` option or when the process is being traced " "(see :manpage:`ptrace(2)`)." msgstr "" -#: ../../library/os.rst:5307 +#: ../../library/os.rst:5308 msgid "" "Return ``True`` if the process was terminated by a signal, otherwise return " "``False``." msgstr "" -#: ../../library/os.rst:5315 +#: ../../library/os.rst:5316 msgid "" "Return ``True`` if the process exited terminated normally, that is, by " "calling ``exit()`` or ``_exit()``, or by returning from ``main()``; " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5324 +#: ../../library/os.rst:5325 msgid "Return the process exit status." msgstr "" -#: ../../library/os.rst:5326 +#: ../../library/os.rst:5327 msgid "This function should be employed only if :func:`WIFEXITED` is true." msgstr "" -#: ../../library/os.rst:5333 +#: ../../library/os.rst:5334 msgid "Return the signal which caused the process to stop." msgstr "" -#: ../../library/os.rst:5335 +#: ../../library/os.rst:5336 msgid "This function should be employed only if :func:`WIFSTOPPED` is true." msgstr "" -#: ../../library/os.rst:5342 +#: ../../library/os.rst:5343 msgid "Return the number of the signal that caused the process to terminate." msgstr "" -#: ../../library/os.rst:5350 +#: ../../library/os.rst:5351 msgid "Interface to the scheduler" msgstr "" -#: ../../library/os.rst:5352 +#: ../../library/os.rst:5353 msgid "" "These functions control how a process is allocated CPU time by the operating " "system. They are only available on some Unix platforms. For more detailed " "information, consult your Unix manpages." msgstr "" -#: ../../library/os.rst:5358 +#: ../../library/os.rst:5359 msgid "" "The following scheduling policies are exposed if they are supported by the " "operating system." msgstr "" -#: ../../library/os.rst:5365 +#: ../../library/os.rst:5366 msgid "The default scheduling policy." msgstr "" -#: ../../library/os.rst:5369 +#: ../../library/os.rst:5370 msgid "" "Scheduling policy for CPU-intensive processes that tries to preserve " "interactivity on the rest of the computer." msgstr "" -#: ../../library/os.rst:5374 +#: ../../library/os.rst:5375 msgid "Scheduling policy for extremely low priority background tasks." msgstr "" -#: ../../library/os.rst:5378 +#: ../../library/os.rst:5379 msgid "Scheduling policy for sporadic server programs." msgstr "" -#: ../../library/os.rst:5382 +#: ../../library/os.rst:5383 msgid "A First In First Out scheduling policy." msgstr "" -#: ../../library/os.rst:5386 +#: ../../library/os.rst:5387 msgid "A round-robin scheduling policy." msgstr "" -#: ../../library/os.rst:5390 +#: ../../library/os.rst:5391 msgid "" "This flag can be OR'ed with any other scheduling policy. When a process with " "this flag set forks, its child's scheduling policy and priority are reset to " "the default." msgstr "" -#: ../../library/os.rst:5397 +#: ../../library/os.rst:5398 msgid "" "This class represents tunable scheduling parameters used in :func:" "`sched_setparam`, :func:`sched_setscheduler`, and :func:`sched_getparam`. It " "is immutable." msgstr "" -#: ../../library/os.rst:5401 +#: ../../library/os.rst:5402 msgid "At the moment, there is only one possible parameter:" msgstr "" -#: ../../library/os.rst:5405 +#: ../../library/os.rst:5406 msgid "The scheduling priority for a scheduling policy." msgstr "" -#: ../../library/os.rst:5410 +#: ../../library/os.rst:5411 msgid "" "Get the minimum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5416 +#: ../../library/os.rst:5417 msgid "" "Get the maximum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5422 +#: ../../library/os.rst:5423 msgid "" "Set the scheduling policy for the process with PID *pid*. A *pid* of 0 means " "the calling process. *policy* is one of the scheduling policy constants " "above. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:5429 +#: ../../library/os.rst:5430 msgid "" "Return the scheduling policy for the process with PID *pid*. A *pid* of 0 " "means the calling process. The result is one of the scheduling policy " "constants above." msgstr "" -#: ../../library/os.rst:5436 +#: ../../library/os.rst:5437 msgid "" "Set the scheduling parameters for the process with PID *pid*. A *pid* of 0 " "means the calling process. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:5442 +#: ../../library/os.rst:5443 msgid "" "Return the scheduling parameters as a :class:`sched_param` instance for the " "process with PID *pid*. A *pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:5448 +#: ../../library/os.rst:5449 msgid "" "Return the round-robin quantum in seconds for the process with PID *pid*. A " "*pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:5454 +#: ../../library/os.rst:5455 msgid "" "Voluntarily relinquish the CPU. See :manpage:`sched_yield(2)` for details." msgstr "" -#: ../../library/os.rst:5459 +#: ../../library/os.rst:5460 msgid "" "Restrict the process with PID *pid* (or the current process if zero) to a " "set of CPUs. *mask* is an iterable of integers representing the set of CPUs " "to which the process should be restricted." msgstr "" -#: ../../library/os.rst:5466 +#: ../../library/os.rst:5467 msgid "Return the set of CPUs the process with PID *pid* is restricted to." msgstr "" -#: ../../library/os.rst:5468 +#: ../../library/os.rst:5469 msgid "" "If *pid* is zero, return the set of CPUs the calling thread of the current " "process is restricted to." msgstr "" -#: ../../library/os.rst:5471 +#: ../../library/os.rst:5472 msgid "See also the :func:`process_cpu_count` function." msgstr "也請見 :func:`process_cpu_count` 函式。" -#: ../../library/os.rst:5477 +#: ../../library/os.rst:5478 msgid "Miscellaneous System Information" msgstr "" -#: ../../library/os.rst:5482 +#: ../../library/os.rst:5483 msgid "" "Return string-valued system configuration values. *name* specifies the " "configuration value to retrieve; it may be a string which is the name of a " @@ -6223,13 +6217,13 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:5490 +#: ../../library/os.rst:5491 msgid "" "If the configuration value specified by *name* isn't defined, ``None`` is " "returned." msgstr "" -#: ../../library/os.rst:5493 +#: ../../library/os.rst:5494 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " @@ -6237,62 +6231,62 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:5503 +#: ../../library/os.rst:5504 msgid "" "Dictionary mapping names accepted by :func:`confstr` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:5512 +#: ../../library/os.rst:5513 msgid "" "Return the number of logical CPUs in the **system**. Returns ``None`` if " "undetermined." msgstr "" -#: ../../library/os.rst:5515 +#: ../../library/os.rst:5516 msgid "" "The :func:`process_cpu_count` function can be used to get the number of " "logical CPUs usable by the calling thread of the **current process**." msgstr "" -#: ../../library/os.rst:5520 +#: ../../library/os.rst:5521 msgid "" "If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " "set, :func:`cpu_count` returns the overridden value *n*." msgstr "" -#: ../../library/os.rst:5527 +#: ../../library/os.rst:5528 msgid "" "Return the number of processes in the system run queue averaged over the " "last 1, 5, and 15 minutes or raises :exc:`OSError` if the load average was " "unobtainable." msgstr "" -#: ../../library/os.rst:5536 +#: ../../library/os.rst:5537 msgid "" "Get the number of logical CPUs usable by the calling thread of the **current " "process**. Returns ``None`` if undetermined. It can be less than :func:" "`cpu_count` depending on the CPU affinity." msgstr "" -#: ../../library/os.rst:5540 +#: ../../library/os.rst:5541 msgid "" "The :func:`cpu_count` function can be used to get the number of logical CPUs " "in the **system**." msgstr "" -#: ../../library/os.rst:5543 +#: ../../library/os.rst:5544 msgid "" "If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " "set, :func:`process_cpu_count` returns the overridden value *n*." msgstr "" -#: ../../library/os.rst:5546 +#: ../../library/os.rst:5547 msgid "See also the :func:`sched_getaffinity` function." msgstr "也請見 :func:`sched_getaffinity` 函式。" -#: ../../library/os.rst:5553 +#: ../../library/os.rst:5554 msgid "" "Return integer-valued system configuration values. If the configuration " "value specified by *name* isn't defined, ``-1`` is returned. The comments " @@ -6301,44 +6295,44 @@ msgid "" "``sysconf_names``." msgstr "" -#: ../../library/os.rst:5563 +#: ../../library/os.rst:5564 msgid "" "Dictionary mapping names accepted by :func:`sysconf` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:5569 +#: ../../library/os.rst:5570 msgid "Add ``'SC_MINSIGSTKSZ'`` name." msgstr "" -#: ../../library/os.rst:5572 +#: ../../library/os.rst:5573 msgid "" "The following data values are used to support path manipulation operations. " "These are defined for all platforms." msgstr "" -#: ../../library/os.rst:5575 +#: ../../library/os.rst:5576 msgid "" "Higher-level operations on pathnames are defined in the :mod:`os.path` " "module." msgstr "" -#: ../../library/os.rst:5581 +#: ../../library/os.rst:5582 msgid "" "The constant string used by the operating system to refer to the current " "directory. This is ``'.'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: ../../library/os.rst:5589 +#: ../../library/os.rst:5590 msgid "" "The constant string used by the operating system to refer to the parent " "directory. This is ``'..'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: ../../library/os.rst:5598 +#: ../../library/os.rst:5599 msgid "" "The character used by the operating system to separate pathname components. " "This is ``'/'`` for POSIX and ``'\\\\'`` for Windows. Note that knowing " @@ -6347,7 +6341,7 @@ msgid "" "useful. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5608 +#: ../../library/os.rst:5609 msgid "" "An alternative character used by the operating system to separate pathname " "components, or ``None`` if only one separator character exists. This is set " @@ -6355,27 +6349,27 @@ msgid "" "via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5617 +#: ../../library/os.rst:5618 msgid "" "The character which separates the base filename from the extension; for " "example, the ``'.'`` in :file:`os.py`. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5625 +#: ../../library/os.rst:5626 msgid "" "The character conventionally used by the operating system to separate search " "path components (as in :envvar:`PATH`), such as ``':'`` for POSIX or ``';'`` " "for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5632 +#: ../../library/os.rst:5633 msgid "" "The default search path used by :func:`exec\\*p\\* ` and :func:" "`spawn\\*p\\* ` if the environment doesn't have a ``'PATH'`` key. " "Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5639 +#: ../../library/os.rst:5640 msgid "" "The string used to separate (or, rather, terminate) lines on the current " "platform. This may be a single character, such as ``'\\n'`` for POSIX, or " @@ -6384,36 +6378,36 @@ msgid "" "default); use a single ``'\\n'`` instead, on all platforms." msgstr "" -#: ../../library/os.rst:5648 +#: ../../library/os.rst:5649 msgid "" "The file path of the null device. For example: ``'/dev/null'`` for POSIX, " "``'nul'`` for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5659 +#: ../../library/os.rst:5660 msgid "" "Flags for use with the :func:`~sys.setdlopenflags` and :func:`~sys." "getdlopenflags` functions. See the Unix manual page :manpage:`dlopen(3)` " "for what the different flags mean." msgstr "" -#: ../../library/os.rst:5667 +#: ../../library/os.rst:5668 msgid "Random numbers" msgstr "" -#: ../../library/os.rst:5672 +#: ../../library/os.rst:5673 msgid "" "Get up to *size* random bytes. The function can return less bytes than " "requested." msgstr "" -#: ../../library/os.rst:5675 +#: ../../library/os.rst:5676 msgid "" "These bytes can be used to seed user-space random number generators or for " "cryptographic purposes." msgstr "" -#: ../../library/os.rst:5678 +#: ../../library/os.rst:5679 msgid "" "``getrandom()`` relies on entropy gathered from device drivers and other " "sources of environmental noise. Unnecessarily reading large quantities of " @@ -6421,32 +6415,32 @@ msgid "" "``/dev/urandom`` devices." msgstr "" -#: ../../library/os.rst:5683 +#: ../../library/os.rst:5684 msgid "" "The flags argument is a bit mask that can contain zero or more of the " "following values ORed together: :py:const:`os.GRND_RANDOM` and :py:data:" "`GRND_NONBLOCK`." msgstr "" -#: ../../library/os.rst:5687 +#: ../../library/os.rst:5688 msgid "" "See also the `Linux getrandom() manual page `_." msgstr "" -#: ../../library/os.rst:5696 +#: ../../library/os.rst:5697 msgid "" "Return a bytestring of *size* random bytes suitable for cryptographic use." msgstr "" -#: ../../library/os.rst:5698 +#: ../../library/os.rst:5699 msgid "" "This function returns random bytes from an OS-specific randomness source. " "The returned data should be unpredictable enough for cryptographic " "applications, though its exact quality depends on the OS implementation." msgstr "" -#: ../../library/os.rst:5702 +#: ../../library/os.rst:5703 msgid "" "On Linux, if the ``getrandom()`` syscall is available, it is used in " "blocking mode: block until the system urandom entropy pool is initialized " @@ -6456,206 +6450,206 @@ msgid "" "to poll until the system urandom entropy pool is initialized." msgstr "" -#: ../../library/os.rst:5709 +#: ../../library/os.rst:5710 msgid "" "On a Unix-like system, random bytes are read from the ``/dev/urandom`` " "device. If the ``/dev/urandom`` device is not available or not readable, " "the :exc:`NotImplementedError` exception is raised." msgstr "" -#: ../../library/os.rst:5713 +#: ../../library/os.rst:5714 msgid "On Windows, it will use ``BCryptGenRandom()``." msgstr "" -#: ../../library/os.rst:5716 +#: ../../library/os.rst:5717 msgid "" "The :mod:`secrets` module provides higher level functions. For an easy-to-" "use interface to the random number generator provided by your platform, " "please see :class:`random.SystemRandom`." msgstr "" -#: ../../library/os.rst:5720 +#: ../../library/os.rst:5721 msgid "" "On Linux 3.17 and newer, the ``getrandom()`` syscall is now used when " "available. On OpenBSD 5.6 and newer, the C ``getentropy()`` function is now " "used. These functions avoid the usage of an internal file descriptor." msgstr "" -#: ../../library/os.rst:5726 +#: ../../library/os.rst:5727 msgid "" "On Linux, if the ``getrandom()`` syscall blocks (the urandom entropy pool is " "not initialized yet), fall back on reading ``/dev/urandom``." msgstr "" -#: ../../library/os.rst:5730 +#: ../../library/os.rst:5731 msgid "" "On Linux, ``getrandom()`` is now used in blocking mode to increase the " "security." msgstr "" -#: ../../library/os.rst:5734 +#: ../../library/os.rst:5735 msgid "" "On Windows, ``BCryptGenRandom()`` is used instead of ``CryptGenRandom()`` " "which is deprecated." msgstr "" -#: ../../library/os.rst:5740 +#: ../../library/os.rst:5741 msgid "" "By default, when reading from ``/dev/random``, :func:`getrandom` blocks if " "no random bytes are available, and when reading from ``/dev/urandom``, it " "blocks if the entropy pool has not yet been initialized." msgstr "" -#: ../../library/os.rst:5744 +#: ../../library/os.rst:5745 msgid "" "If the :py:data:`GRND_NONBLOCK` flag is set, then :func:`getrandom` does not " "block in these cases, but instead immediately raises :exc:`BlockingIOError`." msgstr "" -#: ../../library/os.rst:5751 +#: ../../library/os.rst:5752 msgid "" "If this bit is set, then random bytes are drawn from the ``/dev/" "random`` pool instead of the ``/dev/urandom`` pool." msgstr "" -#: ../../library/os.rst:363 ../../library/os.rst:529 ../../library/os.rst:731 +#: ../../library/os.rst:364 ../../library/os.rst:530 ../../library/os.rst:732 msgid "user" msgstr "user(使用者)" -#: ../../library/os.rst:363 +#: ../../library/os.rst:364 msgid "effective id" msgstr "" -#: ../../library/os.rst:372 ../../library/os.rst:438 ../../library/os.rst:447 -#: ../../library/os.rst:456 ../../library/os.rst:470 ../../library/os.rst:666 -#: ../../library/os.rst:4523 ../../library/os.rst:4549 +#: ../../library/os.rst:373 ../../library/os.rst:439 ../../library/os.rst:448 +#: ../../library/os.rst:457 ../../library/os.rst:471 ../../library/os.rst:667 +#: ../../library/os.rst:4524 ../../library/os.rst:4550 msgid "process" msgstr "process" -#: ../../library/os.rst:372 ../../library/os.rst:438 +#: ../../library/os.rst:373 ../../library/os.rst:439 msgid "group" msgstr "group(群組)" -#: ../../library/os.rst:447 ../../library/os.rst:529 +#: ../../library/os.rst:448 ../../library/os.rst:530 msgid "id" msgstr "id" -#: ../../library/os.rst:456 +#: ../../library/os.rst:457 msgid "id of parent" msgstr "" -#: ../../library/os.rst:470 ../../library/os.rst:666 +#: ../../library/os.rst:471 ../../library/os.rst:667 msgid "scheduling priority" msgstr "scheduling priority(排程優先權)" -#: ../../library/os.rst:552 ../../library/os.rst:801 +#: ../../library/os.rst:553 ../../library/os.rst:802 msgid "environment variables" msgstr "environment variables(環境變數)" -#: ../../library/os.rst:552 +#: ../../library/os.rst:553 msgid "setting" msgstr "setting(設定)" -#: ../../library/os.rst:731 +#: ../../library/os.rst:732 msgid "id, setting" msgstr "id, setting(設定)" -#: ../../library/os.rst:764 +#: ../../library/os.rst:765 msgid "gethostname() (in module socket)" msgstr "gethostname()(於 socket 模組)" -#: ../../library/os.rst:764 +#: ../../library/os.rst:765 msgid "gethostbyaddr() (in module socket)" msgstr "gethostbyaddr()(於 socket 模組)" -#: ../../library/os.rst:801 ../../library/os.rst:2658 +#: ../../library/os.rst:802 ../../library/os.rst:2659 msgid "deleting" msgstr "deleting(刪除)" -#: ../../library/os.rst:1360 ../../library/os.rst:3028 +#: ../../library/os.rst:1361 ../../library/os.rst:3029 msgid "module" msgstr "module(模組)" -#: ../../library/os.rst:1360 +#: ../../library/os.rst:1361 msgid "pty" msgstr "pty" -#: ../../library/os.rst:2045 ../../library/os.rst:2457 -#: ../../library/os.rst:2658 ../../library/os.rst:3562 -#: ../../library/os.rst:3662 +#: ../../library/os.rst:2046 ../../library/os.rst:2458 +#: ../../library/os.rst:2659 ../../library/os.rst:3563 +#: ../../library/os.rst:3663 msgid "directory" msgstr "directory(目錄)" -#: ../../library/os.rst:2045 +#: ../../library/os.rst:2046 msgid "changing" msgstr "changing(改變)" -#: ../../library/os.rst:2457 +#: ../../library/os.rst:2458 msgid "creating" msgstr "creating(建立)" -#: ../../library/os.rst:2457 +#: ../../library/os.rst:2458 msgid "UNC paths" msgstr "UNC paths(UNC 路徑)" -#: ../../library/os.rst:2457 +#: ../../library/os.rst:2458 msgid "and os.makedirs()" msgstr "以及 os.makedirs()" -#: ../../library/os.rst:3028 +#: ../../library/os.rst:3029 msgid "stat" msgstr "stat" -#: ../../library/os.rst:3562 ../../library/os.rst:3662 +#: ../../library/os.rst:3563 ../../library/os.rst:3663 msgid "walking" msgstr "" -#: ../../library/os.rst:3562 ../../library/os.rst:3662 +#: ../../library/os.rst:3563 ../../library/os.rst:3663 msgid "traversal" msgstr "traversal(遍歷)" -#: ../../library/os.rst:4523 ../../library/os.rst:4549 +#: ../../library/os.rst:4524 ../../library/os.rst:4550 msgid "killing" msgstr "" -#: ../../library/os.rst:4523 ../../library/os.rst:4549 +#: ../../library/os.rst:4524 ../../library/os.rst:4550 msgid "signalling" msgstr "signalling(信號)" -#: ../../library/os.rst:5578 ../../library/os.rst:5614 +#: ../../library/os.rst:5579 ../../library/os.rst:5615 msgid ". (dot)" msgstr ". (點)" -#: ../../library/os.rst:5578 ../../library/os.rst:5586 -#: ../../library/os.rst:5594 ../../library/os.rst:5605 -#: ../../library/os.rst:5614 +#: ../../library/os.rst:5579 ../../library/os.rst:5587 +#: ../../library/os.rst:5595 ../../library/os.rst:5606 +#: ../../library/os.rst:5615 msgid "in pathnames" msgstr "於 pathnames(路徑名稱)中" -#: ../../library/os.rst:5586 +#: ../../library/os.rst:5587 msgid ".." msgstr ".." -#: ../../library/os.rst:5594 ../../library/os.rst:5605 +#: ../../library/os.rst:5595 ../../library/os.rst:5606 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../library/os.rst:5595 +#: ../../library/os.rst:5596 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../library/os.rst:5595 +#: ../../library/os.rst:5596 msgid "in pathnames (Windows)" msgstr "in pathnames (Windows)(在路徑名稱中 (Windows))" -#: ../../library/os.rst:5621 +#: ../../library/os.rst:5622 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/os.rst:5621 +#: ../../library/os.rst:5622 msgid "path separator (POSIX)" msgstr "path separator (POSIX)(路徑分隔器 (POSIX))" -#: ../../library/os.rst:5621 +#: ../../library/os.rst:5622 msgid "; (semicolon)" msgstr "; (分號)" diff --git a/library/pdb.po b/library/pdb.po index 7740a944de..572db3165d 100644 --- a/library/pdb.po +++ b/library/pdb.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-15 00:13+0000\n" +"POT-Creation-Date: 2025-04-09 00:15+0000\n" "PO-Revision-Date: 2024-10-19 17:39+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,14 +43,13 @@ msgstr "" #: ../../library/pdb.rst:26 msgid "" -"The debugger is extensible -- it is actually defined as the " -"class :class:`Pdb`. This is currently undocumented but easily understood by " -"reading the source. The extension interface uses the modules :mod:`bdb` " -"and :mod:`cmd`." +"The debugger is extensible -- it is actually defined as the class :class:" +"`Pdb`. This is currently undocumented but easily understood by reading the " +"source. The extension interface uses the modules :mod:`bdb` and :mod:`cmd`." msgstr "" "偵錯器是可擴充的 —— 偵錯器實際被定義為 :class:`Pdb` 類別。該類別目前沒有文" -"件,但可以很容易地透過閱讀原始碼來理解它。擴充套件介面使用了 :mod:`bdb` " -"和 :mod:`cmd` 模組。" +"件,但可以很容易地透過閱讀原始碼來理解它。擴充套件介面使用了 :mod:`bdb` 和 :" +"mod:`cmd` 模組。" #: ../../library/pdb.rst:32 msgid "Module :mod:`faulthandler`" @@ -152,17 +151,17 @@ msgstr "" "透過 :mod:`readline` 模組達成的 tab 補全可用於補全本模組的命令和命令的引數," "例如會提供當前的全域和區域名稱以作為 ``p`` 命令的引數。" -#: ../../library/pdb.rst:78 +#: ../../library/pdb.rst:80 msgid "" "You can also invoke :mod:`pdb` from the command line to debug other " "scripts. For example::" msgstr "你還可以從命令列調用 :mod:`pdb` 來偵錯其他腳本。例如: ::" -#: ../../library/pdb.rst:81 -msgid "python -m pdb myscript.py" -msgstr "python -m pdb myscript.py" - #: ../../library/pdb.rst:83 +msgid "python -m pdb [-c command] (-m module | pyfile) [args ...]" +msgstr "" + +#: ../../library/pdb.rst:85 msgid "" "When invoked as a module, pdb will automatically enter post-mortem debugging " "if the program being debugged exits abnormally. After post-mortem debugging " @@ -174,28 +173,39 @@ msgstr "" "偵錯後(或程式正常退出後),pdb 將重新啟動程式。自動重新啟動會保留 pdb 的狀態" "(例如斷點),並且在大多數情況下比在程式退出時退出偵錯器更有用。" -#: ../../library/pdb.rst:89 +#: ../../library/pdb.rst:93 +#, fuzzy msgid "" -"Added the ``-c`` option to execute commands as if given in a :file:`.pdbrc` " -"file; see :ref:`debugger-commands`." +"To execute commands as if given in a :file:`.pdbrc` file; see :ref:`debugger-" +"commands`." msgstr "" "新增了 ``-c`` 選項來執行命令,就像能在 :file:`.pdbrc` 檔案中給定的那樣;請參" "閱\\ :ref:`偵錯器命令 `。" -#: ../../library/pdb.rst:93 +#: ../../library/pdb.rst:96 +#, fuzzy +msgid "Added the ``-c`` option." +msgstr "新增了 ``>>`` 標記。" + +#: ../../library/pdb.rst:101 +#, fuzzy msgid "" -"Added the ``-m`` option to execute modules similar to the way ``python -m`` " -"does. As with a script, the debugger will pause execution just before the " -"first line of the module." +"To execute modules similar to the way ``python -m`` does. As with a script, " +"the debugger will pause execution just before the first line of the module." msgstr "" "新增了 ``-m`` 選項以類似於 ``python -m`` 的方式來執行模組。與腳本一樣,偵錯器" "將在模組的第一列之前暫停執行。" -#: ../../library/pdb.rst:98 +#: ../../library/pdb.rst:104 +#, fuzzy +msgid "Added the ``-m`` option." +msgstr "新增了 ``>>`` 標記。" + +#: ../../library/pdb.rst:107 msgid "Typical usage to execute a statement under control of the debugger is::" msgstr "在偵錯器控制下執行陳述式的典型用法是: ::" -#: ../../library/pdb.rst:100 +#: ../../library/pdb.rst:109 msgid "" ">>> import pdb\n" ">>> def f(x):\n" @@ -215,11 +225,11 @@ msgstr "" "0.5\n" ">>>" -#: ../../library/pdb.rst:109 +#: ../../library/pdb.rst:118 msgid "The typical usage to inspect a crashed program is::" msgstr "檢查一個損壞程式的典型用法: ::" -#: ../../library/pdb.rst:111 +#: ../../library/pdb.rst:120 msgid "" ">>> import pdb\n" ">>> def f(x):\n" @@ -251,7 +261,7 @@ msgstr "" "0\n" "(Pdb)" -#: ../../library/pdb.rst:126 +#: ../../library/pdb.rst:135 msgid "" "The implementation of :pep:`667` means that name assignments made via " "``pdb`` will immediately affect the active scope, even when running inside " @@ -261,13 +271,13 @@ msgstr "" "影響有效作用域,即使在\\ :term:`最佳化作用域 `\\ 內運作也是" "如此。" -#: ../../library/pdb.rst:132 +#: ../../library/pdb.rst:141 msgid "" "The module defines the following functions; each enters the debugger in a " "slightly different way:" msgstr "本模組定義了下列函式,每個函式進入偵錯器的方式略有不同:" -#: ../../library/pdb.rst:137 +#: ../../library/pdb.rst:146 msgid "" "Execute the *statement* (given as a string or a code object) under debugger " "control. The debugger prompt appears before any code is executed; you can " @@ -275,38 +285,38 @@ msgid "" "statement using :pdbcmd:`step` or :pdbcmd:`next` (all these commands are " "explained below). The optional *globals* and *locals* arguments specify the " "environment in which the code is executed; by default the dictionary of the " -"module :mod:`__main__` is used. (See the explanation of the built-" -"in :func:`exec` or :func:`eval` functions.)" +"module :mod:`__main__` is used. (See the explanation of the built-in :func:" +"`exec` or :func:`eval` functions.)" msgstr "" "在偵錯器控制下執行 *statement*\\ (以字串或程式碼物件形式給定)。偵錯提示字元" "會在執行任何程式碼前出現;你可以設定斷點並輸入 :pdbcmd:`continue`,或也可以使" "用 :pdbcmd:`step` 或 :pdbcmd:`next` 逐步執行陳述式(這些命令在下面都有說" -"明)。可選引數 *globals* 和 *locals* 指定程式碼執行的環境;預設使" -"用 :mod:`__main__` 模組的字典。(請參閱內建函式 :func:`exec` 或 :func:`eval` " -"的說明。)" +"明)。可選引數 *globals* 和 *locals* 指定程式碼執行的環境;預設使用 :mod:" +"`__main__` 模組的字典。(請參閱內建函式 :func:`exec` 或 :func:`eval` 的說" +"明。)" -#: ../../library/pdb.rst:149 +#: ../../library/pdb.rst:158 msgid "" "Evaluate the *expression* (given as a string or a code object) under " "debugger control. When :func:`runeval` returns, it returns the value of the " "*expression*. Otherwise this function is similar to :func:`run`." msgstr "" -"在偵錯器控制下為 *expression* 求值(以字串或程式碼物件形式給定)。" -"當 :func:`runeval` 回傳時,它回傳 *expression* 的值。除此之外,該函式" -"與 :func:`run` 類似。" +"在偵錯器控制下為 *expression* 求值(以字串或程式碼物件形式給定)。當 :func:" +"`runeval` 回傳時,它回傳 *expression* 的值。除此之外,該函式與 :func:`run` 類" +"似。" -#: ../../library/pdb.rst:156 +#: ../../library/pdb.rst:165 msgid "" "Call the *function* (a function or method object, not a string) with the " "given arguments. When :func:`runcall` returns, it returns whatever the " "function call returned. The debugger prompt appears as soon as the function " "is entered." msgstr "" -"使用給定的引數呼叫 *function*\\ (只可以是函式或方法物件,不能是字" -"串)。:func:`runcall` 回傳的是所呼叫函式的回傳值。偵錯器提示字元將在進入函式" -"後立即出現。" +"使用給定的引數呼叫 *function*\\ (只可以是函式或方法物件,不能是字串)。:" +"func:`runcall` 回傳的是所呼叫函式的回傳值。偵錯器提示字元將在進入函式後立即出" +"現。" -#: ../../library/pdb.rst:164 +#: ../../library/pdb.rst:173 msgid "" "Enter the debugger at the calling stack frame. This is useful to hard-code " "a breakpoint at a given point in a program, even if the code is not " @@ -317,17 +327,17 @@ msgstr "" "一個斷點,即便該程式碼不在偵錯狀態(如斷言失敗時)。如有給定 *header*,它將在" "偵錯正要開始前被印出到控制台。" -#: ../../library/pdb.rst:169 +#: ../../library/pdb.rst:178 msgid "The keyword-only argument *header*." msgstr "僅限關鍵字引數 *header*。" -#: ../../library/pdb.rst:172 +#: ../../library/pdb.rst:181 msgid "" ":func:`set_trace` will enter the debugger immediately, rather than on the " "next line of code to be executed." msgstr ":func:`set_trace` 將立即進入偵錯器,而不是在下一列要執行的程式碼中。" -#: ../../library/pdb.rst:178 +#: ../../library/pdb.rst:187 msgid "" "Enter post-mortem debugging of the given exception or :ref:`traceback object " "`. If no value is given, it uses the exception that is " @@ -336,30 +346,29 @@ msgstr "" "進入所給定例外或\\ :ref:`回溯物件 `\\ 的事後偵錯。如果沒有" "給定,預設使用當前正在處理的例外,或如果沒有例外則會引發 ``ValueError``。" -#: ../../library/pdb.rst:183 +#: ../../library/pdb.rst:192 msgid "Support for exception objects was added." msgstr "新增對例外物件的支援。" -#: ../../library/pdb.rst:188 +#: ../../library/pdb.rst:197 msgid "" "Enter post-mortem debugging of the exception found in :data:`sys.last_exc`." msgstr "進入在 :data:`sys.last_exc` 中發現的例外的事後偵錯。" -#: ../../library/pdb.rst:192 +#: ../../library/pdb.rst:201 msgid "" "The ``run*`` functions and :func:`set_trace` are aliases for instantiating " "the :class:`Pdb` class and calling the method of the same name. If you want " "to access further features, you have to do this yourself:" msgstr "" -"``run*`` 函式和 :func:`set_trace` 都是別名,用於實例化 " -"(instantiate) :class:`Pdb` 類別並呼叫同名方法。如果要使用更多功能,則必須自己" -"執行以下操作:" +"``run*`` 函式和 :func:`set_trace` 都是別名,用於實例化 (instantiate) :class:" +"`Pdb` 類別並呼叫同名方法。如果要使用更多功能,則必須自己執行以下操作:" -#: ../../library/pdb.rst:199 +#: ../../library/pdb.rst:208 msgid ":class:`Pdb` is the debugger class." msgstr ":class:`Pdb` 是偵錯器類別。" -#: ../../library/pdb.rst:201 +#: ../../library/pdb.rst:210 msgid "" "The *completekey*, *stdin* and *stdout* arguments are passed to the " "underlying :class:`cmd.Cmd` class; see the description there." @@ -367,7 +376,7 @@ msgstr "" "*completekey*、*stdin* 與 *stdout* 引數會被傳到底層的 :class:`cmd.Cmd` 類別;" "請於該文件閱讀相關敘述。" -#: ../../library/pdb.rst:204 +#: ../../library/pdb.rst:213 msgid "" "The *skip* argument, if given, must be an iterable of glob-style module name " "patterns. The debugger will not step into frames that originate in a module " @@ -376,63 +385,63 @@ msgstr "" "如果給定 *skip* 引數,則它必須是一個給出 glob 樣式之模組名稱的疊代器。如果遇" "到匹配這些樣式的模組,偵錯器將不會進入來自該模組的 frame。 [1]_" -#: ../../library/pdb.rst:208 +#: ../../library/pdb.rst:217 msgid "" "By default, Pdb sets a handler for the SIGINT signal (which is sent when the " -"user presses :kbd:`Ctrl-C` on the console) when you give " -"a :pdbcmd:`continue` command. This allows you to break into the debugger " -"again by pressing :kbd:`Ctrl-C`. If you want Pdb not to touch the SIGINT " -"handler, set *nosigint* to true." +"user presses :kbd:`Ctrl-C` on the console) when you give a :pdbcmd:" +"`continue` command. This allows you to break into the debugger again by " +"pressing :kbd:`Ctrl-C`. If you want Pdb not to touch the SIGINT handler, " +"set *nosigint* to true." msgstr "" "預設情況下,當你發出 :pdbcmd:`continue` 命令時,Pdb 會為 SIGINT 訊號(即使用" "者在控制台上按下 :kbd:`Ctrl-C` 時會發送的訊號)設定一個處理程式 (handler),這" "允許你透過按下 :kbd:`Ctrl-C` 再次切入偵錯器。如果你希望 Pdb 不影響到 SIGINT " "處理程式,請將 *nosigint* 設定為 true。" -#: ../../library/pdb.rst:213 +#: ../../library/pdb.rst:222 msgid "" -"The *readrc* argument defaults to true and controls whether Pdb will " -"load .pdbrc files from the filesystem." +"The *readrc* argument defaults to true and controls whether Pdb will load ." +"pdbrc files from the filesystem." msgstr "*readrc* 引數預設為 true,它控制 Pdb 是否從檔案系統載入 .pdbrc 檔案。" -#: ../../library/pdb.rst:216 +#: ../../library/pdb.rst:225 msgid "Example call to enable tracing with *skip*::" msgstr "啟用追蹤 (tracing) 且帶有 *skip* 引數的呼叫示範: ::" -#: ../../library/pdb.rst:218 +#: ../../library/pdb.rst:227 msgid "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" msgstr "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" -#: ../../library/pdb.rst:220 +#: ../../library/pdb.rst:229 msgid "" "Raises an :ref:`auditing event ` ``pdb.Pdb`` with no arguments." msgstr "" -"不帶引數地引發一個\\ :ref:`稽核事件 (auditing event) ` " -"``pdb.Pdb``。" +"不帶引數地引發一個\\ :ref:`稽核事件 (auditing event) ` ``pdb." +"Pdb``。" -#: ../../library/pdb.rst:222 +#: ../../library/pdb.rst:231 msgid "Added the *skip* parameter." msgstr "新增了 *skip* 參數。" -#: ../../library/pdb.rst:225 +#: ../../library/pdb.rst:234 msgid "" "Added the *nosigint* parameter. Previously, a SIGINT handler was never set " "by Pdb." msgstr "新增了 *nosigint* 參數。以前 SIGINT 處理程式從未被 Pdb 設定過。" -#: ../../library/pdb.rst:229 +#: ../../library/pdb.rst:238 msgid "The *readrc* argument." msgstr "*readrc* 引數。" -#: ../../library/pdb.rst:237 +#: ../../library/pdb.rst:246 msgid "See the documentation for the functions explained above." msgstr "請見上面關於這些函式的文件說明。" -#: ../../library/pdb.rst:243 +#: ../../library/pdb.rst:252 msgid "Debugger Commands" msgstr "偵錯器命令" -#: ../../library/pdb.rst:245 +#: ../../library/pdb.rst:254 msgid "" "The commands recognized by the debugger are listed below. Most commands can " "be abbreviated to one or two letters as indicated; e.g. ``h(elp)`` means " @@ -449,15 +458,15 @@ msgstr "" "空格(空格符 (spaces) 或製表符 (tabs))分隔。在命令語法中,可選引數被括在方括" "號 (``[]``) 中;使用時請勿輸入方括號。命令語法中的選擇項由豎線 (``|``) 分隔。" -#: ../../library/pdb.rst:254 +#: ../../library/pdb.rst:263 msgid "" "Entering a blank line repeats the last command entered. Exception: if the " "last command was a :pdbcmd:`list` command, the next 11 lines are listed." msgstr "" -"輸入一個空白列 (blank line) 將重複上次輸入的命令。例外:如果上一個命令" -"是 :pdbcmd:`list` 命令,則會列出接下來的 11 列。" +"輸入一個空白列 (blank line) 將重複上次輸入的命令。例外:如果上一個命令是 :" +"pdbcmd:`list` 命令,則會列出接下來的 11 列。" -#: ../../library/pdb.rst:257 +#: ../../library/pdb.rst:266 msgid "" "Commands that the debugger doesn't recognize are assumed to be Python " "statements and are executed in the context of the program being debugged. " @@ -472,13 +481,13 @@ msgstr "" "大方法,甚至可以修改變數或呼叫函式。當此類陳述式發生例外,將印出例外名稱,但" "偵錯器的狀態不會改變。" -#: ../../library/pdb.rst:265 +#: ../../library/pdb.rst:274 msgid "" "Expressions/Statements whose prefix is a pdb command are now correctly " "identified and executed." msgstr "現在可以正確辨識並執行前綴為 pdb 命令的運算式/陳述式。" -#: ../../library/pdb.rst:269 +#: ../../library/pdb.rst:278 msgid "" "The debugger supports :ref:`aliases `. Aliases can have " "parameters which allows one a certain level of adaptability to the context " @@ -487,7 +496,7 @@ msgstr "" "偵錯器有支援設定\\ :ref:`別名 `。別名可以有參數,使得偵錯器" "對被檢查的情境有一定程度的適應性。" -#: ../../library/pdb.rst:273 +#: ../../library/pdb.rst:282 msgid "" "Multiple commands may be entered on a single line, separated by ``;;``. (A " "single ``;`` is not used as it is the separator for multiple commands in a " @@ -502,7 +511,7 @@ msgstr "" "總是在第一處 ``;;`` 被切分開,即使它位於引號內的字串之中。對於具有雙分號字串" "的一個變通解法,是使用隱式字串連接 ``';'';'`` 或 ``\";\"\";\"``。" -#: ../../library/pdb.rst:280 +#: ../../library/pdb.rst:289 msgid "" "To set a temporary global variable, use a *convenience variable*. A " "*convenience variable* is a variable whose name starts with ``$``. For " @@ -516,27 +525,27 @@ msgstr "" "可以在偵錯器會話 (debugger session) 中使用它。當程式恢復執行時,*便利變數*\\ " "將被清除,因此與使用 ``foo = 1`` 等普通變數相比,它不太會去干擾你的程式。" -#: ../../library/pdb.rst:287 +#: ../../library/pdb.rst:296 msgid "There are three preset *convenience variables*:" msgstr "共有三個預先設定的\\ *便利變數*:" -#: ../../library/pdb.rst:289 +#: ../../library/pdb.rst:298 msgid "``$_frame``: the current frame you are debugging" msgstr "``$_frame``:當前正在偵錯的 frame" -#: ../../library/pdb.rst:290 +#: ../../library/pdb.rst:299 msgid "``$_retval``: the return value if the frame is returning" msgstr "``$_retval``:frame 回傳時的回傳值" -#: ../../library/pdb.rst:291 +#: ../../library/pdb.rst:300 msgid "``$_exception``: the exception if the frame is raising an exception" msgstr "``$_exception``:frame 引發例外時的例外" -#: ../../library/pdb.rst:295 +#: ../../library/pdb.rst:304 msgid "Added the *convenience variable* feature." msgstr "新增了\\ *便利變數*\\ 功能。" -#: ../../library/pdb.rst:301 +#: ../../library/pdb.rst:310 msgid "" "If a file :file:`.pdbrc` exists in the user's home directory or in the " "current directory, it is read with ``'utf-8'`` encoding and executed as if " @@ -550,16 +559,16 @@ msgstr "" "空列和以 ``#`` 開頭的列會被忽略之外。這對於別名設定特別有用。如果兩個檔案都存" "在,則先讀取家目錄中的檔案,且定義於其中的別名可以被本地檔案覆蓋。" -#: ../../library/pdb.rst:308 +#: ../../library/pdb.rst:317 msgid "" -":file:`.pdbrc` can now contain commands that continue debugging, such " -"as :pdbcmd:`continue` or :pdbcmd:`next`. Previously, these commands had no " +":file:`.pdbrc` can now contain commands that continue debugging, such as :" +"pdbcmd:`continue` or :pdbcmd:`next`. Previously, these commands had no " "effect." msgstr "" -":file:`.pdbrc` 現在可以包含繼續偵錯的命令,如 :pdbcmd:`continue` " -"或 :pdbcmd:`next`。以前檔案中的這些命令是無效的。" +":file:`.pdbrc` 現在可以包含繼續偵錯的命令,如 :pdbcmd:`continue` 或 :pdbcmd:" +"`next`。以前檔案中的這些命令是無效的。" -#: ../../library/pdb.rst:313 +#: ../../library/pdb.rst:322 msgid "" ":file:`.pdbrc` is now read with ``'utf-8'`` encoding. Previously, it was " "read with the system locale encoding." @@ -567,7 +576,7 @@ msgstr "" ":file:`.pdbrc` 現在使用 ``'utf-8'`` 編碼讀取。以前它是使用系統區域設定編碼讀" "取的。" -#: ../../library/pdb.rst:320 +#: ../../library/pdb.rst:329 msgid "" "Without argument, print the list of available commands. With a *command* as " "argument, print help about that command. ``help pdb`` displays the full " @@ -580,7 +589,7 @@ msgstr "" "由於 *command* 引數必須是一個識別字 (identifier),若要獲取 ``!`` 命令的幫助訊" "息則必須輸入 ``help exec``。" -#: ../../library/pdb.rst:328 +#: ../../library/pdb.rst:337 msgid "" "Print a stack trace, with the most recent frame at the bottom. An arrow " "(``>``) indicates the current frame, which determines the context of most " @@ -589,7 +598,7 @@ msgstr "" "印出 stack trace,最新的 frame 會位於底部。箭頭(``>``)表示當前的 frame,它" "也決定了大多數命令的情境。" -#: ../../library/pdb.rst:333 +#: ../../library/pdb.rst:342 msgid "" "Move the current frame *count* (default one) levels down in the stack trace " "(to a newer frame)." @@ -597,7 +606,7 @@ msgstr "" "在 stack trace 中,將當前 frame 向下移動 *count* 級(預設為 1 級,移往較新的 " "frame)。" -#: ../../library/pdb.rst:338 +#: ../../library/pdb.rst:347 msgid "" "Move the current frame *count* (default one) levels up in the stack trace " "(to an older frame)." @@ -605,21 +614,21 @@ msgstr "" "在 stack trace 中,將當前 frame 向上移動 *count* 級(預設為 1 級,移向較舊的 " "frame)。" -#: ../../library/pdb.rst:343 +#: ../../library/pdb.rst:352 msgid "" "With a *lineno* argument, set a break at line *lineno* in the current file. " "The line number may be prefixed with a *filename* and a colon, to specify a " "breakpoint in another file (possibly one that hasn't been loaded yet). The " "file is searched on :data:`sys.path`. Accepatable forms of *filename* are " -"``/abspath/to/file.py``, ``relpath/file.py``, ``module`` and " -"``package.module``." +"``/abspath/to/file.py``, ``relpath/file.py``, ``module`` and ``package." +"module``." msgstr "" "如帶有 *lineno* 引數,則在目前檔案中的 *lineno* 列處設定中斷。列號可以以 " "*filename* 和冒號為前綴,以指定另一個檔案(可能是尚未載入的檔案)中的斷點。該" "檔案會在 :data:`sys.path` 上搜尋。可接受的 *filename* 形式為 ``/abspath/to/" "file.py``、``relpath/file.py``、``module`` 和 ``package.module``。" -#: ../../library/pdb.rst:350 +#: ../../library/pdb.rst:359 msgid "" "With a *function* argument, set a break at the first executable statement " "within that function. *function* can be any expression that evaluates to a " @@ -628,13 +637,13 @@ msgstr "" "如帶有 *function* 引數,在該函式內的第一個可執行陳述式處設定中斷。*function* " "可以是任何其求值結果為目前命名空間中函式的運算式。" -#: ../../library/pdb.rst:354 +#: ../../library/pdb.rst:363 msgid "" "If a second argument is present, it is an expression which must evaluate to " "true before the breakpoint is honored." msgstr "如果第二個引數存在,它是一個運算式,在斷點生效前其必須求值為 true" -#: ../../library/pdb.rst:357 +#: ../../library/pdb.rst:366 msgid "" "Without argument, list all breaks, including for each breakpoint, the number " "of times that breakpoint has been hit, the current ignore count, and the " @@ -643,20 +652,20 @@ msgstr "" "如果不帶引數執行會列出所有斷點資訊,包括每個斷點、命中該斷點的次數、當前的忽" "略次數以及關聯的條件(如存在)。" -#: ../../library/pdb.rst:361 +#: ../../library/pdb.rst:370 msgid "" "Each breakpoint is assigned a number to which all the other breakpoint " "commands refer." msgstr "每個斷點都有賦予一個編號,所有其他斷點命令都參照該編號。" -#: ../../library/pdb.rst:366 +#: ../../library/pdb.rst:375 msgid "" "Temporary breakpoint, which is removed automatically when it is first hit. " "The arguments are the same as for :pdbcmd:`break`." msgstr "" "臨時斷點,在第一次遇見時會自動被刪除。它的引數與 :pdbcmd:`break` 相同。" -#: ../../library/pdb.rst:371 +#: ../../library/pdb.rst:380 msgid "" "With a *filename:lineno* argument, clear all the breakpoints at this line. " "With a space separated list of breakpoint numbers, clear those breakpoints. " @@ -665,7 +674,7 @@ msgstr "" "如帶有 *filename:lineno* 引數,則清除此列上的所有斷點。如果引數是空格分隔的斷" "點編號列表,則清除這些斷點。如果不帶引數則清除所有斷點(但會先提示確認)。" -#: ../../library/pdb.rst:377 +#: ../../library/pdb.rst:386 msgid "" "Disable the breakpoints given as a space separated list of breakpoint " "numbers. Disabling a breakpoint means it cannot cause the program to stop " @@ -675,11 +684,11 @@ msgstr "" "停用斷點,斷點以空格分隔的斷點編號列表來給定。停用斷點表示它不會導致程式停止" "執行,但是與清除斷點不同,停用的斷點將保留在斷點列表中並且可以(重新)啟用。" -#: ../../library/pdb.rst:384 +#: ../../library/pdb.rst:393 msgid "Enable the breakpoints specified." msgstr "啟用指定的斷點。" -#: ../../library/pdb.rst:388 +#: ../../library/pdb.rst:397 msgid "" "Set the ignore count for the given breakpoint number. If *count* is " "omitted, the ignore count is set to 0. A breakpoint becomes active when the " @@ -691,7 +700,7 @@ msgstr "" "為 0 時,斷點將變為有效狀態。當非 0 時,每次到達斷點,且斷點沒有被禁用,且任" "何關聯的條件被求值為 true,則 *count* 就會遞減。" -#: ../../library/pdb.rst:396 +#: ../../library/pdb.rst:405 msgid "" "Set a new *condition* for the breakpoint, an expression which must evaluate " "to true before the breakpoint is honored. If *condition* is absent, any " @@ -700,7 +709,7 @@ msgstr "" "為斷點設定一個新 *condition*,為一個運算式,且其求值結果為 true 時斷點才會起" "作用。如果沒有給定 *condition*,則刪除任何現有條件,也就是不為斷點設定條件。" -#: ../../library/pdb.rst:402 +#: ../../library/pdb.rst:411 msgid "" "Specify a list of commands for breakpoint number *bpnumber*. The commands " "themselves appear on the following lines. Type a line containing just " @@ -709,7 +718,7 @@ msgstr "" "為編號是 *bpnumber* 的斷點指定一系列命令。命令內容出現在後續的幾列中。輸入僅" "包含 ``end`` 的一列來結束命令列表。例如: ::" -#: ../../library/pdb.rst:406 +#: ../../library/pdb.rst:415 msgid "" "(Pdb) commands 1\n" "(com) p some_variable\n" @@ -721,7 +730,7 @@ msgstr "" "(com) end\n" "(Pdb)" -#: ../../library/pdb.rst:411 +#: ../../library/pdb.rst:420 msgid "" "To remove all commands from a breakpoint, type ``commands`` and follow it " "immediately with ``end``; that is, give no commands." @@ -729,37 +738,37 @@ msgstr "" "要刪除斷點上的所有命令,請輸入 ``commands`` 並立即以 ``end`` 結尾,也就是不指" "定任何命令。" -#: ../../library/pdb.rst:414 +#: ../../library/pdb.rst:423 msgid "" "With no *bpnumber* argument, ``commands`` refers to the last breakpoint set." msgstr "不帶有 *bpnumber* 引數則 ``commands`` 會關聯到上一個設定的斷點。" -#: ../../library/pdb.rst:416 +#: ../../library/pdb.rst:425 msgid "" "You can use breakpoint commands to start your program up again. Simply use " "the :pdbcmd:`continue` command, or :pdbcmd:`step`, or any other command that " "resumes execution." msgstr "" -"可以使用斷點命令來重新啟動程式,只需使用 :pdbcmd:`continue` " -"或 :pdbcmd:`step` 命令,或其他可以繼續執行程式的命令。" +"可以使用斷點命令來重新啟動程式,只需使用 :pdbcmd:`continue` 或 :pdbcmd:" +"`step` 命令,或其他可以繼續執行程式的命令。" -#: ../../library/pdb.rst:420 +#: ../../library/pdb.rst:429 msgid "" -"Specifying any command resuming execution " -"(currently :pdbcmd:`continue`, :pdbcmd:`step`, :pdbcmd:`next`, :pdbcmd:`return`, :pdbcmd:`jump`, :pdbcmd:`quit` " -"and their abbreviations) terminates the command list (as if that command was " -"immediately followed by end). This is because any time you resume execution " -"(even with a simple next or step), you may encounter another breakpoint—" -"which could have its own command list, leading to ambiguities about which " -"list to execute." +"Specifying any command resuming execution (currently :pdbcmd:`continue`, :" +"pdbcmd:`step`, :pdbcmd:`next`, :pdbcmd:`return`, :pdbcmd:`jump`, :pdbcmd:" +"`quit` and their abbreviations) terminates the command list (as if that " +"command was immediately followed by end). This is because any time you " +"resume execution (even with a simple next or step), you may encounter " +"another breakpoint—which could have its own command list, leading to " +"ambiguities about which list to execute." msgstr "" -"如果指定了某個繼續執行程式的命令(目前包" -"括 :pdbcmd:`continue`、:pdbcmd:`step`、:pdbcmd:`next`、:pdbcmd:`return`、:pdbcmd:`jump`、:pdbcmd:`quit` " -"及它們的縮寫)將終止命令列表(就像該命令後馬上跟著 end)。因為在任何時候繼續" -"執行下去(即使是簡單的 next 或 step),都可能會遇到另一個斷點,該斷點可能具有" -"自己的命令列表,這會導致無法確定要執行哪個列表。" +"如果指定了某個繼續執行程式的命令(目前包括 :pdbcmd:`continue`、:pdbcmd:" +"`step`、:pdbcmd:`next`、:pdbcmd:`return`、:pdbcmd:`jump`、:pdbcmd:`quit` 及它" +"們的縮寫)將終止命令列表(就像該命令後馬上跟著 end)。因為在任何時候繼續執行" +"下去(即使是簡單的 next 或 step),都可能會遇到另一個斷點,該斷點可能具有自己" +"的命令列表,這會導致無法確定要執行哪個列表。" -#: ../../library/pdb.rst:429 +#: ../../library/pdb.rst:438 msgid "" "If you use the ``silent`` command in the command list, the usual message " "about stopping at a breakpoint is not printed. This may be desirable for " @@ -771,7 +780,7 @@ msgstr "" "息就不會印出。對於要印出特定訊息再繼續的斷點來說,這可能會是需要的功能。如果" "其他命令都沒有印出任何內容,那你就看不到已到達斷點的跡象。" -#: ../../library/pdb.rst:436 +#: ../../library/pdb.rst:445 msgid "" "Execute the current line, stop at the first possible occasion (either in a " "function that is called or on the next line in the current function)." @@ -779,7 +788,7 @@ msgstr "" "執行當前列,在第一個可以停止的位置(在被呼叫的函式內部或在當前函式的下一列)" "停止。" -#: ../../library/pdb.rst:441 +#: ../../library/pdb.rst:450 msgid "" "Continue execution until the next line in the current function is reached or " "it returns. (The difference between :pdbcmd:`next` and :pdbcmd:`step` is " @@ -792,13 +801,13 @@ msgstr "" "而 :pdbcmd:`next`\\ (幾乎)全速執行被呼叫的函式,並僅在當前函式的下一列停" "止。)" -#: ../../library/pdb.rst:449 +#: ../../library/pdb.rst:458 msgid "" "Without argument, continue execution until the line with a number greater " "than the current one is reached." msgstr "如果不帶引數則繼續執行,直到列號比當前的列大時停止。" -#: ../../library/pdb.rst:452 +#: ../../library/pdb.rst:461 msgid "" "With *lineno*, continue execution until a line with a number greater or " "equal to *lineno* is reached. In both cases, also stop when the current " @@ -807,19 +816,19 @@ msgstr "" "如帶有 *lineno* 則繼續執行,直到到達列號大於或等於 *lineno* 的那一列。在這兩" "種情況下,當前 frame 回傳時也會停止。" -#: ../../library/pdb.rst:456 +#: ../../library/pdb.rst:465 msgid "Allow giving an explicit line number." msgstr "允許明確給定一個列號。" -#: ../../library/pdb.rst:461 +#: ../../library/pdb.rst:470 msgid "Continue execution until the current function returns." msgstr "繼續執行,直到目前的函式回傳。" -#: ../../library/pdb.rst:465 +#: ../../library/pdb.rst:474 msgid "Continue execution, only stop when a breakpoint is encountered." msgstr "繼續執行,除非遇到斷點才停下來。" -#: ../../library/pdb.rst:469 +#: ../../library/pdb.rst:478 msgid "" "Set the next line that will be executed. Only available in the bottom-most " "frame. This lets you jump back and execute code again, or jump forward to " @@ -828,16 +837,16 @@ msgstr "" "設定即將執行的下一列,僅可用於堆疊中最底部的 frame。這讓你可以跳回去並再次執" "行程式碼,或者往前跳以跳過不想執行的程式碼。" -#: ../../library/pdb.rst:473 +#: ../../library/pdb.rst:482 msgid "" "It should be noted that not all jumps are allowed -- for instance it is not " -"possible to jump into the middle of a :keyword:`for` loop or out of " -"a :keyword:`finally` clause." +"possible to jump into the middle of a :keyword:`for` loop or out of a :" +"keyword:`finally` clause." msgstr "" "需要注意的是,不是所有的跳轉都是被允許的 -- 例如不能跳轉到 :keyword:`for` 迴" "圈的中間或跳出 :keyword:`finally` 子句。" -#: ../../library/pdb.rst:479 +#: ../../library/pdb.rst:488 msgid "" "List source code for the current file. Without arguments, list 11 lines " "around the current line or continue the previous listing. With ``.`` as " @@ -850,7 +859,7 @@ msgstr "" "列出那一列周圍的 11 列。如果帶有兩個引數,則列出給定範圍中的程式碼;如果第二" "個引數小於第一個引數,則將其直譯為要列出的列數。" -#: ../../library/pdb.rst:485 +#: ../../library/pdb.rst:494 msgid "" "The current line in the current frame is indicated by ``->``. If an " "exception is being debugged, the line where the exception was originally " @@ -860,34 +869,34 @@ msgstr "" "當前 frame 中的當前列會用 ``->`` 標記出來。如果正在偵錯一個例外,且引發或傳遞" "該例外的那一列不是當前列,則會用 ``>>`` 來標記該列。" -#: ../../library/pdb.rst:490 +#: ../../library/pdb.rst:499 msgid "Added the ``>>`` marker." msgstr "新增了 ``>>`` 標記。" -#: ../../library/pdb.rst:495 +#: ../../library/pdb.rst:504 msgid "" "List all source code for the current function or frame. Interesting lines " "are marked as for :pdbcmd:`list`." msgstr "" "列出當前函式或 frame 的所有原始碼。相關列的標記方式與 :pdbcmd:`list` 相同。" -#: ../../library/pdb.rst:502 +#: ../../library/pdb.rst:511 msgid "Print the arguments of the current function and their current values." msgstr "印出當前函式的引數及它們當前的值。" -#: ../../library/pdb.rst:506 +#: ../../library/pdb.rst:515 msgid "Evaluate *expression* in the current context and print its value." msgstr "在當前情境中為 *expression* 求值並印出其值。" -#: ../../library/pdb.rst:510 +#: ../../library/pdb.rst:519 msgid "" "``print()`` can also be used, but is not a debugger command --- this " "executes the Python :func:`print` function." msgstr "" -"也可以使用 ``print()``,但它不是一個偵錯器命令 --- 它會執行 " -"Python :func:`print` 函式。" +"也可以使用 ``print()``,但它不是一個偵錯器命令 --- 它會執行 Python :func:" +"`print` 函式。" -#: ../../library/pdb.rst:516 +#: ../../library/pdb.rst:525 msgid "" "Like the :pdbcmd:`p` command, except the value of *expression* is pretty-" "printed using the :mod:`pprint` module." @@ -895,26 +904,26 @@ msgstr "" "與 :pdbcmd:`p` 命令類似,除了 *expression* 的值是使用 :mod:`pprint` 模組美化" "後印出來的。" -#: ../../library/pdb.rst:521 +#: ../../library/pdb.rst:530 msgid "Print the type of *expression*." msgstr "印出 *expression* 的型別。" -#: ../../library/pdb.rst:525 +#: ../../library/pdb.rst:534 msgid "Try to get source code of *expression* and display it." msgstr "嘗試獲取 *expression* 的原始碼並顯示它。" -#: ../../library/pdb.rst:531 +#: ../../library/pdb.rst:540 msgid "" "Display the value of *expression* if it changed, each time execution stops " "in the current frame." msgstr "每次在當前 frame 中停止執行時,顯示 *expression* 的值(如果有變更)。" -#: ../../library/pdb.rst:534 +#: ../../library/pdb.rst:543 msgid "" "Without *expression*, list all display expressions for the current frame." msgstr "如果不帶有 *expression*,則列出當前 frame 的所有運算式。" -#: ../../library/pdb.rst:538 +#: ../../library/pdb.rst:547 msgid "" "Display evaluates *expression* and compares to the result of the previous " "evaluation of *expression*, so when the result is mutable, display may not " @@ -923,11 +932,11 @@ msgstr "" "display 會對 *expression* 求值並將結果與之前 *expression* 的求值結果進行比" "較,因此當結果可變時,display 可能無法獲取其變更。" -#: ../../library/pdb.rst:542 ../../library/pdb.rst:692 +#: ../../library/pdb.rst:551 ../../library/pdb.rst:701 msgid "Example::" msgstr "範例如下: ::" -#: ../../library/pdb.rst:544 +#: ../../library/pdb.rst:553 msgid "" "lst = []\n" "breakpoint()\n" @@ -941,15 +950,15 @@ msgstr "" "lst.append(1)\n" "print(lst)" -#: ../../library/pdb.rst:550 +#: ../../library/pdb.rst:559 msgid "" "Display won't realize ``lst`` has been changed because the result of " "evaluation is modified in place by ``lst.append(1)`` before being compared::" msgstr "" -"display 不會意識到 ``lst`` 已更改,因為其求值結果在比較之前已被 " -"``lst.append(1)`` 原地 (in place) 修改: ::" +"display 不會意識到 ``lst`` 已更改,因為其求值結果在比較之前已被 ``lst." +"append(1)`` 原地 (in place) 修改: ::" -#: ../../library/pdb.rst:553 +#: ../../library/pdb.rst:562 msgid "" "> example.py(3)()\n" "-> pass\n" @@ -975,11 +984,11 @@ msgstr "" "-> print(lst)\n" "(Pdb)" -#: ../../library/pdb.rst:565 +#: ../../library/pdb.rst:574 msgid "You can do some tricks with copy mechanism to make it work::" msgstr "你可以運用複製機制的一些技巧來使其能夠運作: ::" -#: ../../library/pdb.rst:567 +#: ../../library/pdb.rst:576 msgid "" "> example.py(3)()\n" "-> pass\n" @@ -1007,7 +1016,7 @@ msgstr "" "display lst[:]: [1] [old: []]\n" "(Pdb)" -#: ../../library/pdb.rst:584 +#: ../../library/pdb.rst:593 msgid "" "Do not display *expression* anymore in the current frame. Without " "*expression*, clear all display expressions for the current frame." @@ -1015,7 +1024,7 @@ msgstr "" "不再顯示當前 frame 中的 *expression*。如果不帶有 *expression*,則清除當前 " "frame 的所有顯示運算式。" -#: ../../library/pdb.rst:591 +#: ../../library/pdb.rst:600 msgid "" "Start an interactive interpreter (using the :mod:`code` module) in a new " "global namespace initialised from the local and global namespaces for the " @@ -1026,7 +1035,7 @@ msgstr "" "(使用 :mod:`code` 模組)。可使用 ``exit()`` 或 ``quit()`` 退出直譯器並回到偵" "錯器。" -#: ../../library/pdb.rst:598 +#: ../../library/pdb.rst:607 msgid "" "As ``interact`` creates a new dedicated namespace for code execution, " "assignments to variables will not affect the original namespaces. However, " @@ -1037,20 +1046,20 @@ msgstr "" "影響原始命名空間,但是對任何被參照的可變物件的修改將像往常一樣反映在原始命名" "空間中。" -#: ../../library/pdb.rst:605 +#: ../../library/pdb.rst:614 msgid "" "``exit()`` and ``quit()`` can be used to exit the :pdbcmd:`interact` command." msgstr "``exit()`` 和 ``quit()`` 可用來退出 :pdbcmd:`interact` 命令。" -#: ../../library/pdb.rst:609 +#: ../../library/pdb.rst:618 msgid "" ":pdbcmd:`interact` directs its output to the debugger's output channel " "rather than :data:`sys.stderr`." msgstr "" -":pdbcmd:`interact` 將其輸出導向到偵錯器的輸出通道 (output channel),而不" -"是 :data:`sys.stderr`。" +":pdbcmd:`interact` 將其輸出導向到偵錯器的輸出通道 (output channel),而不是 :" +"data:`sys.stderr`。" -#: ../../library/pdb.rst:617 +#: ../../library/pdb.rst:626 msgid "" "Create an alias called *name* that executes *command*. The *command* must " "*not* be enclosed in quotes. Replaceable parameters can be indicated by " @@ -1063,7 +1072,7 @@ msgstr "" "有參數替換。如果省略 *command*,則顯示 *name* 的目前別名。如果未給定引數,則" "列出所有別名。" -#: ../../library/pdb.rst:623 +#: ../../library/pdb.rst:632 msgid "" "Aliases may be nested and can contain anything that can be legally typed at " "the pdb prompt. Note that internal pdb commands *can* be overridden by " @@ -1075,14 +1084,14 @@ msgstr "" "部 pdb 命令\\ *可以*\\ 被別名所覆蓋。這樣的命令在別名被移除前都將被隱藏。別名" "會遞迴地應用到命令列的第一個單詞;該列內的其他單詞則不會受影響。" -#: ../../library/pdb.rst:629 +#: ../../library/pdb.rst:638 msgid "" -"As an example, here are two useful aliases (especially when placed in " -"the :file:`.pdbrc` file)::" +"As an example, here are two useful aliases (especially when placed in the :" +"file:`.pdbrc` file)::" msgstr "" "作為範例,這裡列出了兩個有用的別名(特別是放在 :file:`.pdbrc` 檔案中時): ::" -#: ../../library/pdb.rst:632 +#: ../../library/pdb.rst:641 msgid "" "# Print instance variables (usage \"pi classInst\")\n" "alias pi for k in %1.__dict__.keys(): print(f\"%1.{k} = {%1.__dict__[k]}\")\n" @@ -1094,11 +1103,11 @@ msgstr "" "# 印出 self 中的實例變數\n" "alias ps pi self" -#: ../../library/pdb.rst:639 +#: ../../library/pdb.rst:648 msgid "Delete the specified alias *name*." msgstr "刪除指定的別名 *name*。" -#: ../../library/pdb.rst:643 +#: ../../library/pdb.rst:652 msgid "" "Execute the (one-line) *statement* in the context of the current stack " "frame. The exclamation point can be omitted unless the first word of the " @@ -1107,7 +1116,7 @@ msgstr "" "在當前 stack frame 的情境中執行(單列)\\ *statement*。除非陳述式的第一個單詞" "類似於偵錯器命令,否則可以省略驚嘆號,例如:" -#: ../../library/pdb.rst:647 +#: ../../library/pdb.rst:656 msgid "" "(Pdb) ! n=42\n" "(Pdb)" @@ -1115,15 +1124,15 @@ msgstr "" "(Pdb) ! n=42\n" "(Pdb)" -#: ../../library/pdb.rst:652 +#: ../../library/pdb.rst:661 msgid "" -"To set a global variable, you can prefix the assignment command with " -"a :keyword:`global` statement on the same line, e.g.:" +"To set a global variable, you can prefix the assignment command with a :" +"keyword:`global` statement on the same line, e.g.:" msgstr "" "要設定全域變數,你可以在同一列的賦值命令前面加上 :keyword:`global` 陳述式,例" "如:" -#: ../../library/pdb.rst:655 +#: ../../library/pdb.rst:664 msgid "" "(Pdb) global list_options; list_options = ['-l']\n" "(Pdb)" @@ -1131,22 +1140,22 @@ msgstr "" "(Pdb) global list_options; list_options = ['-l']\n" "(Pdb)" -#: ../../library/pdb.rst:663 +#: ../../library/pdb.rst:672 msgid "" "Restart the debugged Python program. If *args* is supplied, it is split " "with :mod:`shlex` and the result is used as the new :data:`sys.argv`. " -"History, breakpoints, actions and debugger options are " -"preserved. :pdbcmd:`restart` is an alias for :pdbcmd:`run`." +"History, breakpoints, actions and debugger options are preserved. :pdbcmd:" +"`restart` is an alias for :pdbcmd:`run`." msgstr "" "重新啟動已偵錯完畢的 Python 程式。如果提供了 *args*,它將以 :mod:`shlex` 分" "割,並將結果用作新的 :data:`sys.argv`。歷史記錄、斷點、操作和偵錯器選項均會被" "保留。:pdbcmd:`restart` 是 :pdbcmd:`run` 的別名。" -#: ../../library/pdb.rst:670 +#: ../../library/pdb.rst:679 msgid "Quit from the debugger. The program being executed is aborted." msgstr "離開偵錯器,執行中的程式會被中止。" -#: ../../library/pdb.rst:674 +#: ../../library/pdb.rst:683 msgid "" "Enter a recursive debugger that steps through *code* (which is an arbitrary " "expression or statement to be executed in the current environment)." @@ -1154,26 +1163,27 @@ msgstr "" "進入一個遞迴偵錯器,逐步執行 *code*\\ (這是要在當前環境中執行的任意運算式或" "陳述式)。" -#: ../../library/pdb.rst:680 +#: ../../library/pdb.rst:689 msgid "Print the return value for the last return of the current function." msgstr "印出當前函式最後一次回傳的回傳值。" -#: ../../library/pdb.rst:684 +#: ../../library/pdb.rst:693 msgid "List or jump between chained exceptions." msgstr "列出鏈接例外 (chained exceptions),或在其間跳轉。" -#: ../../library/pdb.rst:686 +#: ../../library/pdb.rst:695 +#, fuzzy msgid "" "When using ``pdb.pm()`` or ``Pdb.post_mortem(...)`` with a chained " "exception instead of a traceback, it allows the user to move between the " "chained exceptions using ``exceptions`` command to list exceptions, and " -"``exception `` to switch to that exception." +"``exceptions `` to switch to that exception." msgstr "" "當使用 ``pdb.pm()`` 或 ``Pdb.post_mortem(...)`` 於鏈接例外而不是回溯時,它允" "許使用者在鏈接例外之間移動,使用 ``exceptions`` 命令以列出例外,並使用 " "``exception `` 切換到該例外。" -#: ../../library/pdb.rst:694 +#: ../../library/pdb.rst:703 msgid "" "def out():\n" " try:\n" @@ -1209,11 +1219,11 @@ msgstr "" "\n" " out()" -#: ../../library/pdb.rst:711 +#: ../../library/pdb.rst:720 msgid "calling ``pdb.pm()`` will allow to move between exceptions::" msgstr "呼叫 ``pdb.pm()`` 將允許在例外之間移動: ::" -#: ../../library/pdb.rst:713 +#: ../../library/pdb.rst:722 msgid "" "> example.py(5)out()\n" "-> raise ValueError(\"reraise middle() error\") from e\n" @@ -1247,11 +1257,11 @@ msgstr "" "> example.py(10)middle()\n" "-> return inner(0)" -#: ../../library/pdb.rst:732 +#: ../../library/pdb.rst:741 msgid "Footnotes" msgstr "註腳" -#: ../../library/pdb.rst:733 +#: ../../library/pdb.rst:742 msgid "" "Whether a frame is considered to originate in a certain module is determined " "by the ``__name__`` in the frame globals." @@ -1279,18 +1289,21 @@ msgstr "bdb" msgid "cmd" msgstr "cmd" -#: ../../library/pdb.rst:297 +#: ../../library/pdb.rst:306 msgid ".pdbrc" msgstr ".pdbrc" -#: ../../library/pdb.rst:297 +#: ../../library/pdb.rst:306 msgid "file" msgstr "file(檔案)" -#: ../../library/pdb.rst:297 +#: ../../library/pdb.rst:306 msgid "debugger" msgstr "debugger(偵錯器)" -#: ../../library/pdb.rst:297 +#: ../../library/pdb.rst:306 msgid "configuration" msgstr "configuration(設定)" + +#~ msgid "python -m pdb myscript.py" +#~ msgstr "python -m pdb myscript.py" diff --git a/library/persistence.po b/library/persistence.po index b655269a25..7e6edefbbd 100644 --- a/library/persistence.po +++ b/library/persistence.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -30,6 +29,10 @@ msgid "" "objects from the bytes. The various DBM-related modules support a family of " "hash-based file formats that store a mapping of strings to other strings." msgstr "" +"本章節所描述的模組支援將 Python 資料以持久形式儲存在磁碟上。:mod:`pickle` " +"和 :mod:`marshal` 模組可以將許多 Python 資料型別轉換為位元串流,然後再從位元" +"串流重建物件。各種與 DBM 有關的模組支援一系列基於雜湊的檔案格式,用來儲存字串" +"對字串的對映。" #: ../../library/persistence.rst:13 msgid "The list of modules described in this chapter is:" diff --git a/library/pickle.po b/library/pickle.po index 111cb91b47..2cc7605765 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -39,9 +39,9 @@ msgid "" "The :mod:`pickle` module implements binary protocols for serializing and de-" "serializing a Python object structure. *\"Pickling\"* is the process " "whereby a Python object hierarchy is converted into a byte stream, and " -"*\"unpickling\"* is the inverse operation, whereby a byte stream (from a :" -"term:`binary file` or :term:`bytes-like object`) is converted back into an " -"object hierarchy. Pickling (and unpickling) is alternatively known as " +"*\"unpickling\"* is the inverse operation, whereby a byte stream (from " +"a :term:`binary file` or :term:`bytes-like object`) is converted back into " +"an object hierarchy. Pickling (and unpickling) is alternatively known as " "\"serialization\", \"marshalling,\" [#]_ or \"flattening\"; however, to " "avoid confusion, the terms used here are \"pickling\" and \"unpickling\"." msgstr "" @@ -92,12 +92,12 @@ msgstr "和 ``marshal`` 的比較" msgid "" "Python has a more primitive serialization module called :mod:`marshal`, but " "in general :mod:`pickle` should always be the preferred way to serialize " -"Python objects. :mod:`marshal` exists primarily to support Python's :file:`." -"pyc` files." +"Python objects. :mod:`marshal` exists primarily to support " +"Python's :file:`.pyc` files." msgstr "" "Python 有另一個比較原始的序列化模組叫 :mod:`marshal`,不過其設計目的是為了支" -"援 Python 的預編譯功能 :file:`.pyc` 的運作。總地來說,請盡可能地使用 :mod:" -"`pickle`,沒事不要用 :mod:`marshal`。" +"援 Python 的預編譯功能 :file:`.pyc` 的運作。總地來說,請盡可能地使" +"用 :mod:`pickle`,沒事不要用 :mod:`marshal`。" #: ../../library/pickle.rst:57 msgid "" @@ -128,9 +128,9 @@ msgid "" msgstr "" "這對遞迴物件和物件共用都有影響。遞迴物件是指包含自我參照的物件。這些情況在 " "marshal 模組中不會被處理,若嘗試使用 marshal 處理遞迴物件會導致 Python 直譯器" -"崩潰。物件共用發生在序列化的物件階層中、不同位置對同一物件有多個參照時。:mod:" -"`pickle` 只會儲存這個被參照的物件一次,並確保所有其他參照指向這個主要的版本。" -"共用的物件會保持共用,這對於可變(mutable)物件來說非常重要。" +"崩潰。物件共用發生在序列化的物件階層中、不同位置對同一物件有多個參照" +"時。:mod:`pickle` 只會儲存這個被參照的物件一次,並確保所有其他參照指向這個主" +"要的版本。共用的物件會保持共用,這對於可變(mutable)物件來說非常重要。" #: ../../library/pickle.rst:72 msgid "" @@ -146,14 +146,14 @@ msgstr "" #: ../../library/pickle.rst:77 msgid "" "The :mod:`marshal` serialization format is not guaranteed to be portable " -"across Python versions. Because its primary job in life is to support :file:" -"`.pyc` files, the Python implementers reserve the right to change the " -"serialization format in non-backwards compatible ways should the need arise. " -"The :mod:`pickle` serialization format is guaranteed to be backwards " -"compatible across Python releases provided a compatible pickle protocol is " -"chosen and pickling and unpickling code deals with Python 2 to Python 3 type " -"differences if your data is crossing that unique breaking change language " -"boundary." +"across Python versions. Because its primary job in life is to " +"support :file:`.pyc` files, the Python implementers reserve the right to " +"change the serialization format in non-backwards compatible ways should the " +"need arise. The :mod:`pickle` serialization format is guaranteed to be " +"backwards compatible across Python releases provided a compatible pickle " +"protocol is chosen and pickling and unpickling code deals with Python 2 to " +"Python 3 type differences if your data is crossing that unique breaking " +"change language boundary." msgstr "" ":mod:`marshal` 序列化格式無法保證能在不同版本的 Python 之間移植。因為其主要的" "作用是支援 :file:`.pyc` 檔案的運作,Python 的實作人員會在需要時實作無法前向相" @@ -205,8 +205,8 @@ msgid "" "JSON, by default, can only represent a subset of the Python built-in types, " "and no custom classes; pickle can represent an extremely large number of " "Python types (many of them automatically, by clever usage of Python's " -"introspection facilities; complex cases can be tackled by implementing :ref:" -"`specific object APIs `);" +"introspection facilities; complex cases can be tackled by " +"implementing :ref:`specific object APIs `);" msgstr "" "預設狀態下的 JSON 只能紀錄一小部份的 Python 內建型別,且無法紀錄自訂類別;但" "透過 Python 的自省措施,pickle 可以紀錄絕大多數的 Python 型別(其他比較複雜的" @@ -258,8 +258,9 @@ msgid "" "generated by :mod:`pickle`. :mod:`pickletools` source code has extensive " "comments about opcodes used by pickle protocols." msgstr "" -":mod:`pickletools` 含有工具可分析 :mod:`pickle` 所產生的資料流。:mod:" -"`pickletools` 的源始碼詳細地記載了所有 pickle 協定的操作碼(opcode)。" +":mod:`pickletools` 含有工具可分析 :mod:`pickle` 所產生的資料" +"流。:mod:`pickletools` 的源始碼詳細地記載了所有 pickle 協定的操作碼" +"(opcode)。" #: ../../library/pickle.rst:139 msgid "" @@ -295,9 +296,9 @@ msgstr "" #: ../../library/pickle.rst:153 msgid "" -"Protocol version 3 was added in Python 3.0. It has explicit support for :" -"class:`bytes` objects and cannot be unpickled by Python 2.x. This was the " -"default protocol in Python 3.0--3.7." +"Protocol version 3 was added in Python 3.0. It has explicit support " +"for :class:`bytes` objects and cannot be unpickled by Python 2.x. This was " +"the default protocol in Python 3.0--3.7." msgstr "" "版本 3 的協定在 Python 3.0 被新增。現在能支援封裝 :class:`bytes` 的物件且無法" "被 2.x 版本的 Python 拆封。在 3.0~3.7 的 Python 預設使用 3 版協定。" @@ -331,9 +332,9 @@ msgstr "" # persistence-layer/ #: ../../library/pickle.rst:168 msgid "" -"Serialization is a more primitive notion than persistence; although :mod:" -"`pickle` reads and writes file objects, it does not handle the issue of " -"naming persistent objects, nor the (even more complicated) issue of " +"Serialization is a more primitive notion than persistence; " +"although :mod:`pickle` reads and writes file objects, it does not handle the " +"issue of naming persistent objects, nor the (even more complicated) issue of " "concurrent access to persistent objects. The :mod:`pickle` module can " "transform a complex object into a byte stream and it can transform the byte " "stream into an object with the same internal structure. Perhaps the most " @@ -357,15 +358,15 @@ msgstr "模組介面" #: ../../library/pickle.rst:183 msgid "" "To serialize an object hierarchy, you simply call the :func:`dumps` " -"function. Similarly, to de-serialize a data stream, you call the :func:" -"`loads` function. However, if you want more control over serialization and " -"de-serialization, you can create a :class:`Pickler` or an :class:`Unpickler` " -"object, respectively." +"function. Similarly, to de-serialize a data stream, you call " +"the :func:`loads` function. However, if you want more control over " +"serialization and de-serialization, you can create a :class:`Pickler` or " +"an :class:`Unpickler` object, respectively." msgstr "" "想要序列化一個物件,你只需要呼叫 :func:`dumps` 函式。而當你想要去序列化一個資" "料流時,你只需要呼叫 :func:`loads` 即可。不過,若你希望能各自對序列化和去序列" -"化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` 或 :class:" -"`Unpickler` 物件。" +"化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` " +"或 :class:`Unpickler` 物件。" #: ../../library/pickle.rst:188 msgid "The :mod:`pickle` module provides the following constants:" @@ -374,12 +375,13 @@ msgstr ":mod:`pickle` 模組提供以下常數:" #: ../../library/pickle.rst:193 msgid "" "An integer, the highest :ref:`protocol version ` " -"available. This value can be passed as a *protocol* value to functions :" -"func:`dump` and :func:`dumps` as well as the :class:`Pickler` constructor." +"available. This value can be passed as a *protocol* value to " +"functions :func:`dump` and :func:`dumps` as well as the :class:`Pickler` " +"constructor." msgstr "" "一個整數,表示可使用的最高\\ :ref:`協定版本 `。這個值可作" -"為 *protocol* 的數值傳給 :func:`dump` 和 :func:`dumps` 函式以及 :class:" -"`Pickler` 建構式。" +"為 *protocol* 的數值傳給 :func:`dump` 和 :func:`dumps` 函式以" +"及 :class:`Pickler` 建構式。" #: ../../library/pickle.rst:200 msgid "" @@ -419,8 +421,8 @@ msgid "" "Arguments *file*, *protocol*, *fix_imports* and *buffer_callback* have the " "same meaning as in the :class:`Pickler` constructor." msgstr "" -"引數 *file*、*protocol*、*fix_imports* 和 *buffer_callback* 的意義與 :class:" -"`Pickler` 建構式中的相同。" +"引數 *file*、*protocol*、*fix_imports* 和 *buffer_callback* 的意義" +"與 :class:`Pickler` 建構式中的相同。" #: ../../library/pickle.rst:225 ../../library/pickle.rst:236 #: ../../library/pickle.rst:328 @@ -440,8 +442,8 @@ msgid "" "Arguments *protocol*, *fix_imports* and *buffer_callback* have the same " "meaning as in the :class:`Pickler` constructor." msgstr "" -"引數 *protocol*、*fix_imports* 和 *buffer_callback* 的意義和 :class:" -"`Pickler` 建構式中的相同。" +"引數 *protocol*、*fix_imports* 和 *buffer_callback* 的意義" +"和 :class:`Pickler` 建構式中的相同。" #: ../../library/pickle.rst:241 msgid "" @@ -487,8 +489,8 @@ msgid "" "Arguments *fix_imports*, *encoding*, *errors*, *strict* and *buffers* have " "the same meaning as in the :class:`Unpickler` constructor." msgstr "" -"引數 *fix_imports*、*encoding*、*errors*、*strict* 和 *buffers* 的意義與 :" -"class:`Unpickler` 建構式所用的相同。" +"引數 *fix_imports*、*encoding*、*errors*、*strict* 和 *buffers* 的意義" +"與 :class:`Unpickler` 建構式所用的相同。" #: ../../library/pickle.rst:271 msgid "The :mod:`pickle` module defines three exceptions:" @@ -496,8 +498,8 @@ msgstr ":mod:`pickle` 模組定義了以下三種例外:" #: ../../library/pickle.rst:275 msgid "" -"Common base class for the other pickling exceptions. It inherits from :exc:" -"`Exception`." +"Common base class for the other pickling exceptions. It inherits " +"from :exc:`Exception`." msgstr "" "繼承 :exc:`Exception` 類別。一個在封裝或拆封時遭遇其他例外時通用的基底類別。" @@ -520,8 +522,8 @@ msgid "" "Error raised when there is a problem unpickling an object, such as a data " "corruption or a security violation. It inherits from :exc:`PickleError`." msgstr "" -"拆封物件時遇到問題(如資料毀損或違反安全性原則等)所引發的意外。繼承自 :exc:" -"`PickleError` 類別。" +"拆封物件時遇到問題(如資料毀損或違反安全性原則等)所引發的意外。繼承" +"自 :exc:`PickleError` 類別。" #: ../../library/pickle.rst:291 msgid "" @@ -534,11 +536,11 @@ msgstr "" #: ../../library/pickle.rst:296 msgid "" -"The :mod:`pickle` module exports three classes, :class:`Pickler`, :class:" -"`Unpickler` and :class:`PickleBuffer`:" +"The :mod:`pickle` module exports three " +"classes, :class:`Pickler`, :class:`Unpickler` and :class:`PickleBuffer`:" msgstr "" -"引入模組 :mod:`pickle` 時會帶來三個類別::class:`Pickler`、:class:" -"`Unpickler` 和 :class:`PickleBuffer`:" +"引入模組 :mod:`pickle` 時會帶來三個類" +"別::class:`Pickler`、:class:`Unpickler` 和 :class:`PickleBuffer`:" #: ../../library/pickle.rst:301 msgid "This takes a binary file for writing a pickle data stream." @@ -552,14 +554,15 @@ msgid "" "number is specified, :data:`HIGHEST_PROTOCOL` is selected." msgstr "" "可選引數 *protocol* 接受整數,用來要求封裝器(pickler)使用指定的協定;支援" -"從 0 版起到 :data:`HIGHEST_PROTOCOL` 版的協定。如未指定,則預設為 :data:" -"`DEFAULT_PROTOCOL`。若指定了負數,則視為選擇 :data:`HIGHEST_PROTOCOL`。" +"從 0 版起到 :data:`HIGHEST_PROTOCOL` 版的協定。如未指定,則預設" +"為 :data:`DEFAULT_PROTOCOL`。若指定了負數,則視為選" +"擇 :data:`HIGHEST_PROTOCOL`。" #: ../../library/pickle.rst:308 msgid "" "The *file* argument must have a write() method that accepts a single bytes " -"argument. It can thus be an on-disk file opened for binary writing, an :" -"class:`io.BytesIO` instance, or any other custom object that meets this " +"argument. It can thus be an on-disk file opened for binary writing, " +"an :class:`io.BytesIO` instance, or any other custom object that meets this " "interface." msgstr "" "引數 *file* 必須支援可寫入單一位元組引數的 write() 方法。只要滿足此條件,傳入" @@ -639,8 +642,8 @@ msgstr "關於細節與用法範例請見 :ref:`pickle-persistent`。" #: ../../library/pickle.rst:348 msgid "" -"Add the default implementation of this method in the C implementation of :" -"class:`!Pickler`." +"Add the default implementation of this method in the C implementation " +"of :class:`!Pickler`." msgstr "在 C 的 :class:`!Pickler` 實作中的增加了這個方法的預設實作。" # SkyLull: [T] @@ -666,12 +669,12 @@ msgstr "" #: ../../library/pickle.rst:362 msgid "" "By default, a pickler object will not have a :attr:`dispatch_table` " -"attribute, and it will instead use the global dispatch table managed by the :" -"mod:`copyreg` module. However, to customize the pickling for a specific " +"attribute, and it will instead use the global dispatch table managed by " +"the :mod:`copyreg` module. However, to customize the pickling for a specific " "pickler object one can set the :attr:`dispatch_table` attribute to a dict-" -"like object. Alternatively, if a subclass of :class:`Pickler` has a :attr:" -"`dispatch_table` attribute then this will be used as the default dispatch " -"table for instances of that class." +"like object. Alternatively, if a subclass of :class:`Pickler` has " +"a :attr:`dispatch_table` attribute then this will be used as the default " +"dispatch table for instances of that class." msgstr "" "預設情況下,封裝器(pickler)物件不會有 :attr:`dispatch_table` 屬性,而是會使" "用由 :mod:`copyreg` 模組管理的全域調度表。不過,若要自訂某個封裝器(pickler)" @@ -688,14 +691,14 @@ msgid "" "Special reducer that can be defined in :class:`Pickler` subclasses. This " "method has priority over any reducer in the :attr:`dispatch_table`. It " "should conform to the same interface as a :meth:`~object.__reduce__` method, " -"and can optionally return :data:`NotImplemented` to fallback on :attr:" -"`dispatch_table`-registered reducers to pickle ``obj``." +"and can optionally return :data:`NotImplemented` to fallback " +"on :attr:`dispatch_table`-registered reducers to pickle ``obj``." msgstr "" "一個可以在 :class:`Pickler` 子類別中被定義的縮減器(reducer)。這個方法的優先" -"度高於任何其他 :attr:`分派表 ` 中的縮減器。他應該要有和 :" -"meth:`~object.__reduce__` 方法相同的函式介面,且可以可選地回傳 :data:" -"`NotImplemented` 以退回(fallback)使用 :attr:`分派表 ` 中登" -"錄的縮減方法來封裝 ``obj``。" +"度高於任何其他 :attr:`分派表 ` 中的縮減器。他應該要有" +"和 :meth:`~object.__reduce__` 方法相同的函式介面,且可以可選地回" +"傳 :data:`NotImplemented` 以退回(fallback)使用 :attr:`分派表 " +"` 中登錄的縮減方法來封裝 ``obj``。" #: ../../library/pickle.rst:383 msgid "For a detailed example, see :ref:`reducer_override`." @@ -730,15 +733,15 @@ msgstr "協定版本號會被自動偵測,所以不需要在這邊手動輸入 msgid "" "The argument *file* must have three methods, a read() method that takes an " "integer argument, a readinto() method that takes a buffer argument and a " -"readline() method that requires no arguments, as in the :class:`io." -"BufferedIOBase` interface. Thus *file* can be an on-disk file opened for " -"binary reading, an :class:`io.BytesIO` object, or any other custom object " -"that meets this interface." +"readline() method that requires no arguments, as in " +"the :class:`io.BufferedIOBase` interface. Thus *file* can be an on-disk " +"file opened for binary reading, an :class:`io.BytesIO` object, or any other " +"custom object that meets this interface." msgstr "" "參數 *file* 必須擁有三個方法,分別是接受整數作為引數的 read() 方法、接受緩衝" -"區作為引數的 readinto() 方法以及不需要引數的 readline() 方法,如同在 :class:" -"`io.BufferedIOBase` 的介面一樣。因此,*file* 可以是一個以二進位讀取模式開啟的" -"檔案、一個 :class:`io.BytesIO` 物件、或任何符合此介面的自訂物件。" +"區作為引數的 readinto() 方法以及不需要引數的 readline() 方法,如同" +"在 :class:`io.BufferedIOBase` 的介面一樣。因此,*file* 可以是一個以二進位讀取" +"模式開啟的檔案、一個 :class:`io.BytesIO` 物件、或任何符合此介面的自訂物件。" #: ../../library/pickle.rst:412 msgid "" @@ -749,18 +752,18 @@ msgid "" "decode 8-bit string instances pickled by Python 2; these default to 'ASCII' " "and 'strict', respectively. The *encoding* can be 'bytes' to read these 8-" "bit string instances as bytes objects. Using ``encoding='latin1'`` is " -"required for unpickling NumPy arrays and instances of :class:`~datetime." -"datetime`, :class:`~datetime.date` and :class:`~datetime.time` pickled by " -"Python 2." +"required for unpickling NumPy arrays and instances " +"of :class:`~datetime.datetime`, :class:`~datetime.date` " +"and :class:`~datetime.time` pickled by Python 2." msgstr "" "可選引數 *fix_imports*、*encoding* 和 *errors* 用來控制 Python 2 pickle 資料" "的相容性支援。如果 *fix_imports* 為 true,則 pickle 模組會嘗試將舊的 Python " "2 模組名稱映射到 Python 3 中使用的新名稱。*encoding* 和 *errors* 告訴 pickle " "模組如何解碼由 Python 2 pickle 封裝的 8 位元字串實例;*encoding* 和 *errors* " "預設分別為 'ASCII' 和 'strict'。*encoding* 可以設定為 'bytes' 以將這些 8 位元" -"字串實例讀為位元組物件。而由 Python 2 封裝的 NumPy 陣列、:class:`~datetime." -"datetime`、:class:`~datetime.date` 和 :class:`~datetime.time` 的實例則必須使" -"用 ``encoding='latin1'`` 來拆封。" +"字串實例讀為位元組物件。而由 Python 2 封裝的 NumPy 陣" +"列、:class:`~datetime.datetime`、:class:`~datetime.date` " +"和 :class:`~datetime.time` 的實例則必須使用 ``encoding='latin1'`` 來拆封。" #: ../../library/pickle.rst:423 msgid "" @@ -801,17 +804,17 @@ msgstr "預設會引發 :exc:`UnpicklingError` 例外。" #: ../../library/pickle.rst:447 msgid "" "If defined, :meth:`persistent_load` should return the object specified by " -"the persistent ID *pid*. If an invalid persistent ID is encountered, an :" -"exc:`UnpicklingError` should be raised." +"the persistent ID *pid*. If an invalid persistent ID is encountered, " +"an :exc:`UnpicklingError` should be raised." msgstr "" -"若有定義 :meth:`persistent_load`,則其將回傳符合持久化識別碼 `pid` 的物件。如" +"若有定義,則 :meth:`persistent_load` 將回傳符合持久化識別碼 *pid* 的物件。如" "果遭遇了無效的持久化識別碼,則會引發 :exc:`UnpicklingError`。" #: ../../library/pickle.rst:453 msgid "" -"Add the default implementation of this method in the C implementation of :" -"class:`!Unpickler`." -msgstr "" +"Add the default implementation of this method in the C implementation " +"of :class:`!Unpickler`." +msgstr "在 C 的 :class:`!Unpickler` 實作中的增加了這個方法的預設實作。" #: ../../library/pickle.rst:459 msgid "" @@ -820,15 +823,15 @@ msgid "" "unlike its name suggests, :meth:`find_class` is also used for finding " "functions." msgstr "" -"如有需要將引入 *module* ,並從中回傳名為 *name* 的物件,這裡的 *module* 和 " -"*name* 引數接受的輸入是 :class:`str` 物件。注意,雖然名稱上看起來不像,但 :" -"meth:`find_class` 亦可被用於尋找其他函式。" +"如有需要將引入 *module*,並從中回傳名為 *name* 的物件,這裡的 *module* 和 " +"*name* 引數接受的輸入是 :class:`str` 物件。注意,雖然名稱上看起來不像," +"但 :meth:`find_class` 亦可被用於尋找其他函式。" #: ../../library/pickle.rst:464 msgid "" "Subclasses may override this to gain control over what type of objects and " -"how they can be loaded, potentially reducing security risks. Refer to :ref:" -"`pickle-restrict` for details." +"how they can be loaded, potentially reducing security risks. Refer " +"to :ref:`pickle-restrict` for details." msgstr "" "子類別可以覆寫此方法以控制可以載入哪些類型的物件、以及如何載入它們,從而潛在" "地降低安全性風險。詳情請參考\\ :ref:`pickle-restrict`。" @@ -842,13 +845,13 @@ msgstr "" "``pickle.find_class``。" # SkyLull: [T] -# 參見 #729 +# 參見 #729 # wrapper -> 包裝器 #: ../../library/pickle.rst:472 msgid "" -"A wrapper for a buffer representing picklable data. *buffer* must be a :ref:" -"`buffer-providing ` object, such as a :term:`bytes-like " -"object` or a N-dimensional array." +"A wrapper for a buffer representing picklable data. *buffer* must be " +"a :ref:`buffer-providing ` object, such as a :term:`bytes-" +"like object` or a N-dimensional array." msgstr "" "一個表示了含有可封裝資料緩衝區的包裝函式(wrapper function)。*buffer* 必須是" "一個 :ref:`提供緩衝區 ` 的物件,例如一個 :term:`類位元組物件 " @@ -857,8 +860,8 @@ msgstr "" #: ../../library/pickle.rst:476 msgid "" ":class:`PickleBuffer` is itself a buffer provider, therefore it is possible " -"to pass it to other APIs expecting a buffer-providing object, such as :class:" -"`memoryview`." +"to pass it to other APIs expecting a buffer-providing object, such " +"as :class:`memoryview`." msgstr "" ":class:`PickleBuffer` 本身就是一個提供緩衝區的物件,所以是能夠將其提供給其它" "「預期收到含有緩衝物件的 API」的,比如 :class:`memoryview`。" @@ -902,11 +905,11 @@ msgstr "下列型別可以被封裝:" #: ../../library/pickle.rst:505 msgid "" -"built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, and :data:" -"`NotImplemented`);" +"built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, " +"and :data:`NotImplemented`);" msgstr "" -"內建常數(``None``、``True``、``False``、``Ellipsis`` 和 :data:" -"`NotImplemented`);" +"內建常數(``None``、``True``、``False``、``Ellipsis`` " +"和 :data:`NotImplemented`);" #: ../../library/pickle.rst:508 msgid "integers, floating-point numbers, complex numbers;" @@ -926,8 +929,8 @@ msgid "" "functions (built-in and user-defined) accessible from the top level of a " "module (using :keyword:`def`, not :keyword:`lambda`);" msgstr "" -"在模組最表面的層級就能被存取的函式(內建或自訂的皆可,不過僅限使用 :keyword:" -"`def` 定義的函式,:keyword:`lambda` 函式不適用);" +"在模組最表面的層級就能被存取的函式(內建或自訂的皆可,不過僅限使" +"用 :keyword:`def` 定義的函式,:keyword:`lambda` 函式不適用);" #: ../../library/pickle.rst:517 msgid "classes accessible from the top level of a module;" @@ -935,8 +938,9 @@ msgstr "在模組最表面的層級就能被存取的類別;" #: ../../library/pickle.rst:519 msgid "" -"instances of such classes whose the result of calling :meth:`~object." -"__getstate__` is picklable (see section :ref:`pickle-inst` for details)." +"instances of such classes whose the result of " +"calling :meth:`~object.__getstate__` is picklable (see section :ref:`pickle-" +"inst` for details)." msgstr "" "實例,只要在呼叫了 :meth:`~object.__getstate__` 後其回傳值全都是可封裝物件。" "(詳情請參閱 :ref:`pickle-inst`)。" @@ -946,9 +950,9 @@ msgid "" "Attempts to pickle unpicklable objects will raise the :exc:`PicklingError` " "exception; when this happens, an unspecified number of bytes may have " "already been written to the underlying file. Trying to pickle a highly " -"recursive data structure may exceed the maximum recursion depth, a :exc:" -"`RecursionError` will be raised in this case. You can carefully raise this " -"limit with :func:`sys.setrecursionlimit`." +"recursive data structure may exceed the maximum recursion depth, " +"a :exc:`RecursionError` will be raised in this case. You can carefully " +"raise this limit with :func:`sys.setrecursionlimit`." msgstr "" "嘗試封裝無法封裝的物件會引發 :exc:`PicklingError` 例外;注意當這種情況發生" "時,可能已經有未知數量的位元組已被寫入到檔案。嘗試封裝深度遞迴的資料結構可能" @@ -960,11 +964,11 @@ msgstr "" # qualified name -> 限定名稱 #: ../../library/pickle.rst:529 msgid "" -"Note that functions (built-in and user-defined) are pickled by fully :term:" -"`qualified name`, not by value. [#]_ This means that only the function name " -"is pickled, along with the name of the containing module and classes. " -"Neither the function's code, nor any of its function attributes are " -"pickled. Thus the defining module must be importable in the unpickling " +"Note that functions (built-in and user-defined) are pickled by " +"fully :term:`qualified name`, not by value. [#]_ This means that only the " +"function name is pickled, along with the name of the containing module and " +"classes. Neither the function's code, nor any of its function attributes " +"are pickled. Thus the defining module must be importable in the unpickling " "environment, and the module must contain the named object, otherwise an " "exception will be raised. [#]_" msgstr "" @@ -1011,8 +1015,8 @@ msgid "" "and still load objects that were created with an earlier version of the " "class. If you plan to have long-lived objects that will see many versions " "of a class, it may be worthwhile to put a version number in the objects so " -"that suitable conversions can be made by the class's :meth:`~object." -"__setstate__` method." +"that suitable conversions can be made by the " +"class's :meth:`~object.__setstate__` method." msgstr "" "同樣地,當類別實例被封裝時,它所屬類別具有的程式碼和資料不會被一起封裝。只有" "實例資料本身會被封裝。這是有意而為的,因為如此你才可以在類別中修正錯誤或新增" @@ -1036,15 +1040,16 @@ msgstr "" msgid "" "In most cases, no additional code is needed to make instances picklable. By " "default, pickle will retrieve the class and the attributes of an instance " -"via introspection. When a class instance is unpickled, its :meth:`~object." -"__init__` method is usually *not* invoked. The default behaviour first " -"creates an uninitialized instance and then restores the saved attributes. " -"The following code shows an implementation of this behaviour::" +"via introspection. When a class instance is unpickled, " +"its :meth:`~object.__init__` method is usually *not* invoked. The default " +"behaviour first creates an uninitialized instance and then restores the " +"saved attributes. The following code shows an implementation of this " +"behaviour::" msgstr "" "大部分的實例不需要額外的程式碼就已經是可封裝的了。在這樣的預設狀況中,pickle " -"模組透過自省機制來取得類別及其實例的屬性。當類別實例被拆封時,其 :meth:" -"`~object.__init__` 方法通常*不會*被呼叫。預設行為首先會建立一個未初始化的實" -"例,然後還原紀錄中的屬性。以下程式碼的實作展示了前述行為::" +"模組透過自省機制來取得類別及其實例的屬性。當類別實例被拆封時," +"其 :meth:`~object.__init__` 方法通常*不會*被呼叫。預設行為首先會建立一個未初" +"始化的實例,然後還原紀錄中的屬性。以下程式碼的實作展示了前述行為::" #: ../../library/pickle.rst:575 msgid "" @@ -1073,12 +1078,12 @@ msgstr "" #: ../../library/pickle.rst:588 msgid "" -"In protocols 2 and newer, classes that implements the :meth:" -"`__getnewargs_ex__` method can dictate the values passed to the :meth:" -"`__new__` method upon unpickling. The method must return a pair ``(args, " -"kwargs)`` where *args* is a tuple of positional arguments and *kwargs* a " -"dictionary of named arguments for constructing the object. Those will be " -"passed to the :meth:`__new__` method upon unpickling." +"In protocols 2 and newer, classes that implements " +"the :meth:`__getnewargs_ex__` method can dictate the values passed to " +"the :meth:`__new__` method upon unpickling. The method must return a pair " +"``(args, kwargs)`` where *args* is a tuple of positional arguments and " +"*kwargs* a dictionary of named arguments for constructing the object. Those " +"will be passed to the :meth:`__new__` method upon unpickling." msgstr "" "在第 2 版協定或更新的版本中,有實作 :meth:`__getnewargs_ex__` 方法的類別,可" "以決定在拆封時要傳遞給 :meth:`__new__` 方法的值。該方法必須回傳一個 ``(args, " @@ -1105,8 +1110,8 @@ msgid "" "``args`` which will be passed to the :meth:`__new__` method upon unpickling." msgstr "" "此方法與 :meth:`__getnewargs_ex__` 的目的一樣,但僅支援位置參數。它必須回傳一" -"個由傳入引數所組成的元組(tuple)\\ ``args``,這些引數會在拆封時傳遞給 :meth:" -"`__new__` 方法。" +"個由傳入引數所組成的元組(tuple)\\ ``args``,這些引數會在拆封時傳遞" +"給 :meth:`__new__` 方法。" #: ../../library/pickle.rst:610 msgid "" @@ -1117,8 +1122,8 @@ msgstr "" #: ../../library/pickle.rst:613 msgid "" -"Before Python 3.6, :meth:`__getnewargs__` was called instead of :meth:" -"`__getnewargs_ex__` in protocols 2 and 3." +"Before Python 3.6, :meth:`__getnewargs__` was called instead " +"of :meth:`__getnewargs_ex__` in protocols 2 and 3." msgstr "" "在 Python 3.6 之前、版本 2 和版本 3 的協定中,會呼叫 :meth:`__getnewargs__` " "而非 :meth:`__getnewargs_ex__`。" @@ -1136,26 +1141,26 @@ msgstr "" #: ../../library/pickle.rst:625 msgid "" -"For a class that has no instance :attr:`~object.__dict__` and no :attr:" -"`~object.__slots__`, the default state is ``None``." +"For a class that has no instance :attr:`~object.__dict__` and " +"no :attr:`~object.__slots__`, the default state is ``None``." msgstr "" "沒有 :attr:`~object.__dict__` 和 :attr:`~object.__slots__` 實例的類別,其預設" "狀態為 ``None``。" #: ../../library/pickle.rst:628 msgid "" -"For a class that has an instance :attr:`~object.__dict__` and no :attr:" -"`~object.__slots__`, the default state is ``self.__dict__``." +"For a class that has an instance :attr:`~object.__dict__` and " +"no :attr:`~object.__slots__`, the default state is ``self.__dict__``." msgstr "" "有 :attr:`~object.__dict__` 實例、但沒有 :attr:`~object.__slots__` 實例的類" "別,其預設狀態為 ``self.__dict__``。" #: ../../library/pickle.rst:631 msgid "" -"For a class that has an instance :attr:`~object.__dict__` and :attr:`~object." -"__slots__`, the default state is a tuple consisting of two dictionaries: " -"``self.__dict__``, and a dictionary mapping slot names to slot values. Only " -"slots that have a value are included in the latter." +"For a class that has an instance :attr:`~object.__dict__` " +"and :attr:`~object.__slots__`, the default state is a tuple consisting of " +"two dictionaries: ``self.__dict__``, and a dictionary mapping slot names to " +"slot values. Only slots that have a value are included in the latter." msgstr "" "有 :attr:`~object.__dict__` 和 :attr:`~object.__slots__` 實例的類別,其預設狀" "態是一個含有兩個字典的元組(tuple),該二字典分別為 ``self.__dict__`` 本身," @@ -1164,10 +1169,10 @@ msgstr "" #: ../../library/pickle.rst:637 msgid "" -"For a class that has :attr:`~object.__slots__` and no instance :attr:" -"`~object.__dict__`, the default state is a tuple whose first item is " -"``None`` and whose second item is a dictionary mapping slot names to slot " -"values described in the previous bullet." +"For a class that has :attr:`~object.__slots__` and no " +"instance :attr:`~object.__dict__`, the default state is a tuple whose first " +"item is ``None`` and whose second item is a dictionary mapping slot names to " +"slot values described in the previous bullet." msgstr "" "沒有 :attr:`~object.__dict__` 但有 :attr:`~object.__slots__` 實例的類別,其預" "設狀態是一個二元組(tuple),元組中的第一個值是 ``None``,第二個值則是紀錄欄" @@ -1175,8 +1180,8 @@ msgstr "" #: ../../library/pickle.rst:642 msgid "" -"Added the default implementation of the ``__getstate__()`` method in the :" -"class:`object` class." +"Added the default implementation of the ``__getstate__()`` method in " +"the :class:`object` class." msgstr "在 :class:`object` 類別中增加預設的 ``__getstate__()`` 實作。" #: ../../library/pickle.rst:649 @@ -1192,61 +1197,64 @@ msgstr "" #: ../../library/pickle.rst:656 msgid "" -"If :meth:`__reduce__` returns a state with value ``None`` at pickling, the :" -"meth:`__setstate__` method will not be called upon unpickling." +"If :meth:`__reduce__` returns a state with value ``None`` at pickling, " +"the :meth:`__setstate__` method will not be called upon unpickling." msgstr "" -"如果 :meth:`__reduce__` 在封裝時回傳了 ``None`` 狀態,則拆封時就不會去呼叫 :" -"meth:`__setstate__`。" +"如果 :meth:`__reduce__` 在封裝時回傳了 ``None`` 狀態,則拆封時就不會去呼" +"叫 :meth:`__setstate__`。" #: ../../library/pickle.rst:660 msgid "" "Refer to the section :ref:`pickle-state` for more information about how to " -"use the methods :meth:`~object.__getstate__` and :meth:`~object." -"__setstate__`." +"use the methods :meth:`~object.__getstate__` " +"and :meth:`~object.__setstate__`." msgstr "" -"參閱 :ref:`pickle-state` 以了解 :meth:`~object.__getstate__` 和 :meth:" -"`~object.__setstate__` 的使用方法。" +"參閱 :ref:`pickle-state` 以了解 :meth:`~object.__getstate__` " +"和 :meth:`~object.__setstate__` 的使用方法。" #: ../../library/pickle.rst:665 msgid "" -"At unpickling time, some methods like :meth:`~object.__getattr__`, :meth:" -"`~object.__getattribute__`, or :meth:`~object.__setattr__` may be called " -"upon the instance. In case those methods rely on some internal invariant " -"being true, the type should implement :meth:`~object.__new__` to establish " -"such an invariant, as :meth:`~object.__init__` is not called when unpickling " -"an instance." +"At unpickling time, some methods " +"like :meth:`~object.__getattr__`, :meth:`~object.__getattribute__`, " +"or :meth:`~object.__setattr__` may be called upon the instance. In case " +"those methods rely on some internal invariant being true, the type should " +"implement :meth:`~object.__new__` to establish such an invariant, " +"as :meth:`~object.__init__` is not called when unpickling an instance." msgstr "" -"在拆封時,某些方法如 :meth:`~object.__getattr__`、:meth:`~object." -"__getattribute__` 或 :meth:`~object.__setattr__` 可能會在建立實例時被呼叫。如" -"果這些方法依賴了某些實例內部的不變性,則應實作 :meth:`~object.__new__` 以建立" -"此不變性,因為在拆封實例時不會呼叫 :meth:`~object.__init__`。" +"在拆封時,某些方法" +"如 :meth:`~object.__getattr__`、:meth:`~object.__getattribute__` " +"或 :meth:`~object.__setattr__` 可能會在建立實例時被呼叫。如果這些方法依賴了某" +"些實例內部的不變性,則應實作 :meth:`~object.__new__` 以建立此不變性,因為在拆" +"封實例時不會呼叫 :meth:`~object.__init__`。" #: ../../library/pickle.rst:674 msgid "" "As we shall see, pickle does not use directly the methods described above. " -"In fact, these methods are part of the copy protocol which implements the :" -"meth:`~object.__reduce__` special method. The copy protocol provides a " +"In fact, these methods are part of the copy protocol which implements " +"the :meth:`~object.__reduce__` special method. The copy protocol provides a " "unified interface for retrieving the data necessary for pickling and copying " "objects. [#]_" msgstr "" -"如稍後所演示,pickle 並不直接使用上述方法。這些方法實際上是實作了 :meth:" -"`~object.__reduce__` 特殊方法的拷貝協定(copy protocol)。拷貝協定提供了統一" -"的介面,以檢索進行封裝及複製物件時所需的資料。 [#]_" +"如稍後所演示,pickle 並不直接使用上述方法。這些方法實際上是實作" +"了 :meth:`~object.__reduce__` 特殊方法的拷貝協定(copy protocol)。拷貝協定提" +"供了統一的介面,以檢索進行封裝及複製物件時所需的資料。 [#]_" #: ../../library/pickle.rst:680 msgid "" "Although powerful, implementing :meth:`~object.__reduce__` directly in your " "classes is error prone. For this reason, class designers should use the " -"high-level interface (i.e., :meth:`~object.__getnewargs_ex__`, :meth:" -"`~object.__getstate__` and :meth:`~object.__setstate__`) whenever possible. " -"We will show, however, cases where using :meth:`!__reduce__` is the only " -"option or leads to more efficient pickling or both." +"high-level interface " +"(i.e., :meth:`~object.__getnewargs_ex__`, :meth:`~object.__getstate__` " +"and :meth:`~object.__setstate__`) whenever possible. We will show, however, " +"cases where using :meth:`!__reduce__` is the only option or leads to more " +"efficient pickling or both." msgstr "" "直接在類別中實作 :meth:`~object.__reduce__` 雖然功能強大但卻容易導致出錯。因" -"此,設計類別者應盡可能使用高階介面(例如,:meth:`~object." -"__getnewargs_ex__`、:meth:`~object.__getstate__` 和 :meth:`~object." -"__setstate__`)。不過,我們也將展示一些特例狀況,在這些狀況中,使用 :meth:`!" -"__reduce__` 可能是唯一的選擇、是更有效率的封裝方法或二者兼備。" +"此,設計類別者應盡可能使用高階介面(例" +"如,:meth:`~object.__getnewargs_ex__`、:meth:`~object.__getstate__` " +"和 :meth:`~object.__setstate__`)。不過,我們也將展示一些特例狀況,在這些狀況" +"中,使用 :meth:`!__reduce__` 可能是唯一的選擇、是更有效率的封裝方法或二者兼" +"備。" #: ../../library/pickle.rst:689 msgid "" @@ -1293,14 +1301,14 @@ msgstr "" #: ../../library/pickle.rst:710 msgid "" -"Optionally, the object's state, which will be passed to the object's :meth:" -"`__setstate__` method as previously described. If the object has no such " -"method then, the value must be a dictionary and it will be added to the " -"object's :attr:`~object.__dict__` attribute." +"Optionally, the object's state, which will be passed to the " +"object's :meth:`__setstate__` method as previously described. If the object " +"has no such method then, the value must be a dictionary and it will be added " +"to the object's :attr:`~object.__dict__` attribute." msgstr "" "可選項。物件狀態。如前所述,會被傳遞給該物件的 :meth:`__setstate__` 方法。如" -"果該物件沒有實作此方法,則本值必須是一個字典,且其將會被新增到物件的 :attr:" -"`~object.__dict__` 屬性中。" +"果該物件沒有實作此方法,則本值必須是一個字典,且其將會被新增到物件" +"的 :attr:`~object.__dict__` 屬性中。" # SkyLull: [T] # signature: https://jo-jo.medium.com/c-c-%E5%B9%BC%E5%B9%BC%E7%8F%AD-%E7%B0%BD%E7%AB%A0signature-fa9b04e1a3e2 @@ -1309,18 +1317,19 @@ msgid "" "Optionally, an iterator (and not a sequence) yielding successive items. " "These items will be appended to the object either using ``obj.append(item)`` " "or, in batch, using ``obj.extend(list_of_items)``. This is primarily used " -"for list subclasses, but may be used by other classes as long as they have :" -"ref:`append and extend methods ` with the appropriate " +"for list subclasses, but may be used by other classes as long as they " +"have :ref:`append and extend methods ` with the appropriate " "signature. (Whether :meth:`!append` or :meth:`!extend` is used depends on " "which pickle protocol version is used as well as the number of items to " "append, so both must be supported.)" msgstr "" -"可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 ``obj." -"append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被附加到" -"物件中。主要用於串列(list)子類別,但只要其他類別具有相應的 :ref:`append 和 " -"extend 方法 `\\ 以及相同的函式簽章(signature)就也可以使" -"用。 (是否會調用 :meth:`!append` 或 :meth:`!extend` 方法將取決於所選用的 " -"pickle 協定版本以及要附加的項目數量,因此必須同時支援這兩種方法。)" +"可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 " +"``obj.append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被" +"附加到物件中。主要用於串列(list)子類別,但只要其他類別具有相應" +"的 :ref:`append 和 extend 方法 `\\ 以及相同的函式簽章" +"(signature)就也可以使用。 (是否會調用 :meth:`!append` 或 :meth:`!extend` " +"方法將取決於所選用的 pickle 協定版本以及要附加的項目數量,因此必須同時支援這" +"兩種方法。)" #: ../../library/pickle.rst:725 msgid "" @@ -1338,8 +1347,8 @@ msgid "" "Optionally, a callable with a ``(obj, state)`` signature. This callable " "allows the user to programmatically control the state-updating behavior of a " "specific object, instead of using ``obj``'s static :meth:`__setstate__` " -"method. If not ``None``, this callable will have priority over ``obj``'s :" -"meth:`__setstate__`." +"method. If not ``None``, this callable will have priority over " +"``obj``'s :meth:`__setstate__`." msgstr "" "可選項。一個具有 ``(obj, state)`` 函式簽章(signature)的可呼叫物件。該物件允" "許使用者以可編寫的邏輯,而不是物件 ``obj`` 預設的 :meth:`__setstate__` 靜態方" @@ -1354,15 +1363,16 @@ msgstr "加入第六個可選項(一個 ``(obj, state)`` 元組)。" msgid "" "Alternatively, a :meth:`__reduce_ex__` method may be defined. The only " "difference is this method should take a single integer argument, the " -"protocol version. When defined, pickle will prefer it over the :meth:" -"`__reduce__` method. In addition, :meth:`__reduce__` automatically becomes " -"a synonym for the extended version. The main use for this method is to " -"provide backwards-compatible reduce values for older Python releases." +"protocol version. When defined, pickle will prefer it over " +"the :meth:`__reduce__` method. In addition, :meth:`__reduce__` " +"automatically becomes a synonym for the extended version. The main use for " +"this method is to provide backwards-compatible reduce values for older " +"Python releases." msgstr "" "另外,你也可以定義一個 :meth:`__reduce_ex__` 方法。唯一的不同的地方是此方法只" -"接受協定版本(整數)作為參數。當有定義本方法時,pickle 會優先調用它而不是 :" -"meth:`__reduce__` 。此外,呼叫 :meth:`__reduce__` 時也會自動變成呼叫這個變體" -"版本。此方法主要是為了向後相容的舊的 Python 版本而存在。" +"接受協定版本(整數)作為參數。當有定義本方法時,pickle 會優先調用它而不" +"是 :meth:`__reduce__` 。此外,呼叫 :meth:`__reduce__` 時也會自動變成呼叫這個" +"變體版本。此方法主要是為了向後相容的舊的 Python 版本而存在。" #: ../../library/pickle.rst:754 msgid "Persistence of External Objects" @@ -1385,8 +1395,8 @@ msgstr "" msgid "" "The resolution of such persistent IDs is not defined by the :mod:`pickle` " "module; it will delegate this resolution to the user-defined methods on the " -"pickler and unpickler, :meth:`~Pickler.persistent_id` and :meth:`~Unpickler." -"persistent_load` respectively." +"pickler and unpickler, :meth:`~Pickler.persistent_id` " +"and :meth:`~Unpickler.persistent_load` respectively." msgstr "" ":mod:`pickle` 沒有定義要如何解決或分派這個持久化 ID 的問題;故其處理方式有賴" "使用者自行定義在封裝器(pickler)以及拆封器(unpickler)中。方法的名稱各自" @@ -1402,20 +1412,21 @@ msgid "" "object, along with a marker so that the unpickler will recognize it as a " "persistent ID." msgstr "" -"要封裝具有外部持久化 ID 的物件,封裝器(pickler)必須擁有一個自訂的方法 :" -"meth:`~Pickler.persistent_id`,這個方法將接收一個物件作為參數,並回傳 `None` " -"或該物件的持久化 ID。當回傳 `None` 時,封裝器會正常地封裝該物件。當回傳一個持" -"久化 ID 字串時,封裝器會封裝該物件並加上一個標記,讓拆封器(unpikler)能識別" -"它是一個持久化 ID。" +"要封裝具有外部持久化 ID 的物件,封裝器(pickler)必須擁有一個自訂的方" +"法 :meth:`~Pickler.persistent_id`,這個方法將接收一個物件作為參數,並回傳 " +"``None`` 或該物件的持久化 ID。當回傳 ``None`` 時,封裝器會正常地封裝該物件。" +"當回傳一個持久化 ID 字串時,封裝器會封裝該物件並加上一個標記,讓拆封器" +"(unpickler)能識別它是一個持久化 ID。" #: ../../library/pickle.rst:778 msgid "" -"To unpickle external objects, the unpickler must have a custom :meth:" -"`~Unpickler.persistent_load` method that takes a persistent ID object and " -"returns the referenced object." +"To unpickle external objects, the unpickler must have a " +"custom :meth:`~Unpickler.persistent_load` method that takes a persistent ID " +"object and returns the referenced object." msgstr "" -"要拆封外部物件,拆封器(unpickler)必須有一個自訂的 :meth:`~Unpickler." -"persistent_load` 方法,該方法應接受一個持久化 ID 物件,並回傳相對應的物件。" +"要拆封外部物件,拆封器(unpickler)必須有一個自訂" +"的 :meth:`~Unpickler.persistent_load` 方法,該方法應接受一個持久化 ID 物件," +"並回傳相對應的物件。" #: ../../library/pickle.rst:782 msgid "" @@ -1487,8 +1498,8 @@ msgid "" " # Initialize and populate our database.\n" " conn = sqlite3.connect(\":memory:\")\n" " cursor = conn.cursor()\n" -" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task " -"TEXT)\")\n" +" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task TEXT)" +"\")\n" " tasks = (\n" " 'give food to fish',\n" " 'prepare group meeting',\n" @@ -1574,8 +1585,8 @@ msgstr "" " # 初始化資料庫。\n" " conn = sqlite3.connect(\":memory:\")\n" " cursor = conn.cursor()\n" -" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task " -"TEXT)\")\n" +" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task TEXT)" +"\")\n" " tasks = (\n" " 'give food to fish',\n" " 'prepare group meeting',\n" @@ -1837,15 +1848,16 @@ msgid "" "alternatively return :data:`NotImplemented` to fallback to the traditional " "behavior." msgstr "" -"如果是這樣的話,可以繼承 :class:`Pickler` 類別並實作一個 :meth:`~Pickler." -"reducer_override` 方法。此方法可以回傳任意的縮減元組(參閱 :meth:`~object." -"__reduce__`)、也可以回傳 :data:`NotImplemented` 以回退至原始的行為。" +"如果是這樣的話,可以繼承 :class:`Pickler` 類別並實作一" +"個 :meth:`~Pickler.reducer_override` 方法。此方法可以回傳任意的縮減元組(參" +"閱 :meth:`~object.__reduce__`)、也可以回傳 :data:`NotImplemented` 以回退至原" +"始的行為。" #: ../../library/pickle.rst:910 msgid "" -"If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler." -"reducer_override` are defined, then :meth:`~Pickler.reducer_override` method " -"takes priority." +"If both the :attr:`~Pickler.dispatch_table` " +"and :meth:`~Pickler.reducer_override` are defined, " +"then :meth:`~Pickler.reducer_override` method takes priority." msgstr "" "如果 :attr:`~Pickler.dispatch_table` 和 :meth:`~Pickler.reducer_override` 都" "被定義了的話,:meth:`~Pickler.reducer_override` 的優先度較高。" @@ -1854,14 +1866,14 @@ msgstr "" msgid "" "For performance reasons, :meth:`~Pickler.reducer_override` may not be called " "for the following objects: ``None``, ``True``, ``False``, and exact " -"instances of :class:`int`, :class:`float`, :class:`bytes`, :class:`str`, :" -"class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` and :class:" -"`tuple`." +"instances " +"of :class:`int`, :class:`float`, :class:`bytes`, :class:`str`, :class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` " +"and :class:`tuple`." msgstr "" "出於效能考量,處裡以下物件可能不會呼叫 :meth:`~Pickler.reducer_override`:" -"``None``、``True``、``False``,以及 :class:`int`、:class:`float`、:class:" -"`bytes`、:class:`str`、:class:`dict`、:class:`set`、:class:`frozenset`、:" -"class:`list` 和 :class:`tuple` 的實例。" +"``None``、``True``、``False``,以" +"及 :class:`int`、:class:`float`、:class:`bytes`、:class:`str`、:class:`dict`、:class:`set`、:class:`frozenset`、:class:`list` " +"和 :class:`tuple` 的實例。" #: ../../library/pickle.rst:921 msgid "" @@ -1961,14 +1973,15 @@ msgstr "供給者 API" #: ../../library/pickle.rst:975 msgid "" -"The large data objects to be pickled must implement a :meth:`~object." -"__reduce_ex__` method specialized for protocol 5 and higher, which returns " -"a :class:`PickleBuffer` instance (instead of e.g. a :class:`bytes` object) " -"for any large data." +"The large data objects to be pickled must implement " +"a :meth:`~object.__reduce_ex__` method specialized for protocol 5 and " +"higher, which returns a :class:`PickleBuffer` instance (instead of e.g. " +"a :class:`bytes` object) for any large data." msgstr "" -"要封裝的大型資料物件,則必須實作一個針對 5 版協定及以上的 :meth:`~object." -"__reduce_ex__` 方法,該方法應回傳一個 :class:`PickleBuffer` 實例來處理任何大" -"型資料(而非回傳如 :class:`bytes` 物件)。" +"要封裝的大型資料物件,則必須實作一個針對 5 版協定及以上" +"的 :meth:`~object.__reduce_ex__` 方法,該方法應回傳一" +"個 :class:`PickleBuffer` 實例來處理任何大型資料(而非回傳如 :class:`bytes` 物" +"件)。" #: ../../library/pickle.rst:980 msgid "" @@ -1988,41 +2001,42 @@ msgstr "消費者 API" #: ../../library/pickle.rst:989 msgid "" -"A communications system can enable custom handling of the :class:" -"`PickleBuffer` objects generated when serializing an object graph." +"A communications system can enable custom handling of " +"the :class:`PickleBuffer` objects generated when serializing an object graph." msgstr "" "一個資訊交換系統可以決定要自行處裡序列化物件圖時產生的 :class:`PickleBuffer` " "物件。" #: ../../library/pickle.rst:992 msgid "" -"On the sending side, it needs to pass a *buffer_callback* argument to :class:" -"`Pickler` (or to the :func:`dump` or :func:`dumps` function), which will be " -"called with each :class:`PickleBuffer` generated while pickling the object " -"graph. Buffers accumulated by the *buffer_callback* will not see their data " -"copied into the pickle stream, only a cheap marker will be inserted." +"On the sending side, it needs to pass a *buffer_callback* argument " +"to :class:`Pickler` (or to the :func:`dump` or :func:`dumps` function), " +"which will be called with each :class:`PickleBuffer` generated while " +"pickling the object graph. Buffers accumulated by the *buffer_callback* " +"will not see their data copied into the pickle stream, only a cheap marker " +"will be inserted." msgstr "" -"傳送端需要傳遞一個調用緩衝區的回呼函式給 :class:`Pickler`\\ (或 :func:" -"`dump` 或 :func:`dumps` 函式)的 *buffer_callback* 引數,使每次生成 :class:" -"`PickleBuffer` 時,該物件在處理物件圖時能被呼叫。除了一個簡易標記以外,由 " -"*buffer_callback* 累積的緩衝區資料不會被複製到 pickle 串流中。" +"傳送端需要傳遞一個調用緩衝區的回呼函式給 :class:`Pickler`\\ " +"(或 :func:`dump` 或 :func:`dumps` 函式)的 *buffer_callback* 引數,使每次生" +"成 :class:`PickleBuffer` 時,該物件在處理物件圖時能被呼叫。除了一個簡易標記以" +"外,由 *buffer_callback* 累積的緩衝區資料不會被複製到 pickle 串流中。" #: ../../library/pickle.rst:999 msgid "" -"On the receiving side, it needs to pass a *buffers* argument to :class:" -"`Unpickler` (or to the :func:`load` or :func:`loads` function), which is an " -"iterable of the buffers which were passed to *buffer_callback*. That " -"iterable should produce buffers in the same order as they were passed to " -"*buffer_callback*. Those buffers will provide the data expected by the " -"reconstructors of the objects whose pickling produced the original :class:" -"`PickleBuffer` objects." -msgstr "" -"接收端需要傳遞一個緩衝區物件給 :class:`Unpickler`\\ (或 :func:`load` 或 :" -"func:`loads` 函式)的 *buffers* 引數。該物件須是一個可疊代的(iterable)緩衝" -"區(buffer)物件,其中包含傳遞給 *buffer_callback* 的緩衝區物件。這個可疊代物" -"件的緩衝區順序應該與它們當初被封裝時傳遞給 *buffer_callback* 的順序相同。這些" -"緩衝區將提供物件重建所需的資料,以使重建器能還原出那個當時產生了 :class:" -"`PickleBuffer` 的物件。" +"On the receiving side, it needs to pass a *buffers* argument " +"to :class:`Unpickler` (or to the :func:`load` or :func:`loads` function), " +"which is an iterable of the buffers which were passed to *buffer_callback*. " +"That iterable should produce buffers in the same order as they were passed " +"to *buffer_callback*. Those buffers will provide the data expected by the " +"reconstructors of the objects whose pickling produced the " +"original :class:`PickleBuffer` objects." +msgstr "" +"接收端需要傳遞一個緩衝區物件給 :class:`Unpickler`\\ (或 :func:`load` " +"或 :func:`loads` 函式)的 *buffers* 引數。該物件須是一個可疊代的(iterable)" +"緩衝區(buffer)物件,其中包含傳遞給 *buffer_callback* 的緩衝區物件。這個可疊" +"代物件的緩衝區順序應該與它們當初被封裝時傳遞給 *buffer_callback* 的順序相同。" +"這些緩衝區將提供物件重建所需的資料,以使重建器能還原出那個當時產生" +"了 :class:`PickleBuffer` 的物件。" #: ../../library/pickle.rst:1007 msgid "" @@ -2043,8 +2057,8 @@ msgid "" "Here is a trivial example where we implement a :class:`bytearray` subclass " "able to participate in out-of-band buffer pickling::" msgstr "" -"這一個簡單的範例展示了如何實作一個可以參與帶外緩衝區封裝的 :class:" -"`bytearray` 子類別:::" +"這一個簡單的範例展示了如何實作一個可以參與帶外緩衝區封裝" +"的 :class:`bytearray` 子類別:::" #: ../../library/pickle.rst:1018 msgid "" @@ -2202,11 +2216,11 @@ msgstr "" #: ../../library/pickle.rst:1094 msgid "" -"For this reason, you may want to control what gets unpickled by customizing :" -"meth:`Unpickler.find_class`. Unlike its name suggests, :meth:`Unpickler." -"find_class` is called whenever a global (i.e., a class or a function) is " -"requested. Thus it is possible to either completely forbid globals or " -"restrict them to a safe subset." +"For this reason, you may want to control what gets unpickled by " +"customizing :meth:`Unpickler.find_class`. Unlike its name " +"suggests, :meth:`Unpickler.find_class` is called whenever a global (i.e., a " +"class or a function) is requested. Thus it is possible to either completely " +"forbid globals or restrict them to a safe subset." msgstr "" "基於以上原因,你可能會希望透過自訂 :meth:`Unpickler.find_class` 來控制哪些是" "能夠被拆封的內容。與其名稱字面意義暗示的不同,實際上每當你請求一個全域物件" @@ -2215,8 +2229,8 @@ msgstr "" #: ../../library/pickle.rst:1100 msgid "" -"Here is an example of an unpickler allowing only few safe classes from the :" -"mod:`builtins` module to be loaded::" +"Here is an example of an unpickler allowing only few safe classes from " +"the :mod:`builtins` module to be loaded::" msgstr "" "以下是一個僅允許從 :mod:`builtins` 模組中載入少數安全類別的拆封器" "(unpickler)的例子:::" @@ -2446,8 +2460,8 @@ msgstr "" #: ../../library/pickle.rst:1222 msgid "" -"The exception raised will likely be an :exc:`ImportError` or an :exc:" -"`AttributeError` but it could be something else." +"The exception raised will likely be an :exc:`ImportError` or " +"an :exc:`AttributeError` but it could be something else." msgstr "" "引發的例外應該是 :exc:`ImportError` 或 :exc:`AttributeError`,但也可能是其他" "例外。" diff --git a/library/pkgutil.po b/library/pkgutil.po index 31147bebcb..3851b2c077 100644 --- a/library/pkgutil.po +++ b/library/pkgutil.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -41,8 +41,8 @@ msgid "" "Extend the search path for the modules which comprise a package. Intended " "use is to place the following code in a package's :file:`__init__.py`::" msgstr "" -"擴充組成一個套件之模組的搜尋路徑。預期用法是將以下程式碼放入套件的 :file:" -"`__init__.py`: ::" +"擴充組成一個套件之模組的搜尋路徑。預期用法是將以下程式碼放入套件" +"的 :file:`__init__.py`: ::" #: ../../library/pkgutil.rst:25 msgid "" @@ -55,9 +55,10 @@ msgstr "" #: ../../library/pkgutil.rst:28 msgid "" "For each directory on :data:`sys.path` that has a subdirectory that matches " -"the package name, add the subdirectory to the package's :attr:`~module." -"__path__`. This is useful if one wants to distribute different parts of a " -"single logical package as multiple directories." +"the package name, add the subdirectory to the " +"package's :attr:`~module.__path__`. This is useful if one wants to " +"distribute different parts of a single logical package as multiple " +"directories." msgstr "" "對於 :data:`sys.path` 上具有與套件名稱相符的子目錄的每個目錄,將該子目錄新增" "至套件的 :attr:`~module.__path__` 中。如果想要將單一邏輯套件的不同部分給分配" @@ -66,12 +67,12 @@ msgstr "" #: ../../library/pkgutil.rst:34 msgid "" "It also looks for :file:`\\*.pkg` files beginning where ``*`` matches the " -"*name* argument. This feature is similar to :file:`\\*.pth` files (see the :" -"mod:`site` module for more information), except that it doesn't special-case " -"lines starting with ``import``. A :file:`\\*.pkg` file is trusted at face " -"value: apart from skipping blank lines and ignoring comments, all entries " -"found in a :file:`\\*.pkg` file are added to the path, regardless of whether " -"they exist on the filesystem (this is a feature)." +"*name* argument. This feature is similar to :file:`\\*.pth` files (see " +"the :mod:`site` module for more information), except that it doesn't special-" +"case lines starting with ``import``. A :file:`\\*.pkg` file is trusted at " +"face value: apart from skipping blank lines and ignoring comments, all " +"entries found in a :file:`\\*.pkg` file are added to the path, regardless of " +"whether they exist on the filesystem (this is a feature)." msgstr "" "它還會尋找 :file:`\\*.pkg` 檔案,其中開頭的 ``*`` 與 *name* 引數相符。此功能" "類似於 :file:`\\*.pth` 檔案(更多資訊請參閱 :mod:`site` 模組),但他不特別處" @@ -90,11 +91,11 @@ msgstr "" #: ../../library/pkgutil.rst:46 msgid "" -"It is assumed that :data:`sys.path` is a sequence. Items of :data:`sys." -"path` that are not strings referring to existing directories are ignored. " -"Unicode items on :data:`sys.path` that cause errors when used as filenames " -"may cause this function to raise an exception (in line with :func:`os.path." -"isdir` behavior)." +"It is assumed that :data:`sys.path` is a sequence. Items " +"of :data:`sys.path` that are not strings referring to existing directories " +"are ignored. Unicode items on :data:`sys.path` that cause errors when used " +"as filenames may cause this function to raise an exception (in line " +"with :func:`os.path.isdir` behavior)." msgstr "" ":data:`sys.path` 被假設是一個序列,:data:`sys.path` 中的項目裡,若不是代表現" "存目錄的字串則將被忽略。:data:`sys.path` 上用作檔案名稱時導致錯誤的 Unicode " @@ -106,14 +107,14 @@ msgstr "取得給定之 *fullname* 的模組 :term:`loader`。" #: ../../library/pkgutil.rst:56 msgid "" -"This is a backwards compatibility wrapper around :func:`importlib.util." -"find_spec` that converts most failures to :exc:`ImportError` and only " -"returns the loader rather than the full :class:`importlib.machinery." -"ModuleSpec`." +"This is a backwards compatibility wrapper " +"around :func:`importlib.util.find_spec` that converts most failures " +"to :exc:`ImportError` and only returns the loader rather than the " +"full :class:`importlib.machinery.ModuleSpec`." msgstr "" "這是一個 :func:`importlib.util.find_spec` 的向後相容包裝器,它將大多數的失敗" -"轉換為 :exc:`ImportError` 並且僅回傳載入器而不是完整的 :class:`importlib." -"machinery.ModuleSpec`。" +"轉換為 :exc:`ImportError` 並且僅回傳載入器而不是完整" +"的 :class:`importlib.machinery.ModuleSpec`。" #: ../../library/pkgutil.rst:61 ../../library/pkgutil.rst:82 #: ../../library/pkgutil.rst:97 ../../library/pkgutil.rst:121 @@ -147,8 +148,8 @@ msgstr "" #: ../../library/pkgutil.rst:79 msgid "" -"The cache (or part of it) can be cleared manually if a rescan of :data:`sys." -"path_hooks` is necessary." +"The cache (or part of it) can be cleared manually if a rescan " +"of :data:`sys.path_hooks` is necessary." msgstr "" "如果需要重新掃描 :data:`sys.path_hooks`,可以手動清除快取(或部分快取)。" @@ -216,12 +217,12 @@ msgstr "*prefix* 是在輸出的每個模組名稱前面的輸出字串。" msgid "" "Only works for a :term:`finder` which defines an ``iter_modules()`` method. " "This interface is non-standard, so the module also provides implementations " -"for :class:`importlib.machinery.FileFinder` and :class:`zipimport." -"zipimporter`." +"for :class:`importlib.machinery.FileFinder` " +"and :class:`zipimport.zipimporter`." msgstr "" "僅適用於有定義 ``iter_modules()`` 方法的 :term:`finder`。此介面並非是標準的," -"因此該模組還提供了 :class:`importlib.machinery.FileFinder` 和 :class:" -"`zipimport.zipimporter` 的實作。" +"因此該模組還提供了 :class:`importlib.machinery.FileFinder` " +"和 :class:`zipimport.zipimporter` 的實作。" #: ../../library/pkgutil.rst:149 msgid "" @@ -244,13 +245,13 @@ msgstr "" msgid "" "*onerror* is a function which gets called with one argument (the name of the " "package which was being imported) if any exception occurs while trying to " -"import a package. If no *onerror* function is supplied, :exc:" -"`ImportError`\\s are caught and ignored, while all other exceptions are " -"propagated, terminating the search." +"import a package. If no *onerror* function is " +"supplied, :exc:`ImportError`\\s are caught and ignored, while all other " +"exceptions are propagated, terminating the search." msgstr "" "*onerror* 是一個函式,如果在嘗試引入套件時發生任何例外,則使用一個引數(正在" -"引入之套件的名稱)來呼叫函式。如果未提供 *onerror* 函式,則會捕獲並忽略 :exc:" -"`ImportError`,同時傳播所有其他例外並終止搜尋。" +"引入之套件的名稱)來呼叫函式。如果未提供 *onerror* 函式,則會捕獲並忽" +"略 :exc:`ImportError`,同時傳播所有其他例外並終止搜尋。" #: ../../library/pkgutil.rst:166 msgid "Examples::" @@ -264,6 +265,11 @@ msgid "" "# list all submodules of ctypes\n" "walk_packages(ctypes.__path__, ctypes.__name__ + '.')" msgstr "" +"# 列出 Python 可存取的所有模組\n" +"walk_packages()\n" +"\n" +"# 列出 ctypes 的所有子模組\n" +"walk_packages(ctypes.__path__, ctypes.__name__ + '.')" #: ../../library/pkgutil.rst:188 msgid "Get a resource from a package." @@ -271,12 +277,12 @@ msgstr "從套件中取得資源。" #: ../../library/pkgutil.rst:190 msgid "" -"This is a wrapper for the :term:`loader` :meth:`get_data ` API. The *package* argument should be the name of " -"a package, in standard module format (``foo.bar``). The *resource* argument " -"should be in the form of a relative filename, using ``/`` as the path " -"separator. The parent directory name ``..`` is not allowed, and nor is a " -"rooted name (starting with a ``/``)." +"This is a wrapper for the :term:`loader` :meth:`get_data " +"` API. The *package* argument should " +"be the name of a package, in standard module format (``foo.bar``). The " +"*resource* argument should be in the form of a relative filename, using ``/" +"`` as the path separator. The parent directory name ``..`` is not allowed, " +"and nor is a rooted name (starting with a ``/``)." msgstr "" "這是 :term:`loader` :meth:`get_data ` " "API 的包裝器。*package* 引數應該是採用標準模組格式 (``foo.bar``) 的套件名稱。" @@ -306,15 +312,16 @@ msgstr "" #: ../../library/pkgutil.rst:206 msgid "" "If the package cannot be located or loaded, or it uses a :term:`loader` " -"which does not support :meth:`get_data `, then ``None`` is returned. In particular, the :term:`loader` " -"for :term:`namespace packages ` does not support :meth:" -"`get_data `." +"which does not support :meth:`get_data " +"`, then ``None`` is returned. In " +"particular, the :term:`loader` for :term:`namespace packages ` does not support :meth:`get_data " +"`." msgstr "" -"如果無法定位或載入套件,或者它使用不支援 :meth:`get_data ` 的 :term:`loader` 則回傳 ``None``。特別是\\ :term:`" -"命名空間套件 `\\ 的 :term:`loader` 不支援 :meth:`get_data " -"`。" +"如果無法定位或載入套件,或者它使用不支援 :meth:`get_data " +"` 的 :term:`loader` 則回傳 ``None``。" +"特別是\\ :term:`命名空間套件 `\\ 的 :term:`loader` 不支" +"援 :meth:`get_data `。" #: ../../library/pkgutil.rst:215 msgid "Resolve a name to an object." @@ -322,9 +329,9 @@ msgstr "將名稱解析為物件。" #: ../../library/pkgutil.rst:217 msgid "" -"This functionality is used in numerous places in the standard library (see :" -"issue:`12915`) - and equivalent functionality is also in widely used third-" -"party packages such as setuptools, Django and Pyramid." +"This functionality is used in numerous places in the standard library " +"(see :issue:`12915`) - and equivalent functionality is also in widely used " +"third-party packages such as setuptools, Django and Pyramid." msgstr "" "標準函式庫中的許多地方都使用了此功能(請參閱 :issue:`12915`),且相同功能也被" "用於擁有廣大使用者的第三方套件,如 setuptools、Django 和 Pyramid。" diff --git a/library/plistlib.po b/library/plistlib.po index 8e0a57dc70..cd169610e3 100644 --- a/library/plistlib.po +++ b/library/plistlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2016-01-31 07:27+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -132,95 +132,92 @@ msgstr "" #: ../../library/plistlib.rst:81 msgid "" -"The parser for the binary format raises :exc:`InvalidFileException` when the " -"file cannot be parsed." +"The parser raises :exc:`InvalidFileException` when the file cannot be parsed." msgstr "" -#: ../../library/plistlib.rst:86 ../../library/plistlib.rst:131 +#: ../../library/plistlib.rst:85 ../../library/plistlib.rst:130 msgid "The keyword-only parameter *aware_datetime* has been added." msgstr "" -#: ../../library/plistlib.rst:92 +#: ../../library/plistlib.rst:91 msgid "" "Load a plist from a bytes or string object. See :func:`load` for an " "explanation of the keyword arguments." msgstr "" -#: ../../library/plistlib.rst:97 +#: ../../library/plistlib.rst:96 msgid "*data* can be a string when *fmt* equals :data:`FMT_XML`." msgstr "" -#: ../../library/plistlib.rst:102 +#: ../../library/plistlib.rst:101 msgid "" -"Write *value* to a plist file. *Fp* should be a writable, binary file object." +"Write *value* to a plist file. *fp* should be a writable, binary file object." msgstr "" -#: ../../library/plistlib.rst:105 +#: ../../library/plistlib.rst:104 msgid "" "The *fmt* argument specifies the format of the plist file and can be one of " "the following values:" msgstr "" -#: ../../library/plistlib.rst:108 +#: ../../library/plistlib.rst:107 msgid ":data:`FMT_XML`: XML formatted plist file" msgstr "" -#: ../../library/plistlib.rst:110 +#: ../../library/plistlib.rst:109 msgid ":data:`FMT_BINARY`: Binary formatted plist file" msgstr "" -#: ../../library/plistlib.rst:112 +#: ../../library/plistlib.rst:111 msgid "" "When *sort_keys* is true (the default) the keys for dictionaries will be " "written to the plist in sorted order, otherwise they will be written in the " "iteration order of the dictionary." msgstr "" -#: ../../library/plistlib.rst:116 +#: ../../library/plistlib.rst:115 msgid "" "When *skipkeys* is false (the default) the function raises :exc:`TypeError` " "when a key of a dictionary is not a string, otherwise such keys are skipped." msgstr "" -#: ../../library/plistlib.rst:119 +#: ../../library/plistlib.rst:118 msgid "" "When *aware_datetime* is true and any field with type ``datetime.datetime`` " "is set as an :ref:`aware object `, it will convert to " "UTC timezone before writing it." msgstr "" -#: ../../library/plistlib.rst:123 +#: ../../library/plistlib.rst:122 msgid "" "A :exc:`TypeError` will be raised if the object is of an unsupported type or " "a container that contains objects of unsupported types." msgstr "" -#: ../../library/plistlib.rst:126 +#: ../../library/plistlib.rst:125 msgid "" "An :exc:`OverflowError` will be raised for integer values that cannot be " "represented in (binary) plist files." msgstr "" -#: ../../library/plistlib.rst:137 +#: ../../library/plistlib.rst:136 msgid "" "Return *value* as a plist-formatted bytes object. See the documentation for :" "func:`dump` for an explanation of the keyword arguments of this function." msgstr "" -#: ../../library/plistlib.rst:144 +#: ../../library/plistlib.rst:143 msgid "The following classes are available:" msgstr "" -#: ../../library/plistlib.rst:148 +#: ../../library/plistlib.rst:147 msgid "" "Wraps an :class:`int`. This is used when reading or writing NSKeyedArchiver " "encoded data, which contains UID (see PList manual)." msgstr "" -#: ../../library/plistlib.rst:151 -msgid "" -"It has one attribute, :attr:`data`, which can be used to retrieve the int " -"value of the UID. :attr:`data` must be in the range ``0 <= data < 2**64``." +#: ../../library/plistlib.rst:152 +msgid "Int value of the UID. It must be in the range ``0 <= data < 2**64``." msgstr "" #: ../../library/plistlib.rst:157 @@ -235,15 +232,23 @@ msgstr "" msgid "The binary format for plist files" msgstr "" -#: ../../library/plistlib.rst:174 +#: ../../library/plistlib.rst:173 +msgid "The module defines the following exceptions:" +msgstr "" + +#: ../../library/plistlib.rst:177 +msgid "Raised when a file cannot be parsed." +msgstr "" + +#: ../../library/plistlib.rst:183 msgid "Examples" msgstr "範例" -#: ../../library/plistlib.rst:176 +#: ../../library/plistlib.rst:185 msgid "Generating a plist::" msgstr "" -#: ../../library/plistlib.rst:178 +#: ../../library/plistlib.rst:187 msgid "" "import datetime\n" "import plistlib\n" @@ -285,11 +290,11 @@ msgstr "" ")\n" "print(plistlib.dumps(pl).decode())" -#: ../../library/plistlib.rst:198 +#: ../../library/plistlib.rst:207 msgid "Parsing a plist::" msgstr "" -#: ../../library/plistlib.rst:200 +#: ../../library/plistlib.rst:209 msgid "" "import plistlib\n" "\n" diff --git a/library/profile.po b/library/profile.po index aa480c4282..5babd398ac 100644 --- a/library/profile.po +++ b/library/profile.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-02 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,7 +27,7 @@ msgstr "**原始碼:**\\ :source:`Lib/profile.py` 與 :source:`Lib/pstats.py`" #: ../../library/profile.rst:14 msgid "Introduction to the profilers" -msgstr "" +msgstr "分析器簡介" #: ../../library/profile.rst:20 msgid "" @@ -53,20 +53,21 @@ msgstr "" #: ../../library/profile.rst:33 msgid "" -":mod:`profile`, a pure Python module whose interface is imitated by :mod:" -"`cProfile`, but which adds significant overhead to profiled programs. If " -"you're trying to extend the profiler in some way, the task might be easier " -"with this module. Originally designed and written by Jim Roskind." +":mod:`profile`, a pure Python module whose interface is imitated " +"by :mod:`cProfile`, but which adds significant overhead to profiled " +"programs. If you're trying to extend the profiler in some way, the task " +"might be easier with this module. Originally designed and written by Jim " +"Roskind." msgstr "" #: ../../library/profile.rst:40 msgid "" "The profiler modules are designed to provide an execution profile for a " -"given program, not for benchmarking purposes (for that, there is :mod:" -"`timeit` for reasonably accurate results). This particularly applies to " -"benchmarking Python code against C code: the profilers introduce overhead " -"for Python code, but not for C-level functions, and so the C code would seem " -"faster than any Python one." +"given program, not for benchmarking purposes (for that, there " +"is :mod:`timeit` for reasonably accurate results). This particularly " +"applies to benchmarking Python code against C code: the profilers introduce " +"overhead for Python code, but not for C-level functions, and so the C code " +"would seem faster than any Python one." msgstr "" #: ../../library/profile.rst:51 @@ -223,48 +224,49 @@ msgid "" "formats them in various ways." msgstr "" -#: ../../library/profile.rst:126 +#: ../../library/profile.rst:128 msgid "" "The files :mod:`cProfile` and :mod:`profile` can also be invoked as a script " "to profile another script. For example::" msgstr "" -#: ../../library/profile.rst:129 +#: ../../library/profile.rst:131 msgid "" "python -m cProfile [-o output_file] [-s sort_order] (-m module | myscript.py)" msgstr "" "python -m cProfile [-o output_file] [-s sort_order] (-m module | myscript.py)" -#: ../../library/profile.rst:131 -msgid "``-o`` writes the profile results to a file instead of to stdout" +#: ../../library/profile.rst:135 +msgid "Writes the profile results to a file instead of to stdout." msgstr "" -#: ../../library/profile.rst:133 +#: ../../library/profile.rst:139 msgid "" -"``-s`` specifies one of the :func:`~pstats.Stats.sort_stats` sort values to " -"sort the output by. This only applies when ``-o`` is not supplied." +"Specifies one of the :func:`~pstats.Stats.sort_stats` sort values to sort " +"the output by. This only applies when :option:`-o ` is not " +"supplied." msgstr "" -#: ../../library/profile.rst:136 -msgid "``-m`` specifies that a module is being profiled instead of a script." +#: ../../library/profile.rst:145 +msgid "Specifies that a module is being profiled instead of a script." msgstr "" -#: ../../library/profile.rst:138 +#: ../../library/profile.rst:147 msgid "Added the ``-m`` option to :mod:`cProfile`." msgstr "新增 ``-m`` 選項到 :mod:`cProfile`。" -#: ../../library/profile.rst:141 +#: ../../library/profile.rst:150 msgid "Added the ``-m`` option to :mod:`profile`." msgstr "新增 ``-m`` 選項到 :mod:`profile`。" -#: ../../library/profile.rst:144 +#: ../../library/profile.rst:153 msgid "" "The :mod:`pstats` module's :class:`~pstats.Stats` class has a variety of " "methods for manipulating and printing the data saved into a profile results " "file::" msgstr "" -#: ../../library/profile.rst:147 +#: ../../library/profile.rst:156 msgid "" "import pstats\n" "from pstats import SortKey\n" @@ -276,7 +278,7 @@ msgstr "" "p = pstats.Stats('restats')\n" "p.strip_dirs().sort_stats(-1).print_stats()" -#: ../../library/profile.rst:152 +#: ../../library/profile.rst:161 msgid "" "The :meth:`~pstats.Stats.strip_dirs` method removed the extraneous path from " "all the module names. The :meth:`~pstats.Stats.sort_stats` method sorted all " @@ -285,7 +287,7 @@ msgid "" "statistics. You might try the following sort calls::" msgstr "" -#: ../../library/profile.rst:158 +#: ../../library/profile.rst:167 msgid "" "p.sort_stats(SortKey.NAME)\n" "p.print_stats()" @@ -293,60 +295,60 @@ msgstr "" "p.sort_stats(SortKey.NAME)\n" "p.print_stats()" -#: ../../library/profile.rst:161 +#: ../../library/profile.rst:170 msgid "" "The first call will actually sort the list by function name, and the second " "call will print out the statistics. The following are some interesting " "calls to experiment with::" msgstr "" -#: ../../library/profile.rst:165 +#: ../../library/profile.rst:174 msgid "p.sort_stats(SortKey.CUMULATIVE).print_stats(10)" msgstr "p.sort_stats(SortKey.CUMULATIVE).print_stats(10)" -#: ../../library/profile.rst:167 +#: ../../library/profile.rst:176 msgid "" "This sorts the profile by cumulative time in a function, and then only " "prints the ten most significant lines. If you want to understand what " "algorithms are taking time, the above line is what you would use." msgstr "" -#: ../../library/profile.rst:171 +#: ../../library/profile.rst:180 msgid "" "If you were looking to see what functions were looping a lot, and taking a " "lot of time, you would do::" msgstr "" -#: ../../library/profile.rst:174 +#: ../../library/profile.rst:183 msgid "p.sort_stats(SortKey.TIME).print_stats(10)" msgstr "p.sort_stats(SortKey.TIME).print_stats(10)" -#: ../../library/profile.rst:176 +#: ../../library/profile.rst:185 msgid "" "to sort according to time spent within each function, and then print the " "statistics for the top ten functions." msgstr "" -#: ../../library/profile.rst:179 +#: ../../library/profile.rst:188 msgid "You might also try::" msgstr "" -#: ../../library/profile.rst:181 +#: ../../library/profile.rst:190 msgid "p.sort_stats(SortKey.FILENAME).print_stats('__init__')" msgstr "p.sort_stats(SortKey.FILENAME).print_stats('__init__')" -#: ../../library/profile.rst:183 +#: ../../library/profile.rst:192 msgid "" "This will sort all the statistics by file name, and then print out " "statistics for only the class init methods (since they are spelled with " "``__init__`` in them). As one final example, you could try::" msgstr "" -#: ../../library/profile.rst:187 +#: ../../library/profile.rst:196 msgid "p.sort_stats(SortKey.TIME, SortKey.CUMULATIVE).print_stats(.5, 'init')" msgstr "p.sort_stats(SortKey.TIME, SortKey.CUMULATIVE).print_stats(.5, 'init')" -#: ../../library/profile.rst:189 +#: ../../library/profile.rst:198 msgid "" "This line sorts statistics with a primary key of time, and a secondary key " "of cumulative time, and then prints out some of the statistics. To be " @@ -355,27 +357,27 @@ msgid "" "list is printed." msgstr "" -#: ../../library/profile.rst:194 +#: ../../library/profile.rst:203 msgid "" "If you wondered what functions called the above functions, you could now " "(``p`` is still sorted according to the last criteria) do::" msgstr "" -#: ../../library/profile.rst:197 +#: ../../library/profile.rst:206 msgid "p.print_callers(.5, 'init')" msgstr "p.print_callers(.5, 'init')" -#: ../../library/profile.rst:199 +#: ../../library/profile.rst:208 msgid "and you would get a list of callers for each of the listed functions." msgstr "" -#: ../../library/profile.rst:201 +#: ../../library/profile.rst:210 msgid "" "If you want more functionality, you're going to have to read the manual, or " "guess what the following functions do::" msgstr "" -#: ../../library/profile.rst:204 +#: ../../library/profile.rst:213 msgid "" "p.print_callees()\n" "p.add('restats')" @@ -383,34 +385,34 @@ msgstr "" "p.print_callees()\n" "p.add('restats')" -#: ../../library/profile.rst:207 +#: ../../library/profile.rst:216 msgid "" "Invoked as a script, the :mod:`pstats` module is a statistics browser for " "reading and examining profile dumps. It has a simple line-oriented " "interface (implemented using :mod:`cmd`) and interactive help." msgstr "" -#: ../../library/profile.rst:212 +#: ../../library/profile.rst:221 msgid ":mod:`profile` and :mod:`cProfile` Module Reference" -msgstr "" +msgstr ":mod:`profile` 與 :mod:`cProfile` 模組參考文件" -#: ../../library/profile.rst:218 +#: ../../library/profile.rst:227 msgid "" "Both the :mod:`profile` and :mod:`cProfile` modules provide the following " "functions:" msgstr "" -#: ../../library/profile.rst:223 +#: ../../library/profile.rst:232 msgid "" "This function takes a single argument that can be passed to the :func:`exec` " "function, and an optional file name. In all cases this routine executes::" msgstr "" -#: ../../library/profile.rst:226 +#: ../../library/profile.rst:235 msgid "exec(command, __main__.__dict__, __main__.__dict__)" msgstr "exec(command, __main__.__dict__, __main__.__dict__)" -#: ../../library/profile.rst:228 +#: ../../library/profile.rst:237 msgid "" "and gathers profiling statistics from the execution. If no file name is " "present, then this function automatically creates a :class:`~pstats.Stats` " @@ -419,27 +421,27 @@ msgid "" "how the results are sorted." msgstr "" -#: ../../library/profile.rst:236 +#: ../../library/profile.rst:245 msgid "" "This function is similar to :func:`run`, with added arguments to supply the " "globals and locals mappings for the *command* string. This routine executes::" msgstr "" -#: ../../library/profile.rst:240 +#: ../../library/profile.rst:249 msgid "exec(command, globals, locals)" msgstr "exec(command, globals, locals)" -#: ../../library/profile.rst:242 +#: ../../library/profile.rst:251 msgid "and gathers profiling statistics as in the :func:`run` function above." msgstr "" -#: ../../library/profile.rst:246 +#: ../../library/profile.rst:255 msgid "" "This class is normally only used if more precise control over profiling is " "needed than what the :func:`cProfile.run` function provides." msgstr "" -#: ../../library/profile.rst:249 +#: ../../library/profile.rst:258 msgid "" "A custom timer can be supplied for measuring how long code takes to run via " "the *timer* argument. This must be a function that returns a single number " @@ -449,13 +451,13 @@ msgid "" "time unit would be ``.001``." msgstr "" -#: ../../library/profile.rst:256 +#: ../../library/profile.rst:265 msgid "" "Directly using the :class:`Profile` class allows formatting profile results " "without writing the profile data to a file::" msgstr "" -#: ../../library/profile.rst:259 +#: ../../library/profile.rst:268 msgid "" "import cProfile, pstats, io\n" "from pstats import SortKey\n" @@ -481,13 +483,13 @@ msgstr "" "ps.print_stats()\n" "print(s.getvalue())" -#: ../../library/profile.rst:271 +#: ../../library/profile.rst:280 msgid "" "The :class:`Profile` class can also be used as a context manager (supported " "only in :mod:`cProfile` module. see :ref:`typecontextmanager`)::" msgstr "" -#: ../../library/profile.rst:274 +#: ../../library/profile.rst:283 msgid "" "import cProfile\n" "\n" @@ -496,61 +498,67 @@ msgid "" "\n" " pr.print_stats()" msgstr "" +"import cProfile\n" +"\n" +"with cProfile.Profile() as pr:\n" +" # ... do something ...\n" +"\n" +" pr.print_stats()" -#: ../../library/profile.rst:281 +#: ../../library/profile.rst:290 msgid "Added context manager support." msgstr "新增情境管理器的支援。" -#: ../../library/profile.rst:286 +#: ../../library/profile.rst:295 msgid "Start collecting profiling data. Only in :mod:`cProfile`." msgstr "" -#: ../../library/profile.rst:290 +#: ../../library/profile.rst:299 msgid "Stop collecting profiling data. Only in :mod:`cProfile`." msgstr "" -#: ../../library/profile.rst:294 +#: ../../library/profile.rst:303 msgid "" "Stop collecting profiling data and record the results internally as the " "current profile." msgstr "" -#: ../../library/profile.rst:299 +#: ../../library/profile.rst:308 msgid "" "Create a :class:`~pstats.Stats` object based on the current profile and " "print the results to stdout." msgstr "" -#: ../../library/profile.rst:302 +#: ../../library/profile.rst:311 msgid "" "The *sort* parameter specifies the sorting order of the displayed " "statistics. It accepts a single key or a tuple of keys to enable multi-level " "sorting, as in :func:`Stats.sort_stats `." msgstr "" -#: ../../library/profile.rst:306 +#: ../../library/profile.rst:315 msgid ":meth:`~Profile.print_stats` now accepts a tuple of keys." msgstr "" -#: ../../library/profile.rst:311 +#: ../../library/profile.rst:320 msgid "Write the results of the current profile to *filename*." msgstr "" -#: ../../library/profile.rst:315 +#: ../../library/profile.rst:324 msgid "Profile the cmd via :func:`exec`." msgstr "" -#: ../../library/profile.rst:319 +#: ../../library/profile.rst:328 msgid "" "Profile the cmd via :func:`exec` with the specified global and local " "environment." msgstr "" -#: ../../library/profile.rst:324 +#: ../../library/profile.rst:333 msgid "Profile ``func(*args, **kwargs)``" msgstr "" -#: ../../library/profile.rst:326 +#: ../../library/profile.rst:335 msgid "" "Note that profiling will only work if the called command/function actually " "returns. If the interpreter is terminated (e.g. via a :func:`sys.exit` call " @@ -558,23 +566,23 @@ msgid "" "printed." msgstr "" -#: ../../library/profile.rst:334 +#: ../../library/profile.rst:343 msgid "The :class:`Stats` Class" -msgstr "" +msgstr ":class:`Stats` 類別" -#: ../../library/profile.rst:336 +#: ../../library/profile.rst:345 msgid "" "Analysis of the profiler data is done using the :class:`~pstats.Stats` class." msgstr "" -#: ../../library/profile.rst:343 +#: ../../library/profile.rst:352 msgid "" "This class constructor creates an instance of a \"statistics object\" from a " "*filename* (or list of filenames) or from a :class:`Profile` instance. " "Output will be printed to the stream specified by *stream*." msgstr "" -#: ../../library/profile.rst:347 +#: ../../library/profile.rst:356 msgid "" "The file selected by the above constructor must have been created by the " "corresponding version of :mod:`profile` or :mod:`cProfile`. To be specific, " @@ -588,40 +596,41 @@ msgid "" "can be used." msgstr "" -#: ../../library/profile.rst:358 +#: ../../library/profile.rst:367 msgid "" "Instead of reading the profile data from a file, a :class:`cProfile.Profile` " "or :class:`profile.Profile` object can be used as the profile data source." msgstr "" -#: ../../library/profile.rst:361 +#: ../../library/profile.rst:370 msgid ":class:`Stats` objects have the following methods:" -msgstr "" +msgstr ":class:`Stats` 物件有以下方法:" -#: ../../library/profile.rst:365 +#: ../../library/profile.rst:374 msgid "" "This method for the :class:`Stats` class removes all leading path " "information from file names. It is very useful in reducing the size of the " "printout to fit within (close to) 80 columns. This method modifies the " "object, and the stripped information is lost. After performing a strip " "operation, the object is considered to have its entries in a \"random\" " -"order, as it was just after object initialization and loading. If :meth:" -"`~pstats.Stats.strip_dirs` causes two function names to be indistinguishable " -"(they are on the same line of the same filename, and have the same function " -"name), then the statistics for these two entries are accumulated into a " -"single entry." +"order, as it was just after object initialization and loading. " +"If :meth:`~pstats.Stats.strip_dirs` causes two function names to be " +"indistinguishable (they are on the same line of the same filename, and have " +"the same function name), then the statistics for these two entries are " +"accumulated into a single entry." msgstr "" -#: ../../library/profile.rst:379 +#: ../../library/profile.rst:388 msgid "" "This method of the :class:`Stats` class accumulates additional profiling " "information into the current profiling object. Its arguments should refer " -"to filenames created by the corresponding version of :func:`profile.run` or :" -"func:`cProfile.run`. Statistics for identically named (re: file, line, name) " -"functions are automatically accumulated into single function statistics." +"to filenames created by the corresponding version of :func:`profile.run` " +"or :func:`cProfile.run`. Statistics for identically named (re: file, line, " +"name) functions are automatically accumulated into single function " +"statistics." msgstr "" -#: ../../library/profile.rst:389 +#: ../../library/profile.rst:398 msgid "" "Save the data loaded into the :class:`Stats` object to a file named " "*filename*. The file is created if it does not exist, and is overwritten if " @@ -629,7 +638,7 @@ msgid "" "the :class:`profile.Profile` and :class:`cProfile.Profile` classes." msgstr "" -#: ../../library/profile.rst:397 +#: ../../library/profile.rst:406 msgid "" "This method modifies the :class:`Stats` object by sorting it according to " "the supplied criteria. The argument can be either a string or a SortKey " @@ -639,7 +648,7 @@ msgid "" "prone." msgstr "" -#: ../../library/profile.rst:404 +#: ../../library/profile.rst:413 msgid "" "When more than one key is provided, then additional keys are used as " "secondary criteria when there is equality in all keys selected before them. " @@ -648,178 +657,178 @@ msgid "" "function names) by sorting by file name." msgstr "" -#: ../../library/profile.rst:410 +#: ../../library/profile.rst:419 msgid "" "For the string argument, abbreviations can be used for any key names, as " "long as the abbreviation is unambiguous." msgstr "" -#: ../../library/profile.rst:413 +#: ../../library/profile.rst:422 msgid "The following are the valid string and SortKey:" msgstr "" -#: ../../library/profile.rst:416 +#: ../../library/profile.rst:425 msgid "Valid String Arg" msgstr "" -#: ../../library/profile.rst:416 +#: ../../library/profile.rst:425 msgid "Valid enum Arg" msgstr "" -#: ../../library/profile.rst:416 +#: ../../library/profile.rst:425 msgid "Meaning" msgstr "含義" -#: ../../library/profile.rst:418 +#: ../../library/profile.rst:427 msgid "``'calls'``" msgstr "``'calls'``" -#: ../../library/profile.rst:418 +#: ../../library/profile.rst:427 msgid "SortKey.CALLS" msgstr "SortKey.CALLS" -#: ../../library/profile.rst:418 ../../library/profile.rst:430 +#: ../../library/profile.rst:427 ../../library/profile.rst:439 msgid "call count" msgstr "" -#: ../../library/profile.rst:420 +#: ../../library/profile.rst:429 msgid "``'cumulative'``" msgstr "``'cumulative'``" -#: ../../library/profile.rst:420 +#: ../../library/profile.rst:429 msgid "SortKey.CUMULATIVE" msgstr "SortKey.CUMULATIVE" -#: ../../library/profile.rst:420 ../../library/profile.rst:422 +#: ../../library/profile.rst:429 ../../library/profile.rst:431 msgid "cumulative time" msgstr "" -#: ../../library/profile.rst:422 +#: ../../library/profile.rst:431 msgid "``'cumtime'``" msgstr "``'cumtime'``" -#: ../../library/profile.rst:422 ../../library/profile.rst:424 -#: ../../library/profile.rst:428 ../../library/profile.rst:430 -#: ../../library/profile.rst:444 +#: ../../library/profile.rst:431 ../../library/profile.rst:433 +#: ../../library/profile.rst:437 ../../library/profile.rst:439 +#: ../../library/profile.rst:453 msgid "N/A" msgstr "N/A" -#: ../../library/profile.rst:424 +#: ../../library/profile.rst:433 msgid "``'file'``" msgstr "``'file'``" -#: ../../library/profile.rst:424 ../../library/profile.rst:426 -#: ../../library/profile.rst:428 +#: ../../library/profile.rst:433 ../../library/profile.rst:435 +#: ../../library/profile.rst:437 msgid "file name" msgstr "file name(檔案名稱)" -#: ../../library/profile.rst:426 +#: ../../library/profile.rst:435 msgid "``'filename'``" msgstr "``'filename'``" -#: ../../library/profile.rst:426 +#: ../../library/profile.rst:435 msgid "SortKey.FILENAME" msgstr "SortKey.FILENAME" -#: ../../library/profile.rst:428 +#: ../../library/profile.rst:437 msgid "``'module'``" msgstr "``'module'``" -#: ../../library/profile.rst:430 +#: ../../library/profile.rst:439 msgid "``'ncalls'``" msgstr "``'ncalls'``" -#: ../../library/profile.rst:432 +#: ../../library/profile.rst:441 msgid "``'pcalls'``" msgstr "``'pcalls'``" -#: ../../library/profile.rst:432 +#: ../../library/profile.rst:441 msgid "SortKey.PCALLS" msgstr "SortKey.PCALLS" -#: ../../library/profile.rst:432 +#: ../../library/profile.rst:441 msgid "primitive call count" msgstr "" -#: ../../library/profile.rst:434 +#: ../../library/profile.rst:443 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/profile.rst:434 +#: ../../library/profile.rst:443 msgid "SortKey.LINE" msgstr "SortKey.LINE" -#: ../../library/profile.rst:434 +#: ../../library/profile.rst:443 msgid "line number" msgstr "列號" -#: ../../library/profile.rst:436 +#: ../../library/profile.rst:445 msgid "``'name'``" msgstr "``'name'``" -#: ../../library/profile.rst:436 +#: ../../library/profile.rst:445 msgid "SortKey.NAME" msgstr "SortKey.NAME" -#: ../../library/profile.rst:436 +#: ../../library/profile.rst:445 msgid "function name" msgstr "" -#: ../../library/profile.rst:438 +#: ../../library/profile.rst:447 msgid "``'nfl'``" msgstr "``'nfl'``" -#: ../../library/profile.rst:438 +#: ../../library/profile.rst:447 msgid "SortKey.NFL" msgstr "SortKey.NFL" -#: ../../library/profile.rst:438 +#: ../../library/profile.rst:447 msgid "name/file/line" msgstr "" -#: ../../library/profile.rst:440 +#: ../../library/profile.rst:449 msgid "``'stdname'``" msgstr "``'stdname'``" -#: ../../library/profile.rst:440 +#: ../../library/profile.rst:449 msgid "SortKey.STDNAME" msgstr "SortKey.STDNAME" -#: ../../library/profile.rst:440 +#: ../../library/profile.rst:449 msgid "standard name" msgstr "" -#: ../../library/profile.rst:442 +#: ../../library/profile.rst:451 msgid "``'time'``" msgstr "``'time'``" -#: ../../library/profile.rst:442 +#: ../../library/profile.rst:451 msgid "SortKey.TIME" msgstr "SortKey.TIME" -#: ../../library/profile.rst:442 ../../library/profile.rst:444 +#: ../../library/profile.rst:451 ../../library/profile.rst:453 msgid "internal time" msgstr "" -#: ../../library/profile.rst:444 +#: ../../library/profile.rst:453 msgid "``'tottime'``" msgstr "``'tottime'``" -#: ../../library/profile.rst:447 +#: ../../library/profile.rst:456 msgid "" "Note that all sorts on statistics are in descending order (placing most time " "consuming items first), where as name, file, and line number searches are in " -"ascending order (alphabetical). The subtle distinction between ``SortKey." -"NFL`` and ``SortKey.STDNAME`` is that the standard name is a sort of the " -"name as printed, which means that the embedded line numbers get compared in " -"an odd way. For example, lines 3, 20, and 40 would (if the file names were " -"the same) appear in the string order 20, 3 and 40. In contrast, ``SortKey." -"NFL`` does a numeric compare of the line numbers. In fact, " +"ascending order (alphabetical). The subtle distinction between " +"``SortKey.NFL`` and ``SortKey.STDNAME`` is that the standard name is a sort " +"of the name as printed, which means that the embedded line numbers get " +"compared in an odd way. For example, lines 3, 20, and 40 would (if the file " +"names were the same) appear in the string order 20, 3 and 40. In contrast, " +"``SortKey.NFL`` does a numeric compare of the line numbers. In fact, " "``sort_stats(SortKey.NFL)`` is the same as ``sort_stats(SortKey.NAME, " "SortKey.FILENAME, SortKey.LINE)``." msgstr "" -#: ../../library/profile.rst:458 +#: ../../library/profile.rst:467 msgid "" "For backward-compatibility reasons, the numeric arguments ``-1``, ``0``, " "``1``, and ``2`` are permitted. They are interpreted as ``'stdname'``, " @@ -828,31 +837,32 @@ msgid "" "used, and additional arguments will be silently ignored." msgstr "" -#: ../../library/profile.rst:466 +#: ../../library/profile.rst:475 msgid "Added the SortKey enum." msgstr "" -#: ../../library/profile.rst:471 +#: ../../library/profile.rst:480 msgid "" "This method for the :class:`Stats` class reverses the ordering of the basic " "list within the object. Note that by default ascending vs descending order " "is properly selected based on the sort key of choice." msgstr "" -#: ../../library/profile.rst:481 +#: ../../library/profile.rst:490 msgid "" "This method for the :class:`Stats` class prints out a report as described in " "the :func:`profile.run` definition." msgstr "" -#: ../../library/profile.rst:484 +#: ../../library/profile.rst:493 msgid "" -"The order of the printing is based on the last :meth:`~pstats.Stats." -"sort_stats` operation done on the object (subject to caveats in :meth:" -"`~pstats.Stats.add` and :meth:`~pstats.Stats.strip_dirs`)." +"The order of the printing is based on the " +"last :meth:`~pstats.Stats.sort_stats` operation done on the object (subject " +"to caveats in :meth:`~pstats.Stats.add` " +"and :meth:`~pstats.Stats.strip_dirs`)." msgstr "" -#: ../../library/profile.rst:489 +#: ../../library/profile.rst:498 msgid "" "The arguments provided (if any) can be used to limit the list down to the " "significant entries. Initially, the list is taken to be the complete set of " @@ -864,28 +874,28 @@ msgid "" "example::" msgstr "" -#: ../../library/profile.rst:498 +#: ../../library/profile.rst:507 msgid "print_stats(.1, 'foo:')" msgstr "print_stats(.1, 'foo:')" -#: ../../library/profile.rst:500 +#: ../../library/profile.rst:509 msgid "" "would first limit the printing to first 10% of list, and then only print " "functions that were part of filename :file:`.\\*foo:`. In contrast, the " "command::" msgstr "" -#: ../../library/profile.rst:504 +#: ../../library/profile.rst:513 msgid "print_stats('foo:', .1)" msgstr "print_stats('foo:', .1)" -#: ../../library/profile.rst:506 +#: ../../library/profile.rst:515 msgid "" "would limit the list to all functions having file names :file:`.\\*foo:`, " "and then proceed to only print the first 10% of them." msgstr "" -#: ../../library/profile.rst:512 +#: ../../library/profile.rst:521 msgid "" "This method for the :class:`Stats` class prints a list of all functions that " "called each function in the profiled database. The ordering is identical to " @@ -895,7 +905,7 @@ msgid "" "produced the stats:" msgstr "" -#: ../../library/profile.rst:519 +#: ../../library/profile.rst:528 msgid "" "With :mod:`profile`, a number is shown in parentheses after each caller to " "show how many times this specific call was made. For convenience, a second " @@ -903,14 +913,14 @@ msgid "" "at the right." msgstr "" -#: ../../library/profile.rst:524 +#: ../../library/profile.rst:533 msgid "" "With :mod:`cProfile`, each caller is preceded by three numbers: the number " "of times this specific call was made, and the total and cumulative times " "spent in the current function while it was invoked by this specific caller." msgstr "" -#: ../../library/profile.rst:532 +#: ../../library/profile.rst:541 msgid "" "This method for the :class:`Stats` class prints a list of all function that " "were called by the indicated function. Aside from this reversal of " @@ -918,7 +928,7 @@ msgid "" "are identical to the :meth:`~pstats.Stats.print_callers` method." msgstr "" -#: ../../library/profile.rst:540 +#: ../../library/profile.rst:549 msgid "" "This method returns an instance of StatsProfile, which contains a mapping of " "function names to instances of FunctionProfile. Each FunctionProfile " @@ -926,17 +936,17 @@ msgid "" "long the function took to run, how many times it was called, etc..." msgstr "" -#: ../../library/profile.rst:545 +#: ../../library/profile.rst:554 msgid "" "Added the following dataclasses: StatsProfile, FunctionProfile. Added the " "following function: get_stats_profile." msgstr "" -#: ../../library/profile.rst:552 +#: ../../library/profile.rst:561 msgid "What Is Deterministic Profiling?" msgstr "" -#: ../../library/profile.rst:554 +#: ../../library/profile.rst:563 msgid "" ":dfn:`Deterministic profiling` is meant to reflect the fact that all " "*function call*, *function return*, and *exception* events are monitored, " @@ -949,7 +959,7 @@ msgid "" "being spent." msgstr "" -#: ../../library/profile.rst:563 +#: ../../library/profile.rst:572 msgid "" "In Python, since there is an interpreter active during execution, the " "presence of instrumented code is not required in order to do deterministic " @@ -961,7 +971,7 @@ msgid "" "time statistics about the execution of a Python program." msgstr "" -#: ../../library/profile.rst:572 +#: ../../library/profile.rst:581 msgid "" "Call count statistics can be used to identify bugs in code (surprising " "counts), and to identify possible inline-expansion points (high call " @@ -973,11 +983,11 @@ msgid "" "compared to iterative implementations." msgstr "" -#: ../../library/profile.rst:585 +#: ../../library/profile.rst:594 msgid "Limitations" msgstr "限制" -#: ../../library/profile.rst:587 +#: ../../library/profile.rst:596 msgid "" "One limitation has to do with accuracy of timing information. There is a " "fundamental problem with deterministic profilers involving accuracy. The " @@ -988,7 +998,7 @@ msgid "" "first error induces a second source of error." msgstr "" -#: ../../library/profile.rst:595 +#: ../../library/profile.rst:604 msgid "" "The second problem is that it \"takes a while\" from when an event is " "dispatched until the profiler's call to get the time actually *gets* the " @@ -1001,7 +1011,7 @@ msgid "" "clock tick), but it *can* accumulate and become very significant." msgstr "" -#: ../../library/profile.rst:605 +#: ../../library/profile.rst:614 msgid "" "The problem is more important with :mod:`profile` than with the lower-" "overhead :mod:`cProfile`. For this reason, :mod:`profile` provides a means " @@ -1015,11 +1025,11 @@ msgid "" "calibration." msgstr "" -#: ../../library/profile.rst:619 +#: ../../library/profile.rst:628 msgid "Calibration" msgstr "校正" -#: ../../library/profile.rst:621 +#: ../../library/profile.rst:630 msgid "" "The profiler of the :mod:`profile` module subtracts a constant from each " "event handling time to compensate for the overhead of calling the time " @@ -1028,7 +1038,7 @@ msgid "" "platform (see :ref:`profile-limitations`). ::" msgstr "" -#: ../../library/profile.rst:627 +#: ../../library/profile.rst:636 msgid "" "import profile\n" "pr = profile.Profile()\n" @@ -1040,7 +1050,7 @@ msgstr "" "for i in range(5):\n" " print(pr.calibrate(10000))" -#: ../../library/profile.rst:632 +#: ../../library/profile.rst:641 msgid "" "The method executes the number of Python calls given by the argument, " "directly and again under the profiler, measuring the time for both. It then " @@ -1050,19 +1060,19 @@ msgid "" "4.04e-6." msgstr "" -#: ../../library/profile.rst:638 +#: ../../library/profile.rst:647 msgid "" "The object of this exercise is to get a fairly consistent result. If your " "computer is *very* fast, or your timer function has poor resolution, you " "might have to pass 100000, or even 1000000, to get consistent results." msgstr "" -#: ../../library/profile.rst:642 +#: ../../library/profile.rst:651 msgid "" "When you have a consistent answer, there are three ways you can use it::" msgstr "" -#: ../../library/profile.rst:644 +#: ../../library/profile.rst:653 msgid "" "import profile\n" "\n" @@ -1077,40 +1087,40 @@ msgid "" "pr = profile.Profile(bias=your_computed_bias)" msgstr "" -#: ../../library/profile.rst:656 +#: ../../library/profile.rst:665 msgid "" "If you have a choice, you are better off choosing a smaller constant, and " "then your results will \"less often\" show up as negative in profile " "statistics." msgstr "" -#: ../../library/profile.rst:662 +#: ../../library/profile.rst:671 msgid "Using a custom timer" msgstr "" -#: ../../library/profile.rst:664 +#: ../../library/profile.rst:673 msgid "" "If you want to change how current time is determined (for example, to force " "use of wall-clock time or elapsed process time), pass the timing function " "you want to the :class:`Profile` class constructor::" msgstr "" -#: ../../library/profile.rst:668 +#: ../../library/profile.rst:677 msgid "pr = profile.Profile(your_time_func)" msgstr "pr = profile.Profile(your_time_func)" -#: ../../library/profile.rst:670 +#: ../../library/profile.rst:679 msgid "" "The resulting profiler will then call ``your_time_func``. Depending on " "whether you are using :class:`profile.Profile` or :class:`cProfile.Profile`, " "``your_time_func``'s return value will be interpreted differently:" msgstr "" -#: ../../library/profile.rst:674 +#: ../../library/profile.rst:683 msgid ":class:`profile.Profile`" msgstr ":class:`profile.Profile`" -#: ../../library/profile.rst:675 +#: ../../library/profile.rst:684 msgid "" "``your_time_func`` should return a single number, or a list of numbers whose " "sum is the current time (like what :func:`os.times` returns). If the " @@ -1119,7 +1129,7 @@ msgid "" "routine." msgstr "" -#: ../../library/profile.rst:681 +#: ../../library/profile.rst:690 msgid "" "Be warned that you should calibrate the profiler class for the timer " "function that you choose (see :ref:`profile-calibration`). For most " @@ -1131,11 +1141,11 @@ msgid "" "along with the appropriate calibration constant." msgstr "" -#: ../../library/profile.rst:690 +#: ../../library/profile.rst:699 msgid ":class:`cProfile.Profile`" msgstr ":class:`cProfile.Profile`" -#: ../../library/profile.rst:691 +#: ../../library/profile.rst:700 msgid "" "``your_time_func`` should return a single number. If it returns integers, " "you can also invoke the class constructor with a second argument specifying " @@ -1144,11 +1154,11 @@ msgid "" "you would construct the :class:`Profile` instance as follows::" msgstr "" -#: ../../library/profile.rst:697 +#: ../../library/profile.rst:706 msgid "pr = cProfile.Profile(your_integer_time_func, 0.001)" msgstr "pr = cProfile.Profile(your_integer_time_func, 0.001)" -#: ../../library/profile.rst:699 +#: ../../library/profile.rst:708 msgid "" "As the :class:`cProfile.Profile` class cannot be calibrated, custom timer " "functions should be used with care and should be as fast as possible. For " @@ -1156,11 +1166,11 @@ msgid "" "in the C source of the internal :mod:`!_lsprof` module." msgstr "" -#: ../../library/profile.rst:704 +#: ../../library/profile.rst:713 msgid "" "Python 3.3 adds several new functions in :mod:`time` that can be used to " -"make precise measurements of process or wall-clock time. For example, see :" -"func:`time.perf_counter`." +"make precise measurements of process or wall-clock time. For example, " +"see :func:`time.perf_counter`." msgstr "" #: ../../library/profile.rst:16 diff --git a/library/pwd.po b/library/pwd.po index aac5275e62..4f4a5acc84 100644 --- a/library/pwd.po +++ b/library/pwd.po @@ -144,11 +144,10 @@ msgid "" "The uid and gid items are integers, all others are strings. :exc:`KeyError` " "is raised if the entry asked for cannot be found." msgstr "" -"uid 和 gid 項目為整數,其他項目都是字串。如果找不到請求的條目,則會引發 :exc:" -"`KeyError`。" +"uid 和 gid 項目為整數,其他項目都是字串。如果找不到請求的條目,則會引" +"發 :exc:`KeyError`。" #: ../../library/pwd.rst:42 -#, fuzzy msgid "" "In traditional Unix the field ``pw_passwd`` usually contains a password " "encrypted with a DES derived algorithm. However most modern unices use a " @@ -158,12 +157,11 @@ msgid "" "world readable. Whether the *pw_passwd* field contains anything useful is " "system-dependent." msgstr "" -"在傳統的 Unix 中,``pw_passwd`` 欄位通常包含一個使用 DES 衍生演算法加密的密碼" -"(參見模組 :mod:`crypt`)。然而,大多數現代 Unix 是使用所謂的 *shadow " -"password* 系統。在那些 Unix 上,*pw_passwd* 欄位僅包含一個星號 (``'*'``) 或字" -"母 ``'x'``,其中加密密碼存儲在非全域可讀的 (not world readable) :file:`/etc/" -"shadow` 文件中。 *pw_passwd* 欄位是否包含任何有用的內容取決於系統。如果可用," -"應該要在需要存取加密密碼的地方使用 :mod:`spwd` 模組。" +"在傳統的 Unix 中,``pw_passwd`` 欄位通常包含一個使用 DES 衍生演算法加密的密" +"碼。然而,大多數現代 Unix 是使用所謂的 *shadow password* 系統。在那些 Unix " +"上,*pw_passwd* 欄位僅包含一個星號 (``'*'``) 或字母 ``'x'``,其中加密密碼存儲" +"在非全域可讀的 (not world readable) :file:`/etc/shadow` 檔案中。*pw_passwd* " +"欄位是否包含任何有用的內容取決於系統。" #: ../../library/pwd.rst:50 msgid "It defines the following items:" diff --git a/library/python.po b/library/python.po index 804cb269c0..2c76635377 100644 --- a/library/python.po +++ b/library/python.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -28,3 +27,5 @@ msgid "" "related to the Python interpreter and its interaction with its environment. " "Here's an overview:" msgstr "" +"本章節所描述的模組提供了與 Python 直譯器及其與環境互動相關的廣泛服務。以下是" +"概觀:" diff --git a/library/re.po b/library/re.po index dee9f2cecd..e3e62eedc5 100644 --- a/library/re.po +++ b/library/re.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-04-11 00:15+0000\n" "PO-Revision-Date: 2023-09-16 14:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -169,7 +169,7 @@ msgstr "" msgid "The special characters are:" msgstr "" -#: ../../library/re.rst:101 ../../library/re.rst:1649 +#: ../../library/re.rst:101 ../../library/re.rst:1658 msgid "``.``" msgstr "``.``" @@ -379,19 +379,24 @@ msgstr "" #: ../../library/re.rst:253 msgid "" -"Special characters lose their special meaning inside sets. For example, " -"``[(+*)]`` will match any of the literal characters ``'('``, ``'+'``, " -"``'*'``, or ``')'``." +"Special characters except backslash lose their special meaning inside sets. " +"For example, ``[(+*)]`` will match any of the literal characters ``'('``, " +"``'+'``, ``'*'``, or ``')'``." msgstr "" -#: ../../library/re.rst:259 +#: ../../library/re.rst:260 msgid "" -"Character classes such as ``\\w`` or ``\\S`` (defined below) are also " -"accepted inside a set, although the characters they match depend on the " -"flags_ used." +"Backslash either escapes characters which have special meaning in a set such " +"as ``'-'``, ``']'``, ``'^'`` and ``'\\\\'`` itself or signals a special " +"sequence which represents a single character such as ``\\xa0`` or ``\\n`` or " +"a character class such as ``\\w`` or ``\\S`` (defined below). Note that " +"``\\b`` represents a single \"backspace\" character, not a word boundary as " +"outside a set, and numeric escapes such as ``\\1`` are always octal escapes, " +"not group references. Special sequences which do not match a single " +"character such as ``\\A`` and ``\\Z`` are not allowed." msgstr "" -#: ../../library/re.rst:264 +#: ../../library/re.rst:273 msgid "" "Characters that are not within a range can be matched by :dfn:" "`complementing` the set. If the first character of the set is ``'^'``, all " @@ -401,7 +406,7 @@ msgid "" "first character in the set." msgstr "" -#: ../../library/re.rst:271 +#: ../../library/re.rst:280 msgid "" "To match a literal ``']'`` inside a set, precede it with a backslash, or " "place it at the beginning of the set. For example, both ``[()[\\]{}]`` and " @@ -409,7 +414,7 @@ msgid "" "and parentheses." msgstr "" -#: ../../library/re.rst:281 +#: ../../library/re.rst:290 msgid "" "Support of nested sets and set operations as in `Unicode Technical Standard " "#18`_ might be added in the future. This would change the syntax, so to " @@ -419,17 +424,17 @@ msgid "" "``'||'``. To avoid a warning escape them with a backslash." msgstr "" -#: ../../library/re.rst:291 +#: ../../library/re.rst:300 msgid "" ":exc:`FutureWarning` is raised if a character set contains constructs that " "will change semantically in the future." msgstr "" -#: ../../library/re.rst:297 +#: ../../library/re.rst:306 msgid "``|``" msgstr "``|``" -#: ../../library/re.rst:298 +#: ../../library/re.rst:307 msgid "" "``A|B``, where *A* and *B* can be arbitrary REs, creates a regular " "expression that will match either *A* or *B*. An arbitrary number of REs " @@ -442,11 +447,11 @@ msgid "" "use ``\\|``, or enclose it inside a character class, as in ``[|]``." msgstr "" -#: ../../library/re.rst:311 +#: ../../library/re.rst:320 msgid "``(...)``" msgstr "``(...)``" -#: ../../library/re.rst:312 +#: ../../library/re.rst:321 msgid "" "Matches whatever regular expression is inside the parentheses, and indicates " "the start and end of a group; the contents of a group can be retrieved after " @@ -456,11 +461,11 @@ msgid "" "character class: ``[(]``, ``[)]``." msgstr "" -#: ../../library/re.rst:320 +#: ../../library/re.rst:329 msgid "``(?...)``" msgstr "``(?...)``" -#: ../../library/re.rst:321 +#: ../../library/re.rst:330 msgid "" "This is an extension notation (a ``'?'`` following a ``'('`` is not " "meaningful otherwise). The first character after the ``'?'`` determines " @@ -469,46 +474,46 @@ msgid "" "rule. Following are the currently supported extensions." msgstr "" -#: ../../library/re.rst:327 +#: ../../library/re.rst:336 msgid "``(?aiLmsux)``" msgstr "``(?aiLmsux)``" -#: ../../library/re.rst:328 +#: ../../library/re.rst:337 msgid "" "(One or more letters from the set ``'a'``, ``'i'``, ``'L'``, ``'m'``, " "``'s'``, ``'u'``, ``'x'``.) The group matches the empty string; the letters " "set the corresponding flags for the entire regular expression:" msgstr "" -#: ../../library/re.rst:333 ../../library/re.rst:365 +#: ../../library/re.rst:342 ../../library/re.rst:374 msgid ":const:`re.A` (ASCII-only matching)" msgstr "" -#: ../../library/re.rst:334 ../../library/re.rst:366 +#: ../../library/re.rst:343 ../../library/re.rst:375 msgid ":const:`re.I` (ignore case)" msgstr "" -#: ../../library/re.rst:335 ../../library/re.rst:367 +#: ../../library/re.rst:344 ../../library/re.rst:376 msgid ":const:`re.L` (locale dependent)" msgstr "" -#: ../../library/re.rst:336 ../../library/re.rst:368 +#: ../../library/re.rst:345 ../../library/re.rst:377 msgid ":const:`re.M` (multi-line)" msgstr "" -#: ../../library/re.rst:337 ../../library/re.rst:369 +#: ../../library/re.rst:346 ../../library/re.rst:378 msgid ":const:`re.S` (dot matches all)" msgstr "" -#: ../../library/re.rst:338 ../../library/re.rst:370 +#: ../../library/re.rst:347 ../../library/re.rst:379 msgid ":const:`re.U` (Unicode matching)" msgstr "" -#: ../../library/re.rst:339 ../../library/re.rst:371 +#: ../../library/re.rst:348 ../../library/re.rst:380 msgid ":const:`re.X` (verbose)" msgstr "" -#: ../../library/re.rst:341 +#: ../../library/re.rst:350 msgid "" "(The flags are described in :ref:`contents-of-module-re`.) This is useful if " "you wish to include the flags as part of the regular expression, instead of " @@ -516,15 +521,15 @@ msgid "" "be used first in the expression string." msgstr "" -#: ../../library/re.rst:347 +#: ../../library/re.rst:356 msgid "This construction can only be used at the start of the expression." msgstr "" -#: ../../library/re.rst:352 +#: ../../library/re.rst:361 msgid "``(?:...)``" msgstr "``(?:...)``" -#: ../../library/re.rst:353 +#: ../../library/re.rst:362 msgid "" "A non-capturing version of regular parentheses. Matches whatever regular " "expression is inside the parentheses, but the substring matched by the group " @@ -532,11 +537,11 @@ msgid "" "pattern." msgstr "" -#: ../../library/re.rst:358 +#: ../../library/re.rst:367 msgid "``(?aiLmsux-imsx:...)``" msgstr "``(?aiLmsux-imsx:...)``" -#: ../../library/re.rst:359 +#: ../../library/re.rst:368 msgid "" "(Zero or more letters from the set ``'a'``, ``'i'``, ``'L'``, ``'m'``, " "``'s'``, ``'u'``, ``'x'``, optionally followed by ``'-'`` followed by one or " @@ -544,11 +549,11 @@ msgid "" "or remove the corresponding flags for the part of the expression:" msgstr "" -#: ../../library/re.rst:373 +#: ../../library/re.rst:382 msgid "(The flags are described in :ref:`contents-of-module-re`.)" msgstr "" -#: ../../library/re.rst:375 +#: ../../library/re.rst:384 msgid "" "The letters ``'a'``, ``'L'`` and ``'u'`` are mutually exclusive when used as " "inline flags, so they can't be combined or follow ``'-'``. Instead, when " @@ -561,15 +566,15 @@ msgid "" "restored outside of the group." msgstr "" -#: ../../library/re.rst:387 +#: ../../library/re.rst:396 msgid "The letters ``'a'``, ``'L'`` and ``'u'`` also can be used in a group." msgstr "" -#: ../../library/re.rst:390 +#: ../../library/re.rst:399 msgid "``(?>...)``" msgstr "``(?>...)``" -#: ../../library/re.rst:391 +#: ../../library/re.rst:400 msgid "" "Attempts to match ``...`` as if it was a separate regular expression, and if " "successful, continues to match the rest of the pattern following it. If the " @@ -583,11 +588,11 @@ msgid "" "thus fail to match." msgstr "" -#: ../../library/re.rst:407 +#: ../../library/re.rst:416 msgid "``(?P...)``" msgstr "``(?P...)``" -#: ../../library/re.rst:408 +#: ../../library/re.rst:417 msgid "" "Similar to regular parentheses, but the substring matched by the group is " "accessible via the symbolic group name *name*. Group names must be valid " @@ -597,108 +602,108 @@ msgid "" "the group were not named." msgstr "" -#: ../../library/re.rst:415 +#: ../../library/re.rst:424 msgid "" "Named groups can be referenced in three contexts. If the pattern is ``(?" "P['\"]).*?(?P=quote)`` (i.e. matching a string quoted with either " "single or double quotes):" msgstr "" -#: ../../library/re.rst:420 +#: ../../library/re.rst:429 msgid "Context of reference to group \"quote\"" msgstr "" -#: ../../library/re.rst:420 +#: ../../library/re.rst:429 msgid "Ways to reference it" msgstr "" -#: ../../library/re.rst:422 +#: ../../library/re.rst:431 msgid "in the same pattern itself" msgstr "" -#: ../../library/re.rst:422 +#: ../../library/re.rst:431 msgid "``(?P=quote)`` (as shown)" msgstr "" -#: ../../library/re.rst:423 ../../library/re.rst:430 +#: ../../library/re.rst:432 ../../library/re.rst:439 msgid "``\\1``" msgstr "``\\1``" -#: ../../library/re.rst:425 +#: ../../library/re.rst:434 msgid "when processing match object *m*" msgstr "" -#: ../../library/re.rst:425 +#: ../../library/re.rst:434 msgid "``m.group('quote')``" msgstr "``m.group('quote')``" -#: ../../library/re.rst:426 +#: ../../library/re.rst:435 msgid "``m.end('quote')`` (etc.)" msgstr "" -#: ../../library/re.rst:428 +#: ../../library/re.rst:437 msgid "in a string passed to the *repl* argument of ``re.sub()``" msgstr "" -#: ../../library/re.rst:428 +#: ../../library/re.rst:437 msgid "``\\g``" msgstr "``\\g``" -#: ../../library/re.rst:429 +#: ../../library/re.rst:438 msgid "``\\g<1>``" msgstr "``\\g<1>``" -#: ../../library/re.rst:433 +#: ../../library/re.rst:442 msgid "" "In :class:`bytes` patterns, group *name* can only contain bytes in the ASCII " "range (``b'\\x00'``-``b'\\x7f'``)." msgstr "" -#: ../../library/re.rst:439 +#: ../../library/re.rst:448 msgid "``(?P=name)``" msgstr "``(?P=name)``" -#: ../../library/re.rst:440 +#: ../../library/re.rst:449 msgid "" "A backreference to a named group; it matches whatever text was matched by " "the earlier group named *name*." msgstr "" -#: ../../library/re.rst:445 +#: ../../library/re.rst:454 msgid "``(?#...)``" msgstr "``(?#...)``" -#: ../../library/re.rst:446 +#: ../../library/re.rst:455 msgid "A comment; the contents of the parentheses are simply ignored." msgstr "" -#: ../../library/re.rst:450 +#: ../../library/re.rst:459 msgid "``(?=...)``" msgstr "``(?=...)``" -#: ../../library/re.rst:451 +#: ../../library/re.rst:460 msgid "" "Matches if ``...`` matches next, but doesn't consume any of the string. " "This is called a :dfn:`lookahead assertion`. For example, ``Isaac (?" "=Asimov)`` will match ``'Isaac '`` only if it's followed by ``'Asimov'``." msgstr "" -#: ../../library/re.rst:457 +#: ../../library/re.rst:466 msgid "``(?!...)``" msgstr "``(?!...)``" -#: ../../library/re.rst:458 +#: ../../library/re.rst:467 msgid "" "Matches if ``...`` doesn't match next. This is a :dfn:`negative lookahead " "assertion`. For example, ``Isaac (?!Asimov)`` will match ``'Isaac '`` only " "if it's *not* followed by ``'Asimov'``." msgstr "" -#: ../../library/re.rst:464 +#: ../../library/re.rst:473 msgid "``(?<=...)``" msgstr "``(?<=...)``" -#: ../../library/re.rst:465 +#: ../../library/re.rst:474 msgid "" "Matches if the current position in the string is preceded by a match for " "``...`` that ends at the current position. This is called a :dfn:`positive " @@ -712,19 +717,19 @@ msgid "" "func:`match` function:" msgstr "" -#: ../../library/re.rst:480 +#: ../../library/re.rst:489 msgid "This example looks for a word following a hyphen:" msgstr "" -#: ../../library/re.rst:486 +#: ../../library/re.rst:495 msgid "Added support for group references of fixed length." msgstr "" -#: ../../library/re.rst:491 +#: ../../library/re.rst:500 msgid "``(?'``." msgstr "" -#: ../../library/re.rst:509 +#: ../../library/re.rst:518 msgid "" "Group *id* can only contain ASCII digits. In :class:`bytes` patterns, group " "*name* can only contain bytes in the ASCII range (``b'\\x00'``-``b'\\x7f'``)." msgstr "" -#: ../../library/re.rst:517 +#: ../../library/re.rst:526 msgid "" "The special sequences consist of ``'\\'`` and a character from the list " "below. If the ordinary character is not an ASCII digit or an ASCII letter, " @@ -761,11 +766,11 @@ msgid "" "matches the character ``'$'``." msgstr "" -#: ../../library/re.rst:524 +#: ../../library/re.rst:533 msgid "``\\number``" msgstr "``\\number``" -#: ../../library/re.rst:525 +#: ../../library/re.rst:534 msgid "" "Matches the contents of the group of the same number. Groups are numbered " "starting from 1. For example, ``(.+) \\1`` matches ``'the the'`` or ``'55 " @@ -777,19 +782,19 @@ msgid "" "escapes are treated as characters." msgstr "" -#: ../../library/re.rst:536 +#: ../../library/re.rst:545 msgid "``\\A``" msgstr "``\\A``" -#: ../../library/re.rst:537 +#: ../../library/re.rst:546 msgid "Matches only at the start of the string." msgstr "" -#: ../../library/re.rst:541 +#: ../../library/re.rst:550 msgid "``\\b``" msgstr "``\\b``" -#: ../../library/re.rst:542 +#: ../../library/re.rst:551 msgid "" "Matches the empty string, but only at the beginning or end of a word. A word " "is defined as a sequence of word characters. Note that formally, ``\\b`` is " @@ -799,7 +804,7 @@ msgid "" "``'as at ay'`` but not ``'attempt'`` or ``'atlas'``." msgstr "" -#: ../../library/re.rst:550 +#: ../../library/re.rst:559 msgid "" "The default word characters in Unicode (str) patterns are Unicode " "alphanumerics and the underscore, but this can be changed by using the :py:" @@ -807,17 +812,17 @@ msgid "" "if the :py:const:`~re.LOCALE` flag is used." msgstr "" -#: ../../library/re.rst:558 +#: ../../library/re.rst:567 msgid "" "Inside a character range, ``\\b`` represents the backspace character, for " "compatibility with Python's string literals." msgstr "" -#: ../../library/re.rst:563 +#: ../../library/re.rst:572 msgid "``\\B``" msgstr "``\\B``" -#: ../../library/re.rst:564 +#: ../../library/re.rst:573 msgid "" "Matches the empty string, but only when it is *not* at the beginning or end " "of a word. This means that ``r'at\\B'`` matches ``'athens'``, ``'atom'``, " @@ -828,61 +833,61 @@ msgid "" "current locale if the :py:const:`~re.LOCALE` flag is used." msgstr "" -#: ../../library/re.rst:577 +#: ../../library/re.rst:586 msgid "" "Note that ``\\B`` does not match an empty string, which differs from RE " "implementations in other programming languages such as Perl. This behavior " "is kept for compatibility reasons." msgstr "" -#: ../../library/re.rst:583 +#: ../../library/re.rst:592 msgid "``\\d``" msgstr "``\\d``" -#: ../../library/re.rst:584 ../../library/re.rst:608 ../../library/re.rst:630 +#: ../../library/re.rst:593 ../../library/re.rst:617 ../../library/re.rst:639 msgid "For Unicode (str) patterns:" msgstr "" -#: ../../library/re.rst:585 +#: ../../library/re.rst:594 msgid "" "Matches any Unicode decimal digit (that is, any character in Unicode " "character category `[Nd]`__). This includes ``[0-9]``, and also many other " "digit characters." msgstr "" -#: ../../library/re.rst:589 +#: ../../library/re.rst:598 msgid "Matches ``[0-9]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:593 ../../library/re.rst:615 ../../library/re.rst:638 +#: ../../library/re.rst:602 ../../library/re.rst:624 ../../library/re.rst:647 msgid "For 8-bit (bytes) patterns:" msgstr "" -#: ../../library/re.rst:594 +#: ../../library/re.rst:603 msgid "" "Matches any decimal digit in the ASCII character set; this is equivalent to " "``[0-9]``." msgstr "" -#: ../../library/re.rst:599 +#: ../../library/re.rst:608 msgid "``\\D``" msgstr "``\\D``" -#: ../../library/re.rst:600 +#: ../../library/re.rst:609 msgid "" "Matches any character which is not a decimal digit. This is the opposite of " "``\\d``." msgstr "" -#: ../../library/re.rst:603 +#: ../../library/re.rst:612 msgid "Matches ``[^0-9]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:607 +#: ../../library/re.rst:616 msgid "``\\s``" msgstr "``\\s``" -#: ../../library/re.rst:609 +#: ../../library/re.rst:618 msgid "" "Matches Unicode whitespace characters (as defined by :py:meth:`str." "isspace`). This includes ``[ \\t\\n\\r\\f\\v]``, and also many other " @@ -890,48 +895,48 @@ msgid "" "in many languages." msgstr "" -#: ../../library/re.rst:613 +#: ../../library/re.rst:622 msgid "" "Matches ``[ \\t\\n\\r\\f\\v]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:616 +#: ../../library/re.rst:625 msgid "" "Matches characters considered whitespace in the ASCII character set; this is " "equivalent to ``[ \\t\\n\\r\\f\\v]``." msgstr "" -#: ../../library/re.rst:621 +#: ../../library/re.rst:630 msgid "``\\S``" msgstr "``\\S``" -#: ../../library/re.rst:622 +#: ../../library/re.rst:631 msgid "" "Matches any character which is not a whitespace character. This is the " "opposite of ``\\s``." msgstr "" -#: ../../library/re.rst:625 +#: ../../library/re.rst:634 msgid "" "Matches ``[^ \\t\\n\\r\\f\\v]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:629 +#: ../../library/re.rst:638 msgid "``\\w``" msgstr "``\\w``" -#: ../../library/re.rst:631 +#: ../../library/re.rst:640 msgid "" "Matches Unicode word characters; this includes all Unicode alphanumeric " "characters (as defined by :py:meth:`str.isalnum`), as well as the underscore " "(``_``)." msgstr "" -#: ../../library/re.rst:636 +#: ../../library/re.rst:645 msgid "Matches ``[a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:639 +#: ../../library/re.rst:648 msgid "" "Matches characters considered alphanumeric in the ASCII character set; this " "is equivalent to ``[a-zA-Z0-9_]``. If the :py:const:`~re.LOCALE` flag is " @@ -939,42 +944,42 @@ msgid "" "the underscore." msgstr "" -#: ../../library/re.rst:646 +#: ../../library/re.rst:655 msgid "``\\W``" msgstr "``\\W``" -#: ../../library/re.rst:647 +#: ../../library/re.rst:656 msgid "" "Matches any character which is not a word character. This is the opposite of " "``\\w``. By default, matches non-underscore (``_``) characters for which :py:" "meth:`str.isalnum` returns ``False``." msgstr "" -#: ../../library/re.rst:652 +#: ../../library/re.rst:661 msgid "Matches ``[^a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:654 +#: ../../library/re.rst:663 msgid "" "If the :py:const:`~re.LOCALE` flag is used, matches characters which are " "neither alphanumeric in the current locale nor the underscore." msgstr "" -#: ../../library/re.rst:660 +#: ../../library/re.rst:669 msgid "``\\Z``" msgstr "``\\Z``" -#: ../../library/re.rst:661 +#: ../../library/re.rst:670 msgid "Matches only at the end of the string." msgstr "" -#: ../../library/re.rst:677 +#: ../../library/re.rst:686 msgid "" "Most of the :ref:`escape sequences ` supported by Python " "string literals are also accepted by the regular expression parser::" msgstr "" -#: ../../library/re.rst:680 +#: ../../library/re.rst:689 msgid "" "\\a \\b \\f \\n\n" "\\N \\r \\t \\u\n" @@ -984,20 +989,20 @@ msgstr "" "\\N \\r \\t \\u\n" "\\U \\v \\x \\\\" -#: ../../library/re.rst:684 +#: ../../library/re.rst:693 msgid "" "(Note that ``\\b`` is used to represent word boundaries, and means " "\"backspace\" only inside character classes.)" msgstr "" -#: ../../library/re.rst:687 +#: ../../library/re.rst:696 msgid "" "``'\\u'``, ``'\\U'``, and ``'\\N'`` escape sequences are only recognized in " "Unicode (str) patterns. In bytes patterns they are errors. Unknown escapes " "of ASCII letters are reserved for future use and treated as errors." msgstr "" -#: ../../library/re.rst:693 +#: ../../library/re.rst:702 msgid "" "Octal escapes are included in a limited form. If the first digit is a 0, or " "if there are three octal digits, it is considered an octal escape. " @@ -1005,27 +1010,27 @@ msgid "" "are always at most three digits in length." msgstr "" -#: ../../library/re.rst:698 +#: ../../library/re.rst:707 msgid "The ``'\\u'`` and ``'\\U'`` escape sequences have been added." msgstr "" -#: ../../library/re.rst:701 +#: ../../library/re.rst:710 msgid "" "Unknown escapes consisting of ``'\\'`` and an ASCII letter now are errors." msgstr "" -#: ../../library/re.rst:704 +#: ../../library/re.rst:713 msgid "" "The :samp:`'\\\\N\\\\{{name}\\\\}'` escape sequence has been added. As in " "string literals, it expands to the named Unicode character (e.g. ``'\\N{EM " "DASH}'``)." msgstr "" -#: ../../library/re.rst:712 +#: ../../library/re.rst:721 msgid "Module Contents" msgstr "模組內容" -#: ../../library/re.rst:714 +#: ../../library/re.rst:723 msgid "" "The module defines several functions, constants, and an exception. Some of " "the functions are simplified versions of the full featured methods for " @@ -1033,26 +1038,26 @@ msgid "" "compiled form." msgstr "" -#: ../../library/re.rst:721 +#: ../../library/re.rst:730 msgid "Flags" msgstr "旗標" -#: ../../library/re.rst:723 +#: ../../library/re.rst:732 msgid "" "Flag constants are now instances of :class:`RegexFlag`, which is a subclass " "of :class:`enum.IntFlag`." msgstr "" -#: ../../library/re.rst:730 +#: ../../library/re.rst:739 msgid "" "An :class:`enum.IntFlag` class containing the regex options listed below." msgstr "" -#: ../../library/re.rst:732 +#: ../../library/re.rst:741 msgid "- added to ``__all__``" msgstr "" -#: ../../library/re.rst:737 +#: ../../library/re.rst:746 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B``, ``\\d``, ``\\D``, ``\\s`` and " "``\\S`` perform ASCII-only matching instead of full Unicode matching. This " @@ -1060,11 +1065,11 @@ msgid "" "patterns." msgstr "" -#: ../../library/re.rst:741 +#: ../../library/re.rst:750 msgid "Corresponds to the inline flag ``(?a)``." msgstr "" -#: ../../library/re.rst:745 +#: ../../library/re.rst:754 msgid "" "The :py:const:`~re.U` flag still exists for backward compatibility, but is " "redundant in Python 3 since matches are Unicode by default for ``str`` " @@ -1072,15 +1077,15 @@ msgid "" "`~re.UNICODE` and the inline flag ``(?u)`` are similarly redundant." msgstr "" -#: ../../library/re.rst:754 +#: ../../library/re.rst:763 msgid "Display debug information about compiled expression." msgstr "" -#: ../../library/re.rst:756 +#: ../../library/re.rst:765 msgid "No corresponding inline flag." msgstr "" -#: ../../library/re.rst:762 +#: ../../library/re.rst:771 msgid "" "Perform case-insensitive matching; expressions like ``[A-Z]`` will also " "match lowercase letters. Full Unicode matching (such as ``Ü`` matching " @@ -1089,33 +1094,33 @@ msgid "" "flag unless the :py:const:`~re.LOCALE` flag is also used." msgstr "" -#: ../../library/re.rst:770 +#: ../../library/re.rst:779 msgid "Corresponds to the inline flag ``(?i)``." msgstr "" -#: ../../library/re.rst:772 +#: ../../library/re.rst:781 msgid "" "Note that when the Unicode patterns ``[a-z]`` or ``[A-Z]`` are used in " "combination with the :const:`IGNORECASE` flag, they will match the 52 ASCII " "letters and 4 additional non-ASCII letters: 'İ' (U+0130, Latin capital " -"letter I with dot above), 'ı' (U+0131, Latin small letter dotless i), 'ſ' " -"(U+017F, Latin small letter long s) and 'K' (U+212A, Kelvin sign). If the :" -"py:const:`~re.ASCII` flag is used, only letters 'a' to 'z' and 'A' to 'Z' " -"are matched." +"letter I with dot above), 'ı' (U+0131, Latin small letter dotless i), " +"'ſ' (U+017F, Latin small letter long s) and 'K' (U+212A, Kelvin sign). If " +"the :py:const:`~re.ASCII` flag is used, only letters 'a' to 'z' and 'A' to " +"'Z' are matched." msgstr "" -#: ../../library/re.rst:783 +#: ../../library/re.rst:792 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B`` and case-insensitive matching " "dependent on the current locale. This flag can be used only with bytes " "patterns." msgstr "" -#: ../../library/re.rst:787 +#: ../../library/re.rst:796 msgid "Corresponds to the inline flag ``(?L)``." msgstr "" -#: ../../library/re.rst:791 +#: ../../library/re.rst:800 msgid "" "This flag is discouraged; consider Unicode matching instead. The locale " "mechanism is very unreliable as it only handles one \"culture\" at a time " @@ -1124,20 +1129,20 @@ msgid "" "languages." msgstr "" -#: ../../library/re.rst:798 +#: ../../library/re.rst:807 msgid "" ":py:const:`~re.LOCALE` can be used only with bytes patterns and is not " "compatible with :py:const:`~re.ASCII`." msgstr "" -#: ../../library/re.rst:802 +#: ../../library/re.rst:811 msgid "" "Compiled regular expression objects with the :py:const:`~re.LOCALE` flag no " "longer depend on the locale at compile time. Only the locale at matching " "time affects the result of matching." msgstr "" -#: ../../library/re.rst:811 +#: ../../library/re.rst:820 msgid "" "When specified, the pattern character ``'^'`` matches at the beginning of " "the string and at the beginning of each line (immediately following each " @@ -1148,11 +1153,11 @@ msgid "" "the end of the string." msgstr "" -#: ../../library/re.rst:818 +#: ../../library/re.rst:827 msgid "Corresponds to the inline flag ``(?m)``." msgstr "" -#: ../../library/re.rst:822 +#: ../../library/re.rst:831 msgid "" "Indicates no flag being applied, the value is ``0``. This flag may be used " "as a default value for a function keyword argument or as a base value that " @@ -1160,35 +1165,35 @@ msgid "" "value::" msgstr "" -#: ../../library/re.rst:827 +#: ../../library/re.rst:836 msgid "" "def myfunc(text, flag=re.NOFLAG):\n" " return re.match(text, flag)" msgstr "" -#: ../../library/re.rst:835 +#: ../../library/re.rst:844 msgid "" "Make the ``'.'`` special character match any character at all, including a " "newline; without this flag, ``'.'`` will match anything *except* a newline." msgstr "" -#: ../../library/re.rst:838 +#: ../../library/re.rst:847 msgid "Corresponds to the inline flag ``(?s)``." msgstr "" -#: ../../library/re.rst:844 +#: ../../library/re.rst:853 msgid "" "In Python 3, Unicode characters are matched by default for ``str`` patterns. " "This flag is therefore redundant with **no effect** and is only kept for " "backward compatibility." msgstr "" -#: ../../library/re.rst:849 +#: ../../library/re.rst:858 msgid "" "See :py:const:`~re.ASCII` to restrict matching to ASCII characters instead." msgstr "" -#: ../../library/re.rst:856 +#: ../../library/re.rst:865 msgid "" "This flag allows you to write regular expressions that look nicer and are " "more readable by allowing you to visually separate logical sections of the " @@ -1201,13 +1206,13 @@ msgid "" "ignored." msgstr "" -#: ../../library/re.rst:866 +#: ../../library/re.rst:875 msgid "" "This means that the two following regular expression objects that match a " "decimal number are functionally equal::" msgstr "" -#: ../../library/re.rst:869 +#: ../../library/re.rst:878 msgid "" "a = re.compile(r\"\"\"\\d + # the integral part\n" " \\. # the decimal point\n" @@ -1215,15 +1220,15 @@ msgid "" "b = re.compile(r\"\\d+\\.\\d*\")" msgstr "" -#: ../../library/re.rst:874 +#: ../../library/re.rst:883 msgid "Corresponds to the inline flag ``(?x)``." msgstr "" -#: ../../library/re.rst:878 +#: ../../library/re.rst:887 msgid "Functions" msgstr "函式" -#: ../../library/re.rst:882 +#: ../../library/re.rst:891 msgid "" "Compile a regular expression pattern into a :ref:`regular expression object " "`, which can be used for matching using its :func:`~Pattern." @@ -1232,10 +1237,10 @@ msgstr "" "將正規表示式模式編譯成\\ :ref:`正規表示式物件 `,可以使用它的 :" "func:`~Pattern.match`、:func:`~Pattern.search` 等方法來匹配,如下所述。" -#: ../../library/re.rst:887 ../../library/re.rst:919 ../../library/re.rst:937 -#: ../../library/re.rst:948 ../../library/re.rst:994 ../../library/re.rst:1028 -#: ../../library/re.rst:1043 ../../library/re.rst:1102 -#: ../../library/re.rst:1138 +#: ../../library/re.rst:896 ../../library/re.rst:928 ../../library/re.rst:946 +#: ../../library/re.rst:957 ../../library/re.rst:1003 ../../library/re.rst:1037 +#: ../../library/re.rst:1052 ../../library/re.rst:1111 +#: ../../library/re.rst:1147 msgid "" "The expression's behaviour can be modified by specifying a *flags* value. " "Values can be any of the `flags`_ variables, combined using bitwise OR (the " @@ -1244,11 +1249,11 @@ msgstr "" "可以透過指定 *flags* 值來修改運算式的行為,值可以是任何 `flags`_ 變數,使用位" "元 OR(bitwise OR、``|`` 運算子)組合。" -#: ../../library/re.rst:891 +#: ../../library/re.rst:900 msgid "The sequence ::" msgstr "順序為: ::" -#: ../../library/re.rst:893 +#: ../../library/re.rst:902 msgid "" "prog = re.compile(pattern)\n" "result = prog.match(string)" @@ -1256,15 +1261,15 @@ msgstr "" "prog = re.compile(pattern)\n" "result = prog.match(string)" -#: ../../library/re.rst:896 +#: ../../library/re.rst:905 msgid "is equivalent to ::" msgstr "等價於: ::" -#: ../../library/re.rst:898 +#: ../../library/re.rst:907 msgid "result = re.match(pattern, string)" msgstr "result = re.match(pattern, string)" -#: ../../library/re.rst:900 +#: ../../library/re.rst:909 msgid "" "but using :func:`re.compile` and saving the resulting regular expression " "object for reuse is more efficient when the expression will be used several " @@ -1273,7 +1278,7 @@ msgstr "" "但是當表示式在單一程式中多次使用時,使用 :func:`re.compile` 並保存產生的正規" "表示式物件以供重複使用會更有效率。" -#: ../../library/re.rst:906 +#: ../../library/re.rst:915 msgid "" "The compiled versions of the most recent patterns passed to :func:`re." "compile` and the module-level matching functions are cached, so programs " @@ -1283,7 +1288,7 @@ msgstr "" "傳遞給 :func:`re.compile` 之最新模式的編譯版本和模組層級匹配函式都會被快取," "因此一次僅使用幾個正規表示式的程式不必去擔心編譯正規表示式。" -#: ../../library/re.rst:914 +#: ../../library/re.rst:923 msgid "" "Scan through *string* looking for the first location where the regular " "expression *pattern* produces a match, and return a corresponding :class:" @@ -1295,7 +1300,7 @@ msgstr "" "class:`~re.Match`。如果字串中沒有與模式匹配的位置則回傳 ``None``;請注意,這" "與在字串中的某個點查找零長度匹配不同。" -#: ../../library/re.rst:926 +#: ../../library/re.rst:935 msgid "" "If zero or more characters at the beginning of *string* match the regular " "expression *pattern*, return a corresponding :class:`~re.Match`. Return " @@ -1306,7 +1311,7 @@ msgstr "" "class:`~re.Match`。如果字串與模式不匹配,則回傳 ``None``;請注意,這與零長度" "匹配不同。" -#: ../../library/re.rst:931 +#: ../../library/re.rst:940 msgid "" "Note that even in :const:`MULTILINE` mode, :func:`re.match` will only match " "at the beginning of the string and not at the beginning of each line." @@ -1314,7 +1319,7 @@ msgstr "" "請注意,即使在 :const:`MULTILINE` 模式 (mode) 下,:func:`re.match` 只會於字串" "的開頭匹配,而非每行的開頭。" -#: ../../library/re.rst:934 +#: ../../library/re.rst:943 msgid "" "If you want to locate a match anywhere in *string*, use :func:`search` " "instead (see also :ref:`search-vs-match`)." @@ -1322,7 +1327,7 @@ msgstr "" "如果你想在 *string* 中的任何位置找到匹配項,請使用 :func:`search`\\ (另請參" "閱 :ref:`search-vs-match`)。" -#: ../../library/re.rst:944 +#: ../../library/re.rst:953 msgid "" "If the whole *string* matches the regular expression *pattern*, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " @@ -1331,7 +1336,7 @@ msgstr "" "如果整個 *string* 與正規表示式 *pattern* 匹配,則回傳對應的 :class:`~re." "Match`。如果字串與模式不匹配,則回傳 ``None``;請注意,這與零長度匹配不同。" -#: ../../library/re.rst:957 +#: ../../library/re.rst:966 msgid "" "Split *string* by the occurrences of *pattern*. If capturing parentheses " "are used in *pattern*, then the text of all groups in the pattern are also " @@ -1343,7 +1348,7 @@ msgstr "" "中所有群組的文字也會作為結果串列的一部分回傳。如果 *maxsplit* 非零,則最多發" "生 *maxsplit* 次拆分,並且字串的其餘部分會作為串列的最終元素回傳。 ::" -#: ../../library/re.rst:963 +#: ../../library/re.rst:972 msgid "" ">>> re.split(r'\\W+', 'Words, words, words.')\n" "['Words', 'words', 'words', '']\n" @@ -1363,7 +1368,7 @@ msgstr "" ">>> re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE)\n" "['0', '3', '9']" -#: ../../library/re.rst:972 +#: ../../library/re.rst:981 msgid "" "If there are capturing groups in the separator and it matches at the start " "of the string, the result will start with an empty string. The same holds " @@ -1372,7 +1377,7 @@ msgstr "" "如果分隔符號中有捕獲群組並且它在字串的開頭匹配,則結果將以空字串開頭。這同樣" "適用於字串的結尾: ::" -#: ../../library/re.rst:976 +#: ../../library/re.rst:985 msgid "" ">>> re.split(r'(\\W+)', '...words, words...')\n" "['', '...', 'words', ', ', 'words', '...', '']" @@ -1380,19 +1385,19 @@ msgstr "" ">>> re.split(r'(\\W+)', '...words, words...')\n" "['', '...', 'words', ', ', 'words', '...', '']" -#: ../../library/re.rst:979 +#: ../../library/re.rst:988 msgid "" "That way, separator components are always found at the same relative indices " "within the result list." msgstr "如此一來,分隔符號元件始終可以在結果串列中的相同相對索引處找到。" -#: ../../library/re.rst:982 +#: ../../library/re.rst:991 msgid "" "Empty matches for the pattern split the string only when not adjacent to a " "previous empty match." msgstr "只有當與先前的空匹配不相鄰時,模式的空匹配才會拆分字串。" -#: ../../library/re.rst:985 +#: ../../library/re.rst:994 msgid "" ">>> re.split(r'\\b', 'Words, words, words.')\n" "['', 'Words', ', ', 'words', ', ', 'words', '.']\n" @@ -1410,16 +1415,16 @@ msgstr "" "['', '...', '', '', 'w', '', 'o', '', 'r', '', 'd', '', 's', '...', '', '', " "'']" -#: ../../library/re.rst:998 ../../library/re.rst:1106 +#: ../../library/re.rst:1007 ../../library/re.rst:1115 msgid "Added the optional flags argument." msgstr "新增可選的旗標引數。" -#: ../../library/re.rst:1001 +#: ../../library/re.rst:1010 msgid "" "Added support of splitting on a pattern that could match an empty string." msgstr "新增了對可以匹配空字串之模式進行拆分的支援。" -#: ../../library/re.rst:1004 +#: ../../library/re.rst:1013 msgid "" "Passing *maxsplit* and *flags* as positional arguments is deprecated. In " "future Python versions they will be :ref:`keyword-only parameters `。" -#: ../../library/re.rst:1012 +#: ../../library/re.rst:1021 msgid "" "Return all non-overlapping matches of *pattern* in *string*, as a list of " "strings or tuples. The *string* is scanned left-to-right, and matches are " @@ -1437,7 +1442,7 @@ msgstr "" "以字串或元組串列的形式回傳 *string* 中 *pattern* 的所有非重疊匹配項。從左到右" "掃描 *string*,並按找到的順序回傳符合項目。結果中會包含空匹配項。" -#: ../../library/re.rst:1016 +#: ../../library/re.rst:1025 msgid "" "The result depends on the number of capturing groups in the pattern. If " "there are no groups, return a list of strings matching the whole pattern. " @@ -1450,11 +1455,11 @@ msgstr "" "列。如果恰好存在一個群組,則回傳與該群組匹配的字串串列。如果存在多個群組,則" "回傳與群組匹配的字串元組串列。非捕獲群組則不影響結果的形式。" -#: ../../library/re.rst:1032 ../../library/re.rst:1047 +#: ../../library/re.rst:1041 ../../library/re.rst:1056 msgid "Non-empty matches can now start just after a previous empty match." msgstr "非空匹配現在可以剛好在前一個空匹配的後面開始。" -#: ../../library/re.rst:1038 +#: ../../library/re.rst:1047 msgid "" "Return an :term:`iterator` yielding :class:`~re.Match` objects over all non-" "overlapping matches for the RE *pattern* in *string*. The *string* is " @@ -1465,7 +1470,7 @@ msgstr "" "yield :class:`~re.Match` 物件。從左到右掃描 *string*,並按找到的順序回傳匹配" "項目。結果中包含空匹配項。" -#: ../../library/re.rst:1053 +#: ../../library/re.rst:1062 msgid "" "Return the string obtained by replacing the leftmost non-overlapping " "occurrences of *pattern* in *string* by the replacement *repl*. If the " @@ -1485,7 +1490,7 @@ msgstr "" "留以供將來使用並被視為錯誤。其他未知轉義符例如 ``\\&`` 會被單獨保留。例如 " "``\\6`` 的反向參照將被替換為模式中第 6 組匹配的子字串。例如: ::" -#: ../../library/re.rst:1064 +#: ../../library/re.rst:1073 msgid "" ">>> re.sub(r'def\\s+([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\(\\s*\\):',\n" "... r'static PyObject*\\npy_\\1(void)\\n{',\n" @@ -1497,7 +1502,7 @@ msgstr "" "... 'def myfunc():')\n" "'static PyObject*\\npy_myfunc(void)\\n{'" -#: ../../library/re.rst:1069 +#: ../../library/re.rst:1078 msgid "" "If *repl* is a function, it is called for every non-overlapping occurrence " "of *pattern*. The function takes a single :class:`~re.Match` argument, and " @@ -1506,7 +1511,7 @@ msgstr "" "如果 *repl* 是一個函式,則 *pattern* 的每個不重疊出現之處都會呼叫它。此函式接" "收單一 :class:`~re.Match` 引數,並回傳替換字串。例如: ::" -#: ../../library/re.rst:1073 +#: ../../library/re.rst:1082 msgid "" ">>> def dashrepl(matchobj):\n" "... if matchobj.group(0) == '-': return ' '\n" @@ -1528,11 +1533,11 @@ msgstr "" "IGNORECASE)\n" "'Baked Beans & Spam'" -#: ../../library/re.rst:1082 +#: ../../library/re.rst:1091 msgid "The pattern may be a string or a :class:`~re.Pattern`." msgstr "此模式可以是字串或 :class:`~re.Pattern`。" -#: ../../library/re.rst:1084 +#: ../../library/re.rst:1093 msgid "" "The optional argument *count* is the maximum number of pattern occurrences " "to be replaced; *count* must be a non-negative integer. If omitted or zero, " @@ -1544,7 +1549,7 @@ msgstr "" "略或為零,則所有出現的內容都將被替換。只有當與先前的空匹配不相鄰時,模式的空" "匹配才會被替換,因此 ``sub('x*', '-', 'abxd')`` 會回傳 ``'-a-b--d -'``。" -#: ../../library/re.rst:1092 +#: ../../library/re.rst:1101 msgid "" "In string-type *repl* arguments, in addition to the character escapes and " "backreferences described above, ``\\g`` will use the substring matched " @@ -1563,18 +1568,18 @@ msgstr "" "群組 20 的參照,而不是對後面跟著字面字元 ``'0'`` 的群組 2 的參照。反向參照 " "``\\g<0>`` 會取代以 RE 所匹配到的整個子字串。" -#: ../../library/re.rst:1109 ../../library/re.rst:1387 +#: ../../library/re.rst:1118 ../../library/re.rst:1396 msgid "Unmatched groups are replaced with an empty string." msgstr "不匹配的群組將被替換為空字串。" -#: ../../library/re.rst:1112 +#: ../../library/re.rst:1121 msgid "" "Unknown escapes in *pattern* consisting of ``'\\'`` and an ASCII letter now " "are errors." msgstr "" "在由 ``'\\'`` 和一個 ASCII 字母組成之 *pattern* 中的未知轉義符現在為錯誤。" -#: ../../library/re.rst:1116 +#: ../../library/re.rst:1125 msgid "" "Unknown escapes in *repl* consisting of ``'\\'`` and an ASCII letter now are " "errors. Empty matches for the pattern are replaced when adjacent to a " @@ -1583,7 +1588,7 @@ msgstr "" "由 ``'\\'`` 和一個 ASCII 字母組成之 *repl* 中的未知轉義符現在為錯誤。當與先前" "的非空匹配相鄰時,模式的空匹配將被替換。" -#: ../../library/re.rst:1122 +#: ../../library/re.rst:1131 msgid "" "Group *id* can only contain ASCII digits. In :class:`bytes` replacement " "strings, group *name* can only contain bytes in the ASCII range " @@ -1592,7 +1597,7 @@ msgstr "" "群組 *id* 只能包含 ASCII 數字。在 :class:`bytes` 替換字串中,群組 *name* 只能" "包含 ASCII 範圍內的位元組 (``b'\\x00'``-``b'\\x7f'``)。" -#: ../../library/re.rst:1127 +#: ../../library/re.rst:1136 msgid "" "Passing *count* and *flags* as positional arguments is deprecated. In future " "Python versions they will be :ref:`keyword-only parameters `。" -#: ../../library/re.rst:1135 +#: ../../library/re.rst:1144 msgid "" "Perform the same operation as :func:`sub`, but return a tuple ``(new_string, " "number_of_subs_made)``." @@ -1609,7 +1614,7 @@ msgstr "" "執行與 :func:`sub` 相同的操作,但回傳一個元組 ``(new_string, " "number_of_subs_made)``。" -#: ../../library/re.rst:1145 +#: ../../library/re.rst:1154 msgid "" "Escape special characters in *pattern*. This is useful if you want to match " "an arbitrary literal string that may have regular expression metacharacters " @@ -1618,7 +1623,7 @@ msgstr "" "對 *pattern* 中的特殊字元進行轉義。如果你想要匹配其中可能包含正規表示式元字" "元 (metacharacter) 的任意文本字串,這會非常有用。例如: ::" -#: ../../library/re.rst:1149 +#: ../../library/re.rst:1158 msgid "" ">>> print(re.escape('https://www.python.org'))\n" "https://www\\.python\\.org\n" @@ -1644,7 +1649,7 @@ msgstr "" ">>> print('|'.join(map(re.escape, sorted(operators, reverse=True))))\n" "/|\\-|\\+|\\*\\*|\\*" -#: ../../library/re.rst:1160 +#: ../../library/re.rst:1169 msgid "" "This function must not be used for the replacement string in :func:`sub` " "and :func:`subn`, only backslashes should be escaped. For example::" @@ -1652,7 +1657,7 @@ msgstr "" "此函式不得用於 :func:`sub` 和 :func:`subn` 中的替換字串,僅應轉義反斜線。例" "如: ::" -#: ../../library/re.rst:1163 +#: ../../library/re.rst:1172 msgid "" ">>> digits_re = r'\\d+'\n" ">>> sample = '/usr/sbin/sendmail - 0 errors, 12 warnings'\n" @@ -1664,11 +1669,11 @@ msgstr "" ">>> print(re.sub(digits_re, digits_re.replace('\\\\', r'\\\\'), sample))\n" "/usr/sbin/sendmail - \\d+ errors, \\d+ warnings" -#: ../../library/re.rst:1168 +#: ../../library/re.rst:1177 msgid "The ``'_'`` character is no longer escaped." msgstr "``'_'`` 字元不再被轉義。" -#: ../../library/re.rst:1171 +#: ../../library/re.rst:1180 msgid "" "Only characters that can have special meaning in a regular expression are " "escaped. As a result, ``'!'``, ``'\"'``, ``'%'``, ``\"'\"``, ``','``, " @@ -1676,15 +1681,15 @@ msgid "" "are no longer escaped." msgstr "" -#: ../../library/re.rst:1180 +#: ../../library/re.rst:1189 msgid "Clear the regular expression cache." msgstr "清除正規表示式快取。" -#: ../../library/re.rst:1184 +#: ../../library/re.rst:1193 msgid "Exceptions" msgstr "例外" -#: ../../library/re.rst:1188 +#: ../../library/re.rst:1197 msgid "" "Exception raised when a string passed to one of the functions here is not a " "valid regular expression (for example, it might contain unmatched " @@ -1694,55 +1699,55 @@ msgid "" "attributes:" msgstr "" "當傳遞給此處函式之一的字串不是有效的正規表示式(例如它可能包含不匹配的括號)" -"或在編譯或匹配期間發生某些其他錯誤時,將引發例外。如果字串不包含模式匹配項,則" -"絕不是錯誤。``PatternError`` 實例具有以下附加屬性:" +"或在編譯或匹配期間發生某些其他錯誤時,將引發例外。如果字串不包含模式匹配項," +"則絕不是錯誤。``PatternError`` 實例具有以下附加屬性:" -#: ../../library/re.rst:1196 +#: ../../library/re.rst:1205 msgid "The unformatted error message." msgstr "未格式化的錯誤訊息。" -#: ../../library/re.rst:1200 +#: ../../library/re.rst:1209 msgid "The regular expression pattern." msgstr "正規表示式模式。" -#: ../../library/re.rst:1204 +#: ../../library/re.rst:1213 msgid "The index in *pattern* where compilation failed (may be ``None``)." msgstr "*pattern* 中編譯失敗的索引(可能是 ``None``)。" -#: ../../library/re.rst:1208 +#: ../../library/re.rst:1217 msgid "The line corresponding to *pos* (may be ``None``)." msgstr "對應 *pos* 的列(可能是 ``None``)。" -#: ../../library/re.rst:1212 +#: ../../library/re.rst:1221 msgid "The column corresponding to *pos* (may be ``None``)." msgstr "對應 *pos* 的欄(可能是 ``None``)。" -#: ../../library/re.rst:1214 +#: ../../library/re.rst:1223 msgid "Added additional attributes." msgstr "新增額外屬性。" -#: ../../library/re.rst:1217 +#: ../../library/re.rst:1226 msgid "" "``PatternError`` was originally named ``error``; the latter is kept as an " "alias for backward compatibility." msgstr "" "``PatternError`` 最初被命名為 ``error``;後者為了向後相容性而被保留為別名。" -#: ../../library/re.rst:1224 +#: ../../library/re.rst:1233 msgid "Regular Expression Objects" msgstr "" -#: ../../library/re.rst:1228 +#: ../../library/re.rst:1237 msgid "Compiled regular expression object returned by :func:`re.compile`." msgstr "" -#: ../../library/re.rst:1230 +#: ../../library/re.rst:1239 msgid "" ":py:class:`re.Pattern` supports ``[]`` to indicate a Unicode (str) or bytes " "pattern. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1236 +#: ../../library/re.rst:1245 msgid "" "Scan through *string* looking for the first location where this regular " "expression produces a match, and return a corresponding :class:`~re.Match`. " @@ -1751,7 +1756,7 @@ msgid "" "string." msgstr "" -#: ../../library/re.rst:1241 +#: ../../library/re.rst:1250 msgid "" "The optional second parameter *pos* gives an index in the string where the " "search is to start; it defaults to ``0``. This is not completely equivalent " @@ -1760,7 +1765,7 @@ msgid "" "necessarily at the index where the search is to start." msgstr "" -#: ../../library/re.rst:1247 +#: ../../library/re.rst:1256 msgid "" "The optional parameter *endpos* limits how far the string will be searched; " "it will be as if the string is *endpos* characters long, so only the " @@ -1770,7 +1775,7 @@ msgid "" "equivalent to ``rx.search(string[:50], 0)``. ::" msgstr "" -#: ../../library/re.rst:1254 +#: ../../library/re.rst:1263 msgid "" ">>> pattern = re.compile(\"d\")\n" ">>> pattern.search(\"dog\") # Match at index 0\n" @@ -1778,7 +1783,7 @@ msgid "" ">>> pattern.search(\"dog\", 1) # No match; search doesn't include the \"d\"" msgstr "" -#: ../../library/re.rst:1262 +#: ../../library/re.rst:1271 msgid "" "If zero or more characters at the *beginning* of *string* match this regular " "expression, return a corresponding :class:`~re.Match`. Return ``None`` if " @@ -1786,13 +1791,13 @@ msgid "" "zero-length match." msgstr "" -#: ../../library/re.rst:1267 ../../library/re.rst:1285 +#: ../../library/re.rst:1276 ../../library/re.rst:1294 msgid "" "The optional *pos* and *endpos* parameters have the same meaning as for the :" "meth:`~Pattern.search` method. ::" msgstr "" -#: ../../library/re.rst:1270 +#: ../../library/re.rst:1279 msgid "" ">>> pattern = re.compile(\"o\")\n" ">>> pattern.match(\"dog\") # No match as \"o\" is not at the start of " @@ -1802,20 +1807,20 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1275 +#: ../../library/re.rst:1284 msgid "" "If you want to locate a match anywhere in *string*, use :meth:`~Pattern." "search` instead (see also :ref:`search-vs-match`)." msgstr "" -#: ../../library/re.rst:1281 +#: ../../library/re.rst:1290 msgid "" "If the whole *string* matches this regular expression, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " "match the pattern; note that this is different from a zero-length match." msgstr "" -#: ../../library/re.rst:1288 +#: ../../library/re.rst:1297 msgid "" ">>> pattern = re.compile(\"o[gh]\")\n" ">>> pattern.fullmatch(\"dog\") # No match as \"o\" is not at the start " @@ -1826,72 +1831,72 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1299 +#: ../../library/re.rst:1308 msgid "Identical to the :func:`split` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1304 +#: ../../library/re.rst:1313 msgid "" "Similar to the :func:`findall` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1311 +#: ../../library/re.rst:1320 msgid "" "Similar to the :func:`finditer` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1318 +#: ../../library/re.rst:1327 msgid "Identical to the :func:`sub` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1323 +#: ../../library/re.rst:1332 msgid "Identical to the :func:`subn` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1328 +#: ../../library/re.rst:1337 msgid "" "The regex matching flags. This is a combination of the flags given to :func:" "`.compile`, any ``(?...)`` inline flags in the pattern, and implicit flags " "such as :py:const:`~re.UNICODE` if the pattern is a Unicode string." msgstr "" -#: ../../library/re.rst:1335 +#: ../../library/re.rst:1344 msgid "The number of capturing groups in the pattern." msgstr "" -#: ../../library/re.rst:1340 +#: ../../library/re.rst:1349 msgid "" "A dictionary mapping any symbolic group names defined by ``(?P)`` to " "group numbers. The dictionary is empty if no symbolic groups were used in " "the pattern." msgstr "" -#: ../../library/re.rst:1347 +#: ../../library/re.rst:1356 msgid "The pattern string from which the pattern object was compiled." msgstr "" -#: ../../library/re.rst:1350 +#: ../../library/re.rst:1359 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Compiled " "regular expression objects are considered atomic." msgstr "" -#: ../../library/re.rst:1358 +#: ../../library/re.rst:1367 msgid "Match Objects" msgstr "" -#: ../../library/re.rst:1360 +#: ../../library/re.rst:1369 msgid "" "Match objects always have a boolean value of ``True``. Since :meth:`~Pattern." "match` and :meth:`~Pattern.search` return ``None`` when there is no match, " "you can test whether there was a match with a simple ``if`` statement::" msgstr "" -#: ../../library/re.rst:1365 +#: ../../library/re.rst:1374 msgid "" "match = re.search(pattern, string)\n" "if match:\n" @@ -1901,17 +1906,17 @@ msgstr "" "if match:\n" " process(match)" -#: ../../library/re.rst:1371 +#: ../../library/re.rst:1380 msgid "Match object returned by successful ``match``\\ es and ``search``\\ es." msgstr "" -#: ../../library/re.rst:1373 +#: ../../library/re.rst:1382 msgid "" ":py:class:`re.Match` supports ``[]`` to indicate a Unicode (str) or bytes " "match. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1379 +#: ../../library/re.rst:1388 msgid "" "Return the string obtained by doing backslash substitution on the template " "string *template*, as done by the :meth:`~Pattern.sub` method. Escapes such " @@ -1921,7 +1926,7 @@ msgid "" "backreference ``\\g<0>`` will be replaced by the entire match." msgstr "" -#: ../../library/re.rst:1392 +#: ../../library/re.rst:1401 msgid "" "Returns one or more subgroups of the match. If there is a single argument, " "the result is a single string; if there are multiple arguments, the result " @@ -1936,7 +1941,7 @@ msgid "" "the pattern that matched multiple times, the last match is returned. ::" msgstr "" -#: ../../library/re.rst:1404 +#: ../../library/re.rst:1413 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m.group(0) # The entire match\n" @@ -1949,7 +1954,7 @@ msgid "" "('Isaac', 'Newton')" msgstr "" -#: ../../library/re.rst:1414 +#: ../../library/re.rst:1423 msgid "" "If the regular expression uses the ``(?P...)`` syntax, the *groupN* " "arguments may also be strings identifying groups by their group name. If a " @@ -1957,11 +1962,11 @@ msgid "" "`IndexError` exception is raised." msgstr "" -#: ../../library/re.rst:1419 +#: ../../library/re.rst:1428 msgid "A moderately complicated example::" msgstr "" -#: ../../library/re.rst:1421 +#: ../../library/re.rst:1430 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -1977,11 +1982,11 @@ msgstr "" ">>> m.group('last_name')\n" "'Reynolds'" -#: ../../library/re.rst:1427 +#: ../../library/re.rst:1436 msgid "Named groups can also be referred to by their index::" msgstr "" -#: ../../library/re.rst:1429 +#: ../../library/re.rst:1438 msgid "" ">>> m.group(1)\n" "'Malcolm'\n" @@ -1993,24 +1998,24 @@ msgstr "" ">>> m.group(2)\n" "'Reynolds'" -#: ../../library/re.rst:1434 +#: ../../library/re.rst:1443 msgid "If a group matches multiple times, only the last match is accessible::" msgstr "" -#: ../../library/re.rst:1436 +#: ../../library/re.rst:1445 msgid "" ">>> m = re.match(r\"(..)+\", \"a1b2c3\") # Matches 3 times.\n" ">>> m.group(1) # Returns only the last match.\n" "'c3'" msgstr "" -#: ../../library/re.rst:1443 +#: ../../library/re.rst:1452 msgid "" "This is identical to ``m.group(g)``. This allows easier access to an " "individual group from a match::" msgstr "" -#: ../../library/re.rst:1446 +#: ../../library/re.rst:1455 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m[0] # The entire match\n" @@ -2021,11 +2026,11 @@ msgid "" "'Newton'" msgstr "" -#: ../../library/re.rst:1454 +#: ../../library/re.rst:1463 msgid "Named groups are supported as well::" msgstr "" -#: ../../library/re.rst:1456 +#: ../../library/re.rst:1465 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Isaac " "Newton\")\n" @@ -2041,18 +2046,18 @@ msgstr "" ">>> m['last_name']\n" "'Newton'" -#: ../../library/re.rst:1467 +#: ../../library/re.rst:1476 msgid "" "Return a tuple containing all the subgroups of the match, from 1 up to " "however many groups are in the pattern. The *default* argument is used for " "groups that did not participate in the match; it defaults to ``None``." msgstr "" -#: ../../library/re.rst:1471 ../../library/re.rst:1696 +#: ../../library/re.rst:1480 ../../library/re.rst:1705 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/re.rst:1473 +#: ../../library/re.rst:1482 msgid "" ">>> m = re.match(r\"(\\d+)\\.(\\d+)\", \"24.1632\")\n" ">>> m.groups()\n" @@ -2062,14 +2067,14 @@ msgstr "" ">>> m.groups()\n" "('24', '1632')" -#: ../../library/re.rst:1477 +#: ../../library/re.rst:1486 msgid "" "If we make the decimal place and everything after it optional, not all " "groups might participate in the match. These groups will default to " "``None`` unless the *default* argument is given::" msgstr "" -#: ../../library/re.rst:1481 +#: ../../library/re.rst:1490 msgid "" ">>> m = re.match(r\"(\\d+)\\.?(\\d+)?\", \"24\")\n" ">>> m.groups() # Second group defaults to None.\n" @@ -2078,14 +2083,14 @@ msgid "" "('24', '0')" msgstr "" -#: ../../library/re.rst:1490 +#: ../../library/re.rst:1499 msgid "" "Return a dictionary containing all the *named* subgroups of the match, keyed " "by the subgroup name. The *default* argument is used for groups that did " "not participate in the match; it defaults to ``None``. For example::" msgstr "" -#: ../../library/re.rst:1494 +#: ../../library/re.rst:1503 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -2097,7 +2102,7 @@ msgstr "" ">>> m.groupdict()\n" "{'first_name': 'Malcolm', 'last_name': 'Reynolds'}" -#: ../../library/re.rst:1502 +#: ../../library/re.rst:1511 msgid "" "Return the indices of the start and end of the substring matched by *group*; " "*group* defaults to zero (meaning the whole matched substring). Return " @@ -2106,11 +2111,11 @@ msgid "" "matched by group *g* (equivalent to ``m.group(g)``) is ::" msgstr "" -#: ../../library/re.rst:1508 +#: ../../library/re.rst:1517 msgid "m.string[m.start(g):m.end(g)]" msgstr "m.string[m.start(g):m.end(g)]" -#: ../../library/re.rst:1510 +#: ../../library/re.rst:1519 msgid "" "Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched " "a null string. For example, after ``m = re.search('b(c?)', 'cba')``, ``m." @@ -2118,11 +2123,11 @@ msgid "" "2, and ``m.start(2)`` raises an :exc:`IndexError` exception." msgstr "" -#: ../../library/re.rst:1515 +#: ../../library/re.rst:1524 msgid "An example that will remove *remove_this* from email addresses::" msgstr "" -#: ../../library/re.rst:1517 +#: ../../library/re.rst:1526 msgid "" ">>> email = \"tony@tiremove_thisger.net\"\n" ">>> m = re.search(\"remove_this\", email)\n" @@ -2134,28 +2139,28 @@ msgstr "" ">>> email[:m.start()] + email[m.end():]\n" "'tony@tiger.net'" -#: ../../library/re.rst:1525 +#: ../../library/re.rst:1534 msgid "" "For a match *m*, return the 2-tuple ``(m.start(group), m.end(group))``. Note " "that if *group* did not contribute to the match, this is ``(-1, -1)``. " "*group* defaults to zero, the entire match." msgstr "" -#: ../../library/re.rst:1532 +#: ../../library/re.rst:1541 msgid "" "The value of *pos* which was passed to the :meth:`~Pattern.search` or :meth:" "`~Pattern.match` method of a :ref:`regex object `. This is the " "index into the string at which the RE engine started looking for a match." msgstr "" -#: ../../library/re.rst:1539 +#: ../../library/re.rst:1548 msgid "" "The value of *endpos* which was passed to the :meth:`~Pattern.search` or :" "meth:`~Pattern.match` method of a :ref:`regex object `. This is " "the index into the string beyond which the RE engine will not go." msgstr "" -#: ../../library/re.rst:1546 +#: ../../library/re.rst:1555 msgid "" "The integer index of the last matched capturing group, or ``None`` if no " "group was matched at all. For example, the expressions ``(a)b``, ``((a)" @@ -2164,43 +2169,43 @@ msgid "" "applied to the same string." msgstr "" -#: ../../library/re.rst:1555 +#: ../../library/re.rst:1564 msgid "" "The name of the last matched capturing group, or ``None`` if the group " "didn't have a name, or if no group was matched at all." msgstr "" -#: ../../library/re.rst:1561 +#: ../../library/re.rst:1570 msgid "" "The :ref:`regular expression object ` whose :meth:`~Pattern." "match` or :meth:`~Pattern.search` method produced this match instance." msgstr "" -#: ../../library/re.rst:1567 +#: ../../library/re.rst:1576 msgid "The string passed to :meth:`~Pattern.match` or :meth:`~Pattern.search`." msgstr "" -#: ../../library/re.rst:1570 +#: ../../library/re.rst:1579 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Match objects " "are considered atomic." msgstr "" -#: ../../library/re.rst:1578 +#: ../../library/re.rst:1587 msgid "Regular Expression Examples" msgstr "" -#: ../../library/re.rst:1582 +#: ../../library/re.rst:1591 msgid "Checking for a Pair" msgstr "" -#: ../../library/re.rst:1584 +#: ../../library/re.rst:1593 msgid "" "In this example, we'll use the following helper function to display match " "objects a little more gracefully::" msgstr "" -#: ../../library/re.rst:1587 +#: ../../library/re.rst:1596 msgid "" "def displaymatch(match):\n" " if match is None:\n" @@ -2212,7 +2217,7 @@ msgstr "" " return None\n" " return '' % (match.group(), match.groups())" -#: ../../library/re.rst:1592 +#: ../../library/re.rst:1601 msgid "" "Suppose you are writing a poker program where a player's hand is represented " "as a 5-character string with each character representing a card, \"a\" for " @@ -2220,11 +2225,11 @@ msgid "" "\"2\" through \"9\" representing the card with that value." msgstr "" -#: ../../library/re.rst:1597 +#: ../../library/re.rst:1606 msgid "To see if a given string is a valid hand, one could do the following::" msgstr "" -#: ../../library/re.rst:1599 +#: ../../library/re.rst:1608 msgid "" ">>> valid = re.compile(r\"^[a2-9tjqk]{5}$\")\n" ">>> displaymatch(valid.match(\"akt5q\")) # Valid.\n" @@ -2235,14 +2240,14 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1607 +#: ../../library/re.rst:1616 msgid "" "That last hand, ``\"727ak\"``, contained a pair, or two of the same valued " "cards. To match this with a regular expression, one could use backreferences " "as such::" msgstr "" -#: ../../library/re.rst:1610 +#: ../../library/re.rst:1619 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> displaymatch(pair.match(\"717ak\")) # Pair of 7s.\n" @@ -2252,13 +2257,13 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1617 +#: ../../library/re.rst:1626 msgid "" "To find out what card the pair consists of, one could use the :meth:`~Match." "group` method of the match object in the following manner::" msgstr "" -#: ../../library/re.rst:1620 +#: ../../library/re.rst:1629 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> pair.match(\"717ak\").group(1)\n" @@ -2276,11 +2281,11 @@ msgid "" "'a'" msgstr "" -#: ../../library/re.rst:1636 +#: ../../library/re.rst:1645 msgid "Simulating scanf()" msgstr "模擬 scanf()" -#: ../../library/re.rst:1640 +#: ../../library/re.rst:1649 msgid "" "Python does not currently have an equivalent to :c:func:`!scanf`. Regular " "expressions are generally more powerful, though also more verbose, than :c:" @@ -2289,130 +2294,130 @@ msgid "" "expressions." msgstr "" -#: ../../library/re.rst:1647 +#: ../../library/re.rst:1656 msgid ":c:func:`!scanf` Token" msgstr "" -#: ../../library/re.rst:1647 +#: ../../library/re.rst:1656 msgid "Regular Expression" msgstr "" -#: ../../library/re.rst:1649 +#: ../../library/re.rst:1658 msgid "``%c``" msgstr "``%c``" -#: ../../library/re.rst:1651 +#: ../../library/re.rst:1660 msgid "``%5c``" msgstr "``%5c``" -#: ../../library/re.rst:1651 +#: ../../library/re.rst:1660 msgid "``.{5}``" msgstr "``.{5}``" -#: ../../library/re.rst:1653 +#: ../../library/re.rst:1662 msgid "``%d``" msgstr "``%d``" -#: ../../library/re.rst:1653 +#: ../../library/re.rst:1662 msgid "``[-+]?\\d+``" msgstr "``[-+]?\\d+``" -#: ../../library/re.rst:1655 +#: ../../library/re.rst:1664 msgid "``%e``, ``%E``, ``%f``, ``%g``" msgstr "``%e``, ``%E``, ``%f``, ``%g``" -#: ../../library/re.rst:1655 +#: ../../library/re.rst:1664 msgid "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" msgstr "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" -#: ../../library/re.rst:1657 +#: ../../library/re.rst:1666 msgid "``%i``" msgstr "``%i``" -#: ../../library/re.rst:1657 +#: ../../library/re.rst:1666 msgid "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" msgstr "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" -#: ../../library/re.rst:1659 +#: ../../library/re.rst:1668 msgid "``%o``" msgstr "``%o``" -#: ../../library/re.rst:1659 +#: ../../library/re.rst:1668 msgid "``[-+]?[0-7]+``" msgstr "``[-+]?[0-7]+``" -#: ../../library/re.rst:1661 +#: ../../library/re.rst:1670 msgid "``%s``" msgstr "``%s``" -#: ../../library/re.rst:1661 +#: ../../library/re.rst:1670 msgid "``\\S+``" msgstr "``\\S+``" -#: ../../library/re.rst:1663 +#: ../../library/re.rst:1672 msgid "``%u``" msgstr "``%u``" -#: ../../library/re.rst:1663 +#: ../../library/re.rst:1672 msgid "``\\d+``" msgstr "``\\d+``" -#: ../../library/re.rst:1665 +#: ../../library/re.rst:1674 msgid "``%x``, ``%X``" msgstr "``%x``、``%X``" -#: ../../library/re.rst:1665 +#: ../../library/re.rst:1674 msgid "``[-+]?(0[xX])?[\\dA-Fa-f]+``" msgstr "``[-+]?(0[xX])?[\\dA-Fa-f]+``" -#: ../../library/re.rst:1668 +#: ../../library/re.rst:1677 msgid "To extract the filename and numbers from a string like ::" msgstr "" -#: ../../library/re.rst:1670 +#: ../../library/re.rst:1679 msgid "/usr/sbin/sendmail - 0 errors, 4 warnings" msgstr "/usr/sbin/sendmail - 0 errors, 4 warnings" -#: ../../library/re.rst:1672 +#: ../../library/re.rst:1681 msgid "you would use a :c:func:`!scanf` format like ::" msgstr "" -#: ../../library/re.rst:1674 +#: ../../library/re.rst:1683 msgid "%s - %d errors, %d warnings" msgstr "" -#: ../../library/re.rst:1676 +#: ../../library/re.rst:1685 msgid "The equivalent regular expression would be ::" msgstr "" -#: ../../library/re.rst:1678 +#: ../../library/re.rst:1687 msgid "(\\S+) - (\\d+) errors, (\\d+) warnings" msgstr "" -#: ../../library/re.rst:1684 +#: ../../library/re.rst:1693 msgid "search() vs. match()" msgstr "search() vs. match()" -#: ../../library/re.rst:1688 +#: ../../library/re.rst:1697 msgid "" "Python offers different primitive operations based on regular expressions:" msgstr "" -#: ../../library/re.rst:1690 +#: ../../library/re.rst:1699 msgid ":func:`re.match` checks for a match only at the beginning of the string" msgstr "" -#: ../../library/re.rst:1691 +#: ../../library/re.rst:1700 msgid "" ":func:`re.search` checks for a match anywhere in the string (this is what " "Perl does by default)" msgstr "" -#: ../../library/re.rst:1693 +#: ../../library/re.rst:1702 msgid ":func:`re.fullmatch` checks for entire string to be a match" msgstr "" -#: ../../library/re.rst:1698 +#: ../../library/re.rst:1707 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"c\", \"abcdef\") # Match\n" @@ -2422,13 +2427,13 @@ msgid "" ">>> re.fullmatch(\"r.*n\", \"python\") # No match" msgstr "" -#: ../../library/re.rst:1705 +#: ../../library/re.rst:1714 msgid "" "Regular expressions beginning with ``'^'`` can be used with :func:`search` " "to restrict the match at the beginning of the string::" msgstr "" -#: ../../library/re.rst:1708 +#: ../../library/re.rst:1717 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"^c\", \"abcdef\") # No match\n" @@ -2436,7 +2441,7 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1713 +#: ../../library/re.rst:1722 msgid "" "Note however that in :const:`MULTILINE` mode :func:`match` only matches at " "the beginning of the string, whereas using :func:`search` with a regular " @@ -2444,18 +2449,18 @@ msgid "" "line. ::" msgstr "" -#: ../../library/re.rst:1717 +#: ../../library/re.rst:1726 msgid "" ">>> re.match(\"X\", \"A\\nB\\nX\", re.MULTILINE) # No match\n" ">>> re.search(\"^X\", \"A\\nB\\nX\", re.MULTILINE) # Match\n" "" msgstr "" -#: ../../library/re.rst:1723 +#: ../../library/re.rst:1732 msgid "Making a Phonebook" msgstr "" -#: ../../library/re.rst:1725 +#: ../../library/re.rst:1734 msgid "" ":func:`split` splits a string into a list delimited by the passed pattern. " "The method is invaluable for converting textual data into data structures " @@ -2463,13 +2468,13 @@ msgid "" "following example that creates a phonebook." msgstr "" -#: ../../library/re.rst:1730 +#: ../../library/re.rst:1739 msgid "" "First, here is the input. Normally it may come from a file, here we are " "using triple-quoted string syntax" msgstr "" -#: ../../library/re.rst:1733 +#: ../../library/re.rst:1742 msgid "" ">>> text = \"\"\"Ross McFluff: 834.345.1254 155 Elm Street\n" "...\n" @@ -2487,13 +2492,13 @@ msgstr "" "...\n" "... Heather Albrecht: 548.326.4584 919 Park Place\"\"\"" -#: ../../library/re.rst:1743 +#: ../../library/re.rst:1752 msgid "" "The entries are separated by one or more newlines. Now we convert the string " "into a list with each nonempty line having its own entry:" msgstr "" -#: ../../library/re.rst:1746 +#: ../../library/re.rst:1755 msgid "" ">>> entries = re.split(\"\\n+\", text)\n" ">>> entries\n" @@ -2509,14 +2514,14 @@ msgstr "" "'Frank Burger: 925.541.7625 662 South Dogwood Way',\n" "'Heather Albrecht: 548.326.4584 919 Park Place']" -#: ../../library/re.rst:1756 +#: ../../library/re.rst:1765 msgid "" "Finally, split each entry into a list with first name, last name, telephone " "number, and address. We use the ``maxsplit`` parameter of :func:`split` " "because the address has spaces, our splitting pattern, in it:" msgstr "" -#: ../../library/re.rst:1760 +#: ../../library/re.rst:1769 msgid "" ">>> [re.split(\":? \", entry, maxsplit=3) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],\n" @@ -2530,14 +2535,14 @@ msgstr "" "['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919 Park Place']]" -#: ../../library/re.rst:1769 +#: ../../library/re.rst:1778 msgid "" "The ``:?`` pattern matches the colon after the last name, so that it does " "not occur in the result list. With a ``maxsplit`` of ``4``, we could " "separate the house number from the street name:" msgstr "" -#: ../../library/re.rst:1773 +#: ../../library/re.rst:1782 msgid "" ">>> [re.split(\":? \", entry, maxsplit=4) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155', 'Elm Street'],\n" @@ -2551,11 +2556,11 @@ msgstr "" "['Frank', 'Burger', '925.541.7625', '662', 'South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919', 'Park Place']]" -#: ../../library/re.rst:1784 +#: ../../library/re.rst:1793 msgid "Text Munging" msgstr "" -#: ../../library/re.rst:1786 +#: ../../library/re.rst:1795 msgid "" ":func:`sub` replaces every occurrence of a pattern with a string or the " "result of a function. This example demonstrates using :func:`sub` with a " @@ -2563,7 +2568,7 @@ msgid "" "each word of a sentence except for the first and last characters::" msgstr "" -#: ../../library/re.rst:1791 +#: ../../library/re.rst:1800 msgid "" ">>> def repl(m):\n" "... inner_word = list(m.group(2))\n" @@ -2587,11 +2592,11 @@ msgstr "" ">>> re.sub(r\"(\\w)(\\w+)(\\w)\", repl, text)\n" "'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.'" -#: ../../library/re.rst:1804 +#: ../../library/re.rst:1813 msgid "Finding all Adverbs" msgstr "" -#: ../../library/re.rst:1806 +#: ../../library/re.rst:1815 msgid "" ":func:`findall` matches *all* occurrences of a pattern, not just the first " "one as :func:`search` does. For example, if a writer wanted to find all of " @@ -2599,7 +2604,7 @@ msgid "" "manner::" msgstr "" -#: ../../library/re.rst:1811 +#: ../../library/re.rst:1820 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> re.findall(r\"\\w+ly\\b\", text)\n" @@ -2609,11 +2614,11 @@ msgstr "" ">>> re.findall(r\"\\w+ly\\b\", text)\n" "['carefully', 'quickly']" -#: ../../library/re.rst:1817 +#: ../../library/re.rst:1826 msgid "Finding all Adverbs and their Positions" msgstr "" -#: ../../library/re.rst:1819 +#: ../../library/re.rst:1828 msgid "" "If one wants more information about all matches of a pattern than the " "matched text, :func:`finditer` is useful as it provides :class:`~re.Match` " @@ -2622,7 +2627,7 @@ msgid "" "they would use :func:`finditer` in the following manner::" msgstr "" -#: ../../library/re.rst:1825 +#: ../../library/re.rst:1834 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> for m in re.finditer(r\"\\w+ly\\b\", text):\n" @@ -2636,11 +2641,11 @@ msgstr "" "07-16: carefully\n" "40-47: quickly" -#: ../../library/re.rst:1833 +#: ../../library/re.rst:1842 msgid "Raw String Notation" msgstr "" -#: ../../library/re.rst:1835 +#: ../../library/re.rst:1844 msgid "" "Raw string notation (``r\"text\"``) keeps regular expressions sane. Without " "it, every backslash (``'\\'``) in a regular expression would have to be " @@ -2648,7 +2653,7 @@ msgid "" "lines of code are functionally identical::" msgstr "" -#: ../../library/re.rst:1840 +#: ../../library/re.rst:1849 msgid "" ">>> re.match(r\"\\W(.)\\1\\W\", \" ff \")\n" "\n" @@ -2660,7 +2665,7 @@ msgstr "" ">>> re.match(\"\\\\W(.)\\\\1\\\\W\", \" ff \")\n" "" -#: ../../library/re.rst:1845 +#: ../../library/re.rst:1854 msgid "" "When one wants to match a literal backslash, it must be escaped in the " "regular expression. With raw string notation, this means ``r\"\\\\\"``. " @@ -2668,7 +2673,7 @@ msgid "" "following lines of code functionally identical::" msgstr "" -#: ../../library/re.rst:1850 +#: ../../library/re.rst:1859 msgid "" ">>> re.match(r\"\\\\\", r\"\\\\\")\n" "\n" @@ -2680,25 +2685,25 @@ msgstr "" ">>> re.match(\"\\\\\\\\\", r\"\\\\\")\n" "" -#: ../../library/re.rst:1857 +#: ../../library/re.rst:1866 msgid "Writing a Tokenizer" msgstr "" -#: ../../library/re.rst:1859 +#: ../../library/re.rst:1868 msgid "" "A `tokenizer or scanner `_ " "analyzes a string to categorize groups of characters. This is a useful " "first step in writing a compiler or interpreter." msgstr "" -#: ../../library/re.rst:1863 +#: ../../library/re.rst:1872 msgid "" "The text categories are specified with regular expressions. The technique " "is to combine those into a single master regular expression and to loop over " "successive matches::" msgstr "" -#: ../../library/re.rst:1867 +#: ../../library/re.rst:1876 msgid "" "from typing import NamedTuple\n" "import re\n" @@ -2754,11 +2759,11 @@ msgid "" " print(token)" msgstr "" -#: ../../library/re.rst:1919 +#: ../../library/re.rst:1928 msgid "The tokenizer produces the following output::" msgstr "" -#: ../../library/re.rst:1921 +#: ../../library/re.rst:1930 msgid "" "Token(type='IF', value='IF', line=2, column=4)\n" "Token(type='ID', value='quantity', line=2, column=7)\n" @@ -2800,7 +2805,7 @@ msgstr "" "Token(type='ENDIF', value='ENDIF', line=5, column=4)\n" "Token(type='END', value=';', line=5, column=9)" -#: ../../library/re.rst:1942 +#: ../../library/re.rst:1951 msgid "" "Friedl, Jeffrey. Mastering Regular Expressions. 3rd ed., O'Reilly Media, " "2009. The third edition of the book no longer covers Python at all, but the " @@ -2816,20 +2821,20 @@ msgstr ". (點)" #: ../../library/re.rst:123 ../../library/re.rst:130 ../../library/re.rst:137 #: ../../library/re.rst:143 ../../library/re.rst:157 ../../library/re.rst:181 #: ../../library/re.rst:220 ../../library/re.rst:235 ../../library/re.rst:244 -#: ../../library/re.rst:257 ../../library/re.rst:262 ../../library/re.rst:295 -#: ../../library/re.rst:308 ../../library/re.rst:318 ../../library/re.rst:350 -#: ../../library/re.rst:405 ../../library/re.rst:437 ../../library/re.rst:443 -#: ../../library/re.rst:448 ../../library/re.rst:455 ../../library/re.rst:462 -#: ../../library/re.rst:489 ../../library/re.rst:499 ../../library/re.rst:522 -#: ../../library/re.rst:534 ../../library/re.rst:539 ../../library/re.rst:561 -#: ../../library/re.rst:581 ../../library/re.rst:597 ../../library/re.rst:605 -#: ../../library/re.rst:619 ../../library/re.rst:627 ../../library/re.rst:644 -#: ../../library/re.rst:658 ../../library/re.rst:663 ../../library/re.rst:854 -#: ../../library/re.rst:1090 +#: ../../library/re.rst:258 ../../library/re.rst:271 ../../library/re.rst:304 +#: ../../library/re.rst:317 ../../library/re.rst:327 ../../library/re.rst:359 +#: ../../library/re.rst:414 ../../library/re.rst:446 ../../library/re.rst:452 +#: ../../library/re.rst:457 ../../library/re.rst:464 ../../library/re.rst:471 +#: ../../library/re.rst:498 ../../library/re.rst:508 ../../library/re.rst:531 +#: ../../library/re.rst:543 ../../library/re.rst:548 ../../library/re.rst:570 +#: ../../library/re.rst:590 ../../library/re.rst:606 ../../library/re.rst:614 +#: ../../library/re.rst:628 ../../library/re.rst:636 ../../library/re.rst:653 +#: ../../library/re.rst:667 ../../library/re.rst:672 ../../library/re.rst:863 +#: ../../library/re.rst:1099 msgid "in regular expressions" msgstr "於正規表示式中" -#: ../../library/re.rst:106 ../../library/re.rst:262 +#: ../../library/re.rst:106 ../../library/re.rst:271 msgid "^ (caret)" msgstr "^ (插入符號)" @@ -2877,7 +2882,7 @@ msgstr "?+" msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/re.rst:220 ../../library/re.rst:257 ../../library/re.rst:522 +#: ../../library/re.rst:220 ../../library/re.rst:258 ../../library/re.rst:531 msgid "\\ (backslash)" msgstr "\\ (反斜線)" @@ -2889,147 +2894,147 @@ msgstr "[] (方括號)" msgid "- (minus)" msgstr "- (減號)" -#: ../../library/re.rst:295 +#: ../../library/re.rst:304 msgid "| (vertical bar)" msgstr "| (垂直線)" -#: ../../library/re.rst:308 +#: ../../library/re.rst:317 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/re.rst:318 +#: ../../library/re.rst:327 msgid "(?" msgstr "(?" -#: ../../library/re.rst:350 +#: ../../library/re.rst:359 msgid "(?:" msgstr "(?:" -#: ../../library/re.rst:405 +#: ../../library/re.rst:414 msgid "(?P<" msgstr "(?P<" -#: ../../library/re.rst:437 +#: ../../library/re.rst:446 msgid "(?P=" msgstr "(?P=" -#: ../../library/re.rst:443 +#: ../../library/re.rst:452 msgid "(?#" msgstr "(?#" -#: ../../library/re.rst:448 +#: ../../library/re.rst:457 msgid "(?=" msgstr "(?=" -#: ../../library/re.rst:455 +#: ../../library/re.rst:464 msgid "(?!" msgstr "(?!" -#: ../../library/re.rst:462 +#: ../../library/re.rst:471 msgid "(?<=" msgstr "(?<=" -#: ../../library/re.rst:489 +#: ../../library/re.rst:498 msgid "(?\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -109,13 +109,13 @@ msgstr "" #: ../../library/readline.rst:67 msgid "" "Execute the init line provided in the *string* argument. This calls :c:func:" -"`rl_parse_and_bind` in the underlying library." +"`!rl_parse_and_bind` in the underlying library." msgstr "" #: ../../library/readline.rst:73 msgid "" "Execute a readline initialization file. The default filename is the last " -"filename used. This calls :c:func:`rl_read_init_file` in the underlying " +"filename used. This calls :c:func:`!rl_read_init_file` in the underlying " "library." msgstr "" @@ -129,20 +129,20 @@ msgstr "" #: ../../library/readline.rst:85 msgid "" -"Return the current contents of the line buffer (:c:data:`rl_line_buffer` in " +"Return the current contents of the line buffer (:c:data:`!rl_line_buffer` in " "the underlying library)." msgstr "" #: ../../library/readline.rst:91 msgid "" "Insert text into the line buffer at the cursor position. This calls :c:func:" -"`rl_insert_text` in the underlying library, but ignores the return value." +"`!rl_insert_text` in the underlying library, but ignores the return value." msgstr "" #: ../../library/readline.rst:98 msgid "" "Change what's displayed on the screen to reflect the current contents of the " -"line buffer. This calls :c:func:`rl_redisplay` in the underlying library." +"line buffer. This calls :c:func:`!rl_redisplay` in the underlying library." msgstr "" #: ../../library/readline.rst:103 @@ -156,22 +156,22 @@ msgstr "" #: ../../library/readline.rst:110 msgid "" "Load a readline history file, and append it to the history list. The default " -"filename is :file:`~/.history`. This calls :c:func:`read_history` in the " +"filename is :file:`~/.history`. This calls :c:func:`!read_history` in the " "underlying library." msgstr "" #: ../../library/readline.rst:117 msgid "" "Save the history list to a readline history file, overwriting any existing " -"file. The default filename is :file:`~/.history`. This calls :c:func:" -"`write_history` in the underlying library." +"file. The default filename is :file:`~/.history`. This calls :c:func:`!" +"write_history` in the underlying library." msgstr "" #: ../../library/readline.rst:124 msgid "" "Append the last *nelements* items of history to a file. The default " "filename is :file:`~/.history`. The file must already exist. This calls :c:" -"func:`append_history` in the underlying library. This function only exists " +"func:`!append_history` in the underlying library. This function only exists " "if Python was compiled for a version of the library that supports it." msgstr "" @@ -179,8 +179,8 @@ msgstr "" msgid "" "Set or return the desired number of lines to save in the history file. The :" "func:`write_history_file` function uses this value to truncate the history " -"file, by calling :c:func:`history_truncate_file` in the underlying library. " -"Negative values imply unlimited history file size." +"file, by calling :c:func:`!history_truncate_file` in the underlying " +"library. Negative values imply unlimited history file size." msgstr "" #: ../../library/readline.rst:144 @@ -193,7 +193,7 @@ msgstr "" #: ../../library/readline.rst:151 msgid "" -"Clear the current history. This calls :c:func:`clear_history` in the " +"Clear the current history. This calls :c:func:`!clear_history` in the " "underlying library. The Python function only exists if Python was compiled " "for a version of the library that supports it." msgstr "" @@ -208,32 +208,32 @@ msgstr "" #: ../../library/readline.rst:165 msgid "" "Return the current contents of history item at *index*. The item index is " -"one-based. This calls :c:func:`history_get` in the underlying library." +"one-based. This calls :c:func:`!history_get` in the underlying library." msgstr "" #: ../../library/readline.rst:171 msgid "" "Remove history item specified by its position from the history. The position " -"is zero-based. This calls :c:func:`remove_history` in the underlying " +"is zero-based. This calls :c:func:`!remove_history` in the underlying " "library." msgstr "" #: ../../library/readline.rst:178 msgid "" "Replace history item specified by its position with *line*. The position is " -"zero-based. This calls :c:func:`replace_history_entry` in the underlying " +"zero-based. This calls :c:func:`!replace_history_entry` in the underlying " "library." msgstr "" #: ../../library/readline.rst:185 msgid "" "Append *line* to the history buffer, as if it was the last line typed. This " -"calls :c:func:`add_history` in the underlying library." +"calls :c:func:`!add_history` in the underlying library." msgstr "" #: ../../library/readline.rst:191 msgid "" -"Enable or disable automatic calls to :c:func:`add_history` when reading " +"Enable or disable automatic calls to :c:func:`!add_history` when reading " "input via readline. The *enabled* argument should be a Boolean value that " "when true, enables auto history, and that when false, disables auto history." msgstr "" @@ -250,16 +250,16 @@ msgstr "" #: ../../library/readline.rst:209 msgid "" -"Set or remove the function invoked by the :c:data:`rl_startup_hook` callback " -"of the underlying library. If *function* is specified, it will be used as " -"the new hook function; if omitted or ``None``, any function already " +"Set or remove the function invoked by the :c:data:`!rl_startup_hook` " +"callback of the underlying library. If *function* is specified, it will be " +"used as the new hook function; if omitted or ``None``, any function already " "installed is removed. The hook is called with no arguments just before " "readline prints the first prompt." msgstr "" #: ../../library/readline.rst:218 msgid "" -"Set or remove the function invoked by the :c:data:`rl_pre_input_hook` " +"Set or remove the function invoked by the :c:data:`!rl_pre_input_hook` " "callback of the underlying library. If *function* is specified, it will be " "used as the new hook function; if omitted or ``None``, any function already " "installed is removed. The hook is called with no arguments after the first " @@ -295,9 +295,9 @@ msgstr "" #: ../../library/readline.rst:249 msgid "" "The installed completer function is invoked by the *entry_func* callback " -"passed to :c:func:`rl_completion_matches` in the underlying library. The " -"*text* string comes from the first parameter to the :c:data:" -"`rl_attempted_completion_function` callback of the underlying library." +"passed to :c:func:`!rl_completion_matches` in the underlying library. The " +"*text* string comes from the first parameter to the :c:data:`!" +"rl_attempted_completion_function` callback of the underlying library." msgstr "" #: ../../library/readline.rst:258 @@ -308,15 +308,15 @@ msgstr "" #: ../../library/readline.rst:263 msgid "" -"Get the type of completion being attempted. This returns the :c:data:" -"`rl_completion_type` variable in the underlying library as an integer." +"Get the type of completion being attempted. This returns the :c:data:`!" +"rl_completion_type` variable in the underlying library as an integer." msgstr "" #: ../../library/readline.rst:271 msgid "" "Get the beginning or ending index of the completion scope. These indexes are " -"the *start* and *end* arguments passed to the :c:data:" -"`rl_attempted_completion_function` callback of the underlying library. The " +"the *start* and *end* arguments passed to the :c:data:`!" +"rl_attempted_completion_function` callback of the underlying library. The " "values may be different in the same input editing scenario based on the " "underlying C readline implementation. Ex: libedit is known to behave " "differently than libreadline." @@ -326,7 +326,7 @@ msgstr "" msgid "" "Set or get the word delimiters for completion. These determine the start of " "the word to be considered for completion (the completion scope). These " -"functions access the :c:data:`rl_completer_word_break_characters` variable " +"functions access the :c:data:`!rl_completer_word_break_characters` variable " "in the underlying library." msgstr "" @@ -335,7 +335,7 @@ msgid "" "Set or remove the completion display function. If *function* is specified, " "it will be used as the new completion display function; if omitted or " "``None``, any completion display function already installed is removed. " -"This sets or clears the :c:data:`rl_completion_display_matches_hook` " +"This sets or clears the :c:data:`!rl_completion_display_matches_hook` " "callback in the underlying library. The completion display function is " "called as ``function(substitution, [matches], longest_match_length)`` once " "each time matches need to be displayed." diff --git a/library/sched.po b/library/sched.po index 3e6f6d458d..2fa14ca924 100644 --- a/library/sched.po +++ b/library/sched.po @@ -92,6 +92,33 @@ msgid "" "From print_time 1652342840.369612 default\n" "1652342840.3697174" msgstr "" +">>> import sched, time\n" +">>> s = sched.scheduler(time.time, time.sleep)\n" +">>> def print_time(a='default'):\n" +"... print(\"From print_time\", time.time(), a)\n" +"...\n" +">>> def print_some_times():\n" +"... print(time.time())\n" +"... s.enter(10, 1, print_time)\n" +"... s.enter(5, 2, print_time, argument=('positional',))\n" +"... # 儘管優先順序較高,但由於 enter() 是相對的,'keyword' 在 " +"'positional' 之後運行\n" +"... s.enter(5, 1, print_time, kwargs={'a': 'keyword'})\n" +"... s.enterabs(1_650_000_000, 10, print_time, argument=(\"first " +"enterabs\",))\n" +"... s.enterabs(1_650_000_000, 5, print_time, argument=(\"second " +"enterabs\",))\n" +"... s.run()\n" +"... print(time.time())\n" +"...\n" +">>> print_some_times()\n" +"1652342830.3640375\n" +"From print_time 1652342830.3642538 second enterabs\n" +"From print_time 1652342830.3643398 first enterabs\n" +"From print_time 1652342835.3694863 positional\n" +"From print_time 1652342835.3696074 keyword\n" +"From print_time 1652342840.369612 default\n" +"1652342840.3697174" #: ../../library/sched.rst:67 msgid "Scheduler Objects" @@ -149,8 +176,8 @@ msgid "" "Remove the event from the queue. If *event* is not an event currently in the " "queue, this method will raise a :exc:`ValueError`." msgstr "" -"從佇列中刪除該事件。如果 *event* 不是目前佇列中的事件,此方法將引發 :exc:" -"`ValueError`。" +"從佇列中刪除該事件。如果 *event* 不是目前佇列中的事件,此方法將引" +"發 :exc:`ValueError`。" #: ../../library/sched.rst:113 msgid "Return ``True`` if the event queue is empty." diff --git a/library/secrets.po b/library/secrets.po index d2bfde8612..4381fc459f 100644 --- a/library/secrets.po +++ b/library/secrets.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 23:08+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2022-11-30 13:42+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -66,8 +66,8 @@ msgid "" "provided by the operating system. See :class:`random.SystemRandom` for " "additional details." msgstr "" -"一個用來產生亂數的類別,用的是作業系統提供的最高品質來源。 請參閱 :class:" -"`random.SystemRandom` 以獲取更多細節。" +"一個用來產生亂數的類別,用的是作業系統提供的最高品質來源。 請參" +"閱 :class:`random.SystemRandom` 以獲取更多細節。" #: ../../library/secrets.rst:47 msgid "Return a randomly chosen element from a non-empty sequence." @@ -104,10 +104,10 @@ msgstr "" #: ../../library/secrets.rst:71 msgid "" -">>> token_bytes(16) \n" +">>> token_bytes(16)\n" "b'\\xebr\\x17D*t\\xae\\xd4\\xe3S\\xb6\\xe2\\xebP1\\x8b'" msgstr "" -">>> token_bytes(16) \n" +">>> token_bytes(16)\n" "b'\\xebr\\x17D*t\\xae\\xd4\\xe3S\\xb6\\xe2\\xebP1\\x8b'" #: ../../library/secrets.rst:79 @@ -122,10 +122,10 @@ msgstr "" #: ../../library/secrets.rst:83 msgid "" -">>> token_hex(16) \n" +">>> token_hex(16)\n" "'f9bf78b9a18ce6d46a0cd2b0b86df9da'" msgstr "" -">>> token_hex(16) \n" +">>> token_hex(16)\n" "'f9bf78b9a18ce6d46a0cd2b0b86df9da'" #: ../../library/secrets.rst:90 @@ -141,10 +141,10 @@ msgstr "" #: ../../library/secrets.rst:95 msgid "" -">>> token_urlsafe(16) \n" +">>> token_urlsafe(16)\n" "'Drmhze6EPcv0fN_81Bj-nA'" msgstr "" -">>> token_urlsafe(16) \n" +">>> token_urlsafe(16)\n" "'Drmhze6EPcv0fN_81Bj-nA'" #: ../../library/secrets.rst:102 @@ -174,9 +174,9 @@ msgid "" "argument to the various ``token_*`` functions. That argument is taken as " "the number of bytes of randomness to use." msgstr "" -"對於想自行管理權杖長度的使用者,你可以對各種 ``token_*`` 函式明白地指定 :" -"class:`int` 引數(argument)來指定權杖要使用的隨機性程度。 該引數以位元組數來" -"表示要使用的隨機性程度。" +"對於想自行管理權杖長度的使用者,你可以對各種 ``token_*`` 函式明白地指" +"定 :class:`int` 引數(argument)來指定權杖要使用的隨機性程度。 該引數以位元組" +"數來表示要使用的隨機性程度。" #: ../../library/secrets.rst:117 msgid "" @@ -289,6 +289,12 @@ msgid "" " words = [word.strip() for word in f]\n" " password = ' '.join(secrets.choice(words) for i in range(4))" msgstr "" +"import secrets\n" +"# 在標準 Linux 系統上,使用一個方便的字典檔案。\n" +"# 其他平台可能需要提供自己的字詞列表。\n" +"with open('/usr/share/dict/words') as f:\n" +" words = [word.strip() for word in f]\n" +" password = ' '.join(secrets.choice(words) for i in range(4))" #: ../../library/secrets.rst:192 msgid "" diff --git a/library/selectors.po b/library/selectors.po index 6b0f35f089..e231d00893 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -166,35 +166,35 @@ msgid "" "implementations support the :term:`context manager` protocol." msgstr "" -#: ../../library/selectors.rst:108 +#: ../../library/selectors.rst:109 msgid "Register a file object for selection, monitoring it for I/O events." msgstr "" -#: ../../library/selectors.rst:110 +#: ../../library/selectors.rst:111 msgid "" "*fileobj* is the file object to monitor. It may either be an integer file " "descriptor or an object with a ``fileno()`` method. *events* is a bitwise " "mask of events to monitor. *data* is an opaque object." msgstr "" -#: ../../library/selectors.rst:115 +#: ../../library/selectors.rst:116 msgid "" "This returns a new :class:`SelectorKey` instance, or raises a :exc:" "`ValueError` in case of invalid event mask or file descriptor, or :exc:" "`KeyError` if the file object is already registered." msgstr "" -#: ../../library/selectors.rst:121 +#: ../../library/selectors.rst:123 msgid "" "Unregister a file object from selection, removing it from monitoring. A file " "object shall be unregistered prior to being closed." msgstr "" -#: ../../library/selectors.rst:124 +#: ../../library/selectors.rst:126 msgid "*fileobj* must be a file object previously registered." msgstr "" -#: ../../library/selectors.rst:126 +#: ../../library/selectors.rst:128 msgid "" "This returns the associated :class:`SelectorKey` instance, or raises a :exc:" "`KeyError` if *fileobj* is not registered. It will raise :exc:`ValueError` " @@ -202,30 +202,30 @@ msgid "" "``fileno()`` method has an invalid return value)." msgstr "" -#: ../../library/selectors.rst:133 +#: ../../library/selectors.rst:135 msgid "Change a registered file object's monitored events or attached data." msgstr "" -#: ../../library/selectors.rst:135 +#: ../../library/selectors.rst:137 msgid "" "This is equivalent to ``BaseSelector.unregister(fileobj)`` followed by " "``BaseSelector.register(fileobj, events, data)``, except that it can be " "implemented more efficiently." msgstr "" -#: ../../library/selectors.rst:139 +#: ../../library/selectors.rst:141 msgid "" "This returns a new :class:`SelectorKey` instance, or raises a :exc:" "`ValueError` in case of invalid event mask or file descriptor, or :exc:" "`KeyError` if the file object is not registered." msgstr "" -#: ../../library/selectors.rst:145 +#: ../../library/selectors.rst:148 msgid "" "Wait until some registered file objects become ready, or the timeout expires." msgstr "" -#: ../../library/selectors.rst:148 +#: ../../library/selectors.rst:151 msgid "" "If ``timeout > 0``, this specifies the maximum wait time, in seconds. If " "``timeout <= 0``, the call won't block, and will report the currently ready " @@ -233,26 +233,26 @@ msgid "" "monitored file object becomes ready." msgstr "" -#: ../../library/selectors.rst:154 +#: ../../library/selectors.rst:157 msgid "" "This returns a list of ``(key, events)`` tuples, one for each ready file " "object." msgstr "" -#: ../../library/selectors.rst:157 +#: ../../library/selectors.rst:160 msgid "" "*key* is the :class:`SelectorKey` instance corresponding to a ready file " "object. *events* is a bitmask of events ready on this file object." msgstr "" -#: ../../library/selectors.rst:162 +#: ../../library/selectors.rst:165 msgid "" "This method can return before any file object becomes ready or the timeout " "has elapsed if the current process receives a signal: in this case, an empty " "list will be returned." msgstr "" -#: ../../library/selectors.rst:166 +#: ../../library/selectors.rst:169 msgid "" "The selector is now retried with a recomputed timeout when interrupted by a " "signal if the signal handler did not raise an exception (see :pep:`475` for " @@ -260,90 +260,90 @@ msgid "" "timeout." msgstr "" -#: ../../library/selectors.rst:174 +#: ../../library/selectors.rst:177 msgid "Close the selector." msgstr "" -#: ../../library/selectors.rst:176 +#: ../../library/selectors.rst:179 msgid "" "This must be called to make sure that any underlying resource is freed. The " "selector shall not be used once it has been closed." msgstr "" -#: ../../library/selectors.rst:181 +#: ../../library/selectors.rst:184 msgid "Return the key associated with a registered file object." msgstr "" -#: ../../library/selectors.rst:183 +#: ../../library/selectors.rst:186 msgid "" "This returns the :class:`SelectorKey` instance associated to this file " "object, or raises :exc:`KeyError` if the file object is not registered." msgstr "" -#: ../../library/selectors.rst:188 +#: ../../library/selectors.rst:192 msgid "Return a mapping of file objects to selector keys." msgstr "" -#: ../../library/selectors.rst:190 +#: ../../library/selectors.rst:194 msgid "" "This returns a :class:`~collections.abc.Mapping` instance mapping registered " "file objects to their associated :class:`SelectorKey` instance." msgstr "" -#: ../../library/selectors.rst:197 +#: ../../library/selectors.rst:201 msgid "" "The default selector class, using the most efficient implementation " "available on the current platform. This should be the default choice for " "most users." msgstr "" -#: ../../library/selectors.rst:204 +#: ../../library/selectors.rst:208 msgid ":func:`select.select`-based selector." msgstr "" -#: ../../library/selectors.rst:209 +#: ../../library/selectors.rst:213 msgid ":func:`select.poll`-based selector." msgstr "" -#: ../../library/selectors.rst:214 +#: ../../library/selectors.rst:218 msgid ":func:`select.epoll`-based selector." msgstr "" -#: ../../library/selectors.rst:218 +#: ../../library/selectors.rst:222 msgid "" "This returns the file descriptor used by the underlying :func:`select.epoll` " "object." msgstr "" -#: ../../library/selectors.rst:223 +#: ../../library/selectors.rst:227 msgid ":func:`select.devpoll`-based selector." msgstr "" -#: ../../library/selectors.rst:227 +#: ../../library/selectors.rst:231 msgid "" "This returns the file descriptor used by the underlying :func:`select." "devpoll` object." msgstr "" -#: ../../library/selectors.rst:234 +#: ../../library/selectors.rst:238 msgid ":func:`select.kqueue`-based selector." msgstr "" -#: ../../library/selectors.rst:238 +#: ../../library/selectors.rst:242 msgid "" "This returns the file descriptor used by the underlying :func:`select." "kqueue` object." msgstr "" -#: ../../library/selectors.rst:243 +#: ../../library/selectors.rst:247 msgid "Examples" msgstr "範例" -#: ../../library/selectors.rst:245 +#: ../../library/selectors.rst:249 msgid "Here is a simple echo server implementation::" msgstr "" -#: ../../library/selectors.rst:247 +#: ../../library/selectors.rst:251 msgid "" "import selectors\n" "import socket\n" diff --git a/library/shutil.po b/library/shutil.po index 633b582f04..b8b5d44058 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-23 00:14+0000\n" +"POT-Creation-Date: 2025-04-20 00:16+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -625,8 +625,9 @@ msgid "" msgstr "" #: ../../library/shutil.rst:476 +#, fuzzy msgid "" -">> shutil.which(\"C:\\\\Python33\\\\python\")\n" +">>> shutil.which(\"C:\\\\Python33\\\\python\")\n" "'C:\\\\Python33\\\\python.EXE'" msgstr "" ">> shutil.which(\"C:\\\\Python33\\\\python\")\n" diff --git a/library/signal.po b/library/signal.po index 2f85ac971d..5b01072bd5 100644 --- a/library/signal.po +++ b/library/signal.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-04-15 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -196,9 +196,9 @@ msgstr "" #: ../../library/signal.rst:351 ../../library/signal.rst:390 #: ../../library/signal.rst:414 ../../library/signal.rst:437 #: ../../library/signal.rst:471 ../../library/signal.rst:501 -#: ../../library/signal.rst:508 ../../library/signal.rst:561 -#: ../../library/signal.rst:603 ../../library/signal.rst:618 -#: ../../library/signal.rst:644 ../../library/signal.rst:664 +#: ../../library/signal.rst:508 ../../library/signal.rst:563 +#: ../../library/signal.rst:605 ../../library/signal.rst:620 +#: ../../library/signal.rst:646 ../../library/signal.rst:666 msgid "Availability" msgstr "" @@ -690,16 +690,19 @@ msgid "Returns current value of a given interval timer specified by *which*." msgstr "回傳由 *which* 指定之間隔計時器的當前值。" #: ../../library/signal.rst:513 +#, fuzzy msgid "" -"Set the wakeup file descriptor to *fd*. When a signal is received, the " -"signal number is written as a single byte into the fd. This can be used by " -"a library to wakeup a poll or select call, allowing the signal to be fully " -"processed." +"Set the wakeup file descriptor to *fd*. When a signal your program has " +"registered a signal handler for is received, the signal number is written as " +"a single byte into the fd. If you haven't registered a signal handler for " +"the signals you care about, then nothing will be written to the wakeup fd. " +"This can be used by a library to wakeup a poll or select call, allowing the " +"signal to be fully processed." msgstr "" "設定喚醒檔案描述器為 *fd*。當接收到訊號時,訊號編號會以單一位元組寫入 fd。這" "可被函式庫用來喚醒輪詢 (wakeup a poll) 或 select 呼叫,讓訊號得以完全處理。" -#: ../../library/signal.rst:518 +#: ../../library/signal.rst:520 msgid "" "The old wakeup fd is returned (or -1 if file descriptor wakeup was not " "enabled). If *fd* is -1, file descriptor wakeup is disabled. If not -1, " @@ -710,7 +713,7 @@ msgstr "" "停用檔案描述器喚醒。如果不是 -1,*fd* 必須是非阻塞的。在再次呼叫輪詢或 " "select 之前,由函式庫來決定是否移除 *fd* 中的任何位元組。" -#: ../../library/signal.rst:523 ../../library/signal.rst:578 +#: ../../library/signal.rst:525 ../../library/signal.rst:580 msgid "" "When threads are enabled, this function can only be called from :ref:`the " "main thread of the main interpreter `; attempting to " @@ -720,7 +723,7 @@ msgstr "" "當啟用執行緒時,這個函式只能從\\ :ref:`主直譯器 `\\ 的主" "執行緒來呼叫;嘗試從其他執行緒呼叫它將會引發 :exc:`ValueError` 例外。" -#: ../../library/signal.rst:528 +#: ../../library/signal.rst:530 msgid "" "There are two common ways to use this function. In both approaches, you use " "the fd to wake up when a signal arrives, but then they differ in how they " @@ -729,7 +732,7 @@ msgstr "" "使用這個函式有兩種常見的方式。在這兩種方法中,當訊號抵達時,你都要使用 fd 來" "喚醒,但它們的不同之處在於如何判斷\\ *哪個或哪些*\\ 訊號有抵達。" -#: ../../library/signal.rst:533 +#: ../../library/signal.rst:535 msgid "" "In the first approach, we read the data out of the fd's buffer, and the byte " "values give you the signal numbers. This is simple, but in rare cases it can " @@ -745,7 +748,7 @@ msgstr "" "法,那麼你應該設定 ``warn_on_full_buffer=True``,這至少會在訊號丟失時將警告印" "出到 stderr。" -#: ../../library/signal.rst:542 +#: ../../library/signal.rst:544 msgid "" "In the second approach, we use the wakeup fd *only* for wakeups, and ignore " "the actual byte values. In this case, all we care about is whether the fd's " @@ -759,15 +762,15 @@ msgstr "" "如果你使用這種方法,那麼你應該設定 ``warn_on_full_buffer=False``,這樣你的使" "用者就不會被虛假的警告訊息所混淆。" -#: ../../library/signal.rst:549 +#: ../../library/signal.rst:551 msgid "On Windows, the function now also supports socket handles." msgstr "在 Windows 上,此功能現在也支援 socket 處理程式。" -#: ../../library/signal.rst:552 +#: ../../library/signal.rst:554 msgid "Added ``warn_on_full_buffer`` parameter." msgstr "新增 ``warn_on_full_buffer`` 參數。" -#: ../../library/signal.rst:557 +#: ../../library/signal.rst:559 msgid "" "Change system call restart behaviour: if *flag* is :const:`False`, system " "calls will be restarted when interrupted by signal *signalnum*, otherwise " @@ -776,11 +779,11 @@ msgstr "" "改變系統呼叫重新啟動的行為:如果 *flag* 是 :const:`False`,系統呼叫會在被訊" "號 *signalnum* 中斷時重新啟動,否則系統呼叫會被中斷。不會回傳任何東西。" -#: ../../library/signal.rst:563 +#: ../../library/signal.rst:565 msgid "See the man page :manpage:`siginterrupt(3)` for further information." msgstr "更多資訊請見 :manpage:`siginterrupt(3)` 線上手冊。" -#: ../../library/signal.rst:565 +#: ../../library/signal.rst:567 msgid "" "Note that installing a signal handler with :func:`signal` will reset the " "restart behaviour to interruptible by implicitly calling :c:func:`!" @@ -789,7 +792,7 @@ msgstr "" "請注意,使用 :func:`signal` 安裝訊號處理程式,會透過隱式呼叫 :c:func:`!" "siginterrupt` 來將重新啟動的行為重設為可中斷,且指定訊號的 *flag* 值為 true。" -#: ../../library/signal.rst:572 +#: ../../library/signal.rst:574 msgid "" "Set the handler for signal *signalnum* to the function *handler*. *handler* " "can be a callable Python object taking two arguments (see below), or one of " @@ -801,9 +804,9 @@ msgstr "" "將訊號 *signalnum* 的處理程式設定為函式 *handler*。*handler* 可以是帶兩個引數" "的可呼叫 Python 物件(見下面),或是特殊值 :const:`signal.SIG_IGN` 或 :const:" "`signal.SIG_DFL` 之一。先前的訊號處理程式將會被回傳(請參閱上面 :func:" -"`getsignal` 的說明)。(更多資訊請參閱 Unix 線上手冊 :`signal(2)`)。" +"`getsignal` 的說明)。(更多資訊請參閱 Unix 線上手冊 :manpage:`signal(2)`)。" -#: ../../library/signal.rst:583 +#: ../../library/signal.rst:585 msgid "" "The *handler* is called with two arguments: the signal number and the " "current stack frame (``None`` or a frame object; for a description of frame " @@ -814,7 +817,7 @@ msgstr "" "frame 物件;關於 frame 物件的描述,請參閱\\ :ref:`型別階層中的描述 `\\ 或 :mod:`inspect` 模組中的屬性描述)。" -#: ../../library/signal.rst:588 +#: ../../library/signal.rst:590 msgid "" "On Windows, :func:`signal` can only be called with :const:`SIGABRT`, :const:" "`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, :const:" @@ -829,7 +832,7 @@ msgstr "" "有系統都定義相同的訊號名稱;如果訊號名稱沒有被定義為 ``SIG*`` 模組層級常數," "則會引發 :exc:`AttributeError` 錯誤。" -#: ../../library/signal.rst:599 +#: ../../library/signal.rst:601 msgid "" "Examine the set of signals that are pending for delivery to the calling " "thread (i.e., the signals which have been raised while blocked). Return the " @@ -838,15 +841,15 @@ msgstr "" "檢查待傳送至呼叫執行緒的訊號集合(即阻檔時已被提出的訊號)。回傳待定訊號的集" "合。" -#: ../../library/signal.rst:605 +#: ../../library/signal.rst:607 msgid "See the man page :manpage:`sigpending(2)` for further information." msgstr "更多資訊請見 :manpage:`sigpending(2)` 線上手冊。" -#: ../../library/signal.rst:607 +#: ../../library/signal.rst:609 msgid "See also :func:`pause`, :func:`pthread_sigmask` and :func:`sigwait`." msgstr "另請參閱 :func:`pause`、:func:`pthread_sigmask` 與 :func:`sigwait`。" -#: ../../library/signal.rst:614 +#: ../../library/signal.rst:616 msgid "" "Suspend execution of the calling thread until the delivery of one of the " "signals specified in the signal set *sigset*. The function accepts the " @@ -856,11 +859,11 @@ msgstr "" "暫停呼叫執行緒的執行,直到送出訊號集合 *sigset* 中指定的一個訊號。函式接受訊" "號(將其從待定訊號清單中移除),並回傳訊號編號。" -#: ../../library/signal.rst:620 +#: ../../library/signal.rst:622 msgid "See the man page :manpage:`sigwait(3)` for further information." msgstr "更多資訊請見 :manpage:`sigwait(3)` 線上手冊。" -#: ../../library/signal.rst:622 +#: ../../library/signal.rst:624 msgid "" "See also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:" "`sigwaitinfo` and :func:`sigtimedwait`." @@ -868,7 +871,7 @@ msgstr "" "另也請見 :func:`pause`、:func:`pthread_sigmask`、:func:`sigpending`、:func:" "`sigwaitinfo` 和 :func:`sigtimedwait`。" -#: ../../library/signal.rst:630 +#: ../../library/signal.rst:632 msgid "" "Suspend execution of the calling thread until the delivery of one of the " "signals specified in the signal set *sigset*. The function accepts the " @@ -884,7 +887,7 @@ msgstr "" "會被呼叫。如果被不在 *sigset* 中的訊號中斷,函式會引發 :exc:" "`InterruptedError`。" -#: ../../library/signal.rst:639 +#: ../../library/signal.rst:641 msgid "" "The return value is an object representing the data contained in the :c:type:" "`siginfo_t` structure, namely: :attr:`si_signo`, :attr:`si_code`, :attr:" @@ -895,15 +898,15 @@ msgstr "" "`si_signo`、:attr:`si_code`、:attr:`si_errno`、:attr:`si_pid`、:attr:" "`si_uid`、:attr:`si_status`、:attr:`si_band`。" -#: ../../library/signal.rst:646 +#: ../../library/signal.rst:648 msgid "See the man page :manpage:`sigwaitinfo(2)` for further information." msgstr "更多資訊請見 :manpage:`sigwaitinfo(2)` 線上手冊。" -#: ../../library/signal.rst:648 +#: ../../library/signal.rst:650 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigtimedwait`." msgstr "另請參閱 :func:`pause`、:func:`sigwait` 與 :func:`sigtimedwait`。" -#: ../../library/signal.rst:652 +#: ../../library/signal.rst:654 msgid "" "The function is now retried if interrupted by a signal not in *sigset* and " "the signal handler does not raise an exception (see :pep:`475` for the " @@ -912,7 +915,7 @@ msgstr "" "現在如果被不在 *sigset* 中的訊號中斷,且訊號處理程式沒有引發例外,則會重試函" "式(理由請參閱 :pep:`475`)。" -#: ../../library/signal.rst:660 +#: ../../library/signal.rst:662 msgid "" "Like :func:`sigwaitinfo`, but takes an additional *timeout* argument " "specifying a timeout. If *timeout* is specified as ``0``, a poll is " @@ -921,15 +924,15 @@ msgstr "" "類似 :func:`sigwaitinfo`,但需要額外的 *timeout* 引數指定逾時時間。如果 " "*timeout* 指定為 ``0``,會執行輪詢。如果發生逾時則會回傳 :const:`None`。" -#: ../../library/signal.rst:666 +#: ../../library/signal.rst:668 msgid "See the man page :manpage:`sigtimedwait(2)` for further information." msgstr "更多資訊請見 :manpage:`sigtimedwait(2)` 線上手冊。" -#: ../../library/signal.rst:668 +#: ../../library/signal.rst:670 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigwaitinfo`." msgstr "另請參閱 :func:`pause`、:func:`sigwait` 與 :func:`sigwaitinfo`。" -#: ../../library/signal.rst:672 +#: ../../library/signal.rst:674 msgid "" "The function is now retried with the recomputed *timeout* if interrupted by " "a signal not in *sigset* and the signal handler does not raise an exception " @@ -938,11 +941,11 @@ msgstr "" "現在如果被不在 *sigset* 中的訊號中斷,且訊號處理程式沒有引發例外,則會使用重" "新計算的 *timeout* 重試函式(理由請參閱 :pep:`475`)。" -#: ../../library/signal.rst:681 +#: ../../library/signal.rst:683 msgid "Examples" msgstr "範例" -#: ../../library/signal.rst:683 +#: ../../library/signal.rst:685 msgid "" "Here is a minimal example program. It uses the :func:`alarm` function to " "limit the time spent waiting to open a file; this is useful if the file is " @@ -956,7 +959,7 @@ msgstr "" "無限期地被擱置。解決方法是在開啟檔案前設定一個 5 秒的警報;如果操作時間過長," "警報訊號就會被送出,而處理程式會產生例外。 ::" -#: ../../library/signal.rst:690 +#: ../../library/signal.rst:692 msgid "" "import signal, os\n" "\n" @@ -990,11 +993,11 @@ msgstr "" "\n" "signal.alarm(0) # 停用警報" -#: ../../library/signal.rst:707 +#: ../../library/signal.rst:709 msgid "Note on SIGPIPE" msgstr "關於 SIGPIPE 的說明" -#: ../../library/signal.rst:709 +#: ../../library/signal.rst:711 msgid "" "Piping output of your program to tools like :manpage:`head(1)` will cause a :" "const:`SIGPIPE` signal to be sent to your process when the receiver of its " @@ -1007,7 +1010,7 @@ msgstr "" "`BrokenPipeError: [Errno 32] Broken pipe` 的例外。要處理這種情況,請將你的進" "入點包裝成如下的樣子來捕捉這個例外: ::" -#: ../../library/signal.rst:715 +#: ../../library/signal.rst:717 msgid "" "import os\n" "import sys\n" @@ -1052,7 +1055,7 @@ msgstr "" "if __name__ == '__main__':\n" " main()" -#: ../../library/signal.rst:736 +#: ../../library/signal.rst:738 msgid "" "Do not set :const:`SIGPIPE`'s disposition to :const:`SIG_DFL` in order to " "avoid :exc:`BrokenPipeError`. Doing that would cause your program to exit " @@ -1063,11 +1066,11 @@ msgstr "" "(disposition) 設定為 :const:`SIG_DFL`。這樣做會導致你的程式在寫入任何 socket " "連線時被中斷而意外退出。" -#: ../../library/signal.rst:745 +#: ../../library/signal.rst:747 msgid "Note on Signal Handlers and Exceptions" msgstr "訊號處理程式與例外的說明" -#: ../../library/signal.rst:747 +#: ../../library/signal.rst:749 msgid "" "If a signal handler raises an exception, the exception will be propagated to " "the main thread and may be raised after any :term:`bytecode` instruction. " @@ -1083,11 +1086,11 @@ msgstr "" "exc:`KeyboardInterrupt`\\ (或任何其他由訊號處理程式產生的例外)可能會在罕見" "的情況下使程式處於預期之外的狀態。" -#: ../../library/signal.rst:754 +#: ../../library/signal.rst:756 msgid "To illustrate this issue, consider the following code::" msgstr "為了說明這個問題,請參考以下程式碼: ::" -#: ../../library/signal.rst:756 +#: ../../library/signal.rst:758 msgid "" "class SpamContext:\n" " def __init__(self):\n" @@ -1119,7 +1122,7 @@ msgstr "" " ...\n" " self.lock.release()" -#: ../../library/signal.rst:771 +#: ../../library/signal.rst:773 msgid "" "For many programs, especially those that merely want to exit on :exc:" "`KeyboardInterrupt`, this is not a problem, but applications that are " @@ -1136,7 +1139,7 @@ msgstr "" "`SIGINT` 處理程式。以下是 HTTP 伺服器避免 :exc:`KeyboardInterrupt` 的範" "例: ::" -#: ../../library/signal.rst:779 +#: ../../library/signal.rst:781 msgid "" "import signal\n" "import socket\n" diff --git a/library/smtplib.po b/library/smtplib.po index 5e46fd820e..921c053924 100644 --- a/library/smtplib.po +++ b/library/smtplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-12 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -706,11 +706,11 @@ msgid "" "and *to_addrs*, ``send_message`` does not transmit any :mailheader:`Bcc` or :" "mailheader:`Resent-Bcc` headers that may appear in *msg*. If any of the " "addresses in *from_addr* and *to_addrs* contain non-ASCII characters and the " -"server does not advertise ``SMTPUTF8`` support, an :exc:`SMTPNotSupported` " -"error is raised. Otherwise the ``Message`` is serialized with a clone of " -"its :mod:`~email.policy` with the :attr:`~email.policy.EmailPolicy.utf8` " -"attribute set to ``True``, and ``SMTPUTF8`` and ``BODY=8BITMIME`` are added " -"to *mail_options*." +"server does not advertise ``SMTPUTF8`` support, an :exc:" +"`SMTPNotSupportedError` is raised. Otherwise the ``Message`` is serialized " +"with a clone of its :mod:`~email.policy` with the :attr:`~email.policy." +"EmailPolicy.utf8` attribute set to ``True``, and ``SMTPUTF8`` and " +"``BODY=8BITMIME`` are added to *mail_options*." msgstr "" #: ../../library/smtplib.rst:534 diff --git a/library/socket.po b/library/socket.po index 67135fe667..df2b7625d4 100644 --- a/library/socket.po +++ b/library/socket.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-10-30 00:03+0000\n" +"POT-Creation-Date: 2025-04-19 00:14+0000\n" "PO-Revision-Date: 2024-12-30 23:45+0800\n" "Last-Translator: Jay \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -19,8 +19,8 @@ msgstr "" "X-Generator: Poedit 3.5\n" #: ../../library/socket.rst:2 -msgid ":mod:`socket` --- Low-level networking interface" -msgstr ":mod:`socket` — 網路底層介面" +msgid ":mod:`!socket` --- Low-level networking interface" +msgstr ":mod:`!socket` — 低階網路介面" #: ../../library/socket.rst:7 msgid "**Source code:** :source:`Lib/socket.py`" @@ -41,35 +41,35 @@ msgid "" "operating system socket APIs." msgstr "由於是呼叫作業系統的 socket API,某些行為可能會因平台而有所差異。" -#: ../../library/socket.rst:171 ../../library/socket.rst:181 -#: ../../library/socket.rst:209 ../../library/socket.rst:216 -#: ../../library/socket.rst:233 ../../library/socket.rst:383 -#: ../../library/socket.rst:461 ../../library/socket.rst:475 -#: ../../library/socket.rst:490 ../../library/socket.rst:501 -#: ../../library/socket.rst:510 ../../library/socket.rst:519 -#: ../../library/socket.rst:530 ../../library/socket.rst:542 -#: ../../library/socket.rst:553 ../../library/socket.rst:566 -#: ../../library/socket.rst:594 ../../library/socket.rst:606 -#: ../../library/socket.rst:612 ../../library/socket.rst:643 -#: ../../library/socket.rst:658 ../../library/socket.rst:667 -#: ../../library/socket.rst:684 ../../library/socket.rst:699 -#: ../../library/socket.rst:709 ../../library/socket.rst:898 -#: ../../library/socket.rst:1023 ../../library/socket.rst:1039 -#: ../../library/socket.rst:1052 ../../library/socket.rst:1067 -#: ../../library/socket.rst:1084 ../../library/socket.rst:1095 -#: ../../library/socket.rst:1106 ../../library/socket.rst:1117 -#: ../../library/socket.rst:1206 ../../library/socket.rst:1226 -#: ../../library/socket.rst:1252 ../../library/socket.rst:1275 -#: ../../library/socket.rst:1304 ../../library/socket.rst:1315 -#: ../../library/socket.rst:1342 ../../library/socket.rst:1359 -#: ../../library/socket.rst:1376 ../../library/socket.rst:1390 -#: ../../library/socket.rst:1441 ../../library/socket.rst:1488 -#: ../../library/socket.rst:1502 ../../library/socket.rst:1522 -#: ../../library/socket.rst:1569 ../../library/socket.rst:1614 -#: ../../library/socket.rst:1739 ../../library/socket.rst:1783 -#: ../../library/socket.rst:1891 ../../library/socket.rst:1909 -#: ../../library/socket.rst:1993 ../../library/socket.rst:2003 -#: ../../library/socket.rst:2015 ../../includes/wasm-notavail.rst:3 +#: ../../library/socket.rst:176 ../../library/socket.rst:186 +#: ../../library/socket.rst:214 ../../library/socket.rst:221 +#: ../../library/socket.rst:238 ../../library/socket.rst:388 +#: ../../library/socket.rst:466 ../../library/socket.rst:483 +#: ../../library/socket.rst:498 ../../library/socket.rst:509 +#: ../../library/socket.rst:518 ../../library/socket.rst:527 +#: ../../library/socket.rst:538 ../../library/socket.rst:550 +#: ../../library/socket.rst:561 ../../library/socket.rst:574 +#: ../../library/socket.rst:602 ../../library/socket.rst:614 +#: ../../library/socket.rst:620 ../../library/socket.rst:650 +#: ../../library/socket.rst:665 ../../library/socket.rst:674 +#: ../../library/socket.rst:691 ../../library/socket.rst:706 +#: ../../library/socket.rst:716 ../../library/socket.rst:905 +#: ../../library/socket.rst:1030 ../../library/socket.rst:1046 +#: ../../library/socket.rst:1059 ../../library/socket.rst:1074 +#: ../../library/socket.rst:1091 ../../library/socket.rst:1102 +#: ../../library/socket.rst:1113 ../../library/socket.rst:1124 +#: ../../library/socket.rst:1213 ../../library/socket.rst:1233 +#: ../../library/socket.rst:1259 ../../library/socket.rst:1282 +#: ../../library/socket.rst:1311 ../../library/socket.rst:1322 +#: ../../library/socket.rst:1349 ../../library/socket.rst:1366 +#: ../../library/socket.rst:1383 ../../library/socket.rst:1397 +#: ../../library/socket.rst:1448 ../../library/socket.rst:1495 +#: ../../library/socket.rst:1509 ../../library/socket.rst:1529 +#: ../../library/socket.rst:1576 ../../library/socket.rst:1621 +#: ../../library/socket.rst:1746 ../../library/socket.rst:1790 +#: ../../library/socket.rst:1898 ../../library/socket.rst:1916 +#: ../../library/socket.rst:2000 ../../library/socket.rst:2010 +#: ../../library/socket.rst:2022 ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "" @@ -87,8 +87,8 @@ msgid "" "call and library interface for sockets to Python's object-oriented style: " "the :func:`~socket.socket` function returns a :dfn:`socket object` whose " "methods implement the various socket system calls. Parameter types are " -"somewhat higher-level than in the C interface: as with :meth:`read` " -"and :meth:`write` operations on Python files, buffer allocation on receive " +"somewhat higher-level than in the C interface: as with :meth:`read` and :" +"meth:`write` operations on Python files, buffer allocation on receive " "operations is automatic, and buffer length is implicit on send operations." msgstr "" "Python 的介面是將 Unix 的系統呼叫和 socket 函式庫介面直接轉換成 Python 的物件" @@ -147,8 +147,8 @@ msgid "" "Previously, :const:`AF_UNIX` socket paths were assumed to use UTF-8 encoding." msgstr "" -#: ../../library/socket.rst:66 ../../library/socket.rst:1189 -#: ../../library/socket.rst:1231 ../../library/socket.rst:1987 +#: ../../library/socket.rst:66 ../../library/socket.rst:1196 +#: ../../library/socket.rst:1238 ../../library/socket.rst:1994 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" @@ -164,10 +164,10 @@ msgstr "" msgid "" "For IPv4 addresses, two special forms are accepted instead of a host " "address: ``''`` represents :const:`INADDR_ANY`, which is used to bind to all " -"interfaces, and the string ``''`` " -"represents :const:`INADDR_BROADCAST`. This behavior is not compatible with " -"IPv6, therefore, you may want to avoid these if you intend to support IPv6 " -"with your Python programs." +"interfaces, and the string ``''`` represents :const:" +"`INADDR_BROADCAST`. This behavior is not compatible with IPv6, therefore, " +"you may want to avoid these if you intend to support IPv6 with your Python " +"programs." msgstr "" #: ../../library/socket.rst:83 @@ -281,120 +281,133 @@ msgid "" msgstr "" #: ../../library/socket.rst:146 +msgid ":const:`BTPROTO_HCI` accepts a format that depends on your OS." +msgstr "" + +#: ../../library/socket.rst:148 +msgid "" +"On Linux it accepts a tuple ``(device_id,)`` where ``device_id`` is an " +"integer specifying the number of the Bluetooth device." +msgstr "" + +#: ../../library/socket.rst:150 msgid "" -":const:`BTPROTO_HCI` accepts ``(device_id,)`` where ``device_id`` is either " -"an integer or a string with the Bluetooth address of the interface. (This " -"depends on your OS; NetBSD and DragonFlyBSD expect a Bluetooth address while " -"everything else expects an integer.)" +"On FreeBSD, NetBSD and DragonFly BSD it accepts ``bdaddr`` where ``bdaddr`` " +"is the Bluetooth address as a string." msgstr "" -#: ../../library/socket.rst:151 +#: ../../library/socket.rst:153 msgid "NetBSD and DragonFlyBSD support added." msgstr "加入對 NetBSD 和 DragonFlyBSD 的支援。" -#: ../../library/socket.rst:154 +#: ../../library/socket.rst:156 +#, fuzzy +msgid "FreeBSD support added." +msgstr "新增對 Windows 的支援。" + +#: ../../library/socket.rst:159 msgid "" -":const:`BTPROTO_SCO` accepts ``bdaddr`` where ``bdaddr`` is a :class:`bytes` " -"object containing the Bluetooth address in a string format. (ex. " -"``b'12:23:34:45:56:67'``) This protocol is not supported under FreeBSD." +":const:`BTPROTO_SCO` accepts ``bdaddr`` where ``bdaddr`` is the Bluetooth " +"address as a string or a :class:`bytes` object. (ex. ``'12:23:34:45:56:67'`` " +"or ``b'12:23:34:45:56:67'``) This protocol is not supported under FreeBSD." msgstr "" -#: ../../library/socket.rst:159 +#: ../../library/socket.rst:164 msgid "" ":const:`AF_ALG` is a Linux-only socket based interface to Kernel " "cryptography. An algorithm socket is configured with a tuple of two to four " "elements ``(type, name [, feat [, mask]])``, where:" msgstr "" -#: ../../library/socket.rst:163 +#: ../../library/socket.rst:168 msgid "" "*type* is the algorithm type as string, e.g. ``aead``, ``hash``, " "``skcipher`` or ``rng``." msgstr "" -#: ../../library/socket.rst:166 +#: ../../library/socket.rst:171 msgid "" "*name* is the algorithm name and operation mode as string, e.g. ``sha256``, " "``hmac(sha256)``, ``cbc(aes)`` or ``drbg_nopr_ctr_aes256``." msgstr "" -#: ../../library/socket.rst:169 +#: ../../library/socket.rst:174 msgid "*feat* and *mask* are unsigned 32bit integers." msgstr "" -#: ../../library/socket.rst:173 +#: ../../library/socket.rst:178 msgid "Some algorithm types require more recent Kernels." msgstr "" -#: ../../library/socket.rst:177 +#: ../../library/socket.rst:182 msgid "" ":const:`AF_VSOCK` allows communication between virtual machines and their " "hosts. The sockets are represented as a ``(CID, port)`` tuple where the " "context ID or CID and port are integers." msgstr "" -#: ../../library/socket.rst:183 +#: ../../library/socket.rst:188 msgid "See :manpage:`vsock(7)`" msgstr "請見 :manpage:`vsock(7)`" -#: ../../library/socket.rst:187 +#: ../../library/socket.rst:192 msgid "" ":const:`AF_PACKET` is a low-level interface directly to network devices. The " "addresses are represented by the tuple ``(ifname, proto[, pkttype[, hatype[, " "addr]]])`` where:" msgstr "" -#: ../../library/socket.rst:191 +#: ../../library/socket.rst:196 msgid "*ifname* - String specifying the device name." msgstr "" -#: ../../library/socket.rst:192 +#: ../../library/socket.rst:197 msgid "" "*proto* - The Ethernet protocol number. May be :data:`ETH_P_ALL` to capture " "all protocols, one of the :ref:`ETHERTYPE_* constants ` or any other Ethernet protocol number." msgstr "" -#: ../../library/socket.rst:196 +#: ../../library/socket.rst:201 msgid "*pkttype* - Optional integer specifying the packet type:" msgstr "" -#: ../../library/socket.rst:198 +#: ../../library/socket.rst:203 msgid "``PACKET_HOST`` (the default) - Packet addressed to the local host." msgstr "" -#: ../../library/socket.rst:199 +#: ../../library/socket.rst:204 msgid "``PACKET_BROADCAST`` - Physical-layer broadcast packet." msgstr "" -#: ../../library/socket.rst:200 +#: ../../library/socket.rst:205 msgid "" "``PACKET_MULTICAST`` - Packet sent to a physical-layer multicast address." msgstr "" -#: ../../library/socket.rst:201 +#: ../../library/socket.rst:206 msgid "" "``PACKET_OTHERHOST`` - Packet to some other host that has been caught by a " "device driver in promiscuous mode." msgstr "" -#: ../../library/socket.rst:203 +#: ../../library/socket.rst:208 msgid "" "``PACKET_OUTGOING`` - Packet originating from the local host that is looped " "back to a packet socket." msgstr "" -#: ../../library/socket.rst:205 +#: ../../library/socket.rst:210 msgid "*hatype* - Optional integer specifying the ARP hardware address type." msgstr "" -#: ../../library/socket.rst:206 +#: ../../library/socket.rst:211 msgid "" "*addr* - Optional bytes-like object specifying the hardware physical " "address, whose interpretation depends on the device." msgstr "" -#: ../../library/socket.rst:211 +#: ../../library/socket.rst:216 msgid "" ":const:`AF_QIPCRTR` is a Linux-only socket based interface for communicating " "with services running on co-processors in Qualcomm platforms. The address " @@ -402,7 +415,7 @@ msgid "" "*port* are non-negative integers." msgstr "" -#: ../../library/socket.rst:220 +#: ../../library/socket.rst:225 msgid "" ":const:`IPPROTO_UDPLITE` is a variant of UDP which allows you to specify " "what portion of a packet is covered with the checksum. It adds two socket " @@ -413,14 +426,14 @@ msgid "" "of their data. In both cases ``length`` should be in ``range(8, 2**16, 8)``." msgstr "" -#: ../../library/socket.rst:229 +#: ../../library/socket.rst:234 msgid "" "Such a socket should be constructed with ``socket(AF_INET, SOCK_DGRAM, " "IPPROTO_UDPLITE)`` for IPv4 or ``socket(AF_INET6, SOCK_DGRAM, " "IPPROTO_UDPLITE)`` for IPv6." msgstr "" -#: ../../library/socket.rst:237 +#: ../../library/socket.rst:242 msgid "" ":const:`AF_HYPERV` is a Windows-only socket based interface for " "communicating with Hyper-V hosts and guests. The address family is " @@ -428,49 +441,49 @@ msgid "" "``service_id`` are UUID strings." msgstr "" -#: ../../library/socket.rst:242 +#: ../../library/socket.rst:247 msgid "" "The ``vm_id`` is the virtual machine identifier or a set of known VMID " "values if the target is not a specific virtual machine. Known VMID constants " "defined on ``socket`` are:" msgstr "" -#: ../../library/socket.rst:246 +#: ../../library/socket.rst:251 msgid "``HV_GUID_ZERO``" msgstr "``HV_GUID_ZERO``" -#: ../../library/socket.rst:247 +#: ../../library/socket.rst:252 msgid "``HV_GUID_BROADCAST``" msgstr "``HV_GUID_BROADCAST``" -#: ../../library/socket.rst:248 +#: ../../library/socket.rst:253 msgid "" "``HV_GUID_WILDCARD`` - Used to bind on itself and accept connections from " "all partitions." msgstr "" -#: ../../library/socket.rst:250 +#: ../../library/socket.rst:255 msgid "" "``HV_GUID_CHILDREN`` - Used to bind on itself and accept connection from " "child partitions." msgstr "" -#: ../../library/socket.rst:252 +#: ../../library/socket.rst:257 msgid "``HV_GUID_LOOPBACK`` - Used as a target to itself." msgstr "" -#: ../../library/socket.rst:253 +#: ../../library/socket.rst:258 msgid "" "``HV_GUID_PARENT`` - When used as a bind accepts connection from the parent " "partition. When used as an address target it will connect to the parent " "partition." msgstr "" -#: ../../library/socket.rst:256 +#: ../../library/socket.rst:261 msgid "The ``service_id`` is the service identifier of the registered service." msgstr "" -#: ../../library/socket.rst:260 +#: ../../library/socket.rst:265 msgid "" "If you use a hostname in the *host* portion of IPv4/v6 socket address, the " "program may show a nondeterministic behavior, as Python uses the first " @@ -480,57 +493,56 @@ msgid "" "deterministic behavior use a numeric address in *host* portion." msgstr "" -#: ../../library/socket.rst:267 +#: ../../library/socket.rst:272 msgid "" "All errors raise exceptions. The normal exceptions for invalid argument " "types and out-of-memory conditions can be raised. Errors related to socket " "or address semantics raise :exc:`OSError` or one of its subclasses." msgstr "" -#: ../../library/socket.rst:272 +#: ../../library/socket.rst:277 msgid "" "Non-blocking mode is supported through :meth:`~socket.setblocking`. A " -"generalization of this based on timeouts is supported " -"through :meth:`~socket.settimeout`." +"generalization of this based on timeouts is supported through :meth:`~socket." +"settimeout`." msgstr "" -#: ../../library/socket.rst:278 +#: ../../library/socket.rst:283 msgid "Module contents" msgstr "模組內容" -#: ../../library/socket.rst:280 +#: ../../library/socket.rst:285 msgid "The module :mod:`socket` exports the following elements." msgstr "" -#: ../../library/socket.rst:284 +#: ../../library/socket.rst:289 msgid "Exceptions" msgstr "例外" -#: ../../library/socket.rst:288 +#: ../../library/socket.rst:293 msgid "A deprecated alias of :exc:`OSError`." msgstr "一個已棄用的 :exc:`OSError` 的別名。" -#: ../../library/socket.rst:290 +#: ../../library/socket.rst:295 msgid "Following :pep:`3151`, this class was made an alias of :exc:`OSError`." msgstr "" -#: ../../library/socket.rst:296 +#: ../../library/socket.rst:301 msgid "" "A subclass of :exc:`OSError`, this exception is raised for address-related " -"errors, i.e. for functions that use *h_errno* in the POSIX C API, " -"including :func:`gethostbyname_ex` and :func:`gethostbyaddr`. The " -"accompanying value is a pair ``(h_errno, string)`` representing an error " -"returned by a library call. *h_errno* is a numeric value, while *string* " -"represents the description of *h_errno*, as returned by " -"the :c:func:`hstrerror` C function." +"errors, i.e. for functions that use *h_errno* in the POSIX C API, including :" +"func:`gethostbyname_ex` and :func:`gethostbyaddr`. The accompanying value is " +"a pair ``(h_errno, string)`` representing an error returned by a library " +"call. *h_errno* is a numeric value, while *string* represents the " +"description of *h_errno*, as returned by the :c:func:`hstrerror` C function." msgstr "" -#: ../../library/socket.rst:304 ../../library/socket.rst:317 -#: ../../library/socket.rst:330 +#: ../../library/socket.rst:309 ../../library/socket.rst:322 +#: ../../library/socket.rst:335 msgid "This class was made a subclass of :exc:`OSError`." msgstr "" -#: ../../library/socket.rst:309 +#: ../../library/socket.rst:314 msgid "" "A subclass of :exc:`OSError`, this exception is raised for address-related " "errors by :func:`getaddrinfo` and :func:`getnameinfo`. The accompanying " @@ -540,34 +552,34 @@ msgid "" "match one of the :const:`!EAI_\\*` constants defined in this module." msgstr "" -#: ../../library/socket.rst:322 +#: ../../library/socket.rst:327 msgid "A deprecated alias of :exc:`TimeoutError`." msgstr "" -#: ../../library/socket.rst:324 +#: ../../library/socket.rst:329 msgid "" "A subclass of :exc:`OSError`, this exception is raised when a timeout occurs " -"on a socket which has had timeouts enabled via a prior call " -"to :meth:`~socket.settimeout` (or implicitly " -"through :func:`~socket.setdefaulttimeout`). The accompanying value is a " -"string whose value is currently always \"timed out\"." +"on a socket which has had timeouts enabled via a prior call to :meth:" +"`~socket.settimeout` (or implicitly through :func:`~socket." +"setdefaulttimeout`). The accompanying value is a string whose value is " +"currently always \"timed out\"." msgstr "" -#: ../../library/socket.rst:333 +#: ../../library/socket.rst:338 msgid "This class was made an alias of :exc:`TimeoutError`." msgstr "" -#: ../../library/socket.rst:338 +#: ../../library/socket.rst:343 msgid "Constants" msgstr "常數" -#: ../../library/socket.rst:340 +#: ../../library/socket.rst:345 msgid "" -"The AF_* and SOCK_* constants are now :class:`AddressFamily` " -"and :class:`SocketKind` :class:`.IntEnum` collections." +"The AF_* and SOCK_* constants are now :class:`AddressFamily` and :class:" +"`SocketKind` :class:`.IntEnum` collections." msgstr "" -#: ../../library/socket.rst:349 +#: ../../library/socket.rst:354 msgid "" "These constants represent the address (and protocol) families, used for the " "first argument to :func:`~socket.socket`. If the :const:`AF_UNIX` constant " @@ -575,79 +587,79 @@ msgid "" "available depending on the system." msgstr "" -#: ../../library/socket.rst:356 +#: ../../library/socket.rst:361 msgid "" ":const:`AF_UNSPEC` means that :func:`getaddrinfo` should return socket " "addresses for any address family (either IPv4, IPv6, or any other) that can " "be used." msgstr "" -#: ../../library/socket.rst:366 +#: ../../library/socket.rst:371 msgid "" -"These constants represent the socket types, used for the second argument " -"to :func:`~socket.socket`. More constants may be available depending on the " +"These constants represent the socket types, used for the second argument to :" +"func:`~socket.socket`. More constants may be available depending on the " "system. (Only :const:`SOCK_STREAM` and :const:`SOCK_DGRAM` appear to be " "generally useful.)" msgstr "" -#: ../../library/socket.rst:374 +#: ../../library/socket.rst:379 msgid "" "These two constants, if defined, can be combined with the socket types and " "allow you to set some flags atomically (thus avoiding possible race " "conditions and the need for separate calls)." msgstr "" -#: ../../library/socket.rst:380 +#: ../../library/socket.rst:385 msgid "" -"`Secure File Descriptor Handling `_ for a more thorough explanation." +"`Secure File Descriptor Handling `_ for a more thorough explanation." msgstr "" -#: ../../library/socket.rst:404 +#: ../../library/socket.rst:409 msgid "" "Many constants of these forms, documented in the Unix documentation on " "sockets and/or the IP protocol, are also defined in the socket module. They " -"are generally used in arguments to the :meth:`~socket.setsockopt` " -"and :meth:`~socket.getsockopt` methods of socket objects. In most cases, " -"only those symbols that are defined in the Unix header files are defined; " -"for a few symbols, default values are provided." +"are generally used in arguments to the :meth:`~socket.setsockopt` and :meth:" +"`~socket.getsockopt` methods of socket objects. In most cases, only those " +"symbols that are defined in the Unix header files are defined; for a few " +"symbols, default values are provided." msgstr "" -#: ../../library/socket.rst:411 +#: ../../library/socket.rst:416 msgid "" "``SO_DOMAIN``, ``SO_PROTOCOL``, ``SO_PEERSEC``, ``SO_PASSSEC``, " "``TCP_USER_TIMEOUT``, ``TCP_CONGESTION`` were added." msgstr "" -#: ../../library/socket.rst:415 +#: ../../library/socket.rst:420 msgid "" "On Windows, ``TCP_FASTOPEN``, ``TCP_KEEPCNT`` appear if run-time Windows " "supports." msgstr "" -#: ../../library/socket.rst:419 +#: ../../library/socket.rst:424 msgid "``TCP_NOTSENT_LOWAT`` was added." msgstr "新增 ``TCP_NOTSENT_LOWAT``。" -#: ../../library/socket.rst:422 +#: ../../library/socket.rst:427 msgid "" "On Windows, ``TCP_KEEPIDLE``, ``TCP_KEEPINTVL`` appear if run-time Windows " "supports." msgstr "" -#: ../../library/socket.rst:425 +#: ../../library/socket.rst:430 msgid "" "``IP_RECVTOS`` was added. Added ``TCP_KEEPALIVE``. On MacOS this constant " "can be used in the same way that ``TCP_KEEPIDLE`` is used on Linux." msgstr "" -#: ../../library/socket.rst:430 +#: ../../library/socket.rst:435 msgid "" "Added ``TCP_CONNECTION_INFO``. On MacOS this constant can be used in the " "same way that ``TCP_INFO`` is used on Linux and BSD." msgstr "" -#: ../../library/socket.rst:434 +#: ../../library/socket.rst:439 msgid "" "Added ``SO_RTABLE`` and ``SO_USER_COOKIE``. On OpenBSD and FreeBSD " "respectively those constants can be used in the same way that ``SO_MARK`` is " @@ -663,133 +675,137 @@ msgid "" "``IP_DROP_SOURCE_MEMBERSHIP``." msgstr "" -#: ../../library/socket.rst:448 +#: ../../library/socket.rst:453 msgid "" "Added ``SO_BINDTOIFINDEX``. On Linux this constant can be used in the same " "way that ``SO_BINDTODEVICE`` is used, but with the index of a network " "interface instead of its name." msgstr "" -#: ../../library/socket.rst:458 ../../library/socket.rst:539 -#: ../../library/socket.rst:563 +#: ../../library/socket.rst:463 ../../library/socket.rst:547 +#: ../../library/socket.rst:571 msgid "" "Many constants of these forms, documented in the Linux documentation, are " "also defined in the socket module." msgstr "" -#: ../../library/socket.rst:465 +#: ../../library/socket.rst:470 msgid "NetBSD support was added." msgstr "" -#: ../../library/socket.rst:471 +#: ../../library/socket.rst:473 +msgid "Restored missing ``CAN_RAW_ERR_FILTER`` on Linux." +msgstr "" + +#: ../../library/socket.rst:479 msgid "" "CAN_BCM, in the CAN protocol family, is the broadcast manager (BCM) " "protocol. Broadcast manager constants, documented in the Linux " "documentation, are also defined in the socket module." msgstr "" -#: ../../library/socket.rst:478 +#: ../../library/socket.rst:486 msgid "" "The :data:`CAN_BCM_CAN_FD_FRAME` flag is only available on Linux >= 4.8." msgstr "" -#: ../../library/socket.rst:484 +#: ../../library/socket.rst:492 msgid "" "Enables CAN FD support in a CAN_RAW socket. This is disabled by default. " "This allows your application to send both CAN and CAN FD frames; however, " "you must accept both CAN and CAN FD frames when reading from the socket." msgstr "" -#: ../../library/socket.rst:488 ../../library/socket.rst:499 +#: ../../library/socket.rst:496 ../../library/socket.rst:507 msgid "This constant is documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:496 +#: ../../library/socket.rst:504 msgid "" "Joins the applied CAN filters such that only CAN frames that match all given " "CAN filters are passed to user space." msgstr "" -#: ../../library/socket.rst:507 +#: ../../library/socket.rst:515 msgid "" "CAN_ISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2) protocol. " "ISO-TP constants, documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:516 +#: ../../library/socket.rst:524 msgid "" "CAN_J1939, in the CAN protocol family, is the SAE J1939 protocol. J1939 " "constants, documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:527 +#: ../../library/socket.rst:535 msgid "" "These two constants, documented in the FreeBSD divert(4) manual page, are " "also defined in the socket module." msgstr "" -#: ../../library/socket.rst:547 +#: ../../library/socket.rst:555 msgid "" ":data:`!ETH_P_ALL` can be used in the :class:`~socket.socket` constructor as " "*proto* for the :const:`AF_PACKET` family in order to capture every packet, " "regardless of protocol." msgstr "" -#: ../../library/socket.rst:551 +#: ../../library/socket.rst:559 msgid "For more information, see the :manpage:`packet(7)` manpage." msgstr "" -#: ../../library/socket.rst:576 +#: ../../library/socket.rst:584 msgid "" "Constants for Windows' WSAIoctl(). The constants are used as arguments to " "the :meth:`~socket.socket.ioctl` method of socket objects." msgstr "" -#: ../../library/socket.rst:579 ../../library/socket.rst:1604 +#: ../../library/socket.rst:587 ../../library/socket.rst:1611 msgid "``SIO_LOOPBACK_FAST_PATH`` was added." msgstr "加入 ``SIO_LOOPBACK_FAST_PATH``。" -#: ../../library/socket.rst:585 +#: ../../library/socket.rst:593 msgid "" "TIPC related constants, matching the ones exported by the C socket API. See " "the TIPC documentation for more information." msgstr "" -#: ../../library/socket.rst:592 +#: ../../library/socket.rst:600 msgid "Constants for Linux Kernel cryptography." msgstr "" -#: ../../library/socket.rst:604 +#: ../../library/socket.rst:612 msgid "Constants for Linux host/guest communication." msgstr "" -#: ../../library/socket.rst:618 +#: ../../library/socket.rst:626 msgid "" "This constant contains a boolean value which indicates if IPv6 is supported " "on this platform." msgstr "" -#: ../../library/socket.rst:624 +#: ../../library/socket.rst:632 msgid "" "These are string constants containing Bluetooth addresses with special " "meanings. For example, :const:`BDADDR_ANY` can be used to indicate any " "address when specifying the binding socket with :const:`BTPROTO_RFCOMM`." msgstr "" -#: ../../library/socket.rst:633 +#: ../../library/socket.rst:641 msgid "" -"For use with :const:`BTPROTO_HCI`. :const:`HCI_FILTER` is not available for " -"NetBSD or DragonFlyBSD. :const:`HCI_TIME_STAMP` and :const:`HCI_DATA_DIR` " -"are not available for FreeBSD, NetBSD, or DragonFlyBSD." +"For use with :const:`BTPROTO_HCI`. :const:`!HCI_FILTER` is only available on " +"Linux and FreeBSD. :const:`!HCI_TIME_STAMP` and :const:`!HCI_DATA_DIR` are " +"only available on Linux." msgstr "" -#: ../../library/socket.rst:640 +#: ../../library/socket.rst:647 msgid "" "Constant for Qualcomm's IPC router protocol, used to communicate with " "service providing remote processors." msgstr "" -#: ../../library/socket.rst:649 +#: ../../library/socket.rst:656 msgid "" "LOCAL_CREDS and LOCAL_CREDS_PERSISTENT can be used with SOCK_DGRAM, " "SOCK_STREAM sockets, equivalent to Linux/DragonFlyBSD SO_PASSCRED, while " @@ -798,71 +814,71 @@ msgid "" "message type." msgstr "" -#: ../../library/socket.rst:662 +#: ../../library/socket.rst:669 msgid "" -"Constant to optimize CPU locality, to be used in conjunction " -"with :data:`SO_REUSEPORT`." +"Constant to optimize CPU locality, to be used in conjunction with :data:" +"`SO_REUSEPORT`." msgstr "" -#: ../../library/socket.rst:682 +#: ../../library/socket.rst:689 msgid "Constants for Windows Hyper-V sockets for host/guest communications." msgstr "" -#: ../../library/socket.rst:695 +#: ../../library/socket.rst:702 msgid "" "`IEEE 802.3 protocol number `_. constants." msgstr "" -#: ../../library/socket.rst:707 +#: ../../library/socket.rst:714 msgid "" "These constants are used by the :meth:`~socket.socket.shutdown` method of " "socket objects." msgstr "" -#: ../../library/socket.rst:712 +#: ../../library/socket.rst:719 msgid "Functions" msgstr "函式" -#: ../../library/socket.rst:715 +#: ../../library/socket.rst:722 msgid "Creating sockets" msgstr "建立 sockets" -#: ../../library/socket.rst:717 +#: ../../library/socket.rst:724 msgid "" "The following functions all create :ref:`socket objects `." msgstr "" -#: ../../library/socket.rst:722 +#: ../../library/socket.rst:729 msgid "" "Create a new socket using the given address family, socket type and protocol " -"number. The address family should be :const:`AF_INET` (the " -"default), :const:`AF_INET6`, :const:`AF_UNIX`, :const:`AF_CAN`, :const:`AF_PACKET`, " -"or :const:`AF_RDS`. The socket type should be :const:`SOCK_STREAM` (the " -"default), :const:`SOCK_DGRAM`, :const:`SOCK_RAW` or perhaps one of the other " -"``SOCK_`` constants. The protocol number is usually zero and may be omitted " -"or in the case where the address family is :const:`AF_CAN` the protocol " -"should be one of :const:`CAN_RAW`, :const:`CAN_BCM`, :const:`CAN_ISOTP` " -"or :const:`CAN_J1939`." +"number. The address family should be :const:`AF_INET` (the default), :const:" +"`AF_INET6`, :const:`AF_UNIX`, :const:`AF_CAN`, :const:`AF_PACKET`, or :const:" +"`AF_RDS`. The socket type should be :const:`SOCK_STREAM` (the default), :" +"const:`SOCK_DGRAM`, :const:`SOCK_RAW` or perhaps one of the other ``SOCK_`` " +"constants. The protocol number is usually zero and may be omitted or in the " +"case where the address family is :const:`AF_CAN` the protocol should be one " +"of :const:`CAN_RAW`, :const:`CAN_BCM`, :const:`CAN_ISOTP` or :const:" +"`CAN_J1939`." msgstr "" -#: ../../library/socket.rst:732 +#: ../../library/socket.rst:739 msgid "" "If *fileno* is specified, the values for *family*, *type*, and *proto* are " "auto-detected from the specified file descriptor. Auto-detection can be " "overruled by calling the function with explicit *family*, *type*, or *proto* " "arguments. This only affects how Python represents e.g. the return value " -"of :meth:`socket.getpeername` but not the actual OS resource. " -"Unlike :func:`socket.fromfd`, *fileno* will return the same socket and not a " -"duplicate. This may help close a detached socket using :meth:`socket.close`." +"of :meth:`socket.getpeername` but not the actual OS resource. Unlike :func:" +"`socket.fromfd`, *fileno* will return the same socket and not a duplicate. " +"This may help close a detached socket using :meth:`socket.close`." msgstr "" -#: ../../library/socket.rst:741 ../../library/socket.rst:887 -#: ../../library/socket.rst:1423 ../../library/socket.rst:1517 +#: ../../library/socket.rst:748 ../../library/socket.rst:894 +#: ../../library/socket.rst:1430 ../../library/socket.rst:1524 msgid "The newly created socket is :ref:`non-inheritable `." msgstr "" -#: ../../library/socket.rst:743 +#: ../../library/socket.rst:750 msgid "" "Raises an :ref:`auditing event ` ``socket.__new__`` with arguments " "``self``, ``family``, ``type``, ``protocol``." @@ -870,30 +886,30 @@ msgstr "" "引發一個附帶引數 ``self``、``family``、``type``、``protocol`` 的\\ :ref:`稽核" "事件 ` ``socket.__new__``。" -#: ../../library/socket.rst:745 +#: ../../library/socket.rst:752 msgid "The AF_CAN family was added. The AF_RDS family was added." msgstr "" -#: ../../library/socket.rst:749 +#: ../../library/socket.rst:756 msgid "The CAN_BCM protocol was added." msgstr "新增 CAN_BCM 協定。" -#: ../../library/socket.rst:752 ../../library/socket.rst:889 +#: ../../library/socket.rst:759 ../../library/socket.rst:896 msgid "The returned socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:755 +#: ../../library/socket.rst:762 msgid "The CAN_ISOTP protocol was added." msgstr "新增 CAN_ISOTP 協定。" -#: ../../library/socket.rst:758 +#: ../../library/socket.rst:765 msgid "" "When :const:`SOCK_NONBLOCK` or :const:`SOCK_CLOEXEC` bit flags are applied " "to *type* they are cleared, and :attr:`socket.type` will not reflect them. " "They are still passed to the underlying system ``socket()`` call. Therefore," msgstr "" -#: ../../library/socket.rst:766 +#: ../../library/socket.rst:773 msgid "" "sock = socket.socket(\n" " socket.AF_INET,\n" @@ -903,21 +919,21 @@ msgstr "" " socket.AF_INET,\n" " socket.SOCK_STREAM | socket.SOCK_NONBLOCK)" -#: ../../library/socket.rst:770 +#: ../../library/socket.rst:777 msgid "" "will still create a non-blocking socket on OSes that support " "``SOCK_NONBLOCK``, but ``sock.type`` will be set to ``socket.SOCK_STREAM``." msgstr "" -#: ../../library/socket.rst:774 +#: ../../library/socket.rst:781 msgid "The CAN_J1939 protocol was added." msgstr "新增 CAN_J1939 協定。" -#: ../../library/socket.rst:777 +#: ../../library/socket.rst:784 msgid "The IPPROTO_MPTCP protocol was added." msgstr "新增 IPPROTO_MPTCP 協定。" -#: ../../library/socket.rst:782 +#: ../../library/socket.rst:789 msgid "" "Build a pair of connected socket objects using the given address family, " "socket type, and protocol number. Address family, socket type, and protocol " @@ -926,25 +942,25 @@ msgid "" "default is :const:`AF_INET`." msgstr "" -#: ../../library/socket.rst:787 +#: ../../library/socket.rst:794 msgid "The newly created sockets are :ref:`non-inheritable `." msgstr "" -#: ../../library/socket.rst:789 +#: ../../library/socket.rst:796 msgid "" "The returned socket objects now support the whole socket API, rather than a " "subset." msgstr "" -#: ../../library/socket.rst:793 +#: ../../library/socket.rst:800 msgid "The returned sockets are now non-inheritable." msgstr "" -#: ../../library/socket.rst:796 +#: ../../library/socket.rst:803 msgid "Windows support added." msgstr "新增對 Windows 的支援。" -#: ../../library/socket.rst:802 +#: ../../library/socket.rst:809 msgid "" "Connect to a TCP service listening on the internet *address* (a 2-tuple " "``(host, port)``), and return the socket object. This is a higher-level " @@ -955,21 +971,21 @@ msgid "" "IPv4 and IPv6." msgstr "" -#: ../../library/socket.rst:810 +#: ../../library/socket.rst:817 msgid "" "Passing the optional *timeout* parameter will set the timeout on the socket " "instance before attempting to connect. If no *timeout* is supplied, the " "global default timeout setting returned by :func:`getdefaulttimeout` is used." msgstr "" -#: ../../library/socket.rst:815 +#: ../../library/socket.rst:822 msgid "" "If supplied, *source_address* must be a 2-tuple ``(host, port)`` for the " "socket to bind to as its source address before connecting. If host or port " "are '' or 0 respectively the OS default behavior will be used." msgstr "" -#: ../../library/socket.rst:819 +#: ../../library/socket.rst:826 msgid "" "When a connection cannot be created, an exception is raised. By default, it " "is the exception from the last address in the list. If *all_errors* is " @@ -977,42 +993,42 @@ msgid "" "attempts." msgstr "" -#: ../../library/socket.rst:824 +#: ../../library/socket.rst:831 msgid "*source_address* was added." msgstr "新增 *source_address*。" -#: ../../library/socket.rst:827 +#: ../../library/socket.rst:834 msgid "*all_errors* was added." msgstr "新增 *all_errors*。" -#: ../../library/socket.rst:833 +#: ../../library/socket.rst:840 msgid "" "Convenience function which creates a TCP socket bound to *address* (a 2-" "tuple ``(host, port)``) and returns the socket object." msgstr "" -#: ../../library/socket.rst:836 +#: ../../library/socket.rst:843 msgid "" "*family* should be either :data:`AF_INET` or :data:`AF_INET6`. *backlog* is " "the queue size passed to :meth:`socket.listen`; if not specified , a default " -"reasonable value is chosen. *reuse_port* dictates whether to set " -"the :data:`SO_REUSEPORT` socket option." +"reasonable value is chosen. *reuse_port* dictates whether to set the :data:" +"`SO_REUSEPORT` socket option." msgstr "" -#: ../../library/socket.rst:841 +#: ../../library/socket.rst:848 msgid "" -"If *dualstack_ipv6* is true and the platform supports it the socket will be " -"able to accept both IPv4 and IPv6 connections, else it will " -"raise :exc:`ValueError`. Most POSIX platforms and Windows are supposed to " -"support this functionality. When this functionality is enabled the address " -"returned by :meth:`socket.getpeername` when an IPv4 connection occurs will " -"be an IPv6 address represented as an IPv4-mapped IPv6 address. If " -"*dualstack_ipv6* is false it will explicitly disable this functionality on " -"platforms that enable it by default (e.g. Linux). This parameter can be used " -"in conjunction with :func:`has_dualstack_ipv6`:" +"If *dualstack_ipv6* is true, *family* is :data:`AF_INET6` and the platform " +"supports it the socket will be able to accept both IPv4 and IPv6 " +"connections, else it will raise :exc:`ValueError`. Most POSIX platforms and " +"Windows are supposed to support this functionality. When this functionality " +"is enabled the address returned by :meth:`socket.getpeername` when an IPv4 " +"connection occurs will be an IPv6 address represented as an IPv4-mapped IPv6 " +"address. If *dualstack_ipv6* is false it will explicitly disable this " +"functionality on platforms that enable it by default (e.g. Linux). This " +"parameter can be used in conjunction with :func:`has_dualstack_ipv6`:" msgstr "" -#: ../../library/socket.rst:854 +#: ../../library/socket.rst:861 msgid "" "import socket\n" "\n" @@ -1032,65 +1048,65 @@ msgstr "" "else:\n" " s = socket.create_server(addr)" -#: ../../library/socket.rst:863 +#: ../../library/socket.rst:870 msgid "" "On POSIX platforms the :data:`SO_REUSEADDR` socket option is set in order to " "immediately reuse previous sockets which were bound on the same *address* " "and remained in TIME_WAIT state." msgstr "" -#: ../../library/socket.rst:871 +#: ../../library/socket.rst:878 msgid "" "Return ``True`` if the platform supports creating a TCP socket which can " "handle both IPv4 and IPv6 connections." msgstr "" -#: ../../library/socket.rst:878 +#: ../../library/socket.rst:885 msgid "" "Duplicate the file descriptor *fd* (an integer as returned by a file " "object's :meth:`~io.IOBase.fileno` method) and build a socket object from " -"the result. Address family, socket type and protocol number are as for " -"the :func:`~socket.socket` function above. The file descriptor should refer " -"to a socket, but this is not checked --- subsequent operations on the object " -"may fail if the file descriptor is invalid. This function is rarely needed, " -"but can be used to get or set socket options on a socket passed to a program " -"as standard input or output (such as a server started by the Unix inet " +"the result. Address family, socket type and protocol number are as for the :" +"func:`~socket.socket` function above. The file descriptor should refer to a " +"socket, but this is not checked --- subsequent operations on the object may " +"fail if the file descriptor is invalid. This function is rarely needed, but " +"can be used to get or set socket options on a socket passed to a program as " +"standard input or output (such as a server started by the Unix inet " "daemon). The socket is assumed to be in blocking mode." msgstr "" -#: ../../library/socket.rst:895 +#: ../../library/socket.rst:902 msgid "" "Instantiate a socket from data obtained from the :meth:`socket.share` " "method. The socket is assumed to be in blocking mode." msgstr "" -#: ../../library/socket.rst:905 +#: ../../library/socket.rst:912 msgid "" "This is a Python type object that represents the socket object type. It is " "the same as ``type(socket(...))``." msgstr "" -#: ../../library/socket.rst:910 +#: ../../library/socket.rst:917 msgid "Other functions" msgstr "其他函式" -#: ../../library/socket.rst:912 +#: ../../library/socket.rst:919 msgid "The :mod:`socket` module also offers various network-related services:" msgstr "" -#: ../../library/socket.rst:917 +#: ../../library/socket.rst:924 msgid "" "Close a socket file descriptor. This is like :func:`os.close`, but for " "sockets. On some platforms (most noticeable Windows) :func:`os.close` does " "not work for socket file descriptors." msgstr "" -#: ../../library/socket.rst:925 +#: ../../library/socket.rst:932 msgid "" "This function wraps the C function ``getaddrinfo`` of the underlying system." msgstr "" -#: ../../library/socket.rst:927 +#: ../../library/socket.rst:934 msgid "" "Translate the *host*/*port* argument into a sequence of 5-tuples that " "contain all the necessary arguments for creating a socket connected to that " @@ -1100,7 +1116,7 @@ msgid "" "and *port*, you can pass ``NULL`` to the underlying C API." msgstr "" -#: ../../library/socket.rst:934 +#: ../../library/socket.rst:941 msgid "" "The *family*, *type* and *proto* arguments can be optionally specified in " "order to provide options and limit the list of addresses returned. Pass " @@ -1108,36 +1124,35 @@ msgid "" "limit the results. See the note below for details." msgstr "" -#: ../../library/socket.rst:939 +#: ../../library/socket.rst:946 msgid "" "The *flags* argument can be one or several of the ``AI_*`` constants, and " -"will influence how results are computed and returned. For " -"example, :const:`AI_NUMERICHOST` will disable domain name resolution and " -"will raise an error if *host* is a domain name." +"will influence how results are computed and returned. For example, :const:" +"`AI_NUMERICHOST` will disable domain name resolution and will raise an error " +"if *host* is a domain name." msgstr "" -#: ../../library/socket.rst:944 +#: ../../library/socket.rst:951 msgid "The function returns a list of 5-tuples with the following structure:" msgstr "" -#: ../../library/socket.rst:946 +#: ../../library/socket.rst:953 msgid "``(family, type, proto, canonname, sockaddr)``" msgstr "``(family, type, proto, canonname, sockaddr)``" -#: ../../library/socket.rst:948 +#: ../../library/socket.rst:955 msgid "" "In these tuples, *family*, *type*, *proto* are all integers and are meant to " "be passed to the :func:`~socket.socket` function. *canonname* will be a " -"string representing the canonical name of the *host* " -"if :const:`AI_CANONNAME` is part of the *flags* argument; else *canonname* " -"will be empty. *sockaddr* is a tuple describing a socket address, whose " -"format depends on the returned *family* (a ``(address, port)`` 2-tuple " -"for :const:`AF_INET`, a ``(address, port, flowinfo, scope_id)`` 4-tuple " -"for :const:`AF_INET6`), and is meant to be passed to " -"the :meth:`socket.connect` method." +"string representing the canonical name of the *host* if :const:" +"`AI_CANONNAME` is part of the *flags* argument; else *canonname* will be " +"empty. *sockaddr* is a tuple describing a socket address, whose format " +"depends on the returned *family* (a ``(address, port)`` 2-tuple for :const:" +"`AF_INET`, a ``(address, port, flowinfo, scope_id)`` 4-tuple for :const:" +"`AF_INET6`), and is meant to be passed to the :meth:`socket.connect` method." msgstr "" -#: ../../library/socket.rst:960 +#: ../../library/socket.rst:967 msgid "" "If you intend to use results from :func:`!getaddrinfo` to create a socket " "(rather than, for example, retrieve *canonname*), consider limiting the " @@ -1146,13 +1161,13 @@ msgid "" "application can handle." msgstr "" -#: ../../library/socket.rst:966 +#: ../../library/socket.rst:973 msgid "" "The behavior with default values of *family*, *type*, *proto* and *flags* is " "system-specific." msgstr "" -#: ../../library/socket.rst:969 +#: ../../library/socket.rst:976 msgid "" "Many systems (for example, most Linux configurations) will return a sorted " "list of all matching addresses. These addresses should generally be tried in " @@ -1162,14 +1177,14 @@ msgid "" "attempts." msgstr "" -#: ../../library/socket.rst:976 +#: ../../library/socket.rst:983 msgid "" "Some systems will, however, only return a single address. (For example, this " "was reported on Solaris and AIX configurations.) On these systems, limiting " "the *type* and/or *proto* helps ensure that this address is usable." msgstr "" -#: ../../library/socket.rst:981 +#: ../../library/socket.rst:988 msgid "" "Raises an :ref:`auditing event ` ``socket.getaddrinfo`` with " "arguments ``host``, ``port``, ``family``, ``type``, ``protocol``." @@ -1177,14 +1192,14 @@ msgstr "" "引發一個附帶引數 ``host``、``port``、``family``、``type``、``protocol`` 的" "\\ :ref:`稽核事件 ` ``socket.getaddrinfo``。" -#: ../../library/socket.rst:983 +#: ../../library/socket.rst:990 msgid "" "The following example fetches address information for a hypothetical TCP " "connection to ``example.org`` on port 80 (results may differ on your system " "if IPv6 isn't enabled)::" msgstr "" -#: ../../library/socket.rst:987 +#: ../../library/socket.rst:994 msgid "" ">>> socket.getaddrinfo(\"example.org\", 80, proto=socket.IPPROTO_TCP)\n" "[(socket.AF_INET6, socket.SOCK_STREAM,\n" @@ -1198,17 +1213,17 @@ msgstr "" " (socket.AF_INET, socket.SOCK_STREAM,\n" " 6, '', ('93.184.216.34', 80))]" -#: ../../library/socket.rst:993 +#: ../../library/socket.rst:1000 msgid "parameters can now be passed using keyword arguments." msgstr "" -#: ../../library/socket.rst:996 +#: ../../library/socket.rst:1003 msgid "" "for IPv6 multicast addresses, string representing an address will not " "contain ``%scope_id`` part." msgstr "" -#: ../../library/socket.rst:1004 +#: ../../library/socket.rst:1011 msgid "" "Return a fully qualified domain name for *name*. If *name* is omitted or " "empty, it is interpreted as the local host. To find the fully qualified " @@ -1219,7 +1234,7 @@ msgid "" "``'0.0.0.0'``, the hostname from :func:`gethostname` is returned." msgstr "" -#: ../../library/socket.rst:1015 +#: ../../library/socket.rst:1022 msgid "" "Translate a host name to IPv4 address format. The IPv4 address is returned " "as a string, such as ``'100.50.200.5'``. If the host name is an IPv4 " @@ -1229,15 +1244,15 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:1021 ../../library/socket.rst:1037 +#: ../../library/socket.rst:1028 ../../library/socket.rst:1044 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyname`` with " "argument ``hostname``." msgstr "" -"引發一個附帶引數 ``hostname`` 的\\ :ref:`稽核事件 ` " -"``socket.gethostbyname``。" +"引發一個附帶引數 ``hostname`` 的\\ :ref:`稽核事件 ` ``socket." +"gethostbyname``。" -#: ../../library/socket.rst:1028 +#: ../../library/socket.rst:1035 msgid "" "Translate a host name to IPv4 address format, extended interface. Return a 3-" "tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the host's " @@ -1249,45 +1264,45 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:1044 +#: ../../library/socket.rst:1051 msgid "" "Return a string containing the hostname of the machine where the Python " "interpreter is currently executing." msgstr "" -#: ../../library/socket.rst:1047 +#: ../../library/socket.rst:1054 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostname`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``socket.gethostname``。" -#: ../../library/socket.rst:1049 +#: ../../library/socket.rst:1056 msgid "" "Note: :func:`gethostname` doesn't always return the fully qualified domain " "name; use :func:`getfqdn` for that." msgstr "" -#: ../../library/socket.rst:1057 +#: ../../library/socket.rst:1064 msgid "" "Return a 3-tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is " "the primary host name responding to the given *ip_address*, *aliaslist* is a " "(possibly empty) list of alternative host names for the same address, and " "*ipaddrlist* is a list of IPv4/v6 addresses for the same interface on the " "same host (most likely containing only a single address). To find the fully " -"qualified domain name, use the " -"function :func:`getfqdn`. :func:`gethostbyaddr` supports both IPv4 and IPv6." +"qualified domain name, use the function :func:`getfqdn`. :func:" +"`gethostbyaddr` supports both IPv4 and IPv6." msgstr "" -#: ../../library/socket.rst:1065 +#: ../../library/socket.rst:1072 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyaddr`` with " "argument ``ip_address``." msgstr "" -"引發一個附帶引數 ``ip_address`` 的\\ :ref:`稽核事件 ` " -"``socket.gethostbyaddr``。" +"引發一個附帶引數 ``ip_address`` 的\\ :ref:`稽核事件 ` ``socket." +"gethostbyaddr``。" -#: ../../library/socket.rst:1072 +#: ../../library/socket.rst:1079 msgid "" "Translate a socket address *sockaddr* into a 2-tuple ``(host, port)``. " "Depending on the settings of *flags*, the result can contain a fully " @@ -1295,43 +1310,42 @@ msgid "" "Similarly, *port* can contain a string port name or a numeric port number." msgstr "" -#: ../../library/socket.rst:1077 +#: ../../library/socket.rst:1084 msgid "" "For IPv6 addresses, ``%scope_id`` is appended to the host part if *sockaddr* " "contains meaningful *scope_id*. Usually this happens for multicast addresses." msgstr "" -#: ../../library/socket.rst:1080 +#: ../../library/socket.rst:1087 msgid "" "For more information about *flags* you can consult :manpage:`getnameinfo(3)`." msgstr "" -#: ../../library/socket.rst:1082 +#: ../../library/socket.rst:1089 msgid "" "Raises an :ref:`auditing event ` ``socket.getnameinfo`` with " "argument ``sockaddr``." msgstr "" -"引發一個附帶引數 ``sockaddr`` 的\\ :ref:`稽核事件 ` " -"``socket.getnameinfo``。" +"引發一個附帶引數 ``sockaddr`` 的\\ :ref:`稽核事件 ` ``socket." +"getnameinfo``。" -#: ../../library/socket.rst:1089 +#: ../../library/socket.rst:1096 msgid "" "Translate an internet protocol name (for example, ``'icmp'``) to a constant " -"suitable for passing as the (optional) third argument to " -"the :func:`~socket.socket` function. This is usually only needed for " -"sockets opened in \"raw\" mode (:const:`SOCK_RAW`); for the normal socket " -"modes, the correct protocol is chosen automatically if the protocol is " -"omitted or zero." +"suitable for passing as the (optional) third argument to the :func:`~socket." +"socket` function. This is usually only needed for sockets opened in \"raw\" " +"mode (:const:`SOCK_RAW`); for the normal socket modes, the correct protocol " +"is chosen automatically if the protocol is omitted or zero." msgstr "" -#: ../../library/socket.rst:1100 +#: ../../library/socket.rst:1107 msgid "" "Translate an internet service name and protocol name to a port number for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:1104 +#: ../../library/socket.rst:1111 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyname`` with " "arguments ``servicename``, ``protocolname``." @@ -1339,14 +1353,14 @@ msgstr "" "引發一個附帶引數 ``sockaddr``、``protocolname`` 的\\ :ref:`稽核事件 " "` ``socket.getservbyname``。" -#: ../../library/socket.rst:1111 +#: ../../library/socket.rst:1118 msgid "" "Translate an internet port number and protocol name to a service name for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:1115 +#: ../../library/socket.rst:1122 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyport`` with " "arguments ``port``, ``protocolname``." @@ -1354,40 +1368,40 @@ msgstr "" "引發一個附帶引數 ``port``、``protocolname`` 的\\ :ref:`稽核事件 ` " "``socket.getservbyport``。" -#: ../../library/socket.rst:1122 +#: ../../library/socket.rst:1129 msgid "" "Convert 32-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:1129 +#: ../../library/socket.rst:1136 msgid "" "Convert 16-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:1133 ../../library/socket.rst:1151 +#: ../../library/socket.rst:1140 ../../library/socket.rst:1158 msgid "" "Raises :exc:`OverflowError` if *x* does not fit in a 16-bit unsigned integer." msgstr "" -#: ../../library/socket.rst:1140 +#: ../../library/socket.rst:1147 msgid "" "Convert 32-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:1147 +#: ../../library/socket.rst:1154 msgid "" "Convert 16-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:1158 +#: ../../library/socket.rst:1165 msgid "" "Convert an IPv4 address from dotted-quad string format (for example, " "'123.45.67.89') to 32-bit packed binary format, as a bytes object four " @@ -1396,26 +1410,26 @@ msgid "" "which is the C type for the 32-bit packed binary this function returns." msgstr "" -#: ../../library/socket.rst:1164 +#: ../../library/socket.rst:1171 msgid "" ":func:`inet_aton` also accepts strings with less than three dots; see the " "Unix manual page :manpage:`inet(3)` for details." msgstr "" -#: ../../library/socket.rst:1167 +#: ../../library/socket.rst:1174 msgid "" -"If the IPv4 address string passed to this function is " -"invalid, :exc:`OSError` will be raised. Note that exactly what is valid " -"depends on the underlying C implementation of :c:func:`inet_aton`." +"If the IPv4 address string passed to this function is invalid, :exc:" +"`OSError` will be raised. Note that exactly what is valid depends on the " +"underlying C implementation of :c:func:`inet_aton`." msgstr "" -#: ../../library/socket.rst:1171 +#: ../../library/socket.rst:1178 msgid "" ":func:`inet_aton` does not support IPv6, and :func:`inet_pton` should be " "used instead for IPv4/v6 dual stack support." msgstr "" -#: ../../library/socket.rst:1177 +#: ../../library/socket.rst:1184 msgid "" "Convert a 32-bit packed IPv4 address (a :term:`bytes-like object` four bytes " "in length) to its standard dotted-quad string representation (for example, " @@ -1425,7 +1439,7 @@ msgid "" "argument." msgstr "" -#: ../../library/socket.rst:1184 +#: ../../library/socket.rst:1191 msgid "" "If the byte sequence passed to this function is not exactly 4 bytes in " "length, :exc:`OSError` will be raised. :func:`inet_ntoa` does not support " @@ -1433,28 +1447,28 @@ msgid "" "support." msgstr "" -#: ../../library/socket.rst:1195 +#: ../../library/socket.rst:1202 msgid "" "Convert an IP address from its family-specific string format to a packed, " "binary format. :func:`inet_pton` is useful when a library or network " -"protocol calls for an object of type :c:struct:`in_addr` (similar " -"to :func:`inet_aton`) or :c:struct:`in6_addr`." +"protocol calls for an object of type :c:struct:`in_addr` (similar to :func:" +"`inet_aton`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:1200 +#: ../../library/socket.rst:1207 msgid "" -"Supported values for *address_family* are currently :const:`AF_INET` " -"and :const:`AF_INET6`. If the IP address string *ip_string* is " -"invalid, :exc:`OSError` will be raised. Note that exactly what is valid " -"depends on both the value of *address_family* and the underlying " -"implementation of :c:func:`inet_pton`." +"Supported values for *address_family* are currently :const:`AF_INET` and :" +"const:`AF_INET6`. If the IP address string *ip_string* is invalid, :exc:" +"`OSError` will be raised. Note that exactly what is valid depends on both " +"the value of *address_family* and the underlying implementation of :c:func:" +"`inet_pton`." msgstr "" -#: ../../library/socket.rst:1208 ../../library/socket.rst:1228 +#: ../../library/socket.rst:1215 ../../library/socket.rst:1235 msgid "Windows support added" msgstr "" -#: ../../library/socket.rst:1214 +#: ../../library/socket.rst:1221 msgid "" "Convert a packed IP address (a :term:`bytes-like object` of some number of " "bytes) to its standard, family-specific string representation (for example, " @@ -1463,32 +1477,31 @@ msgid "" "(similar to :func:`inet_ntoa`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:1221 +#: ../../library/socket.rst:1228 msgid "" -"Supported values for *address_family* are currently :const:`AF_INET` " -"and :const:`AF_INET6`. If the bytes object *packed_ip* is not the correct " -"length for the specified address family, :exc:`ValueError` will be " -"raised. :exc:`OSError` is raised for errors from the call " -"to :func:`inet_ntop`." +"Supported values for *address_family* are currently :const:`AF_INET` and :" +"const:`AF_INET6`. If the bytes object *packed_ip* is not the correct length " +"for the specified address family, :exc:`ValueError` will be raised. :exc:" +"`OSError` is raised for errors from the call to :func:`inet_ntop`." msgstr "" -#: ../../library/socket.rst:1243 +#: ../../library/socket.rst:1250 msgid "" "Return the total length, without trailing padding, of an ancillary data item " "with associated data of the given *length*. This value can often be used as " "the buffer size for :meth:`~socket.recvmsg` to receive a single item of " -"ancillary data, but :rfc:`3542` requires portable applications to " -"use :func:`CMSG_SPACE` and thus include space for padding, even when the " -"item will be the last in the buffer. Raises :exc:`OverflowError` if " -"*length* is outside the permissible range of values." +"ancillary data, but :rfc:`3542` requires portable applications to use :func:" +"`CMSG_SPACE` and thus include space for padding, even when the item will be " +"the last in the buffer. Raises :exc:`OverflowError` if *length* is outside " +"the permissible range of values." msgstr "" -#: ../../library/socket.rst:1254 ../../library/socket.rst:1741 -#: ../../library/socket.rst:1785 ../../library/socket.rst:1893 +#: ../../library/socket.rst:1261 ../../library/socket.rst:1748 +#: ../../library/socket.rst:1792 ../../library/socket.rst:1900 msgid "Most Unix platforms." msgstr "" -#: ../../library/socket.rst:1261 +#: ../../library/socket.rst:1268 msgid "" "Return the buffer size needed for :meth:`~socket.recvmsg` to receive an " "ancillary data item with associated data of the given *length*, along with " @@ -1498,7 +1511,7 @@ msgid "" "values." msgstr "" -#: ../../library/socket.rst:1269 +#: ../../library/socket.rst:1276 msgid "" "Note that some systems might support ancillary data without providing this " "function. Also note that setting the buffer size using the results of this " @@ -1506,136 +1519,134 @@ msgid "" "received, since additional data may be able to fit into the padding area." msgstr "" -#: ../../library/socket.rst:1277 +#: ../../library/socket.rst:1284 msgid "most Unix platforms." msgstr "" -#: ../../library/socket.rst:1284 +#: ../../library/socket.rst:1291 msgid "" "Return the default timeout in seconds (float) for new socket objects. A " "value of ``None`` indicates that new socket objects have no timeout. When " "the socket module is first imported, the default is ``None``." msgstr "" -#: ../../library/socket.rst:1291 +#: ../../library/socket.rst:1298 msgid "" "Set the default timeout in seconds (float) for new socket objects. When the " -"socket module is first imported, the default is ``None``. " -"See :meth:`~socket.settimeout` for possible values and their respective " -"meanings." +"socket module is first imported, the default is ``None``. See :meth:" +"`~socket.settimeout` for possible values and their respective meanings." msgstr "" -#: ../../library/socket.rst:1299 +#: ../../library/socket.rst:1306 msgid "" "Set the machine's hostname to *name*. This will raise an :exc:`OSError` if " "you don't have enough rights." msgstr "" -#: ../../library/socket.rst:1302 +#: ../../library/socket.rst:1309 msgid "" "Raises an :ref:`auditing event ` ``socket.sethostname`` with " "argument ``name``." msgstr "" -"引發一個附帶引數 ``name`` 的\\ :ref:`稽核事件 ` " -"``socket.sethostname``。" +"引發一個附帶引數 ``name`` 的\\ :ref:`稽核事件 ` ``socket." +"sethostname``。" -#: ../../library/socket.rst:1311 +#: ../../library/socket.rst:1318 msgid "" "Return a list of network interface information (index int, name string) " "tuples. :exc:`OSError` if the system call fails." msgstr "" -#: ../../library/socket.rst:1319 ../../library/socket.rst:1346 -#: ../../library/socket.rst:1363 +#: ../../library/socket.rst:1326 ../../library/socket.rst:1353 +#: ../../library/socket.rst:1370 msgid "Windows support was added." msgstr "增加對 Windows 的支援。" -#: ../../library/socket.rst:1324 +#: ../../library/socket.rst:1331 msgid "" "On Windows network interfaces have different names in different contexts " "(all names are examples):" msgstr "" -#: ../../library/socket.rst:1327 +#: ../../library/socket.rst:1334 msgid "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" msgstr "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" -#: ../../library/socket.rst:1328 +#: ../../library/socket.rst:1335 msgid "name: ``ethernet_32770``" msgstr "" -#: ../../library/socket.rst:1329 +#: ../../library/socket.rst:1336 msgid "friendly name: ``vEthernet (nat)``" msgstr "" -#: ../../library/socket.rst:1330 +#: ../../library/socket.rst:1337 msgid "description: ``Hyper-V Virtual Ethernet Adapter``" msgstr "" -#: ../../library/socket.rst:1332 +#: ../../library/socket.rst:1339 msgid "" "This function returns names of the second form from the list, " "``ethernet_32770`` in this example case." msgstr "" -#: ../../library/socket.rst:1338 +#: ../../library/socket.rst:1345 msgid "" -"Return a network interface index number corresponding to an interface " -"name. :exc:`OSError` if no interface with the given name exists." +"Return a network interface index number corresponding to an interface name. :" +"exc:`OSError` if no interface with the given name exists." msgstr "" -#: ../../library/socket.rst:1350 ../../library/socket.rst:1367 +#: ../../library/socket.rst:1357 ../../library/socket.rst:1374 msgid "\"Interface name\" is a name as documented in :func:`if_nameindex`." msgstr "" -#: ../../library/socket.rst:1355 +#: ../../library/socket.rst:1362 msgid "" -"Return a network interface name corresponding to an interface index " -"number. :exc:`OSError` if no interface with the given index exists." +"Return a network interface name corresponding to an interface index number. :" +"exc:`OSError` if no interface with the given index exists." msgstr "" -#: ../../library/socket.rst:1372 +#: ../../library/socket.rst:1379 msgid "" "Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket " -"*sock*. The *fds* parameter is a sequence of file descriptors. " -"Consult :meth:`~socket.sendmsg` for the documentation of these parameters." +"*sock*. The *fds* parameter is a sequence of file descriptors. Consult :meth:" +"`~socket.sendmsg` for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1378 ../../library/socket.rst:1392 +#: ../../library/socket.rst:1385 ../../library/socket.rst:1399 msgid "" "Unix platforms supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` " "mechanism." msgstr "" -#: ../../library/socket.rst:1386 +#: ../../library/socket.rst:1393 msgid "" "Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket " -"*sock*. Return ``(msg, list(fds), flags, addr)``. " -"Consult :meth:`~socket.recvmsg` for the documentation of these parameters." +"*sock*. Return ``(msg, list(fds), flags, addr)``. Consult :meth:`~socket." +"recvmsg` for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1399 +#: ../../library/socket.rst:1406 msgid "Any truncated integers at the end of the list of file descriptors." msgstr "" -#: ../../library/socket.rst:1405 +#: ../../library/socket.rst:1412 msgid "Socket Objects" msgstr "Socket 物件" -#: ../../library/socket.rst:1407 +#: ../../library/socket.rst:1414 msgid "" -"Socket objects have the following methods. Except " -"for :meth:`~socket.makefile`, these correspond to Unix system calls " -"applicable to sockets." +"Socket objects have the following methods. Except for :meth:`~socket." +"makefile`, these correspond to Unix system calls applicable to sockets." msgstr "" -#: ../../library/socket.rst:1411 +#: ../../library/socket.rst:1418 msgid "" "Support for the :term:`context manager` protocol was added. Exiting the " "context manager is equivalent to calling :meth:`~socket.close`." msgstr "" -#: ../../library/socket.rst:1418 +#: ../../library/socket.rst:1425 msgid "" "Accept a connection. The socket must be bound to an address and listening " "for connections. The return value is a pair ``(conn, address)`` where *conn* " @@ -1644,27 +1655,27 @@ msgid "" "connection." msgstr "" -#: ../../library/socket.rst:1425 ../../library/socket.rst:1519 +#: ../../library/socket.rst:1432 ../../library/socket.rst:1526 msgid "The socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:1428 ../../library/socket.rst:1654 -#: ../../library/socket.rst:1668 ../../library/socket.rst:1745 -#: ../../library/socket.rst:1818 ../../library/socket.rst:1837 -#: ../../library/socket.rst:1854 ../../library/socket.rst:1899 +#: ../../library/socket.rst:1435 ../../library/socket.rst:1661 +#: ../../library/socket.rst:1675 ../../library/socket.rst:1752 +#: ../../library/socket.rst:1825 ../../library/socket.rst:1844 +#: ../../library/socket.rst:1861 ../../library/socket.rst:1906 msgid "" "If the system call is interrupted and the signal handler does not raise an " -"exception, the method now retries the system call instead of raising " -"an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." +"exception, the method now retries the system call instead of raising an :exc:" +"`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1436 +#: ../../library/socket.rst:1443 msgid "" "Bind the socket to *address*. The socket must not already be bound. (The " "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1439 +#: ../../library/socket.rst:1446 msgid "" "Raises an :ref:`auditing event ` ``socket.bind`` with arguments " "``self``, ``address``." @@ -1672,7 +1683,7 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.bind``。" -#: ../../library/socket.rst:1446 +#: ../../library/socket.rst:1453 msgid "" "Mark the socket closed. The underlying system resource (e.g. a file " "descriptor) is also closed when all file objects from :meth:`makefile` are " @@ -1681,43 +1692,43 @@ msgid "" "flushed)." msgstr "" -#: ../../library/socket.rst:1452 +#: ../../library/socket.rst:1459 msgid "" "Sockets are automatically closed when they are garbage-collected, but it is " "recommended to :meth:`close` them explicitly, or to use a :keyword:`with` " "statement around them." msgstr "" -#: ../../library/socket.rst:1456 +#: ../../library/socket.rst:1463 msgid "" -":exc:`OSError` is now raised if an error occurs when the " -"underlying :c:func:`close` call is made." +":exc:`OSError` is now raised if an error occurs when the underlying :c:func:" +"`close` call is made." msgstr "" -#: ../../library/socket.rst:1462 +#: ../../library/socket.rst:1469 msgid "" ":meth:`close` releases the resource associated with a connection but does " "not necessarily close the connection immediately. If you want to close the " "connection in a timely fashion, call :meth:`shutdown` before :meth:`close`." msgstr "" -#: ../../library/socket.rst:1470 +#: ../../library/socket.rst:1477 msgid "" "Connect to a remote socket at *address*. (The format of *address* depends on " "the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1473 +#: ../../library/socket.rst:1480 msgid "" "If the connection is interrupted by a signal, the method waits until the " "connection completes, or raise a :exc:`TimeoutError` on timeout, if the " "signal handler doesn't raise an exception and the socket is blocking or has " -"a timeout. For non-blocking sockets, the method raises " -"an :exc:`InterruptedError` exception if the connection is interrupted by a " -"signal (or the exception raised by the signal handler)." +"a timeout. For non-blocking sockets, the method raises an :exc:" +"`InterruptedError` exception if the connection is interrupted by a signal " +"(or the exception raised by the signal handler)." msgstr "" -#: ../../library/socket.rst:1480 ../../library/socket.rst:1500 +#: ../../library/socket.rst:1487 ../../library/socket.rst:1507 msgid "" "Raises an :ref:`auditing event ` ``socket.connect`` with arguments " "``self``, ``address``." @@ -1725,15 +1736,15 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.connect``。" -#: ../../library/socket.rst:1482 +#: ../../library/socket.rst:1489 msgid "" -"The method now waits until the connection completes instead of raising " -"an :exc:`InterruptedError` exception if the connection is interrupted by a " +"The method now waits until the connection completes instead of raising an :" +"exc:`InterruptedError` exception if the connection is interrupted by a " "signal, the signal handler doesn't raise an exception and the socket is " "blocking or has a timeout (see the :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1493 +#: ../../library/socket.rst:1500 msgid "" "Like ``connect(address)``, but return an error indicator instead of raising " "an exception for errors returned by the C-level :c:func:`connect` call " @@ -1743,38 +1754,38 @@ msgid "" "asynchronous connects." msgstr "" -#: ../../library/socket.rst:1506 +#: ../../library/socket.rst:1513 msgid "" "Put the socket object into closed state without actually closing the " "underlying file descriptor. The file descriptor is returned, and can be " "reused for other purposes." msgstr "" -#: ../../library/socket.rst:1515 +#: ../../library/socket.rst:1522 msgid "Duplicate the socket." msgstr "" -#: ../../library/socket.rst:1527 +#: ../../library/socket.rst:1534 msgid "" "Return the socket's file descriptor (a small integer), or -1 on failure. " "This is useful with :func:`select.select`." msgstr "" -#: ../../library/socket.rst:1530 +#: ../../library/socket.rst:1537 msgid "" "Under Windows the small integer returned by this method cannot be used where " "a file descriptor can be used (such as :func:`os.fdopen`). Unix does not " "have this limitation." msgstr "" -#: ../../library/socket.rst:1536 +#: ../../library/socket.rst:1543 msgid "" "Get the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle: ``True`` if the socket can be inherited in " "child processes, ``False`` if it cannot." msgstr "" -#: ../../library/socket.rst:1545 +#: ../../library/socket.rst:1552 msgid "" "Return the remote address to which the socket is connected. This is useful " "to find out the port number of a remote IPv4/v6 socket, for instance. (The " @@ -1782,71 +1793,70 @@ msgid "" "above.) On some systems this function is not supported." msgstr "" -#: ../../library/socket.rst:1553 +#: ../../library/socket.rst:1560 msgid "" "Return the socket's own address. This is useful to find out the port number " "of an IPv4/v6 socket, for instance. (The format of the address returned " "depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1560 +#: ../../library/socket.rst:1567 msgid "" -"Return the value of the given socket option (see the Unix man " -"page :manpage:`getsockopt(2)`). The needed symbolic constants (:ref:`SO_\\* " -"etc. `) are defined in this module. If *buflen* is " -"absent, an integer option is assumed and its integer value is returned by " -"the function. If *buflen* is present, it specifies the maximum length of " -"the buffer used to receive the option in, and this buffer is returned as a " -"bytes object. It is up to the caller to decode the contents of the buffer " -"(see the optional built-in module :mod:`struct` for a way to decode C " -"structures encoded as byte strings)." +"Return the value of the given socket option (see the Unix man page :manpage:" +"`getsockopt(2)`). The needed symbolic constants (:ref:`SO_\\* etc. `) are defined in this module. If *buflen* is absent, an " +"integer option is assumed and its integer value is returned by the " +"function. If *buflen* is present, it specifies the maximum length of the " +"buffer used to receive the option in, and this buffer is returned as a bytes " +"object. It is up to the caller to decode the contents of the buffer (see " +"the optional built-in module :mod:`struct` for a way to decode C structures " +"encoded as byte strings)." msgstr "" -#: ../../library/socket.rst:1574 +#: ../../library/socket.rst:1581 msgid "" "Return ``True`` if socket is in blocking mode, ``False`` if in non-blocking." msgstr "" -#: ../../library/socket.rst:1577 +#: ../../library/socket.rst:1584 msgid "This is equivalent to checking ``socket.gettimeout() != 0``." msgstr "這等同於檢查 ``socket.gettimeout() != 0``。" -#: ../../library/socket.rst:1584 +#: ../../library/socket.rst:1591 msgid "" "Return the timeout in seconds (float) associated with socket operations, or " -"``None`` if no timeout is set. This reflects the last call " -"to :meth:`setblocking` or :meth:`settimeout`." +"``None`` if no timeout is set. This reflects the last call to :meth:" +"`setblocking` or :meth:`settimeout`." msgstr "" #: ../../library/socket.rst:0 msgid "platform" msgstr "平台" -#: ../../library/socket.rst:1591 +#: ../../library/socket.rst:1598 msgid "Windows" msgstr "Windows" -#: ../../library/socket.rst:1593 +#: ../../library/socket.rst:1600 msgid "" "The :meth:`ioctl` method is a limited interface to the WSAIoctl system " -"interface. Please refer to the `Win32 documentation `_ for more " -"information." +"interface. Please refer to the `Win32 documentation `_ for more information." msgstr "" -#: ../../library/socket.rst:1598 +#: ../../library/socket.rst:1605 msgid "" "On other platforms, the generic :func:`fcntl.fcntl` and :func:`fcntl.ioctl` " "functions may be used; they accept a socket object as their first argument." msgstr "" -#: ../../library/socket.rst:1601 +#: ../../library/socket.rst:1608 msgid "" "Currently only the following control codes are supported: ``SIO_RCVALL``, " "``SIO_KEEPALIVE_VALS``, and ``SIO_LOOPBACK_FAST_PATH``." msgstr "" -#: ../../library/socket.rst:1609 +#: ../../library/socket.rst:1616 msgid "" "Enable a server to accept connections. If *backlog* is specified, it must " "be at least 0 (if it is lower, it is set to 0); it specifies the number of " @@ -1854,11 +1864,11 @@ msgid "" "connections. If not specified, a default reasonable value is chosen." msgstr "" -#: ../../library/socket.rst:1616 +#: ../../library/socket.rst:1623 msgid "The *backlog* parameter is now optional." msgstr "" -#: ../../library/socket.rst:1625 +#: ../../library/socket.rst:1632 msgid "" "Return a :term:`file object` associated with the socket. The exact returned " "type depends on the arguments given to :meth:`makefile`. These arguments " @@ -1867,38 +1877,38 @@ msgid "" "``'b'``, or a combination of those." msgstr "" -#: ../../library/socket.rst:1631 +#: ../../library/socket.rst:1638 msgid "" "The socket must be in blocking mode; it can have a timeout, but the file " "object's internal buffer may end up in an inconsistent state if a timeout " "occurs." msgstr "" -#: ../../library/socket.rst:1635 +#: ../../library/socket.rst:1642 msgid "" "Closing the file object returned by :meth:`makefile` won't close the " -"original socket unless all other file objects have been closed " -"and :meth:`socket.close` has been called on the socket object." +"original socket unless all other file objects have been closed and :meth:" +"`socket.close` has been called on the socket object." msgstr "" -#: ../../library/socket.rst:1641 +#: ../../library/socket.rst:1648 msgid "" "On Windows, the file-like object created by :meth:`makefile` cannot be used " "where a file object with a file descriptor is expected, such as the stream " "arguments of :meth:`subprocess.Popen`." msgstr "" -#: ../../library/socket.rst:1648 +#: ../../library/socket.rst:1655 msgid "" "Receive data from the socket. The return value is a bytes object " "representing the data received. The maximum amount of data to be received " "at once is specified by *bufsize*. A returned empty bytes object indicates " -"that the client has disconnected. See the Unix manual " -"page :manpage:`recv(2)` for the meaning of the optional argument *flags*; it " -"defaults to zero." +"that the client has disconnected. See the Unix manual page :manpage:" +"`recv(2)` for the meaning of the optional argument *flags*; it defaults to " +"zero." msgstr "" -#: ../../library/socket.rst:1662 +#: ../../library/socket.rst:1669 msgid "" "Receive data from the socket. The return value is a pair ``(bytes, " "address)`` where *bytes* is a bytes object representing the data received " @@ -1908,14 +1918,14 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1673 +#: ../../library/socket.rst:1680 msgid "" "For multicast IPv6 address, first item of *address* does not contain " -"``%scope_id`` part anymore. In order to get full IPv6 address " -"use :func:`getnameinfo`." +"``%scope_id`` part anymore. In order to get full IPv6 address use :func:" +"`getnameinfo`." msgstr "" -#: ../../library/socket.rst:1680 +#: ../../library/socket.rst:1687 msgid "" "Receive normal data (up to *bufsize* bytes) and ancillary data from the " "socket. The *ancbufsize* argument sets the size in bytes of the internal " @@ -1926,7 +1936,7 @@ msgid "" "*flags* argument defaults to 0 and has the same meaning as for :meth:`recv`." msgstr "" -#: ../../library/socket.rst:1690 +#: ../../library/socket.rst:1697 msgid "" "The return value is a 4-tuple: ``(data, ancdata, msg_flags, address)``. The " "*data* item is a :class:`bytes` object holding the non-ancillary data " @@ -1941,39 +1951,38 @@ msgid "" "socket, if available; otherwise, its value is unspecified." msgstr "" -#: ../../library/socket.rst:1704 +#: ../../library/socket.rst:1711 msgid "" "On some systems, :meth:`sendmsg` and :meth:`recvmsg` can be used to pass " "file descriptors between processes over an :const:`AF_UNIX` socket. When " "this facility is used (it is often restricted to :const:`SOCK_STREAM` " "sockets), :meth:`recvmsg` will return, in its ancillary data, items of the " -"form ``(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)``, where *fds* is " -"a :class:`bytes` object representing the new file descriptors as a binary " -"array of the native C :c:expr:`int` type. If :meth:`recvmsg` raises an " -"exception after the system call returns, it will first attempt to close any " -"file descriptors received via this mechanism." +"form ``(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)``, where *fds* is a :" +"class:`bytes` object representing the new file descriptors as a binary array " +"of the native C :c:expr:`int` type. If :meth:`recvmsg` raises an exception " +"after the system call returns, it will first attempt to close any file " +"descriptors received via this mechanism." msgstr "" -#: ../../library/socket.rst:1715 +#: ../../library/socket.rst:1722 msgid "" "Some systems do not indicate the truncated length of ancillary data items " "which have been only partially received. If an item appears to extend " -"beyond the end of the buffer, :meth:`recvmsg` will issue " -"a :exc:`RuntimeWarning`, and will return the part of it which is inside the " -"buffer provided it has not been truncated before the start of its associated " -"data." +"beyond the end of the buffer, :meth:`recvmsg` will issue a :exc:" +"`RuntimeWarning`, and will return the part of it which is inside the buffer " +"provided it has not been truncated before the start of its associated data." msgstr "" -#: ../../library/socket.rst:1722 +#: ../../library/socket.rst:1729 msgid "" "On systems which support the :const:`SCM_RIGHTS` mechanism, the following " "function will receive up to *maxfds* file descriptors, returning the message " "data and a list containing the descriptors (while ignoring unexpected " -"conditions such as unrelated control messages being received). See " -"also :meth:`sendmsg`. ::" +"conditions such as unrelated control messages being received). See also :" +"meth:`sendmsg`. ::" msgstr "" -#: ../../library/socket.rst:1728 +#: ../../library/socket.rst:1735 msgid "" "import socket, array\n" "\n" @@ -1982,29 +1991,28 @@ msgid "" " msg, ancdata, flags, addr = sock.recvmsg(msglen, socket.CMSG_LEN(maxfds " "* fds.itemsize))\n" " for cmsg_level, cmsg_type, cmsg_data in ancdata:\n" -" if cmsg_level == socket.SOL_SOCKET and cmsg_type == " -"socket.SCM_RIGHTS:\n" +" if cmsg_level == socket.SOL_SOCKET and cmsg_type == socket." +"SCM_RIGHTS:\n" " # Append data, ignoring any truncated integers at the end.\n" -" fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % " -"fds.itemsize)])\n" +" fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds." +"itemsize)])\n" " return msg, list(fds)" msgstr "" -#: ../../library/socket.rst:1753 +#: ../../library/socket.rst:1760 msgid "" -"Receive normal data and ancillary data from the socket, behaving " -"as :meth:`recvmsg` would, but scatter the non-ancillary data into a series " -"of buffers instead of returning a new bytes object. The *buffers* argument " -"must be an iterable of objects that export writable buffers " -"(e.g. :class:`bytearray` objects); these will be filled with successive " -"chunks of the non-ancillary data until it has all been written or there are " -"no more buffers. The operating system may set a limit (:func:`~os.sysconf` " -"value ``SC_IOV_MAX``) on the number of buffers that can be used. The " -"*ancbufsize* and *flags* arguments have the same meaning as " -"for :meth:`recvmsg`." +"Receive normal data and ancillary data from the socket, behaving as :meth:" +"`recvmsg` would, but scatter the non-ancillary data into a series of buffers " +"instead of returning a new bytes object. The *buffers* argument must be an " +"iterable of objects that export writable buffers (e.g. :class:`bytearray` " +"objects); these will be filled with successive chunks of the non-ancillary " +"data until it has all been written or there are no more buffers. The " +"operating system may set a limit (:func:`~os.sysconf` value ``SC_IOV_MAX``) " +"on the number of buffers that can be used. The *ancbufsize* and *flags* " +"arguments have the same meaning as for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1764 +#: ../../library/socket.rst:1771 msgid "" "The return value is a 4-tuple: ``(nbytes, ancdata, msg_flags, address)``, " "where *nbytes* is the total number of bytes of non-ancillary data written " @@ -2012,11 +2020,11 @@ msgid "" "for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1769 +#: ../../library/socket.rst:1776 msgid "Example::" msgstr "範例: ::" -#: ../../library/socket.rst:1771 +#: ../../library/socket.rst:1778 msgid "" ">>> import socket\n" ">>> s1, s2 = socket.socketpair()\n" @@ -2042,7 +2050,7 @@ msgstr "" ">>> [b1, b2, b3]\n" "[bytearray(b'Mary'), bytearray(b'01 had a 9'), bytearray(b'little lamb---')]" -#: ../../library/socket.rst:1792 +#: ../../library/socket.rst:1799 msgid "" "Receive data from the socket, writing it into *buffer* instead of creating a " "new bytestring. The return value is a pair ``(nbytes, address)`` where " @@ -2052,7 +2060,7 @@ msgid "" "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1802 +#: ../../library/socket.rst:1809 msgid "" "Receive up to *nbytes* bytes from the socket, storing the data into a buffer " "rather than creating a new bytestring. If *nbytes* is not specified (or 0), " @@ -2061,7 +2069,7 @@ msgid "" "of the optional argument *flags*; it defaults to zero." msgstr "" -#: ../../library/socket.rst:1811 +#: ../../library/socket.rst:1818 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2071,7 +2079,7 @@ msgid "" "data. For further information on this topic, consult the :ref:`socket-howto`." msgstr "" -#: ../../library/socket.rst:1826 +#: ../../library/socket.rst:1833 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2081,13 +2089,13 @@ msgid "" "to determine how much data, if any, was successfully sent." msgstr "" -#: ../../library/socket.rst:1833 +#: ../../library/socket.rst:1840 msgid "" "The socket timeout is no longer reset each time data is sent successfully. " "The socket timeout is now the maximum total duration to send all data." msgstr "" -#: ../../library/socket.rst:1846 +#: ../../library/socket.rst:1853 msgid "" "Send data to the socket. The socket should not be connected to a remote " "socket, since the destination socket is specified by *address*. The " @@ -2096,7 +2104,7 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1852 +#: ../../library/socket.rst:1859 msgid "" "Raises an :ref:`auditing event ` ``socket.sendto`` with arguments " "``self``, ``address``." @@ -2104,13 +2112,13 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.sendto``。" -#: ../../library/socket.rst:1862 +#: ../../library/socket.rst:1869 msgid "" "Send normal and ancillary data to the socket, gathering the non-ancillary " "data from a series of buffers and concatenating it into a single message. " -"The *buffers* argument specifies the non-ancillary data as an iterable " -"of :term:`bytes-like objects ` (e.g. :class:`bytes` " -"objects); the operating system may set a limit (:func:`~os.sysconf` value " +"The *buffers* argument specifies the non-ancillary data as an iterable of :" +"term:`bytes-like objects ` (e.g. :class:`bytes` objects); " +"the operating system may set a limit (:func:`~os.sysconf` value " "``SC_IOV_MAX``) on the number of buffers that can be used. The *ancdata* " "argument specifies the ancillary data (control messages) as an iterable of " "zero or more tuples ``(cmsg_level, cmsg_type, cmsg_data)``, where " @@ -2124,28 +2132,28 @@ msgid "" "bytes of non-ancillary data sent." msgstr "" -#: ../../library/socket.rst:1882 +#: ../../library/socket.rst:1889 msgid "" -"The following function sends the list of file descriptors *fds* over " -"an :const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " +"The following function sends the list of file descriptors *fds* over an :" +"const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " "mechanism. See also :meth:`recvmsg`. ::" msgstr "" -#: ../../library/socket.rst:1886 +#: ../../library/socket.rst:1893 msgid "" "import socket, array\n" "\n" "def send_fds(sock, msg, fds):\n" -" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, " -"array.array(\"i\", fds))])" +" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array." +"array(\"i\", fds))])" msgstr "" "import socket, array\n" "\n" "def send_fds(sock, msg, fds):\n" -" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, " -"array.array(\"i\", fds))])" +" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array." +"array(\"i\", fds))])" -#: ../../library/socket.rst:1895 +#: ../../library/socket.rst:1902 msgid "" "Raises an :ref:`auditing event ` ``socket.sendmsg`` with arguments " "``self``, ``address``." @@ -2153,161 +2161,158 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.sendmsg``。" -#: ../../library/socket.rst:1906 +#: ../../library/socket.rst:1913 msgid "" "Specialized version of :meth:`~socket.sendmsg` for :const:`AF_ALG` socket. " "Set mode, IV, AEAD associated data length and flags for :const:`AF_ALG` " "socket." msgstr "" -#: ../../library/socket.rst:1915 +#: ../../library/socket.rst:1922 msgid "" -"Send a file until EOF is reached by using high-" -"performance :mod:`os.sendfile` and return the total number of bytes which " -"were sent. *file* must be a regular file object opened in binary mode. " -"If :mod:`os.sendfile` is not available (e.g. Windows) or *file* is not a " -"regular file :meth:`send` will be used instead. *offset* tells from where to " -"start reading the file. If specified, *count* is the total number of bytes " -"to transmit as opposed to sending the file until EOF is reached. File " -"position is updated on return or also in case of error in which " -"case :meth:`file.tell() ` can be used to figure out the " -"number of bytes which were sent. The socket must be of :const:`SOCK_STREAM` " -"type. Non-blocking sockets are not supported." +"Send a file until EOF is reached by using high-performance :mod:`os." +"sendfile` and return the total number of bytes which were sent. *file* must " +"be a regular file object opened in binary mode. If :mod:`os.sendfile` is not " +"available (e.g. Windows) or *file* is not a regular file :meth:`send` will " +"be used instead. *offset* tells from where to start reading the file. If " +"specified, *count* is the total number of bytes to transmit as opposed to " +"sending the file until EOF is reached. File position is updated on return or " +"also in case of error in which case :meth:`file.tell() ` can " +"be used to figure out the number of bytes which were sent. The socket must " +"be of :const:`SOCK_STREAM` type. Non-blocking sockets are not supported." msgstr "" -#: ../../library/socket.rst:1931 +#: ../../library/socket.rst:1938 msgid "" "Set the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle." msgstr "" -#: ../../library/socket.rst:1939 +#: ../../library/socket.rst:1946 msgid "" "Set blocking or non-blocking mode of the socket: if *flag* is false, the " "socket is set to non-blocking, else to blocking mode." msgstr "" -#: ../../library/socket.rst:1942 +#: ../../library/socket.rst:1949 msgid "" "This method is a shorthand for certain :meth:`~socket.settimeout` calls:" msgstr "" -#: ../../library/socket.rst:1944 +#: ../../library/socket.rst:1951 msgid "``sock.setblocking(True)`` is equivalent to ``sock.settimeout(None)``" msgstr "``sock.setblocking(True)`` 等價於 ``sock.settimeout(None)``" -#: ../../library/socket.rst:1946 +#: ../../library/socket.rst:1953 msgid "``sock.setblocking(False)`` is equivalent to ``sock.settimeout(0.0)``" msgstr "``sock.setblocking(False)`` 等價於 ``sock.settimeout(0.0)``" -#: ../../library/socket.rst:1948 +#: ../../library/socket.rst:1955 msgid "" -"The method no longer applies :const:`SOCK_NONBLOCK` flag " -"on :attr:`socket.type`." +"The method no longer applies :const:`SOCK_NONBLOCK` flag on :attr:`socket." +"type`." msgstr "" -#: ../../library/socket.rst:1955 +#: ../../library/socket.rst:1962 msgid "" "Set a timeout on blocking socket operations. The *value* argument can be a " "nonnegative floating-point number expressing seconds, or ``None``. If a non-" -"zero value is given, subsequent socket operations will raise " -"a :exc:`timeout` exception if the timeout period *value* has elapsed before " -"the operation has completed. If zero is given, the socket is put in non-" +"zero value is given, subsequent socket operations will raise a :exc:" +"`timeout` exception if the timeout period *value* has elapsed before the " +"operation has completed. If zero is given, the socket is put in non-" "blocking mode. If ``None`` is given, the socket is put in blocking mode." msgstr "" -#: ../../library/socket.rst:1962 +#: ../../library/socket.rst:1969 msgid "" "For further information, please consult the :ref:`notes on socket timeouts " "`." msgstr "" -#: ../../library/socket.rst:1964 +#: ../../library/socket.rst:1971 msgid "" -"The method no longer toggles :const:`SOCK_NONBLOCK` flag " -"on :attr:`socket.type`." +"The method no longer toggles :const:`SOCK_NONBLOCK` flag on :attr:`socket." +"type`." msgstr "" -#: ../../library/socket.rst:1977 +#: ../../library/socket.rst:1984 msgid "" -"Set the value of the given socket option (see the Unix manual " -"page :manpage:`setsockopt(2)`). The needed symbolic constants are defined " -"in this module (:ref:`!SO_\\* etc. `). The value can " -"be an integer, ``None`` or a :term:`bytes-like object` representing a " -"buffer. In the later case it is up to the caller to ensure that the " -"bytestring contains the proper bits (see the optional built-in " -"module :mod:`struct` for a way to encode C structures as bytestrings). When " -"*value* is set to ``None``, *optlen* argument is required. It's equivalent " -"to call :c:func:`setsockopt` C function with ``optval=NULL`` and " -"``optlen=optlen``." +"Set the value of the given socket option (see the Unix manual page :manpage:" +"`setsockopt(2)`). The needed symbolic constants are defined in this module " +"(:ref:`!SO_\\* etc. `). The value can be an integer, " +"``None`` or a :term:`bytes-like object` representing a buffer. In the later " +"case it is up to the caller to ensure that the bytestring contains the " +"proper bits (see the optional built-in module :mod:`struct` for a way to " +"encode C structures as bytestrings). When *value* is set to ``None``, " +"*optlen* argument is required. It's equivalent to call :c:func:`setsockopt` " +"C function with ``optval=NULL`` and ``optlen=optlen``." msgstr "" -#: ../../library/socket.rst:1990 +#: ../../library/socket.rst:1997 msgid "setsockopt(level, optname, None, optlen: int) form added." msgstr "" -#: ../../library/socket.rst:1998 +#: ../../library/socket.rst:2005 msgid "" -"Shut down one or both halves of the connection. If *how* " -"is :const:`SHUT_RD`, further receives are disallowed. If *how* " -"is :const:`SHUT_WR`, further sends are disallowed. If *how* " -"is :const:`SHUT_RDWR`, further sends and receives are disallowed." +"Shut down one or both halves of the connection. If *how* is :const:" +"`SHUT_RD`, further receives are disallowed. If *how* is :const:`SHUT_WR`, " +"further sends are disallowed. If *how* is :const:`SHUT_RDWR`, further sends " +"and receives are disallowed." msgstr "" -#: ../../library/socket.rst:2008 +#: ../../library/socket.rst:2015 msgid "" "Duplicate a socket and prepare it for sharing with a target process. The " "target process must be provided with *process_id*. The resulting bytes " "object can then be passed to the target process using some form of " -"interprocess communication and the socket can be recreated there " -"using :func:`fromshare`. Once this method has been called, it is safe to " -"close the socket since the operating system has already duplicated it for " -"the target process." +"interprocess communication and the socket can be recreated there using :func:" +"`fromshare`. Once this method has been called, it is safe to close the " +"socket since the operating system has already duplicated it for the target " +"process." msgstr "" -#: ../../library/socket.rst:2020 +#: ../../library/socket.rst:2027 msgid "" -"Note that there are no methods :meth:`read` or :meth:`write`; " -"use :meth:`~socket.recv` and :meth:`~socket.send` without *flags* argument " -"instead." +"Note that there are no methods :meth:`read` or :meth:`write`; use :meth:" +"`~socket.recv` and :meth:`~socket.send` without *flags* argument instead." msgstr "" -#: ../../library/socket.rst:2023 +#: ../../library/socket.rst:2030 msgid "" "Socket objects also have these (read-only) attributes that correspond to the " "values given to the :class:`~socket.socket` constructor." msgstr "" -#: ../../library/socket.rst:2029 +#: ../../library/socket.rst:2036 msgid "The socket family." msgstr "" -#: ../../library/socket.rst:2034 +#: ../../library/socket.rst:2041 msgid "The socket type." msgstr "" -#: ../../library/socket.rst:2039 +#: ../../library/socket.rst:2046 msgid "The socket protocol." msgstr "" -#: ../../library/socket.rst:2046 +#: ../../library/socket.rst:2053 msgid "Notes on socket timeouts" msgstr "" -#: ../../library/socket.rst:2048 +#: ../../library/socket.rst:2055 msgid "" "A socket object can be in one of three modes: blocking, non-blocking, or " "timeout. Sockets are by default always created in blocking mode, but this " "can be changed by calling :func:`setdefaulttimeout`." msgstr "" -#: ../../library/socket.rst:2052 +#: ../../library/socket.rst:2059 msgid "" "In *blocking mode*, operations block until complete or the system returns an " "error (such as connection timed out)." msgstr "" -#: ../../library/socket.rst:2055 +#: ../../library/socket.rst:2062 msgid "" "In *non-blocking mode*, operations fail (with an error that is unfortunately " "system-dependent) if they cannot be completed immediately: functions from " @@ -2315,14 +2320,14 @@ msgid "" "available for reading or writing." msgstr "" -#: ../../library/socket.rst:2060 +#: ../../library/socket.rst:2067 msgid "" "In *timeout mode*, operations fail if they cannot be completed within the " "timeout specified for the socket (they raise a :exc:`timeout` exception) or " "if the system returns an error." msgstr "" -#: ../../library/socket.rst:2065 +#: ../../library/socket.rst:2072 msgid "" "At the operating system level, sockets in *timeout mode* are internally set " "in non-blocking mode. Also, the blocking and timeout modes are shared " @@ -2331,38 +2336,38 @@ msgid "" "you decide to use the :meth:`~socket.fileno` of a socket." msgstr "" -#: ../../library/socket.rst:2072 +#: ../../library/socket.rst:2079 msgid "Timeouts and the ``connect`` method" msgstr "" -#: ../../library/socket.rst:2074 +#: ../../library/socket.rst:2081 msgid "" "The :meth:`~socket.connect` operation is also subject to the timeout " "setting, and in general it is recommended to call :meth:`~socket.settimeout` " -"before calling :meth:`~socket.connect` or pass a timeout parameter " -"to :meth:`create_connection`. However, the system network stack may also " -"return a connection timeout error of its own regardless of any Python socket " -"timeout setting." +"before calling :meth:`~socket.connect` or pass a timeout parameter to :meth:" +"`create_connection`. However, the system network stack may also return a " +"connection timeout error of its own regardless of any Python socket timeout " +"setting." msgstr "" -#: ../../library/socket.rst:2082 +#: ../../library/socket.rst:2089 msgid "Timeouts and the ``accept`` method" msgstr "" -#: ../../library/socket.rst:2084 +#: ../../library/socket.rst:2091 msgid "" -"If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by " -"the :meth:`~socket.accept` method inherit that timeout. Otherwise, the " -"behaviour depends on settings of the listening socket:" +"If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by the :" +"meth:`~socket.accept` method inherit that timeout. Otherwise, the behaviour " +"depends on settings of the listening socket:" msgstr "" -#: ../../library/socket.rst:2088 +#: ../../library/socket.rst:2095 msgid "" "if the listening socket is in *blocking mode* or in *timeout mode*, the " "socket returned by :meth:`~socket.accept` is in *blocking mode*;" msgstr "" -#: ../../library/socket.rst:2091 +#: ../../library/socket.rst:2098 msgid "" "if the listening socket is in *non-blocking mode*, whether the socket " "returned by :meth:`~socket.accept` is in blocking or non-blocking mode is " @@ -2370,29 +2375,28 @@ msgid "" "it is recommended you manually override this setting." msgstr "" -#: ../../library/socket.rst:2100 +#: ../../library/socket.rst:2107 msgid "Example" msgstr "範例" -#: ../../library/socket.rst:2102 +#: ../../library/socket.rst:2109 msgid "" "Here are four minimal example programs using the TCP/IP protocol: a server " "that echoes all data that it receives back (servicing only one client), and " -"a client using it. Note that a server must perform the " -"sequence :func:`~socket.socket`, :meth:`~socket.bind`, :meth:`~socket.listen`, :meth:`~socket.accept` " -"(possibly repeating the :meth:`~socket.accept` to service more than one " -"client), while a client only needs the " -"sequence :func:`~socket.socket`, :meth:`~socket.connect`. Also note that " -"the server does not :meth:`~socket.sendall`/:meth:`~socket.recv` on the " -"socket it is listening on but on the new socket returned " -"by :meth:`~socket.accept`." +"a client using it. Note that a server must perform the sequence :func:" +"`~socket.socket`, :meth:`~socket.bind`, :meth:`~socket.listen`, :meth:" +"`~socket.accept` (possibly repeating the :meth:`~socket.accept` to service " +"more than one client), while a client only needs the sequence :func:`~socket." +"socket`, :meth:`~socket.connect`. Also note that the server does not :meth:" +"`~socket.sendall`/:meth:`~socket.recv` on the socket it is listening on but " +"on the new socket returned by :meth:`~socket.accept`." msgstr "" -#: ../../library/socket.rst:2112 +#: ../../library/socket.rst:2119 msgid "The first two examples support IPv4 only. ::" msgstr "前兩個範例只支援 IPv4: ::" -#: ../../library/socket.rst:2114 +#: ../../library/socket.rst:2121 msgid "" "# Echo server program\n" "import socket\n" @@ -2411,7 +2415,7 @@ msgid "" " conn.sendall(data)" msgstr "" -#: ../../library/socket.rst:2132 +#: ../../library/socket.rst:2139 msgid "" "# Echo client program\n" "import socket\n" @@ -2425,7 +2429,7 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2143 +#: ../../library/socket.rst:2150 msgid "" "The next two examples are identical to the above two, but support both IPv4 " "and IPv6. The server side will listen to the first address family available " @@ -2435,7 +2439,7 @@ msgid "" "resolution, and sends traffic to the first one connected successfully. ::" msgstr "" -#: ../../library/socket.rst:2150 +#: ../../library/socket.rst:2157 msgid "" "# Echo server program\n" "import socket\n" @@ -2472,7 +2476,7 @@ msgid "" " conn.send(data)" msgstr "" -#: ../../library/socket.rst:2186 +#: ../../library/socket.rst:2193 msgid "" "# Echo client program\n" "import socket\n" @@ -2481,8 +2485,8 @@ msgid "" "HOST = 'daring.cwi.nl' # The remote host\n" "PORT = 50007 # The same port as used by the server\n" "s = None\n" -"for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, " -"socket.SOCK_STREAM):\n" +"for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket." +"SOCK_STREAM):\n" " af, socktype, proto, canonname, sa = res\n" " try:\n" " s = socket.socket(af, socktype, proto)\n" @@ -2505,14 +2509,14 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2215 +#: ../../library/socket.rst:2222 msgid "" "The next example shows how to write a very simple network sniffer with raw " "sockets on Windows. The example requires administrator privileges to modify " "the interface::" msgstr "" -#: ../../library/socket.rst:2219 +#: ../../library/socket.rst:2226 msgid "" "import socket\n" "\n" @@ -2536,29 +2540,29 @@ msgid "" "s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)" msgstr "" -#: ../../library/socket.rst:2240 +#: ../../library/socket.rst:2247 msgid "" "The next example shows how to use the socket interface to communicate to a " "CAN network using the raw socket protocol. To use CAN with the broadcast " "manager protocol instead, open a socket with::" msgstr "" -#: ../../library/socket.rst:2244 +#: ../../library/socket.rst:2251 msgid "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" msgstr "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" -#: ../../library/socket.rst:2246 +#: ../../library/socket.rst:2253 msgid "" "After binding (:const:`CAN_RAW`) or connecting (:const:`CAN_BCM`) the " "socket, you can use the :meth:`socket.send` and :meth:`socket.recv` " "operations (and their counterparts) on the socket object as usual." msgstr "" -#: ../../library/socket.rst:2250 +#: ../../library/socket.rst:2257 msgid "This last example might require special privileges::" msgstr "" -#: ../../library/socket.rst:2252 +#: ../../library/socket.rst:2259 msgid "" "import socket\n" "import struct\n" @@ -2600,29 +2604,29 @@ msgid "" " print('Error sending CAN frame')" msgstr "" -#: ../../library/socket.rst:2290 +#: ../../library/socket.rst:2297 msgid "" "Running an example several times with too small delay between executions, " "could lead to this error::" msgstr "" -#: ../../library/socket.rst:2293 +#: ../../library/socket.rst:2300 msgid "OSError: [Errno 98] Address already in use" msgstr "OSError: [Errno 98] Address already in use" -#: ../../library/socket.rst:2295 +#: ../../library/socket.rst:2302 msgid "" "This is because the previous execution has left the socket in a " "``TIME_WAIT`` state, and can't be immediately reused." msgstr "" -#: ../../library/socket.rst:2298 +#: ../../library/socket.rst:2305 msgid "" -"There is a :mod:`socket` flag to set, in order to prevent " -"this, :const:`socket.SO_REUSEADDR`::" +"There is a :mod:`socket` flag to set, in order to prevent this, :const:" +"`socket.SO_REUSEADDR`::" msgstr "" -#: ../../library/socket.rst:2301 +#: ../../library/socket.rst:2308 msgid "" "s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" @@ -2632,30 +2636,30 @@ msgstr "" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" "s.bind((HOST, PORT))" -#: ../../library/socket.rst:2305 +#: ../../library/socket.rst:2312 msgid "" "the :data:`SO_REUSEADDR` flag tells the kernel to reuse a local socket in " "``TIME_WAIT`` state, without waiting for its natural timeout to expire." msgstr "" -#: ../../library/socket.rst:2311 +#: ../../library/socket.rst:2318 msgid "" "For an introduction to socket programming (in C), see the following papers:" msgstr "" -#: ../../library/socket.rst:2313 +#: ../../library/socket.rst:2320 msgid "" "*An Introductory 4.3BSD Interprocess Communication Tutorial*, by Stuart " "Sechrest" msgstr "" -#: ../../library/socket.rst:2315 +#: ../../library/socket.rst:2322 msgid "" "*An Advanced 4.3BSD Interprocess Communication Tutorial*, by Samuel J. " "Leffler et al," msgstr "" -#: ../../library/socket.rst:2318 +#: ../../library/socket.rst:2325 msgid "" "both in the UNIX Programmer's Manual, Supplementary Documents 1 (sections " "PS1:7 and PS1:8). The platform-specific reference material for the various " @@ -2674,18 +2678,18 @@ msgstr "object(物件)" msgid "socket" msgstr "socket" -#: ../../library/socket.rst:1623 +#: ../../library/socket.rst:1630 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/socket.rst:1623 +#: ../../library/socket.rst:1630 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/socket.rst:1975 +#: ../../library/socket.rst:1982 msgid "module" msgstr "module(模組)" -#: ../../library/socket.rst:1975 +#: ../../library/socket.rst:1982 msgid "struct" msgstr "struct" diff --git a/library/socketserver.po b/library/socketserver.po index d87251dc5d..31b914a9a2 100644 --- a/library/socketserver.po +++ b/library/socketserver.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-07 00:13+0000\n" +"POT-Creation-Date: 2025-02-09 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -90,9 +90,9 @@ msgid "" "classes, passing it the server's address and the request handler class. It " "is recommended to use the server in a :keyword:`with` statement. Then call " "the :meth:`~BaseServer.handle_request` or :meth:`~BaseServer.serve_forever` " -"method of the server object to process one or many requests. Finally, " -"call :meth:`~BaseServer.server_close` to close the socket (unless you used " -"a :keyword:`!with` statement)." +"method of the server object to process one or many requests. Finally, call :" +"meth:`~BaseServer.server_close` to close the socket (unless you used a :" +"keyword:`!with` statement)." msgstr "" #: ../../library/socketserver.rst:64 @@ -103,8 +103,8 @@ msgid "" "attribute *daemon_threads*, which indicates whether or not the server should " "wait for thread termination. You should set the flag explicitly if you " "would like threads to behave autonomously; the default is :const:`False`, " -"meaning that Python will not exit until all threads created " -"by :class:`ThreadingMixIn` have exited." +"meaning that Python will not exit until all threads created by :class:" +"`ThreadingMixIn` have exited." msgstr "" #: ../../library/socketserver.rst:73 @@ -177,9 +177,9 @@ msgstr "" #: ../../library/socketserver.rst:112 msgid "" -"The mix-in class comes first, since it overrides a method defined " -"in :class:`UDPServer`. Setting the various attributes also changes the " -"behavior of the underlying server mechanism." +"The mix-in class comes first, since it overrides a method defined in :class:" +"`UDPServer`. Setting the various attributes also changes the behavior of " +"the underlying server mechanism." msgstr "" #: ../../library/socketserver.rst:116 @@ -204,18 +204,18 @@ msgstr "" #: ../../library/socketserver.rst:131 msgid "" -"For :class:`ThreadingMixIn` use daemonic threads by " -"setting :data:`ThreadingMixIn.daemon_threads ` to ``True`` " -"to not wait until threads complete." +"For :class:`ThreadingMixIn` use daemonic threads by setting :data:" +"`ThreadingMixIn.daemon_threads ` to ``True`` to not wait " +"until threads complete." msgstr "" #: ../../library/socketserver.rst:137 msgid "" -":meth:`ForkingMixIn.server_close ` " -"and :meth:`ThreadingMixIn.server_close ` now waits " -"until all child processes and non-daemonic threads complete. Add a " -"new :attr:`ForkingMixIn.block_on_close ` class attribute to " -"opt-in for the pre-3.7 behaviour." +":meth:`ForkingMixIn.server_close ` and :meth:" +"`ThreadingMixIn.server_close ` now waits until all " +"child processes and non-daemonic threads complete. Add a new :attr:" +"`ForkingMixIn.block_on_close ` class attribute to opt-in for " +"the pre-3.7 behaviour." msgstr "" #: ../../library/socketserver.rst:153 @@ -230,13 +230,13 @@ msgstr "" #: ../../library/socketserver.rst:159 msgid "" -"To implement a service, you must derive a class " -"from :class:`BaseRequestHandler` and redefine " -"its :meth:`~BaseRequestHandler.handle` method. You can then run various " -"versions of the service by combining one of the server classes with your " -"request handler class. The request handler class must be different for " -"datagram or stream services. This can be hidden by using the handler " -"subclasses :class:`StreamRequestHandler` or :class:`DatagramRequestHandler`." +"To implement a service, you must derive a class from :class:" +"`BaseRequestHandler` and redefine its :meth:`~BaseRequestHandler.handle` " +"method. You can then run various versions of the service by combining one of " +"the server classes with your request handler class. The request handler " +"class must be different for datagram or stream services. This can be hidden " +"by using the handler subclasses :class:`StreamRequestHandler` or :class:" +"`DatagramRequestHandler`." msgstr "" #: ../../library/socketserver.rst:167 @@ -264,8 +264,8 @@ msgid "" "In some cases, it may be appropriate to process part of a request " "synchronously, but to finish processing in a forked child depending on the " "request data. This can be implemented by using a synchronous server and " -"doing an explicit fork in the request handler " -"class :meth:`~BaseRequestHandler.handle` method." +"doing an explicit fork in the request handler class :meth:" +"`~BaseRequestHandler.handle` method." msgstr "" #: ../../library/socketserver.rst:185 @@ -288,8 +288,8 @@ msgstr "" msgid "" "This is the superclass of all Server objects in the module. It defines the " "interface, given below, but does not implement most of the methods, which is " -"done in subclasses. The two parameters are stored in the " -"respective :attr:`server_address` and :attr:`RequestHandlerClass` attributes." +"done in subclasses. The two parameters are stored in the respective :attr:" +"`server_address` and :attr:`RequestHandlerClass` attributes." msgstr "" #: ../../library/socketserver.rst:210 @@ -302,13 +302,12 @@ msgstr "" #: ../../library/socketserver.rst:217 msgid "" "Process a single request. This function calls the following methods in " -"order: :meth:`get_request`, :meth:`verify_request`, " -"and :meth:`process_request`. If the user-" -"provided :meth:`~BaseRequestHandler.handle` method of the handler class " -"raises an exception, the server's :meth:`handle_error` method will be " -"called. If no request is received within :attr:`timeout` " -"seconds, :meth:`handle_timeout` will be called and :meth:`handle_request` " -"will return." +"order: :meth:`get_request`, :meth:`verify_request`, and :meth:" +"`process_request`. If the user-provided :meth:`~BaseRequestHandler.handle` " +"method of the handler class raises an exception, the server's :meth:" +"`handle_error` method will be called. If no request is received within :" +"attr:`timeout` seconds, :meth:`handle_timeout` will be called and :meth:" +"`handle_request` will return." msgstr "" #: ../../library/socketserver.rst:229 @@ -334,9 +333,9 @@ msgstr "" #: ../../library/socketserver.rst:251 msgid "" -"Tell the :meth:`serve_forever` loop to stop and wait until it " -"does. :meth:`shutdown` must be called while :meth:`serve_forever` is running " -"in a different thread otherwise it will deadlock." +"Tell the :meth:`serve_forever` loop to stop and wait until it does. :meth:" +"`shutdown` must be called while :meth:`serve_forever` is running in a " +"different thread otherwise it will deadlock." msgstr "" #: ../../library/socketserver.rst:258 @@ -345,41 +344,44 @@ msgstr "" #: ../../library/socketserver.rst:263 msgid "" -"The family of protocols to which the server's socket belongs. Common " -"examples are :const:`socket.AF_INET` and :const:`socket.AF_UNIX`." +"The family of protocols to which the server's socket belongs. Common " +"examples are :const:`socket.AF_INET`, :const:`socket.AF_INET6`, and :const:" +"`socket.AF_UNIX`. Subclass the TCP or UDP server classes in this module " +"with class attribute ``address_family = AF_INET6`` set if you want IPv6 " +"server classes." msgstr "" -#: ../../library/socketserver.rst:269 +#: ../../library/socketserver.rst:272 msgid "" "The user-provided request handler class; an instance of this class is " "created for each request." msgstr "" -#: ../../library/socketserver.rst:275 +#: ../../library/socketserver.rst:278 msgid "" "The address on which the server is listening. The format of addresses " -"varies depending on the protocol family; see the documentation for " -"the :mod:`socket` module for details. For internet protocols, this is a " -"tuple containing a string giving the address, and an integer port number: " +"varies depending on the protocol family; see the documentation for the :mod:" +"`socket` module for details. For internet protocols, this is a tuple " +"containing a string giving the address, and an integer port number: " "``('127.0.0.1', 80)``, for example." msgstr "" -#: ../../library/socketserver.rst:284 +#: ../../library/socketserver.rst:287 msgid "" "The socket object on which the server will listen for incoming requests." msgstr "" -#: ../../library/socketserver.rst:287 +#: ../../library/socketserver.rst:290 msgid "The server classes support the following class variables:" msgstr "" -#: ../../library/socketserver.rst:293 +#: ../../library/socketserver.rst:296 msgid "" -"Whether the server will allow the reuse of an address. This defaults " -"to :const:`False`, and can be set in subclasses to change the policy." +"Whether the server will allow the reuse of an address. This defaults to :" +"const:`False`, and can be set in subclasses to change the policy." msgstr "" -#: ../../library/socketserver.rst:299 +#: ../../library/socketserver.rst:302 msgid "" "The size of the request queue. If it takes a long time to process a single " "request, any requests that arrive while the server is busy are placed into a " @@ -388,40 +390,40 @@ msgid "" "default value is usually 5, but this can be overridden by subclasses." msgstr "" -#: ../../library/socketserver.rst:308 +#: ../../library/socketserver.rst:311 msgid "" -"The type of socket used by the server; :const:`socket.SOCK_STREAM` " -"and :const:`socket.SOCK_DGRAM` are two common values." +"The type of socket used by the server; :const:`socket.SOCK_STREAM` and :" +"const:`socket.SOCK_DGRAM` are two common values." msgstr "" -#: ../../library/socketserver.rst:314 +#: ../../library/socketserver.rst:317 msgid "" "Timeout duration, measured in seconds, or :const:`None` if no timeout is " "desired. If :meth:`handle_request` receives no incoming requests within the " "timeout period, the :meth:`handle_timeout` method is called." msgstr "" -#: ../../library/socketserver.rst:319 +#: ../../library/socketserver.rst:322 msgid "" "There are various server methods that can be overridden by subclasses of " "base server classes like :class:`TCPServer`; these methods aren't useful to " "external users of the server object." msgstr "" -#: ../../library/socketserver.rst:328 +#: ../../library/socketserver.rst:331 msgid "" "Actually processes the request by instantiating :attr:`RequestHandlerClass` " "and calling its :meth:`~BaseRequestHandler.handle` method." msgstr "" -#: ../../library/socketserver.rst:334 +#: ../../library/socketserver.rst:337 msgid "" "Must accept a request from the socket, and return a 2-tuple containing the " "*new* socket object to be used to communicate with the client, and the " "client's address." msgstr "" -#: ../../library/socketserver.rst:341 +#: ../../library/socketserver.rst:344 msgid "" "This function is called if the :meth:`~BaseRequestHandler.handle` method of " "a :attr:`RequestHandlerClass` instance raises an exception. The default " @@ -429,11 +431,11 @@ msgid "" "further requests." msgstr "" -#: ../../library/socketserver.rst:346 +#: ../../library/socketserver.rst:349 msgid "Now only called for exceptions derived from the :exc:`Exception` class." msgstr "" -#: ../../library/socketserver.rst:353 +#: ../../library/socketserver.rst:356 msgid "" "This function is called when the :attr:`timeout` attribute has been set to a " "value other than :const:`None` and the timeout period has passed with no " @@ -442,28 +444,28 @@ msgid "" "threading servers this method does nothing." msgstr "" -#: ../../library/socketserver.rst:362 +#: ../../library/socketserver.rst:365 msgid "" -"Calls :meth:`finish_request` to create an instance of " -"the :attr:`RequestHandlerClass`. If desired, this function can create a new " -"process or thread to handle the request; the :class:`ForkingMixIn` " -"and :class:`ThreadingMixIn` classes do this." +"Calls :meth:`finish_request` to create an instance of the :attr:" +"`RequestHandlerClass`. If desired, this function can create a new process " +"or thread to handle the request; the :class:`ForkingMixIn` and :class:" +"`ThreadingMixIn` classes do this." msgstr "" -#: ../../library/socketserver.rst:374 +#: ../../library/socketserver.rst:377 msgid "" "Called by the server's constructor to activate the server. The default " "behavior for a TCP server just invokes :meth:`~socket.socket.listen` on the " "server's socket. May be overridden." msgstr "" -#: ../../library/socketserver.rst:381 +#: ../../library/socketserver.rst:384 msgid "" "Called by the server's constructor to bind the socket to the desired " "address. May be overridden." msgstr "" -#: ../../library/socketserver.rst:387 +#: ../../library/socketserver.rst:390 msgid "" "Must return a Boolean value; if the value is :const:`True`, the request will " "be processed, and if it's :const:`False`, the request will be denied. This " @@ -471,17 +473,17 @@ msgid "" "default implementation always returns :const:`True`." msgstr "" -#: ../../library/socketserver.rst:393 +#: ../../library/socketserver.rst:396 msgid "" "Support for the :term:`context manager` protocol was added. Exiting the " "context manager is equivalent to calling :meth:`server_close`." msgstr "" -#: ../../library/socketserver.rst:399 +#: ../../library/socketserver.rst:402 msgid "Request Handler Objects" msgstr "" -#: ../../library/socketserver.rst:403 +#: ../../library/socketserver.rst:406 msgid "" "This is the superclass of all request handler objects. It defines the " "interface, given below. A concrete request handler subclass must define a " @@ -489,87 +491,87 @@ msgid "" "instance of the subclass is created for each request." msgstr "" -#: ../../library/socketserver.rst:412 +#: ../../library/socketserver.rst:415 msgid "" "Called before the :meth:`handle` method to perform any initialization " "actions required. The default implementation does nothing." msgstr "" -#: ../../library/socketserver.rst:418 +#: ../../library/socketserver.rst:421 msgid "" "This function must do all the work required to service a request. The " "default implementation does nothing. Several instance attributes are " "available to it; the request is available as :attr:`request`; the client " -"address as :attr:`client_address`; and the server instance " -"as :attr:`server`, in case it needs access to per-server information." +"address as :attr:`client_address`; and the server instance as :attr:" +"`server`, in case it needs access to per-server information." msgstr "" -#: ../../library/socketserver.rst:424 +#: ../../library/socketserver.rst:427 msgid "" "The type of :attr:`request` is different for datagram or stream services. " "For stream services, :attr:`request` is a socket object; for datagram " "services, :attr:`request` is a pair of string and socket." msgstr "" -#: ../../library/socketserver.rst:431 +#: ../../library/socketserver.rst:434 msgid "" "Called after the :meth:`handle` method to perform any clean-up actions " "required. The default implementation does nothing. If :meth:`setup` raises " "an exception, this function will not be called." msgstr "" -#: ../../library/socketserver.rst:438 +#: ../../library/socketserver.rst:441 msgid "" "The *new* :class:`socket.socket` object to be used to communicate with the " "client." msgstr "" -#: ../../library/socketserver.rst:444 +#: ../../library/socketserver.rst:447 msgid "Client address returned by :meth:`BaseServer.get_request`." msgstr "" -#: ../../library/socketserver.rst:449 +#: ../../library/socketserver.rst:452 msgid ":class:`BaseServer` object used for handling the request." msgstr "" -#: ../../library/socketserver.rst:455 +#: ../../library/socketserver.rst:458 msgid "" -"These :class:`BaseRequestHandler` subclasses override " -"the :meth:`~BaseRequestHandler.setup` and :meth:`~BaseRequestHandler.finish` " -"methods, and provide :attr:`rfile` and :attr:`wfile` attributes." +"These :class:`BaseRequestHandler` subclasses override the :meth:" +"`~BaseRequestHandler.setup` and :meth:`~BaseRequestHandler.finish` methods, " +"and provide :attr:`rfile` and :attr:`wfile` attributes." msgstr "" -#: ../../library/socketserver.rst:461 +#: ../../library/socketserver.rst:464 msgid "" -"A file object from which receives the request is read. Support " -"the :class:`io.BufferedIOBase` readable interface." +"A file object from which receives the request is read. Support the :class:" +"`io.BufferedIOBase` readable interface." msgstr "" -#: ../../library/socketserver.rst:466 +#: ../../library/socketserver.rst:469 msgid "" -"A file object to which the reply is written. Support " -"the :class:`io.BufferedIOBase` writable interface" +"A file object to which the reply is written. Support the :class:`io." +"BufferedIOBase` writable interface" msgstr "" -#: ../../library/socketserver.rst:470 +#: ../../library/socketserver.rst:473 msgid "" ":attr:`wfile` also supports the :class:`io.BufferedIOBase` writable " "interface." msgstr "" -#: ../../library/socketserver.rst:476 +#: ../../library/socketserver.rst:479 msgid "Examples" msgstr "範例" -#: ../../library/socketserver.rst:479 +#: ../../library/socketserver.rst:482 msgid ":class:`socketserver.TCPServer` Example" msgstr ":class:`socketserver.TCPServer` 範例" -#: ../../library/socketserver.rst:481 ../../library/socketserver.rst:592 +#: ../../library/socketserver.rst:484 ../../library/socketserver.rst:595 msgid "This is the server side::" msgstr "" -#: ../../library/socketserver.rst:483 +#: ../../library/socketserver.rst:486 msgid "" "import socketserver\n" "\n" @@ -606,14 +608,14 @@ msgid "" " server.serve_forever()" msgstr "" -#: ../../library/socketserver.rst:517 +#: ../../library/socketserver.rst:520 msgid "" "An alternative request handler class that makes use of streams (file-like " "objects that simplify communication by providing the standard file " "interface)::" msgstr "" -#: ../../library/socketserver.rst:520 +#: ../../library/socketserver.rst:523 msgid "" "class MyTCPHandler(socketserver.StreamRequestHandler):\n" "\n" @@ -629,7 +631,7 @@ msgid "" " self.wfile.write(self.data.upper())" msgstr "" -#: ../../library/socketserver.rst:533 +#: ../../library/socketserver.rst:536 msgid "" "The difference is that the ``readline()`` call in the second handler will " "call ``recv()`` multiple times until it encounters a newline character, " @@ -641,11 +643,11 @@ msgid "" "the number of ``recv()`` calls on the server required to receive it." msgstr "" -#: ../../library/socketserver.rst:543 ../../library/socketserver.rst:616 +#: ../../library/socketserver.rst:546 ../../library/socketserver.rst:619 msgid "This is the client side::" msgstr "" -#: ../../library/socketserver.rst:545 +#: ../../library/socketserver.rst:548 msgid "" "import socket\n" "import sys\n" @@ -667,15 +669,15 @@ msgid "" "print(\"Received:\", received)" msgstr "" -#: ../../library/socketserver.rst:565 ../../library/socketserver.rst:691 +#: ../../library/socketserver.rst:568 ../../library/socketserver.rst:694 msgid "The output of the example should look something like this:" msgstr "" -#: ../../library/socketserver.rst:567 +#: ../../library/socketserver.rst:570 msgid "Server:" msgstr "" -#: ../../library/socketserver.rst:569 +#: ../../library/socketserver.rst:572 msgid "" "$ python TCPServer.py\n" "127.0.0.1 wrote:\n" @@ -689,11 +691,11 @@ msgstr "" "127.0.0.1 wrote:\n" "b'python is nice'" -#: ../../library/socketserver.rst:577 +#: ../../library/socketserver.rst:580 msgid "Client:" msgstr "" -#: ../../library/socketserver.rst:579 +#: ../../library/socketserver.rst:582 msgid "" "$ python TCPClient.py hello world with TCP\n" "Sent: hello world with TCP\n" @@ -709,11 +711,11 @@ msgstr "" "Sent: python is nice\n" "Received: PYTHON IS NICE" -#: ../../library/socketserver.rst:590 +#: ../../library/socketserver.rst:593 msgid ":class:`socketserver.UDPServer` Example" msgstr ":class:`socketserver.UDPServer` 範例" -#: ../../library/socketserver.rst:594 +#: ../../library/socketserver.rst:597 msgid "" "import socketserver\n" "\n" @@ -738,7 +740,7 @@ msgid "" " server.serve_forever()" msgstr "" -#: ../../library/socketserver.rst:618 +#: ../../library/socketserver.rst:621 msgid "" "import socket\n" "import sys\n" @@ -758,27 +760,27 @@ msgid "" "print(\"Received:\", received)" msgstr "" -#: ../../library/socketserver.rst:635 +#: ../../library/socketserver.rst:638 msgid "" "The output of the example should look exactly like for the TCP server " "example." msgstr "" -#: ../../library/socketserver.rst:639 +#: ../../library/socketserver.rst:642 msgid "Asynchronous Mixins" msgstr "" -#: ../../library/socketserver.rst:641 +#: ../../library/socketserver.rst:644 msgid "" -"To build asynchronous handlers, use the :class:`ThreadingMixIn` " -"and :class:`ForkingMixIn` classes." +"To build asynchronous handlers, use the :class:`ThreadingMixIn` and :class:" +"`ForkingMixIn` classes." msgstr "" -#: ../../library/socketserver.rst:644 +#: ../../library/socketserver.rst:647 msgid "An example for the :class:`ThreadingMixIn` class::" msgstr "" -#: ../../library/socketserver.rst:646 +#: ../../library/socketserver.rst:649 msgid "" "import socket\n" "import threading\n" @@ -792,8 +794,8 @@ msgid "" " response = bytes(\"{}: {}\".format(cur_thread.name, data), 'ascii')\n" " self.request.sendall(response)\n" "\n" -"class ThreadedTCPServer(socketserver.ThreadingMixIn, " -"socketserver.TCPServer):\n" +"class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver." +"TCPServer):\n" " pass\n" "\n" "def client(ip, port, message):\n" @@ -826,7 +828,7 @@ msgid "" " server.shutdown()" msgstr "" -#: ../../library/socketserver.rst:693 +#: ../../library/socketserver.rst:696 msgid "" "$ python ThreadedTCPServer.py\n" "Server loop running in thread: Thread-1\n" @@ -840,7 +842,7 @@ msgstr "" "Received: Thread-3: Hello World 2\n" "Received: Thread-4: Hello World 3" -#: ../../library/socketserver.rst:702 +#: ../../library/socketserver.rst:705 msgid "" "The :class:`ForkingMixIn` class is used in the same way, except that the " "server will spawn a new process for each request. Available only on POSIX " diff --git a/library/sqlite3.po b/library/sqlite3.po index 509dad97ff..26e569c969 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-02 00:13+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -356,7 +356,7 @@ msgstr ":ref:`sqlite3-adapters`" msgid ":ref:`sqlite3-converters`" msgstr ":ref:`sqlite3-converters`" -#: ../../library/sqlite3.rst:244 ../../library/sqlite3.rst:615 +#: ../../library/sqlite3.rst:244 ../../library/sqlite3.rst:618 msgid ":ref:`sqlite3-connection-context-manager`" msgstr ":ref:`sqlite3-connection-context-manager`" @@ -407,13 +407,10 @@ msgid "" "converters registered with :func:`register_converter`. Set it to any " "combination (using ``|``, bitwise or) of :const:`PARSE_DECLTYPES` and :const:" "`PARSE_COLNAMES` to enable this. Column names takes precedence over declared " -"types if both flags are set. Types cannot be detected for generated fields " -"(for example ``max(data)``), even when the *detect_types* parameter is set; :" -"class:`str` will be returned instead. By default (``0``), type detection is " -"disabled." +"types if both flags are set. By default (``0``), type detection is disabled." msgstr "" -#: ../../library/sqlite3.rst:298 +#: ../../library/sqlite3.rst:295 msgid "" "Control legacy transaction handling behaviour. See :attr:`Connection." "isolation_level` and :ref:`sqlite3-transaction-control-isolation-level` for " @@ -423,7 +420,7 @@ msgid "" "`~sqlite3.LEGACY_TRANSACTION_CONTROL` (the default)." msgstr "" -#: ../../library/sqlite3.rst:308 +#: ../../library/sqlite3.rst:305 msgid "" "If ``True`` (default), :exc:`ProgrammingError` will be raised if the " "database connection is used by a thread other than the one that created it. " @@ -432,19 +429,19 @@ msgid "" "See :attr:`threadsafety` for more information." msgstr "" -#: ../../library/sqlite3.rst:317 +#: ../../library/sqlite3.rst:314 msgid "" "A custom subclass of :class:`Connection` to create the connection with, if " "not the default :class:`Connection` class." msgstr "" -#: ../../library/sqlite3.rst:321 +#: ../../library/sqlite3.rst:318 msgid "" "The number of statements that :mod:`!sqlite3` should internally cache for " "this connection, to avoid parsing overhead. By default, 128 statements." msgstr "" -#: ../../library/sqlite3.rst:326 +#: ../../library/sqlite3.rst:323 msgid "" "If set to ``True``, *database* is interpreted as a :abbr:`URI (Uniform " "Resource Identifier)` with a file path and an optional query string. The " @@ -453,7 +450,7 @@ msgid "" "various :ref:`sqlite3-uri-tricks`." msgstr "" -#: ../../library/sqlite3.rst:335 +#: ../../library/sqlite3.rst:332 msgid "" "Control :pep:`249` transaction handling behaviour. See :attr:`Connection." "autocommit` and :ref:`sqlite3-transaction-control-autocommit` for more " @@ -466,7 +463,7 @@ msgstr "" msgid "Return type" msgstr "" -#: ../../library/sqlite3.rst:346 +#: ../../library/sqlite3.rst:343 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect`` with argument " "``database``." @@ -474,7 +471,7 @@ msgstr "" "引發一個附帶引數 ``database`` 的\\ :ref:`稽核事件 ` ``sqlite3." "connect``。" -#: ../../library/sqlite3.rst:347 +#: ../../library/sqlite3.rst:344 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect/handle`` with " "argument ``connection_handle``." @@ -482,31 +479,31 @@ msgstr "" "引發一個附帶引數 ``connection_handle`` 的\\ :ref:`稽核事件 ` " "``sqlite3.connect/handle``。" -#: ../../library/sqlite3.rst:349 +#: ../../library/sqlite3.rst:346 msgid "Added the *uri* parameter." msgstr "新增 *uri* 參數。" -#: ../../library/sqlite3.rst:352 +#: ../../library/sqlite3.rst:349 msgid "" "*database* can now also be a :term:`path-like object`, not only a string." msgstr "" -#: ../../library/sqlite3.rst:355 +#: ../../library/sqlite3.rst:352 msgid "Added the ``sqlite3.connect/handle`` auditing event." msgstr "新增 ``sqlite3.connect/handle`` 稽核事件。" -#: ../../library/sqlite3.rst:358 +#: ../../library/sqlite3.rst:355 msgid "Added the *autocommit* parameter." msgstr "新增 *autocommit* 參數。" -#: ../../library/sqlite3.rst:361 +#: ../../library/sqlite3.rst:358 msgid "" "Positional use of the parameters *timeout*, *detect_types*, " "*isolation_level*, *check_same_thread*, *factory*, *cached_statements*, and " "*uri* is deprecated. They will become keyword-only parameters in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:369 +#: ../../library/sqlite3.rst:366 msgid "" "Return ``True`` if the string *statement* appears to contain one or more " "complete SQL statements. No syntactic verification or parsing of any kind is " @@ -514,11 +511,11 @@ msgid "" "and the statement is terminated by a semicolon." msgstr "" -#: ../../library/sqlite3.rst:375 +#: ../../library/sqlite3.rst:372 msgid "For example:" msgstr "範例:" -#: ../../library/sqlite3.rst:377 +#: ../../library/sqlite3.rst:374 msgid "" ">>> sqlite3.complete_statement(\"SELECT foo FROM bar;\")\n" "True\n" @@ -530,20 +527,20 @@ msgstr "" ">>> sqlite3.complete_statement(\"SELECT foo\")\n" "False" -#: ../../library/sqlite3.rst:384 +#: ../../library/sqlite3.rst:381 msgid "" "This function may be useful during command-line input to determine if the " "entered text seems to form a complete SQL statement, or if additional input " "is needed before calling :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:388 +#: ../../library/sqlite3.rst:385 msgid "" "See :func:`!runsource` in :source:`Lib/sqlite3/__main__.py` for real-world " "use." msgstr "" -#: ../../library/sqlite3.rst:393 +#: ../../library/sqlite3.rst:390 msgid "" "Enable or disable callback tracebacks. By default you will not get any " "tracebacks in user-defined functions, aggregates, converters, authorizer " @@ -552,14 +549,14 @@ msgid "" "on :data:`sys.stderr`. Use ``False`` to disable the feature again." msgstr "" -#: ../../library/sqlite3.rst:402 +#: ../../library/sqlite3.rst:399 msgid "" "Errors in user-defined function callbacks are logged as unraisable " "exceptions. Use an :func:`unraisable hook handler ` for " "introspection of the failed callback." msgstr "" -#: ../../library/sqlite3.rst:408 +#: ../../library/sqlite3.rst:405 msgid "" "Register an *adapter* :term:`callable` to adapt the Python type *type* into " "an SQLite type. The adapter is called with a Python object of type *type* as " @@ -567,7 +564,7 @@ msgid "" "natively understands `." msgstr "" -#: ../../library/sqlite3.rst:416 +#: ../../library/sqlite3.rst:413 msgid "" "Register the *converter* :term:`callable` to convert SQLite objects of type " "*typename* into a Python object of a specific type. The converter is invoked " @@ -577,115 +574,122 @@ msgid "" "type detection works." msgstr "" -#: ../../library/sqlite3.rst:424 +#: ../../library/sqlite3.rst:421 msgid "" "Note: *typename* and the name of the type in your query are matched case-" "insensitively." msgstr "" -#: ../../library/sqlite3.rst:431 +#: ../../library/sqlite3.rst:428 msgid "Module constants" msgstr "" -#: ../../library/sqlite3.rst:435 +#: ../../library/sqlite3.rst:432 msgid "" "Set :attr:`~Connection.autocommit` to this constant to select old style (pre-" "Python 3.12) transaction control behaviour. See :ref:`sqlite3-transaction-" "control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:441 +#: ../../library/sqlite3.rst:438 msgid "" "Pass this flag value to the *detect_types* parameter of :func:`connect` to " -"look up a converter function by using the type name, parsed from the query " -"column name, as the converter dictionary key. The type name must be wrapped " -"in square brackets (``[]``)." +"look up a converter function using the declared types for each column. The " +"types are declared when the database table is created. :mod:`!sqlite3` will " +"look up a converter function using the first word of the declared type as " +"the converter dictionary key. For example:" msgstr "" -#: ../../library/sqlite3.rst:447 +#: ../../library/sqlite3.rst:446 msgid "" -"SELECT p as \"p [point]\" FROM test; ! will look up converter \"point\"" +"CREATE TABLE test(\n" +" i integer primary key, ! will look up a converter named \"integer\"\n" +" p point, ! will look up a converter named \"point\"\n" +" n number(10) ! will look up a converter named \"number\"\n" +" )" msgstr "" -#: ../../library/sqlite3.rst:451 +#: ../../library/sqlite3.rst:454 msgid "" -"This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|`` " +"This flag may be combined with :const:`PARSE_COLNAMES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:456 +#: ../../library/sqlite3.rst:459 msgid "" -"Pass this flag value to the *detect_types* parameter of :func:`connect` to " -"look up a converter function using the declared types for each column. The " -"types are declared when the database table is created. :mod:`!sqlite3` will " -"look up a converter function using the first word of the declared type as " -"the converter dictionary key. For example:" +"Generated fields (for example ``MAX(p)``) are returned as :class:`str`. Use :" +"const:`!PARSE_COLNAMES` to enforce types for such queries." msgstr "" #: ../../library/sqlite3.rst:464 msgid "" -"CREATE TABLE test(\n" -" i integer primary key, ! will look up a converter named \"integer\"\n" -" p point, ! will look up a converter named \"point\"\n" -" n number(10) ! will look up a converter named \"number\"\n" -" )" +"Pass this flag value to the *detect_types* parameter of :func:`connect` to " +"look up a converter function by using the type name, parsed from the query " +"column name, as the converter dictionary key. The query column name must be " +"wrapped in double quotes (``\"``) and the type name must be wrapped in " +"square brackets (``[]``)." msgstr "" -#: ../../library/sqlite3.rst:472 +#: ../../library/sqlite3.rst:471 msgid "" -"This flag may be combined with :const:`PARSE_COLNAMES` using the ``|`` " +"SELECT MAX(p) as \"p [point]\" FROM test; ! will look up converter \"point\"" +msgstr "" + +#: ../../library/sqlite3.rst:475 +msgid "" +"This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:479 +#: ../../library/sqlite3.rst:482 msgid "" "Flags that should be returned by the *authorizer_callback* :term:`callable` " "passed to :meth:`Connection.set_authorizer`, to indicate whether:" msgstr "" -#: ../../library/sqlite3.rst:482 +#: ../../library/sqlite3.rst:485 msgid "Access is allowed (:const:`!SQLITE_OK`)," msgstr "" -#: ../../library/sqlite3.rst:483 +#: ../../library/sqlite3.rst:486 msgid "" "The SQL statement should be aborted with an error (:const:`!SQLITE_DENY`)" msgstr "" -#: ../../library/sqlite3.rst:484 +#: ../../library/sqlite3.rst:487 msgid "" "The column should be treated as a ``NULL`` value (:const:`!SQLITE_IGNORE`)" msgstr "" -#: ../../library/sqlite3.rst:488 +#: ../../library/sqlite3.rst:491 msgid "" "String constant stating the supported DB-API level. Required by the DB-API. " "Hard-coded to ``\"2.0\"``." msgstr "" -#: ../../library/sqlite3.rst:493 +#: ../../library/sqlite3.rst:496 msgid "" "String constant stating the type of parameter marker formatting expected by " "the :mod:`!sqlite3` module. Required by the DB-API. Hard-coded to " "``\"qmark\"``." msgstr "" -#: ../../library/sqlite3.rst:499 +#: ../../library/sqlite3.rst:502 msgid "The ``named`` DB-API parameter style is also supported." msgstr "" -#: ../../library/sqlite3.rst:503 +#: ../../library/sqlite3.rst:506 msgid "" "Version number of the runtime SQLite library as a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:507 +#: ../../library/sqlite3.rst:510 msgid "" "Version number of the runtime SQLite library as a :class:`tuple` of :class:" "`integers `." msgstr "" -#: ../../library/sqlite3.rst:512 +#: ../../library/sqlite3.rst:515 msgid "" "Integer constant required by the DB-API 2.0, stating the level of thread " "safety the :mod:`!sqlite3` module supports. This attribute is set based on " @@ -693,187 +697,187 @@ msgid "" "underlying SQLite library is compiled with. The SQLite threading modes are:" msgstr "" -#: ../../library/sqlite3.rst:517 +#: ../../library/sqlite3.rst:520 msgid "" "**Single-thread**: In this mode, all mutexes are disabled and SQLite is " "unsafe to use in more than a single thread at once." msgstr "" -#: ../../library/sqlite3.rst:519 +#: ../../library/sqlite3.rst:522 msgid "" "**Multi-thread**: In this mode, SQLite can be safely used by multiple " "threads provided that no single database connection is used simultaneously " "in two or more threads." msgstr "" -#: ../../library/sqlite3.rst:522 +#: ../../library/sqlite3.rst:525 msgid "" "**Serialized**: In serialized mode, SQLite can be safely used by multiple " "threads with no restriction." msgstr "" -#: ../../library/sqlite3.rst:525 +#: ../../library/sqlite3.rst:528 msgid "" "The mappings from SQLite threading modes to DB-API 2.0 threadsafety levels " "are as follows:" msgstr "" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:532 msgid "SQLite threading mode" msgstr "SQLite 執行緒模式" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:532 msgid ":pep:`threadsafety <0249#threadsafety>`" msgstr ":pep:`執行緒安全 <0249#threadsafety>`" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:532 msgid "`SQLITE_THREADSAFE`_" msgstr "`SQLITE_THREADSAFE`_" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:532 msgid "DB-API 2.0 meaning" msgstr "" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:535 msgid "single-thread" msgstr "" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:535 msgid "0" msgstr "0" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:535 msgid "Threads may not share the module" msgstr "" -#: ../../library/sqlite3.rst:535 +#: ../../library/sqlite3.rst:538 msgid "multi-thread" msgstr "" -#: ../../library/sqlite3.rst:535 ../../library/sqlite3.rst:538 +#: ../../library/sqlite3.rst:538 ../../library/sqlite3.rst:541 msgid "1" msgstr "1" -#: ../../library/sqlite3.rst:535 +#: ../../library/sqlite3.rst:538 msgid "2" msgstr "2" -#: ../../library/sqlite3.rst:535 +#: ../../library/sqlite3.rst:538 msgid "Threads may share the module, but not connections" msgstr "" -#: ../../library/sqlite3.rst:538 +#: ../../library/sqlite3.rst:541 msgid "serialized" msgstr "" -#: ../../library/sqlite3.rst:538 +#: ../../library/sqlite3.rst:541 msgid "3" msgstr "3" -#: ../../library/sqlite3.rst:538 +#: ../../library/sqlite3.rst:541 msgid "Threads may share the module, connections and cursors" msgstr "" -#: ../../library/sqlite3.rst:544 +#: ../../library/sqlite3.rst:547 msgid "Set *threadsafety* dynamically instead of hard-coding it to ``1``." msgstr "" -#: ../../library/sqlite3.rst:549 +#: ../../library/sqlite3.rst:552 msgid "" "Version number of this module as a :class:`string `. This is not the " "version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:552 ../../library/sqlite3.rst:562 +#: ../../library/sqlite3.rst:555 ../../library/sqlite3.rst:565 msgid "" "This constant used to reflect the version number of the ``pysqlite`` " "package, a third-party library which used to upstream changes to :mod:`!" "sqlite3`. Today, it carries no meaning or practical value." msgstr "" -#: ../../library/sqlite3.rst:559 +#: ../../library/sqlite3.rst:562 msgid "" "Version number of this module as a :class:`tuple` of :class:`integers " "`. This is not the version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:586 +#: ../../library/sqlite3.rst:589 msgid "" "These constants are used for the :meth:`Connection.setconfig` and :meth:" "`~Connection.getconfig` methods." msgstr "" -#: ../../library/sqlite3.rst:589 +#: ../../library/sqlite3.rst:592 msgid "" "The availability of these constants varies depending on the version of " "SQLite Python was compiled with." msgstr "" -#: ../../library/sqlite3.rst:596 +#: ../../library/sqlite3.rst:599 msgid "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" msgstr "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" -#: ../../library/sqlite3.rst:597 +#: ../../library/sqlite3.rst:600 msgid "SQLite docs: Database Connection Configuration Options" msgstr "" -#: ../../library/sqlite3.rst:603 +#: ../../library/sqlite3.rst:606 msgid "Connection objects" msgstr "Connection 物件" -#: ../../library/sqlite3.rst:607 +#: ../../library/sqlite3.rst:610 msgid "" "Each open SQLite database is represented by a ``Connection`` object, which " "is created using :func:`sqlite3.connect`. Their main purpose is creating :" "class:`Cursor` objects, and :ref:`sqlite3-controlling-transactions`." msgstr "" -#: ../../library/sqlite3.rst:614 +#: ../../library/sqlite3.rst:617 msgid ":ref:`sqlite3-connection-shortcuts`" msgstr ":ref:`sqlite3-connection-shortcuts`" -#: ../../library/sqlite3.rst:620 +#: ../../library/sqlite3.rst:623 msgid "" "A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before a :" "class:`!Connection` object is deleted." msgstr "" -#: ../../library/sqlite3.rst:623 +#: ../../library/sqlite3.rst:626 msgid "An SQLite database connection has the following attributes and methods:" msgstr "" -#: ../../library/sqlite3.rst:627 +#: ../../library/sqlite3.rst:630 msgid "" "Create and return a :class:`Cursor` object. The cursor method accepts a " "single optional parameter *factory*. If supplied, this must be a :term:" "`callable` returning an instance of :class:`Cursor` or its subclasses." msgstr "" -#: ../../library/sqlite3.rst:634 +#: ../../library/sqlite3.rst:637 msgid "" "Open a :class:`Blob` handle to an existing :abbr:`BLOB (Binary Large " "OBject)`." msgstr "" -#: ../../library/sqlite3.rst:637 +#: ../../library/sqlite3.rst:640 msgid "The name of the table where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:640 +#: ../../library/sqlite3.rst:643 msgid "The name of the column where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:643 +#: ../../library/sqlite3.rst:646 msgid "The name of the row where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:646 +#: ../../library/sqlite3.rst:649 msgid "" "Set to ``True`` if the blob should be opened without write permissions. " "Defaults to ``False``." msgstr "" -#: ../../library/sqlite3.rst:651 +#: ../../library/sqlite3.rst:654 msgid "" "The name of the database where the blob is located. Defaults to ``\"main\"``." msgstr "" @@ -882,17 +886,17 @@ msgstr "" msgid "Raises" msgstr "" -#: ../../library/sqlite3.rst:655 +#: ../../library/sqlite3.rst:658 msgid "When trying to open a blob in a ``WITHOUT ROWID`` table." msgstr "" -#: ../../library/sqlite3.rst:662 +#: ../../library/sqlite3.rst:665 msgid "" "The blob size cannot be changed using the :class:`Blob` class. Use the SQL " "function ``zeroblob`` to create a blob with a fixed size." msgstr "" -#: ../../library/sqlite3.rst:669 +#: ../../library/sqlite3.rst:672 msgid "" "Commit any pending transaction to the database. If :attr:`autocommit` is " "``True``, or there is no open transaction, this method does nothing. If :" @@ -900,7 +904,7 @@ msgid "" "pending transaction was committed by this method." msgstr "" -#: ../../library/sqlite3.rst:677 +#: ../../library/sqlite3.rst:680 msgid "" "Roll back to the start of any pending transaction. If :attr:`autocommit` is " "``True``, or there is no open transaction, this method does nothing. If :" @@ -908,7 +912,7 @@ msgid "" "pending transaction was rolled back by this method." msgstr "" -#: ../../library/sqlite3.rst:685 +#: ../../library/sqlite3.rst:688 msgid "" "Close the database connection. If :attr:`autocommit` is ``False``, any " "pending transaction is implicitly rolled back. If :attr:`!autocommit` is " @@ -917,63 +921,63 @@ msgid "" "losing pending changes." msgstr "" -#: ../../library/sqlite3.rst:695 +#: ../../library/sqlite3.rst:698 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.execute` on it " "with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:701 +#: ../../library/sqlite3.rst:704 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executemany` on " "it with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:707 +#: ../../library/sqlite3.rst:710 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executescript` " "on it with the given *sql_script*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:713 +#: ../../library/sqlite3.rst:716 msgid "Create or remove a user-defined SQL function." msgstr "" -#: ../../library/sqlite3.rst:715 +#: ../../library/sqlite3.rst:718 msgid "The name of the SQL function." msgstr "" -#: ../../library/sqlite3.rst:718 +#: ../../library/sqlite3.rst:721 msgid "" "The number of arguments the SQL function can accept. If ``-1``, it may take " "any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:722 +#: ../../library/sqlite3.rst:725 msgid "" "A :term:`callable` that is called when the SQL function is invoked. The " "callable must return :ref:`a type natively supported by SQLite `. Set to ``None`` to remove an existing SQL function." msgstr "" -#: ../../library/sqlite3.rst:729 +#: ../../library/sqlite3.rst:732 msgid "" "If ``True``, the created SQL function is marked as `deterministic `_, which allows SQLite to perform additional " "optimizations." msgstr "" -#: ../../library/sqlite3.rst:734 +#: ../../library/sqlite3.rst:737 msgid "Added the *deterministic* parameter." msgstr "新增 *deterministic* 參數。" -#: ../../library/sqlite3.rst:737 ../../library/sqlite3.rst:781 -#: ../../library/sqlite3.rst:849 ../../library/sqlite3.rst:1128 -#: ../../library/sqlite3.rst:1550 ../../library/sqlite3.rst:1593 +#: ../../library/sqlite3.rst:740 ../../library/sqlite3.rst:784 +#: ../../library/sqlite3.rst:852 ../../library/sqlite3.rst:1131 +#: ../../library/sqlite3.rst:1553 ../../library/sqlite3.rst:1596 msgid "Example:" msgstr "範例:" -#: ../../library/sqlite3.rst:739 +#: ../../library/sqlite3.rst:742 msgid "" ">>> import hashlib\n" ">>> def md5sum(t):\n" @@ -995,27 +999,27 @@ msgstr "" "('acbd18db4cc2f85cedef654fccc4a4d8',)\n" ">>> con.close()" -#: ../../library/sqlite3.rst:753 +#: ../../library/sqlite3.rst:756 msgid "" "Passing *name*, *narg*, and *func* as keyword arguments is deprecated. These " "parameters will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:759 +#: ../../library/sqlite3.rst:762 msgid "Create or remove a user-defined SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:761 +#: ../../library/sqlite3.rst:764 msgid "The name of the SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:764 +#: ../../library/sqlite3.rst:767 msgid "" "The number of arguments the SQL aggregate function can accept. If ``-1``, it " "may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:768 +#: ../../library/sqlite3.rst:771 msgid "" "A class must implement the following methods: * ``step()``: Add a row to " "the aggregate. * ``finalize()``: Return the final result of the aggregate " @@ -1024,31 +1028,31 @@ msgid "" "*n_arg*. Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:769 +#: ../../library/sqlite3.rst:772 msgid "A class must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:771 +#: ../../library/sqlite3.rst:774 msgid "``step()``: Add a row to the aggregate." msgstr "" -#: ../../library/sqlite3.rst:772 ../../library/sqlite3.rst:833 +#: ../../library/sqlite3.rst:775 ../../library/sqlite3.rst:836 msgid "" "``finalize()``: Return the final result of the aggregate as :ref:`a type " "natively supported by SQLite `." msgstr "" -#: ../../library/sqlite3.rst:775 +#: ../../library/sqlite3.rst:778 msgid "" "The number of arguments that the ``step()`` method must accept is controlled " "by *n_arg*." msgstr "" -#: ../../library/sqlite3.rst:778 +#: ../../library/sqlite3.rst:781 msgid "Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:783 +#: ../../library/sqlite3.rst:786 msgid "" "class MySum:\n" " def __init__(self):\n" @@ -1090,27 +1094,27 @@ msgstr "" "\n" "con.close()" -#: ../../library/sqlite3.rst:812 +#: ../../library/sqlite3.rst:815 msgid "" "Passing *name*, *n_arg*, and *aggregate_class* as keyword arguments is " "deprecated. These parameters will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:818 +#: ../../library/sqlite3.rst:821 msgid "Create or remove a user-defined aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:820 +#: ../../library/sqlite3.rst:823 msgid "The name of the SQL aggregate window function to create or remove." msgstr "" -#: ../../library/sqlite3.rst:823 +#: ../../library/sqlite3.rst:826 msgid "" "The number of arguments the SQL aggregate window function can accept. If " "``-1``, it may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:827 +#: ../../library/sqlite3.rst:830 msgid "" "A class that must implement the following methods: * ``step()``: Add a row " "to the current window. * ``value()``: Return the current value of the " @@ -1122,39 +1126,39 @@ msgid "" "function." msgstr "" -#: ../../library/sqlite3.rst:828 +#: ../../library/sqlite3.rst:831 msgid "A class that must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:830 +#: ../../library/sqlite3.rst:833 msgid "``step()``: Add a row to the current window." msgstr "" -#: ../../library/sqlite3.rst:831 +#: ../../library/sqlite3.rst:834 msgid "``value()``: Return the current value of the aggregate." msgstr "" -#: ../../library/sqlite3.rst:832 +#: ../../library/sqlite3.rst:835 msgid "``inverse()``: Remove a row from the current window." msgstr "" -#: ../../library/sqlite3.rst:836 +#: ../../library/sqlite3.rst:839 msgid "" "The number of arguments that the ``step()`` and ``value()`` methods must " "accept is controlled by *num_params*." msgstr "" -#: ../../library/sqlite3.rst:839 +#: ../../library/sqlite3.rst:842 msgid "Set to ``None`` to remove an existing SQL aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:841 +#: ../../library/sqlite3.rst:844 msgid "" "If used with a version of SQLite older than 3.25.0, which does not support " "aggregate window functions." msgstr "" -#: ../../library/sqlite3.rst:851 +#: ../../library/sqlite3.rst:854 msgid "" "# Example taken from https://www.sqlite.org/windowfunctions.html#udfwinfunc\n" "class WindowSumInt:\n" @@ -1202,30 +1206,30 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:905 +#: ../../library/sqlite3.rst:908 msgid "" "Create a collation named *name* using the collating function *callable*. " "*callable* is passed two :class:`string ` arguments, and it should " "return an :class:`integer `:" msgstr "" -#: ../../library/sqlite3.rst:909 +#: ../../library/sqlite3.rst:912 msgid "``1`` if the first is ordered higher than the second" msgstr "" -#: ../../library/sqlite3.rst:910 +#: ../../library/sqlite3.rst:913 msgid "``-1`` if the first is ordered lower than the second" msgstr "" -#: ../../library/sqlite3.rst:911 +#: ../../library/sqlite3.rst:914 msgid "``0`` if they are ordered equal" msgstr "" -#: ../../library/sqlite3.rst:913 +#: ../../library/sqlite3.rst:916 msgid "The following example shows a reverse sorting collation:" msgstr "" -#: ../../library/sqlite3.rst:915 +#: ../../library/sqlite3.rst:918 msgid "" "def collate_reverse(string1, string2):\n" " if string1 == string2:\n" @@ -1263,24 +1267,24 @@ msgstr "" " print(row)\n" "con.close()" -#: ../../library/sqlite3.rst:941 +#: ../../library/sqlite3.rst:944 msgid "Remove a collation function by setting *callable* to ``None``." msgstr "" -#: ../../library/sqlite3.rst:943 +#: ../../library/sqlite3.rst:946 msgid "" "The collation name can contain any Unicode character. Earlier, only ASCII " "characters were allowed." msgstr "" -#: ../../library/sqlite3.rst:950 +#: ../../library/sqlite3.rst:953 msgid "" "Call this method from a different thread to abort any queries that might be " "executing on the connection. Aborted queries will raise an :exc:" "`OperationalError`." msgstr "" -#: ../../library/sqlite3.rst:957 +#: ../../library/sqlite3.rst:960 msgid "" "Register :term:`callable` *authorizer_callback* to be invoked for each " "attempt to access a column of a table in the database. The callback should " @@ -1289,7 +1293,7 @@ msgid "" "underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:964 +#: ../../library/sqlite3.rst:967 msgid "" "The first argument to the callback signifies what kind of operation is to be " "authorized. The second and third argument will be arguments or ``None`` " @@ -1299,7 +1303,7 @@ msgid "" "attempt or ``None`` if this access attempt is directly from input SQL code." msgstr "" -#: ../../library/sqlite3.rst:971 +#: ../../library/sqlite3.rst:974 msgid "" "Please consult the SQLite documentation about the possible values for the " "first argument and the meaning of the second and third argument depending on " @@ -1307,21 +1311,21 @@ msgid "" "module." msgstr "" -#: ../../library/sqlite3.rst:975 +#: ../../library/sqlite3.rst:978 msgid "Passing ``None`` as *authorizer_callback* will disable the authorizer." msgstr "" -#: ../../library/sqlite3.rst:977 +#: ../../library/sqlite3.rst:980 msgid "Added support for disabling the authorizer using ``None``." msgstr "" -#: ../../library/sqlite3.rst:980 +#: ../../library/sqlite3.rst:983 msgid "" "Passing *authorizer_callback* as a keyword argument is deprecated. The " "parameter will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:987 +#: ../../library/sqlite3.rst:990 msgid "" "Register :term:`callable` *progress_handler* to be invoked for every *n* " "instructions of the SQLite virtual machine. This is useful if you want to " @@ -1329,32 +1333,32 @@ msgid "" "a GUI." msgstr "" -#: ../../library/sqlite3.rst:992 +#: ../../library/sqlite3.rst:995 msgid "" "If you want to clear any previously installed progress handler, call the " "method with ``None`` for *progress_handler*." msgstr "" -#: ../../library/sqlite3.rst:995 +#: ../../library/sqlite3.rst:998 msgid "" "Returning a non-zero value from the handler function will terminate the " "currently executing query and cause it to raise a :exc:`DatabaseError` " "exception." msgstr "" -#: ../../library/sqlite3.rst:999 +#: ../../library/sqlite3.rst:1002 msgid "" "Passing *progress_handler* as a keyword argument is deprecated. The " "parameter will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:1006 +#: ../../library/sqlite3.rst:1009 msgid "" "Register :term:`callable` *trace_callback* to be invoked for each SQL " "statement that is actually executed by the SQLite backend." msgstr "" -#: ../../library/sqlite3.rst:1009 +#: ../../library/sqlite3.rst:1012 msgid "" "The only argument passed to the callback is the statement (as :class:`str`) " "that is being executed. The return value of the callback is ignored. Note " @@ -1364,24 +1368,24 @@ msgid "" "execution of triggers defined in the current database." msgstr "" -#: ../../library/sqlite3.rst:1017 +#: ../../library/sqlite3.rst:1020 msgid "Passing ``None`` as *trace_callback* will disable the trace callback." msgstr "" -#: ../../library/sqlite3.rst:1020 +#: ../../library/sqlite3.rst:1023 msgid "" "Exceptions raised in the trace callback are not propagated. As a development " "and debugging aid, use :meth:`~sqlite3.enable_callback_tracebacks` to enable " "printing tracebacks from exceptions raised in the trace callback." msgstr "" -#: ../../library/sqlite3.rst:1027 +#: ../../library/sqlite3.rst:1030 msgid "" "Passing *trace_callback* as a keyword argument is deprecated. The parameter " "will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:1034 +#: ../../library/sqlite3.rst:1037 msgid "" "Enable the SQLite engine to load SQLite extensions from shared libraries if " "*enabled* is ``True``; else, disallow loading SQLite extensions. SQLite " @@ -1390,7 +1394,7 @@ msgid "" "distributed with SQLite." msgstr "" -#: ../../library/sqlite3.rst:1043 +#: ../../library/sqlite3.rst:1046 msgid "" "The :mod:`!sqlite3` module is not built with loadable extension support by " "default, because some platforms (notably macOS) have SQLite libraries which " @@ -1399,7 +1403,7 @@ msgid "" "program:`configure`." msgstr "" -#: ../../library/sqlite3.rst:1050 +#: ../../library/sqlite3.rst:1053 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." @@ -1407,11 +1411,11 @@ msgstr "" "引發一個附帶引數 ``connection``、``enabled`` 的\\ :ref:`稽核事件 ` " "``sqlite3.enable_load_extension``。" -#: ../../library/sqlite3.rst:1054 +#: ../../library/sqlite3.rst:1057 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "加入 ``sqlite3.enable_load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1060 +#: ../../library/sqlite3.rst:1063 msgid "" "con.enable_load_extension(True)\n" "\n" @@ -1441,24 +1445,24 @@ msgid "" " print(row)" msgstr "" -#: ../../library/sqlite3.rst:1086 +#: ../../library/sqlite3.rst:1089 msgid "" "Load an SQLite extension from a shared library. Enable extension loading " "with :meth:`enable_load_extension` before calling this method." msgstr "" -#: ../../library/sqlite3.rst:1090 +#: ../../library/sqlite3.rst:1093 msgid "The path to the SQLite extension." msgstr "" -#: ../../library/sqlite3.rst:1094 +#: ../../library/sqlite3.rst:1097 msgid "" "Entry point name. If ``None`` (the default), SQLite will come up with an " "entry point name of its own; see the SQLite docs `Loading an Extension`_ for " "details." msgstr "" -#: ../../library/sqlite3.rst:1103 +#: ../../library/sqlite3.rst:1106 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." @@ -1466,29 +1470,29 @@ msgstr "" "引發一個附帶引數 ``connection``、``path`` 的\\ :ref:`稽核事件 ` " "``sqlite3.load_extension``。" -#: ../../library/sqlite3.rst:1107 +#: ../../library/sqlite3.rst:1110 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "加入 ``sqlite3.load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1110 +#: ../../library/sqlite3.rst:1113 msgid "Added the *entrypoint* parameter." msgstr "新增 *entrypoint* 參數。" -#: ../../library/sqlite3.rst:1117 +#: ../../library/sqlite3.rst:1120 msgid "" "Return an :term:`iterator` to dump the database as SQL source code. Useful " "when saving an in-memory database for later restoration. Similar to the ``." "dump`` command in the :program:`sqlite3` shell." msgstr "" -#: ../../library/sqlite3.rst:1121 +#: ../../library/sqlite3.rst:1124 msgid "" "An optional ``LIKE`` pattern for database objects to dump, e.g. " "``prefix_%``. If ``None`` (the default), all database objects will be " "included." msgstr "" -#: ../../library/sqlite3.rst:1130 +#: ../../library/sqlite3.rst:1133 msgid "" "# Convert file example.db to SQL dump file dump.sql\n" "con = sqlite3.connect('example.db')\n" @@ -1498,35 +1502,35 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1141 ../../library/sqlite3.rst:1215 +#: ../../library/sqlite3.rst:1144 ../../library/sqlite3.rst:1218 msgid ":ref:`sqlite3-howto-encoding`" msgstr ":ref:`sqlite3-howto-encoding`" -#: ../../library/sqlite3.rst:1143 +#: ../../library/sqlite3.rst:1146 msgid "Added the *filter* parameter." msgstr "新增 *filter* 參數。" -#: ../../library/sqlite3.rst:1148 +#: ../../library/sqlite3.rst:1151 msgid "Create a backup of an SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1150 +#: ../../library/sqlite3.rst:1153 msgid "" "Works even if the database is being accessed by other clients or " "concurrently by the same connection." msgstr "" -#: ../../library/sqlite3.rst:1153 +#: ../../library/sqlite3.rst:1156 msgid "The database connection to save the backup to." msgstr "" -#: ../../library/sqlite3.rst:1156 +#: ../../library/sqlite3.rst:1159 msgid "" "The number of pages to copy at a time. If equal to or less than ``0``, the " "entire database is copied in a single step. Defaults to ``-1``." msgstr "" -#: ../../library/sqlite3.rst:1162 +#: ../../library/sqlite3.rst:1165 msgid "" "If set to a :term:`callable`, it is invoked with three integer arguments for " "every backup iteration: the *status* of the last iteration, the *remaining* " @@ -1534,24 +1538,24 @@ msgid "" "Defaults to ``None``." msgstr "" -#: ../../library/sqlite3.rst:1171 +#: ../../library/sqlite3.rst:1174 msgid "" "The name of the database to back up. Either ``\"main\"`` (the default) for " "the main database, ``\"temp\"`` for the temporary database, or the name of a " "custom database as attached using the ``ATTACH DATABASE`` SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1178 +#: ../../library/sqlite3.rst:1181 msgid "" "The number of seconds to sleep between successive attempts to back up " "remaining pages." msgstr "" -#: ../../library/sqlite3.rst:1182 +#: ../../library/sqlite3.rst:1185 msgid "Example 1, copy an existing database into another:" msgstr "" -#: ../../library/sqlite3.rst:1184 +#: ../../library/sqlite3.rst:1187 msgid "" "def progress(status, remaining, total):\n" " print(f'Copied {total-remaining} of {total} pages...')\n" @@ -1573,11 +1577,11 @@ msgstr "" "dst.close()\n" "src.close()" -#: ../../library/sqlite3.rst:1201 +#: ../../library/sqlite3.rst:1204 msgid "Example 2, copy an existing database into a transient copy:" msgstr "" -#: ../../library/sqlite3.rst:1203 +#: ../../library/sqlite3.rst:1206 msgid "" "src = sqlite3.connect('example.db')\n" "dst = sqlite3.connect(':memory:')\n" @@ -1591,25 +1595,25 @@ msgstr "" "dst.close()\n" "src.close()" -#: ../../library/sqlite3.rst:1219 +#: ../../library/sqlite3.rst:1222 msgid "Get a connection runtime limit." msgstr "" -#: ../../library/sqlite3.rst:1221 +#: ../../library/sqlite3.rst:1224 msgid "The `SQLite limit category`_ to be queried." msgstr "" -#: ../../library/sqlite3.rst:1226 ../../library/sqlite3.rst:1263 +#: ../../library/sqlite3.rst:1229 ../../library/sqlite3.rst:1266 msgid "If *category* is not recognised by the underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:1229 +#: ../../library/sqlite3.rst:1232 msgid "" "Example, query the maximum length of an SQL statement for :class:" "`Connection` ``con`` (the default is 1000000000):" msgstr "" -#: ../../library/sqlite3.rst:1239 +#: ../../library/sqlite3.rst:1242 msgid "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" "1000000000" @@ -1617,7 +1621,7 @@ msgstr "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" "1000000000" -#: ../../library/sqlite3.rst:1249 +#: ../../library/sqlite3.rst:1252 msgid "" "Set a connection runtime limit. Attempts to increase a limit above its hard " "upper bound are silently truncated to the hard upper bound. Regardless of " @@ -1625,22 +1629,22 @@ msgid "" "returned." msgstr "" -#: ../../library/sqlite3.rst:1254 +#: ../../library/sqlite3.rst:1257 msgid "The `SQLite limit category`_ to be set." msgstr "" -#: ../../library/sqlite3.rst:1257 +#: ../../library/sqlite3.rst:1260 msgid "" "The value of the new limit. If negative, the current limit is unchanged." msgstr "" -#: ../../library/sqlite3.rst:1266 +#: ../../library/sqlite3.rst:1269 msgid "" "Example, limit the number of attached databases to 1 for :class:`Connection` " "``con`` (the default limit is 10):" msgstr "" -#: ../../library/sqlite3.rst:1269 +#: ../../library/sqlite3.rst:1272 msgid "" ">>> con.setlimit(sqlite3.SQLITE_LIMIT_ATTACHED, 1)\n" "10\n" @@ -1652,25 +1656,25 @@ msgstr "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_ATTACHED)\n" "1" -#: ../../library/sqlite3.rst:1287 +#: ../../library/sqlite3.rst:1290 msgid "Query a boolean connection configuration option." msgstr "" -#: ../../library/sqlite3.rst:1289 ../../library/sqlite3.rst:1300 +#: ../../library/sqlite3.rst:1292 ../../library/sqlite3.rst:1303 msgid "A :ref:`SQLITE_DBCONFIG code `." msgstr "" -#: ../../library/sqlite3.rst:1298 +#: ../../library/sqlite3.rst:1301 msgid "Set a boolean connection configuration option." msgstr "" -#: ../../library/sqlite3.rst:1303 +#: ../../library/sqlite3.rst:1306 msgid "" "``True`` if the configuration option should be enabled (default); ``False`` " "if it should be disabled." msgstr "" -#: ../../library/sqlite3.rst:1311 +#: ../../library/sqlite3.rst:1314 msgid "" "Serialize a database into a :class:`bytes` object. For an ordinary on-disk " "database file, the serialization is just a copy of the disk file. For an in-" @@ -1679,17 +1683,17 @@ msgid "" "backed up to disk." msgstr "" -#: ../../library/sqlite3.rst:1317 +#: ../../library/sqlite3.rst:1320 msgid "The database name to be serialized. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1325 +#: ../../library/sqlite3.rst:1328 msgid "" "This method is only available if the underlying SQLite library has the " "serialize API." msgstr "" -#: ../../library/sqlite3.rst:1333 +#: ../../library/sqlite3.rst:1336 msgid "" "Deserialize a :meth:`serialized ` database into a :class:" "`Connection`. This method causes the database connection to disconnect from " @@ -1697,96 +1701,96 @@ msgid "" "serialization contained in *data*." msgstr "" -#: ../../library/sqlite3.rst:1339 +#: ../../library/sqlite3.rst:1342 msgid "A serialized database." msgstr "" -#: ../../library/sqlite3.rst:1342 +#: ../../library/sqlite3.rst:1345 msgid "The database name to deserialize into. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1346 +#: ../../library/sqlite3.rst:1349 msgid "" "If the database connection is currently involved in a read transaction or a " "backup operation." msgstr "" -#: ../../library/sqlite3.rst:1350 +#: ../../library/sqlite3.rst:1353 msgid "If *data* does not contain a valid SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1353 +#: ../../library/sqlite3.rst:1356 msgid "If :func:`len(data) ` is larger than ``2**63 - 1``." msgstr "" -#: ../../library/sqlite3.rst:1358 +#: ../../library/sqlite3.rst:1361 msgid "" "This method is only available if the underlying SQLite library has the " "deserialize API." msgstr "" -#: ../../library/sqlite3.rst:1365 +#: ../../library/sqlite3.rst:1368 msgid "" "This attribute controls :pep:`249`-compliant transaction behaviour. :attr:`!" "autocommit` has three allowed values:" msgstr "" -#: ../../library/sqlite3.rst:1368 +#: ../../library/sqlite3.rst:1371 msgid "" "``False``: Select :pep:`249`-compliant transaction behaviour, implying that :" "mod:`!sqlite3` ensures a transaction is always open. Use :meth:`commit` and :" "meth:`rollback` to close transactions." msgstr "" -#: ../../library/sqlite3.rst:1372 +#: ../../library/sqlite3.rst:1375 msgid "This is the recommended value of :attr:`!autocommit`." msgstr "" -#: ../../library/sqlite3.rst:1374 +#: ../../library/sqlite3.rst:1377 msgid "" "``True``: Use SQLite's `autocommit mode`_. :meth:`commit` and :meth:" "`rollback` have no effect in this mode." msgstr "" -#: ../../library/sqlite3.rst:1377 +#: ../../library/sqlite3.rst:1380 msgid "" ":data:`LEGACY_TRANSACTION_CONTROL`: Pre-Python 3.12 (non-:pep:`249`-" "compliant) transaction control. See :attr:`isolation_level` for more details." msgstr "" -#: ../../library/sqlite3.rst:1381 +#: ../../library/sqlite3.rst:1384 msgid "This is currently the default value of :attr:`!autocommit`." msgstr "" -#: ../../library/sqlite3.rst:1383 +#: ../../library/sqlite3.rst:1386 msgid "" "Changing :attr:`!autocommit` to ``False`` will open a new transaction, and " "changing it to ``True`` will commit any pending transaction." msgstr "" -#: ../../library/sqlite3.rst:1386 +#: ../../library/sqlite3.rst:1389 msgid "See :ref:`sqlite3-transaction-control-autocommit` for more details." msgstr "更多詳情請見 :ref:`sqlite3-transaction-control-autocommit`。" -#: ../../library/sqlite3.rst:1390 +#: ../../library/sqlite3.rst:1393 msgid "" "The :attr:`isolation_level` attribute has no effect unless :attr:" "`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." msgstr "" -#: ../../library/sqlite3.rst:1397 +#: ../../library/sqlite3.rst:1400 msgid "" "This read-only attribute corresponds to the low-level SQLite `autocommit " "mode`_." msgstr "" -#: ../../library/sqlite3.rst:1400 +#: ../../library/sqlite3.rst:1403 msgid "" "``True`` if a transaction is active (there are uncommitted changes), " "``False`` otherwise." msgstr "" -#: ../../library/sqlite3.rst:1407 +#: ../../library/sqlite3.rst:1410 msgid "" "Controls the :ref:`legacy transaction handling mode ` of :mod:`!sqlite3`. If set to ``None``, " @@ -1796,13 +1800,13 @@ msgid "" "` is performed." msgstr "" -#: ../../library/sqlite3.rst:1415 +#: ../../library/sqlite3.rst:1418 msgid "" "If not overridden by the *isolation_level* parameter of :func:`connect`, the " "default is ``\"\"``, which is an alias for ``\"DEFERRED\"``." msgstr "" -#: ../../library/sqlite3.rst:1420 +#: ../../library/sqlite3.rst:1423 msgid "" "Using :attr:`autocommit` to control transaction handling is recommended over " "using :attr:`!isolation_level`. :attr:`!isolation_level` has no effect " @@ -1810,7 +1814,7 @@ msgid "" "default)." msgstr "" -#: ../../library/sqlite3.rst:1427 +#: ../../library/sqlite3.rst:1430 msgid "" "The initial :attr:`~Cursor.row_factory` for :class:`Cursor` objects created " "from this connection. Assigning to this attribute does not affect the :attr:" @@ -1819,33 +1823,33 @@ msgid "" "`tuple`." msgstr "" -#: ../../library/sqlite3.rst:1434 ../../library/sqlite3.rst:1720 -#: ../../library/sqlite3.rst:1743 +#: ../../library/sqlite3.rst:1437 ../../library/sqlite3.rst:1723 +#: ../../library/sqlite3.rst:1746 msgid "See :ref:`sqlite3-howto-row-factory` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-row-factory`。" -#: ../../library/sqlite3.rst:1438 +#: ../../library/sqlite3.rst:1441 msgid "" "A :term:`callable` that accepts a :class:`bytes` parameter and returns a " "text representation of it. The callable is invoked for SQLite values with " "the ``TEXT`` data type. By default, this attribute is set to :class:`str`." msgstr "" -#: ../../library/sqlite3.rst:1443 +#: ../../library/sqlite3.rst:1446 msgid "See :ref:`sqlite3-howto-encoding` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-encoding`。" -#: ../../library/sqlite3.rst:1447 +#: ../../library/sqlite3.rst:1450 msgid "" "Return the total number of database rows that have been modified, inserted, " "or deleted since the database connection was opened." msgstr "" -#: ../../library/sqlite3.rst:1454 +#: ../../library/sqlite3.rst:1457 msgid "Cursor objects" msgstr "Cursor 物件" -#: ../../library/sqlite3.rst:1456 +#: ../../library/sqlite3.rst:1459 msgid "" "A ``Cursor`` object represents a `database cursor`_ which is used to execute " "SQL statements, and manage the context of a fetch operation. Cursors are " @@ -1853,14 +1857,14 @@ msgid "" "`connection shortcut methods `." msgstr "" -#: ../../library/sqlite3.rst:1463 +#: ../../library/sqlite3.rst:1466 msgid "" "Cursor objects are :term:`iterators `, meaning that if you :meth:" "`~Cursor.execute` a ``SELECT`` query, you can simply iterate over the cursor " "to fetch the resulting rows:" msgstr "" -#: ../../library/sqlite3.rst:1474 +#: ../../library/sqlite3.rst:1477 msgid "" "for row in cur.execute(\"SELECT t FROM data\"):\n" " print(row)" @@ -1868,32 +1872,32 @@ msgstr "" "for row in cur.execute(\"SELECT t FROM data\"):\n" " print(row)" -#: ../../library/sqlite3.rst:1488 +#: ../../library/sqlite3.rst:1491 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr "" -#: ../../library/sqlite3.rst:1495 +#: ../../library/sqlite3.rst:1498 msgid "" "Execute a single SQL statement, optionally binding Python values using :ref:" "`placeholders `." msgstr "" -#: ../../library/sqlite3.rst:1499 +#: ../../library/sqlite3.rst:1502 msgid "A single SQL statement." msgstr "單一個 SQL 陳述式。" -#: ../../library/sqlite3.rst:1502 +#: ../../library/sqlite3.rst:1505 msgid "" "Python values to bind to placeholders in *sql*. A :class:`!dict` if named " "placeholders are used. A :term:`!sequence` if unnamed placeholders are used. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1509 +#: ../../library/sqlite3.rst:1512 msgid "If *sql* contains more than one SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1512 +#: ../../library/sqlite3.rst:1515 msgid "" "If :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`, :" "attr:`~Connection.isolation_level` is not ``None``, *sql* is an ``INSERT``, " @@ -1901,7 +1905,7 @@ msgid "" "transaction, a transaction is implicitly opened before executing *sql*." msgstr "" -#: ../../library/sqlite3.rst:1521 +#: ../../library/sqlite3.rst:1524 msgid "" ":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and *parameters* is a sequence instead of a :class:" @@ -1909,37 +1913,37 @@ msgid "" "instead." msgstr "" -#: ../../library/sqlite3.rst:1527 +#: ../../library/sqlite3.rst:1530 msgid "Use :meth:`executescript` to execute multiple SQL statements." msgstr "" -#: ../../library/sqlite3.rst:1531 +#: ../../library/sqlite3.rst:1534 msgid "" "For every item in *parameters*, repeatedly execute the :ref:`parameterized " "` :abbr:`DML (Data Manipulation Language)` SQL " "statement *sql*." msgstr "" -#: ../../library/sqlite3.rst:1535 +#: ../../library/sqlite3.rst:1538 msgid "Uses the same implicit transaction handling as :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:1537 +#: ../../library/sqlite3.rst:1540 msgid "A single SQL DML statement." msgstr "" -#: ../../library/sqlite3.rst:1540 +#: ../../library/sqlite3.rst:1543 msgid "" "An :term:`!iterable` of parameters to bind with the placeholders in *sql*. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1546 +#: ../../library/sqlite3.rst:1549 msgid "" "If *sql* contains more than one SQL statement, or is not a DML statement." msgstr "" -#: ../../library/sqlite3.rst:1552 +#: ../../library/sqlite3.rst:1555 msgid "" "rows = [\n" " (\"row1\",),\n" @@ -1955,13 +1959,13 @@ msgstr "" "# cur 是一個 sqlite3.Cursor 物件\n" "cur.executemany(\"INSERT INTO data VALUES(?)\", rows)" -#: ../../library/sqlite3.rst:1567 +#: ../../library/sqlite3.rst:1570 msgid "" "Any resulting rows are discarded, including DML statements with `RETURNING " "clauses`_." msgstr "" -#: ../../library/sqlite3.rst:1574 +#: ../../library/sqlite3.rst:1577 msgid "" ":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and the items in *parameters* are sequences instead " @@ -1969,7 +1973,7 @@ msgid "" "be raised instead." msgstr "" -#: ../../library/sqlite3.rst:1583 +#: ../../library/sqlite3.rst:1586 msgid "" "Execute the SQL statements in *sql_script*. If the :attr:`~Connection." "autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and there is a pending " @@ -1978,11 +1982,11 @@ msgid "" "added to *sql_script*." msgstr "" -#: ../../library/sqlite3.rst:1591 +#: ../../library/sqlite3.rst:1594 msgid "*sql_script* must be a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:1595 +#: ../../library/sqlite3.rst:1598 msgid "" "# cur is an sqlite3.Cursor object\n" "cur.executescript(\"\"\"\n" @@ -2002,20 +2006,20 @@ msgstr "" " COMMIT;\n" "\"\"\")" -#: ../../library/sqlite3.rst:1608 +#: ../../library/sqlite3.rst:1611 msgid "" "If :attr:`~Cursor.row_factory` is ``None``, return the next row query result " "set as a :class:`tuple`. Else, pass it to the row factory and return its " "result. Return ``None`` if no more data is available." msgstr "" -#: ../../library/sqlite3.rst:1616 +#: ../../library/sqlite3.rst:1619 msgid "" "Return the next set of rows of a query result as a :class:`list`. Return an " "empty list if no more rows are available." msgstr "" -#: ../../library/sqlite3.rst:1619 +#: ../../library/sqlite3.rst:1622 msgid "" "The number of rows to fetch per call is specified by the *size* parameter. " "If *size* is not given, :attr:`arraysize` determines the number of rows to " @@ -2023,7 +2027,7 @@ msgid "" "available are returned." msgstr "" -#: ../../library/sqlite3.rst:1625 +#: ../../library/sqlite3.rst:1628 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -2031,36 +2035,36 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:1632 +#: ../../library/sqlite3.rst:1635 msgid "" "Return all (remaining) rows of a query result as a :class:`list`. Return an " "empty list if no rows are available. Note that the :attr:`arraysize` " "attribute can affect the performance of this operation." msgstr "" -#: ../../library/sqlite3.rst:1639 +#: ../../library/sqlite3.rst:1642 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:1641 +#: ../../library/sqlite3.rst:1644 msgid "" "The cursor will be unusable from this point forward; a :exc:" "`ProgrammingError` exception will be raised if any operation is attempted " "with the cursor." msgstr "" -#: ../../library/sqlite3.rst:1646 ../../library/sqlite3.rst:1650 +#: ../../library/sqlite3.rst:1649 ../../library/sqlite3.rst:1653 msgid "Required by the DB-API. Does nothing in :mod:`!sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:1654 +#: ../../library/sqlite3.rst:1657 msgid "" "Read/write attribute that controls the number of rows returned by :meth:" "`fetchmany`. The default value is 1 which means a single row would be " "fetched per call." msgstr "" -#: ../../library/sqlite3.rst:1659 +#: ../../library/sqlite3.rst:1662 msgid "" "Read-only attribute that provides the SQLite database :class:`Connection` " "belonging to the cursor. A :class:`Cursor` object created by calling :meth:" @@ -2068,7 +2072,7 @@ msgid "" "that refers to *con*:" msgstr "" -#: ../../library/sqlite3.rst:1664 +#: ../../library/sqlite3.rst:1667 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> cur = con.cursor()\n" @@ -2082,18 +2086,18 @@ msgstr "" "True\n" ">>> con.close()" -#: ../../library/sqlite3.rst:1674 +#: ../../library/sqlite3.rst:1677 msgid "" "Read-only attribute that provides the column names of the last query. To " "remain compatible with the Python DB API, it returns a 7-tuple for each " "column where the last six items of each tuple are ``None``." msgstr "" -#: ../../library/sqlite3.rst:1678 +#: ../../library/sqlite3.rst:1681 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:1682 +#: ../../library/sqlite3.rst:1685 msgid "" "Read-only attribute that provides the row id of the last inserted row. It is " "only updated after successful ``INSERT`` or ``REPLACE`` statements using " @@ -2103,15 +2107,15 @@ msgid "" "``None``." msgstr "" -#: ../../library/sqlite3.rst:1690 +#: ../../library/sqlite3.rst:1693 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:1692 +#: ../../library/sqlite3.rst:1695 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:1697 +#: ../../library/sqlite3.rst:1700 msgid "" "Read-only attribute that provides the number of modified rows for " "``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " @@ -2121,7 +2125,7 @@ msgid "" "resulting rows must be fetched in order for :attr:`!rowcount` to be updated." msgstr "" -#: ../../library/sqlite3.rst:1708 +#: ../../library/sqlite3.rst:1711 msgid "" "Control how a row fetched from this :class:`!Cursor` is represented. If " "``None``, a row is represented as a :class:`tuple`. Can be set to the " @@ -2130,18 +2134,18 @@ msgid "" "and returns a custom object representing an SQLite row." msgstr "" -#: ../../library/sqlite3.rst:1715 +#: ../../library/sqlite3.rst:1718 msgid "" "Defaults to what :attr:`Connection.row_factory` was set to when the :class:`!" "Cursor` was created. Assigning to this attribute does not affect :attr:" "`Connection.row_factory` of the parent connection." msgstr "" -#: ../../library/sqlite3.rst:1731 +#: ../../library/sqlite3.rst:1734 msgid "Row objects" msgstr "Row 物件" -#: ../../library/sqlite3.rst:1735 +#: ../../library/sqlite3.rst:1738 msgid "" "A :class:`!Row` instance serves as a highly optimized :attr:`~Connection." "row_factory` for :class:`Connection` objects. It supports iteration, " @@ -2149,28 +2153,28 @@ msgid "" "index." msgstr "" -#: ../../library/sqlite3.rst:1740 +#: ../../library/sqlite3.rst:1743 msgid "" "Two :class:`!Row` objects compare equal if they have identical column names " "and values." msgstr "" -#: ../../library/sqlite3.rst:1747 +#: ../../library/sqlite3.rst:1750 msgid "" "Return a :class:`list` of column names as :class:`strings `. " "Immediately after a query, it is the first member of each tuple in :attr:" "`Cursor.description`." msgstr "" -#: ../../library/sqlite3.rst:1751 +#: ../../library/sqlite3.rst:1754 msgid "Added support of slicing." msgstr "新增對切片的支援。" -#: ../../library/sqlite3.rst:1758 +#: ../../library/sqlite3.rst:1761 msgid "Blob objects" msgstr "Blob 物件" -#: ../../library/sqlite3.rst:1764 +#: ../../library/sqlite3.rst:1767 msgid "" "A :class:`Blob` instance is a :term:`file-like object` that can read and " "write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. Call :func:" @@ -2178,13 +2182,13 @@ msgid "" "and :term:`slices ` for direct access to the blob data." msgstr "" -#: ../../library/sqlite3.rst:1769 +#: ../../library/sqlite3.rst:1772 msgid "" "Use the :class:`Blob` as a :term:`context manager` to ensure that the blob " "handle is closed after use." msgstr "" -#: ../../library/sqlite3.rst:1772 +#: ../../library/sqlite3.rst:1775 msgid "" "con = sqlite3.connect(\":memory:\")\n" "con.execute(\"CREATE TABLE test(blob_col blob)\")\n" @@ -2206,18 +2210,18 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1800 +#: ../../library/sqlite3.rst:1803 msgid "Close the blob." msgstr "" -#: ../../library/sqlite3.rst:1802 +#: ../../library/sqlite3.rst:1805 msgid "" "The blob will be unusable from this point onward. An :class:`~sqlite3." "Error` (or subclass) exception will be raised if any further operation is " "attempted with the blob." msgstr "" -#: ../../library/sqlite3.rst:1808 +#: ../../library/sqlite3.rst:1811 msgid "" "Read *length* bytes of data from the blob at the current offset position. If " "the end of the blob is reached, the data up to :abbr:`EOF (End of File)` " @@ -2225,18 +2229,18 @@ msgid "" "`~Blob.read` will read until the end of the blob." msgstr "" -#: ../../library/sqlite3.rst:1816 +#: ../../library/sqlite3.rst:1819 msgid "" "Write *data* to the blob at the current offset. This function cannot change " "the blob length. Writing beyond the end of the blob will raise :exc:" "`ValueError`." msgstr "" -#: ../../library/sqlite3.rst:1822 +#: ../../library/sqlite3.rst:1825 msgid "Return the current access position of the blob." msgstr "" -#: ../../library/sqlite3.rst:1826 +#: ../../library/sqlite3.rst:1829 msgid "" "Set the current access position of the blob to *offset*. The *origin* " "argument defaults to :const:`os.SEEK_SET` (absolute blob positioning). Other " @@ -2244,26 +2248,26 @@ msgid "" "position) and :const:`os.SEEK_END` (seek relative to the blob’s end)." msgstr "" -#: ../../library/sqlite3.rst:1834 +#: ../../library/sqlite3.rst:1837 msgid "PrepareProtocol objects" msgstr "PrepareProtocol 物件" -#: ../../library/sqlite3.rst:1838 +#: ../../library/sqlite3.rst:1841 msgid "" "The PrepareProtocol type's single purpose is to act as a :pep:`246` style " "adaption protocol for objects that can :ref:`adapt themselves ` to :ref:`native SQLite types `." msgstr "" -#: ../../library/sqlite3.rst:1846 +#: ../../library/sqlite3.rst:1849 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:1848 +#: ../../library/sqlite3.rst:1851 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: ../../library/sqlite3.rst:1852 +#: ../../library/sqlite3.rst:1855 msgid "" "This exception is not currently raised by the :mod:`!sqlite3` module, but " "may be raised by applications using :mod:`!sqlite3`, for example if a user-" @@ -2271,39 +2275,39 @@ msgid "" "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1859 +#: ../../library/sqlite3.rst:1862 msgid "" "The base class of the other exceptions in this module. Use this to catch all " "errors with one single :keyword:`except` statement. ``Error`` is a subclass " "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1863 +#: ../../library/sqlite3.rst:1866 msgid "" "If the exception originated from within the SQLite library, the following " "two attributes are added to the exception:" msgstr "" -#: ../../library/sqlite3.rst:1868 +#: ../../library/sqlite3.rst:1871 msgid "" "The numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1875 +#: ../../library/sqlite3.rst:1878 msgid "" "The symbolic name of the numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1882 +#: ../../library/sqlite3.rst:1885 msgid "" "Exception raised for misuse of the low-level SQLite C API. In other words, " "if this exception is raised, it probably indicates a bug in the :mod:`!" "sqlite3` module. ``InterfaceError`` is a subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1889 +#: ../../library/sqlite3.rst:1892 msgid "" "Exception raised for errors that are related to the database. This serves as " "the base exception for several types of database errors. It is only raised " @@ -2311,14 +2315,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1896 +#: ../../library/sqlite3.rst:1899 msgid "" "Exception raised for errors caused by problems with the processed data, like " "numeric values out of range, and strings which are too long. ``DataError`` " "is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1902 +#: ../../library/sqlite3.rst:1905 msgid "" "Exception raised for errors that are related to the database's operation, " "and not necessarily under the control of the programmer. For example, the " @@ -2326,20 +2330,20 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1910 +#: ../../library/sqlite3.rst:1913 msgid "" "Exception raised when the relational integrity of the database is affected, " "e.g. a foreign key check fails. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1915 +#: ../../library/sqlite3.rst:1918 msgid "" "Exception raised when SQLite encounters an internal error. If this is " "raised, it may indicate that there is a problem with the runtime SQLite " "library. ``InternalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1922 +#: ../../library/sqlite3.rst:1925 msgid "" "Exception raised for :mod:`!sqlite3` API programming errors, for example " "supplying the wrong number of bindings to a query, or trying to operate on a " @@ -2347,7 +2351,7 @@ msgid "" "`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1929 +#: ../../library/sqlite3.rst:1932 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to ``True`` " @@ -2356,78 +2360,78 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1939 +#: ../../library/sqlite3.rst:1942 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:1941 +#: ../../library/sqlite3.rst:1944 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:1944 +#: ../../library/sqlite3.rst:1947 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:1947 ../../library/sqlite3.rst:1964 +#: ../../library/sqlite3.rst:1950 ../../library/sqlite3.rst:1967 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:1947 ../../library/sqlite3.rst:1964 +#: ../../library/sqlite3.rst:1950 ../../library/sqlite3.rst:1967 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:1949 ../../library/sqlite3.rst:1966 +#: ../../library/sqlite3.rst:1952 ../../library/sqlite3.rst:1969 msgid "``None``" msgstr "``None``" -#: ../../library/sqlite3.rst:1949 ../../library/sqlite3.rst:1966 +#: ../../library/sqlite3.rst:1952 ../../library/sqlite3.rst:1969 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:1951 ../../library/sqlite3.rst:1968 +#: ../../library/sqlite3.rst:1954 ../../library/sqlite3.rst:1971 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:1951 ../../library/sqlite3.rst:1968 +#: ../../library/sqlite3.rst:1954 ../../library/sqlite3.rst:1971 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:1953 ../../library/sqlite3.rst:1970 +#: ../../library/sqlite3.rst:1956 ../../library/sqlite3.rst:1973 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:1953 ../../library/sqlite3.rst:1970 +#: ../../library/sqlite3.rst:1956 ../../library/sqlite3.rst:1973 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:1955 +#: ../../library/sqlite3.rst:1958 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:1955 ../../library/sqlite3.rst:1972 +#: ../../library/sqlite3.rst:1958 ../../library/sqlite3.rst:1975 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:1957 ../../library/sqlite3.rst:1975 +#: ../../library/sqlite3.rst:1960 ../../library/sqlite3.rst:1978 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:1957 ../../library/sqlite3.rst:1975 +#: ../../library/sqlite3.rst:1960 ../../library/sqlite3.rst:1978 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:1961 +#: ../../library/sqlite3.rst:1964 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:1972 +#: ../../library/sqlite3.rst:1975 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:1978 +#: ../../library/sqlite3.rst:1981 msgid "" "The type system of the :mod:`!sqlite3` module is extensible in two ways: you " "can store additional Python types in an SQLite database via :ref:`object " @@ -2436,47 +2440,47 @@ msgid "" "converters>`." msgstr "" -#: ../../library/sqlite3.rst:1988 +#: ../../library/sqlite3.rst:1991 msgid "Default adapters and converters (deprecated)" msgstr "" -#: ../../library/sqlite3.rst:1992 +#: ../../library/sqlite3.rst:1995 msgid "" "The default adapters and converters are deprecated as of Python 3.12. " "Instead, use the :ref:`sqlite3-adapter-converter-recipes` and tailor them to " "your needs." msgstr "" -#: ../../library/sqlite3.rst:1996 +#: ../../library/sqlite3.rst:1999 msgid "The deprecated default adapters and converters consist of:" msgstr "" -#: ../../library/sqlite3.rst:1998 +#: ../../library/sqlite3.rst:2001 msgid "" "An adapter for :class:`datetime.date` objects to :class:`strings ` in " "`ISO 8601`_ format." msgstr "" -#: ../../library/sqlite3.rst:2000 +#: ../../library/sqlite3.rst:2003 msgid "" "An adapter for :class:`datetime.datetime` objects to strings in ISO 8601 " "format." msgstr "" -#: ../../library/sqlite3.rst:2002 +#: ../../library/sqlite3.rst:2005 msgid "" "A converter for :ref:`declared ` \"date\" types to :" "class:`datetime.date` objects." msgstr "" -#: ../../library/sqlite3.rst:2004 +#: ../../library/sqlite3.rst:2007 msgid "" "A converter for declared \"timestamp\" types to :class:`datetime.datetime` " "objects. Fractional parts will be truncated to 6 digits (microsecond " "precision)." msgstr "" -#: ../../library/sqlite3.rst:2010 +#: ../../library/sqlite3.rst:2013 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -2484,42 +2488,42 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:2023 +#: ../../library/sqlite3.rst:2026 msgid "Command-line interface" msgstr "命令列介面" -#: ../../library/sqlite3.rst:2025 +#: ../../library/sqlite3.rst:2028 msgid "" "The :mod:`!sqlite3` module can be invoked as a script, using the " "interpreter's :option:`-m` switch, in order to provide a simple SQLite " "shell. The argument signature is as follows::" msgstr "" -#: ../../library/sqlite3.rst:2030 +#: ../../library/sqlite3.rst:2033 msgid "python -m sqlite3 [-h] [-v] [filename] [sql]" msgstr "python -m sqlite3 [-h] [-v] [filename] [sql]" -#: ../../library/sqlite3.rst:2032 +#: ../../library/sqlite3.rst:2035 msgid "Type ``.quit`` or CTRL-D to exit the shell." msgstr "" -#: ../../library/sqlite3.rst:2038 +#: ../../library/sqlite3.rst:2041 msgid "Print CLI help." msgstr "" -#: ../../library/sqlite3.rst:2042 +#: ../../library/sqlite3.rst:2045 msgid "Print underlying SQLite library version." msgstr "" -#: ../../library/sqlite3.rst:2050 +#: ../../library/sqlite3.rst:2053 msgid "How-to guides" msgstr "" -#: ../../library/sqlite3.rst:2055 +#: ../../library/sqlite3.rst:2058 msgid "How to use placeholders to bind values in SQL queries" msgstr "" -#: ../../library/sqlite3.rst:2057 +#: ../../library/sqlite3.rst:2060 msgid "" "SQL operations usually need to use values from Python variables. However, " "beware of using Python's string operations to assemble queries, as they are " @@ -2527,7 +2531,7 @@ msgid "" "close the single quote and inject ``OR TRUE`` to select all rows::" msgstr "" -#: ../../library/sqlite3.rst:2062 +#: ../../library/sqlite3.rst:2065 msgid "" ">>> # Never do this -- insecure!\n" ">>> symbol = input()\n" @@ -2538,7 +2542,7 @@ msgid "" ">>> cur.execute(sql)" msgstr "" -#: ../../library/sqlite3.rst:2070 +#: ../../library/sqlite3.rst:2073 msgid "" "Instead, use the DB-API's parameter substitution. To insert a variable into " "a query string, use a placeholder in the string, and substitute the actual " @@ -2546,7 +2550,7 @@ msgid "" "second argument of the cursor's :meth:`~Cursor.execute` method." msgstr "" -#: ../../library/sqlite3.rst:2075 +#: ../../library/sqlite3.rst:2078 msgid "" "An SQL statement may use one of two kinds of placeholders: question marks " "(qmark style) or named placeholders (named style). For the qmark style, " @@ -2557,7 +2561,7 @@ msgid "" "ignored. Here's an example of both styles:" msgstr "" -#: ../../library/sqlite3.rst:2086 +#: ../../library/sqlite3.rst:2089 msgid "" "con = sqlite3.connect(\":memory:\")\n" "cur = con.execute(\"CREATE TABLE lang(name, first_appeared)\")\n" @@ -2578,24 +2582,24 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2113 +#: ../../library/sqlite3.rst:2116 msgid "" ":pep:`249` numeric placeholders are *not* supported. If used, they will be " "interpreted as named placeholders." msgstr "" -#: ../../library/sqlite3.rst:2120 +#: ../../library/sqlite3.rst:2123 msgid "How to adapt custom Python types to SQLite values" msgstr "" -#: ../../library/sqlite3.rst:2122 +#: ../../library/sqlite3.rst:2125 msgid "" "SQLite supports only a limited set of data types natively. To store custom " "Python types in SQLite databases, *adapt* them to one of the :ref:`Python " "types SQLite natively understands `." msgstr "" -#: ../../library/sqlite3.rst:2126 +#: ../../library/sqlite3.rst:2129 msgid "" "There are two ways to adapt Python objects to SQLite types: letting your " "object adapt itself, or using an *adapter callable*. The latter will take " @@ -2605,11 +2609,11 @@ msgid "" "custom adapter functions." msgstr "" -#: ../../library/sqlite3.rst:2138 +#: ../../library/sqlite3.rst:2141 msgid "How to write adaptable objects" msgstr "" -#: ../../library/sqlite3.rst:2140 +#: ../../library/sqlite3.rst:2143 msgid "" "Suppose we have a :class:`!Point` class that represents a pair of " "coordinates, ``x`` and ``y``, in a Cartesian coordinate system. The " @@ -2619,7 +2623,7 @@ msgid "" "object passed to *protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:2148 +#: ../../library/sqlite3.rst:2151 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2651,18 +2655,18 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2172 +#: ../../library/sqlite3.rst:2175 msgid "How to register adapter callables" msgstr "" -#: ../../library/sqlite3.rst:2174 +#: ../../library/sqlite3.rst:2177 msgid "" "The other possibility is to create a function that converts the Python " "object to an SQLite-compatible type. This function can then be registered " "using :func:`register_adapter`." msgstr "" -#: ../../library/sqlite3.rst:2178 +#: ../../library/sqlite3.rst:2181 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2696,36 +2700,36 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2205 +#: ../../library/sqlite3.rst:2208 msgid "How to convert SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:2207 +#: ../../library/sqlite3.rst:2210 msgid "" "Writing an adapter lets you convert *from* custom Python types *to* SQLite " "values. To be able to convert *from* SQLite values *to* custom Python types, " "we use *converters*." msgstr "" -#: ../../library/sqlite3.rst:2212 +#: ../../library/sqlite3.rst:2215 msgid "" "Let's go back to the :class:`!Point` class. We stored the x and y " "coordinates separated via semicolons as strings in SQLite." msgstr "" -#: ../../library/sqlite3.rst:2215 +#: ../../library/sqlite3.rst:2218 msgid "" "First, we'll define a converter function that accepts the string as a " "parameter and constructs a :class:`!Point` object from it." msgstr "" -#: ../../library/sqlite3.rst:2220 +#: ../../library/sqlite3.rst:2223 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: ../../library/sqlite3.rst:2223 +#: ../../library/sqlite3.rst:2226 msgid "" "def convert_point(s):\n" " x, y = map(float, s.split(b\";\"))\n" @@ -2735,32 +2739,32 @@ msgstr "" " x, y = map(float, s.split(b\";\"))\n" " return Point(x, y)" -#: ../../library/sqlite3.rst:2229 +#: ../../library/sqlite3.rst:2232 msgid "" "We now need to tell :mod:`!sqlite3` when it should convert a given SQLite " "value. This is done when connecting to a database, using the *detect_types* " "parameter of :func:`connect`. There are three options:" msgstr "" -#: ../../library/sqlite3.rst:2233 +#: ../../library/sqlite3.rst:2236 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: ../../library/sqlite3.rst:2234 +#: ../../library/sqlite3.rst:2237 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: ../../library/sqlite3.rst:2235 +#: ../../library/sqlite3.rst:2238 msgid "" "Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." "PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" -#: ../../library/sqlite3.rst:2239 +#: ../../library/sqlite3.rst:2242 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: ../../library/sqlite3.rst:2241 +#: ../../library/sqlite3.rst:2244 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2802,15 +2806,15 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2292 +#: ../../library/sqlite3.rst:2295 msgid "Adapter and converter recipes" msgstr "" -#: ../../library/sqlite3.rst:2294 +#: ../../library/sqlite3.rst:2297 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: ../../library/sqlite3.rst:2296 +#: ../../library/sqlite3.rst:2299 msgid "" "import datetime\n" "import sqlite3\n" @@ -2848,11 +2852,11 @@ msgid "" "sqlite3.register_converter(\"timestamp\", convert_timestamp)" msgstr "" -#: ../../library/sqlite3.rst:2356 +#: ../../library/sqlite3.rst:2359 msgid "How to use connection shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:2358 +#: ../../library/sqlite3.rst:2361 msgid "" "Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" "meth:`~Connection.executescript` methods of the :class:`Connection` class, " @@ -2864,7 +2868,7 @@ msgid "" "object." msgstr "" -#: ../../library/sqlite3.rst:2367 +#: ../../library/sqlite3.rst:2370 msgid "" "# Create and fill the table.\n" "con = sqlite3.connect(\":memory:\")\n" @@ -2888,11 +2892,11 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2399 +#: ../../library/sqlite3.rst:2402 msgid "How to use the connection context manager" msgstr "" -#: ../../library/sqlite3.rst:2401 +#: ../../library/sqlite3.rst:2404 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -2904,21 +2908,21 @@ msgid "" "rolling back." msgstr "" -#: ../../library/sqlite3.rst:2412 +#: ../../library/sqlite3.rst:2415 msgid "" "If there is no open transaction upon leaving the body of the ``with`` " "statement, or if :attr:`~Connection.autocommit` is ``True``, the context " "manager does nothing." msgstr "" -#: ../../library/sqlite3.rst:2417 +#: ../../library/sqlite3.rst:2420 msgid "" "The context manager neither implicitly opens a new transaction nor closes " "the connection. If you need a closing context manager, consider using :meth:" "`contextlib.closing`." msgstr "" -#: ../../library/sqlite3.rst:2421 +#: ../../library/sqlite3.rst:2424 msgid "" "con = sqlite3.connect(\":memory:\")\n" "con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR " @@ -2942,19 +2946,19 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2451 +#: ../../library/sqlite3.rst:2454 msgid "How to work with SQLite URIs" msgstr "" -#: ../../library/sqlite3.rst:2453 +#: ../../library/sqlite3.rst:2456 msgid "Some useful URI tricks include:" msgstr "" -#: ../../library/sqlite3.rst:2455 +#: ../../library/sqlite3.rst:2458 msgid "Open a database in read-only mode:" msgstr "" -#: ../../library/sqlite3.rst:2457 +#: ../../library/sqlite3.rst:2460 msgid "" ">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" ">>> con.execute(\"CREATE TABLE readonly(data)\")\n" @@ -2968,13 +2972,13 @@ msgstr "" "OperationalError: attempt to write a readonly database\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2465 +#: ../../library/sqlite3.rst:2468 msgid "" "Do not implicitly create a new database file if it does not already exist; " "will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:" msgstr "" -#: ../../library/sqlite3.rst:2468 +#: ../../library/sqlite3.rst:2471 msgid "" ">>> con = sqlite3.connect(\"file:nosuchdb.db?mode=rw\", uri=True)\n" "Traceback (most recent call last):\n" @@ -2984,11 +2988,11 @@ msgstr "" "Traceback (most recent call last):\n" "OperationalError: unable to open database file" -#: ../../library/sqlite3.rst:2475 +#: ../../library/sqlite3.rst:2478 msgid "Create a shared named in-memory database:" msgstr "" -#: ../../library/sqlite3.rst:2477 +#: ../../library/sqlite3.rst:2480 msgid "" "db = \"file:mem1?mode=memory&cache=shared\"\n" "con1 = sqlite3.connect(db, uri=True)\n" @@ -3014,24 +3018,24 @@ msgstr "" "con1.close()\n" "con2.close()" -#: ../../library/sqlite3.rst:2491 +#: ../../library/sqlite3.rst:2494 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:2500 +#: ../../library/sqlite3.rst:2503 msgid "How to create and use row factories" msgstr "" -#: ../../library/sqlite3.rst:2502 +#: ../../library/sqlite3.rst:2505 msgid "" "By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If a :" "class:`!tuple` does not suit your needs, you can use the :class:`sqlite3." "Row` class or a custom :attr:`~Cursor.row_factory`." msgstr "" -#: ../../library/sqlite3.rst:2507 +#: ../../library/sqlite3.rst:2510 msgid "" "While :attr:`!row_factory` exists as an attribute both on the :class:" "`Cursor` and the :class:`Connection`, it is recommended to set :class:" @@ -3039,7 +3043,7 @@ msgid "" "use the same row factory." msgstr "" -#: ../../library/sqlite3.rst:2512 +#: ../../library/sqlite3.rst:2515 msgid "" ":class:`!Row` provides indexed and case-insensitive named access to columns, " "with minimal memory overhead and performance impact over a :class:`!tuple`. " @@ -3047,7 +3051,7 @@ msgid "" "attribute:" msgstr "" -#: ../../library/sqlite3.rst:2517 +#: ../../library/sqlite3.rst:2520 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" @@ -3055,11 +3059,11 @@ msgstr "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" -#: ../../library/sqlite3.rst:2522 +#: ../../library/sqlite3.rst:2525 msgid "Queries now return :class:`!Row` objects:" msgstr "" -#: ../../library/sqlite3.rst:2524 +#: ../../library/sqlite3.rst:2527 msgid "" ">>> res = con.execute(\"SELECT 'Earth' AS name, 6378 AS radius\")\n" ">>> row = res.fetchone()\n" @@ -3074,7 +3078,7 @@ msgid "" ">>> con.close()" msgstr "" -#: ../../library/sqlite3.rst:2540 +#: ../../library/sqlite3.rst:2543 msgid "" "The ``FROM`` clause can be omitted in the ``SELECT`` statement, as in the " "above example. In such cases, SQLite returns a single row with columns " @@ -3082,13 +3086,13 @@ msgid "" "alias``." msgstr "" -#: ../../library/sqlite3.rst:2545 +#: ../../library/sqlite3.rst:2548 msgid "" "You can create a custom :attr:`~Cursor.row_factory` that returns each row as " "a :class:`dict`, with column names mapped to values:" msgstr "" -#: ../../library/sqlite3.rst:2548 +#: ../../library/sqlite3.rst:2551 msgid "" "def dict_factory(cursor, row):\n" " fields = [column[0] for column in cursor.description]\n" @@ -3098,12 +3102,12 @@ msgstr "" " fields = [column[0] for column in cursor.description]\n" " return {key: value for key, value in zip(fields, row)}" -#: ../../library/sqlite3.rst:2554 +#: ../../library/sqlite3.rst:2557 msgid "" "Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2556 +#: ../../library/sqlite3.rst:2559 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = dict_factory\n" @@ -3119,11 +3123,11 @@ msgstr "" "{'a': 1, 'b': 2}\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2565 +#: ../../library/sqlite3.rst:2568 msgid "The following row factory returns a :term:`named tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2567 +#: ../../library/sqlite3.rst:2570 msgid "" "from collections import namedtuple\n" "\n" @@ -3139,11 +3143,11 @@ msgstr "" " cls = namedtuple(\"Row\", fields)\n" " return cls._make(row)" -#: ../../library/sqlite3.rst:2576 +#: ../../library/sqlite3.rst:2579 msgid ":func:`!namedtuple_factory` can be used as follows:" msgstr "" -#: ../../library/sqlite3.rst:2578 +#: ../../library/sqlite3.rst:2581 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = namedtuple_factory\n" @@ -3169,18 +3173,18 @@ msgstr "" "2\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2592 +#: ../../library/sqlite3.rst:2595 msgid "" "With some adjustments, the above recipe can be adapted to use a :class:" "`~dataclasses.dataclass`, or any other custom class, instead of a :class:" "`~collections.namedtuple`." msgstr "" -#: ../../library/sqlite3.rst:2600 +#: ../../library/sqlite3.rst:2603 msgid "How to handle non-UTF-8 text encodings" msgstr "" -#: ../../library/sqlite3.rst:2602 +#: ../../library/sqlite3.rst:2605 msgid "" "By default, :mod:`!sqlite3` uses :class:`str` to adapt SQLite values with " "the ``TEXT`` data type. This works well for UTF-8 encoded text, but it might " @@ -3188,7 +3192,7 @@ msgid "" "`~Connection.text_factory` to handle such cases." msgstr "" -#: ../../library/sqlite3.rst:2608 +#: ../../library/sqlite3.rst:2611 msgid "" "Because of SQLite's `flexible typing`_, it is not uncommon to encounter " "table columns with the ``TEXT`` data type containing non-UTF-8 encodings, or " @@ -3199,39 +3203,39 @@ msgid "" "text using this :attr:`~Connection.text_factory`:" msgstr "" -#: ../../library/sqlite3.rst:2617 +#: ../../library/sqlite3.rst:2620 msgid "con.text_factory = lambda data: str(data, encoding=\"latin2\")" msgstr "con.text_factory = lambda data: str(data, encoding=\"latin2\")" -#: ../../library/sqlite3.rst:2621 +#: ../../library/sqlite3.rst:2624 msgid "" "For invalid UTF-8 or arbitrary data in stored in ``TEXT`` table columns, you " "can use the following technique, borrowed from the :ref:`unicode-howto`:" msgstr "" -#: ../../library/sqlite3.rst:2624 +#: ../../library/sqlite3.rst:2627 msgid "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" msgstr "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" -#: ../../library/sqlite3.rst:2630 +#: ../../library/sqlite3.rst:2633 msgid "" "The :mod:`!sqlite3` module API does not support strings containing " "surrogates." msgstr "" -#: ../../library/sqlite3.rst:2635 +#: ../../library/sqlite3.rst:2638 msgid ":ref:`unicode-howto`" msgstr ":ref:`unicode-howto`" -#: ../../library/sqlite3.rst:2641 +#: ../../library/sqlite3.rst:2644 msgid "Explanation" msgstr "解釋" -#: ../../library/sqlite3.rst:2647 +#: ../../library/sqlite3.rst:2650 msgid "Transaction control" msgstr "" -#: ../../library/sqlite3.rst:2649 +#: ../../library/sqlite3.rst:2652 msgid "" ":mod:`!sqlite3` offers multiple methods of controlling whether, when and how " "database transactions are opened and closed. :ref:`sqlite3-transaction-" @@ -3239,24 +3243,24 @@ msgid "" "isolation-level` retains the pre-Python 3.12 behaviour." msgstr "" -#: ../../library/sqlite3.rst:2658 +#: ../../library/sqlite3.rst:2661 msgid "Transaction control via the ``autocommit`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2660 +#: ../../library/sqlite3.rst:2663 msgid "" "The recommended way of controlling transaction behaviour is through the :" "attr:`Connection.autocommit` attribute, which should preferably be set using " "the *autocommit* parameter of :func:`connect`." msgstr "" -#: ../../library/sqlite3.rst:2665 +#: ../../library/sqlite3.rst:2668 msgid "" "It is suggested to set *autocommit* to ``False``, which implies :pep:`249`-" "compliant transaction control. This means:" msgstr "" -#: ../../library/sqlite3.rst:2669 +#: ../../library/sqlite3.rst:2672 msgid "" ":mod:`!sqlite3` ensures that a transaction is always open, so :func:" "`connect`, :meth:`Connection.commit`, and :meth:`Connection.rollback` will " @@ -3265,21 +3269,21 @@ msgid "" "when opening transactions." msgstr "" -#: ../../library/sqlite3.rst:2674 +#: ../../library/sqlite3.rst:2677 msgid "Transactions should be committed explicitly using :meth:`!commit`." msgstr "" -#: ../../library/sqlite3.rst:2675 +#: ../../library/sqlite3.rst:2678 msgid "Transactions should be rolled back explicitly using :meth:`!rollback`." msgstr "" -#: ../../library/sqlite3.rst:2676 +#: ../../library/sqlite3.rst:2679 msgid "" "An implicit rollback is performed if the database is :meth:`~Connection." "close`-ed with pending changes." msgstr "" -#: ../../library/sqlite3.rst:2679 +#: ../../library/sqlite3.rst:2682 msgid "" "Set *autocommit* to ``True`` to enable SQLite's `autocommit mode`_. In this " "mode, :meth:`Connection.commit` and :meth:`Connection.rollback` have no " @@ -3288,25 +3292,25 @@ msgid "" "in_transaction` to query the low-level SQLite autocommit mode." msgstr "" -#: ../../library/sqlite3.rst:2687 +#: ../../library/sqlite3.rst:2690 msgid "" "Set *autocommit* to :data:`LEGACY_TRANSACTION_CONTROL` to leave transaction " "control behaviour to the :attr:`Connection.isolation_level` attribute. See :" "ref:`sqlite3-transaction-control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:2696 +#: ../../library/sqlite3.rst:2699 msgid "Transaction control via the ``isolation_level`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2700 +#: ../../library/sqlite3.rst:2703 msgid "" "The recommended way of controlling transactions is via the :attr:" "`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-control-" "autocommit`." msgstr "" -#: ../../library/sqlite3.rst:2704 +#: ../../library/sqlite3.rst:2707 msgid "" "If :attr:`Connection.autocommit` is set to :data:" "`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour is " @@ -3314,7 +3318,7 @@ msgid "" "Otherwise, :attr:`!isolation_level` has no effect." msgstr "" -#: ../../library/sqlite3.rst:2710 +#: ../../library/sqlite3.rst:2713 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " "``None``, new transactions are implicitly opened before :meth:`~Cursor." @@ -3328,7 +3332,7 @@ msgid "" "attribute." msgstr "" -#: ../../library/sqlite3.rst:2723 +#: ../../library/sqlite3.rst:2726 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " @@ -3338,34 +3342,34 @@ msgid "" "in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:2731 +#: ../../library/sqlite3.rst:2734 msgid "" "The :meth:`~Cursor.executescript` method implicitly commits any pending " "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -#: ../../library/sqlite3.rst:2735 +#: ../../library/sqlite3.rst:2738 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:2739 +#: ../../library/sqlite3.rst:2742 msgid "" "The recommended way of controlling transactions is now via the :attr:" "`~Connection.autocommit` attribute." msgstr "" -#: ../../library/sqlite3.rst:1490 +#: ../../library/sqlite3.rst:1493 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/sqlite3.rst:1490 ../../library/sqlite3.rst:1491 +#: ../../library/sqlite3.rst:1493 ../../library/sqlite3.rst:1494 msgid "in SQL statements" msgstr "於 SQL 陳述式中" -#: ../../library/sqlite3.rst:1491 +#: ../../library/sqlite3.rst:1494 msgid ": (colon)" msgstr ": (冒號)" diff --git a/library/ssl.po b/library/ssl.po index 15a4f1f037..b135986e77 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2024-08-28 00:43+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -89,15 +89,16 @@ msgid "" "also encrypts and decrypts the data going over the socket with SSL. It " "supports additional methods such as :meth:`getpeercert`, which retrieves the " "certificate of the other side of the connection, :meth:`cipher`, which " -"retrieves the cipher being used for the secure connection or :meth:" -"`get_verified_chain`, :meth:`get_unverified_chain` which retrieves " +"retrieves the cipher being used for the secure connection " +"or :meth:`get_verified_chain`, :meth:`get_unverified_chain` which retrieves " "certificate chain." msgstr "" "此模組提供了一個 :class:`ssl.SSLSocket` 類別,它是從 :class:`socket.socket` " "衍生出來的,並且提供類似 socket 的包裝器,讓使用 SSL 進行資料傳輸時,可以進行" "資料的加密及解密。它也提供了一些額外的方法,如 :meth:`getpeercert`,用於取得" -"連結另一端的憑證,以及 :meth:`cipher`,用於搜尋用於安全連接的加密方法 " -"(cipher)。" +"連結另一端的憑證;以及 :meth:`cipher`,用於搜尋用於安全連接的加密方法 " +"(cipher);和 :meth:`get_verified_chain`、:meth:`get_unverified_chain` 能用於" +"取得憑證鏈。" #: ../../library/ssl.rst:51 msgid "" @@ -142,9 +143,10 @@ msgstr "Socket 建立" #: ../../library/ssl.rst:79 msgid "" -"Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." -"wrap_socket` method. The helper function :func:`create_default_context` " -"returns a new context with secure default settings." +"Instances of :class:`SSLSocket` must be created using " +"the :meth:`SSLContext.wrap_socket` method. The helper " +"function :func:`create_default_context` returns a new context with secure " +"default settings." msgstr "" ":class:`SSLSocket` 實例必須使用 :meth:`SSLContext.wrap_socket` 方法來建立。輔" "助函式 :func:`create_default_context` 會回傳有安全預設設定的新語境 " @@ -245,31 +247,31 @@ msgid "" "If all three are :const:`None`, this function can choose to trust the " "system's default CA certificates instead." msgstr "" -"*cafile*, *capath*, *cadata* 是用來選擇用於憑證認證的 CA 憑證,就像 :meth:" -"`SSLContext.load_verify_locations` 一樣。如果三個值都是 :const:`None`,此函式" -"會自動選擇系統預設的 CA 憑證。" +"*cafile*, *capath*, *cadata* 是用來選擇用於憑證認證的 CA 憑證,就" +"像 :meth:`SSLContext.load_verify_locations` 一樣。如果三個值都" +"是 :const:`None`,此函式會自動選擇系統預設的 CA 憑證。" # Skylull: `high encryption cipher` 可能是指 https://superuser.com/questions/1751902/how-to-check-which-ciphers-are-included-in-high-ciphers-constant # 其文中表示可能是指 128bit 以上 key length 的加密算法,需要其他來源佐證。 # 或是 https://help.fortinet.com/fweb/582/Content/FortiWeb/fortiweb-admin/supported_cipher_suites.htm#ssl_414712646_1189301 #: ../../library/ssl.rst:141 msgid "" -"The settings are: :data:`PROTOCOL_TLS_CLIENT` or :data:" -"`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` with " -"high encryption cipher suites without RC4 and without unauthenticated cipher " -"suites. Passing :const:`~Purpose.SERVER_AUTH` as *purpose* sets :data:" -"`~SSLContext.verify_mode` to :data:`CERT_REQUIRED` and either loads CA " -"certificates (when at least one of *cafile*, *capath* or *cadata* is given) " -"or uses :meth:`SSLContext.load_default_certs` to load default CA " +"The settings are: :data:`PROTOCOL_TLS_CLIENT` " +"or :data:`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` " +"with high encryption cipher suites without RC4 and without unauthenticated " +"cipher suites. Passing :const:`~Purpose.SERVER_AUTH` as *purpose* " +"sets :data:`~SSLContext.verify_mode` to :data:`CERT_REQUIRED` and either " +"loads CA certificates (when at least one of *cafile*, *capath* or *cadata* " +"is given) or uses :meth:`SSLContext.load_default_certs` to load default CA " "certificates." msgstr "" -"這些設定包含::data:`PROTOCOL_TLS_CLIENT` 或 :data:`PROTOCOL_TLS_SERVER`、:" -"data:`OP_NO_SSLv2`、以及 :data:`OP_NO_SSLv3`,使用高等加密套件但不包含 RC4 和" -"未經身份驗證的加密套件。如果將 *purpose* 設定為 :const:`~Purpose." -"SERVER_AUTH`,則會把 :data:`~SSLContext.verify_mode` 設為 :data:" -"`CERT_REQUIRED` 並使用設定的 CA 憑證(當 *cafile*、*capath* 或 *cadata* 其中一" -"個值有被設定時) 或使用預設的 CA 憑證 :meth:`SSLContext." -"load_default_certs` 。" +"這些設定包含::data:`PROTOCOL_TLS_CLIENT` " +"或 :data:`PROTOCOL_TLS_SERVER`、:data:`OP_NO_SSLv2`、以" +"及 :data:`OP_NO_SSLv3`,使用高等加密套件但不包含 RC4 和未經身份驗證的加密套" +"件。如果將 *purpose* 設定為 :const:`~Purpose.SERVER_AUTH`,則會" +"把 :data:`~SSLContext.verify_mode` 設為 :data:`CERT_REQUIRED` 並使用設定的 " +"CA 憑證(當 *cafile*、*capath* 或 *cadata* 其中一個值有被設定時) 或使用預設的 " +"CA 憑證 :meth:`SSLContext.load_default_certs` 。" #: ../../library/ssl.rst:150 msgid "" @@ -277,16 +279,16 @@ msgid "" "variable :envvar:`SSLKEYLOGFILE` is set, :func:`create_default_context` " "enables key logging." msgstr "" -"當系統有支援 :attr:`~SSLContext.keylog_filename` 並且有設定環境變數 :envvar:" -"`SSLKEYLOGFILE` 時 :func:`create_default_context` 會啟用密鑰日誌記錄 " -"(logging)。" +"當系統有支援 :attr:`~SSLContext.keylog_filename` 並且有設定環境變" +"數 :envvar:`SSLKEYLOGFILE` 時 :func:`create_default_context` 會啟用密鑰日誌記" +"錄 (logging)。" #: ../../library/ssl.rst:154 msgid "" -"The default settings for this context include :data:" -"`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. These make the " -"underlying OpenSSL implementation behave more like a conforming " -"implementation of :rfc:`5280`, in exchange for a small amount of " +"The default settings for this context " +"include :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. " +"These make the underlying OpenSSL implementation behave more like a " +"conforming implementation of :rfc:`5280`, in exchange for a small amount of " "incompatibility with older X.509 certificates." msgstr "" @@ -301,8 +303,8 @@ msgstr "" #: ../../library/ssl.rst:165 msgid "" -"If your application needs specific settings, you should create a :class:" -"`SSLContext` and apply the settings yourself." +"If your application needs specific settings, you should create " +"a :class:`SSLContext` and apply the settings yourself." msgstr "" "如果你的應用程式需要特殊的設定,你應該要自行建立一個 :class:`SSLContext` 並自" "行調整設定。" @@ -313,9 +315,9 @@ msgid "" "with a :class:`SSLContext` created by this function that they get an error " "stating \"Protocol or cipher suite mismatch\", it may be that they only " "support SSL3.0 which this function excludes using the :data:`OP_NO_SSLv3`. " -"SSL3.0 is widely considered to be `completely broken `_. If you still wish to continue to use this function but " -"still allow SSL 3.0 connections you can re-enable them using::" +"SSL3.0 is widely considered to be `completely broken `_. If you still wish to continue to use this " +"function but still allow SSL 3.0 connections you can re-enable them using::" msgstr "" "如果你發現某些舊的客戶端或伺服器常適用此函式建立的 :class:`SSLContext` 連線" "時,收到 \"Protocol or cipher suite mismatch\" 錯誤,這可能是因為他們的系統僅" @@ -340,13 +342,12 @@ msgid "" msgstr "" #: ../../library/ssl.rst:187 -#, fuzzy msgid "" "ctx = ssl.create_default_context()\n" "ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" msgstr "" -"ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" -"ctx.options &= ~ssl.OP_NO_SSLv3" +"ctx = ssl.create_default_context()\n" +"ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" #: ../../library/ssl.rst:194 msgid "RC4 was dropped from the default cipher string." @@ -366,16 +367,17 @@ msgstr "增加了 :envvar:`SSLKEYLOGFILE` 對密鑰日誌記錄 (logging) 的支 #: ../../library/ssl.rst:208 msgid "" -"The context now uses :data:`PROTOCOL_TLS_CLIENT` or :data:" -"`PROTOCOL_TLS_SERVER` protocol instead of generic :data:`PROTOCOL_TLS`." +"The context now uses :data:`PROTOCOL_TLS_CLIENT` " +"or :data:`PROTOCOL_TLS_SERVER` protocol instead of " +"generic :data:`PROTOCOL_TLS`." msgstr "" "當前語境使用 :data:`PROTOCOL_TLS_CLIENT` 協定或 :data:`PROTOCOL_TLS_SERVER` " "協定而非通用的 :data:`PROTOCOL_TLS`。" #: ../../library/ssl.rst:214 msgid "" -"The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:" -"`VERIFY_X509_STRICT` in its default verify flags." +"The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` " +"and :data:`VERIFY_X509_STRICT` in its default verify flags." msgstr "" #: ../../library/ssl.rst:219 @@ -392,9 +394,9 @@ msgid "" "OpenSSL library." msgstr "" "引發由底層 SSL 實作(目前由 OpenSSL 函式庫提供)所引發的錯誤訊息。這表示在覆" -"蓋底層網路連線的高階加密和身份驗證層中存在一些問題。這項錯誤是 :exc:" -"`OSError` 的一個子型別。:exc:`SSLError` 實例的錯誤程式代碼和訊息是由 OpenSSL " -"函式庫提供。" +"蓋底層網路連線的高階加密和身份驗證層中存在一些問題。這項錯誤" +"是 :exc:`OSError` 的一個子型別。:exc:`SSLError` 實例的錯誤程式代碼和訊息是由 " +"OpenSSL 函式庫提供。" #: ../../library/ssl.rst:230 msgid ":exc:`SSLError` used to be a subtype of :exc:`socket.error`." @@ -490,16 +492,16 @@ msgstr "隨機產生" #: ../../library/ssl.rst:319 msgid "" -"Return *num* cryptographically strong pseudo-random bytes. Raises an :class:" -"`SSLError` if the PRNG has not been seeded with enough data or if the " -"operation is not supported by the current RAND method. :func:`RAND_status` " -"can be used to check the status of the PRNG and :func:`RAND_add` can be used " -"to seed the PRNG." +"Return *num* cryptographically strong pseudo-random bytes. Raises " +"an :class:`SSLError` if the PRNG has not been seeded with enough data or if " +"the operation is not supported by the current RAND " +"method. :func:`RAND_status` can be used to check the status of the PRNG " +"and :func:`RAND_add` can be used to seed the PRNG." msgstr "" "回傳 *num* 個加密性強的偽隨機位元組。如果 PRNG 未使用足夠的資料做為隨機種子 " -"(seed) 或是目前的 RAND 方法不支持該操作則會導致 :class:`SSLError` 錯誤。:" -"func:`RAND_status` 函式可以用來檢查 PRNG 函式,而 :func:`RAND_add` 則可以用來" -"為 PRNG 設定隨機種子。" +"(seed) 或是目前的 RAND 方法不支持該操作則會導致 :class:`SSLError` 錯" +"誤。:func:`RAND_status` 函式可以用來檢查 PRNG 函式,而 :func:`RAND_add` 則可" +"以用來為 PRNG 設定隨機種子。" #: ../../library/ssl.rst:325 msgid "For almost all applications :func:`os.urandom` is preferable." @@ -512,20 +514,21 @@ msgid "" "Cryptographically_secure_pseudorandom_number_generator>`_, to get the " "requirements of a cryptographically strong generator." msgstr "" -"請閱讀維基百科的\\ `密碼學安全偽隨機數產生器 (CSPRNG) `_\\ 文章來了" -"解密碼學安全偽隨機數產生器的需求。" +"請閱讀維基百科的\\ `密碼學安全偽隨機數產生器 (CSPRNG) `_\\ 文章來了解密碼學" +"安全偽隨機數產生器的需求。" #: ../../library/ssl.rst:336 msgid "" "Return ``True`` if the SSL pseudo-random number generator has been seeded " -"with 'enough' randomness, and ``False`` otherwise. You can use :func:`ssl." -"RAND_egd` and :func:`ssl.RAND_add` to increase the randomness of the pseudo-" -"random number generator." +"with 'enough' randomness, and ``False`` otherwise. You can " +"use :func:`ssl.RAND_egd` and :func:`ssl.RAND_add` to increase the randomness " +"of the pseudo-random number generator." msgstr "" "如果 SSL 偽隨機數產生器已經使用「足夠的」隨機性進行隨機種子生成,則回傳 " -"``True`` ,否則回傳 ``False``。你可以使用 :func:`ssl.RAND_egd` 函式和 :func:" -"`ssl.RAND_add` 函式來增加偽隨機數產生器的隨機性。" +"``True`` ,否則回傳 ``False``。你可以使用 :func:`ssl.RAND_egd` 函式" +"和 :func:`ssl.RAND_add` 函式來增加偽隨機數產生器的隨機性。" #: ../../library/ssl.rst:343 msgid "" @@ -564,18 +567,18 @@ msgstr "以下是一個範例:" msgid "" ">>> import ssl\n" ">>> timestamp = ssl.cert_time_to_seconds(\"Jan 5 09:34:43 2018 GMT\")\n" -">>> timestamp \n" +">>> timestamp\n" "1515144883\n" ">>> from datetime import datetime\n" -">>> print(datetime.utcfromtimestamp(timestamp)) \n" +">>> print(datetime.utcfromtimestamp(timestamp))\n" "2018-01-05 09:34:43" msgstr "" ">>> import ssl\n" ">>> timestamp = ssl.cert_time_to_seconds(\"Jan 5 09:34:43 2018 GMT\")\n" -">>> timestamp \n" +">>> timestamp\n" "1515144883\n" ">>> from datetime import datetime\n" -">>> print(datetime.utcfromtimestamp(timestamp)) \n" +">>> print(datetime.utcfromtimestamp(timestamp))\n" "2018-01-05 09:34:43" #: ../../library/ssl.rst:377 @@ -598,19 +601,19 @@ msgid "" "PEM-encoded string. If ``ssl_version`` is specified, uses that version of " "the SSL protocol to attempt to connect to the server. If *ca_certs* is " "specified, it should be a file containing a list of root certificates, the " -"same format as used for the *cafile* parameter in :meth:`SSLContext." -"load_verify_locations`. The call will attempt to validate the server " -"certificate against that set of root certificates, and will fail if the " -"validation attempt fails. A timeout can be specified with the ``timeout`` " -"parameter." +"same format as used for the *cafile* parameter " +"in :meth:`SSLContext.load_verify_locations`. The call will attempt to " +"validate the server certificate against that set of root certificates, and " +"will fail if the validation attempt fails. A timeout can be specified with " +"the ``timeout`` parameter." msgstr "" "輸入使用 SSL 保護的伺服器的地址 ``addr``,輸入形式為一個 pair (*hostname*, " "*port-number*),獲取該伺服器的憑證,並以 PEM 編碼字串的形式回傳。如果指定了 " "``ssl_version``,則使用指定的 SSL 協議來嘗試與伺服器連線。如果指定 " -"*ca_certs*,則它應該是一個包含根憑證列表的檔案,並與 :meth:`SSLContext." -"load_verify_locations` 中的參數 *cafile* 所使用的格式相同。此呼叫將嘗試使用該" -"組根憑證對伺服器憑證進行驗證,如果驗證失敗,呼叫將失敗。可以使用 ``timeout`` " -"參數指定超時時間。" +"*ca_certs*,則它應該是一個包含根憑證列表的檔案,並" +"與 :meth:`SSLContext.load_verify_locations` 中的參數 *cafile* 所使用的格式相" +"同。此呼叫將嘗試使用該組根憑證對伺服器憑證進行驗證,如果驗證失敗,呼叫將失" +"敗。可以使用 ``timeout`` 參數指定超時時間。" #: ../../library/ssl.rst:399 msgid "This function is now IPv6-compatible." @@ -618,11 +621,11 @@ msgstr "此函式現在是與 IPv6 相容的。" #: ../../library/ssl.rst:402 msgid "" -"The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` to :data:" -"`PROTOCOL_TLS` for maximum compatibility with modern servers." +"The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` " +"to :data:`PROTOCOL_TLS` for maximum compatibility with modern servers." msgstr "" -"預設的 *ssl_version* 已經從 :data:`PROTOCOL_SSLv3` 改為 :data:" -"`PROTOCOL_TLS`,已確保與現今的伺服器有最大的相容性。" +"預設的 *ssl_version* 已經從 :data:`PROTOCOL_SSLv3` 改" +"為 :data:`PROTOCOL_TLS`,已確保與現今的伺服器有最大的相容性。" #: ../../library/ssl.rst:406 msgid "The *timeout* parameter was added." @@ -649,9 +652,9 @@ msgid "" "paths are the same as used by :meth:`SSLContext.set_default_verify_paths`. " "The return value is a :term:`named tuple` ``DefaultVerifyPaths``:" msgstr "" -"回傳一個具有 OpenSSL 的預設 cafile 和 capath 路徑的附名元組。這些路徑與 :" -"meth:`SSLContext.set_default_verify_paths` 使用的相同。回傳值是一個 :term:" -"`named tuple` ``DefaultVerifyPaths``:" +"回傳一個具有 OpenSSL 的預設 cafile 和 capath 路徑的附名元組。這些路徑" +"與 :meth:`SSLContext.set_default_verify_paths` 使用的相同。回傳值是一" +"個 :term:`named tuple` ``DefaultVerifyPaths``:" #: ../../library/ssl.rst:426 msgid "" @@ -697,15 +700,17 @@ msgstr "" #: ../../library/ssl.rst:441 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " -"The encoding_type specifies the encoding of cert_bytes. It is either :const:" -"`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for PKCS#7 ASN.1 " -"data. Trust specifies the purpose of the certificate as a set of OIDS or " -"exactly ``True`` if the certificate is trustworthy for all purposes." +"The encoding_type specifies the encoding of cert_bytes. It is " +"either :const:`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for " +"PKCS#7 ASN.1 data. Trust specifies the purpose of the certificate as a set " +"of OIDS or exactly ``True`` if the certificate is trustworthy for all " +"purposes." msgstr "" "此函式會回傳一個元組 (cert_bytes, encoding_type, trust) 串列。encoding_type " -"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料的 :const:" -"`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。Trust 通過一" -"組 OIDS 來指定憑證的用途,或是如果憑證對所有用途都可以使用則回傳 ``True``。" +"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料" +"的 :const:`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" +"Trust 通過一組 OIDS 來指定憑證的用途,或是如果憑證對所有用途都可以使用則回傳 " +"``True``。" #: ../../library/ssl.rst:448 ../../library/ssl.rst:1599 #: ../../library/ssl.rst:1898 @@ -733,12 +738,13 @@ msgstr "" #: ../../library/ssl.rst:464 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " -"The encoding_type specifies the encoding of cert_bytes. It is either :const:" -"`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for PKCS#7 ASN.1 data." +"The encoding_type specifies the encoding of cert_bytes. It is " +"either :const:`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for " +"PKCS#7 ASN.1 data." msgstr "" "此函式會回傳一個元組 (cert_bytes, encoding_type, trust) 串列。encoding_type " -"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料的 :const:" -"`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" +"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料" +"的 :const:`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" #: ../../library/ssl.rst:475 msgid "Constants" @@ -753,10 +759,11 @@ msgstr "" #: ../../library/ssl.rst:483 msgid "" -"Possible value for :attr:`SSLContext.verify_mode`. Except for :const:" -"`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side sockets, " -"just about any cert is accepted. Validation errors, such as untrusted or " -"expired cert, are ignored and do not abort the TLS/SSL handshake." +"Possible value for :attr:`SSLContext.verify_mode`. Except " +"for :const:`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side " +"sockets, just about any cert is accepted. Validation errors, such as " +"untrusted or expired cert, are ignored and do not abort the TLS/SSL " +"handshake." msgstr "" ":attr:`SSLContext.verify_mode` 可能的值。除了 :attr:`SSLContext.verify_mode` " "外,這是預設的模式。對於客戶端的 sockets,幾乎任何憑證都能被允許。驗證錯誤," @@ -776,13 +783,14 @@ msgstr "參閱下方 :ref:`ssl-security` 的討論。" #: ../../library/ssl.rst:496 msgid "" -"Possible value for :attr:`SSLContext.verify_mode`. In client mode, :const:" -"`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. It is " -"recommended to use :const:`CERT_REQUIRED` for client-side sockets instead." +"Possible value for :attr:`SSLContext.verify_mode`. In client " +"mode, :const:`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. " +"It is recommended to use :const:`CERT_REQUIRED` for client-side sockets " +"instead." msgstr "" -":attr:`SSLContext.verify_mode` 可能的值。在客戶端模式下,:const:" -"`CERT_OPTIONAL` 具有與 :const:`CERT_REQUIRED` 相同的含意。對於客戶端 sockets " -"推薦改用 :const:`CERT_REQUIRED`。" +":attr:`SSLContext.verify_mode` 可能的值。在客戶端模式" +"下,:const:`CERT_OPTIONAL` 具有與 :const:`CERT_REQUIRED` 相同的含意。對於客戶" +"端 sockets 推薦改用 :const:`CERT_REQUIRED`。" #: ../../library/ssl.rst:501 msgid "" @@ -798,29 +806,30 @@ msgstr "" #: ../../library/ssl.rst:507 ../../library/ssl.rst:526 msgid "" -"Use of this setting requires a valid set of CA certificates to be passed to :" -"meth:`SSLContext.load_verify_locations`." +"Use of this setting requires a valid set of CA certificates to be passed " +"to :meth:`SSLContext.load_verify_locations`." msgstr "" -"使用此設定需要將一組有效的 CA 憑證傳送給 :meth:`SSLContext." -"load_verify_locations`。" +"使用此設定需要將一組有效的 CA 憑證傳送" +"給 :meth:`SSLContext.load_verify_locations`。" #: ../../library/ssl.rst:512 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In this mode, " -"certificates are required from the other side of the socket connection; an :" -"class:`SSLError` will be raised if no certificate is provided, or if its " +"certificates are required from the other side of the socket connection; " +"an :class:`SSLError` will be raised if no certificate is provided, or if its " "validation fails. This mode is **not** sufficient to verify a certificate in " -"client mode as it does not match hostnames. :attr:`~SSLContext." -"check_hostname` must be enabled as well to verify the authenticity of a " -"cert. :const:`PROTOCOL_TLS_CLIENT` uses :const:`CERT_REQUIRED` and enables :" -"attr:`~SSLContext.check_hostname` by default." +"client mode as it does not match " +"hostnames. :attr:`~SSLContext.check_hostname` must be enabled as well to " +"verify the authenticity of a cert. :const:`PROTOCOL_TLS_CLIENT` " +"uses :const:`CERT_REQUIRED` and enables :attr:`~SSLContext.check_hostname` " +"by default." msgstr "" ":attr:`SSLContext.verify_mode` 可能的值。在這個模式下,需要從 socket 連線的另" "一端獲取憑證;如果未提供憑證或是驗證失敗,則將會導致 :class:`SSLError`。此模" -"式 **不能** 在客戶端模式下對憑證進行驗證,因為它無法去配對主機名稱。:attr:" -"`~SSLContext.check_hostname` 也必須被開起來來驗證憑證的真實性。:const:" -"`PROTOCOL_TLS_CLIENT` 會使用 :const:`CERT_REQUIRED` 並預設開啟 :attr:" -"`~SSLContext.check_hostname`。" +"式 **不能** 在客戶端模式下對憑證進行驗證,因為它無法去配對主機名" +"稱。:attr:`~SSLContext.check_hostname` 也必須被開起來來驗證憑證的真實" +"性。:const:`PROTOCOL_TLS_CLIENT` 會使用 :const:`CERT_REQUIRED` 並預設開" +"啟 :attr:`~SSLContext.check_hostname`。" #: ../../library/ssl.rst:522 msgid "" @@ -849,8 +858,8 @@ msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, only the " "peer cert is checked but none of the intermediate CA certificates. The mode " "requires a valid CRL that is signed by the peer cert's issuer (its direct " -"ancestor CA). If no proper CRL has been loaded with :attr:`SSLContext." -"load_verify_locations`, validation will fail." +"ancestor CA). If no proper CRL has been loaded " +"with :attr:`SSLContext.load_verify_locations`, validation will fail." msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。在此模式下,只會檢查同等的憑證而不" "會去檢查中間的 CA 憑證。此模式需要提供由對等憑證發行者 (它的直接上級 CA) 的有" @@ -916,8 +925,8 @@ msgstr "" #: ../../library/ssl.rst:608 msgid "" "TLS clients and servers require different default settings for secure " -"communication. The generic TLS protocol constant is deprecated in favor of :" -"data:`PROTOCOL_TLS_CLIENT` and :data:`PROTOCOL_TLS_SERVER`." +"communication. The generic TLS protocol constant is deprecated in favor " +"of :data:`PROTOCOL_TLS_CLIENT` and :data:`PROTOCOL_TLS_SERVER`." msgstr "" "TLS 的客戶端及伺服器端需要不同的預設值來實現安全通訊。通用的 TLS 協定常數已被" "廢除,並改用 :data:`PROTOCOL_TLS_CLIENT` 和 :data:`PROTOCOL_TLS_SERVER`。" @@ -963,13 +972,13 @@ msgstr "第三版的 SSL 是不安全的,強烈建議不要使用。" #: ../../library/ssl.rst:649 msgid "" "OpenSSL has deprecated all version specific protocols. Use the default " -"protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` with :" -"attr:`SSLContext.minimum_version` and :attr:`SSLContext.maximum_version` " -"instead." +"protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` " +"with :attr:`SSLContext.minimum_version` " +"and :attr:`SSLContext.maximum_version` instead." msgstr "" -"OpenSSL 已經終止了所有特定版本的協定。請改用預設的 :data:" -"`PROTOCOL_TLS_SERVER` 協定或帶有 :attr:`SSLContext.minimum_version` 和 :attr:" -"`SSLContext.maximum_version` 的 :data:`PROTOCOL_TLS_CLIENT`。" +"OpenSSL 已經終止了所有特定版本的協定。請改用預設" +"的 :data:`PROTOCOL_TLS_SERVER` 協定或帶有 :attr:`SSLContext.minimum_version` " +"和 :attr:`SSLContext.maximum_version` 的 :data:`PROTOCOL_TLS_CLIENT`。" #: ../../library/ssl.rst:657 msgid "Selects TLS version 1.0 as the channel encryption protocol." @@ -1042,11 +1051,13 @@ msgstr "" #: ../../library/ssl.rst:725 msgid "" -"The option is deprecated since OpenSSL 1.1.0, use the new :attr:`SSLContext." -"minimum_version` and :attr:`SSLContext.maximum_version` instead." +"The option is deprecated since OpenSSL 1.1.0, use the " +"new :attr:`SSLContext.minimum_version` " +"and :attr:`SSLContext.maximum_version` instead." msgstr "" -"該選項自從 OpenSSL 1.1.0 以後已被棄用,請改用新的 :attr:`SSLContext." -"minimum_version` 及 :attr:`SSLContext.maximum_version` 代替。" +"該選項自從 OpenSSL 1.1.0 以後已被棄用,請改用新" +"的 :attr:`SSLContext.minimum_version` 及 :attr:`SSLContext.maximum_version` " +"代替。" #: ../../library/ssl.rst:732 msgid "" @@ -1196,16 +1207,16 @@ msgid "" "Whether the OpenSSL library has built-in support for the *Application-Layer " "Protocol Negotiation* TLS extension as described in :rfc:`7301`." msgstr "" -"OpenSSL 函式庫是否內建支援 *應用層協定協商* TLS 擴充套件,該擴充套件描述在 :" -"rfc:`7301` 中。" +"OpenSSL 函式庫是否內建支援 *應用層協定協商* TLS 擴充套件,該擴充套件描述" +"在 :rfc:`7301` 中。" #: ../../library/ssl.rst:864 msgid "" "Whether the OpenSSL library has built-in support not checking subject common " "name and :attr:`SSLContext.hostname_checks_common_name` is writeable." msgstr "" -"OpenSSL 函式庫是否內建支援不檢查主題通用名稱及 :attr:`SSLContext." -"hostname_checks_common_name` 是否可寫。" +"OpenSSL 函式庫是否內建支援不檢查主題通用名稱" +"及 :attr:`SSLContext.hostname_checks_common_name` 是否可寫。" #: ../../library/ssl.rst:872 msgid "" @@ -1268,17 +1279,16 @@ msgid "" msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.3 協定。" #: ../../library/ssl.rst:933 -#, fuzzy msgid "Whether the OpenSSL library has built-in support for TLS-PSK." -msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.0 協定。" +msgstr "此 OpenSSL 函式庫是否內建支援 TLS-PSK。" #: ../../library/ssl.rst:939 msgid "" "List of supported TLS channel binding types. Strings in this list can be " "used as arguments to :meth:`SSLSocket.get_channel_binding`." msgstr "" -"支援的 TLS 通道綁定類型列表。列表中的字串可以作為 :meth:`SSLSocket." -"get_channel_binding` 的參數。" +"支援的 TLS 通道綁定類型列表。列表中的字串可以作" +"為 :meth:`SSLSocket.get_channel_binding` 的參數。" #: ../../library/ssl.rst:946 msgid "The version string of the OpenSSL library loaded by the interpreter::" @@ -1329,14 +1339,14 @@ msgid "" "parameters-6>`_ contains this list and references to the RFCs where their " "meaning is defined." msgstr "" -"來自 :rfc:`5246` 和其他文檔的警報描述。`IANA TLS Alert Registry `_ 包" -"含了此列表以及其含義定義所在的 RFC 的引用。" +"來自 :rfc:`5246` 和其他文檔的警報描述。`IANA TLS Alert Registry `_ 包含了此列表以及其含義定義所在的 RFC 的引用。" #: ../../library/ssl.rst:982 msgid "" -"Used as the return value of the callback function in :meth:`SSLContext." -"set_servername_callback`." +"Used as the return value of the callback function " +"in :meth:`SSLContext.set_servername_callback`." msgstr "" "被用來做為 :meth:`SSLContext.set_servername_callback` 中回呼函式的回傳值。" @@ -1346,20 +1356,20 @@ msgstr ":class:`enum.IntEnum` 為 ALERT_DESCRIPTION_* 常數中的一個集合 #: ../../library/ssl.rst:995 msgid "" -"Option for :func:`create_default_context` and :meth:`SSLContext." -"load_default_certs`. This value indicates that the context may be used to " -"authenticate web servers (therefore, it will be used to create client-side " -"sockets)." +"Option for :func:`create_default_context` " +"and :meth:`SSLContext.load_default_certs`. This value indicates that the " +"context may be used to authenticate web servers (therefore, it will be used " +"to create client-side sockets)." msgstr "" ":func:`create_default_context` 和 :meth:`SSLContext.load_default_certs` 的選" "項。此值表示該語境可能會用於驗證網頁伺服器 (因此它將用於建立用戶端 socket)。" #: ../../library/ssl.rst:1004 msgid "" -"Option for :func:`create_default_context` and :meth:`SSLContext." -"load_default_certs`. This value indicates that the context may be used to " -"authenticate web clients (therefore, it will be used to create server-side " -"sockets)." +"Option for :func:`create_default_context` " +"and :meth:`SSLContext.load_default_certs`. This value indicates that the " +"context may be used to authenticate web clients (therefore, it will be used " +"to create server-side sockets)." msgstr "" ":func:`create_default_context` 和 :meth:`SSLContext.load_default_certs` 的選" "項。此值表示該語境可能會用於驗證網頁用戶端 (因此,它將用於建立伺服器端的 " @@ -1371,11 +1381,13 @@ msgstr ":class:`enum.IntEnum` 為 SSL_ERROR_* 常數中的一個集合。" #: ../../library/ssl.rst:1019 msgid "" -":class:`enum.IntEnum` collection of SSL and TLS versions for :attr:" -"`SSLContext.maximum_version` and :attr:`SSLContext.minimum_version`." +":class:`enum.IntEnum` collection of SSL and TLS versions " +"for :attr:`SSLContext.maximum_version` " +"and :attr:`SSLContext.minimum_version`." msgstr "" -"用於 :attr:`SSLContext.maximum_version` 和 :attr:`SSLContext." -"minimum_version` 的 SSL 和 TLS 版本 :class:`enum.IntEnum` 集合。" +"用於 :attr:`SSLContext.maximum_version` " +"和 :attr:`SSLContext.minimum_version` 的 SSL 和 TLS 版" +"本 :class:`enum.IntEnum` 集合。" #: ../../library/ssl.rst:1027 msgid "" @@ -1392,11 +1404,11 @@ msgstr "SSL 3.0 到 TLS 1.3。" #: ../../library/ssl.rst:1041 msgid "" -"All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` and :attr:" -"`TLSVersion.TLSv1_3` are deprecated." +"All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` " +"and :attr:`TLSVersion.TLSv1_3` are deprecated." msgstr "" -"除了 :attr:`TLSVersion.TLSv1_2` 和 :attr:`TLSVersion.TLSv1_3` 之外,所有的 :" -"class:`TLSVersion` 成員都已被棄用。" +"除了 :attr:`TLSVersion.TLSv1_2` 和 :attr:`TLSVersion.TLSv1_3` 之外,所有" +"的 :class:`TLSVersion` 成員都已被棄用。" #: ../../library/ssl.rst:1046 msgid "SSL Sockets" @@ -1439,12 +1451,8 @@ msgid ":meth:`~socket.socket.getsockopt`, :meth:`~socket.socket.setsockopt`" msgstr ":meth:`~socket.socket.getsockopt`、:meth:`~socket.socket.setsockopt`" #: ../../library/ssl.rst:1060 -msgid "" -":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:" -"`~socket.socket.setblocking`" -msgstr "" -":meth:`~socket.socket.gettimeout`、:meth:`~socket.socket.settimeout`、:meth:" -"`~socket.socket.setblocking`" +msgid ":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:`~socket.socket.setblocking`" +msgstr ":meth:`~socket.socket.gettimeout`、:meth:`~socket.socket.settimeout`、:meth:`~socket.socket.setblocking`" #: ../../library/ssl.rst:1062 msgid ":meth:`~socket.socket.listen`" @@ -1495,8 +1503,8 @@ msgstr "" #: ../../library/ssl.rst:1077 msgid "" -"Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." -"wrap_socket` method." +"Instances of :class:`SSLSocket` must be created using " +"the :meth:`SSLContext.wrap_socket` method." msgstr "" ":class:`SSLSocket` 的實例必須使用 :meth:`SSLContext.wrap_socket` 方法建立。" @@ -1515,17 +1523,18 @@ msgstr "" #: ../../library/ssl.rst:1088 msgid "" -"It is deprecated to create a :class:`SSLSocket` instance directly, use :meth:" -"`SSLContext.wrap_socket` to wrap a socket." +"It is deprecated to create a :class:`SSLSocket` instance directly, " +"use :meth:`SSLContext.wrap_socket` to wrap a socket." msgstr "" -"直接建立 :class:`SSLSocket` 實例的方式已被棄用,請使用 :meth:`SSLContext." -"wrap_socket` 來包裝 socket。" +"直接建立 :class:`SSLSocket` 實例的方式已被棄用,請使" +"用 :meth:`SSLContext.wrap_socket` 來包裝 socket。" #: ../../library/ssl.rst:1092 msgid "" -":class:`SSLSocket` instances must to created with :meth:`~SSLContext." -"wrap_socket`. In earlier versions, it was possible to create instances " -"directly. This was never documented or officially supported." +":class:`SSLSocket` instances must to created " +"with :meth:`~SSLContext.wrap_socket`. In earlier versions, it was possible " +"to create instances directly. This was never documented or officially " +"supported." msgstr "" ":class:`SSLSocket` 實例必須使用 :meth:`~SSLContext.wrap_socket` 建立。在較早" "的版本中可以直接建立實例,但這從未被記錄或正式支援。" @@ -1554,11 +1563,12 @@ msgstr "" #: ../../library/ssl.rst:1111 msgid "" -"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" -"ref:`non-blocking ` and the read would block." +"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket " +"is :ref:`non-blocking ` and the read would block." msgstr "" -"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" -"`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且讀取操作將會被阻塞。" +"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引" +"發 :exc:`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且讀取操作將會被阻" +"塞。" #: ../../library/ssl.rst:1114 msgid "" @@ -1590,11 +1600,12 @@ msgstr "" #: ../../library/ssl.rst:1130 msgid "" -"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" -"ref:`non-blocking ` and the write would block." +"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket " +"is :ref:`non-blocking ` and the write would block." msgstr "" -"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" -"`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且寫入操作將會被阻塞。" +"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引" +"發 :exc:`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且寫入操作將會被阻" +"塞。" #: ../../library/ssl.rst:1133 msgid "" @@ -1620,8 +1631,8 @@ msgid "" "The :meth:`~SSLSocket.read` and :meth:`~SSLSocket.write` methods are the low-" "level methods that read and write unencrypted, application-level data and " "decrypt/encrypt it to encrypted, wire-level data. These methods require an " -"active SSL connection, i.e. the handshake was completed and :meth:`SSLSocket." -"unwrap` was not called." +"active SSL connection, i.e. the handshake was completed " +"and :meth:`SSLSocket.unwrap` was not called." msgstr "" ":meth:`~SSLSocket.read` 和 :meth:`~SSLSocket.write` 方法為低階層的方法,負責" "讀取和寫入未加密的應用層資料,並將其加密/解密為加密的寫入層資料。這些方法需要" @@ -1629,8 +1640,9 @@ msgstr "" #: ../../library/ssl.rst:1151 msgid "" -"Normally you should use the socket API methods like :meth:`~socket.socket." -"recv` and :meth:`~socket.socket.send` instead of these methods." +"Normally you should use the socket API methods " +"like :meth:`~socket.socket.recv` and :meth:`~socket.socket.send` instead of " +"these methods." msgstr "" "通常你應該使用像 :meth:`~socket.socket.recv` 和 :meth:`~socket.socket.send` " "這樣的 socket API 方法,而不是直接使用這些方法。" @@ -1641,12 +1653,13 @@ msgstr "執行 SSL 設定握手。" #: ../../library/ssl.rst:1159 msgid "" -"The handshake method also performs :func:`match_hostname` when the :attr:" -"`~SSLContext.check_hostname` attribute of the socket's :attr:`~SSLSocket." -"context` is true." +"The handshake method also performs :func:`match_hostname` when " +"the :attr:`~SSLContext.check_hostname` attribute of the " +"socket's :attr:`~SSLSocket.context` is true." msgstr "" -"當 socket 的 :attr:`~SSLSocket.context` 的 :attr:`~SSLContext." -"check_hostname` 屬性質為 true 時,握手方法也會執行 :func:`match_hostname`。" +"當 socket 的 :attr:`~SSLSocket.context` " +"的 :attr:`~SSLContext.check_hostname` 屬性質為 true 時,握手方法也會執" +"行 :func:`match_hostname`。" #: ../../library/ssl.rst:1164 msgid "" @@ -1658,23 +1671,23 @@ msgstr "" #: ../../library/ssl.rst:1168 msgid "" -"Hostname or IP address is matched by OpenSSL during handshake. The function :" -"func:`match_hostname` is no longer used. In case OpenSSL refuses a hostname " -"or IP address, the handshake is aborted early and a TLS alert message is " -"sent to the peer." +"Hostname or IP address is matched by OpenSSL during handshake. The " +"function :func:`match_hostname` is no longer used. In case OpenSSL refuses a " +"hostname or IP address, the handshake is aborted early and a TLS alert " +"message is sent to the peer." msgstr "" -"在握手過程中,OpenSSL 會去配對主機名稱或 IP 地址。已不再使用 :func:" -"`match_hostname` 函式。如果 OpenSSL 拒絕某個主機名稱或 IP 地址,握手將會提前" -"中止,並向對方發送 TLS 警報訊息。" +"在握手過程中,OpenSSL 會去配對主機名稱或 IP 地址。已不再使" +"用 :func:`match_hostname` 函式。如果 OpenSSL 拒絕某個主機名稱或 IP 地址,握手" +"將會提前中止,並向對方發送 TLS 警報訊息。" #: ../../library/ssl.rst:1176 msgid "" "If there is no certificate for the peer on the other end of the connection, " -"return ``None``. If the SSL handshake hasn't been done yet, raise :exc:" -"`ValueError`." +"return ``None``. If the SSL handshake hasn't been done yet, " +"raise :exc:`ValueError`." msgstr "" -"如果連線端沒有證書,則回傳 ``None``。如果 SSL 握手尚未完成,則引發 :exc:" -"`ValueError`。" +"如果連線端沒有證書,則回傳 ``None``。如果 SSL 握手尚未完成,則引" +"發 :exc:`ValueError`。" #: ../../library/ssl.rst:1180 msgid "" @@ -1755,8 +1768,8 @@ msgid "" "socket's role:" msgstr "" "如果 ``binary_form`` 參數設定為 :const:`True`,且對等提供了證書,則該方法會" -"以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回傳 :" -"const:`None`。對等是否提供證書取決於 SSL socket 的腳色:" +"以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回" +"傳 :const:`None`。對等是否提供證書取決於 SSL socket 的腳色:" #: ../../library/ssl.rst:1219 msgid "" @@ -1767,13 +1780,13 @@ msgstr "對於客戶端 SSL socket,伺服器將永遠提供證書,無論是 #: ../../library/ssl.rst:1222 msgid "" "for a server SSL socket, the client will only provide a certificate when " -"requested by the server; therefore :meth:`getpeercert` will return :const:" -"`None` if you used :const:`CERT_NONE` (rather than :const:`CERT_OPTIONAL` " -"or :const:`CERT_REQUIRED`)." +"requested by the server; therefore :meth:`getpeercert` will " +"return :const:`None` if you used :const:`CERT_NONE` (rather " +"than :const:`CERT_OPTIONAL` or :const:`CERT_REQUIRED`)." msgstr "" "對於伺服器 SSL socket,客戶端僅在伺服器要求時才會提供證書;因此,如果你使用的" -"是 :const:`CERT_NONE` (而非 :const:`CERT_OPTIONAL` 或 :const:" -"`CERT_REQUIRED`),則 :meth:`getpeercert` 會回傳 :const:`None`。" +"是 :const:`CERT_NONE` (而非 :const:`CERT_OPTIONAL` " +"或 :const:`CERT_REQUIRED`),則 :meth:`getpeercert` 會回傳 :const:`None`。" #: ../../library/ssl.rst:1227 msgid "See also :attr:`SSLContext.check_hostname`." @@ -1849,17 +1862,18 @@ msgstr "" msgid "" "The *cb_type* parameter allow selection of the desired channel binding type. " "Valid channel binding types are listed in the :data:`CHANNEL_BINDING_TYPES` " -"list. Currently only the 'tls-unique' channel binding, defined by :rfc:" -"`5929`, is supported. :exc:`ValueError` will be raised if an unsupported " -"channel binding type is requested." +"list. Currently only the 'tls-unique' channel binding, defined " +"by :rfc:`5929`, is supported. :exc:`ValueError` will be raised if an " +"unsupported channel binding type is requested." msgstr "" #: ../../library/ssl.rst:1299 msgid "" -"Return the protocol that was selected during the TLS handshake. If :meth:" -"`SSLContext.set_alpn_protocols` was not called, if the other party does not " -"support ALPN, if this socket does not support any of the client's proposed " -"protocols, or if the handshake has not happened yet, ``None`` is returned." +"Return the protocol that was selected during the TLS handshake. " +"If :meth:`SSLContext.set_alpn_protocols` was not called, if the other party " +"does not support ALPN, if this socket does not support any of the client's " +"proposed protocols, or if the handshake has not happened yet, ``None`` is " +"returned." msgstr "" #: ../../library/ssl.rst:1309 @@ -1887,8 +1901,8 @@ msgstr "" msgid "" "Requests post-handshake authentication (PHA) from a TLS 1.3 client. PHA can " "only be initiated for a TLS 1.3 connection from a server-side socket, after " -"the initial TLS handshake and with PHA enabled on both sides, see :attr:" -"`SSLContext.post_handshake_auth`." +"the initial TLS handshake and with PHA enabled on both sides, " +"see :attr:`SSLContext.post_handshake_auth`." msgstr "" #: ../../library/ssl.rst:1335 @@ -1900,8 +1914,8 @@ msgstr "" #: ../../library/ssl.rst:1339 msgid "" -"If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), an :exc:" -"`SSLError` is raised." +"If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), " +"an :exc:`SSLError` is raised." msgstr "" #: ../../library/ssl.rst:1343 @@ -1945,16 +1959,16 @@ msgstr "" msgid "" "The attribute is now always ASCII text. When ``server_hostname`` is an " "internationalized domain name (IDN), this attribute now stores the A-label " -"form (``\"xn--pythn-mua.org\"``), rather than the U-label form (``\"pythön." -"org\"``)." +"form (``\"xn--pythn-mua.org\"``), rather than the U-label form " +"(``\"pythön.org\"``)." msgstr "" #: ../../library/ssl.rst:1391 msgid "" "The :class:`SSLSession` for this SSL connection. The session is available " "for client and server side sockets after the TLS handshake has been " -"performed. For client sockets the session can be set before :meth:" -"`~SSLSocket.do_handshake` has been called to reuse a session." +"performed. For client sockets the session can be set " +"before :meth:`~SSLSocket.do_handshake` has been called to reuse a session." msgstr "" #: ../../library/ssl.rst:1404 @@ -2084,28 +2098,27 @@ msgstr "" #: ../../library/ssl.rst:1453 msgid "" -"The context is created with secure default values. The options :data:" -"`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:" -"`OP_SINGLE_DH_USE`, :data:`OP_SINGLE_ECDH_USE`, :data:`OP_NO_SSLv2`, and :" -"data:`OP_NO_SSLv3` (except for :data:`PROTOCOL_SSLv3`) are set by default. " -"The initial cipher suite list contains only ``HIGH`` ciphers, no ``NULL`` " -"ciphers and no ``MD5`` ciphers." +"The context is created with secure default values. The " +"options :data:`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:`OP_SINGLE_DH_USE`, :data:`OP_SINGLE_ECDH_USE`, :data:`OP_NO_SSLv2`, " +"and :data:`OP_NO_SSLv3` (except for :data:`PROTOCOL_SSLv3`) are set by " +"default. The initial cipher suite list contains only ``HIGH`` ciphers, no " +"``NULL`` ciphers and no ``MD5`` ciphers." msgstr "" #: ../../library/ssl.rst:1463 msgid "" ":class:`SSLContext` without protocol argument is deprecated. The context " -"class will either require :data:`PROTOCOL_TLS_CLIENT` or :data:" -"`PROTOCOL_TLS_SERVER` protocol in the future." +"class will either require :data:`PROTOCOL_TLS_CLIENT` " +"or :data:`PROTOCOL_TLS_SERVER` protocol in the future." msgstr "" #: ../../library/ssl.rst:1469 msgid "" "The default cipher suites now include only secure AES and ChaCha20 ciphers " "with forward secrecy and security level 2. RSA and DH keys with less than " -"2048 bits and ECC keys with less than 224 bits are prohibited. :data:" -"`PROTOCOL_TLS`, :data:`PROTOCOL_TLS_CLIENT`, and :data:`PROTOCOL_TLS_SERVER` " -"use TLS 1.2 as minimum TLS version." +"2048 bits and ECC keys with less than 224 bits are " +"prohibited. :data:`PROTOCOL_TLS`, :data:`PROTOCOL_TLS_CLIENT`, " +"and :data:`PROTOCOL_TLS_SERVER` use TLS 1.2 as minimum TLS version." msgstr "" #: ../../library/ssl.rst:1477 @@ -2190,9 +2203,9 @@ msgstr "" msgid "" "Load a set of default \"certification authority\" (CA) certificates from " "default locations. On Windows it loads CA certs from the ``CA`` and ``ROOT`` " -"system stores. On all systems it calls :meth:`SSLContext." -"set_default_verify_paths`. In the future the method may load CA certificates " -"from other locations, too." +"system stores. On all systems it " +"calls :meth:`SSLContext.set_default_verify_paths`. In the future the method " +"may load CA certificates from other locations, too." msgstr "" #: ../../library/ssl.rst:1543 @@ -2207,8 +2220,9 @@ msgstr "" #: ../../library/ssl.rst:1553 msgid "" "Load a set of \"certification authority\" (CA) certificates used to validate " -"other peers' certificates when :data:`verify_mode` is other than :data:" -"`CERT_NONE`. At least one of *cafile* or *capath* must be specified." +"other peers' certificates when :data:`verify_mode` is other " +"than :data:`CERT_NONE`. At least one of *cafile* or *capath* must be " +"specified." msgstr "" #: ../../library/ssl.rst:1557 @@ -2262,8 +2276,8 @@ msgstr "" #: ../../library/ssl.rst:1596 msgid "" -"Get a list of enabled ciphers. The list is in order of cipher priority. See :" -"meth:`SSLContext.set_ciphers`." +"Get a list of enabled ciphers. The list is in order of cipher priority. " +"See :meth:`SSLContext.set_ciphers`." msgstr "" #: ../../library/ssl.rst:1601 @@ -2351,16 +2365,16 @@ msgstr "" #: ../../library/ssl.rst:1653 msgid "" -"TLS 1.3 cipher suites cannot be disabled with :meth:`~SSLContext." -"set_ciphers`." +"TLS 1.3 cipher suites cannot be disabled " +"with :meth:`~SSLContext.set_ciphers`." msgstr "" #: ../../library/ssl.rst:1658 msgid "" "Specify which protocols the socket should advertise during the SSL/TLS " -"handshake. It should be a list of ASCII strings, like ``['http/1.1', " -"'spdy/2']``, ordered by preference. The selection of a protocol will happen " -"during the handshake, and will play out according to :rfc:`7301`. After a " +"handshake. It should be a list of ASCII strings, like ``['http/1.1', 'spdy/" +"2']``, ordered by preference. The selection of a protocol will happen during " +"the handshake, and will play out according to :rfc:`7301`. After a " "successful handshake, the :meth:`SSLSocket.selected_alpn_protocol` method " "will return the agreed-upon protocol." msgstr "" @@ -2378,9 +2392,9 @@ msgid "" "ordered by preference. The selection of a protocol will happen during the " "handshake, and will play out according to the `Application Layer Protocol " "Negotiation `_. After a successful handshake, the :meth:" -"`SSLSocket.selected_npn_protocol` method will return the agreed-upon " -"protocol." +"Layer_Protocol_Negotiation>`_. After a successful handshake, " +"the :meth:`SSLSocket.selected_npn_protocol` method will return the agreed-" +"upon protocol." msgstr "" #: ../../library/ssl.rst:1680 @@ -2417,37 +2431,37 @@ msgstr "" #: ../../library/ssl.rst:1708 msgid "" -"A typical use of this callback is to change the :class:`ssl.SSLSocket`'s :" -"attr:`SSLSocket.context` attribute to a new object of type :class:" -"`SSLContext` representing a certificate chain that matches the server name." +"A typical use of this callback is to change " +"the :class:`ssl.SSLSocket`'s :attr:`SSLSocket.context` attribute to a new " +"object of type :class:`SSLContext` representing a certificate chain that " +"matches the server name." msgstr "" #: ../../library/ssl.rst:1713 msgid "" "Due to the early negotiation phase of the TLS connection, only limited " -"methods and attributes are usable like :meth:`SSLSocket." -"selected_alpn_protocol` and :attr:`SSLSocket.context`. The :meth:`SSLSocket." -"getpeercert`, :meth:`SSLSocket.get_verified_chain`, :meth:`SSLSocket." -"get_unverified_chain` :meth:`SSLSocket.cipher` and :meth:`SSLSocket." -"compression` methods require that the TLS connection has progressed beyond " -"the TLS Client Hello and therefore will not return meaningful values nor can " -"they be called safely." +"methods and attributes are usable " +"like :meth:`SSLSocket.selected_alpn_protocol` and :attr:`SSLSocket.context`. " +"The :meth:`SSLSocket.getpeercert`, :meth:`SSLSocket.get_verified_chain`, :meth:`SSLSocket.get_unverified_chain` :meth:`SSLSocket.cipher` " +"and :meth:`SSLSocket.compression` methods require that the TLS connection " +"has progressed beyond the TLS Client Hello and therefore will not return " +"meaningful values nor can they be called safely." msgstr "" #: ../../library/ssl.rst:1722 msgid "" "The *sni_callback* function must return ``None`` to allow the TLS " -"negotiation to continue. If a TLS failure is required, a constant :const:" -"`ALERT_DESCRIPTION_* ` can be returned. " -"Other return values will result in a TLS fatal error with :const:" -"`ALERT_DESCRIPTION_INTERNAL_ERROR`." +"negotiation to continue. If a TLS failure is required, a " +"constant :const:`ALERT_DESCRIPTION_* ` can " +"be returned. Other return values will result in a TLS fatal error " +"with :const:`ALERT_DESCRIPTION_INTERNAL_ERROR`." msgstr "" #: ../../library/ssl.rst:1728 msgid "" "If an exception is raised from the *sni_callback* function the TLS " -"connection will terminate with a fatal TLS alert message :const:" -"`ALERT_DESCRIPTION_HANDSHAKE_FAILURE`." +"connection will terminate with a fatal TLS alert " +"message :const:`ALERT_DESCRIPTION_HANDSHAKE_FAILURE`." msgstr "" #: ../../library/ssl.rst:1732 @@ -2483,8 +2497,8 @@ msgstr "" #: ../../library/ssl.rst:1759 msgid "" -"This setting doesn't apply to client sockets. You can also use the :data:" -"`OP_SINGLE_DH_USE` option to further improve security." +"This setting doesn't apply to client sockets. You can also use " +"the :data:`OP_SINGLE_DH_USE` option to further improve security." msgstr "" #: ../../library/ssl.rst:1766 @@ -2498,8 +2512,8 @@ msgstr "" #: ../../library/ssl.rst:1772 msgid "" -"This setting doesn't apply to client sockets. You can also use the :data:" -"`OP_SINGLE_ECDH_USE` option to further improve security." +"This setting doesn't apply to client sockets. You can also use " +"the :data:`OP_SINGLE_ECDH_USE` option to further improve security." msgstr "" #: ../../library/ssl.rst:1775 @@ -2518,10 +2532,11 @@ msgstr "" #: ../../library/ssl.rst:1787 msgid "" -"Wrap an existing Python socket *sock* and return an instance of :attr:" -"`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The returned SSL " -"socket is tied to the context, its settings and certificates. *sock* must be " -"a :const:`~socket.SOCK_STREAM` socket; other socket types are unsupported." +"Wrap an existing Python socket *sock* and return an instance " +"of :attr:`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The " +"returned SSL socket is tied to the context, its settings and certificates. " +"*sock* must be a :const:`~socket.SOCK_STREAM` socket; other socket types are " +"unsupported." msgstr "" #: ../../library/ssl.rst:1793 @@ -2537,8 +2552,8 @@ msgid "" "after :meth:`connect` is called on the socket. For server-side sockets, if " "the socket has no remote peer, it is assumed to be a listening socket, and " "the server-side SSL wrapping is automatically performed on client " -"connections accepted via the :meth:`accept` method. The method may raise :" -"exc:`SSLError`." +"connections accepted via the :meth:`accept` method. The method may " +"raise :exc:`SSLError`." msgstr "" #: ../../library/ssl.rst:1804 @@ -2554,20 +2569,20 @@ msgstr "" msgid "" "The parameter ``do_handshake_on_connect`` specifies whether to do the SSL " "handshake automatically after doing a :meth:`socket.connect`, or whether the " -"application program will call it explicitly, by invoking the :meth:" -"`SSLSocket.do_handshake` method. Calling :meth:`SSLSocket.do_handshake` " -"explicitly gives the program control over the blocking behavior of the " -"socket I/O involved in the handshake." +"application program will call it explicitly, by invoking " +"the :meth:`SSLSocket.do_handshake` method. " +"Calling :meth:`SSLSocket.do_handshake` explicitly gives the program control " +"over the blocking behavior of the socket I/O involved in the handshake." msgstr "" #: ../../library/ssl.rst:1817 msgid "" -"The parameter ``suppress_ragged_eofs`` specifies how the :meth:`SSLSocket." -"recv` method should signal unexpected EOF from the other end of the " -"connection. If specified as :const:`True` (the default), it returns a " -"normal EOF (an empty bytes object) in response to unexpected EOF errors " -"raised from the underlying socket; if :const:`False`, it will raise the " -"exceptions back to the caller." +"The parameter ``suppress_ragged_eofs`` specifies how " +"the :meth:`SSLSocket.recv` method should signal unexpected EOF from the " +"other end of the connection. If specified as :const:`True` (the default), " +"it returns a normal EOF (an empty bytes object) in response to unexpected " +"EOF errors raised from the underlying socket; if :const:`False`, it will " +"raise the exceptions back to the caller." msgstr "" #: ../../library/ssl.rst:1824 @@ -2576,8 +2591,8 @@ msgstr "" #: ../../library/ssl.rst:1826 msgid "" -"To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, use :meth:" -"`SSLContext.wrap_bio`." +"To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, " +"use :meth:`SSLContext.wrap_bio`." msgstr "" #: ../../library/ssl.rst:1829 @@ -2598,15 +2613,15 @@ msgstr "" #: ../../library/ssl.rst:1842 msgid "" -"The return type of :meth:`SSLContext.wrap_socket`, defaults to :class:" -"`SSLSocket`. The attribute can be overridden on instance of class in order " -"to return a custom subclass of :class:`SSLSocket`." +"The return type of :meth:`SSLContext.wrap_socket`, defaults " +"to :class:`SSLSocket`. The attribute can be overridden on instance of class " +"in order to return a custom subclass of :class:`SSLSocket`." msgstr "" #: ../../library/ssl.rst:1851 msgid "" -"Wrap the BIO objects *incoming* and *outgoing* and return an instance of :" -"attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " +"Wrap the BIO objects *incoming* and *outgoing* and return an instance " +"of :attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " "routines will read input data from the incoming BIO and write data to the " "outgoing BIO." msgstr "" @@ -2625,9 +2640,9 @@ msgstr "" #: ../../library/ssl.rst:1868 msgid "" -"The return type of :meth:`SSLContext.wrap_bio`, defaults to :class:" -"`SSLObject`. The attribute can be overridden on instance of class in order " -"to return a custom subclass of :class:`SSLObject`." +"The return type of :meth:`SSLContext.wrap_bio`, defaults " +"to :class:`SSLObject`. The attribute can be overridden on instance of class " +"in order to return a custom subclass of :class:`SSLObject`." msgstr "" #: ../../library/ssl.rst:1876 @@ -2652,14 +2667,15 @@ msgstr "" #: ../../library/ssl.rst:1887 msgid "" "Whether to match the peer cert's hostname in :meth:`SSLSocket.do_handshake`. " -"The context's :attr:`~SSLContext.verify_mode` must be set to :data:" -"`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, and you must pass " +"The context's :attr:`~SSLContext.verify_mode` must be set " +"to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, and you must pass " "*server_hostname* to :meth:`~SSLContext.wrap_socket` in order to match the " -"hostname. Enabling hostname checking automatically sets :attr:`~SSLContext." -"verify_mode` from :data:`CERT_NONE` to :data:`CERT_REQUIRED`. It cannot be " -"set back to :data:`CERT_NONE` as long as hostname checking is enabled. The :" -"data:`PROTOCOL_TLS_CLIENT` protocol enables hostname checking by default. " -"With other protocols, hostname checking must be enabled explicitly." +"hostname. Enabling hostname checking automatically " +"sets :attr:`~SSLContext.verify_mode` from :data:`CERT_NONE` " +"to :data:`CERT_REQUIRED`. It cannot be set back to :data:`CERT_NONE` as " +"long as hostname checking is enabled. The :data:`PROTOCOL_TLS_CLIENT` " +"protocol enables hostname checking by default. With other protocols, " +"hostname checking must be enabled explicitly." msgstr "" #: ../../library/ssl.rst:1900 @@ -2688,10 +2704,10 @@ msgstr "" #: ../../library/ssl.rst:1915 msgid "" -":attr:`~SSLContext.verify_mode` is now automatically changed to :data:" -"`CERT_REQUIRED` when hostname checking is enabled and :attr:`~SSLContext." -"verify_mode` is :data:`CERT_NONE`. Previously the same operation would have " -"failed with a :exc:`ValueError`." +":attr:`~SSLContext.verify_mode` is now automatically changed " +"to :data:`CERT_REQUIRED` when hostname checking is enabled " +"and :attr:`~SSLContext.verify_mode` is :data:`CERT_NONE`. Previously the " +"same operation would have failed with a :exc:`ValueError`." msgstr "" #: ../../library/ssl.rst:1922 @@ -2707,18 +2723,20 @@ msgstr "" msgid "" "A :class:`TLSVersion` enum member representing the highest supported TLS " "version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`. The " -"attribute is read-only for protocols other than :const:`PROTOCOL_TLS`, :" -"const:`PROTOCOL_TLS_CLIENT`, and :const:`PROTOCOL_TLS_SERVER`." +"attribute is read-only for protocols other " +"than :const:`PROTOCOL_TLS`, :const:`PROTOCOL_TLS_CLIENT`, " +"and :const:`PROTOCOL_TLS_SERVER`." msgstr "" #: ../../library/ssl.rst:1937 msgid "" -"The attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext." -"minimum_version` and :attr:`SSLContext.options` all affect the supported SSL " -"and TLS versions of the context. The implementation does not prevent invalid " -"combination. For example a context with :attr:`OP_NO_TLSv1_2` in :attr:" -"`~SSLContext.options` and :attr:`~SSLContext.maximum_version` set to :attr:" -"`TLSVersion.TLSv1_2` will not be able to establish a TLS 1.2 connection." +"The " +"attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext.minimum_version` " +"and :attr:`SSLContext.options` all affect the supported SSL and TLS versions " +"of the context. The implementation does not prevent invalid combination. For " +"example a context with :attr:`OP_NO_TLSv1_2` in :attr:`~SSLContext.options` " +"and :attr:`~SSLContext.maximum_version` set to :attr:`TLSVersion.TLSv1_2` " +"will not be able to establish a TLS 1.2 connection." msgstr "" #: ../../library/ssl.rst:1950 @@ -2729,16 +2747,16 @@ msgstr "" #: ../../library/ssl.rst:1957 msgid "" -"Control the number of TLS 1.3 session tickets of a :const:" -"`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 to 1.2 " -"connections." +"Control the number of TLS 1.3 session tickets of " +"a :const:`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 " +"to 1.2 connections." msgstr "" #: ../../library/ssl.rst:1965 msgid "" "An integer representing the set of SSL options enabled on this context. The " -"default value is :data:`OP_ALL`, but you can specify other options such as :" -"data:`OP_NO_SSLv2` by ORing them together." +"default value is :data:`OP_ALL`, but you can specify other options such " +"as :data:`OP_NO_SSLv2` by ORing them together." msgstr "" #: ../../library/ssl.rst:1969 @@ -2748,8 +2766,8 @@ msgstr "" #: ../../library/ssl.rst:1977 msgid "" "All ``OP_NO_SSL*`` and ``OP_NO_TLS*`` options have been deprecated since " -"Python 3.7. Use :attr:`SSLContext.minimum_version` and :attr:`SSLContext." -"maximum_version` instead." +"Python 3.7. Use :attr:`SSLContext.minimum_version` " +"and :attr:`SSLContext.maximum_version` instead." msgstr "" #: ../../library/ssl.rst:1983 @@ -2770,8 +2788,9 @@ msgstr "" msgid "" "When enabled on server-side sockets, :attr:`SSLContext.verify_mode` must be " "set to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, too. The actual " -"client cert exchange is delayed until :meth:`SSLSocket." -"verify_client_post_handshake` is called and some I/O is performed." +"client cert exchange is delayed " +"until :meth:`SSLSocket.verify_client_post_handshake` is called and some I/O " +"is performed." msgstr "" #: ../../library/ssl.rst:2001 @@ -2802,9 +2821,9 @@ msgstr "" #: ../../library/ssl.rst:2027 msgid "" -"The flags for certificate verification operations. You can set flags like :" -"data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default OpenSSL does " -"neither require nor verify certificate revocation lists (CRLs)." +"The flags for certificate verification operations. You can set flags " +"like :data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default " +"OpenSSL does neither require nor verify certificate revocation lists (CRLs)." msgstr "" #: ../../library/ssl.rst:2033 @@ -2814,8 +2833,8 @@ msgstr "" #: ../../library/ssl.rst:2041 msgid "" "Whether to try to verify other peers' certificates and how to behave if " -"verification fails. This attribute must be one of :data:`CERT_NONE`, :data:" -"`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." +"verification fails. This attribute must be one " +"of :data:`CERT_NONE`, :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." msgstr "" #: ../../library/ssl.rst:2045 @@ -2862,9 +2881,8 @@ msgid "client-identity must be a non-empty string." msgstr "" #: ../../library/ssl.rst:2075 ../../library/ssl.rst:2122 -#, fuzzy msgid "Example usage::" -msgstr "範例: ::" +msgstr "範例用法: ::" #: ../../library/ssl.rst:2077 msgid "" @@ -3051,9 +3069,9 @@ msgid "" "certificate chains for each issuer you are willing to trust. Again, this " "file just contains these chains concatenated together. For validation, " "Python will use the first chain it finds in the file which matches. The " -"platform's certificates file can be used by calling :meth:`SSLContext." -"load_default_certs`, this is done automatically with :func:`." -"create_default_context`." +"platform's certificates file can be used by " +"calling :meth:`SSLContext.load_default_certs`, this is done automatically " +"with :func:`.create_default_context`." msgstr "" #: ../../library/ssl.rst:2228 @@ -3200,8 +3218,8 @@ msgstr "" #: ../../library/ssl.rst:2320 msgid "" -"When you use the context to connect to a server, :const:`CERT_REQUIRED` and :" -"attr:`~SSLContext.check_hostname` validate the server certificate: it " +"When you use the context to connect to a server, :const:`CERT_REQUIRED` " +"and :attr:`~SSLContext.check_hostname` validate the server certificate: it " "ensures that the server certificate was signed with one of the CA " "certificates, checks the signature for correctness, and verifies other " "properties like validity and identity of the hostname::" @@ -3237,10 +3255,10 @@ msgid "" "{'OCSP': ('http://ocsp.digicert.com',),\n" " 'caIssuers': ('http://cacerts.digicert.com/" "DigiCertSHA2ExtendedValidationServerCA.crt',),\n" -" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1." -"crl',\n" -" 'http://crl4.digicert.com/sha2-ev-server-g1." -"crl'),\n" +" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-" +"g1.crl',\n" +" 'http://crl4.digicert.com/sha2-ev-server-" +"g1.crl'),\n" " 'issuer': ((('countryName', 'US'),),\n" " (('organizationName', 'DigiCert Inc'),),\n" " (('organizationalUnitName', 'www.digicert.com'),),\n" @@ -3281,10 +3299,10 @@ msgstr "" "{'OCSP': ('http://ocsp.digicert.com',),\n" " 'caIssuers': ('http://cacerts.digicert.com/" "DigiCertSHA2ExtendedValidationServerCA.crt',),\n" -" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1." -"crl',\n" -" 'http://crl4.digicert.com/sha2-ev-server-g1." -"crl'),\n" +" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-" +"g1.crl',\n" +" 'http://crl4.digicert.com/sha2-ev-server-" +"g1.crl'),\n" " 'issuer': ((('countryName', 'US'),),\n" " (('organizationName', 'DigiCert Inc'),),\n" " (('organizationalUnitName', 'www.digicert.com'),),\n" @@ -3405,8 +3423,9 @@ msgstr "" #: ../../library/ssl.rst:2421 msgid "" "When a client connects, you'll call :meth:`accept` on the socket to get the " -"new socket from the other end, and use the context's :meth:`SSLContext." -"wrap_socket` method to create a server-side SSL socket for the connection::" +"new socket from the other end, and use the " +"context's :meth:`SSLContext.wrap_socket` method to create a server-side SSL " +"socket for the connection::" msgstr "" #: ../../library/ssl.rst:2425 @@ -3473,10 +3492,10 @@ msgid "" "Most :class:`SSLSocket` methods will raise either :exc:`SSLWantWriteError` " "or :exc:`SSLWantReadError` instead of :exc:`BlockingIOError` if an I/O " "operation would block. :exc:`SSLWantReadError` will be raised if a read " -"operation on the underlying socket is necessary, and :exc:" -"`SSLWantWriteError` for a write operation on the underlying socket. Note " -"that attempts to *write* to an SSL socket may require *reading* from the " -"underlying socket first, and attempts to *read* from the SSL socket may " +"operation on the underlying socket is necessary, " +"and :exc:`SSLWantWriteError` for a write operation on the underlying socket. " +"Note that attempts to *write* to an SSL socket may require *reading* from " +"the underlying socket first, and attempts to *read* from the SSL socket may " "require a prior *write* to the underlying socket." msgstr "" @@ -3492,8 +3511,8 @@ msgid "" "read from (or written to), but it does not imply that there is sufficient " "data at the upper SSL layer. For example, only part of an SSL frame might " "have arrived. Therefore, you must be ready to handle :meth:`SSLSocket.recv` " -"and :meth:`SSLSocket.send` failures, and retry after another call to :func:" -"`~select.select`." +"and :meth:`SSLSocket.send` failures, and retry after another call " +"to :func:`~select.select`." msgstr "" #: ../../library/ssl.rst:2485 @@ -3507,16 +3526,16 @@ msgstr "" #: ../../library/ssl.rst:2491 msgid "" -"(of course, similar provisions apply when using other primitives such as :" -"func:`~select.poll`, or those in the :mod:`selectors` module)" +"(of course, similar provisions apply when using other primitives such " +"as :func:`~select.poll`, or those in the :mod:`selectors` module)" msgstr "" #: ../../library/ssl.rst:2494 msgid "" -"The SSL handshake itself will be non-blocking: the :meth:`SSLSocket." -"do_handshake` method has to be retried until it returns successfully. Here " -"is a synopsis using :func:`~select.select` to wait for the socket's " -"readiness::" +"The SSL handshake itself will be non-blocking: " +"the :meth:`SSLSocket.do_handshake` method has to be retried until it returns " +"successfully. Here is a synopsis using :func:`~select.select` to wait for " +"the socket's readiness::" msgstr "" #: ../../library/ssl.rst:2499 @@ -3544,9 +3563,9 @@ msgid "" "The :mod:`asyncio` module supports :ref:`non-blocking SSL sockets ` and provides a higher level :ref:`Streams API `. It polls for events using the :mod:`selectors` module and " -"handles :exc:`SSLWantWriteError`, :exc:`SSLWantReadError` and :exc:" -"`BlockingIOError` exceptions. It runs the SSL handshake asynchronously as " -"well." +"handles :exc:`SSLWantWriteError`, :exc:`SSLWantReadError` " +"and :exc:`BlockingIOError` exceptions. It runs the SSL handshake " +"asynchronously as well." msgstr "" #: ../../library/ssl.rst:2519 @@ -3555,8 +3574,8 @@ msgstr "" #: ../../library/ssl.rst:2523 msgid "" -"Ever since the SSL module was introduced in Python 2.6, the :class:" -"`SSLSocket` class has provided two related but distinct areas of " +"Ever since the SSL module was introduced in Python 2.6, " +"the :class:`SSLSocket` class has provided two related but distinct areas of " "functionality:" msgstr "" @@ -3581,11 +3600,11 @@ msgid "" "Combining SSL protocol handling and network IO usually works well, but there " "are some cases where it doesn't. An example is async IO frameworks that want " "to use a different IO multiplexing model than the \"select/poll on a file " -"descriptor\" (readiness based) model that is assumed by :class:`socket." -"socket` and by the internal OpenSSL socket IO routines. This is mostly " -"relevant for platforms like Windows where this model is not efficient. For " -"this purpose, a reduced scope variant of :class:`SSLSocket` called :class:" -"`SSLObject` is provided." +"descriptor\" (readiness based) model that is assumed " +"by :class:`socket.socket` and by the internal OpenSSL socket IO routines. " +"This is mostly relevant for platforms like Windows where this model is not " +"efficient. For this purpose, a reduced scope variant of :class:`SSLSocket` " +"called :class:`SSLObject` is provided." msgstr "" #: ../../library/ssl.rst:2545 @@ -3722,8 +3741,8 @@ msgstr "" #: ../../library/ssl.rst:2595 msgid "" "There is no handling of *suppress_ragged_eofs*. All end-of-file conditions " -"that are in violation of the protocol are reported via the :exc:" -"`SSLEOFError` exception." +"that are in violation of the protocol are reported via " +"the :exc:`SSLEOFError` exception." msgstr "" #: ../../library/ssl.rst:2599 @@ -3734,9 +3753,9 @@ msgstr "" #: ../../library/ssl.rst:2602 msgid "" -"The *server_name_callback* callback passed to :meth:`SSLContext." -"set_servername_callback` will get an :class:`SSLObject` instance instead of " -"a :class:`SSLSocket` instance as its first parameter." +"The *server_name_callback* callback passed " +"to :meth:`SSLContext.set_servername_callback` will get an :class:`SSLObject` " +"instance instead of a :class:`SSLSocket` instance as its first parameter." msgstr "" #: ../../library/ssl.rst:2606 @@ -3746,15 +3765,16 @@ msgstr "" #: ../../library/ssl.rst:2608 msgid "" "All IO on an :class:`SSLObject` is :ref:`non-blocking `. " -"This means that for example :meth:`~SSLSocket.read` will raise an :exc:" -"`SSLWantReadError` if it needs more data than the incoming BIO has available." +"This means that for example :meth:`~SSLSocket.read` will raise " +"an :exc:`SSLWantReadError` if it needs more data than the incoming BIO has " +"available." msgstr "" #: ../../library/ssl.rst:2613 msgid "" -":class:`SSLObject` instances must be created with :meth:`~SSLContext." -"wrap_bio`. In earlier versions, it was possible to create instances " -"directly. This was never documented or officially supported." +":class:`SSLObject` instances must be created " +"with :meth:`~SSLContext.wrap_bio`. In earlier versions, it was possible to " +"create instances directly. This was never documented or officially supported." msgstr "" #: ../../library/ssl.rst:2619 @@ -3824,11 +3844,11 @@ msgstr "" #: ../../library/ssl.rst:2681 msgid "" "For **client use**, if you don't have any special requirements for your " -"security policy, it is highly recommended that you use the :func:" -"`create_default_context` function to create your SSL context. It will load " -"the system's trusted CA certificates, enable certificate validation and " -"hostname checking, and try to choose reasonably secure protocol and cipher " -"settings." +"security policy, it is highly recommended that you use " +"the :func:`create_default_context` function to create your SSL context. It " +"will load the system's trusted CA certificates, enable certificate " +"validation and hostname checking, and try to choose reasonably secure " +"protocol and cipher settings." msgstr "" #: ../../library/ssl.rst:2688 @@ -3853,16 +3873,16 @@ msgstr "" #: ../../library/ssl.rst:2697 msgid "" -"If a client certificate is needed for the connection, it can be added with :" -"meth:`SSLContext.load_cert_chain`." +"If a client certificate is needed for the connection, it can be added " +"with :meth:`SSLContext.load_cert_chain`." msgstr "" #: ../../library/ssl.rst:2700 msgid "" -"By contrast, if you create the SSL context by calling the :class:" -"`SSLContext` constructor yourself, it will not have certificate validation " -"nor hostname checking enabled by default. If you do so, please read the " -"paragraphs below to achieve a good security level." +"By contrast, if you create the SSL context by calling " +"the :class:`SSLContext` constructor yourself, it will not have certificate " +"validation nor hostname checking enabled by default. If you do so, please " +"read the paragraphs below to achieve a good security level." msgstr "" #: ../../library/ssl.rst:2706 @@ -3875,23 +3895,23 @@ msgstr "驗證憑證" #: ../../library/ssl.rst:2711 msgid "" -"When calling the :class:`SSLContext` constructor directly, :const:" -"`CERT_NONE` is the default. Since it does not authenticate the other peer, " -"it can be insecure, especially in client mode where most of the time you " -"would like to ensure the authenticity of the server you're talking to. " -"Therefore, when in client mode, it is highly recommended to use :const:" -"`CERT_REQUIRED`. However, it is in itself not sufficient; you also have to " -"check that the server certificate, which can be obtained by calling :meth:" -"`SSLSocket.getpeercert`, matches the desired service. For many protocols " -"and applications, the service can be identified by the hostname. This common " -"check is automatically performed when :attr:`SSLContext.check_hostname` is " -"enabled." +"When calling the :class:`SSLContext` constructor " +"directly, :const:`CERT_NONE` is the default. Since it does not authenticate " +"the other peer, it can be insecure, especially in client mode where most of " +"the time you would like to ensure the authenticity of the server you're " +"talking to. Therefore, when in client mode, it is highly recommended to " +"use :const:`CERT_REQUIRED`. However, it is in itself not sufficient; you " +"also have to check that the server certificate, which can be obtained by " +"calling :meth:`SSLSocket.getpeercert`, matches the desired service. For " +"many protocols and applications, the service can be identified by the " +"hostname. This common check is automatically performed " +"when :attr:`SSLContext.check_hostname` is enabled." msgstr "" #: ../../library/ssl.rst:2723 msgid "" -"Hostname matchings is now performed by OpenSSL. Python no longer uses :func:" -"`match_hostname`." +"Hostname matchings is now performed by OpenSSL. Python no longer " +"uses :func:`match_hostname`." msgstr "" #: ../../library/ssl.rst:2727 @@ -3910,9 +3930,9 @@ msgstr "協定版本" msgid "" "SSL versions 2 and 3 are considered insecure and are therefore dangerous to " "use. If you want maximum compatibility between clients and servers, it is " -"recommended to use :const:`PROTOCOL_TLS_CLIENT` or :const:" -"`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are disabled " -"by default." +"recommended to use :const:`PROTOCOL_TLS_CLIENT` " +"or :const:`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are " +"disabled by default." msgstr "" #: ../../library/ssl.rst:2743 @@ -3928,9 +3948,9 @@ msgstr "" #: ../../library/ssl.rst:2748 msgid "" "The SSL context created above will only allow TLSv1.3 and later (if " -"supported by your system) connections to a server. :const:" -"`PROTOCOL_TLS_CLIENT` implies certificate validation and hostname checks by " -"default. You have to load certificates into the context." +"supported by your system) connections to a " +"server. :const:`PROTOCOL_TLS_CLIENT` implies certificate validation and " +"hostname checks by default. You have to load certificates into the context." msgstr "" #: ../../library/ssl.rst:2755 @@ -3940,14 +3960,14 @@ msgstr "" #: ../../library/ssl.rst:2757 msgid "" "If you have advanced security requirements, fine-tuning of the ciphers " -"enabled when negotiating a SSL session is possible through the :meth:" -"`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the ssl module " -"disables certain weak ciphers by default, but you may want to further " -"restrict the cipher choice. Be sure to read OpenSSL's documentation about " -"the `cipher list format `_. If you want to check which ciphers are enabled by a given " -"cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl ciphers`` " -"command on your system." +"enabled when negotiating a SSL session is possible through " +"the :meth:`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the " +"ssl module disables certain weak ciphers by default, but you may want to " +"further restrict the cipher choice. Be sure to read OpenSSL's documentation " +"about the `cipher list format `_. If you want to check which ciphers are enabled by a " +"given cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl " +"ciphers`` command on your system." msgstr "" #: ../../library/ssl.rst:2768 @@ -3978,9 +3998,9 @@ msgstr "" #: ../../library/ssl.rst:2789 msgid "" "TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20 " -"cipher suites are enabled by default. The method :meth:`SSLContext." -"set_ciphers` cannot enable or disable any TLS 1.3 ciphers yet, but :meth:" -"`SSLContext.get_ciphers` returns them." +"cipher suites are enabled by default. The " +"method :meth:`SSLContext.set_ciphers` cannot enable or disable any TLS 1.3 " +"ciphers yet, but :meth:`SSLContext.get_ciphers` returns them." msgstr "" #: ../../library/ssl.rst:2793 diff --git a/library/statistics.po b/library/statistics.po index 1337bd2d8f..30c55ed953 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2023-07-22 21:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -47,19 +47,20 @@ msgstr "" #: ../../library/statistics.rst:31 msgid "" -"Unless explicitly noted, these functions support :class:`int`, :class:" -"`float`, :class:`~decimal.Decimal` and :class:`~fractions.Fraction`. " -"Behaviour with other types (whether in the numeric tower or not) is " -"currently unsupported. Collections with a mix of types are also undefined " -"and implementation-dependent. If your input data consists of mixed types, " -"you may be able to use :func:`map` to ensure a consistent result, for " -"example: ``map(float, input_data)``." -msgstr "" -"除非特別註明,這些函數支援 :class:`int`、:class:`float`、:class:`~decimal." -"Decimal` 以及 :class:`~fractions.Fraction`。目前不支援其他型別(無論是否為數" -"值型別)。含有混合型別的資料的集合亦是尚未定義,且取決於該型別的實作。若你的" -"輸入資料含有混合型別,你可以考慮使用 :func:`map` 來確保結果是一致的,例如:" -"``map(float, input_data)``。" +"Unless explicitly noted, these functions " +"support :class:`int`, :class:`float`, :class:`~decimal.Decimal` " +"and :class:`~fractions.Fraction`. Behaviour with other types (whether in the " +"numeric tower or not) is currently unsupported. Collections with a mix of " +"types are also undefined and implementation-dependent. If your input data " +"consists of mixed types, you may be able to use :func:`map` to ensure a " +"consistent result, for example: ``map(float, input_data)``." +msgstr "" +"除非特別註明,這些函數支" +"援 :class:`int`、:class:`float`、:class:`~decimal.Decimal` 以" +"及 :class:`~fractions.Fraction`。目前不支援其他型別(無論是否為數值型別)。含" +"有混合型別的資料的集合亦是尚未定義,且取決於該型別的實作。若你的輸入資料含有" +"混合型別,你可以考慮使用 :func:`map` 來確保結果是一致的,例如:``map(float, " +"input_data)``。" #: ../../library/statistics.rst:39 msgid "" @@ -386,13 +387,13 @@ msgstr "將 *data* 轉換為浮點數並計算其算數平均數。" #: ../../library/statistics.rst:168 msgid "" -"This runs faster than the :func:`mean` function and it always returns a :" -"class:`float`. The *data* may be a sequence or iterable. If the input " +"This runs faster than the :func:`mean` function and it always returns " +"a :class:`float`. The *data* may be a sequence or iterable. If the input " "dataset is empty, raises a :exc:`StatisticsError`." msgstr "" "這個函式運算比 :func:`mean` 更快,並且它總是回傳一個 :class:`float`。*data* " -"可以是一個 sequence 或者 iterable。如果輸入的資料為空,則引發 :exc:" -"`StatisticsError`。" +"可以是一個 sequence 或者 iterable。如果輸入的資料為空,則引" +"發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:172 msgid "" @@ -425,11 +426,11 @@ msgstr "" #: ../../library/statistics.rst:188 msgid "" -"If *weights* is supplied, it must be the same length as the *data* or a :exc:" -"`ValueError` will be raised." +"If *weights* is supplied, it must be the same length as the *data* or " +"a :exc:`ValueError` will be raised." msgstr "" -"如果有提供 *weights*,它必須與 *data* 長度相同,否則將引發 :exc:" -"`ValueError`。" +"如果有提供 *weights*,它必須與 *data* 長度相同,否則將引" +"發 :exc:`ValueError`。" #: ../../library/statistics.rst:193 ../../library/statistics.rst:261 msgid "Added support for *weights*." @@ -536,8 +537,8 @@ msgid "" ":exc:`StatisticsError` is raised if *data* is empty, any element is less " "than zero, or if the weighted sum isn't positive." msgstr "" -"若 *data* 為空、含有任何小於零的元素、或者加權總和不為正數,則引發 :exc:" -"`StatisticsError`。" +"若 *data* 為空、含有任何小於零的元素、或者加權總和不為正數,則引" +"發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:255 msgid "" @@ -558,9 +559,9 @@ msgstr "" #: ../../library/statistics.rst:272 msgid "" -"The basic idea is to smooth the data using `a kernel function `_. to help draw inferences about a " -"population from a sample." +"The basic idea is to smooth the data using `a kernel function `_. to help draw inferences about " +"a population from a sample." msgstr "" #: ../../library/statistics.rst:276 @@ -596,13 +597,11 @@ msgid "" msgstr "" #: ../../library/statistics.rst:293 ../../library/statistics.rst:324 -#, fuzzy msgid "" "A :exc:`StatisticsError` will be raised if the *data* sequence is empty." msgstr "若 *data* 為空,則引發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:295 -#, fuzzy msgid "" "`Wikipedia has an example `_ where we can use :func:`kde` to " @@ -610,11 +609,10 @@ msgid "" "sample:" msgstr "" "`維基百科有一個範例 `_,我們可以使用 ``kde_normal()`` 這個錦囊" -"妙計來生成並繪製從小樣本估計的機率密度函式:" +"Kernel_density_estimation#Example>`_,我們可以使用 :func:`kde` 來從一個小樣本" +"生成並繪製估計的機率密度函數:" #: ../../library/statistics.rst:300 -#, fuzzy msgid "" ">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" ">>> f_hat = kde(sample, h=1.5)\n" @@ -622,9 +620,9 @@ msgid "" ">>> yarr = [f_hat(x) for x in xarr]" msgstr "" ">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" -">>> pdf, cdf, rand = kde_normal(sample, h=1.5)\n" +">>> f_hat = kde(sample, h=1.5)\n" ">>> xarr = [i/100 for i in range(-750, 1100)]\n" -">>> yarr = [pdf(x) for x in xarr]" +">>> yarr = [f_hat(x) for x in xarr]" #: ../../library/statistics.rst:307 msgid "The points in ``xarr`` and ``yarr`` can be used to make a PDF plot:" @@ -713,11 +711,12 @@ msgstr "" #: ../../library/statistics.rst:371 msgid "" -"Return the low median of numeric data. If *data* is empty, :exc:" -"`StatisticsError` is raised. *data* can be a sequence or iterable." +"Return the low median of numeric data. If *data* is " +"empty, :exc:`StatisticsError` is raised. *data* can be a sequence or " +"iterable." msgstr "" -"回傳數值型資料的低中位數 (low median)。若 *data* 為空,則引發 :exc:" -"`StatisticsError`。*data* 可為 sequence 或者 iterable。" +"回傳數值型資料的低中位數 (low median)。若 *data* 為空,則引" +"發 :exc:`StatisticsError`。*data* 可為 sequence 或者 iterable。" #: ../../library/statistics.rst:374 msgid "" @@ -753,8 +752,8 @@ msgid "" "Return the high median of data. If *data* is empty, :exc:`StatisticsError` " "is raised. *data* can be a sequence or iterable." msgstr "" -"回傳數值型資料的高中位數 (high median)。若 *data* 為空,則引發 :exc:" -"`StatisticsError`。*data* 可為 sequence 或者 iterable。" +"回傳數值型資料的高中位數 (high median)。若 *data* 為空,則引" +"發 :exc:`StatisticsError`。*data* 可為 sequence 或者 iterable。" #: ../../library/statistics.rst:394 msgid "" @@ -890,8 +889,8 @@ msgid "" msgstr "" "若有多個出現次數相同的眾數,則回傳在 *data* 中最先出現的眾數。如果希望回傳其" "中最小或最大的眾數,可以使用 ``min(multimode(data))`` 或 " -"``max(multimode(data))``。如果輸入的 *data* 為空,則會引發 :exc:" -"`StatisticsError`。" +"``max(multimode(data))``。如果輸入的 *data* 為空,則會引" +"發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:472 msgid "" @@ -968,8 +967,8 @@ msgid "" "Return the population standard deviation (the square root of the population " "variance). See :func:`pvariance` for arguments and other details." msgstr "" -"回傳母體標準差(即母體變異數的平方根)。有關引數以及其他細節,請參見 :func:" -"`pvariance`。" +"回傳母體標準差(即母體變異數的平方根)。有關引數以及其他細節,請參" +"見 :func:`pvariance`。" #: ../../library/statistics.rst:521 msgid "" @@ -1098,8 +1097,8 @@ msgid "" "Return the sample standard deviation (the square root of the sample " "variance). See :func:`variance` for arguments and other details." msgstr "" -"回傳樣本標準差(即樣本變異數的平方根)。有關引數以及其他細節,請參見 :func:" -"`variance`。" +"回傳樣本標準差(即樣本變異數的平方根)。有關引數以及其他細節,請參" +"見 :func:`variance`。" #: ../../library/statistics.rst:593 msgid "" @@ -1217,12 +1216,12 @@ msgstr "" #: ../../library/statistics.rst:656 msgid "" -"If you somehow know the actual population mean μ you should pass it to the :" -"func:`pvariance` function as the *mu* parameter to get the variance of a " -"sample." +"If you somehow know the actual population mean μ you should pass it to " +"the :func:`pvariance` function as the *mu* parameter to get the variance of " +"a sample." msgstr "" -"若你剛好知道真正的母體平均數 μ,你應該將其作為 *mu* 參數傳入 :func:" -"`pvariance` 函式來計算樣本變異數。" +"若你剛好知道真正的母體平均數 μ,你應該將其作為 *mu* 參數傳" +"入 :func:`pvariance` 函式來計算樣本變異數。" #: ../../library/statistics.rst:662 msgid "" @@ -1244,14 +1243,13 @@ msgstr "" "如果 *n* 不是至少為 1,則引發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:670 -#, fuzzy msgid "" "The *data* can be any iterable containing sample data. For meaningful " "results, the number of data points in *data* should be larger than *n*. " "Raises :exc:`StatisticsError` if there is not at least one data point." msgstr "" "*data* 可以是包含樣本資料的任何 iterable。為了取得有意義的結果,*data* 中的資" -"料點數量應大於 *n*。如果資料點少於兩個,則引發 :exc:`StatisticsError`。" +"料點數量應大於 *n*。如果連一個資料點都沒有,則引發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:674 msgid "" @@ -1331,8 +1329,8 @@ msgstr "" #: ../../library/statistics.rst:722 msgid "" -"Both inputs must be of the same length (no less than two), otherwise :exc:" -"`StatisticsError` is raised." +"Both inputs must be of the same length (no less than two), " +"otherwise :exc:`StatisticsError` is raised." msgstr "" "兩輸入必須具有相同長度(至少兩個),否則會引發 :exc:`StatisticsError`。" @@ -1397,8 +1395,8 @@ msgid "" "Both inputs must be of the same length (no less than two), and need not to " "be constant, otherwise :exc:`StatisticsError` is raised." msgstr "" -"兩輸入必須具有相同長度(至少兩個),且不須為常數,否則會引發 :exc:" -"`StatisticsError`。" +"兩輸入必須具有相同長度(至少兩個),且不須為常數,否則會引" +"發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:762 msgid "" @@ -1439,8 +1437,8 @@ msgstr "新增了對 Spearman 等級相關係數的支援。" #: ../../library/statistics.rst:794 msgid "" -"Return the slope and intercept of `simple linear regression `_ parameters estimated using " +"Return the slope and intercept of `simple linear regression `_ parameters estimated using " "ordinary least squares. Simple linear regression describes the relationship " "between an independent variable *x* and a dependent variable *y* in terms of " "this linear function:" @@ -1468,11 +1466,11 @@ msgstr "" #: ../../library/statistics.rst:808 msgid "" "Both inputs must be of the same length (no less than two), and the " -"independent variable *x* cannot be constant; otherwise a :exc:" -"`StatisticsError` is raised." +"independent variable *x* cannot be constant; otherwise " +"a :exc:`StatisticsError` is raised." msgstr "" -"兩輸入必須具有相同長度(至少兩個),且自變數 *x* 不得為常數,否則會引發 :exc:" -"`StatisticsError`。" +"兩輸入必須具有相同長度(至少兩個),且自變數 *x* 不得為常數,否則會引" +"發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:812 msgid "" @@ -1481,9 +1479,9 @@ msgid "" "cumulative number of Monty Python films that would have been produced by " "2019 assuming that they had kept the pace." msgstr "" -"舉例來說,我們可以使用 `Monty Python 系列電影的上映日期 `_\\ 來預測至 2019 年為止,假設他們保持" -"固定的製作速度,應該會產生的 Monty Python 電影的累計數量。" +"舉例來說,我們可以使用 `Monty Python 系列電影的上映日期 `_\\ 來預測至 2019 年為止,假設他們" +"保持固定的製作速度,應該會產生的 Monty Python 電影的累計數量。" #: ../../library/statistics.rst:818 msgid "" @@ -1538,6 +1536,18 @@ msgid "" ">>> [5_906, 10_152, 6_796, 6_450, 414] # actual distance in million km\n" "[5906, 10152, 6796, 6450, 414]" msgstr "" +">>> model = linear_regression(period_squared, dist_cubed, " +"proportional=True)\n" +">>> slope = model.slope\n" +"\n" +">>> # 矮行星: 冥王星、 鬩神星、 鳥神星、 妊神星、 穀神星\n" +">>> orbital_periods = [90_560, 204_199, 111_845, 103_410, 1_680] # 天數\n" +">>> predicted_dist = [math.cbrt(slope * (p * p)) for p in orbital_periods]\n" +">>> list(map(round, predicted_dist))\n" +"[5912, 10166, 6806, 6459, 414]\n" +"\n" +">>> [5_906, 10_152, 6_796, 6_450, 414] # 以百萬公里為單位的實際距離\n" +"[5906, 10152, 6796, 6450, 414]" #: ../../library/statistics.rst:854 msgid "Added support for *proportional*." @@ -1562,9 +1572,9 @@ msgstr ":class:`NormalDist` 物件" #: ../../library/statistics.rst:870 msgid "" ":class:`NormalDist` is a tool for creating and manipulating normal " -"distributions of a `random variable `_. It is a class that treats the mean and " -"standard deviation of data measurements as a single entity." +"distributions of a `random variable `_. It is a class that treats the mean and standard " +"deviation of data measurements as a single entity." msgstr "" ":class:`NormalDist` 是一種用於建立與操作\\ `隨機變數 (random variable) " "`_ 的常態分布的工" @@ -1572,12 +1582,12 @@ msgstr "" #: ../../library/statistics.rst:876 msgid "" -"Normal distributions arise from the `Central Limit Theorem `_ and have a wide range of " +"Normal distributions arise from the `Central Limit Theorem `_ and have a wide range of " "applications in statistics." msgstr "" -"常態分布源自於\\ `中央極限定理 (Central Limit Theorem) `_,在統計學中有著廣泛的應用。" +"常態分布源自於\\ `中央極限定理 (Central Limit Theorem) `_,在統計學中有著廣泛的應用。" #: ../../library/statistics.rst:882 msgid "" @@ -1658,8 +1668,8 @@ msgid "" "Generates *n* random samples for a given mean and standard deviation. " "Returns a :class:`list` of :class:`float` values." msgstr "" -"給定平均值與標準差,產生 *n* 個隨機樣本。回傳一個由 :class:`float` 組成的 :" -"class:`list`。" +"給定平均值與標準差,產生 *n* 個隨機樣本。回傳一個由 :class:`float` 組成" +"的 :class:`list`。" #: ../../library/statistics.rst:935 msgid "" @@ -1683,9 +1693,9 @@ msgid "" "random variable *X* will be near the given value *x*. Mathematically, it is " "the limit of the ratio ``P(x <= X < x+dx) / dx`` as *dx* approaches zero." msgstr "" -"利用\\ `機率密度函數 (probability density function, pdf) `_ 計算隨機變數 *X* 接近給定" -"值 *x* 的相對概度 (relative likelihood)。數學上,它是比率 ``P(x <= X < " +"利用\\ `機率密度函數 (probability density function, pdf) `_ 計算隨機變數 *X* 接近給" +"定值 *x* 的相對概度 (relative likelihood)。數學上,它是比率 ``P(x <= X < " "x+dx) / dx`` 在 *dx* 趨近於零時的極限值。" #: ../../library/statistics.rst:952 @@ -1705,23 +1715,24 @@ msgid "" "random variable *X* will be less than or equal to *x*. Mathematically, it " "is written ``P(X <= x)``." msgstr "" -"利用\\ `累積分布函式 (cumulative distribution function, cdf) `_ 計算隨機變數 *X* 小於" -"或等於 *x* 的機率。數學上,它記為 ``P(X <= x)``。" +"利用\\ `累積分布函式 (cumulative distribution function, cdf) `_ 計算隨機變數 *X* 小" +"於或等於 *x* 的機率。數學上,它記為 ``P(X <= x)``。" #: ../../library/statistics.rst:966 msgid "" "Compute the inverse cumulative distribution function, also known as the " "`quantile function `_ or " -"the `percent-point `_ " +"the `percent-point `_ " "function. Mathematically, it is written ``x : P(X <= x) = p``." msgstr "" "計算反累計分布函式 (inverse cumulative distribution function),也稱為\\ `分位" "數函式 (quantile function) `_ 或者\\ `百分率點 (percent-point) `_ 函式。數學上記為 ``x : P(X <= x) = p``。" +"Quantile_function>`_ 或者\\ `百分率點 (percent-point) `_ " +"函式。數學上記為 ``x : P(X <= x) = p``。" #: ../../library/statistics.rst:972 msgid "" @@ -1784,6 +1795,9 @@ msgid "" ">>> temperature_february * (9/5) + 32 # Fahrenheit\n" "NormalDist(mu=41.0, sigma=4.5)" msgstr "" +">>> temperature_february = NormalDist(5, 2.5) # 攝氏\n" +">>> temperature_february * (9/5) + 32 # 華氏\n" +"NormalDist(mu=41.0, sigma=4.5)" #: ../../library/statistics.rst:1013 msgid "" @@ -1797,13 +1811,13 @@ msgid "" "Since normal distributions arise from additive effects of independent " "variables, it is possible to `add and subtract two independent normally " "distributed random variables `_ represented as instances of :" -"class:`NormalDist`. For example:" +"Sum_of_normally_distributed_random_variables>`_ represented as instances " +"of :class:`NormalDist`. For example:" msgstr "" "由於常態分布源自於自變數的加法效應 (additive effects),因此可以\\ `將兩個獨立" "的常態分布隨機變數相加與相減 `_,並且表示為 :class:" -"`NormalDist` 的實例。例如:" +"Sum_of_normally_distributed_random_variables>`_,並且表示" +"為 :class:`NormalDist` 的實例。例如:" #: ../../library/statistics.rst:1022 msgid "" @@ -1902,7 +1916,7 @@ msgid "" ">>> X = NormalDist(10, 2.5).samples(n, seed=3652260728)\n" ">>> Y = NormalDist(15, 1.75).samples(n, seed=4582495471)\n" ">>> Z = NormalDist(50, 1.25).samples(n, seed=6582483453)\n" -">>> quantiles(map(model, X, Y, Z)) \n" +">>> quantiles(map(model, X, Y, Z))\n" "[1.4591308524824727, 1.8035946855390597, 2.175091447274739]" msgstr "" ">>> def model(x, y, z):\n" @@ -1912,7 +1926,7 @@ msgstr "" ">>> X = NormalDist(10, 2.5).samples(n, seed=3652260728)\n" ">>> Y = NormalDist(15, 1.75).samples(n, seed=4582495471)\n" ">>> Z = NormalDist(50, 1.25).samples(n, seed=6582483453)\n" -">>> quantiles(map(model, X, Y, Z)) \n" +">>> quantiles(map(model, X, Y, Z))\n" "[1.4591308524824727, 1.8035946855390597, 2.175091447274739]" #: ../../library/statistics.rst:1088 @@ -1926,8 +1940,8 @@ msgid "" "size is large and when the probability of a successful trial is near 50%." msgstr "" "當樣本數量夠大,且試驗成功的機率接近 50%,可以使用常態分布來近似\\ `二項分布 " -"(Binomial distributions) `_。" +"(Binomial distributions) `_。" #: ../../library/statistics.rst:1095 msgid "" @@ -1976,8 +1990,8 @@ msgstr "常態分布常在機器學習問題中出現。" #: ../../library/statistics.rst:1130 msgid "" -"Wikipedia has a `nice example of a Naive Bayesian Classifier `_. The " +"Wikipedia has a `nice example of a Naive Bayesian Classifier `_. The " "challenge is to predict a person's gender from measurements of normally " "distributed features including height, weight, and foot size." msgstr "" @@ -2030,9 +2044,9 @@ msgid "" "the prior times the product of likelihoods for the feature measurements " "given the gender:" msgstr "" -"從可能為男性或女性的 50% `先驗機率 (prior probability) `_ 為開端,我們將後驗機率 (posterior probability) " -"計算為先驗機率乘以給定性別下,各特徵量測值的概度乘積:" +"從可能為男性或女性的 50% `先驗機率 (prior probability) `_ 為開端,我們將後驗機率 (posterior " +"probability) 計算為先驗機率乘以給定性別下,各特徵量測值的概度乘積:" #: ../../library/statistics.rst:1162 msgid "" @@ -2086,8 +2100,8 @@ msgstr "" #~ "smoothing is controlled by a scaling parameter, ``h``, which is called " #~ "the *bandwidth*." #~ msgstr "" -#~ "基本想法是使用\\ `一個核函式如常態分布、三角分布或均勻分布 `_\\ 來使資料更加平滑。" #~ "平滑程度由一個縮放參數 ``h`` 控制,被稱為 *bandwidth*。" diff --git a/library/stdtypes.po b/library/stdtypes.po index 332f14e2f5..ca6fd65506 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-30 00:13+0000\n" +"POT-Creation-Date: 2025-03-20 00:14+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -135,8 +135,8 @@ msgstr "結果" #: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:276 #: ../../library/stdtypes.rst:416 ../../library/stdtypes.rst:965 -#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2432 -#: ../../library/stdtypes.rst:3651 +#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2438 +#: ../../library/stdtypes.rst:3657 msgid "Notes" msgstr "註解" @@ -150,7 +150,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:967 #: ../../library/stdtypes.rst:970 ../../library/stdtypes.rst:1181 -#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 +#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:3663 msgid "\\(1)" msgstr "\\(1)" @@ -164,8 +164,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:289 #: ../../library/stdtypes.rst:309 ../../library/stdtypes.rst:1209 -#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:2444 -#: ../../library/stdtypes.rst:3661 ../../library/stdtypes.rst:3663 +#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:2450 +#: ../../library/stdtypes.rst:3667 ../../library/stdtypes.rst:3669 msgid "\\(2)" msgstr "\\(2)" @@ -178,18 +178,18 @@ msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" #: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:979 -#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2446 -#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:2450 -#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:3665 -#: ../../library/stdtypes.rst:3667 ../../library/stdtypes.rst:3669 -#: ../../library/stdtypes.rst:3671 +#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2452 +#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:2456 +#: ../../library/stdtypes.rst:2458 ../../library/stdtypes.rst:3671 +#: ../../library/stdtypes.rst:3673 ../../library/stdtypes.rst:3675 +#: ../../library/stdtypes.rst:3677 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:320 #: ../../library/stdtypes.rst:434 ../../library/stdtypes.rst:1016 -#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:2478 -#: ../../library/stdtypes.rst:3701 +#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:2484 +#: ../../library/stdtypes.rst:3707 msgid "Notes:" msgstr "註解:" @@ -236,9 +236,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2409 -#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:3628 -#: ../../library/stdtypes.rst:3651 +#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2415 +#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3634 +#: ../../library/stdtypes.rst:3657 msgid "Meaning" msgstr "含義" @@ -559,7 +559,7 @@ msgid "" msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" #: ../../library/stdtypes.rst:302 ../../library/stdtypes.rst:1202 -#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:2446 ../../library/stdtypes.rst:3694 msgid "\\(6)" msgstr "\\(6)" @@ -597,9 +597,9 @@ msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:311 ../../library/stdtypes.rst:313 #: ../../library/stdtypes.rst:1191 ../../library/stdtypes.rst:1194 -#: ../../library/stdtypes.rst:2465 ../../library/stdtypes.rst:2468 -#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:3684 -#: ../../library/stdtypes.rst:3691 +#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:2474 +#: ../../library/stdtypes.rst:2477 ../../library/stdtypes.rst:3690 +#: ../../library/stdtypes.rst:3697 msgid "\\(5)" msgstr "\\(5)" @@ -758,8 +758,8 @@ msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:418 ../../library/stdtypes.rst:421 #: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:2458 -#: ../../library/stdtypes.rst:3673 ../../library/stdtypes.rst:3677 +#: ../../library/stdtypes.rst:2460 ../../library/stdtypes.rst:2464 +#: ../../library/stdtypes.rst:3679 ../../library/stdtypes.rst:3683 msgid "\\(4)" msgstr "\\(4)" @@ -1530,9 +1530,9 @@ msgstr "" #: ../../library/stdtypes.rst:909 msgid "" "Python's :term:`generator`\\s provide a convenient way to implement the " -"iterator protocol. If a container object's :meth:`~iterator.__iter__` " -"method is implemented as a generator, it will automatically return an " -"iterator object (technically, a generator object) supplying the :meth:`!" +"iterator protocol. If a container object's :meth:`~object.__iter__` method " +"is implemented as a generator, it will automatically return an iterator " +"object (technically, a generator object) supplying the :meth:`~iterator." "__iter__` and :meth:`~generator.__next__` methods. More information about " "generators can be found in :ref:`the documentation for the yield expression " "`." @@ -1584,7 +1584,7 @@ msgstr "``x in s``" #: ../../library/stdtypes.rst:967 msgid "``True`` if an item of *s* is equal to *x*, else ``False``" -msgstr "" +msgstr "如果 *s* 的一個項目等於 *x* 則為 ``True``,否則為 ``False``" #: ../../library/stdtypes.rst:970 msgid "``x not in s``" @@ -1592,7 +1592,7 @@ msgstr "``x not in s``" #: ../../library/stdtypes.rst:970 msgid "``False`` if an item of *s* is equal to *x*, else ``True``" -msgstr "" +msgstr "如果 *s* 的一個項目等於 *x* 則為 ``False``,否則為 ``True``" #: ../../library/stdtypes.rst:973 msgid "``s + t``" @@ -1600,7 +1600,7 @@ msgstr "``s + t``" #: ../../library/stdtypes.rst:973 msgid "the concatenation of *s* and *t*" -msgstr "" +msgstr "*s* 和 *t* 的串接" #: ../../library/stdtypes.rst:973 msgid "(6)(7)" @@ -1612,7 +1612,7 @@ msgstr "``s * n`` 或 ``n * s``" #: ../../library/stdtypes.rst:976 msgid "equivalent to adding *s* to itself *n* times" -msgstr "" +msgstr "等同於將 *s* 加到自己 *n* 次" #: ../../library/stdtypes.rst:976 msgid "(2)(7)" @@ -1624,7 +1624,7 @@ msgstr "``s[i]``" #: ../../library/stdtypes.rst:979 msgid "*i*\\ th item of *s*, origin 0" -msgstr "" +msgstr "*s* 的第 *i* 項,起始為 0" #: ../../library/stdtypes.rst:981 msgid "``s[i:j]``" @@ -1684,7 +1684,7 @@ msgid "" "before index *j*)" msgstr "" -#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3659 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3665 msgid "\\(8)" msgstr "\\(8)" @@ -1694,7 +1694,7 @@ msgstr "``s.count(x)``" #: ../../library/stdtypes.rst:996 msgid "total number of occurrences of *x* in *s*" -msgstr "" +msgstr "*s* 中 *x* 的總出現次數" #: ../../library/stdtypes.rst:1000 msgid "" @@ -2619,7 +2619,7 @@ msgstr "" msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1673 ../../library/stdtypes.rst:2824 +#: ../../library/stdtypes.rst:1673 ../../library/stdtypes.rst:2830 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." @@ -2641,11 +2641,11 @@ msgid "" "ref:`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:1688 ../../library/stdtypes.rst:2843 +#: ../../library/stdtypes.rst:1688 ../../library/stdtypes.rst:2849 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1691 ../../library/stdtypes.rst:2846 +#: ../../library/stdtypes.rst:1691 ../../library/stdtypes.rst:2852 msgid "" "The value of the *errors* argument is now checked in :ref:`devmode` and in :" "ref:`debug mode `." @@ -2839,29 +2839,41 @@ msgstr "" #: ../../library/stdtypes.rst:1879 msgid "" -"Return ``True`` if all characters in the string are printable or the string " -"is empty, ``False`` otherwise. Nonprintable characters are those characters " -"defined in the Unicode character database as \"Other\" or \"Separator\", " -"excepting the ASCII space (0x20) which is considered printable. (Note that " -"printable characters in this context are those which should not be escaped " -"when :func:`repr` is invoked on a string. It has no bearing on the handling " -"of strings written to :data:`sys.stdout` or :data:`sys.stderr`.)" +"Return true if all characters in the string are printable, false if it " +"contains at least one non-printable character." +msgstr "" + +#: ../../library/stdtypes.rst:1882 +msgid "" +"Here \"printable\" means the character is suitable for :func:`repr` to use " +"in its output; \"non-printable\" means that :func:`repr` on built-in types " +"will hex-escape the character. It has no bearing on the handling of strings " +"written to :data:`sys.stdout` or :data:`sys.stderr`." msgstr "" -#: ../../library/stdtypes.rst:1890 +#: ../../library/stdtypes.rst:1887 +msgid "" +"The printable characters are those which in the Unicode character database " +"(see :mod:`unicodedata`) have a general category in group Letter, Mark, " +"Number, Punctuation, or Symbol (L, M, N, P, or S); plus the ASCII space " +"0x20. Nonprintable characters are those in group Separator or Other (Z or " +"C), except the ASCII space." +msgstr "" + +#: ../../library/stdtypes.rst:1896 msgid "" "Return ``True`` if there are only whitespace characters in the string and " "there is at least one character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1893 +#: ../../library/stdtypes.rst:1899 msgid "" "A character is *whitespace* if in the Unicode character database (see :mod:" "`unicodedata`), either its general category is ``Zs`` (\"Separator, " "space\"), or its bidirectional class is one of ``WS``, ``B``, or ``S``." msgstr "" -#: ../../library/stdtypes.rst:1901 +#: ../../library/stdtypes.rst:1907 msgid "" "Return ``True`` if the string is a titlecased string and there is at least " "one character, for example uppercase characters may only follow uncased " @@ -2869,13 +2881,13 @@ msgid "" "otherwise." msgstr "" -#: ../../library/stdtypes.rst:1908 +#: ../../library/stdtypes.rst:1914 msgid "" "Return ``True`` if all cased characters [4]_ in the string are uppercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1926 +#: ../../library/stdtypes.rst:1932 msgid "" "Return a string which is the concatenation of the strings in *iterable*. A :" "exc:`TypeError` will be raised if there are any non-string values in " @@ -2883,27 +2895,27 @@ msgid "" "elements is the string providing this method." msgstr "" -#: ../../library/stdtypes.rst:1934 +#: ../../library/stdtypes.rst:1940 msgid "" "Return the string left justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:1941 +#: ../../library/stdtypes.rst:1947 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "lowercase." msgstr "" -#: ../../library/stdtypes.rst:1944 +#: ../../library/stdtypes.rst:1950 msgid "" "The lowercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:1951 +#: ../../library/stdtypes.rst:1957 msgid "" "Return a copy of the string with leading characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -2912,7 +2924,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:1956 +#: ../../library/stdtypes.rst:1962 msgid "" ">>> ' spacious '.lstrip()\n" "'spacious '\n" @@ -2924,13 +2936,13 @@ msgstr "" ">>> 'www.example.com'.lstrip('cmowz.')\n" "'example.com'" -#: ../../library/stdtypes.rst:1961 +#: ../../library/stdtypes.rst:1967 msgid "" "See :meth:`str.removeprefix` for a method that will remove a single prefix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:1964 +#: ../../library/stdtypes.rst:1970 msgid "" ">>> 'Arthur: three!'.lstrip('Arthur: ')\n" "'ee!'\n" @@ -2942,13 +2954,13 @@ msgstr "" ">>> 'Arthur: three!'.removeprefix('Arthur: ')\n" "'three!'" -#: ../../library/stdtypes.rst:1972 +#: ../../library/stdtypes.rst:1978 msgid "" "This static method returns a translation table usable for :meth:`str." "translate`." msgstr "" -#: ../../library/stdtypes.rst:1974 +#: ../../library/stdtypes.rst:1980 msgid "" "If there is only one argument, it must be a dictionary mapping Unicode " "ordinals (integers) or characters (strings of length 1) to Unicode ordinals, " @@ -2956,7 +2968,7 @@ msgid "" "converted to ordinals." msgstr "" -#: ../../library/stdtypes.rst:1979 +#: ../../library/stdtypes.rst:1985 msgid "" "If there are two arguments, they must be strings of equal length, and in the " "resulting dictionary, each character in x will be mapped to the character at " @@ -2964,7 +2976,7 @@ msgid "" "whose characters will be mapped to ``None`` in the result." msgstr "" -#: ../../library/stdtypes.rst:1987 +#: ../../library/stdtypes.rst:1993 msgid "" "Split the string at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -2972,13 +2984,13 @@ msgid "" "containing the string itself, followed by two empty strings." msgstr "" -#: ../../library/stdtypes.rst:1995 +#: ../../library/stdtypes.rst:2001 msgid "" "If the string starts with the *prefix* string, return " "``string[len(prefix):]``. Otherwise, return a copy of the original string::" msgstr "" -#: ../../library/stdtypes.rst:1999 +#: ../../library/stdtypes.rst:2005 msgid "" ">>> 'TestHook'.removeprefix('Test')\n" "'Hook'\n" @@ -2990,14 +3002,14 @@ msgstr "" ">>> 'BaseTestCase'.removeprefix('Test')\n" "'BaseTestCase'" -#: ../../library/stdtypes.rst:2009 +#: ../../library/stdtypes.rst:2015 msgid "" "If the string ends with the *suffix* string and that *suffix* is not empty, " "return ``string[:-len(suffix)]``. Otherwise, return a copy of the original " "string::" msgstr "" -#: ../../library/stdtypes.rst:2013 +#: ../../library/stdtypes.rst:2019 msgid "" ">>> 'MiscTests'.removesuffix('Tests')\n" "'Misc'\n" @@ -3009,7 +3021,7 @@ msgstr "" ">>> 'TmpDirMixin'.removesuffix('Tests')\n" "'TmpDirMixin'" -#: ../../library/stdtypes.rst:2023 +#: ../../library/stdtypes.rst:2029 msgid "" "Return a copy of the string with all occurrences of substring *old* replaced " "by *new*. If *count* is given, only the first *count* occurrences are " @@ -3017,31 +3029,31 @@ msgid "" "replaced." msgstr "" -#: ../../library/stdtypes.rst:2027 +#: ../../library/stdtypes.rst:2033 msgid "*count* is now supported as a keyword argument." msgstr "*count* 現在作為關鍵字引數被支援。" -#: ../../library/stdtypes.rst:2033 +#: ../../library/stdtypes.rst:2039 msgid "" "Return the highest index in the string where substring *sub* is found, such " "that *sub* is contained within ``s[start:end]``. Optional arguments *start* " "and *end* are interpreted as in slice notation. Return ``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2040 +#: ../../library/stdtypes.rst:2046 msgid "" "Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is " "not found." msgstr "" -#: ../../library/stdtypes.rst:2046 +#: ../../library/stdtypes.rst:2052 msgid "" "Return the string right justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2053 +#: ../../library/stdtypes.rst:2059 msgid "" "Split the string at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3049,7 +3061,7 @@ msgid "" "containing two empty strings, followed by the string itself." msgstr "" -#: ../../library/stdtypes.rst:2061 +#: ../../library/stdtypes.rst:2067 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done, the " @@ -3058,7 +3070,7 @@ msgid "" "behaves like :meth:`split` which is described in detail below." msgstr "" -#: ../../library/stdtypes.rst:2070 +#: ../../library/stdtypes.rst:2076 msgid "" "Return a copy of the string with trailing characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3067,7 +3079,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2075 +#: ../../library/stdtypes.rst:2081 msgid "" ">>> ' spacious '.rstrip()\n" "' spacious'\n" @@ -3079,13 +3091,13 @@ msgstr "" ">>> 'mississippi'.rstrip('ipz')\n" "'mississ'" -#: ../../library/stdtypes.rst:2080 +#: ../../library/stdtypes.rst:2086 msgid "" "See :meth:`str.removesuffix` for a method that will remove a single suffix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2083 +#: ../../library/stdtypes.rst:2089 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" @@ -3097,7 +3109,7 @@ msgstr "" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" -#: ../../library/stdtypes.rst:2090 +#: ../../library/stdtypes.rst:2096 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, " @@ -3106,7 +3118,7 @@ msgid "" "possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:2096 +#: ../../library/stdtypes.rst:2102 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " @@ -3116,20 +3128,20 @@ msgid "" "``['']``." msgstr "" -#: ../../library/stdtypes.rst:2103 ../../library/stdtypes.rst:2121 -#: ../../library/stdtypes.rst:2173 ../../library/stdtypes.rst:2241 -#: ../../library/stdtypes.rst:2309 ../../library/stdtypes.rst:3161 -#: ../../library/stdtypes.rst:3179 ../../library/stdtypes.rst:3270 -#: ../../library/stdtypes.rst:3286 ../../library/stdtypes.rst:3311 -#: ../../library/stdtypes.rst:3325 ../../library/stdtypes.rst:3353 -#: ../../library/stdtypes.rst:3367 ../../library/stdtypes.rst:3385 -#: ../../library/stdtypes.rst:3412 ../../library/stdtypes.rst:3435 -#: ../../library/stdtypes.rst:3462 ../../library/stdtypes.rst:3504 -#: ../../library/stdtypes.rst:3528 +#: ../../library/stdtypes.rst:2109 ../../library/stdtypes.rst:2127 +#: ../../library/stdtypes.rst:2179 ../../library/stdtypes.rst:2247 +#: ../../library/stdtypes.rst:2315 ../../library/stdtypes.rst:3167 +#: ../../library/stdtypes.rst:3185 ../../library/stdtypes.rst:3276 +#: ../../library/stdtypes.rst:3292 ../../library/stdtypes.rst:3317 +#: ../../library/stdtypes.rst:3331 ../../library/stdtypes.rst:3359 +#: ../../library/stdtypes.rst:3373 ../../library/stdtypes.rst:3391 +#: ../../library/stdtypes.rst:3418 ../../library/stdtypes.rst:3441 +#: ../../library/stdtypes.rst:3468 ../../library/stdtypes.rst:3510 +#: ../../library/stdtypes.rst:3534 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/stdtypes.rst:2105 +#: ../../library/stdtypes.rst:2111 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -3149,7 +3161,7 @@ msgstr "" ">>> '1<>2<>3<4'.split('<>')\n" "['1', '2', '3<4']" -#: ../../library/stdtypes.rst:2114 +#: ../../library/stdtypes.rst:2120 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive whitespace are regarded as a single separator, " @@ -3159,7 +3171,7 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2123 +#: ../../library/stdtypes.rst:2129 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -3175,120 +3187,120 @@ msgstr "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" -#: ../../library/stdtypes.rst:2136 +#: ../../library/stdtypes.rst:2142 msgid "" "Return a list of the lines in the string, breaking at line boundaries. Line " "breaks are not included in the resulting list unless *keepends* is given and " "true." msgstr "" -#: ../../library/stdtypes.rst:2140 +#: ../../library/stdtypes.rst:2146 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2144 +#: ../../library/stdtypes.rst:2150 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2144 +#: ../../library/stdtypes.rst:2150 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2146 +#: ../../library/stdtypes.rst:2152 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2146 +#: ../../library/stdtypes.rst:2152 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2148 +#: ../../library/stdtypes.rst:2154 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2148 +#: ../../library/stdtypes.rst:2154 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2150 +#: ../../library/stdtypes.rst:2156 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2150 +#: ../../library/stdtypes.rst:2156 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2152 +#: ../../library/stdtypes.rst:2158 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2152 +#: ../../library/stdtypes.rst:2158 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2154 +#: ../../library/stdtypes.rst:2160 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2154 +#: ../../library/stdtypes.rst:2160 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2156 +#: ../../library/stdtypes.rst:2162 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2156 +#: ../../library/stdtypes.rst:2162 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2158 +#: ../../library/stdtypes.rst:2164 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2158 +#: ../../library/stdtypes.rst:2164 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2160 +#: ../../library/stdtypes.rst:2166 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2160 +#: ../../library/stdtypes.rst:2166 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2162 +#: ../../library/stdtypes.rst:2168 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2162 +#: ../../library/stdtypes.rst:2168 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2164 +#: ../../library/stdtypes.rst:2170 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2164 +#: ../../library/stdtypes.rst:2170 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2166 +#: ../../library/stdtypes.rst:2172 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2166 +#: ../../library/stdtypes.rst:2172 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2171 +#: ../../library/stdtypes.rst:2177 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2175 +#: ../../library/stdtypes.rst:2181 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" @@ -3300,14 +3312,14 @@ msgstr "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']" -#: ../../library/stdtypes.rst:2180 +#: ../../library/stdtypes.rst:2186 msgid "" "Unlike :meth:`~str.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:2184 +#: ../../library/stdtypes.rst:2190 msgid "" ">>> \"\".splitlines()\n" "[]\n" @@ -3319,11 +3331,11 @@ msgstr "" ">>> \"One line\\n\".splitlines()\n" "['One line']" -#: ../../library/stdtypes.rst:2189 +#: ../../library/stdtypes.rst:2195 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2191 +#: ../../library/stdtypes.rst:2197 msgid "" ">>> ''.split('\\n')\n" "['']\n" @@ -3335,7 +3347,7 @@ msgstr "" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" -#: ../../library/stdtypes.rst:2199 +#: ../../library/stdtypes.rst:2205 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -3343,7 +3355,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2207 +#: ../../library/stdtypes.rst:2213 msgid "" "Return a copy of the string with the leading and trailing characters " "removed. The *chars* argument is a string specifying the set of characters " @@ -3352,7 +3364,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2213 +#: ../../library/stdtypes.rst:2219 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" @@ -3364,7 +3376,7 @@ msgstr "" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" -#: ../../library/stdtypes.rst:2218 +#: ../../library/stdtypes.rst:2224 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -3372,7 +3384,7 @@ msgid "" "A similar action takes place on the trailing end. For example::" msgstr "" -#: ../../library/stdtypes.rst:2224 +#: ../../library/stdtypes.rst:2230 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" @@ -3382,20 +3394,20 @@ msgstr "" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" -#: ../../library/stdtypes.rst:2231 +#: ../../library/stdtypes.rst:2237 msgid "" "Return a copy of the string with uppercase characters converted to lowercase " "and vice versa. Note that it is not necessarily true that ``s.swapcase()." "swapcase() == s``." msgstr "" -#: ../../library/stdtypes.rst:2238 +#: ../../library/stdtypes.rst:2244 msgid "" "Return a titlecased version of the string where words start with an " "uppercase character and the remaining characters are lowercase." msgstr "" -#: ../../library/stdtypes.rst:2243 +#: ../../library/stdtypes.rst:2249 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" @@ -3403,7 +3415,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2246 ../../library/stdtypes.rst:3472 +#: ../../library/stdtypes.rst:2252 ../../library/stdtypes.rst:3478 msgid "" "The algorithm uses a simple language-independent definition of a word as " "groups of consecutive letters. The definition works in many contexts but it " @@ -3411,7 +3423,7 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2251 +#: ../../library/stdtypes.rst:2257 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" @@ -3419,19 +3431,19 @@ msgstr "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:2254 +#: ../../library/stdtypes.rst:2260 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2257 +#: ../../library/stdtypes.rst:2263 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2260 +#: ../../library/stdtypes.rst:2266 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -3451,7 +3463,7 @@ msgstr "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:2272 +#: ../../library/stdtypes.rst:2278 msgid "" "Return a copy of the string in which each character has been mapped through " "the given translation table. The table must be an object that implements " @@ -3463,19 +3475,19 @@ msgid "" "exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2281 +#: ../../library/stdtypes.rst:2287 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2284 +#: ../../library/stdtypes.rst:2290 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2290 +#: ../../library/stdtypes.rst:2296 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s`` " @@ -3484,14 +3496,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2296 +#: ../../library/stdtypes.rst:2302 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2303 +#: ../../library/stdtypes.rst:2309 msgid "" "Return a copy of the string left filled with ASCII ``'0'`` digits to make a " "string of length *width*. A leading sign prefix (``'+'``/``'-'``) is handled " @@ -3499,7 +3511,7 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2311 +#: ../../library/stdtypes.rst:2317 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" @@ -3511,11 +3523,11 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2321 +#: ../../library/stdtypes.rst:2327 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2334 +#: ../../library/stdtypes.rst:2340 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -3526,7 +3538,7 @@ msgid "" "or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2342 +#: ../../library/stdtypes.rst:2348 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -3536,13 +3548,13 @@ msgid "" "function in the C language. For example:" msgstr "" -#: ../../library/stdtypes.rst:2349 +#: ../../library/stdtypes.rst:2355 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." msgstr "" -#: ../../library/stdtypes.rst:2354 +#: ../../library/stdtypes.rst:2360 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -3550,36 +3562,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2364 ../../library/stdtypes.rst:3583 +#: ../../library/stdtypes.rst:2370 ../../library/stdtypes.rst:3589 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2367 ../../library/stdtypes.rst:3586 +#: ../../library/stdtypes.rst:2373 ../../library/stdtypes.rst:3592 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2369 ../../library/stdtypes.rst:3588 +#: ../../library/stdtypes.rst:2375 ../../library/stdtypes.rst:3594 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2372 ../../library/stdtypes.rst:3591 +#: ../../library/stdtypes.rst:2378 ../../library/stdtypes.rst:3597 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2375 ../../library/stdtypes.rst:3594 +#: ../../library/stdtypes.rst:2381 ../../library/stdtypes.rst:3600 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is read from the next element of the tuple in *values*, and the " "object to convert comes after the minimum field width and optional precision." msgstr "" -#: ../../library/stdtypes.rst:2379 ../../library/stdtypes.rst:3598 +#: ../../library/stdtypes.rst:2385 ../../library/stdtypes.rst:3604 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -3587,15 +3599,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2384 ../../library/stdtypes.rst:3603 +#: ../../library/stdtypes.rst:2390 ../../library/stdtypes.rst:3609 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2386 ../../library/stdtypes.rst:3605 +#: ../../library/stdtypes.rst:2392 ../../library/stdtypes.rst:3611 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2388 +#: ../../library/stdtypes.rst:2394 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the string *must* include a parenthesised mapping key into that " @@ -3603,279 +3615,279 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2397 ../../library/stdtypes.rst:3616 +#: ../../library/stdtypes.rst:2403 ../../library/stdtypes.rst:3622 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2400 ../../library/stdtypes.rst:3619 +#: ../../library/stdtypes.rst:2406 ../../library/stdtypes.rst:3625 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2409 ../../library/stdtypes.rst:3628 +#: ../../library/stdtypes.rst:2415 ../../library/stdtypes.rst:3634 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2411 ../../library/stdtypes.rst:3630 +#: ../../library/stdtypes.rst:2417 ../../library/stdtypes.rst:3636 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2411 ../../library/stdtypes.rst:3630 +#: ../../library/stdtypes.rst:2417 ../../library/stdtypes.rst:3636 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2414 ../../library/stdtypes.rst:3633 +#: ../../library/stdtypes.rst:2420 ../../library/stdtypes.rst:3639 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2414 ../../library/stdtypes.rst:3633 +#: ../../library/stdtypes.rst:2420 ../../library/stdtypes.rst:3639 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2416 ../../library/stdtypes.rst:3635 +#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:3641 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2416 ../../library/stdtypes.rst:3635 +#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:3641 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2419 ../../library/stdtypes.rst:3638 +#: ../../library/stdtypes.rst:2425 ../../library/stdtypes.rst:3644 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2419 ../../library/stdtypes.rst:3638 +#: ../../library/stdtypes.rst:2425 ../../library/stdtypes.rst:3644 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:3641 +#: ../../library/stdtypes.rst:2428 ../../library/stdtypes.rst:3647 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:3641 +#: ../../library/stdtypes.rst:2428 ../../library/stdtypes.rst:3647 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2426 ../../library/stdtypes.rst:3645 +#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:3651 msgid "" "A length modifier (``h``, ``l``, or ``L``) may be present, but is ignored as " "it is not necessary for Python -- so e.g. ``%ld`` is identical to ``%d``." msgstr "" -#: ../../library/stdtypes.rst:2429 ../../library/stdtypes.rst:3648 +#: ../../library/stdtypes.rst:2435 ../../library/stdtypes.rst:3654 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:3651 +#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 msgid "Conversion" msgstr "" -#: ../../library/stdtypes.rst:2434 ../../library/stdtypes.rst:3653 +#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3659 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2434 ../../library/stdtypes.rst:2436 -#: ../../library/stdtypes.rst:3653 ../../library/stdtypes.rst:3655 +#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:2442 +#: ../../library/stdtypes.rst:3659 ../../library/stdtypes.rst:3661 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2436 ../../library/stdtypes.rst:3655 +#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:3661 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 +#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:3663 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 +#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:3663 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3659 +#: ../../library/stdtypes.rst:2446 ../../library/stdtypes.rst:3665 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3659 +#: ../../library/stdtypes.rst:2446 ../../library/stdtypes.rst:3665 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:3661 +#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:3667 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:3661 +#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:3667 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:3663 +#: ../../library/stdtypes.rst:2450 ../../library/stdtypes.rst:3669 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:3663 +#: ../../library/stdtypes.rst:2450 ../../library/stdtypes.rst:3669 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2446 ../../library/stdtypes.rst:3665 +#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:3671 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2446 ../../library/stdtypes.rst:3665 +#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:3671 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:3667 +#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:3673 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:3667 +#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:3673 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2450 ../../library/stdtypes.rst:3669 +#: ../../library/stdtypes.rst:2456 ../../library/stdtypes.rst:3675 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2450 ../../library/stdtypes.rst:2452 -#: ../../library/stdtypes.rst:3669 ../../library/stdtypes.rst:3671 +#: ../../library/stdtypes.rst:2456 ../../library/stdtypes.rst:2458 +#: ../../library/stdtypes.rst:3675 ../../library/stdtypes.rst:3677 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:3671 +#: ../../library/stdtypes.rst:2458 ../../library/stdtypes.rst:3677 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:3673 +#: ../../library/stdtypes.rst:2460 ../../library/stdtypes.rst:3679 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:3673 +#: ../../library/stdtypes.rst:2460 ../../library/stdtypes.rst:3679 msgid "" "Floating-point format. Uses lowercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2458 ../../library/stdtypes.rst:3677 +#: ../../library/stdtypes.rst:2464 ../../library/stdtypes.rst:3683 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2458 ../../library/stdtypes.rst:3677 +#: ../../library/stdtypes.rst:2464 ../../library/stdtypes.rst:3683 msgid "" "Floating-point format. Uses uppercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2462 ../../library/stdtypes.rst:3681 +#: ../../library/stdtypes.rst:2468 ../../library/stdtypes.rst:3687 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2462 +#: ../../library/stdtypes.rst:2468 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2465 ../../library/stdtypes.rst:3694 +#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:3700 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2465 +#: ../../library/stdtypes.rst:2471 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2468 ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:2474 ../../library/stdtypes.rst:3694 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2468 +#: ../../library/stdtypes.rst:2474 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:3691 +#: ../../library/stdtypes.rst:2477 ../../library/stdtypes.rst:3697 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2471 +#: ../../library/stdtypes.rst:2477 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2474 ../../library/stdtypes.rst:3697 +#: ../../library/stdtypes.rst:2480 ../../library/stdtypes.rst:3703 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2474 ../../library/stdtypes.rst:3697 +#: ../../library/stdtypes.rst:2480 ../../library/stdtypes.rst:3703 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2481 ../../library/stdtypes.rst:3704 +#: ../../library/stdtypes.rst:2487 ../../library/stdtypes.rst:3710 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2485 ../../library/stdtypes.rst:3708 +#: ../../library/stdtypes.rst:2491 ../../library/stdtypes.rst:3714 msgid "" "The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on " "whether the ``'x'`` or ``'X'`` format was used) to be inserted before the " "first digit." msgstr "" -#: ../../library/stdtypes.rst:2489 ../../library/stdtypes.rst:3712 +#: ../../library/stdtypes.rst:2495 ../../library/stdtypes.rst:3718 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2492 ../../library/stdtypes.rst:3715 +#: ../../library/stdtypes.rst:2498 ../../library/stdtypes.rst:3721 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2496 ../../library/stdtypes.rst:3719 +#: ../../library/stdtypes.rst:2502 ../../library/stdtypes.rst:3725 msgid "" "The alternate form causes the result to always contain a decimal point, and " "trailing zeroes are not removed as they would otherwise be." msgstr "" -#: ../../library/stdtypes.rst:2499 ../../library/stdtypes.rst:3722 +#: ../../library/stdtypes.rst:2505 ../../library/stdtypes.rst:3728 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2503 ../../library/stdtypes.rst:3726 +#: ../../library/stdtypes.rst:2509 ../../library/stdtypes.rst:3732 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2506 ../../library/stdtypes.rst:3735 +#: ../../library/stdtypes.rst:2512 ../../library/stdtypes.rst:3741 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:2508 +#: ../../library/stdtypes.rst:2514 msgid "" "Since Python strings have an explicit length, ``%s`` conversions do not " "assume that ``'\\0'`` is the end of the string." msgstr "" -#: ../../library/stdtypes.rst:2513 +#: ../../library/stdtypes.rst:2519 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2524 +#: ../../library/stdtypes.rst:2530 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:2532 +#: ../../library/stdtypes.rst:2538 msgid "" "The core built-in types for manipulating binary data are :class:`bytes` and :" "class:`bytearray`. They are supported by :class:`memoryview` which uses the :" @@ -3883,17 +3895,17 @@ msgid "" "objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:2537 +#: ../../library/stdtypes.rst:2543 msgid "" "The :mod:`array` module supports efficient storage of basic data types like " "32-bit integers and IEEE754 double-precision floating values." msgstr "" -#: ../../library/stdtypes.rst:2543 +#: ../../library/stdtypes.rst:2549 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:2547 +#: ../../library/stdtypes.rst:2553 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -3901,40 +3913,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:2554 +#: ../../library/stdtypes.rst:2560 msgid "" "Firstly, the syntax for bytes literals is largely the same as that for " "string literals, except that a ``b`` prefix is added:" msgstr "" -#: ../../library/stdtypes.rst:2557 +#: ../../library/stdtypes.rst:2563 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:2558 +#: ../../library/stdtypes.rst:2564 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:2559 +#: ../../library/stdtypes.rst:2565 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:2561 +#: ../../library/stdtypes.rst:2567 msgid "" "Only ASCII characters are permitted in bytes literals (regardless of the " "declared source code encoding). Any binary values over 127 must be entered " "into bytes literals using the appropriate escape sequence." msgstr "" -#: ../../library/stdtypes.rst:2565 +#: ../../library/stdtypes.rst:2571 msgid "" "As with string literals, bytes literals may also use a ``r`` prefix to " "disable processing of escape sequences. See :ref:`strings` for more about " "the various forms of bytes literal, including supported escape sequences." msgstr "" -#: ../../library/stdtypes.rst:2569 +#: ../../library/stdtypes.rst:2575 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -3947,29 +3959,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:2579 +#: ../../library/stdtypes.rst:2585 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:2582 +#: ../../library/stdtypes.rst:2588 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:2583 +#: ../../library/stdtypes.rst:2589 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2584 +#: ../../library/stdtypes.rst:2590 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:2586 +#: ../../library/stdtypes.rst:2592 msgid "Also see the :ref:`bytes ` built-in." -msgstr "" +msgstr "另見內建的 :ref:`bytes `。" -#: ../../library/stdtypes.rst:2588 +#: ../../library/stdtypes.rst:2594 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -3977,32 +3989,32 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:2594 +#: ../../library/stdtypes.rst:2600 msgid "" "This :class:`bytes` class method returns a bytes object, decoding the given " "string object. The string must contain two hexadecimal digits per byte, " "with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2601 +#: ../../library/stdtypes.rst:2607 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:2605 +#: ../../library/stdtypes.rst:2611 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2610 ../../library/stdtypes.rst:2695 +#: ../../library/stdtypes.rst:2616 ../../library/stdtypes.rst:2701 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:2616 +#: ../../library/stdtypes.rst:2622 msgid "" "If you want to make the hex string easier to read, you can specify a single " "character separator *sep* parameter to include in the output. By default, " @@ -4011,13 +4023,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:2633 +#: ../../library/stdtypes.rst:2639 msgid "" ":meth:`bytes.hex` now supports optional *sep* and *bytes_per_sep* parameters " "to insert separators between bytes in the hex output." msgstr "" -#: ../../library/stdtypes.rst:2637 +#: ../../library/stdtypes.rst:2643 msgid "" "Since bytes objects are sequences of integers (akin to a tuple), for a bytes " "object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes " @@ -4025,58 +4037,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2642 +#: ../../library/stdtypes.rst:2648 msgid "" "The representation of bytes objects uses the literal format (``b'...'``) " "since it is often more useful than e.g. ``bytes([46, 46, 46])``. You can " "always convert a bytes object into a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2650 +#: ../../library/stdtypes.rst:2656 msgid "Bytearray Objects" -msgstr "" +msgstr "Bytearray 物件" -#: ../../library/stdtypes.rst:2654 +#: ../../library/stdtypes.rst:2660 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:2659 +#: ../../library/stdtypes.rst:2665 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:2662 +#: ../../library/stdtypes.rst:2668 msgid "Creating an empty instance: ``bytearray()``" -msgstr "" +msgstr "建立一個空的實例:``bytearray()``" -#: ../../library/stdtypes.rst:2663 +#: ../../library/stdtypes.rst:2669 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:2664 +#: ../../library/stdtypes.rst:2670 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2665 +#: ../../library/stdtypes.rst:2671 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:2667 +#: ../../library/stdtypes.rst:2673 msgid "" "As bytearray objects are mutable, they support the :ref:`mutable ` sequence operations in addition to the common bytes and bytearray " "operations described in :ref:`bytes-methods`." msgstr "" -#: ../../library/stdtypes.rst:2671 +#: ../../library/stdtypes.rst:2677 msgid "Also see the :ref:`bytearray ` built-in." -msgstr "" +msgstr "另見內建的 :ref:`bytearray `。" -#: ../../library/stdtypes.rst:2673 +#: ../../library/stdtypes.rst:2679 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4084,33 +4096,33 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:2679 +#: ../../library/stdtypes.rst:2685 msgid "" "This :class:`bytearray` class method returns bytearray object, decoding the " "given string object. The string must contain two hexadecimal digits per " "byte, with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2686 +#: ../../library/stdtypes.rst:2692 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:2690 +#: ../../library/stdtypes.rst:2696 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2703 +#: ../../library/stdtypes.rst:2709 msgid "" "Similar to :meth:`bytes.hex`, :meth:`bytearray.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:2708 +#: ../../library/stdtypes.rst:2714 msgid "" "Since bytearray objects are sequences of integers (akin to a list), for a " "bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be " @@ -4118,7 +4130,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2713 +#: ../../library/stdtypes.rst:2719 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -4126,11 +4138,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2722 +#: ../../library/stdtypes.rst:2728 msgid "Bytes and Bytearray Operations" -msgstr "" +msgstr "Bytes 和 Bytearray 的操作" -#: ../../library/stdtypes.rst:2727 +#: ../../library/stdtypes.rst:2733 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -4139,14 +4151,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:2735 +#: ../../library/stdtypes.rst:2741 msgid "" "The methods on bytes and bytearray objects don't accept strings as their " "arguments, just as the methods on strings don't accept bytes as their " "arguments. For example, you have to write::" msgstr "" -#: ../../library/stdtypes.rst:2739 +#: ../../library/stdtypes.rst:2745 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -4154,11 +4166,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:2742 +#: ../../library/stdtypes.rst:2748 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:2744 +#: ../../library/stdtypes.rst:2750 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -4166,60 +4178,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:2747 +#: ../../library/stdtypes.rst:2753 msgid "" "Some bytes and bytearray operations assume the use of ASCII compatible " "binary formats, and hence should be avoided when working with arbitrary " "binary data. These restrictions are covered below." msgstr "" -#: ../../library/stdtypes.rst:2752 +#: ../../library/stdtypes.rst:2758 msgid "" "Using these ASCII based operations to manipulate binary data that is not " "stored in an ASCII based format may lead to data corruption." msgstr "" -#: ../../library/stdtypes.rst:2755 +#: ../../library/stdtypes.rst:2761 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:2761 +#: ../../library/stdtypes.rst:2767 msgid "" "Return the number of non-overlapping occurrences of subsequence *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:2765 ../../library/stdtypes.rst:2870 -#: ../../library/stdtypes.rst:2892 ../../library/stdtypes.rst:2958 -#: ../../library/stdtypes.rst:2971 +#: ../../library/stdtypes.rst:2771 ../../library/stdtypes.rst:2876 +#: ../../library/stdtypes.rst:2898 ../../library/stdtypes.rst:2964 +#: ../../library/stdtypes.rst:2977 msgid "" "The subsequence to search for may be any :term:`bytes-like object` or an " "integer in the range 0 to 255." msgstr "" -#: ../../library/stdtypes.rst:2768 +#: ../../library/stdtypes.rst:2774 msgid "" "If *sub* is empty, returns the number of empty slices between characters " "which is the length of the bytes object plus one." msgstr "" -#: ../../library/stdtypes.rst:2771 ../../library/stdtypes.rst:2882 -#: ../../library/stdtypes.rst:2895 ../../library/stdtypes.rst:2961 -#: ../../library/stdtypes.rst:2974 +#: ../../library/stdtypes.rst:2777 ../../library/stdtypes.rst:2888 +#: ../../library/stdtypes.rst:2901 ../../library/stdtypes.rst:2967 +#: ../../library/stdtypes.rst:2980 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:2778 +#: ../../library/stdtypes.rst:2784 msgid "" "If the binary data starts with the *prefix* string, return " "``bytes[len(prefix):]``. Otherwise, return a copy of the original binary " "data::" msgstr "" -#: ../../library/stdtypes.rst:2782 +#: ../../library/stdtypes.rst:2788 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -4231,32 +4243,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:2787 +#: ../../library/stdtypes.rst:2793 msgid "The *prefix* may be any :term:`bytes-like object`." -msgstr "" - -#: ../../library/stdtypes.rst:2791 ../../library/stdtypes.rst:2813 -#: ../../library/stdtypes.rst:2946 ../../library/stdtypes.rst:3039 -#: ../../library/stdtypes.rst:3053 ../../library/stdtypes.rst:3084 -#: ../../library/stdtypes.rst:3098 ../../library/stdtypes.rst:3140 -#: ../../library/stdtypes.rst:3211 ../../library/stdtypes.rst:3229 -#: ../../library/stdtypes.rst:3257 ../../library/stdtypes.rst:3396 -#: ../../library/stdtypes.rst:3451 ../../library/stdtypes.rst:3494 -#: ../../library/stdtypes.rst:3515 ../../library/stdtypes.rst:3537 -#: ../../library/stdtypes.rst:3739 +msgstr "*prefix* 可以是任何的 :term:`bytes-like object`。" + +#: ../../library/stdtypes.rst:2797 ../../library/stdtypes.rst:2819 +#: ../../library/stdtypes.rst:2952 ../../library/stdtypes.rst:3045 +#: ../../library/stdtypes.rst:3059 ../../library/stdtypes.rst:3090 +#: ../../library/stdtypes.rst:3104 ../../library/stdtypes.rst:3146 +#: ../../library/stdtypes.rst:3217 ../../library/stdtypes.rst:3235 +#: ../../library/stdtypes.rst:3263 ../../library/stdtypes.rst:3402 +#: ../../library/stdtypes.rst:3457 ../../library/stdtypes.rst:3500 +#: ../../library/stdtypes.rst:3521 ../../library/stdtypes.rst:3543 +#: ../../library/stdtypes.rst:3745 msgid "" "The bytearray version of this method does *not* operate in place - it always " "produces a new object, even if no changes were made." msgstr "" -#: ../../library/stdtypes.rst:2800 +#: ../../library/stdtypes.rst:2806 msgid "" "If the binary data ends with the *suffix* string and that *suffix* is not " "empty, return ``bytes[:-len(suffix)]``. Otherwise, return a copy of the " "original binary data::" msgstr "" -#: ../../library/stdtypes.rst:2804 +#: ../../library/stdtypes.rst:2810 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -4268,15 +4280,15 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:2809 +#: ../../library/stdtypes.rst:2815 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2822 +#: ../../library/stdtypes.rst:2828 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:2827 +#: ../../library/stdtypes.rst:2833 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -4284,21 +4296,21 @@ msgid "" "`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:2833 +#: ../../library/stdtypes.rst:2839 msgid "" "For performance reasons, the value of *errors* is not checked for validity " "unless a decoding error actually occurs, :ref:`devmode` is enabled or a :ref:" "`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:2839 +#: ../../library/stdtypes.rst:2845 msgid "" "Passing the *encoding* argument to :class:`str` allows decoding any :term:" "`bytes-like object` directly, without needing to make a temporary :class:`!" "bytes` or :class:`!bytearray` object." msgstr "" -#: ../../library/stdtypes.rst:2854 +#: ../../library/stdtypes.rst:2860 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -4306,11 +4318,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:2859 +#: ../../library/stdtypes.rst:2865 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2865 +#: ../../library/stdtypes.rst:2871 msgid "" "Return the lowest index in the data where the subsequence *sub* is found, " "such that *sub* is contained in the slice ``s[start:end]``. Optional " @@ -4318,14 +4330,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:2875 +#: ../../library/stdtypes.rst:2881 msgid "" "The :meth:`~bytes.find` method should be used only if you need to know the " "position of *sub*. To check if *sub* is a substring or not, use the :" "keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:2879 +#: ../../library/stdtypes.rst:2885 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -4333,13 +4345,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:2889 +#: ../../library/stdtypes.rst:2895 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:2902 +#: ../../library/stdtypes.rst:2908 msgid "" "Return a bytes or bytearray object which is the concatenation of the binary " "data sequences in *iterable*. A :exc:`TypeError` will be raised if there " @@ -4349,7 +4361,7 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:2913 +#: ../../library/stdtypes.rst:2919 msgid "" "This static method returns a translation table usable for :meth:`bytes." "translate` that will map each character in *from* into the character at the " @@ -4357,7 +4369,7 @@ msgid "" "objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:2924 +#: ../../library/stdtypes.rst:2930 msgid "" "Split the sequence at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4366,24 +4378,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:2931 ../../library/stdtypes.rst:2988 +#: ../../library/stdtypes.rst:2937 ../../library/stdtypes.rst:2994 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2937 +#: ../../library/stdtypes.rst:2943 msgid "" "Return a copy of the sequence with all occurrences of subsequence *old* " "replaced by *new*. If the optional argument *count* is given, only the " "first *count* occurrences are replaced." msgstr "" -#: ../../library/stdtypes.rst:2941 +#: ../../library/stdtypes.rst:2947 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:2953 +#: ../../library/stdtypes.rst:2959 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -4391,13 +4403,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2968 +#: ../../library/stdtypes.rst:2974 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:2981 +#: ../../library/stdtypes.rst:2987 msgid "" "Split the sequence at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4406,7 +4418,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:2994 +#: ../../library/stdtypes.rst:3000 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -4414,11 +4426,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:2999 +#: ../../library/stdtypes.rst:3005 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3005 +#: ../../library/stdtypes.rst:3011 msgid "" "Return a copy of the bytes or bytearray object where all bytes occurring in " "the optional argument *delete* are removed, and the remaining bytes have " @@ -4426,18 +4438,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3010 +#: ../../library/stdtypes.rst:3016 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3013 +#: ../../library/stdtypes.rst:3019 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3016 +#: ../../library/stdtypes.rst:3022 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -4445,11 +4457,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3019 +#: ../../library/stdtypes.rst:3025 msgid "*delete* is now supported as a keyword argument." -msgstr "" +msgstr "支援 *delete* 關鍵字引數。" -#: ../../library/stdtypes.rst:3023 +#: ../../library/stdtypes.rst:3029 msgid "" "The following methods on bytes and bytearray objects have default behaviours " "that assume the use of ASCII compatible binary formats, but can still be " @@ -4458,7 +4470,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3032 +#: ../../library/stdtypes.rst:3038 msgid "" "Return a copy of the object centered in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4466,7 +4478,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3046 +#: ../../library/stdtypes.rst:3052 msgid "" "Return a copy of the object left justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4474,7 +4486,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3060 +#: ../../library/stdtypes.rst:3066 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -4484,7 +4496,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3067 +#: ../../library/stdtypes.rst:3073 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -4496,14 +4508,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3072 +#: ../../library/stdtypes.rst:3078 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removeprefix` for a method that will remove a " "single prefix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3077 +#: ../../library/stdtypes.rst:3083 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -4515,7 +4527,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3091 +#: ../../library/stdtypes.rst:3097 msgid "" "Return a copy of the object right justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4523,7 +4535,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3105 +#: ../../library/stdtypes.rst:3111 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are " @@ -4533,7 +4545,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3116 +#: ../../library/stdtypes.rst:3122 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -4543,7 +4555,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3123 +#: ../../library/stdtypes.rst:3129 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -4555,14 +4567,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3128 +#: ../../library/stdtypes.rst:3134 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removesuffix` for a method that will remove a " "single suffix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3133 +#: ../../library/stdtypes.rst:3139 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -4574,7 +4586,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3147 +#: ../../library/stdtypes.rst:3153 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given and non-negative, at most " @@ -4583,7 +4595,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3153 +#: ../../library/stdtypes.rst:3159 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty subsequences (for example, ``b'1,,2'.split(b',')`` " @@ -4594,7 +4606,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3163 +#: ../../library/stdtypes.rst:3169 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -4614,7 +4626,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3172 +#: ../../library/stdtypes.rst:3178 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive ASCII whitespace are regarded as a single " @@ -4624,7 +4636,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3182 +#: ../../library/stdtypes.rst:3188 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -4640,7 +4652,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3193 +#: ../../library/stdtypes.rst:3199 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " "removed. The *chars* argument is a binary sequence specifying the set of " @@ -4650,7 +4662,7 @@ msgid "" "a prefix or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3201 +#: ../../library/stdtypes.rst:3207 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -4662,13 +4674,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3206 +#: ../../library/stdtypes.rst:3212 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3215 +#: ../../library/stdtypes.rst:3221 msgid "" "The following methods on bytes and bytearray objects assume the use of ASCII " "compatible binary formats and should not be applied to arbitrary binary " @@ -4676,14 +4688,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3223 +#: ../../library/stdtypes.rst:3229 msgid "" "Return a copy of the sequence with each byte interpreted as an ASCII " "character, and the first byte capitalized and the rest lowercased. Non-ASCII " "byte values are passed through unchanged." msgstr "" -#: ../../library/stdtypes.rst:3236 +#: ../../library/stdtypes.rst:3242 msgid "" "Return a copy of the sequence where all ASCII tab characters are replaced by " "one or more ASCII spaces, depending on the current column and the given tab " @@ -4699,7 +4711,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3250 +#: ../../library/stdtypes.rst:3256 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -4711,7 +4723,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:3264 +#: ../../library/stdtypes.rst:3270 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -4720,7 +4732,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3272 +#: ../../library/stdtypes.rst:3278 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -4732,7 +4744,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:3281 +#: ../../library/stdtypes.rst:3287 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -4740,7 +4752,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3288 +#: ../../library/stdtypes.rst:3294 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -4752,20 +4764,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:3297 +#: ../../library/stdtypes.rst:3303 msgid "" "Return ``True`` if the sequence is empty or all bytes in the sequence are " "ASCII, ``False`` otherwise. ASCII bytes are in the range 0-0x7F." msgstr "" -#: ../../library/stdtypes.rst:3307 +#: ../../library/stdtypes.rst:3313 msgid "" "Return ``True`` if all bytes in the sequence are ASCII decimal digits and " "the sequence is not empty, ``False`` otherwise. ASCII decimal digits are " "those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3313 +#: ../../library/stdtypes.rst:3319 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -4777,13 +4789,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:3322 +#: ../../library/stdtypes.rst:3328 msgid "" "Return ``True`` if there is at least one lowercase ASCII character in the " "sequence and no uppercase ASCII characters, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:3327 +#: ../../library/stdtypes.rst:3333 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -4795,16 +4807,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:3332 ../../library/stdtypes.rst:3374 -#: ../../library/stdtypes.rst:3390 ../../library/stdtypes.rst:3440 -#: ../../library/stdtypes.rst:3509 +#: ../../library/stdtypes.rst:3338 ../../library/stdtypes.rst:3380 +#: ../../library/stdtypes.rst:3396 ../../library/stdtypes.rst:3446 +#: ../../library/stdtypes.rst:3515 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " "values in the sequence ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3340 +#: ../../library/stdtypes.rst:3346 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -4812,14 +4824,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3349 +#: ../../library/stdtypes.rst:3355 msgid "" "Return ``True`` if the sequence is ASCII titlecase and the sequence is not " "empty, ``False`` otherwise. See :meth:`bytes.title` for more details on the " "definition of \"titlecase\"." msgstr "" -#: ../../library/stdtypes.rst:3355 +#: ../../library/stdtypes.rst:3361 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -4831,14 +4843,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:3364 +#: ../../library/stdtypes.rst:3370 msgid "" "Return ``True`` if there is at least one uppercase alphabetic ASCII " "character in the sequence and no lowercase ASCII characters, ``False`` " "otherwise." msgstr "" -#: ../../library/stdtypes.rst:3369 +#: ../../library/stdtypes.rst:3375 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -4850,13 +4862,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:3382 +#: ../../library/stdtypes.rst:3388 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3387 +#: ../../library/stdtypes.rst:3393 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -4864,7 +4876,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:3407 +#: ../../library/stdtypes.rst:3413 msgid "" "Return a list of the lines in the binary sequence, breaking at ASCII line " "boundaries. This method uses the :term:`universal newlines` approach to " @@ -4872,7 +4884,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3414 +#: ../../library/stdtypes.rst:3420 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -4884,14 +4896,14 @@ msgstr "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" -#: ../../library/stdtypes.rst:3419 +#: ../../library/stdtypes.rst:3425 msgid "" "Unlike :meth:`~bytes.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:3423 +#: ../../library/stdtypes.rst:3429 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -4903,13 +4915,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:3432 +#: ../../library/stdtypes.rst:3438 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart and vice-versa." msgstr "" -#: ../../library/stdtypes.rst:3437 +#: ../../library/stdtypes.rst:3443 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -4917,7 +4929,7 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:3444 +#: ../../library/stdtypes.rst:3450 msgid "" "Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " @@ -4925,14 +4937,14 @@ msgid "" "Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3458 +#: ../../library/stdtypes.rst:3464 msgid "" "Return a titlecased version of the binary sequence where words start with an " "uppercase ASCII character and the remaining characters are lowercase. " "Uncased byte values are left unmodified." msgstr "" -#: ../../library/stdtypes.rst:3464 +#: ../../library/stdtypes.rst:3470 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -4940,7 +4952,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:3467 +#: ../../library/stdtypes.rst:3473 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -4948,7 +4960,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3477 +#: ../../library/stdtypes.rst:3483 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -4956,12 +4968,12 @@ msgstr "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:3480 +#: ../../library/stdtypes.rst:3486 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3482 +#: ../../library/stdtypes.rst:3488 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -4983,13 +4995,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:3501 +#: ../../library/stdtypes.rst:3507 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3506 +#: ../../library/stdtypes.rst:3512 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -4997,7 +5009,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:3522 +#: ../../library/stdtypes.rst:3528 msgid "" "Return a copy of the sequence left filled with ASCII ``b'0'`` digits to make " "a sequence of length *width*. A leading sign prefix (``b'+'``/ ``b'-'``) is " @@ -5006,7 +5018,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:3530 +#: ../../library/stdtypes.rst:3536 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -5018,11 +5030,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:3544 +#: ../../library/stdtypes.rst:3550 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:3561 +#: ../../library/stdtypes.rst:3567 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -5030,7 +5042,7 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:3566 +#: ../../library/stdtypes.rst:3572 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -5040,7 +5052,7 @@ msgid "" "func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:3573 +#: ../../library/stdtypes.rst:3579 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -5048,7 +5060,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:3607 +#: ../../library/stdtypes.rst:3613 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the bytes object *must* include a parenthesised mapping key into " @@ -5056,73 +5068,73 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:3681 +#: ../../library/stdtypes.rst:3687 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:3684 +#: ../../library/stdtypes.rst:3690 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:3684 +#: ../../library/stdtypes.rst:3690 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:3694 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3691 +#: ../../library/stdtypes.rst:3697 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:3694 +#: ../../library/stdtypes.rst:3700 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3694 +#: ../../library/stdtypes.rst:3700 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:3729 +#: ../../library/stdtypes.rst:3735 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." -msgstr "" +msgstr "``b'%s'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3732 +#: ../../library/stdtypes.rst:3738 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." -msgstr "" +msgstr "``b'%r'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3744 +#: ../../library/stdtypes.rst:3750 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:3751 +#: ../../library/stdtypes.rst:3757 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:3753 +#: ../../library/stdtypes.rst:3759 msgid "" ":class:`memoryview` objects allow Python code to access the internal data of " "an object that supports the :ref:`buffer protocol ` without " "copying." msgstr "" -#: ../../library/stdtypes.rst:3759 +#: ../../library/stdtypes.rst:3765 msgid "" "Create a :class:`memoryview` that references *object*. *object* must " "support the buffer protocol. Built-in objects that support the buffer " "protocol include :class:`bytes` and :class:`bytearray`." msgstr "" -#: ../../library/stdtypes.rst:3763 +#: ../../library/stdtypes.rst:3769 msgid "" "A :class:`memoryview` has the notion of an *element*, which is the atomic " "memory unit handled by the originating *object*. For many simple types such " @@ -5130,32 +5142,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:3768 +#: ../../library/stdtypes.rst:3774 msgid "" "``len(view)`` is equal to the length of :class:`~memoryview.tolist`, which " "is the nested list representation of the view. If ``view.ndim = 1``, this is " "equal to the number of elements in the view." msgstr "" -#: ../../library/stdtypes.rst:3772 +#: ../../library/stdtypes.rst:3778 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:3775 +#: ../../library/stdtypes.rst:3781 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:3778 +#: ../../library/stdtypes.rst:3784 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:3781 +#: ../../library/stdtypes.rst:3787 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -5177,7 +5189,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:3791 +#: ../../library/stdtypes.rst:3797 msgid "" "If :class:`~memoryview.format` is one of the native format specifiers from " "the :mod:`struct` module, indexing with an integer or a tuple of integers is " @@ -5188,11 +5200,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:3800 +#: ../../library/stdtypes.rst:3806 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:3802 +#: ../../library/stdtypes.rst:3808 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -5214,13 +5226,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:3812 +#: ../../library/stdtypes.rst:3818 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:3815 +#: ../../library/stdtypes.rst:3821 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -5260,14 +5272,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:3833 +#: ../../library/stdtypes.rst:3839 msgid "" "One-dimensional memoryviews of :term:`hashable` (read-only) types with " "formats 'B', 'b' or 'c' are also hashable. The hash is defined as ``hash(m) " "== hash(m.tobytes())``::" msgstr "" -#: ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:3843 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -5285,40 +5297,40 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:3845 +#: ../../library/stdtypes.rst:3851 msgid "" "One-dimensional memoryviews can now be sliced. One-dimensional memoryviews " "with formats 'B', 'b' or 'c' are now :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:3849 +#: ../../library/stdtypes.rst:3855 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" -#: ../../library/stdtypes.rst:3853 +#: ../../library/stdtypes.rst:3859 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:3856 +#: ../../library/stdtypes.rst:3862 msgid ":class:`memoryview` has several methods:" -msgstr "" +msgstr ":class:`memoryview` 有幾個方法:" -#: ../../library/stdtypes.rst:3860 +#: ../../library/stdtypes.rst:3866 msgid "" "A memoryview and a :pep:`3118` exporter are equal if their shapes are " "equivalent and if all corresponding values are equal when the operands' " "respective format codes are interpreted using :mod:`struct` syntax." msgstr "" -#: ../../library/stdtypes.rst:3864 +#: ../../library/stdtypes.rst:3870 msgid "" "For the subset of :mod:`struct` format strings currently supported by :meth:" "`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == w.tolist()``::" msgstr "" -#: ../../library/stdtypes.rst:3867 +#: ../../library/stdtypes.rst:3873 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -5352,14 +5364,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:3883 +#: ../../library/stdtypes.rst:3889 msgid "" "If either format string is not supported by the :mod:`struct` module, then " "the objects will always compare as unequal (even if the format strings and " "buffer contents are identical)::" msgstr "" -#: ../../library/stdtypes.rst:3887 +#: ../../library/stdtypes.rst:3893 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -5385,25 +5397,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:3899 +#: ../../library/stdtypes.rst:3905 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:3902 +#: ../../library/stdtypes.rst:3908 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:3908 +#: ../../library/stdtypes.rst:3914 msgid "" "Return the data in the buffer as a bytestring. This is equivalent to " "calling the :class:`bytes` constructor on the memoryview. ::" msgstr "" -#: ../../library/stdtypes.rst:3911 +#: ../../library/stdtypes.rst:3917 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -5417,7 +5429,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:3917 +#: ../../library/stdtypes.rst:3923 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -5425,7 +5437,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:3922 +#: ../../library/stdtypes.rst:3928 msgid "" "*order* can be {'C', 'F', 'A'}. When *order* is 'C' or 'F', the data of the " "original array is converted to C or Fortran order. For contiguous views, 'A' " @@ -5434,13 +5446,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:3931 +#: ../../library/stdtypes.rst:3937 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:3934 +#: ../../library/stdtypes.rst:3940 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -5450,18 +5462,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:3940 +#: ../../library/stdtypes.rst:3946 msgid "" "Similar to :meth:`bytes.hex`, :meth:`memoryview.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:3947 +#: ../../library/stdtypes.rst:3953 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:3949 +#: ../../library/stdtypes.rst:3955 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -5479,19 +5491,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:3957 +#: ../../library/stdtypes.rst:3963 msgid "" ":meth:`tolist` now supports all single character native formats in :mod:" "`struct` module syntax as well as multi-dimensional representations." msgstr "" -#: ../../library/stdtypes.rst:3964 +#: ../../library/stdtypes.rst:3970 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:3967 +#: ../../library/stdtypes.rst:3973 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -5517,7 +5529,7 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:3983 +#: ../../library/stdtypes.rst:3989 msgid "" "Release the underlying buffer exposed by the memoryview object. Many " "objects take special actions when a view is held on them (for example, a :" @@ -5526,14 +5538,14 @@ msgid "" "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:3989 +#: ../../library/stdtypes.rst:3995 msgid "" "After this method has been called, any further operation on the view raises " "a :class:`ValueError` (except :meth:`release` itself which can be called " "multiple times)::" msgstr "" -#: ../../library/stdtypes.rst:3993 +#: ../../library/stdtypes.rst:3999 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -5549,13 +5561,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4000 +#: ../../library/stdtypes.rst:4006 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4003 +#: ../../library/stdtypes.rst:4009 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -5575,7 +5587,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4016 +#: ../../library/stdtypes.rst:4022 msgid "" "Cast a memoryview to a new format or shape. *shape* defaults to " "``[byte_length//new_itemsize]``, which means that the result view will be " @@ -5584,7 +5596,7 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4022 +#: ../../library/stdtypes.rst:4028 msgid "" "The destination format is restricted to a single element native format in :" "mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' or " @@ -5592,11 +5604,11 @@ msgid "" "Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4028 +#: ../../library/stdtypes.rst:4034 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4030 +#: ../../library/stdtypes.rst:4036 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -5640,11 +5652,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4051 +#: ../../library/stdtypes.rst:4057 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4053 +#: ../../library/stdtypes.rst:4059 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -5668,11 +5680,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4064 +#: ../../library/stdtypes.rst:4070 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4066 +#: ../../library/stdtypes.rst:4072 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -5722,11 +5734,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4090 +#: ../../library/stdtypes.rst:4096 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4092 +#: ../../library/stdtypes.rst:4098 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -5748,19 +5760,19 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4104 +#: ../../library/stdtypes.rst:4110 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4107 +#: ../../library/stdtypes.rst:4113 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4111 +#: ../../library/stdtypes.rst:4117 msgid "The underlying object of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:4119 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -5772,14 +5784,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4122 +#: ../../library/stdtypes.rst:4128 msgid "" "``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is the " "amount of space in bytes that the array would use in a contiguous " "representation. It is not necessarily equal to ``len(m)``::" msgstr "" -#: ../../library/stdtypes.rst:4126 +#: ../../library/stdtypes.rst:4132 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -5811,11 +5823,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4141 +#: ../../library/stdtypes.rst:4147 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4143 +#: ../../library/stdtypes.rst:4149 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -5839,11 +5851,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4158 +#: ../../library/stdtypes.rst:4164 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4162 +#: ../../library/stdtypes.rst:4168 msgid "" "A string containing the format (in :mod:`struct` module style) for each " "element in the view. A memoryview can be created from exporters with " @@ -5851,17 +5863,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4167 +#: ../../library/stdtypes.rst:4173 msgid "" "format ``'B'`` is now handled according to the struct module syntax. This " "means that ``memoryview(b'abc')[0] == b'abc'[0] == 97``." msgstr "" -#: ../../library/stdtypes.rst:4173 +#: ../../library/stdtypes.rst:4179 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4175 +#: ../../library/stdtypes.rst:4181 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -5881,49 +5893,49 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4186 +#: ../../library/stdtypes.rst:4192 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4191 +#: ../../library/stdtypes.rst:4197 msgid "" "A tuple of integers the length of :attr:`ndim` giving the shape of the " "memory as an N-dimensional array." msgstr "" -#: ../../library/stdtypes.rst:4194 ../../library/stdtypes.rst:4202 +#: ../../library/stdtypes.rst:4200 ../../library/stdtypes.rst:4208 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4199 +#: ../../library/stdtypes.rst:4205 msgid "" "A tuple of integers the length of :attr:`ndim` giving the size in bytes to " "access each element for each dimension of the array." msgstr "" -#: ../../library/stdtypes.rst:4207 +#: ../../library/stdtypes.rst:4213 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4211 +#: ../../library/stdtypes.rst:4217 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4217 +#: ../../library/stdtypes.rst:4223 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4223 +#: ../../library/stdtypes.rst:4229 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4231 +#: ../../library/stdtypes.rst:4237 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4235 +#: ../../library/stdtypes.rst:4241 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -5933,7 +5945,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4242 +#: ../../library/stdtypes.rst:4248 msgid "" "Like other collections, sets support ``x in set``, ``len(set)``, and ``for x " "in set``. Being an unordered collection, sets do not record element " @@ -5941,7 +5953,7 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4247 +#: ../../library/stdtypes.rst:4253 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " @@ -5953,18 +5965,18 @@ msgid "" "of another set." msgstr "" -#: ../../library/stdtypes.rst:4255 +#: ../../library/stdtypes.rst:4261 msgid "" "Non-empty sets (not frozensets) can be created by placing a comma-separated " "list of elements within braces, for example: ``{'jack', 'sjoerd'}``, in " "addition to the :class:`set` constructor." msgstr "" -#: ../../library/stdtypes.rst:4259 +#: ../../library/stdtypes.rst:4265 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4264 +#: ../../library/stdtypes.rst:4270 msgid "" "Return a new set or frozenset object whose elements are taken from " "*iterable*. The elements of a set must be :term:`hashable`. To represent " @@ -5972,92 +5984,92 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4270 +#: ../../library/stdtypes.rst:4276 msgid "Sets can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4272 +#: ../../library/stdtypes.rst:4278 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4273 +#: ../../library/stdtypes.rst:4279 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4274 +#: ../../library/stdtypes.rst:4280 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4276 +#: ../../library/stdtypes.rst:4282 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4281 +#: ../../library/stdtypes.rst:4287 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4285 +#: ../../library/stdtypes.rst:4291 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4289 +#: ../../library/stdtypes.rst:4295 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4293 +#: ../../library/stdtypes.rst:4299 msgid "" "Return ``True`` if the set has no elements in common with *other*. Sets are " "disjoint if and only if their intersection is the empty set." msgstr "" -#: ../../library/stdtypes.rst:4299 +#: ../../library/stdtypes.rst:4305 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4303 +#: ../../library/stdtypes.rst:4309 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4309 +#: ../../library/stdtypes.rst:4315 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4313 +#: ../../library/stdtypes.rst:4319 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4319 +#: ../../library/stdtypes.rst:4325 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4324 +#: ../../library/stdtypes.rst:4330 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4329 +#: ../../library/stdtypes.rst:4335 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4334 +#: ../../library/stdtypes.rst:4340 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4338 +#: ../../library/stdtypes.rst:4344 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4341 +#: ../../library/stdtypes.rst:4347 msgid "" "Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" "meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" @@ -6067,7 +6079,7 @@ msgid "" "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4348 +#: ../../library/stdtypes.rst:4354 msgid "" "Both :class:`set` and :class:`frozenset` support set to set comparisons. Two " "sets are equal if and only if every element of each set is contained in the " @@ -6077,14 +6089,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4355 +#: ../../library/stdtypes.rst:4361 msgid "" "Instances of :class:`set` are compared to instances of :class:`frozenset` " "based on their members. For example, ``set('abc') == frozenset('abc')`` " "returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``." msgstr "" -#: ../../library/stdtypes.rst:4359 +#: ../../library/stdtypes.rst:4365 msgid "" "The subset and equality comparisons do not generalize to a total ordering " "function. For example, any two nonempty disjoint sets are not equal and are " @@ -6092,71 +6104,71 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4364 +#: ../../library/stdtypes.rst:4370 msgid "" "Since sets only define partial ordering (subset relationships), the output " "of the :meth:`list.sort` method is undefined for lists of sets." msgstr "" -#: ../../library/stdtypes.rst:4367 +#: ../../library/stdtypes.rst:4373 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4369 +#: ../../library/stdtypes.rst:4375 msgid "" "Binary operations that mix :class:`set` instances with :class:`frozenset` " "return the type of the first operand. For example: ``frozenset('ab') | " "set('bc')`` returns an instance of :class:`frozenset`." msgstr "" -#: ../../library/stdtypes.rst:4373 +#: ../../library/stdtypes.rst:4379 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4379 +#: ../../library/stdtypes.rst:4385 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4384 +#: ../../library/stdtypes.rst:4390 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4389 +#: ../../library/stdtypes.rst:4395 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4394 +#: ../../library/stdtypes.rst:4400 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4398 +#: ../../library/stdtypes.rst:4404 msgid "Add element *elem* to the set." -msgstr "" +msgstr "將元素 *elem* 加入集合。" -#: ../../library/stdtypes.rst:4402 +#: ../../library/stdtypes.rst:4408 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4407 +#: ../../library/stdtypes.rst:4413 msgid "Remove element *elem* from the set if it is present." msgstr "" -#: ../../library/stdtypes.rst:4411 +#: ../../library/stdtypes.rst:4417 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4416 +#: ../../library/stdtypes.rst:4422 msgid "Remove all elements from the set." -msgstr "" +msgstr "從集合中移除所有元素。" -#: ../../library/stdtypes.rst:4419 +#: ../../library/stdtypes.rst:4425 msgid "" "Note, the non-operator versions of the :meth:`update`, :meth:" "`intersection_update`, :meth:`difference_update`, and :meth:" @@ -6164,18 +6176,18 @@ msgid "" "argument." msgstr "" -#: ../../library/stdtypes.rst:4424 +#: ../../library/stdtypes.rst:4430 msgid "" "Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" "`remove`, and :meth:`discard` methods may be a set. To support searching " "for an equivalent frozenset, a temporary one is created from *elem*." msgstr "" -#: ../../library/stdtypes.rst:4433 +#: ../../library/stdtypes.rst:4439 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4443 +#: ../../library/stdtypes.rst:4449 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -6184,7 +6196,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:4449 +#: ../../library/stdtypes.rst:4455 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -6193,33 +6205,33 @@ msgid "" "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4460 +#: ../../library/stdtypes.rst:4466 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4463 +#: ../../library/stdtypes.rst:4469 msgid "Dictionaries can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4465 +#: ../../library/stdtypes.rst:4471 msgid "" "Use a comma-separated list of ``key: value`` pairs within braces: ``{'jack': " "4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4467 +#: ../../library/stdtypes.rst:4473 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4468 +#: ../../library/stdtypes.rst:4474 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:4471 +#: ../../library/stdtypes.rst:4477 msgid "" "If no positional argument is given, an empty dictionary is created. If a " "positional argument is given and it defines a ``keys()`` method, a " @@ -6232,7 +6244,7 @@ msgid "" "that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:4481 +#: ../../library/stdtypes.rst:4487 msgid "" "If keyword arguments are given, the keyword arguments and their values are " "added to the dictionary created from the positional argument. If a key " @@ -6240,13 +6252,13 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:4486 +#: ../../library/stdtypes.rst:4492 msgid "" "To illustrate, the following examples all return a dictionary equal to " "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:4489 +#: ../../library/stdtypes.rst:4495 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -6266,33 +6278,33 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:4498 +#: ../../library/stdtypes.rst:4504 msgid "" "Providing keyword arguments as in the first example only works for keys that " "are valid Python identifiers. Otherwise, any valid keys can be used." msgstr "" -#: ../../library/stdtypes.rst:4502 +#: ../../library/stdtypes.rst:4508 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:4507 +#: ../../library/stdtypes.rst:4513 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4511 +#: ../../library/stdtypes.rst:4517 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4515 +#: ../../library/stdtypes.rst:4521 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:4520 +#: ../../library/stdtypes.rst:4526 msgid "" "If a subclass of dict defines a method :meth:`__missing__` and *key* is not " "present, the ``d[key]`` operation calls that method with the key *key* as " @@ -6303,7 +6315,7 @@ msgid "" "an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:4528 +#: ../../library/stdtypes.rst:4534 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -6327,51 +6339,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:4539 +#: ../../library/stdtypes.rst:4545 msgid "" "The example above shows part of the implementation of :class:`collections." "Counter`. A different ``__missing__`` method is used by :class:`collections." "defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:4545 +#: ../../library/stdtypes.rst:4551 msgid "Set ``d[key]`` to *value*." -msgstr "" +msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:4549 +#: ../../library/stdtypes.rst:4555 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." -msgstr "" +msgstr "從 *d* 中移除 ``d[key]``。若 *key* 不在對映中則引發 :exc:`KeyError`。" -#: ../../library/stdtypes.rst:4554 +#: ../../library/stdtypes.rst:4560 msgid "Return ``True`` if *d* has a key *key*, else ``False``." -msgstr "" +msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:4558 +#: ../../library/stdtypes.rst:4564 msgid "Equivalent to ``not key in d``." -msgstr "" +msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:4562 +#: ../../library/stdtypes.rst:4568 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4567 +#: ../../library/stdtypes.rst:4573 msgid "Remove all items from the dictionary." -msgstr "" +msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:4571 +#: ../../library/stdtypes.rst:4577 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4575 +#: ../../library/stdtypes.rst:4581 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:4577 +#: ../../library/stdtypes.rst:4583 msgid "" ":meth:`fromkeys` is a class method that returns a new dictionary. *value* " "defaults to ``None``. All of the values refer to just a single instance, so " @@ -6380,70 +6392,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:4585 +#: ../../library/stdtypes.rst:4591 msgid "" "Return the value for *key* if *key* is in the dictionary, else *default*. If " "*default* is not given, it defaults to ``None``, so that this method never " "raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4591 +#: ../../library/stdtypes.rst:4597 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4596 +#: ../../library/stdtypes.rst:4602 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:4601 +#: ../../library/stdtypes.rst:4607 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " "*default*. If *default* is not given and *key* is not in the dictionary, a :" "exc:`KeyError` is raised." msgstr "" -#: ../../library/stdtypes.rst:4607 +#: ../../library/stdtypes.rst:4613 msgid "" "Remove and return a ``(key, value)`` pair from the dictionary. Pairs are " "returned in :abbr:`LIFO (last-in, first-out)` order." msgstr "" -#: ../../library/stdtypes.rst:4610 +#: ../../library/stdtypes.rst:4616 msgid "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " "often used in set algorithms. If the dictionary is empty, calling :meth:" "`popitem` raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4614 +#: ../../library/stdtypes.rst:4620 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:4620 +#: ../../library/stdtypes.rst:4626 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4627 +#: ../../library/stdtypes.rst:4633 msgid "" "If *key* is in the dictionary, return its value. If not, insert *key* with " "a value of *default* and return *default*. *default* defaults to ``None``." msgstr "" -#: ../../library/stdtypes.rst:4633 +#: ../../library/stdtypes.rst:4639 msgid "" "Update the dictionary with the key/value pairs from *other*, overwriting " "existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:4636 +#: ../../library/stdtypes.rst:4642 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -6452,20 +6464,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:4644 +#: ../../library/stdtypes.rst:4650 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4647 +#: ../../library/stdtypes.rst:4653 msgid "" "An equality comparison between one ``dict.values()`` view and another will " "always return ``False``. This also applies when comparing ``dict.values()`` " "to itself::" msgstr "" -#: ../../library/stdtypes.rst:4651 +#: ../../library/stdtypes.rst:4657 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -6475,34 +6487,34 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:4657 +#: ../../library/stdtypes.rst:4663 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4665 +#: ../../library/stdtypes.rst:4671 msgid "" "Update the dictionary *d* with keys and values from *other*, which may be " "either a :term:`mapping` or an :term:`iterable` of key/value pairs. The " "values of *other* take priority when *d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4671 +#: ../../library/stdtypes.rst:4677 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " "'>') raise :exc:`TypeError`." msgstr "" -#: ../../library/stdtypes.rst:4675 +#: ../../library/stdtypes.rst:4681 msgid "" "Dictionaries preserve insertion order. Note that updating a key does not " "affect the order. Keys added after deletion are inserted at the end. ::" msgstr "" -#: ../../library/stdtypes.rst:4678 +#: ../../library/stdtypes.rst:4684 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6534,17 +6546,17 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:4693 +#: ../../library/stdtypes.rst:4699 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4697 +#: ../../library/stdtypes.rst:4703 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:4699 +#: ../../library/stdtypes.rst:4705 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6566,21 +6578,21 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:4709 +#: ../../library/stdtypes.rst:4715 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4714 +#: ../../library/stdtypes.rst:4720 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:4721 +#: ../../library/stdtypes.rst:4727 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:4723 +#: ../../library/stdtypes.rst:4729 msgid "" "The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" "`dict.items` are *view objects*. They provide a dynamic view on the " @@ -6588,23 +6600,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:4728 +#: ../../library/stdtypes.rst:4734 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:4733 +#: ../../library/stdtypes.rst:4739 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4737 +#: ../../library/stdtypes.rst:4743 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4740 +#: ../../library/stdtypes.rst:4746 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -6612,39 +6624,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:4745 +#: ../../library/stdtypes.rst:4751 msgid "" "Iterating views while adding or deleting entries in the dictionary may raise " "a :exc:`RuntimeError` or fail to iterate over all entries." msgstr "" -#: ../../library/stdtypes.rst:4748 +#: ../../library/stdtypes.rst:4754 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:4753 +#: ../../library/stdtypes.rst:4759 msgid "" "Return ``True`` if *x* is in the underlying dictionary's keys, values or " "items (in the latter case, *x* should be a ``(key, value)`` tuple)." msgstr "" -#: ../../library/stdtypes.rst:4758 +#: ../../library/stdtypes.rst:4764 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" -#: ../../library/stdtypes.rst:4761 +#: ../../library/stdtypes.rst:4767 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4766 +#: ../../library/stdtypes.rst:4772 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:4771 +#: ../../library/stdtypes.rst:4777 msgid "" "Keys views are set-like since their entries are unique and :term:`hashable`. " "Items views also have set-like operations since the (key, value) pairs are " @@ -6658,11 +6670,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:4783 +#: ../../library/stdtypes.rst:4789 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:4785 +#: ../../library/stdtypes.rst:4791 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -6703,11 +6715,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:4827 +#: ../../library/stdtypes.rst:4833 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:4834 +#: ../../library/stdtypes.rst:4840 msgid "" "Python's :keyword:`with` statement supports the concept of a runtime context " "defined by a context manager. This is implemented using a pair of methods " @@ -6718,7 +6730,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:4842 +#: ../../library/stdtypes.rst:4848 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " @@ -6729,7 +6741,7 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:4847 +#: ../../library/stdtypes.rst:4853 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" @@ -6738,7 +6750,7 @@ msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:4851 +#: ../../library/stdtypes.rst:4857 msgid "" "An example of a context manager that returns a related object is the one " "returned by :func:`decimal.localcontext`. These managers set the active " @@ -6752,7 +6764,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的當前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:4861 +#: ../../library/stdtypes.rst:4867 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -6764,7 +6776,7 @@ msgstr "" "keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:4866 +#: ../../library/stdtypes.rst:4872 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -6779,7 +6791,7 @@ msgstr "" "(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" "的任何例外。" -#: ../../library/stdtypes.rst:4873 +#: ../../library/stdtypes.rst:4879 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -6791,7 +6803,7 @@ msgstr "" "已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" "`__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:4879 +#: ../../library/stdtypes.rst:4885 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -6803,7 +6815,7 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:4885 +#: ../../library/stdtypes.rst:4891 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -6818,7 +6830,7 @@ msgstr "" "`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" "理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:4892 +#: ../../library/stdtypes.rst:4898 msgid "" "Note that there is no specific slot for any of these methods in the type " "structure for Python objects in the Python/C API. Extension types wanting to " @@ -6830,7 +6842,7 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:4900 +#: ../../library/stdtypes.rst:4906 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" @@ -6838,7 +6850,7 @@ msgstr "" "型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" "ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:4911 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." @@ -6846,11 +6858,11 @@ msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:4912 +#: ../../library/stdtypes.rst:4918 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:4918 +#: ../../library/stdtypes.rst:4924 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -6866,7 +6878,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:4928 +#: ../../library/stdtypes.rst:4934 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -6874,7 +6886,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:4931 +#: ../../library/stdtypes.rst:4937 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -6882,7 +6894,7 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:4934 +#: ../../library/stdtypes.rst:4940 msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " @@ -6894,7 +6906,7 @@ msgstr "" "物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" "`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:4940 +#: ../../library/stdtypes.rst:4946 msgid "" "For a class which defines :meth:`~object.__class_getitem__` but is not a " "container, the argument(s) supplied to a subscription of the class will " @@ -6906,7 +6918,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:4946 +#: ../../library/stdtypes.rst:4952 msgid "" "If ``x = re.search('foo', 'foo')``, ``x`` will be a :ref:`re.Match ` object where the return values of ``x.group(0)`` and ``x[0]`` will " @@ -6918,7 +6930,7 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:4952 +#: ../../library/stdtypes.rst:4958 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " "``y`` will also be an instance of ``re.Match``, but the return values of ``y." @@ -6931,7 +6943,7 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:4958 +#: ../../library/stdtypes.rst:4964 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " @@ -6940,7 +6952,7 @@ msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:4964 +#: ../../library/stdtypes.rst:4970 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " @@ -6950,7 +6962,7 @@ msgstr "" "所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" "class:`list`: ::" -#: ../../library/stdtypes.rst:4969 +#: ../../library/stdtypes.rst:4975 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -6958,7 +6970,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:4972 +#: ../../library/stdtypes.rst:4978 msgid "" "Another example for :term:`mapping` objects, using a :class:`dict`, which is " "a generic type expecting two type parameters representing the key type and " @@ -6969,7 +6981,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:4977 +#: ../../library/stdtypes.rst:4983 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -6977,7 +6989,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:4980 +#: ../../library/stdtypes.rst:4986 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -6985,7 +6997,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:4983 +#: ../../library/stdtypes.rst:4989 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -6997,7 +7009,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:4988 +#: ../../library/stdtypes.rst:4994 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -7009,7 +7021,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:4994 +#: ../../library/stdtypes.rst:5000 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7019,13 +7031,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:4998 +#: ../../library/stdtypes.rst:5004 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5001 +#: ../../library/stdtypes.rst:5007 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7043,13 +7055,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5009 +#: ../../library/stdtypes.rst:5015 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5011 +#: ../../library/stdtypes.rst:5017 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -7063,7 +7075,7 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5017 +#: ../../library/stdtypes.rst:5023 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" @@ -7071,7 +7083,7 @@ msgstr "" "為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." "__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5020 +#: ../../library/stdtypes.rst:5026 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -7083,7 +7095,7 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5025 +#: ../../library/stdtypes.rst:5031 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " @@ -7093,7 +7105,7 @@ msgstr "" "的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." "__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5029 +#: ../../library/stdtypes.rst:5035 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -7105,245 +7117,255 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5036 +#: ../../library/stdtypes.rst:5042 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5038 +#: ../../library/stdtypes.rst:5044 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5041 +#: ../../library/stdtypes.rst:5047 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5042 +#: ../../library/stdtypes.rst:5048 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5043 +#: ../../library/stdtypes.rst:5049 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5044 +#: ../../library/stdtypes.rst:5050 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5045 +#: ../../library/stdtypes.rst:5051 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5046 +#: ../../library/stdtypes.rst:5052 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5047 +#: ../../library/stdtypes.rst:5053 +#, fuzzy +msgid ":class:`asyncio.Future`" +msgstr ":class:`tuple`" + +#: ../../library/stdtypes.rst:5054 +#, fuzzy +msgid ":class:`asyncio.Task`" +msgstr ":class:`list`" + +#: ../../library/stdtypes.rst:5055 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5048 +#: ../../library/stdtypes.rst:5056 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5049 +#: ../../library/stdtypes.rst:5057 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5050 +#: ../../library/stdtypes.rst:5058 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5051 +#: ../../library/stdtypes.rst:5059 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5052 +#: ../../library/stdtypes.rst:5060 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5053 +#: ../../library/stdtypes.rst:5061 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5054 +#: ../../library/stdtypes.rst:5062 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5055 +#: ../../library/stdtypes.rst:5063 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5056 +#: ../../library/stdtypes.rst:5064 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5057 +#: ../../library/stdtypes.rst:5065 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5058 +#: ../../library/stdtypes.rst:5066 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5059 +#: ../../library/stdtypes.rst:5067 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5060 +#: ../../library/stdtypes.rst:5068 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5061 +#: ../../library/stdtypes.rst:5069 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5062 +#: ../../library/stdtypes.rst:5070 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5063 +#: ../../library/stdtypes.rst:5071 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5064 +#: ../../library/stdtypes.rst:5072 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5065 +#: ../../library/stdtypes.rst:5073 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5066 +#: ../../library/stdtypes.rst:5074 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5067 +#: ../../library/stdtypes.rst:5075 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5068 +#: ../../library/stdtypes.rst:5076 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5069 +#: ../../library/stdtypes.rst:5077 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5070 +#: ../../library/stdtypes.rst:5078 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5071 +#: ../../library/stdtypes.rst:5079 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5072 +#: ../../library/stdtypes.rst:5080 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5081 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5074 +#: ../../library/stdtypes.rst:5082 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5075 +#: ../../library/stdtypes.rst:5083 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5076 +#: ../../library/stdtypes.rst:5084 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5077 +#: ../../library/stdtypes.rst:5085 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5078 +#: ../../library/stdtypes.rst:5086 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5079 +#: ../../library/stdtypes.rst:5087 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5080 +#: ../../library/stdtypes.rst:5088 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5081 +#: ../../library/stdtypes.rst:5089 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5082 +#: ../../library/stdtypes.rst:5090 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5083 +#: ../../library/stdtypes.rst:5091 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5084 +#: ../../library/stdtypes.rst:5092 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5085 +#: ../../library/stdtypes.rst:5093 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5086 +#: ../../library/stdtypes.rst:5094 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5087 +#: ../../library/stdtypes.rst:5095 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5088 +#: ../../library/stdtypes.rst:5096 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5089 +#: ../../library/stdtypes.rst:5097 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5090 +#: ../../library/stdtypes.rst:5098 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5091 +#: ../../library/stdtypes.rst:5099 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5092 +#: ../../library/stdtypes.rst:5100 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5093 +#: ../../library/stdtypes.rst:5101 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5094 +#: ../../library/stdtypes.rst:5102 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5099 +#: ../../library/stdtypes.rst:5107 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5101 +#: ../../library/stdtypes.rst:5109 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5105 +#: ../../library/stdtypes.rst:5113 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5107 +#: ../../library/stdtypes.rst:5115 msgid "" ">>> list[int].__origin__\n" "" @@ -7351,7 +7373,7 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5113 +#: ../../library/stdtypes.rst:5121 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " @@ -7360,7 +7382,7 @@ msgstr "" "此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" "class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5117 +#: ../../library/stdtypes.rst:5125 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -7368,7 +7390,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5123 +#: ../../library/stdtypes.rst:5131 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -7376,7 +7398,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5126 +#: ../../library/stdtypes.rst:5134 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -7390,7 +7412,7 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5134 +#: ../../library/stdtypes.rst:5142 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." @@ -7400,7 +7422,7 @@ msgstr "" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5141 +#: ../../library/stdtypes.rst:5149 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." @@ -7408,19 +7430,19 @@ msgstr "" "如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" "`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5149 +#: ../../library/stdtypes.rst:5157 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5150 +#: ../../library/stdtypes.rst:5158 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5152 +#: ../../library/stdtypes.rst:5160 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5153 +#: ../../library/stdtypes.rst:5161 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." @@ -7429,7 +7451,7 @@ msgstr "" "引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" "`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5157 +#: ../../library/stdtypes.rst:5165 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" @@ -7437,18 +7459,18 @@ msgstr "" ":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" "`typing.Generic`" -#: ../../library/stdtypes.rst:5158 +#: ../../library/stdtypes.rst:5166 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" "有關如何實作可以在 runtime 參數化並能被靜態型別檢查器理解的泛型類別的文件。" -#: ../../library/stdtypes.rst:5167 +#: ../../library/stdtypes.rst:5175 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5173 +#: ../../library/stdtypes.rst:5181 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -7461,7 +7483,7 @@ msgstr "" "釋 (type annotation) `。與 :data:`typing.Union` 相比,聯合型別運" "算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5180 +#: ../../library/stdtypes.rst:5188 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " @@ -7472,7 +7494,7 @@ msgstr "" "``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" "class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5185 +#: ../../library/stdtypes.rst:5193 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -7480,7 +7502,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5190 +#: ../../library/stdtypes.rst:5198 msgid "" "The ``|`` operand cannot be used at runtime to define unions where one or " "more members is a forward reference. For example, ``int | \"Foo\"``, where " @@ -7493,58 +7515,58 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5198 +#: ../../library/stdtypes.rst:5206 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5200 +#: ../../library/stdtypes.rst:5208 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5202 +#: ../../library/stdtypes.rst:5210 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5204 +#: ../../library/stdtypes.rst:5212 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5206 +#: ../../library/stdtypes.rst:5214 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:5216 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5210 +#: ../../library/stdtypes.rst:5218 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5212 +#: ../../library/stdtypes.rst:5220 msgid "It is compatible with :data:`typing.Union`::" msgstr "它與 :data:`typing.Union` 相容: ::" -#: ../../library/stdtypes.rst:5214 +#: ../../library/stdtypes.rst:5222 msgid "int | str == typing.Union[int, str]" msgstr "int | str == typing.Union[int, str]" -#: ../../library/stdtypes.rst:5216 +#: ../../library/stdtypes.rst:5224 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5218 +#: ../../library/stdtypes.rst:5226 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5223 +#: ../../library/stdtypes.rst:5231 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5226 +#: ../../library/stdtypes.rst:5234 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -7552,14 +7574,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5229 +#: ../../library/stdtypes.rst:5237 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5232 +#: ../../library/stdtypes.rst:5240 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -7569,7 +7591,7 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5239 +#: ../../library/stdtypes.rst:5247 msgid "" "The user-exposed type for the union object can be accessed from :data:`types." "UnionType` and used for :func:`isinstance` checks. An object cannot be " @@ -7578,7 +7600,7 @@ msgstr "" "構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`types." "UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別來實例化: ::" -#: ../../library/stdtypes.rst:5243 +#: ../../library/stdtypes.rst:5251 msgid "" ">>> import types\n" ">>> isinstance(int | str, types.UnionType)\n" @@ -7596,7 +7618,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'types.UnionType' instances" -#: ../../library/stdtypes.rst:5252 +#: ../../library/stdtypes.rst:5260 msgid "" "The :meth:`!__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may " @@ -7605,7 +7627,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5256 +#: ../../library/stdtypes.rst:5264 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -7631,25 +7653,25 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5272 +#: ../../library/stdtypes.rst:5280 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5280 +#: ../../library/stdtypes.rst:5288 msgid "Other Built-in Types" msgstr "" -#: ../../library/stdtypes.rst:5282 +#: ../../library/stdtypes.rst:5290 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5289 +#: ../../library/stdtypes.rst:5297 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5291 +#: ../../library/stdtypes.rst:5299 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " @@ -7660,7 +7682,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5298 +#: ../../library/stdtypes.rst:5306 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -7671,32 +7693,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:5306 +#: ../../library/stdtypes.rst:5314 msgid "" -"Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." +"Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5314 +#: ../../library/stdtypes.rst:5322 msgid "Classes and Class Instances" msgstr "" -#: ../../library/stdtypes.rst:5316 +#: ../../library/stdtypes.rst:5324 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "" -#: ../../library/stdtypes.rst:5322 +#: ../../library/stdtypes.rst:5330 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5324 +#: ../../library/stdtypes.rst:5332 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" -#: ../../library/stdtypes.rst:5327 +#: ../../library/stdtypes.rst:5335 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -7704,15 +7726,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5331 +#: ../../library/stdtypes.rst:5339 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5337 +#: ../../library/stdtypes.rst:5345 msgid "Methods" msgstr "" -#: ../../library/stdtypes.rst:5341 +#: ../../library/stdtypes.rst:5349 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" @@ -7720,7 +7742,7 @@ msgid "" "Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5346 +#: ../../library/stdtypes.rst:5354 msgid "" "If you access a method (a function defined in a class namespace) through an " "instance, you get a special object: a :dfn:`bound method` (also called :ref:" @@ -7733,7 +7755,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5357 +#: ../../library/stdtypes.rst:5365 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -7744,7 +7766,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5373 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -7772,15 +7794,15 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5380 +#: ../../library/stdtypes.rst:5388 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5388 +#: ../../library/stdtypes.rst:5396 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:5394 +#: ../../library/stdtypes.rst:5402 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -7790,7 +7812,7 @@ msgid "" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5401 +#: ../../library/stdtypes.rst:5409 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -7799,21 +7821,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5408 +#: ../../library/stdtypes.rst:5416 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" -#: ../../library/stdtypes.rst:5411 +#: ../../library/stdtypes.rst:5419 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5417 +#: ../../library/stdtypes.rst:5425 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5423 +#: ../../library/stdtypes.rst:5431 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " @@ -7821,30 +7843,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5428 +#: ../../library/stdtypes.rst:5436 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5434 +#: ../../library/stdtypes.rst:5442 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:5436 +#: ../../library/stdtypes.rst:5444 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" -#: ../../library/stdtypes.rst:5440 +#: ../../library/stdtypes.rst:5448 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5447 +#: ../../library/stdtypes.rst:5455 msgid "The Ellipsis Object" msgstr "" -#: ../../library/stdtypes.rst:5449 +#: ../../library/stdtypes.rst:5457 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " "no special operations. There is exactly one ellipsis object, named :const:" @@ -7852,15 +7874,15 @@ msgid "" "`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5454 +#: ../../library/stdtypes.rst:5462 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:5460 +#: ../../library/stdtypes.rst:5468 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:5462 +#: ../../library/stdtypes.rst:5470 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " @@ -7868,64 +7890,64 @@ msgid "" "`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5467 +#: ../../library/stdtypes.rst:5475 msgid "It is written as :code:`NotImplemented`." msgstr "" -#: ../../library/stdtypes.rst:5473 +#: ../../library/stdtypes.rst:5481 msgid "Internal Objects" msgstr "" -#: ../../library/stdtypes.rst:5475 +#: ../../library/stdtypes.rst:5483 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5483 +#: ../../library/stdtypes.rst:5491 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:5485 +#: ../../library/stdtypes.rst:5493 msgid "" "The implementation adds a few special read-only attributes to several object " "types, where they are relevant. Some of these are not reported by the :func:" "`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:5492 +#: ../../library/stdtypes.rst:5500 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5498 +#: ../../library/stdtypes.rst:5506 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5506 +#: ../../library/stdtypes.rst:5514 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:5511 +#: ../../library/stdtypes.rst:5519 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:5516 +#: ../../library/stdtypes.rst:5524 msgid "" "The :ref:`type parameters ` of generic classes, functions, and :" "ref:`type aliases `. For classes and functions that are not " "generic, this will be an empty tuple." msgstr "" -#: ../../library/stdtypes.rst:5526 +#: ../../library/stdtypes.rst:5534 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5528 +#: ../../library/stdtypes.rst:5536 msgid "" "CPython has a global limit for converting between :class:`int` and :class:" "`str` to mitigate denial of service attacks. This limit *only* applies to " @@ -7933,7 +7955,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5533 +#: ../../library/stdtypes.rst:5541 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -7943,24 +7965,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5540 +#: ../../library/stdtypes.rst:5548 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:5542 +#: ../../library/stdtypes.rst:5550 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:5546 +#: ../../library/stdtypes.rst:5554 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5548 +#: ../../library/stdtypes.rst:5556 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -7984,7 +8006,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:5568 +#: ../../library/stdtypes.rst:5576 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -7992,11 +8014,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5573 +#: ../../library/stdtypes.rst:5581 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5575 +#: ../../library/stdtypes.rst:5583 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8014,84 +8036,84 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:5588 +#: ../../library/stdtypes.rst:5596 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:5590 +#: ../../library/stdtypes.rst:5598 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5593 +#: ../../library/stdtypes.rst:5601 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:5594 +#: ../../library/stdtypes.rst:5602 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5595 +#: ../../library/stdtypes.rst:5603 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5596 +#: ../../library/stdtypes.rst:5604 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:5597 +#: ../../library/stdtypes.rst:5605 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5600 +#: ../../library/stdtypes.rst:5608 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5602 +#: ../../library/stdtypes.rst:5610 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5603 +#: ../../library/stdtypes.rst:5611 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:5604 +#: ../../library/stdtypes.rst:5612 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:5605 +#: ../../library/stdtypes.rst:5613 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5606 +#: ../../library/stdtypes.rst:5614 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5607 +#: ../../library/stdtypes.rst:5615 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5610 +#: ../../library/stdtypes.rst:5618 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:5612 +#: ../../library/stdtypes.rst:5620 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:5615 +#: ../../library/stdtypes.rst:5623 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:5618 +#: ../../library/stdtypes.rst:5626 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -8099,7 +8121,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:5620 +#: ../../library/stdtypes.rst:5628 msgid "" ":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" "`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " @@ -8108,38 +8130,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:5626 +#: ../../library/stdtypes.rst:5634 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5629 +#: ../../library/stdtypes.rst:5637 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:5633 +#: ../../library/stdtypes.rst:5641 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5635 +#: ../../library/stdtypes.rst:5643 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5637 +#: ../../library/stdtypes.rst:5645 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:5644 +#: ../../library/stdtypes.rst:5652 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -8151,7 +8173,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5653 +#: ../../library/stdtypes.rst:5661 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -8159,11 +8181,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5659 +#: ../../library/stdtypes.rst:5667 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:5661 +#: ../../library/stdtypes.rst:5669 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -8171,11 +8193,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:5666 +#: ../../library/stdtypes.rst:5674 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:5668 +#: ../../library/stdtypes.rst:5676 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -8197,38 +8219,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:5678 +#: ../../library/stdtypes.rst:5686 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5682 +#: ../../library/stdtypes.rst:5690 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:5683 +#: ../../library/stdtypes.rst:5691 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5686 +#: ../../library/stdtypes.rst:5694 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5689 +#: ../../library/stdtypes.rst:5697 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5691 +#: ../../library/stdtypes.rst:5699 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:5694 +#: ../../library/stdtypes.rst:5702 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -8241,13 +8263,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:316 #: ../../library/stdtypes.rst:393 ../../library/stdtypes.rst:950 #: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:1139 -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 -#: ../../library/stdtypes.rst:5419 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4441 +#: ../../library/stdtypes.rst:5427 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4441 msgid "statement" msgstr "statement(陳述式)" @@ -8369,11 +8391,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:1260 #: ../../library/stdtypes.rst:1339 ../../library/stdtypes.rst:1383 #: ../../library/stdtypes.rst:1504 ../../library/stdtypes.rst:1540 -#: ../../library/stdtypes.rst:2526 ../../library/stdtypes.rst:2545 -#: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:4233 -#: ../../library/stdtypes.rst:4435 ../../library/stdtypes.rst:4914 -#: ../../library/stdtypes.rst:5169 ../../library/stdtypes.rst:5339 -#: ../../library/stdtypes.rst:5383 +#: ../../library/stdtypes.rst:2532 ../../library/stdtypes.rst:2551 +#: ../../library/stdtypes.rst:2658 ../../library/stdtypes.rst:4239 +#: ../../library/stdtypes.rst:4441 ../../library/stdtypes.rst:4920 +#: ../../library/stdtypes.rst:5177 ../../library/stdtypes.rst:5347 +#: ../../library/stdtypes.rst:5391 msgid "object" msgstr "object(物件)" @@ -8465,9 +8487,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:950 -#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4435 -#: ../../library/stdtypes.rst:5390 ../../library/stdtypes.rst:5404 -#: ../../library/stdtypes.rst:5419 +#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4441 +#: ../../library/stdtypes.rst:5398 ../../library/stdtypes.rst:5412 +#: ../../library/stdtypes.rst:5427 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -8483,8 +8505,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2402 -#: ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2408 +#: ../../library/stdtypes.rst:3627 msgid "+ (plus)" msgstr "+ (加號)" @@ -8496,13 +8518,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2402 -#: ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2408 +#: ../../library/stdtypes.rst:3627 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2359 -#: ../../library/stdtypes.rst:3578 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2365 +#: ../../library/stdtypes.rst:3584 msgid "* (asterisk)" msgstr "* (星號)" @@ -8514,8 +8536,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2323 -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2329 +#: ../../library/stdtypes.rst:3552 msgid "% (percent)" msgstr "% (百分號)" @@ -8525,7 +8547,7 @@ msgstr "**" #: ../../library/stdtypes.rst:316 ../../library/stdtypes.rst:393 #: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4441 msgid "operations on" msgstr "operations on(操作於)" @@ -8534,7 +8556,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:335 ../../library/stdtypes.rst:1606 -#: ../../library/stdtypes.rst:2526 ../../library/stdtypes.rst:5419 +#: ../../library/stdtypes.rst:2532 ../../library/stdtypes.rst:5427 msgid "module" msgstr "模組" @@ -8602,7 +8624,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4835 msgid "protocol" msgstr "protocol(協定)" @@ -8628,7 +8650,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4441 msgid "len" msgstr "len" @@ -8705,14 +8727,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2526 -#: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:2724 -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2532 +#: ../../library/stdtypes.rst:2658 ../../library/stdtypes.rst:2730 +#: ../../library/stdtypes.rst:3552 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 -#: ../../library/stdtypes.rst:5169 ../../library/stdtypes.rst:5419 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4441 +#: ../../library/stdtypes.rst:5177 ../../library/stdtypes.rst:5427 msgid "type" msgstr "type(型別)" @@ -8720,7 +8742,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4441 msgid "del" msgstr "del" @@ -8761,7 +8783,7 @@ msgid "range" msgstr "range" #: ../../library/stdtypes.rst:1504 ../../library/stdtypes.rst:1553 -#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2329 msgid "string" msgstr "string(字串)" @@ -8782,17 +8804,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2518 +#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2524 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2526 -#: ../../library/stdtypes.rst:2545 ../../library/stdtypes.rst:2724 -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2532 +#: ../../library/stdtypes.rst:2551 ../../library/stdtypes.rst:2730 +#: ../../library/stdtypes.rst:3552 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2724 +#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2730 msgid "methods" msgstr "methods(方法)" @@ -8800,183 +8822,183 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2131 ../../library/stdtypes.rst:3400 +#: ../../library/stdtypes.rst:2137 ../../library/stdtypes.rst:3406 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2131 +#: ../../library/stdtypes.rst:2137 msgid "str.splitlines method" msgstr "str.splitlines 方法" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2329 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2329 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2329 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2329 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:2323 ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:2329 ../../library/stdtypes.rst:3552 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:2323 ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:2329 ../../library/stdtypes.rst:3552 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:3578 +#: ../../library/stdtypes.rst:2365 ../../library/stdtypes.rst:3584 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:2402 -#: ../../library/stdtypes.rst:3578 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2365 ../../library/stdtypes.rst:2408 +#: ../../library/stdtypes.rst:3584 ../../library/stdtypes.rst:3627 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:3578 +#: ../../library/stdtypes.rst:2365 ../../library/stdtypes.rst:3584 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2408 ../../library/stdtypes.rst:3627 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2408 ../../library/stdtypes.rst:3627 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:2518 +#: ../../library/stdtypes.rst:2524 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:2526 +#: ../../library/stdtypes.rst:2532 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:2526 +#: ../../library/stdtypes.rst:2532 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:3400 +#: ../../library/stdtypes.rst:3406 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:3400 +#: ../../library/stdtypes.rst:3406 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:3552 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:3552 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:3552 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:3552 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4233 +#: ../../library/stdtypes.rst:4239 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4441 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4441 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:4518 +#: ../../library/stdtypes.rst:4524 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:4835 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:4835 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:4835 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:4902 +#: ../../library/stdtypes.rst:4908 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:4902 +#: ../../library/stdtypes.rst:4908 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:4914 +#: ../../library/stdtypes.rst:4920 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:4914 +#: ../../library/stdtypes.rst:4920 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:4914 +#: ../../library/stdtypes.rst:4920 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5169 +#: ../../library/stdtypes.rst:5177 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5169 +#: ../../library/stdtypes.rst:5177 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5339 +#: ../../library/stdtypes.rst:5347 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5383 +#: ../../library/stdtypes.rst:5391 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5383 +#: ../../library/stdtypes.rst:5391 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5390 +#: ../../library/stdtypes.rst:5398 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5390 +#: ../../library/stdtypes.rst:5398 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:5412 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:5412 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5443 +#: ../../library/stdtypes.rst:5451 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5443 +#: ../../library/stdtypes.rst:5451 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" diff --git a/library/string.po b/library/string.po index ceb98aace6..7dfb81a170 100644 --- a/library/string.po +++ b/library/string.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-16 00:13+0000\n" +"POT-Creation-Date: 2025-04-08 00:14+0000\n" "PO-Revision-Date: 2024-03-10 15:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -44,9 +44,9 @@ msgstr "此模組中定義的常數為:" #: ../../library/string.rst:26 msgid "" -"The concatenation of the :const:`ascii_lowercase` " -"and :const:`ascii_uppercase` constants described below. This value is not " -"locale-dependent." +"The concatenation of the :const:`ascii_lowercase` and :const:" +"`ascii_uppercase` constants described below. This value is not locale-" +"dependent." msgstr "" "下文描述的 :const:`ascii_lowercase` 和 :const:`ascii_uppercase` 常數的串接," "該值不依賴於區域設定。" @@ -88,19 +88,17 @@ msgstr "" #: ../../library/string.rst:65 msgid "" "String of ASCII characters which are considered printable by Python. This is " -"a combination " -"of :const:`digits`, :const:`ascii_letters`, :const:`punctuation`, " -"and :const:`whitespace`." +"a combination of :const:`digits`, :const:`ascii_letters`, :const:" +"`punctuation`, and :const:`whitespace`." msgstr "" -"ASCII 字元的字串被 Python 是為可被列印輸出的。這" -"是 :const:`digits`、:const:`ascii_letters`、:const:`punctuation` " -"和 :const:`whitespace` 的組合。" +"ASCII 字元的字串被 Python 是為可被列印輸出的。這是 :const:`digits`、:const:" +"`ascii_letters`、:const:`punctuation` 和 :const:`whitespace` 的組合。" #: ../../library/string.rst:71 msgid "" -"By design, :meth:`string.printable.isprintable() ` " -"returns :const:`False`. In particular, ``string.printable`` is not printable " -"in the POSIX sense (see :manpage:`LC_CTYPE `)." +"By design, :meth:`string.printable.isprintable() ` returns :" +"const:`False`. In particular, ``string.printable`` is not printable in the " +"POSIX sense (see :manpage:`LC_CTYPE `)." msgstr "" #: ../../library/string.rst:78 @@ -138,11 +136,11 @@ msgstr ":class:`Formatter` 類別有以下的公開方法:" #: ../../library/string.rst:101 msgid "" "The primary API method. It takes a format string and an arbitrary set of " -"positional and keyword arguments. It is just a wrapper that " -"calls :meth:`vformat`." +"positional and keyword arguments. It is just a wrapper that calls :meth:" +"`vformat`." msgstr "" -"主要的 API 方法。它接收一個格式字串及一組任意的位置引數與關鍵字引數,是呼" -"叫 :meth:`vformat` 的包裝器 (wrapper)。" +"主要的 API 方法。它接收一個格式字串及一組任意的位置引數與關鍵字引數,是呼叫 :" +"meth:`vformat` 的包裝器 (wrapper)。" #: ../../library/string.rst:105 msgid "" @@ -155,10 +153,9 @@ msgid "" "This function does the actual work of formatting. It is exposed as a " "separate function for cases where you want to pass in a predefined " "dictionary of arguments, rather than unpacking and repacking the dictionary " -"as individual arguments using the ``*args`` and ``**kwargs`` " -"syntax. :meth:`vformat` does the work of breaking up the format string into " -"character data and replacement fields. It calls the various methods " -"described below." +"as individual arguments using the ``*args`` and ``**kwargs`` syntax. :meth:" +"`vformat` does the work of breaking up the format string into character data " +"and replacement fields. It calls the various methods described below." msgstr "" #: ../../library/string.rst:119 @@ -192,9 +189,9 @@ msgstr "" msgid "" "Given *field_name* as returned by :meth:`parse` (see above), convert it to " "an object to be formatted. Returns a tuple (obj, used_key). The default " -"version takes strings of the form defined in :pep:`3101`, such as \"0[name]" -"\" or \"label.title\". *args* and *kwargs* are as passed in " -"to :meth:`vformat`. The return value *used_key* has the same meaning as the " +"version takes strings of the form defined in :pep:`3101`, such as " +"\"0[name]\" or \"label.title\". *args* and *kwargs* are as passed in to :" +"meth:`vformat`. The return value *used_key* has the same meaning as the " "*key* parameter to :meth:`get_value`." msgstr "" @@ -208,9 +205,9 @@ msgstr "" #: ../../library/string.rst:152 msgid "" -"The *args* parameter is set to the list of positional arguments " -"to :meth:`vformat`, and the *kwargs* parameter is set to the dictionary of " -"keyword arguments." +"The *args* parameter is set to the list of positional arguments to :meth:" +"`vformat`, and the *kwargs* parameter is set to the dictionary of keyword " +"arguments." msgstr "" #: ../../library/string.rst:156 @@ -224,14 +221,14 @@ msgstr "" msgid "" "So for example, the field expression '0.name' would cause :meth:`get_value` " "to be called with a *key* argument of 0. The ``name`` attribute will be " -"looked up after :meth:`get_value` returns by calling the built-" -"in :func:`getattr` function." +"looked up after :meth:`get_value` returns by calling the built-in :func:" +"`getattr` function." msgstr "" #: ../../library/string.rst:165 msgid "" -"If the index or keyword refers to an item that does not exist, then " -"an :exc:`IndexError` or :exc:`KeyError` should be raised." +"If the index or keyword refers to an item that does not exist, then an :exc:" +"`IndexError` or :exc:`KeyError` should be raised." msgstr "" #: ../../library/string.rst:170 @@ -240,9 +237,8 @@ msgid "" "function is the set of all argument keys that were actually referred to in " "the format string (integers for positional arguments, and strings for named " "arguments), and a reference to the *args* and *kwargs* that was passed to " -"vformat. The set of unused args can be calculated from these " -"parameters. :meth:`check_unused_args` is assumed to raise an exception if " -"the check fails." +"vformat. The set of unused args can be calculated from these parameters. :" +"meth:`check_unused_args` is assumed to raise an exception if the check fails." msgstr "" #: ../../library/string.rst:180 @@ -311,9 +307,9 @@ msgid "" "not quote-delimited, it is not possible to specify arbitrary dictionary keys " "(e.g., the strings ``'10'`` or ``':-]'``) within a format string. The " "*arg_name* can be followed by any number of index or attribute expressions. " -"An expression of the form ``'.name'`` selects the named attribute " -"using :func:`getattr`, while an expression of the form ``'[index]'`` does an " -"index lookup using :meth:`~object.__getitem__`." +"An expression of the form ``'.name'`` selects the named attribute using :" +"func:`getattr`, while an expression of the form ``'[index]'`` does an index " +"lookup using :meth:`~object.__getitem__`." msgstr "" #: ../../library/string.rst:249 @@ -350,15 +346,15 @@ msgid "" "the job of formatting a value is done by the :meth:`~object.__format__` " "method of the value itself. However, in some cases it is desirable to force " "a type to be formatted as a string, overriding its own definition of " -"formatting. By converting the value to a string before " -"calling :meth:`~object.__format__`, the normal formatting logic is bypassed." +"formatting. By converting the value to a string before calling :meth:" +"`~object.__format__`, the normal formatting logic is bypassed." msgstr "" #: ../../library/string.rst:272 msgid "" -"Three conversion flags are currently supported: ``'!s'`` which " -"calls :func:`str` on the value, ``'!r'`` which calls :func:`repr` and ``'!" -"a'`` which calls :func:`ascii`." +"Three conversion flags are currently supported: ``'!s'`` which calls :func:" +"`str` on the value, ``'!r'`` which calls :func:`repr` and ``'!a'`` which " +"calls :func:`ascii`." msgstr "" "目前支援三種轉換旗標:``'!s'`` 會對該值呼叫 :func:`str`,``'!r'`` 會對該值呼" "叫 :func:`repr`,而 ``'!a'`` 則會對該值呼叫 :func:`ascii`。" @@ -416,10 +412,10 @@ msgstr "格式規格 (Format Specification) 迷你語言" #: ../../library/string.rst:305 msgid "" "\"Format specifications\" are used within replacement fields contained " -"within a format string to define how individual values are presented " -"(see :ref:`formatstrings` and :ref:`f-strings`). They can also be passed " -"directly to the built-in :func:`format` function. Each formattable type may " -"define how the format specification is to be interpreted." +"within a format string to define how individual values are presented (see :" +"ref:`formatstrings` and :ref:`f-strings`). They can also be passed directly " +"to the built-in :func:`format` function. Each formattable type may define " +"how the format specification is to be interpreted." msgstr "" "「格式規格」在格式字串 (format string) 中包含的替換欄位中使用,以定義各個值如" "何被呈現(請參考 :ref:`formatstrings` 和 :ref:`f-strings`\\ )。它們也能夠直" @@ -447,7 +443,7 @@ msgstr "" msgid "The general form of a *standard format specifier* is:" msgstr "*標準格式說明符號 (standard format specifier)* 的一般型式如下:" -#: ../../library/string.rst:331 +#: ../../library/string.rst:333 msgid "" "If a valid *align* value is specified, it can be preceded by a *fill* " "character that can be any character and defaults to a space if omitted. It " @@ -458,67 +454,68 @@ msgid "" "the :func:`format` function." msgstr "" "如果給定了一個有效的 *align* 值,則可以在它之前加一個 *fill* 字元,且該字元可" -"為任意字元,若不加的話預設為空格。使用\\ :ref:`格式字串 `\\ " -"或 :meth:`str.format` 時是無法在其中使用大括號(\"``{``\" 或 \"``}``\")作為 " -"*fill* 字元的,但仍可透過巢狀替換欄位的方式插入大括號。此限制不影" -"響 :func:`format` 函式。" +"為任意字元,若不加的話預設為空格。使用\\ :ref:`格式字串 `\\ 或 :" +"meth:`str.format` 時是無法在其中使用大括號(\"``{``\" 或 \"``}``\")作為 " +"*fill* 字元的,但仍可透過巢狀替換欄位的方式插入大括號。此限制不影響 :func:" +"`format` 函式。" -#: ../../library/string.rst:340 +#: ../../library/string.rst:342 msgid "The meaning of the various alignment options is as follows:" msgstr "" -#: ../../library/string.rst:349 ../../library/string.rst:381 +#: ../../library/string.rst:351 ../../library/string.rst:383 +#: ../../library/string.rst:442 msgid "Option" msgstr "選項" -#: ../../library/string.rst:349 ../../library/string.rst:381 -#: ../../library/string.rst:466 ../../library/string.rst:477 -#: ../../library/string.rst:512 +#: ../../library/string.rst:351 ../../library/string.rst:383 +#: ../../library/string.rst:442 ../../library/string.rst:481 +#: ../../library/string.rst:492 ../../library/string.rst:527 msgid "Meaning" msgstr "含義" -#: ../../library/string.rst:351 +#: ../../library/string.rst:353 msgid "``'<'``" msgstr "``'<'``" -#: ../../library/string.rst:351 +#: ../../library/string.rst:353 msgid "" "Forces the field to be left-aligned within the available space (this is the " "default for most objects)." msgstr "強制欄位在可用空間內靠左對齊(這是大多數物件的預設值)。" -#: ../../library/string.rst:354 +#: ../../library/string.rst:356 msgid "``'>'``" msgstr "``'>'``" -#: ../../library/string.rst:354 +#: ../../library/string.rst:356 msgid "" "Forces the field to be right-aligned within the available space (this is the " "default for numbers)." msgstr "強制欄位在可用空間內靠右對齊(這是數字的預設值)。" -#: ../../library/string.rst:357 +#: ../../library/string.rst:359 msgid "``'='``" msgstr "``'='``" -#: ../../library/string.rst:357 +#: ../../library/string.rst:359 msgid "" "Forces the padding to be placed after the sign (if any) but before the " "digits. This is used for printing fields in the form '+000000120'. This " -"alignment option is only valid for numeric types, " -"excluding :class:`complex`. It becomes the default for numbers when '0' " -"immediately precedes the field width." +"alignment option is only valid for numeric types, excluding :class:" +"`complex`. It becomes the default for numbers when '0' immediately precedes " +"the field width." msgstr "" -#: ../../library/string.rst:364 +#: ../../library/string.rst:366 msgid "``'^'``" msgstr "``'^'``" -#: ../../library/string.rst:364 +#: ../../library/string.rst:366 msgid "Forces the field to be centered within the available space." msgstr "強制欄位在可用空間內置中。" -#: ../../library/string.rst:368 +#: ../../library/string.rst:370 msgid "" "Note that unless a minimum field width is defined, the field width will " "always be the same size as the data to fill it, so that the alignment option " @@ -527,54 +524,57 @@ msgstr "" "請注意,除非有定義了最小欄位寬度,否則欄位寬度將始終與填充它的資料大小相同," "故在該情況下的對齊選項是沒有意義的。" -#: ../../library/string.rst:372 +#: ../../library/string.rst:374 msgid "" "The *sign* option is only valid for number types, and can be one of the " "following:" msgstr "*sign* 選項只適用於數字型別,並可為以下之一:" -#: ../../library/string.rst:383 +#: ../../library/string.rst:385 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/string.rst:383 +#: ../../library/string.rst:385 +#, fuzzy msgid "" -"indicates that a sign should be used for both positive as well as negative " +"Indicates that a sign should be used for both positive as well as negative " "numbers." msgstr "表示正數與負數均需使用符號。" -#: ../../library/string.rst:386 +#: ../../library/string.rst:388 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/string.rst:386 +#: ../../library/string.rst:388 +#, fuzzy msgid "" -"indicates that a sign should be used only for negative numbers (this is the " +"Indicates that a sign should be used only for negative numbers (this is the " "default behavior)." -msgstr "" +msgstr "表示正數應使用前導空格,負數應使用減號。" -#: ../../library/string.rst:375 ../../library/string.rst:389 +#: ../../library/string.rst:377 ../../library/string.rst:391 msgid "space" msgstr "空格" -#: ../../library/string.rst:389 +#: ../../library/string.rst:391 +#, fuzzy msgid "" -"indicates that a leading space should be used on positive numbers, and a " +"Indicates that a leading space should be used on positive numbers, and a " "minus sign on negative numbers." msgstr "表示正數應使用前導空格,負數應使用減號。" -#: ../../library/string.rst:396 +#: ../../library/string.rst:398 msgid "" "The ``'z'`` option coerces negative zero floating-point values to positive " "zero after rounding to the format precision. This option is only valid for " "floating-point presentation types." msgstr "" -#: ../../library/string.rst:400 +#: ../../library/string.rst:402 msgid "Added the ``'z'`` option (see also :pep:`682`)." msgstr "新增 ``'z'`` 選項(請見 :pep:`682`\\ )。" -#: ../../library/string.rst:405 +#: ../../library/string.rst:407 msgid "" "The ``'#'`` option causes the \"alternate form\" to be used for the " "conversion. The alternate form is defined differently for different types. " @@ -589,60 +589,80 @@ msgid "" msgstr "" #: ../../library/string.rst:419 +#, fuzzy msgid "" -"The ``','`` option signals the use of a comma for a thousands separator for " -"floating-point presentation types and for integer presentation type ``'d'``. " -"For other presentation types, this option is an error. For a locale aware " -"separator, use the ``'n'`` integer presentation type instead." -msgstr "" - -#: ../../library/string.rst:425 -msgid "Added the ``','`` option (see also :pep:`378`)." -msgstr "新增 ``','`` 選項(請見 :pep:`378`\\ )。" - -#: ../../library/string.rst:430 -msgid "" -"The ``'_'`` option signals the use of an underscore for a thousands " -"separator for floating-point presentation types and for integer presentation " -"type ``'d'``. For integer presentation types ``'b'``, ``'o'``, ``'x'``, and " -"``'X'``, underscores will be inserted every 4 digits. For other " -"presentation types, specifying this option is an error." -msgstr "" -"``'_'`` 選項表示對於浮點表示型別和整數表示型別 ``'d'`` 使用底線作為千位分隔符" -"號。對於整數表示型別 ``'b'``,``'o'``,``'x'`` 和 ``'X'``,每 4 位數字會插入" -"底線。對於其他表示型別,指定此選項會出錯。" - -#: ../../library/string.rst:437 -msgid "Added the ``'_'`` option (see also :pep:`515`)." -msgstr "新增 ``'_'`` 選項(請見 :pep:`515`\\ )。" - -#: ../../library/string.rst:440 -msgid "" -"*width* is a decimal integer defining the minimum total field width, " +"The *width* is a decimal integer defining the minimum total field width, " "including any prefixes, separators, and other formatting characters. If not " "specified, then the field width will be determined by the content." msgstr "" "*width* 是一個十進位整數,定義了最小總欄位寬度,包括任何前綴、分隔符號和其他" "格式字元。如果未指定,則欄位寬度將由內容決定。" -#: ../../library/string.rst:444 +#: ../../library/string.rst:423 msgid "" "When no explicit alignment is given, preceding the *width* field by a zero " "(``'0'``) character enables sign-aware zero-padding for numeric types, " "excluding :class:`complex`. This is equivalent to a *fill* character of " "``'0'`` with an *alignment* type of ``'='``." msgstr "" -"當未給予明確的對齊指示,在 *width* 欄位前面填入零 (``'0'``) 字元將會" -"為 :class:`complex` 以外的數值型別啟用有符號察覺的零填充 (sign-aware zero-" +"當未給予明確的對齊指示,在 *width* 欄位前面填入零 (``'0'``) 字元將會為 :" +"class:`complex` 以外的數值型別啟用有符號察覺的零填充 (sign-aware zero-" "padding)。這相當於使用 ``'0'`` 為 *fill* 字元且對齊類型為 ``'='``。" -#: ../../library/string.rst:449 +#: ../../library/string.rst:428 msgid "" "Preceding the *width* field by ``'0'`` no longer affects the default " "alignment for strings." msgstr "在 *width* 欄位前面加上 ``'0'`` 不再影響字串的預設對齊方式。" -#: ../../library/string.rst:453 +#: ../../library/string.rst:433 +msgid "" +"The *grouping* option after the *width* field specifies a digit group " +"separator for the integral part of a number. It can be one of the following:" +msgstr "" + +#: ../../library/string.rst:444 +msgid "``','``" +msgstr "" + +#: ../../library/string.rst:444 +msgid "" +"Inserts a comma every 3 digits for integer presentation type ``'d'`` and " +"floating-point presentation types, excluding ``'n'``. For other presentation " +"types, this option is not supported." +msgstr "" + +#: ../../library/string.rst:450 +msgid "``'_'``" +msgstr "" + +#: ../../library/string.rst:450 +#, fuzzy +msgid "" +"Inserts an underscore every 3 digits for integer presentation type ``'d'`` " +"and floating-point presentation types, excluding ``'n'``. For integer " +"presentation types ``'b'``, ``'o'``, ``'x'``, and ``'X'``, underscores are " +"inserted every 4 digits. For other presentation types, this option is not " +"supported." +msgstr "" +"``'_'`` 選項表示對於浮點表示型別和整數表示型別 ``'d'`` 使用底線作為千位分隔符" +"號。對於整數表示型別 ``'b'``,``'o'``,``'x'`` 和 ``'X'``,每 4 位數字會插入" +"底線。對於其他表示型別,指定此選項會出錯。" + +#: ../../library/string.rst:460 +msgid "" +"For a locale aware separator, use the ``'n'`` presentation type instead." +msgstr "" + +#: ../../library/string.rst:462 +msgid "Added the ``','`` option (see also :pep:`378`)." +msgstr "新增 ``','`` 選項(請見 :pep:`378`\\ )。" + +#: ../../library/string.rst:465 +msgid "Added the ``'_'`` option (see also :pep:`515`)." +msgstr "新增 ``'_'`` 選項(請見 :pep:`515`\\ )。" + +#: ../../library/string.rst:468 msgid "" "The *precision* is a decimal integer indicating how many digits should be " "displayed after the decimal point for presentation types ``'f'`` and " @@ -657,89 +677,89 @@ msgstr "" "示類型,該欄位指定最大欄位大小 - 換言之,將使用欄位中的多少字元。整數表示類型" "不允許使用 *precision*。" -#: ../../library/string.rst:461 +#: ../../library/string.rst:476 msgid "Finally, the *type* determines how the data should be presented." msgstr "最終,型別決定了資料將會如何呈現" -#: ../../library/string.rst:463 +#: ../../library/string.rst:478 msgid "The available string presentation types are:" msgstr "可用的字串表示型別有:" -#: ../../library/string.rst:466 ../../library/string.rst:477 -#: ../../library/string.rst:512 +#: ../../library/string.rst:481 ../../library/string.rst:492 +#: ../../library/string.rst:527 msgid "Type" msgstr "型別" -#: ../../library/string.rst:468 +#: ../../library/string.rst:483 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/string.rst:468 +#: ../../library/string.rst:483 msgid "String format. This is the default type for strings and may be omitted." msgstr "" -#: ../../library/string.rst:471 ../../library/string.rst:500 -#: ../../library/string.rst:585 +#: ../../library/string.rst:486 ../../library/string.rst:515 +#: ../../library/string.rst:601 msgid "None" msgstr "None" -#: ../../library/string.rst:471 +#: ../../library/string.rst:486 msgid "The same as ``'s'``." msgstr "與 ``'s'`` 相同。" -#: ../../library/string.rst:474 +#: ../../library/string.rst:489 msgid "The available integer presentation types are:" msgstr "" -#: ../../library/string.rst:479 +#: ../../library/string.rst:494 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/string.rst:479 +#: ../../library/string.rst:494 msgid "Binary format. Outputs the number in base 2." msgstr "" -#: ../../library/string.rst:481 +#: ../../library/string.rst:496 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/string.rst:481 +#: ../../library/string.rst:496 msgid "" "Character. Converts the integer to the corresponding unicode character " "before printing." msgstr "" -#: ../../library/string.rst:484 +#: ../../library/string.rst:499 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/string.rst:484 +#: ../../library/string.rst:499 msgid "Decimal Integer. Outputs the number in base 10." msgstr "" -#: ../../library/string.rst:486 +#: ../../library/string.rst:501 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/string.rst:486 +#: ../../library/string.rst:501 msgid "Octal format. Outputs the number in base 8." msgstr "" -#: ../../library/string.rst:488 +#: ../../library/string.rst:503 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/string.rst:488 +#: ../../library/string.rst:503 msgid "" "Hex format. Outputs the number in base 16, using lower-case letters for the " "digits above 9." msgstr "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用小寫字母。" -#: ../../library/string.rst:491 +#: ../../library/string.rst:506 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/string.rst:491 +#: ../../library/string.rst:506 msgid "" "Hex format. Outputs the number in base 16, using upper-case letters for the " "digits above 9. In case ``'#'`` is specified, the prefix ``'0x'`` will be " @@ -748,21 +768,21 @@ msgstr "" "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用大寫字母。如果指定了 " "``'#'``,則前綴 ``'0x'`` 也會被轉成大寫的 ``'0X'``。" -#: ../../library/string.rst:496 ../../library/string.rst:578 +#: ../../library/string.rst:511 ../../library/string.rst:593 msgid "``'n'``" msgstr "``'n'``" -#: ../../library/string.rst:496 +#: ../../library/string.rst:511 msgid "" "Number. This is the same as ``'d'``, except that it uses the current locale " -"setting to insert the appropriate number separator characters." +"setting to insert the appropriate digit group separators." msgstr "" -#: ../../library/string.rst:500 +#: ../../library/string.rst:515 msgid "The same as ``'d'``." msgstr "與 ``'d'`` 相同。" -#: ../../library/string.rst:503 +#: ../../library/string.rst:518 msgid "" "In addition to the above presentation types, integers can be formatted with " "the floating-point presentation types listed below (except ``'n'`` and " @@ -770,43 +790,43 @@ msgid "" "floating-point number before formatting." msgstr "" -#: ../../library/string.rst:508 +#: ../../library/string.rst:523 msgid "" -"The available presentation types for :class:`float` " -"and :class:`~decimal.Decimal` values are:" +"The available presentation types for :class:`float` and :class:`~decimal." +"Decimal` values are:" msgstr "" -#: ../../library/string.rst:514 +#: ../../library/string.rst:529 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/string.rst:514 +#: ../../library/string.rst:529 msgid "" "Scientific notation. For a given precision ``p``, formats the number in " "scientific notation with the letter 'e' separating the coefficient from the " "exponent. The coefficient has one digit before and ``p`` digits after the " "decimal point, for a total of ``p + 1`` significant digits. With no " "precision given, uses a precision of ``6`` digits after the decimal point " -"for :class:`float`, and shows all coefficient digits " -"for :class:`~decimal.Decimal`. If ``p=0``, the decimal point is omitted " -"unless the ``#`` option is used." +"for :class:`float`, and shows all coefficient digits for :class:`~decimal." +"Decimal`. If ``p=0``, the decimal point is omitted unless the ``#`` option " +"is used." msgstr "" -#: ../../library/string.rst:525 +#: ../../library/string.rst:540 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/string.rst:525 +#: ../../library/string.rst:540 msgid "" "Scientific notation. Same as ``'e'`` except it uses an upper case 'E' as the " "separator character." msgstr "" -#: ../../library/string.rst:528 +#: ../../library/string.rst:543 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/string.rst:528 +#: ../../library/string.rst:543 msgid "" "Fixed-point notation. For a given precision ``p``, formats the number as a " "decimal number with exactly ``p`` digits following the decimal point. With " @@ -816,21 +836,21 @@ msgid "" "point is omitted unless the ``#`` option is used." msgstr "" -#: ../../library/string.rst:537 +#: ../../library/string.rst:552 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/string.rst:537 +#: ../../library/string.rst:552 msgid "" "Fixed-point notation. Same as ``'f'``, but converts ``nan`` to ``NAN`` and " "``inf`` to ``INF``." msgstr "" -#: ../../library/string.rst:540 +#: ../../library/string.rst:555 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/string.rst:540 +#: ../../library/string.rst:555 msgid "" "General format. For a given precision ``p >= 1``, this rounds the number to " "``p`` significant digits and then formats the result in either fixed-point " @@ -838,7 +858,7 @@ msgid "" "``0`` is treated as equivalent to a precision of ``1``." msgstr "" -#: ../../library/string.rst:547 +#: ../../library/string.rst:562 msgid "" "The precise rules are as follows: suppose that the result formatted with " "presentation type ``'e'`` and precision ``p-1`` would have exponent " @@ -851,50 +871,51 @@ msgid "" "unless the ``'#'`` option is used." msgstr "" -#: ../../library/string.rst:560 +#: ../../library/string.rst:575 msgid "" -"With no precision given, uses a precision of ``6`` significant digits " -"for :class:`float`. For :class:`~decimal.Decimal`, the coefficient of the " -"result is formed from the coefficient digits of the value; scientific " -"notation is used for values smaller than ``1e-6`` in absolute value and " -"values where the place value of the least significant digit is larger than " -"1, and fixed-point notation is used otherwise." +"With no precision given, uses a precision of ``6`` significant digits for :" +"class:`float`. For :class:`~decimal.Decimal`, the coefficient of the result " +"is formed from the coefficient digits of the value; scientific notation is " +"used for values smaller than ``1e-6`` in absolute value and values where the " +"place value of the least significant digit is larger than 1, and fixed-point " +"notation is used otherwise." msgstr "" -#: ../../library/string.rst:569 +#: ../../library/string.rst:584 msgid "" "Positive and negative infinity, positive and negative zero, and nans, are " "formatted as ``inf``, ``-inf``, ``0``, ``-0`` and ``nan`` respectively, " "regardless of the precision." msgstr "" -#: ../../library/string.rst:574 +#: ../../library/string.rst:589 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/string.rst:574 +#: ../../library/string.rst:589 msgid "" "General format. Same as ``'g'`` except switches to ``'E'`` if the number " "gets too large. The representations of infinity and NaN are uppercased, too." msgstr "" -#: ../../library/string.rst:578 +#: ../../library/string.rst:593 msgid "" "Number. This is the same as ``'g'``, except that it uses the current locale " -"setting to insert the appropriate number separator characters." +"setting to insert the appropriate digit group separators for the integral " +"part of a number." msgstr "" -#: ../../library/string.rst:582 +#: ../../library/string.rst:598 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/string.rst:582 +#: ../../library/string.rst:598 msgid "" "Percentage. Multiplies the number by 100 and displays in fixed (``'f'``) " "format, followed by a percent sign." msgstr "" -#: ../../library/string.rst:585 +#: ../../library/string.rst:601 msgid "" "For :class:`float` this is like the ``'g'`` type, except that when fixed-" "point notation is used to format the result, it always includes at least one " @@ -903,20 +924,20 @@ msgid "" "as large as needed to represent the given value faithfully." msgstr "" -#: ../../library/string.rst:593 +#: ../../library/string.rst:609 msgid "" "For :class:`~decimal.Decimal`, this is the same as either ``'g'`` or ``'G'`` " "depending on the value of ``context.capitals`` for the current decimal " "context." msgstr "" -#: ../../library/string.rst:597 +#: ../../library/string.rst:613 msgid "" "The overall effect is to match the output of :func:`str` as altered by the " "other format modifiers." msgstr "" -#: ../../library/string.rst:601 +#: ../../library/string.rst:617 msgid "" "The result should be correctly rounded to a given precision ``p`` of digits " "after the decimal point. The rounding mode for :class:`float` matches that " @@ -924,7 +945,7 @@ msgid "" "mode of the current :ref:`context ` will be used." msgstr "" -#: ../../library/string.rst:606 +#: ../../library/string.rst:622 msgid "" "The available presentation types for :class:`complex` are the same as those " "for :class:`float` (``'%'`` is not allowed). Both the real and imaginary " @@ -936,17 +957,17 @@ msgid "" "surrounded by parentheses), possibly altered by other format modifiers." msgstr "" -#: ../../library/string.rst:619 +#: ../../library/string.rst:635 msgid "Format examples" msgstr "格式範例" -#: ../../library/string.rst:621 +#: ../../library/string.rst:637 msgid "" "This section contains examples of the :meth:`str.format` syntax and " "comparison with the old ``%``-formatting." msgstr "本節包含 :meth:`str.format` 語法以及與舊式 ``%`` 格式的比較。" -#: ../../library/string.rst:624 +#: ../../library/string.rst:640 msgid "" "In most of the cases the syntax is similar to the old ``%``-formatting, with " "the addition of the ``{}`` and with ``:`` used instead of ``%``. For " @@ -955,17 +976,17 @@ msgstr "" "此語法在大多情況下與舊式的 ``%`` 格式類似,只是增加了 ``{}`` 和 ``:`` 來取代 " "``%``。例如,``'%03.2f'`` 可以改寫為 ``'{:03.2f}'``。" -#: ../../library/string.rst:628 +#: ../../library/string.rst:644 msgid "" "The new format syntax also supports new and different options, shown in the " "following examples." msgstr "新的語法還支援新的選項,將在以下的範例中說明。" -#: ../../library/string.rst:631 +#: ../../library/string.rst:647 msgid "Accessing arguments by position::" msgstr "按位置存取引數: ::" -#: ../../library/string.rst:633 +#: ../../library/string.rst:649 msgid "" ">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" "'a, b, c'\n" @@ -990,11 +1011,11 @@ msgstr "" ">>> '{0}{1}{0}'.format('abra', 'cad') # 引數索引可以重複\n" "'abracadabra'" -#: ../../library/string.rst:644 +#: ../../library/string.rst:660 msgid "Accessing arguments by name::" msgstr "按名稱存取引數: ::" -#: ../../library/string.rst:646 +#: ../../library/string.rst:662 msgid "" ">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " "longitude='-115.81W')\n" @@ -1004,11 +1025,11 @@ msgid "" "'Coordinates: 37.24N, -115.81W'" msgstr "" -#: ../../library/string.rst:652 +#: ../../library/string.rst:668 msgid "Accessing arguments' attributes::" msgstr "存取引數的屬性: ::" -#: ../../library/string.rst:654 +#: ../../library/string.rst:670 msgid "" ">>> c = 3-5j\n" ">>> ('The complex number {0} is formed from the real part {0.real} '\n" @@ -1025,11 +1046,11 @@ msgid "" "'Point(4, 2)'" msgstr "" -#: ../../library/string.rst:667 +#: ../../library/string.rst:683 msgid "Accessing arguments' items::" msgstr "存取引數的內容: ::" -#: ../../library/string.rst:669 +#: ../../library/string.rst:685 msgid "" ">>> coord = (3, 5)\n" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" @@ -1039,11 +1060,11 @@ msgstr "" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" "'X: 3; Y: 5'" -#: ../../library/string.rst:673 +#: ../../library/string.rst:689 msgid "Replacing ``%s`` and ``%r``::" msgstr "替換 ``%s`` 和 ``%r``: ::" -#: ../../library/string.rst:675 +#: ../../library/string.rst:691 msgid "" ">>> \"repr() shows quotes: {!r}; str() doesn't: {!s}\".format('test1', " "'test2')\n" @@ -1053,11 +1074,11 @@ msgstr "" "'test2')\n" "\"repr() shows quotes: 'test1'; str() doesn't: test2\"" -#: ../../library/string.rst:678 +#: ../../library/string.rst:694 msgid "Aligning the text and specifying a width::" msgstr "對齊文字以及指定寬度: ::" -#: ../../library/string.rst:680 +#: ../../library/string.rst:696 msgid "" ">>> '{:<30}'.format('left aligned')\n" "'left aligned '\n" @@ -1069,18 +1090,18 @@ msgid "" "'***********centered***********'" msgstr "" -#: ../../library/string.rst:689 +#: ../../library/string.rst:705 msgid "Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::" msgstr "替換 ``%+f``、``%-f`` 和 ``% f`` 以及指定正負號: ::" -#: ../../library/string.rst:691 +#: ../../library/string.rst:707 msgid "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always\n" "'+3.140000; -3.140000'\n" ">>> '{: f}; {: f}'.format(3.14, -3.14) # show a space for positive numbers\n" "' 3.140000; -3.140000'\n" -">>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as " -"'{:f}; {:f}'\n" +">>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as '{:" +"f}; {:f}'\n" "'3.140000; -3.140000'" msgstr "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # 總會顯示\n" @@ -1091,12 +1112,12 @@ msgstr "" "同\n" "'3.140000; -3.140000'" -#: ../../library/string.rst:698 +#: ../../library/string.rst:714 msgid "" "Replacing ``%x`` and ``%o`` and converting the value to different bases::" msgstr "替換 ``%x`` 和 ``%o`` 並將其值轉換為不同的進位制: ::" -#: ../../library/string.rst:700 +#: ../../library/string.rst:716 msgid "" ">>> # format also supports binary numbers\n" ">>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}\".format(42)\n" @@ -1106,23 +1127,28 @@ msgid "" "'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'" msgstr "" -#: ../../library/string.rst:707 -msgid "Using the comma as a thousands separator::" +#: ../../library/string.rst:723 +#, fuzzy +msgid "Using the comma or the underscore as a digit group separator::" msgstr "使用逗號作為千位分隔符: ::" -#: ../../library/string.rst:709 +#: ../../library/string.rst:725 msgid "" ">>> '{:,}'.format(1234567890)\n" -"'1,234,567,890'" +"'1,234,567,890'\n" +">>> '{:_}'.format(1234567890)\n" +"'1_234_567_890'\n" +">>> '{:_b}'.format(1234567890)\n" +"'100_1001_1001_0110_0000_0010_1101_0010'\n" +">>> '{:_x}'.format(1234567890)\n" +"'4996_02d2'" msgstr "" -">>> '{:,}'.format(1234567890)\n" -"'1,234,567,890'" -#: ../../library/string.rst:712 +#: ../../library/string.rst:734 msgid "Expressing a percentage::" msgstr "表示為百分比: ::" -#: ../../library/string.rst:714 +#: ../../library/string.rst:736 msgid "" ">>> points = 19\n" ">>> total = 22\n" @@ -1134,11 +1160,11 @@ msgstr "" ">>> 'Correct answers: {:.2%}'.format(points/total)\n" "'Correct answers: 86.36%'" -#: ../../library/string.rst:719 +#: ../../library/string.rst:741 msgid "Using type-specific formatting::" msgstr "作為特定型別格式: ::" -#: ../../library/string.rst:721 +#: ../../library/string.rst:743 msgid "" ">>> import datetime\n" ">>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n" @@ -1150,11 +1176,11 @@ msgstr "" ">>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" "'2010-07-04 12:15:58'" -#: ../../library/string.rst:726 +#: ../../library/string.rst:748 msgid "Nesting arguments and more complex examples::" msgstr "巢狀引數及更多複雜範例: ::" -#: ../../library/string.rst:728 +#: ../../library/string.rst:750 msgid "" ">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" "... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" @@ -1170,7 +1196,7 @@ msgid "" "3232235521\n" ">>>\n" ">>> width = 5\n" -">>> for num in range(5,12): \n" +">>> for num in range(5,12):\n" "... for base in 'dXob':\n" "... print('{0:{width}{base}}'.format(num, base=base, width=width), " "end=' ')\n" @@ -1198,7 +1224,7 @@ msgstr "" "3232235521\n" ">>>\n" ">>> width = 5\n" -">>> for num in range(5,12): \n" +">>> for num in range(5,12):\n" "... for base in 'dXob':\n" "... print('{0:{width}{base}}'.format(num, base=base, width=width), " "end=' ')\n" @@ -1212,36 +1238,35 @@ msgstr "" " 10 A 12 1010\n" " 11 B 13 1011" -#: ../../library/string.rst:760 +#: ../../library/string.rst:782 msgid "Template strings" msgstr "模板字串" -#: ../../library/string.rst:762 +#: ../../library/string.rst:784 msgid "" -"Template strings provide simpler string substitutions as described " -"in :pep:`292`. A primary use case for template strings is for " -"internationalization (i18n) since in that context, the simpler syntax and " -"functionality makes it easier to translate than other built-in string " -"formatting facilities in Python. As an example of a library built on " -"template strings for i18n, see the `flufl.i18n `_ package." +"Template strings provide simpler string substitutions as described in :pep:" +"`292`. A primary use case for template strings is for internationalization " +"(i18n) since in that context, the simpler syntax and functionality makes it " +"easier to translate than other built-in string formatting facilities in " +"Python. As an example of a library built on template strings for i18n, see " +"the `flufl.i18n `_ package." msgstr "" "模板字串提供如 :pep:`292` 所述更簡單的字串替換。模板字串的主要用例是國際化 " "(i18n),因為在這種情況下,更簡單的語法和功能使得它比其他 Python 內建字串格式" "化工具更容易翻譯。基於模板字串建構的 i18n 函式庫範例,請參閱 `flufl.i18n " "`_ 套件。" -#: ../../library/string.rst:772 +#: ../../library/string.rst:794 msgid "" "Template strings support ``$``-based substitutions, using the following " "rules:" msgstr "" -#: ../../library/string.rst:774 +#: ../../library/string.rst:796 msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "" -#: ../../library/string.rst:776 +#: ../../library/string.rst:798 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of " "``\"identifier\"``. By default, ``\"identifier\"`` is restricted to any " @@ -1251,30 +1276,30 @@ msgid "" "specification." msgstr "" -#: ../../library/string.rst:783 +#: ../../library/string.rst:805 msgid "" "``${identifier}`` is equivalent to ``$identifier``. It is required when " "valid identifier characters follow the placeholder but are not part of the " "placeholder, such as ``\"${noun}ification\"``." msgstr "" -#: ../../library/string.rst:787 +#: ../../library/string.rst:809 msgid "" -"Any other appearance of ``$`` in the string will result in " -"a :exc:`ValueError` being raised." +"Any other appearance of ``$`` in the string will result in a :exc:" +"`ValueError` being raised." msgstr "" -#: ../../library/string.rst:790 +#: ../../library/string.rst:812 msgid "" "The :mod:`string` module provides a :class:`Template` class that implements " "these rules. The methods of :class:`Template` are:" msgstr "" -#: ../../library/string.rst:796 +#: ../../library/string.rst:818 msgid "The constructor takes a single argument which is the template string." msgstr "" -#: ../../library/string.rst:801 +#: ../../library/string.rst:823 msgid "" "Performs the template substitution, returning a new string. *mapping* is " "any dictionary-like object with keys that match the placeholders in the " @@ -1286,7 +1311,7 @@ msgstr "" "的字典型物件。或者如果關鍵字就是佔位符號時,你也可以改提供關鍵字引數。當 " "*mapping* 跟 *kwds* 同時給定並存在重複時,*kwds* 的佔位符號會被優先使用。" -#: ../../library/string.rst:810 +#: ../../library/string.rst:832 msgid "" "Like :meth:`substitute`, except that if placeholders are missing from " "*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the " @@ -1299,7 +1324,7 @@ msgstr "" "與 :meth:`substitute` 不同的是,任何包含 ``$`` 的字句會直接回傳 ``$`` 而非引" "發 :exc:`ValueError`。" -#: ../../library/string.rst:816 +#: ../../library/string.rst:838 msgid "" "While other exceptions may still occur, this method is called \"safe\" " "because it always tries to return a usable string instead of raising an " @@ -1313,26 +1338,26 @@ msgstr "" "完全安全,因為它會默默忽略格式錯誤的模板,這些模板包含了多餘的左右定界符、不" "匹配的括號,或者不是有效的 Python 識別字的佔位符號。" -#: ../../library/string.rst:826 +#: ../../library/string.rst:848 msgid "" -"Returns false if the template has invalid placeholders that will " -"cause :meth:`substitute` to raise :exc:`ValueError`." +"Returns false if the template has invalid placeholders that will cause :meth:" +"`substitute` to raise :exc:`ValueError`." msgstr "" "如果模板有將導致 :meth:`substitute` 引發 :exc:`ValueError` 的無效佔位符號,就" "會回傳 false。" -#: ../../library/string.rst:834 +#: ../../library/string.rst:856 msgid "" "Returns a list of the valid identifiers in the template, in the order they " "first appear, ignoring any invalid identifiers." msgstr "" "回傳模板中有效識別字的串列,按照它們首次出現的順序,並忽略任何無效的識別字。" -#: ../../library/string.rst:839 +#: ../../library/string.rst:861 msgid ":class:`Template` instances also provide one public data attribute:" msgstr ":class:`Template` 實例也提供一個公開的資料屬性:" -#: ../../library/string.rst:843 +#: ../../library/string.rst:865 msgid "" "This is the object passed to the constructor's *template* argument. In " "general, you shouldn't change it, but read-only access is not enforced." @@ -1340,11 +1365,11 @@ msgstr "" "這是傳遞給建構函式 *template* 引數的物件。一般來說,你不應該改變它,但並沒有" "強制設定成唯讀。" -#: ../../library/string.rst:846 +#: ../../library/string.rst:868 msgid "Here is an example of how to use a Template::" msgstr "以下是如何使用 Template 的一個範例: ::" -#: ../../library/string.rst:848 +#: ../../library/string.rst:870 msgid "" ">>> from string import Template\n" ">>> s = Template('$who likes $what')\n" @@ -1378,7 +1403,7 @@ msgstr "" ">>> Template('$who likes $what').safe_substitute(d)\n" "'tim likes $what'" -#: ../../library/string.rst:864 +#: ../../library/string.rst:886 msgid "" "Advanced usage: you can derive subclasses of :class:`Template` to customize " "the placeholder syntax, delimiter character, or the entire regular " @@ -1388,21 +1413,21 @@ msgstr "" "進階用法:你可以衍生 :class:`Template` 類別來自定義佔位符號語法、左右定界符字" "元,或者用於剖析模板字串的正規表示式。你可以透過覆寫這些類別屬性來達成:" -#: ../../library/string.rst:869 +#: ../../library/string.rst:891 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " -"*not* be a regular expression, as the implementation will " -"call :meth:`re.escape` on this string as needed. Note further that you " -"cannot change the delimiter after class creation (i.e. a different delimiter " -"must be set in the subclass's class namespace)." +"*not* be a regular expression, as the implementation will call :meth:`re." +"escape` on this string as needed. Note further that you cannot change the " +"delimiter after class creation (i.e. a different delimiter must be set in " +"the subclass's class namespace)." msgstr "" "*delimiter* -- 這是描述引入左右定界符的文字字串。預設值是 ``$``。請注意這\\ *" "不是*\\ 正規表示式,因為實作會在需要時對這個字串呼叫 :meth:`re.escape`。也請" "注意你不能在建立類別後修改左右定界符。(意即在子類別的命名空間中必須設置不同" "的左右定界符)" -#: ../../library/string.rst:876 +#: ../../library/string.rst:898 msgid "" "*idpattern* -- This is the regular expression describing the pattern for non-" "braced placeholders. The default value is the regular expression ``(?a:[_a-" @@ -1410,19 +1435,19 @@ msgid "" "pattern will also apply to braced placeholders." msgstr "" -#: ../../library/string.rst:883 +#: ../../library/string.rst:905 msgid "" "Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with " "some non-ASCII characters. That's why we use the local ``a`` flag here." msgstr "" -#: ../../library/string.rst:887 +#: ../../library/string.rst:909 msgid "" "*braceidpattern* can be used to define separate patterns used inside and " "outside the braces." msgstr "" -#: ../../library/string.rst:891 +#: ../../library/string.rst:913 msgid "" "*braceidpattern* -- This is like *idpattern* but describes the pattern for " "braced placeholders. Defaults to ``None`` which means to fall back to " @@ -1431,7 +1456,7 @@ msgid "" "unbraced placeholders." msgstr "" -#: ../../library/string.rst:899 +#: ../../library/string.rst:921 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1440,7 +1465,7 @@ msgid "" "regular expressions." msgstr "" -#: ../../library/string.rst:907 +#: ../../library/string.rst:929 msgid "" "Alternatively, you can provide the entire regular expression pattern by " "overriding the class attribute *pattern*. If you do this, the value must be " @@ -1449,13 +1474,13 @@ msgid "" "placeholder rule:" msgstr "" -#: ../../library/string.rst:913 +#: ../../library/string.rst:935 msgid "" "*escaped* -- This group matches the escape sequence, e.g. ``$$``, in the " "default pattern." msgstr "*escaped* -- 此群組與跳脫序列匹配,例如在預設模式下為 ``$$``。" -#: ../../library/string.rst:916 +#: ../../library/string.rst:938 msgid "" "*named* -- This group matches the unbraced placeholder name; it should not " "include the delimiter in capturing group." @@ -1463,7 +1488,7 @@ msgstr "" "*named* -- 此群組與不帶大括號的佔位符號名稱匹配;它不應包含擷取群組中的左右定" "界符號。" -#: ../../library/string.rst:919 +#: ../../library/string.rst:941 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." @@ -1471,7 +1496,7 @@ msgstr "" "*braced* -- 此群組與大括號括起來的佔位符號名稱匹配;它不應在擷取群組中包含左" "右定界符或大括號。" -#: ../../library/string.rst:922 +#: ../../library/string.rst:944 msgid "" "*invalid* -- This group matches any other delimiter pattern (usually a " "single delimiter), and it should appear last in the regular expression." @@ -1479,26 +1504,26 @@ msgstr "" "*invalid* -- 此群組與任何其他左右定界符模式(通常是單一左右定界符)匹配,且它" "應該出現在正規表示式的最後。" -#: ../../library/string.rst:925 +#: ../../library/string.rst:947 msgid "" "The methods on this class will raise :exc:`ValueError` if the pattern " "matches the template without one of these named groups matching." msgstr "" -"當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引" -"發 :exc:`ValueError`。" +"當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引發 :exc:" +"`ValueError`。" -#: ../../library/string.rst:930 +#: ../../library/string.rst:952 msgid "Helper functions" msgstr "輔助函式" -#: ../../library/string.rst:934 +#: ../../library/string.rst:956 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " -"using :meth:`str.capitalize`, and join the capitalized words " -"using :meth:`str.join`. If the optional second argument *sep* is absent or " -"``None``, runs of whitespace characters are replaced by a single space and " -"leading and trailing whitespace are removed, otherwise *sep* is used to " -"split and join the words." +"using :meth:`str.capitalize`, and join the capitalized words using :meth:" +"`str.join`. If the optional second argument *sep* is absent or ``None``, " +"runs of whitespace characters are replaced by a single space and leading and " +"trailing whitespace are removed, otherwise *sep* is used to split and join " +"the words." msgstr "" "使用 :meth:`str.split` 將引數分割為字詞,使用 :meth:`str.capitalize` 將每個單" "字大寫,並使用 :meth:`str.join` 將大寫字詞連接起來。如果可選的第二引數 *sep* " @@ -1509,10 +1534,9 @@ msgstr "" msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/string.rst:202 ../../library/string.rst:342 -#: ../../library/string.rst:375 ../../library/string.rst:394 -#: ../../library/string.rst:403 ../../library/string.rst:417 -#: ../../library/string.rst:428 +#: ../../library/string.rst:202 ../../library/string.rst:344 +#: ../../library/string.rst:377 ../../library/string.rst:396 +#: ../../library/string.rst:405 ../../library/string.rst:437 msgid "in string formatting" msgstr "於字串格式化" @@ -1532,50 +1556,57 @@ msgstr "! (驚嘆號)" msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/string.rst:342 +#: ../../library/string.rst:344 msgid "< (less)" msgstr "< (小於)" -#: ../../library/string.rst:342 +#: ../../library/string.rst:344 msgid "> (greater)" msgstr "> (大於)" -#: ../../library/string.rst:342 +#: ../../library/string.rst:344 msgid "= (equals)" msgstr "= (等於)" -#: ../../library/string.rst:342 +#: ../../library/string.rst:344 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../library/string.rst:375 +#: ../../library/string.rst:377 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../library/string.rst:375 +#: ../../library/string.rst:377 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/string.rst:394 +#: ../../library/string.rst:396 msgid "z" msgstr "z" -#: ../../library/string.rst:403 +#: ../../library/string.rst:405 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/string.rst:417 +#: ../../library/string.rst:437 msgid ", (comma)" msgstr ", (逗號)" -#: ../../library/string.rst:428 +#: ../../library/string.rst:437 msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../library/string.rst:770 +#: ../../library/string.rst:792 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/string.rst:770 +#: ../../library/string.rst:792 msgid "in template strings" msgstr "於 template strings(模板字串)" + +#~ msgid "" +#~ ">>> '{:,}'.format(1234567890)\n" +#~ "'1,234,567,890'" +#~ msgstr "" +#~ ">>> '{:,}'.format(1234567890)\n" +#~ "'1,234,567,890'" diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index e09420449f..ebcf07aaf1 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-19 01:58+0800\n" +"POT-Creation-Date: 2025-03-20 00:14+0000\n" "PO-Revision-Date: 2024-10-21 17:51+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -273,11 +273,11 @@ msgstr "" msgid "Events are divided into three groups:" msgstr "事件被分為三組:" -#: ../../library/sys.monitoring.rst:171 +#: ../../library/sys.monitoring.rst:173 msgid "Local events" msgstr "區域事件" -#: ../../library/sys.monitoring.rst:173 +#: ../../library/sys.monitoring.rst:175 msgid "" "Local events are associated with normal execution of the program and happen " "at clearly defined locations. All local events can be disabled. The local " @@ -286,65 +286,65 @@ msgstr "" "區域事件與程式的正常執行相關,並發生在明確定義的位置。所有區域事件都可以被停" "用。區域事件有:" -#: ../../library/sys.monitoring.rst:177 +#: ../../library/sys.monitoring.rst:179 msgid ":monitoring-event:`PY_START`" msgstr ":monitoring-event:`PY_START`" -#: ../../library/sys.monitoring.rst:178 +#: ../../library/sys.monitoring.rst:180 msgid ":monitoring-event:`PY_RESUME`" msgstr ":monitoring-event:`PY_RESUME`" -#: ../../library/sys.monitoring.rst:179 +#: ../../library/sys.monitoring.rst:181 msgid ":monitoring-event:`PY_RETURN`" msgstr ":monitoring-event:`PY_RETURN`" -#: ../../library/sys.monitoring.rst:180 +#: ../../library/sys.monitoring.rst:182 msgid ":monitoring-event:`PY_YIELD`" msgstr ":monitoring-event:`PY_YIELD`" -#: ../../library/sys.monitoring.rst:181 +#: ../../library/sys.monitoring.rst:183 msgid ":monitoring-event:`CALL`" msgstr ":monitoring-event:`CALL`" -#: ../../library/sys.monitoring.rst:182 +#: ../../library/sys.monitoring.rst:184 msgid ":monitoring-event:`LINE`" msgstr ":monitoring-event:`LINE`" -#: ../../library/sys.monitoring.rst:183 +#: ../../library/sys.monitoring.rst:185 msgid ":monitoring-event:`INSTRUCTION`" msgstr ":monitoring-event:`INSTRUCTION`" -#: ../../library/sys.monitoring.rst:184 +#: ../../library/sys.monitoring.rst:186 msgid ":monitoring-event:`JUMP`" msgstr ":monitoring-event:`JUMP`" -#: ../../library/sys.monitoring.rst:185 +#: ../../library/sys.monitoring.rst:187 msgid ":monitoring-event:`BRANCH`" msgstr ":monitoring-event:`BRANCH`" -#: ../../library/sys.monitoring.rst:186 +#: ../../library/sys.monitoring.rst:188 msgid ":monitoring-event:`STOP_ITERATION`" msgstr ":monitoring-event:`STOP_ITERATION`" -#: ../../library/sys.monitoring.rst:189 +#: ../../library/sys.monitoring.rst:191 msgid "Ancillary events" msgstr "附屬事件 (ancillary events)" -#: ../../library/sys.monitoring.rst:191 +#: ../../library/sys.monitoring.rst:193 msgid "" "Ancillary events can be monitored like other events, but are controlled by " "another event:" msgstr "附屬事件可以像其他事件一樣被監控,但由另一個事件所控制:" -#: ../../library/sys.monitoring.rst:194 +#: ../../library/sys.monitoring.rst:196 msgid ":monitoring-event:`C_RAISE`" msgstr ":monitoring-event:`C_RAISE`" -#: ../../library/sys.monitoring.rst:195 +#: ../../library/sys.monitoring.rst:197 msgid ":monitoring-event:`C_RETURN`" msgstr ":monitoring-event:`C_RETURN`" -#: ../../library/sys.monitoring.rst:197 +#: ../../library/sys.monitoring.rst:199 msgid "" "The :monitoring-event:`C_RETURN` and :monitoring-event:`C_RAISE` events are " "controlled by the :monitoring-event:`CALL` event. :monitoring-event:" @@ -356,41 +356,41 @@ msgstr "" "受到監控時,才會看到 :monitoring-event:`C_RETURN` 和 :monitoring-event:" "`C_RAISE` 事件。" -#: ../../library/sys.monitoring.rst:203 +#: ../../library/sys.monitoring.rst:205 msgid "Other events" msgstr "其他事件" -#: ../../library/sys.monitoring.rst:205 +#: ../../library/sys.monitoring.rst:207 msgid "" "Other events are not necessarily tied to a specific location in the program " "and cannot be individually disabled." msgstr "其他事件不一定與程式中的特定位置相關聯,也不能單獨停用。" -#: ../../library/sys.monitoring.rst:208 +#: ../../library/sys.monitoring.rst:210 msgid "The other events that can be monitored are:" msgstr "其他可以監控的事件有:" -#: ../../library/sys.monitoring.rst:210 +#: ../../library/sys.monitoring.rst:212 msgid ":monitoring-event:`PY_THROW`" msgstr ":monitoring-event:`PY_THROW`" -#: ../../library/sys.monitoring.rst:211 +#: ../../library/sys.monitoring.rst:213 msgid ":monitoring-event:`PY_UNWIND`" msgstr ":monitoring-event:`PY_UNWIND`" -#: ../../library/sys.monitoring.rst:212 +#: ../../library/sys.monitoring.rst:214 msgid ":monitoring-event:`RAISE`" msgstr ":monitoring-event:`RAISE`" -#: ../../library/sys.monitoring.rst:213 +#: ../../library/sys.monitoring.rst:215 msgid ":monitoring-event:`EXCEPTION_HANDLED`" msgstr ":monitoring-event:`EXCEPTION_HANDLED`" -#: ../../library/sys.monitoring.rst:217 +#: ../../library/sys.monitoring.rst:219 msgid "The STOP_ITERATION event" msgstr "STOP_ITERATION 事件" -#: ../../library/sys.monitoring.rst:219 +#: ../../library/sys.monitoring.rst:221 msgid "" ":pep:`PEP 380 <380#use-of-stopiteration-to-return-values>` specifies that a :" "exc:`StopIteration` exception is raised when returning a value from a " @@ -403,7 +403,7 @@ msgstr "" "式,因此有一些 Python 實作(特別是 CPython 3.12+)不會引發例外,除非它對其他" "程式碼是可見的。" -#: ../../library/sys.monitoring.rst:225 +#: ../../library/sys.monitoring.rst:227 msgid "" "To allow tools to monitor for real exceptions without slowing down " "generators and coroutines, the :monitoring-event:`STOP_ITERATION` event is " @@ -414,11 +414,11 @@ msgstr "" "event:`STOP_ITERATION` 事件。與 :monitoring-event:`RAISE` 不同,:monitoring-" "event:`STOP_ITERATION` 可以區域停用。" -#: ../../library/sys.monitoring.rst:231 +#: ../../library/sys.monitoring.rst:233 msgid "Turning events on and off" msgstr "開啟和關閉事件" -#: ../../library/sys.monitoring.rst:233 +#: ../../library/sys.monitoring.rst:235 msgid "" "In order to monitor an event, it must be turned on and a corresponding " "callback must be registered. Events can be turned on or off by setting the " @@ -427,21 +427,21 @@ msgstr "" "為了監控一個事件,必須打開它並註冊相應的回呼。可以透過將事件設定為全域或只為" "特定程式碼物件來開啟或關閉事件。" -#: ../../library/sys.monitoring.rst:240 +#: ../../library/sys.monitoring.rst:242 msgid "Setting events globally" msgstr "全域設定事件" -#: ../../library/sys.monitoring.rst:242 +#: ../../library/sys.monitoring.rst:244 msgid "" "Events can be controlled globally by modifying the set of events being " "monitored." msgstr "可以透過修改正在監控的事件集合來全域地控制事件。" -#: ../../library/sys.monitoring.rst:246 +#: ../../library/sys.monitoring.rst:248 msgid "Returns the ``int`` representing all the active events." msgstr "回傳代表所有有效事件的 ``int``。" -#: ../../library/sys.monitoring.rst:250 +#: ../../library/sys.monitoring.rst:252 msgid "" "Activates all events which are set in *event_set*. Raises a :exc:" "`ValueError` if *tool_id* is not in use." @@ -449,15 +449,15 @@ msgstr "" "啟動 *event_set* 中設定的所有事件。如果 *tool_id* 並未正在被使用,則引發 :" "exc:`ValueError`。" -#: ../../library/sys.monitoring.rst:253 +#: ../../library/sys.monitoring.rst:255 msgid "No events are active by default." msgstr "預設沒有有效事件。" -#: ../../library/sys.monitoring.rst:256 +#: ../../library/sys.monitoring.rst:258 msgid "Per code object events" msgstr "各別程式碼物件事件" -#: ../../library/sys.monitoring.rst:258 +#: ../../library/sys.monitoring.rst:260 msgid "" "Events can also be controlled on a per code object basis. The functions " "defined below which accept a :class:`types.CodeType` should be prepared to " @@ -468,11 +468,11 @@ msgstr "" "CodeType` 的函式應該準備好接受來自 Python 中未定義函式的類似物件(請參閱 :" "ref:`c-api-monitoring`)。" -#: ../../library/sys.monitoring.rst:265 +#: ../../library/sys.monitoring.rst:267 msgid "Returns all the local events for *code*" msgstr "回傳 *code* 的所有區域事件" -#: ../../library/sys.monitoring.rst:269 +#: ../../library/sys.monitoring.rst:271 msgid "" "Activates all the local events for *code* which are set in *event_set*. " "Raises a :exc:`ValueError` if *tool_id* is not in use." @@ -480,7 +480,7 @@ msgstr "" "啟動 *event_set* 中針對 *code* 設定的所有區域事件。如果 *tool_id* 並未正在被" "使用,則引發 :exc:`ValueError`。" -#: ../../library/sys.monitoring.rst:272 +#: ../../library/sys.monitoring.rst:274 msgid "" "Local events add to global events, but do not mask them. In other words, all " "global events will trigger for a code object, regardless of the local events." @@ -488,17 +488,17 @@ msgstr "" "區域事件會加入到全域事件中,但不會掩蓋它們。換句話說,無論區域事件如何,所有" "全域事件都將為程式碼物件觸發。" -#: ../../library/sys.monitoring.rst:278 +#: ../../library/sys.monitoring.rst:280 msgid "Disabling events" msgstr "停用事件" -#: ../../library/sys.monitoring.rst:282 +#: ../../library/sys.monitoring.rst:284 msgid "" "A special value that can be returned from a callback function to disable " "events for the current code location." msgstr "可以從回呼函式回傳的特殊值,以停用當前程式碼位置的事件。" -#: ../../library/sys.monitoring.rst:285 +#: ../../library/sys.monitoring.rst:287 msgid "" "Local events can be disabled for a specific code location by returning :data:" "`sys.monitoring.DISABLE` from a callback function. This does not change " @@ -507,7 +507,7 @@ msgstr "" "可透過回呼函式回傳 :data:`sys.monitoring.DISABLE` 來停用特定程式碼位置的區域" "事件。這不會改變被設定的事件,或相同事件的任何其他程式碼位置。" -#: ../../library/sys.monitoring.rst:289 +#: ../../library/sys.monitoring.rst:291 msgid "" "Disabling events for specific locations is very important for high " "performance monitoring. For example, a program can be run under a debugger " @@ -517,25 +517,25 @@ msgstr "" "停用特定位置的事件對於高效能監控非常重要。舉例來說,如果除少數斷點外,偵錯器" "可以停用所有監控,那麼在偵錯器下執行程式就不會有任何開銷 (overhead)。" -#: ../../library/sys.monitoring.rst:296 +#: ../../library/sys.monitoring.rst:298 msgid "" "Enable all the events that were disabled by :data:`sys.monitoring.DISABLE` " "for all tools." msgstr "為所有工具啟用由 :data:`sys.monitoring.DISABLE` 停用的所有事件。" -#: ../../library/sys.monitoring.rst:303 +#: ../../library/sys.monitoring.rst:305 msgid "Registering callback functions" msgstr "註冊回呼函式" -#: ../../library/sys.monitoring.rst:305 +#: ../../library/sys.monitoring.rst:307 msgid "To register a callable for events call" msgstr "用來註冊對事件呼叫的可呼叫物件" -#: ../../library/sys.monitoring.rst:309 +#: ../../library/sys.monitoring.rst:311 msgid "Registers the callable *func* for the *event* with the given *tool_id*" msgstr "使用給定的 *tool_id* 來註冊對 *event* 的可呼叫物件 *func*" -#: ../../library/sys.monitoring.rst:311 +#: ../../library/sys.monitoring.rst:313 msgid "" "If another callback was registered for the given *tool_id* and *event*, it " "is unregistered and returned. Otherwise :func:`register_callback` returns " @@ -544,7 +544,7 @@ msgstr "" "如果給定的 *tool_id* 和 *event* 已經註冊了另一個回呼,則會取消註冊並回傳。否" "則 :func:`register_callback` 會回傳 ``None``。" -#: ../../library/sys.monitoring.rst:316 +#: ../../library/sys.monitoring.rst:318 msgid "" "Functions can be unregistered by calling ``sys.monitoring." "register_callback(tool_id, event, None)``." @@ -552,27 +552,27 @@ msgstr "" "可以透過呼叫 ``sys.monitoring.register_callback(tool_id, event, None)`` 來取" "消註冊函式。" -#: ../../library/sys.monitoring.rst:319 +#: ../../library/sys.monitoring.rst:321 msgid "Callback functions can be registered and unregistered at any time." msgstr "回呼函式可以隨時被註冊和取消註冊。" -#: ../../library/sys.monitoring.rst:321 +#: ../../library/sys.monitoring.rst:323 msgid "" "Registering or unregistering a callback function will generate a :func:`sys." "audit` event." msgstr "註冊或取消註冊回呼函式將產生 :func:`sys.audit` 事件。" -#: ../../library/sys.monitoring.rst:325 +#: ../../library/sys.monitoring.rst:327 msgid "Callback function arguments" msgstr "回呼函式引數" -#: ../../library/sys.monitoring.rst:329 +#: ../../library/sys.monitoring.rst:331 msgid "" "A special value that is passed to a callback function to indicate that there " "are no arguments to the call." msgstr "傳遞給回呼函式的特殊值,表示該呼叫沒有引數。" -#: ../../library/sys.monitoring.rst:332 +#: ../../library/sys.monitoring.rst:334 msgid "" "When an active event occurs, the registered callback function is called. " "Different events will provide the callback function with different " @@ -581,19 +581,19 @@ msgstr "" "當有效事件發生時,已註冊的回呼函式會被呼叫。不同的事件會為回呼函式提供不同的" "引數,如下所示:" -#: ../../library/sys.monitoring.rst:335 +#: ../../library/sys.monitoring.rst:337 msgid ":monitoring-event:`PY_START` and :monitoring-event:`PY_RESUME`::" msgstr ":monitoring-event:`PY_START` 和 :monitoring-event:`PY_RESUME`: ::" -#: ../../library/sys.monitoring.rst:337 ../../library/sys.monitoring.rst:368 +#: ../../library/sys.monitoring.rst:339 ../../library/sys.monitoring.rst:370 msgid "func(code: CodeType, instruction_offset: int) -> DISABLE | Any" msgstr "func(code: CodeType, instruction_offset: int) -> DISABLE | Any" -#: ../../library/sys.monitoring.rst:339 +#: ../../library/sys.monitoring.rst:341 msgid ":monitoring-event:`PY_RETURN` and :monitoring-event:`PY_YIELD`::" msgstr ":monitoring-event:`PY_RETURN` 和 :monitoring-event:`PY_YIELD`: ::" -#: ../../library/sys.monitoring.rst:341 +#: ../../library/sys.monitoring.rst:343 msgid "" "func(code: CodeType, instruction_offset: int, retval: object) -> DISABLE | " "Any" @@ -601,7 +601,7 @@ msgstr "" "func(code: CodeType, instruction_offset: int, retval: object) -> DISABLE | " "Any" -#: ../../library/sys.monitoring.rst:343 +#: ../../library/sys.monitoring.rst:345 msgid "" ":monitoring-event:`CALL`, :monitoring-event:`C_RAISE` and :monitoring-event:" "`C_RETURN`::" @@ -609,7 +609,7 @@ msgstr "" ":monitoring-event:`CALL`、:monitoring-event:`C_RAISE` 和 :monitoring-event:" "`C_RETURN`: ::" -#: ../../library/sys.monitoring.rst:345 +#: ../../library/sys.monitoring.rst:347 msgid "" "func(code: CodeType, instruction_offset: int, callable: object, arg0: object " "| MISSING) -> DISABLE | Any" @@ -617,12 +617,12 @@ msgstr "" "func(code: CodeType, instruction_offset: int, callable: object, arg0: object " "| MISSING) -> DISABLE | Any" -#: ../../library/sys.monitoring.rst:347 +#: ../../library/sys.monitoring.rst:349 msgid "" "If there are no arguments, *arg0* is set to :data:`sys.monitoring.MISSING`." msgstr "如果沒有引數,*arg0* 將被設定為 :data:`sys.monitoring.MISSING`。" -#: ../../library/sys.monitoring.rst:349 +#: ../../library/sys.monitoring.rst:351 msgid "" ":monitoring-event:`RAISE`, :monitoring-event:`RERAISE`, :monitoring-event:" "`EXCEPTION_HANDLED`, :monitoring-event:`PY_UNWIND`, :monitoring-event:" @@ -632,7 +632,7 @@ msgstr "" "`EXCEPTION_HANDLED`、:monitoring-event:`PY_UNWIND`、:monitoring-event:" "`PY_THROW` 和 :monitoring-event:`STOP_ITERATION`: ::" -#: ../../library/sys.monitoring.rst:352 +#: ../../library/sys.monitoring.rst:354 msgid "" "func(code: CodeType, instruction_offset: int, exception: BaseException) -> " "DISABLE | Any" @@ -640,19 +640,19 @@ msgstr "" "func(code: CodeType, instruction_offset: int, exception: BaseException) -> " "DISABLE | Any" -#: ../../library/sys.monitoring.rst:354 +#: ../../library/sys.monitoring.rst:356 msgid ":monitoring-event:`LINE`::" msgstr ":monitoring-event:`LINE`: ::" -#: ../../library/sys.monitoring.rst:356 +#: ../../library/sys.monitoring.rst:358 msgid "func(code: CodeType, line_number: int) -> DISABLE | Any" msgstr "func(code: CodeType, line_number: int) -> DISABLE | Any" -#: ../../library/sys.monitoring.rst:358 +#: ../../library/sys.monitoring.rst:360 msgid ":monitoring-event:`BRANCH` and :monitoring-event:`JUMP`::" msgstr ":monitoring-event:`BRANCH` 和 :monitoring-event:`JUMP`: ::" -#: ../../library/sys.monitoring.rst:360 +#: ../../library/sys.monitoring.rst:362 msgid "" "func(code: CodeType, instruction_offset: int, destination_offset: int) -> " "DISABLE | Any" @@ -660,7 +660,7 @@ msgstr "" "func(code: CodeType, instruction_offset: int, destination_offset: int) -> " "DISABLE | Any" -#: ../../library/sys.monitoring.rst:362 +#: ../../library/sys.monitoring.rst:364 msgid "" "Note that the *destination_offset* is where the code will next execute. For " "an untaken branch this will be the offset of the instruction following the " @@ -669,6 +669,6 @@ msgstr "" "請注意,*destination_offset* 是程式碼接下來要執行的地方。對於未採用的分支,這" "將是該分支之後的指令的偏移量。" -#: ../../library/sys.monitoring.rst:366 +#: ../../library/sys.monitoring.rst:368 msgid ":monitoring-event:`INSTRUCTION`::" msgstr ":monitoring-event:`INSTRUCTION`: ::" diff --git a/library/sys.po b/library/sys.po index 99a0ab456f..b4321d66db 100644 --- a/library/sys.po +++ b/library/sys.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-18 00:13+0000\n" +"POT-Creation-Date: 2025-03-27 00:14+0000\n" "PO-Revision-Date: 2023-04-26 02:54+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,10 +45,10 @@ msgstr "" #: ../../library/sys.rst:25 ../../library/sys.rst:299 ../../library/sys.rst:369 #: ../../library/sys.rst:760 ../../library/sys.rst:778 -#: ../../library/sys.rst:1020 ../../library/sys.rst:1519 -#: ../../library/sys.rst:1760 ../../library/sys.rst:1775 -#: ../../library/sys.rst:1783 ../../library/sys.rst:1799 -#: ../../library/sys.rst:2043 +#: ../../library/sys.rst:1020 ../../library/sys.rst:1522 +#: ../../library/sys.rst:1763 ../../library/sys.rst:1778 +#: ../../library/sys.rst:1786 ../../library/sys.rst:1802 +#: ../../library/sys.rst:2046 msgid "Availability" msgstr "" @@ -996,8 +996,8 @@ msgstr "" #: ../../library/sys.rst:767 msgid "" -"Return the name of the current default string encoding used by the Unicode " -"implementation." +"Return ``'utf-8'``. This is the name of the default string encoding, used in " +"methods like :meth:`str.encode`." msgstr "" #: ../../library/sys.rst:773 @@ -1134,7 +1134,7 @@ msgstr "" #: ../../library/sys.rst:886 msgid "" -"Return the interpreter's \"thread switch interval\"; see :func:" +"Return the interpreter's \"thread switch interval\" in seconds; see :func:" "`setswitchinterval`." msgstr "" @@ -1325,7 +1325,7 @@ msgstr "" msgid "See :pep:`525` for more details." msgstr "更多細節請見 :pep:`525`。" -#: ../../library/sys.rst:1043 ../../library/sys.rst:1731 +#: ../../library/sys.rst:1043 ../../library/sys.rst:1734 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.)" @@ -1337,7 +1337,7 @@ msgid "" "`set_coroutine_origin_tracking_depth`." msgstr "" -#: ../../library/sys.rst:1055 ../../library/sys.rst:1752 +#: ../../library/sys.rst:1055 ../../library/sys.rst:1755 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.) Use it only for debugging purposes." @@ -1547,17 +1547,21 @@ msgid "" "is disabled." msgstr "" -#: ../../library/sys.rst:1241 +#: ../../library/sys.rst:1240 ../../library/sys.rst:1272 +msgid "It is not guaranteed to exist in all implementations of Python." +msgstr "" + +#: ../../library/sys.rst:1244 msgid "" "Return :const:`True` if the main Python interpreter is :term:`shutting down " "`. Return :const:`False` otherwise." msgstr "" -#: ../../library/sys.rst:1244 +#: ../../library/sys.rst:1247 msgid "See also the :exc:`PythonFinalizationError` exception." msgstr "" -#: ../../library/sys.rst:1250 +#: ../../library/sys.rst:1253 msgid "" "This variable is not always defined; it is set to the exception instance " "when an exception is not handled and the interpreter prints an error message " @@ -1568,44 +1572,40 @@ msgid "" "more information.)" msgstr "" -#: ../../library/sys.rst:1262 +#: ../../library/sys.rst:1265 msgid "" "Return :const:`True` if the given string is \"interned\", :const:`False` " "otherwise." msgstr "" -#: ../../library/sys.rst:1269 -msgid "It is not guaranteed to exist in all implementations of Python." -msgstr "" - -#: ../../library/sys.rst:1276 +#: ../../library/sys.rst:1279 msgid "" "These three variables are deprecated; use :data:`sys.last_exc` instead. They " "hold the legacy representation of ``sys.last_exc``, as returned from :func:" "`exc_info` above." msgstr "" -#: ../../library/sys.rst:1282 +#: ../../library/sys.rst:1285 msgid "" "An integer giving the maximum value a variable of type :c:type:`Py_ssize_t` " "can take. It's usually ``2**31 - 1`` on a 32-bit platform and ``2**63 - 1`` " "on a 64-bit platform." msgstr "" -#: ../../library/sys.rst:1289 +#: ../../library/sys.rst:1292 msgid "" "An integer giving the value of the largest Unicode code point, i.e. " "``1114111`` (``0x10FFFF`` in hexadecimal)." msgstr "" -#: ../../library/sys.rst:1292 +#: ../../library/sys.rst:1295 msgid "" "Before :pep:`393`, ``sys.maxunicode`` used to be either ``0xFFFF`` or " "``0x10FFFF``, depending on the configuration option that specified whether " "Unicode characters were stored as UCS-2 or UCS-4." msgstr "" -#: ../../library/sys.rst:1300 +#: ../../library/sys.rst:1303 msgid "" "A list of :term:`meta path finder` objects that have their :meth:`~importlib." "abc.MetaPathFinder.find_spec` methods called to see if one of the objects " @@ -1618,40 +1618,40 @@ msgid "" "``None`` if the module cannot be found." msgstr "" -#: ../../library/sys.rst:1313 +#: ../../library/sys.rst:1316 msgid ":class:`importlib.abc.MetaPathFinder`" msgstr ":class:`importlib.abc.MetaPathFinder`" -#: ../../library/sys.rst:1314 +#: ../../library/sys.rst:1317 msgid "" "The abstract base class defining the interface of finder objects on :data:" "`meta_path`." msgstr "" -#: ../../library/sys.rst:1316 +#: ../../library/sys.rst:1319 msgid ":class:`importlib.machinery.ModuleSpec`" msgstr ":class:`importlib.machinery.ModuleSpec`" -#: ../../library/sys.rst:1317 +#: ../../library/sys.rst:1320 msgid "" "The concrete class which :meth:`~importlib.abc.MetaPathFinder.find_spec` " "should return instances of." msgstr "" -#: ../../library/sys.rst:1323 +#: ../../library/sys.rst:1326 msgid "" ":term:`Module specs ` were introduced in Python 3.4, by :pep:" "`451`." msgstr "" -#: ../../library/sys.rst:1328 +#: ../../library/sys.rst:1331 msgid "" "Removed the fallback that looked for a :meth:`!find_module` method if a :" "data:`meta_path` entry didn't have a :meth:`~importlib.abc.MetaPathFinder." "find_spec` method." msgstr "" -#: ../../library/sys.rst:1334 +#: ../../library/sys.rst:1337 msgid "" "This is a dictionary that maps module names to modules which have already " "been loaded. This can be manipulated to force reloading of modules and " @@ -1663,13 +1663,13 @@ msgid "" "other threads." msgstr "" -#: ../../library/sys.rst:1346 +#: ../../library/sys.rst:1349 msgid "" "The list of the original command line arguments passed to the Python " "executable." msgstr "" -#: ../../library/sys.rst:1349 +#: ../../library/sys.rst:1352 msgid "" "The elements of :data:`sys.orig_argv` are the arguments to the Python " "interpreter, while the elements of :data:`sys.argv` are the arguments to the " @@ -1677,68 +1677,68 @@ msgid "" "in :data:`sys.orig_argv` and missing from :data:`sys.argv`." msgstr "" -#: ../../library/sys.rst:1361 +#: ../../library/sys.rst:1364 msgid "" "A list of strings that specifies the search path for modules. Initialized " "from the environment variable :envvar:`PYTHONPATH`, plus an installation-" "dependent default." msgstr "" -#: ../../library/sys.rst:1365 +#: ../../library/sys.rst:1368 msgid "" "By default, as initialized upon program startup, a potentially unsafe path " "is prepended to :data:`sys.path` (*before* the entries inserted as a result " "of :envvar:`PYTHONPATH`):" msgstr "" -#: ../../library/sys.rst:1369 +#: ../../library/sys.rst:1372 msgid "" "``python -m module`` command line: prepend the current working directory." msgstr "" -#: ../../library/sys.rst:1371 +#: ../../library/sys.rst:1374 msgid "" "``python script.py`` command line: prepend the script's directory. If it's a " "symbolic link, resolve symbolic links." msgstr "" -#: ../../library/sys.rst:1373 +#: ../../library/sys.rst:1376 msgid "" "``python -c code`` and ``python`` (REPL) command lines: prepend an empty " "string, which means the current working directory." msgstr "" -#: ../../library/sys.rst:1376 +#: ../../library/sys.rst:1379 msgid "" "To not prepend this potentially unsafe path, use the :option:`-P` command " "line option or the :envvar:`PYTHONSAFEPATH` environment variable." msgstr "" -#: ../../library/sys.rst:1379 +#: ../../library/sys.rst:1382 msgid "" "A program is free to modify this list for its own purposes. Only strings " "should be added to :data:`sys.path`; all other data types are ignored during " "import." msgstr "" -#: ../../library/sys.rst:1385 +#: ../../library/sys.rst:1388 msgid "" "Module :mod:`site` This describes how to use .pth files to extend :data:`sys." "path`." msgstr "" -#: ../../library/sys.rst:1390 +#: ../../library/sys.rst:1393 msgid "" "A list of callables that take a path argument to try to create a :term:" "`finder` for the path. If a finder can be created, it is to be returned by " "the callable, else raise :exc:`ImportError`." msgstr "" -#: ../../library/sys.rst:1394 ../../library/sys.rst:1405 +#: ../../library/sys.rst:1397 ../../library/sys.rst:1408 msgid "Originally specified in :pep:`302`." msgstr "" -#: ../../library/sys.rst:1399 +#: ../../library/sys.rst:1402 msgid "" "A dictionary acting as a cache for :term:`finder` objects. The keys are " "paths that have been passed to :data:`sys.path_hooks` and the values are the " @@ -1746,91 +1746,91 @@ msgid "" "is found on :data:`sys.path_hooks` then ``None`` is stored." msgstr "" -#: ../../library/sys.rst:1410 +#: ../../library/sys.rst:1413 msgid "A string containing a platform identifier. Known values are:" msgstr "" -#: ../../library/sys.rst:1413 +#: ../../library/sys.rst:1416 msgid "System" msgstr "" -#: ../../library/sys.rst:1413 +#: ../../library/sys.rst:1416 msgid "``platform`` value" msgstr "" -#: ../../library/sys.rst:1415 +#: ../../library/sys.rst:1418 msgid "AIX" msgstr "AIX" -#: ../../library/sys.rst:1415 +#: ../../library/sys.rst:1418 msgid "``'aix'``" msgstr "``'aix'``" -#: ../../library/sys.rst:1416 +#: ../../library/sys.rst:1419 msgid "Android" msgstr "Android" -#: ../../library/sys.rst:1416 +#: ../../library/sys.rst:1419 msgid "``'android'``" msgstr "``'android'``" -#: ../../library/sys.rst:1417 +#: ../../library/sys.rst:1420 msgid "Emscripten" msgstr "Emscripten" -#: ../../library/sys.rst:1417 +#: ../../library/sys.rst:1420 msgid "``'emscripten'``" msgstr "``'emscripten'``" -#: ../../library/sys.rst:1418 +#: ../../library/sys.rst:1421 msgid "iOS" msgstr "iOS" -#: ../../library/sys.rst:1418 +#: ../../library/sys.rst:1421 msgid "``'ios'``" msgstr "``'ios'``" -#: ../../library/sys.rst:1419 +#: ../../library/sys.rst:1422 msgid "Linux" msgstr "Linux" -#: ../../library/sys.rst:1419 +#: ../../library/sys.rst:1422 msgid "``'linux'``" msgstr "``'linux'``" -#: ../../library/sys.rst:1420 +#: ../../library/sys.rst:1423 msgid "macOS" msgstr "macOS" -#: ../../library/sys.rst:1420 +#: ../../library/sys.rst:1423 msgid "``'darwin'``" msgstr "``'darwin'``" -#: ../../library/sys.rst:1421 +#: ../../library/sys.rst:1424 msgid "Windows" msgstr "Windows" -#: ../../library/sys.rst:1421 +#: ../../library/sys.rst:1424 msgid "``'win32'``" msgstr "``'win32'``" -#: ../../library/sys.rst:1422 +#: ../../library/sys.rst:1425 msgid "Windows/Cygwin" msgstr "Windows/Cygwin" -#: ../../library/sys.rst:1422 +#: ../../library/sys.rst:1425 msgid "``'cygwin'``" msgstr "``'cygwin'``" -#: ../../library/sys.rst:1423 +#: ../../library/sys.rst:1426 msgid "WASI" msgstr "WASI" -#: ../../library/sys.rst:1423 +#: ../../library/sys.rst:1426 msgid "``'wasi'``" msgstr "``'wasi'``" -#: ../../library/sys.rst:1426 +#: ../../library/sys.rst:1429 msgid "" "On Unix systems not listed in the table, the value is the lowercased OS name " "as returned by ``uname -s``, with the first part of the version as returned " @@ -1839,81 +1839,81 @@ msgid "" "version, it is therefore recommended to use the following idiom::" msgstr "" -#: ../../library/sys.rst:1432 +#: ../../library/sys.rst:1435 msgid "" "if sys.platform.startswith('freebsd'):\n" " # FreeBSD-specific code here..." msgstr "" -#: ../../library/sys.rst:1435 +#: ../../library/sys.rst:1438 msgid "" "On Linux, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``." msgstr "" -#: ../../library/sys.rst:1439 +#: ../../library/sys.rst:1442 msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``." msgstr "" -#: ../../library/sys.rst:1443 +#: ../../library/sys.rst:1446 msgid "" "On Android, :data:`sys.platform` now returns ``'android'`` rather than " "``'linux'``." msgstr "" -#: ../../library/sys.rst:1449 +#: ../../library/sys.rst:1452 msgid "" ":data:`os.name` has a coarser granularity. :func:`os.uname` gives system-" "dependent version information." msgstr "" -#: ../../library/sys.rst:1452 +#: ../../library/sys.rst:1455 msgid "" "The :mod:`platform` module provides detailed checks for the system's " "identity." msgstr "" -#: ../../library/sys.rst:1458 +#: ../../library/sys.rst:1461 msgid "" "Name of the platform-specific library directory. It is used to build the " "path of standard library and the paths of installed extension modules." msgstr "" -#: ../../library/sys.rst:1461 +#: ../../library/sys.rst:1464 msgid "" "It is equal to ``\"lib\"`` on most platforms. On Fedora and SuSE, it is " "equal to ``\"lib64\"`` on 64-bit platforms which gives the following ``sys." "path`` paths (where ``X.Y`` is the Python ``major.minor`` version):" msgstr "" -#: ../../library/sys.rst:1465 +#: ../../library/sys.rst:1468 msgid "" "``/usr/lib64/pythonX.Y/``: Standard library (like ``os.py`` of the :mod:`os` " "module)" msgstr "" -#: ../../library/sys.rst:1467 +#: ../../library/sys.rst:1470 msgid "" "``/usr/lib64/pythonX.Y/lib-dynload/``: C extension modules of the standard " "library (like the :mod:`errno` module, the exact filename is platform " "specific)" msgstr "" -#: ../../library/sys.rst:1470 +#: ../../library/sys.rst:1473 msgid "" "``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, not :data:`sys." "platlibdir`): Third-party modules" msgstr "" -#: ../../library/sys.rst:1472 +#: ../../library/sys.rst:1475 msgid "" "``/usr/lib64/pythonX.Y/site-packages/``: C extension modules of third-party " "packages" msgstr "" -#: ../../library/sys.rst:1480 +#: ../../library/sys.rst:1483 msgid "" "A string giving the site-specific directory prefix where the platform " "independent Python files are installed; on Unix, the default is :file:`/usr/" @@ -1922,14 +1922,14 @@ msgid "" "derived paths." msgstr "" -#: ../../library/sys.rst:1486 +#: ../../library/sys.rst:1489 msgid "" "If a :ref:`virtual environment ` is in effect, this value will be " "changed in ``site.py`` to point to the virtual environment. The value for " "the Python installation will still be available, via :data:`base_prefix`." msgstr "" -#: ../../library/sys.rst:1501 +#: ../../library/sys.rst:1504 msgid "" "Strings specifying the primary and secondary prompt of the interpreter. " "These are only defined if the interpreter is in interactive mode. Their " @@ -1939,7 +1939,7 @@ msgid "" "used to implement a dynamic prompt." msgstr "" -#: ../../library/sys.rst:1511 +#: ../../library/sys.rst:1514 msgid "" "Set the flags used by the interpreter for :c:func:`dlopen` calls, such as " "when the interpreter loads extension modules. Among other things, this will " @@ -1950,14 +1950,14 @@ msgid "" "g. :const:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:1523 +#: ../../library/sys.rst:1526 msgid "" "Set the :ref:`integer string conversion length limitation " "` used by this interpreter. See also :func:" "`get_int_max_str_digits`." msgstr "" -#: ../../library/sys.rst:1535 +#: ../../library/sys.rst:1538 msgid "" "Set the system's profile function, which allows you to implement a Python " "source code profiler in Python. See chapter :ref:`profile` for more " @@ -1972,14 +1972,14 @@ msgid "" "in the profile function will cause itself unset." msgstr "" -#: ../../library/sys.rst:1547 +#: ../../library/sys.rst:1550 msgid "" "The same tracing mechanism is used for :func:`!setprofile` as :func:" "`settrace`. To trace calls with :func:`!setprofile` inside a tracing " "function (e.g. in a debugger breakpoint), see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1551 +#: ../../library/sys.rst:1554 msgid "" "Profile functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -1987,71 +1987,71 @@ msgid "" "depends on the event type." msgstr "" -#: ../../library/sys.rst:1556 ../../library/sys.rst:1643 +#: ../../library/sys.rst:1559 ../../library/sys.rst:1646 msgid "The events have the following meaning:" msgstr "" -#: ../../library/sys.rst:1558 ../../library/sys.rst:1645 +#: ../../library/sys.rst:1561 ../../library/sys.rst:1648 msgid "``'call'``" msgstr "``'call'``" -#: ../../library/sys.rst:1559 +#: ../../library/sys.rst:1562 msgid "" "A function is called (or some other code block entered). The profile " "function is called; *arg* is ``None``." msgstr "" -#: ../../library/sys.rst:1562 ../../library/sys.rst:1660 +#: ../../library/sys.rst:1565 ../../library/sys.rst:1663 msgid "``'return'``" msgstr "``'return'``" -#: ../../library/sys.rst:1563 +#: ../../library/sys.rst:1566 msgid "" "A function (or other code block) is about to return. The profile function " "is called; *arg* is the value that will be returned, or ``None`` if the " "event is caused by an exception being raised." msgstr "" -#: ../../library/sys.rst:1567 +#: ../../library/sys.rst:1570 msgid "``'c_call'``" msgstr "``'c_call'``" -#: ../../library/sys.rst:1568 +#: ../../library/sys.rst:1571 msgid "" "A C function is about to be called. This may be an extension function or a " "built-in. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1571 +#: ../../library/sys.rst:1574 msgid "``'c_return'``" msgstr "``'c_return'``" -#: ../../library/sys.rst:1572 +#: ../../library/sys.rst:1575 msgid "A C function has returned. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1574 +#: ../../library/sys.rst:1577 msgid "``'c_exception'``" msgstr "``'c_exception'``" -#: ../../library/sys.rst:1575 +#: ../../library/sys.rst:1578 msgid "A C function has raised an exception. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1577 +#: ../../library/sys.rst:1580 msgid "" "Raises an :ref:`auditing event ` ``sys.setprofile`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.setprofile``。" -#: ../../library/sys.rst:1582 +#: ../../library/sys.rst:1585 msgid "" "Set the maximum depth of the Python interpreter stack to *limit*. This " "limit prevents infinite recursion from causing an overflow of the C stack " "and crashing Python." msgstr "" -#: ../../library/sys.rst:1586 +#: ../../library/sys.rst:1589 msgid "" "The highest possible limit is platform-dependent. A user may need to set " "the limit higher when they have a program that requires deep recursion and a " @@ -2059,19 +2059,19 @@ msgid "" "because a too-high limit can lead to a crash." msgstr "" -#: ../../library/sys.rst:1591 +#: ../../library/sys.rst:1594 msgid "" "If the new limit is too low at the current recursion depth, a :exc:" "`RecursionError` exception is raised." msgstr "" -#: ../../library/sys.rst:1594 +#: ../../library/sys.rst:1597 msgid "" "A :exc:`RecursionError` exception is now raised if the new limit is too low " "at the current recursion depth." msgstr "" -#: ../../library/sys.rst:1601 +#: ../../library/sys.rst:1604 msgid "" "Set the interpreter's thread switch interval (in seconds). This floating-" "point value determines the ideal duration of the \"timeslices\" allocated to " @@ -2082,7 +2082,7 @@ msgid "" "scheduler." msgstr "" -#: ../../library/sys.rst:1618 +#: ../../library/sys.rst:1621 msgid "" "Set the system's trace function, which allows you to implement a Python " "source code debugger in Python. The function is thread-specific; for a " @@ -2091,7 +2091,7 @@ msgid "" "`threading.settrace`." msgstr "" -#: ../../library/sys.rst:1623 +#: ../../library/sys.rst:1626 msgid "" "Trace functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -2099,7 +2099,7 @@ msgid "" "the event type." msgstr "" -#: ../../library/sys.rst:1628 +#: ../../library/sys.rst:1631 msgid "" "The trace function is invoked (with *event* set to ``'call'``) whenever a " "new local scope is entered; it should return a reference to a local trace " @@ -2107,36 +2107,36 @@ msgid "" "traced." msgstr "" -#: ../../library/sys.rst:1633 +#: ../../library/sys.rst:1636 msgid "" "The local trace function should return a reference to itself, or to another " "function which would then be used as the local trace function for the scope." msgstr "" -#: ../../library/sys.rst:1636 +#: ../../library/sys.rst:1639 msgid "" "If there is any error occurred in the trace function, it will be unset, just " "like ``settrace(None)`` is called." msgstr "" -#: ../../library/sys.rst:1640 +#: ../../library/sys.rst:1643 msgid "" "Tracing is disabled while calling the trace function (e.g. a function set " "by :func:`!settrace`). For recursive tracing see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1646 +#: ../../library/sys.rst:1649 msgid "" "A function is called (or some other code block entered). The global trace " "function is called; *arg* is ``None``; the return value specifies the local " "trace function." msgstr "" -#: ../../library/sys.rst:1650 +#: ../../library/sys.rst:1653 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/sys.rst:1651 +#: ../../library/sys.rst:1654 msgid "" "The interpreter is about to execute a new line of code or re-execute the " "condition of a loop. The local trace function is called; *arg* is ``None``; " @@ -2146,7 +2146,7 @@ msgid "" "to :const:`False` on that :ref:`frame `." msgstr "" -#: ../../library/sys.rst:1661 +#: ../../library/sys.rst:1664 msgid "" "A function (or other code block) is about to return. The local trace " "function is called; *arg* is the value that will be returned, or ``None`` if " @@ -2154,22 +2154,22 @@ msgid "" "return value is ignored." msgstr "" -#: ../../library/sys.rst:1666 +#: ../../library/sys.rst:1669 msgid "``'exception'``" msgstr "``'exception'``" -#: ../../library/sys.rst:1667 +#: ../../library/sys.rst:1670 msgid "" "An exception has occurred. The local trace function is called; *arg* is a " "tuple ``(exception, value, traceback)``; the return value specifies the new " "local trace function." msgstr "" -#: ../../library/sys.rst:1671 +#: ../../library/sys.rst:1674 msgid "``'opcode'``" msgstr "``'opcode'``" -#: ../../library/sys.rst:1672 +#: ../../library/sys.rst:1675 msgid "" "The interpreter is about to execute a new opcode (see :mod:`dis` for opcode " "details). The local trace function is called; *arg* is ``None``; the return " @@ -2179,13 +2179,13 @@ msgid "" "objects>`." msgstr "" -#: ../../library/sys.rst:1679 +#: ../../library/sys.rst:1682 msgid "" "Note that as an exception is propagated down the chain of callers, an " "``'exception'`` event is generated at each level." msgstr "" -#: ../../library/sys.rst:1682 +#: ../../library/sys.rst:1685 msgid "" "For more fine-grained usage, it's possible to set a trace function by " "assigning ``frame.f_trace = tracefunc`` explicitly, rather than relying on " @@ -2199,17 +2199,17 @@ msgid "" "on each frame)." msgstr "" -#: ../../library/sys.rst:1693 +#: ../../library/sys.rst:1696 msgid "For more information on code and frame objects, refer to :ref:`types`." msgstr "" -#: ../../library/sys.rst:1695 +#: ../../library/sys.rst:1698 msgid "" "Raises an :ref:`auditing event ` ``sys.settrace`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.settrace``。" -#: ../../library/sys.rst:1699 +#: ../../library/sys.rst:1702 msgid "" "The :func:`settrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -2217,13 +2217,13 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:1706 +#: ../../library/sys.rst:1709 msgid "" "``'opcode'`` event type added; :attr:`~frame.f_trace_lines` and :attr:" "`~frame.f_trace_opcodes` attributes added to frames" msgstr "" -#: ../../library/sys.rst:1711 +#: ../../library/sys.rst:1714 msgid "" "Accepts two optional keyword arguments which are callables that accept an :" "term:`asynchronous generator iterator` as an argument. The *firstiter* " @@ -2232,7 +2232,7 @@ msgid "" "about to be garbage collected." msgstr "" -#: ../../library/sys.rst:1717 +#: ../../library/sys.rst:1720 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_firstiter`` with no arguments." @@ -2240,7 +2240,7 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "set_asyncgen_hooks_firstiter``。" -#: ../../library/sys.rst:1719 +#: ../../library/sys.rst:1722 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_finalizer`` with no arguments." @@ -2248,20 +2248,20 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "set_asyncgen_hooks_finalizer``。" -#: ../../library/sys.rst:1721 +#: ../../library/sys.rst:1724 msgid "" "Two auditing events are raised because the underlying API consists of two " "calls, each of which must raise its own event." msgstr "" -#: ../../library/sys.rst:1724 +#: ../../library/sys.rst:1727 msgid "" "See :pep:`525` for more details, and for a reference example of a " "*finalizer* method see the implementation of ``asyncio.Loop." "shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`" msgstr "" -#: ../../library/sys.rst:1736 +#: ../../library/sys.rst:1739 msgid "" "Allows enabling or disabling coroutine origin tracking. When enabled, the " "``cr_origin`` attribute on coroutine objects will contain a tuple of " @@ -2270,111 +2270,111 @@ msgid "" "disabled, ``cr_origin`` will be ``None``." msgstr "" -#: ../../library/sys.rst:1743 +#: ../../library/sys.rst:1746 msgid "" "To enable, pass a *depth* value greater than zero; this sets the number of " "frames whose information will be captured. To disable, pass set *depth* to " "zero." msgstr "" -#: ../../library/sys.rst:1747 +#: ../../library/sys.rst:1750 msgid "This setting is thread-specific." msgstr "" -#: ../../library/sys.rst:1757 +#: ../../library/sys.rst:1760 msgid "" "Activate the stack profiler trampoline *backend*. The only supported backend " "is ``\"perf\"``." msgstr "" -#: ../../library/sys.rst:1766 +#: ../../library/sys.rst:1769 msgid ":ref:`perf_profiling`" msgstr ":ref:`perf_profiling`" -#: ../../library/sys.rst:1767 +#: ../../library/sys.rst:1770 msgid "https://perf.wiki.kernel.org" msgstr "https://perf.wiki.kernel.org" -#: ../../library/sys.rst:1771 +#: ../../library/sys.rst:1774 msgid "Deactivate the current stack profiler trampoline backend." msgstr "" -#: ../../library/sys.rst:1773 +#: ../../library/sys.rst:1776 msgid "If no stack profiler is activated, this function has no effect." msgstr "" -#: ../../library/sys.rst:1781 +#: ../../library/sys.rst:1784 msgid "Return ``True`` if a stack profiler trampoline is active." msgstr "" -#: ../../library/sys.rst:1789 +#: ../../library/sys.rst:1792 msgid "" "Changes the :term:`filesystem encoding and error handler` to 'mbcs' and " "'replace' respectively, for consistency with versions of Python prior to 3.6." msgstr "" -#: ../../library/sys.rst:1793 +#: ../../library/sys.rst:1796 msgid "" "This is equivalent to defining the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable before launching Python." msgstr "" -#: ../../library/sys.rst:1796 +#: ../../library/sys.rst:1799 msgid "" "See also :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors`." msgstr "" -#: ../../library/sys.rst:1802 +#: ../../library/sys.rst:1805 msgid "" "Changing the filesystem encoding after Python startup is risky because the " "old fsencoding or paths encoded by the old fsencoding may be cached " "somewhere. Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." msgstr "" -#: ../../library/sys.rst:1806 +#: ../../library/sys.rst:1809 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`。" -#: ../../library/sys.rst:1809 +#: ../../library/sys.rst:1812 msgid "Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." msgstr "" -#: ../../library/sys.rst:1816 +#: ../../library/sys.rst:1819 msgid "" ":term:`File objects ` used by the interpreter for standard " "input, output and errors:" msgstr "" -#: ../../library/sys.rst:1819 +#: ../../library/sys.rst:1822 msgid "" "``stdin`` is used for all interactive input (including calls to :func:" "`input`);" msgstr "" -#: ../../library/sys.rst:1821 +#: ../../library/sys.rst:1824 msgid "" "``stdout`` is used for the output of :func:`print` and :term:`expression` " "statements and for the prompts of :func:`input`;" msgstr "" -#: ../../library/sys.rst:1823 +#: ../../library/sys.rst:1826 msgid "The interpreter's own prompts and its error messages go to ``stderr``." msgstr "" -#: ../../library/sys.rst:1825 +#: ../../library/sys.rst:1828 msgid "" "These streams are regular :term:`text files ` like those returned " "by the :func:`open` function. Their parameters are chosen as follows:" msgstr "" -#: ../../library/sys.rst:1829 +#: ../../library/sys.rst:1832 msgid "" "The encoding and error handling are is initialized from :c:member:`PyConfig." "stdio_encoding` and :c:member:`PyConfig.stdio_errors`." msgstr "" -#: ../../library/sys.rst:1832 +#: ../../library/sys.rst:1835 msgid "" "On Windows, UTF-8 is used for the console device. Non-character devices " "such as disk files and pipes use the system locale encoding (i.e. the ANSI " @@ -2385,14 +2385,14 @@ msgid "" "initially attached to a console." msgstr "" -#: ../../library/sys.rst:1841 +#: ../../library/sys.rst:1844 msgid "" "The special behaviour of the console can be overridden by setting the " "environment variable PYTHONLEGACYWINDOWSSTDIO before starting Python. In " "that case, the console codepages are used as for any other character device." msgstr "" -#: ../../library/sys.rst:1846 +#: ../../library/sys.rst:1849 msgid "" "Under all platforms, you can override the character encoding by setting the :" "envvar:`PYTHONIOENCODING` environment variable before starting Python or by " @@ -2401,7 +2401,7 @@ msgid "" "only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set." msgstr "" -#: ../../library/sys.rst:1853 +#: ../../library/sys.rst:1856 msgid "" "When interactive, the ``stdout`` stream is line-buffered. Otherwise, it is " "block-buffered like regular text files. The ``stderr`` stream is line-" @@ -2410,19 +2410,19 @@ msgid "" "`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../library/sys.rst:1859 +#: ../../library/sys.rst:1862 msgid "" "Non-interactive ``stderr`` is now line-buffered instead of fully buffered." msgstr "" -#: ../../library/sys.rst:1865 +#: ../../library/sys.rst:1868 msgid "" "To write or read binary data from/to the standard streams, use the " "underlying binary :data:`~io.TextIOBase.buffer` object. For example, to " "write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``." msgstr "" -#: ../../library/sys.rst:1869 +#: ../../library/sys.rst:1872 msgid "" "However, if you are writing a library (and do not control in which context " "its code will be executed), be aware that the standard streams may be " @@ -2430,7 +2430,7 @@ msgid "" "support the :attr:`!buffer` attribute." msgstr "" -#: ../../library/sys.rst:1879 +#: ../../library/sys.rst:1882 msgid "" "These objects contain the original values of ``stdin``, ``stderr`` and " "``stdout`` at the start of the program. They are used during finalization, " @@ -2438,7 +2438,7 @@ msgid "" "``sys.std*`` object has been redirected." msgstr "" -#: ../../library/sys.rst:1884 +#: ../../library/sys.rst:1887 msgid "" "It can also be used to restore the actual files to known working file " "objects in case they have been overwritten with a broken object. However, " @@ -2446,7 +2446,7 @@ msgid "" "before replacing it, and restore the saved object." msgstr "" -#: ../../library/sys.rst:1890 +#: ../../library/sys.rst:1893 msgid "" "Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the " "original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be " @@ -2454,12 +2454,12 @@ msgid "" "to a console and Python apps started with :program:`pythonw`." msgstr "" -#: ../../library/sys.rst:1898 +#: ../../library/sys.rst:1901 msgid "" "A frozenset of strings containing the names of standard library modules." msgstr "" -#: ../../library/sys.rst:1900 +#: ../../library/sys.rst:1903 msgid "" "It is the same on all platforms. Modules which are not available on some " "platforms and modules disabled at Python build are also listed. All module " @@ -2467,7 +2467,7 @@ msgid "" "modules are excluded." msgstr "" -#: ../../library/sys.rst:1905 +#: ../../library/sys.rst:1908 msgid "" "For packages, only the main package is listed: sub-packages and sub-modules " "are not listed. For example, the ``email`` package is listed, but the " @@ -2475,60 +2475,60 @@ msgid "" "listed." msgstr "" -#: ../../library/sys.rst:1910 +#: ../../library/sys.rst:1913 msgid "See also the :data:`sys.builtin_module_names` list." msgstr "另請參閱 :attr:`sys.builtin_module_names` 清單。" -#: ../../library/sys.rst:1917 +#: ../../library/sys.rst:1920 msgid "" "A :term:`named tuple` holding information about the thread implementation." msgstr "" -#: ../../library/sys.rst:1922 +#: ../../library/sys.rst:1925 msgid "The name of the thread implementation:" msgstr "" -#: ../../library/sys.rst:1924 +#: ../../library/sys.rst:1927 msgid "``\"nt\"``: Windows threads" msgstr "``\"nt\"``: Windows 執行緒" -#: ../../library/sys.rst:1925 +#: ../../library/sys.rst:1928 msgid "``\"pthread\"``: POSIX threads" msgstr "``\"pthread\"``: POSIX 執行緒" -#: ../../library/sys.rst:1926 +#: ../../library/sys.rst:1929 msgid "" "``\"pthread-stubs\"``: stub POSIX threads (on WebAssembly platforms without " "threading support)" msgstr "" -#: ../../library/sys.rst:1928 +#: ../../library/sys.rst:1931 msgid "``\"solaris\"``: Solaris threads" msgstr "" -#: ../../library/sys.rst:1932 +#: ../../library/sys.rst:1935 msgid "The name of the lock implementation:" msgstr "" -#: ../../library/sys.rst:1934 +#: ../../library/sys.rst:1937 msgid "``\"semaphore\"``: a lock uses a semaphore" msgstr "" -#: ../../library/sys.rst:1935 +#: ../../library/sys.rst:1938 msgid "``\"mutex+cond\"``: a lock uses a mutex and a condition variable" msgstr "" -#: ../../library/sys.rst:1936 +#: ../../library/sys.rst:1939 msgid "``None`` if this information is unknown" msgstr "為 ``None`` 表示此資訊未知" -#: ../../library/sys.rst:1940 +#: ../../library/sys.rst:1943 msgid "" "The name and version of the thread library. It is a string, or ``None`` if " "this information is unknown." msgstr "" -#: ../../library/sys.rst:1948 +#: ../../library/sys.rst:1951 msgid "" "When this variable is set to an integer value, it determines the maximum " "number of levels of traceback information printed when an unhandled " @@ -2537,73 +2537,73 @@ msgid "" "are printed." msgstr "" -#: ../../library/sys.rst:1956 +#: ../../library/sys.rst:1959 msgid "Handle an unraisable exception." msgstr "處理一個不可被引發的例外。" -#: ../../library/sys.rst:1958 +#: ../../library/sys.rst:1961 msgid "" "Called when an exception has occurred but there is no way for Python to " "handle it. For example, when a destructor raises an exception or during " "garbage collection (:func:`gc.collect`)." msgstr "" -#: ../../library/sys.rst:1962 +#: ../../library/sys.rst:1965 msgid "The *unraisable* argument has the following attributes:" msgstr "" -#: ../../library/sys.rst:1964 +#: ../../library/sys.rst:1967 msgid ":attr:`!exc_type`: Exception type." msgstr ":attr:`!exc_type`: 例外型別。" -#: ../../library/sys.rst:1965 +#: ../../library/sys.rst:1968 msgid ":attr:`!exc_value`: Exception value, can be ``None``." msgstr ":attr:`!exc_value`: 例外值,可以為 ``None``。" -#: ../../library/sys.rst:1966 +#: ../../library/sys.rst:1969 msgid ":attr:`!exc_traceback`: Exception traceback, can be ``None``." msgstr ":attr:`!exc_traceback`: 例外追蹤,可以為 ``None``。" -#: ../../library/sys.rst:1967 +#: ../../library/sys.rst:1970 msgid ":attr:`!err_msg`: Error message, can be ``None``." msgstr ":attr:`!err_msg`: 錯誤訊息,可以為 ``None``。" -#: ../../library/sys.rst:1968 +#: ../../library/sys.rst:1971 msgid ":attr:`!object`: Object causing the exception, can be ``None``." msgstr ":attr:`!object`: 導致例外的物件,可以為 ``None``。" -#: ../../library/sys.rst:1970 +#: ../../library/sys.rst:1973 msgid "" "The default hook formats :attr:`!err_msg` and :attr:`!object` as: " "``f'{err_msg}: {object!r}'``; use \"Exception ignored in\" error message if :" "attr:`!err_msg` is ``None``." msgstr "" -#: ../../library/sys.rst:1974 +#: ../../library/sys.rst:1977 msgid "" ":func:`sys.unraisablehook` can be overridden to control how unraisable " "exceptions are handled." msgstr "" -#: ../../library/sys.rst:1979 +#: ../../library/sys.rst:1982 msgid ":func:`excepthook` which handles uncaught exceptions." msgstr "處理未被捕捉到例外的 :func:`excepthook`。" -#: ../../library/sys.rst:1983 +#: ../../library/sys.rst:1986 msgid "" "Storing :attr:`!exc_value` using a custom hook can create a reference cycle. " "It should be cleared explicitly to break the reference cycle when the " "exception is no longer needed." msgstr "" -#: ../../library/sys.rst:1987 +#: ../../library/sys.rst:1990 msgid "" "Storing :attr:`!object` using a custom hook can resurrect it if it is set to " "an object which is being finalized. Avoid storing :attr:`!object` after the " "custom hook completes to avoid resurrecting objects." msgstr "" -#: ../../library/sys.rst:1991 ../../library/sys.rst:1993 +#: ../../library/sys.rst:1994 ../../library/sys.rst:1996 msgid "" "Raise an auditing event ``sys.unraisablehook`` with arguments *hook*, " "*unraisable* when an exception that cannot be handled occurs. The " @@ -2611,7 +2611,7 @@ msgid "" "hook has been set, *hook* may be ``None``." msgstr "" -#: ../../library/sys.rst:2002 +#: ../../library/sys.rst:2005 msgid "" "A string containing the version number of the Python interpreter plus " "additional information on the build number and compiler used. This string " @@ -2620,13 +2620,13 @@ msgid "" "functions provided by the :mod:`platform` module." msgstr "" -#: ../../library/sys.rst:2011 +#: ../../library/sys.rst:2014 msgid "" "The C API version for this interpreter. Programmers may find this useful " "when debugging version conflicts between Python and extension modules." msgstr "" -#: ../../library/sys.rst:2017 +#: ../../library/sys.rst:2020 msgid "" "A tuple containing the five components of the version number: *major*, " "*minor*, *micro*, *releaselevel*, and *serial*. All values except " @@ -2637,18 +2637,18 @@ msgid "" "version_info.major`` and so on." msgstr "" -#: ../../library/sys.rst:2025 +#: ../../library/sys.rst:2028 msgid "Added named component attributes." msgstr "新增了附名的元件屬性。" -#: ../../library/sys.rst:2030 +#: ../../library/sys.rst:2033 msgid "" "This is an implementation detail of the warnings framework; do not modify " "this value. Refer to the :mod:`warnings` module for more information on the " "warnings framework." msgstr "" -#: ../../library/sys.rst:2037 +#: ../../library/sys.rst:2040 msgid "" "The version number used to form registry keys on Windows platforms. This is " "stored as string resource 1000 in the Python DLL. The value is normally the " @@ -2657,20 +2657,20 @@ msgid "" "has no effect on the registry keys used by Python." msgstr "" -#: ../../library/sys.rst:2049 +#: ../../library/sys.rst:2052 msgid "" "Namespace containing functions and constants for register callbacks and " "controlling monitoring events. See :mod:`sys.monitoring` for details." msgstr "" -#: ../../library/sys.rst:2055 +#: ../../library/sys.rst:2058 msgid "" "A dictionary of the various implementation-specific flags passed through " "the :option:`-X` command-line option. Option names are either mapped to " "their values, if given explicitly, or to :const:`True`. Example:" msgstr "" -#: ../../library/sys.rst:2059 +#: ../../library/sys.rst:2062 msgid "" "$ ./python -Xa=b -Xc\n" "Python 3.2a3+ (py3k, Oct 16 2010, 20:14:50)\n" @@ -2690,18 +2690,18 @@ msgstr "" ">>> sys._xoptions\n" "{'a': 'b', 'c': True}" -#: ../../library/sys.rst:2071 +#: ../../library/sys.rst:2074 msgid "" "This is a CPython-specific way of accessing options passed through :option:`-" "X`. Other implementations may export them through other means, or not at " "all." msgstr "" -#: ../../library/sys.rst:2079 +#: ../../library/sys.rst:2082 msgid "Citations" msgstr "引用" -#: ../../library/sys.rst:2080 +#: ../../library/sys.rst:2083 msgid "" "ISO/IEC 9899:1999. \"Programming languages -- C.\" A public draft of this " "standard is available at https://www.open-std.org/jtc1/sc22/wg14/www/docs/" @@ -2722,50 +2722,50 @@ msgstr "object(物件)" msgid "traceback" msgstr "traceback" -#: ../../library/sys.rst:954 ../../library/sys.rst:1531 +#: ../../library/sys.rst:954 ../../library/sys.rst:1534 msgid "profile function" msgstr "" -#: ../../library/sys.rst:954 ../../library/sys.rst:1531 +#: ../../library/sys.rst:954 ../../library/sys.rst:1534 msgid "profiler" msgstr "" -#: ../../library/sys.rst:963 ../../library/sys.rst:1614 +#: ../../library/sys.rst:963 ../../library/sys.rst:1617 msgid "trace function" msgstr "" -#: ../../library/sys.rst:963 ../../library/sys.rst:1614 +#: ../../library/sys.rst:963 ../../library/sys.rst:1617 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/sys.rst:1359 +#: ../../library/sys.rst:1362 msgid "module" msgstr "module(模組)" -#: ../../library/sys.rst:1359 +#: ../../library/sys.rst:1362 msgid "search" msgstr "search(搜尋)" -#: ../../library/sys.rst:1359 +#: ../../library/sys.rst:1362 msgid "path" msgstr "path(路徑)" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1498 msgid "interpreter prompts" msgstr "interpreter prompts(直譯器提示)" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1498 msgid "prompts, interpreter" msgstr "prompts, interpreter(提示、直譯器)" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1498 msgid ">>>" msgstr ">>>" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1498 msgid "interpreter prompt" msgstr "interpreter prompt(直譯器提示)" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1498 msgid "..." msgstr "..." diff --git a/library/tempfile.po b/library/tempfile.po index ea21fbf628..7482bad18e 100644 --- a/library/tempfile.po +++ b/library/tempfile.po @@ -31,17 +31,18 @@ msgstr "**原始碼:**\\ :source:`Lib/tempfile.py`" #: ../../library/tempfile.rst:17 msgid "" "This module creates temporary files and directories. It works on all " -"supported platforms. :class:`TemporaryFile`, :class:`NamedTemporaryFile`, :" -"class:`TemporaryDirectory`, and :class:`SpooledTemporaryFile` are high-level " -"interfaces which provide automatic cleanup and can be used as :term:`context " -"managers `. :func:`mkstemp` and :func:`mkdtemp` are lower-" -"level functions which require manual cleanup." -msgstr "" -"該 module(模組)用於建立臨時檔案和目錄,它可以在所有有支援的平臺上使用。:" -"class:`TemporaryFile`、:class:`NamedTemporaryFile`、:class:" -"`TemporaryDirectory` 和 :class:`SpooledTemporaryFile` 是有自動清除功能的高階" -"介面,可作為\\ :term:`情境管理器 (context manager) ` 使用。:" -"func:`mkstemp` 和 :func:`mkdtemp` 是低階函式,使用完畢後需手動清理。" +"supported " +"platforms. :class:`TemporaryFile`, :class:`NamedTemporaryFile`, :class:`TemporaryDirectory`, " +"and :class:`SpooledTemporaryFile` are high-level interfaces which provide " +"automatic cleanup and can be used as :term:`context managers `. :func:`mkstemp` and :func:`mkdtemp` are lower-level functions " +"which require manual cleanup." +msgstr "" +"該 module(模組)用於建立臨時檔案和目錄,它可以在所有有支援的平臺上使" +"用。:class:`TemporaryFile`、:class:`NamedTemporaryFile`、:class:`TemporaryDirectory` " +"和 :class:`SpooledTemporaryFile` 是有自動清除功能的高階介面,可作為\\ :term:`" +"情境管理器 (context manager) ` 使用。:func:`mkstemp` " +"和 :func:`mkdtemp` 是低階函式,使用完畢後需手動清理。" #: ../../library/tempfile.rst:24 msgid "" @@ -82,13 +83,13 @@ msgstr "" #: ../../library/tempfile.rst:44 msgid "" -"The resulting object can be used as a :term:`context manager` (see :ref:" -"`tempfile-examples`). On completion of the context or destruction of the " -"file object the temporary file will be removed from the filesystem." +"The resulting object can be used as a :term:`context manager` " +"(see :ref:`tempfile-examples`). On completion of the context or destruction " +"of the file object the temporary file will be removed from the filesystem." msgstr "" -"生成的物件可以作為\\ :term:`情境管理器 `\\ 使用(參見 :ref:" -"`tempfile-examples`)。完成情境或銷毀臨時檔案物件後,臨時檔案將從檔案系統中刪" -"除。" +"生成的物件可以作為\\ :term:`情境管理器 `\\ 使用(參" +"見 :ref:`tempfile-examples`)。完成情境或銷毀臨時檔案物件後,臨時檔案將從檔案" +"系統中刪除。" #: ../../library/tempfile.rst:49 msgid "" @@ -171,8 +172,8 @@ msgid "" "with *delete* and *delete_on_close* parameters that determine whether and " "how the named file should be automatically deleted." msgstr "" -"為了管理指定檔案,它使用 *delete* 和 *delete_on_close* 參數擴充 :func:" -"`TemporaryFile` 來指定是否以及如何自動刪除指定檔案。" +"為了管理指定檔案,它使用 *delete* 和 *delete_on_close* 參數擴" +"充 :func:`TemporaryFile` 來指定是否以及如何自動刪除指定檔案。" #: ../../library/tempfile.rst:89 msgid "" @@ -202,8 +203,8 @@ msgstr "" "如果 *delete* 為 true(預設值)並且 *delete_on_close* 為 true(預設值),則檔" "案在關閉後會立即被刪除。如果 *delete* 為 true 並且 *delete_on_close* 為 " "false,則僅在情境管理器退出時刪除檔案,或者在\\ :term:`類檔案物件 `\\ 完結時刪除檔案。在這種情況下,並不總是保證能成功刪除(請參閱 :" -"meth:`object.__del__`\\ )。如果 *delete* 為 false,則會忽略 " +"object>`\\ 完結時刪除檔案。在這種情況下,並不總是保證能成功刪除(請參" +"閱 :meth:`object.__del__`\\ )。如果 *delete* 為 false,則會忽略 " "*delete_on_close* 的值。" #: ../../library/tempfile.rst:104 @@ -245,21 +246,21 @@ msgid "" "additional open shares delete access (e.g. by calling :func:`os.open` with " "the flag ``O_TEMPORARY``)" msgstr "" -"額外的 open 會共享刪除存取權限(例如,通過使用旗標 ``O_TEMPORARY`` 來呼叫 :" -"func:`os.open`\\ )" +"額外的 open 會共享刪除存取權限(例如,通過使用旗標 ``O_TEMPORARY`` 來呼" +"叫 :func:`os.open`\\ )" #: ../../library/tempfile.rst:121 msgid "" "*delete* is true but *delete_on_close* is false. Note, that in this case the " -"additional opens that do not share delete access (e.g. created via builtin :" -"func:`open`) must be closed before exiting the context manager, else the :" -"func:`os.unlink` call on context manager exit will fail with a :exc:" -"`PermissionError`." +"additional opens that do not share delete access (e.g. created via " +"builtin :func:`open`) must be closed before exiting the context manager, " +"else the :func:`os.unlink` call on context manager exit will fail with " +"a :exc:`PermissionError`." msgstr "" "*delete* 為 true 但 *delete_on_close* 為 false。請注意,在這種情況下不共享刪" "除存取權限的其他 open(例如透過內建的 :func:`open` 建立)必須在退出情境管理器" -"之前關閉,否則情境管理器上的 :func:`os.unlink` 呼叫退出將失敗並出現 :exc:" -"`PermissionError`。" +"之前關閉,否則情境管理器上的 :func:`os.unlink` 呼叫退出將失敗並出" +"現 :exc:`PermissionError`。" #: ../../library/tempfile.rst:127 msgid "" @@ -292,8 +293,8 @@ msgid "" "This class operates exactly as :func:`TemporaryFile` does, except that data " "is spooled in memory until the file size exceeds *max_size*, or until the " "file's :func:`~io.IOBase.fileno` method is called, at which point the " -"contents are written to disk and operation proceeds as with :func:" -"`TemporaryFile`." +"contents are written to disk and operation proceeds as " +"with :func:`TemporaryFile`." msgstr "" "此類別執行的操作與 :func:`TemporaryFile` 完全相同,但會將資料排存 (spool) 於" "在記憶體中,直到檔案大小超過 *max_size*,或檔案的 :func:`~io.IOBase.fileno` " @@ -316,10 +317,10 @@ msgid "" "depending on whether :meth:`rollover` has been called. This file-like " "object can be used in a :keyword:`with` statement, just like a normal file." msgstr "" -"回傳的物件是 file-like object,它的 :attr:`!_file` 屬性是 :class:`io." -"BytesIO` 或 :class:`io.TextIOWrapper` 物件(取決於指定的是二進位制模式還是文" -"字模式)或真實的檔案物件(取決於是否已呼叫 :meth:`rollover`)。file-like " -"object 可以像普通檔案一樣在 :keyword:`with` 陳述式中使用。" +"回傳的物件是 file-like object,它的 :attr:`!_file` 屬性" +"是 :class:`io.BytesIO` 或 :class:`io.TextIOWrapper` 物件(取決於指定的是二進" +"位制模式還是文字模式)或真實的檔案物件(取決於是否已呼叫 :meth:`rollover`)。" +"file-like object 可以像普通檔案一樣在 :keyword:`with` 陳述式中使用。" #: ../../library/tempfile.rst:166 msgid "the truncate method now accepts a *size* argument." @@ -336,8 +337,8 @@ msgstr "" #: ../../library/tempfile.rst:180 msgid "" -"This class securely creates a temporary directory using the same rules as :" -"func:`mkdtemp`. The resulting object can be used as a :term:`context " +"This class securely creates a temporary directory using the same rules " +"as :func:`mkdtemp`. The resulting object can be used as a :term:`context " "manager` (see :ref:`tempfile-examples`). On completion of the context or " "destruction of the temporary directory object, the newly created temporary " "directory and all its contents are removed from the filesystem." @@ -354,9 +355,9 @@ msgid "" "manager`, the :attr:`!name` will be assigned to the target of the :keyword:`!" "as` clause in the :keyword:`with` statement, if there is one." msgstr "" -"可以從回傳物件的 :attr:`!name` 屬性中找到的臨時目錄名稱。當回傳的物件用作\\ :" -"term:`情境管理器 `\\ 時,這個 :attr:`!name` 會作為 :keyword:" -"`with` 陳述句中 :keyword:`!as` 子句的目標(如果有 as 的話)。" +"可以從回傳物件的 :attr:`!name` 屬性中找到的臨時目錄名稱。當回傳的物件用作" +"\\ :term:`情境管理器 `\\ 時,這個 :attr:`!name` 會作" +"為 :keyword:`with` 陳述句中 :keyword:`!as` 子句的目標(如果有 as 的話)。" #: ../../library/tempfile.rst:195 msgid "" @@ -434,15 +435,15 @@ msgid "" "between the file name and the suffix; if you need one, put it at the " "beginning of *suffix*." msgstr "" -"如果 *suffix* 不是 ``None`` 則檔名將以該後綴結尾,若為 ``None`` 則沒有後綴。:" -"func:`mkstemp` 不會在檔名和後綴之間加點 (dot),如果需要加一個點號,請將其放" -"在 *suffix* 的開頭。" +"如果 *suffix* 不是 ``None`` 則檔名將以該後綴結尾,若為 ``None`` 則沒有後" +"綴。:func:`mkstemp` 不會在檔名和後綴之間加點 (dot),如果需要加一個點號,請將" +"其放在 *suffix* 的開頭。" #: ../../library/tempfile.rst:239 msgid "" "If *prefix* is not ``None``, the file name will begin with that prefix; " -"otherwise, a default prefix is used. The default is the return value of :" -"func:`gettempprefix` or :func:`gettempprefixb`, as appropriate." +"otherwise, a default prefix is used. The default is the return value " +"of :func:`gettempprefix` or :func:`gettempprefixb`, as appropriate." msgstr "" "如果 *prefix* 不是 ``None`` 則檔名將以該字首開頭,若為 ``None`` 則使用預設前" "綴。預設前綴是 :func:`gettempprefix` 或 :func:`gettempprefixb` 函式的回傳值" @@ -525,8 +526,8 @@ msgstr ":func:`mkdtemp` 的使用者用完臨時目錄後需要自行將其刪 #: ../../library/tempfile.rst:285 msgid "" -"The *prefix*, *suffix*, and *dir* arguments are the same as for :func:" -"`mkstemp`." +"The *prefix*, *suffix*, and *dir* arguments are the same as " +"for :func:`mkstemp`." msgstr "" "引數 *prefix*、*suffix* 和 *dir* 的含義與它們在 :func:`mkstemp` 中相同。" @@ -580,8 +581,8 @@ msgstr "" #: ../../library/tempfile.rst:325 msgid "" -"On all other platforms, the directories :file:`/tmp`, :file:`/var/tmp`, and :" -"file:`/usr/tmp`, in that order." +"On all other platforms, the directories :file:`/tmp`, :file:`/var/tmp`, " +"and :file:`/usr/tmp`, in that order." msgstr "" "在所有其他平臺上,目錄依次為 :file:`/tmp`、:file:`/var/tmp` 和 :file:`/usr/" "tmp`。" @@ -654,16 +655,16 @@ msgstr "" #: ../../library/tempfile.rst:375 msgid "" "Beware that if you set ``tempdir`` to a bytes value, there is a nasty side " -"effect: The global default return type of :func:`mkstemp` and :func:" -"`mkdtemp` changes to bytes when no explicit ``prefix``, ``suffix``, or " -"``dir`` arguments of type str are supplied. Please do not write code " -"expecting or depending on this. This awkward behavior is maintained for " -"compatibility with the historical implementation." +"effect: The global default return type of :func:`mkstemp` " +"and :func:`mkdtemp` changes to bytes when no explicit ``prefix``, " +"``suffix``, or ``dir`` arguments of type str are supplied. Please do not " +"write code expecting or depending on this. This awkward behavior is " +"maintained for compatibility with the historical implementation." msgstr "" -"請注意如果你將 ``tempdir`` 設為位元組串值,會有一個麻煩的副作用::func:" -"`mkstemp` 和 :func:`mkdtemp` 的全域性預設回傳型別會在沒有提供明顯字串型別的 " -"``prefix``、``suffix`` 或 ``dir`` 時被改為位元組串。請不要編寫預期此行為或依" -"賴於此行為的程式。這個奇怪的行為是為了維持與以往實作版本的相容性。" +"請注意如果你將 ``tempdir`` 設為位元組串值,會有一個麻煩的副作" +"用::func:`mkstemp` 和 :func:`mkdtemp` 的全域性預設回傳型別會在沒有提供明顯字" +"串型別的 ``prefix``、``suffix`` 或 ``dir`` 時被改為位元組串。請不要編寫預期此" +"行為或依賴於此行為的程式。這個奇怪的行為是為了維持與以往實作版本的相容性。" #: ../../library/tempfile.rst:386 msgid "Examples" @@ -715,6 +716,45 @@ msgid "" ">>>\n" "# directory and contents have been removed" msgstr "" +">>> import tempfile\n" +"\n" +"# 建立一個臨時檔案並寫入一些資料\n" +">>> fp = tempfile.TemporaryFile()\n" +">>> fp.write(b'Hello world!')\n" +"# read data from file\n" +">>> fp.seek(0)\n" +">>> fp.read()\n" +"b'Hello world!'\n" +"# 關閉檔案,檔案會被刪除\n" +">>> fp.close()\n" +"\n" +"# 使用情境管理器建立臨時檔案\n" +">>> with tempfile.TemporaryFile() as fp:\n" +"... fp.write(b'Hello world!')\n" +"... fp.seek(0)\n" +"... fp.read()\n" +"b'Hello world!'\n" +">>>\n" +"# 檔案現在已關閉並刪除\n" +"\n" +"# 使用情境管理器建立臨時檔案\n" +"# 關閉檔案,使用名稱再次開啟檔案\n" +">>> with tempfile.NamedTemporaryFile(delete_on_close=False) as fp:\n" +"... fp.write(b'Hello world!')\n" +"... fp.close()\n" +"... # 檔案已被關閉,但未被刪除\n" +"... # 透過其名稱再次開啟檔案\n" +"... with open(fp.name, mode='rb') as f:\n" +"... f.read()\n" +"b'Hello world!'\n" +">>>\n" +"# 現在檔案已被刪除\n" +"\n" +"# 使用情境管理器建立臨時目錄\n" +">>> with tempfile.TemporaryDirectory() as tmpdirname:\n" +"... print('created temporary directory', tmpdirname)\n" +">>>\n" +"# 目錄及其內容已被刪除" #: ../../library/tempfile.rst:433 msgid "Deprecated functions and variables" @@ -815,5 +855,5 @@ msgstr "file(檔案)" #~ "允許用檔名第二次開啟檔案,在各個平臺上是不同的(在 Unix 上可以;在 " #~ "Windows NT 版本以上不行)。如果 *delete* 為 true(預設值),則檔案會在關閉" #~ "後立即被刪除。該函式回傳的物件始終是 file-like object,它的 :attr:`!file` " -#~ "屬性是底層的真實檔案物件。file-like object 可以像普通檔案一樣在 :keyword:" -#~ "`with` 陳述句中使用。" +#~ "屬性是底層的真實檔案物件。file-like object 可以像普通檔案一樣" +#~ "在 :keyword:`with` 陳述句中使用。" diff --git a/library/time.po b/library/time.po index 52833ec856..f57d2f21c9 100644 --- a/library/time.po +++ b/library/time.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-19 00:15+0000\n" +"POT-Creation-Date: 2025-03-10 00:13+0000\n" "PO-Revision-Date: 2024-11-20 15:25+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -86,14 +86,13 @@ msgstr "" #: ../../library/time.rst:55 msgid "" -"UTC is Coordinated Universal Time (formerly known as Greenwich Mean Time, or " -"GMT). The acronym UTC is not a mistake but a compromise between English and " -"French." +"UTC is `Coordinated Universal Time`_ and superseded `Greenwich Mean Time`_ " +"or GMT as the basis of international timekeeping. The acronym UTC is not a " +"mistake but conforms to an earlier, language-agnostic naming scheme for time " +"standards such as UT0, UT1, and UT2." msgstr "" -"UTC 是 Coordinated Universal Time --- 世界協調時間(原稱為格林威治標準時間," -"或 GMT)。縮寫 UTC 並不是寫錯,而是英文和法文之間折衷的結果。" -#: ../../library/time.rst:61 +#: ../../library/time.rst:65 msgid "" "DST is Daylight Saving Time, an adjustment of the timezone by (usually) one " "hour during part of the year. DST rules are magic (determined by local law) " @@ -106,7 +105,7 @@ msgstr "" "含當地規則的表(通常會為了靈活性而從系統文件中讀取),在這方面是唯一的真正依" "據。" -#: ../../library/time.rst:67 +#: ../../library/time.rst:71 msgid "" "The precision of the various real-time functions may be less than suggested " "by the units in which their value or argument is expressed. E.g. on most " @@ -115,13 +114,13 @@ msgstr "" "各種即時 (real-time) 函式的精確度可能低於其值或引數所表示的單位所建議的精確" "度。例如,在大多數 Unix 系統上,時鐘每秒只「跳」50 次或 100 次。" -#: ../../library/time.rst:71 +#: ../../library/time.rst:75 msgid "" "On the other hand, the precision of :func:`.time` and :func:`sleep` is " "better than their Unix equivalents: times are expressed as floating-point " -"numbers, :func:`.time` returns the most accurate time available (using " -"Unix :c:func:`!gettimeofday` where available), and :func:`sleep` will accept " -"a time with a nonzero fraction (Unix :c:func:`!select` is used to implement " +"numbers, :func:`.time` returns the most accurate time available (using Unix :" +"c:func:`!gettimeofday` where available), and :func:`sleep` will accept a " +"time with a nonzero fraction (Unix :c:func:`!select` is used to implement " "this, where available)." msgstr "" "另一方面,:func:`.time` 和 :func:`sleep` 的精確度比它們的在 Unix 的等效函式更" @@ -129,104 +128,103 @@ msgstr "" "Unix 的 :c:func:`!gettimeofday`\\ ),而 :func:`sleep` 可以接受帶有非零分數的" "時間(如果可以會使用 Unix 的 :c:func:`!select` 來實作)。" -#: ../../library/time.rst:78 +#: ../../library/time.rst:82 msgid "" -"The time value as returned by :func:`gmtime`, :func:`localtime`, " -"and :func:`strptime`, and accepted by :func:`asctime`, :func:`mktime` " -"and :func:`strftime`, is a sequence of 9 integers. The return values " -"of :func:`gmtime`, :func:`localtime`, and :func:`strptime` also offer " -"attribute names for individual fields." +"The time value as returned by :func:`gmtime`, :func:`localtime`, and :func:" +"`strptime`, and accepted by :func:`asctime`, :func:`mktime` and :func:" +"`strftime`, is a sequence of 9 integers. The return values of :func:" +"`gmtime`, :func:`localtime`, and :func:`strptime` also offer attribute names " +"for individual fields." msgstr "" -"由 :func:`gmtime`、:func:`localtime` 和 :func:`strptime` 回傳,並" -"由 :func:`asctime`、:func:`mktime` 和 :func:`strftime` 接受的時間值,是一個 " -"9 個整數的序列。:func:`gmtime`、:func:`localtime` 和 :func:`strptime` 的回傳" -"值也為各個欄位提供屬性名稱。" +"由 :func:`gmtime`、:func:`localtime` 和 :func:`strptime` 回傳,並由 :func:" +"`asctime`、:func:`mktime` 和 :func:`strftime` 接受的時間值,是一個 9 個整數的" +"序列。:func:`gmtime`、:func:`localtime` 和 :func:`strptime` 的回傳值也為各個" +"欄位提供屬性名稱。" -#: ../../library/time.rst:84 +#: ../../library/time.rst:88 msgid "See :class:`struct_time` for a description of these objects." msgstr "關於這些物件的敘述請見 :class:`struct_time`。" -#: ../../library/time.rst:86 +#: ../../library/time.rst:90 msgid "" -"The :class:`struct_time` type was extended to provide " -"the :attr:`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` " -"attributes when platform supports corresponding ``struct tm`` members." +"The :class:`struct_time` type was extended to provide the :attr:" +"`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` attributes when " +"platform supports corresponding ``struct tm`` members." msgstr "" "當平台支援對應的 ``struct tm`` 成員時,:class:`struct_time` 型別被擴展以提" "供 :attr:`~struct_time.tm_gmtoff` 和 :attr:`~struct_time.tm_zone` 屬性。" -#: ../../library/time.rst:92 +#: ../../library/time.rst:96 msgid "" -"The :class:`struct_time` attributes :attr:`~struct_time.tm_gmtoff` " -"and :attr:`~struct_time.tm_zone` are now available on all platforms." +"The :class:`struct_time` attributes :attr:`~struct_time.tm_gmtoff` and :attr:" +"`~struct_time.tm_zone` are now available on all platforms." msgstr "" -":class:`struct_time` 的屬性 :attr:`~struct_time.tm_gmtoff` " -"和 :attr:`~struct_time.tm_zone` 現在在所有平台上都可用。" +":class:`struct_time` 的屬性 :attr:`~struct_time.tm_gmtoff` 和 :attr:" +"`~struct_time.tm_zone` 現在在所有平台上都可用。" -#: ../../library/time.rst:97 +#: ../../library/time.rst:101 msgid "Use the following functions to convert between time representations:" msgstr "使用以下函式在時間表示之間進行轉換:" -#: ../../library/time.rst:100 +#: ../../library/time.rst:104 msgid "From" msgstr "轉換來源" -#: ../../library/time.rst:100 +#: ../../library/time.rst:104 msgid "To" msgstr "轉換目標" -#: ../../library/time.rst:100 +#: ../../library/time.rst:104 msgid "Use" msgstr "使用" -#: ../../library/time.rst:29 ../../library/time.rst:102 -#: ../../library/time.rst:105 ../../library/time.rst:108 -#: ../../library/time.rst:111 +#: ../../library/time.rst:29 ../../library/time.rst:106 +#: ../../library/time.rst:109 ../../library/time.rst:112 +#: ../../library/time.rst:115 msgid "seconds since the epoch" msgstr "紀元秒數" -#: ../../library/time.rst:102 ../../library/time.rst:108 +#: ../../library/time.rst:106 ../../library/time.rst:112 msgid ":class:`struct_time` in UTC" msgstr "世界協調時間的 :class:`struct_time`" -#: ../../library/time.rst:102 +#: ../../library/time.rst:106 msgid ":func:`gmtime`" msgstr ":func:`gmtime`" -#: ../../library/time.rst:105 ../../library/time.rst:111 +#: ../../library/time.rst:109 ../../library/time.rst:115 msgid ":class:`struct_time` in local time" msgstr "本地時間的 :class:`struct_time`" -#: ../../library/time.rst:105 +#: ../../library/time.rst:109 msgid ":func:`localtime`" msgstr ":func:`localtime`" -#: ../../library/time.rst:108 +#: ../../library/time.rst:112 msgid ":func:`calendar.timegm`" msgstr ":func:`calendar.timegm`" -#: ../../library/time.rst:111 +#: ../../library/time.rst:115 msgid ":func:`mktime`" msgstr ":func:`mktime`" -#: ../../library/time.rst:119 +#: ../../library/time.rst:123 msgid "Functions" msgstr "函式" -#: ../../library/time.rst:123 +#: ../../library/time.rst:127 msgid "" -"Convert a tuple or :class:`struct_time` representing a time as returned " -"by :func:`gmtime` or :func:`localtime` to a string of the following form: " -"``'Sun Jun 20 23:21:05 1993'``. The day field is two characters long and is " -"space padded if the day is a single digit, e.g.: ``'Wed Jun 9 04:26:40 " -"1993'``." +"Convert a tuple or :class:`struct_time` representing a time as returned by :" +"func:`gmtime` or :func:`localtime` to a string of the following form: ``'Sun " +"Jun 20 23:21:05 1993'``. The day field is two characters long and is space " +"padded if the day is a single digit, e.g.: ``'Wed Jun 9 04:26:40 1993'``." msgstr "" "將由 :func:`gmtime` 或 :func:`localtime` 回傳的元組或 :class:`struct_time` 表" "示的時間轉換為以下格式的字串:``'Sun Jun 20 23:21:05 1993'``。日期欄位為兩個" "字元長,如果日期是個位數,則用空格填充,例如:``'Wed Jun 9 04:26:40 " "1993'``。" -#: ../../library/time.rst:129 +#: ../../library/time.rst:133 msgid "" "If *t* is not provided, the current time as returned by :func:`localtime` is " "used. Locale information is not used by :func:`asctime`." @@ -234,28 +232,28 @@ msgstr "" "如果沒有提供 *t*,則使用由 :func:`localtime` 回傳的當前時間。:func:`asctime` " "不使用區域資訊。" -#: ../../library/time.rst:134 +#: ../../library/time.rst:138 msgid "" "Unlike the C function of the same name, :func:`asctime` does not add a " "trailing newline." msgstr "與同名的 C 函式不同,:func:`asctime` 不會添加結尾的換行字元。" -#: ../../library/time.rst:139 +#: ../../library/time.rst:143 msgid "" "Return the *clk_id* of the thread-specific CPU-time clock for the specified " "*thread_id*." msgstr "為指定的 *thread_id* 回傳執行緒專用 CPU-time 時鐘的 *clk_id*。" -#: ../../library/time.rst:141 +#: ../../library/time.rst:145 msgid "" "Use :func:`threading.get_ident` or the :attr:`~threading.Thread.ident` " "attribute of :class:`threading.Thread` objects to get a suitable value for " "*thread_id*." msgstr "" -"使用 :func:`threading.get_ident` 或 :class:`threading.Thread` 物件" -"的 :attr:`~threading.Thread.ident` 屬性來獲取適用於 *thread_id* 的值。" +"使用 :func:`threading.get_ident` 或 :class:`threading.Thread` 物件的 :attr:" +"`~threading.Thread.ident` 屬性來獲取適用於 *thread_id* 的值。" -#: ../../library/time.rst:146 +#: ../../library/time.rst:150 msgid "" "Passing an invalid or expired *thread_id* may result in undefined behavior, " "such as segmentation fault." @@ -263,27 +261,27 @@ msgstr "" "傳遞無效或過期的 *thread_id* 可能會導致未定義的行為,例如分段錯誤 " "(segmentation fault)。" -#: ../../library/time.rst:149 ../../library/time.rst:161 -#: ../../library/time.rst:174 ../../library/time.rst:183 -#: ../../library/time.rst:196 ../../library/time.rst:205 -#: ../../library/time.rst:743 ../../library/time.rst:767 -#: ../../library/time.rst:863 ../../library/time.rst:874 -#: ../../library/time.rst:884 ../../library/time.rst:894 -#: ../../library/time.rst:903 ../../library/time.rst:912 -#: ../../library/time.rst:921 ../../library/time.rst:932 -#: ../../library/time.rst:940 ../../library/time.rst:951 -#: ../../library/time.rst:962 ../../library/time.rst:971 -#: ../../library/time.rst:984 +#: ../../library/time.rst:153 ../../library/time.rst:165 +#: ../../library/time.rst:178 ../../library/time.rst:187 +#: ../../library/time.rst:200 ../../library/time.rst:209 +#: ../../library/time.rst:747 ../../library/time.rst:771 +#: ../../library/time.rst:867 ../../library/time.rst:878 +#: ../../library/time.rst:888 ../../library/time.rst:898 +#: ../../library/time.rst:907 ../../library/time.rst:916 +#: ../../library/time.rst:925 ../../library/time.rst:936 +#: ../../library/time.rst:944 ../../library/time.rst:955 +#: ../../library/time.rst:966 ../../library/time.rst:975 +#: ../../library/time.rst:988 msgid "Availability" msgstr "" -#: ../../library/time.rst:151 +#: ../../library/time.rst:155 msgid "" "See the man page for :manpage:`pthread_getcpuclockid(3)` for further " "information." msgstr "若需更多資訊,請參閱 :manpage:`pthread_getcpuclockid(3)` 的說明文件。" -#: ../../library/time.rst:158 +#: ../../library/time.rst:162 msgid "" "Return the resolution (precision) of the specified clock *clk_id*. Refer " "to :ref:`time-clock-id-constants` for a list of accepted values for *clk_id*." @@ -291,46 +289,46 @@ msgstr "" "回傳指定時鐘 *clk_id* 的解析度(精確度)。有關 *clk_id* 可接受的值的串列,請" "參閱 :ref:`time-clock-id-constants`。" -#: ../../library/time.rst:168 +#: ../../library/time.rst:172 msgid "" "Return the time of the specified clock *clk_id*. Refer to :ref:`time-clock-" "id-constants` for a list of accepted values for *clk_id*." msgstr "" -"回傳指定時鐘 *clk_id* 的時間。有關 *clk_id* 可接受的值的串列,請參" -"閱 :ref:`time-clock-id-constants`。" +"回傳指定時鐘 *clk_id* 的時間。有關 *clk_id* 可接受的值的串列,請參閱 :ref:" +"`time-clock-id-constants`。" -#: ../../library/time.rst:171 +#: ../../library/time.rst:175 msgid "" -"Use :func:`clock_gettime_ns` to avoid the precision loss caused by " -"the :class:`float` type." +"Use :func:`clock_gettime_ns` to avoid the precision loss caused by the :" +"class:`float` type." msgstr "" "使用 :func:`clock_gettime_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:181 +#: ../../library/time.rst:185 msgid "Similar to :func:`clock_gettime` but return time as nanoseconds." msgstr "" "類似於 :func:`clock_gettime`,但回傳以奈秒 (nanoseconds) 為單位的時間。" -#: ../../library/time.rst:190 +#: ../../library/time.rst:194 msgid "" -"Set the time of the specified clock *clk_id*. " -"Currently, :data:`CLOCK_REALTIME` is the only accepted value for *clk_id*." +"Set the time of the specified clock *clk_id*. Currently, :data:" +"`CLOCK_REALTIME` is the only accepted value for *clk_id*." msgstr "" "設定指定時鐘 *clk_id* 的時間。目前,:data:`CLOCK_REALTIME` 是 *clk_id* 唯一可" "以接受的值。" -#: ../../library/time.rst:193 +#: ../../library/time.rst:197 msgid "" -"Use :func:`clock_settime_ns` to avoid the precision loss caused by " -"the :class:`float` type." +"Use :func:`clock_settime_ns` to avoid the precision loss caused by the :" +"class:`float` type." msgstr "" "使用 :func:`clock_settime_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:203 +#: ../../library/time.rst:207 msgid "Similar to :func:`clock_settime` but set time with nanoseconds." msgstr "類似於 :func:`clock_settime`,但設定以奈秒為單位的時間。" -#: ../../library/time.rst:212 +#: ../../library/time.rst:216 msgid "" "Convert a time expressed in seconds since the epoch_ to a string of a form: " "``'Sun Jun 20 23:21:05 1993'`` representing local time. The day field is two " @@ -341,18 +339,18 @@ msgstr "" "Jun 20 23:21:05 1993'``。日期欄位為兩個字元長,如果日期是個位數,則用空格填" "充,例如:``'Wed Jun 9 04:26:40 1993'``。" -#: ../../library/time.rst:217 +#: ../../library/time.rst:221 msgid "" -"If *secs* is not provided or :const:`None`, the current time as returned " -"by :func:`.time` is used. ``ctime(secs)`` is equivalent to " -"``asctime(localtime(secs))``. Locale information is not used " -"by :func:`ctime`." +"If *secs* is not provided or :const:`None`, the current time as returned by :" +"func:`.time` is used. ``ctime(secs)`` is equivalent to " +"``asctime(localtime(secs))``. Locale information is not used by :func:" +"`ctime`." msgstr "" "如果未提供 *secs* 或其為 :const:`None`,則使用由 :func:`.time` 回傳的當前時" "間。``ctime(secs)`` 等同於 ``asctime(localtime(secs))``。:func:`ctime` 不使用" "區域資訊。" -#: ../../library/time.rst:225 +#: ../../library/time.rst:229 msgid "" "Get information on the specified clock as a namespace object. Supported " "clock names and the corresponding functions to read their value are:" @@ -360,31 +358,31 @@ msgstr "" "獲取指定時鐘的資訊作為命名空間物件。支援的時鐘名稱及讀取他們的值的對應函式如" "下:" -#: ../../library/time.rst:229 +#: ../../library/time.rst:233 msgid "``'monotonic'``: :func:`time.monotonic`" msgstr "``'monotonic'``::func:`time.monotonic`" -#: ../../library/time.rst:230 +#: ../../library/time.rst:234 msgid "``'perf_counter'``: :func:`time.perf_counter`" msgstr "``'perf_counter'``::func:`time.perf_counter`" -#: ../../library/time.rst:231 +#: ../../library/time.rst:235 msgid "``'process_time'``: :func:`time.process_time`" msgstr "``'process_time'``::func:`time.process_time`" -#: ../../library/time.rst:232 +#: ../../library/time.rst:236 msgid "``'thread_time'``: :func:`time.thread_time`" msgstr "``'thread_time'``::func:`time.thread_time`" -#: ../../library/time.rst:233 +#: ../../library/time.rst:237 msgid "``'time'``: :func:`time.time`" msgstr "``'time'``::func:`time.time`" -#: ../../library/time.rst:235 +#: ../../library/time.rst:239 msgid "The result has the following attributes:" msgstr "其結果具有以下屬性:" -#: ../../library/time.rst:237 +#: ../../library/time.rst:241 msgid "" "*adjustable*: ``True`` if the clock can be changed automatically (e.g. by a " "NTP daemon) or manually by the system administrator, ``False`` otherwise" @@ -392,80 +390,80 @@ msgstr "" "*adjustable*: 如果時鐘可以自動(例如,透過 NTP 常駐程式)或由系統管理員手動更" "改,則為 ``True``,否則為 ``False``" -#: ../../library/time.rst:239 +#: ../../library/time.rst:243 msgid "" "*implementation*: The name of the underlying C function used to get the " "clock value. Refer to :ref:`time-clock-id-constants` for possible values." msgstr "" -"*implementation*: 用於獲取時鐘的值的底層 C 函式名稱。有關可能的值,請參" -"閱 :ref:`time-clock-id-constants`。" +"*implementation*: 用於獲取時鐘的值的底層 C 函式名稱。有關可能的值,請參閱 :" +"ref:`time-clock-id-constants`。" -#: ../../library/time.rst:241 +#: ../../library/time.rst:245 msgid "" "*monotonic*: ``True`` if the clock cannot go backward, ``False`` otherwise" msgstr "*monotonic*: 如果時鐘不能倒轉,則為 ``True``,否則為 ``False``" -#: ../../library/time.rst:243 +#: ../../library/time.rst:247 msgid "*resolution*: The resolution of the clock in seconds (:class:`float`)" msgstr "*resolution*: 以秒 (:class:`float`) 為單位的時鐘的解析度" -#: ../../library/time.rst:250 +#: ../../library/time.rst:254 msgid "" -"Convert a time expressed in seconds since the epoch_ to " -"a :class:`struct_time` in UTC in which the dst flag is always zero. If " -"*secs* is not provided or :const:`None`, the current time as returned " -"by :func:`.time` is used. Fractions of a second are ignored. See above for " -"a description of the :class:`struct_time` object. " -"See :func:`calendar.timegm` for the inverse of this function." +"Convert a time expressed in seconds since the epoch_ to a :class:" +"`struct_time` in UTC in which the dst flag is always zero. If *secs* is not " +"provided or :const:`None`, the current time as returned by :func:`.time` is " +"used. Fractions of a second are ignored. See above for a description of " +"the :class:`struct_time` object. See :func:`calendar.timegm` for the inverse " +"of this function." msgstr "" "將自 epoch_ 起以秒表示的時間轉換為 UTC 中的 :class:`struct_time`,其中 dst 旗" "標始終為零。如果未提供 *secs* 或其為 :const:`None`,則使用由 :func:`.time` 回" "傳的當前時間。忽略秒的分數部分。關於 :class:`struct_time` 物件的描述,請參閱" "上文。此函式的反運算請參閱 :func:`calendar.timegm`。" -#: ../../library/time.rst:260 +#: ../../library/time.rst:264 msgid "" "Like :func:`gmtime` but converts to local time. If *secs* is not provided " "or :const:`None`, the current time as returned by :func:`.time` is used. " "The dst flag is set to ``1`` when DST applies to the given time." msgstr "" -"類似於 :func:`gmtime`,但轉換為當地時間。如果未提供 *secs* 或其" -"為 :const:`None`,則使用由 :func:`.time` 回傳的當前時間。當 DST 適用於給定時" -"間時,dst 旗標會被設定為 ``1``。" +"類似於 :func:`gmtime`,但轉換為當地時間。如果未提供 *secs* 或其為 :const:" +"`None`,則使用由 :func:`.time` 回傳的當前時間。當 DST 適用於給定時間時,dst " +"旗標會被設定為 ``1``。" -#: ../../library/time.rst:264 +#: ../../library/time.rst:268 msgid "" ":func:`localtime` may raise :exc:`OverflowError`, if the timestamp is " "outside the range of values supported by the platform C :c:func:`localtime` " -"or :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` " -"or :c:func:`gmtime` failure. It's common for this to be restricted to years " +"or :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` or :" +"c:func:`gmtime` failure. It's common for this to be restricted to years " "between 1970 and 2038." msgstr "" "如果時間戳超出 C 平台的 :c:func:`localtime` 或 :c:func:`gmtime` 函式支援的範" -"圍,:func:`localtime` 可能會引發 :exc:`OverflowError`;" -"在 :c:func:`localtime` 或 :c:func:`gmtime` 失敗時,會引發 :exc:`OSError`。通" -"常會把年份限制在 1970 年到 2038 年之間。" +"圍,:func:`localtime` 可能會引發 :exc:`OverflowError`;在 :c:func:" +"`localtime` 或 :c:func:`gmtime` 失敗時,會引發 :exc:`OSError`。通常會把年份限" +"制在 1970 年到 2038 年之間。" -#: ../../library/time.rst:273 +#: ../../library/time.rst:277 msgid "" -"This is the inverse function of :func:`localtime`. Its argument is " -"the :class:`struct_time` or full 9-tuple (since the dst flag is needed; use " +"This is the inverse function of :func:`localtime`. Its argument is the :" +"class:`struct_time` or full 9-tuple (since the dst flag is needed; use " "``-1`` as the dst flag if it is unknown) which expresses the time in *local* " -"time, not UTC. It returns a floating-point number, for compatibility " -"with :func:`.time`. If the input value cannot be represented as a valid " -"time, either :exc:`OverflowError` or :exc:`ValueError` will be raised (which " +"time, not UTC. It returns a floating-point number, for compatibility with :" +"func:`.time`. If the input value cannot be represented as a valid time, " +"either :exc:`OverflowError` or :exc:`ValueError` will be raised (which " "depends on whether the invalid value is caught by Python or the underlying C " "libraries). The earliest date for which it can generate a time is platform-" "dependent." msgstr "" -"這是 :func:`localtime` 的反函式。其引數是表示\\ *當地*\\ 時間(不是 UTC)" -"的 :class:`struct_time` 或完整的 9 元組(因為需要 dst 旗標;如果 dst 為未知," -"則使用 ``-1`` 作為 dst 旗標)。它回傳一個浮點數,以與 :func:`.time` 相容。如" -"果輸入值不能表示為有效時間,將引發 :exc:`OverflowError` " -"或 :exc:`ValueError`\\ (取決於無效值是被 Python 還是底層 C 函式庫捕獲)。它" -"能生成時間的最早日期根據平台而有所不同。" +"這是 :func:`localtime` 的反函式。其引數是表示\\ *當地*\\ 時間(不是 UTC)的 :" +"class:`struct_time` 或完整的 9 元組(因為需要 dst 旗標;如果 dst 為未知,則使" +"用 ``-1`` 作為 dst 旗標)。它回傳一個浮點數,以與 :func:`.time` 相容。如果輸" +"入值不能表示為有效時間,將引發 :exc:`OverflowError` 或 :exc:`ValueError`\\ " +"(取決於無效值是被 Python 還是底層 C 函式庫捕獲)。它能生成時間的最早日期根據" +"平台而有所不同。" -#: ../../library/time.rst:285 +#: ../../library/time.rst:289 msgid "" "Return the value (in fractional seconds) of a monotonic clock, i.e. a clock " "that cannot go backwards. The clock is not affected by system clock " @@ -476,11 +474,11 @@ msgstr "" "示)。該時鐘不受系統時鐘更新的影響。回傳值的參考點沒有定義,因此只有兩次呼叫" "結果之間的差異才是有效的。" -#: ../../library/time.rst:290 ../../library/time.rst:709 +#: ../../library/time.rst:294 ../../library/time.rst:713 msgid "Clock:" msgstr "時鐘:" -#: ../../library/time.rst:292 +#: ../../library/time.rst:296 msgid "" "On Windows, call ``QueryPerformanceCounter()`` and " "``QueryPerformanceFrequency()``." @@ -488,42 +486,42 @@ msgstr "" "在 Windows 上,呼叫 ``QueryPerformanceCounter()`` 和 " "``QueryPerformanceFrequency()``。" -#: ../../library/time.rst:294 +#: ../../library/time.rst:298 msgid "On macOS, call ``mach_absolute_time()`` and ``mach_timebase_info()``." msgstr "" "在 macOS 上,呼叫 ``mach_absolute_time()`` 和 ``mach_timebase_info()``。" -#: ../../library/time.rst:295 +#: ../../library/time.rst:299 msgid "On HP-UX, call ``gethrtime()``." msgstr "在 HP-UX 上,呼叫 ``gethrtime()``。" -#: ../../library/time.rst:296 +#: ../../library/time.rst:300 msgid "Call ``clock_gettime(CLOCK_HIGHRES)`` if available." msgstr "如果可以的話,呼叫 ``clock_gettime(CLOCK_HIGHRES)``。" -#: ../../library/time.rst:297 +#: ../../library/time.rst:301 msgid "Otherwise, call ``clock_gettime(CLOCK_MONOTONIC)``." msgstr "否則,呼叫 ``clock_gettime(CLOCK_MONOTONIC)``。" -#: ../../library/time.rst:299 +#: ../../library/time.rst:303 msgid "" -"Use :func:`monotonic_ns` to avoid the precision loss caused by " -"the :class:`float` type." +"Use :func:`monotonic_ns` to avoid the precision loss caused by the :class:" +"`float` type." msgstr "使用 :func:`monotonic_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:304 +#: ../../library/time.rst:308 msgid "The function is now always available and always system-wide." msgstr "此函式現在始終可用且涵蓋整個系統。" -#: ../../library/time.rst:307 +#: ../../library/time.rst:311 msgid "On macOS, the function is now system-wide." msgstr "在 macOS 上,此函式現在涵蓋整個系統。" -#: ../../library/time.rst:313 +#: ../../library/time.rst:317 msgid "Similar to :func:`monotonic`, but return time as nanoseconds." msgstr "類似於 :func:`monotonic`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:322 +#: ../../library/time.rst:326 msgid "" "Return the value (in fractional seconds) of a performance counter, i.e. a " "clock with the highest available resolution to measure a short duration. It " @@ -535,7 +533,7 @@ msgstr "" "間隔的時鐘。它包括睡眠時經過的時間,並且涵蓋整個系統。回傳值的參考點沒有定" "義,因此只有兩次呼叫結果之間的差異才是有效的。" -#: ../../library/time.rst:330 +#: ../../library/time.rst:334 msgid "" "On CPython, use the same clock as :func:`time.monotonic` and is a monotonic " "clock, i.e. a clock that cannot go backwards." @@ -543,26 +541,26 @@ msgstr "" "在 CPython 上,使用與 :func:`time.monotonic` 相同的時鐘,且其為單調時鐘(即不" "能倒轉的時鐘)。" -#: ../../library/time.rst:333 +#: ../../library/time.rst:337 msgid "" -"Use :func:`perf_counter_ns` to avoid the precision loss caused by " -"the :class:`float` type." +"Use :func:`perf_counter_ns` to avoid the precision loss caused by the :class:" +"`float` type." msgstr "" "使用 :func:`perf_counter_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:338 +#: ../../library/time.rst:342 msgid "On Windows, the function is now system-wide." msgstr "在 Windows 上,此函式現在涵蓋整個系統。" -#: ../../library/time.rst:341 +#: ../../library/time.rst:345 msgid "Use the same clock as :func:`time.monotonic`." msgstr "使用與 :func:`time.monotonic` 相同的時鐘。" -#: ../../library/time.rst:347 +#: ../../library/time.rst:351 msgid "Similar to :func:`perf_counter`, but return time as nanoseconds." msgstr "類似於 :func:`perf_counter`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:359 +#: ../../library/time.rst:363 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current process. It does not include time elapsed during " @@ -574,18 +572,18 @@ msgstr "" "經過的時間。根據定義,它涵蓋整個行程。回傳值的參考點沒有定義,因此只有兩次呼" "叫結果之間的差異才是有效的。" -#: ../../library/time.rst:365 +#: ../../library/time.rst:369 msgid "" -"Use :func:`process_time_ns` to avoid the precision loss caused by " -"the :class:`float` type." +"Use :func:`process_time_ns` to avoid the precision loss caused by the :class:" +"`float` type." msgstr "" "使用 :func:`process_time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:372 +#: ../../library/time.rst:376 msgid "Similar to :func:`process_time` but return time as nanoseconds." msgstr "類似於 :func:`process_time`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:378 +#: ../../library/time.rst:382 msgid "" "Suspend execution of the calling thread for the given number of seconds. The " "argument may be a floating-point number to indicate a more precise sleep " @@ -594,7 +592,7 @@ msgstr "" "在一個給定的秒數內暫停呼叫執行緒 (calling thread) 的執行。引數可以是浮點數," "以表示更精確的睡眠時間。" -#: ../../library/time.rst:382 +#: ../../library/time.rst:386 msgid "" "If the sleep is interrupted by a signal and no exception is raised by the " "signal handler, the sleep is restarted with a recomputed timeout." @@ -602,17 +600,17 @@ msgstr "" "如果睡眠被訊號中斷且訊號處理器未引發例外,則睡眠將以重新計算過的逾時 " "(timeout) 重新開始。" -#: ../../library/time.rst:385 +#: ../../library/time.rst:389 msgid "" "The suspension time may be longer than requested by an arbitrary amount, " "because of the scheduling of other activity in the system." msgstr "由於系統中其他活動的調度,暫停時間可能會比請求的時間長任意的量。" -#: ../../library/time.rst:389 +#: ../../library/time.rst:393 msgid "Windows implementation" msgstr "Windows 實作" -#: ../../library/time.rst:390 +#: ../../library/time.rst:394 msgid "" "On Windows, if *secs* is zero, the thread relinquishes the remainder of its " "time slice to any other thread that is ready to run. If there are no other " @@ -628,34 +626,34 @@ msgstr "" "learn.microsoft.com/windows-hardware/drivers/kernel/high-resolution-" "timers>`_,其解析度為 100 奈秒。如果 *secs* 為零,則使用 ``Sleep(0)``。" -#: ../../library/time.rst:399 +#: ../../library/time.rst:403 msgid "Unix implementation" msgstr "Unix 實作" -#: ../../library/time.rst:400 +#: ../../library/time.rst:404 msgid "Use ``clock_nanosleep()`` if available (resolution: 1 nanosecond);" msgstr "如果可以,使用 ``clock_nanosleep()``\\ (解析度:1 奈秒);" -#: ../../library/time.rst:401 +#: ../../library/time.rst:405 msgid "Or use ``nanosleep()`` if available (resolution: 1 nanosecond);" msgstr "或者使用 ``nanosleep()``\\ (解析度:1 奈秒);" -#: ../../library/time.rst:402 +#: ../../library/time.rst:406 msgid "Or use ``select()`` (resolution: 1 microsecond)." msgstr "或使用 ``select()``\\ (解析度:1 微秒)。" -#: ../../library/time.rst:406 +#: ../../library/time.rst:410 msgid "" "To emulate a \"no-op\", use :keyword:`pass` instead of ``time.sleep(0)``." msgstr "" -#: ../../library/time.rst:408 +#: ../../library/time.rst:412 msgid "" "To voluntarily relinquish the CPU, specify a real-time :ref:`scheduling " "policy ` and use :func:`os.sched_yield` instead." msgstr "" -#: ../../library/time.rst:411 +#: ../../library/time.rst:415 msgid "" "Raises an :ref:`auditing event ` ``time.sleep`` with argument " "``secs``." @@ -663,7 +661,7 @@ msgstr "" "引發一個帶有引數 ``secs`` 的\\ :ref:`稽核事件 (auditing event) ` " "``time.sleep``。" -#: ../../library/time.rst:413 +#: ../../library/time.rst:417 msgid "" "The function now sleeps at least *secs* even if the sleep is interrupted by " "a signal, except if the signal handler raises an exception (see :pep:`475` " @@ -672,7 +670,7 @@ msgstr "" "即使睡眠被訊號中斷,此函式現在至少還是會睡眠 *secs*,除非訊號處理器引發例外" "(理由請參閱 :pep:`475`)。" -#: ../../library/time.rst:418 +#: ../../library/time.rst:422 msgid "" "On Unix, the ``clock_nanosleep()`` and ``nanosleep()`` functions are now " "used if available. On Windows, a waitable timer is now used." @@ -680,24 +678,24 @@ msgstr "" "在 Unix 上,如果可以的話現在會使用 ``clock_nanosleep()`` 和 ``nanosleep()`` " "函式。在 Windows 上,現在使用可等待的計時器。" -#: ../../library/time.rst:422 +#: ../../library/time.rst:426 msgid "Raises an auditing event." msgstr "引發一個稽核事件。" -#: ../../library/time.rst:430 +#: ../../library/time.rst:434 msgid "" -"Convert a tuple or :class:`struct_time` representing a time as returned " -"by :func:`gmtime` or :func:`localtime` to a string as specified by the " -"*format* argument. If *t* is not provided, the current time as returned " -"by :func:`localtime` is used. *format* must be a string. :exc:`ValueError` " -"is raised if any field in *t* is outside of the allowed range." +"Convert a tuple or :class:`struct_time` representing a time as returned by :" +"func:`gmtime` or :func:`localtime` to a string as specified by the *format* " +"argument. If *t* is not provided, the current time as returned by :func:" +"`localtime` is used. *format* must be a string. :exc:`ValueError` is " +"raised if any field in *t* is outside of the allowed range." msgstr "" -"將由 :func:`gmtime` 或 :func:`localtime` 回傳代表時間的一個元組" -"或 :class:`struct_time` 轉換為由 *format* 引數指定的字串。如果未提供 *t*,則" -"使用由 :func:`localtime` 回傳的當前時間。*format* 必須是一個字串。如果 *t* 中" -"的任何欄位超出允許範圍,將會引發 :exc:`ValueError`。" +"將由 :func:`gmtime` 或 :func:`localtime` 回傳代表時間的一個元組或 :class:" +"`struct_time` 轉換為由 *format* 引數指定的字串。如果未提供 *t*,則使用由 :" +"func:`localtime` 回傳的當前時間。*format* 必須是一個字串。如果 *t* 中的任何欄" +"位超出允許範圍,將會引發 :exc:`ValueError`。" -#: ../../library/time.rst:436 +#: ../../library/time.rst:440 msgid "" "0 is a legal argument for any position in the time tuple; if it is normally " "illegal the value is forced to a correct one." @@ -705,7 +703,7 @@ msgstr "" "0 在時間元組中的任何位置都是合法引數;如果元組中出現常見的錯誤,該值將被強制" "更改為正確的值。" -#: ../../library/time.rst:439 +#: ../../library/time.rst:443 msgid "" "The following directives can be embedded in the *format* string. They are " "shown without the optional field width and precision specification, and are " @@ -714,151 +712,151 @@ msgstr "" "以下指令可以嵌入在 *format* 字串中。它們顯示時不帶可選的欄位寬度和精度規範," "並在 :func:`strftime` 的結果中被標示的字元替換:" -#: ../../library/time.rst:444 +#: ../../library/time.rst:448 msgid "Directive" msgstr "指令" -#: ../../library/time.rst:444 +#: ../../library/time.rst:448 msgid "Meaning" msgstr "意義" -#: ../../library/time.rst:444 +#: ../../library/time.rst:448 msgid "Notes" msgstr "註解" -#: ../../library/time.rst:446 +#: ../../library/time.rst:450 msgid "``%a``" msgstr "``%a``" -#: ../../library/time.rst:446 +#: ../../library/time.rst:450 msgid "Locale's abbreviated weekday name." msgstr "區域設定的週間日 (weekday) 縮寫名稱。" -#: ../../library/time.rst:449 +#: ../../library/time.rst:453 msgid "``%A``" msgstr "``%A``" -#: ../../library/time.rst:449 +#: ../../library/time.rst:453 msgid "Locale's full weekday name." msgstr "區域設定的完整週間日名稱。" -#: ../../library/time.rst:451 +#: ../../library/time.rst:455 msgid "``%b``" msgstr "``%b``" -#: ../../library/time.rst:451 +#: ../../library/time.rst:455 msgid "Locale's abbreviated month name." msgstr "區域設定的縮寫月份名稱。" -#: ../../library/time.rst:454 +#: ../../library/time.rst:458 msgid "``%B``" msgstr "``%B``" -#: ../../library/time.rst:454 +#: ../../library/time.rst:458 msgid "Locale's full month name." msgstr "區域設定的完整月份名稱。" -#: ../../library/time.rst:456 +#: ../../library/time.rst:460 msgid "``%c``" msgstr "``%c``" -#: ../../library/time.rst:456 +#: ../../library/time.rst:460 msgid "Locale's appropriate date and time representation." msgstr "區域設定的合適的日期和時間的表示法。" -#: ../../library/time.rst:459 +#: ../../library/time.rst:463 msgid "``%d``" msgstr "``%d``" -#: ../../library/time.rst:459 +#: ../../library/time.rst:463 msgid "Day of the month as a decimal number [01,31]." msgstr "月份中的日期,表示為十進位數 [01,31]。" -#: ../../library/time.rst:462 +#: ../../library/time.rst:466 msgid "``%f``" msgstr "``%f``" -#: ../../library/time.rst:462 +#: ../../library/time.rst:466 msgid "Microseconds as a decimal number" msgstr "微秒,表示為十進位數" -#: ../../library/time.rst:463 +#: ../../library/time.rst:467 msgid "[000000,999999]." msgstr "[000000,999999]。" -#: ../../library/time.rst:462 +#: ../../library/time.rst:466 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/time.rst:466 +#: ../../library/time.rst:470 msgid "``%H``" msgstr "``%H``" -#: ../../library/time.rst:466 +#: ../../library/time.rst:470 msgid "Hour (24-hour clock) as a decimal number [00,23]." msgstr "小時(24 小時制),表示為十進位數 [00,23]。" -#: ../../library/time.rst:469 +#: ../../library/time.rst:473 msgid "``%I``" msgstr "``%I``" -#: ../../library/time.rst:469 +#: ../../library/time.rst:473 msgid "Hour (12-hour clock) as a decimal number [01,12]." msgstr "小時(12 小時制),表示為十進位數 [01,12]。" -#: ../../library/time.rst:472 +#: ../../library/time.rst:476 msgid "``%j``" msgstr "``%j``" -#: ../../library/time.rst:472 +#: ../../library/time.rst:476 msgid "Day of the year as a decimal number [001,366]." msgstr "一年中的第幾天,表示為十進位數 [001,366]。" -#: ../../library/time.rst:475 +#: ../../library/time.rst:479 msgid "``%m``" msgstr "``%m``" -#: ../../library/time.rst:475 +#: ../../library/time.rst:479 msgid "Month as a decimal number [01,12]." msgstr "月份,表示為十進位數 [01,12]。" -#: ../../library/time.rst:478 +#: ../../library/time.rst:482 msgid "``%M``" msgstr "``%M``" -#: ../../library/time.rst:478 +#: ../../library/time.rst:482 msgid "Minute as a decimal number [00,59]." msgstr "分鐘,表示為十進位數 [00,59]。" -#: ../../library/time.rst:481 +#: ../../library/time.rst:485 msgid "``%p``" msgstr "``%p``" -#: ../../library/time.rst:481 +#: ../../library/time.rst:485 msgid "Locale's equivalent of either AM or PM." msgstr "區域設定中相當於 AM 或 PM 的表示。" -#: ../../library/time.rst:481 +#: ../../library/time.rst:485 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/time.rst:484 +#: ../../library/time.rst:488 msgid "``%S``" msgstr "``%S``" -#: ../../library/time.rst:484 +#: ../../library/time.rst:488 msgid "Second as a decimal number [00,61]." msgstr "秒,表示為十進位數 [00,61]。" -#: ../../library/time.rst:484 +#: ../../library/time.rst:488 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/time.rst:487 +#: ../../library/time.rst:491 msgid "``%U``" msgstr "``%U``" -#: ../../library/time.rst:487 +#: ../../library/time.rst:491 msgid "" "Week number of the year (Sunday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Sunday are " @@ -867,31 +865,31 @@ msgstr "" "一年中的週數(星期天作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期天之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:487 ../../library/time.rst:501 +#: ../../library/time.rst:491 ../../library/time.rst:505 msgid "\\(4)" msgstr "\\(4)" -#: ../../library/time.rst:495 +#: ../../library/time.rst:499 msgid "``%u``" msgstr "``%u``" -#: ../../library/time.rst:495 +#: ../../library/time.rst:499 msgid "Day of the week (Monday is 1; Sunday is 7) as a decimal number [1, 7]." msgstr "一週中的日期(周一為 1;週日為 7),表示為十進位數 [1,7]。" -#: ../../library/time.rst:498 +#: ../../library/time.rst:502 msgid "``%w``" msgstr "``%w``" -#: ../../library/time.rst:498 +#: ../../library/time.rst:502 msgid "Weekday as a decimal number [0(Sunday),6]." msgstr "週間日,表示為十進位數 [0(星期天),6]。" -#: ../../library/time.rst:501 +#: ../../library/time.rst:505 msgid "``%W``" msgstr "``%W``" -#: ../../library/time.rst:501 +#: ../../library/time.rst:505 msgid "" "Week number of the year (Monday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Monday are " @@ -900,43 +898,43 @@ msgstr "" "一年中的週數(星期一作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期一之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:509 +#: ../../library/time.rst:513 msgid "``%x``" msgstr "``%x``" -#: ../../library/time.rst:509 +#: ../../library/time.rst:513 msgid "Locale's appropriate date representation." msgstr "區域設定的合適的日期表示法。" -#: ../../library/time.rst:512 +#: ../../library/time.rst:516 msgid "``%X``" msgstr "``%X``" -#: ../../library/time.rst:512 +#: ../../library/time.rst:516 msgid "Locale's appropriate time representation." msgstr "區域設定的合適的時間表示法。" -#: ../../library/time.rst:515 +#: ../../library/time.rst:519 msgid "``%y``" msgstr "``%y``" -#: ../../library/time.rst:515 +#: ../../library/time.rst:519 msgid "Year without century as a decimal number [00,99]." msgstr "去掉世紀的年份,表示為十進位數 [00,99]。" -#: ../../library/time.rst:518 +#: ../../library/time.rst:522 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/time.rst:518 +#: ../../library/time.rst:522 msgid "Year with century as a decimal number." msgstr "帶世紀的年份,表示為十進位數。" -#: ../../library/time.rst:521 +#: ../../library/time.rst:525 msgid "``%z``" msgstr "``%z``" -#: ../../library/time.rst:521 +#: ../../library/time.rst:525 msgid "" "Time zone offset indicating a positive or negative time difference from UTC/" "GMT of the form +HHMM or -HHMM, where H represents decimal hour digits and M " @@ -945,19 +943,19 @@ msgstr "" "時區偏移量,表示與 UTC/GMT 的正或負時間差,形式為 +HHMM 或 -HHMM,其中 H 代表" "十進位的小時數碼 (digits),M 代表十進位的分鐘數碼 [-23:59, +23:59]。 [1]_" -#: ../../library/time.rst:527 +#: ../../library/time.rst:531 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/time.rst:527 +#: ../../library/time.rst:531 msgid "Time zone name (no characters if no time zone exists). Deprecated. [1]_" msgstr "時區名稱(如果不存在時區,則無字元)。已被棄用。 [1]_" -#: ../../library/time.rst:530 +#: ../../library/time.rst:534 msgid "``%G``" msgstr "``%G``" -#: ../../library/time.rst:530 +#: ../../library/time.rst:534 msgid "" "ISO 8601 year (similar to ``%Y`` but follows the rules for the ISO 8601 " "calendar year). The year starts with the week that contains the first " @@ -966,11 +964,11 @@ msgstr "" "ISO 8601 年(類似於 ``%Y``,但遵循 ISO 8601 日曆年的規則)。年份從包含該日曆" "年第一個星期四的那一週開始。" -#: ../../library/time.rst:535 +#: ../../library/time.rst:539 msgid "``%V``" msgstr "``%V``" -#: ../../library/time.rst:535 +#: ../../library/time.rst:539 msgid "" "ISO 8601 week number (as a decimal number [01,53]). The first week of the " "year is the one that contains the first Thursday of the year. Weeks start on " @@ -979,30 +977,30 @@ msgstr "" "ISO 8601 週數(以十進位數表示 [01,53])。年份的第一週是包含該年第一個星期四的" "那一週。每週從星期一開始。" -#: ../../library/time.rst:540 +#: ../../library/time.rst:544 msgid "``%%``" msgstr "``%%``" -#: ../../library/time.rst:540 +#: ../../library/time.rst:544 msgid "A literal ``'%'`` character." msgstr "字面意義上的 ``'%'`` 字元。" -#: ../../library/time.rst:543 +#: ../../library/time.rst:547 msgid "Notes:" msgstr "註解:" -#: ../../library/time.rst:546 +#: ../../library/time.rst:550 msgid "" -"The ``%f`` format directive only applies to :func:`strptime`, not " -"to :func:`strftime`. However, see also :meth:`datetime.datetime.strptime` " -"and :meth:`datetime.datetime.strftime` where the ``%f`` format " -"directive :ref:`applies to microseconds `." +"The ``%f`` format directive only applies to :func:`strptime`, not to :func:" +"`strftime`. However, see also :meth:`datetime.datetime.strptime` and :meth:" +"`datetime.datetime.strftime` where the ``%f`` format directive :ref:`applies " +"to microseconds `." msgstr "" "``%f`` 格式的指令僅適用於 :func:`strptime`,不適用於 :func:`strftime`。然而," "在 :meth:`datetime.datetime.strptime` 和 :meth:`datetime.datetime.strftime` " "其中的 ``%f`` 格式的指令\\ :ref:`適用於微秒 `。" -#: ../../library/time.rst:552 +#: ../../library/time.rst:556 msgid "" "When used with the :func:`strptime` function, the ``%p`` directive only " "affects the output hour field if the ``%I`` directive is used to parse the " @@ -1011,7 +1009,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%p`` 指令僅在使用 ``%I`` 指令剖析小時" "時影響輸出小時的欄位。" -#: ../../library/time.rst:558 +#: ../../library/time.rst:562 msgid "" "The range really is ``0`` to ``61``; value ``60`` is valid in timestamps " "representing `leap seconds`_ and value ``61`` is supported for historical " @@ -1020,7 +1018,7 @@ msgstr "" "範圍確實是從 ``0`` 到 ``61``;數值 ``60`` 在表示 `leap seconds`_ 的時間戳中是" "有效的,而數值 ``61`` 是出於歷史因素而被支援。" -#: ../../library/time.rst:563 +#: ../../library/time.rst:567 msgid "" "When used with the :func:`strptime` function, ``%U`` and ``%W`` are only " "used in calculations when the day of the week and the year are specified." @@ -1028,7 +1026,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%U`` 和 ``%W`` 僅在指定週間的某天和年" "份時用於計算中。" -#: ../../library/time.rst:566 +#: ../../library/time.rst:570 msgid "" "Here is an example, a format for dates compatible with that specified in " "the :rfc:`2822` Internet email standard. [1]_ ::" @@ -1036,7 +1034,7 @@ msgstr "" "以下是一個範例,其為一種與 :rfc:`2822` 網際網路電子郵件標準中指定的日期格式兼" "容的格式。 [1]_: ::" -#: ../../library/time.rst:569 +#: ../../library/time.rst:573 msgid "" ">>> from time import gmtime, strftime\n" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" @@ -1046,17 +1044,17 @@ msgstr "" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" "'Thu, 28 Jun 2001 14:17:15 +0000'" -#: ../../library/time.rst:573 +#: ../../library/time.rst:577 msgid "" "Additional directives may be supported on certain platforms, but only the " "ones listed here have a meaning standardized by ANSI C. To see the full set " -"of format codes supported on your platform, consult " -"the :manpage:`strftime(3)` documentation." +"of format codes supported on your platform, consult the :manpage:" +"`strftime(3)` documentation." msgstr "" "某些平台可能支援額外的指令,但只有這裡列出的指令具有 ANSI C 標準化的意義。要" "查看你的平台上支援的完整格式碼集,請參閱 :manpage:`strftime(3)` 文件。" -#: ../../library/time.rst:578 +#: ../../library/time.rst:582 msgid "" "On some platforms, an optional field width and precision specification can " "immediately follow the initial ``'%'`` of a directive in the following " @@ -1066,23 +1064,23 @@ msgstr "" "在某些平台上,可選的欄位寬度和精度規範可以以此順序緊跟在指令初始的 ``'%'`` 之" "後;這也是不可攜 (portable) 的。欄位寬度通常為 2,除了 ``%j`` 為 3。" -#: ../../library/time.rst:589 +#: ../../library/time.rst:593 msgid "" "Parse a string representing a time according to a format. The return value " "is a :class:`struct_time` as returned by :func:`gmtime` or :func:`localtime`." msgstr "" -"根據格式剖析表示時間的字串。回傳值是 :class:`struct_time`,如同" -"由 :func:`gmtime` 或 :func:`localtime` 回傳的一樣。" +"根據格式剖析表示時間的字串。回傳值是 :class:`struct_time`,如同由 :func:" +"`gmtime` 或 :func:`localtime` 回傳的一樣。" -#: ../../library/time.rst:593 +#: ../../library/time.rst:597 msgid "" -"The *format* parameter uses the same directives as those used " -"by :func:`strftime`; it defaults to ``\"%a %b %d %H:%M:%S %Y\"`` which " -"matches the formatting returned by :func:`ctime`. If *string* cannot be " -"parsed according to *format*, or if it has excess data after " -"parsing, :exc:`ValueError` is raised. The default values used to fill in any " -"missing data when more accurate values cannot be inferred are ``(1900, 1, 1, " -"0, 0, 0, 0, 1, -1)``. Both *string* and *format* must be strings." +"The *format* parameter uses the same directives as those used by :func:" +"`strftime`; it defaults to ``\"%a %b %d %H:%M:%S %Y\"`` which matches the " +"formatting returned by :func:`ctime`. If *string* cannot be parsed according " +"to *format*, or if it has excess data after parsing, :exc:`ValueError` is " +"raised. The default values used to fill in any missing data when more " +"accurate values cannot be inferred are ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``. " +"Both *string* and *format* must be strings." msgstr "" "*format* 參數使用與 :func:`strftime` 相同的指令;預設為 ``\"%a %b %d %H:%M:" "%S %Y\"``,與 :func:`ctime` 回傳的格式匹配。如果 *string* 無法根據 *format* " @@ -1090,11 +1088,11 @@ msgstr "" "時,用來填充任何缺失資料的預設值為 ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``。" "*string* 和 *format* 都必須是字串。" -#: ../../library/time.rst:601 +#: ../../library/time.rst:605 msgid "For example:" msgstr "例如:" -#: ../../library/time.rst:608 +#: ../../library/time.rst:612 msgid "" "Support for the ``%Z`` directive is based on the values contained in " "``tzname`` and whether ``daylight`` is true. Because of this, it is " @@ -1105,7 +1103,7 @@ msgstr "" "因此,除了識別始終已知的 UTC 和 GMT(且被考慮為非日光節約時區)外,這是特定於" "平台的。" -#: ../../library/time.rst:613 +#: ../../library/time.rst:617 msgid "" "Only the directives specified in the documentation are supported. Because " "``strftime()`` is implemented per platform it can sometimes offer more " @@ -1117,121 +1115,121 @@ msgstr "" "提供比列出的還要更多的指令。但是 ``strptime()`` 與任何平台無關,因此不一定支" "援所有未記載為支援的指令。" -#: ../../library/time.rst:622 +#: ../../library/time.rst:626 msgid "" -"The type of the time value sequence returned " -"by :func:`gmtime`, :func:`localtime`, and :func:`strptime`. It is an object " -"with a :term:`named tuple` interface: values can be accessed by index and by " -"attribute name. The following values are present:" +"The type of the time value sequence returned by :func:`gmtime`, :func:" +"`localtime`, and :func:`strptime`. It is an object with a :term:`named " +"tuple` interface: values can be accessed by index and by attribute name. " +"The following values are present:" msgstr "" "由 :func:`gmtime`、:func:`localtime` 和 :func:`strptime` 回傳的時間值序列的型" "別。它是一個具有 :term:`named tuple` 介面的物件:值可以通過索引和屬性名稱存" "取。包含以下值:" -#: ../../library/time.rst:629 +#: ../../library/time.rst:633 msgid "Index" msgstr "索引" -#: ../../library/time.rst:630 +#: ../../library/time.rst:634 msgid "Attribute" msgstr "屬性" -#: ../../library/time.rst:631 +#: ../../library/time.rst:635 msgid "Values" msgstr "值" -#: ../../library/time.rst:633 +#: ../../library/time.rst:637 msgid "0" msgstr "0" -#: ../../library/time.rst:635 +#: ../../library/time.rst:639 msgid "(for example, 1993)" msgstr "(例如 1993)" -#: ../../library/time.rst:637 +#: ../../library/time.rst:641 msgid "1" msgstr "1" -#: ../../library/time.rst:639 +#: ../../library/time.rst:643 msgid "range [1, 12]" msgstr "範圍 [1, 12]" -#: ../../library/time.rst:641 +#: ../../library/time.rst:645 msgid "2" msgstr "2" -#: ../../library/time.rst:643 +#: ../../library/time.rst:647 msgid "range [1, 31]" msgstr "範圍 [1, 31]" -#: ../../library/time.rst:645 +#: ../../library/time.rst:649 msgid "3" msgstr "3" -#: ../../library/time.rst:647 +#: ../../library/time.rst:651 msgid "range [0, 23]" msgstr "範圍 [0, 23]" -#: ../../library/time.rst:649 +#: ../../library/time.rst:653 msgid "4" msgstr "4" -#: ../../library/time.rst:651 +#: ../../library/time.rst:655 msgid "range [0, 59]" msgstr "範圍 [0, 59]" -#: ../../library/time.rst:653 +#: ../../library/time.rst:657 msgid "5" msgstr "5" -#: ../../library/time.rst:655 +#: ../../library/time.rst:659 msgid "range [0, 61]; see :ref:`Note (2) ` in :func:`strftime`" msgstr "" "範圍 [0, 61];參見 :func:`strftime` 中的\\ :ref:`註釋 (2) `" -#: ../../library/time.rst:657 +#: ../../library/time.rst:661 msgid "6" msgstr "6" -#: ../../library/time.rst:659 +#: ../../library/time.rst:663 msgid "range [0, 6]; Monday is 0" msgstr "範圍 [0, 6];星期一是 0" -#: ../../library/time.rst:661 +#: ../../library/time.rst:665 msgid "7" msgstr "7" -#: ../../library/time.rst:663 +#: ../../library/time.rst:667 msgid "range [1, 366]" msgstr "範圍 [1, 366]" -#: ../../library/time.rst:665 +#: ../../library/time.rst:669 msgid "8" msgstr "8" -#: ../../library/time.rst:667 +#: ../../library/time.rst:671 msgid "0, 1 or -1; see below" msgstr "0、1 或 -1;見下文" -#: ../../library/time.rst:669 ../../library/time.rst:673 +#: ../../library/time.rst:673 ../../library/time.rst:677 msgid "N/A" msgstr "N/A" -#: ../../library/time.rst:671 +#: ../../library/time.rst:675 msgid "abbreviation of timezone name" msgstr "時區名稱的縮寫" -#: ../../library/time.rst:675 +#: ../../library/time.rst:679 msgid "offset east of UTC in seconds" msgstr "UTC 向東的偏移量(以秒為單位)" -#: ../../library/time.rst:677 +#: ../../library/time.rst:681 msgid "" "Note that unlike the C structure, the month value is a range of [1, 12], not " "[0, 11]." msgstr "請注意,與 C 結構不同,月份值的範圍是 [1, 12],而不是 [0, 11]。" -#: ../../library/time.rst:680 +#: ../../library/time.rst:684 msgid "" "In calls to :func:`mktime`, :attr:`tm_isdst` may be set to 1 when daylight " "savings time is in effect, and 0 when it is not. A value of -1 indicates " @@ -1241,28 +1239,28 @@ msgstr "" "在呼叫 :func:`mktime` 時,當日光節約時間生效的時候,:attr:`tm_isdst` 可以設定" "為 1,不生效時設定為 0。值 -1 表示未知是否生效,通常結果會填入正確的狀態。" -#: ../../library/time.rst:684 +#: ../../library/time.rst:688 msgid "" -"When a tuple with an incorrect length is passed to a function expecting " -"a :class:`struct_time`, or having elements of the wrong type, " -"a :exc:`TypeError` is raised." +"When a tuple with an incorrect length is passed to a function expecting a :" +"class:`struct_time`, or having elements of the wrong type, a :exc:" +"`TypeError` is raised." msgstr "" "當一個長度不正確的元組被傳遞給預期得到 :class:`struct_time` 的函式時,或者其" "中有元素型別錯誤時,將引發 :exc:`TypeError`。" -#: ../../library/time.rst:690 +#: ../../library/time.rst:694 msgid "" "Return the time in seconds since the epoch_ as a floating-point number. The " "handling of `leap seconds`_ is platform dependent. On Windows and most Unix " "systems, the leap seconds are not counted towards the time in seconds since " -"the epoch_. This is commonly referred to as `Unix time `_." +"the epoch_. This is commonly referred to as `Unix time `_." msgstr "" "回傳自 epoch_ 起的時間(秒)至今的浮點數。對 `leap seconds`_ 的處理是與平台有" "關的。在 Windows 和大多數 Unix 系統上,閏秒不計入自 epoch_ 起的秒數中。這通常" "被稱為 `Unix 時間 `_。" -#: ../../library/time.rst:696 +#: ../../library/time.rst:700 msgid "" "Note that even though the time is always returned as a floating-point " "number, not all systems provide time with a better precision than 1 second. " @@ -1274,45 +1272,45 @@ msgstr "" "間。雖然此函式通常回傳非遞減的值,但如果在兩次呼叫之間系統時鐘被回調,則它可" "能回傳比之前呼叫更小的值。" -#: ../../library/time.rst:702 +#: ../../library/time.rst:706 msgid "" "The number returned by :func:`.time` may be converted into a more common " -"time format (i.e. year, month, day, hour, etc...) in UTC by passing it " -"to :func:`gmtime` function or in local time by passing it to " -"the :func:`localtime` function. In both cases a :class:`struct_time` object " -"is returned, from which the components of the calendar date may be accessed " -"as attributes." +"time format (i.e. year, month, day, hour, etc...) in UTC by passing it to :" +"func:`gmtime` function or in local time by passing it to the :func:" +"`localtime` function. In both cases a :class:`struct_time` object is " +"returned, from which the components of the calendar date may be accessed as " +"attributes." msgstr "" "由 :func:`.time` 回傳的數字可以通過傳遞給 :func:`gmtime` 函式轉換為 UTC 內更" "常見的時間格式(即年、月、日、小時等)或通過傳遞給 :func:`localtime` 函式轉換" "為當地時間。在這兩種情況下都會回傳一個 :class:`struct_time` 物件,從中可以作" "為屬性存取日曆日期的組成部分。" -#: ../../library/time.rst:711 +#: ../../library/time.rst:715 msgid "On Windows, call ``GetSystemTimeAsFileTime()``." msgstr "在 Windows 上,呼叫 ``GetSystemTimeAsFileTime()``。" -#: ../../library/time.rst:712 +#: ../../library/time.rst:716 msgid "Call ``clock_gettime(CLOCK_REALTIME)`` if available." msgstr "如果可以的話,呼叫 ``clock_gettime(CLOCK_REALTIME)``。" -#: ../../library/time.rst:713 +#: ../../library/time.rst:717 msgid "Otherwise, call ``gettimeofday()``." msgstr "否則,呼叫 ``gettimeofday()``。" -#: ../../library/time.rst:715 +#: ../../library/time.rst:719 msgid "" "Use :func:`time_ns` to avoid the precision loss caused by the :class:`float` " "type." msgstr "使用 :func:`time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:721 +#: ../../library/time.rst:725 msgid "" "Similar to :func:`~time.time` but returns time as an integer number of " "nanoseconds since the epoch_." msgstr "類似於 :func:`~time.time`,但回傳自 epoch_ 起的以奈秒為單位的整數。" -#: ../../library/time.rst:734 +#: ../../library/time.rst:738 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current thread. It does not include time elapsed during " @@ -1324,22 +1322,22 @@ msgstr "" "期間經過的時間。根據定義,這是執行緒特定 (thread-specific) 的。回傳值的參照點" "未定義,因此只有同一執行緒中兩次呼叫結果之間的差異才是有效的。" -#: ../../library/time.rst:740 +#: ../../library/time.rst:744 msgid "" -"Use :func:`thread_time_ns` to avoid the precision loss caused by " -"the :class:`float` type." +"Use :func:`thread_time_ns` to avoid the precision loss caused by the :class:" +"`float` type." msgstr "" "使用 :func:`thread_time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:745 +#: ../../library/time.rst:749 msgid "Unix systems supporting ``CLOCK_THREAD_CPUTIME_ID``." msgstr "有支援 ``CLOCK_THREAD_CPUTIME_ID`` 的 Unix 系統。" -#: ../../library/time.rst:752 +#: ../../library/time.rst:756 msgid "Similar to :func:`thread_time` but return time as nanoseconds." msgstr "類似於 :func:`thread_time`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:759 +#: ../../library/time.rst:763 msgid "" "Reset the time conversion rules used by the library routines. The " "environment variable :envvar:`TZ` specifies how this is done. It will also " @@ -1356,51 +1354,51 @@ msgstr "" "``daylight``\\ (如果該時區沒有日光節約時間規則,則設定為 0;如果在過去、現在" "或未來的某個時間有日光節約時間規則,則設置為非零的值)。" -#: ../../library/time.rst:771 +#: ../../library/time.rst:775 msgid "" "Although in many cases, changing the :envvar:`TZ` environment variable may " -"affect the output of functions like :func:`localtime` without " -"calling :func:`tzset`, this behavior should not be relied on." +"affect the output of functions like :func:`localtime` without calling :func:" +"`tzset`, this behavior should not be relied on." msgstr "" "雖然在許多情況下,更改 :envvar:`TZ` 環境變數可能會在沒有呼叫 :func:`tzset` 的" "情況下影響 :func:`localtime` 等函式的輸出,但是這種行為是不該被依賴的。" -#: ../../library/time.rst:775 +#: ../../library/time.rst:779 msgid "The :envvar:`TZ` environment variable should contain no whitespace." msgstr ":envvar:`TZ` 環境變數不應包含空格字元。" -#: ../../library/time.rst:777 +#: ../../library/time.rst:781 msgid "" "The standard format of the :envvar:`TZ` environment variable is (whitespace " "added for clarity)::" msgstr "" ":envvar:`TZ` 環境變數的標準格式為(為了清楚表達,中間增加了空格字元): ::" -#: ../../library/time.rst:780 +#: ../../library/time.rst:784 msgid "std offset [dst [offset [,start[/time], end[/time]]]]" msgstr "std offset [dst [offset [,start[/time], end[/time]]]]" -#: ../../library/time.rst:782 +#: ../../library/time.rst:786 msgid "Where the components are:" msgstr "其中各個組成部分為:" -#: ../../library/time.rst:784 +#: ../../library/time.rst:788 msgid "``std`` and ``dst``" msgstr "``std`` 和 ``dst``" -#: ../../library/time.rst:785 +#: ../../library/time.rst:789 msgid "" "Three or more alphanumerics giving the timezone abbreviations. These will be " "propagated into time.tzname" msgstr "" -"三個或更多字母與數字 (alphanumerics) 組成的時區縮寫。這些縮寫會被傳播到 " -"time.tzname 中。" +"三個或更多字母與數字 (alphanumerics) 組成的時區縮寫。這些縮寫會被傳播到 time." +"tzname 中。" -#: ../../library/time.rst:788 +#: ../../library/time.rst:792 msgid "``offset``" msgstr "``offset``" -#: ../../library/time.rst:789 +#: ../../library/time.rst:793 msgid "" "The offset has the form: ``± hh[:mm[:ss]]``. This indicates the value added " "the local time to arrive at UTC. If preceded by a '-', the timezone is east " @@ -1411,22 +1409,22 @@ msgstr "" "果以 '-' 開頭,則表示該時區位於本初子午線以東;否則,位於其西。如果 dst 之後" "沒有偏移量,則假定日光時間比標準時間快一小時。" -#: ../../library/time.rst:794 +#: ../../library/time.rst:798 msgid "``start[/time], end[/time]``" msgstr "``start[/time], end[/time]``" -#: ../../library/time.rst:795 +#: ../../library/time.rst:799 msgid "" "Indicates when to change to and back from DST. The format of the start and " "end dates are one of the following:" msgstr "" "表示何時切換至日光節約時間及何時切換回來。開始和結束日期的格式如以下其一:" -#: ../../library/time.rst:798 +#: ../../library/time.rst:802 msgid ":samp:`J{n}`" msgstr ":samp:`J{n}`" -#: ../../library/time.rst:799 +#: ../../library/time.rst:803 msgid "" "The Julian day *n* (1 <= *n* <= 365). Leap days are not counted, so in all " "years February 28 is day 59 and March 1 is day 60." @@ -1434,22 +1432,22 @@ msgstr "" "儒略日 (Julian day) *n*(1 <= *n* <= 365)。閏日不計算,因此在所有年份中,2 " "月 28 日是第 59 天,3 月 1 日是第 60 天。" -#: ../../library/time.rst:802 +#: ../../library/time.rst:806 msgid ":samp:`{n}`" msgstr ":samp:`{n}`" -#: ../../library/time.rst:803 +#: ../../library/time.rst:807 msgid "" "The zero-based Julian day (0 <= *n* <= 365). Leap days are counted, and it " "is possible to refer to February 29." msgstr "" "從 0 開始的儒略日 (0 <= *n* <= 365)。閏日會計算,因此可以適用至 2 月 29 日。" -#: ../../library/time.rst:806 +#: ../../library/time.rst:810 msgid ":samp:`M{m}.{n}.{d}`" msgstr ":samp:`M{m}.{n}.{d}`" -#: ../../library/time.rst:807 +#: ../../library/time.rst:811 msgid "" "The *d*'th day (0 <= *d* <= 6) of week *n* of month *m* of the year (1 <= " "*n* <= 5, 1 <= *m* <= 12, where week 5 means \"the last *d* day in month " @@ -1460,7 +1458,7 @@ msgstr "" "*m* <= 12,其中 *n* 為 5 表示「該月的最後一個第 *d* 天」,這可能出現在第四或" "第五週)。第 1 週是 *d* 天首次出現的那一週。第零天為星期天。" -#: ../../library/time.rst:813 +#: ../../library/time.rst:817 msgid "" "``time`` has the same format as ``offset`` except that no leading sign ('-' " "or '+') is allowed. The default, if time is not given, is 02:00:00." @@ -1468,7 +1466,7 @@ msgstr "" "``time`` 的格式與 ``offset`` 相同,但不允許出現前導符號('-' 或 '+')。如果未" "指定時間,則預設為 02:00:00。" -#: ../../library/time.rst:818 +#: ../../library/time.rst:822 msgid "" ">>> os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'\n" ">>> time.tzset()\n" @@ -1488,7 +1486,7 @@ msgstr "" ">>> time.strftime('%X %x %Z')\n" "'16:08:12 05/08/03 AEST'" -#: ../../library/time.rst:827 +#: ../../library/time.rst:831 msgid "" "On many Unix systems (including \\*BSD, Linux, Solaris, and Darwin), it is " "more convenient to use the system's zoneinfo (:manpage:`tzfile(5)`) " @@ -1505,7 +1503,7 @@ msgstr "" "Eastern'``、``'Australia/Melbourne'``、``'Egypt'`` 或 ``'Europe/" "Amsterdam'``。 ::" -#: ../../library/time.rst:835 +#: ../../library/time.rst:839 msgid "" ">>> os.environ['TZ'] = 'US/Eastern'\n" ">>> time.tzset()\n" @@ -1525,35 +1523,35 @@ msgstr "" ">>> time.tzname\n" "('EET', 'EEST')" -#: ../../library/time.rst:848 +#: ../../library/time.rst:852 msgid "Clock ID Constants" msgstr "時鐘 ID 常數" -#: ../../library/time.rst:850 +#: ../../library/time.rst:854 msgid "" -"These constants are used as parameters for :func:`clock_getres` " -"and :func:`clock_gettime`." +"These constants are used as parameters for :func:`clock_getres` and :func:" +"`clock_gettime`." msgstr "這些常數用作 :func:`clock_getres` 和 :func:`clock_gettime` 的參數。" -#: ../../library/time.rst:855 +#: ../../library/time.rst:859 msgid "" "Identical to :data:`CLOCK_MONOTONIC`, except it also includes any time that " "the system is suspended." msgstr "" "與 :data:`CLOCK_MONOTONIC` 基本相同,不同之處在於它還包括系統暫停的任何時間。" -#: ../../library/time.rst:858 +#: ../../library/time.rst:862 msgid "" "This allows applications to get a suspend-aware monotonic clock without " "having to deal with the complications of :data:`CLOCK_REALTIME`, which may " "have discontinuities if the time is changed using ``settimeofday()`` or " "similar." msgstr "" -"這允許應用程式獲取一個能夠感知暫停的單調時鐘,而無需處" -"理 :data:`CLOCK_REALTIME` 的複雜情況,後者在使用 ``settimeofday()`` 或類似函" -"式更改時間時可能會出現不連續的情況。" +"這允許應用程式獲取一個能夠感知暫停的單調時鐘,而無需處理 :data:" +"`CLOCK_REALTIME` 的複雜情況,後者在使用 ``settimeofday()`` 或類似函式更改時間" +"時可能會出現不連續的情況。" -#: ../../library/time.rst:870 +#: ../../library/time.rst:874 msgid "" "The Solaris OS has a ``CLOCK_HIGHRES`` timer that attempts to use an optimal " "hardware source, and may give close to nanosecond resolution. " @@ -1562,13 +1560,13 @@ msgstr "" "Solaris 作業系統具有 ``CLOCK_HIGHRES`` 計時器,它嘗試使用最佳的硬體資源,並可" "能提供接近奈秒的解析度。``CLOCK_HIGHRES`` 是不可調整且高解析度的時鐘。" -#: ../../library/time.rst:881 +#: ../../library/time.rst:885 msgid "" "Clock that cannot be set and represents monotonic time since some " "unspecified starting point." msgstr "該時鐘無法被設定,其表示自某個未指定起點以來的單調時間。" -#: ../../library/time.rst:891 +#: ../../library/time.rst:895 msgid "" "Similar to :data:`CLOCK_MONOTONIC`, but provides access to a raw hardware-" "based time that is not subject to NTP adjustments." @@ -1576,7 +1574,7 @@ msgstr "" "類似於 :data:`CLOCK_MONOTONIC`,但提供對基於硬體的原始時間的存取,此時間不受 " "NTP 調整的影響。" -#: ../../library/time.rst:900 +#: ../../library/time.rst:904 msgid "" "Similar to :data:`CLOCK_MONOTONIC_RAW`, but reads a value cached by the " "system at context switch and hence has less accuracy." @@ -1584,11 +1582,11 @@ msgstr "" "類似於 :data:`CLOCK_MONOTONIC_RAW`,但讀取的是系統在情境切換時快取的值,因此" "精準度較低。" -#: ../../library/time.rst:910 ../../library/time.rst:919 +#: ../../library/time.rst:914 ../../library/time.rst:923 msgid "High-resolution per-process timer from the CPU." msgstr "來自 CPU 的高解析度每個行程的計時器。" -#: ../../library/time.rst:927 +#: ../../library/time.rst:931 msgid "" "`International Atomic Time `_" @@ -1596,18 +1594,18 @@ msgstr "" "`國際原子時間 `_" -#: ../../library/time.rst:929 +#: ../../library/time.rst:933 msgid "" "The system must have a current leap second table in order for this to give " "the correct answer. PTP or NTP software can maintain a leap second table." msgstr "" "系統必須擁有當前的閏秒表才能給出正確答案。PTP 或 NTP 軟體可以維護閏秒表。" -#: ../../library/time.rst:938 +#: ../../library/time.rst:942 msgid "Thread-specific CPU-time clock." msgstr "執行緒相關的 CPU 時間時鐘。" -#: ../../library/time.rst:947 +#: ../../library/time.rst:951 msgid "" "Time whose absolute value is the time the system has been running and not " "suspended, providing accurate uptime measurement, both absolute and interval." @@ -1615,7 +1613,7 @@ msgstr "" "表示系統運作且無暫停的絕對時間,提供包括絕對時間 (absolute) 和時間區間 " "(interval) 的精確的正常上線時間 (uptime) 測量。" -#: ../../library/time.rst:958 +#: ../../library/time.rst:962 msgid "" "Clock that increments monotonically, tracking the time since an arbitrary " "point, unaffected by frequency or time adjustments and not incremented while " @@ -1624,7 +1622,7 @@ msgstr "" "單調增量的時鐘,從某個任意點開始計時,不受頻率或時間調整影響,並且在系統休眠" "時不增量。" -#: ../../library/time.rst:968 +#: ../../library/time.rst:972 msgid "" "Like :data:`CLOCK_UPTIME_RAW`, but the value is cached by the system at " "context switches and therefore has less accuracy." @@ -1632,23 +1630,23 @@ msgstr "" "類似於 :data:`CLOCK_UPTIME_RAW`,但該值在情境切換時由系統快取,因此精準度較" "低。" -#: ../../library/time.rst:975 +#: ../../library/time.rst:979 msgid "" -"The following constant is the only parameter that can be sent " -"to :func:`clock_settime`." +"The following constant is the only parameter that can be sent to :func:" +"`clock_settime`." msgstr "以下常數是唯一可以傳遞給 :func:`clock_settime` 的參數。" -#: ../../library/time.rst:981 +#: ../../library/time.rst:985 msgid "" "System-wide real-time clock. Setting this clock requires appropriate " "privileges." msgstr "涵蓋整個系統的即時時鐘。設定此時鐘需要適當的權限。" -#: ../../library/time.rst:992 +#: ../../library/time.rst:996 msgid "Timezone Constants" msgstr "時區常數" -#: ../../library/time.rst:996 +#: ../../library/time.rst:1000 msgid "" "The offset of the local DST timezone, in seconds west of UTC, if one is " "defined. This is negative if the local DST timezone is east of UTC (as in " @@ -1659,11 +1657,11 @@ msgstr "" "為單位)。若本地 DST 時區位於 UTC 以東(例如包括英國在內的西歐),則此值為負" "值。僅在 ``daylight`` 為非零時使用此值。詳情請參見下方註釋。" -#: ../../library/time.rst:1002 +#: ../../library/time.rst:1006 msgid "Nonzero if a DST timezone is defined. See note below." msgstr "如果定義了 DST 時區,則為非零值。詳情請參見下方註釋。" -#: ../../library/time.rst:1006 +#: ../../library/time.rst:1010 msgid "" "The offset of the local (non-DST) timezone, in seconds west of UTC (negative " "in most of Western Europe, positive in the US, zero in the UK). See note " @@ -1672,7 +1670,7 @@ msgstr "" "本地(非 DST)時區相對於 UTC 以西的偏移量(以秒為單位),西歐大多數地區為負," "美國為正,英國為零。詳情請參見下方註釋。" -#: ../../library/time.rst:1011 +#: ../../library/time.rst:1015 msgid "" "A tuple of two strings: the first is the name of the local non-DST timezone, " "the second is the name of the local DST timezone. If no DST timezone is " @@ -1681,48 +1679,46 @@ msgstr "" "一個包含兩個字串的元組:第一個是本地非 DST 時區的名稱,第二個是本地 DST 時區" "的名稱。如果沒有定義 DST 時區,則不應使用第二個字串。詳情請參見下方註釋。" -#: ../../library/time.rst:1017 +#: ../../library/time.rst:1021 msgid "" -"For the above Timezone constants " -"(:data:`altzone`, :data:`daylight`, :data:`timezone`, and :data:`tzname`), " -"the value is determined by the timezone rules in effect at module load time " -"or the last time :func:`tzset` is called and may be incorrect for times in " -"the past. It is recommended to use the :attr:`~struct_time.tm_gmtoff` " -"and :attr:`~struct_time.tm_zone` results from :func:`localtime` to obtain " -"timezone information." +"For the above Timezone constants (:data:`altzone`, :data:`daylight`, :data:" +"`timezone`, and :data:`tzname`), the value is determined by the timezone " +"rules in effect at module load time or the last time :func:`tzset` is called " +"and may be incorrect for times in the past. It is recommended to use the :" +"attr:`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` results from :" +"func:`localtime` to obtain timezone information." msgstr "" -"對於上述時區常數(:data:`altzone`、:data:`daylight`、:data:`timezone` " -"和 :data:`tzname`),其值由模組載入時或 :func:`tzset` 最後一次被呼叫時的時區" -"規則決定,且過去的時間可能會不準確。建議使用 :func:`localtime` 回傳" -"的 :attr:`~struct_time.tm_gmtoff` 和 :attr:`~struct_time.tm_zone` 來獲取時區" -"資訊。" +"對於上述時區常數(:data:`altzone`、:data:`daylight`、:data:`timezone` 和 :" +"data:`tzname`),其值由模組載入時或 :func:`tzset` 最後一次被呼叫時的時區規則" +"決定,且過去的時間可能會不準確。建議使用 :func:`localtime` 回傳的 :attr:" +"`~struct_time.tm_gmtoff` 和 :attr:`~struct_time.tm_zone` 來獲取時區資訊。" -#: ../../library/time.rst:1026 +#: ../../library/time.rst:1030 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/time.rst:1027 +#: ../../library/time.rst:1031 msgid "More object-oriented interface to dates and times." msgstr "更多物件導向的日期和時間介面。" -#: ../../library/time.rst:1029 +#: ../../library/time.rst:1033 msgid "Module :mod:`locale`" msgstr ":mod:`locale` 模組" -#: ../../library/time.rst:1030 +#: ../../library/time.rst:1034 msgid "" "Internationalization services. The locale setting affects the " -"interpretation of many format specifiers in :func:`strftime` " -"and :func:`strptime`." +"interpretation of many format specifiers in :func:`strftime` and :func:" +"`strptime`." msgstr "" "國際化服務。區域設定會影響 :func:`strftime` 和 :func:`strptime` 中許多格式指" "定符號 (format specifiers) 的解譯。" -#: ../../library/time.rst:1033 +#: ../../library/time.rst:1037 msgid "Module :mod:`calendar`" msgstr ":mod:`calendar` 模組" -#: ../../library/time.rst:1034 +#: ../../library/time.rst:1038 msgid "" "General calendar-related functions. :func:`~calendar.timegm` is the " "inverse of :func:`gmtime` from this module." @@ -1730,11 +1726,11 @@ msgstr "" "通用的日曆相關函式。:func:`~calendar.timegm` 是本模組中 :func:`gmtime` 的反函" "式。" -#: ../../library/time.rst:1038 +#: ../../library/time.rst:1042 msgid "Footnotes" msgstr "註解" -#: ../../library/time.rst:1039 +#: ../../library/time.rst:1043 msgid "" "The use of ``%Z`` is now deprecated, but the ``%z`` escape that expands to " "the preferred hour/minute offset is not supported by all ANSI C libraries. " @@ -1774,27 +1770,35 @@ msgstr "Coordinated Universal Time(世界協調時間)" msgid "Greenwich Mean Time" msgstr "Greenwich Mean Time(格林威治標準時間)" -#: ../../library/time.rst:59 +#: ../../library/time.rst:63 msgid "Daylight Saving Time" msgstr "Daylight Saving Time(日光節約時間)" -#: ../../library/time.rst:319 ../../library/time.rst:354 -#: ../../library/time.rst:729 +#: ../../library/time.rst:323 ../../library/time.rst:358 +#: ../../library/time.rst:733 msgid "benchmarking" msgstr "benchmarking(基準測試)" -#: ../../library/time.rst:354 ../../library/time.rst:729 +#: ../../library/time.rst:358 ../../library/time.rst:733 msgid "CPU time" msgstr "CPU time(CPU 時間)" -#: ../../library/time.rst:354 ../../library/time.rst:729 +#: ../../library/time.rst:358 ../../library/time.rst:733 msgid "processor time" msgstr "processor time(處理器時間)" -#: ../../library/time.rst:425 ../../library/time.rst:584 +#: ../../library/time.rst:429 ../../library/time.rst:588 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/time.rst:425 ../../library/time.rst:584 +#: ../../library/time.rst:429 ../../library/time.rst:588 msgid "datetime format" msgstr "datetime format(日期時間格式)" + +#~ msgid "" +#~ "UTC is Coordinated Universal Time (formerly known as Greenwich Mean Time, " +#~ "or GMT). The acronym UTC is not a mistake but a compromise between " +#~ "English and French." +#~ msgstr "" +#~ "UTC 是 Coordinated Universal Time --- 世界協調時間(原稱為格林威治標準時" +#~ "間,或 GMT)。縮寫 UTC 並不是寫錯,而是英文和法文之間折衷的結果。" diff --git a/library/timeit.po b/library/timeit.po index 4b5e7eb49d..08c1374e9f 100644 --- a/library/timeit.po +++ b/library/timeit.po @@ -36,8 +36,8 @@ msgid "" "execution times. See also Tim Peters' introduction to the \"Algorithms\" " "chapter in the second edition of *Python Cookbook*, published by O'Reilly." msgstr "" -"該模組提供了一種對少量 Python 程式碼進行計時的簡單方法。它有一個\\ :ref:" -"`timeit-command-line-interface`\\ 和一個\\ :ref:`可呼叫介面 `,它避免了許多測量執行時間的常見陷阱。另請參閱由 O'Reilly 出版的 " "*Python 錦囊妙計 (Python Cookbook)* 第二版中 Tim Peters 所寫的「演算法」章節" "的介紹。" @@ -107,11 +107,11 @@ msgstr "" #: ../../library/timeit.rst:52 msgid "" "Note however that :func:`.timeit` will automatically determine the number of " -"repetitions only when the command-line interface is used. In the :ref:" -"`timeit-examples` section you can find more advanced examples." +"repetitions only when the command-line interface is used. In " +"the :ref:`timeit-examples` section you can find more advanced examples." msgstr "" -"但請注意,僅當使用命令列介面時 :func:`.timeit` 才會自動確定重複次數。在\\ :" -"ref:`timeit-examples`\\ 章節中有更進階的範例。" +"但請注意,僅當使用命令列介面時 :func:`.timeit` 才會自動確定重複次數。在" +"\\ :ref:`timeit-examples`\\ 章節中有更進階的範例。" #: ../../library/timeit.rst:60 msgid "Python Interface" @@ -157,8 +157,8 @@ msgid "" "The default timer, which is always time.perf_counter(), returns float " "seconds. An alternative, time.perf_counter_ns, returns integer nanoseconds." msgstr "" -"預設計時器始終為 time.perf_counter(),會回傳浮點秒數。另一種方法是 time." -"perf_counter_ns,會回傳整數奈秒。" +"預設計時器始終為 time.perf_counter(),會回傳浮點秒數。另一種方法是 " +"time.perf_counter_ns,會回傳整數奈秒。" #: ../../library/timeit.rst:95 msgid ":func:`time.perf_counter` is now the default timer." @@ -186,9 +186,9 @@ msgstr "" #: ../../library/timeit.rst:111 msgid "" -"To measure the execution time of the first statement, use the :meth:`." -"timeit` method. The :meth:`.repeat` and :meth:`.autorange` methods are " -"convenience methods to call :meth:`.timeit` multiple times." +"To measure the execution time of the first statement, use " +"the :meth:`.timeit` method. The :meth:`.repeat` and :meth:`.autorange` " +"methods are convenience methods to call :meth:`.timeit` multiple times." msgstr "" "要測量第一個陳述式的執行時間,請使用 :meth:`.timeit` 方法。:meth:`.repeat` " "和 :meth:`.autorange` 方法是多次呼叫 :meth:`.timeit` 的便捷方法。" @@ -313,6 +313,11 @@ msgid "" "except Exception:\n" " t.print_exc()" msgstr "" +"t = Timer(...) # 在 try/except 之外\n" +"try:\n" +" t.timeit(...) # 或 t.repeat(...)\n" +"except Exception:\n" +" t.print_exc()" #: ../../library/timeit.rst:199 msgid "" @@ -359,8 +364,8 @@ msgid "" "measure process time, not wallclock time, using :func:`time.process_time` " "instead of :func:`time.perf_counter`, which is the default" msgstr "" -"若要測量行程時間 (process time) 而非掛鐘時間 (wallclock time),請使用 :func:" -"`time.process_time` 而不是預設的 :func:`time.perf_counter`" +"若要測量行程時間 (process time) 而非掛鐘時間 (wallclock time),請使" +"用 :func:`time.process_time` 而不是預設的 :func:`time.perf_counter`" #: ../../library/timeit.rst:238 msgid "" @@ -401,15 +406,15 @@ msgstr "" msgid "" ":func:`default_timer` measurements can be affected by other programs running " "on the same machine, so the best thing to do when accurate timing is " -"necessary is to repeat the timing a few times and use the best time. The :" -"option:`-r` option is good for this; the default of 5 repetitions is " +"necessary is to repeat the timing a few times and use the best time. " +"The :option:`-r` option is good for this; the default of 5 repetitions is " "probably enough in most cases. You can use :func:`time.process_time` to " "measure CPU time." msgstr "" ":func:`default_timer` 測量可能會受到同一台機器上運行的其他程式的影響,因此," "當需要精確計時時,最好的做法是重複計時幾次並使用最佳時間。:option:`-r` 選項對" -"此很有用;在大多數情況下,預設的重複 5 次可能就足夠了。你可以使用 :func:" -"`time.process_time` 來測量 CPU 時間。" +"此很有用;在大多數情況下,預設的重複 5 次可能就足夠了。你可以使" +"用 :func:`time.process_time` 來測量 CPU 時間。" #: ../../library/timeit.rst:267 msgid "" @@ -437,15 +442,15 @@ msgid "" "$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"char in " "text\"\n" "5000000 loops, best of 5: 0.0877 usec per loop\n" -"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"text." -"find(char)\"\n" +"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" " +"\"text.find(char)\"\n" "1000000 loops, best of 5: 0.342 usec per loop" msgstr "" "$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"char in " "text\"\n" "5000000 loops, best of 5: 0.0877 usec per loop\n" -"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"text." -"find(char)\"\n" +"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" " +"\"text.find(char)\"\n" "1000000 loops, best of 5: 0.342 usec per loop" #: ../../library/timeit.rst:287 @@ -507,11 +512,12 @@ msgstr "" #: ../../library/timeit.rst:312 msgid "" "The following examples show how to time expressions that contain multiple " -"lines. Here we compare the cost of using :func:`hasattr` vs. :keyword:`try`/:" -"keyword:`except` to test for missing and present object attributes:" +"lines. Here we compare the cost of using :func:`hasattr` " +"vs. :keyword:`try`/:keyword:`except` to test for missing and present object " +"attributes:" msgstr "" -"以下範例展示如何對包含多行的運算式進行計時。這裡我們使用 :func:`hasattr` 與 :" -"keyword:`try`/:keyword:`except` 來測試缺失和存在之物件屬性並比較其花費 " +"以下範例展示如何對包含多行的運算式進行計時。這裡我們使用 :func:`hasattr` " +"與 :keyword:`try`/:keyword:`except` 來測試缺失和存在之物件屬性並比較其花費 " "(cost):" #: ../../library/timeit.rst:316 @@ -614,6 +620,13 @@ msgid "" " import timeit\n" " print(timeit.timeit(\"test()\", setup=\"from __main__ import test\"))" msgstr "" +"def test():\n" +" \"\"\"一個笨笨的測試函式\"\"\"\n" +" L = [i for i in range(100)]\n" +"\n" +"if __name__ == '__main__':\n" +" import timeit\n" +" print(timeit.timeit(\"test()\", setup=\"from __main__ import test\"))" #: ../../library/timeit.rst:369 msgid "" diff --git a/library/tk.po b/library/tk.po index 7b366eefa0..5a3fc9a8d8 100644 --- a/library/tk.po +++ b/library/tk.po @@ -25,28 +25,27 @@ msgid "Graphical User Interfaces with Tk" msgstr "以 Tk 打造圖形使用者介面 (Graphical User Interfaces)" #: ../../library/tk.rst:13 -#, fuzzy msgid "" "Tk/Tcl has long been an integral part of Python. It provides a robust and " "platform independent windowing toolkit, that is available to Python " -"programmers using the :mod:`tkinter` package, and its extension, the :mod:" -"`tkinter.ttk` module." +"programmers using the :mod:`tkinter` package, and its extension, " +"the :mod:`tkinter.ttk` module." msgstr "" "Tk/Tcl 長期以來一直是 Python 不可或缺的一部分。它提供了一個強大且獨立於平台的" -"視窗工具包,可供使用 :mod:`tkinter` 套件及其擴充套件 :mod:`tkinter.tix` 和 :" -"mod:`tkinter.ttk` 模組的 Python 開發者使用。" +"視窗工具包,可供使用 :mod:`tkinter` 套件及其擴充套件 :mod:`tkinter.ttk` 模組" +"的 Python 開發者使用。" #: ../../library/tk.rst:17 msgid "" "The :mod:`tkinter` package is a thin object-oriented layer on top of Tcl/Tk. " "To use :mod:`tkinter`, you don't need to write Tcl code, but you will need " -"to consult the Tk documentation, and occasionally the Tcl documentation. :" -"mod:`tkinter` is a set of wrappers that implement the Tk widgets as Python " -"classes." +"to consult the Tk documentation, and occasionally the Tcl " +"documentation. :mod:`tkinter` is a set of wrappers that implement the Tk " +"widgets as Python classes." msgstr "" -":mod:`tkinter` 套件是 Tcl/Tk 之上的一個輕薄物件導向層。要使用 :mod:" -"`tkinter`,你不需要編寫 Tcl 程式,但會需要查閱 Tk 文件和部份 Tcl 文件。:mod:" -"`tkinter` 是一組將 Tk 小工具 (widget) 實作為 Python 類別的包裝器。" +":mod:`tkinter` 套件是 Tcl/Tk 之上的一個輕薄物件導向層。要使" +"用 :mod:`tkinter`,你不需要編寫 Tcl 程式,但會需要查閱 Tk 文件和部份 Tcl 文" +"件。:mod:`tkinter` 是一組將 Tk 小工具 (widget) 實作為 Python 類別的包裝器。" #: ../../library/tk.rst:23 msgid "" @@ -60,10 +59,10 @@ msgid "" "GuiProgramming>`_." msgstr "" ":mod:`tkinter` 的主要優點是速度快,而且通常與 Python 捆綁 (bundle) 在一起。儘" -"管其標準文件不是很完整,但還是有些不錯的材料,包括:參考資料、教學、書籍等。:" -"mod:`tkinter` 曾因其過時的外觀而眾所皆知,但這在 Tk 8.5 中得到了極大的改進。" -"此外,還有許多其他你可能會感興趣的 GUI 函式庫。Python wiki 列出了幾個替代的 " -"`GUI 框架和工具 `_。" +"管其標準文件不是很完整,但還是有些不錯的材料,包括:參考資料、教學、書籍" +"等。:mod:`tkinter` 曾因其過時的外觀而眾所皆知,但這在 Tk 8.5 中得到了極大的改" +"進。此外,還有許多其他你可能會感興趣的 GUI 函式庫。Python wiki 列出了幾個替代" +"的 `GUI 框架和工具 `_。" #: ../../library/tk.rst:7 msgid "GUI" diff --git a/library/token.po b/library/token.po index de853e2c2d..28c57739a7 100644 --- a/library/token.po +++ b/library/token.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-30 23:07+0000\n" +"POT-Creation-Date: 2025-03-25 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,273 +41,425 @@ msgid "" "functions. The functions mirror definitions in the Python C header files." msgstr "" -#: ../../library/token.rst:25 +#: ../../library/token.rst:22 +msgid "" +"Note that a token's value may depend on tokenizer options. For example, a " +"``\"+\"`` token may be reported as either :data:`PLUS` or :data:`OP`, or a " +"``\"match\"`` token may be either :data:`NAME` or :data:`SOFT_KEYWORD`." +msgstr "" + +#: ../../library/token.rst:29 msgid "" "Dictionary mapping the numeric values of the constants defined in this " "module back to name strings, allowing more human-readable representation of " "parse trees to be generated." msgstr "" -#: ../../library/token.rst:32 +#: ../../library/token.rst:36 msgid "Return ``True`` for terminal token values." msgstr "" -#: ../../library/token.rst:37 +#: ../../library/token.rst:41 msgid "Return ``True`` for non-terminal token values." msgstr "" -#: ../../library/token.rst:42 +#: ../../library/token.rst:46 msgid "Return ``True`` if *x* is the marker indicating the end of input." msgstr "" -#: ../../library/token.rst:45 +#: ../../library/token.rst:49 msgid "The token constants are:" msgstr "" -#: ../../library/token-list.inc:18 -msgid "Token value for ``\"(\"``." +#: ../../library/token.rst:53 +msgid "" +"Token value that indicates an :ref:`identifier `. Note that " +"keywords are also initially tokenized an ``NAME`` tokens." msgstr "" -#: ../../library/token-list.inc:22 -msgid "Token value for ``\")\"``." +#: ../../library/token.rst:58 +msgid "Token value that indicates a :ref:`numeric literal `" msgstr "" -#: ../../library/token-list.inc:26 -msgid "Token value for ``\"[\"``." +#: ../../library/token.rst:62 +msgid "" +"Token value that indicates a :ref:`string or byte literal `, " +"excluding :ref:`formatted string literals `. The token string is " +"not interpreted: it includes the surrounding quotation marks and the prefix " +"(if given); backslashes are included literally, without processing escape " +"sequences." msgstr "" -#: ../../library/token-list.inc:30 -msgid "Token value for ``\"]\"``." +#: ../../library/token.rst:70 +msgid "" +"A generic token value that indicates an :ref:`operator ` or :ref:" +"`delimiter `." msgstr "" -#: ../../library/token-list.inc:34 -msgid "Token value for ``\":\"``." +#: ../../library/token.rst:75 +msgid "" +"This value is only reported by the :mod:`tokenize` module. Internally, the " +"tokenizer uses :ref:`exact token types ` instead." msgstr "" -#: ../../library/token-list.inc:38 -msgid "Token value for ``\",\"``." +#: ../../library/token.rst:81 +msgid "" +"Token value used to indicate a comment. The parser ignores :data:`!COMMENT` " +"tokens." msgstr "" -#: ../../library/token-list.inc:42 -msgid "Token value for ``\";\"``." +#: ../../library/token.rst:86 +msgid "" +"Token value that indicates the end of a :ref:`logical line `." msgstr "" -#: ../../library/token-list.inc:46 -msgid "Token value for ``\"+\"``." +#: ../../library/token.rst:90 +msgid "" +"Token value used to indicate a non-terminating newline. :data:`!NL` tokens " +"are generated when a logical line of code is continued over multiple " +"physical lines. The parser ignores :data:`!NL` tokens." msgstr "" -#: ../../library/token-list.inc:50 -msgid "Token value for ``\"-\"``." +#: ../../library/token.rst:96 +msgid "" +"Token value used at the beginning of a :ref:`logical line ` " +"to indicate the start of an :ref:`indented block `." msgstr "" -#: ../../library/token-list.inc:54 -msgid "Token value for ``\"*\"``." +#: ../../library/token.rst:101 +msgid "" +"Token value used at the beginning of a :ref:`logical line ` " +"to indicate the end of an :ref:`indented block `." msgstr "" -#: ../../library/token-list.inc:58 -msgid "Token value for ``\"/\"``." +#: ../../library/token.rst:106 +msgid "" +"Token value used to indicate the beginning of an :ref:`f-string literal `." msgstr "" -#: ../../library/token-list.inc:62 -msgid "Token value for ``\"|\"``." +#: ../../library/token.rst:111 +msgid "" +"The token string includes the prefix and the opening quote(s), but none of " +"the contents of the literal." msgstr "" -#: ../../library/token-list.inc:66 -msgid "Token value for ``\"&\"``." +#: ../../library/token.rst:116 +msgid "" +"Token value used for literal text inside an :ref:`f-string literal `, including format specifications." msgstr "" -#: ../../library/token-list.inc:70 -msgid "Token value for ``\"<\"``." +#: ../../library/token.rst:121 +msgid "" +"Replacement fields (that is, the non-literal parts of f-strings) use the " +"same tokens as other expressions, and are delimited by :data:`LBRACE`, :data:" +"`RBRACE`, :data:`EXCLAMATION` and :data:`COLON` tokens." msgstr "" -#: ../../library/token-list.inc:74 -msgid "Token value for ``\">\"``." +#: ../../library/token.rst:128 +msgid "Token value used to indicate the end of a :ref:`f-string `." msgstr "" -#: ../../library/token-list.inc:78 -msgid "Token value for ``\"=\"``." +#: ../../library/token.rst:132 +msgid "The token string contains the closing quote(s)." msgstr "" -#: ../../library/token-list.inc:82 -msgid "Token value for ``\".\"``." +#: ../../library/token.rst:136 +msgid "Token value that indicates the end of input." msgstr "" -#: ../../library/token-list.inc:86 -msgid "Token value for ``\"%\"``." +#: ../../library/token.rst:140 +msgid "" +"Token value that indicates the encoding used to decode the source bytes into " +"text. The first token returned by :func:`tokenize.tokenize` will always be " +"an ``ENCODING`` token." msgstr "" -#: ../../library/token-list.inc:90 -msgid "Token value for ``\"{\"``." +#: ../../library/token.rst:146 +msgid "" +"This token type isn't used by the C tokenizer but is needed for the :mod:" +"`tokenize` module." msgstr "" -#: ../../library/token-list.inc:94 -msgid "Token value for ``\"}\"``." +#: ../../library/token.rst:150 +msgid "" +"The following token types are not produced by the :mod:`tokenize` module, " +"and are defined for special uses in the tokenizer or parser:" msgstr "" -#: ../../library/token-list.inc:98 -msgid "Token value for ``\"==\"``." +#: ../../library/token.rst:155 +msgid "" +"Token value indicating that a ``type: ignore`` comment was recognized. Such " +"tokens are produced instead of regular :data:`COMMENT` tokens only with the :" +"data:`~ast.PyCF_TYPE_COMMENTS` flag." msgstr "" -#: ../../library/token-list.inc:102 -msgid "Token value for ``\"!=\"``." +#: ../../library/token.rst:161 +msgid "" +"Token value indicating that a type comment was recognized. Such tokens are " +"produced instead of regular :data:`COMMENT` tokens only with the :data:`~ast." +"PyCF_TYPE_COMMENTS` flag." msgstr "" -#: ../../library/token-list.inc:106 -msgid "Token value for ``\"<=\"``." +#: ../../library/token.rst:167 +msgid "Token value indicating a :ref:`soft keyword `." msgstr "" -#: ../../library/token-list.inc:110 -msgid "Token value for ``\">=\"``." +#: ../../library/token.rst:169 +msgid "" +"The tokenizer never produces this value. To check for a soft keyword, pass " +"a :data:`NAME` token's string to :func:`keyword.issoftkeyword`." msgstr "" -#: ../../library/token-list.inc:114 -msgid "Token value for ``\"~\"``." +#: ../../library/token.rst:175 +msgid "Token value used to indicate wrong input." msgstr "" -#: ../../library/token-list.inc:118 -msgid "Token value for ``\"^\"``." +#: ../../library/token.rst:177 +msgid "" +"The :mod:`tokenize` module generally indicates errors by raising exceptions " +"instead of emitting this token. It can also emit tokens such as :data:`OP` " +"or :data:`NAME` with strings that are later rejected by the parser." msgstr "" -#: ../../library/token-list.inc:122 -msgid "Token value for ``\"<<\"``." +#: ../../library/token.rst:185 +msgid "" +"The remaining tokens represent specific :ref:`operators ` and :" +"ref:`delimiters `. (The :mod:`tokenize` module reports these as :" +"data:`OP`; see ``exact_type`` in the :mod:`tokenize` documentation for " +"details.)" msgstr "" -#: ../../library/token-list.inc:126 -msgid "Token value for ``\">>\"``." +#: ../../library/token-list.inc:7 +msgid "Token" msgstr "" -#: ../../library/token-list.inc:130 -msgid "Token value for ``\"**\"``." +#: ../../library/token-list.inc:8 +msgid "Value" msgstr "" -#: ../../library/token-list.inc:134 -msgid "Token value for ``\"+=\"``." +#: ../../library/token-list.inc:10 +msgid "``\"(\"``" msgstr "" -#: ../../library/token-list.inc:138 -msgid "Token value for ``\"-=\"``." +#: ../../library/token-list.inc:12 +msgid "``\")\"``" msgstr "" -#: ../../library/token-list.inc:142 -msgid "Token value for ``\"*=\"``." +#: ../../library/token-list.inc:14 +msgid "``\"[\"``" msgstr "" -#: ../../library/token-list.inc:146 -msgid "Token value for ``\"/=\"``." +#: ../../library/token-list.inc:16 +msgid "``\"]\"``" msgstr "" -#: ../../library/token-list.inc:150 -msgid "Token value for ``\"%=\"``." +#: ../../library/token-list.inc:18 +msgid "``\":\"``" msgstr "" -#: ../../library/token-list.inc:154 -msgid "Token value for ``\"&=\"``." +#: ../../library/token-list.inc:20 +msgid "``\",\"``" msgstr "" -#: ../../library/token-list.inc:158 -msgid "Token value for ``\"|=\"``." +#: ../../library/token-list.inc:22 +msgid "``\";\"``" msgstr "" -#: ../../library/token-list.inc:162 -msgid "Token value for ``\"^=\"``." +#: ../../library/token-list.inc:24 +msgid "``\"+\"``" msgstr "" -#: ../../library/token-list.inc:166 -msgid "Token value for ``\"<<=\"``." +#: ../../library/token-list.inc:26 +msgid "``\"-\"``" msgstr "" -#: ../../library/token-list.inc:170 -msgid "Token value for ``\">>=\"``." +#: ../../library/token-list.inc:28 +msgid "``\"*\"``" msgstr "" -#: ../../library/token-list.inc:174 -msgid "Token value for ``\"**=\"``." +#: ../../library/token-list.inc:30 +msgid "``\"/\"``" msgstr "" -#: ../../library/token-list.inc:178 -msgid "Token value for ``\"//\"``." +#: ../../library/token-list.inc:32 +msgid "``\"|\"``" msgstr "" -#: ../../library/token-list.inc:182 -msgid "Token value for ``\"//=\"``." +#: ../../library/token-list.inc:34 +msgid "``\"&\"``" msgstr "" -#: ../../library/token-list.inc:186 -msgid "Token value for ``\"@\"``." +#: ../../library/token-list.inc:36 +msgid "``\"<\"``" msgstr "" -#: ../../library/token-list.inc:190 -msgid "Token value for ``\"@=\"``." +#: ../../library/token-list.inc:38 +msgid "``\">\"``" msgstr "" -#: ../../library/token-list.inc:194 -msgid "Token value for ``\"->\"``." +#: ../../library/token-list.inc:40 +msgid "``\"=\"``" msgstr "" -#: ../../library/token-list.inc:198 -msgid "Token value for ``\"...\"``." +#: ../../library/token-list.inc:42 +msgid "``\".\"``" msgstr "" -#: ../../library/token-list.inc:202 -msgid "Token value for ``\":=\"``." +#: ../../library/token-list.inc:44 +msgid "``\"%\"``" msgstr "" -#: ../../library/token-list.inc:206 -msgid "Token value for ``\"!\"``." +#: ../../library/token-list.inc:46 +msgid "``\"{\"``" msgstr "" -#: ../../library/token.rst:49 -msgid "" -"The following token type values aren't used by the C tokenizer but are " -"needed for the :mod:`tokenize` module." +#: ../../library/token-list.inc:48 +msgid "``\"}\"``" msgstr "" -#: ../../library/token.rst:55 -msgid "Token value used to indicate a comment." +#: ../../library/token-list.inc:50 +msgid "``\"==\"``" msgstr "" -#: ../../library/token.rst:61 -msgid "" -"Token value used to indicate a non-terminating newline. The :data:`NEWLINE` " -"token indicates the end of a logical line of Python code; ``NL`` tokens are " -"generated when a logical line of code is continued over multiple physical " -"lines." +#: ../../library/token-list.inc:52 +msgid "``\"!=\"``" msgstr "" -#: ../../library/token.rst:69 -msgid "" -"Token value that indicates the encoding used to decode the source bytes into " -"text. The first token returned by :func:`tokenize.tokenize` will always be " -"an ``ENCODING`` token." +#: ../../library/token-list.inc:54 +msgid "``\"<=\"``" msgstr "" -#: ../../library/token.rst:77 -msgid "" -"Token value indicating that a type comment was recognized. Such tokens are " -"only produced when :func:`ast.parse` is invoked with ``type_comments=True``." +#: ../../library/token-list.inc:56 +msgid "``\">=\"``" +msgstr "" + +#: ../../library/token-list.inc:58 +msgid "``\"~\"``" +msgstr "" + +#: ../../library/token-list.inc:60 +msgid "``\"^\"``" +msgstr "" + +#: ../../library/token-list.inc:62 +msgid "``\"<<\"``" +msgstr "" + +#: ../../library/token-list.inc:64 +msgid "``\">>\"``" +msgstr "" + +#: ../../library/token-list.inc:66 +msgid "``\"**\"``" +msgstr "" + +#: ../../library/token-list.inc:68 +msgid "``\"+=\"``" +msgstr "" + +#: ../../library/token-list.inc:70 +msgid "``\"-=\"``" +msgstr "" + +#: ../../library/token-list.inc:72 +msgid "``\"*=\"``" +msgstr "" + +#: ../../library/token-list.inc:74 +msgid "``\"/=\"``" +msgstr "" + +#: ../../library/token-list.inc:76 +msgid "``\"%=\"``" +msgstr "" + +#: ../../library/token-list.inc:78 +msgid "``\"&=\"``" +msgstr "" + +#: ../../library/token-list.inc:80 +msgid "``\"|=\"``" +msgstr "" + +#: ../../library/token-list.inc:82 +msgid "``\"^=\"``" msgstr "" -#: ../../library/token.rst:84 +#: ../../library/token-list.inc:84 +msgid "``\"<<=\"``" +msgstr "" + +#: ../../library/token-list.inc:86 +msgid "``\">>=\"``" +msgstr "" + +#: ../../library/token-list.inc:88 +msgid "``\"**=\"``" +msgstr "" + +#: ../../library/token-list.inc:90 +msgid "``\"//\"``" +msgstr "" + +#: ../../library/token-list.inc:92 +msgid "``\"//=\"``" +msgstr "" + +#: ../../library/token-list.inc:94 +msgid "``\"@\"``" +msgstr "" + +#: ../../library/token-list.inc:96 +msgid "``\"@=\"``" +msgstr "" + +#: ../../library/token-list.inc:98 +msgid "``\"->\"``" +msgstr "" + +#: ../../library/token-list.inc:100 +msgid "``\"...\"``" +msgstr "" + +#: ../../library/token-list.inc:102 +msgid "``\":=\"``" +msgstr "" + +#: ../../library/token-list.inc:104 +msgid "``\"!\"``" +msgstr "" + +#: ../../library/token.rst:193 +msgid "The following non-token constants are provided:" +msgstr "" + +#: ../../library/token.rst:197 +msgid "The number of token types defined in this module." +msgstr "" + +#: ../../library/token.rst:204 msgid "" "A dictionary mapping the string representation of a token to its numeric " "code." msgstr "" -#: ../../library/token.rst:89 +#: ../../library/token.rst:209 msgid "Added :data:`!AWAIT` and :data:`!ASYNC` tokens." msgstr "" -#: ../../library/token.rst:92 +#: ../../library/token.rst:212 msgid "Added :data:`COMMENT`, :data:`NL` and :data:`ENCODING` tokens." msgstr "" -#: ../../library/token.rst:95 +#: ../../library/token.rst:215 msgid "" "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens. \"async\" and \"await\" " "are now tokenized as :data:`NAME` tokens." msgstr "" -#: ../../library/token.rst:99 +#: ../../library/token.rst:219 msgid "" "Added :data:`TYPE_COMMENT`, :data:`TYPE_IGNORE`, :data:`COLONEQUAL`. Added :" "data:`!AWAIT` and :data:`!ASYNC` tokens back (they're needed to support " @@ -315,6 +467,10 @@ msgid "" "set to 6 or lower)." msgstr "" -#: ../../library/token.rst:105 +#: ../../library/token.rst:225 +msgid "Added :data:`EXCLAMATION`." +msgstr "" + +#: ../../library/token.rst:228 msgid "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens again." msgstr "" diff --git a/library/traceback.po b/library/traceback.po index 3a7269ef34..6337736158 100644 --- a/library/traceback.po +++ b/library/traceback.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-13 00:15+0000\n" +"POT-Creation-Date: 2025-03-03 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -161,15 +161,15 @@ msgstr "" #: ../../library/traceback.rst:114 msgid "" -"This is a shorthand for ``print_exception(sys.exception(), limit, file, " -"chain)``." +"This is a shorthand for ``print_exception(sys.exception(), limit=limit, " +"file=file, chain=chain)``." msgstr "" #: ../../library/traceback.rst:120 msgid "" -"This is a shorthand for ``print_exception(sys.last_exc, limit, file, " -"chain)``. In general it will work only after an exception has reached an " -"interactive prompt (see :data:`sys.last_exc`)." +"This is a shorthand for ``print_exception(sys.last_exc, limit=limit, " +"file=file, chain=chain)``. In general it will work only after an exception " +"has reached an interactive prompt (see :data:`sys.last_exc`)." msgstr "" #: ../../library/traceback.rst:127 @@ -563,7 +563,7 @@ msgid "" "objects>` in a :ref:`traceback `." msgstr "" -#: ../../library/traceback.rst:504 +#: ../../library/traceback.rst:506 msgid "" "Represents a single :ref:`frame ` in the :ref:`traceback " "` or stack that is being formatted or printed. It may " @@ -577,38 +577,60 @@ msgid "" "display." msgstr "" -#: ../../library/traceback.rst:515 +#: ../../library/traceback.rst:517 msgid ":class:`!FrameSummary` instances have the following attributes:" msgstr "" -#: ../../library/traceback.rst:519 +#: ../../library/traceback.rst:521 msgid "" "The filename of the source code for this frame. Equivalent to accessing :" "attr:`f.f_code.co_filename ` on a :ref:`frame object " "` *f*." msgstr "" -#: ../../library/traceback.rst:525 +#: ../../library/traceback.rst:527 msgid "The line number of the source code for this frame." msgstr "" -#: ../../library/traceback.rst:529 +#: ../../library/traceback.rst:531 msgid "" "Equivalent to accessing :attr:`f.f_code.co_name ` on a :" "ref:`frame object ` *f*." msgstr "" -#: ../../library/traceback.rst:534 +#: ../../library/traceback.rst:536 msgid "" "A string representing the source code for this frame, with leading and " "trailing whitespace stripped. If the source is not available, it is ``None``." msgstr "" -#: ../../library/traceback.rst:541 +#: ../../library/traceback.rst:542 +msgid "" +"The last line number of the source code for this frame. By default, it is " +"set to ``lineno`` and indexation starts from 1." +msgstr "" + +#: ../../library/traceback.rst:545 +msgid "The default value changed from ``None`` to ``lineno``." +msgstr "" + +#: ../../library/traceback.rst:550 +msgid "" +"The column number of the source code for this frame. By default, it is " +"``None`` and indexation starts from 0." +msgstr "" + +#: ../../library/traceback.rst:555 +msgid "" +"The last column number of the source code for this frame. By default, it is " +"``None`` and indexation starts from 0." +msgstr "" + +#: ../../library/traceback.rst:562 msgid "Examples of Using the Module-Level Functions" msgstr "" -#: ../../library/traceback.rst:543 +#: ../../library/traceback.rst:564 msgid "" "This simple example implements a basic read-eval-print loop, similar to (but " "less useful than) the standard Python interactive interpreter loop. For a " @@ -616,7 +638,7 @@ msgid "" "`code` module. ::" msgstr "" -#: ../../library/traceback.rst:548 +#: ../../library/traceback.rst:569 msgid "" "import sys, traceback\n" "\n" @@ -635,13 +657,13 @@ msgid "" " run_user_code(envdir)" msgstr "" -#: ../../library/traceback.rst:565 +#: ../../library/traceback.rst:586 msgid "" "The following example demonstrates the different ways to print and format " "the exception and traceback:" msgstr "" -#: ../../library/traceback.rst:568 +#: ../../library/traceback.rst:589 msgid "" "import sys, traceback\n" "\n" @@ -673,11 +695,11 @@ msgid "" " print(\"*** tb_lineno:\", exc.__traceback__.tb_lineno)" msgstr "" -#: ../../library/traceback.rst:599 +#: ../../library/traceback.rst:620 msgid "The output for the example would look similar to this:" msgstr "" -#: ../../library/traceback.rst:601 +#: ../../library/traceback.rst:622 msgid "" "*** print_tb:\n" " File \"\", line 10, in \n" @@ -727,13 +749,13 @@ msgid "" "*** tb_lineno: 10" msgstr "" -#: ../../library/traceback.rst:646 +#: ../../library/traceback.rst:667 msgid "" "The following example shows the different ways to print and format the " "stack::" msgstr "" -#: ../../library/traceback.rst:648 +#: ../../library/traceback.rst:669 msgid "" ">>> import traceback\n" ">>> def another_function():\n" @@ -785,11 +807,11 @@ msgstr "" " ' File \"\", line 8, in lumberstack\\n print(repr(traceback." "format_stack()))\\n']" -#: ../../library/traceback.rst:672 +#: ../../library/traceback.rst:693 msgid "This last example demonstrates the final few formatting functions:" msgstr "" -#: ../../library/traceback.rst:674 +#: ../../library/traceback.rst:695 msgid "" ">>> import traceback\n" ">>> traceback.format_list([('spam.py', 3, '', 'spam.eggs()'),\n" @@ -801,15 +823,15 @@ msgid "" "['IndexError: tuple index out of range\\n']" msgstr "" -#: ../../library/traceback.rst:688 +#: ../../library/traceback.rst:709 msgid "Examples of Using :class:`TracebackException`" msgstr ":class:`TracebackException` 的使用範例" -#: ../../library/traceback.rst:690 +#: ../../library/traceback.rst:711 msgid "With the helper class, we have more options::" msgstr "" -#: ../../library/traceback.rst:692 +#: ../../library/traceback.rst:713 msgid "" ">>> import sys\n" ">>> from traceback import TracebackException\n" diff --git a/library/typing.po b/library/typing.po index 909335de57..08f55eb4af 100644 --- a/library/typing.po +++ b/library/typing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-11 06:16+0000\n" +"POT-Creation-Date: 2025-04-17 00:15+0000\n" "PO-Revision-Date: 2024-07-11 11:12+0800\n" "Last-Translator: Li-Hung Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -110,8 +110,8 @@ msgstr "" "多數 Python 型別檢查器中廣為使用。(某些部分依然是特定給 mypy 使用。)" #: ../../library/typing.rst:56 -msgid "" -"`\"Static Typing with Python\" `_" +#, fuzzy +msgid "`\"Static Typing with Python\" `_" msgstr "" "`\"Python 的靜態型別 (Static Typing)\" `_" @@ -129,10 +129,11 @@ msgid "Specification for the Python Type System" msgstr "Python 型別系統的技術規範" #: ../../library/typing.rst:66 +#, fuzzy msgid "" "The canonical, up-to-date specification of the Python type system can be " "found at `\"Specification for the Python type system\" `_." +"python.org/en/latest/spec/index.html>`_." msgstr "" "關於 Python 型別系統標準的 (canonical)、最新的技術規範可以在\\ `「Python 型別" "系統的技術規範」 `. This would be " -"invalid: only one type should be passed to Annotated." +"where ``T1``, ``T2``, ... are :class:`TypeVars `. This is invalid " +"as only one type should be passed to Annotated." msgstr "" -#: ../../library/typing.rst:1436 +#: ../../library/typing.rst:1422 msgid "" "By default, :func:`get_type_hints` strips the metadata from annotations. " "Pass ``include_extras=True`` to have the metadata preserved:" msgstr "" -#: ../../library/typing.rst:1439 +#: ../../library/typing.rst:1425 msgid "" ">>> from typing import Annotated, get_type_hints\n" ">>> def func(x: Annotated[int, \"metadata\"]) -> None: pass\n" @@ -2362,13 +2330,13 @@ msgstr "" ">>> get_type_hints(func, include_extras=True)\n" "{'x': typing.Annotated[int, 'metadata'], 'return': }" -#: ../../library/typing.rst:1449 +#: ../../library/typing.rst:1435 msgid "" "At runtime, the metadata associated with an ``Annotated`` type can be " "retrieved via the :attr:`!__metadata__` attribute:" msgstr "" -#: ../../library/typing.rst:1452 +#: ../../library/typing.rst:1438 msgid "" ">>> from typing import Annotated\n" ">>> X = Annotated[int, \"very\", \"important\", \"metadata\"]\n" @@ -2384,13 +2352,13 @@ msgstr "" ">>> X.__metadata__\n" "('very', 'important', 'metadata')" -#: ../../library/typing.rst:1461 +#: ../../library/typing.rst:1447 msgid "" -"At runtime, if you want to retrieve the original type wrapped by " -"``Annotated``, use the :attr:`!__origin__` attribute:" +"If you want to retrieve the original type wrapped by ``Annotated``, use the :" +"attr:`!__origin__` attribute:" msgstr "" -#: ../../library/typing.rst:1464 +#: ../../library/typing.rst:1450 msgid "" ">>> from typing import Annotated, get_origin\n" ">>> Password = Annotated[str, \"secret\"]\n" @@ -2402,11 +2370,11 @@ msgstr "" ">>> Password.__origin__\n" "" -#: ../../library/typing.rst:1471 +#: ../../library/typing.rst:1457 msgid "Note that using :func:`get_origin` will return ``Annotated`` itself:" msgstr "" -#: ../../library/typing.rst:1473 +#: ../../library/typing.rst:1459 msgid "" ">>> get_origin(Password)\n" "typing.Annotated" @@ -2414,20 +2382,20 @@ msgstr "" ">>> get_origin(Password)\n" "typing.Annotated" -#: ../../library/typing.rst:1480 +#: ../../library/typing.rst:1466 msgid ":pep:`593` - Flexible function and variable annotations" msgstr "" -#: ../../library/typing.rst:1481 +#: ../../library/typing.rst:1467 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: ../../library/typing.rst:1488 ../../library/typing.rst:1572 +#: ../../library/typing.rst:1474 ../../library/typing.rst:1558 msgid "" "Special typing construct for marking user-defined type predicate functions." msgstr "" -#: ../../library/typing.rst:1490 +#: ../../library/typing.rst:1476 msgid "" "``TypeIs`` can be used to annotate the return type of a user-defined type " "predicate function. ``TypeIs`` only accepts a single type argument. At " @@ -2435,7 +2403,7 @@ msgid "" "one positional argument." msgstr "" -#: ../../library/typing.rst:1495 +#: ../../library/typing.rst:1481 msgid "" "``TypeIs`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " @@ -2445,7 +2413,7 @@ msgid "" "predicate\"::" msgstr "" -#: ../../library/typing.rst:1501 +#: ../../library/typing.rst:1487 msgid "" "def is_str(val: str | float):\n" " # \"isinstance\" type predicate\n" @@ -2457,7 +2425,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1510 +#: ../../library/typing.rst:1496 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " "type predicate. Such a function should use ``TypeIs[...]`` or :data:" @@ -2468,29 +2436,29 @@ msgid "" "does not return ``True`` for all instances of the narrowed type." msgstr "" -#: ../../library/typing.rst:1518 +#: ../../library/typing.rst:1504 msgid "" "Using ``-> TypeIs[NarrowedType]`` tells the static type checker that for a " "given function:" msgstr "" -#: ../../library/typing.rst:1521 ../../library/typing.rst:1582 +#: ../../library/typing.rst:1507 ../../library/typing.rst:1568 msgid "The return value is a boolean." msgstr "" -#: ../../library/typing.rst:1522 +#: ../../library/typing.rst:1508 msgid "" "If the return value is ``True``, the type of its argument is the " "intersection of the argument's original type and ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1524 +#: ../../library/typing.rst:1510 msgid "" "If the return value is ``False``, the type of its argument is narrowed to " "exclude ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1529 +#: ../../library/typing.rst:1515 msgid "" "from typing import assert_type, final, TypeIs\n" "\n" @@ -2514,7 +2482,7 @@ msgid "" " assert_type(arg, Unrelated)" msgstr "" -#: ../../library/typing.rst:1550 +#: ../../library/typing.rst:1536 msgid "" "The type inside ``TypeIs`` must be consistent with the type of the " "function's argument; if it is not, static type checkers will raise an " @@ -2523,27 +2491,27 @@ msgid "" "functions in a type-safe manner." msgstr "" -#: ../../library/typing.rst:1556 +#: ../../library/typing.rst:1542 msgid "" "If a ``TypeIs`` function is a class or instance method, then the type in " "``TypeIs`` maps to the type of the second parameter (after ``cls`` or " "``self``)." msgstr "" -#: ../../library/typing.rst:1560 +#: ../../library/typing.rst:1546 msgid "" "In short, the form ``def foo(arg: TypeA) -> TypeIs[TypeB]: ...``, means that " "if ``foo(arg)`` returns ``True``, then ``arg`` is an instance of ``TypeB``, " "and if it returns ``False``, it is not an instance of ``TypeB``." msgstr "" -#: ../../library/typing.rst:1564 +#: ../../library/typing.rst:1550 msgid "" "``TypeIs`` also works with type variables. For more information, see :pep:" "`742` (Narrowing types with ``TypeIs``)." msgstr "" -#: ../../library/typing.rst:1574 +#: ../../library/typing.rst:1560 msgid "" "Type predicate functions are user-defined functions that return whether " "their argument is an instance of a particular type. ``TypeGuard`` works " @@ -2551,25 +2519,25 @@ msgid "" "checking behavior (see below)." msgstr "" -#: ../../library/typing.rst:1579 +#: ../../library/typing.rst:1565 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" -#: ../../library/typing.rst:1583 +#: ../../library/typing.rst:1569 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1586 +#: ../../library/typing.rst:1572 msgid "" "``TypeGuard`` also works with type variables. See :pep:`647` for more " "details." msgstr "" -#: ../../library/typing.rst:1590 +#: ../../library/typing.rst:1576 msgid "" "def is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n" " '''Determines whether all objects in the list are strings'''\n" @@ -2584,11 +2552,11 @@ msgid "" " print(\"Not a list of strings!\")" msgstr "" -#: ../../library/typing.rst:1602 +#: ../../library/typing.rst:1588 msgid "``TypeIs`` and ``TypeGuard`` differ in the following ways:" msgstr "" -#: ../../library/typing.rst:1604 +#: ../../library/typing.rst:1590 msgid "" "``TypeIs`` requires the narrowed type to be a subtype of the input type, " "while ``TypeGuard`` does not. The main reason is to allow for things like " @@ -2596,7 +2564,7 @@ msgid "" "subtype of the former, since ``list`` is invariant." msgstr "" -#: ../../library/typing.rst:1608 +#: ../../library/typing.rst:1594 msgid "" "When a ``TypeGuard`` function returns ``True``, type checkers narrow the " "type of the variable to exactly the ``TypeGuard`` type. When a ``TypeIs`` " @@ -2605,7 +2573,7 @@ msgid "" "type. (Technically, this is known as an intersection type.)" msgstr "" -#: ../../library/typing.rst:1612 +#: ../../library/typing.rst:1598 msgid "" "When a ``TypeGuard`` function returns ``False``, type checkers cannot narrow " "the type of the variable at all. When a ``TypeIs`` function returns " @@ -2613,18 +2581,18 @@ msgid "" "``TypeIs`` type." msgstr "" -#: ../../library/typing.rst:1621 +#: ../../library/typing.rst:1607 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: ../../library/typing.rst:1623 +#: ../../library/typing.rst:1609 msgid "" "For example, using the unpack operator ``*`` on a :ref:`type variable tuple " "` is equivalent to using ``Unpack`` to mark the type variable " "tuple as having been unpacked::" msgstr "" -#: ../../library/typing.rst:1627 +#: ../../library/typing.rst:1613 msgid "" "Ts = TypeVarTuple('Ts')\n" "tup: tuple[*Ts]\n" @@ -2632,7 +2600,7 @@ msgid "" "tup: tuple[Unpack[Ts]]" msgstr "" -#: ../../library/typing.rst:1632 +#: ../../library/typing.rst:1618 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -2640,7 +2608,7 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: ../../library/typing.rst:1638 +#: ../../library/typing.rst:1624 msgid "" "# In older versions of Python, TypeVarTuple and Unpack\n" "# are located in the `typing_extensions` backports package.\n" @@ -2651,13 +2619,13 @@ msgid "" "tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible" msgstr "" -#: ../../library/typing.rst:1646 +#: ../../library/typing.rst:1632 msgid "" "``Unpack`` can also be used along with :class:`typing.TypedDict` for typing " "``**kwargs`` in a function signature::" msgstr "" -#: ../../library/typing.rst:1649 +#: ../../library/typing.rst:1635 msgid "" "from typing import TypedDict, Unpack\n" "\n" @@ -2670,23 +2638,23 @@ msgid "" "def foo(**kwargs: Unpack[Movie]): ..." msgstr "" -#: ../../library/typing.rst:1659 +#: ../../library/typing.rst:1645 msgid "" "See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing." msgstr "" -#: ../../library/typing.rst:1664 +#: ../../library/typing.rst:1650 msgid "Building generic types and type aliases" msgstr "" -#: ../../library/typing.rst:1666 +#: ../../library/typing.rst:1652 msgid "" "The following classes should not be used directly as annotations. Their " "intended purpose is to be building blocks for creating generic types and " "type aliases." msgstr "" -#: ../../library/typing.rst:1670 +#: ../../library/typing.rst:1656 msgid "" "These objects can be created through special syntax (:ref:`type parameter " "lists ` and the :keyword:`type` statement). For compatibility " @@ -2694,17 +2662,17 @@ msgid "" "syntax, as documented below." msgstr "" -#: ../../library/typing.rst:1677 +#: ../../library/typing.rst:1663 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1679 +#: ../../library/typing.rst:1665 msgid "" "A generic type is typically declared by adding a list of type parameters " "after the class name::" msgstr "" -#: ../../library/typing.rst:1682 +#: ../../library/typing.rst:1668 msgid "" "class Mapping[KT, VT]:\n" " def __getitem__(self, key: KT) -> VT:\n" @@ -2712,17 +2680,17 @@ msgid "" " # Etc." msgstr "" -#: ../../library/typing.rst:1687 +#: ../../library/typing.rst:1673 msgid "" "Such a class implicitly inherits from ``Generic``. The runtime semantics of " "this syntax are discussed in the :ref:`Language Reference `." msgstr "" -#: ../../library/typing.rst:1691 +#: ../../library/typing.rst:1677 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1693 +#: ../../library/typing.rst:1679 msgid "" "def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\n" " try:\n" @@ -2736,20 +2704,20 @@ msgstr "" " except KeyError:\n" " return default" -#: ../../library/typing.rst:1699 +#: ../../library/typing.rst:1685 msgid "" "Here the brackets after the function name indicate a :ref:`generic function " "`." msgstr "" -#: ../../library/typing.rst:1702 +#: ../../library/typing.rst:1688 msgid "" "For backwards compatibility, generic classes can also be declared by " "explicitly inheriting from ``Generic``. In this case, the type parameters " "must be declared separately::" msgstr "" -#: ../../library/typing.rst:1707 +#: ../../library/typing.rst:1693 msgid "" "KT = TypeVar('KT')\n" "VT = TypeVar('VT')\n" @@ -2767,18 +2735,18 @@ msgstr "" " ...\n" " # Etc." -#: ../../library/typing.rst:1719 +#: ../../library/typing.rst:1705 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1721 +#: ../../library/typing.rst:1707 msgid "" "The preferred way to construct a type variable is via the dedicated syntax " "for :ref:`generic functions `, :ref:`generic classes " "`, and :ref:`generic type aliases `::" msgstr "" -#: ../../library/typing.rst:1726 +#: ../../library/typing.rst:1712 msgid "" "class Sequence[T]: # T is a TypeVar\n" " ..." @@ -2786,13 +2754,13 @@ msgstr "" "class Sequence[T]: # T 是一個 TypeVar\n" " ..." -#: ../../library/typing.rst:1729 +#: ../../library/typing.rst:1715 msgid "" "This syntax can also be used to create bounded and constrained type " "variables::" msgstr "" -#: ../../library/typing.rst:1732 +#: ../../library/typing.rst:1718 msgid "" "class StrSequence[S: str]: # S is a TypeVar with a `str` upper bound;\n" " ... # we can say that S is \"bounded by `str`\"\n" @@ -2803,20 +2771,20 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1739 +#: ../../library/typing.rst:1725 msgid "" "However, if desired, reusable type variables can also be constructed " "manually, like so::" msgstr "" -#: ../../library/typing.rst:1741 +#: ../../library/typing.rst:1727 msgid "" "T = TypeVar('T') # Can be anything\n" "S = TypeVar('S', bound=str) # Can be any subtype of str\n" "A = TypeVar('A', str, bytes) # Must be exactly str or bytes" msgstr "" -#: ../../library/typing.rst:1745 +#: ../../library/typing.rst:1731 msgid "" "Type variables exist primarily for the benefit of static type checkers. " "They serve as the parameters for generic types as well as for generic " @@ -2824,7 +2792,7 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1751 +#: ../../library/typing.rst:1737 msgid "" "def repeat[T](x: T, n: int) -> Sequence[T]:\n" " \"\"\"Return a list containing n references to x.\"\"\"\n" @@ -2842,13 +2810,13 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:1766 +#: ../../library/typing.rst:1752 msgid "" "Note that type variables can be *bounded*, *constrained*, or neither, but " "cannot be both bounded *and* constrained." msgstr "" -#: ../../library/typing.rst:1769 +#: ../../library/typing.rst:1755 msgid "" "The variance of type variables is inferred by type checkers when they are " "created through the :ref:`type parameter syntax ` or when " @@ -2858,14 +2826,14 @@ msgid "" "invariant. See :pep:`484` and :pep:`695` for more details." msgstr "" -#: ../../library/typing.rst:1777 +#: ../../library/typing.rst:1763 msgid "" "Bounded type variables and constrained type variables have different " "semantics in several important ways. Using a *bounded* type variable means " "that the ``TypeVar`` will be solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1781 +#: ../../library/typing.rst:1767 msgid "" "x = print_capitalized('a string')\n" "reveal_type(x) # revealed type is str\n" @@ -2879,13 +2847,13 @@ msgid "" "z = print_capitalized(45) # error: int is not a subtype of str" msgstr "" -#: ../../library/typing.rst:1792 +#: ../../library/typing.rst:1778 msgid "" "The upper bound of a type variable can be a concrete type, abstract type " "(ABC or Protocol), or even a union of types::" msgstr "" -#: ../../library/typing.rst:1795 +#: ../../library/typing.rst:1781 msgid "" "# Can be anything with an __abs__ method\n" "def print_abs[T: SupportsAbs](arg: T) -> None:\n" @@ -2896,13 +2864,13 @@ msgid "" "V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method" msgstr "" -#: ../../library/typing.rst:1804 +#: ../../library/typing.rst:1790 msgid "" "Using a *constrained* type variable, however, means that the ``TypeVar`` can " "only ever be solved as being exactly one of the constraints given::" msgstr "" -#: ../../library/typing.rst:1807 +#: ../../library/typing.rst:1793 msgid "" "a = concatenate('one', 'two')\n" "reveal_type(a) # revealed type is str\n" @@ -2915,56 +2883,56 @@ msgid "" "or bytes in a function call, but not both" msgstr "" -#: ../../library/typing.rst:1815 +#: ../../library/typing.rst:1801 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." msgstr "" -#: ../../library/typing.rst:1819 +#: ../../library/typing.rst:1805 msgid "The name of the type variable." msgstr "" -#: ../../library/typing.rst:1823 +#: ../../library/typing.rst:1809 msgid "Whether the type var has been explicitly marked as covariant." msgstr "" -#: ../../library/typing.rst:1827 +#: ../../library/typing.rst:1813 msgid "Whether the type var has been explicitly marked as contravariant." msgstr "" -#: ../../library/typing.rst:1831 +#: ../../library/typing.rst:1817 msgid "" "Whether the type variable's variance should be inferred by type checkers." msgstr "" -#: ../../library/typing.rst:1837 +#: ../../library/typing.rst:1823 msgid "The upper bound of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1841 +#: ../../library/typing.rst:1827 msgid "" "For type variables created through :ref:`type parameter syntax `, the bound is evaluated only when the attribute is accessed, not " "when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1847 +#: ../../library/typing.rst:1833 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1851 +#: ../../library/typing.rst:1837 msgid "" "For type variables created through :ref:`type parameter syntax `, the constraints are evaluated only when the attribute is accessed, " "not when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1857 +#: ../../library/typing.rst:1843 msgid "" "The default value of the type variable, or :data:`typing.NoDefault` if it " "has no default." msgstr "" -#: ../../library/typing.rst:1864 +#: ../../library/typing.rst:1850 msgid "" "Return whether or not the type variable has a default value. This is " "equivalent to checking whether :attr:`__default__` is not the :data:`typing." @@ -2972,31 +2940,31 @@ msgid "" "`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:1873 +#: ../../library/typing.rst:1859 msgid "" "Type variables can now be declared using the :ref:`type parameter ` syntax introduced by :pep:`695`. The ``infer_variance`` parameter " "was added." msgstr "" -#: ../../library/typing.rst:1879 ../../library/typing.rst:2018 -#: ../../library/typing.rst:2120 +#: ../../library/typing.rst:1865 ../../library/typing.rst:2004 +#: ../../library/typing.rst:2106 msgid "Support for default values was added." msgstr "" -#: ../../library/typing.rst:1885 +#: ../../library/typing.rst:1871 msgid "" "Type variable tuple. A specialized form of :ref:`type variable ` " "that enables *variadic* generics." msgstr "" -#: ../../library/typing.rst:1888 +#: ../../library/typing.rst:1874 msgid "" "Type variable tuples can be declared in :ref:`type parameter lists ` using a single asterisk (``*``) before the name::" msgstr "" -#: ../../library/typing.rst:1891 +#: ../../library/typing.rst:1877 msgid "" "def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, " "T]:\n" @@ -3006,11 +2974,11 @@ msgstr "" "T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1894 +#: ../../library/typing.rst:1880 msgid "Or by explicitly invoking the ``TypeVarTuple`` constructor::" msgstr "" -#: ../../library/typing.rst:1896 +#: ../../library/typing.rst:1882 msgid "" "T = TypeVar(\"T\")\n" "Ts = TypeVarTuple(\"Ts\")\n" @@ -3024,7 +2992,7 @@ msgstr "" "def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1902 +#: ../../library/typing.rst:1888 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -3032,7 +3000,7 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: ../../library/typing.rst:1907 +#: ../../library/typing.rst:1893 msgid "" "# T is bound to int, Ts is bound to ()\n" "# Return value is (1,), which has type tuple[int]\n" @@ -3052,7 +3020,7 @@ msgid "" "move_first_element_to_last(tup=())" msgstr "" -#: ../../library/typing.rst:1924 +#: ../../library/typing.rst:1910 msgid "" "Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. " "Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, " @@ -3062,26 +3030,26 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: ../../library/typing.rst:1932 +#: ../../library/typing.rst:1918 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: ../../library/typing.rst:1935 +#: ../../library/typing.rst:1921 msgid "" "x: Ts # Not valid\n" "x: tuple[Ts] # Not valid\n" "x: tuple[*Ts] # The correct way to do it" msgstr "" -#: ../../library/typing.rst:1939 +#: ../../library/typing.rst:1925 msgid "" "Type variable tuples can be used in the same contexts as normal type " "variables. For example, in class definitions, arguments, and return types::" msgstr "" -#: ../../library/typing.rst:1942 +#: ../../library/typing.rst:1928 msgid "" "class Array[*Shape]:\n" " def __getitem__(self, key: tuple[*Shape]) -> float: ...\n" @@ -3093,12 +3061,12 @@ msgstr "" " def __abs__(self) -> \"Array[*Shape]\": ...\n" " def get_shape(self) -> tuple[*Shape]: ..." -#: ../../library/typing.rst:1947 +#: ../../library/typing.rst:1933 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: ../../library/typing.rst:1949 +#: ../../library/typing.rst:1935 msgid "" "class Array[DType, *Shape]: # This is fine\n" " pass\n" @@ -3113,26 +3081,26 @@ msgid "" "int_array_2d: Array[int, Height, Width] = Array() # Yup, fine too" msgstr "" -#: ../../library/typing.rst:1963 +#: ../../library/typing.rst:1949 msgid "" "However, note that at most one type variable tuple may appear in a single " "list of type arguments or type parameters::" msgstr "" -#: ../../library/typing.rst:1966 +#: ../../library/typing.rst:1952 msgid "" "x: tuple[*Ts, *Ts] # Not valid\n" "class Array[*Shape, *Shape]: # Not valid\n" " pass" msgstr "" -#: ../../library/typing.rst:1970 +#: ../../library/typing.rst:1956 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: ../../library/typing.rst:1973 +#: ../../library/typing.rst:1959 msgid "" "def call_soon[*Ts](\n" " callback: Callable[[*Ts], None],\n" @@ -3148,7 +3116,7 @@ msgstr "" " ...\n" " callback(*args)" -#: ../../library/typing.rst:1980 +#: ../../library/typing.rst:1966 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -3157,21 +3125,21 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: ../../library/typing.rst:1987 +#: ../../library/typing.rst:1973 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: ../../library/typing.rst:1991 +#: ../../library/typing.rst:1977 msgid "The name of the type variable tuple." msgstr "" -#: ../../library/typing.rst:1995 +#: ../../library/typing.rst:1981 msgid "" "The default value of the type variable tuple, or :data:`typing.NoDefault` if " "it has no default." msgstr "" -#: ../../library/typing.rst:2002 +#: ../../library/typing.rst:1988 msgid "" "Return whether or not the type variable tuple has a default value. This is " "equivalent to checking whether :attr:`__default__` is not the :data:`typing." @@ -3179,39 +3147,39 @@ msgid "" "`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2013 +#: ../../library/typing.rst:1999 msgid "" "Type variable tuples can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2022 +#: ../../library/typing.rst:2008 msgid "" "Parameter specification variable. A specialized version of :ref:`type " "variables `." msgstr "" -#: ../../library/typing.rst:2025 +#: ../../library/typing.rst:2011 msgid "" "In :ref:`type parameter lists `, parameter specifications can " "be declared with two asterisks (``**``)::" msgstr "" -#: ../../library/typing.rst:2028 +#: ../../library/typing.rst:2014 msgid "type IntFunc[**P] = Callable[P, int]" msgstr "type IntFunc[**P] = Callable[P, int]" -#: ../../library/typing.rst:2030 +#: ../../library/typing.rst:2016 msgid "" "For compatibility with Python 3.11 and earlier, ``ParamSpec`` objects can " "also be created as follows::" msgstr "" -#: ../../library/typing.rst:2033 +#: ../../library/typing.rst:2019 msgid "P = ParamSpec('P')" msgstr "P = ParamSpec('P')" -#: ../../library/typing.rst:2035 +#: ../../library/typing.rst:2021 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -3221,7 +3189,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:2042 +#: ../../library/typing.rst:2028 msgid "" "For example, to add basic logging to a function, one can create a decorator " "``add_logging`` to log function calls. The parameter specification variable " @@ -3229,7 +3197,7 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:2047 +#: ../../library/typing.rst:2033 msgid "" "from collections.abc import Callable\n" "import logging\n" @@ -3247,27 +3215,27 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:2062 +#: ../../library/typing.rst:2048 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with upper bound ``Callable[..., Any]``. However " "this causes two problems:" msgstr "" -#: ../../library/typing.rst:2066 +#: ../../library/typing.rst:2052 msgid "" "The type checker can't type check the ``inner`` function because ``*args`` " "and ``**kwargs`` have to be typed :data:`Any`." msgstr "" -#: ../../library/typing.rst:2068 +#: ../../library/typing.rst:2054 msgid "" ":func:`~cast` may be required in the body of the ``add_logging`` decorator " "when returning the ``inner`` function, or the static type checker must be " "told to ignore the ``return inner``." msgstr "" -#: ../../library/typing.rst:2075 +#: ../../library/typing.rst:2061 msgid "" "Since ``ParamSpec`` captures both positional and keyword parameters, ``P." "args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " @@ -3280,17 +3248,17 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:2087 +#: ../../library/typing.rst:2073 msgid "The name of the parameter specification." msgstr "" -#: ../../library/typing.rst:2091 +#: ../../library/typing.rst:2077 msgid "" "The default value of the parameter specification, or :data:`typing." "NoDefault` if it has no default." msgstr "" -#: ../../library/typing.rst:2098 +#: ../../library/typing.rst:2084 msgid "" "Return whether or not the parameter specification has a default value. This " "is equivalent to checking whether :attr:`__default__` is not the :data:" @@ -3298,7 +3266,7 @@ msgid "" "the :ref:`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2105 +#: ../../library/typing.rst:2091 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -3307,23 +3275,23 @@ msgid "" "decided." msgstr "" -#: ../../library/typing.rst:2115 +#: ../../library/typing.rst:2101 msgid "" "Parameter specifications can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2123 +#: ../../library/typing.rst:2109 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:2129 +#: ../../library/typing.rst:2115 msgid ":data:`Concatenate`" msgstr ":data:`Concatenate`" -#: ../../library/typing.rst:2135 +#: ../../library/typing.rst:2121 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " @@ -3331,13 +3299,13 @@ msgid "" "runtime introspection and have no special meaning to static type checkers." msgstr "" -#: ../../library/typing.rst:2140 +#: ../../library/typing.rst:2126 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: ../../library/typing.rst:2143 +#: ../../library/typing.rst:2129 msgid "" ">>> from typing import ParamSpec, get_origin\n" ">>> P = ParamSpec(\"P\")\n" @@ -3353,11 +3321,11 @@ msgstr "" ">>> get_origin(P.kwargs) is P\n" "True" -#: ../../library/typing.rst:2157 +#: ../../library/typing.rst:2143 msgid "The type of type aliases created through the :keyword:`type` statement." msgstr "" -#: ../../library/typing.rst:2161 +#: ../../library/typing.rst:2147 msgid "" ">>> type Alias = int\n" ">>> type(Alias)\n" @@ -3367,11 +3335,11 @@ msgstr "" ">>> type(Alias)\n" "" -#: ../../library/typing.rst:2171 +#: ../../library/typing.rst:2157 msgid "The name of the type alias:" msgstr "" -#: ../../library/typing.rst:2173 +#: ../../library/typing.rst:2159 msgid "" ">>> type Alias = int\n" ">>> Alias.__name__\n" @@ -3381,11 +3349,11 @@ msgstr "" ">>> Alias.__name__\n" "'Alias'" -#: ../../library/typing.rst:2181 +#: ../../library/typing.rst:2167 msgid "The module in which the type alias was defined::" msgstr "" -#: ../../library/typing.rst:2183 +#: ../../library/typing.rst:2169 msgid "" ">>> type Alias = int\n" ">>> Alias.__module__\n" @@ -3395,13 +3363,13 @@ msgstr "" ">>> Alias.__module__\n" "'__main__'" -#: ../../library/typing.rst:2189 +#: ../../library/typing.rst:2175 msgid "" "The type parameters of the type alias, or an empty tuple if the alias is not " "generic:" msgstr "" -#: ../../library/typing.rst:2192 +#: ../../library/typing.rst:2178 msgid "" ">>> type ListOrSet[T] = list[T] | set[T]\n" ">>> ListOrSet.__type_params__\n" @@ -3417,14 +3385,14 @@ msgstr "" ">>> NotGeneric.__type_params__\n" "()" -#: ../../library/typing.rst:2203 +#: ../../library/typing.rst:2189 msgid "" "The type alias's value. This is :ref:`lazily evaluated `, " "so names used in the definition of the alias are not resolved until the " "``__value__`` attribute is accessed:" msgstr "" -#: ../../library/typing.rst:2207 +#: ../../library/typing.rst:2193 msgid "" ">>> type Mutually = Recursive\n" ">>> type Recursive = Mutually\n" @@ -3448,27 +3416,27 @@ msgstr "" ">>> Recursive.__value__\n" "Mutually" -#: ../../library/typing.rst:2221 +#: ../../library/typing.rst:2207 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:2223 +#: ../../library/typing.rst:2209 msgid "" "These functions and classes should not be used directly as annotations. " "Their intended purpose is to be building blocks for creating and declaring " "types." msgstr "" -#: ../../library/typing.rst:2229 +#: ../../library/typing.rst:2215 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:2231 ../../library/typing.rst:2323 -#: ../../library/typing.rst:3364 +#: ../../library/typing.rst:2217 ../../library/typing.rst:2309 +#: ../../library/typing.rst:3357 msgid "Usage::" msgstr "" -#: ../../library/typing.rst:2233 +#: ../../library/typing.rst:2219 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3478,20 +3446,20 @@ msgstr "" " name: str\n" " id: int" -#: ../../library/typing.rst:2237 +#: ../../library/typing.rst:2223 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../library/typing.rst:2239 +#: ../../library/typing.rst:2225 msgid "Employee = collections.namedtuple('Employee', ['name', 'id'])" msgstr "Employee = collections.namedtuple('Employee', ['name', 'id'])" -#: ../../library/typing.rst:2241 +#: ../../library/typing.rst:2227 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:2243 +#: ../../library/typing.rst:2229 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3507,12 +3475,12 @@ msgstr "" "employee = Employee('Guido')\n" "assert employee.id == 3" -#: ../../library/typing.rst:2250 +#: ../../library/typing.rst:2236 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:2252 +#: ../../library/typing.rst:2238 msgid "" "The resulting class has an extra attribute ``__annotations__`` giving a dict " "that maps the field names to the field types. (The field names are in the " @@ -3521,11 +3489,11 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:2258 +#: ../../library/typing.rst:2244 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:2260 +#: ../../library/typing.rst:2246 msgid "" "class Employee(NamedTuple):\n" " \"\"\"Represents an employee.\"\"\"\n" @@ -3536,11 +3504,11 @@ msgid "" " return f''" msgstr "" -#: ../../library/typing.rst:2268 +#: ../../library/typing.rst:2254 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: ../../library/typing.rst:2270 +#: ../../library/typing.rst:2256 msgid "" "class Group[T](NamedTuple):\n" " key: T\n" @@ -3550,11 +3518,11 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2274 +#: ../../library/typing.rst:2260 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:2276 +#: ../../library/typing.rst:2262 msgid "" "# For creating a generic NamedTuple on Python 3.11\n" "T = TypeVar(\"T\")\n" @@ -3567,38 +3535,38 @@ msgid "" "Employee = NamedTuple('Employee', [('name', str), ('id', int)])" msgstr "" -#: ../../library/typing.rst:2286 +#: ../../library/typing.rst:2272 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:2289 +#: ../../library/typing.rst:2275 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:2292 +#: ../../library/typing.rst:2278 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:2296 +#: ../../library/typing.rst:2282 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:2300 +#: ../../library/typing.rst:2286 msgid "Added support for generic namedtuples." msgstr "" -#: ../../library/typing.rst:2303 +#: ../../library/typing.rst:2289 msgid "" "The undocumented keyword argument syntax for creating NamedTuple classes " "(``NT = NamedTuple(\"NT\", x=int)``) is deprecated, and will be disallowed " "in 3.15. Use the class-based syntax or the functional syntax instead." msgstr "" -#: ../../library/typing.rst:2308 +#: ../../library/typing.rst:2294 msgid "" "When using the functional syntax to create a NamedTuple class, failing to " "pass a value to the 'fields' parameter (``NT = NamedTuple(\"NT\")``) is " @@ -3608,48 +3576,48 @@ msgid "" "NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", [])``." msgstr "" -#: ../../library/typing.rst:2318 +#: ../../library/typing.rst:2304 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: ../../library/typing.rst:2320 +#: ../../library/typing.rst:2306 msgid "" "A ``NewType`` is considered a distinct type by a typechecker. At runtime, " "however, calling a ``NewType`` returns its argument unchanged." msgstr "" -#: ../../library/typing.rst:2325 +#: ../../library/typing.rst:2311 msgid "" "UserId = NewType('UserId', int) # Declare the NewType \"UserId\"\n" "first_user = UserId(1) # \"UserId\" returns the argument unchanged at " "runtime" msgstr "" -#: ../../library/typing.rst:2330 +#: ../../library/typing.rst:2316 msgid "The module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:2334 +#: ../../library/typing.rst:2320 msgid "The name of the new type." msgstr "" -#: ../../library/typing.rst:2338 +#: ../../library/typing.rst:2324 msgid "The type that the new type is based on." msgstr "" -#: ../../library/typing.rst:2342 +#: ../../library/typing.rst:2328 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:2347 +#: ../../library/typing.rst:2333 msgid "Base class for protocol classes." msgstr "" -#: ../../library/typing.rst:2349 +#: ../../library/typing.rst:2335 msgid "Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:2351 +#: ../../library/typing.rst:2337 msgid "" "class Proto(Protocol):\n" " def meth(self) -> int:\n" @@ -3659,13 +3627,13 @@ msgstr "" " def meth(self) -> int:\n" " ..." -#: ../../library/typing.rst:2355 +#: ../../library/typing.rst:2341 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:2358 +#: ../../library/typing.rst:2344 msgid "" "class C:\n" " def meth(self) -> int:\n" @@ -3677,19 +3645,20 @@ msgid "" "func(C()) # Passes static type check" msgstr "" -#: ../../library/typing.rst:2367 +#: ../../library/typing.rst:2353 msgid "" "See :pep:`544` for more details. Protocol classes decorated with :func:" "`runtime_checkable` (described later) act as simple-minded runtime protocols " "that check only the presence of given attributes, ignoring their type " -"signatures." +"signatures. Protocol classes without this decorator cannot be used as the " +"second argument to :func:`isinstance` or :func:`issubclass`." msgstr "" -#: ../../library/typing.rst:2372 +#: ../../library/typing.rst:2359 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:2374 +#: ../../library/typing.rst:2361 msgid "" "class GenProto[T](Protocol):\n" " def meth(self) -> T:\n" @@ -3699,13 +3668,13 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2378 +#: ../../library/typing.rst:2365 msgid "" "In code that needs to be compatible with Python 3.11 or older, generic " "Protocols can be written as follows::" msgstr "" -#: ../../library/typing.rst:2381 +#: ../../library/typing.rst:2368 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -3719,20 +3688,19 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2391 +#: ../../library/typing.rst:2378 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:2393 +#: ../../library/typing.rst:2380 msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " -"This raises :exc:`TypeError` when applied to a non-protocol class. This " -"allows a simple-minded structural check, very similar to \"one trick " +"This allows a simple-minded structural check, very similar to \"one trick " "ponies\" in :mod:`collections.abc` such as :class:`~collections.abc." "Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:2398 +#: ../../library/typing.rst:2384 msgid "" "@runtime_checkable\n" "class Closable(Protocol):\n" @@ -3760,7 +3728,12 @@ msgstr "" "import threading\n" "assert isinstance(threading.Thread(name='Bob'), Named)" -#: ../../library/typing.rst:2413 +#: ../../library/typing.rst:2397 +msgid "" +"This decorator raises :exc:`TypeError` when applied to a non-protocol class." +msgstr "" + +#: ../../library/typing.rst:2401 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " "methods or attributes, not their type signatures or types. For example, :" @@ -3771,7 +3744,7 @@ msgid "" "(instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:2424 +#: ../../library/typing.rst:2412 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -3779,7 +3752,7 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: ../../library/typing.rst:2432 +#: ../../library/typing.rst:2420 msgid "" "The internal implementation of :func:`isinstance` checks against runtime-" "checkable protocols now uses :func:`inspect.getattr_static` to look up " @@ -3789,7 +3762,7 @@ msgid "" "versa. Most users are unlikely to be affected by this change." msgstr "" -#: ../../library/typing.rst:2441 +#: ../../library/typing.rst:2429 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " @@ -3798,13 +3771,13 @@ msgid "" "`\"What's new in Python 3.12\" ` for more details." msgstr "" -#: ../../library/typing.rst:2452 +#: ../../library/typing.rst:2440 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:2455 +#: ../../library/typing.rst:2443 msgid "" "``TypedDict`` declares a dictionary type that expects all of its instances " "to have a certain set of keys, where each key is associated with a value of " @@ -3812,7 +3785,7 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:2461 +#: ../../library/typing.rst:2449 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3825,41 +3798,46 @@ msgid "" "assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" msgstr "" -#: ../../library/typing.rst:2471 +#: ../../library/typing.rst:2459 msgid "" "An alternative way to create a ``TypedDict`` is by using function-call " "syntax. The second argument must be a literal :class:`dict`::" msgstr "" -#: ../../library/typing.rst:2474 +#: ../../library/typing.rst:2462 msgid "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" msgstr "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" -#: ../../library/typing.rst:2476 +#: ../../library/typing.rst:2464 msgid "" "This functional syntax allows defining keys which are not valid :ref:" "`identifiers `, for example because they are keywords or " -"contain hyphens::" +"contain hyphens, or when key names must not be :ref:`mangled ` like regular private names::" msgstr "" -#: ../../library/typing.rst:2480 +#: ../../library/typing.rst:2469 msgid "" "# raises SyntaxError\n" "class Point2D(TypedDict):\n" " in: int # 'in' is a keyword\n" " x-y: int # name with hyphens\n" "\n" +"class Definition(TypedDict):\n" +" __schema: str # mangled to `_Definition__schema`\n" +"\n" "# OK, functional syntax\n" -"Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})" +"Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})\n" +"Definition = TypedDict('Definition', {'__schema': str}) # not mangled" msgstr "" -#: ../../library/typing.rst:2488 +#: ../../library/typing.rst:2481 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "mark individual keys as non-required using :data:`NotRequired`::" msgstr "" -#: ../../library/typing.rst:2491 +#: ../../library/typing.rst:2484 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3871,19 +3849,19 @@ msgid "" "NotRequired[str]})" msgstr "" -#: ../../library/typing.rst:2499 +#: ../../library/typing.rst:2492 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: ../../library/typing.rst:2502 +#: ../../library/typing.rst:2495 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:2505 +#: ../../library/typing.rst:2498 msgid "" "class Point2D(TypedDict, total=False):\n" " x: int\n" @@ -3893,7 +3871,7 @@ msgid "" "Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" msgstr "" -#: ../../library/typing.rst:2512 +#: ../../library/typing.rst:2505 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have any of the keys " "omitted. A type checker is only expected to support a literal ``False`` or " @@ -3901,13 +3879,13 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:2517 +#: ../../library/typing.rst:2510 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: ../../library/typing.rst:2520 +#: ../../library/typing.rst:2513 msgid "" "class Point2D(TypedDict, total=False):\n" " x: Required[int]\n" @@ -3922,13 +3900,13 @@ msgid "" "}, total=False)" msgstr "" -#: ../../library/typing.rst:2532 +#: ../../library/typing.rst:2525 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" -#: ../../library/typing.rst:2536 +#: ../../library/typing.rst:2529 msgid "" "class Point3D(Point2D):\n" " z: int" @@ -3936,13 +3914,13 @@ msgstr "" "class Point3D(Point2D):\n" " z: int" -#: ../../library/typing.rst:2539 +#: ../../library/typing.rst:2532 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:2542 +#: ../../library/typing.rst:2535 msgid "" "class Point3D(TypedDict):\n" " x: int\n" @@ -3954,13 +3932,13 @@ msgstr "" " y: int\n" " z: int" -#: ../../library/typing.rst:2547 +#: ../../library/typing.rst:2540 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:2550 +#: ../../library/typing.rst:2543 msgid "" "class X(TypedDict):\n" " x: int\n" @@ -3975,11 +3953,11 @@ msgid "" "class XZ(X, Z): pass # raises TypeError" msgstr "" -#: ../../library/typing.rst:2562 +#: ../../library/typing.rst:2555 msgid "A ``TypedDict`` can be generic::" msgstr "" -#: ../../library/typing.rst:2564 +#: ../../library/typing.rst:2557 msgid "" "class Group[T](TypedDict):\n" " key: T\n" @@ -3989,13 +3967,13 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2568 +#: ../../library/typing.rst:2561 msgid "" "To create a generic ``TypedDict`` that is compatible with Python 3.11 or " "lower, inherit from :class:`Generic` explicitly:" msgstr "" -#: ../../library/typing.rst:2571 +#: ../../library/typing.rst:2564 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -4009,19 +3987,19 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2579 +#: ../../library/typing.rst:2572 msgid "" "A ``TypedDict`` can be introspected via annotations dicts (see :ref:" "`annotations-howto` for more information on annotations best practices), :" "attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." msgstr "" -#: ../../library/typing.rst:2585 +#: ../../library/typing.rst:2578 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: ../../library/typing.rst:2588 +#: ../../library/typing.rst:2581 msgid "" ">>> from typing import TypedDict\n" ">>> class Point2D(TypedDict): pass\n" @@ -4045,7 +4023,7 @@ msgstr "" ">>> Point3D.__total__\n" "True" -#: ../../library/typing.rst:2601 +#: ../../library/typing.rst:2594 msgid "" "This attribute reflects *only* the value of the ``total`` argument to the " "current ``TypedDict`` class, not whether the class is semantically total. " @@ -4056,21 +4034,21 @@ msgid "" "introspection." msgstr "" -#: ../../library/typing.rst:2614 +#: ../../library/typing.rst:2607 msgid "" "``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" "class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: ../../library/typing.rst:2617 +#: ../../library/typing.rst:2610 msgid "" "Keys marked with :data:`Required` will always appear in " "``__required_keys__`` and keys marked with :data:`NotRequired` will always " "appear in ``__optional_keys__``." msgstr "" -#: ../../library/typing.rst:2620 +#: ../../library/typing.rst:2613 msgid "" "For backwards compatibility with Python 3.10 and below, it is also possible " "to use inheritance to declare both required and non-required keys in the " @@ -4079,7 +4057,7 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2627 +#: ../../library/typing.rst:2620 msgid "" ">>> class Point2D(TypedDict, total=False):\n" "... x: int\n" @@ -4105,7 +4083,7 @@ msgstr "" ">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" "True" -#: ../../library/typing.rst:2645 +#: ../../library/typing.rst:2638 msgid "" "If ``from __future__ import annotations`` is used or if annotations are " "given as strings, annotations are not evaluated when the ``TypedDict`` is " @@ -4114,48 +4092,48 @@ msgid "" "attributes may be incorrect." msgstr "" -#: ../../library/typing.rst:2651 +#: ../../library/typing.rst:2644 msgid "Support for :data:`ReadOnly` is reflected in the following attributes:" msgstr "" -#: ../../library/typing.rst:2655 +#: ../../library/typing.rst:2648 msgid "" "A :class:`frozenset` containing the names of all read-only keys. Keys are " "read-only if they carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2662 +#: ../../library/typing.rst:2655 msgid "" "A :class:`frozenset` containing the names of all mutable keys. Keys are " "mutable if they do not carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2667 +#: ../../library/typing.rst:2660 msgid "" "See :pep:`589` for more examples and detailed rules of using ``TypedDict``." msgstr "" -#: ../../library/typing.rst:2671 +#: ../../library/typing.rst:2664 msgid "" "Added support for marking individual keys as :data:`Required` or :data:" "`NotRequired`. See :pep:`655`." msgstr "" -#: ../../library/typing.rst:2675 +#: ../../library/typing.rst:2668 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: ../../library/typing.rst:2678 +#: ../../library/typing.rst:2671 msgid "" "Removed support for the keyword-argument method of creating ``TypedDict``\\ " "s." msgstr "" -#: ../../library/typing.rst:2681 +#: ../../library/typing.rst:2674 msgid "Support for the :data:`ReadOnly` qualifier was added." msgstr "" -#: ../../library/typing.rst:2684 +#: ../../library/typing.rst:2677 msgid "" "When using the functional syntax to create a TypedDict class, failing to " "pass a value to the 'fields' parameter (``TD = TypedDict(\"TD\")``) is " @@ -4165,106 +4143,106 @@ msgid "" "TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." msgstr "" -#: ../../library/typing.rst:2693 +#: ../../library/typing.rst:2686 msgid "Protocols" msgstr "協定" -#: ../../library/typing.rst:2695 +#: ../../library/typing.rst:2688 msgid "" "The following protocols are provided by the typing module. All are decorated " "with :func:`@runtime_checkable `." msgstr "" -#: ../../library/typing.rst:2700 +#: ../../library/typing.rst:2693 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2705 +#: ../../library/typing.rst:2698 msgid "An ABC with one abstract method ``__bytes__``." msgstr "一個有抽象方法 ``__bytes__`` 的 ABC。" -#: ../../library/typing.rst:2709 +#: ../../library/typing.rst:2702 msgid "An ABC with one abstract method ``__complex__``." msgstr "一個有抽象方法 ``__complex__`` 的 ABC。" -#: ../../library/typing.rst:2713 +#: ../../library/typing.rst:2706 msgid "An ABC with one abstract method ``__float__``." msgstr "一個有抽象方法 ``__float__`` 的 ABC。" -#: ../../library/typing.rst:2717 +#: ../../library/typing.rst:2710 msgid "An ABC with one abstract method ``__index__``." msgstr "一個有抽象方法 ``__index__`` 的 ABC。" -#: ../../library/typing.rst:2723 +#: ../../library/typing.rst:2716 msgid "An ABC with one abstract method ``__int__``." msgstr "一個有抽象方法 ``__int__`` 的 ABC。" -#: ../../library/typing.rst:2727 +#: ../../library/typing.rst:2720 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2731 +#: ../../library/typing.rst:2724 msgid "ABCs for working with IO" msgstr "" -#: ../../library/typing.rst:2737 +#: ../../library/typing.rst:2730 msgid "" "Generic type ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " "by :func:`open`." msgstr "" -#: ../../library/typing.rst:2743 +#: ../../library/typing.rst:2736 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2747 +#: ../../library/typing.rst:2740 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2749 +#: ../../library/typing.rst:2742 msgid "" "This returns the value unchanged. To the type checker this signals that the " "return value has the designated type, but at runtime we intentionally don't " "check anything (we want this to be as fast as possible)." msgstr "" -#: ../../library/typing.rst:2756 +#: ../../library/typing.rst:2749 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: ../../library/typing.rst:2758 +#: ../../library/typing.rst:2751 msgid "" "At runtime this does nothing: it returns the first argument unchanged with " "no checks or side effects, no matter the actual type of the argument." msgstr "" -#: ../../library/typing.rst:2761 +#: ../../library/typing.rst:2754 msgid "" "When a static type checker encounters a call to ``assert_type()``, it emits " "an error if the value is not of the specified type::" msgstr "" -#: ../../library/typing.rst:2764 +#: ../../library/typing.rst:2757 msgid "" "def greet(name: str) -> None:\n" " assert_type(name, str) # OK, inferred type of `name` is `str`\n" " assert_type(name, int) # type checker error" msgstr "" -#: ../../library/typing.rst:2768 +#: ../../library/typing.rst:2761 msgid "" "This function is useful for ensuring the type checker's understanding of a " "script is in line with the developer's intentions::" msgstr "" -#: ../../library/typing.rst:2771 +#: ../../library/typing.rst:2764 msgid "" "def complex_function(arg: object):\n" " # Do some complex type-narrowing logic,\n" @@ -4274,16 +4252,16 @@ msgid "" " assert_type(arg, int)" msgstr "" -#: ../../library/typing.rst:2782 +#: ../../library/typing.rst:2775 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: ../../library/typing.rst:2784 +#: ../../library/typing.rst:2777 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:2786 +#: ../../library/typing.rst:2779 msgid "" "def int_or_str(arg: int | str) -> None:\n" " match arg:\n" @@ -4303,14 +4281,14 @@ msgstr "" " case _ as unreachable:\n" " assert_never(unreachable)" -#: ../../library/typing.rst:2795 +#: ../../library/typing.rst:2788 msgid "" "Here, the annotations allow the type checker to infer that the last case can " "never execute, because ``arg`` is either an :class:`int` or a :class:`str`, " "and both options are covered by earlier cases." msgstr "" -#: ../../library/typing.rst:2800 +#: ../../library/typing.rst:2793 msgid "" "If a type checker finds that a call to ``assert_never()`` is reachable, it " "will emit an error. For example, if the type annotation for ``arg`` was " @@ -4320,47 +4298,47 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: ../../library/typing.rst:2808 +#: ../../library/typing.rst:2801 msgid "At runtime, this throws an exception when called." msgstr "" -#: ../../library/typing.rst:2811 +#: ../../library/typing.rst:2804 msgid "" -"`Unreachable Code and Exhaustiveness Checking `__ has more information about " -"exhaustiveness checking with static typing." +"`Unreachable Code and Exhaustiveness Checking `__ has more information about exhaustiveness " +"checking with static typing." msgstr "" -#: ../../library/typing.rst:2819 +#: ../../library/typing.rst:2812 msgid "Ask a static type checker to reveal the inferred type of an expression." msgstr "" -#: ../../library/typing.rst:2821 +#: ../../library/typing.rst:2814 msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the inferred type of the argument. For example::" msgstr "" -#: ../../library/typing.rst:2824 +#: ../../library/typing.rst:2817 msgid "" "x: int = 1\n" "reveal_type(x) # Revealed type is \"builtins.int\"" msgstr "" -#: ../../library/typing.rst:2827 +#: ../../library/typing.rst:2820 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: ../../library/typing.rst:2830 +#: ../../library/typing.rst:2823 msgid "" "At runtime, this function prints the runtime type of its argument to :data:" "`sys.stderr` and returns the argument unchanged (allowing the call to be " "used within an expression)::" msgstr "" -#: ../../library/typing.rst:2834 +#: ../../library/typing.rst:2827 msgid "" "x = reveal_type(1) # prints \"Runtime type is int\"\n" "print(x) # prints \"1\"" @@ -4368,13 +4346,13 @@ msgstr "" "x = reveal_type(1) # 印出 \"Runtime type is int\"\n" "print(x) # 印出 \"1\"" -#: ../../library/typing.rst:2837 +#: ../../library/typing.rst:2830 msgid "" "Note that the runtime type may be different from (more or less specific " "than) the type statically inferred by a type checker." msgstr "" -#: ../../library/typing.rst:2840 +#: ../../library/typing.rst:2833 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing``, however, " @@ -4382,13 +4360,13 @@ msgid "" "clearly." msgstr "" -#: ../../library/typing.rst:2851 +#: ../../library/typing.rst:2844 msgid "" "Decorator to mark an object as providing :func:`dataclass `-like behavior." msgstr "" -#: ../../library/typing.rst:2854 +#: ../../library/typing.rst:2847 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " @@ -4397,11 +4375,11 @@ msgid "" "to :func:`@dataclasses.dataclass `." msgstr "" -#: ../../library/typing.rst:2861 +#: ../../library/typing.rst:2854 msgid "Example usage with a decorator function:" msgstr "" -#: ../../library/typing.rst:2863 +#: ../../library/typing.rst:2856 msgid "" "@dataclass_transform()\n" "def create_model[T](cls: type[T]) -> type[T]:\n" @@ -4423,11 +4401,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2875 +#: ../../library/typing.rst:2868 msgid "On a base class::" msgstr "" -#: ../../library/typing.rst:2877 +#: ../../library/typing.rst:2870 msgid "" "@dataclass_transform()\n" "class ModelBase: ...\n" @@ -4443,11 +4421,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2884 +#: ../../library/typing.rst:2877 msgid "On a metaclass::" msgstr "" -#: ../../library/typing.rst:2886 +#: ../../library/typing.rst:2879 msgid "" "@dataclass_transform()\n" "class ModelMeta(type): ...\n" @@ -4467,7 +4445,7 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2895 +#: ../../library/typing.rst:2888 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " "similarly to classes created with :func:`@dataclasses.dataclass None:\n" @@ -4673,24 +4651,24 @@ msgid "" " ... # actual implementation goes here" msgstr "" -#: ../../library/typing.rst:3023 +#: ../../library/typing.rst:3016 msgid "" "See :pep:`484` for more details and comparison with other typing semantics." msgstr "" -#: ../../library/typing.rst:3025 +#: ../../library/typing.rst:3018 msgid "" "Overloaded functions can now be introspected at runtime using :func:" "`get_overloads`." msgstr "" -#: ../../library/typing.rst:3032 +#: ../../library/typing.rst:3025 msgid "" "Return a sequence of :func:`@overload `-decorated definitions for " "*func*." msgstr "" -#: ../../library/typing.rst:3035 +#: ../../library/typing.rst:3028 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " @@ -4700,32 +4678,32 @@ msgid "" "returns an empty sequence." msgstr "" -#: ../../library/typing.rst:3042 +#: ../../library/typing.rst:3035 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: ../../library/typing.rst:3050 +#: ../../library/typing.rst:3043 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: ../../library/typing.rst:3052 +#: ../../library/typing.rst:3045 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:3059 +#: ../../library/typing.rst:3052 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: ../../library/typing.rst:3061 +#: ../../library/typing.rst:3054 msgid "" "Decorating a method with ``@final`` indicates to a type checker that the " "method cannot be overridden in a subclass. Decorating a class with " "``@final`` indicates that it cannot be subclassed." msgstr "" -#: ../../library/typing.rst:3067 +#: ../../library/typing.rst:3060 msgid "" "class Base:\n" " @final\n" @@ -4742,7 +4720,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:3086 +#: ../../library/typing.rst:3079 msgid "" "The decorator will now attempt to set a ``__final__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, \"__final__\", " @@ -4752,11 +4730,11 @@ msgid "" "exception." msgstr "" -#: ../../library/typing.rst:3097 +#: ../../library/typing.rst:3090 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:3099 +#: ../../library/typing.rst:3092 msgid "" "This works as a class or function :term:`decorator`. With a class, it " "applies recursively to all methods and classes defined in that class (but " @@ -4764,40 +4742,40 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: ../../library/typing.rst:3105 +#: ../../library/typing.rst:3098 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: ../../library/typing.rst:3109 +#: ../../library/typing.rst:3102 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:3111 +#: ../../library/typing.rst:3104 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:3114 +#: ../../library/typing.rst:3107 msgid "" "No type checker ever added support for ``@no_type_check_decorator``. It is " "therefore deprecated, and will be removed in Python 3.15." msgstr "" -#: ../../library/typing.rst:3120 +#: ../../library/typing.rst:3113 msgid "" "Decorator to indicate that a method in a subclass is intended to override a " "method or attribute in a superclass." msgstr "" -#: ../../library/typing.rst:3123 +#: ../../library/typing.rst:3116 msgid "" "Type checkers should emit an error if a method decorated with ``@override`` " "does not, in fact, override anything. This helps prevent bugs that may occur " "when a base class is changed without an equivalent change to a child class." msgstr "" -#: ../../library/typing.rst:3130 +#: ../../library/typing.rst:3123 msgid "" "class Base:\n" " def log_status(self) -> None:\n" @@ -4813,11 +4791,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:3145 +#: ../../library/typing.rst:3138 msgid "There is no runtime checking of this property." msgstr "" -#: ../../library/typing.rst:3147 +#: ../../library/typing.rst:3140 msgid "" "The decorator will attempt to set an ``__override__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, " @@ -4827,22 +4805,22 @@ msgid "" "without raising an exception." msgstr "" -#: ../../library/typing.rst:3154 +#: ../../library/typing.rst:3147 msgid "See :pep:`698` for more details." msgstr "更多細節請見 :pep:`698`。" -#: ../../library/typing.rst:3161 +#: ../../library/typing.rst:3154 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: ../../library/typing.rst:3163 +#: ../../library/typing.rst:3156 msgid "" "This decorator is itself not available at runtime. It is mainly intended to " "mark classes that are defined in type stub files if an implementation " "returns an instance of a private class::" msgstr "" -#: ../../library/typing.rst:3167 +#: ../../library/typing.rst:3160 msgid "" "@type_check_only\n" "class Response: # private or not available at runtime\n" @@ -4852,29 +4830,29 @@ msgid "" "def fetch_response() -> Response: ..." msgstr "" -#: ../../library/typing.rst:3174 +#: ../../library/typing.rst:3167 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:3178 +#: ../../library/typing.rst:3171 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:3182 +#: ../../library/typing.rst:3175 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:3185 +#: ../../library/typing.rst:3178 msgid "" "This is often the same as ``obj.__annotations__``, but this function makes " "the following changes to the annotations dictionary:" msgstr "" -#: ../../library/typing.rst:3188 +#: ../../library/typing.rst:3181 msgid "" "Forward references encoded as string literals or :class:`ForwardRef` objects " "are handled by evaluating them in *globalns*, *localns*, and (where " @@ -4883,17 +4861,17 @@ msgid "" "inferred from *obj*." msgstr "" -#: ../../library/typing.rst:3193 +#: ../../library/typing.rst:3186 msgid "``None`` is replaced with :class:`types.NoneType`." msgstr "" -#: ../../library/typing.rst:3194 +#: ../../library/typing.rst:3187 msgid "" "If :func:`@no_type_check ` has been applied to *obj*, an " "empty dictionary is returned." msgstr "" -#: ../../library/typing.rst:3196 +#: ../../library/typing.rst:3189 msgid "" "If *obj* is a class ``C``, the function returns a dictionary that merges " "annotations from ``C``'s base classes with those on ``C`` directly. This is " @@ -4903,20 +4881,20 @@ msgid "" "annotations on classes appearing later in the method resolution order." msgstr "" -#: ../../library/typing.rst:3203 +#: ../../library/typing.rst:3196 msgid "" "The function recursively replaces all occurrences of ``Annotated[T, ...]`` " "with ``T``, unless *include_extras* is set to ``True`` (see :class:" "`Annotated` for more information)." msgstr "" -#: ../../library/typing.rst:3207 +#: ../../library/typing.rst:3200 msgid "" "See also :func:`inspect.get_annotations`, a lower-level function that " "returns annotations more directly." msgstr "" -#: ../../library/typing.rst:3212 +#: ../../library/typing.rst:3205 msgid "" "If any forward references in the annotations of *obj* are not resolvable or " "are not valid Python code, this function will raise an exception such as :" @@ -4925,7 +4903,7 @@ msgid "" "imported under :data:`if TYPE_CHECKING `." msgstr "" -#: ../../library/typing.rst:3218 +#: ../../library/typing.rst:3211 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." @@ -4933,20 +4911,20 @@ msgstr "" "新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" "`Annotated` 的文件。" -#: ../../library/typing.rst:3222 +#: ../../library/typing.rst:3215 msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" -#: ../../library/typing.rst:3229 +#: ../../library/typing.rst:3222 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:3232 +#: ../../library/typing.rst:3225 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " "it will be normalized to the original class. If ``X`` is an instance of :" @@ -4954,11 +4932,11 @@ msgid "" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:3238 ../../library/typing.rst:3262 +#: ../../library/typing.rst:3231 ../../library/typing.rst:3255 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:3240 +#: ../../library/typing.rst:3233 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" @@ -4976,13 +4954,13 @@ msgstr "" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3254 +#: ../../library/typing.rst:3247 msgid "" "Get type arguments with all substitutions performed: for a typing object of " "the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``." msgstr "" -#: ../../library/typing.rst:3257 +#: ../../library/typing.rst:3250 msgid "" "If ``X`` is a union or :class:`Literal` contained in another generic type, " "the order of ``(Y, Z, ...)`` may be different from the order of the original " @@ -4990,7 +4968,7 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:3264 +#: ../../library/typing.rst:3257 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" @@ -5000,11 +4978,11 @@ msgstr "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3274 +#: ../../library/typing.rst:3267 msgid "Return the set of members defined in a :class:`Protocol`." msgstr "" -#: ../../library/typing.rst:3276 +#: ../../library/typing.rst:3269 msgid "" ">>> from typing import Protocol, get_protocol_members\n" ">>> class P(Protocol):\n" @@ -5014,15 +4992,15 @@ msgid "" "True" msgstr "" -#: ../../library/typing.rst:3285 +#: ../../library/typing.rst:3278 msgid "Raise :exc:`TypeError` for arguments that are not Protocols." msgstr "" -#: ../../library/typing.rst:3291 +#: ../../library/typing.rst:3284 msgid "Determine if a type is a :class:`Protocol`." msgstr "確定一個型別是否 :class:`Protocol`。" -#: ../../library/typing.rst:3295 +#: ../../library/typing.rst:3288 msgid "" "class P(Protocol):\n" " def a(self) -> str: ...\n" @@ -5032,11 +5010,11 @@ msgid "" "is_protocol(int) # => False" msgstr "" -#: ../../library/typing.rst:3306 +#: ../../library/typing.rst:3299 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:3310 +#: ../../library/typing.rst:3303 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -5050,32 +5028,32 @@ msgid "" "assert not is_typeddict(TypedDict)" msgstr "" -#: ../../library/typing.rst:3327 +#: ../../library/typing.rst:3320 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:3329 +#: ../../library/typing.rst:3322 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. ``ForwardRef`` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:3334 +#: ../../library/typing.rst:3327 msgid "" ":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be " "implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus " "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: ../../library/typing.rst:3342 +#: ../../library/typing.rst:3335 msgid "" "A sentinel object used to indicate that a type parameter has no default " "value. For example:" msgstr "" -#: ../../library/typing.rst:3345 +#: ../../library/typing.rst:3338 msgid "" ">>> T = TypeVar(\"T\")\n" ">>> T.__default__ is typing.NoDefault\n" @@ -5085,17 +5063,17 @@ msgid "" "True" msgstr "" -#: ../../library/typing.rst:3357 +#: ../../library/typing.rst:3350 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3361 +#: ../../library/typing.rst:3354 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It is ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:3366 +#: ../../library/typing.rst:3359 msgid "" "if TYPE_CHECKING:\n" " import expensive_mod\n" @@ -5109,7 +5087,7 @@ msgstr "" "def fun(arg: 'expensive_mod.SomeType') -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" -#: ../../library/typing.rst:3372 +#: ../../library/typing.rst:3365 msgid "" "The first type annotation must be enclosed in quotes, making it a \"forward " "reference\", to hide the ``expensive_mod`` reference from the interpreter " @@ -5117,7 +5095,7 @@ msgid "" "second annotation does not need to be enclosed in quotes." msgstr "" -#: ../../library/typing.rst:3379 +#: ../../library/typing.rst:3372 msgid "" "If ``from __future__ import annotations`` is used, annotations are not " "evaluated at function definition time. Instead, they are stored as strings " @@ -5125,11 +5103,11 @@ msgid "" "annotation (see :pep:`563`)." msgstr "" -#: ../../library/typing.rst:3391 +#: ../../library/typing.rst:3384 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3393 +#: ../../library/typing.rst:3386 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the typing module in " @@ -5138,7 +5116,7 @@ msgid "" "existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3400 +#: ../../library/typing.rst:3393 msgid "" "The redundant types are deprecated as of Python 3.9. However, while the " "aliases may be removed at some point, removal of these aliases is not " @@ -5146,7 +5124,7 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3405 +#: ../../library/typing.rst:3398 msgid "" "If at some point it is decided to remove these deprecated aliases, a " "deprecation warning will be issued by the interpreter for at least two " @@ -5154,38 +5132,38 @@ msgid "" "typing module without deprecation warnings until at least Python 3.14." msgstr "" -#: ../../library/typing.rst:3410 +#: ../../library/typing.rst:3403 msgid "" "Type checkers are encouraged to flag uses of the deprecated types if the " "program they are checking targets a minimum Python version of 3.9 or newer." msgstr "" -#: ../../library/typing.rst:3416 +#: ../../library/typing.rst:3409 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3420 +#: ../../library/typing.rst:3413 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3422 +#: ../../library/typing.rst:3415 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Mapping` rather than to " "use :class:`dict` or :class:`!typing.Dict`." msgstr "" -#: ../../library/typing.rst:3426 +#: ../../library/typing.rst:3419 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3432 +#: ../../library/typing.rst:3425 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3434 +#: ../../library/typing.rst:3427 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Sequence` or :class:" @@ -5193,136 +5171,136 @@ msgid "" "typing.List`." msgstr "" -#: ../../library/typing.rst:3439 +#: ../../library/typing.rst:3432 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3445 +#: ../../library/typing.rst:3438 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3447 +#: ../../library/typing.rst:3440 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`collections.abc.Set` rather than to use :" "class:`set` or :class:`typing.Set`." msgstr "" -#: ../../library/typing.rst:3451 +#: ../../library/typing.rst:3444 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3457 +#: ../../library/typing.rst:3450 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3459 +#: ../../library/typing.rst:3452 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3466 +#: ../../library/typing.rst:3459 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3468 +#: ../../library/typing.rst:3461 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" "`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3471 +#: ../../library/typing.rst:3464 msgid "" ":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3477 +#: ../../library/typing.rst:3470 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3479 +#: ../../library/typing.rst:3472 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3484 +#: ../../library/typing.rst:3477 msgid "" ":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3491 +#: ../../library/typing.rst:3484 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3495 +#: ../../library/typing.rst:3488 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3499 +#: ../../library/typing.rst:3492 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3505 +#: ../../library/typing.rst:3498 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3509 +#: ../../library/typing.rst:3502 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3515 +#: ../../library/typing.rst:3508 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3519 +#: ../../library/typing.rst:3512 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3525 +#: ../../library/typing.rst:3518 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3529 +#: ../../library/typing.rst:3522 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3535 +#: ../../library/typing.rst:3528 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3539 +#: ../../library/typing.rst:3532 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3546 +#: ../../library/typing.rst:3539 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3551 +#: ../../library/typing.rst:3544 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3554 +#: ../../library/typing.rst:3547 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -5330,343 +5308,343 @@ msgid "" "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3559 +#: ../../library/typing.rst:3552 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3565 +#: ../../library/typing.rst:3558 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3567 +#: ../../library/typing.rst:3560 msgid "" "``Text`` is provided to supply a forward compatible path for Python 2 code: " "in Python 2, ``Text`` is an alias for ``unicode``." msgstr "" -#: ../../library/typing.rst:3571 +#: ../../library/typing.rst:3564 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -#: ../../library/typing.rst:3574 +#: ../../library/typing.rst:3567 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" msgstr "" -#: ../../library/typing.rst:3579 +#: ../../library/typing.rst:3572 msgid "" "Python 2 is no longer supported, and most type checkers also no longer " "support type checking Python 2 code. Removal of the alias is not currently " "planned, but users are encouraged to use :class:`str` instead of ``Text``." msgstr "" -#: ../../library/typing.rst:3589 +#: ../../library/typing.rst:3582 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3593 +#: ../../library/typing.rst:3586 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3595 +#: ../../library/typing.rst:3588 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3601 +#: ../../library/typing.rst:3594 msgid "" "This type represents the types :class:`bytes`, :class:`bytearray`, and :" "class:`memoryview` of byte sequences." msgstr "" -#: ../../library/typing.rst:3604 +#: ../../library/typing.rst:3597 msgid "" "Prefer :class:`collections.abc.Buffer`, or a union like ``bytes | bytearray " "| memoryview``." msgstr "" -#: ../../library/typing.rst:3609 +#: ../../library/typing.rst:3602 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3613 +#: ../../library/typing.rst:3606 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3619 +#: ../../library/typing.rst:3612 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3621 +#: ../../library/typing.rst:3614 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3627 +#: ../../library/typing.rst:3620 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3629 +#: ../../library/typing.rst:3622 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3635 +#: ../../library/typing.rst:3628 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3637 +#: ../../library/typing.rst:3630 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3643 +#: ../../library/typing.rst:3636 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3645 +#: ../../library/typing.rst:3638 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3651 +#: ../../library/typing.rst:3644 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3653 +#: ../../library/typing.rst:3646 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3659 +#: ../../library/typing.rst:3652 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3661 +#: ../../library/typing.rst:3654 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3668 +#: ../../library/typing.rst:3661 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3670 +#: ../../library/typing.rst:3663 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3677 +#: ../../library/typing.rst:3670 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3679 +#: ../../library/typing.rst:3672 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3685 +#: ../../library/typing.rst:3678 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3687 +#: ../../library/typing.rst:3680 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3693 +#: ../../library/typing.rst:3686 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3695 +#: ../../library/typing.rst:3688 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3702 +#: ../../library/typing.rst:3695 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3706 +#: ../../library/typing.rst:3699 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3708 +#: ../../library/typing.rst:3701 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.Coroutine` and ``typing.Coroutine`` in type annotations." msgstr "" -#: ../../library/typing.rst:3714 +#: ../../library/typing.rst:3707 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3720 +#: ../../library/typing.rst:3713 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3722 +#: ../../library/typing.rst:3715 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` in type " "annotations." msgstr "" -#: ../../library/typing.rst:3728 +#: ../../library/typing.rst:3721 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3733 +#: ../../library/typing.rst:3726 msgid "The ``SendType`` parameter now has a default." msgstr "" -#: ../../library/typing.rst:3738 +#: ../../library/typing.rst:3731 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3742 +#: ../../library/typing.rst:3735 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3748 +#: ../../library/typing.rst:3741 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3752 +#: ../../library/typing.rst:3745 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3758 +#: ../../library/typing.rst:3751 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3762 +#: ../../library/typing.rst:3755 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3769 +#: ../../library/typing.rst:3762 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3773 +#: ../../library/typing.rst:3766 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:3775 +#: ../../library/typing.rst:3768 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3781 +#: ../../library/typing.rst:3774 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:3783 +#: ../../library/typing.rst:3776 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3789 +#: ../../library/typing.rst:3782 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:3791 +#: ../../library/typing.rst:3784 msgid "" "See :ref:`annotating-callables` for details on how to use :class:" "`collections.abc.Callable` and ``typing.Callable`` in type annotations." msgstr "" -#: ../../library/typing.rst:3794 +#: ../../library/typing.rst:3787 msgid "" ":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3804 +#: ../../library/typing.rst:3797 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:3806 +#: ../../library/typing.rst:3799 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.Generator` and ``typing.Generator`` in type annotations." msgstr "" -#: ../../library/typing.rst:3810 +#: ../../library/typing.rst:3803 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3814 +#: ../../library/typing.rst:3807 msgid "Default values for the send and return types were added." msgstr "" -#: ../../library/typing.rst:3819 +#: ../../library/typing.rst:3812 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:3821 +#: ../../library/typing.rst:3814 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:3826 +#: ../../library/typing.rst:3819 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:3828 +#: ../../library/typing.rst:3821 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3834 +#: ../../library/typing.rst:3827 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:3836 +#: ../../library/typing.rst:3829 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:3842 +#: ../../library/typing.rst:3835 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:3846 +#: ../../library/typing.rst:3839 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:3848 +#: ../../library/typing.rst:3841 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__enter__` method. The optional second type parameter, " @@ -5674,21 +5652,21 @@ msgid "" "returned by the :meth:`~object.__exit__` method." msgstr "" -#: ../../library/typing.rst:3855 +#: ../../library/typing.rst:3848 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3860 +#: ../../library/typing.rst:3853 msgid "Added the optional second type parameter, ``ExitT_co``." msgstr "" -#: ../../library/typing.rst:3865 +#: ../../library/typing.rst:3858 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:3867 +#: ../../library/typing.rst:3860 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__aenter__` method. The optional second type parameter, " @@ -5696,21 +5674,21 @@ msgid "" "returned by the :meth:`~object.__aexit__` method." msgstr "" -#: ../../library/typing.rst:3874 +#: ../../library/typing.rst:3867 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3879 +#: ../../library/typing.rst:3872 msgid "Added the optional second type parameter, ``AExitT_co``." msgstr "" -#: ../../library/typing.rst:3883 +#: ../../library/typing.rst:3876 msgid "Deprecation Timeline of Major Features" msgstr "" -#: ../../library/typing.rst:3885 +#: ../../library/typing.rst:3878 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -5718,111 +5696,130 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:3892 +#: ../../library/typing.rst:3885 msgid "Feature" msgstr "" -#: ../../library/typing.rst:3893 +#: ../../library/typing.rst:3886 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:3894 +#: ../../library/typing.rst:3887 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:3895 +#: ../../library/typing.rst:3888 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:3896 +#: ../../library/typing.rst:3889 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:3897 ../../library/typing.rst:3901 +#: ../../library/typing.rst:3890 ../../library/typing.rst:3894 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:3898 +#: ../../library/typing.rst:3891 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:3899 +#: ../../library/typing.rst:3892 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:3900 +#: ../../library/typing.rst:3893 msgid ":class:`typing.ByteString`" msgstr ":class:`typing.ByteString`" -#: ../../library/typing.rst:3902 +#: ../../library/typing.rst:3895 msgid "3.14" msgstr "3.14" -#: ../../library/typing.rst:3903 +#: ../../library/typing.rst:3896 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:3904 +#: ../../library/typing.rst:3897 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:3905 +#: ../../library/typing.rst:3898 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:3906 ../../library/typing.rst:3910 -#: ../../library/typing.rst:3914 +#: ../../library/typing.rst:3899 ../../library/typing.rst:3903 +#: ../../library/typing.rst:3907 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:3907 +#: ../../library/typing.rst:3900 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:3908 +#: ../../library/typing.rst:3901 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:3909 ../../library/typing.rst:3913 +#: ../../library/typing.rst:3902 ../../library/typing.rst:3906 msgid "3.12" msgstr "3.12" -#: ../../library/typing.rst:3911 +#: ../../library/typing.rst:3904 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:3912 +#: ../../library/typing.rst:3905 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:3915 +#: ../../library/typing.rst:3908 msgid ":pep:`695`" msgstr ":pep:`695`" -#: ../../library/typing.rst:3916 +#: ../../library/typing.rst:3909 msgid ":func:`@typing.no_type_check_decorator `" msgstr ":func:`@typing.no_type_check_decorator `" -#: ../../library/typing.rst:3917 ../../library/typing.rst:3921 +#: ../../library/typing.rst:3910 ../../library/typing.rst:3914 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:3918 +#: ../../library/typing.rst:3911 msgid "3.15" msgstr "3.15" -#: ../../library/typing.rst:3919 +#: ../../library/typing.rst:3912 msgid ":gh:`106309`" msgstr ":gh:`106309`" -#: ../../library/typing.rst:3920 +#: ../../library/typing.rst:3913 msgid ":data:`typing.AnyStr`" msgstr ":data:`typing.AnyStr`" -#: ../../library/typing.rst:3922 +#: ../../library/typing.rst:3915 msgid "3.18" msgstr "3.18" -#: ../../library/typing.rst:3923 +#: ../../library/typing.rst:3916 msgid ":gh:`105578`" msgstr ":gh:`105578`" + +#~ msgid "" +#~ "@dataclass\n" +#~ "class ctype:\n" +#~ " kind: str\n" +#~ "\n" +#~ "Annotated[int, ValueRange(3, 10), ctype(\"char\")]" +#~ msgstr "" +#~ "@dataclass\n" +#~ "class ctype:\n" +#~ " kind: str\n" +#~ "\n" +#~ "Annotated[int, ValueRange(3, 10), ctype(\"char\")]" + +#~ msgid "This would be equivalent to::" +#~ msgstr "這會等價於: ::" + +#~ msgid "Annotated[T1, T2, T3, ..., Ann1]" +#~ msgstr "Annotated[T1, T2, T3, ..., Ann1]" diff --git a/library/unittest.mock-examples.po b/library/unittest.mock-examples.po index 1b709b5160..cb271a4ff9 100644 --- a/library/unittest.mock-examples.po +++ b/library/unittest.mock-examples.po @@ -75,8 +75,9 @@ msgid "" "with the correct arguments." msgstr "" "一旦 mock 被呼叫,它的 :attr:`~Mock.called` 屬性將被設定為 ``True``。更重要的" -"是,我們可以使用 :meth:`~Mock.assert_called_with` 或 :meth:`~Mock." -"assert_called_once_with` 方法來檢查它是否被使用正確的引數來呼叫。" +"是,我們可以使用 :meth:`~Mock.assert_called_with` " +"或 :meth:`~Mock.assert_called_once_with` 方法來檢查它是否被使用正確的引數來呼" +"叫。" #: ../../library/unittest.mock-examples.rst:59 msgid "" @@ -121,12 +122,12 @@ msgstr "" msgid "" "We don't have to do any work to provide the 'close' method on our mock. " "Accessing close creates it. So, if 'close' hasn't already been called then " -"accessing it in the test will create it, but :meth:`~Mock." -"assert_called_with` will raise a failure exception." +"accessing it in the test will create it, " +"but :meth:`~Mock.assert_called_with` will raise a failure exception." msgstr "" "我們不必做任何額外的事情來為 mock 提供 'close' 方法,存取 close 會建立它。因" -"此,如果 'close' 並未被呼叫過,在測試中存取 'close' 就會建立它,但 :meth:" -"`~Mock.assert_called_with` 就會引發一個失敗的例外。" +"此,如果 'close' 並未被呼叫過,在測試中存取 'close' 就會建立它," +"但 :meth:`~Mock.assert_called_with` 就會引發一個失敗的例外。" #: ../../library/unittest.mock-examples.rst:106 msgid "Mocking Classes" @@ -148,8 +149,8 @@ msgid "" "In the example below we have a function ``some_function`` that instantiates " "``Foo`` and calls a method on it. The call to :func:`patch` replaces the " "class ``Foo`` with a mock. The ``Foo`` instance is the result of calling the " -"mock, so it is configured by modifying the mock :attr:`~Mock." -"return_value`. ::" +"mock, so it is configured by modifying the " +"mock :attr:`~Mock.return_value`. ::" msgstr "" "在下面的範例中,我們有一個函式 ``some_function``,它實例化 ``Foo`` 並呼叫它的" "方法。對 :func:`patch` 的呼叫將類別 ``Foo`` 替換為一個 mock。``Foo`` 實例是呼" @@ -197,9 +198,9 @@ msgstr "追蹤所有呼叫" #: ../../library/unittest.mock-examples.rst:146 msgid "" -"Often you want to track more than a single call to a method. The :attr:" -"`~Mock.mock_calls` attribute records all calls to child attributes of the " -"mock - and also to their children." +"Often you want to track more than a single call to a method. " +"The :attr:`~Mock.mock_calls` attribute records all calls to child attributes " +"of the mock - and also to their children." msgstr "" "通常你會想要追蹤對一個方法的多個呼叫。:attr:`~Mock.mock_calls` 屬性記錄對 " "mock 的子屬性以及其子屬性的所有呼叫。" @@ -256,9 +257,9 @@ msgid "" "``mock.connection.cursor().execute(\"SELECT 1\")``. If we wanted this call " "to return a list, then we have to configure the result of the nested call." msgstr "" -"有時你想要 mock 更複雜的情況,例如 ``mock.connection.cursor()." -"execute(\"SELECT 1\")``。如果我們希望此呼叫回傳一個串列,那麼我們就必須配置巢" -"狀呼叫的結果。" +"有時你想要 mock 更複雜的情況,例如 " +"``mock.connection.cursor().execute(\"SELECT 1\")``。如果我們希望此呼叫回傳一" +"個串列,那麼我們就必須配置巢狀呼叫的結果。" #: ../../library/unittest.mock-examples.rst:214 msgid "" @@ -322,10 +323,10 @@ msgstr "Mock 非同步可疊代物件" #: ../../library/unittest.mock-examples.rst:283 msgid "" -"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to mock :ref:" -"`async-iterators` through ``__aiter__``. The :attr:`~Mock.return_value` " -"attribute of ``__aiter__`` can be used to set the return values to be used " -"for iteration." +"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to " +"mock :ref:`async-iterators` through ``__aiter__``. " +"The :attr:`~Mock.return_value` attribute of ``__aiter__`` can be used to set " +"the return values to be used for iteration." msgstr "" "從 Python 3.8 開始,``AsyncMock`` 和 ``MagicMock`` 支援透過 ``__aiter__`` 來 " "mock :ref:`async-iterators`。``__aiter__`` 的 :attr:`~Mock.return_value` 屬性" @@ -337,10 +338,10 @@ msgstr "Mock 非同步情境管理器" #: ../../library/unittest.mock-examples.rst:300 msgid "" -"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to mock :ref:" -"`async-context-managers` through ``__aenter__`` and ``__aexit__``. By " -"default, ``__aenter__`` and ``__aexit__`` are ``AsyncMock`` instances that " -"return an async function." +"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to " +"mock :ref:`async-context-managers` through ``__aenter__`` and ``__aexit__``. " +"By default, ``__aenter__`` and ``__aexit__`` are ``AsyncMock`` instances " +"that return an async function." msgstr "" "從 Python 3.8 開始,``AsyncMock`` 和 ``MagicMock`` 支援透過 ``__aenter__`` " "和 ``__aexit__`` 來 mock :ref:`async-context-managers`。預設情況下," @@ -426,9 +427,10 @@ msgstr "使用 side_effect 回傳各別檔案內容" #: ../../library/unittest.mock-examples.rst:366 msgid "" -":func:`mock_open` is used to patch :func:`open` method. :attr:`~Mock." -"side_effect` can be used to return a new Mock object per call. This can be " -"used to return different contents per file stored in a dictionary::" +":func:`mock_open` is used to patch :func:`open` " +"method. :attr:`~Mock.side_effect` can be used to return a new Mock object " +"per call. This can be used to return different contents per file stored in a " +"dictionary::" msgstr "" ":func:`mock_open` 是用於 patch :func:`open` 方法。:attr:`~Mock.side_effect` " "可以用來在每次呼叫回傳一個新的 mock 物件。這可以用於回傳儲存在字典中的各別檔" @@ -499,19 +501,19 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:404 msgid "" -"mock provides three convenient decorators for this: :func:`patch`, :func:" -"`patch.object` and :func:`patch.dict`. ``patch`` takes a single string, of " -"the form ``package.module.Class.attribute`` to specify the attribute you are " -"patching. It also optionally takes a value that you want the attribute (or " -"class or whatever) to be replaced with. 'patch.object' takes an object and " -"the name of the attribute you would like patched, plus optionally the value " -"to patch it with." +"mock provides three convenient decorators for " +"this: :func:`patch`, :func:`patch.object` and :func:`patch.dict`. ``patch`` " +"takes a single string, of the form ``package.module.Class.attribute`` to " +"specify the attribute you are patching. It also optionally takes a value " +"that you want the attribute (or class or whatever) to be replaced with. " +"'patch.object' takes an object and the name of the attribute you would like " +"patched, plus optionally the value to patch it with." msgstr "" -"mock 為此提供了三個方便的裝飾器::func:`patch`、:func:`patch.object` 和 :" -"func:`patch.dict`。``patch`` 接受單一字串,格式為 ``package.module.Class." -"attribute``,用來指定要 patch 的屬性。同時它也可以接受你想要替換的屬性(或類" -"別或其他)的值。``patch.object`` 接受一個物件和你想要 patch 的屬性的名稱,同" -"時也可以接受要 patch 的值。" +"mock 為此提供了三個方便的裝飾器::func:`patch`、:func:`patch.object` " +"和 :func:`patch.dict`。``patch`` 接受單一字串,格式為 " +"``package.module.Class.attribute``,用來指定要 patch 的屬性。同時它也可以接受" +"你想要替換的屬性(或類別或其他)的值。``patch.object`` 接受一個物件和你想要 " +"patch 的屬性的名稱,同時也可以接受要 patch 的值。" #: ../../library/unittest.mock-examples.rst:412 msgid "``patch.object``::" @@ -551,11 +553,11 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:429 msgid "" -"If you are patching a module (including :mod:`builtins`) then use :func:" -"`patch` instead of :func:`patch.object`:" +"If you are patching a module (including :mod:`builtins`) then " +"use :func:`patch` instead of :func:`patch.object`:" msgstr "" -"如果你要 patch 一個模組(包括 :mod:`builtins`),請使用 :func:`patch` 而非 :" -"func:`patch.object`:" +"如果你要 patch 一個模組(包括 :mod:`builtins`),請使用 :func:`patch` 而" +"非 :func:`patch.object`:" #: ../../library/unittest.mock-examples.rst:439 msgid "" @@ -657,8 +659,9 @@ msgid "" "as class decorators. When used in this way it is the same as applying the " "decorator individually to every method whose name starts with \"test\"." msgstr "" -"另外,“patch”、“patch.object” 和 “patch.dict” 也可以用來作為類別裝飾器。以這" -"種方式使用時,與將裝飾器單獨應用於每個名稱以 “test” 開頭的方法相同。" +"另外,``patch``、``patch.object`` 和 ``patch.dict`` 也可以用來作為類別裝飾" +"器。以這種方式使用時,與將裝飾器單獨應用於每個名稱以 \"test\" 開頭的方法相" +"同。" #: ../../library/unittest.mock-examples.rst:523 msgid "Further Examples" @@ -741,16 +744,17 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:573 msgid "" -"mock_backend.get_endpoint.return_value.create_call.return_value.start_call." -"return_value = mock_response" +"mock_backend.get_endpoint.return_value.create_call.return_value.start_call.return_value " +"= mock_response" msgstr "" -"mock_backend.get_endpoint.return_value.create_call.return_value.start_call." -"return_value = mock_response" +"mock_backend.get_endpoint.return_value.create_call.return_value.start_call.return_value " +"= mock_response" #: ../../library/unittest.mock-examples.rst:575 msgid "" -"We can do that in a slightly nicer way using the :meth:`~Mock." -"configure_mock` method to directly set the return value for us::" +"We can do that in a slightly nicer way using " +"the :meth:`~Mock.configure_mock` method to directly set the return value for " +"us::" msgstr "" "我們可以使用 :meth:`~Mock.configure_mock` 方法來以稍微好一點的方式為我們直接" "設定回傳值: ::" @@ -760,15 +764,17 @@ msgid "" ">>> something = Something()\n" ">>> mock_response = Mock(spec=open)\n" ">>> mock_backend = Mock()\n" -">>> config = {'get_endpoint.return_value.create_call.return_value.start_call." -"return_value': mock_response}\n" +">>> config = " +"{'get_endpoint.return_value.create_call.return_value.start_call.return_value': " +"mock_response}\n" ">>> mock_backend.configure_mock(**config)" msgstr "" ">>> something = Something()\n" ">>> mock_response = Mock(spec=open)\n" ">>> mock_backend = Mock()\n" -">>> config = {'get_endpoint.return_value.create_call.return_value.start_call." -"return_value': mock_response}\n" +">>> config = " +"{'get_endpoint.return_value.create_call.return_value.start_call.return_value': " +"mock_response}\n" ">>> mock_backend.configure_mock(**config)" #: ../../library/unittest.mock-examples.rst:584 @@ -800,13 +806,13 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:595 msgid "" -">>> chained = call.get_endpoint('foobar').create_call('spam', 'eggs')." -"start_call()\n" +">>> chained = call.get_endpoint('foobar').create_call('spam', " +"'eggs').start_call()\n" ">>> call_list = chained.call_list()\n" ">>> assert mock_backend.mock_calls == call_list" msgstr "" -">>> chained = call.get_endpoint('foobar').create_call('spam', 'eggs')." -"start_call()\n" +">>> chained = call.get_endpoint('foobar').create_call('spam', " +"'eggs').start_call()\n" ">>> call_list = chained.call_list()\n" ">>> assert mock_backend.mock_calls == call_list" @@ -819,13 +825,13 @@ msgid "" "In some tests I wanted to mock out a call to :meth:`datetime.date.today` to " "return a known date, but I didn't want to prevent the code under test from " "creating new date objects. Unfortunately :class:`datetime.date` is written " -"in C, and so I couldn't just monkey-patch out the static :meth:`datetime." -"date.today` method." +"in C, and so I couldn't just monkey-patch out the " +"static :meth:`datetime.date.today` method." msgstr "" "在某些測試中,我們會想 mock 對 :meth:`datetime.date.today` 的呼叫以回傳一個已" -"知日期,但我不想阻止測試中的程式碼建立新的日期物件。不幸的是 :class:" -"`datetime.date` 是用 C 語言寫的,所以們我不能 monkey patch 靜態的 :meth:" -"`datetime.date.today` 方法。" +"知日期,但我不想阻止測試中的程式碼建立新的日期物件。不幸的" +"是 :class:`datetime.date` 是用 C 語言寫的,所以們我不能 monkey patch 靜態" +"的 :meth:`datetime.date.today` 方法。" #: ../../library/unittest.mock-examples.rst:608 msgid "" @@ -901,9 +907,9 @@ msgid "" "is discussed in `this blog entry `_." msgstr "" -"處理 mock 日期或其他內建類別的另一種方法在 `這個 blog `_ 中" -"討論。" +"處理 mock 日期或其他內建類別的另一種方法在 `這個 blog `_ 中討論。" #: ../../library/unittest.mock-examples.rst:643 msgid "Mocking a Generator Method" @@ -921,8 +927,8 @@ msgstr "" msgid "" "A generator method / function is called to return the generator object. It " "is the generator object that is then iterated over. The protocol method for " -"iteration is :meth:`~container.__iter__`, so we can mock this using a :class:" -"`MagicMock`." +"iteration is :meth:`~container.__iter__`, so we can mock this using " +"a :class:`MagicMock`." msgstr "" "產生器方法 / 函式會被呼叫以回傳產生器物件。之後此產生器會進行疊代。疊代的協定" "方法是 :meth:`~container.__iter__`,所以我們可以使用 :class:`MagicMock` 來 " @@ -948,16 +954,16 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:675 msgid "" -"There are also generator expressions and more `advanced uses `_ of generators, but we aren't concerned " -"about them here. A very good introduction to generators and how powerful " -"they are is: `Generator Tricks for Systems Programmers `_." +"There are also generator expressions and more `advanced uses `_ of generators, but we aren't " +"concerned about them here. A very good introduction to generators and how " +"powerful they are is: `Generator Tricks for Systems Programmers `_." msgstr "" "還有關於產生器運算式及產生器的更多 `進階用法 `_ ,但我們在這裡不考慮它們。一個關於產生器及其強大功能" -"的優良說明是:`Generator Tricks for Systems Programmers `_。" +"的優良說明是:`Generator Tricks for Systems Programmers `_。" #: ../../library/unittest.mock-examples.rst:683 msgid "Applying the same patch to every test method" @@ -1054,8 +1060,8 @@ msgstr "" msgid "" "If you use this technique you must ensure that the patching is \"undone\" by " "calling ``stop``. This can be fiddlier than you might think, because if an " -"exception is raised in the setUp then tearDown is not called. :meth:" -"`unittest.TestCase.addCleanup` makes this easier::" +"exception is raised in the setUp then tearDown is not " +"called. :meth:`unittest.TestCase.addCleanup` makes this easier::" msgstr "" "如果你使用這個技巧,你必須確保透過呼叫 ``stop`` 來 \"取消\" patch。這可能會比" "你想像的還要複雜一點,因為如果有例外在 ``setUp`` 中被引發,則 ``tearDown`` 就" @@ -1147,9 +1153,9 @@ msgstr "mock 有很好的 API,用於對 mock 物件的使用方式做出斷言 #: ../../library/unittest.mock-examples.rst:792 msgid "" -"If your mock is only being called once you can use the :meth:`~Mock." -"assert_called_once_with` method that also asserts that the :attr:`~Mock." -"call_count` is one." +"If your mock is only being called once you can use " +"the :meth:`~Mock.assert_called_once_with` method that also asserts that " +"the :attr:`~Mock.call_count` is one." msgstr "" "如果你的 mock 只被呼叫一次,你可以使用 :meth:`~Mock.assert_called_once_with` " "方法,其也斷言 :attr:`~Mock.call_count` 是1。" @@ -1158,8 +1164,8 @@ msgstr "" msgid "" "Both ``assert_called_with`` and ``assert_called_once_with`` make assertions " "about the *most recent* call. If your mock is going to be called several " -"times, and you want to make assertions about *all* those calls you can use :" -"attr:`~Mock.call_args_list`:" +"times, and you want to make assertions about *all* those calls you can " +"use :attr:`~Mock.call_args_list`:" msgstr "" "``assert_called_with`` 和 ``assert_called_once_with`` 都對\\ *最近一次*\\ 的" "呼叫做出斷言。如果你的 mock 將被多次呼叫,並且你想要對\\ *所有*\\ 這些呼叫進" @@ -1332,12 +1338,12 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:912 msgid "" -"An alternative approach is to create a subclass of :class:`Mock` or :class:" -"`MagicMock` that copies (using :func:`copy.deepcopy`) the arguments. Here's " -"an example implementation:" +"An alternative approach is to create a subclass of :class:`Mock` " +"or :class:`MagicMock` that copies (using :func:`copy.deepcopy`) the " +"arguments. Here's an example implementation:" msgstr "" -"另一種方法是建立 :class:`Mock` 或 :class:`MagicMock` 的子類別來複製(使用 :" -"func:`copy.deepcopy`\\ )引數。這是一個實作的例子:" +"另一種方法是建立 :class:`Mock` 或 :class:`MagicMock` 的子類別來複製(使" +"用 :func:`copy.deepcopy`\\ )引數。這是一個實作的例子:" #: ../../library/unittest.mock-examples.rst:937 msgid "" @@ -1466,8 +1472,8 @@ msgid "" "and using :data:`~Mock.side_effect` to delegate dictionary access to a real " "underlying dictionary that is under our control." msgstr "" -"我們可以使用 :class:`MagicMock` 來做到這一點,它的行為會與字典一致,並使用 :" -"data:`~Mock.side_effect` 將字典存取委託給我們控制下的真實底層字典。" +"我們可以使用 :class:`MagicMock` 來做到這一點,它的行為會與字典一致,並使" +"用 :data:`~Mock.side_effect` 將字典存取委託給我們控制下的真實底層字典。" #: ../../library/unittest.mock-examples.rst:1000 msgid "" @@ -1476,15 +1482,16 @@ msgid "" "``side_effect`` is called with the key (and in the case of ``__setitem__`` " "the value too). We can also control what is returned." msgstr "" -"當 ``MagicMock`` 的 :meth:`~object.__getitem__` 和 :meth:`~object." -"__setitem__` 方法被呼叫時(一般的字典存取), ``side_effect`` 會被使用鍵 " -"(key) 來呼叫 (在 ``__setitem__`` 的情況也會使用值 (value))。我們也可以控制" -"回傳的內容。" +"當 ``MagicMock`` 的 :meth:`~object.__getitem__` " +"和 :meth:`~object.__setitem__` 方法被呼叫時(一般的字典存取), " +"``side_effect`` 會被使用鍵 (key) 來呼叫 (在 ``__setitem__`` 的情況也會使用" +"值 (value))。我們也可以控制回傳的內容。" #: ../../library/unittest.mock-examples.rst:1005 msgid "" -"After the ``MagicMock`` has been used we can use attributes like :data:" -"`~Mock.call_args_list` to assert about how the dictionary was used:" +"After the ``MagicMock`` has been used we can use attributes " +"like :data:`~Mock.call_args_list` to assert about how the dictionary was " +"used:" msgstr "" "使用 ``MagicMock`` 後,我們可以使用諸如 :data:`~Mock.call_args_list` 之類的屬" "性來斷言字典被使用的方式:" @@ -1549,10 +1556,11 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:1101 msgid "" -"Sometimes this is inconvenient. For example, `one user `_ is subclassing mock to created a `Twisted " -"adaptor `_. Having this applied to attributes too actually causes errors." +"Sometimes this is inconvenient. For example, `one user `_ is subclassing mock to created " +"a `Twisted adaptor `_. Having this applied to attributes too " +"actually causes errors." msgstr "" "有時候這很不方便。例如,`有一個使用者 `_\\ 正在子類別化 mock 以建立 `Twisted adaptor `_ provides similar functionality, that may be " -"useful here, in the form of its equality matcher (`hamcrest.library." -"integration.match_equality `_)." -msgstr "" -"從版本 1.5 開始,Python 測試函式庫 `PyHamcrest `_ 以其相等匹配器的形式,提供了類似的功能,在這裡可能是有用" -"的 (\\ `hamcrest.library.integration.match_equality `_\\ )。" +"useful here, in the form of its equality matcher " +"(`hamcrest.library.integration.match_equality `_)." +msgstr "" +"從版本 1.5 開始,Python 測試函式庫 `PyHamcrest `_ 以其相等匹配器的形式,提供了類似的功能,在這裡" +"可能是有用的 (\\ `hamcrest.library.integration.match_equality `_\\ )。" diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 720ca6deba..ec7c8356cc 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2025-02-22 00:13+0000\n" "PO-Revision-Date: 2024-02-19 21:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -50,15 +50,15 @@ msgstr "" #: ../../library/unittest.mock.rst:26 msgid "" "Additionally, mock provides a :func:`patch` decorator that handles patching " -"module and class level attributes within the scope of a test, along with :" -"const:`sentinel` for creating unique objects. See the `quick guide`_ for " -"some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:" -"`patch`." +"module and class level attributes within the scope of a test, along " +"with :const:`sentinel` for creating unique objects. See the `quick guide`_ " +"for some examples of how to use :class:`Mock`, :class:`MagicMock` " +"and :func:`patch`." msgstr "" "此外,mock 還提供了一個 :func:`patch` 裝飾器,用於 patching 測試範圍內對 " -"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件的 :const:" -"`sentinel`。有關如何使用 :class:`Mock`\\、:class:`MagicMock` 和 :func:" -"`patch` 的一些範例,請參閱\\ `快速導引 `_。" +"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件" +"的 :const:`sentinel`。有關如何使用 :class:`Mock`\\、:class:`MagicMock` " +"和 :func:`patch` 的一些範例,請參閱\\ `快速導引 `_。" #: ../../library/unittest.mock.rst:32 msgid "" @@ -222,11 +222,11 @@ msgid "" "replacing, and any functions and methods (including constructors) have the " "same call signature as the real object." msgstr "" -"為了確保測試中的 mock 物件與它們要替換的物件具有相同的 api,你可以使用\\ :" -"ref:`自動規格 `。自動規格(auto-speccing)可以通過 patch 的 " -"*autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的 mock 物" -"件與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函式)" -"都具有與真實物件相同的呼叫簽名(call signature)。" +"為了確保測試中的 mock 物件與它們要替換的物件具有相同的 api,你可以使用" +"\\ :ref:`自動規格 `。自動規格(auto-speccing)可以通過 patch " +"的 *autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的 mock " +"物件與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函" +"式)都具有與真實物件相同的呼叫簽名(call signature)。" #: ../../library/unittest.mock.rst:177 msgid "" @@ -264,12 +264,12 @@ msgstr "" msgid "" ":class:`MagicMock` is a subclass of :class:`Mock` with all the magic methods " "pre-created and ready to use. There are also non-callable variants, useful " -"when you are mocking out objects that aren't callable: :class:" -"`NonCallableMock` and :class:`NonCallableMagicMock`" +"when you are mocking out objects that aren't " +"callable: :class:`NonCallableMock` and :class:`NonCallableMagicMock`" msgstr "" ":class:`MagicMock` 是 :class:`Mock` 的子類別,其中所有魔術方法均已預先建立並" -"可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有用::class:" -"`NonCallableMock` 和 :class:`NonCallableMagicMock`" +"可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有" +"用::class:`NonCallableMock` 和 :class:`NonCallableMagicMock`" #: ../../library/unittest.mock.rst:224 msgid "" @@ -279,8 +279,8 @@ msgid "" "class of :class:`Mock` using the *new_callable* argument to :func:`patch`." msgstr "" ":func:`patch` 裝飾器可以輕鬆地用 :class:`Mock` 物件臨時替換特定模組中的類別。" -"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使用 :" -"func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" +"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使" +"用 :func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" #: ../../library/unittest.mock.rst:232 msgid "" @@ -300,18 +300,18 @@ msgid "" msgstr "" "*spec*:這可以是字串的 list(串列),也可以是充當 mock 物件規格的現有物件(類" "別或實例)。如果傳入一個物件,則通過對該物件呼叫 dir 來形成字串的串列(不包括" -"不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引發 :exc:" -"`AttributeError`。" +"不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引" +"發 :exc:`AttributeError`。" #: ../../library/unittest.mock.rst:241 msgid "" -"If *spec* is an object (rather than a list of strings) then :attr:`~object." -"__class__` returns the class of the spec object. This allows mocks to pass :" -"func:`isinstance` tests." +"If *spec* is an object (rather than a list of strings) " +"then :attr:`~object.__class__` returns the class of the spec object. This " +"allows mocks to pass :func:`isinstance` tests." msgstr "" -"如果 *spec* 是一個物件(而不是一個字串的串列),那麼 :attr:`~object." -"__class__` 會回傳 spec 物件的類別。這允許 mocks 通過 :func:`isinstance` 測" -"試。" +"如果 *spec* 是一個物件(而不是一個字串的串列),那" +"麼 :attr:`~object.__class__` 會回傳 spec 物件的類別。這允許 mocks 通" +"過 :func:`isinstance` 測試。" #: ../../library/unittest.mock.rst:245 msgid "" @@ -320,13 +320,13 @@ msgid "" "will raise an :exc:`AttributeError`." msgstr "" "*spec_set*:*spec* 的一個更嚴格的變體。如果使用 *spec_set*,在 mock 上嘗試 " -"*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引發 :exc:" -"`AttributeError`。" +"*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引" +"發 :exc:`AttributeError`。" #: ../../library/unittest.mock.rst:249 msgid "" -"*side_effect*: A function to be called whenever the Mock is called. See the :" -"attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " +"*side_effect*: A function to be called whenever the Mock is called. See " +"the :attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " "dynamically changing return values. The function is called with the same " "arguments as the mock, and unless it returns :data:`DEFAULT`, the return " "value of this function is used as the return value." @@ -367,8 +367,8 @@ msgstr "" #: ../../library/unittest.mock.rst:267 msgid "" "*unsafe*: By default, accessing any attribute whose name starts with " -"*assert*, *assret*, *asert*, *aseert* or *assrt* will raise an :exc:" -"`AttributeError`. Passing ``unsafe=True`` will allow access to these " +"*assert*, *assret*, *asert*, *aseert* or *assrt* will raise " +"an :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to these " "attributes." msgstr "" "*unsafe*:預設情況下,存取任何以 *assert*、*assret*、*asert*、*aseert* 或 " @@ -381,13 +381,13 @@ msgid "" "calling the Mock will pass the call through to the wrapped object (returning " "the real result). Attribute access on the mock will return a Mock object " "that wraps the corresponding attribute of the wrapped object (so attempting " -"to access an attribute that doesn't exist will raise an :exc:" -"`AttributeError`)." +"to access an attribute that doesn't exist will raise " +"an :exc:`AttributeError`)." msgstr "" "*wraps*:被 mock 物件包裝的項目。如果 *wraps* 不是 ``None``,那麼呼叫 Mock 將" "通過被包裝的物件(回傳真實結果)。存取 mock 的屬性將會回傳一個 Mock 物件,該" -"物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引發 :exc:" -"`AttributeError`\\ )。" +"物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引" +"發 :exc:`AttributeError`\\ )。" #: ../../library/unittest.mock.rst:281 msgid "" @@ -408,8 +408,8 @@ msgstr "" #: ../../library/unittest.mock.rst:288 msgid "" "Mocks can also be called with arbitrary keyword arguments. These will be " -"used to set attributes on the mock after it is created. See the :meth:" -"`configure_mock` method for details." +"used to set attributes on the mock after it is created. See " +"the :meth:`configure_mock` method for details." msgstr "" "Mocks 還可以使用任意的關鍵字引數進行呼叫。這些關鍵字引數將在建立 mock 之後用" "於設定 mock 的屬性。欲知更多,請參見 :meth:`configure_mock` 方法。" @@ -440,19 +440,19 @@ msgstr "斷言 mock 已經被使用指定的引數呼叫。" #: ../../library/unittest.mock.rst:351 msgid "" -"The assert passes if the mock has *ever* been called, unlike :meth:" -"`assert_called_with` and :meth:`assert_called_once_with` that only pass if " -"the call is the most recent one, and in the case of :meth:" -"`assert_called_once_with` it must also be the only call." +"The assert passes if the mock has *ever* been called, " +"unlike :meth:`assert_called_with` and :meth:`assert_called_once_with` that " +"only pass if the call is the most recent one, and in the case " +"of :meth:`assert_called_once_with` it must also be the only call." msgstr "" -"這個斷言在 mock 曾經被呼叫過時通過,不同於 :meth:`assert_called_with` 和 :" -"meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對於 :meth:" -"`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" +"這個斷言在 mock 曾經被呼叫過時通過,不同於 :meth:`assert_called_with` " +"和 :meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對" +"於 :meth:`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" #: ../../library/unittest.mock.rst:364 msgid "" -"assert the mock has been called with the specified calls. The :attr:" -"`mock_calls` list is checked for the calls." +"assert the mock has been called with the specified calls. " +"The :attr:`mock_calls` list is checked for the calls." msgstr "" "斷言 mock 已經使用指定的呼叫方式來呼叫。此斷言會檢查 :attr:`mock_calls` 串列" "中的呼叫。" @@ -481,31 +481,92 @@ msgstr "斷言 mock 從未被呼叫。" msgid "The reset_mock method resets all the call attributes on a mock object:" msgstr "reset_mock 方法重置 mock 物件上的所有呼叫屬性:" -#: ../../library/unittest.mock.rst:412 -msgid "Added two keyword-only arguments to the reset_mock function." -msgstr "reset_mock 函式新增了兩個僅限關鍵字引數 (keyword-only arguments)。" +#: ../../library/unittest.mock.rst:404 +msgid "" +">>> mock = Mock(return_value=None)\n" +">>> mock('hello')\n" +">>> mock.called\n" +"True\n" +">>> mock.reset_mock()\n" +">>> mock.called\n" +"False" +msgstr "" +">>> mock = Mock(return_value=None)\n" +">>> mock('hello')\n" +">>> mock.called\n" +"True\n" +">>> mock.reset_mock()\n" +">>> mock.called\n" +"False" -#: ../../library/unittest.mock.rst:415 +#: ../../library/unittest.mock.rst:414 msgid "" "This can be useful where you want to make a series of assertions that reuse " -"the same object. Note that :meth:`reset_mock` *doesn't* clear the :attr:" -"`return_value`, :attr:`side_effect` or any child attributes you have set " -"using normal assignment by default. In case you want to reset :attr:" -"`return_value` or :attr:`side_effect`, then pass the corresponding parameter " -"as ``True``. Child mocks and the return value mock (if any) are reset as " -"well." +"the same object." msgstr "" -"這在你想要進行一系列重複使用同一物件的斷言時非常有用。請注意,預設情況下,:" -"meth:`reset_mock` *不會*\\ 清除 :attr:`return_value`、:attr:`side_effect` 或" -"使用普通賦值設定的任何子屬性。如果你想要重置 :attr:`return_value` 或 :attr:" -"`side_effect`,則將相應的參數設置為 ``True``。Child mock 和回傳值 mock(如果" -"有的話)也會被重置。" -#: ../../library/unittest.mock.rst:423 -msgid "*return_value*, and *side_effect* are keyword-only arguments." -msgstr "*return_value* 和 *side_effect* 是僅限關鍵字引數。" +#: ../../library/unittest.mock.rst:417 +msgid "" +"*return_value* parameter when set to ``True`` resets :attr:`return_value`:" +msgstr "" + +#: ../../library/unittest.mock.rst:419 +msgid "" +">>> mock = Mock(return_value=5)\n" +">>> mock('hello')\n" +"5\n" +">>> mock.reset_mock(return_value=True)\n" +">>> mock('hello')\n" +"" +msgstr "" +">>> mock = Mock(return_value=5)\n" +">>> mock('hello')\n" +"5\n" +">>> mock.reset_mock(return_value=True)\n" +">>> mock('hello')\n" +"" -#: ../../library/unittest.mock.rst:429 +#: ../../library/unittest.mock.rst:428 +msgid "" +"*side_effect* parameter when set to ``True`` resets :attr:`side_effect`:" +msgstr "" + +#: ../../library/unittest.mock.rst:430 +msgid "" +">>> mock = Mock(side_effect=ValueError)\n" +">>> mock('hello')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError\n" +">>> mock.reset_mock(side_effect=True)\n" +">>> mock('hello')\n" +"" +msgstr "" +">>> mock = Mock(side_effect=ValueError)\n" +">>> mock('hello')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError\n" +">>> mock.reset_mock(side_effect=True)\n" +">>> mock('hello')\n" +"" + +#: ../../library/unittest.mock.rst:441 +msgid "" +"Note that :meth:`reset_mock` *doesn't* clear " +"the :attr:`return_value`, :attr:`side_effect` or any child attributes you " +"have set using normal assignment by default." +msgstr "" + +#: ../../library/unittest.mock.rst:445 +msgid "Child mocks are reset as well." +msgstr "" + +#: ../../library/unittest.mock.rst:447 +msgid "Added two keyword-only arguments to the reset_mock function." +msgstr "reset_mock 函式新增了兩個僅限關鍵字引數 (keyword-only arguments)。" + +#: ../../library/unittest.mock.rst:452 msgid "" "Add a spec to a mock. *spec* can either be an object or a list of strings. " "Only attributes on the *spec* can be fetched as attributes from the mock." @@ -513,25 +574,25 @@ msgstr "" "向 mock 增加一個規格 (spec)。*spec* 可以是一個物件或一個字串串列 (list of " "strings)。只有在 *spec* 上的屬性才能作為 mock 的屬性被取得。" -#: ../../library/unittest.mock.rst:433 +#: ../../library/unittest.mock.rst:456 msgid "If *spec_set* is true then only attributes on the spec can be set." msgstr "如果 *spec_set* 為 true,那麼只能設定在規格中的屬性。" -#: ../../library/unittest.mock.rst:438 +#: ../../library/unittest.mock.rst:461 msgid "" "Attach a mock as an attribute of this one, replacing its name and parent. " -"Calls to the attached mock will be recorded in the :attr:`method_calls` and :" -"attr:`mock_calls` attributes of this one." +"Calls to the attached mock will be recorded in the :attr:`method_calls` " +"and :attr:`mock_calls` attributes of this one." msgstr "" "將一個 mock 作為這個 Mock 的屬性附加,取代它的名稱和上代 (parent)。對附加的 " "mock 的呼叫將被記錄在這個 Mock 的 :attr:`method_calls` 和 :attr:`mock_calls` " "屬性中。" -#: ../../library/unittest.mock.rst:445 +#: ../../library/unittest.mock.rst:468 msgid "Set attributes on the mock through keyword arguments." msgstr "透過關鍵字引數在 mock 上設定屬性。" -#: ../../library/unittest.mock.rst:447 +#: ../../library/unittest.mock.rst:470 msgid "" "Attributes plus return values and side effects can be set on child mocks " "using standard dot notation and unpacking a dictionary in the method call:" @@ -539,18 +600,18 @@ msgstr "" "可以在使用 method(方法)呼叫時,使用標準點記法 (dot notation) 並將字典拆開," "為 child mock 設定屬性、回傳值和 side effects:" -#: ../../library/unittest.mock.rst:461 +#: ../../library/unittest.mock.rst:484 msgid "The same thing can be achieved in the constructor call to mocks:" msgstr "同樣的事情可以在 mock 的建構函式呼叫中實現:" -#: ../../library/unittest.mock.rst:474 +#: ../../library/unittest.mock.rst:497 msgid "" ":meth:`configure_mock` exists to make it easier to do configuration after " "the mock has been created." msgstr "" ":meth:`configure_mock` 的存在是為了在 mock 被建立後更容易進行組態設定。" -#: ../../library/unittest.mock.rst:480 +#: ../../library/unittest.mock.rst:503 msgid "" ":class:`Mock` objects limit the results of ``dir(some_mock)`` to useful " "results. For mocks with a *spec* this includes all the permitted attributes " @@ -559,13 +620,13 @@ msgstr "" ":class:`Mock` 物件限制了 ``dir(some_mock)`` 僅顯示有用的結果。對於具有 " "*spec* 的 mock,這包含所有被允許的 mock 屬性。" -#: ../../library/unittest.mock.rst:484 +#: ../../library/unittest.mock.rst:507 msgid "" "See :data:`FILTER_DIR` for what this filtering does, and how to switch it " "off." msgstr "請參閱 :data:`FILTER_DIR` 以了解這種過濾行為的作用,以及如何關閉它。" -#: ../../library/unittest.mock.rst:490 +#: ../../library/unittest.mock.rst:513 msgid "" "Create the child mocks for attributes and return value. By default child " "mocks will be the same type as the parent. Subclasses of Mock may want to " @@ -574,35 +635,35 @@ msgstr "" "建立為了得到屬性和回傳值的 child mock。預設情況下,child mock 將與其上代是相" "同的型別。Mock 的子類別可能會想要置換此行為,以自定義 child mock 的建立方式。" -#: ../../library/unittest.mock.rst:495 +#: ../../library/unittest.mock.rst:518 msgid "" "For non-callable mocks the callable variant will be used (rather than any " "custom subclass)." msgstr "對於不可呼叫的 mock,將使用可呼叫的變體,而不是任何的自定義子類別。" -#: ../../library/unittest.mock.rst:501 +#: ../../library/unittest.mock.rst:524 msgid "A boolean representing whether or not the mock object has been called:" msgstr "一個 boolean(布林),表述 mock 物件是否已經被呼叫:" -#: ../../library/unittest.mock.rst:512 +#: ../../library/unittest.mock.rst:535 msgid "An integer telling you how many times the mock object has been called:" msgstr "一個整數,告訴你 mock 物件被呼叫的次數:" -#: ../../library/unittest.mock.rst:524 +#: ../../library/unittest.mock.rst:547 msgid "Set this to configure the value returned by calling the mock:" msgstr "設定此值以配置呼叫 mock 時回傳的值:" -#: ../../library/unittest.mock.rst:531 +#: ../../library/unittest.mock.rst:554 msgid "" "The default return value is a mock object and you can configure it in the " "normal way:" msgstr "預設的回傳值是一個 mock 物件,你也可以按照正常的方式配置它:" -#: ../../library/unittest.mock.rst:540 +#: ../../library/unittest.mock.rst:563 msgid ":attr:`return_value` can also be set in the constructor:" msgstr ":attr:`return_value` 也可以在建構函式中設定:" -#: ../../library/unittest.mock.rst:551 +#: ../../library/unittest.mock.rst:574 msgid "" "This can either be a function to be called when the mock is called, an " "iterable or an exception (class or instance) to be raised." @@ -610,7 +671,7 @@ msgstr "" "這可以是一個在呼叫 mock 時要呼叫的函式、一個可疊代物件,或者要引發的例外(類" "別或實例)。" -#: ../../library/unittest.mock.rst:554 +#: ../../library/unittest.mock.rst:577 msgid "" "If you pass in a function it will be called with same arguments as the mock " "and unless the function returns the :data:`DEFAULT` singleton the call to " @@ -618,37 +679,37 @@ msgid "" "returns :data:`DEFAULT` then the mock will return its normal value (from " "the :attr:`return_value`)." msgstr "" -"如果你傳遞一個函式,它將被呼叫,其引數與 mock 相同,且除非該函式回傳 :data:" -"`DEFAULT` 單例 (singleton),否則對 mock 的呼叫將回傳函式回傳的任何值。如果函" -"式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值(從 :attr:" -"`return_value` 得到)。" +"如果你傳遞一個函式,它將被呼叫,其引數與 mock 相同,且除非該函式回" +"傳 :data:`DEFAULT` 單例 (singleton),否則對 mock 的呼叫將回傳函式回傳的任何" +"值。如果函式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值" +"(從 :attr:`return_value` 得到)。" -#: ../../library/unittest.mock.rst:560 +#: ../../library/unittest.mock.rst:583 msgid "" "If you pass in an iterable, it is used to retrieve an iterator which must " "yield a value on every call. This value can either be an exception instance " -"to be raised, or a value to be returned from the call to the mock (:data:" -"`DEFAULT` handling is identical to the function case)." +"to be raised, or a value to be returned from the call to the mock " +"(:data:`DEFAULT` handling is identical to the function case)." msgstr "" "如果你傳遞一個可疊代物件,它將被用於檢索一個疊代器,該疊代器必須在每次呼叫時" "產出 (yield) 一個值。這個值可以是要引發的例外實例,或者是對 mock 呼叫時要回傳" "的值(處理 :data:`DEFAULT` 的方式與函式的狀況相同)。" -#: ../../library/unittest.mock.rst:565 +#: ../../library/unittest.mock.rst:588 msgid "" "An example of a mock that raises an exception (to test exception handling of " "an API):" msgstr "以下是一個引發例外的 mock 的範例(用於測試 API 的例外處理):" -#: ../../library/unittest.mock.rst:575 +#: ../../library/unittest.mock.rst:598 msgid "Using :attr:`side_effect` to return a sequence of values:" msgstr "使用 :attr:`side_effect` 回傳一連串值的範例:" -#: ../../library/unittest.mock.rst:582 +#: ../../library/unittest.mock.rst:605 msgid "Using a callable:" msgstr "使用可被呼叫物件的範例:" -#: ../../library/unittest.mock.rst:592 +#: ../../library/unittest.mock.rst:615 msgid "" ":attr:`side_effect` can be set in the constructor. Here's an example that " "adds one to the value the mock is called with and returns it:" @@ -656,11 +717,11 @@ msgstr "" ":attr:`side_effect` 可以在建構函式中設定。以下是一個範例,它將 mock 被呼叫時" "給的值加一並回傳:" -#: ../../library/unittest.mock.rst:602 +#: ../../library/unittest.mock.rst:625 msgid "Setting :attr:`side_effect` to ``None`` clears it:" msgstr "將 :attr:`side_effect` 設定為 ``None`` 可以清除它:" -#: ../../library/unittest.mock.rst:616 +#: ../../library/unittest.mock.rst:639 msgid "" "This is either ``None`` (if the mock hasn't been called), or the arguments " "that the mock was last called with. This will be in the form of a tuple: the " @@ -674,35 +735,36 @@ msgstr "" "是 mock 被呼叫時傳遞的所有有序引數(或一個空元組)。第二個成員,其可以通過 " "``kwargs`` 屬性訪問,是所有關鍵字引數(或一個空字典)。" -#: ../../library/unittest.mock.rst:649 +#: ../../library/unittest.mock.rst:672 msgid "" -":attr:`call_args`, along with members of the lists :attr:`call_args_list`, :" -"attr:`method_calls` and :attr:`mock_calls` are :data:`call` objects. These " -"are tuples, so they can be unpacked to get at the individual arguments and " -"make more complex assertions. See :ref:`calls as tuples `." +":attr:`call_args`, along with members of the " +"lists :attr:`call_args_list`, :attr:`method_calls` and :attr:`mock_calls` " +"are :data:`call` objects. These are tuples, so they can be unpacked to get " +"at the individual arguments and make more complex assertions. " +"See :ref:`calls as tuples `." msgstr "" -":attr:`call_args`,以及串列 :attr:`call_args_list`、:attr:`method_calls` 和 :" -"attr:`mock_calls` 的成員都是 :data:`call` 物件。這些都是元組,因此可以解包以" -"獲取各個引數並進行更複雜的斷言。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:655 +#: ../../library/unittest.mock.rst:678 msgid "Added ``args`` and ``kwargs`` properties." msgstr "新增 ``args`` 與 ``kwargs`` 特性。" -#: ../../library/unittest.mock.rst:661 +#: ../../library/unittest.mock.rst:684 msgid "" "This is a list of all the calls made to the mock object in sequence (so the " "length of the list is the number of times it has been called). Before any " "calls have been made it is an empty list. The :data:`call` object can be " -"used for conveniently constructing lists of calls to compare with :attr:" -"`call_args_list`." +"used for conveniently constructing lists of calls to compare " +"with :attr:`call_args_list`." msgstr "" "這是按順序列出所有呼叫 mock 物件的串列(因此串列的長度表示它被呼叫的次數)。" "在任何呼叫發生之前,它會是一個空的串列。 :data:`call` 物件可用於方便地建構呼" "叫的串列,以便與 :attr:`call_args_list` 進行比較。" -#: ../../library/unittest.mock.rst:677 +#: ../../library/unittest.mock.rst:700 msgid "" "Members of :attr:`call_args_list` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " @@ -711,7 +773,7 @@ msgstr "" ":attr:`call_args_list` 的成員都是 :data:`call` 物件。這些物件可以被拆包為元" "組,以取得各個引數。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:684 +#: ../../library/unittest.mock.rst:707 msgid "" "As well as tracking calls to themselves, mocks also track calls to methods " "and attributes, and *their* methods and attributes:" @@ -719,7 +781,7 @@ msgstr "" "除了追蹤對自身的呼叫之外,mock 還會追蹤對方法和屬性的呼叫,以及\\ *它們(這些" "方法和屬性)*\\ 的方法和屬性:" -#: ../../library/unittest.mock.rst:695 +#: ../../library/unittest.mock.rst:718 msgid "" "Members of :attr:`method_calls` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " @@ -728,7 +790,7 @@ msgstr "" ":attr:`method_calls` 的成員都是 :data:`call` 物件。這些物件可以拆包為元組,以" "取得各個引數。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:702 +#: ../../library/unittest.mock.rst:725 msgid "" ":attr:`mock_calls` records *all* calls to the mock object, its methods, " "magic methods *and* return value mocks." @@ -736,7 +798,7 @@ msgstr "" ":attr:`mock_calls` 記錄了 *所有* 對 mock 物件的呼叫,包含其方法、魔術方法以及" "回傳值 mock。" -#: ../../library/unittest.mock.rst:720 +#: ../../library/unittest.mock.rst:743 msgid "" "Members of :attr:`mock_calls` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " @@ -745,7 +807,7 @@ msgstr "" ":attr:`method_calls` 的成員都是 :data:`call` 物件。這些物件可以拆包為元組,以" "取得各個引數。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:726 +#: ../../library/unittest.mock.rst:749 msgid "" "The way :attr:`mock_calls` are recorded means that where nested calls are " "made, the parameters of ancestor calls are not recorded and so will always " @@ -754,7 +816,7 @@ msgstr "" ":attr:`mock_calls` 記錄的方式意味著在進行巢狀呼叫時,上代 (ancestor) 呼叫的參" "數不會被記錄,因此在比較時它們將始終相等:" -#: ../../library/unittest.mock.rst:740 +#: ../../library/unittest.mock.rst:763 msgid "" "Normally the :attr:`!__class__` attribute of an object will return its type. " "For a mock object with a :attr:`!spec`, :attr:`!__class__` returns the spec " @@ -765,15 +827,15 @@ msgstr "" "的 mock 物件,:attr:`!__class__` 會回傳 spec 的類別。這允許 mock 物件通過對它" "們所替代或偽裝的物件進行的 :func:`isinstance` 測試:" -#: ../../library/unittest.mock.rst:749 +#: ../../library/unittest.mock.rst:772 msgid "" -":attr:`!__class__` is assignable to, this allows a mock to pass an :func:" -"`isinstance` check without forcing you to use a spec:" +":attr:`!__class__` is assignable to, this allows a mock to pass " +"an :func:`isinstance` check without forcing you to use a spec:" msgstr "" ":attr:`!__class__` 可以被指定,這允許 mock 通過 :func:`isinstance` 檢查,而不" "需要強制使用 spec:" -#: ../../library/unittest.mock.rst:759 +#: ../../library/unittest.mock.rst:782 msgid "" "A non-callable version of :class:`Mock`. The constructor parameters have the " "same meaning of :class:`Mock`, with the exception of *return_value* and " @@ -782,34 +844,34 @@ msgstr "" ":class:`Mock` 的一個不可呼叫版本。建構函式參數的意義與 :class:`Mock` 相同,其" "例外為 *return_value* 和 *side_effect* 在不可呼叫的 mock 上無意義。" -#: ../../library/unittest.mock.rst:763 +#: ../../library/unittest.mock.rst:786 msgid "" "Mock objects that use a class or an instance as a :attr:`!spec` or :attr:`!" "spec_set` are able to pass :func:`isinstance` tests:" msgstr "" -"使用類別或實例作為 :attr:`!spec` 或 :attr:`!spec_set` 的 mock 物件能夠通過 :" -"func:`isinstance` 測試:" +"使用類別或實例作為 :attr:`!spec` 或 :attr:`!spec_set` 的 mock 物件能夠通" +"過 :func:`isinstance` 測試:" -#: ../../library/unittest.mock.rst:773 +#: ../../library/unittest.mock.rst:796 msgid "" -"The :class:`Mock` classes have support for mocking magic methods. See :ref:" -"`magic methods ` for the full details." +"The :class:`Mock` classes have support for mocking magic methods. " +"See :ref:`magic methods ` for the full details." msgstr "" ":class:`Mock` 類別支援 mock 魔術方法。細節請參考\\ :ref:`魔術方法 `。" -#: ../../library/unittest.mock.rst:776 +#: ../../library/unittest.mock.rst:799 msgid "" "The mock classes and the :func:`patch` decorators all take arbitrary keyword " "arguments for configuration. For the :func:`patch` decorators the keywords " "are passed to the constructor of the mock being created. The keyword " "arguments are for configuring attributes of the mock:" msgstr "" -"Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對於 :func:" -"`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵字引數用" -"於配置 mock 的屬性:" +"Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對" +"於 :func:`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵" +"字引數用於配置 mock 的屬性:" -#: ../../library/unittest.mock.rst:787 +#: ../../library/unittest.mock.rst:810 msgid "" "The return value and side effect of child mocks can be set in the same way, " "using dotted notation. As you can't use dotted names directly in a call you " @@ -818,7 +880,7 @@ msgstr "" "Child mock 的回傳值和 side effect 可以使用使用點記法進行設置。由於你無法直接" "在呼叫中使用帶有點 (.) 的名稱,因此你必須建立一個字典並使用 ``**`` 解包:" -#: ../../library/unittest.mock.rst:802 +#: ../../library/unittest.mock.rst:825 msgid "" "A callable mock which was created with a *spec* (or a *spec_set*) will " "introspect the specification object's signature when matching calls to the " @@ -829,7 +891,7 @@ msgstr "" "將會內省 (introspect) 規格物件的簽名 (signature)。因此,它可以匹配實際呼叫的" "引數,無論它們是按位置傳遞還是按名稱傳遞: ::" -#: ../../library/unittest.mock.rst:807 +#: ../../library/unittest.mock.rst:830 msgid "" ">>> def f(a, b, c): pass\n" "...\n" @@ -847,36 +909,36 @@ msgstr "" ">>> mock.assert_called_with(1, 2, 3)\n" ">>> mock.assert_called_with(a=1, b=2, c=3)" -#: ../../library/unittest.mock.rst:815 +#: ../../library/unittest.mock.rst:838 msgid "" -"This applies to :meth:`~Mock.assert_called_with`, :meth:`~Mock." -"assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock." -"assert_any_call`. When :ref:`auto-speccing`, it will also apply to method " -"calls on the mock object." +"This applies " +"to :meth:`~Mock.assert_called_with`, :meth:`~Mock.assert_called_once_with`, :meth:`~Mock.assert_has_calls` " +"and :meth:`~Mock.assert_any_call`. When :ref:`auto-speccing`, it will also " +"apply to method calls on the mock object." msgstr "" -"這適用於 :meth:`~Mock.assert_called_with`、:meth:`~Mock." -"assert_called_once_with`、:meth:`~Mock.assert_has_calls` 和 :meth:`~Mock." -"assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 mock 物件的方法" -"呼叫。" +"這適用" +"於 :meth:`~Mock.assert_called_with`、:meth:`~Mock.assert_called_once_with`、:meth:`~Mock.assert_has_calls` " +"和 :meth:`~Mock.assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 " +"mock 物件的方法呼叫。" -#: ../../library/unittest.mock.rst:820 +#: ../../library/unittest.mock.rst:843 msgid "Added signature introspection on specced and autospecced mock objects." msgstr "" "對於已經設置了規格(spec)和自動規格(autospec)的 mock 物件,新增簽名內省功" "能。" -#: ../../library/unittest.mock.rst:826 +#: ../../library/unittest.mock.rst:849 msgid "" -"A mock intended to be used as a :class:`property`, or other :term:" -"`descriptor`, on a class. :class:`PropertyMock` provides :meth:`~object." -"__get__` and :meth:`~object.__set__` methods so you can specify a return " -"value when it is fetched." +"A mock intended to be used as a :class:`property`, or " +"other :term:`descriptor`, on a class. :class:`PropertyMock` " +"provides :meth:`~object.__get__` and :meth:`~object.__set__` methods so you " +"can specify a return value when it is fetched." msgstr "" -"一個理應在類別上當成 :class:`property` 或其他 :term:`descriptor` 的 mock。:" -"class:`PropertyMock` 提供了 :meth:`~object.__get__` 和 :meth:`~object." -"__set__` 方法,因此你可以在它被提取時指定回傳值。" +"一個理應在類別上當成 :class:`property` 或其他 :term:`descriptor` 的 " +"mock。:class:`PropertyMock` 提供了 :meth:`~object.__get__` " +"和 :meth:`~object.__set__` 方法,因此你可以在它被提取時指定回傳值。" -#: ../../library/unittest.mock.rst:831 +#: ../../library/unittest.mock.rst:854 msgid "" "Fetching a :class:`PropertyMock` instance from an object calls the mock, " "with no args. Setting it calls the mock with the value being set. ::" @@ -884,7 +946,7 @@ msgstr "" "從物件中提取 :class:`PropertyMock` 實例會不帶任何引數呼叫 mock。設定它則會用" "設定的值來呼叫 mock: ::" -#: ../../library/unittest.mock.rst:834 +#: ../../library/unittest.mock.rst:857 msgid "" ">>> class Foo:\n" "... @property\n" @@ -922,16 +984,16 @@ msgstr "" ">>> mock_foo.mock_calls\n" "[call(), call(6)]" -#: ../../library/unittest.mock.rst:852 +#: ../../library/unittest.mock.rst:875 msgid "" -"Because of the way mock attributes are stored you can't directly attach a :" -"class:`PropertyMock` to a mock object. Instead you can attach it to the mock " -"type object::" +"Because of the way mock attributes are stored you can't directly attach " +"a :class:`PropertyMock` to a mock object. Instead you can attach it to the " +"mock type object::" msgstr "" "由於 mock 屬性的儲存方式,你無法直接將 :class:`PropertyMock` 附加到 mock 物" "件。但是你可以將其附加到 mock 型別的物件: ::" -#: ../../library/unittest.mock.rst:856 +#: ../../library/unittest.mock.rst:879 msgid "" ">>> m = MagicMock()\n" ">>> p = PropertyMock(return_value=3)\n" @@ -947,14 +1009,14 @@ msgstr "" "3\n" ">>> p.assert_called_once_with()" -#: ../../library/unittest.mock.rst:865 +#: ../../library/unittest.mock.rst:888 msgid "" "If an :exc:`AttributeError` is raised by :class:`PropertyMock`, it will be " "interpreted as a missing descriptor and :meth:`~object.__getattr__` will be " "called on the parent mock::" msgstr "" -#: ../../library/unittest.mock.rst:869 +#: ../../library/unittest.mock.rst:892 msgid "" ">>> m = MagicMock()\n" ">>> no_attribute = PropertyMock(side_effect=AttributeError)\n" @@ -968,11 +1030,11 @@ msgstr "" ">>> m.my_property\n" "" -#: ../../library/unittest.mock.rst:875 +#: ../../library/unittest.mock.rst:898 msgid "See :meth:`~object.__getattr__` for details." msgstr "詳情請見 :meth:`~object.__getattr__`。" -#: ../../library/unittest.mock.rst:880 +#: ../../library/unittest.mock.rst:903 msgid "" "An asynchronous version of :class:`MagicMock`. The :class:`AsyncMock` object " "will behave so the object is recognized as an async function, and the result " @@ -981,7 +1043,7 @@ msgstr "" ":class:`MagicMock` 的非同步版本。:class:`AsyncMock` 物件的表現將被視為非同步" "函式,並且呼叫的結果是一個可等待物件。" -#: ../../library/unittest.mock.rst:890 +#: ../../library/unittest.mock.rst:913 msgid "" "The result of ``mock()`` is an async function which will have the outcome of " "``side_effect`` or ``return_value`` after it has been awaited:" @@ -989,19 +1051,19 @@ msgstr "" "``mock()`` 的結果是一個非同步函式,在它被等待後將具有 ``side_effect`` 或 " "``return_value`` 的結果:" -#: ../../library/unittest.mock.rst:893 +#: ../../library/unittest.mock.rst:916 msgid "" "if ``side_effect`` is a function, the async function will return the result " "of that function," msgstr "如果 ``side_effect`` 是一個函式,非同步函式將回傳該函式的結果," -#: ../../library/unittest.mock.rst:895 +#: ../../library/unittest.mock.rst:918 msgid "" "if ``side_effect`` is an exception, the async function will raise the " "exception," msgstr "如果 ``side_effect`` 是一個例外,則非同步函式將引發該例外," -#: ../../library/unittest.mock.rst:897 +#: ../../library/unittest.mock.rst:920 msgid "" "if ``side_effect`` is an iterable, the async function will return the next " "value of the iterable, however, if the sequence of result is exhausted, " @@ -1010,7 +1072,7 @@ msgstr "" "如果 ``side_effect`` 是一個可疊代物件,非同步函式將回傳可疊代物件的下一個值," "但如果結果序列耗盡,將立即引發 ``StopAsyncIteration``," -#: ../../library/unittest.mock.rst:900 +#: ../../library/unittest.mock.rst:923 msgid "" "if ``side_effect`` is not defined, the async function will return the value " "defined by ``return_value``, hence, by default, the async function returns a " @@ -1019,7 +1081,7 @@ msgstr "" "如果 ``side_effect`` 沒有被定義,非同步函式將回傳由 ``return_value`` 定義的" "值,因此在預設情況下,非同步函式回傳一個新的 :class:`AsyncMock` 物件。" -#: ../../library/unittest.mock.rst:905 +#: ../../library/unittest.mock.rst:928 msgid "" "Setting the *spec* of a :class:`Mock` or :class:`MagicMock` to an async " "function will result in a coroutine object being returned after calling." @@ -1027,22 +1089,22 @@ msgstr "" "將 :class:`Mock` 或 :class:`MagicMock` 的 *spec* 設定為非同步函式將導致在呼叫" "後回傳一個協程物件。" -#: ../../library/unittest.mock.rst:917 +#: ../../library/unittest.mock.rst:940 msgid "" -"Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, or :class:" -"`AsyncMock` to a class with asynchronous and synchronous functions will " -"automatically detect the synchronous functions and set them as :class:" -"`MagicMock` (if the parent mock is :class:`AsyncMock` or :class:`MagicMock`) " -"or :class:`Mock` (if the parent mock is :class:`Mock`). All asynchronous " -"functions will be :class:`AsyncMock`." +"Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, " +"or :class:`AsyncMock` to a class with asynchronous and synchronous functions " +"will automatically detect the synchronous functions and set them " +"as :class:`MagicMock` (if the parent mock is :class:`AsyncMock` " +"or :class:`MagicMock`) or :class:`Mock` (if the parent mock " +"is :class:`Mock`). All asynchronous functions will be :class:`AsyncMock`." msgstr "" "將 :class:`Mock`、:class:`MagicMock` 或 :class:`AsyncMock` 的 *spec* 設定為具" -"有同步和非同步函式的類別,會自動檢測同步函式並將其設定為 :class:" -"`MagicMock`\\ (如果上代 mock 為 :class:`AsyncMock` 或 :class:" -"`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock 為 :class:`Mock`\\ )。所" -"有非同步函式將被設定為 :class:`AsyncMock`。" +"有同步和非同步函式的類別,會自動檢測同步函式並將其設定" +"為 :class:`MagicMock`\\ (如果上代 mock 為 :class:`AsyncMock` " +"或 :class:`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock " +"為 :class:`Mock`\\ )。所有非同步函式將被設定為 :class:`AsyncMock`。" -#: ../../library/unittest.mock.rst:945 +#: ../../library/unittest.mock.rst:968 msgid "" "Assert that the mock was awaited at least once. Note that this is separate " "from the object having been called, the ``await`` keyword must be used:" @@ -1050,33 +1112,33 @@ msgstr "" "斷言 mock 至少被等待過一次。請注意這與物件是否被呼叫是分開的,``await`` 關鍵" "字必須被使用:" -#: ../../library/unittest.mock.rst:964 +#: ../../library/unittest.mock.rst:987 msgid "Assert that the mock was awaited exactly once." msgstr "斷言 mock 正好被等待了一次。" -#: ../../library/unittest.mock.rst:980 +#: ../../library/unittest.mock.rst:1003 msgid "Assert that the last await was with the specified arguments." msgstr "斷言最後一次等待使用了指定的引數。" -#: ../../library/unittest.mock.rst:997 +#: ../../library/unittest.mock.rst:1020 msgid "" "Assert that the mock was awaited exactly once and with the specified " "arguments." msgstr "斷言 mock 只被等待了一次並使用了指定的引數。" -#: ../../library/unittest.mock.rst:1014 +#: ../../library/unittest.mock.rst:1037 msgid "Assert the mock has ever been awaited with the specified arguments." msgstr "斷言 mock 曾經被使用指定的引數等待過。" -#: ../../library/unittest.mock.rst:1030 +#: ../../library/unittest.mock.rst:1053 msgid "" -"Assert the mock has been awaited with the specified calls. The :attr:" -"`await_args_list` list is checked for the awaits." +"Assert the mock has been awaited with the specified calls. " +"The :attr:`await_args_list` list is checked for the awaits." msgstr "" "斷言 mock 已被使用指定的呼叫進行等待。:attr:`await_args_list` 串列將被檢查以" "確認等待的內容。" -#: ../../library/unittest.mock.rst:1033 +#: ../../library/unittest.mock.rst:1056 msgid "" "If *any_order* is false then the awaits must be sequential. There can be " "extra calls before or after the specified awaits." @@ -1084,41 +1146,41 @@ msgstr "" "如果 *any_order* 為 false,則等待必須按照順序。指定的等待之前或之後可以有額外" "的呼叫。" -#: ../../library/unittest.mock.rst:1037 +#: ../../library/unittest.mock.rst:1060 msgid "" "If *any_order* is true then the awaits can be in any order, but they must " "all appear in :attr:`await_args_list`." msgstr "" -"如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現在 :" -"attr:`await_args_list` 中。" +"如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現" +"在 :attr:`await_args_list` 中。" -#: ../../library/unittest.mock.rst:1057 +#: ../../library/unittest.mock.rst:1080 msgid "Assert that the mock was never awaited." msgstr "斷言 mock 從未被等待。" -#: ../../library/unittest.mock.rst:1064 +#: ../../library/unittest.mock.rst:1087 msgid "" -"See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to 0, :attr:" -"`await_args` to None, and clears the :attr:`await_args_list`." +"See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to " +"0, :attr:`await_args` to None, and clears the :attr:`await_args_list`." msgstr "" -"參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 0,:attr:" -"`await_args` 設定為 None,並清除 :attr:`await_args_list`。" +"參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 " +"0,:attr:`await_args` 設定為 None,並清除 :attr:`await_args_list`。" -#: ../../library/unittest.mock.rst:1069 +#: ../../library/unittest.mock.rst:1092 msgid "" "An integer keeping track of how many times the mock object has been awaited." msgstr "一個整數,用來記錄 mock 物件已被等待的次數。" -#: ../../library/unittest.mock.rst:1084 +#: ../../library/unittest.mock.rst:1107 msgid "" "This is either ``None`` (if the mock hasn’t been awaited), or the arguments " -"that the mock was last awaited with. Functions the same as :attr:`Mock." -"call_args`." +"that the mock was last awaited with. Functions the same " +"as :attr:`Mock.call_args`." msgstr "" "這可能是 ``None``\\ (如果 mock 尚未被等待),或者是上次等待 mock 時使用的引" "數。與 :attr:`Mock.call_args` 的功能相同。" -#: ../../library/unittest.mock.rst:1102 +#: ../../library/unittest.mock.rst:1125 msgid "" "This is a list of all the awaits made to the mock object in sequence (so the " "length of the list is the number of times it has been awaited). Before any " @@ -1127,78 +1189,78 @@ msgstr "" "這是一個按照順序記錄 mock 物件所有等待的串列(因此串列的長度表示該物件已被等" "待的次數)。在進行任何等待之前,此串列為空。" -#: ../../library/unittest.mock.rst:1122 +#: ../../library/unittest.mock.rst:1145 msgid "" -"A version of :class:`MagicMock` for multithreading tests. The :class:" -"`ThreadingMock` object provides extra methods to wait for a call to be " -"invoked, rather than assert on it immediately." +"A version of :class:`MagicMock` for multithreading tests. " +"The :class:`ThreadingMock` object provides extra methods to wait for a call " +"to be invoked, rather than assert on it immediately." msgstr "" -#: ../../library/unittest.mock.rst:1126 +#: ../../library/unittest.mock.rst:1149 msgid "" "The default timeout is specified by the ``timeout`` argument, or if unset by " "the :attr:`ThreadingMock.DEFAULT_TIMEOUT` attribute, which defaults to " "blocking (``None``)." msgstr "" -#: ../../library/unittest.mock.rst:1129 +#: ../../library/unittest.mock.rst:1152 msgid "" -"You can configure the global default timeout by setting :attr:`ThreadingMock." -"DEFAULT_TIMEOUT`." +"You can configure the global default timeout by " +"setting :attr:`ThreadingMock.DEFAULT_TIMEOUT`." msgstr "" -#: ../../library/unittest.mock.rst:1133 +#: ../../library/unittest.mock.rst:1156 msgid "Waits until the mock is called." msgstr "等待直到 mock 被呼叫。" -#: ../../library/unittest.mock.rst:1135 +#: ../../library/unittest.mock.rst:1158 msgid "" "If a timeout was passed at the creation of the mock or if a timeout argument " "is passed to this function, the function raises an :exc:`AssertionError` if " "the call is not performed in time." msgstr "" -#: ../../library/unittest.mock.rst:1147 +#: ../../library/unittest.mock.rst:1170 msgid "Waits until the mock is called with the specified arguments." msgstr "等到直到 mock 被以特定引數呼叫。" -#: ../../library/unittest.mock.rst:1149 +#: ../../library/unittest.mock.rst:1172 msgid "" -"If a timeout was passed at the creation of the mock the function raises an :" -"exc:`AssertionError` if the call is not performed in time." +"If a timeout was passed at the creation of the mock the function raises " +"an :exc:`AssertionError` if the call is not performed in time." msgstr "" -#: ../../library/unittest.mock.rst:1160 +#: ../../library/unittest.mock.rst:1183 msgid "" -"Global default timeout in seconds to create instances of :class:" -"`ThreadingMock`." +"Global default timeout in seconds to create instances " +"of :class:`ThreadingMock`." msgstr "" -#: ../../library/unittest.mock.rst:1166 +#: ../../library/unittest.mock.rst:1189 msgid "Calling" msgstr "呼叫" -#: ../../library/unittest.mock.rst:1168 +#: ../../library/unittest.mock.rst:1191 msgid "" -"Mock objects are callable. The call will return the value set as the :attr:" -"`~Mock.return_value` attribute. The default return value is a new Mock " -"object; it is created the first time the return value is accessed (either " -"explicitly or by calling the Mock) - but it is stored and the same one " -"returned each time." +"Mock objects are callable. The call will return the value set as " +"the :attr:`~Mock.return_value` attribute. The default return value is a new " +"Mock object; it is created the first time the return value is accessed " +"(either explicitly or by calling the Mock) - but it is stored and the same " +"one returned each time." msgstr "" "Mock 物件可被呼叫。呼叫將回傳設定為 :attr:`~Mock.return_value` 屬性的值。預設" "的回傳值是一個新的 Mock 物件;它會在第一次存取回傳值時(無論是顯式存取還是透" "過呼叫 Mock)被建立,但是這個回傳值會被儲存,之後每次都回傳同一個值。" -#: ../../library/unittest.mock.rst:1174 +#: ../../library/unittest.mock.rst:1197 msgid "" -"Calls made to the object will be recorded in the attributes like :attr:" -"`~Mock.call_args` and :attr:`~Mock.call_args_list`." +"Calls made to the object will be recorded in the attributes " +"like :attr:`~Mock.call_args` and :attr:`~Mock.call_args_list`." msgstr "" -"對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` 和 :attr:`~Mock." -"call_args_list` 等屬性中。" +"對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` " +"和 :attr:`~Mock.call_args_list` 等屬性中。" -#: ../../library/unittest.mock.rst:1177 +#: ../../library/unittest.mock.rst:1200 msgid "" "If :attr:`~Mock.side_effect` is set then it will be called after the call " "has been recorded, so if :attr:`!side_effect` raises an exception the call " @@ -1207,15 +1269,15 @@ msgstr "" "如果 :attr:`~Mock.side_effect` 被設定,那麼在呼叫被記錄後它才會被呼叫,所以如" "果 :attr:`!side_effect` 引發例外,呼叫仍然會被記錄。" -#: ../../library/unittest.mock.rst:1181 +#: ../../library/unittest.mock.rst:1204 msgid "" -"The simplest way to make a mock raise an exception when called is to make :" -"attr:`~Mock.side_effect` an exception class or instance:" +"The simplest way to make a mock raise an exception when called is to " +"make :attr:`~Mock.side_effect` an exception class or instance:" msgstr "" "呼叫 mock 時引發例外的最簡單方式是將 :attr:`~Mock.side_effect` 設定為例外類別" "或實例:" -#: ../../library/unittest.mock.rst:1199 +#: ../../library/unittest.mock.rst:1222 msgid "" "If :attr:`~Mock.side_effect` is a function then whatever that function " "returns is what calls to the mock return. The :attr:`!side_effect` function " @@ -1226,7 +1288,7 @@ msgstr "" "叫所回傳的值。:attr:`!side_effect` 函式會使用與 mock 相同的引數被呼叫。這讓你" "可以根據輸入動態地變更呼叫的回傳值:" -#: ../../library/unittest.mock.rst:1215 +#: ../../library/unittest.mock.rst:1238 msgid "" "If you want the mock to still return the default return value (a new mock), " "or any set return value, then there are two ways of doing this. Either " @@ -1234,10 +1296,10 @@ msgid "" "return :data:`DEFAULT`:" msgstr "" "如果你希望 mock 仍然回傳預設的回傳值(一個新的 mock),或者是任何已設定的回傳" -"值,有兩種方法可以實現。從 :attr:`~Mock.side_effect` 內部回傳 :attr:`~Mock." -"return_value`,或回傳 :data:`DEFAULT`:" +"值,有兩種方法可以實現。從 :attr:`~Mock.side_effect` 內部回" +"傳 :attr:`~Mock.return_value`,或回傳 :data:`DEFAULT`:" -#: ../../library/unittest.mock.rst:1234 +#: ../../library/unittest.mock.rst:1257 msgid "" "To remove a :attr:`~Mock.side_effect`, and return to the default behaviour, " "set the :attr:`!side_effect` to ``None``:" @@ -1245,7 +1307,7 @@ msgstr "" "要刪除 :attr:`~Mock.side_effect`,並恢復預設行為,將 :attr:`!side_effect` 設" "為 ``None``:" -#: ../../library/unittest.mock.rst:1248 +#: ../../library/unittest.mock.rst:1271 msgid "" "The :attr:`~Mock.side_effect` can also be any iterable object. Repeated " "calls to the mock will return values from the iterable (until the iterable " @@ -1254,13 +1316,13 @@ msgstr "" ":attr:`~Mock.side_effect` 也可以是任何可疊代的物件。對 mock 的重複呼叫將從可" "疊代物件中回傳值(直到疊代物件耗盡並引發 :exc:`StopIteration` 為止):" -#: ../../library/unittest.mock.rst:1264 +#: ../../library/unittest.mock.rst:1287 msgid "" "If any members of the iterable are exceptions they will be raised instead of " "returned::" msgstr "如果可疊代物件中的任何成員是例外,則它們將被引發而不是被回傳: ::" -#: ../../library/unittest.mock.rst:1267 +#: ../../library/unittest.mock.rst:1290 msgid "" ">>> iterable = (33, ValueError, 66)\n" ">>> m = MagicMock(side_effect=iterable)\n" @@ -1284,17 +1346,17 @@ msgstr "" ">>> m()\n" "66" -#: ../../library/unittest.mock.rst:1282 +#: ../../library/unittest.mock.rst:1305 msgid "Deleting Attributes" msgstr "刪除屬性" -#: ../../library/unittest.mock.rst:1284 +#: ../../library/unittest.mock.rst:1307 msgid "" "Mock objects create attributes on demand. This allows them to pretend to be " "objects of any type." msgstr "Mock 物件會在需要時建立屬性。這使得它們可以假裝成任何種類的物件。" -#: ../../library/unittest.mock.rst:1287 +#: ../../library/unittest.mock.rst:1310 msgid "" "You may want a mock object to return ``False`` to a :func:`hasattr` call, or " "raise an :exc:`AttributeError` when an attribute is fetched. You can do this " @@ -1305,30 +1367,30 @@ msgstr "" "提取時引發 :exc:`AttributeError`。你可以通過將物件提供為 mock 的 :attr:`!" "spec` 來實現這一點,但這並不總是那麼好用。" -#: ../../library/unittest.mock.rst:1291 +#: ../../library/unittest.mock.rst:1314 msgid "" "You \"block\" attributes by deleting them. Once deleted, accessing an " "attribute will raise an :exc:`AttributeError`." msgstr "" -"你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引發 :exc:" -"`AttributeError`。" +"你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引" +"發 :exc:`AttributeError`。" -#: ../../library/unittest.mock.rst:1308 +#: ../../library/unittest.mock.rst:1331 msgid "Mock names and the name attribute" msgstr "Mock 名稱與名稱屬性" -#: ../../library/unittest.mock.rst:1310 +#: ../../library/unittest.mock.rst:1333 msgid "" "Since \"name\" is an argument to the :class:`Mock` constructor, if you want " "your mock object to have a \"name\" attribute you can't just pass it in at " -"creation time. There are two alternatives. One option is to use :meth:`~Mock." -"configure_mock`::" +"creation time. There are two alternatives. One option is to " +"use :meth:`~Mock.configure_mock`::" msgstr "" "由於 \"name\" 是傳遞給 :class:`Mock` 建構函式的引數,如果你想讓你的 mock 物件" "擁有 \"name\" 屬性,你不能在建立時直接傳遞它。有兩種替代方法。其中一個選擇是" "使用 :meth:`~Mock.configure_mock`: ::" -#: ../../library/unittest.mock.rst:1315 +#: ../../library/unittest.mock.rst:1338 msgid "" ">>> mock = MagicMock()\n" ">>> mock.configure_mock(name='my_name')\n" @@ -1340,13 +1402,13 @@ msgstr "" ">>> mock.name\n" "'my_name'" -#: ../../library/unittest.mock.rst:1320 +#: ../../library/unittest.mock.rst:1343 msgid "" "A simpler option is to simply set the \"name\" attribute after mock " "creation::" msgstr "更簡單的方法是在 mock 建立後直接設定 \"name\" 屬性: ::" -#: ../../library/unittest.mock.rst:1322 +#: ../../library/unittest.mock.rst:1345 msgid "" ">>> mock = MagicMock()\n" ">>> mock.name = \"foo\"" @@ -1354,11 +1416,11 @@ msgstr "" ">>> mock = MagicMock()\n" ">>> mock.name = \"foo\"" -#: ../../library/unittest.mock.rst:1327 +#: ../../library/unittest.mock.rst:1350 msgid "Attaching Mocks as Attributes" msgstr "如同屬性一般附加 mock" -#: ../../library/unittest.mock.rst:1329 +#: ../../library/unittest.mock.rst:1352 msgid "" "When you attach a mock as an attribute of another mock (or as the return " "value) it becomes a \"child\" of that mock. Calls to the child are recorded " @@ -1374,7 +1436,7 @@ msgstr "" "mock 附加到記錄所有對子代的呼叫的上代並允許你對 mock 間的呼叫順序進行斷言非常" "有用:" -#: ../../library/unittest.mock.rst:1347 +#: ../../library/unittest.mock.rst:1370 msgid "" "The exception to this is if the mock has a name. This allows you to prevent " "the \"parenting\" if for some reason you don't want it to happen." @@ -1382,16 +1444,16 @@ msgstr "" "如果 mock 有 name 引數,則上述規則會有例外。這使你可以防止「親屬關係 " "(parenting)」的建立,假設因為某些原因你不希望這種狀況發生。" -#: ../../library/unittest.mock.rst:1358 +#: ../../library/unittest.mock.rst:1381 msgid "" "Mocks created for you by :func:`patch` are automatically given names. To " -"attach mocks that have names to a parent you use the :meth:`~Mock." -"attach_mock` method::" +"attach mocks that have names to a parent you use " +"the :meth:`~Mock.attach_mock` method::" msgstr "" "由 :func:`patch` 為你建立的 mock 會自動被賦予名稱。若要將具有名稱的 mock 附加" "到上代,你可以使用 :meth:`~Mock.attach_mock` 方法: ::" -#: ../../library/unittest.mock.rst:1362 +#: ../../library/unittest.mock.rst:1385 msgid "" ">>> thing1 = object()\n" ">>> thing2 = object()\n" @@ -1419,7 +1481,7 @@ msgstr "" ">>> parent.mock_calls\n" "[call.child1('one'), call.child2('two')]" -#: ../../library/unittest.mock.rst:1376 +#: ../../library/unittest.mock.rst:1399 msgid "" "The only exceptions are magic methods and attributes (those that have " "leading and trailing double underscores). Mock doesn't create these but " @@ -1428,16 +1490,16 @@ msgid "" "a new Mock object when it expects a magic method. If you need magic method " "support see :ref:`magic methods `." msgstr "" -"唯一的例外是魔術方法和屬性(具有前後雙底線)。Mock 不會建立這些,而是會引發 :" -"exc:`AttributeError`。這是因為直譯器通常會隱式地要求這些方法,在期望得到一個" -"魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需要魔" -"術方法的支援,請參閱\\ :ref:`魔術方法 `。" +"唯一的例外是魔術方法和屬性(具有前後雙底線)。Mock 不會建立這些,而是會引" +"發 :exc:`AttributeError`。這是因為直譯器通常會隱式地要求這些方法,在期望得到" +"一個魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需" +"要魔術方法的支援,請參閱\\ :ref:`魔術方法 `。" -#: ../../library/unittest.mock.rst:1385 +#: ../../library/unittest.mock.rst:1408 msgid "The patchers" msgstr "Patchers" -#: ../../library/unittest.mock.rst:1387 +#: ../../library/unittest.mock.rst:1410 msgid "" "The patch decorators are used for patching objects only within the scope of " "the function they decorate. They automatically handle the unpatching for " @@ -1448,17 +1510,17 @@ msgstr "" "patch 的中止,即使有異常被引發也是如此。所有這些函式也可以在 with 陳述式中使" "用,或者作為類別裝飾器使用。" -#: ../../library/unittest.mock.rst:1394 +#: ../../library/unittest.mock.rst:1417 msgid "patch" msgstr "patch" -#: ../../library/unittest.mock.rst:1398 +#: ../../library/unittest.mock.rst:1421 msgid "" "The key is to do the patching in the right namespace. See the section `where " "to patch`_." msgstr "關鍵是要在正確的命名空間進行 patch。請參閱 `where to patch`_ 一節。" -#: ../../library/unittest.mock.rst:1402 +#: ../../library/unittest.mock.rst:1425 msgid "" ":func:`patch` acts as a function decorator, class decorator or a context " "manager. Inside the body of the function or with statement, the *target* is " @@ -1469,7 +1531,7 @@ msgstr "" "內部,*目標*\\ 會被 patch 成一個\\ *新的*\\ 物件。當函式或 with 陳述式結束" "時,patch 就會被解除。" -#: ../../library/unittest.mock.rst:1407 +#: ../../library/unittest.mock.rst:1430 msgid "" "If *new* is omitted, then the target is replaced with an :class:`AsyncMock` " "if the patched object is an async function or a :class:`MagicMock` " @@ -1478,12 +1540,13 @@ msgid "" "If :func:`patch` is used as a context manager the created mock is returned " "by the context manager." msgstr "" -"如果 *new* 被省略,則如果被 patch 的物件是非同步函式,目標會被替換為 :class:" -"`AsyncMock`,反之則替換為 :class:`MagicMock`。如果 :func:`patch` 做為裝飾器使" -"用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函式。如果 :" -"func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回傳。" +"如果 *new* 被省略,則如果被 patch 的物件是非同步函式,目標會被替換" +"為 :class:`AsyncMock`,反之則替換為 :class:`MagicMock`。如果 :func:`patch` 做" +"為裝飾器使用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函" +"式。如果 :func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回" +"傳。" -#: ../../library/unittest.mock.rst:1415 +#: ../../library/unittest.mock.rst:1438 msgid "" "*target* should be a string in the form ``'package.module.ClassName'``. The " "*target* is imported and the specified object replaced with the *new* " @@ -1492,19 +1555,19 @@ msgid "" "function is executed, not at decoration time." msgstr "" "*target* 應該是以 ``'package.module.ClassName'`` 形式出現的字串。*target* 會" -"被引入並用 *new* 物件替換指定的物件,因此 *target* 必須可從你呼叫 :func:" -"`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝飾器作用" -"時 (decoration time)。" +"被引入並用 *new* 物件替換指定的物件,因此 *target* 必須可從你呼" +"叫 :func:`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝" +"飾器作用時 (decoration time)。" -#: ../../library/unittest.mock.rst:1421 +#: ../../library/unittest.mock.rst:1444 msgid "" -"The *spec* and *spec_set* keyword arguments are passed to the :class:" -"`MagicMock` if patch is creating one for you." +"The *spec* and *spec_set* keyword arguments are passed to " +"the :class:`MagicMock` if patch is creating one for you." msgstr "" "*spec* 和 *spec_set* 關鍵字引數會傳遞給 :class:`MagicMock`,如果 patch 正在為" "你建立一個。" -#: ../../library/unittest.mock.rst:1424 +#: ../../library/unittest.mock.rst:1447 msgid "" "In addition you can pass ``spec=True`` or ``spec_set=True``, which causes " "patch to pass in the object being mocked as the spec/spec_set object." @@ -1512,17 +1575,18 @@ msgstr "" "此外,你還可以傳遞 ``spec=True`` 或 ``spec_set=True``,這將導致 patch 將被 " "mock 的物件作為 spec/spec_set 物件傳遞。" -#: ../../library/unittest.mock.rst:1427 +#: ../../library/unittest.mock.rst:1450 msgid "" "*new_callable* allows you to specify a different class, or callable object, " -"that will be called to create the *new* object. By default :class:" -"`AsyncMock` is used for async functions and :class:`MagicMock` for the rest." +"that will be called to create the *new* object. By " +"default :class:`AsyncMock` is used for async functions " +"and :class:`MagicMock` for the rest." msgstr "" "*new_callable* 允許你指定一個不同的類別或可呼叫的物件,用於被呼叫並建立 " "*new* 物件。預設情況下,對於非同步函式使用 :class:`AsyncMock`,而對於其他情況" "則使用 :class:`MagicMock`。" -#: ../../library/unittest.mock.rst:1431 +#: ../../library/unittest.mock.rst:1454 msgid "" "A more powerful form of *spec* is *autospec*. If you set ``autospec=True`` " "then the mock will be created with a spec from the object being replaced. " @@ -1530,17 +1594,17 @@ msgid "" "attribute of the object being replaced. Methods and functions being mocked " "will have their arguments checked and will raise a :exc:`TypeError` if they " "are called with the wrong signature. For mocks replacing a class, their " -"return value (the 'instance') will have the same spec as the class. See the :" -"func:`create_autospec` function and :ref:`auto-speccing`." +"return value (the 'instance') will have the same spec as the class. See " +"the :func:`create_autospec` function and :ref:`auto-speccing`." msgstr "" "*spec* 的一種更強大的形式是 *autospec*。如果你設定 ``autospec=True``,則該 " "mock 將使用被替換物件的規格來建立。該 mock 的所有屬性也將具有被替換物件的對應" "屬性的規格。被 mock 的方法和函式將檢查其引數,如果呼叫時引數與規格不符(被使" "用錯誤的簽名 (signature) 呼叫),將引發 :exc:`TypeError`。對於替換類別的 " -"mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參閱 :func:" -"`create_autospec` 函式和 :ref:`auto-speccing`。" +"mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參" +"閱 :func:`create_autospec` 函式和 :ref:`auto-speccing`。" -#: ../../library/unittest.mock.rst:1441 +#: ../../library/unittest.mock.rst:1464 msgid "" "Instead of ``autospec=True`` you can pass ``autospec=some_object`` to use an " "arbitrary object as the spec instead of the one being replaced." @@ -1548,7 +1612,7 @@ msgstr "" "你可以用 ``autospec=some_object`` 替代 ``autospec=True``,以使用任意物件作為" "規格,而不是被替換的物件。" -#: ../../library/unittest.mock.rst:1444 +#: ../../library/unittest.mock.rst:1467 msgid "" "By default :func:`patch` will fail to replace attributes that don't exist. " "If you pass in ``create=True``, and the attribute doesn't exist, patch will " @@ -1564,7 +1628,7 @@ msgstr "" "行環境建立的屬性的測試時非常有用。此功能預設為關閉,因為這可能會相當危險。開" "啟這個功能後,你可以對於實際上不存在的 API 撰寫會通過的測試!" -#: ../../library/unittest.mock.rst:1454 +#: ../../library/unittest.mock.rst:1477 msgid "" "If you are patching builtins in a module then you don't need to pass " "``create=True``, it will be added by default." @@ -1572,15 +1636,15 @@ msgstr "" "如果你正在 patch 模組中的內建函式,那麼你不需要傳遞 ``create=True``,它預設會" "被加入。" -#: ../../library/unittest.mock.rst:1458 +#: ../../library/unittest.mock.rst:1481 msgid "" "Patch can be used as a :class:`~unittest.TestCase` class decorator. It works " "by decorating each test method in the class. This reduces the boilerplate " "code when your test methods share a common patchings set. :func:`patch` " -"finds tests by looking for method names that start with ``patch." -"TEST_PREFIX``. By default this is ``'test'``, which matches the way :mod:" -"`unittest` finds tests. You can specify an alternative prefix by setting " -"``patch.TEST_PREFIX``." +"finds tests by looking for method names that start with " +"``patch.TEST_PREFIX``. By default this is ``'test'``, which matches the " +"way :mod:`unittest` finds tests. You can specify an alternative prefix by " +"setting ``patch.TEST_PREFIX``." msgstr "" "patch 可以做為 :class:`~unittest.TestCase` 類別的裝飾器使用。它透過裝飾類別中" "的每個測試方法來運作。當你的測試方法共享一組常見的 patch 時,這會減少繁冗的代" @@ -1588,7 +1652,7 @@ msgstr "" "設情況下會是 ``'test'``,這與 :mod:`unittest` 尋找測試的方式相匹配。你可以通" "過設定 ``patch.TEST_PREFIX`` 來指定別的前綴。" -#: ../../library/unittest.mock.rst:1465 +#: ../../library/unittest.mock.rst:1488 msgid "" "Patch can be used as a context manager, with the with statement. Here the " "patching applies to the indented block after the with statement. If you use " @@ -1599,17 +1663,17 @@ msgstr "" "的縮排區塊。如果你使用 \"as\",則被 patch 的物件將被綁定到 \"as\" 後面的名" "稱;如果 :func:`patch` 正在為你建立一個 mock 物件,這會非常有用。" -#: ../../library/unittest.mock.rst:1470 +#: ../../library/unittest.mock.rst:1493 msgid "" -":func:`patch` takes arbitrary keyword arguments. These will be passed to :" -"class:`AsyncMock` if the patched object is asynchronous, to :class:" -"`MagicMock` otherwise or to *new_callable* if specified." +":func:`patch` takes arbitrary keyword arguments. These will be passed " +"to :class:`AsyncMock` if the patched object is asynchronous, " +"to :class:`MagicMock` otherwise or to *new_callable* if specified." msgstr "" ":func:`patch` 接受任意的關鍵字引數。如果被 patch 的物件是非同步的,這些將會被" "傳遞給 :class:`AsyncMock`,如果是同步的則會傳遞給 :class:`MagicMock`,或如果" "指定了 *new_callable*,則傳遞給它。" -#: ../../library/unittest.mock.rst:1474 +#: ../../library/unittest.mock.rst:1497 msgid "" "``patch.dict(...)``, ``patch.multiple(...)`` and ``patch.object(...)`` are " "available for alternate use-cases." @@ -1617,14 +1681,14 @@ msgstr "" "``patch.dict(...)``、``patch.multiple(...)`` 和 ``patch.object(...)`` 可用於" "其餘的使用情境。" -#: ../../library/unittest.mock.rst:1477 +#: ../../library/unittest.mock.rst:1500 msgid "" ":func:`patch` as function decorator, creating the mock for you and passing " "it into the decorated function::" msgstr "" ":func:`patch` 作為函式裝飾器,為你建立 mock 並將其傳遞給被裝飾的函式: ::" -#: ../../library/unittest.mock.rst:1480 +#: ../../library/unittest.mock.rst:1503 msgid "" ">>> @patch('__main__.SomeClass')\n" "... def function(normal_argument, mock_class):\n" @@ -1640,34 +1704,34 @@ msgstr "" ">>> function(None)\n" "True" -#: ../../library/unittest.mock.rst:1487 +#: ../../library/unittest.mock.rst:1510 msgid "" "Patching a class replaces the class with a :class:`MagicMock` *instance*. If " -"the class is instantiated in the code under test then it will be the :attr:" -"`~Mock.return_value` of the mock that will be used." +"the class is instantiated in the code under test then it will be " +"the :attr:`~Mock.return_value` of the mock that will be used." msgstr "" "Patch 一個類別會以 :class:`MagicMock`\\ *實例*\\ 取代該類別。如果該類別在被" -"測試的程式碼中實例化,那麼它將是會被使用的 mock 的 :attr:`~Mock." -"return_value`。" +"測試的程式碼中實例化,那麼它將是會被使用的 mock " +"的 :attr:`~Mock.return_value`。" -#: ../../library/unittest.mock.rst:1491 +#: ../../library/unittest.mock.rst:1514 msgid "" -"If the class is instantiated multiple times you could use :attr:`~Mock." -"side_effect` to return a new mock each time. Alternatively you can set the " -"*return_value* to be anything you want." +"If the class is instantiated multiple times you could " +"use :attr:`~Mock.side_effect` to return a new mock each time. Alternatively " +"you can set the *return_value* to be anything you want." msgstr "" "如果該類別被實例化多次,你可以使用 :attr:`~Mock.side_effect` 來每次回傳一個新" "的 mock。 或者你可以將 *return_value* 設定成你想要的任何值。" -#: ../../library/unittest.mock.rst:1495 +#: ../../library/unittest.mock.rst:1518 msgid "" "To configure return values on methods of *instances* on the patched class " "you must do this on the :attr:`~Mock.return_value`. For example::" msgstr "" -"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須在 :attr:`~Mock." -"return_value` 上進行配置。例如: ::" +"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須" +"在 :attr:`~Mock.return_value` 上進行配置。例如: ::" -#: ../../library/unittest.mock.rst:1498 +#: ../../library/unittest.mock.rst:1521 msgid "" ">>> class Class:\n" "... def method(self):\n" @@ -1691,7 +1755,7 @@ msgstr "" "... assert Class().method() == 'foo'\n" "..." -#: ../../library/unittest.mock.rst:1509 +#: ../../library/unittest.mock.rst:1532 msgid "" "If you use *spec* or *spec_set* and :func:`patch` is replacing a *class*, " "then the return value of the created mock will have the same spec. ::" @@ -1699,7 +1763,7 @@ msgstr "" "如果你使用 *spec* 或 *spec_set* 且 :func:`patch` 正在取代一個\\ *類別*,那麼" "被建立的 mock 的回傳值將具有相同的規格。: ::" -#: ../../library/unittest.mock.rst:1512 +#: ../../library/unittest.mock.rst:1535 msgid "" ">>> Original = Class\n" ">>> patcher = patch('__main__.Class', spec=True)\n" @@ -1715,7 +1779,7 @@ msgstr "" ">>> assert isinstance(instance, Original)\n" ">>> patcher.stop()" -#: ../../library/unittest.mock.rst:1519 +#: ../../library/unittest.mock.rst:1542 msgid "" "The *new_callable* argument is useful where you want to use an alternative " "class to the default :class:`MagicMock` for the created mock. For example, " @@ -1725,7 +1789,7 @@ msgstr "" "*new_callable* 引數非常有用。例如,如果你想要一個 :class:`NonCallableMock` 被" "使用: ::" -#: ../../library/unittest.mock.rst:1523 +#: ../../library/unittest.mock.rst:1546 msgid "" ">>> thing = object()\n" ">>> with patch('__main__.thing', new_callable=NonCallableMock) as " @@ -1747,13 +1811,13 @@ msgstr "" " ...\n" "TypeError: 'NonCallableMock' object is not callable" -#: ../../library/unittest.mock.rst:1532 +#: ../../library/unittest.mock.rst:1555 msgid "" "Another use case might be to replace an object with an :class:`io.StringIO` " "instance::" msgstr "另一個用法是用一個 :class:`io.StringIO` 實例替換一個物件: ::" -#: ../../library/unittest.mock.rst:1534 +#: ../../library/unittest.mock.rst:1557 msgid "" ">>> from io import StringIO\n" ">>> def foo():\n" @@ -1777,7 +1841,7 @@ msgstr "" "...\n" ">>> test()" -#: ../../library/unittest.mock.rst:1545 +#: ../../library/unittest.mock.rst:1568 msgid "" "When :func:`patch` is creating a mock for you, it is common that the first " "thing you need to do is to configure the mock. Some of that configuration " @@ -1788,7 +1852,7 @@ msgstr "" "一些配置可以在對 patch 的呼叫中完成。你傳遞到呼叫中的任何關鍵字都將用於在被建" "立的 mock 上設定屬性: ::" -#: ../../library/unittest.mock.rst:1550 +#: ../../library/unittest.mock.rst:1573 msgid "" ">>> patcher = patch('__main__.thing', first='one', second='two')\n" ">>> mock_thing = patcher.start()\n" @@ -1804,20 +1868,20 @@ msgstr "" ">>> mock_thing.second\n" "'two'" -#: ../../library/unittest.mock.rst:1557 +#: ../../library/unittest.mock.rst:1580 msgid "" -"As well as attributes on the created mock attributes, like the :attr:`~Mock." -"return_value` and :attr:`~Mock.side_effect`, of child mocks can also be " -"configured. These aren't syntactically valid to pass in directly as keyword " -"arguments, but a dictionary with these as keys can still be expanded into a :" -"func:`patch` call using ``**``::" +"As well as attributes on the created mock attributes, like " +"the :attr:`~Mock.return_value` and :attr:`~Mock.side_effect`, of child mocks " +"can also be configured. These aren't syntactically valid to pass in directly " +"as keyword arguments, but a dictionary with these as keys can still be " +"expanded into a :func:`patch` call using ``**``::" msgstr "" -"除了被建立的 mock 上的屬性外,還可以配置 child mock 的 :attr:`~Mock." -"return_value` 和 :attr:`~Mock.side_effect`。它們在語法上不能直接作為關鍵字引" -"數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一個 :func:`patch` 呼" -"叫: ::" +"除了被建立的 mock 上的屬性外,還可以配置 child mock " +"的 :attr:`~Mock.return_value` 和 :attr:`~Mock.side_effect`。它們在語法上不能" +"直接作為關鍵字引數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一" +"個 :func:`patch` 呼叫: ::" -#: ../../library/unittest.mock.rst:1563 +#: ../../library/unittest.mock.rst:1586 msgid "" ">>> config = {'method.return_value': 3, 'other.side_effect': KeyError}\n" ">>> patcher = patch('__main__.thing', **config)\n" @@ -1839,16 +1903,16 @@ msgstr "" " ...\n" "KeyError" -#: ../../library/unittest.mock.rst:1573 +#: ../../library/unittest.mock.rst:1596 msgid "" "By default, attempting to patch a function in a module (or a method or an " -"attribute in a class) that does not exist will fail with :exc:" -"`AttributeError`::" +"attribute in a class) that does not exist will fail " +"with :exc:`AttributeError`::" msgstr "" "預設情況下,嘗試 patch 模組中不存在的函式(或類別中的方法或屬性)將會失敗,並" "引發 :exc:`AttributeError`: ::" -#: ../../library/unittest.mock.rst:1576 +#: ../../library/unittest.mock.rst:1599 msgid "" ">>> @patch('sys.non_existing_attribute', 42)\n" "... def test():\n" @@ -1870,7 +1934,7 @@ msgstr "" "AttributeError: does not have the attribute " "'non_existing_attribute'" -#: ../../library/unittest.mock.rst:1585 +#: ../../library/unittest.mock.rst:1608 msgid "" "but adding ``create=True`` in the call to :func:`patch` will make the " "previous example work as expected::" @@ -1878,7 +1942,7 @@ msgstr "" "但是在對 :func:`patch` 的呼叫中增加 ``create=True`` 將使前面的範例按照預期運" "作: ::" -#: ../../library/unittest.mock.rst:1588 +#: ../../library/unittest.mock.rst:1611 msgid "" ">>> @patch('sys.non_existing_attribute', 42, create=True)\n" "... def test(mock_stdout):\n" @@ -1892,18 +1956,18 @@ msgstr "" "...\n" ">>> test()" -#: ../../library/unittest.mock.rst:1596 +#: ../../library/unittest.mock.rst:1619 msgid "" ":func:`patch` now returns an :class:`AsyncMock` if the target is an async " "function." msgstr "" "如果目標是一個非同步函式,:func:`patch` 現在會回傳一個 :class:`AsyncMock`。" -#: ../../library/unittest.mock.rst:1600 +#: ../../library/unittest.mock.rst:1623 msgid "patch.object" msgstr "patch.object" -#: ../../library/unittest.mock.rst:1604 +#: ../../library/unittest.mock.rst:1627 msgid "" "patch the named member (*attribute*) on an object (*target*) with a mock " "object." @@ -1911,28 +1975,28 @@ msgstr "" "使用一個 mock 物件 patch 一個物件(\\ *目標*\\ )上的命名成員(\\ *屬性" "*\\ )。" -#: ../../library/unittest.mock.rst:1607 +#: ../../library/unittest.mock.rst:1630 msgid "" ":func:`patch.object` can be used as a decorator, class decorator or a " "context manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* " -"and *new_callable* have the same meaning as for :func:`patch`. Like :func:" -"`patch`, :func:`patch.object` takes arbitrary keyword arguments for " -"configuring the mock object it creates." +"and *new_callable* have the same meaning as for :func:`patch`. " +"Like :func:`patch`, :func:`patch.object` takes arbitrary keyword arguments " +"for configuring the mock object it creates." msgstr "" ":func:`patch.object` 可以做為裝飾器、類別裝飾器或情境管理器使用。引數 *new*、" -"*spec*、*create*、*spec_set*、*autospec* 和 *new_callable* 與在 :func:" -"`patch` 中的引數具有相同的意義。與 :func:`patch` 一樣,:func:`patch.object` " -"接受任意關鍵字引數來配置它所建立的 mock 物件。" +"*spec*、*create*、*spec_set*、*autospec* 和 *new_callable* 與" +"在 :func:`patch` 中的引數具有相同的意義。與 :func:`patch` 一" +"樣,:func:`patch.object` 接受任意關鍵字引數來配置它所建立的 mock 物件。" -#: ../../library/unittest.mock.rst:1613 +#: ../../library/unittest.mock.rst:1636 msgid "" -"When used as a class decorator :func:`patch.object` honours ``patch." -"TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.object` honours " +"``patch.TEST_PREFIX`` for choosing which methods to wrap." msgstr "" "當作為類別裝飾器使用時,:func:`patch.object` 會遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" -#: ../../library/unittest.mock.rst:1616 +#: ../../library/unittest.mock.rst:1639 msgid "" "You can either call :func:`patch.object` with three arguments or two " "arguments. The three argument form takes the object to be patched, the " @@ -1941,7 +2005,7 @@ msgstr "" "你可以使用三個引數或兩個引數來呼叫 :func:`patch.object`。三個引數的形式接受要" "被 patch 的物件、屬性名稱和要替換掉屬性的物件。" -#: ../../library/unittest.mock.rst:1620 +#: ../../library/unittest.mock.rst:1643 msgid "" "When calling with the two argument form you omit the replacement object, and " "a mock is created for you and passed in as an extra argument to the " @@ -1950,7 +2014,7 @@ msgstr "" "當使用兩個引數的形式呼叫時,你會省略要替換的物件,一個 mock 會為你建立並將其" "作為額外的引數傳遞給被裝飾的函式:" -#: ../../library/unittest.mock.rst:1631 +#: ../../library/unittest.mock.rst:1654 msgid "" "*spec*, *create* and the other arguments to :func:`patch.object` have the " "same meaning as they do for :func:`patch`." @@ -1958,17 +2022,17 @@ msgstr "" "*spec*、*create* 和 :func:`patch.object` 的其他引數與在 :func:`patch` 中的引" "數具有相同的意義。" -#: ../../library/unittest.mock.rst:1636 +#: ../../library/unittest.mock.rst:1659 msgid "patch.dict" msgstr "patch.dict" -#: ../../library/unittest.mock.rst:1640 +#: ../../library/unittest.mock.rst:1663 msgid "" "Patch a dictionary, or dictionary like object, and restore the dictionary to " "its original state after the test." msgstr "Patch 字典或類字典的物件,並在測試後將字典回復到其原本的狀態。" -#: ../../library/unittest.mock.rst:1643 +#: ../../library/unittest.mock.rst:1666 msgid "" "*in_dict* can be a dictionary or a mapping like container. If it is a " "mapping then it must at least support getting, setting and deleting items " @@ -1977,13 +2041,13 @@ msgstr "" "*in_dict* 可以是一個字典或一個類對映的容器。如果它是一個對映,那麼它至少必須" "支援獲取、設定、刪除項目以及對鍵的疊代。" -#: ../../library/unittest.mock.rst:1647 +#: ../../library/unittest.mock.rst:1670 msgid "" "*in_dict* can also be a string specifying the name of the dictionary, which " "will then be fetched by importing it." msgstr "*in_dict* 也可以是指定字典名稱的字串,然後透過 import 來取得該字典。" -#: ../../library/unittest.mock.rst:1650 +#: ../../library/unittest.mock.rst:1673 msgid "" "*values* can be a dictionary of values to set in the dictionary. *values* " "can also be an iterable of ``(key, value)`` pairs." @@ -1991,39 +2055,40 @@ msgstr "" "*values* 可以是要設定的值的字典。*values* 也可以是 ``(key, value)`` 對 " "(pairs) 的可疊代物件。" -#: ../../library/unittest.mock.rst:1653 +#: ../../library/unittest.mock.rst:1676 msgid "" "If *clear* is true then the dictionary will be cleared before the new values " "are set." msgstr "如果 *clear* 為 true,則在設定新值之前字典將被清除。" -#: ../../library/unittest.mock.rst:1656 +#: ../../library/unittest.mock.rst:1679 msgid "" ":func:`patch.dict` can also be called with arbitrary keyword arguments to " "set values in the dictionary." msgstr "也可以使用任意關鍵字引數呼叫 :func:`patch.dict` 以在字典中設定值。" -#: ../../library/unittest.mock.rst:1661 +#: ../../library/unittest.mock.rst:1684 msgid "" ":func:`patch.dict` now returns the patched dictionary when used as a context " "manager." msgstr ":func:`patch.dict` 現在在做為情境管理器使用時回傳被 patch 的字典。" -#: ../../library/unittest.mock.rst:1664 +#: ../../library/unittest.mock.rst:1687 msgid "" ":func:`patch.dict` can be used as a context manager, decorator or class " "decorator:" msgstr ":func:`patch.dict` 可以做為情境管理器、裝飾器或類別裝飾器使用:" -#: ../../library/unittest.mock.rst:1675 +#: ../../library/unittest.mock.rst:1698 msgid "" -"When used as a class decorator :func:`patch.dict` honours ``patch." -"TEST_PREFIX`` (default to ``'test'``) for choosing which methods to wrap:" +"When used as a class decorator :func:`patch.dict` honours " +"``patch.TEST_PREFIX`` (default to ``'test'``) for choosing which methods to " +"wrap:" msgstr "" "當作為類別裝飾器使用時,:func:`patch.dict` 會遵循 ``patch.TEST_PREFIX``\\ " "(預設為 ``'test'``\\ )來選擇要包裝的方法:" -#: ../../library/unittest.mock.rst:1686 +#: ../../library/unittest.mock.rst:1709 msgid "" "If you want to use a different prefix for your test, you can inform the " "patchers of the different prefix by setting ``patch.TEST_PREFIX``. For more " @@ -2033,7 +2098,7 @@ msgstr "" "patcher 使用不同的前綴。請參閱 :ref:`test-prefix` 以得知如何修改前綴的更多內" "容。" -#: ../../library/unittest.mock.rst:1690 +#: ../../library/unittest.mock.rst:1713 msgid "" ":func:`patch.dict` can be used to add members to a dictionary, or simply let " "a test change a dictionary, and ensure the dictionary is restored when the " @@ -2042,32 +2107,31 @@ msgstr "" ":func:`patch.dict` 可用於在字典中新增成員,或單純地讓測試更改字典,並確保在測" "試結束時將字典回復原狀。" -#: ../../library/unittest.mock.rst:1711 +#: ../../library/unittest.mock.rst:1734 msgid "" "Keywords can be used in the :func:`patch.dict` call to set values in the " "dictionary:" msgstr "可以在 :func:`patch.dict` 呼叫中使用關鍵字來設定字典中的值:" -#: ../../library/unittest.mock.rst:1721 +#: ../../library/unittest.mock.rst:1744 msgid "" ":func:`patch.dict` can be used with dictionary like objects that aren't " "actually dictionaries. At the very minimum they must support item getting, " "setting, deleting and either iteration or membership test. This corresponds " -"to the magic methods :meth:`~object.__getitem__`, :meth:`~object." -"__setitem__`, :meth:`~object.__delitem__` and either :meth:`~container." -"__iter__` or :meth:`~object.__contains__`." +"to the magic " +"methods :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__` " +"and either :meth:`~container.__iter__` or :meth:`~object.__contains__`." msgstr "" ":func:`patch.dict` 可以與實際上不是字典的類字典物件一起使用。最低限度它們必須" -"支援項目的獲取、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中的 :meth:" -"`~object.__getitem__`、:meth:`~object.__setitem__`、:meth:`~object." -"__delitem__` 以及 :meth:`~container.__iter__` 或 :meth:`~object." -"__contains__`。" +"支援項目的獲取、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中" +"的 :meth:`~object.__getitem__`、:meth:`~object.__setitem__`、:meth:`~object.__delitem__` " +"以及 :meth:`~container.__iter__` 或 :meth:`~object.__contains__`。" -#: ../../library/unittest.mock.rst:1751 +#: ../../library/unittest.mock.rst:1774 msgid "patch.multiple" msgstr "patch.multiple" -#: ../../library/unittest.mock.rst:1755 +#: ../../library/unittest.mock.rst:1778 msgid "" "Perform multiple patches in a single call. It takes the object to be patched " "(either as an object or a string to fetch the object by importing) and " @@ -2076,7 +2140,7 @@ msgstr "" "在一次呼叫中執行多個 patch。它接受被 patch 的物件(作為物件或透過 import 取得" "物件的字串)和 patch 的關鍵字引數: ::" -#: ../../library/unittest.mock.rst:1759 +#: ../../library/unittest.mock.rst:1782 msgid "" "with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):\n" " ..." @@ -2084,18 +2148,18 @@ msgstr "" "with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):\n" " ..." -#: ../../library/unittest.mock.rst:1762 +#: ../../library/unittest.mock.rst:1785 msgid "" "Use :data:`DEFAULT` as the value if you want :func:`patch.multiple` to " "create mocks for you. In this case the created mocks are passed into a " -"decorated function by keyword, and a dictionary is returned when :func:" -"`patch.multiple` is used as a context manager." +"decorated function by keyword, and a dictionary is returned " +"when :func:`patch.multiple` is used as a context manager." msgstr "" "如果你想要 :func:`patch.multiple` 為你建立 mock,請使用 :data:`DEFAULT` 作為" -"值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且當 :" -"func:`patch.multiple` 作為情境管理器時會回傳字典。" +"值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且" +"當 :func:`patch.multiple` 作為情境管理器時會回傳字典。" -#: ../../library/unittest.mock.rst:1767 +#: ../../library/unittest.mock.rst:1790 msgid "" ":func:`patch.multiple` can be used as a decorator, class decorator or a " "context manager. The arguments *spec*, *spec_set*, *create*, *autospec* and " @@ -2103,30 +2167,30 @@ msgid "" "will be applied to *all* patches done by :func:`patch.multiple`." msgstr "" ":func:`patch.multiple` 可以做為裝飾器、類別裝飾器或情境管理器使用。引數 " -"*spec*、*spec_set*、*create*、*autospec* 和 *new_callable* 與在 :func:" -"`patch` 中的引數具有相同的意義。這些引數將應用於由 :func:`patch.multiple` 完" -"成的\\ *所有* patch。" +"*spec*、*spec_set*、*create*、*autospec* 和 *new_callable* 與" +"在 :func:`patch` 中的引數具有相同的意義。這些引數將應用於" +"由 :func:`patch.multiple` 完成的\\ *所有* patch。" -#: ../../library/unittest.mock.rst:1772 +#: ../../library/unittest.mock.rst:1795 msgid "" -"When used as a class decorator :func:`patch.multiple` honours ``patch." -"TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.multiple` honours " +"``patch.TEST_PREFIX`` for choosing which methods to wrap." msgstr "" "當作為類別裝飾器使用時,:func:`patch.multiple` 遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" -#: ../../library/unittest.mock.rst:1775 +#: ../../library/unittest.mock.rst:1798 msgid "" "If you want :func:`patch.multiple` to create mocks for you, then you can " "use :data:`DEFAULT` as the value. If you use :func:`patch.multiple` as a " "decorator then the created mocks are passed into the decorated function by " "keyword. ::" msgstr "" -"如果你想要 :func:`patch.multiple` 為你建立 mock,那麼你可以使用 :data:" -"`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼被建立的 " -"mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" +"如果你想要 :func:`patch.multiple` 為你建立 mock,那麼你可以使" +"用 :data:`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼" +"被建立的 mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" -#: ../../library/unittest.mock.rst:1779 +#: ../../library/unittest.mock.rst:1802 msgid "" ">>> thing = object()\n" ">>> other = object()\n" @@ -2148,7 +2212,7 @@ msgstr "" "...\n" ">>> test_function()" -#: ../../library/unittest.mock.rst:1789 +#: ../../library/unittest.mock.rst:1812 msgid "" ":func:`patch.multiple` can be nested with other ``patch`` decorators, but " "put arguments passed by keyword *after* any of the standard arguments " @@ -2157,7 +2221,7 @@ msgstr "" ":func:`patch.multiple` 可以與其他 ``patch`` 裝飾器巢狀使用,但需要將透過關鍵" "字傳遞的引數放在 :func:`patch` 建立的任何標準引數\\ *之後*: ::" -#: ../../library/unittest.mock.rst:1792 +#: ../../library/unittest.mock.rst:1815 msgid "" ">>> @patch('sys.exit')\n" "... @patch.multiple('__main__', thing=DEFAULT, other=DEFAULT)\n" @@ -2177,7 +2241,7 @@ msgstr "" "...\n" ">>> test_function()" -#: ../../library/unittest.mock.rst:1801 +#: ../../library/unittest.mock.rst:1824 msgid "" "If :func:`patch.multiple` is used as a context manager, the value returned " "by the context manager is a dictionary where created mocks are keyed by " @@ -2186,7 +2250,7 @@ msgstr "" "如果 :func:`patch.multiple` 作為情境管理器使用,則情境管理器回傳的值是一個字" "典,其中被建立的 mock 會按名稱作為其鍵值: ::" -#: ../../library/unittest.mock.rst:1804 +#: ../../library/unittest.mock.rst:1827 msgid "" ">>> with patch.multiple('__main__', thing=DEFAULT, other=DEFAULT) as " "values:\n" @@ -2204,11 +2268,11 @@ msgstr "" "... assert values['other'] is other\n" "..." -#: ../../library/unittest.mock.rst:1815 +#: ../../library/unittest.mock.rst:1838 msgid "patch methods: start and stop" msgstr "patch 方法:啟動與停止" -#: ../../library/unittest.mock.rst:1817 +#: ../../library/unittest.mock.rst:1840 msgid "" "All the patchers have :meth:`!start` and :meth:`!stop` methods. These make " "it simpler to do patching in ``setUp`` methods or where you want to do " @@ -2218,18 +2282,18 @@ msgstr "" "方法中進行 patch 或在你想要在沒有巢狀使用裝飾器或 with 陳述式的情況下進行多" "個 patch 時變得更簡單。" -#: ../../library/unittest.mock.rst:1821 +#: ../../library/unittest.mock.rst:1844 msgid "" "To use them call :func:`patch`, :func:`patch.object` or :func:`patch.dict` " "as normal and keep a reference to the returned ``patcher`` object. You can " "then call :meth:`!start` to put the patch in place and :meth:`!stop` to undo " "it." msgstr "" -"要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` 或 :func:" -"`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼叫 :meth:" -"`!start` 將 patch 準備就緒,並呼叫 :meth:`!stop` 來取消 patch。" +"要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` " +"或 :func:`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼" +"叫 :meth:`!start` 將 patch 準備就緒,並呼叫 :meth:`!stop` 來取消 patch。" -#: ../../library/unittest.mock.rst:1825 +#: ../../library/unittest.mock.rst:1848 msgid "" "If you are using :func:`patch` to create a mock for you then it will be " "returned by the call to ``patcher.start``. ::" @@ -2237,7 +2301,7 @@ msgstr "" "如果你使用 :func:`patch` 為你建立 mock,那麼它將透過呼叫 ``patcher.start`` 回" "傳。: ::" -#: ../../library/unittest.mock.rst:1828 +#: ../../library/unittest.mock.rst:1851 msgid "" ">>> patcher = patch('package.module.ClassName')\n" ">>> from package import module\n" @@ -2259,7 +2323,7 @@ msgstr "" ">>> assert module.ClassName is original\n" ">>> assert module.ClassName is not new_mock" -#: ../../library/unittest.mock.rst:1839 +#: ../../library/unittest.mock.rst:1862 msgid "" "A typical use case for this might be for doing multiple patches in the " "``setUp`` method of a :class:`~unittest.TestCase`::" @@ -2267,7 +2331,7 @@ msgstr "" "一個典型的用法是在一個 :class:`~unittest.TestCase` 的 ``setUp`` 方法中執行多" "個 patch: ::" -#: ../../library/unittest.mock.rst:1842 +#: ../../library/unittest.mock.rst:1865 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -2303,18 +2367,18 @@ msgstr "" "...\n" ">>> MyTest('test_something').run()" -#: ../../library/unittest.mock.rst:1861 +#: ../../library/unittest.mock.rst:1884 msgid "" "If you use this technique you must ensure that the patching is \"undone\" by " "calling ``stop``. This can be fiddlier than you might think, because if an " -"exception is raised in the ``setUp`` then ``tearDown`` is not called. :meth:" -"`unittest.TestCase.addCleanup` makes this easier::" +"exception is raised in the ``setUp`` then ``tearDown`` is not " +"called. :meth:`unittest.TestCase.addCleanup` makes this easier::" msgstr "" "如果你使用這個技巧,你必須確保透過呼叫 ``stop`` 來 \"取消\" patch。這可能會比" "你想像的還要複雜一點,因為如果有例外在 ``setUp`` 中被引發,則 ``tearDown`` 就" "不會被呼叫。:meth:`unittest.TestCase.addCleanup` 會讓這稍微簡單一點: ::" -#: ../../library/unittest.mock.rst:1866 +#: ../../library/unittest.mock.rst:1889 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -2336,34 +2400,34 @@ msgstr "" "... assert package.module.Class is self.MockClass\n" "..." -#: ../../library/unittest.mock.rst:1876 +#: ../../library/unittest.mock.rst:1899 msgid "" "As an added bonus you no longer need to keep a reference to the ``patcher`` " "object." msgstr "作為額外的好處,你不再需要保留對 ``patcher`` 物件的參照。" -#: ../../library/unittest.mock.rst:1879 +#: ../../library/unittest.mock.rst:1902 msgid "" -"It is also possible to stop all patches which have been started by using :" -"func:`patch.stopall`." +"It is also possible to stop all patches which have been started by " +"using :func:`patch.stopall`." msgstr "也可以使用 :func:`patch.stopall` 來停止所有已啟動的 patch。" -#: ../../library/unittest.mock.rst:1884 +#: ../../library/unittest.mock.rst:1907 msgid "Stop all active patches. Only stops patches started with ``start``." msgstr "停止所有運作的 patch。只停止以 ``start`` 啟動的 patch。" -#: ../../library/unittest.mock.rst:1890 +#: ../../library/unittest.mock.rst:1913 msgid "patch builtins" msgstr "patch 內建函式" -#: ../../library/unittest.mock.rst:1891 +#: ../../library/unittest.mock.rst:1914 msgid "" "You can patch any builtins within a module. The following example patches " "builtin :func:`ord`::" msgstr "" "你可以 patch 模組內的任何內建函式。以下範例 patch 內建函式 :func:`ord`: ::" -#: ../../library/unittest.mock.rst:1894 +#: ../../library/unittest.mock.rst:1917 msgid "" ">>> @patch('__main__.ord')\n" "... def test(mock_ord):\n" @@ -2381,11 +2445,11 @@ msgstr "" ">>> test()\n" "101" -#: ../../library/unittest.mock.rst:1906 +#: ../../library/unittest.mock.rst:1929 msgid "TEST_PREFIX" msgstr "TEST_PREFIX" -#: ../../library/unittest.mock.rst:1908 +#: ../../library/unittest.mock.rst:1931 msgid "" "All of the patchers can be used as class decorators. When used in this way " "they wrap every test method on the class. The patchers recognise methods " @@ -2393,19 +2457,19 @@ msgid "" "the :class:`unittest.TestLoader` finds test methods by default." msgstr "" "所有 patcher 都可以作為類別裝飾器使用。以這種方式使用時,它們包裝了類別上的每" -"個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這與 :class:" -"`unittest.TestLoader` 預設尋找測試方法的方式相同。" +"個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這" +"與 :class:`unittest.TestLoader` 預設尋找測試方法的方式相同。" -#: ../../library/unittest.mock.rst:1913 +#: ../../library/unittest.mock.rst:1936 msgid "" "It is possible that you want to use a different prefix for your tests. You " -"can inform the patchers of the different prefix by setting ``patch." -"TEST_PREFIX``::" +"can inform the patchers of the different prefix by setting " +"``patch.TEST_PREFIX``::" msgstr "" "你可能會想為你的測試使用不同的前綴。你可以透過設定 ``patch.TEST_PREFIX`` 來告" "知 patcher 使用不同的前綴: ::" -#: ../../library/unittest.mock.rst:1916 +#: ../../library/unittest.mock.rst:1939 msgid "" ">>> patch.TEST_PREFIX = 'foo'\n" ">>> value = 3\n" @@ -2443,21 +2507,21 @@ msgstr "" ">>> value\n" "3" -#: ../../library/unittest.mock.rst:1936 +#: ../../library/unittest.mock.rst:1959 msgid "Nesting Patch Decorators" msgstr "巢狀使用 Patch 裝飾器" -#: ../../library/unittest.mock.rst:1938 +#: ../../library/unittest.mock.rst:1961 msgid "" "If you want to perform multiple patches then you can simply stack up the " "decorators." msgstr "如果你想執行多個 patch,那麼你可以簡單地堆疊裝飾器。" -#: ../../library/unittest.mock.rst:1941 +#: ../../library/unittest.mock.rst:1964 msgid "You can stack up multiple patch decorators using this pattern:" msgstr "你可以使用這個模式來堆疊多個 patch 裝飾器:" -#: ../../library/unittest.mock.rst:1957 +#: ../../library/unittest.mock.rst:1980 msgid "" "Note that the decorators are applied from the bottom upwards. This is the " "standard way that Python applies decorators. The order of the created mocks " @@ -2466,11 +2530,11 @@ msgstr "" "請注意,裝飾器是從底部向上應用的。這是 Python 應用裝飾器的標準方式。被建立的 " "mock 傳遞到測試函式中的順序與此順序相同。" -#: ../../library/unittest.mock.rst:1965 +#: ../../library/unittest.mock.rst:1988 msgid "Where to patch" msgstr "該 patch 何處" -#: ../../library/unittest.mock.rst:1967 +#: ../../library/unittest.mock.rst:1990 msgid "" ":func:`patch` works by (temporarily) changing the object that a *name* " "points to with another one. There can be many names pointing to any " @@ -2481,7 +2545,7 @@ msgstr "" "有許多 name 指向任何單一物件,因此為了使 patch 起作用,你必須確保你 patch 了" "被測試系統使用的 name。" -#: ../../library/unittest.mock.rst:1972 +#: ../../library/unittest.mock.rst:1995 msgid "" "The basic principle is that you patch where an object is *looked up*, which " "is not necessarily the same place as where it is defined. A couple of " @@ -2490,12 +2554,12 @@ msgstr "" "基本原則是在物件\\ *被查找*\\ 的位置進行 patch,該位置不一定與其被定義的位置" "相同。幾個範例將有助於闡明這一點。" -#: ../../library/unittest.mock.rst:1976 +#: ../../library/unittest.mock.rst:1999 msgid "" "Imagine we have a project that we want to test with the following structure::" msgstr "想像一下,我們想要測試一個專案,其結構如下: ::" -#: ../../library/unittest.mock.rst:1978 +#: ../../library/unittest.mock.rst:2001 msgid "" "a.py\n" " -> Defines SomeClass\n" @@ -2504,15 +2568,21 @@ msgid "" " -> from a import SomeClass\n" " -> some_function instantiates SomeClass" msgstr "" +"a.py\n" +" -> Defines SomeClass\n" +"\n" +"b.py\n" +" -> from a import SomeClass\n" +" -> some_function instantiates SomeClass" -#: ../../library/unittest.mock.rst:1985 +#: ../../library/unittest.mock.rst:2008 msgid "" "Now we want to test ``some_function`` but we want to mock out ``SomeClass`` " "using :func:`patch`. The problem is that when we import module b, which we " -"will have to do then it imports ``SomeClass`` from module a. If we use :func:" -"`patch` to mock out ``a.SomeClass`` then it will have no effect on our test; " -"module b already has a reference to the *real* ``SomeClass`` and it looks " -"like our patching had no effect." +"will have to do when it imports ``SomeClass`` from module a. If we " +"use :func:`patch` to mock out ``a.SomeClass`` then it will have no effect on " +"our test; module b already has a reference to the *real* ``SomeClass`` and " +"it looks like our patching had no effect." msgstr "" "現在我們想要測試 ``some_function``,但我們想使用 :func:`patch` mock " "``SomeClass``。問題是,當我們 import 模組 b 時(我們必須這樣做),它會從模組 " @@ -2520,7 +2590,7 @@ msgstr "" "那麼它對我們的測試就不會有任何影響;模組 b 已經有了一個\\ *真實的*\\ " "``SomeClass`` 的參照 ,看起來我們的 patch 並沒有任何效果。" -#: ../../library/unittest.mock.rst:1992 +#: ../../library/unittest.mock.rst:2015 msgid "" "The key is to patch out ``SomeClass`` where it is used (or where it is " "looked up). In this case ``some_function`` will actually look up " @@ -2531,64 +2601,64 @@ msgstr "" "``some_function`` 實際上會在我們 import 它的模組 b 中查找 ``SomeClass``。這裡" "的 patch 應該長得像這樣: ::" -#: ../../library/unittest.mock.rst:1996 +#: ../../library/unittest.mock.rst:2019 msgid "@patch('b.SomeClass')" msgstr "@patch('b.SomeClass')" -#: ../../library/unittest.mock.rst:1998 +#: ../../library/unittest.mock.rst:2021 msgid "" "However, consider the alternative scenario where instead of ``from a import " -"SomeClass`` module b does ``import a`` and ``some_function`` uses ``a." -"SomeClass``. Both of these import forms are common. In this case the class " -"we want to patch is being looked up in the module and so we have to patch " -"``a.SomeClass`` instead::" +"SomeClass`` module b does ``import a`` and ``some_function`` uses " +"``a.SomeClass``. Both of these import forms are common. In this case the " +"class we want to patch is being looked up in the module and so we have to " +"patch ``a.SomeClass`` instead::" msgstr "" "然而,考慮另一種情況,其中模組 b 並不是使用 ``from a import SomeClass``,而" "是 ``import a``,然後 ``some_function`` 使用 ``a.SomeClass``。這兩種 import " "形式都很常見。在這種情況下,我們想要 patch 的類別正在其模組中被查找,因此我們" "必須 patch ``a.SomeClass``: ::" -#: ../../library/unittest.mock.rst:2003 +#: ../../library/unittest.mock.rst:2026 msgid "@patch('a.SomeClass')" msgstr "@patch('a.SomeClass')" -#: ../../library/unittest.mock.rst:2007 +#: ../../library/unittest.mock.rst:2030 msgid "Patching Descriptors and Proxy Objects" msgstr "Patch 描述器與代理物件 (Proxy Objects)" -#: ../../library/unittest.mock.rst:2009 +#: ../../library/unittest.mock.rst:2032 msgid "" "Both patch_ and patch.object_ correctly patch and restore descriptors: class " "methods, static methods and properties. You should patch these on the " "*class* rather than an instance. They also work with *some* objects that " -"proxy attribute access, like the `django settings object `_." msgstr "" "patch_ 和 patch.object_ 都正確地 patch 和還原描述器:類別方法、靜態方法以及屬" "性。你應該在 *類別* 而不是實例上 patch 它們。它們還可以使用代理屬性存取的\\ *" -"一些*\\ 物件,例如 `django 設定物件 `_。" -#: ../../library/unittest.mock.rst:2017 +#: ../../library/unittest.mock.rst:2040 msgid "MagicMock and magic method support" msgstr "MagicMock 以及魔術方法支援" -#: ../../library/unittest.mock.rst:2022 +#: ../../library/unittest.mock.rst:2045 msgid "Mocking Magic Methods" msgstr "Mock 魔術方法" -#: ../../library/unittest.mock.rst:2024 +#: ../../library/unittest.mock.rst:2047 msgid "" -":class:`Mock` supports mocking the Python protocol methods, also known as :" -"term:`\"magic methods\" `. This allows mock objects to replace " -"containers or other objects that implement Python protocols." +":class:`Mock` supports mocking the Python protocol methods, also known " +"as :term:`\"magic methods\" `. This allows mock objects to " +"replace containers or other objects that implement Python protocols." msgstr "" ":class:`Mock` 支援 mock Python 協定方法,其也被稱作 :term:`\"魔術方法\" " "`。這允許 mock 物件替換容器或實作 Python 協定的其他物件。" -#: ../../library/unittest.mock.rst:2028 +#: ../../library/unittest.mock.rst:2051 msgid "" "Because magic methods are looked up differently from normal methods [#]_, " "this support has been specially implemented. This means that only specific " @@ -2599,7 +2669,7 @@ msgstr "" "代表著僅有特定的魔術方法被此方式支援。現在已支援清單中已經\\ *幾乎*\\ 包含了" "所有魔術方法。如果你需要 mock 任何魔術方法而其尚未被支援,請讓我們知道。" -#: ../../library/unittest.mock.rst:2033 +#: ../../library/unittest.mock.rst:2056 msgid "" "You mock magic methods by setting the method you are interested in to a " "function or a mock instance. If you are using a function then it *must* take " @@ -2608,46 +2678,46 @@ msgstr "" "你可以透過將你感興趣的方法設定為函式或 mock 實例來 mock 魔術方法。如果你使用" "函式,那麼它\\ *必須*\\ 將 ``self`` 作為第一個引數 [#]_。" -#: ../../library/unittest.mock.rst:2056 +#: ../../library/unittest.mock.rst:2079 msgid "" -"One use case for this is for mocking objects used as context managers in a :" -"keyword:`with` statement:" +"One use case for this is for mocking objects used as context managers in " +"a :keyword:`with` statement:" msgstr "一個用法是在 :keyword:`with` 陳述式中 mock 作為情境管理器使用的物件:" -#: ../../library/unittest.mock.rst:2068 +#: ../../library/unittest.mock.rst:2091 msgid "" "Calls to magic methods do not appear in :attr:`~Mock.method_calls`, but they " "are recorded in :attr:`~Mock.mock_calls`." msgstr "" -"對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄在 :" -"attr:`~Mock.mock_calls` 內。" +"對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄" +"在 :attr:`~Mock.mock_calls` 內。" -#: ../../library/unittest.mock.rst:2073 +#: ../../library/unittest.mock.rst:2096 msgid "" "If you use the *spec* keyword argument to create a mock then attempting to " -"set a magic method that isn't in the spec will raise an :exc:" -"`AttributeError`." +"set a magic method that isn't in the spec will raise " +"an :exc:`AttributeError`." msgstr "" "如果你使用\\ *spec*\\ 關鍵字引數來建立一個 mock,則嘗試設定規格中未包含的魔術" "方法將引發一個 :exc:`AttributeError`。" -#: ../../library/unittest.mock.rst:2076 +#: ../../library/unittest.mock.rst:2099 msgid "The full list of supported magic methods is:" msgstr "已支援的魔術方法的完整列表是:" -#: ../../library/unittest.mock.rst:2078 +#: ../../library/unittest.mock.rst:2101 msgid "``__hash__``, ``__sizeof__``, ``__repr__`` and ``__str__``" msgstr "``__hash__``、``__sizeof__``、 ``__repr__`` 和 ``__str__``" -#: ../../library/unittest.mock.rst:2079 +#: ../../library/unittest.mock.rst:2102 msgid "``__dir__``, ``__format__`` and ``__subclasses__``" msgstr "``__dir__``、 ``__format__`` 和 ``__subclasses__``" -#: ../../library/unittest.mock.rst:2080 +#: ../../library/unittest.mock.rst:2103 msgid "``__round__``, ``__floor__``, ``__trunc__`` and ``__ceil__``" msgstr "``__round__``、``__floor__``、``__trunc__`` 和 ``__ceil__``" -#: ../../library/unittest.mock.rst:2081 +#: ../../library/unittest.mock.rst:2104 msgid "" "Comparisons: ``__lt__``, ``__gt__``, ``__le__``, ``__ge__``, ``__eq__`` and " "``__ne__``" @@ -2655,7 +2725,7 @@ msgstr "" "比較方法:``__lt__``、``__gt__``、``__le__``、``__ge__``、``__eq__`` 和 " "``__ne__``" -#: ../../library/unittest.mock.rst:2083 +#: ../../library/unittest.mock.rst:2106 msgid "" "Container methods: ``__getitem__``, ``__setitem__``, ``__delitem__``, " "``__contains__``, ``__len__``, ``__iter__``, ``__reversed__`` and " @@ -2665,18 +2735,18 @@ msgstr "" "``__contains__``、``__len__``、``__iter__``、``__reversed__`` 和 " "``__missing__``" -#: ../../library/unittest.mock.rst:2086 +#: ../../library/unittest.mock.rst:2109 msgid "" "Context manager: ``__enter__``, ``__exit__``, ``__aenter__`` and " "``__aexit__``" msgstr "" "情境管理器:``__enter__``、``__exit__``、``__aenter__`` 和 ``__aexit__``" -#: ../../library/unittest.mock.rst:2087 +#: ../../library/unittest.mock.rst:2110 msgid "Unary numeric methods: ``__neg__``, ``__pos__`` and ``__invert__``" msgstr "一元數值方法:``__neg__``、``__pos__`` 和 ``__invert__``" -#: ../../library/unittest.mock.rst:2088 +#: ../../library/unittest.mock.rst:2111 msgid "" "The numeric methods (including right hand and in-place variants): " "``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__truediv__``, " @@ -2688,18 +2758,18 @@ msgstr "" "``__mod__``、``__divmod__``、``__lshift__``、``__rshift__``、``__and__``、" "``__xor__``、``__or__`` 和 ``__pow__``" -#: ../../library/unittest.mock.rst:2092 +#: ../../library/unittest.mock.rst:2115 msgid "" "Numeric conversion methods: ``__complex__``, ``__int__``, ``__float__`` and " "``__index__``" msgstr "" "數值轉換方法:``__complex__``、``__int__``、``__float__`` 和 ``__index__``" -#: ../../library/unittest.mock.rst:2094 +#: ../../library/unittest.mock.rst:2117 msgid "Descriptor methods: ``__get__``, ``__set__`` and ``__delete__``" msgstr "描述器方法:``__get__``、``__set__`` 和 ``__delete__``" -#: ../../library/unittest.mock.rst:2095 +#: ../../library/unittest.mock.rst:2118 msgid "" "Pickling: ``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, " "``__getnewargs__``, ``__getstate__`` and ``__setstate__``" @@ -2707,19 +2777,19 @@ msgstr "" "Pickling:``__reduce__``、``__reduce_ex__``、``__getinitargs__``、" "``__getnewargs__``、``__getstate__`` 和 ``__setstate__``" -#: ../../library/unittest.mock.rst:2097 +#: ../../library/unittest.mock.rst:2120 msgid "File system path representation: ``__fspath__``" msgstr "檔案系統路徑表示法:``__fspath__``" -#: ../../library/unittest.mock.rst:2098 +#: ../../library/unittest.mock.rst:2121 msgid "Asynchronous iteration methods: ``__aiter__`` and ``__anext__``" msgstr "非同步疊代方法:``__aiter__`` 和 ``__anext__``" -#: ../../library/unittest.mock.rst:2100 +#: ../../library/unittest.mock.rst:2123 msgid "Added support for :func:`os.PathLike.__fspath__`." msgstr "新增對於 :func:`os.PathLike.__fspath__` 的支援。" -#: ../../library/unittest.mock.rst:2103 +#: ../../library/unittest.mock.rst:2126 msgid "" "Added support for ``__aenter__``, ``__aexit__``, ``__aiter__`` and " "``__anext__``." @@ -2727,7 +2797,7 @@ msgstr "" "新增對於 ``__aenter__``、``__aexit__``、``__aiter__`` 和 ``__anext__`` 的支" "援。" -#: ../../library/unittest.mock.rst:2107 +#: ../../library/unittest.mock.rst:2130 msgid "" "The following methods exist but are *not* supported as they are either in " "use by mock, can't be set dynamically, or can cause problems:" @@ -2735,29 +2805,29 @@ msgstr "" "以下方法存在,但「不」被支援,因為它們在被 mock 使用時,會無法動態設定,或可" "能導致問題:" -#: ../../library/unittest.mock.rst:2110 +#: ../../library/unittest.mock.rst:2133 msgid "``__getattr__``, ``__setattr__``, ``__init__`` and ``__new__``" msgstr "``__getattr__``、``__setattr__``、``__init__`` 和 ``__new__``" -#: ../../library/unittest.mock.rst:2111 +#: ../../library/unittest.mock.rst:2134 msgid "" "``__prepare__``, ``__instancecheck__``, ``__subclasscheck__``, ``__del__``" msgstr "" "``__prepare__``、``__instancecheck__``、``__subclasscheck__``、``__del__``" -#: ../../library/unittest.mock.rst:2116 +#: ../../library/unittest.mock.rst:2139 msgid "Magic Mock" msgstr "Magic Mock" -#: ../../library/unittest.mock.rst:2118 +#: ../../library/unittest.mock.rst:2141 msgid "" -"There are two ``MagicMock`` variants: :class:`MagicMock` and :class:" -"`NonCallableMagicMock`." +"There are two ``MagicMock`` variants: :class:`MagicMock` " +"and :class:`NonCallableMagicMock`." msgstr "" -"``MagicMock`` 有兩個變體::class:`MagicMock` 和 :class:" -"`NonCallableMagicMock`。" +"``MagicMock`` 有兩個變體::class:`MagicMock` " +"和 :class:`NonCallableMagicMock`。" -#: ../../library/unittest.mock.rst:2123 +#: ../../library/unittest.mock.rst:2146 msgid "" "``MagicMock`` is a subclass of :class:`Mock` with default implementations of " "most of the :term:`magic methods `. You can use ``MagicMock`` " @@ -2766,11 +2836,11 @@ msgstr "" "``MagicMock`` 是 :class:`Mock` 的子類別,其預設具有大多數\\ :term:`魔術方法 " "`\\ 的實作。你可以使用 ``MagicMock``,而無需自行配置魔術方法。" -#: ../../library/unittest.mock.rst:2127 +#: ../../library/unittest.mock.rst:2150 msgid "The constructor parameters have the same meaning as for :class:`Mock`." msgstr "建構函式參數的意義與 :class:`Mock` 中的參數相同。" -#: ../../library/unittest.mock.rst:2129 +#: ../../library/unittest.mock.rst:2152 msgid "" "If you use the *spec* or *spec_set* arguments then *only* magic methods that " "exist in the spec will be created." @@ -2778,11 +2848,11 @@ msgstr "" "如果你使用 *spec* 或 *spec_set* 引數,那麼\\ *只有*\\ 規格中存在的魔術方法會" "被建立。" -#: ../../library/unittest.mock.rst:2135 +#: ../../library/unittest.mock.rst:2158 msgid "A non-callable version of :class:`MagicMock`." msgstr ":class:`MagicMock` 的不可呼叫版本。" -#: ../../library/unittest.mock.rst:2137 +#: ../../library/unittest.mock.rst:2160 msgid "" "The constructor parameters have the same meaning as for :class:`MagicMock`, " "with the exception of *return_value* and *side_effect* which have no meaning " @@ -2791,7 +2861,7 @@ msgstr "" "建構函式參數的意義與 :class:`MagicMock` 中的參數相同,但 *return_value* 和 " "*side_effect* 除外,它們對不可呼叫的 mock 來說沒有任何意義。" -#: ../../library/unittest.mock.rst:2141 +#: ../../library/unittest.mock.rst:2164 msgid "" "The magic methods are setup with :class:`MagicMock` objects, so you can " "configure them and use them in the usual way:" @@ -2799,7 +2869,7 @@ msgstr "" "魔術方法是使用 :class:`MagicMock` 物件設定的,因此你可以配置它們並以一般的方" "法來使用它們:" -#: ../../library/unittest.mock.rst:2151 +#: ../../library/unittest.mock.rst:2174 msgid "" "By default many of the protocol methods are required to return objects of a " "specific type. These methods are preconfigured with a default return value, " @@ -2811,94 +2881,94 @@ msgstr "" "值,因此如果你對回傳值不感興趣,則無需執行任何操作即可使用它們。如果你想更改" "預設值,你仍然可以手動\\ *設定*\\ 回傳值。" -#: ../../library/unittest.mock.rst:2157 +#: ../../library/unittest.mock.rst:2180 msgid "Methods and their defaults:" msgstr "方法及其預設值:" -#: ../../library/unittest.mock.rst:2159 +#: ../../library/unittest.mock.rst:2182 msgid "``__lt__``: :data:`NotImplemented`" msgstr "``__lt__``::data:`NotImplemented`" -#: ../../library/unittest.mock.rst:2160 +#: ../../library/unittest.mock.rst:2183 msgid "``__gt__``: :data:`!NotImplemented`" msgstr "``__gt__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2161 +#: ../../library/unittest.mock.rst:2184 msgid "``__le__``: :data:`!NotImplemented`" msgstr "``__le__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2162 +#: ../../library/unittest.mock.rst:2185 msgid "``__ge__``: :data:`!NotImplemented`" msgstr "``__ge__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2163 +#: ../../library/unittest.mock.rst:2186 msgid "``__int__``: ``1``" msgstr "``__int__``:``1``" -#: ../../library/unittest.mock.rst:2164 +#: ../../library/unittest.mock.rst:2187 msgid "``__contains__``: ``False``" msgstr "``__contains__``:``False``" -#: ../../library/unittest.mock.rst:2165 +#: ../../library/unittest.mock.rst:2188 msgid "``__len__``: ``0``" msgstr "``__len__``:``0``" -#: ../../library/unittest.mock.rst:2166 +#: ../../library/unittest.mock.rst:2189 msgid "``__iter__``: ``iter([])``" msgstr "``__iter__``:``iter([])``" -#: ../../library/unittest.mock.rst:2167 +#: ../../library/unittest.mock.rst:2190 msgid "``__exit__``: ``False``" msgstr "``__exit__``:``False``" -#: ../../library/unittest.mock.rst:2168 +#: ../../library/unittest.mock.rst:2191 msgid "``__aexit__``: ``False``" msgstr "``__aexit__``:``False``" -#: ../../library/unittest.mock.rst:2169 +#: ../../library/unittest.mock.rst:2192 msgid "``__complex__``: ``1j``" msgstr "``__complex__``:``1j``" -#: ../../library/unittest.mock.rst:2170 +#: ../../library/unittest.mock.rst:2193 msgid "``__float__``: ``1.0``" msgstr "``__float__``:``1.0``" -#: ../../library/unittest.mock.rst:2171 +#: ../../library/unittest.mock.rst:2194 msgid "``__bool__``: ``True``" msgstr "``__bool__``:``True``" -#: ../../library/unittest.mock.rst:2172 +#: ../../library/unittest.mock.rst:2195 msgid "``__index__``: ``1``" msgstr "``__index__``:``1``" -#: ../../library/unittest.mock.rst:2173 +#: ../../library/unittest.mock.rst:2196 msgid "``__hash__``: default hash for the mock" msgstr "``__hash__``:mock 的預設雜湊" -#: ../../library/unittest.mock.rst:2174 +#: ../../library/unittest.mock.rst:2197 msgid "``__str__``: default str for the mock" msgstr "``__str__``:mock 的預設字串" -#: ../../library/unittest.mock.rst:2175 +#: ../../library/unittest.mock.rst:2198 msgid "``__sizeof__``: default sizeof for the mock" msgstr "``__sizeof__``:mock 的預設 sizeof" -#: ../../library/unittest.mock.rst:2177 +#: ../../library/unittest.mock.rst:2200 msgid "For example:" msgstr "舉例來說:" -#: ../../library/unittest.mock.rst:2189 +#: ../../library/unittest.mock.rst:2212 msgid "" "The two equality methods, :meth:`!__eq__` and :meth:`!__ne__`, are special. " -"They do the default equality comparison on identity, using the :attr:`~Mock." -"side_effect` attribute, unless you change their return value to return " -"something else::" +"They do the default equality comparison on identity, using " +"the :attr:`~Mock.side_effect` attribute, unless you change their return " +"value to return something else::" msgstr "" -":meth:`!__eq__` 和 :meth:`!__ne__` 這兩個相等的方法是特別的。它們使用 :attr:" -"`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非你變更它" -"們的回傳值以回傳其他內容: ::" +":meth:`!__eq__` 和 :meth:`!__ne__` 這兩個相等的方法是特別的。它們使" +"用 :attr:`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非" +"你變更它們的回傳值以回傳其他內容: ::" -#: ../../library/unittest.mock.rst:2194 +#: ../../library/unittest.mock.rst:2217 msgid "" ">>> MagicMock() == 3\n" "False\n" @@ -2918,14 +2988,14 @@ msgstr "" ">>> mock == 3\n" "True" -#: ../../library/unittest.mock.rst:2203 +#: ../../library/unittest.mock.rst:2226 msgid "" "The return value of :meth:`MagicMock.__iter__` can be any iterable object " "and isn't required to be an iterator:" msgstr "" ":meth:`MagicMock.__iter__` 的回傳值可以是任何可疊代物件,且不需是一個疊代器:" -#: ../../library/unittest.mock.rst:2213 +#: ../../library/unittest.mock.rst:2236 msgid "" "If the return value *is* an iterator, then iterating over it once will " "consume it and subsequent iterations will result in an empty list:" @@ -2933,7 +3003,7 @@ msgstr "" "如果回傳值\\ *是*\\ 一個疊代器,那麼對其進行一次疊代將消耗它,並且後續疊代將" "產生一個空串列:" -#: ../../library/unittest.mock.rst:2222 +#: ../../library/unittest.mock.rst:2245 msgid "" "``MagicMock`` has all of the supported magic methods configured except for " "some of the obscure and obsolete ones. You can still set these up if you " @@ -2942,33 +3012,33 @@ msgstr "" "``MagicMock`` 配置了所有支援的魔術方法,除了一些少見和過時的方法。如果你想" "要,你仍然可以設定這些魔術方法。" -#: ../../library/unittest.mock.rst:2225 +#: ../../library/unittest.mock.rst:2248 msgid "" "Magic methods that are supported but not setup by default in ``MagicMock`` " "are:" msgstr "``MagicMock`` 中支援但預設未設置的魔術方法包含:" -#: ../../library/unittest.mock.rst:2227 +#: ../../library/unittest.mock.rst:2250 msgid "``__subclasses__``" msgstr "``__subclasses__``" -#: ../../library/unittest.mock.rst:2228 +#: ../../library/unittest.mock.rst:2251 msgid "``__dir__``" msgstr "``__dir__``" -#: ../../library/unittest.mock.rst:2229 +#: ../../library/unittest.mock.rst:2252 msgid "``__format__``" msgstr "``__format__``" -#: ../../library/unittest.mock.rst:2230 +#: ../../library/unittest.mock.rst:2253 msgid "``__get__``, ``__set__`` and ``__delete__``" msgstr "``__get__``、``__set__`` 和 ``__delete__``" -#: ../../library/unittest.mock.rst:2231 +#: ../../library/unittest.mock.rst:2254 msgid "``__reversed__`` and ``__missing__``" msgstr "``__reversed__`` 和 ``__missing__``" -#: ../../library/unittest.mock.rst:2232 +#: ../../library/unittest.mock.rst:2255 msgid "" "``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, ``__getnewargs__``, " "``__getstate__`` and ``__setstate__``" @@ -2976,11 +3046,11 @@ msgstr "" "``__reduce__``、``__reduce_ex__``、``__getinitargs__``、``__getnewargs__``、" "``__getstate__`` 和 ``__setstate__``" -#: ../../library/unittest.mock.rst:2234 +#: ../../library/unittest.mock.rst:2257 msgid "``__getformat__``" msgstr "``__getformat__``" -#: ../../library/unittest.mock.rst:2238 +#: ../../library/unittest.mock.rst:2261 msgid "" "Magic methods *should* be looked up on the class rather than the instance. " "Different versions of Python are inconsistent about applying this rule. The " @@ -2989,27 +3059,27 @@ msgstr "" "魔術方法\\ *應該*\\ 在類別而不是實例上被查找。不同版本的 Python 對於這條規則" "的適用並不一致。支援的協定方法應適用於所有支援的 Python 版本。" -#: ../../library/unittest.mock.rst:2242 +#: ../../library/unittest.mock.rst:2265 msgid "" "The function is basically hooked up to the class, but each ``Mock`` instance " "is kept isolated from the others." msgstr "該函式基本上與類別掛鉤,但每個 ``Mock`` 實例都與其他實例保持隔離。" -#: ../../library/unittest.mock.rst:2247 +#: ../../library/unittest.mock.rst:2270 msgid "Helpers" msgstr "輔助函式" -#: ../../library/unittest.mock.rst:2250 +#: ../../library/unittest.mock.rst:2273 msgid "sentinel" msgstr "sentinel(哨兵)" -#: ../../library/unittest.mock.rst:2254 +#: ../../library/unittest.mock.rst:2277 msgid "" "The ``sentinel`` object provides a convenient way of providing unique " "objects for your tests." msgstr "``哨兵``\\ 物件提供了一種為你的測試提供獨特物件的便利方式。" -#: ../../library/unittest.mock.rst:2257 +#: ../../library/unittest.mock.rst:2280 msgid "" "Attributes are created on demand when you access them by name. Accessing the " "same attribute will always return the same object. The objects returned have " @@ -3018,15 +3088,15 @@ msgstr "" "當你使用名稱存取屬性時,屬性會根據需要被建立。存取相同的屬性將始終回傳相同的" "物件。回傳的物件會具有合適的 repr,讓測試失敗的訊息是可閱讀的。" -#: ../../library/unittest.mock.rst:2261 +#: ../../library/unittest.mock.rst:2284 msgid "" -"The ``sentinel`` attributes now preserve their identity when they are :mod:" -"`copied ` or :mod:`pickled `." +"The ``sentinel`` attributes now preserve their identity when they " +"are :mod:`copied ` or :mod:`pickled `." msgstr "" "``哨兵``\\ 屬性現在當被\\ :mod:`複製 `\\ 或\\ :mod:`序列化 `\\ " "時會保留其識別性。" -#: ../../library/unittest.mock.rst:2265 +#: ../../library/unittest.mock.rst:2288 msgid "" "Sometimes when testing you need to test that a specific object is passed as " "an argument to another method, or returned. It can be common to create named " @@ -3037,44 +3107,43 @@ msgstr "" "名的哨兵物件來測試這一點是常見的。:data:`sentinel` 提供了一種此類建立和測試物" "件識別性的便利方式。" -#: ../../library/unittest.mock.rst:2270 +#: ../../library/unittest.mock.rst:2293 msgid "" -"In this example we monkey patch ``method`` to return ``sentinel." -"some_object``:" +"In this example we monkey patch ``method`` to return " +"``sentinel.some_object``:" msgstr "" "在這個例子中,我們 monkey patch ``method`` 以回傳 ``sentinel.some_object``:" -#: ../../library/unittest.mock.rst:2282 +#: ../../library/unittest.mock.rst:2305 msgid "DEFAULT" msgstr "DEFAULT" -#: ../../library/unittest.mock.rst:2287 +#: ../../library/unittest.mock.rst:2310 msgid "" -"The :data:`DEFAULT` object is a pre-created sentinel (actually ``sentinel." -"DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions to " -"indicate that the normal return value should be used." +"The :data:`DEFAULT` object is a pre-created sentinel (actually " +"``sentinel.DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions " +"to indicate that the normal return value should be used." msgstr "" -":data:`DEFAULT` 物件是一個預先建立的哨兵(實際上是 ``sentinel." -"DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示正常的回傳值" -"應該被使用。" +":data:`DEFAULT` 物件是一個預先建立的哨兵(實際上是 " +"``sentinel.DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示" +"正常的回傳值應該被使用。" -#: ../../library/unittest.mock.rst:2293 +#: ../../library/unittest.mock.rst:2316 msgid "call" msgstr "call" -#: ../../library/unittest.mock.rst:2297 +#: ../../library/unittest.mock.rst:2320 msgid "" ":func:`call` is a helper object for making simpler assertions, for comparing " -"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock." -"mock_calls` and :attr:`~Mock.method_calls`. :func:`call` can also be used " +"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock.mock_calls` " +"and :attr:`~Mock.method_calls`. :func:`call` can also be used " "with :meth:`~Mock.assert_has_calls`." msgstr "" -"與 :attr:`~Mock.call_args`、:attr:`~Mock.call_args_list`、:attr:`~Mock." -"mock_calls` 和 :attr:`~Mock.method_calls` 相比,:func:`call` 是一個用於進行更" -"簡單的斷言的輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一" -"起使用。" +"與 :attr:`~Mock.call_args`、:attr:`~Mock.call_args_list`、:attr:`~Mock.mock_calls` " +"和 :attr:`~Mock.method_calls` 相比,:func:`call` 是一個用於進行更簡單的斷言的" +"輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一起使用。" -#: ../../library/unittest.mock.rst:2310 +#: ../../library/unittest.mock.rst:2333 msgid "" "For a call object that represents multiple calls, :meth:`call_list` returns " "a list of all the intermediate calls as well as the final call." @@ -3082,7 +3151,7 @@ msgstr "" "對於表示多個呼叫的 call 物件,:meth:`call_list` 回傳所有中間呼叫以及最終呼叫" "的串列。" -#: ../../library/unittest.mock.rst:2314 +#: ../../library/unittest.mock.rst:2337 msgid "" "``call_list`` is particularly useful for making assertions on \"chained " "calls\". A chained call is multiple calls on a single line of code. This " @@ -3093,39 +3162,41 @@ msgstr "" "在單行程式碼進行的多次呼叫。這會導致 mock 上的 :attr:`~Mock.mock_calls` 中出" "現多個項目。手動建構呼叫序列會相當單調乏味。" -#: ../../library/unittest.mock.rst:2319 +#: ../../library/unittest.mock.rst:2342 msgid "" ":meth:`~call.call_list` can construct the sequence of calls from the same " "chained call:" msgstr ":meth:`~call.call_list` 可以從同一個鍊接呼叫建構呼叫序列:" -#: ../../library/unittest.mock.rst:2336 +#: ../../library/unittest.mock.rst:2359 msgid "" "A ``call`` object is either a tuple of (positional args, keyword args) or " "(name, positional args, keyword args) depending on how it was constructed. " "When you construct them yourself this isn't particularly interesting, but " -"the ``call`` objects that are in the :attr:`Mock.call_args`, :attr:`Mock." -"call_args_list` and :attr:`Mock.mock_calls` attributes can be introspected " -"to get at the individual arguments they contain." +"the ``call`` objects that are in " +"the :attr:`Mock.call_args`, :attr:`Mock.call_args_list` " +"and :attr:`Mock.mock_calls` attributes can be introspected to get at the " +"individual arguments they contain." msgstr "" "取決於它的建構方式,一個 ``call`` 物件會是(位置引數, 關鍵字引數)的元組,或" "是 (名稱, 位置引數, 關鍵字引數) 的元組。當你自己建構它們時,這並不是那麼有" -"趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` 和 :attr:`Mock." -"mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各個引數。" +"趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` " +"和 :attr:`Mock.mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各" +"個引數。" -#: ../../library/unittest.mock.rst:2343 +#: ../../library/unittest.mock.rst:2366 msgid "" -"The ``call`` objects in :attr:`Mock.call_args` and :attr:`Mock." -"call_args_list` are two-tuples of (positional args, keyword args) whereas " -"the ``call`` objects in :attr:`Mock.mock_calls`, along with ones you " -"construct yourself, are three-tuples of (name, positional args, keyword " -"args)." +"The ``call`` objects in :attr:`Mock.call_args` " +"and :attr:`Mock.call_args_list` are two-tuples of (positional args, keyword " +"args) whereas the ``call`` objects in :attr:`Mock.mock_calls`, along with " +"ones you construct yourself, are three-tuples of (name, positional args, " +"keyword args)." msgstr "" ":attr:`Mock.call_args` 和 :attr:`Mock.call_args_list` 中的 ``call`` 物件是" "(位置引數, 關鍵字引數)的二元組,而 :attr:`Mock.mock_calls` 中的 ``call`` 物" "件以及你自己建立的 ``call`` 物件是(名稱, 位置引數, 關鍵字引數)的三元組。" -#: ../../library/unittest.mock.rst:2348 +#: ../../library/unittest.mock.rst:2371 msgid "" "You can use their \"tupleness\" to pull out the individual arguments for " "more complex introspection and assertions. The positional arguments are a " @@ -3135,11 +3206,11 @@ msgstr "" "你可以利用它們作為元組的特性來提取單個引數,以進行更複雜的內省和斷言。位置引" "數是一個元組(如果沒有位置引數則為空元組),關鍵字引數是一個字典:" -#: ../../library/unittest.mock.rst:2381 +#: ../../library/unittest.mock.rst:2404 msgid "create_autospec" msgstr "create_autospec" -#: ../../library/unittest.mock.rst:2385 +#: ../../library/unittest.mock.rst:2408 msgid "" "Create a mock object using another object as a spec. Attributes on the mock " "will use the corresponding attribute on the *spec* object as their spec." @@ -3147,21 +3218,21 @@ msgstr "" "使用另一個物件作為規格建立一個 mock 物件。Mock 上的屬性將使用 *spec* 物件上的" "對應屬性作為其規格。" -#: ../../library/unittest.mock.rst:2389 +#: ../../library/unittest.mock.rst:2412 msgid "" "Functions or methods being mocked will have their arguments checked to " "ensure that they are called with the correct signature." msgstr "被 mock 的函式或方法將檢查其引數,以確保他們被使用正確的簽名來呼叫。" -#: ../../library/unittest.mock.rst:2392 +#: ../../library/unittest.mock.rst:2415 msgid "" "If *spec_set* is ``True`` then attempting to set attributes that don't exist " "on the spec object will raise an :exc:`AttributeError`." msgstr "" -"如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引發 :exc:" -"`AttributeError`。" +"如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引" +"發 :exc:`AttributeError`。" -#: ../../library/unittest.mock.rst:2395 +#: ../../library/unittest.mock.rst:2418 msgid "" "If a class is used as a spec then the return value of the mock (the instance " "of the class) will have the same spec. You can use a class as the spec for " @@ -3172,7 +3243,7 @@ msgstr "" "可以透過傳遞 ``instance=True`` 來使用一個類別作為一個實例物件的規格。只有當 " "mock 的實例是可呼叫物件時,回傳的 mock 才會是可呼叫物件。" -#: ../../library/unittest.mock.rst:2400 +#: ../../library/unittest.mock.rst:2423 msgid "" ":func:`create_autospec` also takes arbitrary keyword arguments that are " "passed to the constructor of the created mock." @@ -3180,27 +3251,27 @@ msgstr "" ":func:`create_autospec` 也接受任意的關鍵字引數,這些引數會傳遞給已建立的 " "mock 的建構函式。" -#: ../../library/unittest.mock.rst:2403 +#: ../../library/unittest.mock.rst:2426 msgid "" -"See :ref:`auto-speccing` for examples of how to use auto-speccing with :func:" -"`create_autospec` and the *autospec* argument to :func:`patch`." +"See :ref:`auto-speccing` for examples of how to use auto-speccing " +"with :func:`create_autospec` and the *autospec* argument to :func:`patch`." msgstr "" "請參閱 :ref:`auto-speccing` 以得知如何以 :func:`create_autospec` 使用自動規格" "以及如何在 :func:`patch` 中使用 *autospec* 引數的範例。" -#: ../../library/unittest.mock.rst:2409 +#: ../../library/unittest.mock.rst:2432 msgid "" ":func:`create_autospec` now returns an :class:`AsyncMock` if the target is " "an async function." msgstr "" -"如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一個 :class:" -"`AsyncMock`。" +"如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一" +"個 :class:`AsyncMock`。" -#: ../../library/unittest.mock.rst:2414 +#: ../../library/unittest.mock.rst:2437 msgid "ANY" msgstr "ANY" -#: ../../library/unittest.mock.rst:2418 +#: ../../library/unittest.mock.rst:2441 msgid "" "Sometimes you may need to make assertions about *some* of the arguments in a " "call to mock, but either not care about some of the arguments or want to " @@ -3210,30 +3281,31 @@ msgstr "" "有時你可能需要對 mock 的呼叫中的\\ *某些*\\ 引數進行斷言,但你不在意其他的某" "些引數,或想將它們單獨從 :attr:`~Mock.call_args` 中取出並進行更加複雜的斷言。" -#: ../../library/unittest.mock.rst:2423 +#: ../../library/unittest.mock.rst:2446 msgid "" "To ignore certain arguments you can pass in objects that compare equal to " -"*everything*. Calls to :meth:`~Mock.assert_called_with` and :meth:`~Mock." -"assert_called_once_with` will then succeed no matter what was passed in." +"*everything*. Calls to :meth:`~Mock.assert_called_with` " +"and :meth:`~Mock.assert_called_once_with` will then succeed no matter what " +"was passed in." msgstr "" "要忽略某些引數,你可以傳入對\\ *所有物件*\\ 來說都相等的物件。那麼無論傳入什" -"麼內容,對 :meth:`~Mock.assert_used_with` 和 :meth:`~Mock." -"assert_used_once_with` 的呼叫都會成功。" +"麼內容,對 :meth:`~Mock.assert_used_with` " +"和 :meth:`~Mock.assert_used_once_with` 的呼叫都會成功。" -#: ../../library/unittest.mock.rst:2432 +#: ../../library/unittest.mock.rst:2455 msgid "" -":data:`ANY` can also be used in comparisons with call lists like :attr:" -"`~Mock.mock_calls`:" +":data:`ANY` can also be used in comparisons with call lists " +"like :attr:`~Mock.mock_calls`:" msgstr "" ":data:`ANY` 也可以用來與呼叫串列進行比較,例如 :attr:`~Mock.mock_calls`:" -#: ../../library/unittest.mock.rst:2442 +#: ../../library/unittest.mock.rst:2465 msgid "" ":data:`ANY` is not limited to comparisons with call objects and so can also " "be used in test assertions::" msgstr ":data:`ANY` 不只能與呼叫物件比較,其也可以在測試斷言中使用: ::" -#: ../../library/unittest.mock.rst:2445 +#: ../../library/unittest.mock.rst:2468 msgid "" "class TestStringMethods(unittest.TestCase):\n" "\n" @@ -3247,24 +3319,24 @@ msgstr "" " s = 'hello world'\n" " self.assertEqual(s.split(), ['hello', ANY])" -#: ../../library/unittest.mock.rst:2453 +#: ../../library/unittest.mock.rst:2476 msgid "FILTER_DIR" msgstr "FILTER_DIR" -#: ../../library/unittest.mock.rst:2457 +#: ../../library/unittest.mock.rst:2480 msgid "" ":data:`FILTER_DIR` is a module level variable that controls the way mock " "objects respond to :func:`dir`. The default is ``True``, which uses the " "filtering described below, to only show useful members. If you dislike this " -"filtering, or need to switch it off for diagnostic purposes, then set ``mock." -"FILTER_DIR = False``." +"filtering, or need to switch it off for diagnostic purposes, then set " +"``mock.FILTER_DIR = False``." msgstr "" ":data:`FILTER_DIR` 是一個模組級別的變數,用於控制 mock 物件回應 :func:`dir` " "的方式。其預設值為 ``True``,它使用以下描述的過濾方式來只顯示有用的成員。如果" "你不喜歡這個過濾方式,或由於診斷意圖而需要將其關閉,請設定 ``mock.FILTER_DIR " "= False``。" -#: ../../library/unittest.mock.rst:2463 +#: ../../library/unittest.mock.rst:2486 msgid "" "With filtering on, ``dir(some_mock)`` shows only useful attributes and will " "include any dynamically created attributes that wouldn't normally be shown. " @@ -3276,7 +3348,7 @@ msgstr "" "的任何動態建立的屬性。如果 mock 是使用 *spec*\\ (或 *autospec*\\ )來建立" "的,那麼源頭的所有屬性都會顯示,即使它們尚未被存取:" -#: ../../library/unittest.mock.rst:2469 +#: ../../library/unittest.mock.rst:2492 msgid "" ">>> dir(Mock())\n" "['assert_any_call',\n" @@ -3314,7 +3386,7 @@ msgstr "" " 'BaseHandler',\n" " ..." -#: ../../library/unittest.mock.rst:2490 +#: ../../library/unittest.mock.rst:2513 msgid "" "Many of the not-very-useful (private to :class:`Mock` rather than the thing " "being mocked) underscore and double underscore prefixed attributes have been " @@ -3326,7 +3398,7 @@ msgstr "" "雙底線前綴屬性已從在 :class:`Mock` 上呼叫 :func:`dir` 的結果中濾除。如果你不" "喜歡這種特性,可以透過設定模組級別開關 :data:`FILTER_DIR` 來將其關閉:" -#: ../../library/unittest.mock.rst:2496 +#: ../../library/unittest.mock.rst:2519 msgid "" ">>> from unittest import mock\n" ">>> mock.FILTER_DIR = False\n" @@ -3352,21 +3424,21 @@ msgstr "" " '__class__',\n" " ..." -#: ../../library/unittest.mock.rst:2511 +#: ../../library/unittest.mock.rst:2534 msgid "" "Alternatively you can just use ``vars(my_mock)`` (instance members) and " "``dir(type(my_mock))`` (type members) to bypass the filtering irrespective " "of :const:`FILTER_DIR`." msgstr "" "或者,你可以只使用 ``vars(my_mock)``\\ (實例成員)和 " -"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考慮 :const:" -"`FILTER_DIR`。" +"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考" +"慮 :const:`FILTER_DIR`。" -#: ../../library/unittest.mock.rst:2517 +#: ../../library/unittest.mock.rst:2540 msgid "mock_open" msgstr "mock_open" -#: ../../library/unittest.mock.rst:2521 +#: ../../library/unittest.mock.rst:2544 msgid "" "A helper function to create a mock to replace the use of :func:`open`. It " "works for :func:`open` called directly or used as a context manager." @@ -3374,7 +3446,7 @@ msgstr "" "用於建立取代 :func:`open` 用途的 mock 的輔助函式。它適用於直接呼叫或用作情境" "管理器的 :func:`open`。" -#: ../../library/unittest.mock.rst:2524 +#: ../../library/unittest.mock.rst:2547 msgid "" "The *mock* argument is the mock object to configure. If ``None`` (the " "default) then a :class:`MagicMock` will be created for you, with the API " @@ -3383,41 +3455,43 @@ msgstr "" "*mock* 引數是要配置的 mock 物件。如果其為 ``None``\\ (預設值),那麼就會為你" "建立一個 :class:`MagicMock`,其 API 限制在標準檔案處理上可用的方法或屬性。" -#: ../../library/unittest.mock.rst:2528 -msgid "" -"*read_data* is a string for the :meth:`~io.RawIOBase.read`, :meth:`~io." -"IOBase.readline`, and :meth:`~io.IOBase.readlines` methods of the file " -"handle to return. Calls to those methods will take data from *read_data* " -"until it is depleted. The mock of these methods is pretty simplistic: every " -"time the *mock* is called, the *read_data* is rewound to the start. If you " -"need more control over the data that you are feeding to the tested code you " -"will need to customize this mock for yourself. When that is insufficient, " -"one of the in-memory filesystem packages on `PyPI `_ can " -"offer a realistic filesystem for testing." -msgstr "" -"*read_data* 是檔案處理方法 :meth:`~io.RawIOBase.read`、:meth:`~io.IOBase." -"readline` 和 :meth:`~io.IOBase.readlines` 的回傳字串。對這些方法的呼叫將從 " -"*read_data* 取得資料,直到資料耗盡。對這些方法的 mock 非常單純:每次呼叫 " -"*mock* 時,*read_data* 都會倒回到起點。如果你需要對提供給測試程式碼的資料進行" -"更多控制,你會需要自行客製化這個 mock。如果這樣還不夠,`PyPI `_ 上的其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測" -"試的真實檔案系統。" - -#: ../../library/unittest.mock.rst:2538 +#: ../../library/unittest.mock.rst:2551 +msgid "" +"*read_data* is a string for " +"the :meth:`~io.RawIOBase.read`, :meth:`~io.IOBase.readline`, " +"and :meth:`~io.IOBase.readlines` methods of the file handle to return. " +"Calls to those methods will take data from *read_data* until it is " +"depleted. The mock of these methods is pretty simplistic: every time the " +"*mock* is called, the *read_data* is rewound to the start. If you need more " +"control over the data that you are feeding to the tested code you will need " +"to customize this mock for yourself. When that is insufficient, one of the " +"in-memory filesystem packages on `PyPI `_ can offer a " +"realistic filesystem for testing." +msgstr "" +"*read_data* 是檔案處理方" +"法 :meth:`~io.RawIOBase.read`、:meth:`~io.IOBase.readline` " +"和 :meth:`~io.IOBase.readlines` 的回傳字串。對這些方法的呼叫將從 *read_data* " +"取得資料,直到資料耗盡。對這些方法的 mock 非常單純:每次呼叫 *mock* 時," +"*read_data* 都會倒回到起點。如果你需要對提供給測試程式碼的資料進行更多控制," +"你會需要自行客製化這個 mock。如果這樣還不夠,`PyPI `_ 上的" +"其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測試的真實檔" +"案系統。" + +#: ../../library/unittest.mock.rst:2561 msgid "" "Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support. " "The mock of :meth:`~io.RawIOBase.read` changed to consume *read_data* rather " "than returning it on each call." msgstr "" -"新增對 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支援。:" -"meth:`~io.RawIOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼叫時回" -"傳它。" +"新增對 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支" +"援。:meth:`~io.RawIOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼" +"叫時回傳它。" -#: ../../library/unittest.mock.rst:2543 +#: ../../library/unittest.mock.rst:2566 msgid "*read_data* is now reset on each call to the *mock*." msgstr "現在,每次呼叫 *mock* 時都會重置 *read_data*。" -#: ../../library/unittest.mock.rst:2546 +#: ../../library/unittest.mock.rst:2569 msgid "" "Added :meth:`~container.__iter__` to implementation so that iteration (such " "as in for loops) correctly consumes *read_data*." @@ -3425,7 +3499,7 @@ msgstr "" "新增 :meth:`~container.__iter__` 到實作中,以便使疊代(例如在 for 迴圈中)正" "確地消耗 *read_data*。" -#: ../../library/unittest.mock.rst:2550 +#: ../../library/unittest.mock.rst:2573 msgid "" "Using :func:`open` as a context manager is a great way to ensure your file " "handles are closed properly and is becoming common::" @@ -3433,7 +3507,7 @@ msgstr "" "使用 :func:`open` 作為情境管理器是確保檔案處理正確關閉的好方式,且這種方式正" "在變得普遍: ::" -#: ../../library/unittest.mock.rst:2553 +#: ../../library/unittest.mock.rst:2576 msgid "" "with open('/some/path', 'w') as f:\n" " f.write('something')" @@ -3441,17 +3515,17 @@ msgstr "" "with open('/some/path', 'w') as f:\n" " f.write('something')" -#: ../../library/unittest.mock.rst:2556 +#: ../../library/unittest.mock.rst:2579 msgid "" "The issue is that even if you mock out the call to :func:`open` it is the " -"*returned object* that is used as a context manager (and has :meth:`~object." -"__enter__` and :meth:`~object.__exit__` called)." +"*returned object* that is used as a context manager (and " +"has :meth:`~object.__enter__` and :meth:`~object.__exit__` called)." msgstr "" "問題是,即使你 mock 了對 :func:`open` 的呼叫,它也是作為情境管理器使用的\\ *" "回傳物件*\\ (且其 :meth:`~object.__enter__` 和 :meth:`~ object.__exit__` 已" "被呼叫)。" -#: ../../library/unittest.mock.rst:2560 +#: ../../library/unittest.mock.rst:2583 msgid "" "Mocking context managers with a :class:`MagicMock` is common enough and " "fiddly enough that a helper function is useful. ::" @@ -3459,7 +3533,7 @@ msgstr "" "使用 :class:`MagicMock` mock 情境管理器相當常見並且精細,因此輔助函式就非常有" "用: ::" -#: ../../library/unittest.mock.rst:2563 +#: ../../library/unittest.mock.rst:2586 msgid "" ">>> m = mock_open()\n" ">>> with patch('__main__.open', m):\n" @@ -3489,11 +3563,11 @@ msgstr "" ">>> handle = m()\n" ">>> handle.write.assert_called_once_with('some stuff')" -#: ../../library/unittest.mock.rst:2577 +#: ../../library/unittest.mock.rst:2600 msgid "And for reading files::" msgstr "以及讀取檔案: ::" -#: ../../library/unittest.mock.rst:2579 +#: ../../library/unittest.mock.rst:2602 msgid "" ">>> with patch('__main__.open', mock_open(read_data='bibble')) as m:\n" "... with open('foo') as h:\n" @@ -3509,29 +3583,29 @@ msgstr "" ">>> m.assert_called_once_with('foo')\n" ">>> assert result == 'bibble'" -#: ../../library/unittest.mock.rst:2590 +#: ../../library/unittest.mock.rst:2613 msgid "Autospeccing" msgstr "Autospeccing(自動規格)" -#: ../../library/unittest.mock.rst:2592 +#: ../../library/unittest.mock.rst:2615 msgid "" "Autospeccing is based on the existing :attr:`!spec` feature of mock. It " "limits the api of mocks to the api of an original object (the spec), but it " "is recursive (implemented lazily) so that attributes of mocks only have the " "same api as the attributes of the spec. In addition mocked functions / " -"methods have the same call signature as the original so they raise a :exc:" -"`TypeError` if they are called incorrectly." +"methods have the same call signature as the original so they raise " +"a :exc:`TypeError` if they are called incorrectly." msgstr "" "自動規格以 mock 現有的 :attr:`!spec` 功能作為基礎。它將 mock 的 api 限制為原" "始物件(規格)的 api,但它是遞迴的(惰性 (lazily) 實現),因此 mock 的屬性僅" "具有與規格的屬性相同的 api。此外,被 mock 的函式/方法具有與原始的函式/方法相" "同的呼叫簽名,因此如果它們被不正確地呼叫,就會引發 :exc:`TypeError`。" -#: ../../library/unittest.mock.rst:2599 +#: ../../library/unittest.mock.rst:2622 msgid "Before I explain how auto-speccing works, here's why it is needed." msgstr "在解釋自動規格如何運作之前,我們先解釋為什麼需要它。" -#: ../../library/unittest.mock.rst:2601 +#: ../../library/unittest.mock.rst:2624 msgid "" ":class:`Mock` is a very powerful and flexible object, but it suffers from a " "flaw which is general to mocking. If you refactor some of your code, rename " @@ -3544,7 +3618,7 @@ msgstr "" "實物件的程式碼測試仍然會通過。這意味著即使你的程式碼壞了,但測試仍可以全部通" "過。" -#: ../../library/unittest.mock.rst:2609 +#: ../../library/unittest.mock.rst:2632 msgid "" "Before 3.5, tests with a typo in the word assert would silently pass when " "they should raise an error. You can still achieve this behavior by passing " @@ -3553,7 +3627,7 @@ msgstr "" "在 3.5 之前,當測試應該引發錯誤時,斷言單字中存在拼字錯誤的測驗會默默地通過。" "你仍可以透過將 ``unsafe=True`` 傳遞給 Mock 來實作此行為。" -#: ../../library/unittest.mock.rst:2612 +#: ../../library/unittest.mock.rst:2635 msgid "" "Note that this is another reason why you need integration tests as well as " "unit tests. Testing everything in isolation is all fine and dandy, but if " @@ -3563,7 +3637,7 @@ msgstr "" "謹記這是你需要有整合測試和單元測試的另一個原因。單獨測試所有內容都很好,但如" "果你不測試你的單元是如何「連接在一起」的,那麼測試還是有機會發現很多錯誤。" -#: ../../library/unittest.mock.rst:2617 +#: ../../library/unittest.mock.rst:2640 msgid "" ":mod:`unittest.mock` already provides a feature to help with this, called " "speccing. If you use a class or instance as the :attr:`!spec` for a mock " @@ -3573,13 +3647,13 @@ msgstr "" "如果你使用類別或實例作為 mock 的 :attr:`!spec`,那麼你在 mock 上只能存取真實" "類別中存在的屬性:" -#: ../../library/unittest.mock.rst:2628 +#: ../../library/unittest.mock.rst:2651 msgid "" "The spec only applies to the mock itself, so we still have the same issue " "with any methods on the mock:" msgstr "該規格僅適用於 mock 本身,因此在 mock 上的任何方法仍然有相同的問題:" -#: ../../library/unittest.mock.rst:2631 +#: ../../library/unittest.mock.rst:2654 msgid "" ">>> mock.has_data()\n" "\n" @@ -3589,10 +3663,10 @@ msgstr "" "\n" ">>> mock.has_data.assret_called_with() # 故意的錯字!" -#: ../../library/unittest.mock.rst:2637 +#: ../../library/unittest.mock.rst:2660 msgid "" -"Auto-speccing solves this problem. You can either pass ``autospec=True`` to :" -"func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " +"Auto-speccing solves this problem. You can either pass ``autospec=True`` " +"to :func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " "function to create a mock with a spec. If you use the ``autospec=True`` " "argument to :func:`patch` then the object that is being replaced will be " "used as the spec object. Because the speccing is done \"lazily\" (the spec " @@ -3600,18 +3674,18 @@ msgid "" "complex or deeply nested objects (like modules that import modules that " "import modules) without a big performance hit." msgstr "" -"自動規格解決了這個問題。你可以將 ``autospec=True`` 傳遞給 :func:`patch` / :" -"func:`patch.object` 或使用 :func:`create_autospec` 函式建立帶有規格的 mock。" -"如果你對 :func:`patch` 使用 ``autospec=True`` 引數,則被取代的物件將作為規格" -"物件使用。因為規格是「惰性」完成的(規格是在 mock 被存取時作為屬性被建立" -"的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引用的模組)一起" -"使用,而不會過於影響性能。" +"自動規格解決了這個問題。你可以將 ``autospec=True`` 傳遞" +"給 :func:`patch` / :func:`patch.object` 或使用 :func:`create_autospec` 函式建" +"立帶有規格的 mock。如果你對 :func:`patch` 使用 ``autospec=True`` 引數,則被取" +"代的物件將作為規格物件使用。因為規格是「惰性」完成的(規格是在 mock 被存取時" +"作為屬性被建立的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引" +"用的模組)一起使用,而不會過於影響性能。" -#: ../../library/unittest.mock.rst:2646 +#: ../../library/unittest.mock.rst:2669 msgid "Here's an example of it in use::" msgstr "這是一個正在使用的例子: ::" -#: ../../library/unittest.mock.rst:2648 +#: ../../library/unittest.mock.rst:2671 msgid "" ">>> from urllib import request\n" ">>> patcher = patch('__main__.request', autospec=True)\n" @@ -3629,17 +3703,17 @@ msgstr "" ">>> mock_request.Request\n" "" -#: ../../library/unittest.mock.rst:2656 +#: ../../library/unittest.mock.rst:2679 msgid "" -"You can see that :class:`!request.Request` has a spec. :class:`!request." -"Request` takes two arguments in the constructor (one of which is *self*). " -"Here's what happens if we try to call it incorrectly::" +"You can see that :class:`!request.Request` has a spec. :class:`!" +"request.Request` takes two arguments in the constructor (one of which is " +"*self*). Here's what happens if we try to call it incorrectly::" msgstr "" "你可以看到 :class:`!request.Request` 有一個規格。:class:`!request.Request` 在" "建構函式中接受兩個引數(其中之一是 *self*\\ )。如果我們錯誤地呼叫它,會發生" "以下情況: ::" -#: ../../library/unittest.mock.rst:2660 +#: ../../library/unittest.mock.rst:2683 msgid "" ">>> req = request.Request()\n" "Traceback (most recent call last):\n" @@ -3651,13 +3725,13 @@ msgstr "" " ...\n" "TypeError: () takes at least 2 arguments (1 given)" -#: ../../library/unittest.mock.rst:2665 +#: ../../library/unittest.mock.rst:2688 msgid "" "The spec also applies to instantiated classes (i.e. the return value of " "specced mocks)::" msgstr "此規格也適用於實例化的類別(即有規格的 mock 的回傳值): ::" -#: ../../library/unittest.mock.rst:2668 +#: ../../library/unittest.mock.rst:2691 msgid "" ">>> req = request.Request('foo')\n" ">>> req\n" @@ -3667,7 +3741,7 @@ msgstr "" ">>> req\n" "" -#: ../../library/unittest.mock.rst:2672 +#: ../../library/unittest.mock.rst:2695 msgid "" ":class:`!Request` objects are not callable, so the return value of " "instantiating our mocked out :class:`!request.Request` is a non-callable " @@ -3678,7 +3752,7 @@ msgstr "" "request.Request` 的回傳值是不可呼叫的 mock。規格到位後,斷言中的任何拼字錯誤" "都會引發正確的錯誤: ::" -#: ../../library/unittest.mock.rst:2676 +#: ../../library/unittest.mock.rst:2699 msgid "" ">>> req.add_header('spam', 'eggs')\n" "\n" @@ -3696,7 +3770,7 @@ msgstr "" "AttributeError: Mock object has no attribute 'assret_called_with'\n" ">>> req.add_header.assert_called_with('spam', 'eggs')" -#: ../../library/unittest.mock.rst:2684 +#: ../../library/unittest.mock.rst:2707 msgid "" "In many cases you will just be able to add ``autospec=True`` to your " "existing :func:`patch` calls and then be protected against bugs due to typos " @@ -3705,15 +3779,15 @@ msgstr "" "在許多情況下,你只需要將 ``autospec=True`` 新增至現有的 :func:`patch` 呼叫" "中,然後就可以防止因拼字錯誤和 api 變更而導致的錯誤。" -#: ../../library/unittest.mock.rst:2688 +#: ../../library/unittest.mock.rst:2711 msgid "" -"As well as using *autospec* through :func:`patch` there is a :func:" -"`create_autospec` for creating autospecced mocks directly:" +"As well as using *autospec* through :func:`patch` there is " +"a :func:`create_autospec` for creating autospecced mocks directly:" msgstr "" -"除了透過 :func:`patch` 使用 *autospec* 之外,還有一個 :func:" -"`create_autospec` 用於直接建立有自動規格的 mock:" +"除了透過 :func:`patch` 使用 *autospec* 之外,還有一" +"個 :func:`create_autospec` 用於直接建立有自動規格的 mock:" -#: ../../library/unittest.mock.rst:2696 +#: ../../library/unittest.mock.rst:2719 msgid "" "This isn't without caveats and limitations however, which is why it is not " "the default behaviour. In order to know what attributes are available on the " @@ -3730,7 +3804,7 @@ msgstr "" "描述器,那麼你可能無法使用 autospec。換句話說,設計你的物件讓內省是安全的 " "[#]_ 會比較好。" -#: ../../library/unittest.mock.rst:2705 +#: ../../library/unittest.mock.rst:2728 msgid "" "A more serious problem is that it is common for instance attributes to be " "created in the :meth:`~object.__init__` method and not to exist on the class " @@ -3741,7 +3815,7 @@ msgstr "" "而其根本不存在於類別中。*autospec* 無法知道任何動態建立的屬性,並將 api 限制" "為可見的屬性。: ::" -#: ../../library/unittest.mock.rst:2710 +#: ../../library/unittest.mock.rst:2733 msgid "" ">>> class Something:\n" "... def __init__(self):\n" @@ -3767,7 +3841,7 @@ msgstr "" " ...\n" "AttributeError: Mock object has no attribute 'a'" -#: ../../library/unittest.mock.rst:2722 +#: ../../library/unittest.mock.rst:2745 msgid "" "There are a few different ways of resolving this problem. The easiest, but " "not necessarily the least annoying, way is to simply set the required " @@ -3779,7 +3853,7 @@ msgstr "" "在 mock 上設定所需的屬性。因為雖然 *autospec* 不允許你取得規格中不存在的屬" "性,但是它不會阻止你設定它們: ::" -#: ../../library/unittest.mock.rst:2728 +#: ../../library/unittest.mock.rst:2751 msgid "" ">>> with patch('__main__.Something', autospec=True):\n" "... thing = Something()\n" @@ -3791,7 +3865,7 @@ msgstr "" "... thing.a = 33\n" "..." -#: ../../library/unittest.mock.rst:2733 +#: ../../library/unittest.mock.rst:2756 msgid "" "There is a more aggressive version of both *spec* and *autospec* that *does* " "prevent you setting non-existent attributes. This is useful if you want to " @@ -3802,7 +3876,7 @@ msgstr "" "屬性。如果你想確保你的程式碼僅能\\ *設定*\\ 有效的屬性,那麼這會很有用,但顯" "然它也順便阻止了這個特殊情況:" -#: ../../library/unittest.mock.rst:2746 +#: ../../library/unittest.mock.rst:2769 msgid "" "Probably the best way of solving the problem is to add class attributes as " "default values for instance members initialised in :meth:`~object.__init__`. " @@ -3814,7 +3888,7 @@ msgstr "" "的實例成員的預設值。請注意,如果你僅在 :meth:`!__init__` 中設定預設屬性,那麼" "透過類別屬性(當然在實例之間共用)提供它們也會更快。例如:" -#: ../../library/unittest.mock.rst:2752 +#: ../../library/unittest.mock.rst:2775 msgid "" "class Something:\n" " a = 33" @@ -3822,7 +3896,7 @@ msgstr "" "class Something:\n" " a = 33" -#: ../../library/unittest.mock.rst:2757 +#: ../../library/unittest.mock.rst:2780 msgid "" "This brings up another issue. It is relatively common to provide a default " "value of ``None`` for members that will later be an object of a different " @@ -3838,7 +3912,7 @@ msgstr "" "他型別的成員,因此自動規格不會對設定為 ``None`` 的成員使用規格。這些會只是普" "通的 mock(通常是 MagicMocks):" -#: ../../library/unittest.mock.rst:2772 +#: ../../library/unittest.mock.rst:2795 msgid "" "If modifying your production classes to add defaults isn't to your liking " "then there are more options. One of these is simply to use an instance as " @@ -3854,7 +3928,7 @@ msgstr "" "你使用替代物件作為規格。值得慶幸的是 :func:`patch` 支援這一點 - 你可以簡單地" "將替代物件作為 *autospec* 引數傳遞: ::" -#: ../../library/unittest.mock.rst:2780 +#: ../../library/unittest.mock.rst:2803 msgid "" ">>> class Something:\n" "... def __init__(self):\n" @@ -3880,7 +3954,7 @@ msgstr "" ">>> mock.a\n" "" -#: ../../library/unittest.mock.rst:2793 +#: ../../library/unittest.mock.rst:2816 msgid "" "This only applies to classes or already instantiated objects. Calling a " "mocked class to create a mock instance *does not* create a real instance. It " @@ -3889,11 +3963,11 @@ msgstr "" "這只適用於類別或已經實例化的物件。呼叫一個被 mock 的類別來建立一個 mock 實例" "\\ *不會*\\ 建立真的實例。它僅查找屬性及對 :func:`dir` 的呼叫。" -#: ../../library/unittest.mock.rst:2798 +#: ../../library/unittest.mock.rst:2821 msgid "Sealing mocks" msgstr "密封 mock" -#: ../../library/unittest.mock.rst:2807 +#: ../../library/unittest.mock.rst:2830 msgid "" "Seal will disable the automatic creation of mocks when accessing an " "attribute of the mock being sealed or any of its attributes that are already " @@ -3902,7 +3976,7 @@ msgstr "" "當存取被密封的 mock 的屬性或其任何已經遞迴 mock 的屬性時,seal 將停用 mock 的" "自動建立。" -#: ../../library/unittest.mock.rst:2810 +#: ../../library/unittest.mock.rst:2833 msgid "" "If a mock instance with a name or a spec is assigned to an attribute it " "won't be considered in the sealing chain. This allows one to prevent seal " @@ -3911,7 +3985,7 @@ msgstr "" "如果將具有名稱或規格的 mock 實例指派給屬性,則不會出現在密封鏈中。這表示可藉" "由固定 mock 物件的一部分來防止密封。: ::" -#: ../../library/unittest.mock.rst:2814 +#: ../../library/unittest.mock.rst:2837 msgid "" ">>> mock = Mock()\n" ">>> mock.submock.attribute1 = 2\n" @@ -3929,52 +4003,52 @@ msgstr "" ">>> mock.submock.attribute2 # This will raise AttributeError.\n" ">>> mock.not_submock.attribute2 # This won't raise." -#: ../../library/unittest.mock.rst:2826 +#: ../../library/unittest.mock.rst:2849 msgid "" "Order of precedence of :attr:`!side_effect`, :attr:`!return_value` and " "*wraps*" msgstr ":attr:`!side_effect`、:attr:`!return_value` 和 *wraps* 的優先順序" -#: ../../library/unittest.mock.rst:2828 +#: ../../library/unittest.mock.rst:2851 msgid "The order of their precedence is:" msgstr "它們的優先順序是:" -#: ../../library/unittest.mock.rst:2830 +#: ../../library/unittest.mock.rst:2853 msgid ":attr:`~Mock.side_effect`" msgstr ":attr:`~Mock.side_effect`" -#: ../../library/unittest.mock.rst:2831 +#: ../../library/unittest.mock.rst:2854 msgid ":attr:`~Mock.return_value`" msgstr ":attr:`~Mock.return_value`" -#: ../../library/unittest.mock.rst:2832 +#: ../../library/unittest.mock.rst:2855 msgid "*wraps*" msgstr "*wraps*" -#: ../../library/unittest.mock.rst:2834 +#: ../../library/unittest.mock.rst:2857 msgid "" -"If all three are set, mock will return the value from :attr:`~Mock." -"side_effect`, ignoring :attr:`~Mock.return_value` and the wrapped object " -"altogether. If any two are set, the one with the higher precedence will " -"return the value. Regardless of the order of which was set first, the order " -"of precedence remains unchanged." +"If all three are set, mock will return the value " +"from :attr:`~Mock.side_effect`, ignoring :attr:`~Mock.return_value` and the " +"wrapped object altogether. If any two are set, the one with the higher " +"precedence will return the value. Regardless of the order of which was set " +"first, the order of precedence remains unchanged." msgstr "" "如果這三個都有設定,mock 將會回傳來自 :attr:`~Mock.side_effect` 的值,並忽" "略 :attr:`~Mock.return_value` 和被包裝物件。如果設定了任兩項,則優先順序較高" "的一項將回傳該值。無論先設定哪個順序,優先順序都保持不變。" -#: ../../library/unittest.mock.rst:2852 +#: ../../library/unittest.mock.rst:2875 msgid "" "As ``None`` is the default value of :attr:`~Mock.side_effect`, if you " "reassign its value back to ``None``, the order of precedence will be checked " -"between :attr:`~Mock.return_value` and the wrapped object, ignoring :attr:" -"`~Mock.side_effect`." +"between :attr:`~Mock.return_value` and the wrapped object, " +"ignoring :attr:`~Mock.side_effect`." msgstr "" "由於 ``None`` 是 :attr:`~Mock.side_effect` 的預設值,如果將其值重新賦值回為 " "``None``,則會檢查 :attr:`~Mock.return_value` 和被包裝物件之間的優先順序,忽" "略 :attr:`~Mock.side_effect`。" -#: ../../library/unittest.mock.rst:2861 +#: ../../library/unittest.mock.rst:2884 msgid "" "If the value being returned by :attr:`~Mock.side_effect` is :data:`DEFAULT`, " "it is ignored and the order of precedence moves to the successor to obtain " @@ -3983,21 +4057,21 @@ msgstr "" "如果 :attr:`~Mock.side_effect` 回傳的值是 :data:`DEFAULT`,它將被忽略,並且優" "先順序被移動到後面一個以獲得要回傳的值。" -#: ../../library/unittest.mock.rst:2870 +#: ../../library/unittest.mock.rst:2893 msgid "" -"When :class:`Mock` wraps an object, the default value of :attr:`~Mock." -"return_value` will be :data:`DEFAULT`." +"When :class:`Mock` wraps an object, the default value " +"of :attr:`~Mock.return_value` will be :data:`DEFAULT`." msgstr "" -"當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將為 :" -"data:`DEFAULT`。" +"當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將" +"為 :data:`DEFAULT`。" -#: ../../library/unittest.mock.rst:2879 +#: ../../library/unittest.mock.rst:2902 msgid "" "The order of precedence will ignore this value and it will move to the last " "successor which is the wrapped object." msgstr "優先順序將忽略該值,並將移動到最後一個,即被包裝物件。" -#: ../../library/unittest.mock.rst:2882 +#: ../../library/unittest.mock.rst:2905 msgid "" "As the real call is being made to the wrapped object, creating an instance " "of this mock will return the real instance of the class. The positional " @@ -4006,7 +4080,7 @@ msgstr "" "當對被包裝物件進行真正的呼叫時,建立此 mock 的實例將回傳該類別的真實實例。必" "須傳遞被包裝物件所需的位置引數(如果存在)。" -#: ../../library/unittest.mock.rst:2900 +#: ../../library/unittest.mock.rst:2923 msgid "" "But if you assign ``None`` to it, this will not be ignored as it is an " "explicit assignment. So, the order of precedence will not move to the " @@ -4015,13 +4089,13 @@ msgstr "" "但如果你為其賦予 ``None`` 則不會被忽略,因為它是明確賦值。因此,優先順序不會" "移至被包裝物件。" -#: ../../library/unittest.mock.rst:2908 +#: ../../library/unittest.mock.rst:2931 msgid "" "Even if you set all three at once when initializing the mock, the order of " "precedence remains the same:" msgstr "即使你在初始化 mock 時同時設定所有三個,優先順序也保持不變:" -#: ../../library/unittest.mock.rst:2925 +#: ../../library/unittest.mock.rst:2948 msgid "" "If :attr:`~Mock.side_effect` is exhausted, the order of precedence will not " "cause a value to be obtained from the successors. Instead, ``StopIteration`` " @@ -4029,3 +4103,21 @@ msgid "" msgstr "" "如果 :attr:`~Mock.side_effect` 已耗盡,則優先順序將不會使值由後面取得。相反地" "這會引發 ``StopIteration`` 例外。" + +#~ msgid "" +#~ "This can be useful where you want to make a series of assertions that " +#~ "reuse the same object. Note that :meth:`reset_mock` *doesn't* clear " +#~ "the :attr:`return_value`, :attr:`side_effect` or any child attributes you " +#~ "have set using normal assignment by default. In case you want to " +#~ "reset :attr:`return_value` or :attr:`side_effect`, then pass the " +#~ "corresponding parameter as ``True``. Child mocks and the return value " +#~ "mock (if any) are reset as well." +#~ msgstr "" +#~ "這在你想要進行一系列重複使用同一物件的斷言時非常有用。請注意,預設情況" +#~ "下,:meth:`reset_mock` *不會*\\ 清" +#~ "除 :attr:`return_value`、:attr:`side_effect` 或使用普通賦值設定的任何子屬" +#~ "性。如果你想要重置 :attr:`return_value` 或 :attr:`side_effect`,則將相應的" +#~ "參數設置為 ``True``。Child mock 和回傳值 mock(如果有的話)也會被重置。" + +#~ msgid "*return_value*, and *side_effect* are keyword-only arguments." +#~ msgstr "*return_value* 和 *side_effect* 是僅限關鍵字引數。" diff --git a/library/unittest.po b/library/unittest.po index 9b00ef635a..80fe6553c4 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-23 00:15+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-" @@ -2425,7 +2425,7 @@ msgid "" "with :class:`asyncio.EventLoop` to avoid using the asyncio policy system." msgstr "" -#: ../../library/unittest.rst:1584 +#: ../../library/unittest.rst:1585 msgid "" "Method called to prepare the test fixture. This is called after :meth:" "`setUp`. This is called immediately before calling the test method; other " @@ -2434,7 +2434,7 @@ msgid "" "implementation does nothing." msgstr "" -#: ../../library/unittest.rst:1592 +#: ../../library/unittest.rst:1594 msgid "" "Method called immediately after the test method has been called and the " "result recorded. This is called before :meth:`tearDown`. This is called " @@ -2447,11 +2447,11 @@ msgid "" "the outcome of the test method. The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:1604 +#: ../../library/unittest.rst:1606 msgid "This method accepts a coroutine that can be used as a cleanup function." msgstr "" -#: ../../library/unittest.rst:1608 +#: ../../library/unittest.rst:1611 msgid "" "Enter the supplied :term:`asynchronous context manager`. If successful, " "also add its :meth:`~object.__aexit__` method as a cleanup function by :meth:" @@ -2459,7 +2459,7 @@ msgid "" "method." msgstr "" -#: ../../library/unittest.rst:1618 +#: ../../library/unittest.rst:1621 msgid "" "Sets up a new event loop to run the test, collecting the result into the :" "class:`TestResult` object passed as *result*. If *result* is omitted or " @@ -2469,11 +2469,11 @@ msgid "" "cancelled." msgstr "" -#: ../../library/unittest.rst:1626 +#: ../../library/unittest.rst:1629 msgid "An example illustrating the order::" msgstr "" -#: ../../library/unittest.rst:1628 +#: ../../library/unittest.rst:1631 msgid "" "from unittest import IsolatedAsyncioTestCase\n" "\n" @@ -2545,14 +2545,14 @@ msgstr "" "if __name__ == \"__main__\":\n" " unittest.main()" -#: ../../library/unittest.rst:1662 +#: ../../library/unittest.rst:1665 msgid "" "After running the test, ``events`` would contain ``[\"setUp\", " "\"asyncSetUp\", \"test_response\", \"asyncTearDown\", \"tearDown\", " "\"cleanup\"]``." msgstr "" -#: ../../library/unittest.rst:1667 +#: ../../library/unittest.rst:1670 msgid "" "This class implements the portion of the :class:`TestCase` interface which " "allows the test runner to drive the test, but does not provide the methods " @@ -2561,11 +2561,11 @@ msgid "" "`unittest`-based test framework." msgstr "" -#: ../../library/unittest.rst:1677 +#: ../../library/unittest.rst:1680 msgid "Grouping tests" msgstr "" -#: ../../library/unittest.rst:1681 +#: ../../library/unittest.rst:1684 msgid "" "This class represents an aggregation of individual test cases and test " "suites. The class presents the interface needed by the test runner to allow " @@ -2573,14 +2573,14 @@ msgid "" "is the same as iterating over the suite, running each test individually." msgstr "" -#: ../../library/unittest.rst:1686 +#: ../../library/unittest.rst:1689 msgid "" "If *tests* is given, it must be an iterable of individual test cases or " "other test suites that will be used to build the suite initially. Additional " "methods are provided to add test cases and suites to the collection later on." msgstr "" -#: ../../library/unittest.rst:1690 +#: ../../library/unittest.rst:1693 msgid "" ":class:`TestSuite` objects behave much like :class:`TestCase` objects, " "except they do not actually implement a test. Instead, they are used to " @@ -2589,47 +2589,47 @@ msgid "" "instances:" msgstr "" -#: ../../library/unittest.rst:1698 +#: ../../library/unittest.rst:1701 msgid "Add a :class:`TestCase` or :class:`TestSuite` to the suite." msgstr "" -#: ../../library/unittest.rst:1703 +#: ../../library/unittest.rst:1706 msgid "" "Add all the tests from an iterable of :class:`TestCase` and :class:" "`TestSuite` instances to this test suite." msgstr "" -#: ../../library/unittest.rst:1706 +#: ../../library/unittest.rst:1709 msgid "" "This is equivalent to iterating over *tests*, calling :meth:`addTest` for " "each element." msgstr "" -#: ../../library/unittest.rst:1709 +#: ../../library/unittest.rst:1712 msgid ":class:`TestSuite` shares the following methods with :class:`TestCase`:" msgstr "" -#: ../../library/unittest.rst:1714 +#: ../../library/unittest.rst:1717 msgid "" "Run the tests associated with this suite, collecting the result into the " "test result object passed as *result*. Note that unlike :meth:`TestCase." "run`, :meth:`TestSuite.run` requires the result object to be passed in." msgstr "" -#: ../../library/unittest.rst:1722 +#: ../../library/unittest.rst:1725 msgid "" "Run the tests associated with this suite without collecting the result. This " "allows exceptions raised by the test to be propagated to the caller and can " "be used to support running tests under a debugger." msgstr "" -#: ../../library/unittest.rst:1729 +#: ../../library/unittest.rst:1732 msgid "" "Return the number of tests represented by this test object, including all " "individual tests and sub-suites." msgstr "" -#: ../../library/unittest.rst:1735 +#: ../../library/unittest.rst:1738 msgid "" "Tests grouped by a :class:`TestSuite` are always accessed by iteration. " "Subclasses can lazily provide tests by overriding :meth:`!__iter__`. Note " @@ -2641,31 +2641,31 @@ msgid "" "overrides :meth:`TestSuite._removeTestAtIndex` to preserve test references." msgstr "" -#: ../../library/unittest.rst:1745 +#: ../../library/unittest.rst:1748 msgid "" "In earlier versions the :class:`TestSuite` accessed tests directly rather " "than through iteration, so overriding :meth:`!__iter__` wasn't sufficient " "for providing tests." msgstr "" -#: ../../library/unittest.rst:1750 +#: ../../library/unittest.rst:1753 msgid "" "In earlier versions the :class:`TestSuite` held references to each :class:" "`TestCase` after :meth:`TestSuite.run`. Subclasses can restore that behavior " "by overriding :meth:`TestSuite._removeTestAtIndex`." msgstr "" -#: ../../library/unittest.rst:1755 +#: ../../library/unittest.rst:1758 msgid "" "In the typical usage of a :class:`TestSuite` object, the :meth:`run` method " "is invoked by a :class:`TestRunner` rather than by the end-user test harness." msgstr "" -#: ../../library/unittest.rst:1760 +#: ../../library/unittest.rst:1763 msgid "Loading and running tests" msgstr "" -#: ../../library/unittest.rst:1764 +#: ../../library/unittest.rst:1767 msgid "" "The :class:`TestLoader` class is used to create test suites from classes and " "modules. Normally, there is no need to create an instance of this class; " @@ -2674,11 +2674,11 @@ msgid "" "customization of some configurable properties." msgstr "" -#: ../../library/unittest.rst:1770 +#: ../../library/unittest.rst:1773 msgid ":class:`TestLoader` objects have the following attributes:" msgstr "" -#: ../../library/unittest.rst:1775 +#: ../../library/unittest.rst:1778 msgid "" "A list of the non-fatal errors encountered while loading tests. Not reset by " "the loader at any point. Fatal errors are signalled by the relevant method " @@ -2686,17 +2686,17 @@ msgid "" "synthetic test that will raise the original error when run." msgstr "" -#: ../../library/unittest.rst:1784 +#: ../../library/unittest.rst:1787 msgid ":class:`TestLoader` objects have the following methods:" msgstr "" -#: ../../library/unittest.rst:1789 +#: ../../library/unittest.rst:1792 msgid "" "Return a suite of all test cases contained in the :class:`TestCase`\\ -" "derived :class:`testCaseClass`." msgstr "" -#: ../../library/unittest.rst:1792 +#: ../../library/unittest.rst:1795 msgid "" "A test case instance is created for each method named by :meth:" "`getTestCaseNames`. By default these are the method names beginning with " @@ -2705,14 +2705,14 @@ msgid "" "method instead." msgstr "" -#: ../../library/unittest.rst:1801 +#: ../../library/unittest.rst:1804 msgid "" "Return a suite of all test cases contained in the given module. This method " "searches *module* for classes derived from :class:`TestCase` and creates an " "instance of the class for each test method defined for the class." msgstr "" -#: ../../library/unittest.rst:1808 +#: ../../library/unittest.rst:1811 msgid "" "While using a hierarchy of :class:`TestCase`\\ -derived classes can be " "convenient in sharing fixtures and helper functions, defining test methods " @@ -2721,7 +2721,7 @@ msgid "" "fixtures are different and defined in subclasses." msgstr "" -#: ../../library/unittest.rst:1814 +#: ../../library/unittest.rst:1817 msgid "" "If a module provides a ``load_tests`` function it will be called to load the " "tests. This allows modules to customize test loading. This is the " @@ -2729,24 +2729,24 @@ msgid "" "argument to ``load_tests``." msgstr "" -#: ../../library/unittest.rst:1819 +#: ../../library/unittest.rst:1822 msgid "Support for ``load_tests`` added." msgstr "" -#: ../../library/unittest.rst:1822 +#: ../../library/unittest.rst:1825 msgid "Support for a keyword-only argument *pattern* has been added." msgstr "" -#: ../../library/unittest.rst:1825 +#: ../../library/unittest.rst:1828 msgid "" "The undocumented and unofficial *use_load_tests* parameter has been removed." msgstr "" -#: ../../library/unittest.rst:1832 +#: ../../library/unittest.rst:1835 msgid "Return a suite of all test cases given a string specifier." msgstr "" -#: ../../library/unittest.rst:1834 +#: ../../library/unittest.rst:1837 msgid "" "The specifier *name* is a \"dotted name\" that may resolve either to a " "module, a test case class, a test method within a test case class, a :class:" @@ -2757,7 +2757,7 @@ msgid "" "object\"." msgstr "" -#: ../../library/unittest.rst:1842 +#: ../../library/unittest.rst:1845 msgid "" "For example, if you have a module :mod:`SampleTests` containing a :class:" "`TestCase`\\ -derived class :class:`SampleTestCase` with three test methods " @@ -2770,31 +2770,31 @@ msgid "" "a side-effect." msgstr "" -#: ../../library/unittest.rst:1852 +#: ../../library/unittest.rst:1855 msgid "The method optionally resolves *name* relative to the given *module*." msgstr "" -#: ../../library/unittest.rst:1854 +#: ../../library/unittest.rst:1857 msgid "" "If an :exc:`ImportError` or :exc:`AttributeError` occurs while traversing " "*name* then a synthetic test that raises that error when run will be " "returned. These errors are included in the errors accumulated by self.errors." msgstr "" -#: ../../library/unittest.rst:1863 +#: ../../library/unittest.rst:1866 msgid "" "Similar to :meth:`loadTestsFromName`, but takes a sequence of names rather " "than a single name. The return value is a test suite which supports all the " "tests defined for each name." msgstr "" -#: ../../library/unittest.rst:1870 +#: ../../library/unittest.rst:1873 msgid "" "Return a sorted sequence of method names found within *testCaseClass*; this " "should be a subclass of :class:`TestCase`." msgstr "" -#: ../../library/unittest.rst:1876 +#: ../../library/unittest.rst:1879 msgid "" "Find all the test modules by recursing into subdirectories from the " "specified start directory, and return a TestSuite object containing them. " @@ -2803,14 +2803,14 @@ msgid "" "Python identifiers) will be loaded." msgstr "" -#: ../../library/unittest.rst:1882 +#: ../../library/unittest.rst:1885 msgid "" "All test modules must be importable from the top level of the project. If " "the start directory is not the top level directory then *top_level_dir* must " "be specified separately." msgstr "" -#: ../../library/unittest.rst:1886 +#: ../../library/unittest.rst:1889 msgid "" "If importing a module fails, for example due to a syntax error, then this " "will be recorded as a single error and discovery will continue. If the " @@ -2818,7 +2818,7 @@ msgid "" "as a skip instead of an error." msgstr "" -#: ../../library/unittest.rst:1891 +#: ../../library/unittest.rst:1894 msgid "" "If a package (a directory containing a file named :file:`__init__.py`) is " "found, the package will be checked for a ``load_tests`` function. If this " @@ -2828,103 +2828,103 @@ msgid "" "itself calls ``loader.discover``." msgstr "" -#: ../../library/unittest.rst:1899 +#: ../../library/unittest.rst:1902 msgid "" "If ``load_tests`` exists then discovery does *not* recurse into the package, " "``load_tests`` is responsible for loading all tests in the package." msgstr "" -#: ../../library/unittest.rst:1903 +#: ../../library/unittest.rst:1906 msgid "" "The pattern is deliberately not stored as a loader attribute so that " "packages can continue discovery themselves." msgstr "" -#: ../../library/unittest.rst:1906 +#: ../../library/unittest.rst:1909 msgid "" "*top_level_dir* is stored internally, and used as a default to any nested " "calls to ``discover()``. That is, if a package's ``load_tests`` calls " "``loader.discover()``, it does not need to pass this argument." msgstr "" -#: ../../library/unittest.rst:1910 +#: ../../library/unittest.rst:1913 msgid "*start_dir* can be a dotted module name as well as a directory." msgstr "" -#: ../../library/unittest.rst:1914 +#: ../../library/unittest.rst:1917 msgid "" "Modules that raise :exc:`SkipTest` on import are recorded as skips, not " "errors." msgstr "" -#: ../../library/unittest.rst:1918 +#: ../../library/unittest.rst:1921 msgid "*start_dir* can be a :term:`namespace packages `." msgstr "" -#: ../../library/unittest.rst:1921 +#: ../../library/unittest.rst:1924 msgid "" "Paths are sorted before being imported so that execution order is the same " "even if the underlying file system's ordering is not dependent on file name." msgstr "" -#: ../../library/unittest.rst:1926 +#: ../../library/unittest.rst:1929 msgid "" "Found packages are now checked for ``load_tests`` regardless of whether " "their path matches *pattern*, because it is impossible for a package name to " "match the default pattern." msgstr "" -#: ../../library/unittest.rst:1931 +#: ../../library/unittest.rst:1934 msgid "" "*start_dir* can not be a :term:`namespace packages `. It " "has been broken since Python 3.7 and Python 3.11 officially remove it." msgstr "" -#: ../../library/unittest.rst:1935 +#: ../../library/unittest.rst:1938 msgid "*top_level_dir* is only stored for the duration of *discover* call." msgstr "" -#: ../../library/unittest.rst:1939 +#: ../../library/unittest.rst:1942 msgid "" "The following attributes of a :class:`TestLoader` can be configured either " "by subclassing or assignment on an instance:" msgstr "" -#: ../../library/unittest.rst:1945 +#: ../../library/unittest.rst:1948 msgid "" "String giving the prefix of method names which will be interpreted as test " "methods. The default value is ``'test'``." msgstr "" -#: ../../library/unittest.rst:1948 +#: ../../library/unittest.rst:1951 msgid "" "This affects :meth:`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1954 +#: ../../library/unittest.rst:1957 msgid "" "Function to be used to compare method names when sorting them in :meth:" "`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1960 +#: ../../library/unittest.rst:1963 msgid "" "Callable object that constructs a test suite from a list of tests. No " "methods on the resulting object are needed. The default value is the :class:" "`TestSuite` class." msgstr "" -#: ../../library/unittest.rst:1964 ../../library/unittest.rst:1977 +#: ../../library/unittest.rst:1967 ../../library/unittest.rst:1980 msgid "This affects all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1968 +#: ../../library/unittest.rst:1971 msgid "" "List of Unix shell-style wildcard test name patterns that test methods have " "to match to be included in test suites (see ``-k`` option)." msgstr "" -#: ../../library/unittest.rst:1971 +#: ../../library/unittest.rst:1974 msgid "" "If this attribute is not ``None`` (the default), all test methods to be " "included in test suites must match one of the patterns in this list. Note " @@ -2933,13 +2933,13 @@ msgid "" "have to be converted using ``*`` wildcards." msgstr "" -#: ../../library/unittest.rst:1984 +#: ../../library/unittest.rst:1987 msgid "" "This class is used to compile information about which tests have succeeded " "and which have failed." msgstr "" -#: ../../library/unittest.rst:1987 +#: ../../library/unittest.rst:1990 msgid "" "A :class:`TestResult` object stores the results of a set of tests. The :" "class:`TestCase` and :class:`TestSuite` classes ensure that results are " @@ -2947,7 +2947,7 @@ msgid "" "outcome of tests." msgstr "" -#: ../../library/unittest.rst:1992 +#: ../../library/unittest.rst:1995 msgid "" "Testing frameworks built on top of :mod:`unittest` may want access to the :" "class:`TestResult` object generated by running a set of tests for reporting " @@ -2955,61 +2955,61 @@ msgid "" "`TestRunner.run` method for this purpose." msgstr "" -#: ../../library/unittest.rst:1997 +#: ../../library/unittest.rst:2000 msgid "" ":class:`TestResult` instances have the following attributes that will be of " "interest when inspecting the results of running a set of tests:" msgstr "" -#: ../../library/unittest.rst:2003 +#: ../../library/unittest.rst:2006 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test which raised an " "unexpected exception." msgstr "" -#: ../../library/unittest.rst:2009 +#: ../../library/unittest.rst:2012 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test where a failure " "was explicitly signalled using the :ref:`assert\\* methods `." msgstr "" -#: ../../library/unittest.rst:2015 +#: ../../library/unittest.rst:2018 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding the reason for skipping the test." msgstr "" -#: ../../library/unittest.rst:2022 +#: ../../library/unittest.rst:2025 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents an expected failure or " "error of the test case." msgstr "" -#: ../../library/unittest.rst:2028 +#: ../../library/unittest.rst:2031 msgid "" "A list containing :class:`TestCase` instances that were marked as expected " "failures, but succeeded." msgstr "" -#: ../../library/unittest.rst:2033 +#: ../../library/unittest.rst:2036 msgid "" "A list containing 2-tuples of test case names and floats representing the " "elapsed time of each test which was run." msgstr "" -#: ../../library/unittest.rst:2040 +#: ../../library/unittest.rst:2043 msgid "" "Set to ``True`` when the execution of tests should stop by :meth:`stop`." msgstr "" -#: ../../library/unittest.rst:2044 +#: ../../library/unittest.rst:2047 msgid "The total number of tests run so far." msgstr "" -#: ../../library/unittest.rst:2048 +#: ../../library/unittest.rst:2051 msgid "" "If set to true, ``sys.stdout`` and ``sys.stderr`` will be buffered in " "between :meth:`startTest` and :meth:`stopTest` being called. Collected " @@ -3018,29 +3018,29 @@ msgid "" "error message." msgstr "" -#: ../../library/unittest.rst:2057 +#: ../../library/unittest.rst:2060 msgid "" "If set to true :meth:`stop` will be called on the first failure or error, " "halting the test run." msgstr "" -#: ../../library/unittest.rst:2064 +#: ../../library/unittest.rst:2067 msgid "If set to true then local variables will be shown in tracebacks." msgstr "" -#: ../../library/unittest.rst:2070 +#: ../../library/unittest.rst:2073 msgid "" "Return ``True`` if all tests run so far have passed, otherwise returns " "``False``." msgstr "" -#: ../../library/unittest.rst:2073 +#: ../../library/unittest.rst:2076 msgid "" "Returns ``False`` if there were any :attr:`unexpectedSuccesses` from tests " "marked with the :func:`expectedFailure` decorator." msgstr "" -#: ../../library/unittest.rst:2079 +#: ../../library/unittest.rst:2082 msgid "" "This method can be called to signal that the set of tests being run should " "be aborted by setting the :attr:`shouldStop` attribute to ``True``. :class:" @@ -3048,7 +3048,7 @@ msgid "" "additional tests." msgstr "" -#: ../../library/unittest.rst:2084 +#: ../../library/unittest.rst:2087 msgid "" "For example, this feature is used by the :class:`TextTestRunner` class to " "stop the test framework when the user signals an interrupt from the " @@ -3056,7 +3056,7 @@ msgid "" "implementations can use this in a similar manner." msgstr "" -#: ../../library/unittest.rst:2089 +#: ../../library/unittest.rst:2092 msgid "" "The following methods of the :class:`TestResult` class are used to maintain " "the internal data structures, and may be extended in subclasses to support " @@ -3064,141 +3064,141 @@ msgid "" "tools which support interactive reporting while tests are being run." msgstr "" -#: ../../library/unittest.rst:2097 +#: ../../library/unittest.rst:2100 msgid "Called when the test case *test* is about to be run." msgstr "" -#: ../../library/unittest.rst:2101 +#: ../../library/unittest.rst:2104 msgid "" "Called after the test case *test* has been executed, regardless of the " "outcome." msgstr "" -#: ../../library/unittest.rst:2106 +#: ../../library/unittest.rst:2109 msgid "Called once before any tests are executed." msgstr "" -#: ../../library/unittest.rst:2113 +#: ../../library/unittest.rst:2116 msgid "Called once after all tests are executed." msgstr "" -#: ../../library/unittest.rst:2120 +#: ../../library/unittest.rst:2123 msgid "" "Called when the test case *test* raises an unexpected exception. *err* is a " "tuple of the form returned by :func:`sys.exc_info`: ``(type, value, " "traceback)``." msgstr "" -#: ../../library/unittest.rst:2124 +#: ../../library/unittest.rst:2127 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`errors` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2131 +#: ../../library/unittest.rst:2134 msgid "" "Called when the test case *test* signals a failure. *err* is a tuple of the " "form returned by :func:`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: ../../library/unittest.rst:2134 +#: ../../library/unittest.rst:2137 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`failures` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2141 +#: ../../library/unittest.rst:2144 msgid "Called when the test case *test* succeeds." msgstr "" -#: ../../library/unittest.rst:2143 +#: ../../library/unittest.rst:2146 msgid "The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:2148 +#: ../../library/unittest.rst:2151 msgid "" "Called when the test case *test* is skipped. *reason* is the reason the " "test gave for skipping." msgstr "" -#: ../../library/unittest.rst:2151 +#: ../../library/unittest.rst:2154 msgid "" "The default implementation appends a tuple ``(test, reason)`` to the " "instance's :attr:`skipped` attribute." msgstr "" -#: ../../library/unittest.rst:2157 +#: ../../library/unittest.rst:2160 msgid "" "Called when the test case *test* fails or errors, but was marked with the :" "func:`expectedFailure` decorator." msgstr "" -#: ../../library/unittest.rst:2160 +#: ../../library/unittest.rst:2163 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`expectedFailures` attribute, where *formatted_err* is a " "formatted traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2167 +#: ../../library/unittest.rst:2170 msgid "" "Called when the test case *test* was marked with the :func:`expectedFailure` " "decorator, but succeeded." msgstr "" -#: ../../library/unittest.rst:2170 +#: ../../library/unittest.rst:2173 msgid "" "The default implementation appends the test to the instance's :attr:" "`unexpectedSuccesses` attribute." msgstr "" -#: ../../library/unittest.rst:2176 +#: ../../library/unittest.rst:2179 msgid "" "Called when a subtest finishes. *test* is the test case corresponding to " "the test method. *subtest* is a custom :class:`TestCase` instance " "describing the subtest." msgstr "" -#: ../../library/unittest.rst:2180 +#: ../../library/unittest.rst:2183 msgid "" "If *outcome* is :const:`None`, the subtest succeeded. Otherwise, it failed " "with an exception where *outcome* is a tuple of the form returned by :func:" "`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: ../../library/unittest.rst:2184 +#: ../../library/unittest.rst:2187 msgid "" "The default implementation does nothing when the outcome is a success, and " "records subtest failures as normal failures." msgstr "" -#: ../../library/unittest.rst:2191 +#: ../../library/unittest.rst:2194 msgid "" "Called when the test case finishes. *elapsed* is the time represented in " "seconds, and it includes the execution of cleanup functions." msgstr "" -#: ../../library/unittest.rst:2198 +#: ../../library/unittest.rst:2201 msgid "" "A concrete implementation of :class:`TestResult` used by the :class:" "`TextTestRunner`. Subclasses should accept ``**kwargs`` to ensure " "compatibility as the interface changes." msgstr "" -#: ../../library/unittest.rst:2204 +#: ../../library/unittest.rst:2207 msgid "Added the *durations* keyword parameter." msgstr "新增 *durations* 關鍵字參數。" -#: ../../library/unittest.rst:2209 +#: ../../library/unittest.rst:2212 msgid "" "Instance of the :class:`TestLoader` class intended to be shared. If no " "customization of the :class:`TestLoader` is needed, this instance can be " "used instead of repeatedly creating new instances." msgstr "" -#: ../../library/unittest.rst:2218 +#: ../../library/unittest.rst:2221 msgid "" "A basic test runner implementation that outputs results to a stream. If " "*stream* is ``None``, the default, :data:`sys.stderr` is used as the output " @@ -3209,7 +3209,7 @@ msgid "" "unittest." msgstr "" -#: ../../library/unittest.rst:2225 +#: ../../library/unittest.rst:2228 msgid "" "By default this runner shows :exc:`DeprecationWarning`, :exc:" "`PendingDeprecationWarning`, :exc:`ResourceWarning` and :exc:`ImportWarning` " @@ -3219,32 +3219,32 @@ msgid "" "``None``." msgstr "" -#: ../../library/unittest.rst:2233 +#: ../../library/unittest.rst:2236 msgid "Added the *warnings* parameter." msgstr "新增 *warnings* 參數。" -#: ../../library/unittest.rst:2236 +#: ../../library/unittest.rst:2239 msgid "" "The default stream is set to :data:`sys.stderr` at instantiation time rather " "than import time." msgstr "" -#: ../../library/unittest.rst:2240 +#: ../../library/unittest.rst:2243 msgid "Added the *tb_locals* parameter." msgstr "新增 *tb_locals* 參數。" -#: ../../library/unittest.rst:2243 +#: ../../library/unittest.rst:2246 msgid "Added the *durations* parameter." msgstr "新增 *durations* 參數。" -#: ../../library/unittest.rst:2248 +#: ../../library/unittest.rst:2251 msgid "" "This method returns the instance of ``TestResult`` used by :meth:`run`. It " "is not intended to be called directly, but can be overridden in subclasses " "to provide a custom ``TestResult``." msgstr "" -#: ../../library/unittest.rst:2252 +#: ../../library/unittest.rst:2255 msgid "" "``_makeResult()`` instantiates the class or callable passed in the " "``TextTestRunner`` constructor as the ``resultclass`` argument. It defaults " @@ -3252,11 +3252,11 @@ msgid "" "class is instantiated with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2257 +#: ../../library/unittest.rst:2260 msgid "stream, descriptions, verbosity" msgstr "" -#: ../../library/unittest.rst:2261 +#: ../../library/unittest.rst:2264 msgid "" "This method is the main public interface to the ``TextTestRunner``. This " "method takes a :class:`TestSuite` or :class:`TestCase` instance. A :class:" @@ -3264,7 +3264,7 @@ msgid "" "run and the results printed to stdout." msgstr "" -#: ../../library/unittest.rst:2272 +#: ../../library/unittest.rst:2275 msgid "" "A command-line program that loads a set of tests from *module* and runs " "them; this is primarily for making test modules conveniently executable. The " @@ -3272,7 +3272,7 @@ msgid "" "of a test script::" msgstr "" -#: ../../library/unittest.rst:2277 +#: ../../library/unittest.rst:2280 msgid "" "if __name__ == '__main__':\n" " unittest.main()" @@ -3280,13 +3280,13 @@ msgstr "" "if __name__ == '__main__':\n" " unittest.main()" -#: ../../library/unittest.rst:2280 +#: ../../library/unittest.rst:2283 msgid "" "You can run tests with more detailed information by passing in the verbosity " "argument::" msgstr "" -#: ../../library/unittest.rst:2283 +#: ../../library/unittest.rst:2286 msgid "" "if __name__ == '__main__':\n" " unittest.main(verbosity=2)" @@ -3294,7 +3294,7 @@ msgstr "" "if __name__ == '__main__':\n" " unittest.main(verbosity=2)" -#: ../../library/unittest.rst:2286 +#: ../../library/unittest.rst:2289 msgid "" "The *defaultTest* argument is either the name of a single test or an " "iterable of test names to run if no test names are specified via *argv*. If " @@ -3302,14 +3302,14 @@ msgid "" "tests found in *module* are run." msgstr "" -#: ../../library/unittest.rst:2291 +#: ../../library/unittest.rst:2294 msgid "" "The *argv* argument can be a list of options passed to the program, with the " "first element being the program name. If not specified or ``None``, the " "values of :data:`sys.argv` are used." msgstr "" -#: ../../library/unittest.rst:2295 +#: ../../library/unittest.rst:2298 msgid "" "The *testRunner* argument can either be a test runner class or an already " "created instance of it. By default ``main`` calls :func:`sys.exit` with an " @@ -3317,20 +3317,20 @@ msgid "" "code of 5 indicates that no tests were run or skipped." msgstr "" -#: ../../library/unittest.rst:2300 +#: ../../library/unittest.rst:2303 msgid "" "The *testLoader* argument has to be a :class:`TestLoader` instance, and " "defaults to :data:`defaultTestLoader`." msgstr "" -#: ../../library/unittest.rst:2303 +#: ../../library/unittest.rst:2306 msgid "" "``main`` supports being used from the interactive interpreter by passing in " "the argument ``exit=False``. This displays the result on standard output " "without calling :func:`sys.exit`::" msgstr "" -#: ../../library/unittest.rst:2307 +#: ../../library/unittest.rst:2310 msgid "" ">>> from unittest import main\n" ">>> main(module='test_module', exit=False)" @@ -3338,13 +3338,13 @@ msgstr "" ">>> from unittest import main\n" ">>> main(module='test_module', exit=False)" -#: ../../library/unittest.rst:2310 +#: ../../library/unittest.rst:2313 msgid "" "The *failfast*, *catchbreak* and *buffer* parameters have the same effect as " "the same-name `command-line options`_." msgstr "" -#: ../../library/unittest.rst:2313 +#: ../../library/unittest.rst:2316 msgid "" "The *warnings* argument specifies the :ref:`warning filter ` " "that should be used while running the tests. If it's not specified, it will " @@ -3353,60 +3353,60 @@ msgid "" "to ``'default'``." msgstr "" -#: ../../library/unittest.rst:2319 +#: ../../library/unittest.rst:2322 msgid "" "Calling ``main`` returns an object with the ``result`` attribute that " "contains the result of the tests run as a :class:`unittest.TestResult`." msgstr "" -#: ../../library/unittest.rst:2322 +#: ../../library/unittest.rst:2325 msgid "The *exit* parameter was added." msgstr "新增 *exit* 參數。" -#: ../../library/unittest.rst:2325 +#: ../../library/unittest.rst:2328 msgid "" "The *verbosity*, *failfast*, *catchbreak*, *buffer* and *warnings* " "parameters were added." msgstr "" -#: ../../library/unittest.rst:2329 +#: ../../library/unittest.rst:2332 msgid "" "The *defaultTest* parameter was changed to also accept an iterable of test " "names." msgstr "" -#: ../../library/unittest.rst:2337 +#: ../../library/unittest.rst:2340 msgid "load_tests Protocol" msgstr "load_tests 協定" -#: ../../library/unittest.rst:2341 +#: ../../library/unittest.rst:2344 msgid "" "Modules or packages can customize how tests are loaded from them during " "normal test runs or test discovery by implementing a function called " "``load_tests``." msgstr "" -#: ../../library/unittest.rst:2344 +#: ../../library/unittest.rst:2347 msgid "" "If a test module defines ``load_tests`` it will be called by :meth:" "`TestLoader.loadTestsFromModule` with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2347 ../../library/unittest.rst:2379 +#: ../../library/unittest.rst:2350 ../../library/unittest.rst:2382 msgid "load_tests(loader, standard_tests, pattern)" msgstr "load_tests(loader, standard_tests, pattern)" -#: ../../library/unittest.rst:2349 +#: ../../library/unittest.rst:2352 msgid "" "where *pattern* is passed straight through from ``loadTestsFromModule``. It " "defaults to ``None``." msgstr "" -#: ../../library/unittest.rst:2352 +#: ../../library/unittest.rst:2355 msgid "It should return a :class:`TestSuite`." msgstr "它應該回傳一個 :class:`TestSuite`。" -#: ../../library/unittest.rst:2354 +#: ../../library/unittest.rst:2357 msgid "" "*loader* is the instance of :class:`TestLoader` doing the loading. " "*standard_tests* are the tests that would be loaded by default from the " @@ -3415,13 +3415,13 @@ msgid "" "packages as part of test discovery." msgstr "" -#: ../../library/unittest.rst:2360 +#: ../../library/unittest.rst:2363 msgid "" "A typical ``load_tests`` function that loads tests from a specific set of :" "class:`TestCase` classes may look like::" msgstr "" -#: ../../library/unittest.rst:2363 +#: ../../library/unittest.rst:2366 msgid "" "test_cases = (TestCase1, TestCase2, TestCase3)\n" "\n" @@ -3441,7 +3441,7 @@ msgstr "" " suite.addTests(tests)\n" " return suite" -#: ../../library/unittest.rst:2372 +#: ../../library/unittest.rst:2375 msgid "" "If discovery is started in a directory containing a package, either from the " "command line or by calling :meth:`TestLoader.discover`, then the package :" @@ -3451,21 +3451,21 @@ msgid "" "left up to ``load_tests`` which is called with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2381 +#: ../../library/unittest.rst:2384 msgid "" "This should return a :class:`TestSuite` representing all the tests from the " "package. (``standard_tests`` will only contain tests collected from :file:" "`__init__.py`.)" msgstr "" -#: ../../library/unittest.rst:2385 +#: ../../library/unittest.rst:2388 msgid "" "Because the pattern is passed into ``load_tests`` the package is free to " "continue (and potentially modify) test discovery. A 'do nothing' " "``load_tests`` function for a test package would look like::" msgstr "" -#: ../../library/unittest.rst:2389 +#: ../../library/unittest.rst:2392 msgid "" "def load_tests(loader, standard_tests, pattern):\n" " # top level directory cached on loader instance\n" @@ -3475,17 +3475,17 @@ msgid "" " return standard_tests" msgstr "" -#: ../../library/unittest.rst:2396 +#: ../../library/unittest.rst:2399 msgid "" "Discovery no longer checks package names for matching *pattern* due to the " "impossibility of package names matching the default pattern." msgstr "" -#: ../../library/unittest.rst:2403 +#: ../../library/unittest.rst:2406 msgid "Class and Module Fixtures" msgstr "" -#: ../../library/unittest.rst:2405 +#: ../../library/unittest.rst:2408 msgid "" "Class and module level fixtures are implemented in :class:`TestSuite`. When " "the test suite encounters a test from a new class then :meth:`tearDownClass` " @@ -3493,27 +3493,27 @@ msgid "" "`setUpClass` from the new class." msgstr "" -#: ../../library/unittest.rst:2410 +#: ../../library/unittest.rst:2413 msgid "" "Similarly if a test is from a different module from the previous test then " "``tearDownModule`` from the previous module is run, followed by " "``setUpModule`` from the new module." msgstr "" -#: ../../library/unittest.rst:2414 +#: ../../library/unittest.rst:2417 msgid "" "After all the tests have run the final ``tearDownClass`` and " "``tearDownModule`` are run." msgstr "" -#: ../../library/unittest.rst:2417 +#: ../../library/unittest.rst:2420 msgid "" "Note that shared fixtures do not play well with [potential] features like " "test parallelization and they break test isolation. They should be used with " "care." msgstr "" -#: ../../library/unittest.rst:2420 +#: ../../library/unittest.rst:2423 msgid "" "The default ordering of tests created by the unittest test loaders is to " "group all tests from the same modules and classes together. This will lead " @@ -3523,14 +3523,14 @@ msgid "" "functions may be called multiple times in a single test run." msgstr "" -#: ../../library/unittest.rst:2427 +#: ../../library/unittest.rst:2430 msgid "" "Shared fixtures are not intended to work with suites with non-standard " "ordering. A ``BaseTestSuite`` still exists for frameworks that don't want to " "support shared fixtures." msgstr "" -#: ../../library/unittest.rst:2431 +#: ../../library/unittest.rst:2434 msgid "" "If there are any exceptions raised during one of the shared fixture " "functions the test is reported as an error. Because there is no " @@ -3540,15 +3540,15 @@ msgid "" "matter, but if you are a framework author it may be relevant." msgstr "" -#: ../../library/unittest.rst:2440 +#: ../../library/unittest.rst:2443 msgid "setUpClass and tearDownClass" msgstr "setUpClass 和 tearDownClass" -#: ../../library/unittest.rst:2442 +#: ../../library/unittest.rst:2445 msgid "These must be implemented as class methods::" msgstr "" -#: ../../library/unittest.rst:2444 +#: ../../library/unittest.rst:2447 msgid "" "import unittest\n" "\n" @@ -3572,14 +3572,14 @@ msgstr "" " def tearDownClass(cls):\n" " cls._connection.destroy()" -#: ../../library/unittest.rst:2455 +#: ../../library/unittest.rst:2458 msgid "" "If you want the ``setUpClass`` and ``tearDownClass`` on base classes called " "then you must call up to them yourself. The implementations in :class:" "`TestCase` are empty." msgstr "" -#: ../../library/unittest.rst:2459 +#: ../../library/unittest.rst:2462 msgid "" "If an exception is raised during a ``setUpClass`` then the tests in the " "class are not run and the ``tearDownClass`` is not run. Skipped classes will " @@ -3588,15 +3588,15 @@ msgid "" "instead of as an error." msgstr "" -#: ../../library/unittest.rst:2467 +#: ../../library/unittest.rst:2470 msgid "setUpModule and tearDownModule" msgstr "setUpModule 和 tearDownModule" -#: ../../library/unittest.rst:2469 +#: ../../library/unittest.rst:2472 msgid "These should be implemented as functions::" msgstr "" -#: ../../library/unittest.rst:2471 +#: ../../library/unittest.rst:2474 msgid "" "def setUpModule():\n" " createConnection()\n" @@ -3610,7 +3610,7 @@ msgstr "" "def tearDownModule():\n" " closeConnection()" -#: ../../library/unittest.rst:2477 +#: ../../library/unittest.rst:2480 msgid "" "If an exception is raised in a ``setUpModule`` then none of the tests in the " "module will be run and the ``tearDownModule`` will not be run. If the " @@ -3618,13 +3618,13 @@ msgid "" "having been skipped instead of as an error." msgstr "" -#: ../../library/unittest.rst:2482 +#: ../../library/unittest.rst:2485 msgid "" "To add cleanup code that must be run even in the case of an exception, use " "``addModuleCleanup``:" msgstr "" -#: ../../library/unittest.rst:2488 +#: ../../library/unittest.rst:2491 msgid "" "Add a function to be called after :func:`tearDownModule` to cleanup " "resources used during the test class. Functions will be called in reverse " @@ -3633,13 +3633,13 @@ msgid "" "`addModuleCleanup` when they are added." msgstr "" -#: ../../library/unittest.rst:2494 +#: ../../library/unittest.rst:2497 msgid "" "If :meth:`setUpModule` fails, meaning that :func:`tearDownModule` is not " "called, then any cleanup functions added will still be called." msgstr "" -#: ../../library/unittest.rst:2502 +#: ../../library/unittest.rst:2505 msgid "" "Enter the supplied :term:`context manager`. If successful, also add its :" "meth:`~object.__exit__` method as a cleanup function by :func:" @@ -3647,30 +3647,30 @@ msgid "" "method." msgstr "" -#: ../../library/unittest.rst:2512 +#: ../../library/unittest.rst:2515 msgid "" "This function is called unconditionally after :func:`tearDownModule`, or " "after :func:`setUpModule` if :func:`setUpModule` raises an exception." msgstr "" -#: ../../library/unittest.rst:2515 +#: ../../library/unittest.rst:2518 msgid "" "It is responsible for calling all the cleanup functions added by :func:" "`addModuleCleanup`. If you need cleanup functions to be called *prior* to :" "func:`tearDownModule` then you can call :func:`doModuleCleanups` yourself." msgstr "" -#: ../../library/unittest.rst:2520 +#: ../../library/unittest.rst:2523 msgid "" ":func:`doModuleCleanups` pops methods off the stack of cleanup functions one " "at a time, so it can be called at any time." msgstr "" -#: ../../library/unittest.rst:2527 +#: ../../library/unittest.rst:2530 msgid "Signal Handling" msgstr "" -#: ../../library/unittest.rst:2531 +#: ../../library/unittest.rst:2534 msgid "" "The :option:`-c/--catch ` command-line option to unittest, " "along with the ``catchbreak`` parameter to :func:`unittest.main`, provide " @@ -3680,7 +3680,7 @@ msgid "" "A second control-c will raise a :exc:`KeyboardInterrupt` in the usual way." msgstr "" -#: ../../library/unittest.rst:2538 +#: ../../library/unittest.rst:2541 msgid "" "The control-c handling signal handler attempts to remain compatible with " "code or tests that install their own :const:`signal.SIGINT` handler. If the " @@ -3692,48 +3692,48 @@ msgid "" "disabled the :func:`removeHandler` decorator can be used." msgstr "" -#: ../../library/unittest.rst:2547 +#: ../../library/unittest.rst:2550 msgid "" "There are a few utility functions for framework authors to enable control-c " "handling functionality within test frameworks." msgstr "" -#: ../../library/unittest.rst:2552 +#: ../../library/unittest.rst:2555 msgid "" "Install the control-c handler. When a :const:`signal.SIGINT` is received " "(usually in response to the user pressing control-c) all registered results " "have :meth:`~TestResult.stop` called." msgstr "" -#: ../../library/unittest.rst:2559 +#: ../../library/unittest.rst:2562 msgid "" "Register a :class:`TestResult` object for control-c handling. Registering a " "result stores a weak reference to it, so it doesn't prevent the result from " "being garbage collected." msgstr "" -#: ../../library/unittest.rst:2563 +#: ../../library/unittest.rst:2566 msgid "" "Registering a :class:`TestResult` object has no side-effects if control-c " "handling is not enabled, so test frameworks can unconditionally register all " "results they create independently of whether or not handling is enabled." msgstr "" -#: ../../library/unittest.rst:2570 +#: ../../library/unittest.rst:2573 msgid "" "Remove a registered result. Once a result has been removed then :meth:" "`~TestResult.stop` will no longer be called on that result object in " "response to a control-c." msgstr "" -#: ../../library/unittest.rst:2577 +#: ../../library/unittest.rst:2580 msgid "" "When called without arguments this function removes the control-c handler if " "it has been installed. This function can also be used as a test decorator to " "temporarily remove the handler while the test is being executed::" msgstr "" -#: ../../library/unittest.rst:2581 +#: ../../library/unittest.rst:2584 msgid "" "@unittest.removeHandler\n" "def test_signal_handling(self):\n" diff --git a/library/urllib.parse.po b/library/urllib.parse.po index d8aa51ce60..b5476ab963 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -80,9 +80,9 @@ msgstr "" #: ../../library/urllib.parse.rst:55 msgid "" "Parse a URL into six components, returning a 6-item :term:`named tuple`. " -"This corresponds to the general structure of a URL: ``scheme://netloc/path;" -"parameters?query#fragment``. Each tuple item is a string, possibly empty. " -"The components are not broken up into smaller parts (for example, the " +"This corresponds to the general structure of a URL: ``scheme://netloc/" +"path;parameters?query#fragment``. Each tuple item is a string, possibly " +"empty. The components are not broken up into smaller parts (for example, the " "network location is a single string), and % escapes are not expanded. The " "delimiters as shown above are not part of the result, except for a leading " "slash in the *path* component, which is retained if present. For example:" @@ -145,8 +145,8 @@ msgstr "" msgid "" ">>> from urllib.parse import urlparse\n" ">>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')\n" ">>> urlparse('www.cwi.nl/%7Eguido/Python.html')\n" "ParseResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html',\n" @@ -157,8 +157,8 @@ msgid "" msgstr "" ">>> from urllib.parse import urlparse\n" ">>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')\n" ">>> urlparse('www.cwi.nl/%7Eguido/Python.html')\n" "ParseResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html',\n" @@ -346,8 +346,8 @@ msgstr "" #: ../../library/urllib.parse.rst:150 ../../library/urllib.parse.rst:336 msgid "" -"Unmatched square brackets in the :attr:`netloc` attribute will raise a :exc:" -"`ValueError`." +"Unmatched square brackets in the :attr:`netloc` attribute will raise " +"a :exc:`ValueError`." msgstr "" #: ../../library/urllib.parse.rst:153 ../../library/urllib.parse.rst:339 @@ -361,9 +361,9 @@ msgstr "" #: ../../library/urllib.parse.rst:158 msgid "" "As is the case with all named tuples, the subclass has a few additional " -"methods and attributes that are particularly useful. One such method is :" -"meth:`_replace`. The :meth:`_replace` method will return a new ParseResult " -"object replacing specified fields with new values." +"methods and attributes that are particularly useful. One such method " +"is :meth:`_replace`. The :meth:`_replace` method will return a new " +"ParseResult object replacing specified fields with new values." msgstr "" #: ../../library/urllib.parse.rst:163 @@ -371,23 +371,23 @@ msgid "" ">>> from urllib.parse import urlparse\n" ">>> u = urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" ">>> u\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')\n" ">>> u._replace(scheme='http')\n" -"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')" msgstr "" ">>> from urllib.parse import urlparse\n" ">>> u = urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" ">>> u\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')\n" ">>> u._replace(scheme='http')\n" -"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')" #: ../../library/urllib.parse.rst:177 @@ -409,8 +409,8 @@ msgstr "" #: ../../library/urllib.parse.rst:188 ../../library/urllib.parse.rst:353 msgid "" -"Out-of-range port numbers now raise :exc:`ValueError`, instead of returning :" -"const:`None`." +"Out-of-range port numbers now raise :exc:`ValueError`, instead of " +"returning :const:`None`." msgstr "" #: ../../library/urllib.parse.rst:192 ../../library/urllib.parse.rst:357 @@ -421,10 +421,10 @@ msgstr "" #: ../../library/urllib.parse.rst:199 msgid "" -"Parse a query string given as a string argument (data of type :mimetype:" -"`application/x-www-form-urlencoded`). Data are returned as a dictionary. " -"The dictionary keys are the unique query variable names and the values are " -"lists of values for each name." +"Parse a query string given as a string argument (data of " +"type :mimetype:`application/x-www-form-urlencoded`). Data are returned as a " +"dictionary. The dictionary keys are the unique query variable names and the " +"values are lists of values for each name." msgstr "" #: ../../library/urllib.parse.rst:204 ../../library/urllib.parse.rst:249 @@ -446,8 +446,8 @@ msgstr "" #: ../../library/urllib.parse.rst:214 ../../library/urllib.parse.rst:259 msgid "" "The optional *encoding* and *errors* parameters specify how to decode " -"percent-encoded sequences into Unicode characters, as accepted by the :meth:" -"`bytes.decode` method." +"percent-encoded sequences into Unicode characters, as accepted by " +"the :meth:`bytes.decode` method." msgstr "" #: ../../library/urllib.parse.rst:218 ../../library/urllib.parse.rst:263 @@ -471,7 +471,7 @@ msgstr "" #: ../../library/urllib.parse.rst:230 ../../library/urllib.parse.rst:273 msgid "Add *encoding* and *errors* parameters." -msgstr "" +msgstr "新增 *encoding* 和 *errors* 參數。" #: ../../library/urllib.parse.rst:233 ../../library/urllib.parse.rst:276 msgid "Added *max_num_fields* parameter." @@ -487,9 +487,9 @@ msgstr "" #: ../../library/urllib.parse.rst:245 msgid "" -"Parse a query string given as a string argument (data of type :mimetype:" -"`application/x-www-form-urlencoded`). Data are returned as a list of name, " -"value pairs." +"Parse a query string given as a string argument (data of " +"type :mimetype:`application/x-www-form-urlencoded`). Data are returned as a " +"list of name, value pairs." msgstr "" #: ../../library/urllib.parse.rst:270 @@ -570,8 +570,8 @@ msgstr "" #: ../../library/urllib.parse.rst:389 msgid "" -"The *allow_fragments* argument has the same meaning and default as for :func:" -"`urlparse`." +"The *allow_fragments* argument has the same meaning and default as " +"for :func:`urlparse`." msgstr "" #: ../../library/urllib.parse.rst:394 @@ -638,10 +638,10 @@ msgstr "" #: ../../library/urllib.parse.rst:447 msgid "" -"Extract the url from a wrapped URL (that is, a string formatted as ````, ````, ``URL:scheme://host/path`` " -"or ``scheme://host/path``). If *url* is not a wrapped URL, it is returned " -"without changes." +"Extract the url from a wrapped URL (that is, a string formatted as " +"````, ````, ``URL:scheme://host/" +"path`` or ``scheme://host/path``). If *url* is not a wrapped URL, it is " +"returned without changes." msgstr "" #: ../../library/urllib.parse.rst:455 @@ -694,36 +694,37 @@ msgid "" "The URL parsing functions were originally designed to operate on character " "strings only. In practice, it is useful to be able to manipulate properly " "quoted and encoded URLs as sequences of ASCII bytes. Accordingly, the URL " -"parsing functions in this module all operate on :class:`bytes` and :class:" -"`bytearray` objects in addition to :class:`str` objects." +"parsing functions in this module all operate on :class:`bytes` " +"and :class:`bytearray` objects in addition to :class:`str` objects." msgstr "" #: ../../library/urllib.parse.rst:492 msgid "" -"If :class:`str` data is passed in, the result will also contain only :class:" -"`str` data. If :class:`bytes` or :class:`bytearray` data is passed in, the " -"result will contain only :class:`bytes` data." +"If :class:`str` data is passed in, the result will also contain " +"only :class:`str` data. If :class:`bytes` or :class:`bytearray` data is " +"passed in, the result will contain only :class:`bytes` data." msgstr "" #: ../../library/urllib.parse.rst:496 msgid "" -"Attempting to mix :class:`str` data with :class:`bytes` or :class:" -"`bytearray` in a single function call will result in a :exc:`TypeError` " -"being raised, while attempting to pass in non-ASCII byte values will " -"trigger :exc:`UnicodeDecodeError`." +"Attempting to mix :class:`str` data with :class:`bytes` " +"or :class:`bytearray` in a single function call will result in " +"a :exc:`TypeError` being raised, while attempting to pass in non-ASCII byte " +"values will trigger :exc:`UnicodeDecodeError`." msgstr "" #: ../../library/urllib.parse.rst:501 msgid "" -"To support easier conversion of result objects between :class:`str` and :" -"class:`bytes`, all return values from URL parsing functions provide either " -"an :meth:`encode` method (when the result contains :class:`str` data) or a :" -"meth:`decode` method (when the result contains :class:`bytes` data). The " -"signatures of these methods match those of the corresponding :class:`str` " -"and :class:`bytes` methods (except that the default encoding is ``'ascii'`` " -"rather than ``'utf-8'``). Each produces a value of a corresponding type that " -"contains either :class:`bytes` data (for :meth:`encode` methods) or :class:" -"`str` data (for :meth:`decode` methods)." +"To support easier conversion of result objects between :class:`str` " +"and :class:`bytes`, all return values from URL parsing functions provide " +"either an :meth:`encode` method (when the result contains :class:`str` data) " +"or a :meth:`decode` method (when the result contains :class:`bytes` data). " +"The signatures of these methods match those of the " +"corresponding :class:`str` and :class:`bytes` methods (except that the " +"default encoding is ``'ascii'`` rather than ``'utf-8'``). Each produces a " +"value of a corresponding type that contains either :class:`bytes` data " +"(for :meth:`encode` methods) or :class:`str` data (for :meth:`decode` " +"methods)." msgstr "" #: ../../library/urllib.parse.rst:512 @@ -751,9 +752,9 @@ msgstr "" #: ../../library/urllib.parse.rst:530 msgid "" -"The result objects from the :func:`urlparse`, :func:`urlsplit` and :func:" -"`urldefrag` functions are subclasses of the :class:`tuple` type. These " -"subclasses add the attributes listed in the documentation for those " +"The result objects from the :func:`urlparse`, :func:`urlsplit` " +"and :func:`urldefrag` functions are subclasses of the :class:`tuple` type. " +"These subclasses add the attributes listed in the documentation for those " "functions, the encoding and decoding support described in the previous " "section, as well as an additional method:" msgstr "" @@ -866,8 +867,8 @@ msgid "" "ASCII characters, as accepted by the :meth:`str.encode` method. *encoding* " "defaults to ``'utf-8'``. *errors* defaults to ``'strict'``, meaning " "unsupported characters raise a :class:`UnicodeEncodeError`. *encoding* and " -"*errors* must not be supplied if *string* is a :class:`bytes`, or a :class:" -"`TypeError` is raised." +"*errors* must not be supplied if *string* is a :class:`bytes`, or " +"a :class:`TypeError` is raised." msgstr "" #: ../../library/urllib.parse.rst:643 @@ -894,8 +895,8 @@ msgstr "" #: ../../library/urllib.parse.rst:661 msgid "" -"Like :func:`quote`, but accepts a :class:`bytes` object rather than a :class:" -"`str`, and does not perform string-to-bytes encoding." +"Like :func:`quote`, but accepts a :class:`bytes` object rather than " +"a :class:`str`, and does not perform string-to-bytes encoding." msgstr "" #: ../../library/urllib.parse.rst:664 @@ -906,8 +907,8 @@ msgstr "" msgid "" "Replace :samp:`%{xx}` escapes with their single-character equivalent. The " "optional *encoding* and *errors* parameters specify how to decode percent-" -"encoded sequences into Unicode characters, as accepted by the :meth:`bytes." -"decode` method." +"encoded sequences into Unicode characters, as accepted by " +"the :meth:`bytes.decode` method." msgstr "" #: ../../library/urllib.parse.rst:677 @@ -1003,9 +1004,9 @@ msgstr "" #: ../../library/urllib.parse.rst:747 msgid "" -"Refer to :ref:`urllib examples ` to find out how the :func:" -"`urllib.parse.urlencode` method can be used for generating the query string " -"of a URL or data for a POST request." +"Refer to :ref:`urllib examples ` to find out how " +"the :func:`urllib.parse.urlencode` method can be used for generating the " +"query string of a URL or data for a POST request." msgstr "" #: ../../library/urllib.parse.rst:751 diff --git a/library/urllib.request.po b/library/urllib.request.po index e18223387e..a303aa895e 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-25 00:14+0000\n" +"POT-Creation-Date: 2025-03-24 00:15+0000\n" "PO-Revision-Date: 2022-04-21 17:59+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1470,7 +1470,7 @@ msgstr "" #: ../../library/urllib.request.rst:1199 msgid "" "This example gets the python.org main page and displays the first 300 bytes " -"of it. ::" +"of it::" msgstr "" #: ../../library/urllib.request.rst:1202 @@ -1479,27 +1479,13 @@ msgid "" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" "... print(f.read(300))\n" "...\n" -"b'\\n\\n\\n\\n\\n\\n\n" -"\\n\n" -"Python Programming '" +"b'<!doctype html>\\n<!--[if lt IE 7]> <html class=\"no-js ie6 lt-ie7 lt-" +"ie8 lt-ie9\"> <![endif]-->\\n<!--[if IE 7]> <html class=\"no-js ie7 " +"lt-ie8 lt-ie9\"> <![endif]-->\\n<!--[if IE 8]> <html " +"class=\"no-js ie8 lt-ie9\">" msgstr "" -">>> import urllib.request\n" -">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" -"... print(f.read(300))\n" -"...\n" -"b'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -"\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\\n\\n\\n<html\n" -"xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" " -"lang=\"en\">\\n\\n<head>\\n\n" -"<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /" -">\\n\n" -"<title>Python Programming '" -#: ../../library/urllib.request.rst:1212 +#: ../../library/urllib.request.rst:1208 msgid "" "Note that urlopen returns a bytes object. This is because there is no way " "for urlopen to automatically determine the encoding of the byte stream it " @@ -1508,26 +1494,35 @@ msgid "" "appropriate encoding." msgstr "" -#: ../../library/urllib.request.rst:1218 +#: ../../library/urllib.request.rst:1214 msgid "" -"The following W3C document, https://www.w3.org/International/O-charset\\ , " -"lists the various ways in which an (X)HTML or an XML document could have " +"The following HTML spec document, https://html.spec.whatwg.org/#charset, " +"lists the various ways in which an HTML or an XML document could have " "specified its encoding information." msgstr "" -#: ../../library/urllib.request.rst:1222 +#: ../../library/urllib.request.rst:1218 +msgid "" +"For additional information, see the W3C document: https://www.w3.org/" +"International/questions/qa-html-encoding-declarations." +msgstr "" + +#: ../../library/urllib.request.rst:1220 msgid "" "As the python.org website uses *utf-8* encoding as specified in its meta " -"tag, we will use the same for decoding the bytes object. ::" +"tag, we will use the same for decoding the bytes object::" msgstr "" -#: ../../library/urllib.request.rst:1225 +#: ../../library/urllib.request.rst:1223 +#, fuzzy msgid "" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" "... print(f.read(100).decode('utf-8'))\n" "...\n" -"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -"\"http://www.w3.org/TR/xhtml1/DTD/xhtm" +"<!doctype html>\n" +"<!--[if lt IE 7]> <html class=\"no-js ie6 lt-ie7 lt-ie8 lt-ie9\"> <!" +"[endif]-->\n" +"<!-" msgstr "" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" "... print(f.read(100).decode('utf-8'))\n" @@ -1535,19 +1530,26 @@ msgstr "" "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" "\"http://www.w3.org/TR/xhtml1/DTD/xhtm" -#: ../../library/urllib.request.rst:1231 +#: ../../library/urllib.request.rst:1230 msgid "" "It is also possible to achieve the same result without using the :term:" -"`context manager` approach. ::" +"`context manager` approach::" msgstr "" -#: ../../library/urllib.request.rst:1234 +#: ../../library/urllib.request.rst:1233 +#, fuzzy msgid "" ">>> import urllib.request\n" ">>> f = urllib.request.urlopen('http://www.python.org/')\n" -">>> print(f.read(100).decode('utf-8'))\n" -"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -"\"http://www.w3.org/TR/xhtml1/DTD/xhtm" +">>> try:\n" +"... print(f.read(100).decode('utf-8'))\n" +"... finally:\n" +"... f.close()\n" +"...\n" +"<!doctype html>\n" +"<!--[if lt IE 7]> <html class=\"no-js ie6 lt-ie7 lt-ie8 lt-ie9\"> <!" +"[endif]-->\n" +"<!--" msgstr "" ">>> import urllib.request\n" ">>> f = urllib.request.urlopen('http://www.python.org/')\n" @@ -1555,14 +1557,14 @@ msgstr "" "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" "\"http://www.w3.org/TR/xhtml1/DTD/xhtm" -#: ../../library/urllib.request.rst:1240 +#: ../../library/urllib.request.rst:1244 msgid "" "In the following example, we are sending a data-stream to the stdin of a CGI " "and reading the data it returns to us. Note that this example will only work " "when the Python installation supports SSL. ::" msgstr "" -#: ../../library/urllib.request.rst:1244 +#: ../../library/urllib.request.rst:1248 msgid "" ">>> import urllib.request\n" ">>> req = urllib.request.Request(url='https://localhost/cgi-bin/test.cgi',\n" @@ -1573,11 +1575,11 @@ msgid "" "Got Data: \"This data is passed to stdin of the CGI\"" msgstr "" -#: ../../library/urllib.request.rst:1252 +#: ../../library/urllib.request.rst:1256 msgid "The code for the sample CGI used in the above example is::" msgstr "" -#: ../../library/urllib.request.rst:1254 +#: ../../library/urllib.request.rst:1258 msgid "" "#!/usr/bin/env python\n" "import sys\n" @@ -1589,11 +1591,11 @@ msgstr "" "data = sys.stdin.read()\n" "print('Content-type: text/plain\\n\\nGot Data: \"%s\"' % data)" -#: ../../library/urllib.request.rst:1259 +#: ../../library/urllib.request.rst:1263 msgid "Here is an example of doing a ``PUT`` request using :class:`Request`::" msgstr "" -#: ../../library/urllib.request.rst:1261 +#: ../../library/urllib.request.rst:1265 msgid "" "import urllib.request\n" "DATA = b'some data'\n" @@ -1613,11 +1615,11 @@ msgstr "" "print(f.status)\n" "print(f.reason)" -#: ../../library/urllib.request.rst:1269 +#: ../../library/urllib.request.rst:1273 msgid "Use of Basic HTTP Authentication::" msgstr "" -#: ../../library/urllib.request.rst:1271 +#: ../../library/urllib.request.rst:1275 msgid "" "import urllib.request\n" "# Create an OpenerDirector with support for Basic HTTP Authentication...\n" @@ -1629,10 +1631,11 @@ msgid "" "opener = urllib.request.build_opener(auth_handler)\n" "# ...and install it globally so it can be used with urlopen.\n" "urllib.request.install_opener(opener)\n" -"urllib.request.urlopen('http://www.example.com/login.html')" +"with urllib.request.urlopen('http://www.example.com/login.html') as f:\n" +" print(f.read().decode('utf-8'))" msgstr "" -#: ../../library/urllib.request.rst:1283 +#: ../../library/urllib.request.rst:1288 msgid "" ":func:`build_opener` provides many handlers by default, including a :class:" "`ProxyHandler`. By default, :class:`ProxyHandler` uses the environment " @@ -1641,14 +1644,15 @@ msgid "" "read to obtain the HTTP proxy's URL." msgstr "" -#: ../../library/urllib.request.rst:1289 +#: ../../library/urllib.request.rst:1294 msgid "" "This example replaces the default :class:`ProxyHandler` with one that uses " "programmatically supplied proxy URLs, and adds proxy authorization support " "with :class:`ProxyBasicAuthHandler`. ::" msgstr "" -#: ../../library/urllib.request.rst:1293 +#: ../../library/urllib.request.rst:1298 +#, fuzzy msgid "" "proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example." "com:3128/'})\n" @@ -1657,7 +1661,8 @@ msgid "" "\n" "opener = urllib.request.build_opener(proxy_handler, proxy_auth_handler)\n" "# This time, rather than install the OpenerDirector, we use it directly:\n" -"opener.open('http://www.example.com/login.html')" +"with opener.open('http://www.example.com/login.html') as f:\n" +" print(f.read().decode('utf-8'))" msgstr "" "proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example." "com:3128/'})\n" @@ -1668,22 +1673,24 @@ msgstr "" "# 這次我們直接使用它而不安裝 OpenerDirector:\n" "opener.open('http://www.example.com/login.html')" -#: ../../library/urllib.request.rst:1301 +#: ../../library/urllib.request.rst:1307 msgid "Adding HTTP headers:" msgstr "" -#: ../../library/urllib.request.rst:1303 +#: ../../library/urllib.request.rst:1309 msgid "Use the *headers* argument to the :class:`Request` constructor, or::" msgstr "" -#: ../../library/urllib.request.rst:1305 +#: ../../library/urllib.request.rst:1311 +#, fuzzy msgid "" "import urllib.request\n" "req = urllib.request.Request('http://www.example.com/')\n" "req.add_header('Referer', 'http://www.python.org/')\n" "# Customize the default User-Agent header value:\n" "req.add_header('User-Agent', 'urllib-example/0.1 (Contact: . . .)')\n" -"r = urllib.request.urlopen(req)" +"with urllib.request.urlopen(req) as f:\n" +" print(f.read().decode('utf-8'))" msgstr "" "import urllib.request\n" "req = urllib.request.Request('http://www.example.com/')\n" @@ -1692,38 +1699,40 @@ msgstr "" "req.add_header('User-Agent', 'urllib-example/0.1 (Contact: . . .)')\n" "r = urllib.request.urlopen(req)" -#: ../../library/urllib.request.rst:1312 +#: ../../library/urllib.request.rst:1320 msgid "" ":class:`OpenerDirector` automatically adds a :mailheader:`User-Agent` header " "to every :class:`Request`. To change this::" msgstr "" -#: ../../library/urllib.request.rst:1315 +#: ../../library/urllib.request.rst:1323 +#, fuzzy msgid "" "import urllib.request\n" "opener = urllib.request.build_opener()\n" "opener.addheaders = [('User-agent', 'Mozilla/5.0')]\n" -"opener.open('http://www.example.com/')" +"with opener.open('http://www.example.com/') as f:\n" +" print(f.read().decode('utf-8'))" msgstr "" "import urllib.request\n" "opener = urllib.request.build_opener()\n" "opener.addheaders = [('User-agent', 'Mozilla/5.0')]\n" "opener.open('http://www.example.com/')" -#: ../../library/urllib.request.rst:1320 +#: ../../library/urllib.request.rst:1329 msgid "" "Also, remember that a few standard headers (:mailheader:`Content-Length`, :" "mailheader:`Content-Type` and :mailheader:`Host`) are added when the :class:" "`Request` is passed to :func:`urlopen` (or :meth:`OpenerDirector.open`)." msgstr "" -#: ../../library/urllib.request.rst:1327 +#: ../../library/urllib.request.rst:1336 msgid "" "Here is an example session that uses the ``GET`` method to retrieve a URL " "containing parameters::" msgstr "" -#: ../../library/urllib.request.rst:1330 +#: ../../library/urllib.request.rst:1339 msgid "" ">>> import urllib.request\n" ">>> import urllib.parse\n" @@ -1741,14 +1750,14 @@ msgstr "" "... print(f.read().decode('utf-8'))\n" "..." -#: ../../library/urllib.request.rst:1338 +#: ../../library/urllib.request.rst:1347 msgid "" "The following example uses the ``POST`` method instead. Note that params " "output from urlencode is encoded to bytes before it is sent to urlopen as " "data::" msgstr "" -#: ../../library/urllib.request.rst:1341 +#: ../../library/urllib.request.rst:1350 msgid "" ">>> import urllib.request\n" ">>> import urllib.parse\n" @@ -1768,13 +1777,13 @@ msgstr "" "... print(f.read().decode('utf-8'))\n" "..." -#: ../../library/urllib.request.rst:1349 +#: ../../library/urllib.request.rst:1358 msgid "" "The following example uses an explicitly specified HTTP proxy, overriding " "environment settings::" msgstr "" -#: ../../library/urllib.request.rst:1352 +#: ../../library/urllib.request.rst:1361 msgid "" ">>> import urllib.request\n" ">>> proxies = {'http': 'http://proxy.example.com:8080/'}\n" @@ -1790,13 +1799,13 @@ msgstr "" "... f.read().decode('utf-8')\n" "..." -#: ../../library/urllib.request.rst:1359 +#: ../../library/urllib.request.rst:1368 msgid "" "The following example uses no proxies at all, overriding environment " "settings::" msgstr "" -#: ../../library/urllib.request.rst:1361 +#: ../../library/urllib.request.rst:1370 msgid "" ">>> import urllib.request\n" ">>> opener = urllib.request.FancyURLopener({})\n" @@ -1810,18 +1819,18 @@ msgstr "" "... f.read().decode('utf-8')\n" "..." -#: ../../library/urllib.request.rst:1369 +#: ../../library/urllib.request.rst:1378 msgid "Legacy interface" msgstr "" -#: ../../library/urllib.request.rst:1371 +#: ../../library/urllib.request.rst:1380 msgid "" "The following functions and classes are ported from the Python 2 module " "``urllib`` (as opposed to ``urllib2``). They might become deprecated at " "some point in the future." msgstr "" -#: ../../library/urllib.request.rst:1377 +#: ../../library/urllib.request.rst:1386 msgid "" "Copy a network object denoted by a URL to a local file. If the URL points to " "a local file, the object will not be copied unless filename is supplied. " @@ -1831,7 +1840,7 @@ msgid "" "a remote object). Exceptions are the same as for :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:1384 +#: ../../library/urllib.request.rst:1393 msgid "" "The second argument, if present, specifies the file location to copy to (if " "absent, the location will be a tempfile with a generated name). The third " @@ -1843,11 +1852,11 @@ msgid "" "file size in response to a retrieval request." msgstr "" -#: ../../library/urllib.request.rst:1393 +#: ../../library/urllib.request.rst:1402 msgid "The following example illustrates the most common usage scenario::" msgstr "" -#: ../../library/urllib.request.rst:1395 +#: ../../library/urllib.request.rst:1404 msgid "" ">>> import urllib.request\n" ">>> local_filename, headers = urllib.request.urlretrieve('http://python." @@ -1861,7 +1870,7 @@ msgstr "" ">>> html = open(local_filename)\n" ">>> html.close()" -#: ../../library/urllib.request.rst:1400 +#: ../../library/urllib.request.rst:1409 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " @@ -1870,7 +1879,7 @@ msgid "" "parse.urlencode` function." msgstr "" -#: ../../library/urllib.request.rst:1406 +#: ../../library/urllib.request.rst:1415 msgid "" ":func:`urlretrieve` will raise :exc:`~urllib.error.ContentTooShortError` " "when it detects that the amount of data available was less than the " @@ -1878,40 +1887,40 @@ msgid "" "This can occur, for example, when the download is interrupted." msgstr "" -#: ../../library/urllib.request.rst:1411 +#: ../../library/urllib.request.rst:1420 msgid "" "The *Content-Length* is treated as a lower bound: if there's more data to " "read, urlretrieve reads more data, but if less data is available, it raises " "the exception." msgstr "" -#: ../../library/urllib.request.rst:1415 +#: ../../library/urllib.request.rst:1424 msgid "" "You can still retrieve the downloaded data in this case, it is stored in " "the :attr:`!content` attribute of the exception instance." msgstr "" -#: ../../library/urllib.request.rst:1418 +#: ../../library/urllib.request.rst:1427 msgid "" "If no *Content-Length* header was supplied, urlretrieve can not check the " "size of the data it has downloaded, and just returns it. In this case you " "just have to assume that the download was successful." msgstr "" -#: ../../library/urllib.request.rst:1424 +#: ../../library/urllib.request.rst:1433 msgid "" "Cleans up temporary files that may have been left behind by previous calls " "to :func:`urlretrieve`." msgstr "" -#: ../../library/urllib.request.rst:1431 +#: ../../library/urllib.request.rst:1440 msgid "" "Base class for opening and reading URLs. Unless you need to support opening " "objects using schemes other than :file:`http:`, :file:`ftp:`, or :file:`file:" "`, you probably want to use :class:`FancyURLopener`." msgstr "" -#: ../../library/urllib.request.rst:1435 +#: ../../library/urllib.request.rst:1444 msgid "" "By default, the :class:`URLopener` class sends a :mailheader:`User-Agent` " "header of ``urllib/VVV``, where *VVV* is the :mod:`urllib` version number. " @@ -1921,7 +1930,7 @@ msgid "" "subclass definition." msgstr "" -#: ../../library/urllib.request.rst:1441 +#: ../../library/urllib.request.rst:1450 msgid "" "The optional *proxies* parameter should be a dictionary mapping scheme names " "to proxy URLs, where an empty dictionary turns proxies off completely. Its " @@ -1929,7 +1938,7 @@ msgid "" "be used if present, as discussed in the definition of :func:`urlopen`, above." msgstr "" -#: ../../library/urllib.request.rst:1446 +#: ../../library/urllib.request.rst:1455 msgid "" "Additional keyword parameters, collected in *x509*, may be used for " "authentication of the client when using the :file:`https:` scheme. The " @@ -1937,13 +1946,13 @@ msgid "" "certificate; both are needed to support client authentication." msgstr "" -#: ../../library/urllib.request.rst:1451 +#: ../../library/urllib.request.rst:1460 msgid "" ":class:`URLopener` objects will raise an :exc:`OSError` exception if the " "server returns an error code." msgstr "" -#: ../../library/urllib.request.rst:1456 +#: ../../library/urllib.request.rst:1465 msgid "" "Open *fullurl* using the appropriate protocol. This method sets up cache " "and proxy information, then calls the appropriate open method with its input " @@ -1952,15 +1961,15 @@ msgid "" "`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:1462 +#: ../../library/urllib.request.rst:1471 msgid "This method always quotes *fullurl* using :func:`~urllib.parse.quote`." msgstr "" -#: ../../library/urllib.request.rst:1466 +#: ../../library/urllib.request.rst:1475 msgid "Overridable interface to open unknown URL types." msgstr "" -#: ../../library/urllib.request.rst:1471 +#: ../../library/urllib.request.rst:1480 msgid "" "Retrieves the contents of *url* and places it in *filename*. The return " "value is a tuple consisting of a local filename and either an :class:`email." @@ -1977,7 +1986,7 @@ msgid "" "*reporthook* is ignored for local URLs." msgstr "" -#: ../../library/urllib.request.rst:1484 +#: ../../library/urllib.request.rst:1493 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " @@ -1986,7 +1995,7 @@ msgid "" "urlencode` function." msgstr "" -#: ../../library/urllib.request.rst:1493 +#: ../../library/urllib.request.rst:1502 msgid "" "Variable that specifies the user agent of the opener object. To get :mod:" "`urllib` to tell servers that it is a particular user agent, set this in a " @@ -1994,7 +2003,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/urllib.request.rst:1503 +#: ../../library/urllib.request.rst:1512 msgid "" ":class:`FancyURLopener` subclasses :class:`URLopener` providing default " "handling for the following HTTP response codes: 301, 302, 303, 307 and 401. " @@ -2005,14 +2014,14 @@ msgid "" "defaults to 10." msgstr "" -#: ../../library/urllib.request.rst:1510 +#: ../../library/urllib.request.rst:1519 msgid "" "For all other response codes, the method :meth:`~BaseHandler." "http_error_default` is called which you can override in subclasses to handle " "the error appropriately." msgstr "" -#: ../../library/urllib.request.rst:1515 +#: ../../library/urllib.request.rst:1524 msgid "" "According to the letter of :rfc:`2616`, 301 and 302 responses to POST " "requests must not be automatically redirected without confirmation by the " @@ -2021,13 +2030,13 @@ msgid "" "behaviour." msgstr "" -#: ../../library/urllib.request.rst:1520 +#: ../../library/urllib.request.rst:1529 msgid "" "The parameters to the constructor are the same as those for :class:" "`URLopener`." msgstr "" -#: ../../library/urllib.request.rst:1524 +#: ../../library/urllib.request.rst:1533 msgid "" "When performing basic authentication, a :class:`FancyURLopener` instance " "calls its :meth:`prompt_user_passwd` method. The default implementation " @@ -2036,59 +2045,59 @@ msgid "" "needed." msgstr "" -#: ../../library/urllib.request.rst:1529 +#: ../../library/urllib.request.rst:1538 msgid "" "The :class:`FancyURLopener` class offers one additional method that should " "be overloaded to provide the appropriate behavior:" msgstr "" -#: ../../library/urllib.request.rst:1534 +#: ../../library/urllib.request.rst:1543 msgid "" "Return information needed to authenticate the user at the given host in the " "specified security realm. The return value should be a tuple, ``(user, " "password)``, which can be used for basic authentication." msgstr "" -#: ../../library/urllib.request.rst:1538 +#: ../../library/urllib.request.rst:1547 msgid "" "The implementation prompts for this information on the terminal; an " "application should override this method to use an appropriate interaction " "model in the local environment." msgstr "" -#: ../../library/urllib.request.rst:1544 +#: ../../library/urllib.request.rst:1553 msgid ":mod:`urllib.request` Restrictions" msgstr "" -#: ../../library/urllib.request.rst:1550 +#: ../../library/urllib.request.rst:1559 msgid "" "Currently, only the following protocols are supported: HTTP (versions 0.9 " "and 1.0), FTP, local files, and data URLs." msgstr "" -#: ../../library/urllib.request.rst:1553 +#: ../../library/urllib.request.rst:1562 msgid "Added support for data URLs." msgstr "" -#: ../../library/urllib.request.rst:1555 +#: ../../library/urllib.request.rst:1564 msgid "" "The caching feature of :func:`urlretrieve` has been disabled until someone " "finds the time to hack proper processing of Expiration time headers." msgstr "" -#: ../../library/urllib.request.rst:1558 +#: ../../library/urllib.request.rst:1567 msgid "" "There should be a function to query whether a particular URL is in the cache." msgstr "" -#: ../../library/urllib.request.rst:1560 +#: ../../library/urllib.request.rst:1569 msgid "" "For backward compatibility, if a URL appears to point to a local file but " "the file can't be opened, the URL is re-interpreted using the FTP protocol. " "This can sometimes cause confusing error messages." msgstr "" -#: ../../library/urllib.request.rst:1564 +#: ../../library/urllib.request.rst:1573 msgid "" "The :func:`urlopen` and :func:`urlretrieve` functions can cause arbitrarily " "long delays while waiting for a network connection to be set up. This means " @@ -2096,7 +2105,7 @@ msgid "" "functions without using threads." msgstr "" -#: ../../library/urllib.request.rst:1573 +#: ../../library/urllib.request.rst:1582 msgid "" "The data returned by :func:`urlopen` or :func:`urlretrieve` is the raw data " "returned by the server. This may be binary data (such as an image), plain " @@ -2106,7 +2115,7 @@ msgid "" "module :mod:`html.parser` to parse it." msgstr "" -#: ../../library/urllib.request.rst:1582 +#: ../../library/urllib.request.rst:1591 msgid "" "The code handling the FTP protocol cannot differentiate between a file and a " "directory. This can lead to unexpected behavior when attempting to read a " @@ -2124,11 +2133,11 @@ msgid "" "meet your needs." msgstr "" -#: ../../library/urllib.request.rst:1599 +#: ../../library/urllib.request.rst:1608 msgid ":mod:`urllib.response` --- Response classes used by urllib" msgstr "" -#: ../../library/urllib.request.rst:1604 +#: ../../library/urllib.request.rst:1613 msgid "" "The :mod:`urllib.response` module defines functions and classes which define " "a minimal file-like interface, including ``read()`` and ``readline()``. " @@ -2137,46 +2146,73 @@ msgid "" "addinfourl` instance:" msgstr "" -#: ../../library/urllib.request.rst:1613 +#: ../../library/urllib.request.rst:1622 msgid "" "URL of the resource retrieved, commonly used to determine if a redirect was " "followed." msgstr "" -#: ../../library/urllib.request.rst:1617 +#: ../../library/urllib.request.rst:1626 msgid "" "Returns the headers of the response in the form of an :class:`~email.message." "EmailMessage` instance." msgstr "" -#: ../../library/urllib.request.rst:1623 +#: ../../library/urllib.request.rst:1632 msgid "Status code returned by server." msgstr "" -#: ../../library/urllib.request.rst:1627 +#: ../../library/urllib.request.rst:1636 msgid "Deprecated in favor of :attr:`~addinfourl.url`." msgstr "" -#: ../../library/urllib.request.rst:1632 +#: ../../library/urllib.request.rst:1641 msgid "Deprecated in favor of :attr:`~addinfourl.headers`." msgstr "" -#: ../../library/urllib.request.rst:1637 ../../library/urllib.request.rst:1642 +#: ../../library/urllib.request.rst:1646 ../../library/urllib.request.rst:1651 msgid "Deprecated in favor of :attr:`~addinfourl.status`." msgstr "" -#: ../../library/urllib.request.rst:1546 ../../library/urllib.request.rst:1569 +#: ../../library/urllib.request.rst:1555 ../../library/urllib.request.rst:1578 msgid "HTTP" msgstr "HTTP" -#: ../../library/urllib.request.rst:1546 ../../library/urllib.request.rst:1569 +#: ../../library/urllib.request.rst:1555 ../../library/urllib.request.rst:1578 msgid "protocol" msgstr "protocol(協定)" -#: ../../library/urllib.request.rst:1546 ../../library/urllib.request.rst:1580 +#: ../../library/urllib.request.rst:1555 ../../library/urllib.request.rst:1589 msgid "FTP" msgstr "FTP" -#: ../../library/urllib.request.rst:1569 +#: ../../library/urllib.request.rst:1578 msgid "HTML" msgstr "HTML" + +#~ msgid "" +#~ ">>> import urllib.request\n" +#~ ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" +#~ "... print(f.read(300))\n" +#~ "...\n" +#~ "b'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" +#~ "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional." +#~ "dtd\">\\n\\n\\n<html\n" +#~ "xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" " +#~ "lang=\"en\">\\n\\n<head>\\n\n" +#~ "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /" +#~ ">\\n\n" +#~ "<title>Python Programming '" +#~ msgstr "" +#~ ">>> import urllib.request\n" +#~ ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" +#~ "... print(f.read(300))\n" +#~ "...\n" +#~ "b'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" +#~ "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional." +#~ "dtd\">\\n\\n\\n<html\n" +#~ "xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" " +#~ "lang=\"en\">\\n\\n<head>\\n\n" +#~ "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /" +#~ ">\\n\n" +#~ "<title>Python Programming '" diff --git a/library/uuid.po b/library/uuid.po index e3274d2fbf..fafd1ce1b4 100644 --- a/library/uuid.po +++ b/library/uuid.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-02-26 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,18 +29,18 @@ msgstr "**原始碼:**\\ :source:`Lib/uuid.py`" #: ../../library/uuid.rst:13 msgid "" "This module provides immutable :class:`UUID` objects (the :class:`UUID` " -"class) and the functions :func:`uuid1`, :func:`uuid3`, :func:`uuid4`, :func:" -"`uuid5` for generating version 1, 3, 4, and 5 UUIDs as specified in :rfc:" -"`4122`." +"class) and the " +"functions :func:`uuid1`, :func:`uuid3`, :func:`uuid4`, :func:`uuid5` for " +"generating version 1, 3, 4, and 5 UUIDs as specified in :rfc:`4122`." msgstr "" -"這個模組提供了不可變的 :class:`UUID` 物件(:class:`UUID` 類別)和 :func:" -"`uuid1`、:func:`uuid3`、:func:`uuid4`、:func:`uuid5` 等函式,用於生成 :rfc:" -"`4122` 定義的第 1、3、4、5 版本的 UUID。" +"這個模組提供了不可變的 :class:`UUID` 物件(:class:`UUID` 類別)" +"和 :func:`uuid1`、:func:`uuid3`、:func:`uuid4`、:func:`uuid5` 等函式,用於生" +"成 :rfc:`4122` 定義的第 1、3、4、5 版本的 UUID。" #: ../../library/uuid.rst:17 msgid "" -"If all you want is a unique ID, you should probably call :func:`uuid1` or :" -"func:`uuid4`. Note that :func:`uuid1` may compromise privacy since it " +"If all you want is a unique ID, you should probably call :func:`uuid1` " +"or :func:`uuid4`. Note that :func:`uuid1` may compromise privacy since it " "creates a UUID containing the computer's network address. :func:`uuid4` " "creates a random UUID." msgstr "" @@ -130,9 +130,9 @@ msgstr "" #: ../../library/uuid.rst:71 msgid "" -"Comparison of UUID objects are made by way of comparing their :attr:`UUID." -"int` attributes. Comparison with a non-UUID object raises a :exc:" -"`TypeError`." +"Comparison of UUID objects are made by way of comparing " +"their :attr:`UUID.int` attributes. Comparison with a non-UUID object raises " +"a :exc:`TypeError`." msgstr "" "UUID 物件之間的比較是透過比較它們的 :attr:`UUID.int` 屬性。與非 UUID 的物件進" "行比較會引發 :exc:`TypeError`。" @@ -220,17 +220,18 @@ msgstr "UUID 以 :rfc:`4122` 中指定的 URN 形式表示。" #: ../../library/uuid.rst:145 msgid "" "The UUID variant, which determines the internal layout of the UUID. This " -"will be one of the constants :const:`RESERVED_NCS`, :const:`RFC_4122`, :" -"const:`RESERVED_MICROSOFT`, or :const:`RESERVED_FUTURE`." +"will be one of the " +"constants :const:`RESERVED_NCS`, :const:`RFC_4122`, :const:`RESERVED_MICROSOFT`, " +"or :const:`RESERVED_FUTURE`." msgstr "" -"UUID 的變體,決定 UUID 內部的佈局 (layout),是 :const:`RESERVED_NCS`、:const:" -"`RFC_4122`、:const:`RESERVED_MICROSOFT` 或 :const:`RESERVED_FUTURE` 其中一個" -"常數。" +"UUID 的變體,決定 UUID 內部的佈局 (layout)," +"是 :const:`RESERVED_NCS`、:const:`RFC_4122`、:const:`RESERVED_MICROSOFT` " +"或 :const:`RESERVED_FUTURE` 其中一個常數。" #: ../../library/uuid.rst:152 msgid "" -"The UUID version number (1 through 5, meaningful only when the variant is :" -"const:`RFC_4122`)." +"The UUID version number (1 through 5, meaningful only when the variant " +"is :const:`RFC_4122`)." msgstr "UUID 的版本號(1 到 5,只有當變體是 :const:`RFC_4122` 時才有意義)。" #: ../../library/uuid.rst:157 @@ -273,31 +274,31 @@ msgstr "" "通用管理的 MAC 位址優於本地管理的 MAC 位址,因為前者保證是全球唯一的,而後者" "不是。" -#: ../../library/uuid.rst:187 +#: ../../library/uuid.rst:185 msgid "" "Generate a UUID from a host ID, sequence number, and the current time. If " "*node* is not given, :func:`getnode` is used to obtain the hardware address. " "If *clock_seq* is given, it is used as the sequence number; otherwise a " "random 14-bit sequence number is chosen." msgstr "" -"從主機 ID、序列號和當前時間生成 UUID。如果未給定 *node*,將使用 :func:" -"`getnode` 獲取硬體位址。如果給定 *clock_seq*,會將其用作序列號;否則將使用一" -"個隨機 14 位元的序列號。" +"從主機 ID、序列號和當前時間生成 UUID。如果未給定 *node*,將使" +"用 :func:`getnode` 獲取硬體位址。如果給定 *clock_seq*,會將其用作序列號;否則" +"將使用一個隨機 14 位元的序列號。" -#: ../../library/uuid.rst:197 +#: ../../library/uuid.rst:193 msgid "" "Generate a UUID based on the MD5 hash of a namespace identifier (which is a " "UUID) and a name (which is a :class:`bytes` object or a string that will be " "encoded using UTF-8)." msgstr "" -"基於命名空間識別碼 (namespace identifier)(一個 UUID)和名稱(一個 :class:" -"`bytes` 物件或使用 UTF-8 編碼的字串)的 MD5 hash 來生成 UUID。" +"基於命名空間識別碼 (namespace identifier)(一個 UUID)和名稱(一" +"個 :class:`bytes` 物件或使用 UTF-8 編碼的字串)的 MD5 hash 來生成 UUID。" -#: ../../library/uuid.rst:206 +#: ../../library/uuid.rst:200 msgid "Generate a random UUID." msgstr "生成一個隨機的 UUID。" -#: ../../library/uuid.rst:213 +#: ../../library/uuid.rst:205 msgid "" "Generate a UUID based on the SHA-1 hash of a namespace identifier (which is " "a UUID) and a name (which is a :class:`bytes` object or a string that will " @@ -306,7 +307,7 @@ msgstr "" "基於命名空間識別碼(一個 UUID)和名稱(一個 :class:`bytes` 物件或使用 UTF-8 " "編碼的字串)的 SHA-1 hash 來生成 UUID。" -#: ../../library/uuid.rst:219 +#: ../../library/uuid.rst:210 msgid "" "The :mod:`uuid` module defines the following namespace identifiers for use " "with :func:`uuid3` or :func:`uuid5`." @@ -314,7 +315,7 @@ msgstr "" ":mod:`uuid` 模組為 :func:`uuid3` 或 :func:`uuid5` 定義了以下的命名空間識別" "碼。" -#: ../../library/uuid.rst:225 +#: ../../library/uuid.rst:216 msgid "" "When this namespace is specified, the *name* string is a fully qualified " "domain name." @@ -322,50 +323,50 @@ msgstr "" "當指定這個命名空間時,*name* 字串是一個完整網域名稱 (fully qualified domain " "name)。" -#: ../../library/uuid.rst:231 +#: ../../library/uuid.rst:222 msgid "When this namespace is specified, the *name* string is a URL." msgstr "當指定這個命名空間時,*name* 字串是一個 URL。" -#: ../../library/uuid.rst:236 +#: ../../library/uuid.rst:227 msgid "When this namespace is specified, the *name* string is an ISO OID." msgstr "當指定這個命名空間時,*name* 字串是一個 ISO OID。" -#: ../../library/uuid.rst:241 +#: ../../library/uuid.rst:232 msgid "" "When this namespace is specified, the *name* string is an X.500 DN in DER or " "a text output format." msgstr "" "當指定這個命名空間時,*name* 字串是以 DER 或文字輸出格式表示的 X.500 DN。" -#: ../../library/uuid.rst:244 +#: ../../library/uuid.rst:235 msgid "" "The :mod:`uuid` module defines the following constants for the possible " "values of the :attr:`~UUID.variant` attribute:" msgstr ":mod:`uuid` 模組為 :attr:`~UUID.variant` 屬性的可能值定義了以下常數:" -#: ../../library/uuid.rst:250 +#: ../../library/uuid.rst:241 msgid "Reserved for NCS compatibility." msgstr "保留供 NCS 相容性使用。" -#: ../../library/uuid.rst:255 +#: ../../library/uuid.rst:246 msgid "Specifies the UUID layout given in :rfc:`4122`." msgstr "使用在 :rfc:`4122` 中給定的 UUID 佈局。" -#: ../../library/uuid.rst:260 +#: ../../library/uuid.rst:251 msgid "Reserved for Microsoft compatibility." msgstr "保留供 Microsoft 相容性使用。" -#: ../../library/uuid.rst:265 +#: ../../library/uuid.rst:256 msgid "Reserved for future definition." msgstr "保留供未來定義使用。" -#: ../../library/uuid.rst:270 +#: ../../library/uuid.rst:261 msgid ":rfc:`4122` - A Universally Unique IDentifier (UUID) URN Namespace" msgstr "" ":rfc:`4122` - 通用唯一辨識碼 (UUID, Universally Unique IDentifier) 的 URN 命" "名空間" -#: ../../library/uuid.rst:271 +#: ../../library/uuid.rst:262 msgid "" "This specification defines a Uniform Resource Name namespace for UUIDs, the " "internal format of UUIDs, and methods of generating UUIDs." @@ -373,36 +374,36 @@ msgstr "" "這個規範定義了 UUID 的統一資源名稱 (Uniform Resource Name) 命名空間、UUID 的" "內部格式和生成 UUID 的方法。" -#: ../../library/uuid.rst:278 +#: ../../library/uuid.rst:269 msgid "Command-Line Usage" msgstr "命令列的用法" -#: ../../library/uuid.rst:282 +#: ../../library/uuid.rst:273 msgid "" "The :mod:`uuid` module can be executed as a script from the command line." msgstr ":mod:`uuid` 模組可以在命令列下作為腳本來執行。" -#: ../../library/uuid.rst:284 +#: ../../library/uuid.rst:275 msgid "" "python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5}] [-n NAMESPACE] [-N NAME]" msgstr "" "python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5}] [-n NAMESPACE] [-N NAME]" -#: ../../library/uuid.rst:288 +#: ../../library/uuid.rst:279 msgid "The following options are accepted:" msgstr "可以接受以下選項:" -#: ../../library/uuid.rst:294 +#: ../../library/uuid.rst:285 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/uuid.rst:299 +#: ../../library/uuid.rst:290 msgid "" -"Specify the function name to use to generate the uuid. By default :func:" -"`uuid4` is used." +"Specify the function name to use to generate the uuid. By " +"default :func:`uuid4` is used." msgstr "指定要用來生成 UUID 的函式名稱。預設使用 :func:`uuid4`。" -#: ../../library/uuid.rst:305 +#: ../../library/uuid.rst:296 msgid "" "The namespace is a ``UUID``, or ``@ns`` where ``ns`` is a well-known " "predefined UUID addressed by namespace name. Such as ``@dns``, ``@url``, " @@ -410,24 +411,24 @@ msgid "" "functions." msgstr "" "該命名空間是一個 ``UUID`` 或 ``@ns``,其中 ``ns`` 是指知名預定義 UUID 的命名" -"空間名稱,例如 ``@dns``、``@url``、``@oid`` 和 ``@x500``。 只有 :func:" -"`uuid3` / :func:`uuid5` 函式會需要。" +"空間名稱,例如 ``@dns``、``@url``、``@oid`` 和 ``@x500``。 只" +"有 :func:`uuid3` / :func:`uuid5` 函式會需要。" -#: ../../library/uuid.rst:312 +#: ../../library/uuid.rst:303 msgid "" -"The name used as part of generating the uuid. Only required for :func:" -"`uuid3` / :func:`uuid5` functions." +"The name used as part of generating the uuid. Only required " +"for :func:`uuid3` / :func:`uuid5` functions." msgstr "用於生成 uuid 的名稱。只有 :func:`uuid3` / :func:`uuid5` 函式會需要。" -#: ../../library/uuid.rst:319 +#: ../../library/uuid.rst:310 msgid "Example" msgstr "範例" -#: ../../library/uuid.rst:321 +#: ../../library/uuid.rst:312 msgid "Here are some examples of typical usage of the :mod:`uuid` module::" msgstr "以下是一些 :mod:`uuid` 模組的典型使用範例: ::" -#: ../../library/uuid.rst:323 +#: ../../library/uuid.rst:314 msgid "" ">>> import uuid\n" "\n" @@ -462,18 +463,50 @@ msgid "" ">>> uuid.UUID(bytes=x.bytes)\n" "UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')" msgstr "" +">>> import uuid\n" +"\n" +">>> # 基於主機 ID 和目前時間生成 UUID\n" +">>> uuid.uuid1()\n" +"UUID('a8098c1a-f86e-11da-bd1a-00112444be1e')\n" +"\n" +">>> # 使用命名空間 UUID 的 MD5 雜湊和一個名稱生成 UUID\n" +">>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')\n" +"UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')\n" +"\n" +">>> # 生成一個隨機的 UUID\n" +">>> uuid.uuid4()\n" +"UUID('16fd2706-8baf-433b-82eb-8c7fada847da')\n" +"\n" +">>> # 使用命名空間 UUID 的 SHA-1 雜湊和一個名稱生成 UUID\n" +">>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')\n" +"UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')\n" +"\n" +">>> # 從十六進位數字組成的字串生成 UUID(大括號和連字符號會被忽略)\n" +">>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')\n" +"\n" +">>> # 將 UUID 轉換為標準形式的十六進位數字字串\n" +">>> str(x)\n" +"'00010203-0405-0607-0809-0a0b0c0d0e0f'\n" +"\n" +">>> # 取得 UUID 的原始 16 位元組\n" +">>> x.bytes\n" +"b'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\t\\n\\x0b\\x0c\\r\\x0e\\x0f'\n" +"\n" +">>> # 從 16 位元組的字串生成 UUID\n" +">>> uuid.UUID(bytes=x.bytes)\n" +"UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')" -#: ../../library/uuid.rst:360 +#: ../../library/uuid.rst:351 msgid "Command-Line Example" msgstr "命令列的範例" -#: ../../library/uuid.rst:362 +#: ../../library/uuid.rst:353 msgid "" "Here are some examples of typical usage of the :mod:`uuid` command line " "interface:" msgstr "以下是一些 :mod:`uuid` 命令列介面的典型使用範例:" -#: ../../library/uuid.rst:364 +#: ../../library/uuid.rst:355 msgid "" "# generate a random uuid - by default uuid4() is used\n" "$ python -m uuid\n" @@ -484,23 +517,11 @@ msgid "" "# generate a uuid using uuid5\n" "$ python -m uuid -u uuid5 -n @url -N example.com" msgstr "" - -#: ../../library/uuid.rst:182 -msgid "getnode" -msgstr "getnode" - -#: ../../library/uuid.rst:192 -msgid "uuid1" -msgstr "uuid1" - -#: ../../library/uuid.rst:201 -msgid "uuid3" -msgstr "uuid3" - -#: ../../library/uuid.rst:208 -msgid "uuid4" -msgstr "uuid4" - -#: ../../library/uuid.rst:217 -msgid "uuid5" -msgstr "uuid5" +"# 生成一個隨機的 uuid - 預設使用 uuid4()\n" +"$ python -m uuid\n" +"\n" +"# 使用 uuid1() 生成一組 uuid\n" +"$ python -m uuid -u uuid1\n" +"\n" +"# 使用 uuid5 生成一組 uuid\n" +"$ python -m uuid -u uuid5 -n @url -N example.com" diff --git a/library/warnings.po b/library/warnings.po index 914b791ce7..35a798ed78 100644 --- a/library/warnings.po +++ b/library/warnings.po @@ -38,16 +38,16 @@ msgstr "" #: ../../library/warnings.rst:18 msgid "" "Python programmers issue warnings by calling the :func:`warn` function " -"defined in this module. (C programmers use :c:func:`PyErr_WarnEx`; see :ref:" -"`exceptionhandling` for details)." +"defined in this module. (C programmers use :c:func:`PyErr_WarnEx`; " +"see :ref:`exceptionhandling` for details)." msgstr "" #: ../../library/warnings.rst:22 msgid "" "Warning messages are normally written to :data:`sys.stderr`, but their " "disposition can be changed flexibly, from ignoring all warnings to turning " -"them into exceptions. The disposition of warnings can vary based on the :" -"ref:`warning category <warning-categories>`, the text of the warning " +"them into exceptions. The disposition of warnings can vary based on " +"the :ref:`warning category <warning-categories>`, the text of the warning " "message, and the source location where it is issued. Repetitions of a " "particular warning for the same source location are typically suppressed." msgstr "" @@ -62,11 +62,11 @@ msgstr "" #: ../../library/warnings.rst:33 msgid "" -"The determination whether to issue a warning message is controlled by the :" -"ref:`warning filter <warning-filter>`, which is a sequence of matching rules " -"and actions. Rules can be added to the filter by calling :func:" -"`filterwarnings` and reset to its default state by calling :func:" -"`resetwarnings`." +"The determination whether to issue a warning message is controlled by " +"the :ref:`warning filter <warning-filter>`, which is a sequence of matching " +"rules and actions. Rules can be added to the filter by " +"calling :func:`filterwarnings` and reset to its default state by " +"calling :func:`resetwarnings`." msgstr "" #: ../../library/warnings.rst:38 @@ -113,7 +113,7 @@ msgstr "" #: ../../library/warnings.rst:69 msgid "Class" -msgstr "" +msgstr "類別" #: ../../library/warnings.rst:69 msgid "Description" @@ -315,10 +315,10 @@ msgstr "" #: ../../library/warnings.rst:156 msgid "" "*message* is a string containing a regular expression that the start of the " -"warning message must match, case-insensitively. In :option:`-W` and :envvar:" -"`PYTHONWARNINGS`, *message* is a literal string that the start of the " -"warning message must contain (case-insensitively), ignoring any whitespace " -"at the start or end of *message*." +"warning message must match, case-insensitively. In :option:`-W` " +"and :envvar:`PYTHONWARNINGS`, *message* is a literal string that the start " +"of the warning message must contain (case-insensitively), ignoring any " +"whitespace at the start or end of *message*." msgstr "" #: ../../library/warnings.rst:162 @@ -409,11 +409,11 @@ msgstr "action:message:category:module:line" #: ../../library/warnings.rst:211 msgid "" "The meaning of each of these fields is as described in :ref:`warning-" -"filter`. When listing multiple filters on a single line (as for :envvar:" -"`PYTHONWARNINGS`), the individual filters are separated by commas and the " -"filters listed later take precedence over those listed before them (as " -"they're applied left-to-right, and the most recently applied filters take " -"precedence over earlier ones)." +"filter`. When listing multiple filters on a single line (as " +"for :envvar:`PYTHONWARNINGS`), the individual filters are separated by " +"commas and the filters listed later take precedence over those listed before " +"them (as they're applied left-to-right, and the most recently applied " +"filters take precedence over earlier ones)." msgstr "" #: ../../library/warnings.rst:218 @@ -475,8 +475,8 @@ msgstr "" #: ../../library/warnings.rst:251 msgid "" -":exc:`DeprecationWarning` is now ignored by default in addition to :exc:" -"`PendingDeprecationWarning`." +":exc:`DeprecationWarning` is now ignored by default in addition " +"to :exc:`PendingDeprecationWarning`." msgstr "" #: ../../library/warnings.rst:255 @@ -500,10 +500,10 @@ msgstr "" msgid "" "Developers of applications written in Python may wish to hide *all* Python " "level warnings from their users by default, and only display them when " -"running tests or otherwise working on the application. The :data:`sys." -"warnoptions` attribute used to pass filter configurations to the interpreter " -"can be used as a marker to indicate whether or not warnings should be " -"disabled::" +"running tests or otherwise working on the application. " +"The :data:`sys.warnoptions` attribute used to pass filter configurations to " +"the interpreter can be used as a marker to indicate whether or not warnings " +"should be disabled::" msgstr "" #: ../../library/warnings.rst:276 @@ -599,7 +599,7 @@ msgstr "" #: ../../library/warnings.rst:334 msgid "Testing Warnings" -msgstr "" +msgstr "測試警告" #: ../../library/warnings.rst:336 msgid "" @@ -766,8 +766,8 @@ msgstr "" #: ../../library/warnings.rst:457 ../../library/warnings.rst:483 msgid "" -"*source*, if supplied, is the destroyed object which emitted a :exc:" -"`ResourceWarning`." +"*source*, if supplied, is the destroyed object which emitted " +"a :exc:`ResourceWarning`." msgstr "" #: ../../library/warnings.rst:460 @@ -800,26 +800,26 @@ msgstr "" #: ../../library/warnings.rst:486 msgid "Add the *source* parameter." -msgstr "" +msgstr "新增 *source* 參數。" #: ../../library/warnings.rst:492 msgid "" "Write a warning to a file. The default implementation calls " "``formatwarning(message, category, filename, lineno, line)`` and writes the " "resulting string to *file*, which defaults to :data:`sys.stderr`. You may " -"replace this function with any callable by assigning to ``warnings." -"showwarning``. *line* is a line of source code to be included in the warning " -"message; if *line* is not supplied, :func:`showwarning` will try to read the " -"line specified by *filename* and *lineno*." +"replace this function with any callable by assigning to " +"``warnings.showwarning``. *line* is a line of source code to be included in " +"the warning message; if *line* is not supplied, :func:`showwarning` will try " +"to read the line specified by *filename* and *lineno*." msgstr "" #: ../../library/warnings.rst:503 msgid "" "Format a warning the standard way. This returns a string which may contain " "embedded newlines and ends in a newline. *line* is a line of source code to " -"be included in the warning message; if *line* is not supplied, :func:" -"`formatwarning` will try to read the line specified by *filename* and " -"*lineno*." +"be included in the warning message; if *line* is not " +"supplied, :func:`formatwarning` will try to read the line specified by " +"*filename* and *lineno*." msgstr "" #: ../../library/warnings.rst:512 @@ -837,10 +837,10 @@ msgstr "" #: ../../library/warnings.rst:524 msgid "" "Insert a simple entry into the list of :ref:`warnings filter specifications " -"<warning-filter>`. The meaning of the function parameters is as for :func:" -"`filterwarnings`, but regular expressions are not needed as the filter " -"inserted always matches any message in any module as long as the category " -"and line number match." +"<warning-filter>`. The meaning of the function parameters is as " +"for :func:`filterwarnings`, but regular expressions are not needed as the " +"filter inserted always matches any message in any module as long as the " +"category and line number match." msgstr "" #: ../../library/warnings.rst:533 @@ -902,9 +902,9 @@ msgstr "" msgid "" "The deprecation message passed to the decorator is saved in the " "``__deprecated__`` attribute on the decorated object. If applied to an " -"overload, the decorator must be after the :func:`@overload <typing." -"overload>` decorator for the attribute to exist on the overload as returned " -"by :func:`typing.get_overloads`." +"overload, the decorator must be after the :func:`@overload " +"<typing.overload>` decorator for the attribute to exist on the overload as " +"returned by :func:`typing.get_overloads`." msgstr "" #: ../../library/warnings.rst:584 @@ -918,12 +918,13 @@ msgstr "" #: ../../library/warnings.rst:593 msgid "" "A context manager that copies and, upon exit, restores the warnings filter " -"and the :func:`showwarning` function. If the *record* argument is :const:" -"`False` (the default) the context manager returns :class:`None` on entry. If " -"*record* is :const:`True`, a list is returned that is progressively " -"populated with objects as seen by a custom :func:`showwarning` function " -"(which also suppresses output to ``sys.stdout``). Each object in the list " -"has attributes with the same names as the arguments to :func:`showwarning`." +"and the :func:`showwarning` function. If the *record* argument " +"is :const:`False` (the default) the context manager returns :class:`None` on " +"entry. If *record* is :const:`True`, a list is returned that is " +"progressively populated with objects as seen by a custom :func:`showwarning` " +"function (which also suppresses output to ``sys.stdout``). Each object in " +"the list has attributes with the same names as the arguments " +"to :func:`showwarning`." msgstr "" #: ../../library/warnings.rst:602 diff --git a/library/webbrowser.po b/library/webbrowser.po index d65090b5fb..fd3a9208fa 100644 --- a/library/webbrowser.po +++ b/library/webbrowser.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-03-10 00:13+0000\n" "PO-Revision-Date: 2024-09-24 18:27+0000\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -88,7 +88,7 @@ msgstr "" "要 :mod:`ctypes` 模組。如果 :mod:`ctypes` 不可用,則呼叫 :func:`.open` 將會失" "敗。" -#: ../../library/webbrowser.rst:43 +#: ../../library/webbrowser.rst:45 msgid "" "The script :program:`webbrowser` can be used as a command-line interface for " "the module. It accepts a URL as the argument. It accepts the following " @@ -97,40 +97,42 @@ msgstr "" "腳本 :program:`webbrowser` 可以用作模組的命令列介面。它接受 URL 作為引數。它" "接受以下可選參數:" -#: ../../library/webbrowser.rst:47 -msgid "" -"``-n``/``--new-window`` opens the URL in a new browser window, if possible." +#: ../../library/webbrowser.rst:51 +#, fuzzy +msgid "Opens the URL in a new browser window, if possible." msgstr "如果可能的話,``-n``/``--new-window`` 會在新的瀏覽器視窗中開啟 URL。" -#: ../../library/webbrowser.rst:48 -msgid "``-t``/``--new-tab`` opens the URL in a new browser page (\"tab\")." +#: ../../library/webbrowser.rst:55 +#, fuzzy +msgid "Opens the URL in a new browser tab." msgstr "``-t``/``--new-tab`` 會在新的瀏覽器分頁 (\"tab\") 中開啟 URL。" -#: ../../library/webbrowser.rst:50 -msgid "The options are, naturally, mutually exclusive. Usage example::" +#: ../../library/webbrowser.rst:57 +#, fuzzy +msgid "The options are, naturally, mutually exclusive. Usage example:" msgstr "這些選項自然是相互排斥的。用法範例: ::" -#: ../../library/webbrowser.rst:52 +#: ../../library/webbrowser.rst:59 msgid "python -m webbrowser -t \"https://www.python.org\"" msgstr "python -m webbrowser -t \"https://www.python.org\"" -#: ../../library/webbrowser.rst:54 +#: ../../library/webbrowser.rst:63 msgid "Availability" msgstr "" -#: ../../library/webbrowser.rst:56 +#: ../../library/webbrowser.rst:65 msgid "The following exception is defined:" msgstr "以下例外有被定義於該模組:" -#: ../../library/webbrowser.rst:61 +#: ../../library/webbrowser.rst:70 msgid "Exception raised when a browser control error occurs." msgstr "當瀏覽器控制項發生錯誤時引發例外。" -#: ../../library/webbrowser.rst:63 +#: ../../library/webbrowser.rst:72 msgid "The following functions are defined:" msgstr "以下函式有被定義於該模組:" -#: ../../library/webbrowser.rst:68 +#: ../../library/webbrowser.rst:77 msgid "" "Display *url* using the default browser. If *new* is 0, the *url* is opened " "in the same browser window if possible. If *new* is 1, a new browser window " @@ -144,13 +146,13 @@ msgstr "" "可能開啟一個新的瀏覽器分頁 (\"tab\")。如果 *autoraise* 為 ``True``,則盡可能" "提升視窗(請注意,無論此變數的設定如何,許多視窗管理器下都會發生這種情況)。" -#: ../../library/webbrowser.rst:75 ../../library/webbrowser.rst:89 -#: ../../library/webbrowser.rst:97 +#: ../../library/webbrowser.rst:84 ../../library/webbrowser.rst:98 +#: ../../library/webbrowser.rst:106 msgid "" "Returns ``True`` if a browser was successfully launched, ``False`` otherwise." msgstr "如果瀏覽器成功啟動則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/webbrowser.rst:77 +#: ../../library/webbrowser.rst:86 msgid "" "Note that on some platforms, trying to open a filename using this function, " "may work and start the operating system's associated program. However, this " @@ -159,7 +161,7 @@ msgstr "" "請注意,在某些平台上,嘗試使用此函式開啟檔案名稱可能能夠運作並啟動作業系統的" "關聯程式。然而這既不支援也不可移植。" -#: ../../library/webbrowser.rst:81 +#: ../../library/webbrowser.rst:90 msgid "" "Raises an :ref:`auditing event <auditing>` ``webbrowser.open`` with argument " "``url``." @@ -167,14 +169,14 @@ msgstr "" "引發一個附帶引數 ``url`` 的\\ :ref:`稽核事件 <auditing>` ``webbrowser." "open``。" -#: ../../library/webbrowser.rst:86 +#: ../../library/webbrowser.rst:95 msgid "" "Open *url* in a new window of the default browser, if possible, otherwise, " "open *url* in the only browser window." msgstr "" "盡可能在預設瀏覽器的新視窗中開啟 *url*,否則在唯一的瀏覽器視窗中開啟 *url*。" -#: ../../library/webbrowser.rst:94 +#: ../../library/webbrowser.rst:103 msgid "" "Open *url* in a new page (\"tab\") of the default browser, if possible, " "otherwise equivalent to :func:`open_new`." @@ -182,7 +184,7 @@ msgstr "" "盡可能在預設瀏覽器的新分頁 (\"tab\") 中開啟 *url*,否則相當於 :func:" "`open_new`。" -#: ../../library/webbrowser.rst:102 +#: ../../library/webbrowser.rst:111 msgid "" "Return a controller object for the browser type *using*. If *using* is " "``None``, return a controller for a default browser appropriate to the " @@ -191,7 +193,7 @@ msgstr "" "回傳瀏覽器類型\\ *使用*(以引數 *using* 給定)的控制器物件。如果 *using* 為 " "``None``,則回傳適合呼叫者環境的預設瀏覽器控制器。" -#: ../../library/webbrowser.rst:109 +#: ../../library/webbrowser.rst:118 msgid "" "Register the browser type *name*. Once a browser type is registered, the :" "func:`get` function can return a controller for that browser type. If " @@ -204,7 +206,7 @@ msgstr "" "``None``,則會在需要時不帶參數地呼叫 *constructor* 來建立實例。如果提供了 " "*instance*,*constructor* 將永遠不會被呼叫,並且可能為 ``None``。" -#: ../../library/webbrowser.rst:115 +#: ../../library/webbrowser.rst:124 msgid "" "Setting *preferred* to ``True`` makes this browser a preferred result for a :" "func:`get` call with no argument. Otherwise, this entry point is only " @@ -216,11 +218,11 @@ msgstr "" "好結果。否則只有當你計劃設定 :envvar:`BROWSER` 變數或使用與你宣告的處理程序名" "稱相符的非空引數呼叫 :func:`get` 時,此入口點才會有用。" -#: ../../library/webbrowser.rst:121 +#: ../../library/webbrowser.rst:130 msgid "*preferred* keyword-only parameter was added." msgstr "新增了 *preferred* 僅限關鍵字參數。" -#: ../../library/webbrowser.rst:124 +#: ../../library/webbrowser.rst:133 msgid "" "A number of browser types are predefined. This table gives the type names " "that may be passed to the :func:`get` function and the corresponding " @@ -229,181 +231,181 @@ msgstr "" "預先定義了多種瀏覽器類型。此表給出了可以傳遞給 :func:`get` 函式的類型名稱以及" "控制器類別的相應實例化方式,這些都定義於此模組中。" -#: ../../library/webbrowser.rst:129 +#: ../../library/webbrowser.rst:138 msgid "Type Name" msgstr "類型名稱" -#: ../../library/webbrowser.rst:129 +#: ../../library/webbrowser.rst:138 msgid "Class Name" msgstr "類別名稱" -#: ../../library/webbrowser.rst:129 +#: ../../library/webbrowser.rst:138 msgid "Notes" msgstr "註解" -#: ../../library/webbrowser.rst:131 +#: ../../library/webbrowser.rst:140 msgid "``'mozilla'``" msgstr "``'mozilla'``" -#: ../../library/webbrowser.rst:131 ../../library/webbrowser.rst:133 +#: ../../library/webbrowser.rst:140 ../../library/webbrowser.rst:142 msgid "``Mozilla('mozilla')``" msgstr "``Mozilla('mozilla')``" -#: ../../library/webbrowser.rst:133 +#: ../../library/webbrowser.rst:142 msgid "``'firefox'``" msgstr "``'firefox'``" -#: ../../library/webbrowser.rst:135 +#: ../../library/webbrowser.rst:144 msgid "``'epiphany'``" msgstr "``'epiphany'``" -#: ../../library/webbrowser.rst:135 +#: ../../library/webbrowser.rst:144 msgid "``Epiphany('epiphany')``" msgstr "``Epiphany('epiphany')``" -#: ../../library/webbrowser.rst:137 +#: ../../library/webbrowser.rst:146 msgid "``'kfmclient'``" msgstr "``'kfmclient'``" -#: ../../library/webbrowser.rst:137 ../../library/webbrowser.rst:139 -#: ../../library/webbrowser.rst:141 +#: ../../library/webbrowser.rst:146 ../../library/webbrowser.rst:148 +#: ../../library/webbrowser.rst:150 msgid "``Konqueror()``" msgstr "``Konqueror()``" -#: ../../library/webbrowser.rst:137 ../../library/webbrowser.rst:139 -#: ../../library/webbrowser.rst:141 +#: ../../library/webbrowser.rst:146 ../../library/webbrowser.rst:148 +#: ../../library/webbrowser.rst:150 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/webbrowser.rst:139 +#: ../../library/webbrowser.rst:148 msgid "``'konqueror'``" msgstr "``'konqueror'``" -#: ../../library/webbrowser.rst:141 +#: ../../library/webbrowser.rst:150 msgid "``'kfm'``" msgstr "``'kfm'``" -#: ../../library/webbrowser.rst:143 +#: ../../library/webbrowser.rst:152 msgid "``'opera'``" msgstr "``'opera'``" -#: ../../library/webbrowser.rst:143 +#: ../../library/webbrowser.rst:152 msgid "``Opera()``" msgstr "``Opera()``" -#: ../../library/webbrowser.rst:145 +#: ../../library/webbrowser.rst:154 msgid "``'links'``" msgstr "``'links'``" -#: ../../library/webbrowser.rst:145 +#: ../../library/webbrowser.rst:154 msgid "``GenericBrowser('links')``" msgstr "``GenericBrowser('links')``" -#: ../../library/webbrowser.rst:147 +#: ../../library/webbrowser.rst:156 msgid "``'elinks'``" msgstr "``'elinks'``" -#: ../../library/webbrowser.rst:147 +#: ../../library/webbrowser.rst:156 msgid "``Elinks('elinks')``" msgstr "``Elinks('elinks')``" -#: ../../library/webbrowser.rst:149 +#: ../../library/webbrowser.rst:158 msgid "``'lynx'``" msgstr "``'lynx'``" -#: ../../library/webbrowser.rst:149 +#: ../../library/webbrowser.rst:158 msgid "``GenericBrowser('lynx')``" msgstr "``GenericBrowser('lynx')``" -#: ../../library/webbrowser.rst:151 +#: ../../library/webbrowser.rst:160 msgid "``'w3m'``" msgstr "``'w3m'``" -#: ../../library/webbrowser.rst:151 +#: ../../library/webbrowser.rst:160 msgid "``GenericBrowser('w3m')``" msgstr "``GenericBrowser('w3m')``" -#: ../../library/webbrowser.rst:153 +#: ../../library/webbrowser.rst:162 msgid "``'windows-default'``" msgstr "``'windows-default'``" -#: ../../library/webbrowser.rst:153 +#: ../../library/webbrowser.rst:162 msgid "``WindowsDefault``" msgstr "``WindowsDefault``" -#: ../../library/webbrowser.rst:153 +#: ../../library/webbrowser.rst:162 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/webbrowser.rst:155 +#: ../../library/webbrowser.rst:164 msgid "``'macosx'``" msgstr "``'macosx'``" -#: ../../library/webbrowser.rst:155 +#: ../../library/webbrowser.rst:164 msgid "``MacOSXOSAScript('default')``" msgstr "``MacOSXOSAScript('default')``" -#: ../../library/webbrowser.rst:155 ../../library/webbrowser.rst:157 +#: ../../library/webbrowser.rst:164 ../../library/webbrowser.rst:166 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/webbrowser.rst:157 +#: ../../library/webbrowser.rst:166 msgid "``'safari'``" msgstr "``'safari'``" -#: ../../library/webbrowser.rst:157 +#: ../../library/webbrowser.rst:166 msgid "``MacOSXOSAScript('safari')``" msgstr "``MacOSXOSAScript('safari')``" -#: ../../library/webbrowser.rst:159 +#: ../../library/webbrowser.rst:168 msgid "``'google-chrome'``" msgstr "``'google-chrome'``" -#: ../../library/webbrowser.rst:159 +#: ../../library/webbrowser.rst:168 msgid "``Chrome('google-chrome')``" msgstr "``Chrome('google-chrome')``" -#: ../../library/webbrowser.rst:161 +#: ../../library/webbrowser.rst:170 msgid "``'chrome'``" msgstr "``'chrome'``" -#: ../../library/webbrowser.rst:161 +#: ../../library/webbrowser.rst:170 msgid "``Chrome('chrome')``" msgstr "``Chrome('chrome')``" -#: ../../library/webbrowser.rst:163 +#: ../../library/webbrowser.rst:172 msgid "``'chromium'``" msgstr "``'chromium'``" -#: ../../library/webbrowser.rst:163 +#: ../../library/webbrowser.rst:172 msgid "``Chromium('chromium')``" msgstr "``Chromium('chromium')``" -#: ../../library/webbrowser.rst:165 +#: ../../library/webbrowser.rst:174 msgid "``'chromium-browser'``" msgstr "``'chromium-browser'``" -#: ../../library/webbrowser.rst:165 +#: ../../library/webbrowser.rst:174 msgid "``Chromium('chromium-browser')``" msgstr "``Chromium('chromium-browser')``" -#: ../../library/webbrowser.rst:167 +#: ../../library/webbrowser.rst:176 msgid "``'iosbrowser'``" msgstr "``'iosbrowser'``" -#: ../../library/webbrowser.rst:167 +#: ../../library/webbrowser.rst:176 msgid "``IOSBrowser``" msgstr "``IOSBrowser``" -#: ../../library/webbrowser.rst:167 +#: ../../library/webbrowser.rst:176 msgid "\\(4)" msgstr "\\(4)" -#: ../../library/webbrowser.rst:170 +#: ../../library/webbrowser.rst:179 msgid "Notes:" msgstr "註解:" -#: ../../library/webbrowser.rst:173 +#: ../../library/webbrowser.rst:182 msgid "" "\"Konqueror\" is the file manager for the KDE desktop environment for Unix, " "and only makes sense to use if KDE is running. Some way of reliably " @@ -417,19 +419,19 @@ msgstr "" "請注意,即使在 KDE 2 中使用 :program:`konqueror` 命令時,也會使用 \"kfm\" 名" "稱 --- 該實作會選擇執行 Konqueror 的最佳策略。" -#: ../../library/webbrowser.rst:180 +#: ../../library/webbrowser.rst:189 msgid "Only on Windows platforms." msgstr "僅在 Windows 平台上。" -#: ../../library/webbrowser.rst:183 +#: ../../library/webbrowser.rst:192 msgid "Only on macOS." msgstr "僅在 macOS 上。" -#: ../../library/webbrowser.rst:186 +#: ../../library/webbrowser.rst:195 msgid "Only on iOS." msgstr "僅在 iOS 上。" -#: ../../library/webbrowser.rst:188 +#: ../../library/webbrowser.rst:197 msgid "" "A new :class:`!MacOSXOSAScript` class has been added and is used on Mac " "instead of the previous :class:`!MacOSX` class. This adds support for " @@ -438,11 +440,11 @@ msgstr "" "新增了 :class:`!MacOSXOSAScript` 類別並於 Mac 上使用,而非使用先前的 :class:" "`!MacOSX` 類別。這增加了對開啟目前未設定為作業系統預設之瀏覽器的支援。" -#: ../../library/webbrowser.rst:193 +#: ../../library/webbrowser.rst:202 msgid "Support for Chrome/Chromium has been added." msgstr "新增了對 Chrome/Chromium 的支援。" -#: ../../library/webbrowser.rst:196 +#: ../../library/webbrowser.rst:205 msgid "" "Support for several obsolete browsers has been removed. Removed browsers " "include Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, and Firefox " @@ -451,15 +453,15 @@ msgstr "" "對多個過時瀏覽器的支援已被刪除。已刪除的瀏覽器包括 Grail、Mosaic、Netscape、" "Galeon、Skipstone、Iceape 和 Firefox 35 及以下版本。" -#: ../../library/webbrowser.rst:201 +#: ../../library/webbrowser.rst:210 msgid "Support for iOS has been added." msgstr "新增了對 iOS 的支援。" -#: ../../library/webbrowser.rst:204 +#: ../../library/webbrowser.rst:213 msgid "Here are some simple examples::" msgstr "以下是一些簡單範例: ::" -#: ../../library/webbrowser.rst:206 +#: ../../library/webbrowser.rst:215 msgid "" "url = 'https://docs.python.org/'\n" "\n" @@ -477,21 +479,21 @@ msgstr "" "# 在新視窗中開啟 URL,如果可能的話提升視窗。\n" "webbrowser.open_new(url)" -#: ../../library/webbrowser.rst:218 +#: ../../library/webbrowser.rst:227 msgid "Browser Controller Objects" msgstr "瀏覽器控制器物件" -#: ../../library/webbrowser.rst:220 +#: ../../library/webbrowser.rst:229 msgid "" "Browser controllers provide these methods which parallel three of the module-" "level convenience functions:" msgstr "瀏覽器控制器提供了這些與三個模組層級便利函式相同的方法:" -#: ../../library/webbrowser.rst:226 +#: ../../library/webbrowser.rst:235 msgid "System-dependent name for the browser." msgstr "瀏覽器的系統相依名稱 (system-dependent name)。" -#: ../../library/webbrowser.rst:231 +#: ../../library/webbrowser.rst:240 msgid "" "Display *url* using the browser handled by this controller. If *new* is 1, a " "new browser window is opened if possible. If *new* is 2, a new browser page " @@ -500,7 +502,7 @@ msgstr "" "使用此控制器處理的瀏覽器顯示 *url*。如果 *new* 為 1,則盡可能開啟一個新的瀏覽" "器視窗。如果 *new* 為 2,則盡可能開啟一個新的瀏覽器分頁 (\"tab\")。" -#: ../../library/webbrowser.rst:238 +#: ../../library/webbrowser.rst:247 msgid "" "Open *url* in a new window of the browser handled by this controller, if " "possible, otherwise, open *url* in the only browser window. Alias :func:" @@ -509,7 +511,7 @@ msgstr "" "盡可能在此控制器處理的瀏覽器的新視窗中開啟 *url*,否則在唯一的瀏覽器視窗中開" "啟 *url*。別名為 :func:`open_new`。" -#: ../../library/webbrowser.rst:245 +#: ../../library/webbrowser.rst:254 msgid "" "Open *url* in a new page (\"tab\") of the browser handled by this " "controller, if possible, otherwise equivalent to :func:`open_new`." @@ -517,11 +519,11 @@ msgstr "" "盡可能在此控制器處理的瀏覽器的新分頁 (\"tab\") 中開啟 *url*,否則相當於 :" "func:`open_new`。" -#: ../../library/webbrowser.rst:250 +#: ../../library/webbrowser.rst:259 msgid "Footnotes" msgstr "註腳" -#: ../../library/webbrowser.rst:251 +#: ../../library/webbrowser.rst:260 msgid "" "Executables named here without a full path will be searched in the " "directories given in the :envvar:`PATH` environment variable." diff --git a/library/winsound.po b/library/winsound.po index f51aa90496..0113d36816 100644 --- a/library/winsound.po +++ b/library/winsound.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-03-17 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -188,18 +188,25 @@ msgstr "" msgid "Return immediately if the sound driver is busy." msgstr "" -#: ../../library/winsound.rst:140 ../../library/winsound.rst:160 +#: ../../library/winsound.rst:140 +msgid "" +"The *sound* parameter is an application-specific alias in the registry. This " +"flag can be combined with the :const:`SND_ALIAS` flag to specify an " +"application-defined sound alias." +msgstr "" + +#: ../../library/winsound.rst:147 ../../library/winsound.rst:167 msgid "Play the ``SystemDefault`` sound." msgstr "播放 ``SystemDefault`` 聲音。" -#: ../../library/winsound.rst:145 +#: ../../library/winsound.rst:152 msgid "Play the ``SystemExclamation`` sound." msgstr "播放 ``SystemExclamation`` 聲音。" -#: ../../library/winsound.rst:150 +#: ../../library/winsound.rst:157 msgid "Play the ``SystemHand`` sound." msgstr "播放 ``SystemHand`` 聲音。" -#: ../../library/winsound.rst:155 +#: ../../library/winsound.rst:162 msgid "Play the ``SystemQuestion`` sound." msgstr "播放 ``SystemQuestion`` 聲音。" diff --git a/library/wsgiref.po b/library/wsgiref.po index 240292a6a8..66b54b9ee9 100644 --- a/library/wsgiref.po +++ b/library/wsgiref.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-02-25 00:14+0000\n" "PO-Revision-Date: 2023-12-09 21:29+0800\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -81,13 +81,14 @@ msgid "" "environments. A WSGI environment is a dictionary containing HTTP request " "variables as described in :pep:`3333`. All of the functions taking an " "*environ* parameter expect a WSGI-compliant dictionary to be supplied; " -"please see :pep:`3333` for a detailed specification and :data:`~wsgiref." -"types.WSGIEnvironment` for a type alias that can be used in type annotations." +"please see :pep:`3333` for a detailed specification " +"and :data:`~wsgiref.types.WSGIEnvironment` for a type alias that can be used " +"in type annotations." msgstr "" "這個模組提供許多用於處理 WSGI 環境運作的功能。WSGI 環境是一個包含 HTTP 請求變" "數的字典,如 :pep:`3333` 所述。所有接受 *environ* 的參數的函式都需要提供符合 " -"WSGI 標準的字典;請參閱 :pep:`3333` 獲取詳細規格,以及 :data:`~wsgiref.types." -"WSGIEnvironment` 獲取可用於使用型別註釋的型別別名。" +"WSGI 標準的字典;請參閱 :pep:`3333` 獲取詳細規格,以" +"及 :data:`~wsgiref.types.WSGIEnvironment` 獲取可用於使用型別註釋的型別別名。" #: ../../library/wsgiref.rst:56 msgid "" @@ -107,9 +108,9 @@ msgid "" "a value is found, and \"http\" otherwise." msgstr "" "當建立一個包裝 CGI 或類似 FastCGI 的 CGI-like 協議閘道時,此函式非常有用。例" -"如 FastCGI,通常提供這類協議的伺服器在通過 SSL 接收到請求時會包含 " -"\"1\",\"yes\",或 \"on\" 的 ``HTTPS`` 變數,因此,如果找到這樣的值,此函式回" -"傳 \"https\",否則回傳 \"http\"。" +"如 FastCGI,通常提供這類協議的伺服器在通過 SSL 接收到請求時會包含 \"1\"," +"\"yes\",或 \"on\" 的 ``HTTPS`` 變數,因此,如果找到這樣的值,此函式回傳 " +"\"https\",否則回傳 \"http\"。" #: ../../library/wsgiref.rst:69 msgid "" @@ -154,11 +155,11 @@ msgid "" "routine modifies the passed-in environment to make it suitable for invoking " "another WSGI application that is located at the target URI. For example, if " "there is a WSGI application at ``/foo``, and the request URI path is ``/foo/" -"bar/baz``, and the WSGI application at ``/foo`` calls :func:" -"`shift_path_info`, it will receive the string \"bar\", and the environment " -"will be updated to be suitable for passing to a WSGI application at ``/foo/" -"bar``. That is, ``SCRIPT_NAME`` will change from ``/foo`` to ``/foo/bar``, " -"and ``PATH_INFO`` will change from ``/bar/baz`` to ``/baz``." +"bar/baz``, and the WSGI application at ``/foo`` " +"calls :func:`shift_path_info`, it will receive the string \"bar\", and the " +"environment will be updated to be suitable for passing to a WSGI application " +"at ``/foo/bar``. That is, ``SCRIPT_NAME`` will change from ``/foo`` to ``/" +"foo/bar``, and ``PATH_INFO`` will change from ``/bar/baz`` to ``/baz``." msgstr "" "通常,此程式用於處理請求 URI 的每一部分路徑,例如將路徑視為一系列的字典鍵此程" "式會修改傳入的環境,使其適用於呼叫位於目標 URI 的 WSGI 應用程式。例如,如果" @@ -190,9 +191,9 @@ msgstr "為測試目的,以簡單的預設值更新 *environ* 。" msgid "" "This routine adds various parameters required for WSGI, including " "``HTTP_HOST``, ``SERVER_NAME``, ``SERVER_PORT``, ``REQUEST_METHOD``, " -"``SCRIPT_NAME``, ``PATH_INFO``, and all of the :pep:`3333`\\ -defined ``wsgi." -"*`` variables. It only supplies default values, and does not replace any " -"existing settings for these variables." +"``SCRIPT_NAME``, ``PATH_INFO``, and all of the :pep:`3333`\\ -defined " +"``wsgi.*`` variables. It only supplies default values, and does not replace " +"any existing settings for these variables." msgstr "" "這個程式新增 WSGI 所需的各種參數,包括 ``HTTP_HOST``、``SERVER_NAME``、" "``SERVER_PORT``、``REQUEST_METHOD``、``SCRIPT_NAME``、``PATH_INFO``,以及所" @@ -208,12 +209,13 @@ msgstr "" "這個程式目的為了讓 WSGI 伺服器和應用程式的單元測試更容易建置虛擬環境。實際的 " "WSGI 伺服器或應用程式不應該使用它,因為所產生的數據是假的!" -#: ../../library/wsgiref.rst:122 ../../library/wsgiref.rst:170 -#: ../../library/wsgiref.rst:293 ../../library/wsgiref.rst:426 -msgid "Example usage::" -msgstr "用法範例: ::" +#: ../../library/wsgiref.rst:122 +msgid "" +"Example usage (see also :func:`~wsgiref.simple_server.demo_app` for another " +"example)::" +msgstr "" -#: ../../library/wsgiref.rst:124 +#: ../../library/wsgiref.rst:125 msgid "" "from wsgiref.util import setup_testing_defaults\n" "from wsgiref.simple_server import make_server\n" @@ -237,13 +239,13 @@ msgid "" " httpd.serve_forever()" msgstr "" -#: ../../library/wsgiref.rst:146 +#: ../../library/wsgiref.rst:147 msgid "" "In addition to the environment functions above, the :mod:`wsgiref.util` " "module also provides these miscellaneous utilities:" msgstr "除了上述的環境功能外,:mod:`wsgiref.util` 模組還提供以下各類工具:" -#: ../../library/wsgiref.rst:152 +#: ../../library/wsgiref.rst:153 msgid "" "Return ``True`` if 'header_name' is an HTTP/1.1 \"Hop-by-Hop\" header, as " "defined by :rfc:`2616`." @@ -251,31 +253,37 @@ msgstr "" "如果 'header_name' 是根據 :rfc:`2616` 所定義的 HTTP/1.1 \"Hop-by-Hop\" 標頭," "則回傳 ``True``。" -#: ../../library/wsgiref.rst:158 +#: ../../library/wsgiref.rst:159 msgid "" "A concrete implementation of the :class:`wsgiref.types.FileWrapper` protocol " "used to convert a file-like object to an :term:`iterator`. The resulting " "objects are :term:`iterable`\\ s. As the object is iterated over, the " "optional *blksize* parameter will be repeatedly passed to the *filelike* " -"object's :meth:`read` method to obtain bytestrings to yield. When :meth:" -"`read` returns an empty bytestring, iteration is ended and is not resumable." +"object's :meth:`read` method to obtain bytestrings to yield. " +"When :meth:`read` returns an empty bytestring, iteration is ended and is not " +"resumable." msgstr "" -":class:`wsgiref.types.FileWrapper` 協議的具體實作,用於將類檔案物件轉換為 :" -"term:`iterator`。產生的物件是 :term:`iterable`。當物件進行疊代時,將可選的 " -"*blksize* 引數重複傳遞給 *filelike* 物件的 :meth:`read` 方法來獲得將產生" +":class:`wsgiref.types.FileWrapper` 協議的具體實作,用於將類檔案物件轉換" +"為 :term:`iterator`。產生的物件是 :term:`iterable`。當物件進行疊代時,將可選" +"的 *blksize* 引數重複傳遞給 *filelike* 物件的 :meth:`read` 方法來獲得將產生" "(yield)的位元組字串。當 :meth:`read` 回傳一個空位元組字串,代表疊代已結束且" "無法回復。" -#: ../../library/wsgiref.rst:166 +#: ../../library/wsgiref.rst:167 msgid "" "If *filelike* has a :meth:`close` method, the returned object will also have " -"a :meth:`close` method, and it will invoke the *filelike* object's :meth:" -"`close` method when called." +"a :meth:`close` method, and it will invoke the *filelike* " +"object's :meth:`close` method when called." msgstr "" "如果 *filelike* 有 :meth:`close` 方法,則回傳的物件也會具有 :meth:`close` 方" "法,並在呼叫時呼叫 *filelike* 物件的 :meth:`close` 方法。" -#: ../../library/wsgiref.rst:172 +#: ../../library/wsgiref.rst:171 ../../library/wsgiref.rst:294 +#: ../../library/wsgiref.rst:429 +msgid "Example usage::" +msgstr "用法範例: ::" + +#: ../../library/wsgiref.rst:173 msgid "" "from io import StringIO\n" "from wsgiref.util import FileWrapper\n" @@ -288,15 +296,15 @@ msgid "" " print(chunk)" msgstr "" -#: ../../library/wsgiref.rst:182 +#: ../../library/wsgiref.rst:183 msgid "Support for :meth:`~object.__getitem__` method has been removed." msgstr "已移除對 :meth:`~object.__getitem__` 方法的支援。" -#: ../../library/wsgiref.rst:187 +#: ../../library/wsgiref.rst:188 msgid ":mod:`wsgiref.headers` -- WSGI response header tools" msgstr ":mod:`wsgiref.headers` -- WSGI 回應標頭工具" -#: ../../library/wsgiref.rst:193 +#: ../../library/wsgiref.rst:194 msgid "" "This module provides a single class, :class:`Headers`, for convenient " "manipulation of WSGI response headers using a mapping-like interface." @@ -304,7 +312,7 @@ msgstr "" "這個模組提供單一類別 :class:`Headers`,用於使用類似對映的介面方便地操作 WSGI " "回應標頭。" -#: ../../library/wsgiref.rst:199 +#: ../../library/wsgiref.rst:200 msgid "" "Create a mapping-like object wrapping *headers*, which must be a list of " "header name/value tuples as described in :pep:`3333`. The default value of " @@ -313,26 +321,25 @@ msgstr "" "建立一個類似對映物件並包裝 *headers*,並且必須是符合 :pep:`3333` 描述的 name/" "value 元組的標頭串列。*headers* 的預設值是一個空串列。" -#: ../../library/wsgiref.rst:203 +#: ../../library/wsgiref.rst:204 msgid "" -":class:`Headers` objects support typical mapping operations including :meth:" -"`~object.__getitem__`, :meth:`~dict.get`, :meth:`~object.__setitem__`, :meth:" -"`~dict.setdefault`, :meth:`~object.__delitem__` and :meth:`~object." -"__contains__`. For each of these methods, the key is the header name " -"(treated case-insensitively), and the value is the first value associated " -"with that header name. Setting a header deletes any existing values for " -"that header, then adds a new value at the end of the wrapped header list. " -"Headers' existing order is generally maintained, with new headers added to " -"the end of the wrapped list." +":class:`Headers` objects support typical mapping operations " +"including :meth:`~object.__getitem__`, :meth:`~dict.get`, :meth:`~object.__setitem__`, :meth:`~dict.setdefault`, :meth:`~object.__delitem__` " +"and :meth:`~object.__contains__`. For each of these methods, the key is the " +"header name (treated case-insensitively), and the value is the first value " +"associated with that header name. Setting a header deletes any existing " +"values for that header, then adds a new value at the end of the wrapped " +"header list. Headers' existing order is generally maintained, with new " +"headers added to the end of the wrapped list." msgstr "" -":class:`Headers` 物件支援典型對映操作包括 :meth:`__getitem__`、:meth:`~dict." -"get`、:meth:`~object.__setitem__`、:meth:`~dict.setdefault`、:meth:`~object." -"__delitem__` 以及 :meth:`~object.__contains__`。對於這些方法中的每一個,鍵是" -"標頭名稱(以不區分大小寫方式處理),而值則是與該標頭名稱關聯的第一個值。設定" -"標頭會刪除該標頭的所有現有值,然後將新值添加到包裝的標頭串列末尾。標頭的現有" -"順序通常保持不變,新標頭會添加到包裝串列的末尾。" +":class:`Headers` 物件支援典型對映操作包" +"括 :meth:`__getitem__`、:meth:`~dict.get`、:meth:`~object.__setitem__`、:meth:`~dict.setdefault`、:meth:`~object.__delitem__` " +"以及 :meth:`~object.__contains__`。對於這些方法中的每一個,鍵是標頭名稱(以不" +"區分大小寫方式處理),而值則是與該標頭名稱關聯的第一個值。設定標頭會刪除該標" +"頭的所有現有值,然後將新值添加到包裝的標頭串列末尾。標頭的現有順序通常保持不" +"變,新標頭會添加到包裝串列的末尾。" -#: ../../library/wsgiref.rst:213 +#: ../../library/wsgiref.rst:214 msgid "" "Unlike a dictionary, :class:`Headers` objects do not raise an error when you " "try to get or delete a key that isn't in the wrapped header list. Getting a " @@ -343,22 +350,22 @@ msgstr "" "不會引發例外錯誤。取得不存在的標頭只會回傳 ``None``,而刪除不存在的標頭則不會" "有任何效果。" -#: ../../library/wsgiref.rst:218 +#: ../../library/wsgiref.rst:219 msgid "" -":class:`Headers` objects also support :meth:`keys`, :meth:`values`, and :" -"meth:`items` methods. The lists returned by :meth:`keys` and :meth:`items` " -"can include the same key more than once if there is a multi-valued header. " -"The ``len()`` of a :class:`Headers` object is the same as the length of its :" -"meth:`items`, which is the same as the length of the wrapped header list. " -"In fact, the :meth:`items` method just returns a copy of the wrapped header " -"list." +":class:`Headers` objects also support :meth:`keys`, :meth:`values`, " +"and :meth:`items` methods. The lists returned by :meth:`keys` " +"and :meth:`items` can include the same key more than once if there is a " +"multi-valued header. The ``len()`` of a :class:`Headers` object is the same " +"as the length of its :meth:`items`, which is the same as the length of the " +"wrapped header list. In fact, the :meth:`items` method just returns a copy " +"of the wrapped header list." msgstr "" ":class:`Headers` 物件還支援 :meth:`keys`、:meth:`value`、和 :meth:`items` 方" "法。由 :meth:`keys` 和 :meth:`items` 回傳的串列在存在多值標頭時可能會包含相同" "的鍵。:class:`Headers` 物件的 ``len()`` 與 :meth:`items` 的長度相同,也與包裝" "標頭串列的長度相同。實際上,:meth:`items` 方法只是回傳包裝的標頭串列的副本。" -#: ../../library/wsgiref.rst:225 +#: ../../library/wsgiref.rst:226 msgid "" "Calling ``bytes()`` on a :class:`Headers` object returns a formatted " "bytestring suitable for transmission as HTTP response headers. Each header " @@ -370,20 +377,21 @@ msgstr "" "式化的位元組字串。每個標頭都與其值一起置於一行上,由冒號與空格分隔。每行以回" "車(carriage return)和換行(line feed)結束,而該位元組字串則以空行結束。" -#: ../../library/wsgiref.rst:231 +#: ../../library/wsgiref.rst:232 msgid "" -"In addition to their mapping interface and formatting features, :class:" -"`Headers` objects also have the following methods for querying and adding " -"multi-valued headers, and for adding headers with MIME parameters:" +"In addition to their mapping interface and formatting " +"features, :class:`Headers` objects also have the following methods for " +"querying and adding multi-valued headers, and for adding headers with MIME " +"parameters:" msgstr "" "除了對映介面和格式化功能外,:class:`Headers` 物件還具有以下查詢及附加多值標頭" "的以及附加 MIME 參數標頭的方法:" -#: ../../library/wsgiref.rst:238 +#: ../../library/wsgiref.rst:239 msgid "Return a list of all the values for the named header." msgstr "回傳指定標頭的所有值的串列。" -#: ../../library/wsgiref.rst:240 +#: ../../library/wsgiref.rst:241 msgid "" "The returned list will be sorted in the order they appeared in the original " "header list or were added to this instance, and may contain duplicates. Any " @@ -394,14 +402,14 @@ msgstr "" "序,並且可能包含重複的內容。任何被刪除並重新插入的欄位都會被添加到標頭串列的" "末尾。如果不存在指定名稱的欄位,則回傳空串列。" -#: ../../library/wsgiref.rst:248 +#: ../../library/wsgiref.rst:249 msgid "" "Add a (possibly multi-valued) header, with optional MIME parameters " "specified via keyword arguments." msgstr "" "添加一個(可能是多值的)標頭,可通過關鍵字引數來指定選擇性的 MIME 參數。" -#: ../../library/wsgiref.rst:251 +#: ../../library/wsgiref.rst:252 msgid "" "*name* is the header field to add. Keyword arguments can be used to set " "MIME parameters for the header field. Each parameter must be a string or " @@ -418,55 +426,55 @@ msgstr "" "則以 ``name=\"value\"`` 的形式添加到標頭值參數中。如果它是 ``None``,則僅添加" "參數名稱。(這使用於沒有值的 MIME 參數)使用範例: ::" -#: ../../library/wsgiref.rst:259 +#: ../../library/wsgiref.rst:260 msgid "h.add_header('content-disposition', 'attachment', filename='bud.gif')" msgstr "h.add_header('content-disposition', 'attachment', filename='bud.gif')" -#: ../../library/wsgiref.rst:261 +#: ../../library/wsgiref.rst:262 msgid "The above will add a header that looks like this::" msgstr "上述操作將添加看起來像這樣的標頭: ::" -#: ../../library/wsgiref.rst:263 +#: ../../library/wsgiref.rst:264 msgid "Content-Disposition: attachment; filename=\"bud.gif\"" msgstr "Content-Disposition: attachment; filename=\"bud.gif\"" -#: ../../library/wsgiref.rst:266 +#: ../../library/wsgiref.rst:267 msgid "*headers* parameter is optional." msgstr "*headers* 參數是可選的。" -#: ../../library/wsgiref.rst:271 +#: ../../library/wsgiref.rst:272 msgid ":mod:`wsgiref.simple_server` -- a simple WSGI HTTP server" msgstr ":mod:`wsgiref.simple_server` -- 一個簡單的 WSGI HTTP 伺服器" -#: ../../library/wsgiref.rst:277 +#: ../../library/wsgiref.rst:278 msgid "" "This module implements a simple HTTP server (based on :mod:`http.server`) " "that serves WSGI applications. Each server instance serves a single WSGI " "application on a given host and port. If you want to serve multiple " "applications on a single host and port, you should create a WSGI application " "that parses ``PATH_INFO`` to select which application to invoke for each " -"request. (E.g., using the :func:`shift_path_info` function from :mod:" -"`wsgiref.util`.)" +"request. (E.g., using the :func:`shift_path_info` function " +"from :mod:`wsgiref.util`.)" msgstr "" "這個模組實作一個簡單的的 HTTP 伺服器(基於 :mod:`http.server`)用於提供 WSGI " "應用程式。每個伺服器執行個體在特定的主機與埠提供單一的 WSGI 應用程式。如果你" "想要在單一主機與埠上提供多個應用程式,你應該建立一個 WSGI 應用程式以剖析 " -"``PATH_INFO`` 去選擇為每個請求呼叫哪個應用程式。(例如,使用來自 :mod:" -"`wsgiref.util` 的 :func:`shift_path_info` 函式。)" +"``PATH_INFO`` 去選擇為每個請求呼叫哪個應用程式。(例如,使用來" +"自 :mod:`wsgiref.util` 的 :func:`shift_path_info` 函式。)" -#: ../../library/wsgiref.rst:288 +#: ../../library/wsgiref.rst:289 msgid "" "Create a new WSGI server listening on *host* and *port*, accepting " "connections for *app*. The return value is an instance of the supplied " "*server_class*, and will process requests using the specified " -"*handler_class*. *app* must be a WSGI application object, as defined by :" -"pep:`3333`." +"*handler_class*. *app* must be a WSGI application object, as defined " +"by :pep:`3333`." msgstr "" "建立一個新的 WSGI 伺服器監聽 *host* 和 *port*,接受 *app* 的連線。回傳值是提" "供 *server_class* 的實例,並將使用指定的 *handler_class* 處理請求。*app* 必須" "是一個 WSGI 應用程式物件,如 :pep:`3333` 所定義。" -#: ../../library/wsgiref.rst:295 +#: ../../library/wsgiref.rst:296 msgid "" "from wsgiref.simple_server import make_server, demo_app\n" "\n" @@ -480,7 +488,7 @@ msgid "" " httpd.handle_request()" msgstr "" -#: ../../library/wsgiref.rst:309 +#: ../../library/wsgiref.rst:310 msgid "" "This function is a small but complete WSGI application that returns a text " "page containing the message \"Hello world!\" and a list of the key/value " @@ -493,77 +501,85 @@ msgstr "" "(例如 :mod:`wsgiref.simple_server`)是否能正確執行簡單的 WSGI 應用程式非常有" "用。" -#: ../../library/wsgiref.rst:318 +#: ../../library/wsgiref.rst:316 msgid "" -"Create a :class:`WSGIServer` instance. *server_address* should be a ``(host," -"port)`` tuple, and *RequestHandlerClass* should be the subclass of :class:" -"`http.server.BaseHTTPRequestHandler` that will be used to process requests." +"The *start_response* callable should follow the :class:`.StartResponse` " +"protocol." +msgstr "" + +#: ../../library/wsgiref.rst:321 +msgid "" +"Create a :class:`WSGIServer` instance. *server_address* should be a " +"``(host,port)`` tuple, and *RequestHandlerClass* should be the subclass " +"of :class:`http.server.BaseHTTPRequestHandler` that will be used to process " +"requests." msgstr "" "建立一個 :class:`WSGIServer` 實例。*server_address* 應該是一個 ``(host, " -"port)`` 元組,而 *RequestHandlerClass* 應該是 :class:`http.server." -"BaseHTTPRequestHandler` 的子類別,將用於處理請求。" +"port)`` 元組,而 *RequestHandlerClass* 應該" +"是 :class:`http.server.BaseHTTPRequestHandler` 的子類別,將用於處理請求。" -#: ../../library/wsgiref.rst:323 +#: ../../library/wsgiref.rst:326 msgid "" -"You do not normally need to call this constructor, as the :func:" -"`make_server` function can handle all the details for you." +"You do not normally need to call this constructor, as " +"the :func:`make_server` function can handle all the details for you." msgstr "" "通常你不需要呼叫這個建構函式(constructor),因為 :func:`make_server` 函式可" "以為你處理所有細節。" -#: ../../library/wsgiref.rst:326 +#: ../../library/wsgiref.rst:329 msgid "" ":class:`WSGIServer` is a subclass of :class:`http.server.HTTPServer`, so all " "of its methods (such as :meth:`serve_forever` and :meth:`handle_request`) " "are available. :class:`WSGIServer` also provides these WSGI-specific methods:" msgstr "" ":class:`WSGIServer` 是 :class:`http.server.HTTPServer` 的子類別,因此它的所有" -"方法(例如 :meth:`serve_forever` 和 :meth:`handle_request`)都可用。:class:" -"`WSGIServer` 也提供這些特定於 WSGI 的方法:" +"方法(例如 :meth:`serve_forever` 和 :meth:`handle_request`)都可" +"用。:class:`WSGIServer` 也提供這些特定於 WSGI 的方法:" -#: ../../library/wsgiref.rst:333 +#: ../../library/wsgiref.rst:336 msgid "" "Sets the callable *application* as the WSGI application that will receive " "requests." msgstr "將可呼叫的 *application* 設定為接收請求的 WSGI 應用程式。" -#: ../../library/wsgiref.rst:339 +#: ../../library/wsgiref.rst:342 msgid "Returns the currently set application callable." msgstr "回傳目前設定應用程式的可呼叫物件。" -#: ../../library/wsgiref.rst:341 +#: ../../library/wsgiref.rst:344 msgid "" -"Normally, however, you do not need to use these additional methods, as :meth:" -"`set_app` is normally called by :func:`make_server`, and the :meth:`get_app` " -"exists mainly for the benefit of request handler instances." +"Normally, however, you do not need to use these additional methods, " +"as :meth:`set_app` is normally called by :func:`make_server`, and " +"the :meth:`get_app` exists mainly for the benefit of request handler " +"instances." msgstr "" -"然而,通常情況下你不需要去使用這些額外方法,因為 :meth:`set_app` 通常會被 :" -"func:`make_server` 呼叫而 :meth:`get_app` 主要存在於請求處理程式(handler)實" -"例的好處上。" +"然而,通常情況下你不需要去使用這些額外方法,因為 :meth:`set_app` 通常會" +"被 :func:`make_server` 呼叫而 :meth:`get_app` 主要存在於請求處理程式" +"(handler)實例的好處上。" -#: ../../library/wsgiref.rst:348 +#: ../../library/wsgiref.rst:351 msgid "" "Create an HTTP handler for the given *request* (i.e. a socket), " -"*client_address* (a ``(host,port)`` tuple), and *server* (:class:" -"`WSGIServer` instance)." +"*client_address* (a ``(host,port)`` tuple), and *server* " +"(:class:`WSGIServer` instance)." msgstr "" "為給定的 *request*(即一個 socket)、*client_address*(一個 ``(host,port)`` " "位元組)、*server* (:class:`WSGIServer` 實例) 建立一個 HTTP 處理程式" "(handler)。" -#: ../../library/wsgiref.rst:351 +#: ../../library/wsgiref.rst:354 msgid "" "You do not need to create instances of this class directly; they are " "automatically created as needed by :class:`WSGIServer` objects. You can, " -"however, subclass this class and supply it as a *handler_class* to the :func:" -"`make_server` function. Some possibly relevant methods for overriding in " -"subclasses:" +"however, subclass this class and supply it as a *handler_class* to " +"the :func:`make_server` function. Some possibly relevant methods for " +"overriding in subclasses:" msgstr "" "你不需要直接建立這個類別的實例;它們會在需要時由 :class:`WSGIServer` 物件自動" -"建立。不過,你可以建立這個類別的子類別並將其作為 *handler_class* 提供給 :" -"func:`make_server` 函式。一些可能相關的方法可以在子類別中進行覆寫:" +"建立。不過,你可以建立這個類別的子類別並將其作為 *handler_class* 提供" +"給 :func:`make_server` 函式。一些可能相關的方法可以在子類別中進行覆寫:" -#: ../../library/wsgiref.rst:360 +#: ../../library/wsgiref.rst:363 msgid "" "Return a :data:`~wsgiref.types.WSGIEnvironment` dictionary for a request. " "The default implementation copies the contents of the :class:`WSGIServer` " @@ -574,17 +590,17 @@ msgid "" msgstr "" "唯一個請求回傳一個 :data:`~wsgiref.types.WSGIEnvironment` 字典。預設的實作會" "複製 :class:`WSGIServer` 物件的 :attr:`base_environ` 字典屬性的內容以及添加" -"從 HTTP 請求中衍生的各種標頭。每次呼叫這個方法都應該回傳一個包含所有如 :pep:" -"`3333` 所指定的相關 CGI 環境變數的新字典。" +"從 HTTP 請求中衍生的各種標頭。每次呼叫這個方法都應該回傳一個包含所有" +"如 :pep:`3333` 所指定的相關 CGI 環境變數的新字典。" -#: ../../library/wsgiref.rst:371 +#: ../../library/wsgiref.rst:374 msgid "" "Return the object that should be used as the ``wsgi.errors`` stream. The " "default implementation just returns ``sys.stderr``." msgstr "" "回傳的物件應該被用作 ``wsgi.errors`` 串流。預設實作只會回傳 ``sys.stderr``。" -#: ../../library/wsgiref.rst:377 +#: ../../library/wsgiref.rst:380 msgid "" "Process the HTTP request. The default implementation creates a handler " "instance using a :mod:`wsgiref.handlers` class to implement the actual WSGI " @@ -593,17 +609,17 @@ msgstr "" "處理 HTTP 請求。預設實作會使用 :mod:`wsgiref.handler` 類別來建立處置程式" "(handler)實例來實作實際 WSGI 應用程式介面。" -#: ../../library/wsgiref.rst:383 +#: ../../library/wsgiref.rst:386 msgid ":mod:`wsgiref.validate` --- WSGI conformance checker" msgstr ":mod:`wsgiref.validate` --- WSGI 符合性檢查" -#: ../../library/wsgiref.rst:389 +#: ../../library/wsgiref.rst:392 msgid "" "When creating new WSGI application objects, frameworks, servers, or " -"middleware, it can be useful to validate the new code's conformance using :" -"mod:`wsgiref.validate`. This module provides a function that creates WSGI " -"application objects that validate communications between a WSGI server or " -"gateway and a WSGI application object, to check both sides for protocol " +"middleware, it can be useful to validate the new code's conformance " +"using :mod:`wsgiref.validate`. This module provides a function that creates " +"WSGI application objects that validate communications between a WSGI server " +"or gateway and a WSGI application object, to check both sides for protocol " "conformance." msgstr "" "當建立新的 WSGI 應用程式物件、框架、伺服器、或是中介軟體(middleware)時,使" @@ -611,7 +627,7 @@ msgstr "" "個函式用於建立 WSGI 應用程式物件,並用於驗證 WSGI 伺服器或是閘道與 WSGI 應用" "程式物件之間的通訊,以檢查雙方協議的符合性。" -#: ../../library/wsgiref.rst:396 +#: ../../library/wsgiref.rst:399 msgid "" "Note that this utility does not guarantee complete :pep:`3333` compliance; " "an absence of errors from this module does not necessarily mean that errors " @@ -623,7 +639,7 @@ msgstr "" "錯誤。但是,如果如果這個模組產生錯誤,那麼幾乎可以確定伺服器或應用程式不是 " "100% 符合標準。" -#: ../../library/wsgiref.rst:401 +#: ../../library/wsgiref.rst:404 msgid "" "This module is based on the :mod:`paste.lint` module from Ian Bicking's " "\"Python Paste\" library." @@ -631,7 +647,7 @@ msgstr "" "這個模組基於 Ian Bicking 的 \"Python Paste\" 函式庫的 :mod:`paste.lint` 模" "組。" -#: ../../library/wsgiref.rst:407 +#: ../../library/wsgiref.rst:410 msgid "" "Wrap *application* and return a new WSGI application object. The returned " "application will forward all requests to the original *application*, and " @@ -642,7 +658,7 @@ msgstr "" "請求給原始的 *application*,並檢查 *application* 和呼叫它的伺服器是否符合 " "WSGI 規範和 :rfc:`2616`。" -#: ../../library/wsgiref.rst:412 +#: ../../library/wsgiref.rst:415 msgid "" "Any detected nonconformance results in an :exc:`AssertionError` being " "raised; note, however, that how these errors are handled is server-" @@ -653,12 +669,12 @@ msgid "" "stream." msgstr "" "任何在 :exc:`AssertionError` 中偵測不符合結果都會發起例外;但請注意,如何處理" -"這些錯誤取決於伺服器。例如,基於 :mod:`wsgiref.handlers` 的 :mod:`wsgiref." -"simple_server` 以及其他伺服器(未覆蓋錯誤處理方法以執行其他操作的伺服器)將僅" -"輸出一條錯誤訊息,指示發生錯誤,並將回溯訊息輸出到 ``sys.stderr`` 或是其他錯" -"誤串流。" +"這些錯誤取決於伺服器。例如,基於 :mod:`wsgiref.handlers` " +"的 :mod:`wsgiref.simple_server` 以及其他伺服器(未覆蓋錯誤處理方法以執行其他" +"操作的伺服器)將僅輸出一條錯誤訊息,指示發生錯誤,並將回溯訊息輸出到 " +"``sys.stderr`` 或是其他錯誤串流。" -#: ../../library/wsgiref.rst:419 +#: ../../library/wsgiref.rst:422 msgid "" "This wrapper may also generate output using the :mod:`warnings` module to " "indicate behaviors that are questionable but which may not actually be " @@ -668,11 +684,11 @@ msgid "" "object)." msgstr "" "這個包裝器也可以使用 :mod:`warnings` 模組生成輸出去指示一些可能有疑慮但實際上" -"可能不會被 :pep:`3333` 禁止的行為。除非使用 Python 命令列選項或 :mod:" -"`warnings` API,抑制了這些警告,否則這類警告將被寫入到 ``sys.stderr``\\ " -"(*not* ``wsgi.errors``,除非它們碰巧是相同的物件)。" +"可能不會被 :pep:`3333` 禁止的行為。除非使用 Python 命令列選項" +"或 :mod:`warnings` API,抑制了這些警告,否則這類警告將被寫入到 " +"``sys.stderr``\\ (*not* ``wsgi.errors``,除非它們碰巧是相同的物件)。" -#: ../../library/wsgiref.rst:428 +#: ../../library/wsgiref.rst:431 msgid "" "from wsgiref.validate import validator\n" "from wsgiref.simple_server import make_server\n" @@ -696,11 +712,11 @@ msgid "" " httpd.serve_forever()" msgstr "" -#: ../../library/wsgiref.rst:451 +#: ../../library/wsgiref.rst:454 msgid ":mod:`wsgiref.handlers` -- server/gateway base classes" msgstr ":mod:`wsgiref.handlers` -- 伺服器 / 閘道基本類別" -#: ../../library/wsgiref.rst:457 +#: ../../library/wsgiref.rst:460 msgid "" "This module provides base handler classes for implementing WSGI servers and " "gateways. These base classes handle most of the work of communicating with " @@ -711,7 +727,7 @@ msgstr "" "處理程式大部分與 WSGI 應用程式通訊的工作,只要它們被提供 CGI-like 環境,以及" "輸入、輸出和錯誤串流。" -#: ../../library/wsgiref.rst:465 +#: ../../library/wsgiref.rst:468 msgid "" "CGI-based invocation via ``sys.stdin``, ``sys.stdout``, ``sys.stderr`` and " "``os.environ``. This is useful when you have a WSGI application and want to " @@ -723,18 +739,18 @@ msgstr "" "很有用的。只需呼叫 ``CGIHandler().run(app)``,其中 ``app`` 是你希望呼叫的 " "WSGI 應用程式物件。" -#: ../../library/wsgiref.rst:470 +#: ../../library/wsgiref.rst:473 msgid "" -"This class is a subclass of :class:`BaseCGIHandler` that sets ``wsgi." -"run_once`` to true, ``wsgi.multithread`` to false, and ``wsgi.multiprocess`` " -"to true, and always uses :mod:`sys` and :mod:`os` to obtain the necessary " -"CGI streams and environment." +"This class is a subclass of :class:`BaseCGIHandler` that sets " +"``wsgi.run_once`` to true, ``wsgi.multithread`` to false, and " +"``wsgi.multiprocess`` to true, and always uses :mod:`sys` and :mod:`os` to " +"obtain the necessary CGI streams and environment." msgstr "" "這個類別是 :class:`BaseCGIHandler` 的子類別將 ``wsgi.run_once`` 設置為 true," "``wsgi.multithread`` 設置為 false,並將 ``wsgi.multiprocess`` 設置為 true,並" "且始終使用 :mod:`sys` 和 :mod:`os` 來獲取所需的 CGI 串流以及環境。" -#: ../../library/wsgiref.rst:478 +#: ../../library/wsgiref.rst:481 msgid "" "A specialized alternative to :class:`CGIHandler`, for use when deploying on " "Microsoft's IIS web server, without having set the config allowPathInfo " @@ -744,7 +760,7 @@ msgstr "" "個專門替代選擇,無需設置 config 的 allowPathInfo 選項(IIS>=7),或 metabase " "的 allowPathInfoForScriptMappings 選項(IIS<7)。" -#: ../../library/wsgiref.rst:482 +#: ../../library/wsgiref.rst:485 msgid "" "By default, IIS gives a ``PATH_INFO`` that duplicates the ``SCRIPT_NAME`` at " "the front, causing problems for WSGI applications that wish to implement " @@ -754,7 +770,7 @@ msgstr "" "作路由的 WSGI 應用程式造成問題。這個處理程式(handler)會移除任何這樣的重複路" "徑。" -#: ../../library/wsgiref.rst:486 +#: ../../library/wsgiref.rst:489 msgid "" "IIS can be configured to pass the correct ``PATH_INFO``, but this causes " "another bug where ``PATH_TRANSLATED`` is wrong. Luckily this variable is " @@ -770,30 +786,31 @@ msgstr "" "``PATH_TRANSLATED`` 問題時會中斷。由於這個原因幾乎從不會使用修復的 IIS<7(即" "使是 IIS7 也很少使用它,因為它仍然沒有相應的 UI)。" -#: ../../library/wsgiref.rst:494 +#: ../../library/wsgiref.rst:497 msgid "" "There is no way for CGI code to tell whether the option was set, so a " -"separate handler class is provided. It is used in the same way as :class:" -"`CGIHandler`, i.e., by calling ``IISCGIHandler().run(app)``, where ``app`` " -"is the WSGI application object you wish to invoke." +"separate handler class is provided. It is used in the same way " +"as :class:`CGIHandler`, i.e., by calling ``IISCGIHandler().run(app)``, where " +"``app`` is the WSGI application object you wish to invoke." msgstr "" "CGI 程式碼無法知道是否已設置該選項,因此提供了一個獨立的處理程式(handler)類" -"別。它的使用方式與 :class:`CGIHandler` 相同,即透過呼叫 ``IISCGIHandler()." -"run(app)`` 來使用,其中 ``app`` 是你希望呼叫的 WSGI 應用程式物件。" +"別。它的使用方式與 :class:`CGIHandler` 相同,即透過呼叫 " +"``IISCGIHandler().run(app)`` 來使用,其中 ``app`` 是你希望呼叫的 WSGI 應用程" +"式物件。" -#: ../../library/wsgiref.rst:504 +#: ../../library/wsgiref.rst:507 msgid "" -"Similar to :class:`CGIHandler`, but instead of using the :mod:`sys` and :mod:" -"`os` modules, the CGI environment and I/O streams are specified explicitly. " -"The *multithread* and *multiprocess* values are used to set the ``wsgi." -"multithread`` and ``wsgi.multiprocess`` flags for any applications run by " -"the handler instance." +"Similar to :class:`CGIHandler`, but instead of using the :mod:`sys` " +"and :mod:`os` modules, the CGI environment and I/O streams are specified " +"explicitly. The *multithread* and *multiprocess* values are used to set the " +"``wsgi.multithread`` and ``wsgi.multiprocess`` flags for any applications " +"run by the handler instance." msgstr "" "類似於 :class:`CGIHandler`,但不是使用 :mod:`sys` 和 :mod:`os` 模組,而是明確" "指定 CGI 環境與 I/O 串流。*multithread* 和 *multiprocess* 值用於設置由處理程" "式(handler)實例運行的任何應用程式的旗標。" -#: ../../library/wsgiref.rst:510 +#: ../../library/wsgiref.rst:513 msgid "" "This class is a subclass of :class:`SimpleHandler` intended for use with " "software other than HTTP \"origin servers\". If you are writing a gateway " @@ -801,38 +818,37 @@ msgid "" "``Status:`` header to send an HTTP status, you probably want to subclass " "this instead of :class:`SimpleHandler`." msgstr "" -"這個類別是專門為除了 HTTP \"origin servers\" 以外的軟體一起使用的 :class:" -"`SimpleHandler` 的子類別。如果你正在撰寫一個使用 ``Status:`` 標頭來發送 HTTP " -"狀態的閘道協議實作(例如 CGI、FastCGI、SCGI 等),你可能會想要子類化這個類別" -"來替代 :class:`SimpleHandler`。" +"這個類別是專門為除了 HTTP \"origin servers\" 以外的軟體一起使用" +"的 :class:`SimpleHandler` 的子類別。如果你正在撰寫一個使用 ``Status:`` 標頭來" +"發送 HTTP 狀態的閘道協議實作(例如 CGI、FastCGI、SCGI 等),你可能會想要子類" +"化這個類別來替代 :class:`SimpleHandler`。" -#: ../../library/wsgiref.rst:519 +#: ../../library/wsgiref.rst:522 msgid "" "Similar to :class:`BaseCGIHandler`, but designed for use with HTTP origin " "servers. If you are writing an HTTP server implementation, you will " "probably want to subclass this instead of :class:`BaseCGIHandler`." msgstr "" "類似於 :class:`BaseCGIHandler`,但是被設計使用在 HTTP origin 伺服器。如果你正" -"在撰寫 HTTP 伺服器的實作,你可能會想要子類別化這個類別來替代 :class:" -"`BaseCGIHandler`。" +"在撰寫 HTTP 伺服器的實作,你可能會想要子類別化這個類別來替" +"代 :class:`BaseCGIHandler`。" -#: ../../library/wsgiref.rst:523 +#: ../../library/wsgiref.rst:526 msgid "" "This class is a subclass of :class:`BaseHandler`. It overrides the :meth:`!" -"__init__`, :meth:`~BaseHandler.get_stdin`, :meth:`~BaseHandler.get_stderr`, :" -"meth:`~BaseHandler.add_cgi_vars`, :meth:`~BaseHandler._write`, and :meth:" -"`~BaseHandler._flush` methods to support explicitly setting the environment " -"and streams via the constructor. The supplied environment and streams are " -"stored in the :attr:`stdin`, :attr:`stdout`, :attr:`stderr`, and :attr:" -"`environ` attributes." +"__init__`, :meth:`~BaseHandler.get_stdin`, :meth:`~BaseHandler.get_stderr`, :meth:`~BaseHandler.add_cgi_vars`, :meth:`~BaseHandler._write`, " +"and :meth:`~BaseHandler._flush` methods to support explicitly setting the " +"environment and streams via the constructor. The supplied environment and " +"streams are stored in the :attr:`stdin`, :attr:`stdout`, :attr:`stderr`, " +"and :attr:`environ` attributes." msgstr "" "這個類別是 :class:`BaseHandler` 的子類別。它透過建構器去覆寫 :meth:`!" -"__init__`、:meth:`~BaseHandler.get_stdin`、:meth:`~BaseHandler.get_stderr`、:" -"meth:`~BaseHandler.add_cgi_vars`、:meth:`~BaseHandler._write`、和 :meth:" -"`~BaseHandler._flush` 方法來明確提供設置環境與串流。提供的環境與串流被儲存" -"在 :attr:`stdin`、:attr:`stdout`、:attr:`stderr`、和 :attr:`environ` 環境中。" +"__init__`、:meth:`~BaseHandler.get_stdin`、:meth:`~BaseHandler.get_stderr`、:meth:`~BaseHandler.add_cgi_vars`、:meth:`~BaseHandler._write`、" +"和 :meth:`~BaseHandler._flush` 方法來明確提供設置環境與串流。提供的環境與串流" +"被儲存在 :attr:`stdin`、:attr:`stdout`、:attr:`stderr`、和 :attr:`environ` 環" +"境中。" -#: ../../library/wsgiref.rst:532 +#: ../../library/wsgiref.rst:535 msgid "" "The :meth:`~io.BufferedIOBase.write` method of *stdout* should write each " "chunk in full, like :class:`io.BufferedIOBase`." @@ -840,7 +856,7 @@ msgstr "" "*stdout* 的 :meth:`~io.BufferedIOBase.write` 方法應該完整地寫入每個塊" "(chunk),像是 :class:`io.BufferedIOBase`。" -#: ../../library/wsgiref.rst:538 +#: ../../library/wsgiref.rst:541 msgid "" "This is an abstract base class for running WSGI applications. Each instance " "will handle a single HTTP request, although in principle you could create a " @@ -849,17 +865,17 @@ msgstr "" "這是一個運行 WSGI 應用程式的抽象基底類別。每個實例將處理單個 HTTP 請求,儘管" "原則上你可以建立一個可重用於多個請求的子類別。" -#: ../../library/wsgiref.rst:542 +#: ../../library/wsgiref.rst:545 msgid "" ":class:`BaseHandler` instances have only one method intended for external " "use:" msgstr ":class:`BaseHandler` 實例只有一個供外部使用的方法:" -#: ../../library/wsgiref.rst:547 +#: ../../library/wsgiref.rst:550 msgid "Run the specified WSGI application, *app*." msgstr "運行指定 WSGI 應用程式,*app*。" -#: ../../library/wsgiref.rst:549 +#: ../../library/wsgiref.rst:552 msgid "" "All of the other :class:`BaseHandler` methods are invoked by this method in " "the process of running the application, and thus exist primarily to allow " @@ -868,11 +884,11 @@ msgstr "" "此方法在運行應用程式的過程中呼叫了所有其他 :class:`BaseHandler` 的方法,因此" "這些方法主要存在是為了允許自定義整個過程。" -#: ../../library/wsgiref.rst:553 +#: ../../library/wsgiref.rst:556 msgid "The following methods MUST be overridden in a subclass:" msgstr "以下方法必須在子類別中覆寫:" -#: ../../library/wsgiref.rst:558 +#: ../../library/wsgiref.rst:561 msgid "" "Buffer the bytes *data* for transmission to the client. It's okay if this " "method actually transmits the data; :class:`BaseHandler` just separates " @@ -883,15 +899,15 @@ msgstr "" "底層系統實際具有這種區分時,:class:`BaseHandler` 為了更好的效能進而分離寫入和" "刷新操作。" -#: ../../library/wsgiref.rst:566 +#: ../../library/wsgiref.rst:569 msgid "" "Force buffered data to be transmitted to the client. It's okay if this " "method is a no-op (i.e., if :meth:`_write` actually sends the data)." msgstr "" -"強制將緩衝數據傳送到用戶端。如果這是一個無操作(no-op)的方法(即,如果 :" -"meth:`_write` 實際上發送了數據),那麼是可以的。" +"強制將緩衝數據傳送到用戶端。如果這是一個無操作(no-op)的方法(即,如" +"果 :meth:`_write` 實際上發送了數據),那麼是可以的。" -#: ../../library/wsgiref.rst:572 +#: ../../library/wsgiref.rst:575 msgid "" "Return an object compatible with :class:`~wsgiref.types.InputStream` " "suitable for use as the ``wsgi.input`` of the request currently being " @@ -900,7 +916,7 @@ msgstr "" "回傳一個與 :class:`~wsgiref.types.InputStream` 相容的物件並適用於用作當前正在" "處理請求的 ``wsgi.input``。" -#: ../../library/wsgiref.rst:579 +#: ../../library/wsgiref.rst:582 msgid "" "Return an object compatible with :class:`~wsgiref.types.ErrorStream` " "suitable for use as the ``wsgi.errors`` of the request currently being " @@ -909,29 +925,29 @@ msgstr "" "回傳一個與 :class:`~wsgiref.types.ErrorStream` 相容的物件並適用於用作當前正在" "處理請求的 ``wsgi.errors``。" -#: ../../library/wsgiref.rst:586 +#: ../../library/wsgiref.rst:589 msgid "" "Insert CGI variables for the current request into the :attr:`environ` " "attribute." msgstr "將當前請求的 CGI 變數插入到 :attr:`environ` 屬性中。" -#: ../../library/wsgiref.rst:588 +#: ../../library/wsgiref.rst:591 msgid "" "Here are some other methods and attributes you may wish to override. This " "list is only a summary, however, and does not include every method that can " "be overridden. You should consult the docstrings and source code for " -"additional information before attempting to create a customized :class:" -"`BaseHandler` subclass." +"additional information before attempting to create a " +"customized :class:`BaseHandler` subclass." msgstr "" "以下是你可能希望覆寫的其他方法和屬性。這個列表只是一個摘要,然而,不包括可以" "被覆寫的每個方法。在嘗試建立自定義的 :class:`BaseHandler` 子類別之前,你應該" "參考文件說明和原始碼以獲得更多資訊。" -#: ../../library/wsgiref.rst:594 +#: ../../library/wsgiref.rst:597 msgid "Attributes and methods for customizing the WSGI environment:" msgstr "用於自定義 WSGI 環境的屬性和方法:" -#: ../../library/wsgiref.rst:599 +#: ../../library/wsgiref.rst:602 msgid "" "The value to be used for the ``wsgi.multithread`` environment variable. It " "defaults to true in :class:`BaseHandler`, but may have a different default " @@ -940,7 +956,7 @@ msgstr "" "用於 ``wsgi.multithread`` 環境變數的值。在 :class:`BaseHandler` 中預設為 " "true,但在其他子類別中可能有不同的預設值(或由建構函式設置)。" -#: ../../library/wsgiref.rst:606 +#: ../../library/wsgiref.rst:609 msgid "" "The value to be used for the ``wsgi.multiprocess`` environment variable. It " "defaults to true in :class:`BaseHandler`, but may have a different default " @@ -949,7 +965,7 @@ msgstr "" "用於 ``wsgi.multiprocess`` 環境變數的值。在 :class:`BaseHandler` 中預設為 " "true,但在其他子類別中可能有不同的預設值(或由建構函式設置)。" -#: ../../library/wsgiref.rst:613 +#: ../../library/wsgiref.rst:616 msgid "" "The value to be used for the ``wsgi.run_once`` environment variable. It " "defaults to false in :class:`BaseHandler`, but :class:`CGIHandler` sets it " @@ -958,20 +974,21 @@ msgstr "" "用於 ``wsgi.run_once`` 環境變數的值。在 :class:`BaseHandler` 中預設為 false," "但 :class:`CGIHandler` 預設將其設置為 true。" -#: ../../library/wsgiref.rst:620 +#: ../../library/wsgiref.rst:623 msgid "" "The default environment variables to be included in every request's WSGI " -"environment. By default, this is a copy of ``os.environ`` at the time that :" -"mod:`wsgiref.handlers` was imported, but subclasses can either create their " -"own at the class or instance level. Note that the dictionary should be " -"considered read-only, since the default value is shared between multiple " +"environment. By default, this is a copy of ``os.environ`` at the time " +"that :mod:`wsgiref.handlers` was imported, but subclasses can either create " +"their own at the class or instance level. Note that the dictionary should " +"be considered read-only, since the default value is shared between multiple " "classes and instances." msgstr "" -"預設環境變數包含在每一個請求的 WSGI 環境中。預設情況下,這是在載入 :mod:" -"`wsgiref.handlers` 時的 ``os.environ`` 副本,但子類別可以在類別或實例層級建立" -"自己的副本。注意字典應該被視為唯讀,因為預設值在多個類別與實例中共享。" +"預設環境變數包含在每一個請求的 WSGI 環境中。預設情況下,這是在載" +"入 :mod:`wsgiref.handlers` 時的 ``os.environ`` 副本,但子類別可以在類別或實例" +"層級建立自己的副本。注意字典應該被視為唯讀,因為預設值在多個類別與實例中共" +"享。" -#: ../../library/wsgiref.rst:630 +#: ../../library/wsgiref.rst:633 msgid "" "If the :attr:`origin_server` attribute is set, this attribute's value is " "used to set the default ``SERVER_SOFTWARE`` WSGI environment variable, and " @@ -981,28 +998,28 @@ msgid "" msgstr "" "如果設置 :attr:`origin_server` 屬性,則此屬性的值將用於設置預設的 " "``SERVER_SOFTWARE`` WSGI 環境變數,並且還將用於設置 HTTP 回應中的預設 " -"``Server:`` 標頭。對於不是 HTTP origin 伺服器的處置程式(例如 :class:" -"`BaseCGIHandler` 和 :class:`CGIHandler`),此屬性將被忽略。" +"``Server:`` 標頭。對於不是 HTTP origin 伺服器的處置程式(例" +"如 :class:`BaseCGIHandler` 和 :class:`CGIHandler`),此屬性將被忽略。" -#: ../../library/wsgiref.rst:636 +#: ../../library/wsgiref.rst:639 msgid "" "The term \"Python\" is replaced with implementation specific term like " "\"CPython\", \"Jython\" etc." msgstr "" "將術語 \"Python\" 替換為特定實作的術語,如 \"CPython\"、\"Jython\" 等。" -#: ../../library/wsgiref.rst:642 +#: ../../library/wsgiref.rst:645 msgid "" "Return the URL scheme being used for the current request. The default " -"implementation uses the :func:`guess_scheme` function from :mod:`wsgiref." -"util` to guess whether the scheme should be \"http\" or \"https\", based on " -"the current request's :attr:`environ` variables." +"implementation uses the :func:`guess_scheme` function " +"from :mod:`wsgiref.util` to guess whether the scheme should be \"http\" or " +"\"https\", based on the current request's :attr:`environ` variables." msgstr "" -"回傳用於當前請求的 URL scheme。預設的實作使用 :mod:`wsgiref.util` 中的 :func:" -"`guess_scheme` 函式去猜測 scheme 是 \"http\" 或是 \"https\",基於目前請求的 :" -"attr:`environ` 變數。" +"回傳用於當前請求的 URL scheme。預設的實作使用 :mod:`wsgiref.util` 中" +"的 :func:`guess_scheme` 函式去猜測 scheme 是 \"http\" 或是 \"https\",基於目" +"前請求的 :attr:`environ` 變數。" -#: ../../library/wsgiref.rst:650 +#: ../../library/wsgiref.rst:653 msgid "" "Set the :attr:`environ` attribute to a fully populated WSGI environment. " "The default implementation uses all of the above methods and attributes, " @@ -1017,11 +1034,11 @@ msgstr "" "``SERVER_SOFTWARE`` 關鍵字,只要 :attr:`origin_server` 屬性是一個 true 值並" "且 :attr:`server_software` 屬性被設置。" -#: ../../library/wsgiref.rst:657 +#: ../../library/wsgiref.rst:660 msgid "Methods and attributes for customizing exception handling:" msgstr "用於自定義例外處理的屬性和方法:" -#: ../../library/wsgiref.rst:662 +#: ../../library/wsgiref.rst:665 msgid "" "Log the *exc_info* tuple in the server log. *exc_info* is a ``(type, value, " "traceback)`` tuple. The default implementation simply writes the traceback " @@ -1035,15 +1052,15 @@ msgstr "" "並刷新它。子類別可以覆蓋此方法以更改格式或重新定向輸出,將追蹤資訊發送給管理" "員,或執行其他被認為合適的操作。" -#: ../../library/wsgiref.rst:671 +#: ../../library/wsgiref.rst:674 msgid "" -"The maximum number of frames to include in tracebacks output by the default :" -"meth:`log_exception` method. If ``None``, all frames are included." +"The maximum number of frames to include in tracebacks output by the " +"default :meth:`log_exception` method. If ``None``, all frames are included." msgstr "" "預設的 :meth:`log_exception` 方法追蹤輸出中包含的最大幀數 。如果為 ``None``," "則包含所有幀。" -#: ../../library/wsgiref.rst:677 +#: ../../library/wsgiref.rst:680 msgid "" "This method is a WSGI application to generate an error page for the user. " "It is only invoked if an error occurs before headers are sent to the client." @@ -1051,25 +1068,30 @@ msgstr "" "這個方法是一個為使用者去產生錯誤頁面的 WSGI 應用程式。只有在標頭傳送給用戶端" "前如果發生錯誤才會被呼叫。" -#: ../../library/wsgiref.rst:680 +#: ../../library/wsgiref.rst:683 msgid "" "This method can access the current error using ``sys.exception()``, and " "should pass that information to *start_response* when calling it (as " -"described in the \"Error Handling\" section of :pep:`3333`)." +"described in the \"Error Handling\" section of :pep:`3333`). In particular, " +"the *start_response* callable should follow the :class:`.StartResponse` " +"protocol." msgstr "" "此方法使用 ``sys.exception()`` 存取當前的錯誤,當呼叫它(如 :pep:`3333` 的 " -"\"Error Handling\" 部分所描述)時應該傳遞資訊給 *start_response*。" +"\"Error Handling\" 部分所描述)時應該傳遞資訊給 *start_response*。特別是 " +"*start_response* 可呼叫物件應該遵循 :class:`.StartResponse` 協定。" -#: ../../library/wsgiref.rst:684 +#: ../../library/wsgiref.rst:689 msgid "" -"The default implementation just uses the :attr:`error_status`, :attr:" -"`error_headers`, and :attr:`error_body` attributes to generate an output " -"page. Subclasses can override this to produce more dynamic error output." +"The default implementation just uses " +"the :attr:`error_status`, :attr:`error_headers`, and :attr:`error_body` " +"attributes to generate an output page. Subclasses can override this to " +"produce more dynamic error output." msgstr "" -"預設的實作只是使用 :attr:`error_status`、:attr:`error_headers` 和 :attr:" -"`error_body` 屬性產生輸出頁面。子類別可以覆蓋此方法以生成更動態的錯誤輸出。" +"預設的實作只是使用 :attr:`error_status`、:attr:`error_headers` " +"和 :attr:`error_body` 屬性產生輸出頁面。子類別可以覆蓋此方法以生成更動態的錯" +"誤輸出。" -#: ../../library/wsgiref.rst:688 +#: ../../library/wsgiref.rst:693 msgid "" "Note, however, that it's not recommended from a security perspective to spit " "out diagnostics to any old user; ideally, you should have to do something " @@ -1079,7 +1101,7 @@ msgstr "" "然而,從安全的角度並不建議向任何普通使用者顯示診斷資訊;理想情況下,你應該需" "要採取特殊措施才能啟用診斷輸出,這就是預設實作不包括任何診斷資訊的原因。" -#: ../../library/wsgiref.rst:696 +#: ../../library/wsgiref.rst:701 msgid "" "The HTTP status used for error responses. This should be a status string as " "defined in :pep:`3333`; it defaults to a 500 code and message." @@ -1087,7 +1109,7 @@ msgstr "" "用於錯誤回應的 HTTP 狀態。這應該是一個按照 :pep:`3333` 定義的狀態字串;預設" "為 500 狀態碼和訊息。" -#: ../../library/wsgiref.rst:702 +#: ../../library/wsgiref.rst:707 msgid "" "The HTTP headers used for error responses. This should be a list of WSGI " "response headers (``(name, value)`` tuples), as described in :pep:`3333`. " @@ -1097,7 +1119,7 @@ msgstr "" "value)`` 元組),如 :pep:`3333` 中所描述。預設串列只設置內容種類為 ``text/" "plain``。" -#: ../../library/wsgiref.rst:709 +#: ../../library/wsgiref.rst:714 msgid "" "The error response body. This should be an HTTP response body bytestring. " "It defaults to the plain text, \"A server error occurred. Please contact " @@ -1106,7 +1128,7 @@ msgstr "" "錯誤回應的主體。這應該是一個 HTTP 回應內容的位元組字串。預設為純文字 \"A " "server error occurred. Please contact the administrator.\"" -#: ../../library/wsgiref.rst:713 +#: ../../library/wsgiref.rst:718 msgid "" "Methods and attributes for :pep:`3333`'s \"Optional Platform-Specific File " "Handling\" feature:" @@ -1114,17 +1136,17 @@ msgstr "" "用於 :pep:`3333` 中的 \"Optional Platform-Specific File Handling\" 功能的方法" "和屬性:" -#: ../../library/wsgiref.rst:719 +#: ../../library/wsgiref.rst:724 msgid "" -"A ``wsgi.file_wrapper`` factory, compatible with :class:`wsgiref.types." -"FileWrapper`, or ``None``. The default value of this attribute is the :" -"class:`wsgiref.util.FileWrapper` class." +"A ``wsgi.file_wrapper`` factory, compatible " +"with :class:`wsgiref.types.FileWrapper`, or ``None``. The default value of " +"this attribute is the :class:`wsgiref.util.FileWrapper` class." msgstr "" -"一個 ``wsgi.file_wrapper`` 工廠函式(factory),與 :class:`wsgiref.types." -"FileWrapper` 相容,或者為 ``None``。這個屬性的預設值是 :class:`wsgiref.util." -"FileWrapper` 類別。" +"一個 ``wsgi.file_wrapper`` 工廠函式(factory)," +"與 :class:`wsgiref.types.FileWrapper` 相容,或者為 ``None``。這個屬性的預設值" +"是 :class:`wsgiref.util.FileWrapper` 類別。" -#: ../../library/wsgiref.rst:726 +#: ../../library/wsgiref.rst:731 msgid "" "Override to implement platform-specific file transmission. This method is " "called only if the application's return value is an instance of the class " @@ -1133,35 +1155,35 @@ msgid "" "default transmission code will not be executed. The default implementation " "of this method just returns a false value." msgstr "" -"覆蓋以實作特定平台的檔案傳輸。只有當應用程式的回傳值是由 :attr:" -"`wsgi_file_wrapper` 屬性指定的類別實例時才會呼叫此方法。如果它能夠成功傳輸檔" -"案應該回傳一個 true 值,以便不執行預設的傳輸程式碼。該方法的預設實作只回傳一" -"個 false 值。" +"覆蓋以實作特定平台的檔案傳輸。只有當應用程式的回傳值是" +"由 :attr:`wsgi_file_wrapper` 屬性指定的類別實例時才會呼叫此方法。如果它能夠成" +"功傳輸檔案應該回傳一個 true 值,以便不執行預設的傳輸程式碼。該方法的預設實作" +"只回傳一個 false 值。" -#: ../../library/wsgiref.rst:733 +#: ../../library/wsgiref.rst:738 msgid "Miscellaneous methods and attributes:" msgstr "其他方法和屬性:" -#: ../../library/wsgiref.rst:738 +#: ../../library/wsgiref.rst:743 msgid "" "This attribute should be set to a true value if the handler's :meth:`_write` " "and :meth:`_flush` are being used to communicate directly to the client, " "rather than via a CGI-like gateway protocol that wants the HTTP status in a " "special ``Status:`` header." msgstr "" -"這個屬性應該被設置為 true 值,如果處理程式(handler)的 :meth:`_write` 和 :" -"meth:`_flush` 被用於直接與用戶端通訊,而不是透過 CGI-like 的閘道協議希望 " +"這個屬性應該被設置為 true 值,如果處理程式(handler)的 :meth:`_write` " +"和 :meth:`_flush` 被用於直接與用戶端通訊,而不是透過 CGI-like 的閘道協議希望 " "HTTP 狀態在特殊的 ``Status:`` 標頭中。" -#: ../../library/wsgiref.rst:743 +#: ../../library/wsgiref.rst:748 msgid "" "This attribute's default value is true in :class:`BaseHandler`, but false " "in :class:`BaseCGIHandler` and :class:`CGIHandler`." msgstr "" -"這個屬性在 :class:`BaseCGIHandler` 預設值為 true,但是在 :class:" -"`BaseCGIHandler` 和 :class:`CGIHandler` 為 false。" +"這個屬性在 :class:`BaseCGIHandler` 預設值為 true,但是" +"在 :class:`BaseCGIHandler` 和 :class:`CGIHandler` 為 false。" -#: ../../library/wsgiref.rst:749 +#: ../../library/wsgiref.rst:754 msgid "" "If :attr:`origin_server` is true, this string attribute is used to set the " "HTTP version of the response set to the client. It defaults to ``\"1.0\"``." @@ -1169,11 +1191,11 @@ msgstr "" "如果 :attr:`origin_server` 為 true,則此字串屬性用於設定傳送給用戶端的回應的 " "HTTP 版本。預設為 ``\"1.0\"``。" -#: ../../library/wsgiref.rst:755 +#: ../../library/wsgiref.rst:760 msgid "" "Transcode CGI variables from ``os.environ`` to :pep:`3333` \"bytes in " -"unicode\" strings, returning a new dictionary. This function is used by :" -"class:`CGIHandler` and :class:`IISCGIHandler` in place of directly using " +"unicode\" strings, returning a new dictionary. This function is used " +"by :class:`CGIHandler` and :class:`IISCGIHandler` in place of directly using " "``os.environ``, which is not necessarily WSGI-compliant on all platforms and " "web servers using Python 3 -- specifically, ones where the OS's actual " "environment is Unicode (i.e. Windows), or ones where the environment is " @@ -1181,13 +1203,13 @@ msgid "" "than ISO-8859-1 (e.g. Unix systems using UTF-8)." msgstr "" "從 ``os.environ`` 轉碼 CGI 變數到 :pep:`3333` 中的 \"bytes in unicode\" 字" -"串,並回傳一個新字典。這個函式被 :class:`CGIHandler` 和 :class:" -"`IISCGIHandler` 使用來直接替代 ``os.environ``,在所有平台和使用 Python 3 的網" -"頁伺服器上不一定符合 WSGI 標準,具體來說,在 OS 的實際環境是 Unicode(例如 " -"Windows)的情況下,或者在環境是位元組的情況下,但 Python 用於解碼它的系統編碼" -"不是 ISO-8859-1 (例如使用 UTF-8 的 Unix 系統)。" +"串,並回傳一個新字典。這個函式被 :class:`CGIHandler` " +"和 :class:`IISCGIHandler` 使用來直接替代 ``os.environ``,在所有平台和使用 " +"Python 3 的網頁伺服器上不一定符合 WSGI 標準,具體來說,在 OS 的實際環境是 " +"Unicode(例如 Windows)的情況下,或者在環境是位元組的情況下,但 Python 用於解" +"碼它的系統編碼不是 ISO-8859-1 (例如使用 UTF-8 的 Unix 系統)。" -#: ../../library/wsgiref.rst:764 +#: ../../library/wsgiref.rst:769 msgid "" "If you are implementing a CGI-based handler of your own, you probably want " "to use this routine instead of just copying values out of ``os.environ`` " @@ -1196,17 +1218,17 @@ msgstr "" "如果你自己正在實作 CGI-based 處理程式(handler),你可能想要使用這個函式來替" "換單純直接從 ``os.environ`` 中複製值。" -#: ../../library/wsgiref.rst:772 +#: ../../library/wsgiref.rst:777 msgid ":mod:`wsgiref.types` -- WSGI types for static type checking" msgstr ":mod:`wsgiref.types` -- 用於靜態型別檢查的 WSGI 型別" -#: ../../library/wsgiref.rst:778 +#: ../../library/wsgiref.rst:783 msgid "" -"This module provides various types for static type checking as described in :" -"pep:`3333`." +"This module provides various types for static type checking as described " +"in :pep:`3333`." msgstr "這個模組提供在 :pep:`3333` 中所描述的各種用於靜態型別檢查的型別。" -#: ../../library/wsgiref.rst:786 +#: ../../library/wsgiref.rst:791 msgid "" "A :class:`typing.Protocol` describing :pep:`start_response() <3333#the-start-" "response-callable>` callables (:pep:`3333`)." @@ -1214,49 +1236,52 @@ msgstr "" "一個描述 :pep:`start_response() <3333#the-start-response-callable>` 可呼叫物" "件的 :class:`typing.Protocol` (:pep:`3333`)。" -#: ../../library/wsgiref.rst:792 +#: ../../library/wsgiref.rst:797 msgid "A type alias describing a WSGI environment dictionary." msgstr "一個描述 WSGI 環境字典的型別別名。" -#: ../../library/wsgiref.rst:796 +#: ../../library/wsgiref.rst:801 msgid "A type alias describing a WSGI application callable." msgstr "一個描述 WSGI 應用程式可呼叫物件的型別別名。" -#: ../../library/wsgiref.rst:800 +#: ../../library/wsgiref.rst:805 msgid "" "A :class:`typing.Protocol` describing a :pep:`WSGI Input Stream <3333#input-" "and-error-streams>`." msgstr "" -"一個描述 :pep:`WSGI 輸入串流 <3333#input-and-error-streams>`\\ 的 :class:" -"`typing.Protocol`。" +"一個描述 :pep:`WSGI 輸入串流 <3333#input-and-error-streams>`\\ " +"的 :class:`typing.Protocol`。" -#: ../../library/wsgiref.rst:805 +#: ../../library/wsgiref.rst:810 msgid "" "A :class:`typing.Protocol` describing a :pep:`WSGI Error Stream <3333#input-" "and-error-streams>`." msgstr "" -"一個描述 :pep:`WSGI 錯誤串流 <3333#input-and-error-streams>`\\ 的 :class:" -"`typing.Protocol`。" +"一個描述 :pep:`WSGI 錯誤串流 <3333#input-and-error-streams>`\\ " +"的 :class:`typing.Protocol`。" -#: ../../library/wsgiref.rst:810 +#: ../../library/wsgiref.rst:815 msgid "" "A :class:`typing.Protocol` describing a :pep:`file wrapper <3333#optional-" "platform-specific-file-handling>`. See :class:`wsgiref.util.FileWrapper` for " "a concrete implementation of this protocol." msgstr "" "一個描述\\ :pep:`檔案包裝器 <3333#optional-platform-specific-file-" -"handling>`\\ 的 :class:`typing.Protocol`。請參閱 :class:`wsgiref.util." -"FileWrapper` 來瞭解此協議的具體實作。" +"handling>`\\ 的 :class:`typing.Protocol`。請參" +"閱 :class:`wsgiref.util.FileWrapper` 來瞭解此協議的具體實作。" -#: ../../library/wsgiref.rst:817 +#: ../../library/wsgiref.rst:822 msgid "Examples" msgstr "範例" -#: ../../library/wsgiref.rst:819 -msgid "This is a working \"Hello World\" WSGI application::" -msgstr "這個一個運作中的 \"Hello World\" WSGI 應用程式: ::" +#: ../../library/wsgiref.rst:824 +msgid "" +"This is a working \"Hello World\" WSGI application, where the " +"*start_response* callable should follow the :class:`.StartResponse` " +"protocol::" +msgstr "" -#: ../../library/wsgiref.rst:821 +#: ../../library/wsgiref.rst:827 msgid "" "\"\"\"\n" "Every WSGI application must have an application object - a callable\n" @@ -1285,7 +1310,7 @@ msgid "" " httpd.serve_forever()" msgstr "" -#: ../../library/wsgiref.rst:848 +#: ../../library/wsgiref.rst:854 msgid "" "Example of a WSGI application serving the current directory, accept optional " "directory and port number (default: 8000) on the command line::" @@ -1293,7 +1318,7 @@ msgstr "" "提供當前目錄的 WSGI 應用程式範例,並接受命令列上的可選目錄和埠號(預設:" "8000): ::" -#: ../../library/wsgiref.rst:851 +#: ../../library/wsgiref.rst:857 msgid "" "\"\"\"\n" "Small wsgiref based web server. Takes a path to serve from and an\n" @@ -1337,3 +1362,6 @@ msgid "" " print(\"Shutting down.\")\n" " httpd.server_close()" msgstr "" + +#~ msgid "This is a working \"Hello World\" WSGI application::" +#~ msgstr "這個一個運作中的 \"Hello World\" WSGI 應用程式: ::" diff --git a/library/xmlrpc.client.po b/library/xmlrpc.client.po index 4ea29b3a93..9835d74f1c 100644 --- a/library/xmlrpc.client.po +++ b/library/xmlrpc.client.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-03-04 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -86,29 +86,29 @@ msgid "" "class:`bytes` and :class:`bytearray` objects may be passed to calls. The " "*headers* parameter is an optional sequence of HTTP headers to send with " "each request, expressed as a sequence of 2-tuples representing the header " -"name and value. (e.g. ``[('Header-Name', 'value')]``). The obsolete " -"*use_datetime* flag is similar to *use_builtin_types* but it applies only to " -"date/time values." +"name and value. (e.g. ``[('Header-Name', 'value')]``). If an HTTPS URL is " +"provided, *context* may be :class:`ssl.SSLContext` and configures the SSL " +"settings of the underlying HTTPS connection. The obsolete *use_datetime* " +"flag is similar to *use_builtin_types* but it applies only to date/time " +"values." msgstr "" -#: ../../library/xmlrpc.client.rst:67 ../../library/xmlrpc.client.rst:549 +#: ../../library/xmlrpc.client.rst:69 ../../library/xmlrpc.client.rst:549 msgid "The *use_builtin_types* flag was added." msgstr "新增 *use_builtin_types* 旗標。" -#: ../../library/xmlrpc.client.rst:70 +#: ../../library/xmlrpc.client.rst:72 msgid "The *headers* parameter was added." msgstr "新增 *headers* 參數。" -#: ../../library/xmlrpc.client.rst:73 +#: ../../library/xmlrpc.client.rst:75 msgid "" "Both the HTTP and HTTPS transports support the URL syntax extension for HTTP " "Basic Authentication: ``http://user:pass@host:port/path``. The ``user:" "pass`` portion will be base64-encoded as an HTTP 'Authorization' header, and " "sent to the remote server as part of the connection process when invoking an " "XML-RPC method. You only need to use this if the remote server requires a " -"Basic Authentication user and password. If an HTTPS URL is provided, " -"*context* may be :class:`ssl.SSLContext` and configures the SSL settings of " -"the underlying HTTPS connection." +"Basic Authentication user and password." msgstr "" #: ../../library/xmlrpc.client.rst:82 diff --git a/library/zipfile.po b/library/zipfile.po index acfa9acf15..1d66416bb3 100644 --- a/library/zipfile.po +++ b/library/zipfile.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-09 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -213,7 +213,7 @@ msgid "" "accepted (see :class:`bz2 <bz2.BZ2File>` for more information)." msgstr "" -#: ../../library/zipfile.rst:187 ../../library/zipfile.rst:760 +#: ../../library/zipfile.rst:187 ../../library/zipfile.rst:768 msgid "" "The *strict_timestamps* argument, when set to ``False``, allows to zip files " "older than 1980-01-01 at the cost of setting the timestamp to 1980-01-01. " @@ -274,7 +274,7 @@ msgstr "新增 :class:`ZipFile` 作為情境管理器使用的能力。" msgid "Added support for :mod:`bzip2 <bz2>` and :mod:`lzma` compression." msgstr "新增對於 :mod:`bzip2 <bz2>` 和 :mod:`lzma` 壓縮的支援。" -#: ../../library/zipfile.rst:227 ../../library/zipfile.rst:673 +#: ../../library/zipfile.rst:227 ../../library/zipfile.rst:681 msgid "ZIP64 extensions are enabled by default." msgstr "" @@ -292,15 +292,15 @@ msgstr "" #: ../../library/zipfile.rst:238 msgid "The *file* parameter accepts a :term:`path-like object`." -msgstr "" +msgstr "*file* 參數接受一個 :term:`path-like object`。" #: ../../library/zipfile.rst:241 msgid "Add the *compresslevel* parameter." -msgstr "" +msgstr "新增 *compresslevel* 參數。" #: ../../library/zipfile.rst:244 msgid "The *strict_timestamps* keyword-only parameter." -msgstr "" +msgstr "*strict_timestamps* 僅限關鍵字參數。" #: ../../library/zipfile.rst:247 msgid "" @@ -656,20 +656,31 @@ msgid "" "file.txt', 'dir/', or ''. Defaults to the empty string, indicating the root." msgstr "" -#: ../../library/zipfile.rst:546 +#: ../../library/zipfile.rst:547 +msgid "" +"The :class:`Path` class does not sanitize filenames within the ZIP archive. " +"Unlike the :meth:`ZipFile.extract` and :meth:`ZipFile.extractall` methods, " +"it is the caller's responsibility to validate or sanitize filenames to " +"prevent path traversal vulnerabilities (e.g., filenames containing \"..\" or " +"absolute paths). When handling untrusted archives, consider resolving " +"filenames using :func:`os.path.abspath` and checking against the target " +"directory with :func:`os.path.commonpath`." +msgstr "" + +#: ../../library/zipfile.rst:554 msgid "" "Path objects expose the following features of :mod:`pathlib.Path` objects:" msgstr "" -#: ../../library/zipfile.rst:549 +#: ../../library/zipfile.rst:557 msgid "Path objects are traversable using the ``/`` operator or ``joinpath``." msgstr "" -#: ../../library/zipfile.rst:553 +#: ../../library/zipfile.rst:561 msgid "The final path component." msgstr "" -#: ../../library/zipfile.rst:557 +#: ../../library/zipfile.rst:565 msgid "" "Invoke :meth:`ZipFile.open` on the current path. Allows opening for read or " "write, text or binary through supported modes: 'r', 'w', 'rb', 'wb'. " @@ -678,12 +689,12 @@ msgid "" "``pwd`` parameter to :meth:`ZipFile.open`." msgstr "" -#: ../../library/zipfile.rst:566 +#: ../../library/zipfile.rst:574 msgid "" "Added support for text and binary modes for open. Default mode is now text." msgstr "" -#: ../../library/zipfile.rst:570 ../../library/zipfile.rst:631 +#: ../../library/zipfile.rst:578 ../../library/zipfile.rst:639 msgid "" "The ``encoding`` parameter can be supplied as a positional argument without " "causing a :exc:`TypeError`. As it could in 3.9. Code needing to be " @@ -691,134 +702,134 @@ msgid "" "TextIOWrapper` arguments, ``encoding`` included, as keywords." msgstr "" -#: ../../library/zipfile.rst:578 +#: ../../library/zipfile.rst:586 msgid "Enumerate the children of the current directory." msgstr "" -#: ../../library/zipfile.rst:582 +#: ../../library/zipfile.rst:590 msgid "Return ``True`` if the current context references a directory." msgstr "" -#: ../../library/zipfile.rst:586 +#: ../../library/zipfile.rst:594 msgid "Return ``True`` if the current context references a file." msgstr "" -#: ../../library/zipfile.rst:590 +#: ../../library/zipfile.rst:598 msgid "Return ``True`` if the current context references a symbolic link." msgstr "" -#: ../../library/zipfile.rst:594 +#: ../../library/zipfile.rst:602 msgid "Previously, ``is_symlink`` would unconditionally return ``False``." msgstr "" -#: ../../library/zipfile.rst:599 +#: ../../library/zipfile.rst:607 msgid "" "Return ``True`` if the current context references a file or directory in the " "zip file." msgstr "" -#: ../../library/zipfile.rst:604 +#: ../../library/zipfile.rst:612 msgid "" "The last dot-separated portion of the final component, if any. This is " "commonly called the file extension." msgstr "" -#: ../../library/zipfile.rst:607 +#: ../../library/zipfile.rst:615 msgid "Added :data:`Path.suffix` property." msgstr "新增 :data:`Path.suffix` 特性。" -#: ../../library/zipfile.rst:612 +#: ../../library/zipfile.rst:620 msgid "The final path component, without its suffix." msgstr "" -#: ../../library/zipfile.rst:614 +#: ../../library/zipfile.rst:622 msgid "Added :data:`Path.stem` property." msgstr "新增 :data:`Path.stem` 特性。" -#: ../../library/zipfile.rst:619 +#: ../../library/zipfile.rst:627 msgid "A list of the path’s suffixes, commonly called file extensions." msgstr "" -#: ../../library/zipfile.rst:621 +#: ../../library/zipfile.rst:629 msgid "Added :data:`Path.suffixes` property." msgstr "新增 :data:`Path.suffixes` 特性。" -#: ../../library/zipfile.rst:626 +#: ../../library/zipfile.rst:634 msgid "" "Read the current file as unicode text. Positional and keyword arguments are " "passed through to :class:`io.TextIOWrapper` (except ``buffer``, which is " "implied by the context)." msgstr "" -#: ../../library/zipfile.rst:639 +#: ../../library/zipfile.rst:647 msgid "Read the current file as bytes." msgstr "" -#: ../../library/zipfile.rst:643 +#: ../../library/zipfile.rst:651 msgid "" "Return a new Path object with each of the *other* arguments joined. The " "following are equivalent::" msgstr "" -#: ../../library/zipfile.rst:646 +#: ../../library/zipfile.rst:654 msgid "" ">>> Path(...).joinpath('child').joinpath('grandchild')\n" ">>> Path(...).joinpath('child', 'grandchild')\n" ">>> Path(...) / 'child' / 'grandchild'" msgstr "" -#: ../../library/zipfile.rst:650 +#: ../../library/zipfile.rst:658 msgid "" "Prior to 3.10, ``joinpath`` was undocumented and accepted exactly one " "parameter." msgstr "" -#: ../../library/zipfile.rst:654 +#: ../../library/zipfile.rst:662 msgid "" "The :pypi:`zipp` project provides backports of the latest path object " "functionality to older Pythons. Use ``zipp.Path`` in place of ``zipfile." "Path`` for early access to changes." msgstr "" -#: ../../library/zipfile.rst:662 +#: ../../library/zipfile.rst:670 msgid "PyZipFile Objects" msgstr "PyZipFile 物件" -#: ../../library/zipfile.rst:664 +#: ../../library/zipfile.rst:672 msgid "" "The :class:`PyZipFile` constructor takes the same parameters as the :class:" "`ZipFile` constructor, and one additional parameter, *optimize*." msgstr "" -#: ../../library/zipfile.rst:670 +#: ../../library/zipfile.rst:678 msgid "Added the *optimize* parameter." msgstr "新增 *optimize* 參數。" -#: ../../library/zipfile.rst:676 +#: ../../library/zipfile.rst:684 msgid "" "Instances have one method in addition to those of :class:`ZipFile` objects:" msgstr "" -#: ../../library/zipfile.rst:680 +#: ../../library/zipfile.rst:688 msgid "" "Search for files :file:`\\*.py` and add the corresponding file to the " "archive." msgstr "" -#: ../../library/zipfile.rst:683 +#: ../../library/zipfile.rst:691 msgid "" "If the *optimize* parameter to :class:`PyZipFile` was not given or ``-1``, " "the corresponding file is a :file:`\\*.pyc` file, compiling if necessary." msgstr "" -#: ../../library/zipfile.rst:686 +#: ../../library/zipfile.rst:694 msgid "" "If the *optimize* parameter to :class:`PyZipFile` was ``0``, ``1`` or ``2``, " "only files with that optimization level (see :func:`compile`) are added to " "the archive, compiling if necessary." msgstr "" -#: ../../library/zipfile.rst:690 +#: ../../library/zipfile.rst:698 msgid "" "If *pathname* is a file, the filename must end with :file:`.py`, and just " "the (corresponding :file:`\\*.pyc`) file is added at the top level (no path " @@ -831,11 +842,11 @@ msgid "" "in sorted order." msgstr "" -#: ../../library/zipfile.rst:700 +#: ../../library/zipfile.rst:708 msgid "*basename* is intended for internal use only." msgstr "" -#: ../../library/zipfile.rst:702 +#: ../../library/zipfile.rst:710 msgid "" "*filterfunc*, if given, must be a function taking a single string argument. " "It will be passed each path (including each individual full file path) " @@ -846,7 +857,7 @@ msgid "" "exclude them::" msgstr "" -#: ../../library/zipfile.rst:710 +#: ../../library/zipfile.rst:718 msgid "" ">>> zf = PyZipFile('myprog.zip')\n" ">>> def notests(s):\n" @@ -862,11 +873,11 @@ msgstr "" "...\n" ">>> zf.writepy('myprog', filterfunc=notests)" -#: ../../library/zipfile.rst:717 +#: ../../library/zipfile.rst:725 msgid "The :meth:`writepy` method makes archives with file names like this::" msgstr "" -#: ../../library/zipfile.rst:720 +#: ../../library/zipfile.rst:728 msgid "" "string.pyc # Top level name\n" "test/__init__.pyc # Package directory\n" @@ -875,302 +886,302 @@ msgid "" "test/bogus/myfile.pyc # Submodule test.bogus.myfile" msgstr "" -#: ../../library/zipfile.rst:726 +#: ../../library/zipfile.rst:734 msgid "Added the *filterfunc* parameter." msgstr "新增 *filterfunc* 參數。" -#: ../../library/zipfile.rst:729 +#: ../../library/zipfile.rst:737 msgid "The *pathname* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:732 +#: ../../library/zipfile.rst:740 msgid "Recursion sorts directory entries." msgstr "" -#: ../../library/zipfile.rst:739 +#: ../../library/zipfile.rst:747 msgid "ZipInfo Objects" msgstr "ZipInfo 物件" -#: ../../library/zipfile.rst:741 +#: ../../library/zipfile.rst:749 msgid "" "Instances of the :class:`ZipInfo` class are returned by the :meth:`.getinfo` " "and :meth:`.infolist` methods of :class:`ZipFile` objects. Each object " "stores information about a single member of the ZIP archive." msgstr "" -#: ../../library/zipfile.rst:745 +#: ../../library/zipfile.rst:753 msgid "" "There is one classmethod to make a :class:`ZipInfo` instance for a " "filesystem file:" msgstr "" -#: ../../library/zipfile.rst:751 +#: ../../library/zipfile.rst:759 msgid "" "Construct a :class:`ZipInfo` instance for a file on the filesystem, in " "preparation for adding it to a zip file." msgstr "" -#: ../../library/zipfile.rst:754 +#: ../../library/zipfile.rst:762 msgid "*filename* should be the path to a file or directory on the filesystem." msgstr "" -#: ../../library/zipfile.rst:756 +#: ../../library/zipfile.rst:764 msgid "" "If *arcname* is specified, it is used as the name within the archive. If " "*arcname* is not specified, the name will be the same as *filename*, but " "with any drive letter and leading path separators removed." msgstr "" -#: ../../library/zipfile.rst:768 +#: ../../library/zipfile.rst:776 msgid "The *filename* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:771 +#: ../../library/zipfile.rst:779 msgid "Added the *strict_timestamps* keyword-only parameter." msgstr "新增 *strict_timestamps* 僅限關鍵字參數。" -#: ../../library/zipfile.rst:775 +#: ../../library/zipfile.rst:783 msgid "Instances have the following methods and attributes:" msgstr "" -#: ../../library/zipfile.rst:779 +#: ../../library/zipfile.rst:787 msgid "Return ``True`` if this archive member is a directory." msgstr "" -#: ../../library/zipfile.rst:781 +#: ../../library/zipfile.rst:789 msgid "This uses the entry's name: directories should always end with ``/``." msgstr "" -#: ../../library/zipfile.rst:788 +#: ../../library/zipfile.rst:796 msgid "Name of the file in the archive." msgstr "" -#: ../../library/zipfile.rst:793 +#: ../../library/zipfile.rst:801 msgid "" "The time and date of the last modification to the archive member. This is a " "tuple of six values:" msgstr "" -#: ../../library/zipfile.rst:797 +#: ../../library/zipfile.rst:805 msgid "Index" msgstr "" -#: ../../library/zipfile.rst:797 +#: ../../library/zipfile.rst:805 msgid "Value" msgstr "" -#: ../../library/zipfile.rst:799 +#: ../../library/zipfile.rst:807 msgid "``0``" msgstr "``0``" -#: ../../library/zipfile.rst:799 +#: ../../library/zipfile.rst:807 msgid "Year (>= 1980)" msgstr "" -#: ../../library/zipfile.rst:801 +#: ../../library/zipfile.rst:809 msgid "``1``" msgstr "``1``" -#: ../../library/zipfile.rst:801 +#: ../../library/zipfile.rst:809 msgid "Month (one-based)" msgstr "" -#: ../../library/zipfile.rst:803 +#: ../../library/zipfile.rst:811 msgid "``2``" msgstr "``2``" -#: ../../library/zipfile.rst:803 +#: ../../library/zipfile.rst:811 msgid "Day of month (one-based)" msgstr "" -#: ../../library/zipfile.rst:805 +#: ../../library/zipfile.rst:813 msgid "``3``" msgstr "``3``" -#: ../../library/zipfile.rst:805 +#: ../../library/zipfile.rst:813 msgid "Hours (zero-based)" msgstr "" -#: ../../library/zipfile.rst:807 +#: ../../library/zipfile.rst:815 msgid "``4``" msgstr "``4``" -#: ../../library/zipfile.rst:807 +#: ../../library/zipfile.rst:815 msgid "Minutes (zero-based)" msgstr "" -#: ../../library/zipfile.rst:809 +#: ../../library/zipfile.rst:817 msgid "``5``" msgstr "``5``" -#: ../../library/zipfile.rst:809 +#: ../../library/zipfile.rst:817 msgid "Seconds (zero-based)" msgstr "" -#: ../../library/zipfile.rst:814 +#: ../../library/zipfile.rst:822 msgid "The ZIP file format does not support timestamps before 1980." msgstr "" -#: ../../library/zipfile.rst:819 +#: ../../library/zipfile.rst:827 msgid "Type of compression for the archive member." msgstr "" -#: ../../library/zipfile.rst:824 +#: ../../library/zipfile.rst:832 msgid "Comment for the individual archive member as a :class:`bytes` object." msgstr "" -#: ../../library/zipfile.rst:829 +#: ../../library/zipfile.rst:837 msgid "" "Expansion field data. The `PKZIP Application Note`_ contains some comments " "on the internal structure of the data contained in this :class:`bytes` " "object." msgstr "" -#: ../../library/zipfile.rst:836 +#: ../../library/zipfile.rst:844 msgid "System which created ZIP archive." msgstr "" -#: ../../library/zipfile.rst:841 +#: ../../library/zipfile.rst:849 msgid "PKZIP version which created ZIP archive." msgstr "" -#: ../../library/zipfile.rst:846 +#: ../../library/zipfile.rst:854 msgid "PKZIP version needed to extract archive." msgstr "" -#: ../../library/zipfile.rst:851 +#: ../../library/zipfile.rst:859 msgid "Must be zero." msgstr "" -#: ../../library/zipfile.rst:856 +#: ../../library/zipfile.rst:864 msgid "ZIP flag bits." msgstr "" -#: ../../library/zipfile.rst:861 +#: ../../library/zipfile.rst:869 msgid "Volume number of file header." msgstr "" -#: ../../library/zipfile.rst:866 +#: ../../library/zipfile.rst:874 msgid "Internal attributes." msgstr "" -#: ../../library/zipfile.rst:871 +#: ../../library/zipfile.rst:879 msgid "External file attributes." msgstr "" -#: ../../library/zipfile.rst:876 +#: ../../library/zipfile.rst:884 msgid "Byte offset to the file header." msgstr "" -#: ../../library/zipfile.rst:881 +#: ../../library/zipfile.rst:889 msgid "CRC-32 of the uncompressed file." msgstr "" -#: ../../library/zipfile.rst:886 +#: ../../library/zipfile.rst:894 msgid "Size of the compressed data." msgstr "" -#: ../../library/zipfile.rst:891 +#: ../../library/zipfile.rst:899 msgid "Size of the uncompressed file." msgstr "" -#: ../../library/zipfile.rst:898 +#: ../../library/zipfile.rst:906 msgid "Command-Line Interface" msgstr "" -#: ../../library/zipfile.rst:900 +#: ../../library/zipfile.rst:908 msgid "" "The :mod:`zipfile` module provides a simple command-line interface to " "interact with ZIP archives." msgstr "" -#: ../../library/zipfile.rst:903 +#: ../../library/zipfile.rst:911 msgid "" "If you want to create a new ZIP archive, specify its name after the :option:" "`-c` option and then list the filename(s) that should be included:" msgstr "" -#: ../../library/zipfile.rst:906 +#: ../../library/zipfile.rst:914 msgid "$ python -m zipfile -c monty.zip spam.txt eggs.txt" msgstr "$ python -m zipfile -c monty.zip spam.txt eggs.txt" -#: ../../library/zipfile.rst:910 +#: ../../library/zipfile.rst:918 msgid "Passing a directory is also acceptable:" msgstr "" -#: ../../library/zipfile.rst:912 +#: ../../library/zipfile.rst:920 msgid "$ python -m zipfile -c monty.zip life-of-brian_1979/" msgstr "$ python -m zipfile -c monty.zip life-of-brian_1979/" -#: ../../library/zipfile.rst:916 +#: ../../library/zipfile.rst:924 msgid "" "If you want to extract a ZIP archive into the specified directory, use the :" "option:`-e` option:" msgstr "" -#: ../../library/zipfile.rst:919 +#: ../../library/zipfile.rst:927 msgid "$ python -m zipfile -e monty.zip target-dir/" msgstr "$ python -m zipfile -e monty.zip target-dir/" -#: ../../library/zipfile.rst:923 +#: ../../library/zipfile.rst:931 msgid "For a list of the files in a ZIP archive, use the :option:`-l` option:" msgstr "" -#: ../../library/zipfile.rst:925 +#: ../../library/zipfile.rst:933 msgid "$ python -m zipfile -l monty.zip" msgstr "$ python -m zipfile -l monty.zip" -#: ../../library/zipfile.rst:931 +#: ../../library/zipfile.rst:939 msgid "Command-line options" msgstr "" -#: ../../library/zipfile.rst:936 +#: ../../library/zipfile.rst:944 msgid "List files in a zipfile." msgstr "" -#: ../../library/zipfile.rst:941 +#: ../../library/zipfile.rst:949 msgid "Create zipfile from source files." msgstr "" -#: ../../library/zipfile.rst:946 +#: ../../library/zipfile.rst:954 msgid "Extract zipfile into target directory." msgstr "" -#: ../../library/zipfile.rst:951 +#: ../../library/zipfile.rst:959 msgid "Test whether the zipfile is valid or not." msgstr "" -#: ../../library/zipfile.rst:955 +#: ../../library/zipfile.rst:963 msgid "" "Specify encoding of member names for :option:`-l`, :option:`-e` and :option:" "`-t`." msgstr "" -#: ../../library/zipfile.rst:962 +#: ../../library/zipfile.rst:970 msgid "Decompression pitfalls" msgstr "" -#: ../../library/zipfile.rst:964 +#: ../../library/zipfile.rst:972 msgid "" "The extraction in zipfile module might fail due to some pitfalls listed " "below." msgstr "" -#: ../../library/zipfile.rst:967 +#: ../../library/zipfile.rst:975 msgid "From file itself" msgstr "" -#: ../../library/zipfile.rst:969 +#: ../../library/zipfile.rst:977 msgid "" "Decompression may fail due to incorrect password / CRC checksum / ZIP format " "or unsupported compression method / decryption." msgstr "" -#: ../../library/zipfile.rst:973 +#: ../../library/zipfile.rst:981 msgid "File System limitations" msgstr "" -#: ../../library/zipfile.rst:975 +#: ../../library/zipfile.rst:983 msgid "" "Exceeding limitations on different file systems can cause decompression " "failed. Such as allowable characters in the directory entries, length of the " @@ -1178,33 +1189,33 @@ msgid "" "files, etc." msgstr "" -#: ../../library/zipfile.rst:982 +#: ../../library/zipfile.rst:990 msgid "Resources limitations" msgstr "" -#: ../../library/zipfile.rst:984 +#: ../../library/zipfile.rst:992 msgid "" "The lack of memory or disk volume would lead to decompression failed. For " "example, decompression bombs (aka `ZIP bomb`_) apply to zipfile library that " "can cause disk volume exhaustion." msgstr "" -#: ../../library/zipfile.rst:989 +#: ../../library/zipfile.rst:997 msgid "Interruption" msgstr "" -#: ../../library/zipfile.rst:991 +#: ../../library/zipfile.rst:999 msgid "" "Interruption during the decompression, such as pressing control-C or killing " "the decompression process may result in incomplete decompression of the " "archive." msgstr "" -#: ../../library/zipfile.rst:995 +#: ../../library/zipfile.rst:1003 msgid "Default behaviors of extraction" msgstr "" -#: ../../library/zipfile.rst:997 +#: ../../library/zipfile.rst:1005 msgid "" "Not knowing the default extraction behaviors can cause unexpected " "decompression results. For example, when extracting the same archive twice, " diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index d887991a95..5e35865c21 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -33,10 +33,10 @@ msgstr "" msgid "" "The :keyword:`if`, :keyword:`while` and :keyword:`for` statements implement " "traditional control flow constructs. :keyword:`try` specifies exception " -"handlers and/or cleanup code for a group of statements, while the :keyword:" -"`with` statement allows the execution of initialization and finalization " -"code around a block of code. Function and class definitions are also " -"syntactically compound statements." +"handlers and/or cleanup code for a group of statements, while " +"the :keyword:`with` statement allows the execution of initialization and " +"finalization code around a block of code. Function and class definitions " +"are also syntactically compound statements." msgstr "" #: ../../reference/compound_stmts.rst:26 @@ -78,8 +78,8 @@ msgid "" "Note that statements always end in a ``NEWLINE`` possibly followed by a " "``DEDENT``. Also note that optional continuation clauses always begin with " "a keyword that cannot start a statement, thus there are no ambiguities (the " -"'dangling :keyword:`else`' problem is solved in Python by requiring nested :" -"keyword:`if` statements to be indented)." +"'dangling :keyword:`else`' problem is solved in Python by requiring " +"nested :keyword:`if` statements to be indented)." msgstr "" #: ../../reference/compound_stmts.rst:75 @@ -127,9 +127,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:133 msgid "" "A :keyword:`break` statement executed in the first suite terminates the loop " -"without executing the :keyword:`!else` clause's suite. A :keyword:" -"`continue` statement executed in the first suite skips the rest of the suite " -"and goes back to testing the expression." +"without executing the :keyword:`!else` clause's suite. " +"A :keyword:`continue` statement executed in the first suite skips the rest " +"of the suite and goes back to testing the expression." msgstr "" #: ../../reference/compound_stmts.rst:142 @@ -144,22 +144,23 @@ msgstr "" #: ../../reference/compound_stmts.rst:160 msgid "" -"The ``starred_list`` expression is evaluated once; it should yield an :term:" -"`iterable` object. An :term:`iterator` is created for that iterable. The " -"first item provided by the iterator is then assigned to the target list " -"using the standard rules for assignments (see :ref:`assignment`), and the " -"suite is executed. This repeats for each item provided by the iterator. " -"When the iterator is exhausted, the suite in the :keyword:`!else` clause, if " -"present, is executed, and the loop terminates." +"The ``starred_list`` expression is evaluated once; it should yield " +"an :term:`iterable` object. An :term:`iterator` is created for that " +"iterable. The first item provided by the iterator is then assigned to the " +"target list using the standard rules for assignments " +"(see :ref:`assignment`), and the suite is executed. This repeats for each " +"item provided by the iterator. When the iterator is exhausted, the suite in " +"the :keyword:`!else` clause, if present, is executed, and the loop " +"terminates." msgstr "" #: ../../reference/compound_stmts.rst:173 msgid "" "A :keyword:`break` statement executed in the first suite terminates the loop " -"without executing the :keyword:`!else` clause's suite. A :keyword:" -"`continue` statement executed in the first suite skips the rest of the suite " -"and continues with the next item, or with the :keyword:`!else` clause if " -"there is no next item." +"without executing the :keyword:`!else` clause's suite. " +"A :keyword:`continue` statement executed in the first suite skips the rest " +"of the suite and continues with the next item, or with the :keyword:`!else` " +"clause if there is no next item." msgstr "" #: ../../reference/compound_stmts.rst:179 @@ -203,9 +204,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:231 msgid "" -"Additional information on exceptions can be found in section :ref:" -"`exceptions`, and information on using the :keyword:`raise` statement to " -"generate exceptions may be found in section :ref:`raise`." +"Additional information on exceptions can be found in " +"section :ref:`exceptions`, and information on using the :keyword:`raise` " +"statement to generate exceptions may be found in section :ref:`raise`." msgstr "" #: ../../reference/compound_stmts.rst:239 @@ -251,13 +252,13 @@ msgstr "" #: ../../reference/compound_stmts.rst:267 msgid "" "When a matching :keyword:`!except` clause is found, the exception is " -"assigned to the target specified after the :keyword:`!as` keyword in that :" -"keyword:`!except` clause, if present, and the :keyword:`!except` clause's " -"suite is executed. All :keyword:`!except` clauses must have an executable " -"block. When the end of this block is reached, execution continues normally " -"after the entire :keyword:`try` statement. (This means that if two nested " -"handlers exist for the same exception, and the exception occurs in the :" -"keyword:`!try` clause of the inner handler, the outer handler will not " +"assigned to the target specified after the :keyword:`!as` keyword in " +"that :keyword:`!except` clause, if present, and the :keyword:`!except` " +"clause's suite is executed. All :keyword:`!except` clauses must have an " +"executable block. When the end of this block is reached, execution continues " +"normally after the entire :keyword:`try` statement. (This means that if two " +"nested handlers exist for the same exception, and the exception occurs in " +"the :keyword:`!try` clause of the inner handler, the outer handler will not " "handle the exception.)" msgstr "" @@ -355,15 +356,15 @@ msgstr ":keyword:`!except*` 子句" #: ../../reference/compound_stmts.rst:335 msgid "" -"The :keyword:`!except*` clause(s) are used for handling :exc:" -"`ExceptionGroup`\\s. The exception type for matching is interpreted as in " -"the case of :keyword:`except`, but in the case of exception groups we can " -"have partial matches when the type matches some of the exceptions in the " -"group. This means that multiple :keyword:`!except*` clauses can execute, " -"each handling part of the exception group. Each clause executes at most once " -"and handles an exception group of all matching exceptions. Each exception " -"in the group is handled by at most one :keyword:`!except*` clause, the first " -"that matches it. ::" +"The :keyword:`!except*` clause(s) are used for " +"handling :exc:`ExceptionGroup`\\s. The exception type for matching is " +"interpreted as in the case of :keyword:`except`, but in the case of " +"exception groups we can have partial matches when the type matches some of " +"the exceptions in the group. This means that multiple :keyword:`!except*` " +"clauses can execute, each handling part of the exception group. Each clause " +"executes at most once and handles an exception group of all matching " +"exceptions. Each exception in the group is handled by at most " +"one :keyword:`!except*` clause, the first that matches it. ::" msgstr "" #: ../../reference/compound_stmts.rst:345 @@ -427,8 +428,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:384 msgid "" "It is not possible to mix :keyword:`except` and :keyword:`!except*` in the " -"same :keyword:`try`. :keyword:`break`, :keyword:`continue` and :keyword:" -"`return` cannot appear in an :keyword:`!except*` clause." +"same :keyword:`try`. :keyword:`break`, :keyword:`continue` " +"and :keyword:`return` cannot appear in an :keyword:`!except*` clause." msgstr "" #: ../../reference/compound_stmts.rst:399 @@ -438,10 +439,10 @@ msgstr ":keyword:`!else` 子句" #: ../../reference/compound_stmts.rst:401 msgid "" "The optional :keyword:`!else` clause is executed if the control flow leaves " -"the :keyword:`try` suite, no exception was raised, and no :keyword:" -"`return`, :keyword:`continue`, or :keyword:`break` statement was executed. " -"Exceptions in the :keyword:`!else` clause are not handled by the preceding :" -"keyword:`except` clauses." +"the :keyword:`try` suite, no exception was raised, and " +"no :keyword:`return`, :keyword:`continue`, or :keyword:`break` statement was " +"executed. Exceptions in the :keyword:`!else` clause are not handled by the " +"preceding :keyword:`except` clauses." msgstr "" #: ../../reference/compound_stmts.rst:413 @@ -450,16 +451,16 @@ msgstr ":keyword:`!finally` 子句" #: ../../reference/compound_stmts.rst:415 msgid "" -"If :keyword:`!finally` is present, it specifies a 'cleanup' handler. The :" -"keyword:`try` clause is executed, including any :keyword:`except` and :" -"keyword:`else` clauses. If an exception occurs in any of the clauses and is " -"not handled, the exception is temporarily saved. The :keyword:`!finally` " -"clause is executed. If there is a saved exception it is re-raised at the " -"end of the :keyword:`!finally` clause. If the :keyword:`!finally` clause " -"raises another exception, the saved exception is set as the context of the " -"new exception. If the :keyword:`!finally` clause executes a :keyword:" -"`return`, :keyword:`break` or :keyword:`continue` statement, the saved " -"exception is discarded::" +"If :keyword:`!finally` is present, it specifies a 'cleanup' handler. " +"The :keyword:`try` clause is executed, including any :keyword:`except` " +"and :keyword:`else` clauses. If an exception occurs in any of the clauses " +"and is not handled, the exception is temporarily saved. The :keyword:`!" +"finally` clause is executed. If there is a saved exception it is re-raised " +"at the end of the :keyword:`!finally` clause. If the :keyword:`!finally` " +"clause raises another exception, the saved exception is set as the context " +"of the new exception. If the :keyword:`!finally` clause executes " +"a :keyword:`return`, :keyword:`break` or :keyword:`continue` statement, the " +"saved exception is discarded::" msgstr "" #: ../../reference/compound_stmts.rst:425 @@ -526,8 +527,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:460 msgid "" -"Prior to Python 3.8, a :keyword:`continue` statement was illegal in the :" -"keyword:`!finally` clause due to a problem with the implementation." +"Prior to Python 3.8, a :keyword:`continue` statement was illegal in " +"the :keyword:`!finally` clause due to a problem with the implementation." msgstr "" #: ../../reference/compound_stmts.rst:469 @@ -538,8 +539,8 @@ msgstr ":keyword:`!with` 陳述式" msgid "" "The :keyword:`with` statement is used to wrap the execution of a block with " "methods defined by a context manager (see section :ref:`context-managers`). " -"This allows common :keyword:`try`...\\ :keyword:`except`...\\ :keyword:" -"`finally` usage patterns to be encapsulated for convenient reuse." +"This allows common :keyword:`try`...\\ :keyword:`except`..." +"\\ :keyword:`finally` usage patterns to be encapsulated for convenient reuse." msgstr "" #: ../../reference/compound_stmts.rst:488 @@ -550,8 +551,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:490 msgid "" -"The context expression (the expression given in the :token:`~python-grammar:" -"with_item`) is evaluated to obtain a context manager." +"The context expression (the expression given in the :token:`~python-" +"grammar:with_item`) is evaluated to obtain a context manager." msgstr "" #: ../../reference/compound_stmts.rst:493 @@ -575,11 +576,11 @@ msgstr "" #: ../../reference/compound_stmts.rst:504 msgid "" -"The :keyword:`with` statement guarantees that if the :meth:`~object." -"__enter__` method returns without an error, then :meth:`~object.__exit__` " -"will always be called. Thus, if an error occurs during the assignment to the " -"target list, it will be treated the same as an error occurring within the " -"suite would be. See step 7 below." +"The :keyword:`with` statement guarantees that if " +"the :meth:`~object.__enter__` method returns without an error, " +"then :meth:`~object.__exit__` will always be called. Thus, if an error " +"occurs during the assignment to the target list, it will be treated the same " +"as an error occurring within the suite would be. See step 7 below." msgstr "" #: ../../reference/compound_stmts.rst:510 @@ -590,16 +591,16 @@ msgstr "" msgid "" "The context manager's :meth:`~object.__exit__` method is invoked. If an " "exception caused the suite to be exited, its type, value, and traceback are " -"passed as arguments to :meth:`~object.__exit__`. Otherwise, three :const:" -"`None` arguments are supplied." +"passed as arguments to :meth:`~object.__exit__`. Otherwise, " +"three :const:`None` arguments are supplied." msgstr "" #: ../../reference/compound_stmts.rst:517 msgid "" -"If the suite was exited due to an exception, and the return value from the :" -"meth:`~object.__exit__` method was false, the exception is reraised. If the " -"return value was true, the exception is suppressed, and execution continues " -"with the statement following the :keyword:`with` statement." +"If the suite was exited due to an exception, and the return value from " +"the :meth:`~object.__exit__` method was false, the exception is reraised. " +"If the return value was true, the exception is suppressed, and execution " +"continues with the statement following the :keyword:`with` statement." msgstr "" #: ../../reference/compound_stmts.rst:522 @@ -667,8 +668,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:550 msgid "" -"With more than one item, the context managers are processed as if multiple :" -"keyword:`with` statements were nested::" +"With more than one item, the context managers are processed as if " +"multiple :keyword:`with` statements were nested::" msgstr "" #: ../../reference/compound_stmts.rst:553 @@ -1047,8 +1048,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:846 msgid "" -"The rule ``strings`` and the token ``NUMBER`` are defined in the :doc:" -"`standard Python grammar <./grammar>`. Triple-quoted strings are " +"The rule ``strings`` and the token ``NUMBER`` are defined in " +"the :doc:`standard Python grammar <./grammar>`. Triple-quoted strings are " "supported. Raw strings and byte strings are supported. :ref:`f-strings` " "are not supported." msgstr "" @@ -1078,8 +1079,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:869 msgid "" "A single underscore ``_`` is not a capture pattern (this is what ``!'_'`` " -"expresses). It is instead treated as a :token:`~python-grammar:" -"wildcard_pattern`." +"expresses). It is instead treated as a :token:`~python-" +"grammar:wildcard_pattern`." msgstr "" #: ../../reference/compound_stmts.rst:873 @@ -1140,8 +1141,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:918 msgid "" -"In simple terms ``NAME1.NAME2`` will succeed only if ``<subject> == NAME1." -"NAME2``" +"In simple terms ``NAME1.NAME2`` will succeed only if ``<subject> == " +"NAME1.NAME2``" msgstr "" #: ../../reference/compound_stmts.rst:922 @@ -1353,8 +1354,8 @@ msgstr "" msgid "" "Key-value pairs are matched using the two-argument form of the mapping " "subject's ``get()`` method. Matched key-value pairs must already be present " -"in the mapping, and not created on-the-fly via :meth:`__missing__` or :meth:" -"`~object.__getitem__`." +"in the mapping, and not created on-the-fly via :meth:`__missing__` " +"or :meth:`~object.__getitem__`." msgstr "" #: ../../reference/compound_stmts.rst:1064 @@ -1401,14 +1402,14 @@ msgstr "" #: ../../reference/compound_stmts.rst:1094 msgid "" -"If ``name_or_attr`` is not an instance of the builtin :class:`type` , raise :" -"exc:`TypeError`." +"If ``name_or_attr`` is not an instance of the builtin :class:`type` , " +"raise :exc:`TypeError`." msgstr "" #: ../../reference/compound_stmts.rst:1097 msgid "" -"If the subject value is not an instance of ``name_or_attr`` (tested via :" -"func:`isinstance`), the class pattern fails." +"If the subject value is not an instance of ``name_or_attr`` (tested " +"via :func:`isinstance`), the class pattern fails." msgstr "" #: ../../reference/compound_stmts.rst:1100 @@ -1474,14 +1475,14 @@ msgstr "" #: ../../reference/compound_stmts.rst:1133 msgid "" -"If the returned value is not a tuple, the conversion fails and :exc:" -"`TypeError` is raised." +"If the returned value is not a tuple, the conversion fails " +"and :exc:`TypeError` is raised." msgstr "" #: ../../reference/compound_stmts.rst:1136 msgid "" -"If there are more positional patterns than ``len(cls.__match_args__)``, :exc:" -"`TypeError` is raised." +"If there are more positional patterns than " +"``len(cls.__match_args__)``, :exc:`TypeError` is raised." msgstr "" #: ../../reference/compound_stmts.rst:1139 @@ -1602,8 +1603,8 @@ msgstr "函式定義" #: ../../reference/compound_stmts.rst:1208 msgid "" -"A function definition defines a user-defined function object (see section :" -"ref:`types`):" +"A function definition defines a user-defined function object (see " +"section :ref:`types`):" msgstr "" #: ../../reference/compound_stmts.rst:1230 @@ -1663,9 +1664,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:1260 msgid "" -"Functions may be decorated with any valid :token:`~python-grammar:" -"assignment_expression`. Previously, the grammar was much more restrictive; " -"see :pep:`614` for details." +"Functions may be decorated with any valid :token:`~python-" +"grammar:assignment_expression`. Previously, the grammar was much more " +"restrictive; see :pep:`614` for details." msgstr "" #: ../../reference/compound_stmts.rst:1265 @@ -1718,18 +1719,18 @@ msgstr "" #: ../../reference/compound_stmts.rst:1309 msgid "" -"Function call semantics are described in more detail in section :ref:" -"`calls`. A function call always assigns values to all parameters mentioned " -"in the parameter list, either from positional arguments, from keyword " -"arguments, or from default values. If the form \"``*identifier``\" is " -"present, it is initialized to a tuple receiving any excess positional " -"parameters, defaulting to the empty tuple. If the form \"``**identifier``\" " -"is present, it is initialized to a new ordered mapping receiving any excess " -"keyword arguments, defaulting to a new empty mapping of the same type. " -"Parameters after \"``*``\" or \"``*identifier``\" are keyword-only " -"parameters and may only be passed by keyword arguments. Parameters before " -"\"``/``\" are positional-only parameters and may only be passed by " -"positional arguments." +"Function call semantics are described in more detail in " +"section :ref:`calls`. A function call always assigns values to all " +"parameters mentioned in the parameter list, either from positional " +"arguments, from keyword arguments, or from default values. If the form " +"\"``*identifier``\" is present, it is initialized to a tuple receiving any " +"excess positional parameters, defaulting to the empty tuple. If the form " +"\"``**identifier``\" is present, it is initialized to a new ordered mapping " +"receiving any excess keyword arguments, defaulting to a new empty mapping of " +"the same type. Parameters after \"``*``\" or \"``*identifier``\" are " +"keyword-only parameters and may only be passed by keyword arguments. " +"Parameters before \"``/``\" are positional-only parameters and may only be " +"passed by positional arguments." msgstr "" #: ../../reference/compound_stmts.rst:1321 @@ -1748,8 +1749,8 @@ msgid "" "of the form \"``-> expression``\" after the parameter list. These " "annotations can be any valid Python expression. The presence of annotations " "does not change the semantics of a function. The annotation values are " -"available as values of a dictionary keyed by the parameters' names in the :" -"attr:`__annotations__` attribute of the function object. If the " +"available as values of a dictionary keyed by the parameters' names in " +"the :attr:`__annotations__` attribute of the function object. If the " "``annotations`` import from :mod:`__future__` is used, annotations are " "preserved as strings at runtime which enables postponed evaluation. " "Otherwise, they are evaluated when the function definition is executed. In " @@ -1770,8 +1771,8 @@ msgid "" "described in section :ref:`lambda`. Note that the lambda expression is " "merely a shorthand for a simplified function definition; a function defined " "in a \":keyword:`def`\" statement can be passed around or assigned to " -"another name just like a function defined by a lambda expression. The \":" -"keyword:`!def`\" form is actually more powerful since it allows the " +"another name just like a function defined by a lambda expression. The " +"\":keyword:`!def`\" form is actually more powerful since it allows the " "execution of multiple statements and annotations." msgstr "" @@ -1794,15 +1795,15 @@ msgstr "" #: ../../reference/compound_stmts.rst:1369 msgid ":pep:`484` - Type Hints" -msgstr "" +msgstr ":pep:`484` - 型別提示" #: ../../reference/compound_stmts.rst:1370 msgid "Definition of a standard meaning for annotations: type hints." -msgstr "" +msgstr "定義註釋的標準意義:型別提示。" #: ../../reference/compound_stmts.rst:1372 msgid ":pep:`526` - Syntax for Variable Annotations" -msgstr "" +msgstr ":pep:`526` - 變數註釋的語法" #: ../../reference/compound_stmts.rst:1373 msgid "" @@ -1869,14 +1870,14 @@ msgstr "" #: ../../reference/compound_stmts.rst:1423 msgid "" -"The class's suite is then executed in a new execution frame (see :ref:" -"`naming`), using a newly created local namespace and the original global " -"namespace. (Usually, the suite contains mostly function definitions.) When " -"the class's suite finishes execution, its execution frame is discarded but " -"its local namespace is saved. [#]_ A class object is then created using the " -"inheritance list for the base classes and the saved local namespace for the " -"attribute dictionary. The class name is bound to this class object in the " -"original local namespace." +"The class's suite is then executed in a new execution frame " +"(see :ref:`naming`), using a newly created local namespace and the original " +"global namespace. (Usually, the suite contains mostly function " +"definitions.) When the class's suite finishes execution, its execution " +"frame is discarded but its local namespace is saved. [#]_ A class object is " +"then created using the inheritance list for the base classes and the saved " +"local namespace for the attribute dictionary. The class name is bound to " +"this class object in the original local namespace." msgstr "" #: ../../reference/compound_stmts.rst:1432 @@ -1923,9 +1924,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:1456 msgid "" -"Classes may be decorated with any valid :token:`~python-grammar:" -"assignment_expression`. Previously, the grammar was much more restrictive; " -"see :pep:`614` for details." +"Classes may be decorated with any valid :token:`~python-" +"grammar:assignment_expression`. Previously, the grammar was much more " +"restrictive; see :pep:`614` for details." msgstr "" #: ../../reference/compound_stmts.rst:1461 @@ -1933,8 +1934,8 @@ msgid "" "A list of :ref:`type parameters <type-params>` may be given in square " "brackets immediately after the class's name. This indicates to static type " "checkers that the class is generic. At runtime, the type parameters can be " -"retrieved from the class's :attr:`~type.__type_params__` attribute. See :ref:" -"`generic-classes` for more." +"retrieved from the class's :attr:`~type.__type_params__` attribute. " +"See :ref:`generic-classes` for more." msgstr "" #: ../../reference/compound_stmts.rst:1470 @@ -2178,9 +2179,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:1645 msgid "" -":ref:`Functions <def>` (including :ref:`coroutines <async def>`), :ref:" -"`classes <class>` and :ref:`type aliases <type>` may contain a type " -"parameter list::" +":ref:`Functions <def>` (including :ref:`coroutines <async " +"def>`), :ref:`classes <class>` and :ref:`type aliases <type>` may contain a " +"type parameter list::" msgstr "" #: ../../reference/compound_stmts.rst:1649 @@ -2237,8 +2238,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:1678 msgid "" -"Generic functions, classes, and type aliases have a :attr:`~definition." -"__type_params__` attribute listing their type parameters." +"Generic functions, classes, and type aliases have " +"a :attr:`~definition.__type_params__` attribute listing their type " +"parameters." msgstr "" #: ../../reference/compound_stmts.rst:1681 @@ -2381,8 +2383,8 @@ msgid "" "Here ``annotation-def`` indicates an :ref:`annotation scope <annotation-" "scopes>`, which is not actually bound to any name at runtime. (One other " "liberty is taken in the translation: the syntax does not go through " -"attribute access on the :mod:`typing` module, but creates an instance of :" -"data:`typing.TypeVar` directly.)" +"attribute access on the :mod:`typing` module, but creates an instance " +"of :data:`typing.TypeVar` directly.)" msgstr "" #: ../../reference/compound_stmts.rst:1760 @@ -2410,8 +2412,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:1771 msgid "" -"Except for the :ref:`lazy evaluation <lazy-evaluation>` of the :class:" -"`~typing.TypeVar` bound, this is equivalent to::" +"Except for the :ref:`lazy evaluation <lazy-evaluation>` of " +"the :class:`~typing.TypeVar` bound, this is equivalent to::" msgstr "" #: ../../reference/compound_stmts.rst:1774 @@ -2474,9 +2476,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:1815 msgid "" -"Here again ``annotation-def`` (not a real keyword) indicates an :ref:" -"`annotation scope <annotation-scopes>`, and the name ``TYPE_PARAMS_OF_Bag`` " -"is not actually bound at runtime." +"Here again ``annotation-def`` (not a real keyword) indicates " +"an :ref:`annotation scope <annotation-scopes>`, and the name " +"``TYPE_PARAMS_OF_Bag`` is not actually bound at runtime." msgstr "" #: ../../reference/compound_stmts.rst:1819 @@ -2563,9 +2565,9 @@ msgstr "註解" #: ../../reference/compound_stmts.rst:1865 msgid "" -"The exception is propagated to the invocation stack unless there is a :" -"keyword:`finally` clause which happens to raise another exception. That new " -"exception causes the old one to be lost." +"The exception is propagated to the invocation stack unless there is " +"a :keyword:`finally` clause which happens to raise another exception. That " +"new exception causes the old one to be lost." msgstr "" #: ../../reference/compound_stmts.rst:1869 @@ -2637,8 +2639,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:1895 msgid "" -"The standard library classes :class:`dict` and :class:`types." -"MappingProxyType` are mappings." +"The standard library classes :class:`dict` " +"and :class:`types.MappingProxyType` are mappings." msgstr "" #: ../../reference/compound_stmts.rst:1898 diff --git a/reference/datamodel.po b/reference/datamodel.po index ab96edc064..64c1ab3aff 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -66,8 +66,8 @@ msgid "" msgstr "" "一個物件的型別決定了該物件所支援的操作(例如「它有長度嗎?」),也同時定義該" "型別的物件能夠擁有的數值。:func:`type` 函式會回傳一個物件的型別(而該型別本身" -"也是一個物件)。如同它的識別性,一個物件的型別 (:dfn:`type`) 也是不可變" -"的。\\ [#]_" +"也是一個物件)。如同它的識別性,一個物件的型別 (:dfn:`type`) 也是不可變的。" +"\\ [#]_" #: ../../reference/datamodel.rst:50 msgid "" @@ -137,9 +137,9 @@ msgid "" "is garbage-collected, but since garbage collection is not guaranteed to " "happen, such objects also provide an explicit way to release the external " "resource, usually a :meth:`!close` method. Programs are strongly recommended " -"to explicitly close such objects. The :keyword:`try`...\\ :keyword:" -"`finally` statement and the :keyword:`with` statement provide convenient " -"ways to do this." +"to explicitly close such objects. The :keyword:`try`..." +"\\ :keyword:`finally` statement and the :keyword:`with` statement provide " +"convenient ways to do this." msgstr "" "某些物件包含對於「外部」資源的參照,像是開啟的檔案或是視窗。基本上這些資源會" "在物件被回收時釋放,但因為垃圾回收不保證會發生,這種物件也會提供明確釋放外部" @@ -241,10 +241,10 @@ msgid "" "will then try the reflected operation, or some other fallback, depending on " "the operator.) It should not be evaluated in a boolean context." msgstr "" -"這個型別只有一個數值。只有一個物件有這個數值。這個物件由內建名稱 :data:" -"`NotImplemented` 存取。數字方法和 rich comparison 方法應該在沒有為所提供的運" -"算元實作該操作的時候回傳這個數值。(直譯器接下來則會依運算子嘗試反轉的操作或" -"是其他的後備方案。)它不應該在預期布林值的情境中被計算。" +"這個型別只有一個數值。只有一個物件有這個數值。這個物件由內建名" +"稱 :data:`NotImplemented` 存取。數字方法和 rich comparison 方法應該在沒有為所" +"提供的運算元實作該操作的時候回傳這個數值。(直譯器接下來則會依運算子嘗試反轉" +"的操作或是其他的後備方案。)它不應該在預期布林值的情境中被計算。" #: ../../reference/datamodel.rst:172 msgid "See :ref:`implementing-the-arithmetic-operations` for more details." @@ -288,8 +288,8 @@ msgstr "" #: ../../reference/datamodel.rst:204 msgid "" -"The string representations of the numeric classes, computed by :meth:" -"`~object.__repr__` and :meth:`~object.__str__`, have the following " +"The string representations of the numeric classes, computed " +"by :meth:`~object.__repr__` and :meth:`~object.__str__`, have the following " "properties:" msgstr "" @@ -463,9 +463,9 @@ msgid "" "The built-in function :func:`ord` converts a code point from its string form " "to an integer in the range ``0 - 10FFFF``; :func:`chr` converts an integer " "in the range ``0 - 10FFFF`` to the corresponding length ``1`` string " -"object. :meth:`str.encode` can be used to convert a :class:`str` to :class:" -"`bytes` using the given text encoding, and :meth:`bytes.decode` can be used " -"to achieve the opposite." +"object. :meth:`str.encode` can be used to convert a :class:`str` " +"to :class:`bytes` using the given text encoding, and :meth:`bytes.decode` " +"can be used to achieve the opposite." msgstr "" #: ../../reference/datamodel.rst:362 @@ -491,8 +491,8 @@ msgid "" "A bytes object is an immutable array. The items are 8-bit bytes, " "represented by integers in the range 0 <= x < 256. Bytes literals (like " "``b'abc'``) and the built-in :func:`bytes` constructor can be used to create " -"bytes objects. Also, bytes objects can be decoded to strings via the :meth:" -"`~bytes.decode` method." +"bytes objects. Also, bytes objects can be decoded to strings via " +"the :meth:`~bytes.decode` method." msgstr "" #: ../../reference/datamodel.rst:386 @@ -502,8 +502,8 @@ msgstr "可變序列" #: ../../reference/datamodel.rst:395 msgid "" "Mutable sequences can be changed after they are created. The subscription " -"and slicing notations can be used as the target of assignment and :keyword:" -"`del` (delete) statements." +"and slicing notations can be used as the target of assignment " +"and :keyword:`del` (delete) statements." msgstr "" #: ../../reference/datamodel.rst:403 @@ -533,8 +533,8 @@ msgstr "位元組陣列" #: ../../reference/datamodel.rst:418 msgid "" -"A bytearray object is a mutable array. They are created by the built-in :" -"func:`bytearray` constructor. Aside from being mutable (and hence " +"A bytearray object is a mutable array. They are created by the built-" +"in :func:`bytearray` constructor. Aside from being mutable (and hence " "unhashable), byte arrays otherwise provide the same interface and " "functionality as immutable :class:`bytes` objects." msgstr "" @@ -572,8 +572,8 @@ msgstr "Set(集合)" #: ../../reference/datamodel.rst:449 msgid "" "These represent a mutable set. They are created by the built-in :func:`set` " -"constructor and can be modified afterwards by several methods, such as :meth:" -"`~set.add`." +"constructor and can be modified afterwards by several methods, such " +"as :meth:`~set.add`." msgstr "" #: ../../reference/datamodel.rst:454 @@ -582,9 +582,10 @@ msgstr "Frozen set(凍結集合)" #: ../../reference/datamodel.rst:457 msgid "" -"These represent an immutable set. They are created by the built-in :func:" -"`frozenset` constructor. As a frozenset is immutable and :term:`hashable`, " -"it can be used again as an element of another set, or as a dictionary key." +"These represent an immutable set. They are created by the built-" +"in :func:`frozenset` constructor. As a frozenset is immutable " +"and :term:`hashable`, it can be used again as an element of another set, or " +"as a dictionary key." msgstr "" #: ../../reference/datamodel.rst:464 @@ -653,8 +654,8 @@ msgstr "可呼叫型別" #: ../../reference/datamodel.rst:525 msgid "" -"These are the types to which the function call operation (see section :ref:" -"`calls`) can be applied:" +"These are the types to which the function call operation (see " +"section :ref:`calls`) can be applied:" msgstr "" #: ../../reference/datamodel.rst:532 @@ -685,9 +686,9 @@ msgstr "含義" #: ../../reference/datamodel.rst:559 msgid "" -"A reference to the :class:`dictionary <dict>` that holds the function's :ref:" -"`global variables <naming>` -- the global namespace of the module in which " -"the function was defined." +"A reference to the :class:`dictionary <dict>` that holds the " +"function's :ref:`global variables <naming>` -- the global namespace of the " +"module in which the function was defined." msgstr "" #: ../../reference/datamodel.rst:564 @@ -717,8 +718,8 @@ msgstr "函式的文件字串,若不可用則為 ``None``。" #: ../../reference/datamodel.rst:597 msgid "" -"The function's name. See also: :attr:`__name__ attributes <definition." -"__name__>`." +"The function's name. See also: :attr:`__name__ attributes " +"<definition.__name__>`." msgstr "" #: ../../reference/datamodel.rst:601 @@ -748,28 +749,28 @@ msgstr "代表編譯函式主體的\\ :ref:`程式碼物件 <code-objects>`。" #: ../../reference/datamodel.rst:620 msgid "" -"The namespace supporting arbitrary function attributes. See also: :attr:" -"`__dict__ attributes <object.__dict__>`." +"The namespace supporting arbitrary function attributes. See " +"also: :attr:`__dict__ attributes <object.__dict__>`." msgstr "" #: ../../reference/datamodel.rst:624 msgid "" "A :class:`dictionary <dict>` containing annotations of :term:`parameters " "<parameter>`. The keys of the dictionary are the parameter names, and " -"``'return'`` for the return annotation, if provided. See also: :ref:" -"`annotations-howto`." +"``'return'`` for the return annotation, if provided. See " +"also: :ref:`annotations-howto`." msgstr "" #: ../../reference/datamodel.rst:631 msgid "" -"A :class:`dictionary <dict>` containing defaults for keyword-only :term:" -"`parameters <parameter>`." +"A :class:`dictionary <dict>` containing defaults for keyword-" +"only :term:`parameters <parameter>`." msgstr "" #: ../../reference/datamodel.rst:635 msgid "" -"A :class:`tuple` containing the :ref:`type parameters <type-params>` of a :" -"ref:`generic function <generic-functions>`." +"A :class:`tuple` containing the :ref:`type parameters <type-params>` of " +"a :ref:`generic function <generic-functions>`." msgstr "" #: ../../reference/datamodel.rst:640 @@ -789,8 +790,8 @@ msgstr "" #: ../../reference/datamodel.rst:651 msgid "" "Additional information about a function's definition can be retrieved from " -"its :ref:`code object <code-objects>` (accessible via the :attr:`~function." -"__code__` attribute)." +"its :ref:`code object <code-objects>` (accessible via " +"the :attr:`~function.__code__` attribute)." msgstr "" #: ../../reference/datamodel.rst:659 @@ -819,15 +820,15 @@ msgstr "" #: ../../reference/datamodel.rst:688 msgid "" -"The method's documentation (same as :attr:`method.__func__.__doc__ <function." -"__doc__>`). A :class:`string <str>` if the original function had a " +"The method's documentation (same as :attr:`method.__func__.__doc__ " +"<function.__doc__>`). A :class:`string <str>` if the original function had a " "docstring, else ``None``." msgstr "" #: ../../reference/datamodel.rst:694 msgid "" -"The name of the method (same as :attr:`method.__func__.__name__ <function." -"__name__>`)" +"The name of the method (same as :attr:`method.__func__.__name__ " +"<function.__name__>`)" msgstr "" #: ../../reference/datamodel.rst:698 @@ -845,43 +846,44 @@ msgstr "" msgid "" "User-defined method objects may be created when getting an attribute of a " "class (perhaps via an instance of that class), if that attribute is a user-" -"defined :ref:`function object <user-defined-funcs>` or a :class:" -"`classmethod` object." +"defined :ref:`function object <user-defined-funcs>` or " +"a :class:`classmethod` object." msgstr "" #: ../../reference/datamodel.rst:711 msgid "" -"When an instance method object is created by retrieving a user-defined :ref:" -"`function object <user-defined-funcs>` from a class via one of its " -"instances, its :attr:`~method.__self__` attribute is the instance, and the " -"method object is said to be *bound*. The new method's :attr:`~method." -"__func__` attribute is the original function object." +"When an instance method object is created by retrieving a user-" +"defined :ref:`function object <user-defined-funcs>` from a class via one of " +"its instances, its :attr:`~method.__self__` attribute is the instance, and " +"the method object is said to be *bound*. The new " +"method's :attr:`~method.__func__` attribute is the original function object." msgstr "" #: ../../reference/datamodel.rst:717 msgid "" -"When an instance method object is created by retrieving a :class:" -"`classmethod` object from a class or instance, its :attr:`~method.__self__` " -"attribute is the class itself, and its :attr:`~method.__func__` attribute is " -"the function object underlying the class method." +"When an instance method object is created by retrieving " +"a :class:`classmethod` object from a class or instance, " +"its :attr:`~method.__self__` attribute is the class itself, and " +"its :attr:`~method.__func__` attribute is the function object underlying the " +"class method." msgstr "" #: ../../reference/datamodel.rst:722 msgid "" -"When an instance method object is called, the underlying function (:attr:" -"`~method.__func__`) is called, inserting the class instance (:attr:`~method." -"__self__`) in front of the argument list. For instance, when :class:`!C` is " -"a class which contains a definition for a function :meth:`!f`, and ``x`` is " -"an instance of :class:`!C`, calling ``x.f(1)`` is equivalent to calling ``C." -"f(x, 1)``." +"When an instance method object is called, the underlying function " +"(:attr:`~method.__func__`) is called, inserting the class instance " +"(:attr:`~method.__self__`) in front of the argument list. For instance, " +"when :class:`!C` is a class which contains a definition for a " +"function :meth:`!f`, and ``x`` is an instance of :class:`!C`, calling " +"``x.f(1)`` is equivalent to calling ``C.f(x, 1)``." msgstr "" #: ../../reference/datamodel.rst:729 msgid "" "When an instance method object is derived from a :class:`classmethod` " "object, the \"class instance\" stored in :attr:`~method.__self__` will " -"actually be the class itself, so that calling either ``x.f(1)`` or ``C." -"f(1)`` is equivalent to calling ``f(C,1)`` where ``f`` is the underlying " +"actually be the class itself, so that calling either ``x.f(1)`` or " +"``C.f(1)`` is equivalent to calling ``f(C,1)`` where ``f`` is the underlying " "function." msgstr "" @@ -898,15 +900,15 @@ msgstr "產生器函式" #: ../../reference/datamodel.rst:747 msgid "" -"A function or method which uses the :keyword:`yield` statement (see section :" -"ref:`yield`) is called a :dfn:`generator function`. Such a function, when " -"called, always returns an :term:`iterator` object which can be used to " -"execute the body of the function: calling the iterator's :meth:`iterator." -"__next__` method will cause the function to execute until it provides a " -"value using the :keyword:`!yield` statement. When the function executes a :" -"keyword:`return` statement or falls off the end, a :exc:`StopIteration` " -"exception is raised and the iterator will have reached the end of the set of " -"values to be returned." +"A function or method which uses the :keyword:`yield` statement (see " +"section :ref:`yield`) is called a :dfn:`generator function`. Such a " +"function, when called, always returns an :term:`iterator` object which can " +"be used to execute the body of the function: calling the " +"iterator's :meth:`iterator.__next__` method will cause the function to " +"execute until it provides a value using the :keyword:`!yield` statement. " +"When the function executes a :keyword:`return` statement or falls off the " +"end, a :exc:`StopIteration` exception is raised and the iterator will have " +"reached the end of the set of values to be returned." msgstr "" #: ../../reference/datamodel.rst:759 @@ -916,10 +918,10 @@ msgstr "Coroutine(協程)函式" #: ../../reference/datamodel.rst:764 msgid "" "A function or method which is defined using :keyword:`async def` is called " -"a :dfn:`coroutine function`. Such a function, when called, returns a :term:" -"`coroutine` object. It may contain :keyword:`await` expressions, as well " -"as :keyword:`async with` and :keyword:`async for` statements. See also the :" -"ref:`coroutine-objects` section." +"a :dfn:`coroutine function`. Such a function, when called, returns " +"a :term:`coroutine` object. It may contain :keyword:`await` expressions, as " +"well as :keyword:`async with` and :keyword:`async for` statements. See also " +"the :ref:`coroutine-objects` section." msgstr "" #: ../../reference/datamodel.rst:772 @@ -937,13 +939,13 @@ msgstr "" #: ../../reference/datamodel.rst:784 msgid "" -"Calling the asynchronous iterator's :meth:`aiterator.__anext__ <object." -"__anext__>` method will return an :term:`awaitable` which when awaited will " -"execute until it provides a value using the :keyword:`yield` expression. " -"When the function executes an empty :keyword:`return` statement or falls off " -"the end, a :exc:`StopAsyncIteration` exception is raised and the " -"asynchronous iterator will have reached the end of the set of values to be " -"yielded." +"Calling the asynchronous iterator's :meth:`aiterator.__anext__ " +"<object.__anext__>` method will return an :term:`awaitable` which when " +"awaited will execute until it provides a value using the :keyword:`yield` " +"expression. When the function executes an empty :keyword:`return` statement " +"or falls off the end, a :exc:`StopAsyncIteration` exception is raised and " +"the asynchronous iterator will have reached the end of the set of values to " +"be yielded." msgstr "" #: ../../reference/datamodel.rst:797 @@ -957,17 +959,17 @@ msgid "" "standard built-in module). The number and type of the arguments are " "determined by the C function. Special read-only attributes:" msgstr "" -"一個內建函式物件是一個 C 函式的 wrapper。內建函式的範例有 :func:`len` 和 :" -"func:`math.sin`\\ (\\ :mod:`math` 是一個標準的內建模組)。內建函式的引數數量" -"與其型別由其包裝的 C 函式所決定。特殊唯讀屬性:" +"一個內建函式物件是一個 C 函式的 wrapper。內建函式的範例有 :func:`len` " +"和 :func:`math.sin`\\ (\\ :mod:`math` 是一個標準的內建模組)。內建函式的引數" +"數量與其型別由其包裝的 C 函式所決定。特殊唯讀屬性:" #: ../../reference/datamodel.rst:809 msgid "" ":attr:`!__doc__` is the function's documentation string, or ``None`` if " "unavailable. See :attr:`function.__doc__`." msgstr "" -":attr:`!__doc__` 是函式的文件字串,若不可用則為 ``None``。請見 :attr:" -"`function.__doc__`。" +":attr:`!__doc__` 是函式的文件字串,若不可用則為 ``None``。請" +"見 :attr:`function.__doc__`。" #: ../../reference/datamodel.rst:811 msgid "" @@ -993,10 +995,10 @@ msgid "" "This is really a different disguise of a built-in function, this time " "containing an object passed to the C function as an implicit extra " "argument. An example of a built-in method is ``alist.append()``, assuming " -"*alist* is a list object. In this case, the special read-only attribute :" -"attr:`!__self__` is set to the object denoted by *alist*. (The attribute has " -"the same semantics as it does with :attr:`other instance methods <method." -"__self__>`.)" +"*alist* is a list object. In this case, the special read-only " +"attribute :attr:`!__self__` is set to the object denoted by *alist*. (The " +"attribute has the same semantics as it does with :attr:`other instance " +"methods <method.__self__>`.)" msgstr "" #: ../../reference/datamodel.rst:838 @@ -1007,8 +1009,8 @@ msgstr "" msgid "" "Classes are callable. These objects normally act as factories for new " "instances of themselves, but variations are possible for class types that " -"override :meth:`~object.__new__`. The arguments of the call are passed to :" -"meth:`!__new__` and, in the typical case, to :meth:`~object.__init__` to " +"override :meth:`~object.__new__`. The arguments of the call are passed " +"to :meth:`!__new__` and, in the typical case, to :meth:`~object.__init__` to " "initialize the new instance." msgstr "" @@ -1018,8 +1020,8 @@ msgstr "類別實例" #: ../../reference/datamodel.rst:850 msgid "" -"Instances of arbitrary classes can be made callable by defining a :meth:" -"`~object.__call__` method in their class." +"Instances of arbitrary classes can be made callable by defining " +"a :meth:`~object.__call__` method in their class." msgstr "" #: ../../reference/datamodel.rst:857 @@ -1029,16 +1031,16 @@ msgstr "模組" #: ../../reference/datamodel.rst:863 msgid "" "Modules are a basic organizational unit of Python code, and are created by " -"the :ref:`import system <importsystem>` as invoked either by the :keyword:" -"`import` statement, or by calling functions such as :func:`importlib." -"import_module` and built-in :func:`__import__`. A module object has a " -"namespace implemented by a :class:`dictionary <dict>` object (this is the " -"dictionary referenced by the :attr:`~function.__globals__` attribute of " -"functions defined in the module). Attribute references are translated to " -"lookups in this dictionary, e.g., ``m.x`` is equivalent to ``m." -"__dict__[\"x\"]``. A module object does not contain the code object used to " -"initialize the module (since it isn't needed once the initialization is " -"done)." +"the :ref:`import system <importsystem>` as invoked either by " +"the :keyword:`import` statement, or by calling functions such " +"as :func:`importlib.import_module` and built-in :func:`__import__`. A " +"module object has a namespace implemented by a :class:`dictionary <dict>` " +"object (this is the dictionary referenced by " +"the :attr:`~function.__globals__` attribute of functions defined in the " +"module). Attribute references are translated to lookups in this dictionary, " +"e.g., ``m.x`` is equivalent to ``m.__dict__[\"x\"]``. A module object does " +"not contain the code object used to initialize the module (since it isn't " +"needed once the initialization is done)." msgstr "" #: ../../reference/datamodel.rst:876 @@ -1102,8 +1104,8 @@ msgstr "" #: ../../reference/datamodel.rst:935 msgid "" "This attribute must be set to the fully qualified name of the module. It is " -"expected to match the value of :attr:`module.__spec__.name <importlib." -"machinery.ModuleSpec.name>`." +"expected to match the value of :attr:`module.__spec__.name " +"<importlib.machinery.ModuleSpec.name>`." msgstr "" #: ../../reference/datamodel.rst:941 @@ -1124,9 +1126,9 @@ msgstr "" msgid "" "If the module is top-level (that is, not a part of any specific package) " "then the attribute should be set to ``''`` (the empty string). Otherwise, it " -"should be set to the name of the module's package (which can be equal to :" -"attr:`module.__name__` if the module itself is a package). See :pep:`366` " -"for further details." +"should be set to the name of the module's package (which can be equal " +"to :attr:`module.__name__` if the module itself is a package). " +"See :pep:`366` for further details." msgstr "" #: ../../reference/datamodel.rst:958 @@ -1141,9 +1143,9 @@ msgstr "" #: ../../reference/datamodel.rst:964 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.parent " -"<importlib.machinery.ModuleSpec.parent>` instead of :attr:`!module." -"__package__`. :attr:`__package__` is now only used as a fallback if :attr:`!" -"__spec__.parent` is not set, and this fallback path is deprecated." +"<importlib.machinery.ModuleSpec.parent>` instead of :attr:`!" +"module.__package__`. :attr:`__package__` is now only used as a fallback " +"if :attr:`!__spec__.parent` is not set, and this fallback path is deprecated." msgstr "" #: ../../reference/datamodel.rst:970 ../../reference/datamodel.rst:1011 @@ -1155,17 +1157,18 @@ msgstr "" #: ../../reference/datamodel.rst:975 msgid "" -"The value of :attr:`!__package__` is expected to be the same as :attr:" -"`__spec__.parent <importlib.machinery.ModuleSpec.parent>`. :attr:" -"`__package__` is now only used as a fallback during import resolution if :" -"attr:`!__spec__.parent` is not defined." +"The value of :attr:`!__package__` is expected to be the same " +"as :attr:`__spec__.parent " +"<importlib.machinery.ModuleSpec.parent>`. :attr:`__package__` is now only " +"used as a fallback during import resolution if :attr:`!__spec__.parent` is " +"not defined." msgstr "" #: ../../reference/datamodel.rst:981 msgid "" ":exc:`ImportWarning` is raised if an import resolution falls back to :attr:`!" -"__package__` instead of :attr:`__spec__.parent <importlib.machinery." -"ModuleSpec.parent>`." +"__package__` instead of :attr:`__spec__.parent " +"<importlib.machinery.ModuleSpec.parent>`." msgstr "" #: ../../reference/datamodel.rst:986 @@ -1195,16 +1198,16 @@ msgstr "" #: ../../reference/datamodel.rst:1002 msgid "" ":attr:`!__loader__` defaults to ``None`` for modules created dynamically " -"using the :class:`types.ModuleType` constructor; use :func:`importlib.util." -"module_from_spec` instead to ensure the attribute is set to a :term:`loader` " -"object." +"using the :class:`types.ModuleType` constructor; " +"use :func:`importlib.util.module_from_spec` instead to ensure the attribute " +"is set to a :term:`loader` object." msgstr "" #: ../../reference/datamodel.rst:1007 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.loader " -"<importlib.machinery.ModuleSpec.loader>` instead of :attr:`!module." -"__loader__`." +"<importlib.machinery.ModuleSpec.loader>` instead of :attr:`!" +"module.__loader__`." msgstr "" #: ../../reference/datamodel.rst:1016 @@ -1228,9 +1231,10 @@ msgstr "" #: ../../reference/datamodel.rst:1029 msgid "" -"It is **strongly** recommended that you use :attr:`module.__spec__." -"submodule_search_locations <importlib.machinery.ModuleSpec." -"submodule_search_locations>` instead of :attr:`!module.__path__`." +"It is **strongly** recommended that you " +"use :attr:`module.__spec__.submodule_search_locations " +"<importlib.machinery.ModuleSpec.submodule_search_locations>` instead " +"of :attr:`!module.__path__`." msgstr "" #: ../../reference/datamodel.rst:1036 @@ -1263,18 +1267,18 @@ msgstr "" #: ../../reference/datamodel.rst:1054 msgid "" "Note that :attr:`!__cached__` may be set even if :attr:`!__file__` is not " -"set. However, that scenario is quite atypical. Ultimately, the :term:" -"`loader` is what makes use of the module spec provided by the :term:`finder` " -"(from which :attr:`!__file__` and :attr:`!__cached__` are derived). So if a " -"loader can load from a cached module but otherwise does not load from a " -"file, that atypical scenario may be appropriate." +"set. However, that scenario is quite atypical. Ultimately, " +"the :term:`loader` is what makes use of the module spec provided by " +"the :term:`finder` (from which :attr:`!__file__` and :attr:`!__cached__` are " +"derived). So if a loader can load from a cached module but otherwise does " +"not load from a file, that atypical scenario may be appropriate." msgstr "" #: ../../reference/datamodel.rst:1061 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.cached " -"<importlib.machinery.ModuleSpec.cached>` instead of :attr:`!module." -"__cached__`." +"<importlib.machinery.ModuleSpec.cached>` instead of :attr:`!" +"module.__cached__`." msgstr "" #: ../../reference/datamodel.rst:1065 @@ -1297,8 +1301,8 @@ msgstr "" #: ../../reference/datamodel.rst:1079 msgid "" -"The module's documentation string, or ``None`` if unavailable. See also: :" -"attr:`__doc__ attributes <definition.__doc__>`." +"The module's documentation string, or ``None`` if unavailable. See " +"also: :attr:`__doc__ attributes <definition.__doc__>`." msgstr "" "模組的文件字串,若不可用則為 ``None``。請見 :attr:`__doc__ attributes " "<definition.__doc__>`。" @@ -1306,8 +1310,8 @@ msgstr "" #: ../../reference/datamodel.rst:1084 msgid "" "A dictionary containing :term:`variable annotations <variable annotation>` " -"collected during module body execution. For best practices on working with :" -"attr:`__annotations__`, please see :ref:`annotations-howto`." +"collected during module body execution. For best practices on working " +"with :attr:`__annotations__`, please see :ref:`annotations-howto`." msgstr "" #: ../../reference/datamodel.rst:1090 @@ -1339,25 +1343,25 @@ msgstr "" #: ../../reference/datamodel.rst:1114 msgid "" -"Custom class types are typically created by class definitions (see section :" -"ref:`class`). A class has a namespace implemented by a dictionary object. " -"Class attribute references are translated to lookups in this dictionary, e." -"g., ``C.x`` is translated to ``C.__dict__[\"x\"]`` (although there are a " -"number of hooks which allow for other means of locating attributes). When " -"the attribute name is not found there, the attribute search continues in the " -"base classes. This search of the base classes uses the C3 method resolution " -"order which behaves correctly even in the presence of 'diamond' inheritance " -"structures where there are multiple inheritance paths leading back to a " -"common ancestor. Additional details on the C3 MRO used by Python can be " -"found at :ref:`python_2.3_mro`." +"Custom class types are typically created by class definitions (see " +"section :ref:`class`). A class has a namespace implemented by a dictionary " +"object. Class attribute references are translated to lookups in this " +"dictionary, e.g., ``C.x`` is translated to ``C.__dict__[\"x\"]`` (although " +"there are a number of hooks which allow for other means of locating " +"attributes). When the attribute name is not found there, the attribute " +"search continues in the base classes. This search of the base classes uses " +"the C3 method resolution order which behaves correctly even in the presence " +"of 'diamond' inheritance structures where there are multiple inheritance " +"paths leading back to a common ancestor. Additional details on the C3 MRO " +"used by Python can be found at :ref:`python_2.3_mro`." msgstr "" #: ../../reference/datamodel.rst:1135 msgid "" "When a class attribute reference (for class :class:`!C`, say) would yield a " -"class method object, it is transformed into an instance method object whose :" -"attr:`~method.__self__` attribute is :class:`!C`. When it would yield a :" -"class:`staticmethod` object, it is transformed into the object wrapped by " +"class method object, it is transformed into an instance method object " +"whose :attr:`~method.__self__` attribute is :class:`!C`. When it would yield " +"a :class:`staticmethod` object, it is transformed into the object wrapped by " "the static method object. See section :ref:`descriptors` for another way in " "which attributes retrieved from a class may differ from those actually " "contained in its :attr:`~object.__dict__`." @@ -1381,8 +1385,8 @@ msgstr "特殊屬性" #: ../../reference/datamodel.rst:1174 msgid "" -"The class's name. See also: :attr:`__name__ attributes <definition." -"__name__>`." +"The class's name. See also: :attr:`__name__ attributes " +"<definition.__name__>`." msgstr "" #: ../../reference/datamodel.rst:1178 @@ -1398,8 +1402,8 @@ msgstr "" #: ../../reference/datamodel.rst:1185 msgid "" "A :class:`mapping proxy <types.MappingProxyType>` providing a read-only view " -"of the class's namespace. See also: :attr:`__dict__ attributes <object." -"__dict__>`." +"of the class's namespace. See also: :attr:`__dict__ attributes " +"<object.__dict__>`." msgstr "" #: ../../reference/datamodel.rst:1190 @@ -1418,22 +1422,22 @@ msgstr "" #: ../../reference/datamodel.rst:1199 msgid "" "A dictionary containing :term:`variable annotations <variable annotation>` " -"collected during class body execution. For best practices on working with :" -"attr:`!__annotations__`, please see :ref:`annotations-howto`." +"collected during class body execution. For best practices on working " +"with :attr:`!__annotations__`, please see :ref:`annotations-howto`." msgstr "" #: ../../reference/datamodel.rst:1206 msgid "" "Accessing the :attr:`!__annotations__` attribute of a class object directly " "may yield incorrect results in the presence of metaclasses. In addition, the " -"attribute may not exist for some classes. Use :func:`inspect." -"get_annotations` to retrieve class annotations safely." +"attribute may not exist for some classes. " +"Use :func:`inspect.get_annotations` to retrieve class annotations safely." msgstr "" #: ../../reference/datamodel.rst:1213 msgid "" -"A :class:`tuple` containing the :ref:`type parameters <type-params>` of a :" -"ref:`generic class <generic-classes>`." +"A :class:`tuple` containing the :ref:`type parameters <type-params>` of " +"a :ref:`generic class <generic-classes>`." msgstr "" #: ../../reference/datamodel.rst:1219 @@ -1508,16 +1512,16 @@ msgid "" "\"Classes\". See section :ref:`descriptors` for another way in which " "attributes of a class retrieved via its instances may differ from the " "objects actually stored in the class's :attr:`~object.__dict__`. If no " -"class attribute is found, and the object's class has a :meth:`~object." -"__getattr__` method, that is called to satisfy the lookup." +"class attribute is found, and the object's class has " +"a :meth:`~object.__getattr__` method, that is called to satisfy the lookup." msgstr "" #: ../../reference/datamodel.rst:1287 msgid "" "Attribute assignments and deletions update the instance's dictionary, never " -"a class's dictionary. If the class has a :meth:`~object.__setattr__` or :" -"meth:`~object.__delattr__` method, this is called instead of updating the " -"instance dictionary directly." +"a class's dictionary. If the class has a :meth:`~object.__setattr__` " +"or :meth:`~object.__delattr__` method, this is called instead of updating " +"the instance dictionary directly." msgstr "" #: ../../reference/datamodel.rst:1297 @@ -1545,9 +1549,9 @@ msgstr "" msgid "" "A :term:`file object` represents an open file. Various shortcuts are " "available to create file objects: the :func:`open` built-in function, and " -"also :func:`os.popen`, :func:`os.fdopen`, and the :meth:`~socket.socket." -"makefile` method of socket objects (and perhaps by other functions or " -"methods provided by extension modules)." +"also :func:`os.popen`, :func:`os.fdopen`, and " +"the :meth:`~socket.socket.makefile` method of socket objects (and perhaps by " +"other functions or methods provided by extension modules)." msgstr "" #: ../../reference/datamodel.rst:1340 @@ -1575,14 +1579,15 @@ msgstr "程式碼物件" #: ../../reference/datamodel.rst:1366 msgid "" -"Code objects represent *byte-compiled* executable Python code, or :term:" -"`bytecode`. The difference between a code object and a function object is " -"that the function object contains an explicit reference to the function's " -"globals (the module in which it was defined), while a code object contains " -"no context; also the default argument values are stored in the function " -"object, not in the code object (because they represent values calculated at " -"run-time). Unlike function objects, code objects are immutable and contain " -"no references (directly or indirectly) to mutable objects." +"Code objects represent *byte-compiled* executable Python code, " +"or :term:`bytecode`. The difference between a code object and a function " +"object is that the function object contains an explicit reference to the " +"function's globals (the module in which it was defined), while a code object " +"contains no context; also the default argument values are stored in the " +"function object, not in the code object (because they represent values " +"calculated at run-time). Unlike function objects, code objects are " +"immutable and contain no references (directly or indirectly) to mutable " +"objects." msgstr "" #: ../../reference/datamodel.rst:1400 @@ -1695,9 +1700,9 @@ msgid "" "``0x04`` is set if the function uses the ``*arguments`` syntax to accept an " "arbitrary number of positional arguments; bit ``0x08`` is set if the " "function uses the ``**keywords`` syntax to accept arbitrary keyword " -"arguments; bit ``0x20`` is set if the function is a generator. See :ref:" -"`inspect-module-co-flags` for details on the semantics of each flags that " -"might be present." +"arguments; bit ``0x20`` is set if the function is a generator. " +"See :ref:`inspect-module-co-flags` for details on the semantics of each " +"flags that might be present." msgstr "" #: ../../reference/datamodel.rst:1482 @@ -1716,9 +1721,9 @@ msgstr "" #: ../../reference/datamodel.rst:1492 msgid "" -"If a code object represents a function, the first item in :attr:`~codeobject." -"co_consts` is the documentation string of the function, or ``None`` if " -"undefined." +"If a code object represents a function, the first item " +"in :attr:`~codeobject.co_consts` is the documentation string of the " +"function, or ``None`` if undefined." msgstr "" #: ../../reference/datamodel.rst:1497 @@ -1781,9 +1786,9 @@ msgstr "" #: ../../reference/datamodel.rst:1534 msgid "" -"Returns an iterator that yields information about successive ranges of :term:" -"`bytecode`\\s. Each item yielded is a ``(start, end, lineno)`` :class:" -"`tuple`:" +"Returns an iterator that yields information about successive ranges " +"of :term:`bytecode`\\s. Each item yielded is a ``(start, end, " +"lineno)`` :class:`tuple`:" msgstr "" #: ../../reference/datamodel.rst:1538 @@ -1800,9 +1805,9 @@ msgstr "" #: ../../reference/datamodel.rst:1542 msgid "" -"``lineno`` is an :class:`int` representing the line number of the :term:" -"`bytecode` range, or ``None`` if the bytecodes in the given range have no " -"line number" +"``lineno`` is an :class:`int` representing the line number of " +"the :term:`bytecode` range, or ``None`` if the bytecodes in the given range " +"have no line number" msgstr "" #: ../../reference/datamodel.rst:1546 @@ -1826,8 +1831,8 @@ msgstr "" #: ../../reference/datamodel.rst:1553 msgid "" -"The last :class:`tuple` yielded will have ``end`` equal to the size of the :" -"term:`bytecode`." +"The last :class:`tuple` yielded will have ``end`` equal to the size of " +"the :term:`bytecode`." msgstr "" #: ../../reference/datamodel.rst:1556 @@ -1875,8 +1880,8 @@ msgstr "" #: ../../reference/datamodel.rst:1605 msgid "" "The :ref:`code object <code-objects>` being executed in this frame. " -"Accessing this attribute raises an :ref:`auditing event <auditing>` ``object." -"__getattr__`` with arguments ``obj`` and ``\"f_code\"``." +"Accessing this attribute raises an :ref:`auditing event <auditing>` " +"``object.__getattr__`` with arguments ``obj`` and ``\"f_code\"``." msgstr "" "在這個 frame 中執行的\\ :ref:`程式碼物件 (code object) <code-objects>`。存取" "這個屬性會引發一個附帶引數 ``obj`` 與 ``\"f_code\"`` 的\\ :ref:`稽核事件 " @@ -1906,8 +1911,8 @@ msgstr "" #: ../../reference/datamodel.rst:1627 msgid "" -"The \"precise instruction\" of the frame object (this is an index into the :" -"term:`bytecode` string of the :ref:`code object <code-objects>`)" +"The \"precise instruction\" of the frame object (this is an index into " +"the :term:`bytecode` string of the :ref:`code object <code-objects>`)" msgstr "" #: ../../reference/datamodel.rst:1643 @@ -1987,18 +1992,18 @@ msgid "" "For implicitly created tracebacks, when the search for an exception handler " "unwinds the execution stack, at each unwound level a traceback object is " "inserted in front of the current traceback. When an exception handler is " -"entered, the stack trace is made available to the program. (See section :ref:" -"`try`.) It is accessible as the third item of the tuple returned by :func:" -"`sys.exc_info`, and as the :attr:`~BaseException.__traceback__` attribute of " -"the caught exception." +"entered, the stack trace is made available to the program. (See " +"section :ref:`try`.) It is accessible as the third item of the tuple " +"returned by :func:`sys.exc_info`, and as " +"the :attr:`~BaseException.__traceback__` attribute of the caught exception." msgstr "" #: ../../reference/datamodel.rst:1719 msgid "" "When the program contains no suitable handler, the stack trace is written " "(nicely formatted) to the standard error stream; if the interpreter is " -"interactive, it is also made available to the user as :data:`sys." -"last_traceback`." +"interactive, it is also made available to the user " +"as :data:`sys.last_traceback`." msgstr "" #: ../../reference/datamodel.rst:1724 @@ -2015,8 +2020,8 @@ msgstr "" #: ../../reference/datamodel.rst:1742 msgid "" -"Accessing this attribute raises an :ref:`auditing event <auditing>` ``object." -"__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." +"Accessing this attribute raises an :ref:`auditing event <auditing>` " +"``object.__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." msgstr "" "存取此屬性會引發一個附帶引數 ``obj`` 與 ``\"tb_frame\"`` 的\\ :ref:`稽核事件 " "<auditing>` ``object.__getattr__``。" @@ -2060,9 +2065,9 @@ msgstr "" #: ../../reference/datamodel.rst:1785 msgid "" -"Special read-only attributes: :attr:`~slice.start` is the lower bound; :attr:" -"`~slice.stop` is the upper bound; :attr:`~slice.step` is the step value; " -"each is ``None`` if omitted. These attributes can have any type." +"Special read-only attributes: :attr:`~slice.start` is the lower " +"bound; :attr:`~slice.stop` is the upper bound; :attr:`~slice.step` is the " +"step value; each is ``None`` if omitted. These attributes can have any type." msgstr "" #: ../../reference/datamodel.rst:1789 @@ -2104,8 +2109,8 @@ msgid "" "another object that alters the way in which that object is retrieved from " "classes and class instances. The behaviour of class method objects upon such " "retrieval is described above, under :ref:`\"instance methods\" <instance-" -"methods>`. Class method objects are created by the built-in :func:" -"`classmethod` constructor." +"methods>`. Class method objects are created by the built-" +"in :func:`classmethod` constructor." msgstr "" #: ../../reference/datamodel.rst:1826 @@ -2118,21 +2123,21 @@ msgid "" "(such as arithmetic operations or subscripting and slicing) by defining " "methods with special names. This is Python's approach to :dfn:`operator " "overloading`, allowing classes to define their own behavior with respect to " -"language operators. For instance, if a class defines a method named :meth:" -"`~object.__getitem__`, and ``x`` is an instance of this class, then ``x[i]`` " -"is roughly equivalent to ``type(x).__getitem__(x, i)``. Except where " -"mentioned, attempts to execute an operation raise an exception when no " -"appropriate method is defined (typically :exc:`AttributeError` or :exc:" -"`TypeError`)." +"language operators. For instance, if a class defines a method " +"named :meth:`~object.__getitem__`, and ``x`` is an instance of this class, " +"then ``x[i]`` is roughly equivalent to ``type(x).__getitem__(x, i)``. " +"Except where mentioned, attempts to execute an operation raise an exception " +"when no appropriate method is defined (typically :exc:`AttributeError` " +"or :exc:`TypeError`)." msgstr "" #: ../../reference/datamodel.rst:1843 msgid "" "Setting a special method to ``None`` indicates that the corresponding " -"operation is not available. For example, if a class sets :meth:`~object." -"__iter__` to ``None``, the class is not iterable, so calling :func:`iter` on " -"its instances will raise a :exc:`TypeError` (without falling back to :meth:" -"`~object.__getitem__`). [#]_" +"operation is not available. For example, if a class " +"sets :meth:`~object.__iter__` to ``None``, the class is not iterable, so " +"calling :func:`iter` on its instances will raise a :exc:`TypeError` (without " +"falling back to :meth:`~object.__getitem__`). [#]_" msgstr "" #: ../../reference/datamodel.rst:1849 @@ -2211,10 +2216,10 @@ msgstr "" #: ../../reference/datamodel.rst:1915 msgid "" "Called when the instance is about to be destroyed. This is also called a " -"finalizer or (improperly) a destructor. If a base class has a :meth:" -"`__del__` method, the derived class's :meth:`__del__` method, if any, must " -"explicitly call it to ensure proper deletion of the base class part of the " -"instance." +"finalizer or (improperly) a destructor. If a base class has " +"a :meth:`__del__` method, the derived class's :meth:`__del__` method, if " +"any, must explicitly call it to ensure proper deletion of the base class " +"part of the instance." msgstr "" #: ../../reference/datamodel.rst:1921 @@ -2269,8 +2274,8 @@ msgid "" ":meth:`__del__` can be invoked when arbitrary code is being executed, " "including from any arbitrary thread. If :meth:`__del__` needs to take a " "lock or invoke any other blocking resource, it may deadlock as the resource " -"may already be taken by the code that gets interrupted to execute :meth:" -"`__del__`." +"may already be taken by the code that gets interrupted to " +"execute :meth:`__del__`." msgstr "" #: ../../reference/datamodel.rst:1964 @@ -2291,9 +2296,10 @@ msgid "" "like a valid Python expression that could be used to recreate an object with " "the same value (given an appropriate environment). If this is not possible, " "a string of the form ``<...some useful description...>`` should be returned. " -"The return value must be a string object. If a class defines :meth:" -"`__repr__` but not :meth:`__str__`, then :meth:`__repr__` is also used when " -"an \"informal\" string representation of instances of that class is required." +"The return value must be a string object. If a class " +"defines :meth:`__repr__` but not :meth:`__str__`, then :meth:`__repr__` is " +"also used when an \"informal\" string representation of instances of that " +"class is required." msgstr "" #: ../../reference/datamodel.rst:1988 @@ -2327,8 +2333,8 @@ msgstr "" #: ../../reference/datamodel.rst:2019 msgid "" "Called by :ref:`bytes <func-bytes>` to compute a byte-string representation " -"of an object. This should return a :class:`bytes` object. The :class:" -"`object` class itself does not provide this method." +"of an object. This should return a :class:`bytes` object. " +"The :class:`object` class itself does not provide this method." msgstr "" #: ../../reference/datamodel.rst:2031 @@ -2373,10 +2379,10 @@ msgstr "" #: ../../reference/datamodel.rst:2068 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " -"between operator symbols and method names is as follows: ``x<y`` calls ``x." -"__lt__(y)``, ``x<=y`` calls ``x.__le__(y)``, ``x==y`` calls ``x.__eq__(y)``, " -"``x!=y`` calls ``x.__ne__(y)``, ``x>y`` calls ``x.__gt__(y)``, and ``x>=y`` " -"calls ``x.__ge__(y)``." +"between operator symbols and method names is as follows: ``x<y`` calls " +"``x.__lt__(y)``, ``x<=y`` calls ``x.__le__(y)``, ``x==y`` calls " +"``x.__eq__(y)``, ``x!=y`` calls ``x.__ne__(y)``, ``x>y`` calls " +"``x.__gt__(y)``, and ``x>=y`` calls ``x.__ge__(y)``." msgstr "" #: ../../reference/datamodel.rst:2074 @@ -2392,14 +2398,15 @@ msgstr "" #: ../../reference/datamodel.rst:2081 msgid "" -"By default, ``object`` implements :meth:`__eq__` by using ``is``, returning :" -"data:`NotImplemented` in the case of a false comparison: ``True if x is y " -"else NotImplemented``. For :meth:`__ne__`, by default it delegates to :meth:" -"`__eq__` and inverts the result unless it is :data:`!NotImplemented`. There " -"are no other implied relationships among the comparison operators or default " -"implementations; for example, the truth of ``(x<y or x==y)`` does not imply " -"``x<=y``. To automatically generate ordering operations from a single root " -"operation, see :func:`functools.total_ordering`." +"By default, ``object`` implements :meth:`__eq__` by using ``is``, " +"returning :data:`NotImplemented` in the case of a false comparison: ``True " +"if x is y else NotImplemented``. For :meth:`__ne__`, by default it delegates " +"to :meth:`__eq__` and inverts the result unless it is :data:`!" +"NotImplemented`. There are no other implied relationships among the " +"comparison operators or default implementations; for example, the truth of " +"``(x<y or x==y)`` does not imply ``x<=y``. To automatically generate " +"ordering operations from a single root operation, " +"see :func:`functools.total_ordering`." msgstr "" #: ../../reference/datamodel.rst:2090 @@ -2407,45 +2414,45 @@ msgid "" "By default, the :class:`object` class provides implementations consistent " "with :ref:`expressions-value-comparisons`: equality compares according to " "object identity, and order comparisons raise :exc:`TypeError`. Each default " -"method may generate these results directly, but may also return :data:" -"`NotImplemented`." +"method may generate these results directly, but may also " +"return :data:`NotImplemented`." msgstr "" #: ../../reference/datamodel.rst:2096 msgid "" -"See the paragraph on :meth:`__hash__` for some important notes on creating :" -"term:`hashable` objects which support custom comparison operations and are " -"usable as dictionary keys." +"See the paragraph on :meth:`__hash__` for some important notes on " +"creating :term:`hashable` objects which support custom comparison operations " +"and are usable as dictionary keys." msgstr "" #: ../../reference/datamodel.rst:2100 msgid "" "There are no swapped-argument versions of these methods (to be used when the " "left argument does not support the operation but the right argument does); " -"rather, :meth:`__lt__` and :meth:`__gt__` are each other's reflection, :meth:" -"`__le__` and :meth:`__ge__` are each other's reflection, and :meth:`__eq__` " -"and :meth:`__ne__` are their own reflection. If the operands are of " -"different types, and the right operand's type is a direct or indirect " -"subclass of the left operand's type, the reflected method of the right " -"operand has priority, otherwise the left operand's method has priority. " -"Virtual subclassing is not considered." +"rather, :meth:`__lt__` and :meth:`__gt__` are each other's " +"reflection, :meth:`__le__` and :meth:`__ge__` are each other's reflection, " +"and :meth:`__eq__` and :meth:`__ne__` are their own reflection. If the " +"operands are of different types, and the right operand's type is a direct or " +"indirect subclass of the left operand's type, the reflected method of the " +"right operand has priority, otherwise the left operand's method has " +"priority. Virtual subclassing is not considered." msgstr "" #: ../../reference/datamodel.rst:2111 msgid "" -"When no appropriate method returns any value other than :data:" -"`NotImplemented`, the ``==`` and ``!=`` operators will fall back to ``is`` " -"and ``is not``, respectively." +"When no appropriate method returns any value other " +"than :data:`NotImplemented`, the ``==`` and ``!=`` operators will fall back " +"to ``is`` and ``is not``, respectively." msgstr "" #: ../../reference/datamodel.rst:2120 msgid "" "Called by built-in function :func:`hash` and for operations on members of " -"hashed collections including :class:`set`, :class:`frozenset`, and :class:" -"`dict`. The ``__hash__()`` method should return an integer. The only " -"required property is that objects which compare equal have the same hash " -"value; it is advised to mix together the hash values of the components of " -"the object that also play a part in comparison of objects by packing them " +"hashed collections including :class:`set`, :class:`frozenset`, " +"and :class:`dict`. The ``__hash__()`` method should return an integer. The " +"only required property is that objects which compare equal have the same " +"hash value; it is advised to mix together the hash values of the components " +"of the object that also play a part in comparison of objects by packing them " "into a tuple and hashing the tuple. Example::" msgstr "" @@ -2459,24 +2466,24 @@ msgstr "" #: ../../reference/datamodel.rst:2133 msgid "" -":func:`hash` truncates the value returned from an object's custom :meth:" -"`__hash__` method to the size of a :c:type:`Py_ssize_t`. This is typically " -"8 bytes on 64-bit builds and 4 bytes on 32-bit builds. If an object's :" -"meth:`__hash__` must interoperate on builds of different bit sizes, be sure " -"to check the width on all supported builds. An easy way to do this is with " -"``python -c \"import sys; print(sys.hash_info.width)\"``." +":func:`hash` truncates the value returned from an object's " +"custom :meth:`__hash__` method to the size of a :c:type:`Py_ssize_t`. This " +"is typically 8 bytes on 64-bit builds and 4 bytes on 32-bit builds. If an " +"object's :meth:`__hash__` must interoperate on builds of different bit " +"sizes, be sure to check the width on all supported builds. An easy way to " +"do this is with ``python -c \"import sys; print(sys.hash_info.width)\"``." msgstr "" #: ../../reference/datamodel.rst:2141 msgid "" -"If a class does not define an :meth:`__eq__` method it should not define a :" -"meth:`__hash__` operation either; if it defines :meth:`__eq__` but not :meth:" -"`__hash__`, its instances will not be usable as items in hashable " -"collections. If a class defines mutable objects and implements an :meth:" -"`__eq__` method, it should not implement :meth:`__hash__`, since the " -"implementation of :term:`hashable` collections requires that a key's hash " -"value is immutable (if the object's hash value changes, it will be in the " -"wrong hash bucket)." +"If a class does not define an :meth:`__eq__` method it should not define " +"a :meth:`__hash__` operation either; if it defines :meth:`__eq__` but " +"not :meth:`__hash__`, its instances will not be usable as items in hashable " +"collections. If a class defines mutable objects and implements " +"an :meth:`__eq__` method, it should not implement :meth:`__hash__`, since " +"the implementation of :term:`hashable` collections requires that a key's " +"hash value is immutable (if the object's hash value changes, it will be in " +"the wrong hash bucket)." msgstr "" #: ../../reference/datamodel.rst:2150 @@ -2491,11 +2498,11 @@ msgstr "" #: ../../reference/datamodel.rst:2155 msgid "" "A class that overrides :meth:`__eq__` and does not define :meth:`__hash__` " -"will have its :meth:`__hash__` implicitly set to ``None``. When the :meth:" -"`__hash__` method of a class is ``None``, instances of the class will raise " -"an appropriate :exc:`TypeError` when a program attempts to retrieve their " -"hash value, and will also be correctly identified as unhashable when " -"checking ``isinstance(obj, collections.abc.Hashable)``." +"will have its :meth:`__hash__` implicitly set to ``None``. When " +"the :meth:`__hash__` method of a class is ``None``, instances of the class " +"will raise an appropriate :exc:`TypeError` when a program attempts to " +"retrieve their hash value, and will also be correctly identified as " +"unhashable when checking ``isinstance(obj, collections.abc.Hashable)``." msgstr "" #: ../../reference/datamodel.rst:2162 @@ -2509,8 +2516,8 @@ msgstr "" msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " -"class which defines its own :meth:`__hash__` that explicitly raises a :exc:" -"`TypeError` would be incorrectly identified as hashable by an " +"class which defines its own :meth:`__hash__` that explicitly raises " +"a :exc:`TypeError` would be incorrectly identified as hashable by an " "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" @@ -2550,9 +2557,9 @@ msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " "defined, :meth:`~object.__len__` is called, if it is defined, and the object " -"is considered true if its result is nonzero. If a class defines neither :" -"meth:`!__len__` nor :meth:`!__bool__` (which is true of the :class:`object` " -"class itself), all its instances are considered true." +"is considered true if its result is nonzero. If a class defines " +"neither :meth:`!__len__` nor :meth:`!__bool__` (which is true of " +"the :class:`object` class itself), all its instances are considered true." msgstr "" #: ../../reference/datamodel.rst:2210 @@ -2571,22 +2578,22 @@ msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " "*name* is not an instance attribute or an attribute in the class tree for " -"``self``; or :meth:`__get__` of a *name* property raises :exc:" -"`AttributeError`). This method should either return the (computed) " -"attribute value or raise an :exc:`AttributeError` exception. The :class:" -"`object` class itself does not provide this method." +"``self``; or :meth:`__get__` of a *name* property " +"raises :exc:`AttributeError`). This method should either return the " +"(computed) attribute value or raise an :exc:`AttributeError` exception. " +"The :class:`object` class itself does not provide this method." msgstr "" #: ../../reference/datamodel.rst:2228 msgid "" -"Note that if the attribute is found through the normal mechanism, :meth:" -"`__getattr__` is not called. (This is an intentional asymmetry between :" -"meth:`__getattr__` and :meth:`__setattr__`.) This is done both for " -"efficiency reasons and because otherwise :meth:`__getattr__` would have no " -"way to access other attributes of the instance. Note that at least for " -"instance variables, you can take total control by not inserting any values " -"in the instance attribute dictionary (but instead inserting them in another " -"object). See the :meth:`__getattribute__` method below for a way to " +"Note that if the attribute is found through the normal " +"mechanism, :meth:`__getattr__` is not called. (This is an intentional " +"asymmetry between :meth:`__getattr__` and :meth:`__setattr__`.) This is done " +"both for efficiency reasons and because otherwise :meth:`__getattr__` would " +"have no way to access other attributes of the instance. Note that at least " +"for instance variables, you can take total control by not inserting any " +"values in the instance attribute dictionary (but instead inserting them in " +"another object). See the :meth:`__getattribute__` method below for a way to " "actually get total control over attribute access." msgstr "" @@ -2625,8 +2632,8 @@ msgstr "" #: ../../reference/datamodel.rst:2270 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " -"call the base class method with the same name, for example, ``object." -"__setattr__(self, name, value)``." +"call the base class method with the same name, for example, " +"``object.__setattr__(self, name, value)``." msgstr "" #: ../../reference/datamodel.rst:2274 ../../reference/datamodel.rst:2276 @@ -2665,10 +2672,10 @@ msgid "" "access to module attributes. The ``__getattr__`` function at the module " "level should accept one argument which is the name of an attribute and " "return the computed value or raise an :exc:`AttributeError`. If an attribute " -"is not found on a module object through the normal lookup, i.e. :meth:" -"`object.__getattribute__`, then ``__getattr__`` is searched in the module " -"``__dict__`` before raising an :exc:`AttributeError`. If found, it is called " -"with the attribute name and the result is returned." +"is not found on a module object through the normal lookup, " +"i.e. :meth:`object.__getattribute__`, then ``__getattr__`` is searched in " +"the module ``__dict__`` before raising an :exc:`AttributeError`. If found, " +"it is called with the attribute name and the result is returned." msgstr "" #: ../../reference/datamodel.rst:2316 @@ -2763,8 +2770,8 @@ msgstr "" #: ../../reference/datamodel.rst:2376 msgid "" -"This method should return the computed attribute value or raise an :exc:" -"`AttributeError` exception." +"This method should return the computed attribute value or raise " +"an :exc:`AttributeError` exception." msgstr "" #: ../../reference/datamodel.rst:2379 @@ -2820,9 +2827,9 @@ msgstr "" msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " -"protocol: :meth:`~object.__get__`, :meth:`~object.__set__`, and :meth:" -"`~object.__delete__`. If any of those methods are defined for an object, it " -"is said to be a descriptor." +"protocol: :meth:`~object.__get__`, :meth:`~object.__set__`, " +"and :meth:`~object.__delete__`. If any of those methods are defined for an " +"object, it is said to be a descriptor." msgstr "" #: ../../reference/datamodel.rst:2423 @@ -2873,8 +2880,8 @@ msgstr "" #: ../../reference/datamodel.rst:2445 msgid "" -"If binding to a class, ``A.x`` is transformed into the call: ``A." -"__dict__['x'].__get__(None, A)``." +"If binding to a class, ``A.x`` is transformed into the call: " +"``A.__dict__['x'].__get__(None, A)``." msgstr "" #: ../../reference/datamodel.rst:2448 @@ -2884,17 +2891,18 @@ msgstr "" #: ../../reference/datamodel.rst:2449 msgid "" "A dotted lookup such as ``super(A, a).x`` searches ``a.__class__.__mro__`` " -"for a base class ``B`` following ``A`` and then returns ``B.__dict__['x']." -"__get__(a, A)``. If not a descriptor, ``x`` is returned unchanged." +"for a base class ``B`` following ``A`` and then returns " +"``B.__dict__['x'].__get__(a, A)``. If not a descriptor, ``x`` is returned " +"unchanged." msgstr "" #: ../../reference/datamodel.rst:2486 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " -"combination of :meth:`~object.__get__`, :meth:`~object.__set__` and :meth:" -"`~object.__delete__`. If it does not define :meth:`!__get__`, then " -"accessing the attribute will return the descriptor object itself unless " +"combination of :meth:`~object.__get__`, :meth:`~object.__set__` " +"and :meth:`~object.__delete__`. If it does not define :meth:`!__get__`, " +"then accessing the attribute will return the descriptor object itself unless " "there is a value in the object's instance dictionary. If the descriptor " "defines :meth:`!__set__` and/or :meth:`!__delete__`, it is a data " "descriptor; if it defines neither, it is a non-data descriptor. Normally, " @@ -2942,8 +2950,8 @@ msgstr "" msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " -"for the declared variables and prevents the automatic creation of :attr:" -"`~object.__dict__` and *__weakref__* for each instance." +"for the declared variables and prevents the automatic creation " +"of :attr:`~object.__dict__` and *__weakref__* for each instance." msgstr "" #: ../../reference/datamodel.rst:2534 @@ -2952,9 +2960,9 @@ msgstr "" #: ../../reference/datamodel.rst:2536 msgid "" -"When inheriting from a class without *__slots__*, the :attr:`~object." -"__dict__` and *__weakref__* attribute of the instances will always be " -"accessible." +"When inheriting from a class without *__slots__*, " +"the :attr:`~object.__dict__` and *__weakref__* attribute of the instances " +"will always be accessible." msgstr "" #: ../../reference/datamodel.rst:2540 @@ -3004,8 +3012,8 @@ msgstr "" msgid "" ":exc:`TypeError` will be raised if nonempty *__slots__* are defined for a " "class derived from a :c:member:`\"variable-length\" built-in type " -"<PyTypeObject.tp_itemsize>` such as :class:`int`, :class:`bytes`, and :class:" -"`tuple`." +"<PyTypeObject.tp_itemsize>` such as :class:`int`, :class:`bytes`, " +"and :class:`tuple`." msgstr "" #: ../../reference/datamodel.rst:2575 @@ -3016,8 +3024,8 @@ msgstr "" msgid "" "If a :class:`dictionary <dict>` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " -"can be used to provide per-attribute docstrings that will be recognised by :" -"func:`inspect.getdoc` and displayed in the output of :func:`help`." +"can be used to provide per-attribute docstrings that will be recognised " +"by :func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" #: ../../reference/datamodel.rst:2582 @@ -3047,12 +3055,13 @@ msgstr "" #: ../../reference/datamodel.rst:2601 msgid "" -"Whenever a class inherits from another class, :meth:`~object." -"__init_subclass__` is called on the parent class. This way, it is possible " -"to write classes which change the behavior of subclasses. This is closely " -"related to class decorators, but where class decorators only affect the " -"specific class they're applied to, ``__init_subclass__`` solely applies to " -"future subclasses of the class defining the method." +"Whenever a class inherits from another " +"class, :meth:`~object.__init_subclass__` is called on the parent class. This " +"way, it is possible to write classes which change the behavior of " +"subclasses. This is closely related to class decorators, but where class " +"decorators only affect the specific class they're applied to, " +"``__init_subclass__`` solely applies to future subclasses of the class " +"defining the method." msgstr "" #: ../../reference/datamodel.rst:2610 @@ -3124,9 +3133,9 @@ msgstr "" #: ../../reference/datamodel.rst:2652 msgid "" -"If the class variable is assigned after the class is created, :meth:" -"`__set_name__` will not be called automatically. If needed, :meth:" -"`__set_name__` can be called directly::" +"If the class variable is assigned after the class is " +"created, :meth:`__set_name__` will not be called automatically. If " +"needed, :meth:`__set_name__` can be called directly::" msgstr "" #: ../../reference/datamodel.rst:2656 @@ -3218,14 +3227,14 @@ msgstr "" #: ../../reference/datamodel.rst:2713 msgid "" -"If a base that appears in a class definition is not an instance of :class:" -"`type`, then an :meth:`!__mro_entries__` method is searched on the base. If " -"an :meth:`!__mro_entries__` method is found, the base is substituted with " -"the result of a call to :meth:`!__mro_entries__` when creating the class. " -"The method is called with the original bases tuple passed to the *bases* " -"parameter, and must return a tuple of classes that will be used instead of " -"the base. The returned tuple may be empty: in these cases, the original base " -"is ignored." +"If a base that appears in a class definition is not an instance " +"of :class:`type`, then an :meth:`!__mro_entries__` method is searched on the " +"base. If an :meth:`!__mro_entries__` method is found, the base is " +"substituted with the result of a call to :meth:`!__mro_entries__` when " +"creating the class. The method is called with the original bases tuple " +"passed to the *bases* parameter, and must return a tuple of classes that " +"will be used instead of the base. The returned tuple may be empty: in these " +"cases, the original base is ignored." msgstr "" #: ../../reference/datamodel.rst:2724 @@ -3242,8 +3251,8 @@ msgstr ":func:`types.get_original_bases`" #: ../../reference/datamodel.rst:2728 msgid "" -"Retrieve a class's \"original bases\" prior to modifications by :meth:" -"`~object.__mro_entries__`." +"Retrieve a class's \"original bases\" prior to modifications " +"by :meth:`~object.__mro_entries__`." msgstr "" #: ../../reference/datamodel.rst:2731 @@ -3270,8 +3279,8 @@ msgstr "" #: ../../reference/datamodel.rst:2743 msgid "" -"if an explicit metaclass is given and it is *not* an instance of :func:" -"`type`, then it is used directly as the metaclass;" +"if an explicit metaclass is given and it is *not* an instance " +"of :func:`type`, then it is used directly as the metaclass;" msgstr "" #: ../../reference/datamodel.rst:2745 @@ -3358,10 +3367,10 @@ msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " "created by the compiler if any methods in a class body refer to either " -"``__class__`` or ``super``. This allows the zero argument form of :func:" -"`super` to correctly identify the class being defined based on lexical " -"scoping, while the class or instance that was used to make the current call " -"is identified based on the first argument passed to the method." +"``__class__`` or ``super``. This allows the zero argument form " +"of :func:`super` to correctly identify the class being defined based on " +"lexical scoping, while the class or instance that was used to make the " +"current call is identified based on the first argument passed to the method." msgstr "" #: ../../reference/datamodel.rst:2824 @@ -3439,8 +3448,8 @@ msgstr "" #: ../../reference/datamodel.rst:2868 msgid "" -"The following methods are used to override the default behavior of the :func:" -"`isinstance` and :func:`issubclass` built-in functions." +"The following methods are used to override the default behavior of " +"the :func:`isinstance` and :func:`issubclass` built-in functions." msgstr "" #: ../../reference/datamodel.rst:2871 @@ -3479,11 +3488,11 @@ msgstr "" #: ../../reference/datamodel.rst:2898 msgid "" -"Includes the specification for customizing :func:`isinstance` and :func:" -"`issubclass` behavior through :meth:`~type.__instancecheck__` and :meth:" -"`~type.__subclasscheck__`, with motivation for this functionality in the " -"context of adding Abstract Base Classes (see the :mod:`abc` module) to the " -"language." +"Includes the specification for customizing :func:`isinstance` " +"and :func:`issubclass` behavior through :meth:`~type.__instancecheck__` " +"and :meth:`~type.__subclasscheck__`, with motivation for this functionality " +"in the context of adding Abstract Base Classes (see the :mod:`abc` module) " +"to the language." msgstr "" #: ../../reference/datamodel.rst:2906 @@ -3500,11 +3509,11 @@ msgstr "" #: ../../reference/datamodel.rst:2915 msgid ":pep:`484` - Type Hints" -msgstr "" +msgstr ":pep:`484` - 型別提示" #: ../../reference/datamodel.rst:2916 msgid "Introducing Python's framework for type annotations" -msgstr "" +msgstr "引入 Python 的型別註釋框架" #: ../../reference/datamodel.rst:2918 msgid ":ref:`Generic Alias Types<types-genericalias>`" @@ -3516,8 +3525,8 @@ msgstr "" #: ../../reference/datamodel.rst:2921 msgid "" -":ref:`Generics`, :ref:`user-defined generics<user-defined-generics>` and :" -"class:`typing.Generic`" +":ref:`Generics`, :ref:`user-defined generics<user-defined-generics>` " +"and :class:`typing.Generic`" msgstr "" #: ../../reference/datamodel.rst:2922 @@ -3541,8 +3550,8 @@ msgstr "" #: ../../reference/datamodel.rst:2933 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " -"method. As such, there is no need for it to be decorated with :func:" -"`@classmethod<classmethod>` when it is defined." +"method. As such, there is no need for it to be decorated " +"with :func:`@classmethod<classmethod>` when it is defined." msgstr "" #: ../../reference/datamodel.rst:2939 @@ -3560,9 +3569,10 @@ msgstr "" msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " -"standard library class that already implements :meth:`~object." -"__class_getitem__`, or inherit from :class:`typing.Generic`, which has its " -"own implementation of ``__class_getitem__()``." +"standard library class that already " +"implements :meth:`~object.__class_getitem__`, or inherit " +"from :class:`typing.Generic`, which has its own implementation of " +"``__class_getitem__()``." msgstr "" #: ../../reference/datamodel.rst:2951 @@ -3590,8 +3600,9 @@ msgstr "" #: ../../reference/datamodel.rst:2970 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " -"follows something like the following process to decide whether :meth:" -"`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" +"follows something like the following process to decide " +"whether :meth:`~object.__getitem__` or :meth:`~object.__class_getitem__` " +"should be called::" msgstr "" #: ../../reference/datamodel.rst:2975 @@ -3624,10 +3635,10 @@ msgstr "" msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " -"the :class:`type` class as their metaclass. :class:`type` does not define :" -"meth:`~object.__getitem__`, meaning that expressions such as ``list[int]``, " -"``dict[str, float]`` and ``tuple[str, bytes]`` all result in :meth:`~object." -"__class_getitem__` being called::" +"the :class:`type` class as their metaclass. :class:`type` does not " +"define :meth:`~object.__getitem__`, meaning that expressions such as " +"``list[int]``, ``dict[str, float]`` and ``tuple[str, bytes]`` all result " +"in :meth:`~object.__class_getitem__` being called::" msgstr "" #: ../../reference/datamodel.rst:3005 @@ -3647,9 +3658,10 @@ msgstr "" #: ../../reference/datamodel.rst:3017 msgid "" -"However, if a class has a custom metaclass that defines :meth:`~object." -"__getitem__`, subscribing the class may result in different behaviour. An " -"example of this can be found in the :mod:`enum` module::" +"However, if a class has a custom metaclass that " +"defines :meth:`~object.__getitem__`, subscribing the class may result in " +"different behaviour. An example of this can be found in the :mod:`enum` " +"module::" msgstr "" #: ../../reference/datamodel.rst:3021 @@ -3678,9 +3690,9 @@ msgstr "" #: ../../reference/datamodel.rst:3041 msgid "" -"Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" -"`subscription<subscriptions>` results in ``__class_getitem__()`` being " -"called instead of :meth:`~object.__getitem__`" +"Introducing :meth:`~object.__class_getitem__`, and outlining when " +"a :ref:`subscription<subscriptions>` results in ``__class_getitem__()`` " +"being called instead of :meth:`~object.__getitem__`" msgstr "" #: ../../reference/datamodel.rst:3049 @@ -3702,37 +3714,37 @@ msgstr "" msgid "" "The following methods can be defined to implement container objects. None of " "them are provided by the :class:`object` class itself. Containers usually " -"are :term:`sequences <sequence>` (such as :class:`lists <list>` or :class:" -"`tuples <tuple>`) or :term:`mappings <mapping>` (like :term:`dictionaries " -"<dictionary>`), but can represent other containers as well. The first set " -"of methods is used either to emulate a sequence or to emulate a mapping; the " -"difference is that for a sequence, the allowable keys should be the integers " -"*k* for which ``0 <= k < N`` where *N* is the length of the sequence, or :" -"class:`slice` objects, which define a range of items. It is also " -"recommended that mappings provide the methods :meth:`!keys`, :meth:`!" -"values`, :meth:`!items`, :meth:`!get`, :meth:`!clear`, :meth:`!setdefault`, :" -"meth:`!pop`, :meth:`!popitem`, :meth:`!copy`, and :meth:`!update` behaving " -"similar to those for Python's standard :class:`dictionary <dict>` objects. " -"The :mod:`collections.abc` module provides a :class:`~collections.abc." -"MutableMapping` :term:`abstract base class` to help create those methods " -"from a base set of :meth:`~object.__getitem__`, :meth:`~object." -"__setitem__`, :meth:`~object.__delitem__`, and :meth:`!keys`. Mutable " -"sequences should provide methods :meth:`!append`, :meth:`!count`, :meth:`!" -"index`, :meth:`!extend`, :meth:`!insert`, :meth:`!pop`, :meth:`!remove`, :" -"meth:`!reverse` and :meth:`!sort`, like Python standard :class:`list` " -"objects. Finally, sequence types should implement addition (meaning " -"concatenation) and multiplication (meaning repetition) by defining the " -"methods :meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:`~object." -"__iadd__`, :meth:`~object.__mul__`, :meth:`~object.__rmul__` and :meth:" -"`~object.__imul__` described below; they should not define other numerical " -"operators. It is recommended that both mappings and sequences implement " -"the :meth:`~object.__contains__` method to allow efficient use of the ``in`` " -"operator; for mappings, ``in`` should search the mapping's keys; for " -"sequences, it should search through the values. It is further recommended " -"that both mappings and sequences implement the :meth:`~object.__iter__` " -"method to allow efficient iteration through the container; for mappings, :" -"meth:`!__iter__` should iterate through the object's keys; for sequences, it " -"should iterate through the values." +"are :term:`sequences <sequence>` (such as :class:`lists <list>` " +"or :class:`tuples <tuple>`) or :term:`mappings <mapping>` " +"(like :term:`dictionaries <dictionary>`), but can represent other containers " +"as well. The first set of methods is used either to emulate a sequence or " +"to emulate a mapping; the difference is that for a sequence, the allowable " +"keys should be the integers *k* for which ``0 <= k < N`` where *N* is the " +"length of the sequence, or :class:`slice` objects, which define a range of " +"items. It is also recommended that mappings provide the methods :meth:`!" +"keys`, :meth:`!values`, :meth:`!items`, :meth:`!get`, :meth:`!" +"clear`, :meth:`!setdefault`, :meth:`!pop`, :meth:`!popitem`, :meth:`!copy`, " +"and :meth:`!update` behaving similar to those for Python's " +"standard :class:`dictionary <dict>` objects. The :mod:`collections.abc` " +"module provides a :class:`~collections.abc.MutableMapping` :term:`abstract " +"base class` to help create those methods from a base set " +"of :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__`, " +"and :meth:`!keys`. Mutable sequences should provide methods :meth:`!" +"append`, :meth:`!count`, :meth:`!index`, :meth:`!extend`, :meth:`!" +"insert`, :meth:`!pop`, :meth:`!remove`, :meth:`!reverse` and :meth:`!sort`, " +"like Python standard :class:`list` objects. Finally, sequence types should " +"implement addition (meaning concatenation) and multiplication (meaning " +"repetition) by defining the " +"methods :meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:`~object.__iadd__`, :meth:`~object.__mul__`, :meth:`~object.__rmul__` " +"and :meth:`~object.__imul__` described below; they should not define other " +"numerical operators. It is recommended that both mappings and sequences " +"implement the :meth:`~object.__contains__` method to allow efficient use of " +"the ``in`` operator; for mappings, ``in`` should search the mapping's keys; " +"for sequences, it should search through the values. It is further " +"recommended that both mappings and sequences implement " +"the :meth:`~object.__iter__` method to allow efficient iteration through the " +"container; for mappings, :meth:`!__iter__` should iterate through the " +"object's keys; for sequences, it should iterate through the values." msgstr "" #: ../../reference/datamodel.rst:3108 @@ -3746,20 +3758,20 @@ msgstr "" #: ../../reference/datamodel.rst:3115 msgid "" "In CPython, the length is required to be at most :data:`sys.maxsize`. If the " -"length is larger than :data:`!sys.maxsize` some features (such as :func:" -"`len`) may raise :exc:`OverflowError`. To prevent raising :exc:`!" -"OverflowError` by truth value testing, an object must define a :meth:" -"`~object.__bool__` method." +"length is larger than :data:`!sys.maxsize` some features (such " +"as :func:`len`) may raise :exc:`OverflowError`. To prevent raising :exc:`!" +"OverflowError` by truth value testing, an object must define " +"a :meth:`~object.__bool__` method." msgstr "" #: ../../reference/datamodel.rst:3124 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " -"The length must be an integer ``>=`` 0. The return value may also be :data:" -"`NotImplemented`, which is treated the same as if the ``__length_hint__`` " -"method didn't exist at all. This method is purely an optimization and is " -"never required for correctness." +"The length must be an integer ``>=`` 0. The return value may also " +"be :data:`NotImplemented`, which is treated the same as if the " +"``__length_hint__`` method didn't exist at all. This method is purely an " +"optimization and is never required for correctness." msgstr "" #: ../../reference/datamodel.rst:3138 @@ -3786,13 +3798,13 @@ msgstr "" #: ../../reference/datamodel.rst:3151 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " -"the accepted keys should be integers. Optionally, they may support :class:" -"`slice` objects as well. Negative index support is also optional. If *key* " -"is of an inappropriate type, :exc:`TypeError` may be raised; if *key* is a " -"value outside the set of indexes for the sequence (after any special " -"interpretation of negative values), :exc:`IndexError` should be raised. For :" -"term:`mapping` types, if *key* is missing (not in the container), :exc:" -"`KeyError` should be raised." +"the accepted keys should be integers. Optionally, they may " +"support :class:`slice` objects as well. Negative index support is also " +"optional. If *key* is of an inappropriate type, :exc:`TypeError` may be " +"raised; if *key* is a value outside the set of indexes for the sequence " +"(after any special interpretation of negative values), :exc:`IndexError` " +"should be raised. For :term:`mapping` types, if *key* is missing (not in the " +"container), :exc:`KeyError` should be raised." msgstr "" #: ../../reference/datamodel.rst:3163 @@ -3803,27 +3815,28 @@ msgstr "" #: ../../reference/datamodel.rst:3168 msgid "" -"When :ref:`subscripting<subscriptions>` a *class*, the special class method :" -"meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " -"See :ref:`classgetitem-versus-getitem` for more details." +"When :ref:`subscripting<subscriptions>` a *class*, the special class " +"method :meth:`~object.__class_getitem__` may be called instead of " +"``__getitem__()``. See :ref:`classgetitem-versus-getitem` for more details." msgstr "" #: ../../reference/datamodel.rst:3176 msgid "" -"Called to implement assignment to ``self[key]``. Same note as for :meth:" -"`__getitem__`. This should only be implemented for mappings if the objects " -"support changes to the values for keys, or if new keys can be added, or for " -"sequences if elements can be replaced. The same exceptions should be raised " -"for improper *key* values as for the :meth:`__getitem__` method." +"Called to implement assignment to ``self[key]``. Same note as " +"for :meth:`__getitem__`. This should only be implemented for mappings if " +"the objects support changes to the values for keys, or if new keys can be " +"added, or for sequences if elements can be replaced. The same exceptions " +"should be raised for improper *key* values as for the :meth:`__getitem__` " +"method." msgstr "" #: ../../reference/datamodel.rst:3185 msgid "" -"Called to implement deletion of ``self[key]``. Same note as for :meth:" -"`__getitem__`. This should only be implemented for mappings if the objects " -"support removal of keys, or for sequences if elements can be removed from " -"the sequence. The same exceptions should be raised for improper *key* " -"values as for the :meth:`__getitem__` method." +"Called to implement deletion of ``self[key]``. Same note as " +"for :meth:`__getitem__`. This should only be implemented for mappings if " +"the objects support removal of keys, or for sequences if elements can be " +"removed from the sequence. The same exceptions should be raised for " +"improper *key* values as for the :meth:`__getitem__` method." msgstr "" #: ../../reference/datamodel.rst:3194 @@ -3850,10 +3863,10 @@ msgstr "" #: ../../reference/datamodel.rst:3212 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " -"built-in will fall back to using the sequence protocol (:meth:`__len__` and :" -"meth:`__getitem__`). Objects that support the sequence protocol should only " -"provide :meth:`__reversed__` if they can provide an implementation that is " -"more efficient than the one provided by :func:`reversed`." +"built-in will fall back to using the sequence protocol (:meth:`__len__` " +"and :meth:`__getitem__`). Objects that support the sequence protocol should " +"only provide :meth:`__reversed__` if they can provide an implementation that " +"is more efficient than the one provided by :func:`reversed`." msgstr "" #: ../../reference/datamodel.rst:3219 @@ -3894,15 +3907,15 @@ msgstr "" #: ../../reference/datamodel.rst:3267 msgid "" "These methods are called to implement the binary arithmetic operations " -"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" -"`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``). For instance, to " -"evaluate the expression ``x + y``, where *x* is an instance of a class that " -"has an :meth:`__add__` method, ``type(x).__add__(x, y)`` is called. The :" -"meth:`__divmod__` method should be the equivalent to using :meth:" -"`__floordiv__` and :meth:`__mod__`; it should not be related to :meth:" -"`__truediv__`. Note that :meth:`__pow__` should be defined to accept an " -"optional third argument if the ternary version of the built-in :func:`pow` " -"function is to be supported." +"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, " +"``%``, :func:`divmod`, :func:`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|" +"``). For instance, to evaluate the expression ``x + y``, where *x* is an " +"instance of a class that has an :meth:`__add__` method, ``type(x).__add__(x, " +"y)`` is called. The :meth:`__divmod__` method should be the equivalent to " +"using :meth:`__floordiv__` and :meth:`__mod__`; it should not be related " +"to :meth:`__truediv__`. Note that :meth:`__pow__` should be defined to " +"accept an optional third argument if the ternary version of the built-" +"in :func:`pow` function is to be supported." msgstr "" #: ../../reference/datamodel.rst:3278 @@ -3914,14 +3927,14 @@ msgstr "" #: ../../reference/datamodel.rst:3301 msgid "" "These methods are called to implement the binary arithmetic operations " -"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" -"`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``) with reflected (swapped) " -"operands. These functions are only called if the left operand does not " -"support the corresponding operation [#]_ and the operands are of different " -"types. [#]_ For instance, to evaluate the expression ``x - y``, where *y* is " -"an instance of a class that has an :meth:`__rsub__` method, ``type(y)." -"__rsub__(y, x)`` is called if ``type(x).__sub__(x, y)`` returns :data:" -"`NotImplemented`." +"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, " +"``%``, :func:`divmod`, :func:`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|" +"``) with reflected (swapped) operands. These functions are only called if " +"the left operand does not support the corresponding operation [#]_ and the " +"operands are of different types. [#]_ For instance, to evaluate the " +"expression ``x - y``, where *y* is an instance of a class that has " +"an :meth:`__rsub__` method, ``type(y).__rsub__(y, x)`` is called if " +"``type(x).__sub__(x, y)`` returns :data:`NotImplemented`." msgstr "" #: ../../reference/datamodel.rst:3313 @@ -3948,25 +3961,25 @@ msgid "" "but does not have to be, *self*). If a specific method is not defined, or " "if that method returns :data:`NotImplemented`, the augmented assignment " "falls back to the normal methods. For instance, if *x* is an instance of a " -"class with an :meth:`__iadd__` method, ``x += y`` is equivalent to ``x = x." -"__iadd__(y)`` . If :meth:`__iadd__` does not exist, or if ``x.__iadd__(y)`` " -"returns :data:`!NotImplemented`, ``x.__add__(y)`` and ``y.__radd__(x)`` are " -"considered, as with the evaluation of ``x + y``. In certain situations, " -"augmented assignment can result in unexpected errors (see :ref:`faq-" -"augmented-assignment-tuple-error`), but this behavior is in fact part of the " -"data model." +"class with an :meth:`__iadd__` method, ``x += y`` is equivalent to ``x = " +"x.__iadd__(y)`` . If :meth:`__iadd__` does not exist, or if " +"``x.__iadd__(y)`` returns :data:`!NotImplemented`, ``x.__add__(y)`` and " +"``y.__radd__(x)`` are considered, as with the evaluation of ``x + y``. In " +"certain situations, augmented assignment can result in unexpected errors " +"(see :ref:`faq-augmented-assignment-tuple-error`), but this behavior is in " +"fact part of the data model." msgstr "" #: ../../reference/datamodel.rst:3362 msgid "" -"Called to implement the unary arithmetic operations (``-``, ``+``, :func:" -"`abs` and ``~``)." +"Called to implement the unary arithmetic operations (``-``, " +"``+``, :func:`abs` and ``~``)." msgstr "" #: ../../reference/datamodel.rst:3375 msgid "" -"Called to implement the built-in functions :func:`complex`, :func:`int` and :" -"func:`float`. Should return a value of the appropriate type." +"Called to implement the built-in functions :func:`complex`, :func:`int` " +"and :func:`float`. Should return a value of the appropriate type." msgstr "" #: ../../reference/datamodel.rst:3382 @@ -4096,8 +4109,8 @@ msgid "" "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " "MyClass(left=x, center=y)``. Note that the number of arguments in the " "pattern must be smaller than or equal to the number of elements in " -"*__match_args__*; if it is larger, the pattern match attempt will raise a :" -"exc:`TypeError`." +"*__match_args__*; if it is larger, the pattern match attempt will raise " +"a :exc:`TypeError`." msgstr "" #: ../../reference/datamodel.rst:3492 @@ -4128,21 +4141,22 @@ msgstr "" #: ../../reference/datamodel.rst:3511 msgid "" -"Called when a buffer is requested from *self* (for example, by the :class:" -"`memoryview` constructor). The *flags* argument is an integer representing " -"the kind of buffer requested, affecting for example whether the returned " -"buffer is read-only or writable. :class:`inspect.BufferFlags` provides a " -"convenient way to interpret the flags. The method must return a :class:" -"`memoryview` object." +"Called when a buffer is requested from *self* (for example, by " +"the :class:`memoryview` constructor). The *flags* argument is an integer " +"representing the kind of buffer requested, affecting for example whether the " +"returned buffer is read-only or writable. :class:`inspect.BufferFlags` " +"provides a convenient way to interpret the flags. The method must return " +"a :class:`memoryview` object." msgstr "" #: ../../reference/datamodel.rst:3520 msgid "" -"Called when a buffer is no longer needed. The *buffer* argument is a :class:" -"`memoryview` object that was previously returned by :meth:`~object." -"__buffer__`. The method must release any resources associated with the " -"buffer. This method should return ``None``. Buffer objects that do not need " -"to perform any cleanup are not required to implement this method." +"Called when a buffer is no longer needed. The *buffer* argument is " +"a :class:`memoryview` object that was previously returned " +"by :meth:`~object.__buffer__`. The method must release any resources " +"associated with the buffer. This method should return ``None``. Buffer " +"objects that do not need to perform any cleanup are not required to " +"implement this method." msgstr "" #: ../../reference/datamodel.rst:3531 @@ -4243,8 +4257,8 @@ msgstr "" #: ../../reference/datamodel.rst:3580 msgid "" "In addition to bypassing any instance attributes in the interest of " -"correctness, implicit special method lookup generally also bypasses the :" -"meth:`~object.__getattribute__` method even of the object's metaclass::" +"correctness, implicit special method lookup generally also bypasses " +"the :meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" #: ../../reference/datamodel.rst:3584 @@ -4291,32 +4305,33 @@ msgstr "" #: ../../reference/datamodel.rst:3623 msgid "" -"An :term:`awaitable` object generally implements an :meth:`~object." -"__await__` method. :term:`Coroutine objects <coroutine>` returned from :" -"keyword:`async def` functions are awaitable." +"An :term:`awaitable` object generally implements " +"an :meth:`~object.__await__` method. :term:`Coroutine objects <coroutine>` " +"returned from :keyword:`async def` functions are awaitable." msgstr "" #: ../../reference/datamodel.rst:3629 msgid "" "The :term:`generator iterator` objects returned from generators decorated " -"with :func:`types.coroutine` are also awaitable, but they do not implement :" -"meth:`~object.__await__`." +"with :func:`types.coroutine` are also awaitable, but they do not " +"implement :meth:`~object.__await__`." msgstr "" #: ../../reference/datamodel.rst:3635 msgid "" -"Must return an :term:`iterator`. Should be used to implement :term:" -"`awaitable` objects. For instance, :class:`asyncio.Future` implements this " -"method to be compatible with the :keyword:`await` expression. The :class:" -"`object` class itself is not awaitable and does not provide this method." +"Must return an :term:`iterator`. Should be used to " +"implement :term:`awaitable` objects. For instance, :class:`asyncio.Future` " +"implements this method to be compatible with the :keyword:`await` " +"expression. The :class:`object` class itself is not awaitable and does not " +"provide this method." msgstr "" #: ../../reference/datamodel.rst:3643 msgid "" "The language doesn't place any restriction on the type or value of the " "objects yielded by the iterator returned by ``__await__``, as this is " -"specific to the implementation of the asynchronous execution framework (e." -"g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." +"specific to the implementation of the asynchronous execution framework " +"(e.g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." msgstr "" #: ../../reference/datamodel.rst:3651 @@ -4332,10 +4347,11 @@ msgid "" ":term:`Coroutine objects <coroutine>` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " "and iterating over the result. When the coroutine has finished executing " -"and returns, the iterator raises :exc:`StopIteration`, and the exception's :" -"attr:`~StopIteration.value` attribute holds the return value. If the " -"coroutine raises an exception, it is propagated by the iterator. Coroutines " -"should not directly raise unhandled :exc:`StopIteration` exceptions." +"and returns, the iterator raises :exc:`StopIteration`, and the " +"exception's :attr:`~StopIteration.value` attribute holds the return value. " +"If the coroutine raises an exception, it is propagated by the iterator. " +"Coroutines should not directly raise unhandled :exc:`StopIteration` " +"exceptions." msgstr "" #: ../../reference/datamodel.rst:3667 @@ -4352,12 +4368,12 @@ msgstr "" #: ../../reference/datamodel.rst:3677 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " -"is equivalent to advancing the iterator returned by :meth:`~object." -"__await__`. If *value* is not ``None``, this method delegates to the :meth:" -"`~generator.send` method of the iterator that caused the coroutine to " -"suspend. The result (return value, :exc:`StopIteration`, or other " -"exception) is the same as when iterating over the :meth:`!__await__` return " -"value, described above." +"is equivalent to advancing the iterator returned " +"by :meth:`~object.__await__`. If *value* is not ``None``, this method " +"delegates to the :meth:`~generator.send` method of the iterator that caused " +"the coroutine to suspend. The result (return value, :exc:`StopIteration`, " +"or other exception) is the same as when iterating over the :meth:`!" +"__await__` return value, described above." msgstr "" #: ../../reference/datamodel.rst:3688 @@ -4365,10 +4381,11 @@ msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " "coroutine to suspend, if it has such a method. Otherwise, the exception is " -"raised at the suspension point. The result (return value, :exc:" -"`StopIteration`, or other exception) is the same as when iterating over the :" -"meth:`~object.__await__` return value, described above. If the exception is " -"not caught in the coroutine, it propagates back to the caller." +"raised at the suspension point. The result (return " +"value, :exc:`StopIteration`, or other exception) is the same as when " +"iterating over the :meth:`~object.__await__` return value, described above. " +"If the exception is not caught in the coroutine, it propagates back to the " +"caller." msgstr "" #: ../../reference/datamodel.rst:3699 @@ -4464,8 +4481,8 @@ msgstr "" #: ../../reference/datamodel.rst:3759 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " -"asynchronous iterator object. Returning anything else will result in a :exc:" -"`TypeError` error." +"asynchronous iterator object. Returning anything else will result in " +"a :exc:`TypeError` error." msgstr "" #: ../../reference/datamodel.rst:3767 @@ -4529,11 +4546,10 @@ msgstr "" #: ../../reference/datamodel.rst:3804 msgid "" -"The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." -"__reversed__`, :meth:`~object.__contains__`, :meth:`~object." -"__class_getitem__` and :meth:`~os.PathLike.__fspath__` methods have special " -"handling for this. Others will still raise a :exc:`TypeError`, but may do so " -"by relying on the behavior that ``None`` is not callable." +"The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object.__reversed__`, :meth:`~object.__contains__`, :meth:`~object.__class_getitem__` " +"and :meth:`~os.PathLike.__fspath__` methods have special handling for this. " +"Others will still raise a :exc:`TypeError`, but may do so by relying on the " +"behavior that ``None`` is not callable." msgstr "" #: ../../reference/datamodel.rst:3811 diff --git a/reference/expressions.po b/reference/expressions.po index 32ca7edb29..ee413f9192 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-15 00:14+0000\n" +"POT-Creation-Date: 2025-02-23 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -715,7 +715,7 @@ msgid "" "*value* may be cleared." msgstr "" -#: ../../reference/expressions.rst:621 ../../reference/expressions.rst:802 +#: ../../reference/expressions.rst:621 ../../reference/expressions.rst:805 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." @@ -878,7 +878,7 @@ msgid "" "which are used to control the execution of a generator function." msgstr "" -#: ../../reference/expressions.rst:757 +#: ../../reference/expressions.rst:758 msgid "" "Returns an awaitable which when run starts to execute the asynchronous " "generator or resumes it at the last executed yield expression. When an " @@ -893,12 +893,12 @@ msgid "" "has completed." msgstr "" -#: ../../reference/expressions.rst:769 +#: ../../reference/expressions.rst:770 msgid "" "This method is normally called implicitly by a :keyword:`async for` loop." msgstr "" -#: ../../reference/expressions.rst:774 +#: ../../reference/expressions.rst:776 msgid "" "Returns an awaitable which when run resumes the execution of the " "asynchronous generator. As with the :meth:`~generator.send` method for a " @@ -913,7 +913,7 @@ msgid "" "receive the value." msgstr "" -#: ../../reference/expressions.rst:790 +#: ../../reference/expressions.rst:793 msgid "" "Returns an awaitable that raises an exception of type ``type`` at the point " "where the asynchronous generator was paused, and returns the next value " @@ -925,7 +925,7 @@ msgid "" "that exception propagates to the caller of the awaitable." msgstr "" -#: ../../reference/expressions.rst:810 +#: ../../reference/expressions.rst:814 msgid "" "Returns an awaitable that when run will throw a :exc:`GeneratorExit` into " "the asynchronous generator function at the point where it was paused. If the " @@ -941,25 +941,25 @@ msgid "" "will return an awaitable that does nothing." msgstr "" -#: ../../reference/expressions.rst:826 +#: ../../reference/expressions.rst:830 msgid "Primaries" msgstr "" -#: ../../reference/expressions.rst:830 +#: ../../reference/expressions.rst:834 msgid "" "Primaries represent the most tightly bound operations of the language. Their " "syntax is:" msgstr "" -#: ../../reference/expressions.rst:840 +#: ../../reference/expressions.rst:844 msgid "Attribute references" msgstr "" -#: ../../reference/expressions.rst:846 +#: ../../reference/expressions.rst:850 msgid "An attribute reference is a primary followed by a period and a name:" msgstr "" -#: ../../reference/expressions.rst:856 +#: ../../reference/expressions.rst:860 msgid "" "The primary must evaluate to an object of a type that supports attribute " "references, which most objects do. This object is then asked to produce the " @@ -968,7 +968,7 @@ msgid "" "reference may yield different objects." msgstr "" -#: ../../reference/expressions.rst:862 +#: ../../reference/expressions.rst:866 msgid "" "This production can be customized by overriding the :meth:`~object." "__getattribute__` method or the :meth:`~object.__getattr__` method. The :" @@ -976,17 +976,17 @@ msgid "" "or raises :exc:`AttributeError` if the attribute is not available." msgstr "" -#: ../../reference/expressions.rst:868 +#: ../../reference/expressions.rst:872 msgid "" "If an :exc:`AttributeError` is raised and the object has a :meth:`!" "__getattr__` method, that method is called as a fallback." msgstr "" -#: ../../reference/expressions.rst:874 +#: ../../reference/expressions.rst:878 msgid "Subscriptions" msgstr "" -#: ../../reference/expressions.rst:889 +#: ../../reference/expressions.rst:893 msgid "" "The subscription of an instance of a :ref:`container class <sequence-types>` " "will generally select an element from the container. The subscription of a :" @@ -994,13 +994,13 @@ msgid "" "`GenericAlias <types-genericalias>` object." msgstr "" -#: ../../reference/expressions.rst:897 +#: ../../reference/expressions.rst:901 msgid "" "When an object is subscripted, the interpreter will evaluate the primary and " "the expression list." msgstr "" -#: ../../reference/expressions.rst:900 +#: ../../reference/expressions.rst:904 msgid "" "The primary must evaluate to an object that supports subscription. An object " "may support subscription through defining one or both of :meth:`~object." @@ -1010,7 +1010,7 @@ msgid "" "called instead of ``__getitem__``, see :ref:`classgetitem-versus-getitem`." msgstr "" -#: ../../reference/expressions.rst:907 +#: ../../reference/expressions.rst:911 msgid "" "If the expression list contains at least one comma, or if any of the " "expressions are starred, the expression list will evaluate to a :class:" @@ -1018,17 +1018,17 @@ msgid "" "expression list will evaluate to the value of the list's sole member." msgstr "" -#: ../../reference/expressions.rst:912 +#: ../../reference/expressions.rst:916 msgid "Expressions in an expression list may be starred. See :pep:`646`." msgstr "" -#: ../../reference/expressions.rst:915 +#: ../../reference/expressions.rst:919 msgid "" "For built-in objects, there are two types of objects that support " "subscription via :meth:`~object.__getitem__`:" msgstr "" -#: ../../reference/expressions.rst:918 +#: ../../reference/expressions.rst:922 msgid "" "Mappings. If the primary is a :term:`mapping`, the expression list must " "evaluate to an object whose value is one of the keys of the mapping, and the " @@ -1036,7 +1036,7 @@ msgid "" "An example of a builtin mapping class is the :class:`dict` class." msgstr "" -#: ../../reference/expressions.rst:922 +#: ../../reference/expressions.rst:926 msgid "" "Sequences. If the primary is a :term:`sequence`, the expression list must " "evaluate to an :class:`int` or a :class:`slice` (as discussed in the " @@ -1044,7 +1044,7 @@ msgid "" "`str`, :class:`list` and :class:`tuple` classes." msgstr "" -#: ../../reference/expressions.rst:927 +#: ../../reference/expressions.rst:931 msgid "" "The formal syntax makes no special provision for negative indices in :term:" "`sequences <sequence>`. However, built-in sequences all provide a :meth:" @@ -1058,25 +1058,25 @@ msgid "" "explicitly add that support." msgstr "" -#: ../../reference/expressions.rst:941 +#: ../../reference/expressions.rst:945 msgid "" "A :class:`string <str>` is a special kind of sequence whose items are " "*characters*. A character is not a separate data type but a string of " "exactly one character." msgstr "" -#: ../../reference/expressions.rst:949 +#: ../../reference/expressions.rst:953 msgid "Slicings" msgstr "" -#: ../../reference/expressions.rst:963 +#: ../../reference/expressions.rst:967 msgid "" "A slicing selects a range of items in a sequence object (e.g., a string, " "tuple or list). Slicings may be used as expressions or as targets in " "assignment or :keyword:`del` statements. The syntax for a slicing:" msgstr "" -#: ../../reference/expressions.rst:976 +#: ../../reference/expressions.rst:980 msgid "" "There is ambiguity in the formal syntax here: anything that looks like an " "expression list also looks like a slice list, so any subscription can be " @@ -1086,7 +1086,7 @@ msgid "" "the case if the slice list contains no proper slice)." msgstr "" -#: ../../reference/expressions.rst:988 +#: ../../reference/expressions.rst:992 msgid "" "The semantics for a slicing are as follows. The primary is indexed (using " "the same :meth:`~object.__getitem__` method as normal subscription) with a " @@ -1101,23 +1101,23 @@ msgid "" "missing expressions." msgstr "" -#: ../../reference/expressions.rst:1012 +#: ../../reference/expressions.rst:1016 msgid "Calls" msgstr "" -#: ../../reference/expressions.rst:1014 +#: ../../reference/expressions.rst:1018 msgid "" "A call calls a callable object (e.g., a :term:`function`) with a possibly " "empty series of :term:`arguments <argument>`:" msgstr "" -#: ../../reference/expressions.rst:1031 +#: ../../reference/expressions.rst:1035 msgid "" "An optional trailing comma may be present after the positional and keyword " "arguments but does not affect the semantics." msgstr "" -#: ../../reference/expressions.rst:1037 +#: ../../reference/expressions.rst:1041 msgid "" "The primary must evaluate to a callable object (user-defined functions, " "built-in functions, methods of built-in objects, class objects, methods of " @@ -1127,7 +1127,7 @@ msgid "" "formal :term:`parameter` lists." msgstr "" -#: ../../reference/expressions.rst:1045 +#: ../../reference/expressions.rst:1049 msgid "" "If keyword arguments are present, they are first converted to positional " "arguments, as follows. First, a list of unfilled slots is created for the " @@ -1148,7 +1148,7 @@ msgid "" "filled slots is used as the argument list for the call." msgstr "" -#: ../../reference/expressions.rst:1065 +#: ../../reference/expressions.rst:1069 msgid "" "An implementation may provide built-in functions whose positional parameters " "do not have names, even if they are 'named' for the purpose of " @@ -1157,7 +1157,7 @@ msgid "" "`PyArg_ParseTuple` to parse their arguments." msgstr "" -#: ../../reference/expressions.rst:1071 +#: ../../reference/expressions.rst:1075 msgid "" "If there are more positional arguments than there are formal parameter " "slots, a :exc:`TypeError` exception is raised, unless a formal parameter " @@ -1166,7 +1166,7 @@ msgid "" "empty tuple if there were no excess positional arguments)." msgstr "" -#: ../../reference/expressions.rst:1077 +#: ../../reference/expressions.rst:1081 msgid "" "If any keyword argument does not correspond to a formal parameter name, a :" "exc:`TypeError` exception is raised, unless a formal parameter using the " @@ -1176,7 +1176,7 @@ msgid "" "(new) empty dictionary if there were no excess keyword arguments." msgstr "" -#: ../../reference/expressions.rst:1088 +#: ../../reference/expressions.rst:1092 msgid "" "If the syntax ``*expression`` appears in the function call, ``expression`` " "must evaluate to an :term:`iterable`. Elements from these iterables are " @@ -1186,14 +1186,14 @@ msgid "" "*y1*, ..., *yM*, *x3*, *x4*." msgstr "" -#: ../../reference/expressions.rst:1095 +#: ../../reference/expressions.rst:1099 msgid "" "A consequence of this is that although the ``*expression`` syntax may appear " "*after* explicit keyword arguments, it is processed *before* the keyword " "arguments (and any ``**expression`` arguments -- see below). So::" msgstr "" -#: ../../reference/expressions.rst:1099 +#: ../../reference/expressions.rst:1103 msgid "" ">>> def f(a, b):\n" "... print(a, b)\n" @@ -1219,13 +1219,13 @@ msgstr "" ">>> f(1, *(2,))\n" "1 2" -#: ../../reference/expressions.rst:1111 +#: ../../reference/expressions.rst:1115 msgid "" "It is unusual for both keyword arguments and the ``*expression`` syntax to " "be used in the same call, so in practice this confusion does not often arise." msgstr "" -#: ../../reference/expressions.rst:1117 +#: ../../reference/expressions.rst:1121 msgid "" "If the syntax ``**expression`` appears in the function call, ``expression`` " "must evaluate to a :term:`mapping`, the contents of which are treated as " @@ -1234,7 +1234,7 @@ msgid "" "a :exc:`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1123 +#: ../../reference/expressions.rst:1127 msgid "" "When ``**expression`` is used, each key in this mapping must be a string. " "Each value from the mapping is assigned to the first formal parameter " @@ -1246,35 +1246,35 @@ msgid "" "is raised." msgstr "" -#: ../../reference/expressions.rst:1133 +#: ../../reference/expressions.rst:1137 msgid "" "Formal parameters using the syntax ``*identifier`` or ``**identifier`` " "cannot be used as positional argument slots or as keyword argument names." msgstr "" -#: ../../reference/expressions.rst:1136 +#: ../../reference/expressions.rst:1140 msgid "" "Function calls accept any number of ``*`` and ``**`` unpackings, positional " "arguments may follow iterable unpackings (``*``), and keyword arguments may " "follow dictionary unpackings (``**``). Originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1142 +#: ../../reference/expressions.rst:1146 msgid "" "A call always returns some value, possibly ``None``, unless it raises an " "exception. How this value is computed depends on the type of the callable " "object." msgstr "" -#: ../../reference/expressions.rst:1146 +#: ../../reference/expressions.rst:1150 msgid "If it is---" msgstr "" -#: ../../reference/expressions.rst:1148 +#: ../../reference/expressions.rst:1152 msgid "a user-defined function:" msgstr "" -#: ../../reference/expressions.rst:1155 +#: ../../reference/expressions.rst:1159 msgid "" "The code block for the function is executed, passing it the argument list. " "The first thing the code block will do is bind the formal parameters to the " @@ -1285,73 +1285,73 @@ msgid "" "``None``." msgstr "" -#: ../../reference/expressions.rst:1162 +#: ../../reference/expressions.rst:1166 msgid "a built-in function or method:" msgstr "" -#: ../../reference/expressions.rst:1173 +#: ../../reference/expressions.rst:1177 msgid "" "The result is up to the interpreter; see :ref:`built-in-funcs` for the " "descriptions of built-in functions and methods." msgstr "" -#: ../../reference/expressions.rst:1176 +#: ../../reference/expressions.rst:1180 msgid "a class object:" msgstr "" -#: ../../reference/expressions.rst:1181 +#: ../../reference/expressions.rst:1185 msgid "A new instance of that class is returned." msgstr "" -#: ../../reference/expressions.rst:1183 +#: ../../reference/expressions.rst:1187 msgid "a class instance method:" msgstr "" -#: ../../reference/expressions.rst:1189 +#: ../../reference/expressions.rst:1193 msgid "" "The corresponding user-defined function is called, with an argument list " "that is one longer than the argument list of the call: the instance becomes " "the first argument." msgstr "" -#: ../../reference/expressions.rst:1193 +#: ../../reference/expressions.rst:1197 msgid "a class instance:" msgstr "" -#: ../../reference/expressions.rst:1198 +#: ../../reference/expressions.rst:1202 msgid "" "The class must define a :meth:`~object.__call__` method; the effect is then " "the same as if that method was called." msgstr "" -#: ../../reference/expressions.rst:1206 ../../reference/expressions.rst:2007 +#: ../../reference/expressions.rst:1210 ../../reference/expressions.rst:2011 msgid "Await expression" msgstr "" -#: ../../reference/expressions.rst:1208 +#: ../../reference/expressions.rst:1212 msgid "" "Suspend the execution of :term:`coroutine` on an :term:`awaitable` object. " "Can only be used inside a :term:`coroutine function`." msgstr "" -#: ../../reference/expressions.rst:1220 +#: ../../reference/expressions.rst:1224 msgid "The power operator" msgstr "" -#: ../../reference/expressions.rst:1226 +#: ../../reference/expressions.rst:1230 msgid "" "The power operator binds more tightly than unary operators on its left; it " "binds less tightly than unary operators on its right. The syntax is:" msgstr "" -#: ../../reference/expressions.rst:1232 +#: ../../reference/expressions.rst:1236 msgid "" "Thus, in an unparenthesized sequence of power and unary operators, the " "operators are evaluated from right to left (this does not constrain the " "evaluation order for the operands): ``-1**2`` results in ``-1``." msgstr "" -#: ../../reference/expressions.rst:1236 +#: ../../reference/expressions.rst:1240 msgid "" "The power operator has the same semantics as the built-in :func:`pow` " "function, when called with two arguments: it yields its left argument raised " @@ -1359,7 +1359,7 @@ msgid "" "converted to a common type, and the result is of that type." msgstr "" -#: ../../reference/expressions.rst:1241 +#: ../../reference/expressions.rst:1245 msgid "" "For int operands, the result has the same type as the operands unless the " "second argument is negative; in that case, all arguments are converted to " @@ -1367,41 +1367,41 @@ msgid "" "``100``, but ``10**-2`` returns ``0.01``." msgstr "" -#: ../../reference/expressions.rst:1246 +#: ../../reference/expressions.rst:1250 msgid "" "Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`. " "Raising a negative number to a fractional power results in a :class:" "`complex` number. (In earlier versions it raised a :exc:`ValueError`.)" msgstr "" -#: ../../reference/expressions.rst:1250 +#: ../../reference/expressions.rst:1254 msgid "" "This operation can be customized using the special :meth:`~object.__pow__` " "and :meth:`~object.__rpow__` methods." msgstr "" -#: ../../reference/expressions.rst:1256 +#: ../../reference/expressions.rst:1260 msgid "Unary arithmetic and bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1262 +#: ../../reference/expressions.rst:1266 msgid "All unary arithmetic and bitwise operations have the same priority:" msgstr "" -#: ../../reference/expressions.rst:1273 +#: ../../reference/expressions.rst:1277 msgid "" "The unary ``-`` (minus) operator yields the negation of its numeric " "argument; the operation can be overridden with the :meth:`~object.__neg__` " "special method." msgstr "" -#: ../../reference/expressions.rst:1281 +#: ../../reference/expressions.rst:1285 msgid "" "The unary ``+`` (plus) operator yields its numeric argument unchanged; the " "operation can be overridden with the :meth:`~object.__pos__` special method." msgstr "" -#: ../../reference/expressions.rst:1288 +#: ../../reference/expressions.rst:1292 msgid "" "The unary ``~`` (invert) operator yields the bitwise inversion of its " "integer argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. " @@ -1409,17 +1409,17 @@ msgid "" "meth:`~object.__invert__` special method." msgstr "" -#: ../../reference/expressions.rst:1297 +#: ../../reference/expressions.rst:1301 msgid "" "In all three cases, if the argument does not have the proper type, a :exc:" "`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1304 +#: ../../reference/expressions.rst:1308 msgid "Binary arithmetic operations" msgstr "" -#: ../../reference/expressions.rst:1308 +#: ../../reference/expressions.rst:1312 msgid "" "The binary arithmetic operations have the conventional priority levels. " "Note that some of these operations also apply to certain non-numeric types. " @@ -1427,7 +1427,7 @@ msgid "" "multiplicative operators and one for additive operators:" msgstr "" -#: ../../reference/expressions.rst:1323 +#: ../../reference/expressions.rst:1327 msgid "" "The ``*`` (multiplication) operator yields the product of its arguments. " "The arguments must either both be numbers, or one argument must be an " @@ -1437,25 +1437,25 @@ msgid "" "an empty sequence." msgstr "" -#: ../../reference/expressions.rst:1329 +#: ../../reference/expressions.rst:1333 msgid "" "This operation can be customized using the special :meth:`~object.__mul__` " "and :meth:`~object.__rmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1336 +#: ../../reference/expressions.rst:1340 msgid "" "The ``@`` (at) operator is intended to be used for matrix multiplication. " "No builtin Python types implement this operator." msgstr "" -#: ../../reference/expressions.rst:1339 +#: ../../reference/expressions.rst:1343 msgid "" "This operation can be customized using the special :meth:`~object." "__matmul__` and :meth:`~object.__rmatmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1350 +#: ../../reference/expressions.rst:1354 msgid "" "The ``/`` (division) and ``//`` (floor division) operators yield the " "quotient of their arguments. The numeric arguments are first converted to a " @@ -1465,7 +1465,7 @@ msgid "" "the :exc:`ZeroDivisionError` exception." msgstr "" -#: ../../reference/expressions.rst:1357 +#: ../../reference/expressions.rst:1361 msgid "" "The division operation can be customized using the special :meth:`~object." "__truediv__` and :meth:`~object.__rtruediv__` methods. The floor division " @@ -1473,7 +1473,7 @@ msgid "" "and :meth:`~object.__rfloordiv__` methods." msgstr "" -#: ../../reference/expressions.rst:1366 +#: ../../reference/expressions.rst:1370 msgid "" "The ``%`` (modulo) operator yields the remainder from the division of the " "first argument by the second. The numeric arguments are first converted to " @@ -1485,7 +1485,7 @@ msgid "" "absolute value of the second operand [#]_." msgstr "" -#: ../../reference/expressions.rst:1375 +#: ../../reference/expressions.rst:1379 msgid "" "The floor division and modulo operators are connected by the following " "identity: ``x == (x//y)*y + (x%y)``. Floor division and modulo are also " @@ -1493,7 +1493,7 @@ msgid "" "y, x%y)``. [#]_." msgstr "" -#: ../../reference/expressions.rst:1380 +#: ../../reference/expressions.rst:1384 msgid "" "In addition to performing the modulo operation on numbers, the ``%`` " "operator is also overloaded by string objects to perform old-style string " @@ -1502,20 +1502,20 @@ msgid "" "formatting`." msgstr "" -#: ../../reference/expressions.rst:1385 +#: ../../reference/expressions.rst:1389 msgid "" "The *modulo* operation can be customized using the special :meth:`~object." "__mod__` and :meth:`~object.__rmod__` methods." msgstr "" -#: ../../reference/expressions.rst:1388 +#: ../../reference/expressions.rst:1392 msgid "" "The floor division operator, the modulo operator, and the :func:`divmod` " "function are not defined for complex numbers. Instead, convert to a " "floating-point number using the :func:`abs` function if appropriate." msgstr "" -#: ../../reference/expressions.rst:1397 +#: ../../reference/expressions.rst:1401 msgid "" "The ``+`` (addition) operator yields the sum of its arguments. The " "arguments must either both be numbers or both be sequences of the same " @@ -1523,40 +1523,40 @@ msgid "" "then added together. In the latter case, the sequences are concatenated." msgstr "" -#: ../../reference/expressions.rst:1402 +#: ../../reference/expressions.rst:1406 msgid "" "This operation can be customized using the special :meth:`~object.__add__` " "and :meth:`~object.__radd__` methods." msgstr "" -#: ../../reference/expressions.rst:1410 +#: ../../reference/expressions.rst:1414 msgid "" "The ``-`` (subtraction) operator yields the difference of its arguments. " "The numeric arguments are first converted to a common type." msgstr "" -#: ../../reference/expressions.rst:1413 +#: ../../reference/expressions.rst:1417 msgid "" "This operation can be customized using the special :meth:`~object.__sub__` " "and :meth:`~object.__rsub__` methods." msgstr "" -#: ../../reference/expressions.rst:1420 +#: ../../reference/expressions.rst:1424 msgid "Shifting operations" msgstr "" -#: ../../reference/expressions.rst:1427 +#: ../../reference/expressions.rst:1431 msgid "" "The shifting operations have lower priority than the arithmetic operations:" msgstr "" -#: ../../reference/expressions.rst:1432 +#: ../../reference/expressions.rst:1436 msgid "" "These operators accept integers as arguments. They shift the first argument " "to the left or right by the number of bits given by the second argument." msgstr "" -#: ../../reference/expressions.rst:1435 +#: ../../reference/expressions.rst:1439 msgid "" "The left shift operation can be customized using the special :meth:`~object." "__lshift__` and :meth:`~object.__rlshift__` methods. The right shift " @@ -1564,46 +1564,46 @@ msgid "" "and :meth:`~object.__rrshift__` methods." msgstr "" -#: ../../reference/expressions.rst:1442 +#: ../../reference/expressions.rst:1446 msgid "" "A right shift by *n* bits is defined as floor division by ``pow(2,n)``. A " "left shift by *n* bits is defined as multiplication with ``pow(2,n)``." msgstr "" -#: ../../reference/expressions.rst:1449 +#: ../../reference/expressions.rst:1453 msgid "Binary bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1453 +#: ../../reference/expressions.rst:1457 msgid "Each of the three bitwise operations has a different priority level:" msgstr "" -#: ../../reference/expressions.rst:1464 +#: ../../reference/expressions.rst:1468 msgid "" "The ``&`` operator yields the bitwise AND of its arguments, which must be " "integers or one of them must be a custom object overriding :meth:`~object." "__and__` or :meth:`~object.__rand__` special methods." msgstr "" -#: ../../reference/expressions.rst:1473 +#: ../../reference/expressions.rst:1477 msgid "" "The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, " "which must be integers or one of them must be a custom object overriding :" "meth:`~object.__xor__` or :meth:`~object.__rxor__` special methods." msgstr "" -#: ../../reference/expressions.rst:1482 +#: ../../reference/expressions.rst:1486 msgid "" "The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which " "must be integers or one of them must be a custom object overriding :meth:" "`~object.__or__` or :meth:`~object.__ror__` special methods." msgstr "" -#: ../../reference/expressions.rst:1490 +#: ../../reference/expressions.rst:1494 msgid "Comparisons" msgstr "" -#: ../../reference/expressions.rst:1502 +#: ../../reference/expressions.rst:1506 msgid "" "Unlike C, all comparison operations in Python have the same priority, which " "is lower than that of any arithmetic, shifting or bitwise operation. Also " @@ -1611,14 +1611,14 @@ msgid "" "conventional in mathematics:" msgstr "" -#: ../../reference/expressions.rst:1512 +#: ../../reference/expressions.rst:1516 msgid "" "Comparisons yield boolean values: ``True`` or ``False``. Custom :dfn:`rich " "comparison methods` may return non-boolean values. In this case Python will " "call :func:`bool` on such value in boolean contexts." msgstr "" -#: ../../reference/expressions.rst:1518 +#: ../../reference/expressions.rst:1522 msgid "" "Comparisons can be chained arbitrarily, e.g., ``x < y <= z`` is equivalent " "to ``x < y and y <= z``, except that ``y`` is evaluated only once (but in " @@ -1626,7 +1626,7 @@ msgid "" "false)." msgstr "" -#: ../../reference/expressions.rst:1522 +#: ../../reference/expressions.rst:1526 msgid "" "Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*, " "*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y opN " @@ -1634,24 +1634,24 @@ msgid "" "each expression is evaluated at most once." msgstr "" -#: ../../reference/expressions.rst:1527 +#: ../../reference/expressions.rst:1531 msgid "" "Note that ``a op1 b op2 c`` doesn't imply any kind of comparison between *a* " "and *c*, so that, e.g., ``x < y > z`` is perfectly legal (though perhaps not " "pretty)." msgstr "" -#: ../../reference/expressions.rst:1534 +#: ../../reference/expressions.rst:1538 msgid "Value comparisons" msgstr "" -#: ../../reference/expressions.rst:1536 +#: ../../reference/expressions.rst:1540 msgid "" "The operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare the " "values of two objects. The objects do not need to have the same type." msgstr "" -#: ../../reference/expressions.rst:1539 +#: ../../reference/expressions.rst:1543 msgid "" "Chapter :ref:`objects` states that objects have a value (in addition to type " "and identity). The value of an object is a rather abstract notion in " @@ -1663,7 +1663,7 @@ msgid "" "indirectly, by means of their comparison implementation." msgstr "" -#: ../../reference/expressions.rst:1548 +#: ../../reference/expressions.rst:1552 msgid "" "Because all types are (direct or indirect) subtypes of :class:`object`, they " "inherit the default comparison behavior from :class:`object`. Types can " @@ -1671,7 +1671,7 @@ msgid "" "methods` like :meth:`~object.__lt__`, described in :ref:`customization`." msgstr "" -#: ../../reference/expressions.rst:1554 +#: ../../reference/expressions.rst:1558 msgid "" "The default behavior for equality comparison (``==`` and ``!=``) is based on " "the identity of the objects. Hence, equality comparison of instances with " @@ -1681,14 +1681,14 @@ msgid "" "``x is y`` implies ``x == y``)." msgstr "" -#: ../../reference/expressions.rst:1561 +#: ../../reference/expressions.rst:1565 msgid "" "A default order comparison (``<``, ``>``, ``<=``, and ``>=``) is not " "provided; an attempt raises :exc:`TypeError`. A motivation for this default " "behavior is the lack of a similar invariant as for equality." msgstr "" -#: ../../reference/expressions.rst:1565 +#: ../../reference/expressions.rst:1569 msgid "" "The behavior of the default equality comparison, that instances with " "different identities are always unequal, may be in contrast to what types " @@ -1697,13 +1697,13 @@ msgid "" "in fact, a number of built-in types have done that." msgstr "" -#: ../../reference/expressions.rst:1571 +#: ../../reference/expressions.rst:1575 msgid "" "The following list describes the comparison behavior of the most important " "built-in types." msgstr "" -#: ../../reference/expressions.rst:1574 +#: ../../reference/expressions.rst:1578 msgid "" "Numbers of built-in numeric types (:ref:`typesnumeric`) and of the standard " "library types :class:`fractions.Fraction` and :class:`decimal.Decimal` can " @@ -1713,7 +1713,7 @@ msgid "" "of precision." msgstr "" -#: ../../reference/expressions.rst:1581 +#: ../../reference/expressions.rst:1585 msgid "" "The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are " "special. Any ordered comparison of a number to a not-a-number value is " @@ -1723,32 +1723,32 @@ msgid "" "is compliant with IEEE 754." msgstr "" -#: ../../reference/expressions.rst:1588 +#: ../../reference/expressions.rst:1592 msgid "" "``None`` and :data:`NotImplemented` are singletons. :PEP:`8` advises that " "comparisons for singletons should always be done with ``is`` or ``is not``, " "never the equality operators." msgstr "" -#: ../../reference/expressions.rst:1592 +#: ../../reference/expressions.rst:1596 msgid "" "Binary sequences (instances of :class:`bytes` or :class:`bytearray`) can be " "compared within and across their types. They compare lexicographically " "using the numeric values of their elements." msgstr "" -#: ../../reference/expressions.rst:1596 +#: ../../reference/expressions.rst:1600 msgid "" "Strings (instances of :class:`str`) compare lexicographically using the " "numerical Unicode code points (the result of the built-in function :func:" "`ord`) of their characters. [#]_" msgstr "" -#: ../../reference/expressions.rst:1600 +#: ../../reference/expressions.rst:1604 msgid "Strings and binary sequences cannot be directly compared." msgstr "" -#: ../../reference/expressions.rst:1602 +#: ../../reference/expressions.rst:1606 msgid "" "Sequences (instances of :class:`tuple`, :class:`list`, or :class:`range`) " "can be compared only within each of their types, with the restriction that " @@ -1757,7 +1757,7 @@ msgid "" "raises :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1608 +#: ../../reference/expressions.rst:1612 msgid "" "Sequences compare lexicographically using comparison of corresponding " "elements. The built-in containers typically assume identical objects are " @@ -1765,19 +1765,19 @@ msgid "" "objects to improve performance and to maintain their internal invariants." msgstr "" -#: ../../reference/expressions.rst:1613 +#: ../../reference/expressions.rst:1617 msgid "" "Lexicographical comparison between built-in collections works as follows:" msgstr "" -#: ../../reference/expressions.rst:1615 +#: ../../reference/expressions.rst:1619 msgid "" "For two collections to compare equal, they must be of the same type, have " "the same length, and each pair of corresponding elements must compare equal " "(for example, ``[1,2] == (1,2)`` is false because the type is not the same)." msgstr "" -#: ../../reference/expressions.rst:1620 +#: ../../reference/expressions.rst:1624 msgid "" "Collections that support order comparison are ordered the same as their " "first unequal elements (for example, ``[1,2,x] <= [1,2,y]`` has the same " @@ -1786,25 +1786,25 @@ msgid "" "true)." msgstr "" -#: ../../reference/expressions.rst:1626 +#: ../../reference/expressions.rst:1630 msgid "" "Mappings (instances of :class:`dict`) compare equal if and only if they have " "equal ``(key, value)`` pairs. Equality comparison of the keys and values " "enforces reflexivity." msgstr "" -#: ../../reference/expressions.rst:1630 +#: ../../reference/expressions.rst:1634 msgid "" "Order comparisons (``<``, ``>``, ``<=``, and ``>=``) raise :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1632 +#: ../../reference/expressions.rst:1636 msgid "" "Sets (instances of :class:`set` or :class:`frozenset`) can be compared " "within and across their types." msgstr "" -#: ../../reference/expressions.rst:1635 +#: ../../reference/expressions.rst:1639 msgid "" "They define order comparison operators to mean subset and superset tests. " "Those relations do not define total orderings (for example, the two sets " @@ -1815,110 +1815,110 @@ msgid "" "sets as inputs)." msgstr "" -#: ../../reference/expressions.rst:1643 +#: ../../reference/expressions.rst:1647 msgid "Comparison of sets enforces reflexivity of its elements." msgstr "" -#: ../../reference/expressions.rst:1645 +#: ../../reference/expressions.rst:1649 msgid "" "Most other built-in types have no comparison methods implemented, so they " "inherit the default comparison behavior." msgstr "" -#: ../../reference/expressions.rst:1648 +#: ../../reference/expressions.rst:1652 msgid "" "User-defined classes that customize their comparison behavior should follow " "some consistency rules, if possible:" msgstr "" -#: ../../reference/expressions.rst:1651 +#: ../../reference/expressions.rst:1655 msgid "" "Equality comparison should be reflexive. In other words, identical objects " "should compare equal:" msgstr "" -#: ../../reference/expressions.rst:1654 +#: ../../reference/expressions.rst:1658 msgid "``x is y`` implies ``x == y``" msgstr "" -#: ../../reference/expressions.rst:1656 +#: ../../reference/expressions.rst:1660 msgid "" "Comparison should be symmetric. In other words, the following expressions " "should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1659 +#: ../../reference/expressions.rst:1663 msgid "``x == y`` and ``y == x``" msgstr "``x == y`` 和 ``y == x``" -#: ../../reference/expressions.rst:1661 +#: ../../reference/expressions.rst:1665 msgid "``x != y`` and ``y != x``" msgstr "``x != y`` 和 ``y != x``" -#: ../../reference/expressions.rst:1663 +#: ../../reference/expressions.rst:1667 msgid "``x < y`` and ``y > x``" msgstr "``x < y`` 和 ``y > x``" -#: ../../reference/expressions.rst:1665 +#: ../../reference/expressions.rst:1669 msgid "``x <= y`` and ``y >= x``" msgstr "``x <= y`` 和 ``y >= x``" -#: ../../reference/expressions.rst:1667 +#: ../../reference/expressions.rst:1671 msgid "" "Comparison should be transitive. The following (non-exhaustive) examples " "illustrate that:" msgstr "" -#: ../../reference/expressions.rst:1670 +#: ../../reference/expressions.rst:1674 msgid "``x > y and y > z`` implies ``x > z``" msgstr "``x > y and y > z`` 暗示了 ``x > z``" -#: ../../reference/expressions.rst:1672 +#: ../../reference/expressions.rst:1676 msgid "``x < y and y <= z`` implies ``x < z``" msgstr "``x < y and y <= z`` 暗示了 ``x < z``" -#: ../../reference/expressions.rst:1674 +#: ../../reference/expressions.rst:1678 msgid "" "Inverse comparison should result in the boolean negation. In other words, " "the following expressions should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1677 +#: ../../reference/expressions.rst:1681 msgid "``x == y`` and ``not x != y``" msgstr "``x == y`` 和 ``not x != y``" -#: ../../reference/expressions.rst:1679 +#: ../../reference/expressions.rst:1683 msgid "``x < y`` and ``not x >= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1681 +#: ../../reference/expressions.rst:1685 msgid "``x > y`` and ``not x <= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1683 +#: ../../reference/expressions.rst:1687 msgid "" "The last two expressions apply to totally ordered collections (e.g. to " "sequences, but not to sets or mappings). See also the :func:`~functools." "total_ordering` decorator." msgstr "" -#: ../../reference/expressions.rst:1687 +#: ../../reference/expressions.rst:1691 msgid "" "The :func:`hash` result should be consistent with equality. Objects that are " "equal should either have the same hash value, or be marked as unhashable." msgstr "" -#: ../../reference/expressions.rst:1691 +#: ../../reference/expressions.rst:1695 msgid "" "Python does not enforce these consistency rules. In fact, the not-a-number " "values are an example for not following these rules." msgstr "" -#: ../../reference/expressions.rst:1700 +#: ../../reference/expressions.rst:1704 msgid "Membership test operations" msgstr "" -#: ../../reference/expressions.rst:1702 +#: ../../reference/expressions.rst:1706 msgid "" "The operators :keyword:`in` and :keyword:`not in` test for membership. ``x " "in s`` evaluates to ``True`` if *x* is a member of *s*, and ``False`` " @@ -1929,7 +1929,7 @@ msgid "" "expression ``x in y`` is equivalent to ``any(x is e or x == e for e in y)``." msgstr "" -#: ../../reference/expressions.rst:1710 +#: ../../reference/expressions.rst:1714 msgid "" "For the string and bytes types, ``x in y`` is ``True`` if and only if *x* is " "a substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty " @@ -1937,14 +1937,14 @@ msgid "" "``\"\" in \"abc\"`` will return ``True``." msgstr "" -#: ../../reference/expressions.rst:1715 +#: ../../reference/expressions.rst:1719 msgid "" "For user-defined classes which define the :meth:`~object.__contains__` " "method, ``x in y`` returns ``True`` if ``y.__contains__(x)`` returns a true " "value, and ``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1719 +#: ../../reference/expressions.rst:1723 msgid "" "For user-defined classes which do not define :meth:`~object.__contains__` " "but do define :meth:`~object.__iter__`, ``x in y`` is ``True`` if some value " @@ -1953,7 +1953,7 @@ msgid "" "it is as if :keyword:`in` raised that exception." msgstr "" -#: ../../reference/expressions.rst:1725 +#: ../../reference/expressions.rst:1729 msgid "" "Lastly, the old-style iteration protocol is tried: if a class defines :meth:" "`~object.__getitem__`, ``x in y`` is ``True`` if and only if there is a non-" @@ -1962,17 +1962,17 @@ msgid "" "exception is raised, it is as if :keyword:`in` raised that exception)." msgstr "" -#: ../../reference/expressions.rst:1737 +#: ../../reference/expressions.rst:1741 msgid "" "The operator :keyword:`not in` is defined to have the inverse truth value " "of :keyword:`in`." msgstr "" -#: ../../reference/expressions.rst:1750 +#: ../../reference/expressions.rst:1754 msgid "Identity comparisons" msgstr "" -#: ../../reference/expressions.rst:1752 +#: ../../reference/expressions.rst:1756 msgid "" "The operators :keyword:`is` and :keyword:`is not` test for an object's " "identity: ``x is y`` is true if and only if *x* and *y* are the same " @@ -1980,11 +1980,11 @@ msgid "" "``x is not y`` yields the inverse truth value. [#]_" msgstr "" -#: ../../reference/expressions.rst:1764 +#: ../../reference/expressions.rst:1768 msgid "Boolean operations" msgstr "" -#: ../../reference/expressions.rst:1775 +#: ../../reference/expressions.rst:1779 msgid "" "In the context of Boolean operations, and also when expressions are used by " "control flow statements, the following values are interpreted as false: " @@ -1995,25 +1995,25 @@ msgid "" "__bool__` method." msgstr "" -#: ../../reference/expressions.rst:1784 +#: ../../reference/expressions.rst:1788 msgid "" "The operator :keyword:`not` yields ``True`` if its argument is false, " "``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1789 +#: ../../reference/expressions.rst:1793 msgid "" "The expression ``x and y`` first evaluates *x*; if *x* is false, its value " "is returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1794 +#: ../../reference/expressions.rst:1798 msgid "" "The expression ``x or y`` first evaluates *x*; if *x* is true, its value is " "returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1797 +#: ../../reference/expressions.rst:1801 msgid "" "Note that neither :keyword:`and` nor :keyword:`or` restrict the value and " "type they return to ``False`` and ``True``, but rather return the last " @@ -2024,11 +2024,11 @@ msgid "" "argument (for example, ``not 'foo'`` produces ``False`` rather than ``''``.)" msgstr "" -#: ../../reference/expressions.rst:1816 +#: ../../reference/expressions.rst:1820 msgid "Assignment expressions" msgstr "" -#: ../../reference/expressions.rst:1821 +#: ../../reference/expressions.rst:1825 msgid "" "An assignment expression (sometimes also called a \"named expression\" or " "\"walrus\") assigns an :token:`~python-grammar:expression` to an :token:" @@ -2036,11 +2036,11 @@ msgid "" "`~python-grammar:expression`." msgstr "" -#: ../../reference/expressions.rst:1826 +#: ../../reference/expressions.rst:1830 msgid "One common use case is when handling matched regular expressions:" msgstr "" -#: ../../reference/expressions.rst:1828 +#: ../../reference/expressions.rst:1832 msgid "" "if matching := pattern.search(data):\n" " do_something(matching)" @@ -2048,11 +2048,11 @@ msgstr "" "if matching := pattern.search(data):\n" " do_something(matching)" -#: ../../reference/expressions.rst:1833 +#: ../../reference/expressions.rst:1837 msgid "Or, when processing a file stream in chunks:" msgstr "" -#: ../../reference/expressions.rst:1835 +#: ../../reference/expressions.rst:1839 msgid "" "while chunk := file.read(9000):\n" " process(chunk)" @@ -2060,7 +2060,7 @@ msgstr "" "while chunk := file.read(9000):\n" " process(chunk)" -#: ../../reference/expressions.rst:1840 +#: ../../reference/expressions.rst:1844 msgid "" "Assignment expressions must be surrounded by parentheses when used as " "expression statements and when used as sub-expressions in slicing, " @@ -2070,36 +2070,36 @@ msgid "" "and ``while`` statements." msgstr "" -#: ../../reference/expressions.rst:1848 +#: ../../reference/expressions.rst:1852 msgid "See :pep:`572` for more details about assignment expressions." msgstr "" -#: ../../reference/expressions.rst:1855 +#: ../../reference/expressions.rst:1859 msgid "Conditional expressions" msgstr "" -#: ../../reference/expressions.rst:1867 +#: ../../reference/expressions.rst:1871 msgid "" "Conditional expressions (sometimes called a \"ternary operator\") have the " "lowest priority of all Python operations." msgstr "" -#: ../../reference/expressions.rst:1870 +#: ../../reference/expressions.rst:1874 msgid "" "The expression ``x if C else y`` first evaluates the condition, *C* rather " "than *x*. If *C* is true, *x* is evaluated and its value is returned; " "otherwise, *y* is evaluated and its value is returned." msgstr "" -#: ../../reference/expressions.rst:1874 +#: ../../reference/expressions.rst:1878 msgid "See :pep:`308` for more details about conditional expressions." msgstr "" -#: ../../reference/expressions.rst:1881 +#: ../../reference/expressions.rst:1885 msgid "Lambdas" msgstr "" -#: ../../reference/expressions.rst:1892 +#: ../../reference/expressions.rst:1896 msgid "" "Lambda expressions (sometimes called lambda forms) are used to create " "anonymous functions. The expression ``lambda parameters: expression`` yields " @@ -2107,7 +2107,7 @@ msgid "" "defined with:" msgstr "" -#: ../../reference/expressions.rst:1896 +#: ../../reference/expressions.rst:1900 msgid "" "def <lambda>(parameters):\n" " return expression" @@ -2115,25 +2115,25 @@ msgstr "" "def <lambda>(parameters):\n" " return expression" -#: ../../reference/expressions.rst:1901 +#: ../../reference/expressions.rst:1905 msgid "" "See section :ref:`function` for the syntax of parameter lists. Note that " "functions created with lambda expressions cannot contain statements or " "annotations." msgstr "" -#: ../../reference/expressions.rst:1909 +#: ../../reference/expressions.rst:1913 msgid "Expression lists" msgstr "" -#: ../../reference/expressions.rst:1925 +#: ../../reference/expressions.rst:1929 msgid "" "Except when part of a list or set display, an expression list containing at " "least one comma yields a tuple. The length of the tuple is the number of " "expressions in the list. The expressions are evaluated from left to right." msgstr "" -#: ../../reference/expressions.rst:1934 +#: ../../reference/expressions.rst:1938 msgid "" "An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be " "an :term:`iterable`. The iterable is expanded into a sequence of items, " @@ -2141,16 +2141,16 @@ msgid "" "unpacking." msgstr "" -#: ../../reference/expressions.rst:1939 +#: ../../reference/expressions.rst:1943 msgid "" "Iterable unpacking in expression lists, originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1942 +#: ../../reference/expressions.rst:1946 msgid "Any item in an expression list may be starred. See :pep:`646`." msgstr "" -#: ../../reference/expressions.rst:1947 +#: ../../reference/expressions.rst:1951 msgid "" "A trailing comma is required only to create a one-item tuple, such as ``1," "``; it is optional in all other cases. A single expression without a " @@ -2159,24 +2159,24 @@ msgid "" "``()``.)" msgstr "" -#: ../../reference/expressions.rst:1958 +#: ../../reference/expressions.rst:1962 msgid "Evaluation order" msgstr "" -#: ../../reference/expressions.rst:1962 +#: ../../reference/expressions.rst:1966 msgid "" "Python evaluates expressions from left to right. Notice that while " "evaluating an assignment, the right-hand side is evaluated before the left-" "hand side." msgstr "" -#: ../../reference/expressions.rst:1965 +#: ../../reference/expressions.rst:1969 msgid "" "In the following lines, expressions will be evaluated in the arithmetic " "order of their suffixes::" msgstr "" -#: ../../reference/expressions.rst:1968 +#: ../../reference/expressions.rst:1972 msgid "" "expr1, expr2, expr3, expr4\n" "(expr1, expr2, expr3, expr4)\n" @@ -2192,11 +2192,11 @@ msgstr "" "expr1(expr2, expr3, *expr4, **expr5)\n" "expr3, expr4 = expr1, expr2" -#: ../../reference/expressions.rst:1979 +#: ../../reference/expressions.rst:1983 msgid "Operator precedence" msgstr "" -#: ../../reference/expressions.rst:1984 +#: ../../reference/expressions.rst:1988 msgid "" "The following table summarizes the operator precedence in Python, from " "highest precedence (most binding) to lowest precedence (least binding). " @@ -2206,176 +2206,176 @@ msgid "" "group from right to left)." msgstr "" -#: ../../reference/expressions.rst:1990 +#: ../../reference/expressions.rst:1994 msgid "" "Note that comparisons, membership tests, and identity tests, all have the " "same precedence and have a left-to-right chaining feature as described in " "the :ref:`comparisons` section." msgstr "" -#: ../../reference/expressions.rst:1996 +#: ../../reference/expressions.rst:2000 msgid "Operator" msgstr "運算子" -#: ../../reference/expressions.rst:1996 +#: ../../reference/expressions.rst:2000 msgid "Description" msgstr "描述" -#: ../../reference/expressions.rst:1998 +#: ../../reference/expressions.rst:2002 msgid "``(expressions...)``," msgstr "``(expressions...)``," -#: ../../reference/expressions.rst:2000 +#: ../../reference/expressions.rst:2004 msgid "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" msgstr "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" -#: ../../reference/expressions.rst:1998 +#: ../../reference/expressions.rst:2002 msgid "" "Binding or parenthesized expression, list display, dictionary display, set " "display" msgstr "" -#: ../../reference/expressions.rst:2004 +#: ../../reference/expressions.rst:2008 msgid "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" msgstr "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" -#: ../../reference/expressions.rst:2004 +#: ../../reference/expressions.rst:2008 msgid "Subscription, slicing, call, attribute reference" msgstr "" -#: ../../reference/expressions.rst:2007 +#: ../../reference/expressions.rst:2011 msgid ":keyword:`await x <await>`" msgstr ":keyword:`await x <await>`" -#: ../../reference/expressions.rst:2009 +#: ../../reference/expressions.rst:2013 msgid "``**``" msgstr "``**``" -#: ../../reference/expressions.rst:2009 +#: ../../reference/expressions.rst:2013 msgid "Exponentiation [#]_" msgstr "" -#: ../../reference/expressions.rst:2011 +#: ../../reference/expressions.rst:2015 msgid "``+x``, ``-x``, ``~x``" msgstr "``+x``, ``-x``, ``~x``" -#: ../../reference/expressions.rst:2011 +#: ../../reference/expressions.rst:2015 msgid "Positive, negative, bitwise NOT" msgstr "" -#: ../../reference/expressions.rst:2013 +#: ../../reference/expressions.rst:2017 msgid "``*``, ``@``, ``/``, ``//``, ``%``" msgstr "``*``, ``@``, ``/``, ``//``, ``%``" -#: ../../reference/expressions.rst:2013 +#: ../../reference/expressions.rst:2017 msgid "" "Multiplication, matrix multiplication, division, floor division, remainder " "[#]_" msgstr "" -#: ../../reference/expressions.rst:2017 +#: ../../reference/expressions.rst:2021 msgid "``+``, ``-``" msgstr "``+``, ``-``" -#: ../../reference/expressions.rst:2017 +#: ../../reference/expressions.rst:2021 msgid "Addition and subtraction" msgstr "" -#: ../../reference/expressions.rst:2019 +#: ../../reference/expressions.rst:2023 msgid "``<<``, ``>>``" msgstr "``<<``, ``>>``" -#: ../../reference/expressions.rst:2019 +#: ../../reference/expressions.rst:2023 msgid "Shifts" msgstr "" -#: ../../reference/expressions.rst:2021 +#: ../../reference/expressions.rst:2025 msgid "``&``" msgstr "``&``" -#: ../../reference/expressions.rst:2021 +#: ../../reference/expressions.rst:2025 msgid "Bitwise AND" msgstr "" -#: ../../reference/expressions.rst:2023 +#: ../../reference/expressions.rst:2027 msgid "``^``" msgstr "``^``" -#: ../../reference/expressions.rst:2023 +#: ../../reference/expressions.rst:2027 msgid "Bitwise XOR" msgstr "" -#: ../../reference/expressions.rst:2025 +#: ../../reference/expressions.rst:2029 msgid "``|``" msgstr "``|``" -#: ../../reference/expressions.rst:2025 +#: ../../reference/expressions.rst:2029 msgid "Bitwise OR" msgstr "" -#: ../../reference/expressions.rst:2027 +#: ../../reference/expressions.rst:2031 msgid "" ":keyword:`in`, :keyword:`not in`, :keyword:`is`, :keyword:`is not`, ``<``, " "``<=``, ``>``, ``>=``, ``!=``, ``==``" msgstr "" -#: ../../reference/expressions.rst:2027 +#: ../../reference/expressions.rst:2031 msgid "Comparisons, including membership tests and identity tests" msgstr "" -#: ../../reference/expressions.rst:2031 +#: ../../reference/expressions.rst:2035 msgid ":keyword:`not x <not>`" msgstr ":keyword:`not x <not>`" -#: ../../reference/expressions.rst:2031 +#: ../../reference/expressions.rst:2035 msgid "Boolean NOT" msgstr "" -#: ../../reference/expressions.rst:2033 +#: ../../reference/expressions.rst:2037 msgid ":keyword:`and`" msgstr ":keyword:`and`" -#: ../../reference/expressions.rst:2033 +#: ../../reference/expressions.rst:2037 msgid "Boolean AND" msgstr "" -#: ../../reference/expressions.rst:2035 +#: ../../reference/expressions.rst:2039 msgid ":keyword:`or`" msgstr ":keyword:`or`" -#: ../../reference/expressions.rst:2035 +#: ../../reference/expressions.rst:2039 msgid "Boolean OR" msgstr "" -#: ../../reference/expressions.rst:2037 +#: ../../reference/expressions.rst:2041 msgid ":keyword:`if <if_expr>` -- :keyword:`!else`" msgstr ":keyword:`if <if_expr>` -- :keyword:`!else`" -#: ../../reference/expressions.rst:2037 +#: ../../reference/expressions.rst:2041 msgid "Conditional expression" msgstr "" -#: ../../reference/expressions.rst:2039 +#: ../../reference/expressions.rst:2043 msgid ":keyword:`lambda`" msgstr ":keyword:`lambda`" -#: ../../reference/expressions.rst:2039 +#: ../../reference/expressions.rst:2043 msgid "Lambda expression" msgstr "" -#: ../../reference/expressions.rst:2041 +#: ../../reference/expressions.rst:2045 msgid "``:=``" msgstr "``:=``" -#: ../../reference/expressions.rst:2041 +#: ../../reference/expressions.rst:2045 msgid "Assignment expression" msgstr "" -#: ../../reference/expressions.rst:2046 +#: ../../reference/expressions.rst:2050 msgid "Footnotes" msgstr "註解" -#: ../../reference/expressions.rst:2047 +#: ../../reference/expressions.rst:2051 msgid "" "While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be " "true numerically due to roundoff. For example, and assuming a platform on " @@ -2387,7 +2387,7 @@ msgid "" "approach is more appropriate depends on the application." msgstr "" -#: ../../reference/expressions.rst:2056 +#: ../../reference/expressions.rst:2060 msgid "" "If x is very close to an exact integer multiple of y, it's possible for ``x//" "y`` to be one larger than ``(x-x%y)//y`` due to rounding. In such cases, " @@ -2395,7 +2395,7 @@ msgid "" "* y + x % y`` be very close to ``x``." msgstr "" -#: ../../reference/expressions.rst:2061 +#: ../../reference/expressions.rst:2065 msgid "" "The Unicode standard distinguishes between :dfn:`code points` (e.g. U+0041) " "and :dfn:`abstract characters` (e.g. \"LATIN CAPITAL LETTER A\"). While most " @@ -2409,7 +2409,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: ../../reference/expressions.rst:2072 +#: ../../reference/expressions.rst:2076 msgid "" "The comparison operators on strings compare at the level of Unicode code " "points. This may be counter-intuitive to humans. For example, ``\"\\u00C7\" " @@ -2417,13 +2417,13 @@ msgid "" "same abstract character \"LATIN CAPITAL LETTER C WITH CEDILLA\"." msgstr "" -#: ../../reference/expressions.rst:2077 +#: ../../reference/expressions.rst:2081 msgid "" "To compare strings at the level of abstract characters (that is, in a way " "intuitive to humans), use :func:`unicodedata.normalize`." msgstr "" -#: ../../reference/expressions.rst:2080 +#: ../../reference/expressions.rst:2084 msgid "" "Due to automatic garbage-collection, free lists, and the dynamic nature of " "descriptors, you may notice seemingly unusual behaviour in certain uses of " @@ -2431,22 +2431,22 @@ msgid "" "instance methods, or constants. Check their documentation for more info." msgstr "" -#: ../../reference/expressions.rst:2085 +#: ../../reference/expressions.rst:2089 msgid "" "The power operator ``**`` binds less tightly than an arithmetic or bitwise " "unary operator on its right, that is, ``2**-1`` is ``0.5``." msgstr "" -#: ../../reference/expressions.rst:2088 +#: ../../reference/expressions.rst:2092 msgid "" "The ``%`` operator is also used for string formatting; the same precedence " "applies." msgstr "" #: ../../reference/expressions.rst:8 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1766 -#: ../../reference/expressions.rst:1806 ../../reference/expressions.rst:1857 -#: ../../reference/expressions.rst:1883 ../../reference/expressions.rst:1911 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1770 +#: ../../reference/expressions.rst:1810 ../../reference/expressions.rst:1861 +#: ../../reference/expressions.rst:1887 ../../reference/expressions.rst:1915 msgid "expression" msgstr "" @@ -2454,8 +2454,8 @@ msgstr "" msgid "BNF" msgstr "BNF" -#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1258 -#: ../../reference/expressions.rst:1306 +#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1262 +#: ../../reference/expressions.rst:1310 msgid "arithmetic" msgstr "" @@ -2477,9 +2477,9 @@ msgstr "" #: ../../reference/expressions.rst:74 ../../reference/expressions.rst:569 #: ../../reference/expressions.rst:624 ../../reference/expressions.rst:753 -#: ../../reference/expressions.rst:805 ../../reference/expressions.rst:851 -#: ../../reference/expressions.rst:1295 ../../reference/expressions.rst:1344 -#: ../../reference/expressions.rst:1440 +#: ../../reference/expressions.rst:808 ../../reference/expressions.rst:855 +#: ../../reference/expressions.rst:1299 ../../reference/expressions.rst:1348 +#: ../../reference/expressions.rst:1444 msgid "exception" msgstr "" @@ -2519,11 +2519,11 @@ msgstr "type(型別)" #: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 #: ../../reference/expressions.rst:372 ../../reference/expressions.rst:393 #: ../../reference/expressions.rst:557 ../../reference/expressions.rst:743 -#: ../../reference/expressions.rst:851 ../../reference/expressions.rst:880 -#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1001 -#: ../../reference/expressions.rst:1149 ../../reference/expressions.rst:1163 -#: ../../reference/expressions.rst:1177 ../../reference/expressions.rst:1184 -#: ../../reference/expressions.rst:1731 ../../reference/expressions.rst:1923 +#: ../../reference/expressions.rst:855 ../../reference/expressions.rst:884 +#: ../../reference/expressions.rst:961 ../../reference/expressions.rst:1005 +#: ../../reference/expressions.rst:1153 ../../reference/expressions.rst:1167 +#: ../../reference/expressions.rst:1181 ../../reference/expressions.rst:1188 +#: ../../reference/expressions.rst:1735 ../../reference/expressions.rst:1927 msgid "object" msgstr "object(物件)" @@ -2532,7 +2532,7 @@ msgid "parenthesized form" msgstr "" #: ../../reference/expressions.rst:162 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1005 msgid "() (parentheses)" msgstr "() (圓括號)" @@ -2544,19 +2544,19 @@ msgstr "" msgid "empty" msgstr "" -#: ../../reference/expressions.rst:175 ../../reference/expressions.rst:880 -#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1923 +#: ../../reference/expressions.rst:175 ../../reference/expressions.rst:884 +#: ../../reference/expressions.rst:961 ../../reference/expressions.rst:1927 msgid "tuple" msgstr "" -#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1945 +#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1949 msgid "comma" msgstr "" #: ../../reference/expressions.rst:181 ../../reference/expressions.rst:275 #: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 -#: ../../reference/expressions.rst:951 ../../reference/expressions.rst:1001 -#: ../../reference/expressions.rst:1911 +#: ../../reference/expressions.rst:955 ../../reference/expressions.rst:1005 +#: ../../reference/expressions.rst:1915 msgid ", (comma)" msgstr ", (逗號)" @@ -2573,7 +2573,7 @@ msgstr "for" msgid "in comprehensions" msgstr "於 comprehensions(綜合運算)" -#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1861 msgid "if" msgstr "if" @@ -2581,13 +2581,13 @@ msgstr "if" msgid "async for" msgstr "async for" -#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1202 +#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1206 msgid "await" msgstr "await" -#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:851 -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:957 -#: ../../reference/expressions.rst:1911 +#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:855 +#: ../../reference/expressions.rst:884 ../../reference/expressions.rst:961 +#: ../../reference/expressions.rst:1915 msgid "list" msgstr "list(串列)" @@ -2596,7 +2596,7 @@ msgstr "list(串列)" msgid "display" msgstr "" -#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:876 +#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:880 msgid "[] (square brackets)" msgstr "[] (方括號)" @@ -2605,7 +2605,7 @@ msgid "list expression" msgstr "list expression(串列運算式)" #: ../../reference/expressions.rst:275 ../../reference/expressions.rst:301 -#: ../../reference/expressions.rst:1911 +#: ../../reference/expressions.rst:1915 msgid "expression list" msgstr "expression list(運算式串列)" @@ -2622,7 +2622,7 @@ msgid "set expression" msgstr "set expression(集合運算式)" #: ../../reference/expressions.rst:329 ../../reference/expressions.rst:355 -#: ../../reference/expressions.rst:880 +#: ../../reference/expressions.rst:884 msgid "dictionary" msgstr "dictionary(字典)" @@ -2642,8 +2642,8 @@ msgstr "key/value pair(鍵/值對)" msgid "dictionary expression" msgstr "dictionary expression(字典運算式)" -#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:951 -#: ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:955 +#: ../../reference/expressions.rst:1887 msgid ": (colon)" msgstr ": (冒號)" @@ -2655,13 +2655,13 @@ msgstr "於字典運算式" msgid "in dictionary displays" msgstr "於字典顯示" -#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1084 -#: ../../reference/expressions.rst:1930 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1088 +#: ../../reference/expressions.rst:1934 msgid "unpacking" msgstr "unpacking(解包)" -#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1114 -#: ../../reference/expressions.rst:1222 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1118 +#: ../../reference/expressions.rst:1226 msgid "**" msgstr "**" @@ -2678,7 +2678,7 @@ msgstr "generator(產生器)" msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1202 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1206 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2690,8 +2690,8 @@ msgstr "yield" msgid "from" msgstr "from" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1149 -#: ../../reference/expressions.rst:1163 ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1153 +#: ../../reference/expressions.rst:1167 ../../reference/expressions.rst:1887 msgid "function" msgstr "function (函式)" @@ -2707,7 +2707,7 @@ msgstr "yield from expression(yield from 運算式)" msgid "StopIteration" msgstr "StopIteration" -#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:805 +#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:808 msgid "GeneratorExit" msgstr "GeneratorExit" @@ -2723,488 +2723,488 @@ msgstr "asynchronous-generator(非同步產生器)" msgid "StopAsyncIteration" msgstr "StopAsyncIteration" -#: ../../reference/expressions.rst:828 +#: ../../reference/expressions.rst:832 msgid "primary" msgstr "primary(主要)" -#: ../../reference/expressions.rst:842 +#: ../../reference/expressions.rst:846 msgid "attribute" msgstr "attribute(屬性)" -#: ../../reference/expressions.rst:842 +#: ../../reference/expressions.rst:846 msgid "reference" msgstr "reference(參照)" -#: ../../reference/expressions.rst:842 +#: ../../reference/expressions.rst:846 msgid ". (dot)" msgstr ". (點)" -#: ../../reference/expressions.rst:842 +#: ../../reference/expressions.rst:846 msgid "attribute reference" msgstr "attribute reference(屬性參照)" -#: ../../reference/expressions.rst:851 +#: ../../reference/expressions.rst:855 msgid "AttributeError" msgstr "AttributeError" -#: ../../reference/expressions.rst:851 +#: ../../reference/expressions.rst:855 msgid "module" msgstr "module(模組)" -#: ../../reference/expressions.rst:876 +#: ../../reference/expressions.rst:880 msgid "subscription" msgstr "subscription(下標)" -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:957 -#: ../../reference/expressions.rst:1731 +#: ../../reference/expressions.rst:884 ../../reference/expressions.rst:961 +#: ../../reference/expressions.rst:1735 msgid "sequence" msgstr "sequence(序列)" -#: ../../reference/expressions.rst:880 +#: ../../reference/expressions.rst:884 msgid "mapping" msgstr "mapping(對映)" -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:937 -#: ../../reference/expressions.rst:957 +#: ../../reference/expressions.rst:884 ../../reference/expressions.rst:941 +#: ../../reference/expressions.rst:961 msgid "string" msgstr "string(字串)" -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:937 +#: ../../reference/expressions.rst:884 ../../reference/expressions.rst:941 msgid "item" msgstr "item(項目)" -#: ../../reference/expressions.rst:937 +#: ../../reference/expressions.rst:941 msgid "character" msgstr "character(字元)" -#: ../../reference/expressions.rst:951 +#: ../../reference/expressions.rst:955 msgid "slicing" msgstr "slicing(切片)" -#: ../../reference/expressions.rst:951 +#: ../../reference/expressions.rst:955 msgid "slice" msgstr "slice(切片)" -#: ../../reference/expressions.rst:983 +#: ../../reference/expressions.rst:987 msgid "start (slice object attribute)" msgstr "start(切片物件屬性)" -#: ../../reference/expressions.rst:983 +#: ../../reference/expressions.rst:987 msgid "stop (slice object attribute)" msgstr "stop(切片物件屬性)" -#: ../../reference/expressions.rst:983 +#: ../../reference/expressions.rst:987 msgid "step (slice object attribute)" msgstr "step(切片物件屬性)" -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1005 msgid "callable" msgstr "callable(可呼叫物件)" -#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1149 -#: ../../reference/expressions.rst:1163 ../../reference/expressions.rst:1177 -#: ../../reference/expressions.rst:1184 ../../reference/expressions.rst:1194 +#: ../../reference/expressions.rst:1005 ../../reference/expressions.rst:1153 +#: ../../reference/expressions.rst:1167 ../../reference/expressions.rst:1181 +#: ../../reference/expressions.rst:1188 ../../reference/expressions.rst:1198 msgid "call" msgstr "call(呼叫)" -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1005 msgid "argument" msgstr "argument(引數)" -#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1034 +#: ../../reference/expressions.rst:1005 ../../reference/expressions.rst:1038 msgid "call semantics" msgstr "call semantics(呼叫語意)" -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1005 msgid "argument list" msgstr "argument list(引數列表)" -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1005 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1084 -#: ../../reference/expressions.rst:1114 +#: ../../reference/expressions.rst:1005 ../../reference/expressions.rst:1088 +#: ../../reference/expressions.rst:1118 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../reference/expressions.rst:1034 +#: ../../reference/expressions.rst:1038 msgid "parameter" msgstr "parameter(參數)" -#: ../../reference/expressions.rst:1084 ../../reference/expressions.rst:1319 -#: ../../reference/expressions.rst:1930 +#: ../../reference/expressions.rst:1088 ../../reference/expressions.rst:1323 +#: ../../reference/expressions.rst:1934 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/expressions.rst:1149 +#: ../../reference/expressions.rst:1153 msgid "user-defined" msgstr "user-defined(使用者定義)" -#: ../../reference/expressions.rst:1149 +#: ../../reference/expressions.rst:1153 msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/expressions.rst:1163 +#: ../../reference/expressions.rst:1167 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../reference/expressions.rst:1163 +#: ../../reference/expressions.rst:1167 msgid "method" msgstr "method(方法)" -#: ../../reference/expressions.rst:1163 +#: ../../reference/expressions.rst:1167 msgid "built-in method" msgstr "built-in method(內建方法)" -#: ../../reference/expressions.rst:1177 +#: ../../reference/expressions.rst:1181 msgid "class" msgstr "class(類別)" -#: ../../reference/expressions.rst:1177 +#: ../../reference/expressions.rst:1181 msgid "class object" msgstr "class object(類別物件)" -#: ../../reference/expressions.rst:1184 +#: ../../reference/expressions.rst:1188 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/expressions.rst:1184 ../../reference/expressions.rst:1194 +#: ../../reference/expressions.rst:1188 ../../reference/expressions.rst:1198 msgid "instance" msgstr "instance(實例)" -#: ../../reference/expressions.rst:1194 +#: ../../reference/expressions.rst:1198 msgid "__call__() (object method)" msgstr "__call__() (物件方法)" -#: ../../reference/expressions.rst:1222 +#: ../../reference/expressions.rst:1226 msgid "power" msgstr "power(次方)" -#: ../../reference/expressions.rst:1222 ../../reference/expressions.rst:1258 -#: ../../reference/expressions.rst:1306 ../../reference/expressions.rst:1422 -#: ../../reference/expressions.rst:1451 ../../reference/expressions.rst:1766 +#: ../../reference/expressions.rst:1226 ../../reference/expressions.rst:1262 +#: ../../reference/expressions.rst:1310 ../../reference/expressions.rst:1426 +#: ../../reference/expressions.rst:1455 ../../reference/expressions.rst:1770 msgid "operation" msgstr "operation(操作)" -#: ../../reference/expressions.rst:1222 ../../reference/expressions.rst:1267 -#: ../../reference/expressions.rst:1276 ../../reference/expressions.rst:1284 -#: ../../reference/expressions.rst:1319 ../../reference/expressions.rst:1332 -#: ../../reference/expressions.rst:1344 ../../reference/expressions.rst:1362 -#: ../../reference/expressions.rst:1392 ../../reference/expressions.rst:1405 -#: ../../reference/expressions.rst:1422 ../../reference/expressions.rst:1460 -#: ../../reference/expressions.rst:1468 ../../reference/expressions.rst:1477 -#: ../../reference/expressions.rst:1492 ../../reference/expressions.rst:1731 -#: ../../reference/expressions.rst:1740 ../../reference/expressions.rst:1782 -#: ../../reference/expressions.rst:1787 ../../reference/expressions.rst:1792 -#: ../../reference/expressions.rst:1857 ../../reference/expressions.rst:1981 +#: ../../reference/expressions.rst:1226 ../../reference/expressions.rst:1271 +#: ../../reference/expressions.rst:1280 ../../reference/expressions.rst:1288 +#: ../../reference/expressions.rst:1323 ../../reference/expressions.rst:1336 +#: ../../reference/expressions.rst:1348 ../../reference/expressions.rst:1366 +#: ../../reference/expressions.rst:1396 ../../reference/expressions.rst:1409 +#: ../../reference/expressions.rst:1426 ../../reference/expressions.rst:1464 +#: ../../reference/expressions.rst:1472 ../../reference/expressions.rst:1481 +#: ../../reference/expressions.rst:1496 ../../reference/expressions.rst:1735 +#: ../../reference/expressions.rst:1744 ../../reference/expressions.rst:1786 +#: ../../reference/expressions.rst:1791 ../../reference/expressions.rst:1796 +#: ../../reference/expressions.rst:1861 ../../reference/expressions.rst:1985 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/expressions.rst:1258 +#: ../../reference/expressions.rst:1262 msgid "unary" msgstr "unary(一元)" -#: ../../reference/expressions.rst:1258 ../../reference/expressions.rst:1451 -#: ../../reference/expressions.rst:1460 ../../reference/expressions.rst:1468 -#: ../../reference/expressions.rst:1477 +#: ../../reference/expressions.rst:1262 ../../reference/expressions.rst:1455 +#: ../../reference/expressions.rst:1464 ../../reference/expressions.rst:1472 +#: ../../reference/expressions.rst:1481 msgid "bitwise" msgstr "bitwise(位元)" -#: ../../reference/expressions.rst:1267 +#: ../../reference/expressions.rst:1271 msgid "negation" msgstr "negation(否定)" -#: ../../reference/expressions.rst:1267 +#: ../../reference/expressions.rst:1271 msgid "minus" msgstr "minus(減)" -#: ../../reference/expressions.rst:1267 ../../reference/expressions.rst:1405 +#: ../../reference/expressions.rst:1271 ../../reference/expressions.rst:1409 msgid "- (minus)" msgstr "- (減號)" -#: ../../reference/expressions.rst:1267 ../../reference/expressions.rst:1276 +#: ../../reference/expressions.rst:1271 ../../reference/expressions.rst:1280 msgid "unary operator" msgstr "unary operator(一元運算子)" -#: ../../reference/expressions.rst:1276 +#: ../../reference/expressions.rst:1280 msgid "plus" msgstr "plus(加)" -#: ../../reference/expressions.rst:1276 ../../reference/expressions.rst:1392 +#: ../../reference/expressions.rst:1280 ../../reference/expressions.rst:1396 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../reference/expressions.rst:1284 +#: ../../reference/expressions.rst:1288 msgid "inversion" msgstr "inversion(反轉)" -#: ../../reference/expressions.rst:1284 +#: ../../reference/expressions.rst:1288 msgid "~ (tilde)" msgstr "~ (波浪號)" -#: ../../reference/expressions.rst:1295 +#: ../../reference/expressions.rst:1299 msgid "TypeError" msgstr "TypeError" -#: ../../reference/expressions.rst:1306 ../../reference/expressions.rst:1451 +#: ../../reference/expressions.rst:1310 ../../reference/expressions.rst:1455 msgid "binary" msgstr "binary(二進位)" -#: ../../reference/expressions.rst:1319 +#: ../../reference/expressions.rst:1323 msgid "multiplication" msgstr "multiplication(乘)" -#: ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1336 msgid "matrix multiplication" msgstr "matrix multiplication(矩陣乘法)" -#: ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1336 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/expressions.rst:1344 +#: ../../reference/expressions.rst:1348 msgid "ZeroDivisionError" msgstr "ZeroDivisionError" -#: ../../reference/expressions.rst:1344 +#: ../../reference/expressions.rst:1348 msgid "division" msgstr "division(除)" -#: ../../reference/expressions.rst:1344 +#: ../../reference/expressions.rst:1348 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/expressions.rst:1344 +#: ../../reference/expressions.rst:1348 msgid "//" msgstr "//" -#: ../../reference/expressions.rst:1362 +#: ../../reference/expressions.rst:1366 msgid "modulo" msgstr "modulo(餘數)" -#: ../../reference/expressions.rst:1362 +#: ../../reference/expressions.rst:1366 msgid "% (percent)" msgstr "% (百分號)" -#: ../../reference/expressions.rst:1392 +#: ../../reference/expressions.rst:1396 msgid "addition" msgstr "addition(加)" -#: ../../reference/expressions.rst:1392 ../../reference/expressions.rst:1405 +#: ../../reference/expressions.rst:1396 ../../reference/expressions.rst:1409 msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../reference/expressions.rst:1405 +#: ../../reference/expressions.rst:1409 msgid "subtraction" msgstr "subtraction(減)" -#: ../../reference/expressions.rst:1422 +#: ../../reference/expressions.rst:1426 msgid "shifting" msgstr "shifting(移動)" -#: ../../reference/expressions.rst:1422 +#: ../../reference/expressions.rst:1426 msgid "<<" msgstr "<<" -#: ../../reference/expressions.rst:1422 +#: ../../reference/expressions.rst:1426 msgid ">>" msgstr ">>" -#: ../../reference/expressions.rst:1440 +#: ../../reference/expressions.rst:1444 msgid "ValueError" msgstr "ValueError" -#: ../../reference/expressions.rst:1460 ../../reference/expressions.rst:1787 +#: ../../reference/expressions.rst:1464 ../../reference/expressions.rst:1791 msgid "and" msgstr "and" -#: ../../reference/expressions.rst:1460 +#: ../../reference/expressions.rst:1464 msgid "& (ampersand)" msgstr "& (和號)" -#: ../../reference/expressions.rst:1468 +#: ../../reference/expressions.rst:1472 msgid "xor" msgstr "xor" -#: ../../reference/expressions.rst:1468 +#: ../../reference/expressions.rst:1472 msgid "exclusive" msgstr "exclusive(排外)" -#: ../../reference/expressions.rst:1468 ../../reference/expressions.rst:1477 -#: ../../reference/expressions.rst:1792 +#: ../../reference/expressions.rst:1472 ../../reference/expressions.rst:1481 +#: ../../reference/expressions.rst:1796 msgid "or" msgstr "or" -#: ../../reference/expressions.rst:1468 +#: ../../reference/expressions.rst:1472 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../reference/expressions.rst:1477 +#: ../../reference/expressions.rst:1481 msgid "inclusive" msgstr "inclusive(包含)" -#: ../../reference/expressions.rst:1477 +#: ../../reference/expressions.rst:1481 msgid "| (vertical bar)" msgstr "| (垂直線)" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "comparison" msgstr "comparison(比較)" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "C" msgstr "C" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "language" msgstr "language(語言)" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "< (less)" msgstr "< (小於)" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "> (greater)" msgstr "> (大於)" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "<=" msgstr "<=" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid ">=" msgstr ">=" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "==" msgstr "==" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "!=" msgstr "!=" -#: ../../reference/expressions.rst:1516 +#: ../../reference/expressions.rst:1520 msgid "chaining" msgstr "chaining(鏈接)" -#: ../../reference/expressions.rst:1516 +#: ../../reference/expressions.rst:1520 msgid "comparisons" msgstr "comparisons(比較)" -#: ../../reference/expressions.rst:1731 +#: ../../reference/expressions.rst:1735 msgid "in" msgstr "in" -#: ../../reference/expressions.rst:1731 +#: ../../reference/expressions.rst:1735 msgid "not in" msgstr "not in" -#: ../../reference/expressions.rst:1731 +#: ../../reference/expressions.rst:1735 msgid "membership" msgstr "membership(成員)" -#: ../../reference/expressions.rst:1731 ../../reference/expressions.rst:1740 +#: ../../reference/expressions.rst:1735 ../../reference/expressions.rst:1744 msgid "test" msgstr "test(測試)" -#: ../../reference/expressions.rst:1740 +#: ../../reference/expressions.rst:1744 msgid "is" msgstr "is" -#: ../../reference/expressions.rst:1740 +#: ../../reference/expressions.rst:1744 msgid "is not" msgstr "is not" -#: ../../reference/expressions.rst:1740 +#: ../../reference/expressions.rst:1744 msgid "identity" msgstr "identity" -#: ../../reference/expressions.rst:1766 +#: ../../reference/expressions.rst:1770 msgid "Conditional" msgstr "Conditional(條件式)" -#: ../../reference/expressions.rst:1766 +#: ../../reference/expressions.rst:1770 msgid "Boolean" msgstr "Boolean(布林)" -#: ../../reference/expressions.rst:1782 +#: ../../reference/expressions.rst:1786 msgid "not" msgstr "not" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1810 msgid ":= (colon equals)" msgstr ":= (冒號等於)" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1810 msgid "assignment expression" msgstr "assignment expression(賦值運算式)" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1810 msgid "walrus operator" msgstr "walrus operator(海象運算子)" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1810 msgid "named expression" msgstr "named expression(附名運算式)" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1810 msgid "assignment" msgstr "assignment(賦值)" -#: ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:1861 msgid "conditional" msgstr "conditional(條件式)" -#: ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:1861 msgid "ternary" msgstr "ternary(三元)" -#: ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:1861 msgid "conditional expression" msgstr "conditional expression(條件運算式)" -#: ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:1861 msgid "else" msgstr "else" -#: ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:1887 msgid "lambda" msgstr "lambda" -#: ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:1887 msgid "form" msgstr "form" -#: ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:1887 msgid "anonymous" msgstr "anonymous(匿名)" -#: ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:1887 msgid "lambda expression" msgstr "lambda expression(lambda 運算式)" -#: ../../reference/expressions.rst:1930 +#: ../../reference/expressions.rst:1934 msgid "iterable" msgstr "iterable(可疊代)" -#: ../../reference/expressions.rst:1930 +#: ../../reference/expressions.rst:1934 msgid "in expression lists" msgstr "於 expression list(運算式串列)" -#: ../../reference/expressions.rst:1945 +#: ../../reference/expressions.rst:1949 msgid "trailing" msgstr "trailing" -#: ../../reference/expressions.rst:1960 +#: ../../reference/expressions.rst:1964 msgid "evaluation" msgstr "evaluation" -#: ../../reference/expressions.rst:1960 +#: ../../reference/expressions.rst:1964 msgid "order" msgstr "order(順序)" -#: ../../reference/expressions.rst:1981 +#: ../../reference/expressions.rst:1985 msgid "precedence" msgstr "precedence(優先順序)" diff --git a/reference/grammar.po b/reference/grammar.po index 14222d9038..24d3eb9b2c 100644 --- a/reference/grammar.po +++ b/reference/grammar.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-11 00:14+0000\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -285,8 +285,8 @@ msgid "" "import_from[stmt_ty]:\n" " | 'from' a=('.' | '...')* b=dotted_name 'import' c=import_from_targets " "{\n" -" _PyAST_ImportFrom(b->v.Name.id, c, _PyPegen_seq_count_dots(a), " -"EXTRA) }\n" +" _PyPegen_checked_future_import(p, b->v.Name.id, c, " +"_PyPegen_seq_count_dots(a), EXTRA) }\n" " | 'from' a=('.' | '...')+ 'import' b=import_from_targets {\n" " _PyAST_ImportFrom(NULL, b, _PyPegen_seq_count_dots(a), EXTRA) }\n" "import_from_targets[asdl_alias_seq*]:\n" @@ -401,10 +401,10 @@ msgid "" " | a[asdl_arg_seq*]=param_no_default+ '/' ',' { a }\n" " | a[asdl_arg_seq*]=param_no_default+ '/' &')' { a }\n" "slash_with_default[SlashWithDefault*]:\n" -" | a=param_no_default* b=param_with_default+ '/' ',' " -"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" -" | a=param_no_default* b=param_with_default+ '/' &')' " -"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=param_no_default* b=param_with_default+ '/' " +"',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=param_no_default* b=param_with_default+ '/' " +"&')' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" "\n" "star_etc[StarEtc*]:\n" " | invalid_star_etc\n" @@ -442,18 +442,18 @@ msgid "" "param_no_default_star_annotation[arg_ty]:\n" " | a=param_star_annotation ',' tc=TYPE_COMMENT? " "{ _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" -" | a=param_star_annotation tc=TYPE_COMMENT? &')' " -"{ _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" +" | a=param_star_annotation tc=TYPE_COMMENT? " +"&')' { _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" "param_with_default[NameDefaultPair*]:\n" " | a=param c=default ',' tc=TYPE_COMMENT? { _PyPegen_name_default_pair(p, " "a, c, tc) }\n" -" | a=param c=default tc=TYPE_COMMENT? &')' " -"{ _PyPegen_name_default_pair(p, a, c, tc) }\n" +" | a=param c=default tc=TYPE_COMMENT? " +"&')' { _PyPegen_name_default_pair(p, a, c, tc) }\n" "param_maybe_default[NameDefaultPair*]:\n" " | a=param c=default? ',' tc=TYPE_COMMENT? " "{ _PyPegen_name_default_pair(p, a, c, tc) }\n" -" | a=param c=default? tc=TYPE_COMMENT? &')' " -"{ _PyPegen_name_default_pair(p, a, c, tc) }\n" +" | a=param c=default? tc=TYPE_COMMENT? " +"&')' { _PyPegen_name_default_pair(p, a, c, tc) }\n" "param[arg_ty]: a=NAME b=annotation? { _PyAST_arg(a->v.Name.id, b, NULL, " "EXTRA) }\n" "param_star_annotation[arg_ty]: a=NAME b=star_annotation { _PyAST_arg(a->v." @@ -683,10 +683,10 @@ msgid "" " | '(' pattern=pattern ')' { pattern }\n" "\n" "sequence_pattern[pattern_ty]:\n" -" | '[' patterns=maybe_sequence_pattern? ']' " -"{ _PyAST_MatchSequence(patterns, EXTRA) }\n" -" | '(' patterns=open_sequence_pattern? ')' " -"{ _PyAST_MatchSequence(patterns, EXTRA) }\n" +" | '[' patterns=maybe_sequence_pattern? " +"']' { _PyAST_MatchSequence(patterns, EXTRA) }\n" +" | '(' patterns=open_sequence_pattern? " +"')' { _PyAST_MatchSequence(patterns, EXTRA) }\n" "\n" "open_sequence_pattern[asdl_seq*]:\n" " | pattern=maybe_star_pattern ',' patterns=maybe_sequence_pattern? {\n" @@ -1067,10 +1067,10 @@ msgid "" " | a[asdl_arg_seq*]=lambda_param_no_default+ '/' &':' { a }\n" "\n" "lambda_slash_with_default[SlashWithDefault*]:\n" -" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' ',' " -"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" -" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' &':' " -"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' " +"',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' " +"&':' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" "\n" "lambda_star_etc[StarEtc*]:\n" " | invalid_lambda_star_etc\n" @@ -1190,8 +1190,8 @@ msgid "" " | invalid_comprehension\n" "\n" "genexp[expr_ty]:\n" -" | '(' a=( assignment_expression | expression !':=') b=for_if_clauses ')' " -"{ _PyAST_GeneratorExp(a, b, EXTRA) }\n" +" | '(' a=( assignment_expression | expression !':=') b=for_if_clauses " +"')' { _PyAST_GeneratorExp(a, b, EXTRA) }\n" " | invalid_comprehension\n" "\n" "dictcomp[expr_ty]:\n" @@ -1465,9 +1465,9 @@ msgid "" "annotation\") }\n" " | (star_targets '=')* a=star_expressions '=' {\n" " RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }\n" -" | (star_targets '=')* a=yield_expr '=' " -"{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"assignment to yield expression not " -"possible\") }\n" +" | (star_targets '=')* a=yield_expr " +"'=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"assignment to yield expression " +"not possible\") }\n" " | a=star_expressions augassign annotated_rhs {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" " a,\n" @@ -1528,8 +1528,8 @@ msgid "" "comment\") }\n" " | '*' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" "positional argument cannot have default value\") }\n" -" | '*' (param_no_default | ',') param_maybe_default* a='*' " -"(param_no_default | ',') {\n" +" | '*' (param_no_default | ',') param_maybe_default* " +"a='*' (param_no_default | ',') {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"* argument may appear only " "once\") }\n" "invalid_kwds:\n" @@ -1572,8 +1572,8 @@ msgid "" "must follow bare *\") }\n" " | '*' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" "positional argument cannot have default value\") }\n" -" | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* a='*' " -"(lambda_param_no_default | ',') {\n" +" | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* " +"a='*' (lambda_param_no_default | ',') {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"* argument may appear only " "once\") }\n" "invalid_lambda_kwds:\n" diff --git a/reference/import.po b/reference/import.po index 54ab4c6fff..770f23b280 100644 --- a/reference/import.po +++ b/reference/import.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-15 16:37+0000\n" "PO-Revision-Date: 2024-11-06 14:55+0800\n" "Last-Translator: Ken Cheng <ken71301@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -232,11 +232,11 @@ msgstr "" "__init__.py``。隨後引入 ``parent.two`` 或 ``parent.three`` 將分別執行 " "``parent/two/__init__.py`` 和 ``parent/three/__init__.py``。" -#: ../../reference/import.rst:127 +#: ../../reference/import.rst:129 msgid "Namespace packages" msgstr "命名空間套件" -#: ../../reference/import.rst:133 +#: ../../reference/import.rst:135 msgid "" "A namespace package is a composite of various :term:`portions <portion>`, " "where each portion contributes a subpackage to the parent package. Portions " @@ -251,7 +251,7 @@ msgstr "" "中、網路上,或 Python 在引入時搜尋的任何其他地方。命名空間套件不一定直接對應" "於檔案系統中的對象;它們可能是沒有具體表示的虛擬模組。" -#: ../../reference/import.rst:141 +#: ../../reference/import.rst:143 msgid "" "Namespace packages do not use an ordinary list for their ``__path__`` " "attribute. They instead use a custom iterable type which will automatically " @@ -263,7 +263,7 @@ msgstr "" "別,當父套件的路徑(或頂層套件的 :data:`sys.path`)發生變化時,會在下一次引入" "嘗試時自動執行新一輪的套件部分搜尋。" -#: ../../reference/import.rst:147 +#: ../../reference/import.rst:149 msgid "" "With namespace packages, there is no ``parent/__init__.py`` file. In fact, " "there may be multiple ``parent`` directories found during import search, " @@ -278,15 +278,15 @@ msgstr "" "``parent`` 套件或其子套件之一時,Python 會為頂層 ``parent`` 套件建立一個命名" "空間套件。" -#: ../../reference/import.rst:154 +#: ../../reference/import.rst:156 msgid "See also :pep:`420` for the namespace package specification." msgstr "有關命名空間套件的規範,請參見 :pep:`420`。" -#: ../../reference/import.rst:158 +#: ../../reference/import.rst:160 msgid "Searching" msgstr "搜尋" -#: ../../reference/import.rst:160 +#: ../../reference/import.rst:162 msgid "" "To begin the search, Python needs the :term:`fully qualified <qualified " "name>` name of the module (or package, but for the purposes of this " @@ -300,7 +300,7 @@ msgstr "" "自 :keyword:`import` 陳述式的各種引數,或來自 :func:`importlib." "import_module` 或 :func:`__import__` 函式的參數。" -#: ../../reference/import.rst:166 +#: ../../reference/import.rst:168 msgid "" "This name will be used in various phases of the import search, and it may be " "the dotted path to a submodule, e.g. ``foo.bar.baz``. In this case, Python " @@ -313,11 +313,11 @@ msgstr "" "bar``,最後是 ``foo.bar.baz``。如果任何中間引入失敗,則會引發 :exc:" "`ModuleNotFoundError`。" -#: ../../reference/import.rst:173 +#: ../../reference/import.rst:175 msgid "The module cache" msgstr "模組快取" -#: ../../reference/import.rst:178 +#: ../../reference/import.rst:180 msgid "" "The first place checked during import search is :data:`sys.modules`. This " "mapping serves as a cache of all modules that have been previously imported, " @@ -331,7 +331,7 @@ msgstr "" "`sys.modules` 將包含 ``foo``、``foo.bar`` 和 ``foo.bar.baz`` 的條目。每個鍵的" "值都是相應的模組物件。" -#: ../../reference/import.rst:185 +#: ../../reference/import.rst:187 msgid "" "During import, the module name is looked up in :data:`sys.modules` and if " "present, the associated value is the module satisfying the import, and the " @@ -343,7 +343,7 @@ msgstr "" "滿足此引入的模組,此引入過程即完成。然而,如果值是 ``None``,則會引發 :exc:" "`ModuleNotFoundError`。如果模組名稱不存在,Python 會繼續搜尋該模組。" -#: ../../reference/import.rst:191 +#: ../../reference/import.rst:193 msgid "" ":data:`sys.modules` is writable. Deleting a key may not destroy the " "associated module (as other modules may hold references to it), but it will " @@ -357,7 +357,7 @@ msgstr "" "次引入該模組時重新搜尋。也可以將鍵賦值為 ``None``,這會強制下一次引入該模組時" "引發 :exc:`ModuleNotFoundError`。" -#: ../../reference/import.rst:198 +#: ../../reference/import.rst:200 msgid "" "Beware though, as if you keep a reference to the module object, invalidate " "its cache entry in :data:`sys.modules`, and then re-import the named module, " @@ -370,11 +370,11 @@ msgstr "" "func:`importlib.reload` 會重用\\ *相同的*\\ 模組物件,並透過重新執行模組的程" "式碼來簡單地重新初始化模組內容。" -#: ../../reference/import.rst:208 +#: ../../reference/import.rst:210 msgid "Finders and loaders" msgstr "尋檢器 (Finder) 與載入器 (Loader)" -#: ../../reference/import.rst:215 +#: ../../reference/import.rst:217 msgid "" "If the named module is not found in :data:`sys.modules`, then Python's " "import protocol is invoked to find and load the module. This protocol " @@ -391,7 +391,7 @@ msgstr "" "組。實作這兩個介面的物件稱為\\ :term:`引入器 (importer) <importer>` ——當它們" "發現可以載入所請求的模組時,會回傳它們自己。" -#: ../../reference/import.rst:223 +#: ../../reference/import.rst:225 msgid "" "Python includes a number of default finders and importers. The first one " "knows how to locate built-in modules, and the second knows how to locate " @@ -405,14 +405,14 @@ msgstr "" "組。:term:`import path` 是一個位置的列表,這些位置可能是檔案系統路徑或壓縮檔" "案,也可以擴展以搜尋任何可定位的資源,例如由 URL 識別的資源。" -#: ../../reference/import.rst:230 +#: ../../reference/import.rst:232 msgid "" "The import machinery is extensible, so new finders can be added to extend " "the range and scope of module searching." msgstr "" "引入機制是可擴展的,因此可以增加新的尋檢器來擴展模組搜尋的範圍和作用域。" -#: ../../reference/import.rst:233 +#: ../../reference/import.rst:235 msgid "" "Finders do not actually load modules. If they can find the named module, " "they return a :dfn:`module spec`, an encapsulation of the module's import-" @@ -423,7 +423,7 @@ msgstr "" "組規格`,這是一個模組的引入相關資訊的封裝,引入機制會在載入模組時使用這些資" "訊。" -#: ../../reference/import.rst:237 +#: ../../reference/import.rst:239 msgid "" "The following sections describe the protocol for finders and loaders in more " "detail, including how you can create and register new ones to extend the " @@ -432,7 +432,7 @@ msgstr "" "以下各節將更詳細地描述尋檢器和載入器的協定,包括如何建立和註冊新的尋檢器和載" "入器來擴展引入機制。" -#: ../../reference/import.rst:241 +#: ../../reference/import.rst:243 msgid "" "In previous versions of Python, finders returned :term:`loaders <loader>` " "directly, whereas now they return module specs which *contain* loaders. " @@ -442,11 +442,11 @@ msgstr "" "回傳的是\\ *包含*\\ 載入器的模組規格。載入器仍在引入過程中使用,但其責任減少" "了。" -#: ../../reference/import.rst:247 +#: ../../reference/import.rst:249 msgid "Import hooks" msgstr "引入掛鉤 (Import hooks)" -#: ../../reference/import.rst:257 +#: ../../reference/import.rst:259 msgid "" "The import machinery is designed to be extensible; the primary mechanism for " "this are the *import hooks*. There are two types of import hooks: *meta " @@ -455,7 +455,7 @@ msgstr "" "引入機制的設計是可擴展的;其主要機制是\\ *引入掛鉤*。引入掛鉤有兩種類型:*元" "掛鉤 (meta hooks)* 和\\ *引入路徑掛鉤*。" -#: ../../reference/import.rst:261 +#: ../../reference/import.rst:263 msgid "" "Meta hooks are called at the start of import processing, before any other " "import processing has occurred, other than :data:`sys.modules` cache look " @@ -468,7 +468,7 @@ msgstr "" "組,甚至是內建模組。元掛鉤透過將新的尋檢器物件添加到 :data:`sys.meta_path` 中" "來註冊,具體描述請參閱以下段落。" -#: ../../reference/import.rst:267 +#: ../../reference/import.rst:269 msgid "" "Import path hooks are called as part of :data:`sys.path` (or ``package." "__path__``) processing, at the point where their associated path item is " @@ -479,11 +479,11 @@ msgstr "" "部分來呼叫,當遇到與其相關聯的路徑項目時就會被觸發。引入路徑掛鉤透過將新的可" "呼叫對象增加到 :data:`sys.path_hooks` 中來註冊,具體描述請參閱以下段落。" -#: ../../reference/import.rst:274 +#: ../../reference/import.rst:276 msgid "The meta path" msgstr "元路徑" -#: ../../reference/import.rst:280 +#: ../../reference/import.rst:282 msgid "" "When the named module is not found in :data:`sys.modules`, Python next " "searches :data:`sys.meta_path`, which contains a list of meta path finder " @@ -500,7 +500,7 @@ msgstr "" "MetaPathFinder.find_spec` 的方法,該方法接收三個引數:名稱、引入路徑和(可選" "的)目標模組。元路徑尋檢器可以使用任何策略來確定它是否能處理命名模組。" -#: ../../reference/import.rst:289 +#: ../../reference/import.rst:291 msgid "" "If the meta path finder knows how to handle the named module, it returns a " "spec object. If it cannot handle the named module, it returns ``None``. " @@ -513,7 +513,7 @@ msgstr "" "回傳規格,則會引發 :exc:`ModuleNotFoundError`。任何其他引發的例外將直接向上傳" "播,並中止引入過程。" -#: ../../reference/import.rst:295 +#: ../../reference/import.rst:297 msgid "" "The :meth:`~importlib.abc.MetaPathFinder.find_spec` method of meta path " "finders is called with two or three arguments. The first is the fully " @@ -533,7 +533,7 @@ msgstr "" "``__path__`` 屬性,將引發 :exc:`ModuleNotFoundError`。第三個引數是一個現有的" "模組物件,該物件將成為後續載入的目標。引入系統只會在重新載入時傳入目標模組。" -#: ../../reference/import.rst:306 +#: ../../reference/import.rst:308 msgid "" "The meta path may be traversed multiple times for a single import request. " "For example, assuming none of the modules involved has already been cached, " @@ -551,7 +551,7 @@ msgstr "" "None)``。當 ``foo.bar`` 被引入後,最後一次遍歷會呼叫 ``mpf.find_spec(\"foo." "bar.baz\", foo.bar.__path__, None)``。" -#: ../../reference/import.rst:316 +#: ../../reference/import.rst:318 msgid "" "Some meta path finders only support top level imports. These importers will " "always return ``None`` when anything other than ``None`` is passed as the " @@ -560,7 +560,7 @@ msgstr "" "一些元路徑尋檢器僅支援頂層引入。當第二個引數傳入 ``None`` 以外的值時,這些引" "入器將始終回傳 ``None``。" -#: ../../reference/import.rst:320 +#: ../../reference/import.rst:322 msgid "" "Python's default :data:`sys.meta_path` has three meta path finders, one that " "knows how to import built-in modules, one that knows how to import frozen " @@ -571,7 +571,7 @@ msgstr "" "模組,一個知道如何引入凍結模組,還有一個知道如何從 :term:`import path` 引入模" "組(即 :term:`path based finder`)。" -#: ../../reference/import.rst:325 +#: ../../reference/import.rst:327 msgid "" "The :meth:`~importlib.abc.MetaPathFinder.find_spec` method of meta path " "finders replaced :meth:`!find_module`, which is now deprecated. While it " @@ -583,13 +583,13 @@ msgstr "" "meth:`!find_module`,後者現在已被棄用。雖然它將繼續正常工作,但引入機制僅在尋" "檢器未實作 :meth:`~importlib.abc.MetaPathFinder.find_spec` 時才會嘗試使用它。" -#: ../../reference/import.rst:332 +#: ../../reference/import.rst:334 msgid "" "Use of :meth:`!find_module` by the import system now raises :exc:" "`ImportWarning`." msgstr "引入系統現在使用 :meth:`!find_module` 時將引發 :exc:`ImportWarning`。" -#: ../../reference/import.rst:336 +#: ../../reference/import.rst:338 msgid "" ":meth:`!find_module` has been removed. Use :meth:`~importlib.abc." "MetaPathFinder.find_spec` instead." @@ -597,11 +597,11 @@ msgstr "" ":meth:`!find_module` 已被移除。請改用 :meth:`~importlib.abc.MetaPathFinder." "find_spec`。" -#: ../../reference/import.rst:342 +#: ../../reference/import.rst:344 msgid "Loading" msgstr "載入" -#: ../../reference/import.rst:344 +#: ../../reference/import.rst:346 msgid "" "If and when a module spec is found, the import machinery will use it (and " "the loader it contains) when loading the module. Here is an approximation " @@ -610,7 +610,7 @@ msgstr "" "如果找到模組規格,引入機制會在載入模組時使用該規格(以及它包含的載入器)。以" "下是引入過程中載入部分的大致情況: ::" -#: ../../reference/import.rst:348 +#: ../../reference/import.rst:350 msgid "" "module = None\n" "if spec.loader is not None and hasattr(spec.loader, 'create_module'):\n" @@ -670,18 +670,18 @@ msgstr "" " raise\n" "return sys.modules[spec.name]" -#: ../../reference/import.rst:377 +#: ../../reference/import.rst:379 msgid "Note the following details:" msgstr "請注意下列細節:" -#: ../../reference/import.rst:379 +#: ../../reference/import.rst:381 msgid "" "If there is an existing module object with the given name in :data:`sys." "modules`, import will have already returned it." msgstr "" "如果 :data:`sys.modules` 中已存在具有給定名稱的模組物件,引入會已回傳該物件。" -#: ../../reference/import.rst:382 +#: ../../reference/import.rst:384 msgid "" "The module will exist in :data:`sys.modules` before the loader executes the " "module code. This is crucial because the module code may (directly or " @@ -693,7 +693,7 @@ msgstr "" "重要,因為模組程式碼可能會(直接或間接)引入自己;事先將其增加到 :data:`sys." "modules` 可以預防類似無限遞迴以及多次重覆載入等情形。" -#: ../../reference/import.rst:388 +#: ../../reference/import.rst:390 msgid "" "If loading fails, the failing module -- and only the failing module -- gets " "removed from :data:`sys.modules`. Any module already in the :data:`sys." @@ -706,7 +706,7 @@ msgstr "" "須保留在快取中。此情形與重新載入不同,在重新載入時,即使載入失敗的模組也會保" "留在 :data:`sys.modules` 中。" -#: ../../reference/import.rst:394 +#: ../../reference/import.rst:396 msgid "" "After the module is created but before execution, the import machinery sets " "the import-related module attributes (\"_init_module_attrs\" in the pseudo-" @@ -717,7 +717,7 @@ msgstr "" "範例中為 \"_init_module_attrs\"),具體內容在\\ :ref:`之後的段落<import-mod-" "attrs>`\\ 會總結。" -#: ../../reference/import.rst:399 +#: ../../reference/import.rst:401 msgid "" "Module execution is the key moment of loading in which the module's " "namespace gets populated. Execution is entirely delegated to the loader, " @@ -726,7 +726,7 @@ msgstr "" "模組執行是載入過程中的關鍵時刻,此時模組的命名空間會被新增名稱。執行過程完全" "交由載入器處理,由其決定如何新增以及新增什麼。" -#: ../../reference/import.rst:403 +#: ../../reference/import.rst:405 msgid "" "The module created during loading and passed to exec_module() may not be the " "one returned at the end of import [#fnlo]_." @@ -734,7 +734,7 @@ msgstr "" "在載入過程中建立並傳遞給 exec_module() 的模組,可能不會是引入結束時回傳的模" "組 [#fnlo]_。" -#: ../../reference/import.rst:406 +#: ../../reference/import.rst:408 msgid "" "The import system has taken over the boilerplate responsibilities of " "loaders. These were previously performed by the :meth:`importlib.abc.Loader." @@ -743,11 +743,11 @@ msgstr "" "引入系統已接管載入器的模板 (boilerplate) 責任。之前是由 :meth:`importlib.abc." "Loader.load_module` 方法執行的。" -#: ../../reference/import.rst:412 +#: ../../reference/import.rst:414 msgid "Loaders" msgstr "載入器" -#: ../../reference/import.rst:414 +#: ../../reference/import.rst:416 msgid "" "Module loaders provide the critical function of loading: module execution. " "The import machinery calls the :meth:`importlib.abc.Loader.exec_module` " @@ -758,11 +758,11 @@ msgstr "" "組物件)呼叫 :meth:`importlib.abc.Loader.exec_module` 方法。任何從 :meth:" "`~importlib.abc.Loader.exec_module` 回傳的值都會被忽略。" -#: ../../reference/import.rst:419 +#: ../../reference/import.rst:421 msgid "Loaders must satisfy the following requirements:" msgstr "載入器必須滿足以下要求:" -#: ../../reference/import.rst:421 +#: ../../reference/import.rst:423 msgid "" "If the module is a Python module (as opposed to a built-in module or a " "dynamically loaded extension), the loader should execute the module's code " @@ -771,7 +771,7 @@ msgstr "" "如果模組是 Python 模組(而非內建模組或動態載入的擴充),載入器應在模組的全域" "命名空間 (``module.__dict__``\\ ) 中執行該模組的程式碼。" -#: ../../reference/import.rst:425 +#: ../../reference/import.rst:427 msgid "" "If the loader cannot execute the module, it should raise an :exc:" "`ImportError`, although any other exception raised during :meth:`~importlib." @@ -780,7 +780,7 @@ msgstr "" "如果載入器無法執行該模組,應引發 :exc:`ImportError`。不過,在 :meth:" "`~importlib.abc.Loader.exec_module` 中引發的任何其他例外也會被傳播。" -#: ../../reference/import.rst:429 +#: ../../reference/import.rst:431 msgid "" "In many cases, the finder and loader can be the same object; in such cases " "the :meth:`~importlib.abc.MetaPathFinder.find_spec` method would just return " @@ -790,7 +790,7 @@ msgstr "" "`~importlib.abc.MetaPathFinder.find_spec` 方法只需回傳一個載入器設為 " "``self`` 的規格即可。" -#: ../../reference/import.rst:433 +#: ../../reference/import.rst:435 msgid "" "Module loaders may opt in to creating the module object during loading by " "implementing a :meth:`~importlib.abc.Loader.create_module` method. It takes " @@ -804,11 +804,11 @@ msgstr "" "要使用的新的模組物件。``create_module()`` 不需要在模組物件上設定任何屬性。如" "果該方法回傳 ``None``,引入機制將自行建立新的模組。" -#: ../../reference/import.rst:440 +#: ../../reference/import.rst:442 msgid "The :meth:`~importlib.abc.Loader.create_module` method of loaders." msgstr "載入器的 :meth:`~importlib.abc.Loader.create_module` 方法。" -#: ../../reference/import.rst:443 +#: ../../reference/import.rst:445 msgid "" "The :meth:`~importlib.abc.Loader.load_module` method was replaced by :meth:" "`~importlib.abc.Loader.exec_module` and the import machinery assumed all the " @@ -817,7 +817,7 @@ msgstr "" ":meth:`~importlib.abc.Loader.load_module` 方法已被 :meth:`~importlib.abc." "Loader.exec_module` 取代,引入機制已承擔所有載入的模板責任。" -#: ../../reference/import.rst:448 +#: ../../reference/import.rst:450 msgid "" "For compatibility with existing loaders, the import machinery will use the " "``load_module()`` method of loaders if it exists and the loader does not " @@ -828,7 +828,7 @@ msgstr "" "``load_module()`` 方法時使用該方法。然而,``load_module()`` 已被棄用,載入器" "應改為實作 ``exec_module()``。" -#: ../../reference/import.rst:453 +#: ../../reference/import.rst:455 msgid "" "The ``load_module()`` method must implement all the boilerplate loading " "functionality described above in addition to executing the module. All the " @@ -837,7 +837,7 @@ msgstr "" "``load_module()`` 方法除了執行模組外,還必須實作上述全部的模板載入功能。所有" "相同的限制依然適用,並且還有一些額外的說明:" -#: ../../reference/import.rst:457 +#: ../../reference/import.rst:459 msgid "" "If there is an existing module object with the given name in :data:`sys." "modules`, the loader must use that existing module. (Otherwise, :func:" @@ -850,7 +850,7 @@ msgstr "" "`sys.modules` 中,載入器必須建立一個新的模組物件並將其新增至 :data:`sys." "modules`。" -#: ../../reference/import.rst:463 +#: ../../reference/import.rst:465 msgid "" "The module *must* exist in :data:`sys.modules` before the loader executes " "the module code, to prevent unbounded recursion or multiple loading." @@ -858,7 +858,7 @@ msgstr "" "在載入器執行模組程式碼之前,該模組\\ *必須*\\ 已存在於 :data:`sys.modules` " "中,以防止無限遞迴或多次載入。" -#: ../../reference/import.rst:467 +#: ../../reference/import.rst:469 msgid "" "If loading fails, the loader must remove any modules it has inserted into :" "data:`sys.modules`, but it must remove **only** the failing module(s), and " @@ -868,7 +868,7 @@ msgstr "" "\\ **只能**\\ 移除失敗的模組(們),且僅在載入器本身明確載入這些模組時才需移" "除。" -#: ../../reference/import.rst:472 +#: ../../reference/import.rst:474 msgid "" "A :exc:`DeprecationWarning` is raised when ``exec_module()`` is defined but " "``create_module()`` is not." @@ -876,7 +876,7 @@ msgstr "" "當 ``exec_module()`` 已定義但未定義 ``create_module()`` 時,將引發 :exc:" "`DeprecationWarning`。" -#: ../../reference/import.rst:476 +#: ../../reference/import.rst:478 msgid "" "An :exc:`ImportError` is raised when ``exec_module()`` is defined but " "``create_module()`` is not." @@ -884,15 +884,15 @@ msgstr "" "當 ``exec_module()`` 已定義但未定義 ``create_module()`` 時,將引發 :exc:" "`ImportError`。" -#: ../../reference/import.rst:480 +#: ../../reference/import.rst:482 msgid "Use of ``load_module()`` will raise :exc:`ImportWarning`." msgstr "使用 ``load_module()`` 將引發 :exc:`ImportWarning`。" -#: ../../reference/import.rst:484 +#: ../../reference/import.rst:486 msgid "Submodules" msgstr "子模組" -#: ../../reference/import.rst:486 +#: ../../reference/import.rst:488 msgid "" "When a submodule is loaded using any mechanism (e.g. ``importlib`` APIs, the " "``import`` or ``import-from`` statements, or built-in ``__import__()``) a " @@ -907,7 +907,7 @@ msgstr "" "foo`` 之後,``spam`` 將擁有一個名為 ``foo`` 的屬性,該屬性繫結到子模組。我們" "假設你有以下的目錄結構: ::" -#: ../../reference/import.rst:493 +#: ../../reference/import.rst:495 msgid "" "spam/\n" " __init__.py\n" @@ -917,22 +917,22 @@ msgstr "" " __init__.py\n" " foo.py" -#: ../../reference/import.rst:497 +#: ../../reference/import.rst:499 msgid "and ``spam/__init__.py`` has the following line in it::" msgstr "並且 ``spam/__init__.py`` 中包含以下程式碼: ::" -#: ../../reference/import.rst:499 +#: ../../reference/import.rst:501 msgid "from .foo import Foo" msgstr "from .foo import Foo" -#: ../../reference/import.rst:501 +#: ../../reference/import.rst:503 msgid "" "then executing the following puts name bindings for ``foo`` and ``Foo`` in " "the ``spam`` module::" msgstr "" "那麼執行以下程式碼會將 ``foo`` 和 ``Foo`` 的名稱繫結到 ``spam`` 模組中: ::" -#: ../../reference/import.rst:504 +#: ../../reference/import.rst:506 msgid "" ">>> import spam\n" ">>> spam.foo\n" @@ -946,7 +946,7 @@ msgstr "" ">>> spam.Foo\n" "<class 'spam.foo.Foo'>" -#: ../../reference/import.rst:510 +#: ../../reference/import.rst:512 msgid "" "Given Python's familiar name binding rules this might seem surprising, but " "it's actually a fundamental feature of the import system. The invariant " @@ -959,11 +959,11 @@ msgstr "" "modules['spam.foo']``\\ (就像上述引入後那樣),那麼後者必須作為前者的 " "``foo`` 屬性出現。" -#: ../../reference/import.rst:519 +#: ../../reference/import.rst:521 msgid "Module specs" msgstr "模組規格" -#: ../../reference/import.rst:521 +#: ../../reference/import.rst:523 msgid "" "The import machinery uses a variety of information about each module during " "import, especially before loading. Most of the information is common to all " @@ -974,7 +974,7 @@ msgstr "" "對所有模組來說都是通用的。模組規格的目的是以每個模組為基礎封裝這些與引入相關" "的資訊。" -#: ../../reference/import.rst:526 +#: ../../reference/import.rst:528 msgid "" "Using a spec during import allows state to be transferred between import " "system components, e.g. between the finder that creates the module spec and " @@ -986,7 +986,7 @@ msgstr "" "的尋檢器和執行該規格的載入器之間傳遞。最重要的是,這允許引入機制執行載入的模" "板操作,而在沒有模組規格的情況下,這些操作則是載入器的責任。" -#: ../../reference/import.rst:532 +#: ../../reference/import.rst:534 msgid "" "The module's spec is exposed as :attr:`module.__spec__`. Setting :attr:`!" "__spec__` appropriately applies equally to :ref:`modules initialized during " @@ -998,18 +998,18 @@ msgstr "" "例外是 ``__main__``,其中 :attr:`!__spec__` 會\\ :ref:`在某些情況下被設定成 " "None <main_spec>`。" -#: ../../reference/import.rst:538 +#: ../../reference/import.rst:540 msgid "" "See :class:`~importlib.machinery.ModuleSpec` for details on the contents of " "the module spec." msgstr "" "有關模組規格內容的詳細資訊,請參閱 :class:`~importlib.machinery.ModuleSpec`。" -#: ../../reference/import.rst:546 +#: ../../reference/import.rst:548 msgid "__path__ attributes on modules" msgstr "" -#: ../../reference/import.rst:548 +#: ../../reference/import.rst:550 msgid "" "The :attr:`~module.__path__` attribute should be a (possibly empty) :term:" "`sequence` of strings enumerating the locations where the package's " @@ -1017,7 +1017,7 @@ msgid "" "attribute, it is a :term:`package`." msgstr "" -#: ../../reference/import.rst:553 +#: ../../reference/import.rst:555 msgid "" "A package's :attr:`~module.__path__` attribute is used during imports of its " "subpackages. Within the import machinery, it functions much the same as :" @@ -1026,14 +1026,14 @@ msgid "" "than :data:`!sys.path`." msgstr "" -#: ../../reference/import.rst:560 +#: ../../reference/import.rst:562 msgid "" "The same rules used for :data:`sys.path` also apply to a package's :attr:`!" "__path__`. :data:`sys.path_hooks` (described below) are consulted when " "traversing a package's :attr:`!__path__`." msgstr "" -#: ../../reference/import.rst:564 +#: ../../reference/import.rst:566 msgid "" "A package's ``__init__.py`` file may set or alter the package's :attr:" "`~module.__path__` attribute, and this was typically the way namespace " @@ -1043,18 +1043,18 @@ msgid "" "automatically sets :attr:`!__path__` correctly for the namespace package." msgstr "" -#: ../../reference/import.rst:573 +#: ../../reference/import.rst:575 msgid "Module reprs" msgstr "" -#: ../../reference/import.rst:575 +#: ../../reference/import.rst:577 msgid "" "By default, all modules have a usable repr, however depending on the " "attributes set above, and in the module's spec, you can more explicitly " "control the repr of module objects." msgstr "" -#: ../../reference/import.rst:579 +#: ../../reference/import.rst:581 msgid "" "If the module has a spec (``__spec__``), the import machinery will try to " "generate a repr from it. If that fails or there is no spec, the import " @@ -1064,45 +1064,45 @@ msgid "" "for whatever information is missing." msgstr "" -#: ../../reference/import.rst:586 +#: ../../reference/import.rst:588 msgid "Here are the exact rules used:" msgstr "" -#: ../../reference/import.rst:588 +#: ../../reference/import.rst:590 msgid "" "If the module has a ``__spec__`` attribute, the information in the spec is " "used to generate the repr. The \"name\", \"loader\", \"origin\", and " "\"has_location\" attributes are consulted." msgstr "" -#: ../../reference/import.rst:592 +#: ../../reference/import.rst:594 msgid "" "If the module has a ``__file__`` attribute, this is used as part of the " "module's repr." msgstr "" -#: ../../reference/import.rst:595 +#: ../../reference/import.rst:597 msgid "" "If the module has no ``__file__`` but does have a ``__loader__`` that is not " "``None``, then the loader's repr is used as part of the module's repr." msgstr "" -#: ../../reference/import.rst:598 +#: ../../reference/import.rst:600 msgid "Otherwise, just use the module's ``__name__`` in the repr." msgstr "" -#: ../../reference/import.rst:600 +#: ../../reference/import.rst:602 msgid "" "Use of :meth:`!module_repr`, having been deprecated since Python 3.4, was " "removed in Python 3.12 and is no longer called during the resolution of a " "module's repr." msgstr "" -#: ../../reference/import.rst:608 +#: ../../reference/import.rst:610 msgid "Cached bytecode invalidation" msgstr "" -#: ../../reference/import.rst:610 +#: ../../reference/import.rst:612 msgid "" "Before Python loads cached bytecode from a ``.pyc`` file, it checks whether " "the cache is up-to-date with the source ``.py`` file. By default, Python " @@ -1112,7 +1112,7 @@ msgid "" "source's metadata." msgstr "" -#: ../../reference/import.rst:617 +#: ../../reference/import.rst:619 msgid "" "Python also supports \"hash-based\" cache files, which store a hash of the " "source file's contents rather than its metadata. There are two variants of " @@ -1126,17 +1126,17 @@ msgid "" "option:`--check-hash-based-pycs` flag." msgstr "" -#: ../../reference/import.rst:628 +#: ../../reference/import.rst:630 msgid "" "Added hash-based ``.pyc`` files. Previously, Python only supported timestamp-" "based invalidation of bytecode caches." msgstr "" -#: ../../reference/import.rst:634 +#: ../../reference/import.rst:636 msgid "The Path Based Finder" msgstr "" -#: ../../reference/import.rst:639 +#: ../../reference/import.rst:641 msgid "" "As mentioned previously, Python comes with several default meta path " "finders. One of these, called the :term:`path based finder` (:class:" @@ -1145,14 +1145,14 @@ msgid "" "a location to search for modules." msgstr "" -#: ../../reference/import.rst:645 +#: ../../reference/import.rst:647 msgid "" "The path based finder itself doesn't know how to import anything. Instead, " "it traverses the individual path entries, associating each of them with a " "path entry finder that knows how to handle that particular kind of path." msgstr "" -#: ../../reference/import.rst:649 +#: ../../reference/import.rst:651 msgid "" "The default set of path entry finders implement all the semantics for " "finding modules on the file system, handling special file types such as " @@ -1163,14 +1163,14 @@ msgid "" "from zipfiles." msgstr "" -#: ../../reference/import.rst:656 +#: ../../reference/import.rst:658 msgid "" "Path entries need not be limited to file system locations. They can refer " "to URLs, database queries, or any other location that can be specified as a " "string." msgstr "" -#: ../../reference/import.rst:660 +#: ../../reference/import.rst:662 msgid "" "The path based finder provides additional hooks and protocols so that you " "can extend and customize the types of searchable path entries. For example, " @@ -1181,7 +1181,7 @@ msgid "" "from the web." msgstr "" -#: ../../reference/import.rst:668 +#: ../../reference/import.rst:670 msgid "" "A word of warning: this section and the previous both use the term *finder*, " "distinguishing between them by using the terms :term:`meta path finder` and :" @@ -1192,7 +1192,7 @@ msgid "" "process, as keyed off the :data:`sys.meta_path` traversal." msgstr "" -#: ../../reference/import.rst:676 +#: ../../reference/import.rst:678 msgid "" "By contrast, path entry finders are in a sense an implementation detail of " "the path based finder, and in fact, if the path based finder were to be " @@ -1200,11 +1200,11 @@ msgid "" "would be invoked." msgstr "" -#: ../../reference/import.rst:683 +#: ../../reference/import.rst:685 msgid "Path entry finders" msgstr "" -#: ../../reference/import.rst:691 +#: ../../reference/import.rst:693 msgid "" "The :term:`path based finder` is responsible for finding and loading Python " "modules and packages whose location is specified with a string :term:`path " @@ -1212,7 +1212,7 @@ msgid "" "not be limited to this." msgstr "" -#: ../../reference/import.rst:696 +#: ../../reference/import.rst:698 msgid "" "As a meta path finder, the :term:`path based finder` implements the :meth:" "`~importlib.abc.MetaPathFinder.find_spec` protocol previously described, " @@ -1220,7 +1220,7 @@ msgid "" "modules are found and loaded from the :term:`import path`." msgstr "" -#: ../../reference/import.rst:701 +#: ../../reference/import.rst:703 msgid "" "Three variables are used by the :term:`path based finder`, :data:`sys." "path`, :data:`sys.path_hooks` and :data:`sys.path_importer_cache`. The " @@ -1228,7 +1228,7 @@ msgid "" "additional ways that the import machinery can be customized." msgstr "" -#: ../../reference/import.rst:706 +#: ../../reference/import.rst:708 msgid "" ":data:`sys.path` contains a list of strings providing search locations for " "modules and packages. It is initialized from the :envvar:`PYTHONPATH` " @@ -1240,7 +1240,7 @@ msgid "" "other data types are ignored." msgstr "" -#: ../../reference/import.rst:715 +#: ../../reference/import.rst:717 msgid "" "The :term:`path based finder` is a :term:`meta path finder`, so the import " "machinery begins the :term:`import path` search by calling the path based " @@ -1252,7 +1252,7 @@ msgid "" "top level import and :data:`sys.path` is used." msgstr "" -#: ../../reference/import.rst:724 +#: ../../reference/import.rst:726 msgid "" "The path based finder iterates over every entry in the search path, and for " "each of these, looks for an appropriate :term:`path entry finder` (:class:" @@ -1268,7 +1268,7 @@ msgid "" "finder to perform the path entry search again." msgstr "" -#: ../../reference/import.rst:737 +#: ../../reference/import.rst:739 msgid "" "If the path entry is not present in the cache, the path based finder " "iterates over every callable in :data:`sys.path_hooks`. Each of the :term:" @@ -1284,7 +1284,7 @@ msgid "" "decode the argument, it should raise :exc:`ImportError`." msgstr "" -#: ../../reference/import.rst:751 +#: ../../reference/import.rst:753 msgid "" "If :data:`sys.path_hooks` iteration ends with no :term:`path entry finder` " "being returned, then the path based finder's :meth:`~importlib.machinery." @@ -1294,7 +1294,7 @@ msgid "" "could not find the module." msgstr "" -#: ../../reference/import.rst:758 +#: ../../reference/import.rst:760 msgid "" "If a :term:`path entry finder` *is* returned by one of the :term:`path entry " "hook` callables on :data:`sys.path_hooks`, then the following protocol is " @@ -1302,7 +1302,7 @@ msgid "" "the module." msgstr "" -#: ../../reference/import.rst:763 +#: ../../reference/import.rst:765 msgid "" "The current working directory -- denoted by an empty string -- is handled " "slightly differently from other entries on :data:`sys.path`. First, if the " @@ -1314,18 +1314,18 @@ msgid "" "and not the empty string." msgstr "" -#: ../../reference/import.rst:773 +#: ../../reference/import.rst:775 msgid "Path entry finder protocol" msgstr "" -#: ../../reference/import.rst:775 +#: ../../reference/import.rst:777 msgid "" "In order to support imports of modules and initialized packages and also to " "contribute portions to namespace packages, path entry finders must implement " "the :meth:`~importlib.abc.PathEntryFinder.find_spec` method." msgstr "" -#: ../../reference/import.rst:779 +#: ../../reference/import.rst:781 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` takes two arguments: the " "fully qualified name of the module being imported, and the (optional) target " @@ -1333,21 +1333,21 @@ msgid "" "spec will always have \"loader\" set (with one exception)." msgstr "" -#: ../../reference/import.rst:784 +#: ../../reference/import.rst:786 msgid "" "To indicate to the import machinery that the spec represents a namespace :" "term:`portion`, the path entry finder sets ``submodule_search_locations`` to " "a list containing the portion." msgstr "" -#: ../../reference/import.rst:788 +#: ../../reference/import.rst:790 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` replaced :meth:`!" "find_loader` and :meth:`!find_module`, both of which are now deprecated, but " "will be used if ``find_spec()`` is not defined." msgstr "" -#: ../../reference/import.rst:794 +#: ../../reference/import.rst:796 msgid "" "Older path entry finders may implement one of these two deprecated methods " "instead of ``find_spec()``. The methods are still respected for the sake of " @@ -1355,14 +1355,14 @@ msgid "" "path entry finder, the legacy methods are ignored." msgstr "" -#: ../../reference/import.rst:799 +#: ../../reference/import.rst:801 msgid "" ":meth:`!find_loader` takes one argument, the fully qualified name of the " "module being imported. ``find_loader()`` returns a 2-tuple where the first " "item is the loader and the second item is a namespace :term:`portion`." msgstr "" -#: ../../reference/import.rst:804 +#: ../../reference/import.rst:806 msgid "" "For backwards compatibility with other implementations of the import " "protocol, many path entry finders also support the same, traditional " @@ -1372,7 +1372,7 @@ msgid "" "initial call to the path hook)." msgstr "" -#: ../../reference/import.rst:811 +#: ../../reference/import.rst:813 msgid "" "The ``find_module()`` method on path entry finders is deprecated, as it does " "not allow the path entry finder to contribute portions to namespace " @@ -1381,28 +1381,28 @@ msgid "" "preference to ``find_module()``." msgstr "" -#: ../../reference/import.rst:817 +#: ../../reference/import.rst:819 msgid "" "Calls to :meth:`!find_module` and :meth:`!find_loader` by the import system " "will raise :exc:`ImportWarning`." msgstr "" -#: ../../reference/import.rst:822 +#: ../../reference/import.rst:824 msgid "``find_module()`` and ``find_loader()`` have been removed." msgstr "" -#: ../../reference/import.rst:827 +#: ../../reference/import.rst:829 msgid "Replacing the standard import system" msgstr "" -#: ../../reference/import.rst:829 +#: ../../reference/import.rst:831 msgid "" "The most reliable mechanism for replacing the entire import system is to " "delete the default contents of :data:`sys.meta_path`, replacing them " "entirely with a custom meta path hook." msgstr "" -#: ../../reference/import.rst:833 +#: ../../reference/import.rst:835 msgid "" "If it is acceptable to only alter the behaviour of import statements without " "affecting other APIs that access the import system, then replacing the " @@ -1411,7 +1411,7 @@ msgid "" "statements within that module." msgstr "" -#: ../../reference/import.rst:839 +#: ../../reference/import.rst:841 msgid "" "To selectively prevent the import of some modules from a hook early on the " "meta path (rather than disabling the standard import system entirely), it is " @@ -1421,11 +1421,11 @@ msgid "" "exception terminates it immediately." msgstr "" -#: ../../reference/import.rst:849 +#: ../../reference/import.rst:851 msgid "Package Relative Imports" msgstr "" -#: ../../reference/import.rst:851 +#: ../../reference/import.rst:853 msgid "" "Relative imports use leading dots. A single leading dot indicates a relative " "import, starting with the current package. Two or more leading dots indicate " @@ -1433,7 +1433,7 @@ msgid "" "after the first. For example, given the following package layout::" msgstr "" -#: ../../reference/import.rst:856 +#: ../../reference/import.rst:858 msgid "" "package/\n" " __init__.py\n" @@ -1457,13 +1457,13 @@ msgstr "" " moduleZ.py\n" " moduleA.py" -#: ../../reference/import.rst:867 +#: ../../reference/import.rst:869 msgid "" "In either ``subpackage1/moduleX.py`` or ``subpackage1/__init__.py``, the " "following are valid relative imports::" msgstr "" -#: ../../reference/import.rst:870 +#: ../../reference/import.rst:872 msgid "" "from .moduleY import spam\n" "from .moduleY import spam as ham\n" @@ -1479,28 +1479,28 @@ msgstr "" "from ..subpackage2.moduleZ import eggs\n" "from ..moduleA import foo" -#: ../../reference/import.rst:877 +#: ../../reference/import.rst:879 msgid "" "Absolute imports may use either the ``import <>`` or ``from <> import <>`` " "syntax, but relative imports may only use the second form; the reason for " "this is that::" msgstr "" -#: ../../reference/import.rst:881 +#: ../../reference/import.rst:883 msgid "import XXX.YYY.ZZZ" msgstr "import XXX.YYY.ZZZ" -#: ../../reference/import.rst:883 +#: ../../reference/import.rst:885 msgid "" "should expose ``XXX.YYY.ZZZ`` as a usable expression, but .moduleY is not a " "valid expression." msgstr "" -#: ../../reference/import.rst:890 +#: ../../reference/import.rst:892 msgid "Special considerations for __main__" msgstr "" -#: ../../reference/import.rst:892 +#: ../../reference/import.rst:894 msgid "" "The :mod:`__main__` module is a special case relative to Python's import " "system. As noted :ref:`elsewhere <programs>`, the ``__main__`` module is " @@ -1511,17 +1511,17 @@ msgid "" "interpreter is invoked." msgstr "" -#: ../../reference/import.rst:903 +#: ../../reference/import.rst:905 msgid "__main__.__spec__" msgstr "__main__.__spec__" -#: ../../reference/import.rst:905 +#: ../../reference/import.rst:907 msgid "" "Depending on how :mod:`__main__` is initialized, ``__main__.__spec__`` gets " "set appropriately or to ``None``." msgstr "" -#: ../../reference/import.rst:908 +#: ../../reference/import.rst:910 msgid "" "When Python is started with the :option:`-m` option, ``__spec__`` is set to " "the module spec of the corresponding module or package. ``__spec__`` is also " @@ -1529,30 +1529,30 @@ msgid "" "directory, zipfile or other :data:`sys.path` entry." msgstr "" -#: ../../reference/import.rst:913 +#: ../../reference/import.rst:915 msgid "" "In :ref:`the remaining cases <using-on-interface-options>` ``__main__." "__spec__`` is set to ``None``, as the code used to populate the :mod:" "`__main__` does not correspond directly with an importable module:" msgstr "" -#: ../../reference/import.rst:917 +#: ../../reference/import.rst:919 msgid "interactive prompt" msgstr "" -#: ../../reference/import.rst:918 +#: ../../reference/import.rst:920 msgid ":option:`-c` option" msgstr ":option:`-c` 選項" -#: ../../reference/import.rst:919 +#: ../../reference/import.rst:921 msgid "running from stdin" msgstr "" -#: ../../reference/import.rst:920 +#: ../../reference/import.rst:922 msgid "running directly from a source or bytecode file" msgstr "" -#: ../../reference/import.rst:922 +#: ../../reference/import.rst:924 msgid "" "Note that ``__main__.__spec__`` is always ``None`` in the last case, *even " "if* the file could technically be imported directly as a module instead. Use " @@ -1560,7 +1560,7 @@ msgid "" "`__main__`." msgstr "" -#: ../../reference/import.rst:927 +#: ../../reference/import.rst:929 msgid "" "Note also that even when ``__main__`` corresponds with an importable module " "and ``__main__.__spec__`` is set accordingly, they're still considered " @@ -1569,11 +1569,11 @@ msgid "" "populate the ``__main__`` namespace, and not during normal import." msgstr "" -#: ../../reference/import.rst:935 +#: ../../reference/import.rst:937 msgid "References" msgstr "" -#: ../../reference/import.rst:937 +#: ../../reference/import.rst:939 msgid "" "The import machinery has evolved considerably since Python's early days. " "The original `specification for packages <https://www.python.org/doc/essays/" @@ -1581,37 +1581,37 @@ msgid "" "since the writing of that document." msgstr "" -#: ../../reference/import.rst:942 +#: ../../reference/import.rst:944 msgid "" "The original specification for :data:`sys.meta_path` was :pep:`302`, with " "subsequent extension in :pep:`420`." msgstr "" -#: ../../reference/import.rst:945 +#: ../../reference/import.rst:947 msgid "" ":pep:`420` introduced :term:`namespace packages <namespace package>` for " "Python 3.3. :pep:`420` also introduced the :meth:`!find_loader` protocol as " "an alternative to :meth:`!find_module`." msgstr "" -#: ../../reference/import.rst:949 +#: ../../reference/import.rst:951 msgid "" ":pep:`366` describes the addition of the ``__package__`` attribute for " "explicit relative imports in main modules." msgstr "" -#: ../../reference/import.rst:952 +#: ../../reference/import.rst:954 msgid "" ":pep:`328` introduced absolute and explicit relative imports and initially " "proposed ``__name__`` for semantics :pep:`366` would eventually specify for " "``__package__``." msgstr "" -#: ../../reference/import.rst:956 +#: ../../reference/import.rst:958 msgid ":pep:`338` defines executing modules as scripts." msgstr "" -#: ../../reference/import.rst:958 +#: ../../reference/import.rst:960 msgid "" ":pep:`451` adds the encapsulation of per-module import state in spec " "objects. It also off-loads most of the boilerplate responsibilities of " @@ -1620,15 +1620,15 @@ msgid "" "finders and loaders." msgstr "" -#: ../../reference/import.rst:965 +#: ../../reference/import.rst:967 msgid "Footnotes" msgstr "註解" -#: ../../reference/import.rst:966 +#: ../../reference/import.rst:968 msgid "See :class:`types.ModuleType`." msgstr "參閱 :class:`types.ModuleType`。" -#: ../../reference/import.rst:968 +#: ../../reference/import.rst:970 msgid "" "The importlib implementation avoids using the return value directly. " "Instead, it gets the module object by looking the module name up in :data:" @@ -1642,7 +1642,7 @@ msgid "import machinery" msgstr "import machinery(引入機制)" #: ../../reference/import.rst:64 ../../reference/import.rst:95 -#: ../../reference/import.rst:129 +#: ../../reference/import.rst:131 msgid "package" msgstr "package(套件)" @@ -1650,83 +1650,83 @@ msgstr "package(套件)" msgid "regular" msgstr "regular(一般)" -#: ../../reference/import.rst:129 +#: ../../reference/import.rst:131 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../reference/import.rst:129 +#: ../../reference/import.rst:131 msgid "portion" msgstr "portion(部分)" -#: ../../reference/import.rst:175 +#: ../../reference/import.rst:177 msgid "sys.modules" msgstr "sys.modules" -#: ../../reference/import.rst:210 ../../reference/import.rst:276 +#: ../../reference/import.rst:212 ../../reference/import.rst:278 msgid "finder" msgstr "finder(搜尋器)" -#: ../../reference/import.rst:210 +#: ../../reference/import.rst:212 msgid "loader" msgstr "loader(載入器)" -#: ../../reference/import.rst:210 +#: ../../reference/import.rst:212 msgid "module spec" msgstr "module spec" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "import hooks" msgstr "import hooks" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "meta hooks" msgstr "meta hooks" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "path hooks" msgstr "path hooks" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "hooks" msgstr "hooks" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "import" msgstr "import(引入)" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "meta" msgstr "meta" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "path" msgstr "path(路徑)" -#: ../../reference/import.rst:276 +#: ../../reference/import.rst:278 msgid "sys.meta_path" msgstr "sys.meta_path" -#: ../../reference/import.rst:276 +#: ../../reference/import.rst:278 msgid "find_spec" msgstr "find_spec" -#: ../../reference/import.rst:636 +#: ../../reference/import.rst:638 msgid "path based finder" msgstr "path based finder(基於路徑的搜尋器)" -#: ../../reference/import.rst:685 +#: ../../reference/import.rst:687 msgid "sys.path" msgstr "sys.path" -#: ../../reference/import.rst:685 +#: ../../reference/import.rst:687 msgid "sys.path_hooks" msgstr "sys.path_hooks" -#: ../../reference/import.rst:685 +#: ../../reference/import.rst:687 msgid "sys.path_importer_cache" msgstr "sys.path_importer_cache" -#: ../../reference/import.rst:685 +#: ../../reference/import.rst:687 msgid "PYTHONPATH" msgstr "PYTHONPATH" diff --git a/reference/lexical_analysis.po b/reference/lexical_analysis.po index fd5a4fbd89..f10ba51779 100644 --- a/reference/lexical_analysis.po +++ b/reference/lexical_analysis.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-15 00:14+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,12 +23,13 @@ msgstr "詞法分析" #: ../../reference/lexical_analysis.rst:10 msgid "" -"A Python program is read by a *parser*. Input to the parser is a stream of " -"*tokens*, generated by the *lexical analyzer*. This chapter describes how " -"the lexical analyzer breaks a file into tokens." +"A Python program is read by a *parser*. Input to the parser is a stream of :" +"term:`tokens <token>`, generated by the *lexical analyzer* (also known as " +"the *tokenizer*). This chapter describes how the lexical analyzer breaks a " +"file into tokens." msgstr "" -#: ../../reference/lexical_analysis.rst:14 +#: ../../reference/lexical_analysis.rst:15 msgid "" "Python reads program text as Unicode code points; the encoding of a source " "file can be given by an encoding declaration and defaults to UTF-8, see :pep:" @@ -36,19 +37,19 @@ msgid "" "`SyntaxError` is raised." msgstr "" -#: ../../reference/lexical_analysis.rst:23 +#: ../../reference/lexical_analysis.rst:24 msgid "Line structure" msgstr "" -#: ../../reference/lexical_analysis.rst:27 +#: ../../reference/lexical_analysis.rst:28 msgid "A Python program is divided into a number of *logical lines*." msgstr "" -#: ../../reference/lexical_analysis.rst:33 +#: ../../reference/lexical_analysis.rst:34 msgid "Logical lines" msgstr "" -#: ../../reference/lexical_analysis.rst:37 +#: ../../reference/lexical_analysis.rst:38 msgid "" "The end of a logical line is represented by the token NEWLINE. Statements " "cannot cross logical line boundaries except where NEWLINE is allowed by the " @@ -57,11 +58,11 @@ msgid "" "implicit *line joining* rules." msgstr "" -#: ../../reference/lexical_analysis.rst:47 +#: ../../reference/lexical_analysis.rst:48 msgid "Physical lines" msgstr "" -#: ../../reference/lexical_analysis.rst:49 +#: ../../reference/lexical_analysis.rst:50 msgid "" "A physical line is a sequence of characters terminated by an end-of-line " "sequence. In source files and strings, any of the standard platform line " @@ -72,18 +73,18 @@ msgid "" "input also serves as an implicit terminator for the final physical line." msgstr "" -#: ../../reference/lexical_analysis.rst:57 +#: ../../reference/lexical_analysis.rst:58 msgid "" "When embedding Python, source code strings should be passed to Python APIs " "using the standard C conventions for newline characters (the ``\\n`` " "character, representing ASCII LF, is the line terminator)." msgstr "" -#: ../../reference/lexical_analysis.rst:65 +#: ../../reference/lexical_analysis.rst:66 msgid "Comments" msgstr "" -#: ../../reference/lexical_analysis.rst:70 +#: ../../reference/lexical_analysis.rst:71 msgid "" "A comment starts with a hash character (``#``) that is not part of a string " "literal, and ends at the end of the physical line. A comment signifies the " @@ -91,11 +92,11 @@ msgid "" "Comments are ignored by the syntax." msgstr "" -#: ../../reference/lexical_analysis.rst:79 +#: ../../reference/lexical_analysis.rst:80 msgid "Encoding declarations" msgstr "" -#: ../../reference/lexical_analysis.rst:84 +#: ../../reference/lexical_analysis.rst:85 msgid "" "If a comment in the first or second line of the Python script matches the " "regular expression ``coding[=:]\\s*([-\\w.]+)``, this comment is processed " @@ -105,41 +106,41 @@ msgid "" "comment-only line. The recommended forms of an encoding expression are ::" msgstr "" -#: ../../reference/lexical_analysis.rst:91 +#: ../../reference/lexical_analysis.rst:92 msgid "# -*- coding: <encoding-name> -*-" msgstr "# -*- coding: <encoding-name> -*-" -#: ../../reference/lexical_analysis.rst:93 +#: ../../reference/lexical_analysis.rst:94 msgid "which is recognized also by GNU Emacs, and ::" msgstr "" -#: ../../reference/lexical_analysis.rst:95 +#: ../../reference/lexical_analysis.rst:96 msgid "# vim:fileencoding=<encoding-name>" msgstr "# vim:fileencoding=<encoding-name>" -#: ../../reference/lexical_analysis.rst:97 +#: ../../reference/lexical_analysis.rst:98 msgid "which is recognized by Bram Moolenaar's VIM." msgstr "" -#: ../../reference/lexical_analysis.rst:99 +#: ../../reference/lexical_analysis.rst:100 msgid "" "If no encoding declaration is found, the default encoding is UTF-8. If the " "implicit or explicit encoding of a file is UTF-8, an initial UTF-8 byte-" "order mark (b'\\xef\\xbb\\xbf') is ignored rather than being a syntax error." msgstr "" -#: ../../reference/lexical_analysis.rst:103 +#: ../../reference/lexical_analysis.rst:104 msgid "" "If an encoding is declared, the encoding name must be recognized by Python " "(see :ref:`standard-encodings`). The encoding is used for all lexical " "analysis, including string literals, comments and identifiers." msgstr "" -#: ../../reference/lexical_analysis.rst:112 +#: ../../reference/lexical_analysis.rst:113 msgid "Explicit line joining" msgstr "" -#: ../../reference/lexical_analysis.rst:116 +#: ../../reference/lexical_analysis.rst:117 msgid "" "Two or more physical lines may be joined into logical lines using backslash " "characters (``\\``), as follows: when a physical line ends in a backslash " @@ -148,7 +149,7 @@ msgid "" "following end-of-line character. For example::" msgstr "" -#: ../../reference/lexical_analysis.rst:122 +#: ../../reference/lexical_analysis.rst:123 msgid "" "if 1900 < year < 2100 and 1 <= month <= 12 \\\n" " and 1 <= day <= 31 and 0 <= hour < 24 \\\n" @@ -160,7 +161,7 @@ msgstr "" " and 0 <= minute < 60 and 0 <= second < 60: # 看起來像個有效日期\n" " return 1" -#: ../../reference/lexical_analysis.rst:127 +#: ../../reference/lexical_analysis.rst:128 msgid "" "A line ending in a backslash cannot carry a comment. A backslash does not " "continue a comment. A backslash does not continue a token except for string " @@ -169,17 +170,17 @@ msgid "" "line outside a string literal." msgstr "" -#: ../../reference/lexical_analysis.rst:137 +#: ../../reference/lexical_analysis.rst:138 msgid "Implicit line joining" msgstr "" -#: ../../reference/lexical_analysis.rst:139 +#: ../../reference/lexical_analysis.rst:140 msgid "" "Expressions in parentheses, square brackets or curly braces can be split " "over more than one physical line without using backslashes. For example::" msgstr "" -#: ../../reference/lexical_analysis.rst:142 +#: ../../reference/lexical_analysis.rst:143 msgid "" "month_names = ['Januari', 'Februari', 'Maart', # These are the\n" " 'April', 'Mei', 'Juni', # Dutch names\n" @@ -187,7 +188,7 @@ msgid "" " 'Oktober', 'November', 'December'] # of the year" msgstr "" -#: ../../reference/lexical_analysis.rst:147 +#: ../../reference/lexical_analysis.rst:148 msgid "" "Implicitly continued lines can carry comments. The indentation of the " "continuation lines is not important. Blank continuation lines are allowed. " @@ -196,11 +197,11 @@ msgid "" "that case they cannot carry comments." msgstr "" -#: ../../reference/lexical_analysis.rst:157 +#: ../../reference/lexical_analysis.rst:158 msgid "Blank lines" msgstr "" -#: ../../reference/lexical_analysis.rst:161 +#: ../../reference/lexical_analysis.rst:162 msgid "" "A logical line that contains only spaces, tabs, formfeeds and possibly a " "comment, is ignored (i.e., no NEWLINE token is generated). During " @@ -211,18 +212,18 @@ msgid "" "statement." msgstr "" -#: ../../reference/lexical_analysis.rst:172 +#: ../../reference/lexical_analysis.rst:173 msgid "Indentation" msgstr "" -#: ../../reference/lexical_analysis.rst:176 +#: ../../reference/lexical_analysis.rst:177 msgid "" "Leading whitespace (spaces and tabs) at the beginning of a logical line is " "used to compute the indentation level of the line, which in turn is used to " "determine the grouping of statements." msgstr "" -#: ../../reference/lexical_analysis.rst:180 +#: ../../reference/lexical_analysis.rst:181 msgid "" "Tabs are replaced (from left to right) by one to eight spaces such that the " "total number of characters up to and including the replacement is a multiple " @@ -233,14 +234,14 @@ msgid "" "the indentation." msgstr "" -#: ../../reference/lexical_analysis.rst:188 +#: ../../reference/lexical_analysis.rst:189 msgid "" "Indentation is rejected as inconsistent if a source file mixes tabs and " "spaces in a way that makes the meaning dependent on the worth of a tab in " "spaces; a :exc:`TabError` is raised in that case." msgstr "" -#: ../../reference/lexical_analysis.rst:192 +#: ../../reference/lexical_analysis.rst:193 msgid "" "**Cross-platform compatibility note:** because of the nature of text editors " "on non-UNIX platforms, it is unwise to use a mixture of spaces and tabs for " @@ -248,7 +249,7 @@ msgid "" "different platforms may explicitly limit the maximum indentation level." msgstr "" -#: ../../reference/lexical_analysis.rst:197 +#: ../../reference/lexical_analysis.rst:198 msgid "" "A formfeed character may be present at the start of the line; it will be " "ignored for the indentation calculations above. Formfeed characters " @@ -256,13 +257,13 @@ msgid "" "instance, they may reset the space count to zero)." msgstr "" -#: ../../reference/lexical_analysis.rst:204 +#: ../../reference/lexical_analysis.rst:205 msgid "" "The indentation levels of consecutive lines are used to generate INDENT and " "DEDENT tokens, using a stack, as follows." msgstr "" -#: ../../reference/lexical_analysis.rst:207 +#: ../../reference/lexical_analysis.rst:208 msgid "" "Before the first line of the file is read, a single zero is pushed on the " "stack; this will never be popped off again. The numbers pushed on the stack " @@ -276,13 +277,13 @@ msgid "" "number remaining on the stack that is larger than zero." msgstr "" -#: ../../reference/lexical_analysis.rst:218 +#: ../../reference/lexical_analysis.rst:219 msgid "" "Here is an example of a correctly (though confusingly) indented piece of " "Python code::" msgstr "" -#: ../../reference/lexical_analysis.rst:221 +#: ../../reference/lexical_analysis.rst:222 msgid "" "def perm(l):\n" " # Compute the list of all permutations of l\n" @@ -297,11 +298,11 @@ msgid "" " return r" msgstr "" -#: ../../reference/lexical_analysis.rst:233 +#: ../../reference/lexical_analysis.rst:234 msgid "The following example shows various indentation errors::" msgstr "" -#: ../../reference/lexical_analysis.rst:235 +#: ../../reference/lexical_analysis.rst:236 msgid "" " def perm(l): # error: first line indented\n" "for i in range(len(l)): # error: not indented\n" @@ -312,18 +313,18 @@ msgid "" " return r # error: inconsistent dedent" msgstr "" -#: ../../reference/lexical_analysis.rst:243 +#: ../../reference/lexical_analysis.rst:244 msgid "" "(Actually, the first three errors are detected by the parser; only the last " "error is found by the lexical analyzer --- the indentation of ``return r`` " "does not match a level popped off the stack.)" msgstr "" -#: ../../reference/lexical_analysis.rst:251 +#: ../../reference/lexical_analysis.rst:252 msgid "Whitespace between tokens" msgstr "" -#: ../../reference/lexical_analysis.rst:253 +#: ../../reference/lexical_analysis.rst:254 msgid "" "Except at the beginning of a logical line or in string literals, the " "whitespace characters space, tab and formfeed can be used interchangeably to " @@ -332,11 +333,11 @@ msgid "" "is one token, but a b is two tokens)." msgstr "" -#: ../../reference/lexical_analysis.rst:263 +#: ../../reference/lexical_analysis.rst:264 msgid "Other tokens" msgstr "" -#: ../../reference/lexical_analysis.rst:265 +#: ../../reference/lexical_analysis.rst:266 msgid "" "Besides NEWLINE, INDENT and DEDENT, the following categories of tokens " "exist: *identifiers*, *keywords*, *literals*, *operators*, and *delimiters*. " @@ -346,24 +347,24 @@ msgid "" "from left to right." msgstr "" -#: ../../reference/lexical_analysis.rst:275 +#: ../../reference/lexical_analysis.rst:276 msgid "Identifiers and keywords" msgstr "" -#: ../../reference/lexical_analysis.rst:279 +#: ../../reference/lexical_analysis.rst:280 msgid "" "Identifiers (also referred to as *names*) are described by the following " "lexical definitions." msgstr "" -#: ../../reference/lexical_analysis.rst:282 +#: ../../reference/lexical_analysis.rst:283 msgid "" "The syntax of identifiers in Python is based on the Unicode standard annex " "UAX-31, with elaboration and changes as defined below; see also :pep:`3131` " "for further details." msgstr "" -#: ../../reference/lexical_analysis.rst:286 +#: ../../reference/lexical_analysis.rst:287 msgid "" "Within the ASCII range (U+0001..U+007F), the valid characters for " "identifiers include the uppercase and lowercase letters ``A`` through ``Z``, " @@ -374,90 +375,90 @@ msgid "" "`unicodedata` module." msgstr "" -#: ../../reference/lexical_analysis.rst:294 +#: ../../reference/lexical_analysis.rst:295 msgid "Identifiers are unlimited in length. Case is significant." msgstr "" -#: ../../reference/lexical_analysis.rst:303 +#: ../../reference/lexical_analysis.rst:304 msgid "The Unicode category codes mentioned above stand for:" msgstr "" -#: ../../reference/lexical_analysis.rst:305 +#: ../../reference/lexical_analysis.rst:306 msgid "*Lu* - uppercase letters" msgstr "*Lu* - 大寫字母" -#: ../../reference/lexical_analysis.rst:306 +#: ../../reference/lexical_analysis.rst:307 msgid "*Ll* - lowercase letters" msgstr "*Ll* - 小寫字母" -#: ../../reference/lexical_analysis.rst:307 +#: ../../reference/lexical_analysis.rst:308 msgid "*Lt* - titlecase letters" msgstr "" -#: ../../reference/lexical_analysis.rst:308 +#: ../../reference/lexical_analysis.rst:309 msgid "*Lm* - modifier letters" msgstr "" -#: ../../reference/lexical_analysis.rst:309 +#: ../../reference/lexical_analysis.rst:310 msgid "*Lo* - other letters" msgstr "*Lo* - 其他字母" -#: ../../reference/lexical_analysis.rst:310 +#: ../../reference/lexical_analysis.rst:311 msgid "*Nl* - letter numbers" msgstr "" -#: ../../reference/lexical_analysis.rst:311 +#: ../../reference/lexical_analysis.rst:312 msgid "*Mn* - nonspacing marks" msgstr "" -#: ../../reference/lexical_analysis.rst:312 +#: ../../reference/lexical_analysis.rst:313 msgid "*Mc* - spacing combining marks" msgstr "" -#: ../../reference/lexical_analysis.rst:313 +#: ../../reference/lexical_analysis.rst:314 msgid "*Nd* - decimal numbers" msgstr "*Nd* - 十進位數字" -#: ../../reference/lexical_analysis.rst:314 +#: ../../reference/lexical_analysis.rst:315 msgid "*Pc* - connector punctuations" msgstr "" -#: ../../reference/lexical_analysis.rst:315 +#: ../../reference/lexical_analysis.rst:316 msgid "" "*Other_ID_Start* - explicit list of characters in `PropList.txt <https://www." "unicode.org/Public/15.1.0/ucd/PropList.txt>`_ to support backwards " "compatibility" msgstr "" -#: ../../reference/lexical_analysis.rst:318 +#: ../../reference/lexical_analysis.rst:319 msgid "*Other_ID_Continue* - likewise" msgstr "" -#: ../../reference/lexical_analysis.rst:320 +#: ../../reference/lexical_analysis.rst:321 msgid "" "All identifiers are converted into the normal form NFKC while parsing; " "comparison of identifiers is based on NFKC." msgstr "" -#: ../../reference/lexical_analysis.rst:323 +#: ../../reference/lexical_analysis.rst:324 msgid "" "A non-normative HTML file listing all valid identifier characters for " "Unicode 15.1.0 can be found at https://www.unicode.org/Public/15.1.0/ucd/" "DerivedCoreProperties.txt" msgstr "" -#: ../../reference/lexical_analysis.rst:331 +#: ../../reference/lexical_analysis.rst:332 msgid "Keywords" msgstr "關鍵字" -#: ../../reference/lexical_analysis.rst:337 +#: ../../reference/lexical_analysis.rst:338 msgid "" "The following identifiers are used as reserved words, or *keywords* of the " "language, and cannot be used as ordinary identifiers. They must be spelled " "exactly as written here:" msgstr "" -#: ../../reference/lexical_analysis.rst:341 +#: ../../reference/lexical_analysis.rst:342 msgid "" "False await else import pass\n" "None break except in raise\n" @@ -475,11 +476,11 @@ msgstr "" "assert del global not with\n" "async elif if or yield" -#: ../../reference/lexical_analysis.rst:355 +#: ../../reference/lexical_analysis.rst:356 msgid "Soft Keywords" msgstr "軟關鍵字" -#: ../../reference/lexical_analysis.rst:361 +#: ../../reference/lexical_analysis.rst:362 msgid "" "Some identifiers are only reserved under specific contexts. These are known " "as *soft keywords*. The identifiers ``match``, ``case``, ``type`` and ``_`` " @@ -487,82 +488,82 @@ msgid "" "is done at the parser level, not when tokenizing." msgstr "" -#: ../../reference/lexical_analysis.rst:366 +#: ../../reference/lexical_analysis.rst:367 msgid "" "As soft keywords, their use in the grammar is possible while still " "preserving compatibility with existing code that uses these names as " "identifier names." msgstr "" -#: ../../reference/lexical_analysis.rst:370 +#: ../../reference/lexical_analysis.rst:371 msgid "" "``match``, ``case``, and ``_`` are used in the :keyword:`match` statement. " "``type`` is used in the :keyword:`type` statement." msgstr "" -#: ../../reference/lexical_analysis.rst:373 +#: ../../reference/lexical_analysis.rst:374 msgid "``type`` is now a soft keyword." msgstr "``type`` 現在是軟關鍵字。" -#: ../../reference/lexical_analysis.rst:382 +#: ../../reference/lexical_analysis.rst:383 msgid "Reserved classes of identifiers" msgstr "" -#: ../../reference/lexical_analysis.rst:384 +#: ../../reference/lexical_analysis.rst:385 msgid "" "Certain classes of identifiers (besides keywords) have special meanings. " "These classes are identified by the patterns of leading and trailing " "underscore characters:" msgstr "" -#: ../../reference/lexical_analysis.rst:388 +#: ../../reference/lexical_analysis.rst:389 msgid "``_*``" msgstr "``_*``" -#: ../../reference/lexical_analysis.rst:389 +#: ../../reference/lexical_analysis.rst:390 msgid "Not imported by ``from module import *``." msgstr "" -#: ../../reference/lexical_analysis.rst:391 +#: ../../reference/lexical_analysis.rst:392 msgid "``_``" msgstr "``_``" -#: ../../reference/lexical_analysis.rst:392 +#: ../../reference/lexical_analysis.rst:393 msgid "" "In a ``case`` pattern within a :keyword:`match` statement, ``_`` is a :ref:" "`soft keyword <soft-keywords>` that denotes a :ref:`wildcard <wildcard-" "patterns>`." msgstr "" -#: ../../reference/lexical_analysis.rst:396 +#: ../../reference/lexical_analysis.rst:397 msgid "" "Separately, the interactive interpreter makes the result of the last " "evaluation available in the variable ``_``. (It is stored in the :mod:" "`builtins` module, alongside built-in functions like ``print``.)" msgstr "" -#: ../../reference/lexical_analysis.rst:401 +#: ../../reference/lexical_analysis.rst:402 msgid "" "Elsewhere, ``_`` is a regular identifier. It is often used to name " "\"special\" items, but it is not special to Python itself." msgstr "" -#: ../../reference/lexical_analysis.rst:406 +#: ../../reference/lexical_analysis.rst:407 msgid "" "The name ``_`` is often used in conjunction with internationalization; refer " "to the documentation for the :mod:`gettext` module for more information on " "this convention." msgstr "" -#: ../../reference/lexical_analysis.rst:410 +#: ../../reference/lexical_analysis.rst:411 msgid "It is also commonly used for unused variables." msgstr "" -#: ../../reference/lexical_analysis.rst:412 +#: ../../reference/lexical_analysis.rst:413 msgid "``__*__``" msgstr "``__*__``" -#: ../../reference/lexical_analysis.rst:413 +#: ../../reference/lexical_analysis.rst:414 msgid "" "System-defined names, informally known as \"dunder\" names. These names are " "defined by the interpreter and its implementation (including the standard " @@ -572,11 +573,11 @@ msgid "" "explicitly documented use, is subject to breakage without warning." msgstr "" -#: ../../reference/lexical_analysis.rst:420 +#: ../../reference/lexical_analysis.rst:421 msgid "``__*``" msgstr "``__*``" -#: ../../reference/lexical_analysis.rst:421 +#: ../../reference/lexical_analysis.rst:422 msgid "" "Class-private names. Names in this category, when used within the context " "of a class definition, are re-written to use a mangled form to help avoid " @@ -584,23 +585,23 @@ msgid "" "section :ref:`atom-identifiers`." msgstr "" -#: ../../reference/lexical_analysis.rst:430 +#: ../../reference/lexical_analysis.rst:431 msgid "Literals" msgstr "" -#: ../../reference/lexical_analysis.rst:434 +#: ../../reference/lexical_analysis.rst:435 msgid "Literals are notations for constant values of some built-in types." msgstr "" -#: ../../reference/lexical_analysis.rst:445 +#: ../../reference/lexical_analysis.rst:446 msgid "String and Bytes literals" msgstr "" -#: ../../reference/lexical_analysis.rst:447 +#: ../../reference/lexical_analysis.rst:448 msgid "String literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:472 +#: ../../reference/lexical_analysis.rst:473 msgid "" "One syntactic restriction not indicated by these productions is that " "whitespace is not allowed between the :token:`~python-grammar:stringprefix` " @@ -610,7 +611,7 @@ msgid "" "`encodings`." msgstr "" -#: ../../reference/lexical_analysis.rst:482 +#: ../../reference/lexical_analysis.rst:483 msgid "" "In plain English: Both types of literals can be enclosed in matching single " "quotes (``'``) or double quotes (``\"``). They can also be enclosed in " @@ -623,7 +624,7 @@ msgid "" "sequences>` below for examples." msgstr "" -#: ../../reference/lexical_analysis.rst:495 +#: ../../reference/lexical_analysis.rst:496 msgid "" "Bytes literals are always prefixed with ``'b'`` or ``'B'``; they produce an " "instance of the :class:`bytes` type instead of the :class:`str` type. They " @@ -631,7 +632,7 @@ msgid "" "greater must be expressed with escapes." msgstr "" -#: ../../reference/lexical_analysis.rst:504 +#: ../../reference/lexical_analysis.rst:505 msgid "" "Both string and bytes literals may optionally be prefixed with a letter " "``'r'`` or ``'R'``; such constructs are called :dfn:`raw string literals` " @@ -640,20 +641,20 @@ msgid "" "escapes are not treated specially." msgstr "" -#: ../../reference/lexical_analysis.rst:510 +#: ../../reference/lexical_analysis.rst:511 msgid "" "The ``'rb'`` prefix of raw bytes literals has been added as a synonym of " "``'br'``." msgstr "" -#: ../../reference/lexical_analysis.rst:514 +#: ../../reference/lexical_analysis.rst:515 msgid "" "Support for the unicode legacy literal (``u'value'``) was reintroduced to " "simplify the maintenance of dual Python 2.x and 3.x codebases. See :pep:" "`414` for more information." msgstr "" -#: ../../reference/lexical_analysis.rst:522 +#: ../../reference/lexical_analysis.rst:523 msgid "" "A string literal with ``'f'`` or ``'F'`` in its prefix is a :dfn:`formatted " "string literal`; see :ref:`f-strings`. The ``'f'`` may be combined with " @@ -661,7 +662,7 @@ msgid "" "are possible, but formatted bytes literals are not." msgstr "" -#: ../../reference/lexical_analysis.rst:527 +#: ../../reference/lexical_analysis.rst:528 msgid "" "In triple-quoted literals, unescaped newlines and quotes are allowed (and " "are retained), except that three unescaped quotes in a row terminate the " @@ -669,253 +670,253 @@ msgid "" "either ``'`` or ``\"``.)" msgstr "" -#: ../../reference/lexical_analysis.rst:550 +#: ../../reference/lexical_analysis.rst:551 msgid "Escape sequences" msgstr "跳脫序列" -#: ../../reference/lexical_analysis.rst:552 +#: ../../reference/lexical_analysis.rst:553 msgid "" "Unless an ``'r'`` or ``'R'`` prefix is present, escape sequences in string " "and bytes literals are interpreted according to rules similar to those used " "by Standard C. The recognized escape sequences are:" msgstr "" -#: ../../reference/lexical_analysis.rst:557 -#: ../../reference/lexical_analysis.rst:590 +#: ../../reference/lexical_analysis.rst:558 +#: ../../reference/lexical_analysis.rst:591 msgid "Escape Sequence" msgstr "" -#: ../../reference/lexical_analysis.rst:557 -#: ../../reference/lexical_analysis.rst:590 +#: ../../reference/lexical_analysis.rst:558 +#: ../../reference/lexical_analysis.rst:591 msgid "Meaning" msgstr "含義" -#: ../../reference/lexical_analysis.rst:557 -#: ../../reference/lexical_analysis.rst:590 +#: ../../reference/lexical_analysis.rst:558 +#: ../../reference/lexical_analysis.rst:591 msgid "Notes" msgstr "註解" -#: ../../reference/lexical_analysis.rst:559 +#: ../../reference/lexical_analysis.rst:560 msgid "``\\``\\ <newline>" msgstr "``\\``\\ <newline>" -#: ../../reference/lexical_analysis.rst:559 +#: ../../reference/lexical_analysis.rst:560 msgid "Backslash and newline ignored" msgstr "" -#: ../../reference/lexical_analysis.rst:559 +#: ../../reference/lexical_analysis.rst:560 msgid "\\(1)" msgstr "\\(1)" -#: ../../reference/lexical_analysis.rst:561 +#: ../../reference/lexical_analysis.rst:562 msgid "``\\\\``" msgstr "``\\\\``" -#: ../../reference/lexical_analysis.rst:561 +#: ../../reference/lexical_analysis.rst:562 msgid "Backslash (``\\``)" msgstr "" -#: ../../reference/lexical_analysis.rst:563 +#: ../../reference/lexical_analysis.rst:564 msgid "``\\'``" msgstr "``\\'``" -#: ../../reference/lexical_analysis.rst:563 +#: ../../reference/lexical_analysis.rst:564 msgid "Single quote (``'``)" msgstr "單引號 (``'``)" -#: ../../reference/lexical_analysis.rst:565 +#: ../../reference/lexical_analysis.rst:566 msgid "``\\\"``" msgstr "``\\\"``" -#: ../../reference/lexical_analysis.rst:565 +#: ../../reference/lexical_analysis.rst:566 msgid "Double quote (``\"``)" msgstr "雙引號 (``\"``)" -#: ../../reference/lexical_analysis.rst:567 +#: ../../reference/lexical_analysis.rst:568 msgid "``\\a``" msgstr "``\\a``" -#: ../../reference/lexical_analysis.rst:567 +#: ../../reference/lexical_analysis.rst:568 msgid "ASCII Bell (BEL)" msgstr "" -#: ../../reference/lexical_analysis.rst:569 +#: ../../reference/lexical_analysis.rst:570 msgid "``\\b``" msgstr "``\\b``" -#: ../../reference/lexical_analysis.rst:569 +#: ../../reference/lexical_analysis.rst:570 msgid "ASCII Backspace (BS)" msgstr "" -#: ../../reference/lexical_analysis.rst:571 +#: ../../reference/lexical_analysis.rst:572 msgid "``\\f``" msgstr "``\\f``" -#: ../../reference/lexical_analysis.rst:571 +#: ../../reference/lexical_analysis.rst:572 msgid "ASCII Formfeed (FF)" msgstr "" -#: ../../reference/lexical_analysis.rst:573 +#: ../../reference/lexical_analysis.rst:574 msgid "``\\n``" msgstr "``\\n``" -#: ../../reference/lexical_analysis.rst:573 +#: ../../reference/lexical_analysis.rst:574 msgid "ASCII Linefeed (LF)" msgstr "" -#: ../../reference/lexical_analysis.rst:575 +#: ../../reference/lexical_analysis.rst:576 msgid "``\\r``" msgstr "``\\r``" -#: ../../reference/lexical_analysis.rst:575 +#: ../../reference/lexical_analysis.rst:576 msgid "ASCII Carriage Return (CR)" msgstr "" -#: ../../reference/lexical_analysis.rst:577 +#: ../../reference/lexical_analysis.rst:578 msgid "``\\t``" msgstr "``\\t``" -#: ../../reference/lexical_analysis.rst:577 +#: ../../reference/lexical_analysis.rst:578 msgid "ASCII Horizontal Tab (TAB)" msgstr "" -#: ../../reference/lexical_analysis.rst:579 +#: ../../reference/lexical_analysis.rst:580 msgid "``\\v``" msgstr "``\\v``" -#: ../../reference/lexical_analysis.rst:579 +#: ../../reference/lexical_analysis.rst:580 msgid "ASCII Vertical Tab (VT)" msgstr "" -#: ../../reference/lexical_analysis.rst:581 +#: ../../reference/lexical_analysis.rst:582 msgid ":samp:`\\\\\\\\{ooo}`" msgstr ":samp:`\\\\\\\\{ooo}`" -#: ../../reference/lexical_analysis.rst:581 +#: ../../reference/lexical_analysis.rst:582 msgid "Character with octal value *ooo*" msgstr "" -#: ../../reference/lexical_analysis.rst:581 +#: ../../reference/lexical_analysis.rst:582 msgid "(2,4)" msgstr "(2,4)" -#: ../../reference/lexical_analysis.rst:584 +#: ../../reference/lexical_analysis.rst:585 msgid ":samp:`\\\\x{hh}`" msgstr ":samp:`\\\\x{hh}`" -#: ../../reference/lexical_analysis.rst:584 +#: ../../reference/lexical_analysis.rst:585 msgid "Character with hex value *hh*" msgstr "" -#: ../../reference/lexical_analysis.rst:584 +#: ../../reference/lexical_analysis.rst:585 msgid "(3,4)" msgstr "(3,4)" -#: ../../reference/lexical_analysis.rst:587 +#: ../../reference/lexical_analysis.rst:588 msgid "Escape sequences only recognized in string literals are:" msgstr "" -#: ../../reference/lexical_analysis.rst:592 +#: ../../reference/lexical_analysis.rst:593 msgid ":samp:`\\\\N\\\\{{name}\\\\}`" msgstr ":samp:`\\\\N\\\\{{name}\\\\}`" -#: ../../reference/lexical_analysis.rst:592 +#: ../../reference/lexical_analysis.rst:593 msgid "Character named *name* in the Unicode database" msgstr "" -#: ../../reference/lexical_analysis.rst:592 +#: ../../reference/lexical_analysis.rst:593 msgid "\\(5)" msgstr "\\(5)" -#: ../../reference/lexical_analysis.rst:595 +#: ../../reference/lexical_analysis.rst:596 msgid ":samp:`\\\\u{xxxx}`" msgstr ":samp:`\\\\u{xxxx}`" -#: ../../reference/lexical_analysis.rst:595 +#: ../../reference/lexical_analysis.rst:596 msgid "Character with 16-bit hex value *xxxx*" msgstr "" -#: ../../reference/lexical_analysis.rst:595 +#: ../../reference/lexical_analysis.rst:596 msgid "\\(6)" msgstr "\\(6)" -#: ../../reference/lexical_analysis.rst:598 +#: ../../reference/lexical_analysis.rst:599 msgid ":samp:`\\\\U{xxxxxxxx}`" msgstr ":samp:`\\\\U{xxxxxxxx}`" -#: ../../reference/lexical_analysis.rst:598 +#: ../../reference/lexical_analysis.rst:599 msgid "Character with 32-bit hex value *xxxxxxxx*" msgstr "" -#: ../../reference/lexical_analysis.rst:598 +#: ../../reference/lexical_analysis.rst:599 msgid "\\(7)" msgstr "\\(7)" -#: ../../reference/lexical_analysis.rst:602 +#: ../../reference/lexical_analysis.rst:603 msgid "Notes:" msgstr "註解:" -#: ../../reference/lexical_analysis.rst:605 +#: ../../reference/lexical_analysis.rst:606 msgid "A backslash can be added at the end of a line to ignore the newline::" msgstr "" -#: ../../reference/lexical_analysis.rst:607 +#: ../../reference/lexical_analysis.rst:608 msgid "" ">>> 'This string will not include \\\n" "... backslashes or newline characters.'\n" "'This string will not include backslashes or newline characters.'" msgstr "" -#: ../../reference/lexical_analysis.rst:611 +#: ../../reference/lexical_analysis.rst:612 msgid "" "The same result can be achieved using :ref:`triple-quoted strings " "<strings>`, or parentheses and :ref:`string literal concatenation <string-" "concatenation>`." msgstr "" -#: ../../reference/lexical_analysis.rst:616 +#: ../../reference/lexical_analysis.rst:617 msgid "As in Standard C, up to three octal digits are accepted." msgstr "" -#: ../../reference/lexical_analysis.rst:618 +#: ../../reference/lexical_analysis.rst:619 msgid "" "Octal escapes with value larger than ``0o377`` produce a :exc:" "`DeprecationWarning`." msgstr "" -#: ../../reference/lexical_analysis.rst:622 +#: ../../reference/lexical_analysis.rst:623 msgid "" "Octal escapes with value larger than ``0o377`` produce a :exc:" "`SyntaxWarning`. In a future Python version they will be eventually a :exc:" "`SyntaxError`." msgstr "" -#: ../../reference/lexical_analysis.rst:628 +#: ../../reference/lexical_analysis.rst:629 msgid "Unlike in Standard C, exactly two hex digits are required." msgstr "" -#: ../../reference/lexical_analysis.rst:631 +#: ../../reference/lexical_analysis.rst:632 msgid "" "In a bytes literal, hexadecimal and octal escapes denote the byte with the " "given value. In a string literal, these escapes denote a Unicode character " "with the given value." msgstr "" -#: ../../reference/lexical_analysis.rst:636 +#: ../../reference/lexical_analysis.rst:637 msgid "Support for name aliases [#]_ has been added." msgstr "" -#: ../../reference/lexical_analysis.rst:640 +#: ../../reference/lexical_analysis.rst:641 msgid "Exactly four hex digits are required." msgstr "" -#: ../../reference/lexical_analysis.rst:643 +#: ../../reference/lexical_analysis.rst:644 msgid "" "Any Unicode character can be encoded this way. Exactly eight hex digits are " "required." msgstr "" -#: ../../reference/lexical_analysis.rst:649 +#: ../../reference/lexical_analysis.rst:650 msgid "" "Unlike Standard C, all unrecognized escape sequences are left in the string " "unchanged, i.e., *the backslash is left in the result*. (This behavior is " @@ -925,17 +926,17 @@ msgid "" "category of unrecognized escapes for bytes literals." msgstr "" -#: ../../reference/lexical_analysis.rst:656 +#: ../../reference/lexical_analysis.rst:657 msgid "Unrecognized escape sequences produce a :exc:`DeprecationWarning`." msgstr "" -#: ../../reference/lexical_analysis.rst:659 +#: ../../reference/lexical_analysis.rst:660 msgid "" "Unrecognized escape sequences produce a :exc:`SyntaxWarning`. In a future " "Python version they will be eventually a :exc:`SyntaxError`." msgstr "" -#: ../../reference/lexical_analysis.rst:663 +#: ../../reference/lexical_analysis.rst:664 msgid "" "Even in a raw literal, quotes can be escaped with a backslash, but the " "backslash remains in the result; for example, ``r\"\\\"\"`` is a valid " @@ -948,11 +949,11 @@ msgid "" "continuation." msgstr "" -#: ../../reference/lexical_analysis.rst:676 +#: ../../reference/lexical_analysis.rst:677 msgid "String literal concatenation" msgstr "" -#: ../../reference/lexical_analysis.rst:678 +#: ../../reference/lexical_analysis.rst:679 msgid "" "Multiple adjacent string or bytes literals (delimited by whitespace), " "possibly using different quoting conventions, are allowed, and their meaning " @@ -962,14 +963,14 @@ msgid "" "lines, or even to add comments to parts of strings, for example::" msgstr "" -#: ../../reference/lexical_analysis.rst:685 +#: ../../reference/lexical_analysis.rst:686 msgid "" "re.compile(\"[A-Za-z_]\" # letter or underscore\n" " \"[A-Za-z0-9_]*\" # letter, digit or underscore\n" " )" msgstr "" -#: ../../reference/lexical_analysis.rst:689 +#: ../../reference/lexical_analysis.rst:690 msgid "" "Note that this feature is defined at the syntactical level, but implemented " "at compile time. The '+' operator must be used to concatenate string " @@ -979,11 +980,11 @@ msgid "" "with plain string literals." msgstr "" -#: ../../reference/lexical_analysis.rst:712 +#: ../../reference/lexical_analysis.rst:713 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../reference/lexical_analysis.rst:716 +#: ../../reference/lexical_analysis.rst:717 msgid "" "A :dfn:`formatted string literal` or :dfn:`f-string` is a string literal " "that is prefixed with ``'f'`` or ``'F'``. These strings may contain " @@ -992,14 +993,14 @@ msgid "" "are really expressions evaluated at run time." msgstr "" -#: ../../reference/lexical_analysis.rst:722 +#: ../../reference/lexical_analysis.rst:723 msgid "" "Escape sequences are decoded like in ordinary string literals (except when a " "literal is also marked as a raw string). After decoding, the grammar for " "the contents of the string is:" msgstr "" -#: ../../reference/lexical_analysis.rst:736 +#: ../../reference/lexical_analysis.rst:737 msgid "" "The parts of the string outside curly braces are treated literally, except " "that any doubled curly braces ``'{{'`` or ``'}}'`` are replaced with the " @@ -1012,7 +1013,7 @@ msgid "" "replacement field ends with a closing curly bracket ``'}'``." msgstr "" -#: ../../reference/lexical_analysis.rst:746 +#: ../../reference/lexical_analysis.rst:747 msgid "" "Expressions in formatted string literals are treated like regular Python " "expressions surrounded by parentheses, with a few exceptions. An empty " @@ -1026,27 +1027,27 @@ msgid "" "replacement fields must be closed in a different line." msgstr "" -#: ../../reference/lexical_analysis.rst:757 +#: ../../reference/lexical_analysis.rst:758 msgid "" ">>> f\"abc{a # This is a comment }\"\n" "... + 3}\"\n" "'abc5'" msgstr "" -#: ../../reference/lexical_analysis.rst:763 +#: ../../reference/lexical_analysis.rst:764 msgid "" "Prior to Python 3.7, an :keyword:`await` expression and comprehensions " "containing an :keyword:`async for` clause were illegal in the expressions in " "formatted string literals due to a problem with the implementation." msgstr "" -#: ../../reference/lexical_analysis.rst:768 +#: ../../reference/lexical_analysis.rst:769 msgid "" "Prior to Python 3.12, comments were not allowed inside f-string replacement " "fields." msgstr "" -#: ../../reference/lexical_analysis.rst:772 +#: ../../reference/lexical_analysis.rst:773 msgid "" "When the equal sign ``'='`` is provided, the output will have the expression " "text, the ``'='`` and the evaluated value. Spaces after the opening brace " @@ -1057,18 +1058,18 @@ msgid "" "r'`` is declared." msgstr "" -#: ../../reference/lexical_analysis.rst:780 +#: ../../reference/lexical_analysis.rst:781 msgid "The equal sign ``'='``." msgstr "等號 ``'='``。" -#: ../../reference/lexical_analysis.rst:783 +#: ../../reference/lexical_analysis.rst:784 msgid "" "If a conversion is specified, the result of evaluating the expression is " "converted before formatting. Conversion ``'!s'`` calls :func:`str` on the " "result, ``'!r'`` calls :func:`repr`, and ``'!a'`` calls :func:`ascii`." msgstr "" -#: ../../reference/lexical_analysis.rst:787 +#: ../../reference/lexical_analysis.rst:788 msgid "" "The result is then formatted using the :func:`format` protocol. The format " "specifier is passed to the :meth:`~object.__format__` method of the " @@ -1077,7 +1078,7 @@ msgid "" "value of the whole string." msgstr "" -#: ../../reference/lexical_analysis.rst:793 +#: ../../reference/lexical_analysis.rst:794 msgid "" "Top-level format specifiers may include nested replacement fields. These " "nested fields may include their own conversion fields and :ref:`format " @@ -1086,17 +1087,17 @@ msgid "" "as that used by the :meth:`str.format` method." msgstr "" -#: ../../reference/lexical_analysis.rst:799 +#: ../../reference/lexical_analysis.rst:800 msgid "" "Formatted string literals may be concatenated, but replacement fields cannot " "be split across literals." msgstr "" -#: ../../reference/lexical_analysis.rst:802 +#: ../../reference/lexical_analysis.rst:803 msgid "Some examples of formatted string literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:804 +#: ../../reference/lexical_analysis.rst:805 msgid "" ">>> name = \"Fred\"\n" ">>> f\"He said his name is {name!r}.\"\n" @@ -1128,13 +1129,13 @@ msgid "" "'line = \"The mill\\'s closed\" '" msgstr "" -#: ../../reference/lexical_analysis.rst:834 +#: ../../reference/lexical_analysis.rst:835 msgid "" "Reusing the outer f-string quoting type inside a replacement field is " "permitted::" msgstr "" -#: ../../reference/lexical_analysis.rst:837 +#: ../../reference/lexical_analysis.rst:838 msgid "" ">>> a = dict(x=2)\n" ">>> f\"abc {a[\"x\"]} def\"\n" @@ -1144,19 +1145,19 @@ msgstr "" ">>> f\"abc {a[\"x\"]} def\"\n" "'abc 2 def'" -#: ../../reference/lexical_analysis.rst:841 +#: ../../reference/lexical_analysis.rst:842 msgid "" "Prior to Python 3.12, reuse of the same quoting type of the outer f-string " "inside a replacement field was not possible." msgstr "" -#: ../../reference/lexical_analysis.rst:845 +#: ../../reference/lexical_analysis.rst:846 msgid "" "Backslashes are also allowed in replacement fields and are evaluated the " "same way as in any other context::" msgstr "" -#: ../../reference/lexical_analysis.rst:848 +#: ../../reference/lexical_analysis.rst:849 msgid "" ">>> a = [\"a\", \"b\", \"c\"]\n" ">>> print(f\"List a contains:\\n{\"\\n\".join(a)}\")\n" @@ -1172,19 +1173,19 @@ msgstr "" "b\n" "c" -#: ../../reference/lexical_analysis.rst:855 +#: ../../reference/lexical_analysis.rst:856 msgid "" "Prior to Python 3.12, backslashes were not permitted inside an f-string " "replacement field." msgstr "" -#: ../../reference/lexical_analysis.rst:859 +#: ../../reference/lexical_analysis.rst:860 msgid "" "Formatted string literals cannot be used as docstrings, even if they do not " "include expressions." msgstr "" -#: ../../reference/lexical_analysis.rst:864 +#: ../../reference/lexical_analysis.rst:865 msgid "" ">>> def foo():\n" "... f\"Not a docstring\"\n" @@ -1193,63 +1194,63 @@ msgid "" "True" msgstr "" -#: ../../reference/lexical_analysis.rst:870 +#: ../../reference/lexical_analysis.rst:871 msgid "" "See also :pep:`498` for the proposal that added formatted string literals, " "and :meth:`str.format`, which uses a related format string mechanism." msgstr "" -#: ../../reference/lexical_analysis.rst:877 +#: ../../reference/lexical_analysis.rst:878 msgid "Numeric literals" msgstr "" -#: ../../reference/lexical_analysis.rst:883 +#: ../../reference/lexical_analysis.rst:884 msgid "" "There are three types of numeric literals: integers, floating-point numbers, " "and imaginary numbers. There are no complex literals (complex numbers can " "be formed by adding a real number and an imaginary number)." msgstr "" -#: ../../reference/lexical_analysis.rst:887 +#: ../../reference/lexical_analysis.rst:888 msgid "" "Note that numeric literals do not include a sign; a phrase like ``-1`` is " "actually an expression composed of the unary operator '``-``' and the " "literal ``1``." msgstr "" -#: ../../reference/lexical_analysis.rst:901 +#: ../../reference/lexical_analysis.rst:902 msgid "Integer literals" msgstr "" -#: ../../reference/lexical_analysis.rst:903 +#: ../../reference/lexical_analysis.rst:904 msgid "Integer literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:917 +#: ../../reference/lexical_analysis.rst:918 msgid "" "There is no limit for the length of integer literals apart from what can be " "stored in available memory." msgstr "" -#: ../../reference/lexical_analysis.rst:920 +#: ../../reference/lexical_analysis.rst:921 msgid "" "Underscores are ignored for determining the numeric value of the literal. " "They can be used to group digits for enhanced readability. One underscore " "can occur between digits, and after base specifiers like ``0x``." msgstr "" -#: ../../reference/lexical_analysis.rst:924 +#: ../../reference/lexical_analysis.rst:925 msgid "" "Note that leading zeros in a non-zero decimal number are not allowed. This " "is for disambiguation with C-style octal literals, which Python used before " "version 3.0." msgstr "" -#: ../../reference/lexical_analysis.rst:928 +#: ../../reference/lexical_analysis.rst:929 msgid "Some examples of integer literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:930 +#: ../../reference/lexical_analysis.rst:931 msgid "" "7 2147483647 0o177 0b100110111\n" "3 79228162514264337593543950336 0o377 0xdeadbeef\n" @@ -1259,21 +1260,21 @@ msgstr "" "3 79228162514264337593543950336 0o377 0xdeadbeef\n" " 100_000_000_000 0b_1110_0101" -#: ../../reference/lexical_analysis.rst:934 -#: ../../reference/lexical_analysis.rst:966 +#: ../../reference/lexical_analysis.rst:935 +#: ../../reference/lexical_analysis.rst:967 msgid "Underscores are now allowed for grouping purposes in literals." msgstr "" -#: ../../reference/lexical_analysis.rst:945 +#: ../../reference/lexical_analysis.rst:946 msgid "Floating-point literals" msgstr "浮點數常數 (Floating-point literals)" -#: ../../reference/lexical_analysis.rst:947 +#: ../../reference/lexical_analysis.rst:948 msgid "" "Floating-point literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:957 +#: ../../reference/lexical_analysis.rst:958 msgid "" "Note that the integer and exponent parts are always interpreted using radix " "10. For example, ``077e010`` is legal, and denotes the same number as " @@ -1282,23 +1283,23 @@ msgid "" "grouping." msgstr "" -#: ../../reference/lexical_analysis.rst:962 +#: ../../reference/lexical_analysis.rst:963 msgid "Some examples of floating-point literals::" msgstr "一些浮點數常數的範例: ::" -#: ../../reference/lexical_analysis.rst:964 +#: ../../reference/lexical_analysis.rst:965 msgid "3.14 10. .001 1e100 3.14e-10 0e0 3.14_15_93" msgstr "3.14 10. .001 1e100 3.14e-10 0e0 3.14_15_93" -#: ../../reference/lexical_analysis.rst:975 +#: ../../reference/lexical_analysis.rst:976 msgid "Imaginary literals" msgstr "" -#: ../../reference/lexical_analysis.rst:977 +#: ../../reference/lexical_analysis.rst:978 msgid "Imaginary literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:982 +#: ../../reference/lexical_analysis.rst:983 msgid "" "An imaginary literal yields a complex number with a real part of 0.0. " "Complex numbers are represented as a pair of floating-point numbers and have " @@ -1307,19 +1308,19 @@ msgid "" "Some examples of imaginary literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:988 +#: ../../reference/lexical_analysis.rst:989 msgid "3.14j 10.j 10j .001j 1e100j 3.14e-10j 3.14_15_93j" msgstr "3.14j 10.j 10j .001j 1e100j 3.14e-10j 3.14_15_93j" -#: ../../reference/lexical_analysis.rst:994 +#: ../../reference/lexical_analysis.rst:995 msgid "Operators" msgstr "" -#: ../../reference/lexical_analysis.rst:998 +#: ../../reference/lexical_analysis.rst:999 msgid "The following tokens are operators:" msgstr "" -#: ../../reference/lexical_analysis.rst:1000 +#: ../../reference/lexical_analysis.rst:1001 msgid "" "+ - * ** / // % @\n" "<< >> & | ^ ~ :=\n" @@ -1329,15 +1330,15 @@ msgstr "" "<< >> & | ^ ~ :=\n" "< > <= >= == !=" -#: ../../reference/lexical_analysis.rst:1011 +#: ../../reference/lexical_analysis.rst:1012 msgid "Delimiters" msgstr "" -#: ../../reference/lexical_analysis.rst:1015 +#: ../../reference/lexical_analysis.rst:1016 msgid "The following tokens serve as delimiters in the grammar:" msgstr "" -#: ../../reference/lexical_analysis.rst:1017 +#: ../../reference/lexical_analysis.rst:1018 msgid "" "( ) [ ] { }\n" ", : ! . ; @ =\n" @@ -1349,7 +1350,7 @@ msgstr "" "-> += -= *= /= //= %=\n" "@= &= |= ^= >>= <<= **=" -#: ../../reference/lexical_analysis.rst:1024 +#: ../../reference/lexical_analysis.rst:1025 msgid "" "The period can also occur in floating-point and imaginary literals. A " "sequence of three periods has a special meaning as an ellipsis literal. The " @@ -1357,31 +1358,31 @@ msgid "" "as delimiters, but also perform an operation." msgstr "" -#: ../../reference/lexical_analysis.rst:1029 +#: ../../reference/lexical_analysis.rst:1030 msgid "" "The following printing ASCII characters have special meaning as part of " "other tokens or are otherwise significant to the lexical analyzer:" msgstr "" -#: ../../reference/lexical_analysis.rst:1032 +#: ../../reference/lexical_analysis.rst:1033 msgid "' \" # \\" msgstr "' \" # \\" -#: ../../reference/lexical_analysis.rst:1036 +#: ../../reference/lexical_analysis.rst:1037 msgid "" "The following printing ASCII characters are not used in Python. Their " "occurrence outside string literals and comments is an unconditional error:" msgstr "" -#: ../../reference/lexical_analysis.rst:1039 +#: ../../reference/lexical_analysis.rst:1040 msgid "$ ? `" msgstr "$ ? `" -#: ../../reference/lexical_analysis.rst:1045 +#: ../../reference/lexical_analysis.rst:1046 msgid "Footnotes" msgstr "註解" -#: ../../reference/lexical_analysis.rst:1046 +#: ../../reference/lexical_analysis.rst:1047 msgid "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" msgstr "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" @@ -1397,415 +1398,415 @@ msgstr "parser(剖析器)" msgid "token" msgstr "token" -#: ../../reference/lexical_analysis.rst:25 +#: ../../reference/lexical_analysis.rst:26 msgid "line structure" msgstr "line structure(列結構)" -#: ../../reference/lexical_analysis.rst:35 +#: ../../reference/lexical_analysis.rst:36 msgid "logical line" msgstr "logical line(邏輯列)" -#: ../../reference/lexical_analysis.rst:35 -#: ../../reference/lexical_analysis.rst:114 -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:36 +#: ../../reference/lexical_analysis.rst:115 +#: ../../reference/lexical_analysis.rst:532 msgid "physical line" msgstr "physical line(物理列)" -#: ../../reference/lexical_analysis.rst:35 -#: ../../reference/lexical_analysis.rst:114 +#: ../../reference/lexical_analysis.rst:36 +#: ../../reference/lexical_analysis.rst:115 msgid "line joining" msgstr "line joining(列連接)" -#: ../../reference/lexical_analysis.rst:35 +#: ../../reference/lexical_analysis.rst:36 msgid "NEWLINE token" msgstr "NEWLINE token(換行標誌)" -#: ../../reference/lexical_analysis.rst:67 +#: ../../reference/lexical_analysis.rst:68 msgid "comment" msgstr "comment(註解)" -#: ../../reference/lexical_analysis.rst:67 +#: ../../reference/lexical_analysis.rst:68 msgid "hash character" msgstr "hash character(井字號)" -#: ../../reference/lexical_analysis.rst:67 -#: ../../reference/lexical_analysis.rst:81 +#: ../../reference/lexical_analysis.rst:68 +#: ../../reference/lexical_analysis.rst:82 msgid "# (hash)" msgstr "# (井字號)" -#: ../../reference/lexical_analysis.rst:81 +#: ../../reference/lexical_analysis.rst:82 msgid "source character set" msgstr "source character set(原始字元集合)" -#: ../../reference/lexical_analysis.rst:81 +#: ../../reference/lexical_analysis.rst:82 msgid "encoding declarations (source file)" msgstr "encoding declarations (source file)(編碼宣告(原始檔案))" -#: ../../reference/lexical_analysis.rst:81 +#: ../../reference/lexical_analysis.rst:82 msgid "source encoding declaration" msgstr "source encoding declaration(原始編碼宣告)" -#: ../../reference/lexical_analysis.rst:114 +#: ../../reference/lexical_analysis.rst:115 msgid "line continuation" msgstr "line continuation(列延續)" -#: ../../reference/lexical_analysis.rst:114 +#: ../../reference/lexical_analysis.rst:115 msgid "backslash character" msgstr "backslash character(反斜線字元)" -#: ../../reference/lexical_analysis.rst:159 +#: ../../reference/lexical_analysis.rst:160 msgid "blank line" msgstr "blank line(空白列)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "indentation" msgstr "indentation(縮排)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "leading whitespace" msgstr "leading whitespace(前置空白)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "space" msgstr "space(空白)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "tab" msgstr "tab(定位字元)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "grouping" msgstr "grouping(群組)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "statement grouping" msgstr "statement grouping(陳述式群組)" -#: ../../reference/lexical_analysis.rst:202 +#: ../../reference/lexical_analysis.rst:203 msgid "INDENT token" msgstr "INDENT token(縮排標誌)" -#: ../../reference/lexical_analysis.rst:202 +#: ../../reference/lexical_analysis.rst:203 msgid "DEDENT token" msgstr "DEDENT token(縮排標誌)" -#: ../../reference/lexical_analysis.rst:277 +#: ../../reference/lexical_analysis.rst:278 msgid "identifier" msgstr "identifier(識別器)" -#: ../../reference/lexical_analysis.rst:277 +#: ../../reference/lexical_analysis.rst:278 msgid "name" msgstr "name(名稱)" -#: ../../reference/lexical_analysis.rst:333 -#: ../../reference/lexical_analysis.rst:357 +#: ../../reference/lexical_analysis.rst:334 +#: ../../reference/lexical_analysis.rst:358 msgid "keyword" msgstr "keyword(關鍵字)" -#: ../../reference/lexical_analysis.rst:333 +#: ../../reference/lexical_analysis.rst:334 msgid "reserved word" msgstr "reserved word(保留字)" -#: ../../reference/lexical_analysis.rst:357 +#: ../../reference/lexical_analysis.rst:358 msgid "soft keyword" msgstr "soft keyword(軟關鍵字)" -#: ../../reference/lexical_analysis.rst:376 +#: ../../reference/lexical_analysis.rst:377 msgid "_, identifiers" msgstr "_, identifiers(識別器)" -#: ../../reference/lexical_analysis.rst:376 +#: ../../reference/lexical_analysis.rst:377 msgid "__, identifiers" msgstr "__, identifiers(識別器)" -#: ../../reference/lexical_analysis.rst:432 +#: ../../reference/lexical_analysis.rst:433 msgid "literal" msgstr "literal(常數)" -#: ../../reference/lexical_analysis.rst:432 +#: ../../reference/lexical_analysis.rst:433 msgid "constant" msgstr "constant(常數)" -#: ../../reference/lexical_analysis.rst:437 -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:438 +#: ../../reference/lexical_analysis.rst:479 msgid "string literal" msgstr "string literal(字串常數)" -#: ../../reference/lexical_analysis.rst:437 -#: ../../reference/lexical_analysis.rst:491 +#: ../../reference/lexical_analysis.rst:438 +#: ../../reference/lexical_analysis.rst:492 msgid "bytes literal" msgstr "bytes literal(位元組常數)" -#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:438 msgid "ASCII" msgstr "ASCII" -#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:438 msgid "' (single quote)" msgstr "' (單引號)" -#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:438 msgid "\" (double quote)" msgstr "\" (雙引號)" -#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:438 msgid "u'" msgstr "u'" -#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:438 msgid "u\"" msgstr "u\"" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:479 msgid "triple-quoted string" msgstr "triple-quoted string(三引號字串)" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:479 msgid "Unicode Consortium" msgstr "Unicode Consortium" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:479 msgid "raw string" msgstr "raw string(原始字串)" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:479 msgid "\"\"\"" msgstr "\"\"\"" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:479 msgid "'''" msgstr "'''" -#: ../../reference/lexical_analysis.rst:491 +#: ../../reference/lexical_analysis.rst:492 msgid "b'" msgstr "b'" -#: ../../reference/lexical_analysis.rst:491 +#: ../../reference/lexical_analysis.rst:492 msgid "b\"" msgstr "b\"" -#: ../../reference/lexical_analysis.rst:500 +#: ../../reference/lexical_analysis.rst:501 msgid "r'" msgstr "r'" -#: ../../reference/lexical_analysis.rst:500 +#: ../../reference/lexical_analysis.rst:501 msgid "raw string literal" msgstr "raw string literal(原始字串常數)" -#: ../../reference/lexical_analysis.rst:500 +#: ../../reference/lexical_analysis.rst:501 msgid "r\"" msgstr "r\"" -#: ../../reference/lexical_analysis.rst:518 +#: ../../reference/lexical_analysis.rst:519 msgid "f'" msgstr "f'" -#: ../../reference/lexical_analysis.rst:518 -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:519 +#: ../../reference/lexical_analysis.rst:697 msgid "formatted string literal" msgstr "formatted string literal(格式化字串常數)" -#: ../../reference/lexical_analysis.rst:518 +#: ../../reference/lexical_analysis.rst:519 msgid "f\"" msgstr "f\"" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "escape sequence" msgstr "escape sequence(跳脫序列)" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "Standard C" msgstr "Standard C(標準 C)" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "C" msgstr "C" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\\\" msgstr "\\\\" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\a" msgstr "\\a" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\b" msgstr "\\b" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\f" msgstr "\\f" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\n" msgstr "\\n" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\r" msgstr "\\r" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\t" msgstr "\\t" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\v" msgstr "\\v" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\x" msgstr "\\x" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\N" msgstr "\\N" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\u" msgstr "\\u" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\U" msgstr "\\U" -#: ../../reference/lexical_analysis.rst:647 +#: ../../reference/lexical_analysis.rst:648 msgid "unrecognized escape sequence" msgstr "unrecognized escape sequence(無法辨識的跳脫序列)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "string" msgstr "string(字串)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "f-string" msgstr "f-string(f 字串)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "! (exclamation)" msgstr "! (驚嘆號)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid ": (colon)" msgstr ": (冒號)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "for help in debugging using string literals" msgstr "for help in debugging using string literals(使用字串常數進行除錯)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "number" msgstr "number(數字)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "numeric literal" msgstr "numeric literal(數值常數)" -#: ../../reference/lexical_analysis.rst:879 -#: ../../reference/lexical_analysis.rst:892 +#: ../../reference/lexical_analysis.rst:880 +#: ../../reference/lexical_analysis.rst:893 msgid "integer literal" msgstr "integer literal(整數常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "floating-point literal" msgstr "floating-point literal(浮點數常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "hexadecimal literal" msgstr "hexadecimal literal(十六進位常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "octal literal" msgstr "octal literal(八進位常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "binary literal" msgstr "binary literal(二進位常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "decimal literal" msgstr "decimal literal(十進位常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "imaginary literal" msgstr "imaginary literal(虛數常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "complex literal" msgstr "complex literal(複數常數)" -#: ../../reference/lexical_analysis.rst:892 +#: ../../reference/lexical_analysis.rst:893 msgid "0b" msgstr "0b" -#: ../../reference/lexical_analysis.rst:892 +#: ../../reference/lexical_analysis.rst:893 msgid "0o" msgstr "0o" -#: ../../reference/lexical_analysis.rst:892 +#: ../../reference/lexical_analysis.rst:893 msgid "0x" msgstr "0x" -#: ../../reference/lexical_analysis.rst:892 -#: ../../reference/lexical_analysis.rst:938 +#: ../../reference/lexical_analysis.rst:893 +#: ../../reference/lexical_analysis.rst:939 msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../reference/lexical_analysis.rst:892 -#: ../../reference/lexical_analysis.rst:938 -#: ../../reference/lexical_analysis.rst:970 +#: ../../reference/lexical_analysis.rst:893 +#: ../../reference/lexical_analysis.rst:939 +#: ../../reference/lexical_analysis.rst:971 msgid "in numeric literal" msgstr "於數值常數中" -#: ../../reference/lexical_analysis.rst:938 +#: ../../reference/lexical_analysis.rst:939 msgid ". (dot)" msgstr ". (點)" -#: ../../reference/lexical_analysis.rst:938 +#: ../../reference/lexical_analysis.rst:939 msgid "e" msgstr "e" -#: ../../reference/lexical_analysis.rst:970 +#: ../../reference/lexical_analysis.rst:971 msgid "j" msgstr "j" -#: ../../reference/lexical_analysis.rst:996 +#: ../../reference/lexical_analysis.rst:997 msgid "operators" msgstr "operators(運算子)" -#: ../../reference/lexical_analysis.rst:1013 +#: ../../reference/lexical_analysis.rst:1014 msgid "delimiters" msgstr "delimiters(分隔符號)" diff --git a/reference/simple_stmts.po b/reference/simple_stmts.po index 8ad51dca40..cf6481aeb7 100644 --- a/reference/simple_stmts.po +++ b/reference/simple_stmts.po @@ -203,9 +203,9 @@ msgid "" "must yield an integer. If it is negative, the sequence's length is added to " "it. The resulting value must be a nonnegative integer less than the " "sequence's length, and the sequence is asked to assign the assigned object " -"to its item with that index. If the index is out of range, :exc:" -"`IndexError` is raised (assignment to a subscripted sequence cannot add new " -"items to a list)." +"to its item with that index. If the index is out of " +"range, :exc:`IndexError` is raised (assignment to a subscripted sequence " +"cannot add new items to a list)." msgstr "" #: ../../reference/simple_stmts.rst:211 @@ -262,6 +262,10 @@ msgid "" "i, x[i] = 1, 2 # i is updated, then x[i] is updated\n" "print(x)" msgstr "" +"x = [0, 1]\n" +"i = 0\n" +"i, x[i] = 1, 2 # i 先被更新,然後 x[i] 再被更新\n" +"print(x)" #: ../../reference/simple_stmts.rst:254 msgid ":pep:`3132` - Extended Iterable Unpacking" @@ -273,7 +277,7 @@ msgstr "" #: ../../reference/simple_stmts.rst:261 msgid "Augmented assignment statements" -msgstr "" +msgstr "擴增賦值陳述式" #: ../../reference/simple_stmts.rst:279 msgid "" @@ -331,7 +335,7 @@ msgstr "" #: ../../reference/simple_stmts.rst:320 msgid "Annotated assignment statements" -msgstr "" +msgstr "註釋賦值陳述式" #: ../../reference/simple_stmts.rst:327 msgid "" @@ -339,6 +343,8 @@ msgid "" "single statement, of a variable or attribute annotation and an optional " "assignment statement:" msgstr "" +":term:`註釋 <variable annotation>` 賦值是將變數或屬性註釋與可選的賦值陳述式結" +"合在一個陳述式中:" #: ../../reference/simple_stmts.rst:334 msgid "" @@ -375,8 +381,8 @@ msgid "" "If the right hand side is present, an annotated assignment performs the " "actual assignment before evaluating annotations (where applicable). If the " "right hand side is not present for an expression target, then the " -"interpreter evaluates the target except for the last :meth:`~object." -"__setitem__` or :meth:`~object.__setattr__` call." +"interpreter evaluates the target except for the " +"last :meth:`~object.__setitem__` or :meth:`~object.__setattr__` call." msgstr "" #: ../../reference/simple_stmts.rst:361 @@ -392,7 +398,7 @@ msgstr "" #: ../../reference/simple_stmts.rst:366 msgid ":pep:`484` - Type hints" -msgstr "" +msgstr ":pep:`484` - 型別提示" #: ../../reference/simple_stmts.rst:367 msgid "" @@ -449,11 +455,11 @@ msgid "" "refer to the built-in variables with those names. In the current " "implementation, the built-in variable ``__debug__`` is ``True`` under normal " "circumstances, ``False`` when optimization is requested (command line " -"option :option:`-O`). The current code generator emits no code for an :" -"keyword:`assert` statement when optimization is requested at compile time. " -"Note that it is unnecessary to include the source code for the expression " -"that failed in the error message; it will be displayed as part of the stack " -"trace." +"option :option:`-O`). The current code generator emits no code for " +"an :keyword:`assert` statement when optimization is requested at compile " +"time. Note that it is unnecessary to include the source code for the " +"expression that failed in the error message; it will be displayed as part of " +"the stack trace." msgstr "" #: ../../reference/simple_stmts.rst:416 @@ -500,8 +506,8 @@ msgstr "" msgid "" "Deletion of a name removes the binding of that name from the local or global " "namespace, depending on whether the name occurs in a :keyword:`global` " -"statement in the same code block. If the name is unbound, a :exc:" -"`NameError` exception will be raised." +"statement in the same code block. If the name is unbound, " +"a :exc:`NameError` exception will be raised." msgstr "" #: ../../reference/simple_stmts.rst:471 @@ -551,16 +557,17 @@ msgstr "" msgid "" "In a generator function, the :keyword:`return` statement indicates that the " "generator is done and will cause :exc:`StopIteration` to be raised. The " -"returned value (if any) is used as an argument to construct :exc:" -"`StopIteration` and becomes the :attr:`StopIteration.value` attribute." +"returned value (if any) is used as an argument to " +"construct :exc:`StopIteration` and becomes the :attr:`StopIteration.value` " +"attribute." msgstr "" #: ../../reference/simple_stmts.rst:513 msgid "" "In an asynchronous generator function, an empty :keyword:`return` statement " -"indicates that the asynchronous generator is done and will cause :exc:" -"`StopAsyncIteration` to be raised. A non-empty :keyword:`!return` statement " -"is a syntax error in an asynchronous generator function." +"indicates that the asynchronous generator is done and will " +"cause :exc:`StopAsyncIteration` to be raised. A non-empty :keyword:`!" +"return` statement is a syntax error in an asynchronous generator function." msgstr "" #: ../../reference/simple_stmts.rst:521 @@ -597,8 +604,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:546 msgid "" -"Yield expressions and statements are only used when defining a :term:" -"`generator` function, and are only used in the body of the generator " +"Yield expressions and statements are only used when defining " +"a :term:`generator` function, and are only used in the body of the generator " "function. Using :keyword:`yield` in a function definition is sufficient to " "cause that definition to create a generator function instead of a normal " "function." @@ -606,8 +613,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:551 msgid "" -"For full details of :keyword:`yield` semantics, refer to the :ref:" -"`yieldexpr` section." +"For full details of :keyword:`yield` semantics, refer to " +"the :ref:`yieldexpr` section." msgstr "" #: ../../reference/simple_stmts.rst:557 @@ -625,15 +632,15 @@ msgstr "" #: ../../reference/simple_stmts.rst:573 msgid "" "Otherwise, :keyword:`raise` evaluates the first expression as the exception " -"object. It must be either a subclass or an instance of :class:" -"`BaseException`. If it is a class, the exception instance will be obtained " -"when needed by instantiating the class with no arguments." +"object. It must be either a subclass or an instance " +"of :class:`BaseException`. If it is a class, the exception instance will be " +"obtained when needed by instantiating the class with no arguments." msgstr "" #: ../../reference/simple_stmts.rst:578 msgid "" -"The :dfn:`type` of the exception is the exception instance's class, the :dfn:" -"`value` is the instance itself." +"The :dfn:`type` of the exception is the exception instance's class, " +"the :dfn:`value` is the instance itself." msgstr "" #: ../../reference/simple_stmts.rst:583 @@ -703,8 +710,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:624 msgid "" "A similar mechanism works implicitly if a new exception is raised when an " -"exception is already being handled. An exception may be handled when an :" -"keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` " +"exception is already being handled. An exception may be handled when " +"an :keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` " "statement, is used. The previous exception is then attached as the new " "exception's :attr:`~BaseException.__context__` attribute:" msgstr "" @@ -775,9 +782,9 @@ msgstr "" #: ../../reference/simple_stmts.rst:664 msgid "" -"Additional information on exceptions can be found in section :ref:" -"`exceptions`, and information about handling exceptions is in section :ref:" -"`try`." +"Additional information on exceptions can be found in " +"section :ref:`exceptions`, and information about handling exceptions is in " +"section :ref:`try`." msgstr "" #: ../../reference/simple_stmts.rst:667 @@ -804,8 +811,8 @@ msgstr ":keyword:`!break` 陳述式" #: ../../reference/simple_stmts.rst:693 msgid "" -":keyword:`break` may only occur syntactically nested in a :keyword:`for` or :" -"keyword:`while` loop, but not nested in a function or class definition " +":keyword:`break` may only occur syntactically nested in a :keyword:`for` " +"or :keyword:`while` loop, but not nested in a function or class definition " "within that loop." msgstr "" @@ -863,8 +870,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:766 msgid "" -"define a name or names in the local namespace for the scope where the :" -"keyword:`import` statement occurs." +"define a name or names in the local namespace for the scope where " +"the :keyword:`import` statement occurs." msgstr "" #: ../../reference/simple_stmts.rst:769 @@ -893,8 +900,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:787 msgid "" -"If the module name is followed by :keyword:`!as`, then the name following :" -"keyword:`!as` is bound directly to the imported module." +"If the module name is followed by :keyword:`!as`, then the name " +"following :keyword:`!as` is bound directly to the imported module." msgstr "" #: ../../reference/simple_stmts.rst:789 @@ -956,10 +963,10 @@ msgid "" "import foo # foo imported and bound locally\n" "import foo.bar.baz # foo, foo.bar, and foo.bar.baz imported, foo " "bound locally\n" -"import foo.bar.baz as fbb # foo, foo.bar, and foo.bar.baz imported, foo.bar." -"baz bound as fbb\n" -"from foo.bar import baz # foo, foo.bar, and foo.bar.baz imported, foo.bar." -"baz bound as baz\n" +"import foo.bar.baz as fbb # foo, foo.bar, and foo.bar.baz imported, " +"foo.bar.baz bound as fbb\n" +"from foo.bar import baz # foo, foo.bar, and foo.bar.baz imported, " +"foo.bar.baz bound as baz\n" "from foo import attr # foo imported and foo.attr bound as attr" msgstr "" @@ -1016,8 +1023,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:866 msgid "" "Raises an :ref:`auditing event <auditing>` ``import`` with arguments " -"``module``, ``filename``, ``sys.path``, ``sys.meta_path``, ``sys." -"path_hooks``." +"``module``, ``filename``, ``sys.path``, ``sys.meta_path``, " +"``sys.path_hooks``." msgstr "" "引發一個附帶引數 ``module``、``filename``、``sys.path``、``sys.meta_path``、" "``sys.path_hooks`` 的\\ :ref:`稽核事件 <auditing>` ``import``。" @@ -1125,11 +1132,11 @@ msgstr "" #: ../../reference/simple_stmts.rst:936 msgid "" -"Code compiled by calls to the built-in functions :func:`exec` and :func:" -"`compile` that occur in a module :mod:`!M` containing a future statement " -"will, by default, use the new syntax or semantics associated with the future " -"statement. This can be controlled by optional arguments to :func:`compile` " -"--- see the documentation of that function for details." +"Code compiled by calls to the built-in functions :func:`exec` " +"and :func:`compile` that occur in a module :mod:`!M` containing a future " +"statement will, by default, use the new syntax or semantics associated with " +"the future statement. This can be controlled by optional arguments " +"to :func:`compile` --- see the documentation of that function for details." msgstr "" #: ../../reference/simple_stmts.rst:942 @@ -1176,8 +1183,8 @@ msgid "" "string or code object supplied to the built-in :func:`exec` function does " "not affect the code block *containing* the function call, and code contained " "in such a string is unaffected by :keyword:`!global` statements in the code " -"containing the function call. The same applies to the :func:`eval` and :" -"func:`compile` functions." +"containing the function call. The same applies to the :func:`eval` " +"and :func:`compile` functions." msgstr "" #: ../../reference/simple_stmts.rst:993 @@ -1192,8 +1199,8 @@ msgid "" "identifiers to refer to names previously bound in nonlocal scopes. It allows " "encapsulated code to rebind such nonlocal identifiers. If a name is bound " "in more than one nonlocal scope, the nearest binding is used. If a name is " -"not bound in any nonlocal scope, or if there is no nonlocal scope, a :exc:" -"`SyntaxError` is raised." +"not bound in any nonlocal scope, or if there is no nonlocal scope, " +"a :exc:`SyntaxError` is raised." msgstr "" #: ../../reference/simple_stmts.rst:1010 @@ -1214,8 +1221,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:1019 msgid "" "**Programmer's note:** :keyword:`nonlocal` is a directive to the parser and " -"applies only to code parsed along with it. See the note for the :keyword:" -"`global` statement." +"applies only to code parsed along with it. See the note for " +"the :keyword:`global` statement." msgstr "" #: ../../reference/simple_stmts.rst:1027 @@ -1257,9 +1264,9 @@ msgstr "" msgid "" "The value of the type alias is evaluated in the annotation scope. It is not " "evaluated when the type alias is created, but only when the value is " -"accessed through the type alias's :attr:`!__value__` attribute (see :ref:" -"`lazy-evaluation`). This allows the type alias to refer to names that are " -"not yet defined." +"accessed through the type alias's :attr:`!__value__` attribute " +"(see :ref:`lazy-evaluation`). This allows the type alias to refer to names " +"that are not yet defined." msgstr "" #: ../../reference/simple_stmts.rst:1056 diff --git a/sphinx.po b/sphinx.po index 58dbb67f14..6ac7eca6f2 100644 --- a/sphinx.po +++ b/sphinx.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-07 15:02+0800\n" +"POT-Creation-Date: 2025-04-16 00:15+0000\n" "PO-Revision-Date: 2023-03-15 10:19+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -20,6 +20,14 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Poedit 3.2.2\n" +#: ../../tools/templates/_docs_by_version.html:10 +msgid "Stable" +msgstr "穩定版本" + +#: ../../tools/templates/_docs_by_version.html:11 +msgid "In development" +msgstr "開發中" + #: ../../tools/templates/customsourcelink.html:3 msgid "This Page" msgstr "此頁面" @@ -37,15 +45,15 @@ msgstr "顯示原始碼" msgid "Download" msgstr "下載" -#: ../../tools/templates/download.html:16 +#: ../../tools/templates/download.html:30 msgid "Download Python %(dl_version)s Documentation" msgstr "下載 Python %(dl_version)s 說明文件" -#: ../../tools/templates/download.html:18 +#: ../../tools/templates/download.html:32 msgid "Last updated on: %(last_updated)s." msgstr "最後更新時間:%(last_updated)s。" -#: ../../tools/templates/download.html:20 +#: ../../tools/templates/download.html:34 msgid "" "To download an archive containing all the documents for this version of\n" "Python in one of various formats, follow one of links in this table." @@ -53,31 +61,31 @@ msgstr "" "要下載包含這個 Python 版本所有文件的歸檔,可以遵循這個表格中的其中一個連結," "以取得各種格式的文件。" -#: ../../tools/templates/download.html:25 +#: ../../tools/templates/download.html:39 msgid "Format" msgstr "格式" -#: ../../tools/templates/download.html:26 +#: ../../tools/templates/download.html:40 msgid "Packed as .zip" msgstr "打包成 .zip" -#: ../../tools/templates/download.html:27 +#: ../../tools/templates/download.html:41 msgid "Packed as .tar.bz2" msgstr "打包成 .tar.bz2" -#: ../../tools/templates/download.html:30 +#: ../../tools/templates/download.html:44 msgid "PDF" msgstr "PDF" -#: ../../tools/templates/download.html:31 +#: ../../tools/templates/download.html:45 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.zip\">Download</a> " "(ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.zip\">下載</a> (ca. %" -"(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.zip\">下載</a> (ca. " +"%(download_size)s MiB)" -#: ../../tools/templates/download.html:32 +#: ../../tools/templates/download.html:46 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.tar.bz2\">Download</" "a> (ca. %(download_size)s MiB)" @@ -85,19 +93,19 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.tar.bz2\">下載</a> " "(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:35 +#: ../../tools/templates/download.html:49 msgid "HTML" msgstr "HTML" -#: ../../tools/templates/download.html:36 +#: ../../tools/templates/download.html:50 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.zip\">Download</a> " "(ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.zip\">下載</a> (ca. %" -"(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.zip\">下載</a> (ca. " +"%(download_size)s MiB)" -#: ../../tools/templates/download.html:37 +#: ../../tools/templates/download.html:51 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.tar.bz2\">Download</a> " "(ca. %(download_size)s MiB)" @@ -105,19 +113,19 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.tar.bz2\">下載</a> " "(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:40 +#: ../../tools/templates/download.html:54 msgid "Plain text" msgstr "純文字" -#: ../../tools/templates/download.html:41 +#: ../../tools/templates/download.html:55 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.zip\">Download</a> " "(ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.zip\">下載</a> (ca. %" -"(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.zip\">下載</a> (ca. " +"%(download_size)s MiB)" -#: ../../tools/templates/download.html:42 +#: ../../tools/templates/download.html:56 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.tar.bz2\">Download</a> " "(ca. %(download_size)s MiB)" @@ -125,11 +133,11 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.tar.bz2\">下載</a> " "(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:45 +#: ../../tools/templates/download.html:59 msgid "Texinfo" msgstr "Texinfo" -#: ../../tools/templates/download.html:46 +#: ../../tools/templates/download.html:60 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.zip\">Download</a> " "(ca. %(download_size)s MiB)" @@ -137,7 +145,7 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.zip\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:47 +#: ../../tools/templates/download.html:61 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.tar.bz2\">Download</" "a> (ca. %(download_size)s MiB)" @@ -145,27 +153,27 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.tar.bz2\">下載</a> " "(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:50 +#: ../../tools/templates/download.html:64 msgid "EPUB" msgstr "EPUB" -#: ../../tools/templates/download.html:51 +#: ../../tools/templates/download.html:65 msgid "" -"<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">Download</a> (ca. %" -"(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">Download</a> (ca. " +"%(download_size)s MiB)" msgstr "" -"<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">下載</a> (ca. %" -"(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">下載</a> (ca. " +"%(download_size)s MiB)" -#: ../../tools/templates/download.html:56 +#: ../../tools/templates/download.html:70 msgid "These archives contain all the content in the documentation." msgstr "這些歸檔包含了說明文件中的所有內容。" -#: ../../tools/templates/download.html:59 +#: ../../tools/templates/download.html:73 msgid "Unpacking" msgstr "解壓縮" -#: ../../tools/templates/download.html:61 +#: ../../tools/templates/download.html:75 msgid "" "Unix users should download the .tar.bz2 archives; these are bzipped tar\n" "archives and can be handled in the usual way using tar and the bzip2\n" @@ -176,11 +184,11 @@ msgid "" "best compression and fastest download times." msgstr "" "Unix 使用者應該下載 .tar.bz2 歸檔;這些是 bzipped tar 歸檔,可以使用 tar 和 " -"bzip2 來處理。如果需要的話,可以使用 <a href=\"https://" -"infozip.sourceforge.net\">Info-ZIP</a> 解壓縮程式來處理 ZIP 歸檔。.tar.bz2 歸" -"檔提供最佳壓縮率和最快的下載時間。" +"bzip2 來處理。如果需要的話,可以使用 <a href=\"https://infozip.sourceforge." +"net\">Info-ZIP</a> 解壓縮程式來處理 ZIP 歸檔。.tar.bz2 歸檔提供最佳壓縮率和最" +"快的下載時間。" -#: ../../tools/templates/download.html:67 +#: ../../tools/templates/download.html:81 msgid "" "Windows users can use the ZIP archives since those are customary on that\n" "platform. These are created on Unix using the Info-ZIP zip program." @@ -188,18 +196,18 @@ msgstr "" "Windows 使用者可以使用 ZIP 歸檔,因為這在該平台上是常見的。這些是在 Unix 上使" "用 Info-ZIP zip 程式建立的。" -#: ../../tools/templates/download.html:71 +#: ../../tools/templates/download.html:85 msgid "Problems" msgstr "問題" -#: ../../tools/templates/download.html:73 +#: ../../tools/templates/download.html:87 msgid "" "If you have comments or suggestions for the Python documentation, please " "send\n" "email to <a href=\"mailto:docs@python.org\">docs@python.org</a>." msgstr "" -"如果你對 Python 說明文件有任何意見或建議,請寄電子郵件至 <a " -"href=\"mailto:docs@python.org\">docs@python.org</a>。" +"如果你對 Python 說明文件有任何意見或建議,請寄電子郵件至 <a href=\"mailto:" +"docs@python.org\">docs@python.org</a>。" #: ../../tools/templates/dummy.html:6 msgid "Availability" @@ -290,182 +298,182 @@ msgstr "安全性修護" msgid "EOL" msgstr "停止維護" -#: ../../tools/templates/indexcontent.html:8 +#: ../../tools/templates/indexcontent.html:21 msgid "Welcome! This is the official documentation for Python %(release)s." msgstr "歡迎!這是 Python %(release)s 的官方說明文件。" -#: ../../tools/templates/indexcontent.html:10 +#: ../../tools/templates/indexcontent.html:23 msgid "Documentation sections:" msgstr "文件章節:" -#: ../../tools/templates/indexcontent.html:13 +#: ../../tools/templates/indexcontent.html:26 msgid "What's new in Python %(version)s?" msgstr "Python %(version)s 有什麼新功能?" -#: ../../tools/templates/indexcontent.html:14 +#: ../../tools/templates/indexcontent.html:27 msgid "" "Or <a href=\"%(whatsnew_index)s\">all \"What's new\" documents since Python " "2.0</a>" msgstr "" "或<a href=\"%(whatsnew_index)s\">自 2.0 起的所有「有什麼新功能?」文件</a>" -#: ../../tools/templates/indexcontent.html:15 +#: ../../tools/templates/indexcontent.html:28 msgid "Tutorial" msgstr "Python 教學" -#: ../../tools/templates/indexcontent.html:16 +#: ../../tools/templates/indexcontent.html:29 msgid "Start here: a tour of Python's syntax and features" msgstr "從這裡開始:Python 的語法與特性導覽" -#: ../../tools/templates/indexcontent.html:17 +#: ../../tools/templates/indexcontent.html:30 msgid "Library reference" msgstr "函式庫參考手冊" -#: ../../tools/templates/indexcontent.html:18 +#: ../../tools/templates/indexcontent.html:31 msgid "Standard library and builtins" msgstr "標準函式庫與內建函式" -#: ../../tools/templates/indexcontent.html:19 +#: ../../tools/templates/indexcontent.html:32 msgid "Language reference" msgstr "語言參考手冊" -#: ../../tools/templates/indexcontent.html:20 +#: ../../tools/templates/indexcontent.html:33 msgid "Syntax and language elements" msgstr "語法及語言要素" -#: ../../tools/templates/indexcontent.html:21 +#: ../../tools/templates/indexcontent.html:34 msgid "Python setup and usage" msgstr "Python 的設置與使用" -#: ../../tools/templates/indexcontent.html:22 +#: ../../tools/templates/indexcontent.html:35 msgid "How to install, configure, and use Python" msgstr "如何安裝、設定與使用 Python" -#: ../../tools/templates/indexcontent.html:23 +#: ../../tools/templates/indexcontent.html:36 msgid "Python HOWTOs" msgstr "Python 如何達成任務" -#: ../../tools/templates/indexcontent.html:24 +#: ../../tools/templates/indexcontent.html:37 msgid "In-depth topic manuals" msgstr "深度主題說明手冊" -#: ../../tools/templates/indexcontent.html:26 +#: ../../tools/templates/indexcontent.html:39 msgid "Installing Python modules" msgstr "安裝 Python 模組" -#: ../../tools/templates/indexcontent.html:27 +#: ../../tools/templates/indexcontent.html:40 msgid "Third-party modules and PyPI.org" msgstr "第三方模組與 PyPI.org" -#: ../../tools/templates/indexcontent.html:28 +#: ../../tools/templates/indexcontent.html:41 msgid "Distributing Python modules" msgstr "發布 Python 模組" -#: ../../tools/templates/indexcontent.html:29 +#: ../../tools/templates/indexcontent.html:42 msgid "Publishing modules for use by other people" msgstr "發佈模組讓其他人可以使用" -#: ../../tools/templates/indexcontent.html:30 +#: ../../tools/templates/indexcontent.html:43 msgid "Extending and embedding" msgstr "擴充和嵌入" -#: ../../tools/templates/indexcontent.html:31 +#: ../../tools/templates/indexcontent.html:44 msgid "For C/C++ programmers" msgstr "給 C/C++ 程式設計師" -#: ../../tools/templates/indexcontent.html:32 +#: ../../tools/templates/indexcontent.html:45 msgid "Python's C API" msgstr "Python 的 C 應用程式介面 (API)" -#: ../../tools/templates/indexcontent.html:33 +#: ../../tools/templates/indexcontent.html:46 msgid "C API reference" msgstr "C API 參考手冊" -#: ../../tools/templates/indexcontent.html:34 +#: ../../tools/templates/indexcontent.html:47 msgid "FAQs" msgstr "常見問答集" -#: ../../tools/templates/indexcontent.html:35 +#: ../../tools/templates/indexcontent.html:48 msgid "Frequently asked questions (with answers!)" msgstr "常被提出的問題(還有答案!)" -#: ../../tools/templates/indexcontent.html:36 +#: ../../tools/templates/indexcontent.html:49 msgid "Deprecations" msgstr "棄用功能" -#: ../../tools/templates/indexcontent.html:37 +#: ../../tools/templates/indexcontent.html:50 msgid "Deprecated functionality" msgstr "已棄用的功能" -#: ../../tools/templates/indexcontent.html:41 +#: ../../tools/templates/indexcontent.html:54 msgid "Indices, glossary, and search:" msgstr "索引、術語表與搜尋:" -#: ../../tools/templates/indexcontent.html:44 +#: ../../tools/templates/indexcontent.html:57 msgid "Global module index" msgstr "全域模組索引" -#: ../../tools/templates/indexcontent.html:45 +#: ../../tools/templates/indexcontent.html:58 msgid "All modules and libraries" msgstr "所有模組與函式庫" -#: ../../tools/templates/indexcontent.html:46 +#: ../../tools/templates/indexcontent.html:59 msgid "General index" msgstr "總索引" -#: ../../tools/templates/indexcontent.html:47 +#: ../../tools/templates/indexcontent.html:60 msgid "All functions, classes, and terms" msgstr "全部函式、類別和術語" -#: ../../tools/templates/indexcontent.html:48 +#: ../../tools/templates/indexcontent.html:61 msgid "Glossary" msgstr "術語表" -#: ../../tools/templates/indexcontent.html:49 +#: ../../tools/templates/indexcontent.html:62 msgid "Terms explained" msgstr "術語解釋" -#: ../../tools/templates/indexcontent.html:51 +#: ../../tools/templates/indexcontent.html:64 msgid "Search page" msgstr "搜尋頁" -#: ../../tools/templates/indexcontent.html:52 +#: ../../tools/templates/indexcontent.html:65 msgid "Search this documentation" msgstr "搜尋這份說明文件" -#: ../../tools/templates/indexcontent.html:53 +#: ../../tools/templates/indexcontent.html:66 msgid "Complete table of contents" msgstr "完整內容列表" -#: ../../tools/templates/indexcontent.html:54 +#: ../../tools/templates/indexcontent.html:67 msgid "Lists all sections and subsections" msgstr "列出所有章節與小節" -#: ../../tools/templates/indexcontent.html:58 +#: ../../tools/templates/indexcontent.html:71 msgid "Project information:" msgstr "專案資訊:" -#: ../../tools/templates/indexcontent.html:61 +#: ../../tools/templates/indexcontent.html:74 msgid "Reporting issues" msgstr "回報問題" -#: ../../tools/templates/indexcontent.html:62 +#: ../../tools/templates/indexcontent.html:75 msgid "Contributing to Docs" msgstr "貢獻說明文件" -#: ../../tools/templates/indexcontent.html:63 +#: ../../tools/templates/indexcontent.html:76 msgid "Download the documentation" msgstr "下載說明文件" -#: ../../tools/templates/indexcontent.html:65 +#: ../../tools/templates/indexcontent.html:78 msgid "History and license of Python" msgstr "Python 的沿革與授權" -#: ../../tools/templates/indexcontent.html:66 +#: ../../tools/templates/indexcontent.html:79 msgid "Copyright" msgstr "版權" -#: ../../tools/templates/indexcontent.html:67 +#: ../../tools/templates/indexcontent.html:80 msgid "About the documentation" msgstr "關於說明文件" @@ -477,39 +485,31 @@ msgstr "下載這些說明文件" msgid "Docs by version" msgstr "各版本說明文件" -#: ../../tools/templates/indexsidebar.html:5 -msgid "Stable" -msgstr "穩定版本" - -#: ../../tools/templates/indexsidebar.html:6 -msgid "In development" -msgstr "開發中" - #: ../../tools/templates/indexsidebar.html:7 msgid "All versions" msgstr "所有版本" -#: ../../tools/templates/indexsidebar.html:10 +#: ../../tools/templates/indexsidebar.html:9 msgid "Other resources" msgstr "其他資源" -#: ../../tools/templates/indexsidebar.html:13 +#: ../../tools/templates/indexsidebar.html:12 msgid "PEP Index" msgstr "PEP 索引" -#: ../../tools/templates/indexsidebar.html:14 +#: ../../tools/templates/indexsidebar.html:13 msgid "Beginner's Guide" msgstr "初學者指南" -#: ../../tools/templates/indexsidebar.html:15 +#: ../../tools/templates/indexsidebar.html:14 msgid "Book List" msgstr "推薦書單" -#: ../../tools/templates/indexsidebar.html:16 +#: ../../tools/templates/indexsidebar.html:15 msgid "Audio/Visual Talks" msgstr "音訊/視訊演講" -#: ../../tools/templates/indexsidebar.html:17 +#: ../../tools/templates/indexsidebar.html:16 msgid "Python Developer’s Guide" msgstr "Python 開發者指南" @@ -525,8 +525,8 @@ msgstr "當前穩定發行的 Python 版本說明文件" #: ../../tools/templates/layout.html:14 msgid "" -"This is a deploy preview created from a <a href=\"%(repository_url)s/pull/%" -"(pr_id)s\">pull request</a>.\n" +"This is a deploy preview created from a <a href=\"%(repository_url)s/pull/" +"%(pr_id)s\">pull request</a>.\n" " For authoritative documentation, see" msgstr "" "這是從 <a href=\"%(repository_url)s/pull/%(pr_id)s\">pull request(拉取請求)" diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index b4bf143460..aa78b12d04 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -64,9 +64,9 @@ msgstr "" msgid "" "There can be zero or more :keyword:`elif` parts, and the :keyword:`else` " "part is optional. The keyword ':keyword:`!elif`' is short for 'else if', " -"and is useful to avoid excessive indentation. An :keyword:`!if` ... :" -"keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute for the " -"``switch`` or ``case`` statements found in other languages." +"and is useful to avoid excessive indentation. An :keyword:`!" +"if` ... :keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute " +"for the ``switch`` or ``case`` statements found in other languages." msgstr "" "在陳述式中,可以沒有或有許多個 :keyword:`elif` 敘述,且 :keyword:`else` 敘述" "並不是必要的。關鍵字 :keyword:`!elif` 是「else if」的縮寫,用來避免過多的縮" @@ -91,10 +91,10 @@ msgid "" "The :keyword:`for` statement in Python differs a bit from what you may be " "used to in C or Pascal. Rather than always iterating over an arithmetic " "progression of numbers (like in Pascal), or giving the user the ability to " -"define both the iteration step and halting condition (as C), Python's :" -"keyword:`!for` statement iterates over the items of any sequence (a list or " -"a string), in the order that they appear in the sequence. For example (no " -"pun intended):" +"define both the iteration step and halting condition (as C), " +"Python's :keyword:`!for` statement iterates over the items of any sequence " +"(a list or a string), in the order that they appear in the sequence. For " +"example (no pun intended):" msgstr "" "在 Python 中的 :keyword:`for` 陳述式有點不同於在 C 或 Pascal 中的慣用方式。相" "較於只能疊代 (iterate) 一個等差數列(如 Pascal),或給予使用者定義疊代步驟與" @@ -145,8 +145,9 @@ msgstr ":func:`range` 函式" #: ../../tutorial/controlflow.rst:96 msgid "" -"If you do need to iterate over a sequence of numbers, the built-in function :" -"func:`range` comes in handy. It generates arithmetic progressions::" +"If you do need to iterate over a sequence of numbers, the built-in " +"function :func:`range` comes in handy. It generates arithmetic " +"progressions::" msgstr "" "如果你需要疊代一個數列的話,使用內建 :func:`range` 函式就很方便。它可以生成一" "等差數列: ::" @@ -266,9 +267,9 @@ msgstr "" msgid "" "We say such an object is :term:`iterable`, that is, suitable as a target for " "functions and constructs that expect something from which they can obtain " -"successive items until the supply is exhausted. We have seen that the :" -"keyword:`for` statement is such a construct, while an example of a function " -"that takes an iterable is :func:`sum`::" +"successive items until the supply is exhausted. We have seen that " +"the :keyword:`for` statement is such a construct, while an example of a " +"function that takes an iterable is :func:`sum`::" msgstr "" "我們稱這樣的物件為 :term:`iterable`\\ (可疊代物件),意即能作為函式及架構中" "可以一直獲取項目直到取盡的對象。我們已經了解 :keyword:`for` 陳述式就是如此的" @@ -288,8 +289,8 @@ msgid "" "arguments. In chapter :ref:`tut-structures`, we will discuss in more detail " "about :func:`list`." msgstr "" -"待會我們可以看到更多回傳 iterable 和使用 iterable 為引數的函式。在\\ :ref:" -"`tut-structures`\\ 章節中,我們會討論更多關於 :func:`list` 的細節。" +"待會我們可以看到更多回傳 iterable 和使用 iterable 為引數的函式。在" +"\\ :ref:`tut-structures`\\ 章節中,我們會討論更多關於 :func:`list` 的細節。" #: ../../tutorial/controlflow.rst:164 msgid ":keyword:`!break` and :keyword:`!continue` Statements" @@ -297,11 +298,11 @@ msgstr ":keyword:`!break` 和 :keyword:`!continue` 陳述式" #: ../../tutorial/controlflow.rst:166 msgid "" -"The :keyword:`break` statement breaks out of the innermost enclosing :" -"keyword:`for` or :keyword:`while` loop::" +"The :keyword:`break` statement breaks out of the innermost " +"enclosing :keyword:`for` or :keyword:`while` loop::" msgstr "" -":keyword:`break` 陳述式,終止包含它的最內部 :keyword:`for` 或 :keyword:" -"`while` 迴圈: ::" +":keyword:`break` 陳述式,終止包含它的最內部 :keyword:`for` " +"或 :keyword:`while` 迴圈: ::" #: ../../tutorial/controlflow.rst:169 msgid "" @@ -454,11 +455,11 @@ msgid "" "occurs. For more on the ``try`` statement and exceptions, see :ref:`tut-" "handling`." msgstr "" -"當 ``else`` 子句用於迴圈時,相較於搭配 ``if`` 陳述式使用,它的行為與 :" -"keyword:`try` 陳述式中的 ``else`` 子句更為相似:``try`` 陳述式的 ``else`` 子" -"句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有任何 " -"``break`` 發生時執行。更多有關 ``try`` 陳述式和例外的介紹,見\\ :ref:`tut-" -"handling`。" +"當 ``else`` 子句用於迴圈時,相較於搭配 ``if`` 陳述式使用,它的行為" +"與 :keyword:`try` 陳述式中的 ``else`` 子句更為相似:``try`` 陳述式的 " +"``else`` 子句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有" +"任何 ``break`` 發生時執行。更多有關 ``try`` 陳述式和例外的介紹,見" +"\\ :ref:`tut-handling`。" #: ../../tutorial/controlflow.rst:257 msgid ":keyword:`!pass` Statements" @@ -697,8 +698,8 @@ msgid "" "A recommended way to read patterns is to look at them as an extended form of " "what you would put on the left of an assignment, to understand which " "variables would be set to what. Only the standalone names (like ``var`` " -"above) are assigned to by a match statement. Dotted names (like ``foo." -"bar``), attribute names (the ``x=`` and ``y=`` above) or class names " +"above) are assigned to by a match statement. Dotted names (like " +"``foo.bar``), attribute names (the ``x=`` and ``y=`` above) or class names " "(recognized by the \"(...)\" next to them like ``Point`` above) are never " "assigned to." msgstr "" @@ -883,8 +884,8 @@ msgstr "" #: ../../tutorial/controlflow.rst:454 msgid "" -"For a more detailed explanation and additional examples, you can look into :" -"pep:`636` which is written in a tutorial format." +"For a more detailed explanation and additional examples, you can look " +"into :pep:`636` which is written in a tutorial format." msgstr "" "關於更詳細的解釋和其他範例,你可以閱讀 :pep:`636`,它是以教學的格式編寫而成。" @@ -926,12 +927,12 @@ msgstr "" #: ../../tutorial/controlflow.rst:487 msgid "" "The first statement of the function body can optionally be a string literal; " -"this string literal is the function's documentation string, or :dfn:" -"`docstring`. (More about docstrings can be found in the section :ref:`tut-" -"docstrings`.) There are tools which use docstrings to automatically produce " -"online or printed documentation, or to let the user interactively browse " -"through code; it's good practice to include docstrings in code that you " -"write, so make a habit of it." +"this string literal is the function's documentation string, " +"or :dfn:`docstring`. (More about docstrings can be found in the " +"section :ref:`tut-docstrings`.) There are tools which use docstrings to " +"automatically produce online or printed documentation, or to let the user " +"interactively browse through code; it's good practice to include docstrings " +"in code that you write, so make a habit of it." msgstr "" "一個函式的第一個陳述式可以是一個字串文本;該字串文本被視為該函式的說明文件字" "串,即 :dfn:`docstring`。(關於 docstring 的細節請參見\\ :ref:`tut-" @@ -957,8 +958,8 @@ msgstr "" "域符號表。然而,在引用一個變數時,會先從區域符號表開始搜尋,其次為外層函式的" "區域符號表,其次為全域符號表 (global symbol table),最後為所有內建的名稱。因" "此,在函式中,全域變數及外層函式變數雖然可以被引用,但無法被直接賦值(除非全" -"域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數在 :keyword:" -"`nonlocal` 陳述式中被定義)。" +"域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數" +"在 :keyword:`nonlocal` 陳述式中被定義)。" #: ../../tutorial/controlflow.rst:505 msgid "" @@ -1006,8 +1007,8 @@ msgid "" "without a :keyword:`return` statement do return a value, albeit a rather " "boring one. This value is called ``None`` (it's a built-in name). Writing " "the value ``None`` is normally suppressed by the interpreter if it would be " -"the only value written. You can see it if you really want to using :func:" -"`print`::" +"the only value written. You can see it if you really want to " +"using :func:`print`::" msgstr "" "如果你是來自別的語言,你可能不同意 ``fib`` 是個函式,而是個程序 (procedure)," "因為它並沒有回傳值。實際上,即使一個函式缺少一個 :keyword:`return` 陳述式,它" @@ -1052,9 +1053,9 @@ msgstr "這個例子一樣示範了一些新的 Python 特性:" #: ../../tutorial/controlflow.rst:552 msgid "" -"The :keyword:`return` statement returns with a value from a function. :" -"keyword:`!return` without an expression argument returns ``None``. Falling " -"off the end of a function also returns ``None``." +"The :keyword:`return` statement returns with a value from a " +"function. :keyword:`!return` without an expression argument returns " +"``None``. Falling off the end of a function also returns ``None``." msgstr "" ":keyword:`return` 陳述式會讓一個函式回傳一個值。單獨使用 :keyword:`!return` " "不外加一個運算式作為引數時會回傳 ``None``。一個函式執行到結束也會回傳 " @@ -1068,8 +1069,8 @@ msgid "" "expression), and ``methodname`` is the name of a method that is defined by " "the object's type. Different types define different methods. Methods of " "different types may have the same name without causing ambiguity. (It is " -"possible to define your own object types and methods, using *classes*, see :" -"ref:`tut-classes`) The method :meth:`!append` shown in the example is " +"possible to define your own object types and methods, using *classes*, " +"see :ref:`tut-classes`) The method :meth:`!append` shown in the example is " "defined for list objects; it adds a new element at the end of the list. In " "this example it is equivalent to ``result = result + [a]``, but more " "efficient." @@ -1359,8 +1360,8 @@ msgid "" "positional arguments beyond the formal parameter list. (``*name`` must " "occur before ``**name``.) For example, if we define a function like this::" msgstr "" -"當最後一個參數為 ``**name`` 形式時,它接收一個 dictionary(字典,詳見 :ref:" -"`typesmapping`\\ ),該字典包含所有可對應形式參數以外的關鍵字引數。" +"當最後一個參數為 ``**name`` 形式時,它接收一個 dictionary(字典,詳" +"見 :ref:`typesmapping`\\ ),該字典包含所有可對應形式參數以外的關鍵字引數。" "``**name`` 可以與 ``*name`` 參數(下一小節介紹)組合使用,``*name`` 接收一" "個 :ref:`tuple <tut-tuples>`,該 tuple 包含一般參數以外的位置引數(\\ " "``*name`` 必須出現在 ``**name`` 前面)。例如,若我們定義這樣的函式: ::" @@ -1830,9 +1831,7 @@ msgid "" msgstr "" "通常,這些 *variadic*\\ (可變的)引數會出現在參數列表的最末端,這樣它們就可" "以把所有傳遞給函式的剩餘輸入引數都撈起來。出現在 ``*args`` 參數後面的任何參數" -"必須是「僅限關鍵字」引數,意即它們只能作為關鍵字引數,而不能用作位置引數。\n" -"\n" -"::" +"必須是「僅限關鍵字」引數,意即它們只能作為關鍵字引數,而不能用作位置引數。 ::" #: ../../tutorial/controlflow.rst:936 msgid "" diff --git a/tutorial/errors.po b/tutorial/errors.po index bd14d08027..6120bef81c 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-26 00:14+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2022-10-24 14:54+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -62,24 +62,29 @@ msgstr "" "SyntaxError: invalid syntax" #: ../../tutorial/errors.rst:26 +#, fuzzy msgid "" "The parser repeats the offending line and displays little arrows pointing at " -"the token in the line where the error was detected. The error may be caused " -"by the absence of a token *before* the indicated token. In the example, the " -"error is detected at the function :func:`print`, since a colon (``':'``) is " -"missing before it. File name and line number are printed so you know where " -"to look in case the input came from a script." +"the place where the error was detected. Note that this is not always the " +"place that needs to be fixed. In the example, the error is detected at the " +"function :func:`print`, since a colon (``':'``) is missing just before it." msgstr "" "剖析器 (parser) 會重複犯錯的那一行,並用一個小箭頭指向該行檢測到的第一個錯誤" "點。錯誤是由箭頭\\ *之前*\\ 的標記 (token) 導致的。此例中,錯誤是在 :func:" "`print` 函式中被檢測到,因為在它前面少了一個冒號 (``':'``)。檔案名稱和列號會" "被印出來,所以如果訊息是來自腳本時,就可以知道去哪裡找問題。" -#: ../../tutorial/errors.rst:37 +#: ../../tutorial/errors.rst:31 +msgid "" +"The file name (``<stdin>`` in our example) and line number are printed so " +"you know where to look in case the input came from a file." +msgstr "" + +#: ../../tutorial/errors.rst:38 msgid "Exceptions" msgstr "例外 (Exception)" -#: ../../tutorial/errors.rst:39 +#: ../../tutorial/errors.rst:40 msgid "" "Even if a statement or expression is syntactically correct, it may cause an " "error when an attempt is made to execute it. Errors detected during " @@ -92,7 +97,7 @@ msgstr "" "到的錯誤稱為\\ *例外*,例外不一定都很嚴重:你很快就能學會在 Python 程式中如何" "處理它們。不過大多數的例外不會被程式處理,並且會顯示如下的錯誤訊息: ::" -#: ../../tutorial/errors.rst:45 +#: ../../tutorial/errors.rst:46 msgid "" ">>> 10 * (1/0)\n" "Traceback (most recent call last):\n" @@ -132,7 +137,7 @@ msgstr "" " ~~~~^~~\n" "TypeError: can only concatenate str (not \"int\") to str" -#: ../../tutorial/errors.rst:64 +#: ../../tutorial/errors.rst:65 msgid "" "The last line of the error message indicates what happened. Exceptions come " "in different types, and the type is printed as part of the message: the " @@ -150,13 +155,13 @@ msgstr "" "需要遵守(雖然這是一個有用的慣例)。標準例外名稱是內建的識別字 (identifier)," "不是保留關鍵字 (reserved keyword)。" -#: ../../tutorial/errors.rst:72 +#: ../../tutorial/errors.rst:73 msgid "" "The rest of the line provides detail based on the type of exception and what " "caused it." msgstr "此行其餘部分,根據例外的類型及導致例外的原因,說明例外的細節。" -#: ../../tutorial/errors.rst:75 +#: ../../tutorial/errors.rst:76 msgid "" "The preceding part of the error message shows the context where the " "exception occurred, in the form of a stack traceback. In general it contains " @@ -167,16 +172,16 @@ msgstr "" "說,它含有一個列出源程式碼行 (source line) 的堆疊回溯;但它不會顯示從標準輸入" "中讀取的程式碼。" -#: ../../tutorial/errors.rst:80 +#: ../../tutorial/errors.rst:81 msgid "" ":ref:`bltin-exceptions` lists the built-in exceptions and their meanings." msgstr ":ref:`bltin-exceptions`\\ 章節列出內建的例外及它們的意義。" -#: ../../tutorial/errors.rst:86 +#: ../../tutorial/errors.rst:87 msgid "Handling Exceptions" msgstr "處理例外" -#: ../../tutorial/errors.rst:88 +#: ../../tutorial/errors.rst:89 msgid "" "It is possible to write programs that handle selected exceptions. Look at " "the following example, which asks the user for input until a valid integer " @@ -190,7 +195,7 @@ msgstr "" "令);請注意,由使用者產生的程式中斷會引發 :exc:`KeyboardInterrupt` 例外信" "號。 ::" -#: ../../tutorial/errors.rst:94 +#: ../../tutorial/errors.rst:95 msgid "" ">>> while True:\n" "... try:\n" @@ -208,11 +213,11 @@ msgstr "" "... print(\"Oops! That was no valid number. Try again...\")\n" "..." -#: ../../tutorial/errors.rst:102 +#: ../../tutorial/errors.rst:103 msgid "The :keyword:`try` statement works as follows." msgstr ":keyword:`try` 陳述式運作方式如下。" -#: ../../tutorial/errors.rst:104 +#: ../../tutorial/errors.rst:105 msgid "" "First, the *try clause* (the statement(s) between the :keyword:`try` and :" "keyword:`except` keywords) is executed." @@ -220,7 +225,7 @@ msgstr "" "首先,執行 *try 子句*\\ (:keyword:`try` 和 :keyword:`except` 關鍵字之間的陳" "述式)。" -#: ../../tutorial/errors.rst:107 +#: ../../tutorial/errors.rst:108 msgid "" "If no exception occurs, the *except clause* is skipped and execution of the :" "keyword:`try` statement is finished." @@ -228,7 +233,7 @@ msgstr "" "如果沒有發生例外,則 *except 子句*\\ 會被跳過,:keyword:`try` 陳述式執行完" "畢。" -#: ../../tutorial/errors.rst:110 +#: ../../tutorial/errors.rst:111 msgid "" "If an exception occurs during execution of the :keyword:`try` clause, the " "rest of the clause is skipped. Then, if its type matches the exception " @@ -239,7 +244,7 @@ msgstr "" "例外的類型與 :keyword:`except` 關鍵字後面的例外名稱相符,則 *except 子句*\\ " "被執行,然後,繼續執行 try/except 區塊之後的程式碼。" -#: ../../tutorial/errors.rst:115 +#: ../../tutorial/errors.rst:116 msgid "" "If an exception occurs which does not match the exception named in the " "*except clause*, it is passed on to outer :keyword:`try` statements; if no " @@ -250,7 +255,7 @@ msgstr "" "`try` 陳述式;如果仍無法找到處理者,則它是一個\\ *未處理例外 (unhandled " "exception)*,執行將停止,並顯示錯誤訊息。" -#: ../../tutorial/errors.rst:119 +#: ../../tutorial/errors.rst:120 msgid "" "A :keyword:`try` statement may have more than one *except clause*, to " "specify handlers for different exceptions. At most one handler will be " @@ -264,7 +269,7 @@ msgstr "" "理同一 :keyword:`!try` 陳述式裡其他處理者內的例外。一個 *except 子句*\\ 可以" "用一組括號內的 tuple 列舉多個例外,例如: ::" -#: ../../tutorial/errors.rst:125 +#: ../../tutorial/errors.rst:126 msgid "" "... except (RuntimeError, TypeError, NameError):\n" "... pass" @@ -272,7 +277,7 @@ msgstr "" "... except (RuntimeError, TypeError, NameError):\n" "... pass" -#: ../../tutorial/errors.rst:128 +#: ../../tutorial/errors.rst:129 msgid "" "A class in an :keyword:`except` clause matches exceptions which are " "instances of the class itself or one of its derived classes (but not the " @@ -284,7 +289,7 @@ msgstr "" "反過來 -- 列出一個衍生類別的 *except 子句*\\ 不會符合它的基底類別的例外)。例" "如,以下程式碼會按照 B、C、D 的順序印出: ::" -#: ../../tutorial/errors.rst:133 +#: ../../tutorial/errors.rst:134 msgid "" "class B(Exception):\n" " pass\n" @@ -324,7 +329,7 @@ msgstr "" " except B:\n" " print(\"B\")" -#: ../../tutorial/errors.rst:152 +#: ../../tutorial/errors.rst:153 msgid "" "Note that if the *except clauses* were reversed (with ``except B`` first), " "it would have printed B, B, B --- the first matching *except clause* is " @@ -333,7 +338,7 @@ msgstr "" "請注意,如果 *except 子句*\\ 的順序被反轉(把 ``except B`` 放到第一個),則會" "印出 B、B、B ­­——第一個符合的 *except 子句*\\ 會被觸發。" -#: ../../tutorial/errors.rst:155 +#: ../../tutorial/errors.rst:156 msgid "" "When an exception occurs, it may have associated values, also known as the " "exception's *arguments*. The presence and types of the arguments depend on " @@ -342,7 +347,7 @@ msgstr "" "當例外發生時,它可能有相關聯的值,也就是例外的\\ *引數*。引數的存在與否及它的" "類型,是取決於例外的類型。" -#: ../../tutorial/errors.rst:159 +#: ../../tutorial/errors.rst:160 msgid "" "The *except clause* may specify a variable after the exception name. The " "variable is bound to the exception instance which typically has an ``args`` " @@ -354,7 +359,7 @@ msgstr "" "(instance),其引數通常儲存在 ``args`` 屬性中。為了方便,內建例外型別定義了 :" "meth:`~object.__str__` 以印出所有引數而不需顯式地取用 ``.args``: ::" -#: ../../tutorial/errors.rst:165 +#: ../../tutorial/errors.rst:166 msgid "" ">>> try:\n" "... raise Exception('spam', 'eggs')\n" @@ -374,8 +379,24 @@ msgid "" "x = spam\n" "y = eggs" msgstr "" +">>> try:\n" +"... raise Exception('spam', 'eggs')\n" +"... except Exception as inst:\n" +"... print(type(inst)) # 例外的型別\n" +"... print(inst.args) # 儲存在 .args 中的引數\n" +"... print(inst) # __str__ 使得引數可以直接被印出,\n" +"... # 但可能在例外的子類別中被覆蓋\n" +"... x, y = inst.args # 解包引數\n" +"... print('x =', x)\n" +"... print('y =', y)\n" +"...\n" +"<class 'Exception'>\n" +"('spam', 'eggs')\n" +"('spam', 'eggs')\n" +"x = spam\n" +"y = eggs" -#: ../../tutorial/errors.rst:182 +#: ../../tutorial/errors.rst:183 msgid "" "The exception's :meth:`~object.__str__` output is printed as the last part " "('detail') of the message for unhandled exceptions." @@ -383,7 +404,7 @@ msgstr "" "例外的 :meth:`~object.__str__` 輸出會被印在未處理例外訊息的最後一部分(「細" "節」)。" -#: ../../tutorial/errors.rst:185 +#: ../../tutorial/errors.rst:186 msgid "" ":exc:`BaseException` is the common base class of all exceptions. One of its " "subclasses, :exc:`Exception`, is the base class of all the non-fatal " @@ -399,7 +420,7 @@ msgstr "" "它們是用來指示程式應該終止。這些例外包括了由 :meth:`sys.exit` 所引發的 :exc:" "`SystemExit`,以及當使用者想要中斷程式時所引發的 :exc:`KeyboardInterrupt`。" -#: ../../tutorial/errors.rst:193 +#: ../../tutorial/errors.rst:194 msgid "" ":exc:`Exception` can be used as a wildcard that catches (almost) everything. " "However, it is good practice to be as specific as possible with the types of " @@ -410,7 +431,7 @@ msgstr "" "較好的做法是盡可能具體地說明我們打算處理的例外類型,並容許任何非預期例外的傳" "遞 (propagate)。" -#: ../../tutorial/errors.rst:198 +#: ../../tutorial/errors.rst:199 msgid "" "The most common pattern for handling :exc:`Exception` is to print or log the " "exception and then re-raise it (allowing a caller to handle the exception as " @@ -419,7 +440,7 @@ msgstr "" "處理 :exc:`Exception` 的最常見模式,是先將該例外印出或記錄,然後再重新引發它" "(也允許一個呼叫函式 (caller) 來處理該例外): ::" -#: ../../tutorial/errors.rst:202 +#: ../../tutorial/errors.rst:203 msgid "" "import sys\n" "\n" @@ -449,7 +470,7 @@ msgstr "" " print(f\"Unexpected {err=}, {type(err)=}\")\n" " raise" -#: ../../tutorial/errors.rst:216 +#: ../../tutorial/errors.rst:217 msgid "" "The :keyword:`try` ... :keyword:`except` statement has an optional *else " "clause*, which, when present, must follow all *except clauses*. It is " @@ -460,7 +481,7 @@ msgstr "" "時,該子句必須放在所有 *except 子句*\\ 之後。如果一段程式碼必須被執行,但 " "*try 子句*\\ 又沒有引發例外時,這個子句很有用。例如: ::" -#: ../../tutorial/errors.rst:221 +#: ../../tutorial/errors.rst:222 msgid "" "for arg in sys.argv[1:]:\n" " try:\n" @@ -480,7 +501,7 @@ msgstr "" " print(arg, 'has', len(f.readlines()), 'lines')\n" " f.close()" -#: ../../tutorial/errors.rst:230 +#: ../../tutorial/errors.rst:231 msgid "" "The use of the :keyword:`!else` clause is better than adding additional code " "to the :keyword:`try` clause because it avoids accidentally catching an " @@ -491,7 +512,7 @@ msgstr "" "這可以避免意外地捕獲不是由 :keyword:`!try` ... :keyword:`!except` 陳述式保護" "的程式碼所引發的例外。" -#: ../../tutorial/errors.rst:235 +#: ../../tutorial/errors.rst:236 msgid "" "Exception handlers do not handle only exceptions that occur immediately in " "the *try clause*, but also those that occur inside functions that are called " @@ -500,7 +521,7 @@ msgstr "" "例外的處理者不僅處理 *try 子句*\\ 內立即發生的例外,還處理 *try 子句*\\ 內" "(即使是間接地)呼叫的函式內部發生的例外。例如: ::" -#: ../../tutorial/errors.rst:239 +#: ../../tutorial/errors.rst:240 msgid "" ">>> def this_fails():\n" "... x = 1/0\n" @@ -522,17 +543,17 @@ msgstr "" "...\n" "Handling run-time error: division by zero" -#: ../../tutorial/errors.rst:253 +#: ../../tutorial/errors.rst:254 msgid "Raising Exceptions" msgstr "引發例外" -#: ../../tutorial/errors.rst:255 +#: ../../tutorial/errors.rst:256 msgid "" "The :keyword:`raise` statement allows the programmer to force a specified " "exception to occur. For example::" msgstr ":keyword:`raise` 陳述式可讓程式設計師強制引發指定的例外。例如: ::" -#: ../../tutorial/errors.rst:258 +#: ../../tutorial/errors.rst:259 msgid "" ">>> raise NameError('HiThere')\n" "Traceback (most recent call last):\n" @@ -546,7 +567,7 @@ msgstr "" " raise NameError('HiThere')\n" "NameError: HiThere" -#: ../../tutorial/errors.rst:264 +#: ../../tutorial/errors.rst:265 msgid "" "The sole argument to :keyword:`raise` indicates the exception to be raised. " "This must be either an exception instance or an exception class (a class " @@ -559,11 +580,11 @@ msgstr "" "的 subclass)。如果一個例外 class 被傳遞,它會不含引數地呼叫它的建構函式 " "(constructor) ,使它被自動建立實例 (implicitly instantiated): ::" -#: ../../tutorial/errors.rst:270 +#: ../../tutorial/errors.rst:271 msgid "raise ValueError # shorthand for 'raise ValueError()'" msgstr "raise ValueError # 'raise ValueError()' 的簡寫" -#: ../../tutorial/errors.rst:272 +#: ../../tutorial/errors.rst:273 msgid "" "If you need to determine whether an exception was raised but don't intend to " "handle it, a simpler form of the :keyword:`raise` statement allows you to re-" @@ -572,7 +593,7 @@ msgstr "" "如果你只想判斷是否引發了例外,但並不打算處理它,則可以使用簡單的 :keyword:" "`raise` 陳述式來重新引發該例外: ::" -#: ../../tutorial/errors.rst:276 +#: ../../tutorial/errors.rst:277 msgid "" ">>> try:\n" "... raise NameError('HiThere')\n" @@ -598,11 +619,11 @@ msgstr "" " raise NameError('HiThere')\n" "NameError: HiThere" -#: ../../tutorial/errors.rst:292 +#: ../../tutorial/errors.rst:293 msgid "Exception Chaining" msgstr "例外鏈接 (Exception Chaining)" -#: ../../tutorial/errors.rst:294 +#: ../../tutorial/errors.rst:295 msgid "" "If an unhandled exception occurs inside an :keyword:`except` section, it " "will have the exception being handled attached to it and included in the " @@ -611,7 +632,7 @@ msgstr "" "如果在 :keyword:`except` 段落內部發生了一個未處理的例外,則它會讓這個將要被處" "理的例外附加在後,並將其包含在錯誤訊息中: ::" -#: ../../tutorial/errors.rst:298 +#: ../../tutorial/errors.rst:299 msgid "" ">>> try:\n" "... open(\"database.sqlite\")\n" @@ -649,7 +670,7 @@ msgstr "" " raise RuntimeError(\"unable to handle error\")\n" "RuntimeError: unable to handle error" -#: ../../tutorial/errors.rst:316 +#: ../../tutorial/errors.rst:317 msgid "" "To indicate that an exception is a direct consequence of another, the :" "keyword:`raise` statement allows an optional :keyword:`from<raise>` clause::" @@ -657,7 +678,7 @@ msgstr "" "為了表明一個例外是另一個例外直接造成的結果,:keyword:`raise` 陳述式容許一個選" "擇性的 :keyword:`from<raise>` 子句: ::" -#: ../../tutorial/errors.rst:319 +#: ../../tutorial/errors.rst:320 msgid "" "# exc must be exception instance or None.\n" "raise RuntimeError from exc" @@ -665,11 +686,11 @@ msgstr "" "# exc 必須是例外實例或 None。\n" "raise RuntimeError from exc" -#: ../../tutorial/errors.rst:322 +#: ../../tutorial/errors.rst:323 msgid "This can be useful when you are transforming exceptions. For example::" msgstr "要變換例外時,這種方式很有用。例如: ::" -#: ../../tutorial/errors.rst:324 +#: ../../tutorial/errors.rst:325 msgid "" ">>> def func():\n" "... raise ConnectionError\n" @@ -715,13 +736,13 @@ msgstr "" " raise RuntimeError('Failed to open database') from exc\n" "RuntimeError: Failed to open database" -#: ../../tutorial/errors.rst:346 +#: ../../tutorial/errors.rst:347 msgid "" "It also allows disabling automatic exception chaining using the ``from " "None`` idiom::" msgstr "它也容許使用慣用語 ``from None`` 來停用自動例外鏈接: ::" -#: ../../tutorial/errors.rst:349 +#: ../../tutorial/errors.rst:350 msgid "" ">>> try:\n" "... open('database.sqlite')\n" @@ -743,16 +764,16 @@ msgstr "" " raise RuntimeError from None\n" "RuntimeError" -#: ../../tutorial/errors.rst:359 +#: ../../tutorial/errors.rst:360 msgid "" "For more information about chaining mechanics, see :ref:`bltin-exceptions`." msgstr "更多關於鏈接機制的資訊,詳見\\ :ref:`bltin-exceptions`。" -#: ../../tutorial/errors.rst:365 +#: ../../tutorial/errors.rst:366 msgid "User-defined Exceptions" msgstr "使用者自定的例外" -#: ../../tutorial/errors.rst:367 +#: ../../tutorial/errors.rst:368 msgid "" "Programs may name their own exceptions by creating a new exception class " "(see :ref:`tut-classes` for more about Python classes). Exceptions should " @@ -763,7 +784,7 @@ msgstr "" "\\ :ref:`tut-classes`\\ )。不論是直接還是間接地,例外通常應該從 :exc:" "`Exception` class 衍生出來。" -#: ../../tutorial/errors.rst:371 +#: ../../tutorial/errors.rst:372 msgid "" "Exception classes can be defined which do anything any other class can do, " "but are usually kept simple, often only offering a number of attributes that " @@ -773,23 +794,23 @@ msgstr "" "例外 class 可被定義來做任何其他 class 能夠做的事,但通常會讓它維持簡單,只提" "供一些屬性,讓關於錯誤的資訊可被例外的處理者抽取出來。" -#: ../../tutorial/errors.rst:375 +#: ../../tutorial/errors.rst:376 msgid "" "Most exceptions are defined with names that end in \"Error\", similar to the " "naming of the standard exceptions." msgstr "大多數的例外定義,都會以「Error」作為名稱結尾,類似於標準例外的命名。" -#: ../../tutorial/errors.rst:378 +#: ../../tutorial/errors.rst:379 msgid "" "Many standard modules define their own exceptions to report errors that may " "occur in functions they define." msgstr "許多標準模組會定義它們自己的例外,以報告在其定義的函式中發生的錯誤。" -#: ../../tutorial/errors.rst:385 +#: ../../tutorial/errors.rst:386 msgid "Defining Clean-up Actions" msgstr "定義清理動作" -#: ../../tutorial/errors.rst:387 +#: ../../tutorial/errors.rst:388 msgid "" "The :keyword:`try` statement has another optional clause which is intended " "to define clean-up actions that must be executed under all circumstances. " @@ -798,7 +819,7 @@ msgstr "" ":keyword:`try` 陳述式有另一個選擇性子句,用於定義在所有情況下都必須被執行的清" "理動作。例如: ::" -#: ../../tutorial/errors.rst:391 +#: ../../tutorial/errors.rst:392 msgid "" ">>> try:\n" "... raise KeyboardInterrupt\n" @@ -822,7 +843,7 @@ msgstr "" " raise KeyboardInterrupt\n" "KeyboardInterrupt" -#: ../../tutorial/errors.rst:402 +#: ../../tutorial/errors.rst:403 msgid "" "If a :keyword:`finally` clause is present, the :keyword:`!finally` clause " "will execute as the last task before the :keyword:`try` statement completes. " @@ -835,7 +856,7 @@ msgstr "" "外,都會執行 :keyword:`!finally` 子句。以下幾點將探討例外發生時,比較複雜的情" "況:" -#: ../../tutorial/errors.rst:408 +#: ../../tutorial/errors.rst:409 msgid "" "If an exception occurs during execution of the :keyword:`!try` clause, the " "exception may be handled by an :keyword:`except` clause. If the exception is " @@ -846,7 +867,7 @@ msgstr "" "`except` 子句處理。如果該例外沒有被 :keyword:`!except` 子句處理,它會在 :" "keyword:`!finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:414 +#: ../../tutorial/errors.rst:415 msgid "" "An exception could occur during execution of an :keyword:`!except` or :" "keyword:`!else` clause. Again, the exception is re-raised after the :keyword:" @@ -855,7 +876,7 @@ msgstr "" "一個例外可能發生於 :keyword:`!except` 或 :keyword:`!else` 子句的執行過程。同" "樣地,該例外會在 :keyword:`!finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:418 +#: ../../tutorial/errors.rst:419 msgid "" "If the :keyword:`!finally` clause executes a :keyword:`break`, :keyword:" "`continue` or :keyword:`return` statement, exceptions are not re-raised." @@ -863,7 +884,7 @@ msgstr "" "如果 :keyword:`!finally` 子句執行 :keyword:`break`、:keyword:`continue` 或 :" "keyword:`return` 陳述式,則例外不會被重新引發。" -#: ../../tutorial/errors.rst:422 +#: ../../tutorial/errors.rst:423 msgid "" "If the :keyword:`!try` statement reaches a :keyword:`break`, :keyword:" "`continue` or :keyword:`return` statement, the :keyword:`!finally` clause " @@ -874,7 +895,7 @@ msgstr "" "keyword:`return` 陳述式,則 :keyword:`!finally` 子句會在執行 :keyword:`!" "break`、:keyword:`!continue` 或 :keyword:`!return` 陳述式之前先執行。" -#: ../../tutorial/errors.rst:428 +#: ../../tutorial/errors.rst:429 msgid "" "If a :keyword:`!finally` clause includes a :keyword:`!return` statement, the " "returned value will be the one from the :keyword:`!finally` clause's :" @@ -885,11 +906,11 @@ msgstr "" "自 :keyword:`!finally` 子句的 :keyword:`!return` 陳述式的回傳值,而不是來自 :" "keyword:`!try` 子句的 :keyword:`!return` 陳述式的回傳值。" -#: ../../tutorial/errors.rst:434 +#: ../../tutorial/errors.rst:435 msgid "For example::" msgstr "例如: ::" -#: ../../tutorial/errors.rst:436 +#: ../../tutorial/errors.rst:437 msgid "" ">>> def bool_return():\n" "... try:\n" @@ -909,11 +930,11 @@ msgstr "" ">>> bool_return()\n" "False" -#: ../../tutorial/errors.rst:445 +#: ../../tutorial/errors.rst:446 msgid "A more complicated example::" msgstr "另一個比較複雜的範例: ::" -#: ../../tutorial/errors.rst:447 +#: ../../tutorial/errors.rst:448 msgid "" ">>> def divide(x, y):\n" "... try:\n" @@ -969,7 +990,7 @@ msgstr "" " ~~^~~\n" "TypeError: unsupported operand type(s) for /: 'str' and 'str'" -#: ../../tutorial/errors.rst:474 +#: ../../tutorial/errors.rst:475 msgid "" "As you can see, the :keyword:`finally` clause is executed in any event. " "The :exc:`TypeError` raised by dividing two strings is not handled by the :" @@ -980,7 +1001,7 @@ msgstr "" "的 :exc:`TypeError` 沒有被 :keyword:`except` 子句處理,因此會在 :keyword:`!" "finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:479 +#: ../../tutorial/errors.rst:480 msgid "" "In real world applications, the :keyword:`finally` clause is useful for " "releasing external resources (such as files or network connections), " @@ -989,11 +1010,11 @@ msgstr "" "在真實應用程式中,:keyword:`finally` 子句對於釋放外部資源(例如檔案或網路連" "線)很有用,無論該資源的使用是否成功。" -#: ../../tutorial/errors.rst:487 +#: ../../tutorial/errors.rst:488 msgid "Predefined Clean-up Actions" msgstr "預定義的清理動作" -#: ../../tutorial/errors.rst:489 +#: ../../tutorial/errors.rst:490 msgid "" "Some objects define standard clean-up actions to be undertaken when the " "object is no longer needed, regardless of whether or not the operation using " @@ -1003,7 +1024,7 @@ msgstr "" "某些物件定義了在物件不再被需要時的標準清理動作,無論使用該物件的作業是成功或" "失敗。請看以下範例,它嘗試開啟一個檔案,並印出檔案內容至螢幕。 ::" -#: ../../tutorial/errors.rst:494 +#: ../../tutorial/errors.rst:495 msgid "" "for line in open(\"myfile.txt\"):\n" " print(line, end=\"\")" @@ -1011,7 +1032,7 @@ msgstr "" "for line in open(\"myfile.txt\"):\n" " print(line, end=\"\")" -#: ../../tutorial/errors.rst:497 +#: ../../tutorial/errors.rst:498 msgid "" "The problem with this code is that it leaves the file open for an " "indeterminate amount of time after this part of the code has finished " @@ -1025,7 +1046,7 @@ msgstr "" "keyword:`with` 陳述式讓物件(例如檔案)在被使用時,能保證它們總是及時、正確地" "被清理。 ::" -#: ../../tutorial/errors.rst:503 +#: ../../tutorial/errors.rst:504 msgid "" "with open(\"myfile.txt\") as f:\n" " for line in f:\n" @@ -1035,7 +1056,7 @@ msgstr "" " for line in f:\n" " print(line, end=\"\")" -#: ../../tutorial/errors.rst:507 +#: ../../tutorial/errors.rst:508 msgid "" "After the statement is executed, the file *f* is always closed, even if a " "problem was encountered while processing the lines. Objects which, like " @@ -1045,11 +1066,11 @@ msgstr "" "陳述式執行完畢後,就算是在處理內容時遇到問題,檔案 *f* 總是會被關閉。和檔案一" "樣,提供預定義清理動作的物件會在說明文件中表明這一點。" -#: ../../tutorial/errors.rst:515 +#: ../../tutorial/errors.rst:516 msgid "Raising and Handling Multiple Unrelated Exceptions" msgstr "引發及處理多個無關的例外" -#: ../../tutorial/errors.rst:517 +#: ../../tutorial/errors.rst:518 msgid "" "There are situations where it is necessary to report several exceptions that " "have occurred. This is often the case in concurrency frameworks, when " @@ -1061,7 +1082,7 @@ msgstr "" "中經常會出現這種情況,當平行的 (parallel) 某些任務可能已經失效,但還有其他用" "例 (use case) 希望能繼續執行並收集多個例外,而不是只有引發第一個例外時。" -#: ../../tutorial/errors.rst:523 +#: ../../tutorial/errors.rst:524 msgid "" "The builtin :exc:`ExceptionGroup` wraps a list of exception instances so " "that they can be raised together. It is an exception itself, so it can be " @@ -1071,7 +1092,7 @@ msgstr "" "(串列),使得它們可以一起被引發。由於它本身就是一個例外,因此它也可以像任何" "其他例外一樣被捕獲。 ::" -#: ../../tutorial/errors.rst:527 +#: ../../tutorial/errors.rst:528 msgid "" ">>> def f():\n" "... excs = [OSError('error 1'), SystemError('error 2')]\n" @@ -1123,7 +1144,7 @@ msgstr "" "caught <class 'ExceptionGroup'>: e\n" ">>>" -#: ../../tutorial/errors.rst:552 +#: ../../tutorial/errors.rst:553 msgid "" "By using ``except*`` instead of ``except``, we can selectively handle only " "the exceptions in the group that match a certain type. In the following " @@ -1136,7 +1157,7 @@ msgstr "" "``except*`` 子句分別從該群組中提取一個特定類型的例外,同時讓所有其他的例外都" "傳遞到其他子句,最後再被重新引發。 ::" -#: ../../tutorial/errors.rst:559 +#: ../../tutorial/errors.rst:560 msgid "" ">>> def f():\n" "... raise ExceptionGroup(\n" @@ -1220,7 +1241,7 @@ msgstr "" " +------------------------------------\n" ">>>" -#: ../../tutorial/errors.rst:600 +#: ../../tutorial/errors.rst:601 msgid "" "Note that the exceptions nested in an exception group must be instances, not " "types. This is because in practice the exceptions would typically be ones " @@ -1230,7 +1251,7 @@ msgstr "" "請注意,被巢套在例外群組中的例外必須是實例,而不是類型。這是因為在實務上,這" "些例外通常是已經被程式引發並捕獲的例外,類似以下的模式: ::" -#: ../../tutorial/errors.rst:605 +#: ../../tutorial/errors.rst:606 msgid "" ">>> excs = []\n" "... for test in tests:\n" @@ -1254,11 +1275,11 @@ msgstr "" "... raise ExceptionGroup(\"Test Failures\", excs)\n" "..." -#: ../../tutorial/errors.rst:620 +#: ../../tutorial/errors.rst:621 msgid "Enriching Exceptions with Notes" msgstr "用註解使例外更詳細" -#: ../../tutorial/errors.rst:622 +#: ../../tutorial/errors.rst:623 msgid "" "When an exception is created in order to be raised, it is usually " "initialized with information that describes the error that has occurred. " @@ -1274,7 +1295,7 @@ msgstr "" "的註解清單中。標準的回溯呈現會在例外之後列出所有的註解,並按照其被添加的順序" "來排列。 ::" -#: ../../tutorial/errors.rst:629 +#: ../../tutorial/errors.rst:630 msgid "" ">>> try:\n" "... raise TypeError('bad type')\n" @@ -1306,7 +1327,7 @@ msgstr "" "Add some more information\n" ">>>" -#: ../../tutorial/errors.rst:644 +#: ../../tutorial/errors.rst:645 msgid "" "For example, when collecting exceptions into an exception group, we may want " "to add context information for the individual errors. In the following each " @@ -1315,7 +1336,7 @@ msgstr "" "例如,在將例外收集到例外群組中時,我們可能希望為各個錯誤添加一些上下文的資" "訊。在以下範例中,群組中的每個例外都有一條註解,指示此錯誤是在何時發生。 ::" -#: ../../tutorial/errors.rst:648 +#: ../../tutorial/errors.rst:649 msgid "" ">>> def f():\n" "... raise OSError('operation failed')\n" diff --git a/tutorial/inputoutput.po b/tutorial/inputoutput.po index 860e9deca2..d4c65f866d 100644 --- a/tutorial/inputoutput.po +++ b/tutorial/inputoutput.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -41,15 +40,15 @@ msgstr "更華麗的輸出格式" #: ../../tutorial/inputoutput.rst:17 msgid "" "So far we've encountered two ways of writing values: *expression statements* " -"and the :func:`print` function. (A third way is using the :meth:`~io." -"TextIOBase.write` method of file objects; the standard output file can be " -"referenced as ``sys.stdout``. See the Library Reference for more information " -"on this.)" +"and the :func:`print` function. (A third way is using " +"the :meth:`~io.TextIOBase.write` method of file objects; the standard output " +"file can be referenced as ``sys.stdout``. See the Library Reference for more " +"information on this.)" msgstr "" -"目前為止我們已經學過兩種寫值的方式:*運算式陳述 (expression statements)* 與 :" -"func:`print` 函式。(第三種方法是使用檔案物件的 :meth:`~io.TextIOBase.write` " -"方法;標準輸出的檔案是使用 ``sys.stdout`` 來達成的。詳細的資訊請參考對應的函" -"式庫說明。)" +"目前為止我們已經學過兩種寫值的方式:*運算式陳述 (expression statements)* " +"與 :func:`print` 函式。(第三種方法是使用檔案物件" +"的 :meth:`~io.TextIOBase.write` 方法;標準輸出的檔案是使用 ``sys.stdout`` 來" +"達成的。詳細的資訊請參考對應的函式庫說明。)" #: ../../tutorial/inputoutput.rst:22 msgid "" @@ -114,8 +113,8 @@ msgstr "" msgid "" "Notice how the ``yes_votes`` are padded with spaces and a negative sign only " "for negative numbers. The example also prints ``percentage`` multiplied by " -"100, with 2 decimal places and followed by a percent sign (see :ref:" -"`formatspec` for details)." +"100, with 2 decimal places and followed by a percent sign " +"(see :ref:`formatspec` for details)." msgstr "" "請注意 ``yes_votes`` 如何對於負數用空格和負號填補。該範例還會列出 " "``percentage`` 乘以 100,並保留 2 位小數且後面跟著一個百分號(有關詳細資訊," @@ -138,17 +137,17 @@ msgid "" "variables for debugging purposes, you can convert any value to a string with " "the :func:`repr` or :func:`str` functions." msgstr "" -"如果你不需要華麗的輸出,只想快速顯示變數以進行除錯,可以用 :func:`repr` 或 :" -"func:`str` 函式把任何的值轉換為字串。" +"如果你不需要華麗的輸出,只想快速顯示變數以進行除錯,可以用 :func:`repr` " +"或 :func:`str` 函式把任何的值轉換為字串。" #: ../../tutorial/inputoutput.rst:66 msgid "" "The :func:`str` function is meant to return representations of values which " "are fairly human-readable, while :func:`repr` is meant to generate " -"representations which can be read by the interpreter (or will force a :exc:" -"`SyntaxError` if there is no equivalent syntax). For objects which don't " -"have a particular representation for human consumption, :func:`str` will " -"return the same value as :func:`repr`. Many values, such as numbers or " +"representations which can be read by the interpreter (or will force " +"a :exc:`SyntaxError` if there is no equivalent syntax). For objects which " +"don't have a particular representation for human consumption, :func:`str` " +"will return the same value as :func:`repr`. Many values, such as numbers or " "structures like lists and dictionaries, have the same representation using " "either function. Strings, in particular, have two distinct representations." msgstr "" @@ -185,6 +184,26 @@ msgid "" ">>> repr((x, y, ('spam', 'eggs')))\n" "\"(32.5, 40000, ('spam', 'eggs'))\"" msgstr "" +">>> s = 'Hello, world.'\n" +">>> str(s)\n" +"'Hello, world.'\n" +">>> repr(s)\n" +"\"'Hello, world.'\"\n" +">>> str(1/7)\n" +"'0.14285714285714285'\n" +">>> x = 10 * 3.25\n" +">>> y = 200 * 200\n" +">>> s = 'The value of x is ' + repr(x) + ', and y is ' + repr(y) + '...'\n" +">>> print(s)\n" +"The value of x is 32.5, and y is 40000...\n" +">>> # 字串的 repr() 會加上字串引號和反斜線:\n" +">>> hello = 'hello, world\\n'\n" +">>> hellos = repr(hello)\n" +">>> print(hellos)\n" +"'hello, world\\n'\n" +">>> # repr() 的引數可以是任何 Python 物件:\n" +">>> repr((x, y, ('spam', 'eggs')))\n" +"\"(32.5, 40000, ('spam', 'eggs'))\"" #: ../../tutorial/inputoutput.rst:98 msgid "" @@ -296,8 +315,8 @@ msgid "" "specifications, see the reference guide for the :ref:`formatspec`." msgstr "" "更多關於 ``=`` 說明符的資訊請見\\ :ref:`自文件性運算式 (self-documenting " -"expressions) <bpo-36817-whatsnew>`。若要參考這些格式化字串的規格,詳見 :ref:" -"`formatspec` 參考指南。" +"expressions) <bpo-36817-whatsnew>`。若要參考這些格式化字串的規格,詳" +"見 :ref:`formatspec` 參考指南。" #: ../../tutorial/inputoutput.rst:166 msgid "The String format() Method" @@ -319,8 +338,8 @@ msgstr "" msgid "" "The brackets and characters within them (called format fields) are replaced " "with the objects passed into the :meth:`str.format` method. A number in the " -"brackets can be used to refer to the position of the object passed into the :" -"meth:`str.format` method. ::" +"brackets can be used to refer to the position of the object passed into " +"the :meth:`str.format` method. ::" msgstr "" "大括號及其內的字元(稱為格式欄位)會被取代為傳遞給 :meth:`str.format` method " "的物件。大括號中的數字表示該物件在傳遞給 :meth:`str.format` method 時所在的位" @@ -403,19 +422,20 @@ msgstr "" #: ../../tutorial/inputoutput.rst:209 msgid "" ">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" -">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'." -"format(**table))\n" +">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: " +"{Dcab:d}'.format(**table))\n" "Jack: 4098; Sjoerd: 4127; Dcab: 8637678" msgstr "" ">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" -">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'." -"format(**table))\n" +">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: " +"{Dcab:d}'.format(**table))\n" "Jack: 4098; Sjoerd: 4127; Dcab: 8637678" #: ../../tutorial/inputoutput.rst:213 msgid "" -"This is particularly useful in combination with the built-in function :func:" -"`vars`, which returns a dictionary containing all local variables::" +"This is particularly useful in combination with the built-in " +"function :func:`vars`, which returns a dictionary containing all local " +"variables::" msgstr "" "與內建函式 :func:`vars` 組合使用時,這種方式特別實用。該函式可以回傳一個包含" "所有區域變數的 dictionary: ::" @@ -470,11 +490,11 @@ msgstr "" #: ../../tutorial/inputoutput.rst:238 msgid "" -"For a complete overview of string formatting with :meth:`str.format`, see :" -"ref:`formatstrings`." +"For a complete overview of string formatting with :meth:`str.format`, " +"see :ref:`formatstrings`." msgstr "" -"關於使用 :meth:`str.format` 進行字串格式化的完整概述,請見\\ :ref:" -"`formatstrings`。" +"關於使用 :meth:`str.format` 進行字串格式化的完整概述,請見" +"\\ :ref:`formatstrings`。" #: ../../tutorial/inputoutput.rst:243 msgid "Manual String Formatting" @@ -520,8 +540,8 @@ msgstr "" #: ../../tutorial/inputoutput.rst:263 msgid "" -"(Note that the one space between each column was added by the way :func:" -"`print` works: it always adds spaces between its arguments.)" +"(Note that the one space between each column was added by the " +"way :func:`print` works: it always adds spaces between its arguments.)" msgstr "" "(請注意,使用 :func:`print` 讓每欄之間加入一個空格的方法:這種方法總是在其引" "數間加入空格。)" @@ -640,9 +660,10 @@ msgid "" "*encoding*. If *encoding* is not specified, the default is platform " "dependent (see :func:`open`). Because UTF-8 is the modern de-facto standard, " "``encoding=\"utf-8\"`` is recommended unless you know that you need to use a " -"different encoding. Appending a ``'b'`` to the mode opens the file in :dfn:" -"`binary mode`. Binary mode data is read and written as :class:`bytes` " -"objects. You can not specify *encoding* when opening file in binary mode." +"different encoding. Appending a ``'b'`` to the mode opens the file " +"in :dfn:`binary mode`. Binary mode data is read and written " +"as :class:`bytes` objects. You can not specify *encoding* when opening file " +"in binary mode." msgstr "" "通常,檔案以 :dfn:`text mode` 開啟,意即,從檔案中讀取或寫入字串時,都以特定" "編碼方式 *encoding* 進行編碼。如未指定 *encoding*,則預設值會取決於系統平台" @@ -657,9 +678,9 @@ msgid "" "endings (``\\n`` on Unix, ``\\r\\n`` on Windows) to just ``\\n``. When " "writing in text mode, the default is to convert occurrences of ``\\n`` back " "to platform-specific line endings. This behind-the-scenes modification to " -"file data is fine for text files, but will corrupt binary data like that in :" -"file:`JPEG` or :file:`EXE` files. Be very careful to use binary mode when " -"reading and writing such files." +"file data is fine for text files, but will corrupt binary data like that " +"in :file:`JPEG` or :file:`EXE` files. Be very careful to use binary mode " +"when reading and writing such files." msgstr "" "在文字模式 (text mode) 下,讀取時會預設把平台特定的行尾符號(Unix 上為 " "``\\n``,Windows 上為 ``\\r\\n``)轉換為 ``\\n``。在文字模式下寫入時,預設會" @@ -671,9 +692,9 @@ msgstr "" msgid "" "It is good practice to use the :keyword:`with` keyword when dealing with " "file objects. The advantage is that the file is properly closed after its " -"suite finishes, even if an exception is raised at some point. Using :" -"keyword:`!with` is also much shorter than writing equivalent :keyword:" -"`try`\\ -\\ :keyword:`finally` blocks::" +"suite finishes, even if an exception is raised at some point. " +"Using :keyword:`!with` is also much shorter than writing " +"equivalent :keyword:`try`\\ -\\ :keyword:`finally` blocks::" msgstr "" "在處理檔案物件時,使用 :keyword:`with` 關鍵字是個好習慣。優點是,當它的套件結" "束後,即使在某個時刻引發了例外,檔案仍會正確地被關閉。使用 :keyword:`!with` " @@ -697,8 +718,8 @@ msgstr "" #: ../../tutorial/inputoutput.rst:365 msgid "" -"If you're not using the :keyword:`with` keyword, then you should call ``f." -"close()`` to close the file and immediately free up any system resources " +"If you're not using the :keyword:`with` keyword, then you should call " +"``f.close()`` to close the file and immediately free up any system resources " "used by it." msgstr "" "如果你沒有使用 :keyword:`with` 關鍵字,則應呼叫 ``f.close()`` 關閉檔案,可以" @@ -834,8 +855,8 @@ msgid "" "If you want to read all the lines of a file in a list you can also use " "``list(f)`` or ``f.readlines()``." msgstr "" -"如果你想把一個檔案的所有行讀進一個 list 裡,可以用 ``list(f)`` 或 ``f." -"readlines()``。" +"如果你想把一個檔案的所有行讀進一個 list 裡,可以用 ``list(f)`` 或 " +"``f.readlines()``。" #: ../../tutorial/inputoutput.rst:437 msgid "" @@ -957,18 +978,18 @@ msgid "" "want to save more complex data types like nested lists and dictionaries, " "parsing and serializing by hand becomes complicated." msgstr "" -"字串可以簡單地從檔案中被寫入和讀取。數字則稍嫌麻煩,因為 :meth:`~io." -"TextIOBase.read` method 只回傳字串,這些字串必須傳遞給像 :func:`int` 這樣的函" -"式,它接受 ``'123'`` 這樣的字串,並回傳數值 123。當你想儲存像是巢狀 list 和 " -"dictionary(字典)等複雜的資料類型時,手動剖析 (parsing) 和序列化 " -"(serializing) 就變得複雜。" +"字串可以簡單地從檔案中被寫入和讀取。數字則稍嫌麻煩,因" +"為 :meth:`~io.TextIOBase.read` method 只回傳字串,這些字串必須傳遞給" +"像 :func:`int` 這樣的函式,它接受 ``'123'`` 這樣的字串,並回傳數值 123。當你" +"想儲存像是巢狀 list 和 dictionary(字典)等複雜的資料類型時,手動剖析 " +"(parsing) 和序列化 (serializing) 就變得複雜。" #: ../../tutorial/inputoutput.rst:499 msgid "" "Rather than having users constantly writing and debugging code to save " "complicated data types to files, Python allows you to use the popular data " -"interchange format called `JSON (JavaScript Object Notation) <https://json." -"org>`_. The standard module called :mod:`json` can take Python data " +"interchange format called `JSON (JavaScript Object Notation) <https://" +"json.org>`_. The standard module called :mod:`json` can take Python data " "hierarchies, and convert them to string representations; this process is " "called :dfn:`serializing`. Reconstructing the data from the string " "representation is called :dfn:`deserializing`. Between serializing and " @@ -1012,13 +1033,14 @@ msgstr "" #: ../../tutorial/inputoutput.rst:522 msgid "" -"Another variant of the :func:`~json.dumps` function, called :func:`~json." -"dump`, simply serializes the object to a :term:`text file`. So if ``f`` is " -"a :term:`text file` object opened for writing, we can do this::" +"Another variant of the :func:`~json.dumps` function, " +"called :func:`~json.dump`, simply serializes the object to a :term:`text " +"file`. So if ``f`` is a :term:`text file` object opened for writing, we can " +"do this::" msgstr "" ":func:`~json.dumps` 函式有一個變體,稱為 :func:`~json.dump`,它單純地將物件序" -"列化為 :term:`text file`。因此,如果 ``f`` 是一個為了寫入而開啟的 :term:" -"`text file` 物件,我們可以這樣做: ::" +"列化為 :term:`text file`。因此,如果 ``f`` 是一個為了寫入而開啟" +"的 :term:`text file` 物件,我們可以這樣做: ::" #: ../../tutorial/inputoutput.rst:526 msgid "json.dump(x, f)" @@ -1041,8 +1063,8 @@ msgid "" "JSON files must be encoded in UTF-8. Use ``encoding=\"utf-8\"`` when opening " "JSON file as a :term:`text file` for both of reading and writing." msgstr "" -"JSON 檔案必須以 UTF-8 格式編碼。在開啟 JSON 檔案以作為一個可讀取與寫入的 :" -"term:`text file` 時,要用 ``encoding=\"utf-8\"``。" +"JSON 檔案必須以 UTF-8 格式編碼。在開啟 JSON 檔案以作為一個可讀取與寫入" +"的 :term:`text file` 時,要用 ``encoding=\"utf-8\"``。" #: ../../tutorial/inputoutput.rst:537 msgid "" diff --git a/tutorial/interactive.po b/tutorial/interactive.po index c7d64f4e81..5321410348 100644 --- a/tutorial/interactive.po +++ b/tutorial/interactive.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-29 10:36+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2021-06-28 20:45+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -70,13 +70,14 @@ msgid "Alternatives to the Interactive Interpreter" msgstr "互動式直譯器的替代方案" #: ../../tutorial/interactive.rst:38 +#, fuzzy msgid "" "This facility is an enormous step forward compared to earlier versions of " "the interpreter; however, some wishes are left: It would be nice if the " "proper indentation were suggested on continuation lines (the parser knows if " -"an indent token is required next). The completion mechanism might use the " -"interpreter's symbol table. A command to check (or even suggest) matching " -"parentheses, quotes, etc., would also be useful." +"an :data:`~token.INDENT` token is required next). The completion mechanism " +"might use the interpreter's symbol table. A command to check (or even " +"suggest) matching parentheses, quotes, etc., would also be useful." msgstr "" "與早期版本的直譯器相比,上述功能的出現的確是一個巨大的進步;但還是有一些願望" "沒有被實現:如果能在每次換行時給予適當的縮排建議(剖析器 (parser) 知道下一行" diff --git a/tutorial/introduction.po b/tutorial/introduction.po index 4db1924d3e..f55a511ab3 100644 --- a/tutorial/introduction.po +++ b/tutorial/introduction.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-08 03:35+0000\n" +"POT-Creation-Date: 2025-02-20 00:13+0000\n" "PO-Revision-Date: 2022-10-16 03:20+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,10 +34,11 @@ msgid "" "that a secondary prompt on a line by itself in an example means you must " "type a blank line; this is used to end a multi-line command." msgstr "" -"在下面的例子中,輸入與輸出的區別在於有無提示字元(prompt,:term:`>>>` 和 :" -"term:`...`\\ ):如果要重做範例,你必須在提示字元出現的時候,輸入提示字元後方" -"的所有內容;那些非提示字元開始的文字行是直譯器的輸出。注意到在範例中,若出現" -"單行只有次提示字元時,代表該行你必須直接換行;這被使用在多行指令結束輸入時。" +"在下面的例子中,輸入與輸出的區別在於有無提示字元(prompt,:term:`>>>` " +"和 :term:`...`\\ ):如果要重做範例,你必須在提示字元出現的時候,輸入提示字元" +"後方的所有內容;那些非提示字元開始的文字行是直譯器的輸出。注意到在範例中,若" +"出現單行只有次提示字元時,代表該行你必須直接換行;這被使用在多行指令結束輸入" +"時。" #: ../../tutorial/introduction.rst:16 msgid "" @@ -120,8 +121,9 @@ msgstr "" #: ../../tutorial/introduction.rst:68 msgid "" "The integer numbers (e.g. ``2``, ``4``, ``20``) have type :class:`int`, the " -"ones with a fractional part (e.g. ``5.0``, ``1.6``) have type :class:" -"`float`. We will see more about numeric types later in the tutorial." +"ones with a fractional part (e.g. ``5.0``, ``1.6``) have " +"type :class:`float`. We will see more about numeric types later in the " +"tutorial." msgstr "" "整數數字(即 ``2``、``4``、``20``)為 :class:`int` 型態,數字有小數點部份的" "(即 ``5.0``、``1.6``)為 :class:`float` 型態。我們將在之後的教學中看到更多數" @@ -256,15 +258,15 @@ msgstr "" #: ../../tutorial/introduction.rst:132 msgid "" "In addition to :class:`int` and :class:`float`, Python supports other types " -"of numbers, such as :class:`~decimal.Decimal` and :class:`~fractions." -"Fraction`. Python also has built-in support for :ref:`complex numbers " -"<typesnumeric>`, and uses the ``j`` or ``J`` suffix to indicate the " -"imaginary part (e.g. ``3+5j``)." +"of numbers, such as :class:`~decimal.Decimal` " +"and :class:`~fractions.Fraction`. Python also has built-in support " +"for :ref:`complex numbers <typesnumeric>`, and uses the ``j`` or ``J`` " +"suffix to indicate the imaginary part (e.g. ``3+5j``)." msgstr "" -"除了 :class:`int` 和 :class:`float`,Python 還支援了其他的數字型態,包含 :" -"class:`~decimal.Decimal` 和 :class:`~fractions.Fraction`。Python 亦內建支援" -"\\ :ref:`複數 (complex numbers) <typesnumeric>`,並使用 ``j`` 和 ``J`` 後綴來" -"指定虛數的部份(即 ``3+5j``)。" +"除了 :class:`int` 和 :class:`float`,Python 還支援了其他的數字型態,包" +"含 :class:`~decimal.Decimal` 和 :class:`~fractions.Fraction`。Python 亦內建支" +"援\\ :ref:`複數 (complex numbers) <typesnumeric>`,並使用 ``j`` 和 ``J`` 後綴" +"來指定虛數的部份(即 ``3+5j``)。" #: ../../tutorial/introduction.rst:142 msgid "Text" @@ -357,14 +359,14 @@ msgstr "" #: ../../tutorial/introduction.rst:197 msgid "" "String literals can span multiple lines. One way is using triple-quotes: " -"``\"\"\"...\"\"\"`` or ``'''...'''``. End of lines are automatically " -"included in the string, but it's possible to prevent this by adding a ``\\`` " -"at the end of the line. In the following example, the initial newline is " -"not included::" +"``\"\"\"...\"\"\"`` or ``'''...'''``. End-of-line characters are " +"automatically included in the string, but it's possible to prevent this by " +"adding a ``\\`` at the end of the line. In the following example, the " +"initial newline is not included::" msgstr "" "字串文本可以跨越數行。其中一方式是使用三個重覆引號:``\"\"\"...\"\"\"`` 或 " -"``'''...'''``。此時換行會被自動加入字串值中,但也可以在換行前加入 ``\\`` 來取" -"消這個行為。在以下的例子中,最初的換行符不會被包含: ::" +"``'''...'''``。此時換行字元會被自動加入字串值中,但也可以在換行前加入 ``\\`` " +"來取消這個行為。在以下的例子中,最初的換行符不會被包含: ::" #: ../../tutorial/introduction.rst:203 msgid "" @@ -796,8 +798,8 @@ msgstr "" #: ../../tutorial/introduction.rst:421 msgid "" -"You can also add new items at the end of the list, by using the :meth:`!list." -"append` *method* (we will see more about methods later)::" +"You can also add new items at the end of the list, by using the :meth:`!" +"list.append` *method* (we will see more about methods later)::" msgstr "" "你也可以在 list 的最後加入新元素,透過使用 :meth:`!list.append` *方法* " "(method)(我們稍後會看到更多方法的說明): ::" diff --git a/tutorial/modules.po b/tutorial/modules.po index 9a828e3f5e..506f1c38be 100644 --- a/tutorial/modules.po +++ b/tutorial/modules.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2022-10-23 20:30+0800\n" "Last-Translator: Phil Lin <linooohon@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -184,8 +184,8 @@ msgstr "" "每個模組都有它自己的私有命名空間 (namespace),模組內定義的函式會把該模組的私" "有符號表當成全域命名空間使用。因此,模組的作者可以在模組中使用全域變數,而不" "必擔心和使用者的全域變數發生意外的名稱衝突。另一方面,如果你知道自己在做什" -"麼,你可以用這個方式取用模組的全域變數,以和引用函式一樣的寫法,``modname." -"itemname``。" +"麼,你可以用這個方式取用模組的全域變數,以和引用函式一樣的寫法," +"``modname.itemname``。" #: ../../tutorial/modules.rst:86 msgid "" @@ -262,8 +262,8 @@ msgstr "" #: ../../tutorial/modules.rst:116 msgid "" -"If the module name is followed by :keyword:`!as`, then the name following :" -"keyword:`!as` is bound directly to the imported module." +"If the module name is followed by :keyword:`!as`, then the name " +"following :keyword:`!as` is bound directly to the imported module." msgstr "" "如果模組名稱後面出現 :keyword:`!as`,則 :keyword:`!as` 之後的名稱將直接和被 " "import 模組綁定在一起。" @@ -306,13 +306,13 @@ msgid "" "For efficiency reasons, each module is only imported once per interpreter " "session. Therefore, if you change your modules, you must restart the " "interpreter -- or, if it's just one module you want to test interactively, " -"use :func:`importlib.reload`, e.g. ``import importlib; importlib." -"reload(modulename)``." +"use :func:`importlib.reload`, e.g. ``import importlib; " +"importlib.reload(modulename)``." msgstr "" "出於效率原因,每個模組在每個直譯器 session 中僅會被 import 一次。因此,如果你" "更改了模組,則必須重啟直譯器——或者,如果只是一個想要在互動模式下測試的模組," -"可以使用 :func:`importlib.reload`。例如:``import importlib; importlib." -"reload(modulename)``。" +"可以使用 :func:`importlib.reload`。例如:``import importlib; " +"importlib.reload(modulename)``。" #: ../../tutorial/modules.rst:147 msgid "Executing modules as scripts" @@ -390,10 +390,11 @@ msgstr "模組的搜尋路徑" #: ../../tutorial/modules.rst:186 msgid "" "When a module named :mod:`!spam` is imported, the interpreter first searches " -"for a built-in module with that name. These module names are listed in :data:" -"`sys.builtin_module_names`. If not found, it then searches for a file named :" -"file:`spam.py` in a list of directories given by the variable :data:`sys." -"path`. :data:`sys.path` is initialized from these locations:" +"for a built-in module with that name. These module names are listed " +"in :data:`sys.builtin_module_names`. If not found, it then searches for a " +"file named :file:`spam.py` in a list of directories given by the " +"variable :data:`sys.path`. :data:`sys.path` is initialized from these " +"locations:" msgstr "" "Import 一個名為 :mod:`!spam` 的模組時,直譯器首先會搜尋具有該名稱的內建模組。" "模組名稱列在 :data:`sys.builtin_module_names` 當中。如果找不到,接下來會在變" @@ -419,8 +420,8 @@ msgid "" "The installation-dependent default (by convention including a ``site-" "packages`` directory, handled by the :mod:`site` module)." msgstr "" -"與安裝相關的預設值(按慣例會包含一個 ``site-packages`` 資料夾,它是由 :mod:" -"`site` 模組所處理)。" +"與安裝相關的預設值(按慣例會包含一個 ``site-packages`` 資料夾,它是" +"由 :mod:`site` 模組所處理)。" #: ../../tutorial/modules.rst:199 msgid "More details are at :ref:`sys-path-init`." @@ -518,8 +519,8 @@ msgstr "" #: ../../tutorial/modules.rst:251 msgid "" "A program doesn't run any faster when it is read from a ``.pyc`` file than " -"when it is read from a ``.py`` file; the only thing that's faster about ``." -"pyc`` files is the speed with which they are loaded." +"when it is read from a ``.py`` file; the only thing that's faster about " +"``.pyc`` files is the speed with which they are loaded." msgstr "" "讀取 ``.pyc`` 檔案時,程式的執行速度並不會比讀取 ``.py`` 檔案快。唯一比較快的" "地方是載入的速度。" @@ -627,7 +628,7 @@ msgid "" ">>> import fibo, sys\n" ">>> dir(fibo)\n" "['__name__', 'fib', 'fib2']\n" -">>> dir(sys) \n" +">>> dir(sys)\n" "['__breakpointhook__', '__displayhook__', '__doc__', '__excepthook__',\n" " '__interactivehook__', '__loader__', '__name__', '__package__', " "'__spec__',\n" @@ -660,7 +661,7 @@ msgstr "" ">>> import fibo, sys\n" ">>> dir(fibo)\n" "['__name__', 'fib', 'fib2']\n" -">>> dir(sys) \n" +">>> dir(sys)\n" "['__breakpointhook__', '__displayhook__', '__doc__', '__excepthook__',\n" " '__interactivehook__', '__loader__', '__name__', '__package__', " "'__spec__',\n" @@ -717,8 +718,8 @@ msgstr "請注意,它列出所有類型的名稱:變數、模組、函式等 #: ../../tutorial/modules.rst:350 msgid "" ":func:`dir` does not list the names of built-in functions and variables. If " -"you want a list of those, they are defined in the standard module :mod:" -"`builtins`::" +"you want a list of those, they are defined in the standard " +"module :mod:`builtins`::" msgstr "" ":func:`dir` 不會列出內建函式和變數的名稱。如果你想要列出它們,它們被定義在標" "準模組 :mod:`builtins` 內: ::" @@ -726,7 +727,7 @@ msgstr "" #: ../../tutorial/modules.rst:354 msgid "" ">>> import builtins\n" -">>> dir(builtins) \n" +">>> dir(builtins)\n" "['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException',\n" " 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning',\n" " 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError',\n" @@ -759,7 +760,7 @@ msgid "" " 'zip']" msgstr "" ">>> import builtins\n" -">>> dir(builtins) \n" +">>> dir(builtins)\n" "['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException',\n" " 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning',\n" " 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError',\n" @@ -814,22 +815,23 @@ msgstr "" msgid "" "Suppose you want to design a collection of modules (a \"package\") for the " "uniform handling of sound files and sound data. There are many different " -"sound file formats (usually recognized by their extension, for example: :" -"file:`.wav`, :file:`.aiff`, :file:`.au`), so you may need to create and " -"maintain a growing collection of modules for the conversion between the " -"various file formats. There are also many different operations you might " -"want to perform on sound data (such as mixing, adding echo, applying an " -"equalizer function, creating an artificial stereo effect), so in addition " -"you will be writing a never-ending stream of modules to perform these " -"operations. Here's a possible structure for your package (expressed in " -"terms of a hierarchical filesystem):" +"sound file formats (usually recognized by their extension, for " +"example: :file:`.wav`, :file:`.aiff`, :file:`.au`), so you may need to " +"create and maintain a growing collection of modules for the conversion " +"between the various file formats. There are also many different operations " +"you might want to perform on sound data (such as mixing, adding echo, " +"applying an equalizer function, creating an artificial stereo effect), so in " +"addition you will be writing a never-ending stream of modules to perform " +"these operations. Here's a possible structure for your package (expressed " +"in terms of a hierarchical filesystem):" msgstr "" "假設你想設計一個能統一處理音訊檔案及音訊數據的模組集(「套件」)。因為音訊檔" -"案有很多的不同的格式(通常以它們的副檔名來辨識,例如::file:`.wav`、:file:`." -"aiff`、:file:`.au`\\ ),因此,為了不同檔案格式之間的轉換,你會需要建立和維護" -"一個不斷增長的模組集合。為了要達成對音訊數據的許多不同作業(例如,音訊混合、" -"增加回聲、套用等化器功能、創造人工立體音效),你將編寫一系列無止盡的模組來執" -"行這些作業。以下是你的套件可能的架構(以階層式檔案系統的方式表示):" +"案有很多的不同的格式(通常以它們的副檔名來辨識,例" +"如::file:`.wav`、:file:`.aiff`、:file:`.au`\\ ),因此,為了不同檔案格式之間" +"的轉換,你會需要建立和維護一個不斷增長的模組集合。為了要達成對音訊數據的許多" +"不同作業(例如,音訊混合、增加回聲、套用等化器功能、創造人工立體音效),你將" +"編寫一系列無止盡的模組來執行這些作業。以下是你的套件可能的架構(以階層式檔案" +"系統的方式表示):" #: ../../tutorial/modules.rst:410 msgid "" @@ -860,8 +862,8 @@ msgstr "" #: ../../tutorial/modules.rst:436 msgid "" -"When importing the package, Python searches through the directories on ``sys." -"path`` looking for the package subdirectory." +"When importing the package, Python searches through the directories on " +"``sys.path`` looking for the package subdirectory." msgstr "Import 套件時,Python 會搜尋 ``sys.path`` 裡的目錄,尋找套件的子目錄。" #: ../../tutorial/modules.rst:439 @@ -874,11 +876,11 @@ msgid "" "can just be an empty file, but it can also execute initialization code for " "the package or set the ``__all__`` variable, described later." msgstr "" -"目錄中必須含有 :file:`__init__.py` 檔案,才會被 Pyhon 當成套件(除非有使用 :" -"term:`namespace package`,為一個相對進階的功能);這樣可以避免一些以常用名稱" -"命名(例如 ``string``\\ )的目錄,無意中隱藏了較晚出現在模組搜尋路徑中的有效" -"模組。在最簡單的情況,:file:`__init__.py` 可以只是一個空白檔案;但它也可以執" -"行套件的初始化程式碼,或設置 ``__all__`` 變數,之後會詳述。" +"目錄中必須含有 :file:`__init__.py` 檔案,才會被 Pyhon 當成套件(除非有使" +"用 :term:`namespace package`,為一個相對進階的功能);這樣可以避免一些以常用" +"名稱命名(例如 ``string``\\ )的目錄,無意中隱藏了較晚出現在模組搜尋路徑中的" +"有效模組。在最簡單的情況,:file:`__init__.py` 可以只是一個空白檔案;但它也可" +"以執行套件的初始化程式碼,或設置 ``__all__`` 變數,之後會詳述。" #: ../../tutorial/modules.rst:447 msgid "" @@ -933,8 +935,8 @@ msgstr "from sound.effects.echo import echofilter" #: ../../tutorial/modules.rst:470 msgid "" -"Again, this loads the submodule :mod:`!echo`, but this makes its function :" -"func:`!echofilter` directly available::" +"Again, this loads the submodule :mod:`!echo`, but this makes its " +"function :func:`!echofilter` directly available::" msgstr "" "同樣地,這樣也會載入子模組 :mod:`!echo`,但它的函式 :func:`!echofilter` 就可" "以直接使用: ::" @@ -949,8 +951,8 @@ msgid "" "submodule (or subpackage) of the package, or some other name defined in the " "package, like a function, class or variable. The ``import`` statement first " "tests whether the item is defined in the package; if not, it assumes it is a " -"module and attempts to load it. If it fails to find it, an :exc:" -"`ImportError` exception is raised." +"module and attempts to load it. If it fails to find it, " +"an :exc:`ImportError` exception is raised." msgstr "" "請注意,使用 ``from package import item`` 時,item 可以是套件的子模組(或子套" "件),也可以是套件中被定義的名稱,像是函式、class (類別)或變數。``import`` " @@ -1001,8 +1003,8 @@ msgstr "" "慣例:如果套件的 :file:`__init__.py` 程式碼有定義一個名為 ``__all__`` 的 " "list,若遇到 ``from package import *`` 的時候,它就會是要被 import 的模組名" "稱。發布套件的新版本時,套件作者可自行決定是否更新此 list。如果套件作者認為沒" -"有人會從他的套件中 import \\*,他也可能會決定不支援這個 list。舉例來說,:" -"file:`sound/effects/__init__.py` 檔案可包含以下程式碼: ::" +"有人會從他的套件中 import \\*,他也可能會決定不支援這個 list。舉例來" +"說,:file:`sound/effects/__init__.py` 檔案可包含以下程式碼: ::" #: ../../tutorial/modules.rst:511 msgid "__all__ = [\"echo\", \"surround\", \"reverse\"]" @@ -1025,8 +1027,8 @@ msgid "" "submodule, because it is shadowed by the locally defined ``reverse`` " "function::" msgstr "" -"請注意,子模組可能會被區域定義 (locally defined) 的名稱遮蔽。例如,如果你在 :" -"file:`sound/effects/__init__.py` 檔案中新增了一個 ``reverse`` 函式,則 " +"請注意,子模組可能會被區域定義 (locally defined) 的名稱遮蔽。例如,如果你" +"在 :file:`sound/effects/__init__.py` 檔案中新增了一個 ``reverse`` 函式,則 " "``from sound.effects import *`` 只會引入兩個子模組 ``echo`` 和 ``surround``," "但\\ *不是* ``reverse`` 子模組,因為它被區域定義的 ``reverse`` 函式遮蔽" "了: ::" @@ -1047,9 +1049,9 @@ msgstr "" msgid "" "If ``__all__`` is not defined, the statement ``from sound.effects import *`` " "does *not* import all submodules from the package :mod:`!sound.effects` into " -"the current namespace; it only ensures that the package :mod:`!sound." -"effects` has been imported (possibly running any initialization code in :" -"file:`__init__.py`) and then imports whatever names are defined in the " +"the current namespace; it only ensures that the package :mod:`!" +"sound.effects` has been imported (possibly running any initialization code " +"in :file:`__init__.py`) and then imports whatever names are defined in the " "package. This includes any names defined (and submodules explicitly loaded) " "by :file:`__init__.py`. It also includes any submodules of the package that " "were explicitly loaded by previous :keyword:`import` statements. Consider " @@ -1058,9 +1060,9 @@ msgstr "" "如果 ``__all__`` 沒有被定義,``from sound.effects import *`` 陳述式\\ *並不會" "*\\ 把 :mod:`!sound.effects` 套件中所有子模組都 import 到當前的命名空間;它只" "保證 :mod:`!sound.effects` 套件有被 import(可能會運行 :file:`__init__.py` 中" -"的初始化程式碼),然後 import 套件中被定義的全部名稱。這包含 :file:`__init__." -"py` 定義(以及被明確載入的子模組)的任何名稱。它也包括任何之前被 :keyword:" -"`import` 陳述式明確載入的套件子模組。請看以下程式碼: ::" +"的初始化程式碼),然後 import 套件中被定義的全部名稱。這包" +"含 :file:`__init__.py` 定義(以及被明確載入的子模組)的任何名稱。它也包括任何" +"之前被 :keyword:`import` 陳述式明確載入的套件子模組。請看以下程式碼: ::" #: ../../tutorial/modules.rst:541 msgid "" @@ -1075,9 +1077,9 @@ msgstr "" #: ../../tutorial/modules.rst:545 msgid "" "In this example, the :mod:`!echo` and :mod:`!surround` modules are imported " -"in the current namespace because they are defined in the :mod:`!sound." -"effects` package when the ``from...import`` statement is executed. (This " -"also works when ``__all__`` is defined.)" +"in the current namespace because they are defined in the :mod:`!" +"sound.effects` package when the ``from...import`` statement is executed. " +"(This also works when ``__all__`` is defined.)" msgstr "" "此例中,當 ``from...import`` 陳述式被執行時,:mod:`!echo` 和 :mod:`!" "surround` 模組被 import 進當前的命名空間,因為它們是在 :mod:`!sound.effects` " @@ -1110,21 +1112,21 @@ msgstr "套件內引用" msgid "" "When packages are structured into subpackages (as with the :mod:`!sound` " "package in the example), you can use absolute imports to refer to submodules " -"of siblings packages. For example, if the module :mod:`!sound.filters." -"vocoder` needs to use the :mod:`!echo` module in the :mod:`!sound.effects` " -"package, it can use ``from sound.effects import echo``." +"of siblings packages. For example, if the module :mod:`!" +"sound.filters.vocoder` needs to use the :mod:`!echo` module in the :mod:`!" +"sound.effects` package, it can use ``from sound.effects import echo``." msgstr "" "當套件的結構為多個子套件的組合時(如同範例中的 :mod:`!sound` 套件),可以使用" -"「絕對 (absolute) import」,引用同層套件中的子模組。例如,要在 :mod:`!sound." -"filters.vocoder` 模組中使用 :mod:`!sound.effects` 中的 :mod:`!echo` 模組時," -"可以用 ``from sound.effects import echo``。" +"「絕對 (absolute) import」,引用同層套件中的子模組。例如,要在 :mod:`!" +"sound.filters.vocoder` 模組中使用 :mod:`!sound.effects` 中的 :mod:`!echo` 模" +"組時,可以用 ``from sound.effects import echo``。" #: ../../tutorial/modules.rst:571 msgid "" "You can also write relative imports, with the ``from module import name`` " "form of import statement. These imports use leading dots to indicate the " -"current and parent packages involved in the relative import. From the :mod:" -"`!surround` module for example, you might use::" +"current and parent packages involved in the relative import. From " +"the :mod:`!surround` module for example, you might use::" msgstr "" "你也可以用 ``from module import name`` 的 import 陳述式,編寫「相對 " "(relative) import」。這些 import 使用前導句號指示相對 import 中的當前套件和母" @@ -1163,10 +1165,10 @@ msgid "" "that file is executed. This variable can be modified; doing so affects " "future searches for modules and subpackages contained in the package." msgstr "" -"套件也支援一個特殊屬性 :attr:`~module.__path__`。它在初始化時是一個字串的\\ :" -"term:`序列 <sequence>`\\ 的 :file:`__init__.py` 檔案所在的目錄名稱,初始化時" -"機是在這個檔案的程式碼被執行之前。這個變數可以被修改,但這樣做會影響將來對套" -"件內的模組和子套件的搜尋。" +"套件也支援一個特殊屬性 :attr:`~module.__path__`。它在初始化時是一個字串的" +"\\ :term:`序列 <sequence>`\\ 的 :file:`__init__.py` 檔案所在的目錄名稱,初始" +"化時機是在這個檔案的程式碼被執行之前。這個變數可以被修改,但這樣做會影響將來" +"對套件內的模組和子套件的搜尋。" #: ../../tutorial/modules.rst:595 msgid "" diff --git a/tutorial/stdlib.po b/tutorial/stdlib.po index ed03a48a61..854ddf9677 100644 --- a/tutorial/stdlib.po +++ b/tutorial/stdlib.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -49,6 +48,12 @@ msgid "" ">>> os.system('mkdir today') # Run the command mkdir in the system shell\n" "0" msgstr "" +">>> import os\n" +">>> os.getcwd() # 回傳目前的工作目錄\n" +"'C:\\\\Python313'\n" +">>> os.chdir('/server/accesslogs') # 改變目前的工作目錄\n" +">>> os.system('mkdir today') # 在系統 shell 中執行 mkdir 指令\n" +"0" #: ../../tutorial/stdlib.rst:23 msgid "" @@ -133,8 +138,8 @@ msgid "" "arguments are stored in the :mod:`sys` module's *argv* attribute as a list. " "For instance, let's take the following :file:`demo.py` file::" msgstr "" -"通用工具腳本常需要處理命令列引數。這些引數會以 list(串列)形式存放在 :mod:" -"`sys` 模組的 *argv* 屬性中。例如以下 :file:`demo.py` 檔案: ::" +"通用工具腳本常需要處理命令列引數。這些引數會以 list(串列)形式存放" +"在 :mod:`sys` 模組的 *argv* 屬性中。例如以下 :file:`demo.py` 檔案: ::" #: ../../tutorial/stdlib.rst:70 msgid "" @@ -189,9 +194,9 @@ msgstr "" #: ../../tutorial/stdlib.rst:93 msgid "" -"When run at the command line with ``python top.py --lines=5 alpha.txt beta." -"txt``, the script sets ``args.lines`` to ``5`` and ``args.filenames`` to " -"``['alpha.txt', 'beta.txt']``." +"When run at the command line with ``python top.py --lines=5 alpha.txt " +"beta.txt``, the script sets ``args.lines`` to ``5`` and ``args.filenames`` " +"to ``['alpha.txt', 'beta.txt']``." msgstr "" "當 ``python top.py --lines=5 alpha.txt beta.txt`` 在命令列執行時,該腳本會將 " "``args.lines`` 設為 ``5``,並將 ``args.filenames`` 設為 ``['alpha.txt', " @@ -215,6 +220,8 @@ msgid "" ">>> sys.stderr.write('Warning, log file not found starting a new one\\n')\n" "Warning, log file not found starting a new one" msgstr "" +">>> sys.stderr.write('Warning, log file not found starting a new one\\n')\n" +"Warning, log file not found starting a new one" #: ../../tutorial/stdlib.rst:110 msgid "The most direct way to terminate a script is to use ``sys.exit()``." @@ -303,6 +310,15 @@ msgid "" ">>> random.randrange(6) # random integer chosen from range(6)\n" "4" msgstr "" +">>> import random\n" +">>> random.choice(['apple', 'pear', 'banana'])\n" +"'apple'\n" +">>> random.sample(range(100), 10) # 不重複抽樣\n" +"[30, 83, 16, 4, 8, 81, 41, 50, 18, 33]\n" +">>> random.random() # 區間 [0.0, 1.0) 中的隨機浮點數\n" +"0.17970987693706186\n" +">>> random.randrange(6) # 從 range(6) 中隨機選擇整數\n" +"4" #: ../../tutorial/stdlib.rst:161 msgid "" @@ -348,8 +364,9 @@ msgid "" "internet protocols. Two of the simplest are :mod:`urllib.request` for " "retrieving data from URLs and :mod:`smtplib` for sending mail::" msgstr "" -"Python 中有許多存取網路以及處理網路協定。最簡單的兩個例子包括 :mod:`urllib." -"request` 模組可以從網址抓取資料以及 :mod:`smtplib` 可以用來寄郵件: ::" +"Python 中有許多存取網路以及處理網路協定。最簡單的兩個例子包" +"括 :mod:`urllib.request` 模組可以從網址抓取資料以及 :mod:`smtplib` 可以用來寄" +"郵件: ::" #: ../../tutorial/stdlib.rst:185 msgid "" @@ -373,6 +390,25 @@ msgid "" "... \"\"\")\n" ">>> server.quit()" msgstr "" +">>> from urllib.request import urlopen\n" +">>> with urlopen('http://worldtimeapi.org/api/timezone/etc/UTC.txt') as " +"response:\n" +"... for line in response:\n" +"... line = line.decode() # 將 bytes 轉換為 str\n" +"... if line.startswith('datetime'):\n" +"... print(line.rstrip()) # 移除最後面的換行符號\n" +"...\n" +"datetime: 2022-01-01T01:36:47.689215+00:00\n" +"\n" +">>> import smtplib\n" +">>> server = smtplib.SMTP('localhost')\n" +">>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org',\n" +"... \"\"\"To: jcaesar@example.org\n" +"... From: soothsayer@example.org\n" +"...\n" +"... Beware the Ides of March.\n" +"... \"\"\")\n" +">>> server.quit()" #: ../../tutorial/stdlib.rst:204 msgid "(Note that the second example needs a mailserver running on localhost.)" @@ -392,9 +428,7 @@ msgid "" msgstr "" ":mod:`datetime` 模組提供許多 class 可以操作日期以及時間,從簡單從複雜都有。模" "組支援日期與時間的運算,而實作的重點是有效率的成員擷取以達到輸出格式化以及操" -"作。模組也提供支援時區換算的類別。\n" -"\n" -"::" +"作。模組也提供支援時區換算的類別。 ::" #: ../../tutorial/stdlib.rst:218 msgid "" @@ -412,6 +446,19 @@ msgid "" ">>> age.days\n" "14368" msgstr "" +">>> # 能夠輕易建立與格式化\n" +">>> from datetime import date\n" +">>> now = date.today()\n" +">>> now\n" +"datetime.date(2003, 12, 2)\n" +">>> now.strftime(\"%m-%d-%y. %d %b %Y is a %A on the %d day of %B.\")\n" +"'12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December.'\n" +"\n" +">>> # 支援運算\n" +">>> birthday = date(1964, 7, 31)\n" +">>> age = now - birthday\n" +">>> age.days\n" +"14368" #: ../../tutorial/stdlib.rst:236 msgid "Data Compression" @@ -420,13 +467,13 @@ msgstr "資料壓縮" #: ../../tutorial/stdlib.rst:238 msgid "" "Common data archiving and compression formats are directly supported by " -"modules including: :mod:`zlib`, :mod:`gzip`, :mod:`bz2`, :mod:`lzma`, :mod:" -"`zipfile` and :mod:`tarfile`. ::" +"modules " +"including: :mod:`zlib`, :mod:`gzip`, :mod:`bz2`, :mod:`lzma`, :mod:`zipfile` " +"and :mod:`tarfile`. ::" msgstr "" -"常見的解壓縮以及壓縮格式都有直接支援的模組。包括::mod:`zlib`、:mod:`gzip`、:" -"mod:`bz2`、:mod:`lzma`、:mod:`zipfile` 以及 :mod:`tarfile`。\n" -"\n" -"::" +"常見的解壓縮以及壓縮格式都有直接支援的模組。包" +"括::mod:`zlib`、:mod:`gzip`、:mod:`bz2`、:mod:`lzma`、:mod:`zipfile` 以" +"及 :mod:`tarfile`。 ::" #: ../../tutorial/stdlib.rst:242 msgid "" @@ -442,6 +489,17 @@ msgid "" ">>> zlib.crc32(s)\n" "226805979" msgstr "" +">>> import zlib\n" +">>> s = b'witch which has which witches wrist watch'\n" +">>> len(s)\n" +"41\n" +">>> t = zlib.compress(s)\n" +">>> len(t)\n" +"37\n" +">>> zlib.decompress(t)\n" +"b'witch which has which witches wrist watch'\n" +">>> zlib.crc32(s)\n" +"226805979" #: ../../tutorial/stdlib.rst:258 msgid "Performance Measurement" @@ -459,11 +517,12 @@ msgstr "" #: ../../tutorial/stdlib.rst:264 msgid "" "For example, it may be tempting to use the tuple packing and unpacking " -"feature instead of the traditional approach to swapping arguments. The :mod:" -"`timeit` module quickly demonstrates a modest performance advantage::" +"feature instead of the traditional approach to swapping arguments. " +"The :mod:`timeit` module quickly demonstrates a modest performance " +"advantage::" msgstr "" -"舉例來說,有人可能會試著用 tuple 的打包機制來交換引數代替傳統的方式。:mod:" -"`timeit` 模組可以迅速地展示效能的進步: ::" +"舉例來說,有人可能會試著用 tuple 的打包機制來交換引數代替傳統的方" +"式。:mod:`timeit` 模組可以迅速地展示效能的進步: ::" #: ../../tutorial/stdlib.rst:268 msgid "" @@ -485,9 +544,9 @@ msgid "" "and :mod:`pstats` modules provide tools for identifying time critical " "sections in larger blocks of code." msgstr "" -"相對於 :mod:`timeit` 模組提供這麼細的粒度,:mod:`profile` 模組以及 :mod:" -"`pstats` 模組則提供了一些在大型的程式碼識別時間使用上關鍵的區塊 (time " -"critical section) 的工具。" +"相對於 :mod:`timeit` 模組提供這麼細的粒度,:mod:`profile` 模組以" +"及 :mod:`pstats` 模組則提供了一些在大型的程式碼識別時間使用上關鍵的區塊 " +"(time critical section) 的工具。" #: ../../tutorial/stdlib.rst:282 msgid "Quality Control" @@ -529,6 +588,16 @@ msgid "" "import doctest\n" "doctest.testmod() # automatically validate the embedded tests" msgstr "" +"def average(values):\n" +" \"\"\"計算數字串列的算術平均數。\n" +"\n" +" >>> print(average([20, 30, 70]))\n" +" 40.0\n" +" \"\"\"\n" +" return sum(values) / len(values)\n" +"\n" +"import doctest\n" +"doctest.testmod() # 自動驗證內嵌的測試" #: ../../tutorial/stdlib.rst:306 msgid "" @@ -555,6 +624,19 @@ msgid "" "\n" "unittest.main() # Calling from the command line invokes all tests" msgstr "" +"import unittest\n" +"\n" +"class TestStatisticalFunctions(unittest.TestCase):\n" +"\n" +" def test_average(self):\n" +" self.assertEqual(average([20, 30, 70]), 40.0)\n" +" self.assertEqual(round(average([1, 5, 7]), 1), 4.3)\n" +" with self.assertRaises(ZeroDivisionError):\n" +" average([])\n" +" with self.assertRaises(TypeError):\n" +" average(20, 30, 70)\n" +"\n" +"unittest.main() # 從命令列呼叫會執行所有測試" #: ../../tutorial/stdlib.rst:328 msgid "Batteries Included" @@ -598,16 +680,16 @@ msgid "" "The :mod:`json` package provides robust support for parsing this popular " "data interchange format. The :mod:`csv` module supports direct reading and " "writing of files in Comma-Separated Value format, commonly supported by " -"databases and spreadsheets. XML processing is supported by the :mod:`xml." -"etree.ElementTree`, :mod:`xml.dom` and :mod:`xml.sax` packages. Together, " -"these modules and packages greatly simplify data interchange between Python " -"applications and other tools." +"databases and spreadsheets. XML processing is supported by " +"the :mod:`xml.etree.ElementTree`, :mod:`xml.dom` and :mod:`xml.sax` " +"packages. Together, these modules and packages greatly simplify data " +"interchange between Python applications and other tools." msgstr "" ":mod:`json` 套件對 JSON 資料交換格式的剖析,提供強大的支援。:mod:`csv` 模組則" -"提供直接讀寫 CSV(以逗號分隔值的檔案格式,通常資料庫和電子表格都有支援)。:" -"mod:`xml.etree.ElementTree`、:mod:`xml.dom` 與 :mod:`xml.sax` 套件則支援 XML " -"的處理。綜觀所有,這些模組和套件都簡化了 Python 應用程式與其他工具之間的資料" -"交換。" +"提供直接讀寫 CSV(以逗號分隔值的檔案格式,通常資料庫和電子表格都有支" +"援)。:mod:`xml.etree.ElementTree`、:mod:`xml.dom` 與 :mod:`xml.sax` 套件則支" +"援 XML 的處理。綜觀所有,這些模組和套件都簡化了 Python 應用程式與其他工具之間" +"的資料交換。" #: ../../tutorial/stdlib.rst:353 msgid "" @@ -620,8 +702,8 @@ msgstr "" #: ../../tutorial/stdlib.rst:357 msgid "" -"Internationalization is supported by a number of modules including :mod:" -"`gettext`, :mod:`locale`, and the :mod:`codecs` package." +"Internationalization is supported by a number of modules " +"including :mod:`gettext`, :mod:`locale`, and the :mod:`codecs` package." msgstr "" "有數種支援國際化的模組,包括 :mod:`gettext`、:mod:`locale` 和 :mod:`codecs` " "等套件。" diff --git a/tutorial/stdlib2.po b/tutorial/stdlib2.po index 1b2f36d17e..deded95c48 100644 --- a/tutorial/stdlib2.po +++ b/tutorial/stdlib2.po @@ -189,15 +189,15 @@ msgstr "" msgid "" "The :meth:`~string.Template.substitute` method raises a :exc:`KeyError` when " "a placeholder is not supplied in a dictionary or a keyword argument. For " -"mail-merge style applications, user supplied data may be incomplete and the :" -"meth:`~string.Template.safe_substitute` method may be more appropriate --- " -"it will leave placeholders unchanged if data is missing::" +"mail-merge style applications, user supplied data may be incomplete and " +"the :meth:`~string.Template.safe_substitute` method may be more appropriate " +"--- it will leave placeholders unchanged if data is missing::" msgstr "" -"如果在 dictionary 或關鍵字引數中未提供某個佔位符號的值,那麼 :meth:`~string." -"Template.substitute` method 將引發 :exc:`KeyError`。對於郵件合併 (mail-" -"merge) 類型的應用程式,使用者提供的資料有可能是不完整的,此時使用 :meth:" -"`~string.Template.safe_substitute` method 會更適當——如果資料有缺少,它會保持" -"佔位符號不變: ::" +"如果在 dictionary 或關鍵字引數中未提供某個佔位符號的值,那" +"麼 :meth:`~string.Template.substitute` method 將引發 :exc:`KeyError`。對於郵" +"件合併 (mail-merge) 類型的應用程式,使用者提供的資料有可能是不完整的,此時使" +"用 :meth:`~string.Template.safe_substitute` method 會更適當——如果資料有缺少," +"它會保持佔位符號不變: ::" #: ../../tutorial/stdlib2.rst:94 msgid "" @@ -285,20 +285,20 @@ msgstr "二進制資料記錄編排 (Binary Data Record Layouts)" #: ../../tutorial/stdlib2.rst:136 msgid "" -"The :mod:`struct` module provides :func:`~struct.pack` and :func:`~struct." -"unpack` functions for working with variable length binary record formats. " -"The following example shows how to loop through header information in a ZIP " -"file without using the :mod:`zipfile` module. Pack codes ``\"H\"`` and " -"``\"I\"`` represent two and four byte unsigned numbers respectively. The " -"``\"<\"`` indicates that they are standard size and in little-endian byte " -"order::" +"The :mod:`struct` module provides :func:`~struct.pack` " +"and :func:`~struct.unpack` functions for working with variable length binary " +"record formats. The following example shows how to loop through header " +"information in a ZIP file without using the :mod:`zipfile` module. Pack " +"codes ``\"H\"`` and ``\"I\"`` represent two and four byte unsigned numbers " +"respectively. The ``\"<\"`` indicates that they are standard size and in " +"little-endian byte order::" msgstr "" ":mod:`struct` 模組提供了 :func:`~struct.pack` 和 :func:`~struct.unpack` 函" -"式,用於處理可變動長度的二進制記錄格式。以下範例說明,如何在不使用 :mod:" -"`zipfile` 模組的情況下,使用迴圈瀏覽一個 ZIP 檔案中的標頭資訊 (header " -"information)。壓縮程式碼 ``\"H\"`` 和 ``\"I\"`` 分別代表兩個和四個位元組的無" -"符號數 (unsigned number)。``\"<\"`` 表示它們是標準大小,並使用小端 (little-" -"endian) 位元組順序: ::" +"式,用於處理可變動長度的二進制記錄格式。以下範例說明,如何在不使" +"用 :mod:`zipfile` 模組的情況下,使用迴圈瀏覽一個 ZIP 檔案中的標頭資訊 " +"(header information)。壓縮程式碼 ``\"H\"`` 和 ``\"I\"`` 分別代表兩個和四個位" +"元組的無符號數 (unsigned number)。``\"<\"`` 表示它們是標準大小,並使用小端 " +"(little-endian) 位元組順序: ::" #: ../../tutorial/stdlib2.rst:144 msgid "" @@ -413,9 +413,10 @@ msgid "" "and more reliable." msgstr "" "儘管這些工具很強大,但很小的設計錯誤也可能導致一些難以重現的問題。所以,任務" -"協調的首選方法是,把所有對資源的存取集中到單一的執行緒中,然後使用 :mod:" -"`queue` 模組向該執行緒饋送來自其他執行緒的請求。應用程式若使用 :class:" -"`~queue.Queue` 物件進行執行緒間的通信和協調,會更易於設計、更易讀、更可靠。" +"協調的首選方法是,把所有對資源的存取集中到單一的執行緒中,然後使" +"用 :mod:`queue` 模組向該執行緒饋送來自其他執行緒的請求。應用程式若使" +"用 :class:`~queue.Queue` 物件進行執行緒間的通信和協調,會更易於設計、更易讀、" +"更可靠。" #: ../../tutorial/stdlib2.rst:214 msgid "Logging" @@ -424,8 +425,8 @@ msgstr "日誌記錄 (Logging)" #: ../../tutorial/stdlib2.rst:216 msgid "" "The :mod:`logging` module offers a full featured and flexible logging " -"system. At its simplest, log messages are sent to a file or to ``sys." -"stderr``::" +"system. At its simplest, log messages are sent to a file or to " +"``sys.stderr``::" msgstr "" ":mod:`logging` 模組提供功能齊全且富彈性的日誌記錄系統。在最簡單的情況下,日誌" "訊息會被發送到檔案或 ``sys.stderr``: ::" @@ -465,15 +466,16 @@ msgid "" "By default, informational and debugging messages are suppressed and the " "output is sent to standard error. Other output options include routing " "messages through email, datagrams, sockets, or to an HTTP Server. New " -"filters can select different routing based on message priority: :const:" -"`~logging.DEBUG`, :const:`~logging.INFO`, :const:`~logging.WARNING`, :const:" -"`~logging.ERROR`, and :const:`~logging.CRITICAL`." +"filters can select different routing based on message " +"priority: :const:`~logging.DEBUG`, :const:`~logging.INFO`, :const:`~logging.WARNING`, :const:`~logging.ERROR`, " +"and :const:`~logging.CRITICAL`." msgstr "" "在預設情況,資訊和除錯訊息不會被顯示,其輸出會被發送到標準錯誤 (standard " "error)。其他輸出選項包括,將訊息轉發到電子郵件、資料報 (datagram)、網路插座 " "(socket) 或 HTTP 伺服器。新的過濾器可以根據訊息的優先順序,選擇不同的路由 " -"(routing) 方式::const:`~logging.DEBUG`、:const:`~logging.INFO`、:const:" -"`~logging.WARNING`、:const:`~logging.ERROR` 及 :const:`~logging.CRITICAL`。" +"(routing) 方" +"式::const:`~logging.DEBUG`、:const:`~logging.INFO`、:const:`~logging.WARNING`、:const:`~logging.ERROR` " +"及 :const:`~logging.CRITICAL`。" #: ../../tutorial/stdlib2.rst:241 msgid "" @@ -716,7 +718,7 @@ msgid "" "results in decimal floating point and binary floating point. The difference " "becomes significant if the results are rounded to the nearest cent::" msgstr "" -"例如,要計算 70 美分的手機充電加上 5% 稅金的總價,使用十進制浮點數和二進制浮" +"例如,要計算 70 美分的手機充電加上 5% 稅金的總價,使用十進制浮點數和二進制浮" "點數,會算出不同的答案。如果把計算結果四捨五入到最接近的美分,兩者的差異會更" "顯著: ::" diff --git a/using/android.po b/using/android.po index 24f937b566..868d2e3659 100644 --- a/using/android.po +++ b/using/android.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-04-02 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -60,51 +60,51 @@ msgstr "將 Python 加入 Android 應用程式" #: ../../using/android.rst:30 msgid "" -"These instructions are only needed if you're planning to compile Python for " -"Android yourself. Most users should *not* need to do this. Instead, use one " -"of the following tools, which will provide a much easier experience:" +"Most app developers should use one of the following tools, which will " +"provide a much easier experience:" msgstr "" -#: ../../using/android.rst:34 +#: ../../using/android.rst:33 msgid "" "`Briefcase <https://briefcase.readthedocs.io>`__, from the BeeWare project" msgstr "`Briefcase <https://briefcase.readthedocs.io>`__,由 BeeWare 專案提供" -#: ../../using/android.rst:35 +#: ../../using/android.rst:34 msgid "`Buildozer <https://buildozer.readthedocs.io>`__, from the Kivy project" msgstr "`Buildozer <https://buildozer.readthedocs.io>`__,由 Kivy 專案提供" -#: ../../using/android.rst:36 +#: ../../using/android.rst:35 msgid "`Chaquopy <https://chaquo.com/chaquopy>`__" msgstr "`Chaquopy <https://chaquo.com/chaquopy>`__" -#: ../../using/android.rst:37 +#: ../../using/android.rst:36 msgid "" "`pyqtdeploy <https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/>`__" msgstr "" "`pyqtdeploy <https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/>`__" -#: ../../using/android.rst:38 +#: ../../using/android.rst:37 msgid "`Termux <https://termux.dev/en/>`__" msgstr "`Termux <https://termux.dev/en/>`__" -#: ../../using/android.rst:40 +#: ../../using/android.rst:39 msgid "" "If you're sure you want to do all of this manually, read on. You can use " "the :source:`testbed app <Android/testbed>` as a guide; each step below " "contains a link to the relevant file." msgstr "" -#: ../../using/android.rst:44 +#: ../../using/android.rst:43 msgid "" -"Build Python by following the instructions in :source:`Android/README.md`." +"Build Python by following the instructions in :source:`Android/README.md`. " +"This will create the directory ``cross-build/HOST/prefix``." msgstr "" #: ../../using/android.rst:46 msgid "" "Add code to your :source:`build.gradle <Android/testbed/app/build.gradle." "kts>` file to copy the following items into your project. All except your " -"own Python code can be copied from ``cross-build/HOST/prefix/lib``:" +"own Python code can be copied from ``prefix/lib``:" msgstr "" #: ../../using/android.rst:50 diff --git a/using/cmdline.po b/using/cmdline.po index ee77384f74..c10b5b2360 100644 --- a/using/cmdline.po +++ b/using/cmdline.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-24 00:14+0000\n" +"POT-Creation-Date: 2025-04-09 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -236,7 +236,7 @@ msgid "" "path`." msgstr "" -#: ../../using/cmdline.rst:141 ../../using/cmdline.rst:790 +#: ../../using/cmdline.rst:141 ../../using/cmdline.rst:796 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_stdin`` with no " "arguments." @@ -417,26 +417,46 @@ msgid "See also the :option:`-P` and :option:`-I` (isolated) options." msgstr "另請參閱 :option:`-P` 和 :option:`-I` (isolated) 選項。" #: ../../using/cmdline.rst:293 +msgid "Enter interactive mode after execution." +msgstr "" + +#: ../../using/cmdline.rst:295 msgid "" -"When a script is passed as first argument or the :option:`-c` option is " -"used, enter interactive mode after executing the script or the command, even " -"when :data:`sys.stdin` does not appear to be a terminal. The :envvar:" -"`PYTHONSTARTUP` file is not read." +"Using the :option:`-i` option will enter interactive mode in any of the " +"following circumstances\\:" +msgstr "" + +#: ../../using/cmdline.rst:297 +msgid "When a script is passed as first argument" msgstr "" #: ../../using/cmdline.rst:298 +msgid "When the :option:`-c` option is used" +msgstr "" + +#: ../../using/cmdline.rst:299 +msgid "When the :option:`-m` option is used" +msgstr "" + +#: ../../using/cmdline.rst:301 +msgid "" +"Interactive mode will start even when :data:`sys.stdin` does not appear to " +"be a terminal. The :envvar:`PYTHONSTARTUP` file is not read." +msgstr "" + +#: ../../using/cmdline.rst:304 msgid "" "This can be useful to inspect global variables or a stack trace when a " "script raises an exception. See also :envvar:`PYTHONINSPECT`." msgstr "" -#: ../../using/cmdline.rst:304 +#: ../../using/cmdline.rst:310 msgid "" "Run Python in isolated mode. This also implies :option:`-E`, :option:`-P` " "and :option:`-s` options." msgstr "" -#: ../../using/cmdline.rst:307 +#: ../../using/cmdline.rst:313 msgid "" "In isolated mode :data:`sys.path` contains neither the script's directory " "nor the user's site-packages directory. All ``PYTHON*`` environment " @@ -444,7 +464,7 @@ msgid "" "the user from injecting malicious code." msgstr "" -#: ../../using/cmdline.rst:317 +#: ../../using/cmdline.rst:323 msgid "" "Remove assert statements and any code conditional on the value of :const:" "`__debug__`. Augment the filename for compiled (:term:`bytecode`) files by " @@ -452,58 +472,58 @@ msgid "" "envvar:`PYTHONOPTIMIZE`." msgstr "" -#: ../../using/cmdline.rst:322 ../../using/cmdline.rst:332 +#: ../../using/cmdline.rst:328 ../../using/cmdline.rst:338 msgid "Modify ``.pyc`` filenames according to :pep:`488`." msgstr "根據 :pep:`488` 修改 ``.pyc`` 檔案名稱。" -#: ../../using/cmdline.rst:328 +#: ../../using/cmdline.rst:334 msgid "" "Do :option:`-O` and also discard docstrings. Augment the filename for " "compiled (:term:`bytecode`) files by adding ``.opt-2`` before the ``.pyc`` " "extension (see :pep:`488`)." msgstr "" -#: ../../using/cmdline.rst:338 +#: ../../using/cmdline.rst:344 msgid "Don't prepend a potentially unsafe path to :data:`sys.path`:" msgstr "" -#: ../../using/cmdline.rst:340 +#: ../../using/cmdline.rst:346 msgid "" "``python -m module`` command line: Don't prepend the current working " "directory." msgstr "" -#: ../../using/cmdline.rst:342 +#: ../../using/cmdline.rst:348 msgid "" "``python script.py`` command line: Don't prepend the script's directory. If " "it's a symbolic link, resolve symbolic links." msgstr "" -#: ../../using/cmdline.rst:344 +#: ../../using/cmdline.rst:350 msgid "" "``python -c code`` and ``python`` (REPL) command lines: Don't prepend an " "empty string, which means the current working directory." msgstr "" -#: ../../using/cmdline.rst:347 +#: ../../using/cmdline.rst:353 msgid "" "See also the :envvar:`PYTHONSAFEPATH` environment variable, and :option:`-E` " "and :option:`-I` (isolated) options." msgstr "" -#: ../../using/cmdline.rst:355 +#: ../../using/cmdline.rst:361 msgid "" "Don't display the copyright and version messages even in interactive mode." msgstr "" -#: ../../using/cmdline.rst:362 +#: ../../using/cmdline.rst:368 msgid "" "Turn on hash randomization. This option only has an effect if the :envvar:" "`PYTHONHASHSEED` environment variable is set to ``0``, since hash " "randomization is enabled by default." msgstr "" -#: ../../using/cmdline.rst:366 +#: ../../using/cmdline.rst:372 msgid "" "On previous versions of Python, this option turns on hash randomization, so " "that the :meth:`~object.__hash__` values of str and bytes objects are " @@ -512,7 +532,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../using/cmdline.rst:372 +#: ../../using/cmdline.rst:378 msgid "" "Hash randomization is intended to provide protection against a denial-of-" "service caused by carefully chosen inputs that exploit the worst case " @@ -520,32 +540,32 @@ msgid "" "http://ocert.org/advisories/ocert-2011-003.html for details." msgstr "" -#: ../../using/cmdline.rst:377 +#: ../../using/cmdline.rst:383 msgid "" ":envvar:`PYTHONHASHSEED` allows you to set a fixed value for the hash seed " "secret." msgstr "" -#: ../../using/cmdline.rst:382 +#: ../../using/cmdline.rst:388 msgid "The option is no longer ignored." msgstr "" -#: ../../using/cmdline.rst:388 +#: ../../using/cmdline.rst:394 msgid "" "Don't add the :data:`user site-packages directory <site.USER_SITE>` to :data:" "`sys.path`." msgstr "" -#: ../../using/cmdline.rst:391 +#: ../../using/cmdline.rst:397 msgid "See also :envvar:`PYTHONNOUSERSITE`." msgstr "另請參閱 :envvar:`PYTHONNOUSERSITE`。" -#: ../../using/cmdline.rst:395 ../../using/cmdline.rst:887 -#: ../../using/cmdline.rst:899 +#: ../../using/cmdline.rst:401 ../../using/cmdline.rst:893 +#: ../../using/cmdline.rst:905 msgid ":pep:`370` -- Per user site-packages directory" msgstr "" -#: ../../using/cmdline.rst:400 +#: ../../using/cmdline.rst:406 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " @@ -553,21 +573,21 @@ msgid "" "main` if you want them to be triggered)." msgstr "" -#: ../../using/cmdline.rst:408 +#: ../../using/cmdline.rst:414 msgid "" "Force the stdout and stderr streams to be unbuffered. This option has no " "effect on the stdin stream." msgstr "" -#: ../../using/cmdline.rst:411 +#: ../../using/cmdline.rst:417 msgid "See also :envvar:`PYTHONUNBUFFERED`." msgstr "另請參閱 :envvar:`PYTHONUNBUFFERED`。" -#: ../../using/cmdline.rst:413 +#: ../../using/cmdline.rst:419 msgid "The text layer of the stdout and stderr streams now is unbuffered." msgstr "" -#: ../../using/cmdline.rst:419 +#: ../../using/cmdline.rst:425 msgid "" "Print a message each time a module is initialized, showing the place " "(filename or built-in module) from which it is loaded. When given twice (:" @@ -575,30 +595,30 @@ msgid "" "searching for a module. Also provides information on module cleanup at exit." msgstr "" -#: ../../using/cmdline.rst:424 +#: ../../using/cmdline.rst:430 msgid "" "The :mod:`site` module reports the site-specific paths and :file:`.pth` " "files being processed." msgstr "" -#: ../../using/cmdline.rst:428 +#: ../../using/cmdline.rst:434 msgid "See also :envvar:`PYTHONVERBOSE`." msgstr "另請參閱 :envvar:`PYTHONVERBOSE`。" -#: ../../using/cmdline.rst:434 +#: ../../using/cmdline.rst:440 msgid "" "Warning control. Python's warning machinery by default prints warning " "messages to :data:`sys.stderr`." msgstr "" -#: ../../using/cmdline.rst:437 ../../using/cmdline.rst:915 +#: ../../using/cmdline.rst:443 ../../using/cmdline.rst:921 msgid "" "The simplest settings apply a particular action unconditionally to all " "warnings emitted by a process (even those that are otherwise ignored by " "default)::" msgstr "" -#: ../../using/cmdline.rst:441 +#: ../../using/cmdline.rst:447 msgid "" "-Wdefault # Warn once per call location\n" "-Werror # Convert to exceptions\n" @@ -609,41 +629,41 @@ msgid "" "-Wignore # Never warn" msgstr "" -#: ../../using/cmdline.rst:449 +#: ../../using/cmdline.rst:455 msgid "" "The action names can be abbreviated as desired and the interpreter will " "resolve them to the appropriate action name. For example, ``-Wi`` is the " "same as ``-Wignore``." msgstr "" -#: ../../using/cmdline.rst:453 +#: ../../using/cmdline.rst:459 msgid "The full form of argument is::" msgstr "完整的引數形式為: ::" -#: ../../using/cmdline.rst:455 +#: ../../using/cmdline.rst:461 msgid "action:message:category:module:lineno" msgstr "action:message:category:module:lineno" -#: ../../using/cmdline.rst:457 +#: ../../using/cmdline.rst:463 msgid "" "Empty fields match all values; trailing empty fields may be omitted. For " "example ``-W ignore::DeprecationWarning`` ignores all DeprecationWarning " "warnings." msgstr "" -#: ../../using/cmdline.rst:461 +#: ../../using/cmdline.rst:467 msgid "" "The *action* field is as explained above but only applies to warnings that " "match the remaining fields." msgstr "" -#: ../../using/cmdline.rst:464 +#: ../../using/cmdline.rst:470 msgid "" "The *message* field must match the whole warning message; this match is case-" "insensitive." msgstr "" -#: ../../using/cmdline.rst:467 +#: ../../using/cmdline.rst:473 msgid "" "The *category* field matches the warning category (ex: " "``DeprecationWarning``). This must be a class name; the match test whether " @@ -651,19 +671,19 @@ msgid "" "warning category." msgstr "" -#: ../../using/cmdline.rst:472 +#: ../../using/cmdline.rst:478 msgid "" "The *module* field matches the (fully qualified) module name; this match is " "case-sensitive." msgstr "" -#: ../../using/cmdline.rst:475 +#: ../../using/cmdline.rst:481 msgid "" "The *lineno* field matches the line number, where zero matches all line " "numbers and is thus equivalent to an omitted line number." msgstr "" -#: ../../using/cmdline.rst:478 +#: ../../using/cmdline.rst:484 msgid "" "Multiple :option:`-W` options can be given; when a warning matches more than " "one option, the action for the last matching option is performed. Invalid :" @@ -671,7 +691,7 @@ msgid "" "invalid options when the first warning is issued)." msgstr "" -#: ../../using/cmdline.rst:483 +#: ../../using/cmdline.rst:489 msgid "" "Warnings can also be controlled using the :envvar:`PYTHONWARNINGS` " "environment variable and from within a Python program using the :mod:" @@ -679,31 +699,31 @@ msgid "" "can be used to use a regular expression on the warning message." msgstr "" -#: ../../using/cmdline.rst:488 ../../using/cmdline.rst:927 +#: ../../using/cmdline.rst:494 ../../using/cmdline.rst:933 msgid "" "See :ref:`warning-filter` and :ref:`describing-warning-filters` for more " "details." msgstr "" -#: ../../using/cmdline.rst:494 +#: ../../using/cmdline.rst:500 msgid "" "Skip the first line of the source, allowing use of non-Unix forms of ``#!" "cmd``. This is intended for a DOS specific hack only." msgstr "" -#: ../../using/cmdline.rst:500 +#: ../../using/cmdline.rst:506 msgid "" "Reserved for various implementation-specific options. CPython currently " "defines the following possible values:" msgstr "" -#: ../../using/cmdline.rst:503 +#: ../../using/cmdline.rst:509 msgid "" "``-X faulthandler`` to enable :mod:`faulthandler`. See also :envvar:" "`PYTHONFAULTHANDLER`." msgstr "" -#: ../../using/cmdline.rst:508 +#: ../../using/cmdline.rst:514 msgid "" "``-X showrefcount`` to output the total reference count and number of used " "memory blocks when the program finishes or after each statement in the " @@ -711,7 +731,7 @@ msgid "" "build>`." msgstr "" -#: ../../using/cmdline.rst:515 +#: ../../using/cmdline.rst:521 msgid "" "``-X tracemalloc`` to start tracing Python memory allocations using the :mod:" "`tracemalloc` module. By default, only the most recent frame is stored in a " @@ -720,14 +740,14 @@ msgid "" "envvar:`PYTHONTRACEMALLOC` for more information." msgstr "" -#: ../../using/cmdline.rst:524 +#: ../../using/cmdline.rst:530 msgid "" "``-X int_max_str_digits`` configures the :ref:`integer string conversion " "length limitation <int_max_str_digits>`. See also :envvar:" "`PYTHONINTMAXSTRDIGITS`." msgstr "" -#: ../../using/cmdline.rst:530 +#: ../../using/cmdline.rst:536 msgid "" "``-X importtime`` to show how long each import takes. It shows module name, " "cumulative time (including nested imports) and self time (excluding nested " @@ -736,35 +756,35 @@ msgid "" "asyncio'``. See also :envvar:`PYTHONPROFILEIMPORTTIME`." msgstr "" -#: ../../using/cmdline.rst:538 +#: ../../using/cmdline.rst:544 msgid "" "``-X dev``: enable :ref:`Python Development Mode <devmode>`, introducing " "additional runtime checks that are too expensive to be enabled by default. " "See also :envvar:`PYTHONDEVMODE`." msgstr "" -#: ../../using/cmdline.rst:544 +#: ../../using/cmdline.rst:550 msgid "" "``-X utf8`` enables the :ref:`Python UTF-8 Mode <utf8-mode>`. ``-X utf8=0`` " "explicitly disables :ref:`Python UTF-8 Mode <utf8-mode>` (even when it would " "otherwise activate automatically). See also :envvar:`PYTHONUTF8`." msgstr "" -#: ../../using/cmdline.rst:551 +#: ../../using/cmdline.rst:557 msgid "" "``-X pycache_prefix=PATH`` enables writing ``.pyc`` files to a parallel tree " "rooted at the given directory instead of to the code tree. See also :envvar:" "`PYTHONPYCACHEPREFIX`." msgstr "" -#: ../../using/cmdline.rst:557 +#: ../../using/cmdline.rst:563 msgid "" "``-X warn_default_encoding`` issues a :class:`EncodingWarning` when the " "locale-specific default encoding is used for opening files. See also :envvar:" "`PYTHONWARNDEFAULTENCODING`." msgstr "" -#: ../../using/cmdline.rst:563 +#: ../../using/cmdline.rst:569 msgid "" "``-X no_debug_ranges`` disables the inclusion of the tables mapping extra " "location information (end line, start column offset and end column offset) " @@ -774,7 +794,7 @@ msgid "" "envvar:`PYTHONNODEBUGRANGES`." msgstr "" -#: ../../using/cmdline.rst:572 +#: ../../using/cmdline.rst:578 msgid "" "``-X frozen_modules`` determines whether or not frozen modules are ignored " "by the import machinery. A value of ``on`` means they get imported and " @@ -786,7 +806,7 @@ msgid "" "`PYTHON_FROZEN_MODULES`." msgstr "" -#: ../../using/cmdline.rst:583 +#: ../../using/cmdline.rst:589 msgid "" "``-X perf`` enables support for the Linux ``perf`` profiler. When this " "option is provided, the ``perf`` profiler will be able to report Python " @@ -795,7 +815,7 @@ msgid "" "also :envvar:`PYTHONPERFSUPPORT` and :ref:`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:591 +#: ../../using/cmdline.rst:597 msgid "" "``-X perf_jit`` enables support for the Linux ``perf`` profiler with DWARF " "support. When this option is provided, the ``perf`` profiler will be able to " @@ -805,7 +825,7 @@ msgid "" "`PYTHON_PERF_JIT_SUPPORT` and :ref:`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:600 +#: ../../using/cmdline.rst:606 msgid "" ":samp:`-X cpu_count={n}` overrides :func:`os.cpu_count`, :func:`os." "process_cpu_count`, and :func:`multiprocessing.cpu_count`. *n* must be " @@ -814,7 +834,7 @@ msgid "" "`PYTHON_CPU_COUNT`. If *n* is ``default``, nothing is overridden." msgstr "" -#: ../../using/cmdline.rst:609 +#: ../../using/cmdline.rst:615 msgid "" ":samp:`-X presite={package.module}` specifies a module that should be " "imported before the :mod:`site` module is executed and before the :mod:" @@ -824,7 +844,7 @@ msgid "" "for this option to exist. See also :envvar:`PYTHON_PRESITE`." msgstr "" -#: ../../using/cmdline.rst:618 +#: ../../using/cmdline.rst:624 msgid "" ":samp:`-X gil={0,1}` forces the GIL to be disabled or enabled, respectively. " "Setting to ``0`` is only available in builds configured with :option:`--" @@ -832,50 +852,50 @@ msgid "" "threaded-cpython`." msgstr "" -#: ../../using/cmdline.rst:625 +#: ../../using/cmdline.rst:631 msgid "" "It also allows passing arbitrary values and retrieving them through the :" "data:`sys._xoptions` dictionary." msgstr "" -#: ../../using/cmdline.rst:630 +#: ../../using/cmdline.rst:636 msgid "Removed the ``-X showalloccount`` option." msgstr "移除 ``-X showalloccount`` 選項。" -#: ../../using/cmdline.rst:633 +#: ../../using/cmdline.rst:639 msgid "Removed the ``-X oldparser`` option." msgstr "移除 ``-X oldparser`` 選項。" -#: ../../using/cmdline.rst:639 +#: ../../using/cmdline.rst:645 msgid "Controlling color" msgstr "" -#: ../../using/cmdline.rst:641 +#: ../../using/cmdline.rst:647 msgid "" "The Python interpreter is configured by default to use colors to highlight " "output in certain situations such as when displaying tracebacks. This " "behavior can be controlled by setting different environment variables." msgstr "" -#: ../../using/cmdline.rst:645 +#: ../../using/cmdline.rst:651 msgid "" "Setting the environment variable ``TERM`` to ``dumb`` will disable color." msgstr "" -#: ../../using/cmdline.rst:647 +#: ../../using/cmdline.rst:653 msgid "" "If the |FORCE_COLOR|_ environment variable is set, then color will be " "enabled regardless of the value of TERM. This is useful on CI systems which " "aren’t terminals but can still display ANSI escape sequences." msgstr "" -#: ../../using/cmdline.rst:651 +#: ../../using/cmdline.rst:657 msgid "" "If the |NO_COLOR|_ environment variable is set, Python will disable all " "color in the output. This takes precedence over ``FORCE_COLOR``." msgstr "" -#: ../../using/cmdline.rst:654 +#: ../../using/cmdline.rst:660 msgid "" "All these environment variables are used also by other tools to control " "color output. To control the color output only in the Python interpreter, " @@ -884,19 +904,19 @@ msgid "" "``FORCE_COLOR``." msgstr "" -#: ../../using/cmdline.rst:669 +#: ../../using/cmdline.rst:675 msgid "Options you shouldn't use" msgstr "你不該使用的選項" -#: ../../using/cmdline.rst:673 +#: ../../using/cmdline.rst:679 msgid "Reserved for use by Jython_." msgstr "" -#: ../../using/cmdline.rst:681 +#: ../../using/cmdline.rst:687 msgid "Environment variables" msgstr "環境變數" -#: ../../using/cmdline.rst:683 +#: ../../using/cmdline.rst:689 msgid "" "These environment variables influence Python's behavior, they are processed " "before the command-line switches other than -E or -I. It is customary that " @@ -904,7 +924,7 @@ msgid "" "conflict." msgstr "" -#: ../../using/cmdline.rst:690 +#: ../../using/cmdline.rst:696 msgid "" "Change the location of the standard Python libraries. By default, the " "libraries are searched in :file:`{prefix}/lib/python{version}` and :file:" @@ -913,14 +933,14 @@ msgid "" "file:`/usr/local`." msgstr "" -#: ../../using/cmdline.rst:696 +#: ../../using/cmdline.rst:702 msgid "" "When :envvar:`PYTHONHOME` is set to a single directory, its value replaces " "both :file:`{prefix}` and :file:`{exec_prefix}`. To specify different " "values for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}`." msgstr "" -#: ../../using/cmdline.rst:703 +#: ../../using/cmdline.rst:709 msgid "" "Augment the default search path for module files. The format is the same as " "the shell's :envvar:`PATH`: one or more directory pathnames separated by :" @@ -928,21 +948,21 @@ msgid "" "existent directories are silently ignored." msgstr "" -#: ../../using/cmdline.rst:708 +#: ../../using/cmdline.rst:714 msgid "" "In addition to normal directories, individual :envvar:`PYTHONPATH` entries " "may refer to zipfiles containing pure Python modules (in either source or " "compiled form). Extension modules cannot be imported from zipfiles." msgstr "" -#: ../../using/cmdline.rst:712 +#: ../../using/cmdline.rst:718 msgid "" "The default search path is installation dependent, but generally begins " "with :file:`{prefix}/lib/python{version}` (see :envvar:`PYTHONHOME` above). " "It is *always* appended to :envvar:`PYTHONPATH`." msgstr "" -#: ../../using/cmdline.rst:716 +#: ../../using/cmdline.rst:722 msgid "" "An additional directory will be inserted in the search path in front of :" "envvar:`PYTHONPATH` as described above under :ref:`using-on-interface-" @@ -950,19 +970,19 @@ msgid "" "the variable :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:724 +#: ../../using/cmdline.rst:730 msgid "" "If this is set to a non-empty string, don't prepend a potentially unsafe " "path to :data:`sys.path`: see the :option:`-P` option for details." msgstr "" -#: ../../using/cmdline.rst:732 +#: ../../using/cmdline.rst:738 msgid "" "If this is set to a non-empty string, it overrides the :data:`sys." "platlibdir` value." msgstr "" -#: ../../using/cmdline.rst:740 +#: ../../using/cmdline.rst:746 msgid "" "If this is the name of a readable file, the Python commands in that file are " "executed before the first prompt is displayed in interactive mode. The file " @@ -973,7 +993,7 @@ msgid "" "file." msgstr "" -#: ../../using/cmdline.rst:747 ../../using/cmdline.rst:749 +#: ../../using/cmdline.rst:753 ../../using/cmdline.rst:755 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_startup`` with the " "filename as the argument when called on startup." @@ -981,14 +1001,14 @@ msgstr "" "引發一個附帶呼叫啟動時的檔案名稱為引數的\\ :ref:`稽核事件 <auditing>` " "``cpython.run_startup``。" -#: ../../using/cmdline.rst:755 +#: ../../using/cmdline.rst:761 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-O` option. If set to an integer, it is equivalent to specifying :" "option:`-O` multiple times." msgstr "" -#: ../../using/cmdline.rst:762 +#: ../../using/cmdline.rst:768 msgid "" "If this is set, it names a callable using dotted-path notation. The module " "containing the callable will be imported and then the callable will be run " @@ -999,68 +1019,68 @@ msgid "" "breakpointhook` to do nothing but return immediately." msgstr "" -#: ../../using/cmdline.rst:774 +#: ../../using/cmdline.rst:780 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-d` option. If set to an integer, it is equivalent to specifying :" "option:`-d` multiple times." msgstr "" -#: ../../using/cmdline.rst:778 +#: ../../using/cmdline.rst:784 msgid "" "This environment variable requires a :ref:`debug build of Python <debug-" "build>`, otherwise it's ignored." msgstr "" -#: ../../using/cmdline.rst:784 +#: ../../using/cmdline.rst:790 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-i` option." msgstr "" -#: ../../using/cmdline.rst:787 +#: ../../using/cmdline.rst:793 msgid "" "This variable can also be modified by Python code using :data:`os.environ` " "to force inspect mode on program termination." msgstr "" -#: ../../using/cmdline.rst:792 +#: ../../using/cmdline.rst:798 msgid "(also 3.11.10, 3.10.15, 3.9.20, and 3.8.20) Emits audit events." msgstr "" -#: ../../using/cmdline.rst:795 +#: ../../using/cmdline.rst:801 msgid "" "Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also " "executed. Emits audit events." msgstr "" -#: ../../using/cmdline.rst:802 +#: ../../using/cmdline.rst:808 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-u` option." msgstr "" -#: ../../using/cmdline.rst:808 +#: ../../using/cmdline.rst:814 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-v` option. If set to an integer, it is equivalent to specifying :" "option:`-v` multiple times." msgstr "" -#: ../../using/cmdline.rst:815 +#: ../../using/cmdline.rst:821 msgid "" "If this is set, Python ignores case in :keyword:`import` statements. This " "only works on Windows and macOS." msgstr "" -#: ../../using/cmdline.rst:821 +#: ../../using/cmdline.rst:827 msgid "" "If this is set to a non-empty string, Python won't try to write ``.pyc`` " "files on the import of source modules. This is equivalent to specifying " "the :option:`-B` option." msgstr "" -#: ../../using/cmdline.rst:828 +#: ../../using/cmdline.rst:834 msgid "" "If this is set, Python will write ``.pyc`` files in a mirror directory tree " "at this path, instead of in ``__pycache__`` directories within the source " @@ -1068,40 +1088,40 @@ msgid "" "``pycache_prefix=PATH`` option." msgstr "" -#: ../../using/cmdline.rst:838 +#: ../../using/cmdline.rst:844 msgid "" "If this variable is not set or set to ``random``, a random value is used to " "seed the hashes of str and bytes objects." msgstr "" -#: ../../using/cmdline.rst:841 +#: ../../using/cmdline.rst:847 msgid "" "If :envvar:`PYTHONHASHSEED` is set to an integer value, it is used as a " "fixed seed for generating the hash() of the types covered by the hash " "randomization." msgstr "" -#: ../../using/cmdline.rst:845 +#: ../../using/cmdline.rst:851 msgid "" "Its purpose is to allow repeatable hashing, such as for selftests for the " "interpreter itself, or to allow a cluster of python processes to share hash " "values." msgstr "" -#: ../../using/cmdline.rst:849 +#: ../../using/cmdline.rst:855 msgid "" "The integer must be a decimal number in the range [0,4294967295]. " "Specifying the value 0 will disable hash randomization." msgstr "" -#: ../../using/cmdline.rst:856 +#: ../../using/cmdline.rst:862 msgid "" "If this variable is set to an integer, it is used to configure the " "interpreter's global :ref:`integer string conversion length limitation " "<int_max_str_digits>`." msgstr "" -#: ../../using/cmdline.rst:864 +#: ../../using/cmdline.rst:870 msgid "" "If this is set before running the interpreter, it overrides the encoding " "used for stdin/stdout/stderr, in the syntax ``encodingname:errorhandler``. " @@ -1109,17 +1129,17 @@ msgid "" "have the same meaning as in :func:`str.encode`." msgstr "" -#: ../../using/cmdline.rst:869 +#: ../../using/cmdline.rst:875 msgid "" "For stderr, the ``:errorhandler`` part is ignored; the handler will always " "be ``'backslashreplace'``." msgstr "" -#: ../../using/cmdline.rst:872 +#: ../../using/cmdline.rst:878 msgid "The ``encodingname`` part is now optional." msgstr "" -#: ../../using/cmdline.rst:875 +#: ../../using/cmdline.rst:881 msgid "" "On Windows, the encoding specified by this variable is ignored for " "interactive console buffers unless :envvar:`PYTHONLEGACYWINDOWSSTDIO` is " @@ -1127,13 +1147,13 @@ msgid "" "not affected." msgstr "" -#: ../../using/cmdline.rst:882 +#: ../../using/cmdline.rst:888 msgid "" "If this is set, Python won't add the :data:`user site-packages directory " "<site.USER_SITE>` to :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:892 +#: ../../using/cmdline.rst:898 msgid "" "Defines the :data:`user base directory <site.USER_BASE>`, which is used to " "compute the path of the :data:`user site-packages directory <site." @@ -1141,20 +1161,20 @@ msgid "" "``python -m pip install --user``." msgstr "" -#: ../../using/cmdline.rst:904 +#: ../../using/cmdline.rst:910 msgid "" "If this environment variable is set, ``sys.argv[0]`` will be set to its " "value instead of the value got through the C runtime. Only works on macOS." msgstr "" -#: ../../using/cmdline.rst:910 +#: ../../using/cmdline.rst:916 msgid "" "This is equivalent to the :option:`-W` option. If set to a comma separated " "string, it is equivalent to specifying :option:`-W` multiple times, with " "filters later in the list taking precedence over those earlier in the list." msgstr "" -#: ../../using/cmdline.rst:919 +#: ../../using/cmdline.rst:925 msgid "" "PYTHONWARNINGS=default # Warn once per call location\n" "PYTHONWARNINGS=error # Convert to exceptions\n" @@ -1165,7 +1185,7 @@ msgid "" "PYTHONWARNINGS=ignore # Never warn" msgstr "" -#: ../../using/cmdline.rst:933 +#: ../../using/cmdline.rst:939 msgid "" "If this environment variable is set to a non-empty string, :func:" "`faulthandler.enable` is called at startup: install a handler for :const:" @@ -1174,7 +1194,7 @@ msgid "" "traceback. This is equivalent to :option:`-X` ``faulthandler`` option." msgstr "" -#: ../../using/cmdline.rst:945 +#: ../../using/cmdline.rst:951 msgid "" "If this environment variable is set to a non-empty string, start tracing " "Python memory allocations using the :mod:`tracemalloc` module. The value of " @@ -1184,101 +1204,101 @@ msgid "" "is equivalent to setting the :option:`-X` ``tracemalloc`` option." msgstr "" -#: ../../using/cmdline.rst:958 +#: ../../using/cmdline.rst:964 msgid "" "If this environment variable is set to a non-empty string, Python will show " "how long each import takes. This is equivalent to setting the :option:`-X` " "``importtime`` option." msgstr "" -#: ../../using/cmdline.rst:967 +#: ../../using/cmdline.rst:973 msgid "" "If this environment variable is set to a non-empty string, enable the :ref:" "`debug mode <asyncio-debug-mode>` of the :mod:`asyncio` module." msgstr "" -#: ../../using/cmdline.rst:975 +#: ../../using/cmdline.rst:981 msgid "Set the Python memory allocators and/or install debug hooks." msgstr "" -#: ../../using/cmdline.rst:977 +#: ../../using/cmdline.rst:983 msgid "Set the family of memory allocators used by Python:" msgstr "" -#: ../../using/cmdline.rst:979 +#: ../../using/cmdline.rst:985 msgid "" "``default``: use the :ref:`default memory allocators <default-memory-" "allocators>`." msgstr "" -#: ../../using/cmdline.rst:981 +#: ../../using/cmdline.rst:987 msgid "" "``malloc``: use the :c:func:`malloc` function of the C library for all " "domains (:c:macro:`PYMEM_DOMAIN_RAW`, :c:macro:`PYMEM_DOMAIN_MEM`, :c:macro:" "`PYMEM_DOMAIN_OBJ`)." msgstr "" -#: ../../using/cmdline.rst:984 +#: ../../using/cmdline.rst:990 msgid "" "``pymalloc``: use the :ref:`pymalloc allocator <pymalloc>` for :c:macro:" "`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and use the :c:" "func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." msgstr "" -#: ../../using/cmdline.rst:987 +#: ../../using/cmdline.rst:993 msgid "" "``mimalloc``: use the :ref:`mimalloc allocator <mimalloc>` for :c:macro:" "`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and use the :c:" "func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." msgstr "" -#: ../../using/cmdline.rst:991 +#: ../../using/cmdline.rst:997 msgid "Install :ref:`debug hooks <pymem-debug-hooks>`:" msgstr "" -#: ../../using/cmdline.rst:993 +#: ../../using/cmdline.rst:999 msgid "" "``debug``: install debug hooks on top of the :ref:`default memory allocators " "<default-memory-allocators>`." msgstr "" -#: ../../using/cmdline.rst:995 +#: ../../using/cmdline.rst:1001 msgid "``malloc_debug``: same as ``malloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:996 +#: ../../using/cmdline.rst:1002 msgid "``pymalloc_debug``: same as ``pymalloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:997 +#: ../../using/cmdline.rst:1003 msgid "``mimalloc_debug``: same as ``mimalloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:1001 +#: ../../using/cmdline.rst:1007 msgid "Added the ``\"default\"`` allocator." msgstr "" -#: ../../using/cmdline.rst:1007 +#: ../../using/cmdline.rst:1013 msgid "" "If set to a non-empty string, Python will print statistics of the :ref:" "`pymalloc memory allocator <pymalloc>` every time a new pymalloc object " "arena is created, and on shutdown." msgstr "" -#: ../../using/cmdline.rst:1011 +#: ../../using/cmdline.rst:1017 msgid "" "This variable is ignored if the :envvar:`PYTHONMALLOC` environment variable " "is used to force the :c:func:`malloc` allocator of the C library, or if " "Python is configured without ``pymalloc`` support." msgstr "" -#: ../../using/cmdline.rst:1015 +#: ../../using/cmdline.rst:1021 msgid "" "This variable can now also be used on Python compiled in release mode. It " "now has no effect if set to an empty string." msgstr "" -#: ../../using/cmdline.rst:1022 +#: ../../using/cmdline.rst:1028 msgid "" "If set to a non-empty string, the default :term:`filesystem encoding and " "error handler` mode will revert to their pre-3.6 values of 'mbcs' and " @@ -1286,42 +1306,42 @@ msgid "" "'surrogatepass' are used." msgstr "" -#: ../../using/cmdline.rst:1027 +#: ../../using/cmdline.rst:1033 msgid "" "This may also be enabled at runtime with :func:`sys." "_enablelegacywindowsfsencoding`." msgstr "" -#: ../../using/cmdline.rst:1030 ../../using/cmdline.rst:1044 -#: ../../using/cmdline.rst:1095 +#: ../../using/cmdline.rst:1036 ../../using/cmdline.rst:1050 +#: ../../using/cmdline.rst:1101 msgid "Availability" msgstr "" -#: ../../using/cmdline.rst:1032 +#: ../../using/cmdline.rst:1038 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`。" -#: ../../using/cmdline.rst:1037 +#: ../../using/cmdline.rst:1043 msgid "" "If set to a non-empty string, does not use the new console reader and " "writer. This means that Unicode characters will be encoded according to the " "active console code page, rather than using utf-8." msgstr "" -#: ../../using/cmdline.rst:1041 +#: ../../using/cmdline.rst:1047 msgid "" "This variable is ignored if the standard streams are redirected (to files or " "pipes) rather than referring to console buffers." msgstr "" -#: ../../using/cmdline.rst:1051 +#: ../../using/cmdline.rst:1057 msgid "" "If set to the value ``0``, causes the main Python command line application " "to skip coercing the legacy ASCII-based C and POSIX locales to a more " "capable UTF-8 based alternative." msgstr "" -#: ../../using/cmdline.rst:1055 +#: ../../using/cmdline.rst:1061 msgid "" "If this variable is *not* set (or is set to a value other than ``0``), the " "``LC_ALL`` locale override environment variable is also not set, and the " @@ -1332,19 +1352,19 @@ msgid "" "runtime:" msgstr "" -#: ../../using/cmdline.rst:1063 +#: ../../using/cmdline.rst:1069 msgid "``C.UTF-8``" msgstr "``C.UTF-8``" -#: ../../using/cmdline.rst:1064 +#: ../../using/cmdline.rst:1070 msgid "``C.utf8``" msgstr "``C.utf8``" -#: ../../using/cmdline.rst:1065 +#: ../../using/cmdline.rst:1071 msgid "``UTF-8``" msgstr "``UTF-8``" -#: ../../using/cmdline.rst:1067 +#: ../../using/cmdline.rst:1073 msgid "" "If setting one of these locale categories succeeds, then the ``LC_CTYPE`` " "environment variable will also be set accordingly in the current process " @@ -1357,7 +1377,7 @@ msgid "" "(such as Python's own :func:`locale.getdefaultlocale`)." msgstr "" -#: ../../using/cmdline.rst:1077 +#: ../../using/cmdline.rst:1083 msgid "" "Configuring one of these locales (either explicitly or via the above " "implicit locale coercion) automatically enables the ``surrogateescape`` :ref:" @@ -1367,7 +1387,7 @@ msgid "" "envvar:`PYTHONIOENCODING` as usual." msgstr "" -#: ../../using/cmdline.rst:1084 +#: ../../using/cmdline.rst:1090 msgid "" "For debugging purposes, setting ``PYTHONCOERCECLOCALE=warn`` will cause " "Python to emit warning messages on ``stderr`` if either the locale coercion " @@ -1375,7 +1395,7 @@ msgid "" "active when the Python runtime is initialized." msgstr "" -#: ../../using/cmdline.rst:1089 +#: ../../using/cmdline.rst:1095 msgid "" "Also note that even when locale coercion is disabled, or when it fails to " "find a suitable target locale, :envvar:`PYTHONUTF8` will still activate by " @@ -1384,11 +1404,11 @@ msgid "" "system interfaces." msgstr "" -#: ../../using/cmdline.rst:1097 +#: ../../using/cmdline.rst:1103 msgid "See :pep:`538` for more details." msgstr "更多細節請見 :pep:`538`。" -#: ../../using/cmdline.rst:1103 +#: ../../using/cmdline.rst:1109 msgid "" "If this environment variable is set to a non-empty string, enable :ref:" "`Python Development Mode <devmode>`, introducing additional runtime checks " @@ -1396,31 +1416,31 @@ msgid "" "setting the :option:`-X` ``dev`` option." msgstr "" -#: ../../using/cmdline.rst:1112 +#: ../../using/cmdline.rst:1118 msgid "If set to ``1``, enable the :ref:`Python UTF-8 Mode <utf8-mode>`." msgstr "如果設為 ``1``,則啟用 :ref:`Python UTF-8 Mode <utf8-mode>`。" -#: ../../using/cmdline.rst:1114 +#: ../../using/cmdline.rst:1120 msgid "If set to ``0``, disable the :ref:`Python UTF-8 Mode <utf8-mode>`." msgstr "如果設為 ``0``,則停用 :ref:`Python UTF-8 Mode <utf8-mode>`。" -#: ../../using/cmdline.rst:1116 +#: ../../using/cmdline.rst:1122 msgid "" "Setting any other non-empty string causes an error during interpreter " "initialisation." msgstr "" -#: ../../using/cmdline.rst:1123 +#: ../../using/cmdline.rst:1129 msgid "" "If this environment variable is set to a non-empty string, issue a :class:" "`EncodingWarning` when the locale-specific default encoding is used." msgstr "" -#: ../../using/cmdline.rst:1126 +#: ../../using/cmdline.rst:1132 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節請見 :ref:`io-encoding-warning`。" -#: ../../using/cmdline.rst:1132 +#: ../../using/cmdline.rst:1138 msgid "" "If this variable is set, it disables the inclusion of the tables mapping " "extra location information (end line, start column offset and end column " @@ -1429,47 +1449,47 @@ msgid "" "visual location indicators when the interpreter displays tracebacks." msgstr "" -#: ../../using/cmdline.rst:1142 +#: ../../using/cmdline.rst:1148 msgid "" "If this variable is set to a nonzero value, it enables support for the Linux " "``perf`` profiler so Python calls can be detected by it." msgstr "" -#: ../../using/cmdline.rst:1145 ../../using/cmdline.rst:1158 +#: ../../using/cmdline.rst:1151 ../../using/cmdline.rst:1164 msgid "If set to ``0``, disable Linux ``perf`` profiler support." msgstr "" -#: ../../using/cmdline.rst:1147 +#: ../../using/cmdline.rst:1153 msgid "" "See also the :option:`-X perf <-X>` command-line option and :ref:" "`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:1154 +#: ../../using/cmdline.rst:1160 msgid "" "If this variable is set to a nonzero value, it enables support for the Linux " "``perf`` profiler so Python calls can be detected by it using DWARF " "information." msgstr "" -#: ../../using/cmdline.rst:1160 +#: ../../using/cmdline.rst:1166 msgid "" "See also the :option:`-X perf_jit <-X>` command-line option and :ref:" "`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:1169 +#: ../../using/cmdline.rst:1175 msgid "" "If this variable is set to a positive integer, it overrides the return " "values of :func:`os.cpu_count` and :func:`os.process_cpu_count`." msgstr "" -#: ../../using/cmdline.rst:1172 +#: ../../using/cmdline.rst:1178 #, fuzzy msgid "See also the :option:`-X cpu_count <-X>` command-line option." msgstr "另請參閱 :option:`-P` 和 :option:`-I` (isolated) 選項。" -#: ../../using/cmdline.rst:1178 +#: ../../using/cmdline.rst:1184 msgid "" "If this variable is set to ``on`` or ``off``, it determines whether or not " "frozen modules are ignored by the import machinery. A value of ``on`` means " @@ -1480,68 +1500,68 @@ msgid "" "flag is set to ``off``." msgstr "" -#: ../../using/cmdline.rst:1186 +#: ../../using/cmdline.rst:1192 #, fuzzy msgid "See also the :option:`-X frozen_modules <-X>` command-line option." msgstr "另請參閱 :option:`-P` 和 :option:`-I` (isolated) 選項。" -#: ../../using/cmdline.rst:1192 +#: ../../using/cmdline.rst:1198 msgid "" "If this variable is set to ``1``, the interpreter will colorize various " "kinds of output. Setting it to ``0`` deactivates this behavior. See also :" "ref:`using-on-controlling-color`." msgstr "" -#: ../../using/cmdline.rst:1200 +#: ../../using/cmdline.rst:1206 msgid "" "If this variable is set to any value, the interpreter will not attempt to " "load the Python-based :term:`REPL` that requires :mod:`curses` and :mod:" "`readline`, and will instead use the traditional parser-based :term:`REPL`." msgstr "" -#: ../../using/cmdline.rst:1209 +#: ../../using/cmdline.rst:1215 msgid "" "This environment variable can be used to set the location of a ``." "python_history`` file (by default, it is ``.python_history`` in the user's " "home directory)." msgstr "" -#: ../../using/cmdline.rst:1217 +#: ../../using/cmdline.rst:1223 msgid "" "If this variable is set to ``1``, the global interpreter lock (GIL) will be " "forced on. Setting it to ``0`` forces the GIL off (needs Python configured " "with the :option:`--disable-gil` build option)." msgstr "" -#: ../../using/cmdline.rst:1221 +#: ../../using/cmdline.rst:1227 msgid "" "See also the :option:`-X gil <-X>` command-line option, which takes " "precedence over this variable, and :ref:`whatsnew313-free-threaded-cpython`." msgstr "" -#: ../../using/cmdline.rst:1227 +#: ../../using/cmdline.rst:1233 msgid "Debug-mode variables" msgstr "除錯模式變數" -#: ../../using/cmdline.rst:1231 +#: ../../using/cmdline.rst:1237 msgid "" "If set, Python will dump objects and reference counts still alive after " "shutting down the interpreter." msgstr "" -#: ../../using/cmdline.rst:1234 ../../using/cmdline.rst:1242 +#: ../../using/cmdline.rst:1240 ../../using/cmdline.rst:1248 msgid "" "Needs Python configured with the :option:`--with-trace-refs` build option." msgstr "" -#: ../../using/cmdline.rst:1238 +#: ../../using/cmdline.rst:1244 msgid "" "If set, Python will dump objects and reference counts still alive after " "shutting down the interpreter into a file under the path given as the value " "to this environment variable." msgstr "" -#: ../../using/cmdline.rst:1248 +#: ../../using/cmdline.rst:1254 msgid "" "If this variable is set to a module, that module will be imported early in " "the interpreter lifecycle, before the :mod:`site` module is executed, and " @@ -1549,22 +1569,22 @@ msgid "" "is not treated as :mod:`__main__`." msgstr "" -#: ../../using/cmdline.rst:1253 +#: ../../using/cmdline.rst:1259 msgid "This can be used to execute code early during Python initialization." msgstr "" -#: ../../using/cmdline.rst:1255 +#: ../../using/cmdline.rst:1261 msgid "" "To import a submodule, use ``package.module`` as the value, like in an " "import statement." msgstr "" -#: ../../using/cmdline.rst:1258 +#: ../../using/cmdline.rst:1264 msgid "" "See also the :option:`-X presite <-X>` command-line option, which takes " "precedence over this variable." msgstr "" -#: ../../using/cmdline.rst:1261 +#: ../../using/cmdline.rst:1267 msgid "Needs Python configured with the :option:`--with-pydebug` build option." msgstr "" diff --git a/using/configure.po b/using/configure.po index edacd303ff..231392ab4c 100644 --- a/using/configure.po +++ b/using/configure.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-31 00:13+0000\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,6 +35,9 @@ msgid "" "features <https://en.wikipedia.org/wiki/" "C11_(C_standard_revision)#Optional_features>`_ are not required." msgstr "" +"一個 `C11 <https://en.cppreference.com/w/c/11>`_ 編譯器。`選擇性 C11 功能 " +"<https://en.wikipedia.org/wiki/" +"C11_(C_standard_revision)#Optional_features>`_\\ 並非必要。" #: ../../using/configure.rst:17 msgid "On Windows, Microsoft Visual Studio 2017 or later is required." @@ -46,6 +49,8 @@ msgid "" "point numbers and `floating-point Not-a-Number (NaN) <https://" "en.wikipedia.org/wiki/NaN#Floating_point>`_." msgstr "" +"支援 `IEEE 754 <https://en.wikipedia.org/wiki/IEEE_754>`_ 浮點數與\\ `浮點數" +"非數值 (NaN) <https://en.wikipedia.org/wiki/NaN#Floating_point>`_。" #: ../../using/configure.rst:23 msgid "Support for threads." @@ -56,6 +61,8 @@ msgid "" "OpenSSL 1.1.1 is the minimum version and OpenSSL 3.0.9 is the recommended " "minimum version for the :mod:`ssl` and :mod:`hashlib` extension modules." msgstr "" +"OpenSSL 1.1.1 是最低版本,OpenSSL 3.0.9 是 :mod:`ssl` 與 :mod:`hashlib` 擴充" +"模組的建議最低版本。" #: ../../using/configure.rst:28 msgid "SQLite 3.15.2 for the :mod:`sqlite3` extension module." @@ -595,11 +602,11 @@ msgstr "``pkg-config`` 選項。" msgid "C compiler options" msgstr "C 編譯器選項。" -#: ../../using/configure.rst:338 ../../using/configure.rst:1245 +#: ../../using/configure.rst:338 ../../using/configure.rst:1251 msgid "C compiler command." msgstr "C 編譯器指令。" -#: ../../using/configure.rst:342 ../../using/configure.rst:1257 +#: ../../using/configure.rst:342 ../../using/configure.rst:1263 msgid "C compiler flags." msgstr "C 編譯器旗標。" @@ -809,7 +816,7 @@ msgstr "``no``:不要執行 ensurepip;" #: ../../using/configure.rst:531 msgid "Performance options" -msgstr "" +msgstr "效能選項" #: ../../using/configure.rst:533 msgid "" @@ -1080,17 +1087,19 @@ msgstr "" #: ../../using/configure.rst:714 msgid "Debug options" -msgstr "" +msgstr "偵錯選項" #: ../../using/configure.rst:718 msgid "" ":ref:`Build Python in debug mode <debug-build>`: define the ``Py_DEBUG`` " "macro (disabled by default)." msgstr "" +":ref:`以偵錯模式建置 Python <debug-build>`:定義 ``Py_DEBUG`` 巨集(預設不啟" +"用)。" #: ../../using/configure.rst:723 msgid "Enable tracing references for debugging purpose (disabled by default)." -msgstr "" +msgstr "以偵錯為目的啟用參照追蹤(預設不啟用)。" #: ../../using/configure.rst:727 msgid "Define the ``Py_TRACE_REFS`` macro." @@ -1109,34 +1118,42 @@ msgid "" "The :envvar:`PYTHONDUMPREFS` environment variable can be used to dump " "objects and reference counts still alive at Python exit." msgstr "" +":envvar:`PYTHONDUMPREFS` 環境變數可以用來在 Python 結束時轉儲仍然有效的物件和" +"參照計數。" #: ../../using/configure.rst:734 msgid ":ref:`Statically allocated objects <static-types>` are not traced." -msgstr "" +msgstr "不追蹤\\ :ref:`靜態配置的物件 <static-types>`。" #: ../../using/configure.rst:738 msgid "" "This build is now ABI compatible with release build and :ref:`debug build " "<debug-build>`." msgstr "" +"這個建置現在與發佈版本建置和\\ :ref:`偵錯建置 <debug-build>`\\ 具有 ABI 相容" +"性。" #: ../../using/configure.rst:744 msgid "" "Build with C assertions enabled (default is no): ``assert(...);`` and " "``_PyObject_ASSERT(...);``." msgstr "" +"啟用 C 斷言建置(預設不啟用):``assert(...);`` 和 " +"``_PyObject_ASSERT(...);``。" #: ../../using/configure.rst:747 msgid "" "If set, the ``NDEBUG`` macro is not defined in the :envvar:`OPT` compiler " "variable." -msgstr "" +msgstr "如果設定,``NDEBUG`` 巨集不會在 :envvar:`OPT` 編譯器變數中定義。" #: ../../using/configure.rst:750 msgid "" "See also the :option:`--with-pydebug` option (:ref:`debug build <debug-" "build>`) which also enables assertions." msgstr "" +"另請參閱 :option:`--with-pydebug` 選項(:ref:`debug build <debug-build>`)," +"它也啟用了斷言。" #: ../../using/configure.rst:757 msgid "Enable Valgrind support (default is no)." @@ -1150,22 +1167,24 @@ msgstr "啟用 DTrace 支援(預設不啟用)。" msgid "" "See :ref:`Instrumenting CPython with DTrace and SystemTap <instrumentation>`." msgstr "" +"請參閱\\ :ref:`使用 DTrace 和 SystemTap 檢測 CPython <instrumentation>`。" #: ../../using/configure.rst:770 msgid "" "Enable AddressSanitizer memory error detector, ``asan`` (default is no)." -msgstr "" +msgstr "啟用 AddressSanitizer 記憶體錯誤偵測器 ``asan``\\ (預設不啟用)。" #: ../../using/configure.rst:776 msgid "" "Enable MemorySanitizer allocation error detector, ``msan`` (default is no)." -msgstr "" +msgstr "啟用 MemorySanitizer 分配錯誤偵測器 ``msan``\\ (預設不啟用)。" #: ../../using/configure.rst:782 msgid "" "Enable UndefinedBehaviorSanitizer undefined behaviour detector, ``ubsan`` " "(default is no)." msgstr "" +"啟用 UndefinedBehaviorSanitizer 未定義行為偵測器 ``ubsan``\\ (預設不啟用)。" #: ../../using/configure.rst:789 msgid "Enable ThreadSanitizer data race detector, ``tsan`` (default is no)." @@ -1173,13 +1192,15 @@ msgstr "啟用 ThreadSanitizer 資料競爭偵測器 ``tsan``\\ (預設不啟 #: ../../using/configure.rst:800 msgid "Enable building a shared Python library: ``libpython`` (default is no)." -msgstr "" +msgstr "啟用建置共享 Python 函式庫:``libpython``\\ (預設不啟用)。" #: ../../using/configure.rst:804 msgid "" "Do not build ``libpythonMAJOR.MINOR.a`` and do not install ``python.o`` " "(built and enabled by default)." msgstr "" +"不要建置 ``libpythonMAJOR.MINOR.a`` 並且不要安裝 ``python.o``\\ (預設會建置" +"並啟用)。" #: ../../using/configure.rst:811 msgid "Libraries options" @@ -1193,23 +1214,25 @@ msgstr "" msgid "" "Build the :mod:`!pyexpat` module using an installed ``expat`` library " "(default is no)." -msgstr "" +msgstr "使用已安裝的 ``expat`` 函式庫建置 :mod:`!pyexpat` 模組(預設不建置)。" #: ../../using/configure.rst:824 msgid "" "Build the ``_decimal`` extension module using an installed ``mpdecimal`` " "library, see the :mod:`decimal` module (default is yes)." msgstr "" +"使用已安裝的 ``mpdecimal`` 函式庫建置 ``_decimal`` 擴充模組,請參" +"閱 :mod:`decimal` 模組(預設建置)。" #: ../../using/configure.rst:829 msgid "Default to using the installed ``mpdecimal`` library." -msgstr "" +msgstr "預設使用已安裝的 ``mpdecimal`` 函式庫。" #: ../../using/configure.rst:832 msgid "" "A copy of the ``mpdecimal`` library sources will no longer be distributed " "with Python 3.15." -msgstr "" +msgstr "Python 3.15 不再隨附 ``mpdecimal`` 函式庫的原始碼副本。" #: ../../using/configure.rst:836 msgid ":option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`." @@ -1374,44 +1397,53 @@ msgid "Options:" msgstr "選項:" #: ../../using/configure.rst:951 -msgid "``universal2``;" -msgstr "``universal2``;" +msgid "``universal2`` (x86-64 and arm64);" +msgstr "``universal2``\\ (x86-64 與 arm64);" #: ../../using/configure.rst:952 -msgid "``32-bit``;" -msgstr "``32-bit``;" +msgid "``32-bit`` (PPC and i386);" +msgstr "``32-bit``\\ (PPC 與 i386);" #: ../../using/configure.rst:953 -msgid "``64-bit``;" -msgstr "``64-bit``;" +msgid "``64-bit`` (PPC64 and x86-64);" +msgstr "``64-bit``\\ (PPC64 與 x86-64);" #: ../../using/configure.rst:954 -msgid "``3-way``;" -msgstr "``3-way``;" +msgid "``3-way`` (i386, PPC and x86-64);" +msgstr "``3-way``\\ (i386、PPC 與 x86-64);" #: ../../using/configure.rst:955 -msgid "``intel``;" -msgstr "``intel``;" +msgid "``intel`` (i386 and x86-64);" +msgstr "``intel``\\ (i386 與 x86-64);" #: ../../using/configure.rst:956 -msgid "``intel-32``;" -msgstr "``intel-32``;" +msgid "``intel-32`` (i386);" +msgstr "``intel-32``\\ (i386);" #: ../../using/configure.rst:957 -msgid "``intel-64``;" -msgstr "``intel-64``;" +msgid "``intel-64`` (x86-64);" +msgstr "``intel-64``\\ (x86-64);" #: ../../using/configure.rst:958 -msgid "``all``." -msgstr "``all``。" +msgid "``all`` (PPC, i386, PPC64 and x86-64)." +msgstr "`all``\\ (PPC、i386、PPC64 與 x86-64);" -#: ../../using/configure.rst:962 +#: ../../using/configure.rst:960 +msgid "" +"Note that values for this configuration item are *not* the same as the " +"identifiers used for universal binary wheels on macOS. See the Python " +"Packaging User Guide for details on the `packaging platform compatibility " +"tags used on macOS <https://packaging.python.org/en/latest/specifications/" +"platform-compatibility-tags/#macos>`_" +msgstr "" + +#: ../../using/configure.rst:968 msgid "" "Specify the name for the python framework on macOS only valid " "when :option:`--enable-framework` is set (default: ``Python``)." msgstr "" -#: ../../using/configure.rst:968 +#: ../../using/configure.rst:974 msgid "" "The Python standard library contains strings that are known to trigger " "automated inspection tool errors when submitted for distribution by the " @@ -1420,29 +1452,29 @@ msgid "" "can also be specified. This option is disabled by default." msgstr "" -#: ../../using/configure.rst:977 +#: ../../using/configure.rst:983 msgid "iOS Options" msgstr "iOS 選項" -#: ../../using/configure.rst:979 +#: ../../using/configure.rst:985 msgid "See :source:`iOS/README.rst`." msgstr "參閱 :source:`iOS/README.rst`。" -#: ../../using/configure.rst:983 +#: ../../using/configure.rst:989 msgid "" "Create a Python.framework. Unlike macOS, the *INSTALLDIR* argument " "specifying the installation path is mandatory." msgstr "" -#: ../../using/configure.rst:988 +#: ../../using/configure.rst:994 msgid "Specify the name for the framework (default: ``Python``)." msgstr "指定框架的名稱(預設值:``Python``)。" -#: ../../using/configure.rst:992 +#: ../../using/configure.rst:998 msgid "Cross Compiling Options" msgstr "" -#: ../../using/configure.rst:994 +#: ../../using/configure.rst:1000 msgid "" "Cross compiling, also known as cross building, can be used to build Python " "for another CPU architecture or platform. Cross compiling requires a Python " @@ -1450,28 +1482,28 @@ msgid "" "match the version of the cross compiled host Python." msgstr "" -#: ../../using/configure.rst:1001 +#: ../../using/configure.rst:1007 msgid "" "configure for building on BUILD, usually guessed by :program:`config.guess`." msgstr "" -#: ../../using/configure.rst:1005 +#: ../../using/configure.rst:1011 msgid "cross-compile to build programs to run on HOST (target platform)" msgstr "" -#: ../../using/configure.rst:1009 +#: ../../using/configure.rst:1015 msgid "path to build ``python`` binary for cross compiling" msgstr "" -#: ../../using/configure.rst:1015 +#: ../../using/configure.rst:1021 msgid "An environment variable that points to a file with configure overrides." msgstr "" -#: ../../using/configure.rst:1017 +#: ../../using/configure.rst:1023 msgid "Example *config.site* file:" -msgstr "" +msgstr "範例 *config.site* 檔案:" -#: ../../using/configure.rst:1019 +#: ../../using/configure.rst:1025 msgid "" "# config.site-aarch64\n" "ac_cv_buggy_getaddrinfo=no\n" @@ -1483,15 +1515,15 @@ msgstr "" "ac_cv_file__dev_ptmx=yes\n" "ac_cv_file__dev_ptc=no" -#: ../../using/configure.rst:1028 +#: ../../using/configure.rst:1034 msgid "Program to run CPython for the host platform for cross-compilation." msgstr "" -#: ../../using/configure.rst:1033 +#: ../../using/configure.rst:1039 msgid "Cross compiling example::" msgstr "" -#: ../../using/configure.rst:1035 +#: ../../using/configure.rst:1041 msgid "" "CONFIG_SITE=config.site-aarch64 ../configure \\\n" " --build=x86_64-pc-linux-gnu \\\n" @@ -1503,65 +1535,65 @@ msgstr "" " --host=aarch64-unknown-linux-gnu \\\n" " --with-build-python=../x86_64/python" -#: ../../using/configure.rst:1042 +#: ../../using/configure.rst:1048 msgid "Python Build System" msgstr "Python 建置系統" -#: ../../using/configure.rst:1045 +#: ../../using/configure.rst:1051 msgid "Main files of the build system" msgstr "建置系統的主要檔案" -#: ../../using/configure.rst:1047 +#: ../../using/configure.rst:1053 msgid ":file:`configure.ac` => :file:`configure`;" msgstr ":file:`configure.ac` => :file:`configure`;" -#: ../../using/configure.rst:1048 +#: ../../using/configure.rst:1054 msgid "" ":file:`Makefile.pre.in` => :file:`Makefile` (created by :file:`configure`);" msgstr "" ":file:`Makefile.pre.in` => :file:`Makefile`\\ (由 :file:`configure` 建立);" -#: ../../using/configure.rst:1049 +#: ../../using/configure.rst:1055 msgid ":file:`pyconfig.h` (created by :file:`configure`);" msgstr ":file:`pyconfig.h`\\ (由 :file:`configure` 建立);" -#: ../../using/configure.rst:1050 +#: ../../using/configure.rst:1056 msgid "" ":file:`Modules/Setup`: C extensions built by the Makefile " "using :file:`Module/makesetup` shell script;" msgstr "" -#: ../../using/configure.rst:1054 +#: ../../using/configure.rst:1060 msgid "Main build steps" msgstr "主要建置步驟" -#: ../../using/configure.rst:1056 +#: ../../using/configure.rst:1062 msgid "C files (``.c``) are built as object files (``.o``)." -msgstr "" +msgstr "C 檔案(``.c``)被建置為目的檔(``.o``)。" -#: ../../using/configure.rst:1057 +#: ../../using/configure.rst:1063 msgid "A static ``libpython`` library (``.a``) is created from objects files." msgstr "" -#: ../../using/configure.rst:1058 +#: ../../using/configure.rst:1064 msgid "" "``python.o`` and the static ``libpython`` library are linked into the final " "``python`` program." msgstr "" -#: ../../using/configure.rst:1060 +#: ../../using/configure.rst:1066 msgid "C extensions are built by the Makefile (see :file:`Modules/Setup`)." msgstr "" -#: ../../using/configure.rst:1063 +#: ../../using/configure.rst:1069 msgid "Main Makefile targets" msgstr "主要 Makefile 目標" -#: ../../using/configure.rst:1066 +#: ../../using/configure.rst:1072 msgid "make" msgstr "make" -#: ../../using/configure.rst:1068 +#: ../../using/configure.rst:1074 msgid "" "For the most part, when rebuilding after editing some code or refreshing " "your checkout from upstream, all you need to do is execute ``make``, which " @@ -1572,20 +1604,20 @@ msgid "" "all`` will build. The three choices are:" msgstr "" -#: ../../using/configure.rst:1077 +#: ../../using/configure.rst:1083 msgid "``profile-opt`` (configured with ``--enable-optimizations``)" -msgstr "" +msgstr "``profile-opt``\\ (使用 ``--enable-optimizations`` 配置)" -#: ../../using/configure.rst:1078 +#: ../../using/configure.rst:1084 msgid "``build_wasm`` (configured with ``--with-emscripten-target``)" -msgstr "" +msgstr "``build_wasm``\\ (使用 ``--with-emscripten-target`` 配置)" -#: ../../using/configure.rst:1079 +#: ../../using/configure.rst:1085 msgid "" "``build_all`` (configured without explicitly using either of the others)" -msgstr "" +msgstr "``build_all``\\ (未明確使用其他選項進行配置)" -#: ../../using/configure.rst:1081 +#: ../../using/configure.rst:1087 msgid "" "Depending on the most recent source file changes, Make will rebuild any " "targets (object files and executables) deemed out-of-date, including running " @@ -1598,11 +1630,11 @@ msgid "" "problems, at the expense of longer build times." msgstr "" -#: ../../using/configure.rst:1094 +#: ../../using/configure.rst:1100 msgid "make platform" msgstr "make platform" -#: ../../using/configure.rst:1096 +#: ../../using/configure.rst:1102 msgid "" "Build the ``python`` program, but don't build the standard library extension " "modules. This generates a file named ``platform`` which contains a single " @@ -1610,81 +1642,81 @@ msgid "" "arm64-3.12`` or ``linux-x86_64-3.13``." msgstr "" -#: ../../using/configure.rst:1103 +#: ../../using/configure.rst:1109 msgid "make profile-opt" msgstr "make profile-opt" -#: ../../using/configure.rst:1105 +#: ../../using/configure.rst:1111 msgid "" "Build Python using profile-guided optimization (PGO). You can use the " "configure :option:`--enable-optimizations` option to make this the default " "target of the ``make`` command (``make all`` or just ``make``)." msgstr "" -#: ../../using/configure.rst:1113 +#: ../../using/configure.rst:1119 msgid "make clean" msgstr "make clean" -#: ../../using/configure.rst:1115 +#: ../../using/configure.rst:1121 msgid "Remove built files." msgstr "移除建置的檔案。" -#: ../../using/configure.rst:1119 +#: ../../using/configure.rst:1125 msgid "make distclean" msgstr "make distclean" -#: ../../using/configure.rst:1121 +#: ../../using/configure.rst:1127 msgid "" "In addition to the work done by ``make clean``, remove files created by the " "configure script. ``configure`` will have to be run before building again. " "[#]_" msgstr "" -#: ../../using/configure.rst:1127 +#: ../../using/configure.rst:1133 msgid "make install" msgstr "make install" -#: ../../using/configure.rst:1129 +#: ../../using/configure.rst:1135 msgid "Build the ``all`` target and install Python." msgstr "建置 ``all`` 目標並安裝 Python。" -#: ../../using/configure.rst:1133 +#: ../../using/configure.rst:1139 msgid "make test" msgstr "make test" -#: ../../using/configure.rst:1135 +#: ../../using/configure.rst:1141 msgid "" "Build the ``all`` target and run the Python test suite with the ``--fast-" "ci`` option. Variables:" msgstr "" -#: ../../using/configure.rst:1138 +#: ../../using/configure.rst:1144 msgid "``TESTOPTS``: additional regrtest command-line options." -msgstr "" +msgstr "``TESTOPTS``:額外的 regrtest 命令列選項。" -#: ../../using/configure.rst:1139 +#: ../../using/configure.rst:1145 msgid "``TESTPYTHONOPTS``: additional Python command-line options." -msgstr "" +msgstr "``TESTPYTHONOPTS``:額外的 Python 命令列選項。" -#: ../../using/configure.rst:1140 +#: ../../using/configure.rst:1146 msgid "``TESTTIMEOUT``: timeout in seconds (default: 10 minutes)." -msgstr "" +msgstr "``TESTTIMEOUT``:秒數表示的超時設定(預設值:10 分鐘)。" -#: ../../using/configure.rst:1144 +#: ../../using/configure.rst:1150 msgid "make buildbottest" msgstr "make buildbottest" -#: ../../using/configure.rst:1146 +#: ../../using/configure.rst:1152 msgid "" "This is similar to ``make test``, but uses the ``--slow-ci`` option and " "default timeout of 20 minutes, instead of ``--fast-ci`` option." msgstr "" -#: ../../using/configure.rst:1151 +#: ../../using/configure.rst:1157 msgid "make regen-all" msgstr "make regen-all" -#: ../../using/configure.rst:1153 +#: ../../using/configure.rst:1159 msgid "" "Regenerate (almost) all generated files. These include (but are not limited " "to) bytecode cases, and parser generator file. ``make regen-stdlib-module-" @@ -1692,18 +1724,18 @@ msgid "" "files <#generated-files>`_." msgstr "" -#: ../../using/configure.rst:1160 +#: ../../using/configure.rst:1166 msgid "C extensions" msgstr "C 擴充模組" -#: ../../using/configure.rst:1162 +#: ../../using/configure.rst:1168 msgid "" "Some C extensions are built as built-in modules, like the ``sys`` module. " "They are built with the ``Py_BUILD_CORE_BUILTIN`` macro defined. Built-in " "modules have no ``__file__`` attribute:" msgstr "" -#: ../../using/configure.rst:1166 +#: ../../using/configure.rst:1172 msgid "" ">>> import sys\n" ">>> sys\n" @@ -1721,14 +1753,14 @@ msgstr "" " File \"<stdin>\", line 1, in <module>\n" "AttributeError: module 'sys' has no attribute '__file__'" -#: ../../using/configure.rst:1176 +#: ../../using/configure.rst:1182 msgid "" "Other C extensions are built as dynamic libraries, like the ``_asyncio`` " "module. They are built with the ``Py_BUILD_CORE_MODULE`` macro defined. " "Example on Linux x86-64:" msgstr "" -#: ../../using/configure.rst:1180 +#: ../../using/configure.rst:1186 msgid "" ">>> import _asyncio\n" ">>> _asyncio\n" @@ -1744,7 +1776,7 @@ msgstr "" ">>> _asyncio.__file__\n" "'/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'" -#: ../../using/configure.rst:1188 +#: ../../using/configure.rst:1194 msgid "" ":file:`Modules/Setup` is used to generate Makefile targets to build C " "extensions. At the beginning of the files, C extensions are built as built-" @@ -1752,7 +1784,7 @@ msgid "" "dynamic libraries." msgstr "" -#: ../../using/configure.rst:1192 +#: ../../using/configure.rst:1198 msgid "" "The :c:macro:`!PyAPI_FUNC()`, :c:macro:`!PyAPI_DATA()` " "and :c:macro:`PyMODINIT_FUNC` macros of :file:`Include/exports.h` are " @@ -1760,92 +1792,92 @@ msgid "" "defined:" msgstr "" -#: ../../using/configure.rst:1196 +#: ../../using/configure.rst:1202 msgid "Use ``Py_EXPORTED_SYMBOL`` if the ``Py_BUILD_CORE_MODULE`` is defined" msgstr "如果定義了 ``Py_BUILD_CORE_MODULE``,則使用 ``Py_EXPORTED_SYMBOL``" -#: ../../using/configure.rst:1197 +#: ../../using/configure.rst:1203 msgid "Use ``Py_IMPORTED_SYMBOL`` otherwise." msgstr "否則使用 ``Py_IMPORTED_SYMBOL``。" -#: ../../using/configure.rst:1199 +#: ../../using/configure.rst:1205 msgid "" "If the ``Py_BUILD_CORE_BUILTIN`` macro is used by mistake on a C extension " "built as a shared library, its :samp:`PyInit_{xxx}()` function is not " "exported, causing an :exc:`ImportError` on import." msgstr "" -#: ../../using/configure.rst:1205 +#: ../../using/configure.rst:1211 msgid "Compiler and linker flags" msgstr "" -#: ../../using/configure.rst:1207 +#: ../../using/configure.rst:1213 msgid "" "Options set by the ``./configure`` script and environment variables and used " "by ``Makefile``." msgstr "" -#: ../../using/configure.rst:1211 +#: ../../using/configure.rst:1217 msgid "Preprocessor flags" msgstr "預處理器旗標" -#: ../../using/configure.rst:1215 +#: ../../using/configure.rst:1221 msgid "" "Value of :envvar:`CPPFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:1221 +#: ../../using/configure.rst:1227 msgid "" "(Objective) C/C++ preprocessor flags, e.g. :samp:`-I{include_dir}` if you " "have headers in a nonstandard directory *include_dir*." msgstr "" -#: ../../using/configure.rst:1224 ../../using/configure.rst:1414 +#: ../../using/configure.rst:1230 ../../using/configure.rst:1420 msgid "" "Both :envvar:`CPPFLAGS` and :envvar:`LDFLAGS` need to contain the shell's " "value to be able to build extension modules using the directories specified " "in the environment variables." msgstr "" -#: ../../using/configure.rst:1234 +#: ../../using/configure.rst:1240 msgid "" "Extra preprocessor flags added for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:1236 +#: ../../using/configure.rst:1242 msgid "" "Default: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $" "(CPPFLAGS)``." msgstr "" -#: ../../using/configure.rst:1241 +#: ../../using/configure.rst:1247 msgid "Compiler flags" msgstr "編譯器旗標" -#: ../../using/configure.rst:1247 +#: ../../using/configure.rst:1253 msgid "Example: ``gcc -pthread``." msgstr "範例:``gcc -pthread``。" -#: ../../using/configure.rst:1251 +#: ../../using/configure.rst:1257 msgid "C++ compiler command." msgstr "C++ 編譯器指令。" -#: ../../using/configure.rst:1253 +#: ../../using/configure.rst:1259 msgid "Example: ``g++ -pthread``." msgstr "範例:``g++ -pthread``。" -#: ../../using/configure.rst:1261 +#: ../../using/configure.rst:1267 msgid "" ":envvar:`CFLAGS_NODIST` is used for building the interpreter and stdlib C " "extensions. Use it when a compiler flag should *not* be part " "of :envvar:`CFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: ../../using/configure.rst:1265 +#: ../../using/configure.rst:1271 msgid "In particular, :envvar:`CFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:1267 +#: ../../using/configure.rst:1273 msgid "" "the compiler flag ``-I`` (for setting the search path for include files). " "The ``-I`` flags are processed from left to right, and any flags " @@ -1853,144 +1885,151 @@ msgid "" "I`` flags." msgstr "" -#: ../../using/configure.rst:1272 +#: ../../using/configure.rst:1278 msgid "" "hardening flags such as ``-Werror`` because distributions cannot control " "whether packages installed by users conform to such heightened standards." msgstr "" -#: ../../using/configure.rst:1280 +#: ../../using/configure.rst:1286 msgid "" "Options passed to the :mod:`compileall` command line when building PYC files " "in ``make install``. Default: ``-j0``." msgstr "" -#: ../../using/configure.rst:1287 +#: ../../using/configure.rst:1293 msgid "Extra C compiler flags." msgstr "額外的 C 編譯器旗標。" -#: ../../using/configure.rst:1291 +#: ../../using/configure.rst:1297 msgid "" "Value of :envvar:`CFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:1298 +#: ../../using/configure.rst:1304 msgid "" "Value of :envvar:`CFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:1305 +#: ../../using/configure.rst:1311 msgid "Base compiler flags." msgstr "基本編譯器旗標。" -#: ../../using/configure.rst:1309 +#: ../../using/configure.rst:1315 msgid "Optimization flags." msgstr "最佳化旗標。" -#: ../../using/configure.rst:1313 +#: ../../using/configure.rst:1319 msgid "Strict or non-strict aliasing flags used to compile ``Python/dtoa.c``." msgstr "" -#: ../../using/configure.rst:1319 +#: ../../using/configure.rst:1325 msgid "Compiler flags used to build a shared library." -msgstr "" +msgstr "用於建置共享函式庫的編譯器旗標。" -#: ../../using/configure.rst:1321 +#: ../../using/configure.rst:1327 msgid "For example, ``-fPIC`` is used on Linux and on BSD." msgstr "例如說 ``-fPIC`` 被使用於 Linux 與 BSD 上。" -#: ../../using/configure.rst:1325 +#: ../../using/configure.rst:1331 msgid "Extra C flags added for building the interpreter object files." -msgstr "" +msgstr "用於建置直譯器目的檔的額外 C 旗標。" -#: ../../using/configure.rst:1327 +#: ../../using/configure.rst:1333 msgid "" "Default: ``$(CCSHARED)`` when :option:`--enable-shared` is used, or an empty " "string otherwise." msgstr "" +"預設值:當使用 :option:`--enable-shared` 時為 ``$(CCSHARED)``,否則為空字串。" -#: ../../using/configure.rst:1332 +#: ../../using/configure.rst:1338 msgid "" "Default: ``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $" "(EXTRA_CFLAGS)``." msgstr "" +"預設值:``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $" +"(EXTRA_CFLAGS)``。" -#: ../../using/configure.rst:1336 +#: ../../using/configure.rst:1342 msgid "" "Default: ``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/" "internal``." msgstr "" +"預設值:``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/" +"internal``。" -#: ../../using/configure.rst:1342 +#: ../../using/configure.rst:1348 msgid "C flags used for building the interpreter object files." -msgstr "" +msgstr "用於建置直譯器目的檔的 C 旗標。" -#: ../../using/configure.rst:1344 +#: ../../using/configure.rst:1350 msgid "" "Default: ``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $" "(CFLAGSFORSHARED)``." msgstr "" +"預設值:``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $" +"(CFLAGSFORSHARED)``。" -#: ../../using/configure.rst:1350 +#: ../../using/configure.rst:1356 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``." -msgstr "" +msgstr "預設值:``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``。" -#: ../../using/configure.rst:1356 +#: ../../using/configure.rst:1362 msgid "" "Compiler flags to build a standard library extension module as a built-in " "module, like the :mod:`posix` module." msgstr "" -#: ../../using/configure.rst:1359 +#: ../../using/configure.rst:1365 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``." -msgstr "" +msgstr "預設值:``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``。" -#: ../../using/configure.rst:1365 +#: ../../using/configure.rst:1371 msgid "Purify command. Purify is a memory debugger program." msgstr "" -#: ../../using/configure.rst:1367 +#: ../../using/configure.rst:1373 msgid "Default: empty string (not used)." -msgstr "" +msgstr "預設值:空字串(未使用)。" -#: ../../using/configure.rst:1371 +#: ../../using/configure.rst:1377 msgid "Linker flags" msgstr "" -#: ../../using/configure.rst:1375 +#: ../../using/configure.rst:1381 msgid "" "Linker command used to build programs like ``python`` and ``_testembed``." msgstr "" -#: ../../using/configure.rst:1377 +#: ../../using/configure.rst:1383 msgid "Default: ``$(PURIFY) $(CC)``." -msgstr "" +msgstr "預設值:``$(PURIFY) $(CC)``。" -#: ../../using/configure.rst:1381 +#: ../../using/configure.rst:1387 msgid "" "Value of :envvar:`LDFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:1383 +#: ../../using/configure.rst:1389 msgid "" "Avoid assigning :envvar:`CFLAGS`, :envvar:`LDFLAGS`, etc. so users can use " "them on the command line to append to these values without stomping the pre-" "set values." msgstr "" -#: ../../using/configure.rst:1391 +#: ../../using/configure.rst:1397 msgid "" ":envvar:`LDFLAGS_NODIST` is used in the same manner " "as :envvar:`CFLAGS_NODIST`. Use it when a linker flag should *not* be part " "of :envvar:`LDFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: ../../using/configure.rst:1395 +#: ../../using/configure.rst:1401 msgid "In particular, :envvar:`LDFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:1397 +#: ../../using/configure.rst:1403 msgid "" "the compiler flag ``-L`` (for setting the search path for libraries). The ``-" "L`` flags are processed from left to right, and any flags " @@ -1998,61 +2037,61 @@ msgid "" "``-L`` flags." msgstr "" -#: ../../using/configure.rst:1404 +#: ../../using/configure.rst:1410 msgid "" "Value of :envvar:`LDFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:1411 +#: ../../using/configure.rst:1417 msgid "" "Linker flags, e.g. :samp:`-L{lib_dir}` if you have libraries in a " "nonstandard directory *lib_dir*." msgstr "" -#: ../../using/configure.rst:1420 +#: ../../using/configure.rst:1426 msgid "" "Linker flags to pass libraries to the linker when linking the Python " "executable." msgstr "" -#: ../../using/configure.rst:1423 +#: ../../using/configure.rst:1429 msgid "Example: ``-lrt``." msgstr "範例:``-lrt``。" -#: ../../using/configure.rst:1427 +#: ../../using/configure.rst:1433 msgid "Command to build a shared library." -msgstr "" +msgstr "建置共享函式庫的指令。" -#: ../../using/configure.rst:1429 +#: ../../using/configure.rst:1435 msgid "Default: ``@LDSHARED@ $(PY_LDFLAGS)``." msgstr "預設值:``@LDSHARED@ $(PY_LDFLAGS)``。" -#: ../../using/configure.rst:1433 +#: ../../using/configure.rst:1439 msgid "Command to build ``libpython`` shared library." -msgstr "" +msgstr "建置 ``libpython`` 共享函式庫的指令。" -#: ../../using/configure.rst:1435 +#: ../../using/configure.rst:1441 msgid "Default: ``@BLDSHARED@ $(PY_CORE_LDFLAGS)``." msgstr "預設值:``@BLDSHARED@ $(PY_CORE_LDFLAGS)``。" -#: ../../using/configure.rst:1439 +#: ../../using/configure.rst:1445 msgid "Default: ``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``." msgstr "預設值:``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``。" -#: ../../using/configure.rst:1443 +#: ../../using/configure.rst:1449 msgid "Default: ``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``." msgstr "預設值:``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``。" -#: ../../using/configure.rst:1449 +#: ../../using/configure.rst:1455 msgid "Linker flags used for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:1455 +#: ../../using/configure.rst:1461 msgid "Footnotes" msgstr "註腳" -#: ../../using/configure.rst:1456 +#: ../../using/configure.rst:1462 msgid "" "``git clean -fdx`` is an even more extreme way to \"clean\" your checkout. " "It removes all files not known to Git. When bug hunting using ``git " @@ -2061,6 +2100,3 @@ msgid "" "clean build. **Use with care**, as it will delete all files not checked into " "Git, including your new, uncommitted work." msgstr "" - -#~ msgid "Define the ``WITH_EDITLINE`` macro." -#~ msgstr "定義 ``WITH_EDITLINE`` 巨集。" diff --git a/using/editors.po b/using/editors.po index d066d58ae3..7aca16ba10 100644 --- a/using/editors.po +++ b/using/editors.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2025-02-13 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,9 +29,28 @@ msgid "" "checks." msgstr "" -#: ../../using/editors.rst:12 +#: ../../using/editors.rst:14 +msgid "IDLE --- Python editor and shell" +msgstr "IDLE --- Python 編輯器與 shell" + +#: ../../using/editors.rst:16 +msgid "" +"IDLE is Python’s Integrated Development and Learning Environment and is " +"generally bundled with Python installs. If you are on Linux and do not have " +"IDLE installed see :ref:`Installing IDLE on Linux " +"<installing_idle_on_linux>`. For more information see the :ref:`IDLE docs " +"<idle>`." +msgstr "" + +#: ../../using/editors.rst:22 +msgid "Other Editors and IDEs" +msgstr "其他編輯器與 IDE" + +#: ../../using/editors.rst:24 msgid "" -"Please go to `Python Editors <https://wiki.python.org/moin/PythonEditors>`_ " -"and `Integrated Development Environments <https://wiki.python.org/moin/" -"IntegratedDevelopmentEnvironments>`_ for a comprehensive list." +"Python's community wiki has information submitted by the community on " +"Editors and IDEs. Please go to `Python Editors <https://wiki.python.org/moin/" +"PythonEditors>`_ and `Integrated Development Environments <https://" +"wiki.python.org/moin/IntegratedDevelopmentEnvironments>`_ for a " +"comprehensive list." msgstr "" diff --git a/using/ios.po b/using/ios.po index 1f08607933..504db08ea5 100644 --- a/using/ios.po +++ b/using/ios.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-10 00:15+0000\n" +"POT-Creation-Date: 2025-03-14 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -491,47 +491,41 @@ msgstr "" #: ../../using/ios.rst:299 msgid "" -"System logging (:c:member:`PyConfig.use_system_logger`) is *enabled* " -"(optional, but strongly recommended);" -msgstr "" - -#: ../../using/ios.rst:301 -msgid "" "``PYTHONHOME`` for the interpreter is configured to point at the ``python`` " "subfolder of your app's bundle; and" msgstr "" -#: ../../using/ios.rst:303 +#: ../../using/ios.rst:301 msgid "The ``PYTHONPATH`` for the interpreter includes:" msgstr "" -#: ../../using/ios.rst:305 +#: ../../using/ios.rst:303 msgid "the ``python/lib/python3.X`` subfolder of your app's bundle," msgstr "" -#: ../../using/ios.rst:306 +#: ../../using/ios.rst:304 msgid "" "the ``python/lib/python3.X/lib-dynload`` subfolder of your app's bundle, and" msgstr "" -#: ../../using/ios.rst:307 +#: ../../using/ios.rst:305 msgid "the ``app`` subfolder of your app's bundle" msgstr "" -#: ../../using/ios.rst:309 +#: ../../using/ios.rst:307 msgid "" "Your app's bundle location can be determined using ``[[NSBundle mainBundle] " "resourcePath]``." msgstr "" -#: ../../using/ios.rst:312 +#: ../../using/ios.rst:310 msgid "" "Steps 8, 9 and 10 of these instructions assume that you have a single folder " "of pure Python application code, named ``app``. If you have third-party " "binary modules in your app, some additional steps will be required:" msgstr "" -#: ../../using/ios.rst:316 +#: ../../using/ios.rst:314 msgid "" "You need to ensure that any folders containing third-party binaries are " "either associated with the app target, or copied in as part of step 8. Step " @@ -540,24 +534,24 @@ msgid "" "building an app targeting the simulator)." msgstr "" -#: ../../using/ios.rst:322 +#: ../../using/ios.rst:320 msgid "" "Any folders that contain third-party binaries must be processed into " "framework form by step 9. The invocation of ``install_dylib`` that processes " "the ``lib-dynload`` folder can be copied and adapted for this purpose." msgstr "" -#: ../../using/ios.rst:326 +#: ../../using/ios.rst:324 msgid "" "If you're using a separate folder for third-party packages, ensure that " "folder is included as part of the ``PYTHONPATH`` configuration in step 10." msgstr "" -#: ../../using/ios.rst:330 +#: ../../using/ios.rst:328 msgid "Testing a Python package" msgstr "" -#: ../../using/ios.rst:332 +#: ../../using/ios.rst:330 msgid "" "The CPython source tree contains :source:`a testbed project <iOS/testbed>` " "that is used to run the CPython test suite on the iOS simulator. This " @@ -565,19 +559,19 @@ msgid "" "library's test suite on iOS." msgstr "" -#: ../../using/ios.rst:336 +#: ../../using/ios.rst:334 msgid "" "After building or obtaining an iOS XCFramework (See :source:`iOS/README.rst` " "for details), create a clone of the Python iOS testbed project by running:" msgstr "" -#: ../../using/ios.rst:339 +#: ../../using/ios.rst:337 msgid "" "$ python iOS/testbed clone --framework <path/to/Python.xcframework> --app " "<path/to/module1> --app <path/to/module2> app-testbed" msgstr "" -#: ../../using/ios.rst:343 +#: ../../using/ios.rst:341 msgid "" "You will need to modify the ``iOS/testbed`` reference to point to that " "directory in the CPython source tree; any folders specified with the ``--" @@ -589,41 +583,41 @@ msgid "" "testbed/iOSTestbed/app_packages`` or similar)." msgstr "" -#: ../../using/ios.rst:352 +#: ../../using/ios.rst:350 msgid "" "You can then use the ``app-testbed`` folder to run the test suite for your " "app, For example, if ``module1.tests`` was the entry point to your test " "suite, you could run:" msgstr "" -#: ../../using/ios.rst:356 +#: ../../using/ios.rst:354 msgid "$ python app-testbed run -- module1.tests" msgstr "" -#: ../../using/ios.rst:360 +#: ../../using/ios.rst:358 msgid "" "This is the equivalent of running ``python -m module1.tests`` on a desktop " "Python build. Any arguments after the ``--`` will be passed to the testbed " "as if they were arguments to ``python -m`` on a desktop machine." msgstr "" -#: ../../using/ios.rst:364 +#: ../../using/ios.rst:362 msgid "You can also open the testbed project in Xcode by running:" msgstr "" -#: ../../using/ios.rst:366 +#: ../../using/ios.rst:364 msgid "$ open app-testbed/iOSTestbed.xcodeproj" msgstr "" -#: ../../using/ios.rst:370 +#: ../../using/ios.rst:368 msgid "This will allow you to use the full Xcode suite of tools for debugging." msgstr "" -#: ../../using/ios.rst:373 +#: ../../using/ios.rst:371 msgid "App Store Compliance" msgstr "" -#: ../../using/ios.rst:375 +#: ../../using/ios.rst:373 msgid "" "The only mechanism for distributing apps to third-party iOS devices is to " "submit the app to the iOS App Store; apps submitted for distribution must " @@ -632,7 +626,7 @@ msgid "" "problematic code." msgstr "" -#: ../../using/ios.rst:380 +#: ../../using/ios.rst:378 msgid "" "The Python standard library contains some code that is known to violate " "these automated rules. While these violations appear to be false positives, " @@ -640,7 +634,7 @@ msgid "" "Python standard library for an app to pass App Store review." msgstr "" -#: ../../using/ios.rst:385 +#: ../../using/ios.rst:383 msgid "" "The Python source tree contains :source:`a patch file <Mac/Resources/app-" "store-compliance.patch>` that will remove all code that is known to cause " diff --git a/using/unix.po b/using/unix.po index e787864dc8..d8258bda11 100644 --- a/using/unix.po +++ b/using/unix.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-22 00:13+0000\n" +"POT-Creation-Date: 2025-03-20 00:14+0000\n" "PO-Revision-Date: 2023-03-27 12:40+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -57,7 +57,7 @@ msgstr "https://www.debian.org/doc/manuals/maint-guide/first.en.html" #: ../../using/unix.rst:30 msgid "for Debian users" -msgstr "對於 Debian 用戶" +msgstr "對於 Debian 使用者" #: ../../using/unix.rst:31 msgid "https://en.opensuse.org/Portal:Packaging" @@ -65,7 +65,7 @@ msgstr "https://en.opensuse.org/Portal:Packaging" #: ../../using/unix.rst:32 msgid "for OpenSuse users" -msgstr "對於 OpenSuse 用戶" +msgstr "對於 OpenSuse 使用者" #: ../../using/unix.rst:33 msgid "" @@ -77,7 +77,7 @@ msgstr "" #: ../../using/unix.rst:34 msgid "for Fedora users" -msgstr "對於 Fedora 用戶" +msgstr "對於 Fedora 使用者" #: ../../using/unix.rst:35 msgid "https://slackbook.org/html/package-management-making-packages.html" @@ -85,25 +85,70 @@ msgstr "https://slackbook.org/html/package-management-making-packages.html" #: ../../using/unix.rst:36 msgid "for Slackware users" -msgstr "對於 Slackware 用戶" +msgstr "對於 Slackware 使用者" -#: ../../using/unix.rst:40 +#: ../../using/unix.rst:41 +msgid "Installing IDLE" +msgstr "安裝 IDLE" + +#: ../../using/unix.rst:43 +msgid "In some cases, IDLE might not be included in your Python installation." +msgstr "在某些情況下,IDLE 可能不會包含在你的 Python 安裝中。" + +#: ../../using/unix.rst:45 +msgid "For Debian and Ubuntu users::" +msgstr "對於 Debian 和 Ubuntu 使用者: ::" + +#: ../../using/unix.rst:47 +msgid "" +"sudo apt update\n" +"sudo apt install idle" +msgstr "" +"sudo apt update\n" +"sudo apt install idle" + +#: ../../using/unix.rst:50 +msgid "For Fedora, RHEL, and CentOS users::" +msgstr "對於 Fedora、RHEL 和 CentOS 使用者: ::" + +#: ../../using/unix.rst:52 +msgid "sudo dnf install python3-idle" +msgstr "sudo dnf install python3-idle" + +#: ../../using/unix.rst:54 +msgid "For SUSE and OpenSUSE users::" +msgstr "對於 SUSE 和 OpenSUSE 使用者: ::" + +#: ../../using/unix.rst:56 +#, fuzzy +msgid "sudo zypper install python3-idle" +msgstr "sudo zypper in python3-idle" + +#: ../../using/unix.rst:58 +msgid "For Alpine Linux users::" +msgstr "對於 Alpine Linux 使用者: ::" + +#: ../../using/unix.rst:60 +msgid "sudo apk add python3-idle" +msgstr "sudo apk add python3-idle" + +#: ../../using/unix.rst:65 msgid "On FreeBSD and OpenBSD" msgstr "在 FreeBSD 和 OpenBSD 上" -#: ../../using/unix.rst:42 +#: ../../using/unix.rst:67 msgid "FreeBSD users, to add the package use::" -msgstr "FreeBSD 用戶應使用以下命令增加套件: ::" +msgstr "FreeBSD 使用者應使用以下命令增加套件: ::" -#: ../../using/unix.rst:44 +#: ../../using/unix.rst:69 msgid "pkg install python3" msgstr "pkg install python3" -#: ../../using/unix.rst:46 +#: ../../using/unix.rst:71 msgid "OpenBSD users, to add the package use::" -msgstr "OpenBSD 用戶應使用以下命令增加套件: ::" +msgstr "OpenBSD 使用者應使用以下命令增加套件: ::" -#: ../../using/unix.rst:48 +#: ../../using/unix.rst:73 msgid "" "pkg_add -r python\n" "\n" @@ -115,11 +160,11 @@ msgstr "" "pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/<insert your " "architecture here>/python-<version>.tgz" -#: ../../using/unix.rst:52 +#: ../../using/unix.rst:77 msgid "For example i386 users get the 2.5.1 version of Python using::" msgstr "例如 i386 使用者要獲取 Python 2.5.1 的可用版本: ::" -#: ../../using/unix.rst:54 +#: ../../using/unix.rst:79 msgid "" "pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/python-2.5.1p2." "tgz" @@ -127,11 +172,11 @@ msgstr "" "pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/python-2.5.1p2." "tgz" -#: ../../using/unix.rst:60 +#: ../../using/unix.rst:85 msgid "Building Python" msgstr "建置 Python" -#: ../../using/unix.rst:62 +#: ../../using/unix.rst:87 msgid "" "If you want to compile CPython yourself, first thing you should do is get " "the `source <https://www.python.org/downloads/source/>`_. You can download " @@ -144,11 +189,11 @@ msgstr "" "(克隆) <https://devguide.python.org/setup/#getting-the-source-code>`_。(如" "果你想要貢獻修補程式碼,也會需要一份 clone。)" -#: ../../using/unix.rst:68 +#: ../../using/unix.rst:93 msgid "The build process consists of the usual commands::" msgstr "建置過程由幾個常用命令組成: ::" -#: ../../using/unix.rst:70 +#: ../../using/unix.rst:95 msgid "" "./configure\n" "make\n" @@ -158,7 +203,7 @@ msgstr "" "make\n" "make install" -#: ../../using/unix.rst:74 +#: ../../using/unix.rst:99 msgid "" ":ref:`Configuration options <configure-options>` and caveats for specific " "Unix platforms are extensively documented in the :source:`README.rst` file " @@ -168,7 +213,7 @@ msgstr "" "地記錄在 Python 原始碼樹 (source tree) 根目錄下的 :source:`README.rst` 檔案" "中。" -#: ../../using/unix.rst:80 +#: ../../using/unix.rst:105 msgid "" "``make install`` can overwrite or masquerade the :file:`python3` binary. " "``make altinstall`` is therefore recommended instead of ``make install`` " @@ -178,11 +223,11 @@ msgstr "" "``make altinstall`` 而不是 ``make install``,因為它只安裝 :file:" "`{exec_prefix}/bin/python{version}`。" -#: ../../using/unix.rst:86 +#: ../../using/unix.rst:111 msgid "Python-related paths and files" msgstr "與 Python 相關的路徑和檔案" -#: ../../using/unix.rst:88 +#: ../../using/unix.rst:113 msgid "" "These are subject to difference depending on local installation " "conventions; :option:`prefix <--prefix>` and :option:`exec_prefix <--exec-" @@ -192,28 +237,28 @@ msgstr "" "這取決於本地安裝慣例;:option:`prefix <--prefix>` 和 :option:`exec_prefix <--" "exec-prefix>` 相依於安裝方式,應被直譯來讓 GNU 軟體使用;它們也可能相同。" -#: ../../using/unix.rst:93 +#: ../../using/unix.rst:118 msgid "" "For example, on most Linux systems, the default for both is :file:`/usr`." msgstr "例如,在大多數 Linux 系統上,兩者的預設值皆是 :file:`/usr`。" -#: ../../using/unix.rst:96 +#: ../../using/unix.rst:121 msgid "File/directory" msgstr "檔案/目錄" -#: ../../using/unix.rst:96 +#: ../../using/unix.rst:121 msgid "Meaning" msgstr "含意" -#: ../../using/unix.rst:98 +#: ../../using/unix.rst:123 msgid ":file:`{exec_prefix}/bin/python3`" msgstr ":file:`{exec_prefix}/bin/python3`" -#: ../../using/unix.rst:98 +#: ../../using/unix.rst:123 msgid "Recommended location of the interpreter." msgstr "直譯器的推薦位置。" -#: ../../using/unix.rst:100 +#: ../../using/unix.rst:125 msgid "" ":file:`{prefix}/lib/python{version}`, :file:`{exec_prefix}/lib/" "python{version}`" @@ -221,12 +266,12 @@ msgstr "" ":file:`{prefix}/lib/python{version}`、:file:`{exec_prefix}/lib/" "python{version}`" -#: ../../using/unix.rst:100 +#: ../../using/unix.rst:125 msgid "" "Recommended locations of the directories containing the standard modules." msgstr "包含標準模組目錄的推薦位置。" -#: ../../using/unix.rst:103 +#: ../../using/unix.rst:128 msgid "" ":file:`{prefix}/include/python{version}`, :file:`{exec_prefix}/include/" "python{version}`" @@ -234,39 +279,39 @@ msgstr "" ":file:`{prefix}/include/python{version}`、:file:`{exec_prefix}/include/" "python{version}`" -#: ../../using/unix.rst:103 +#: ../../using/unix.rst:128 msgid "" "Recommended locations of the directories containing the include files needed " "for developing Python extensions and embedding the interpreter." msgstr "" "包含開發 Python 擴充套件和嵌入直譯器所需 include 檔案之目錄的推薦位置。" -#: ../../using/unix.rst:111 +#: ../../using/unix.rst:136 msgid "Miscellaneous" msgstr "雜項" -#: ../../using/unix.rst:113 +#: ../../using/unix.rst:138 msgid "" "To easily use Python scripts on Unix, you need to make them executable, e.g. " "with" msgstr "" "要在 Unix 上使用 Python 腳本,你需要讓他們是可執行的 (executable),例如用" -#: ../../using/unix.rst:116 +#: ../../using/unix.rst:141 msgid "$ chmod +x script" msgstr "$ chmod +x script" -#: ../../using/unix.rst:120 +#: ../../using/unix.rst:145 msgid "" "and put an appropriate Shebang line at the top of the script. A good choice " "is usually ::" msgstr "並在腳本的頂部放一個合適的 Shebang。以下通常是個好選擇: ::" -#: ../../using/unix.rst:123 +#: ../../using/unix.rst:148 msgid "#!/usr/bin/env python3" msgstr "#!/usr/bin/env python3" -#: ../../using/unix.rst:125 +#: ../../using/unix.rst:150 msgid "" "which searches for the Python interpreter in the whole :envvar:`PATH`. " "However, some Unices may not have the :program:`env` command, so you may " @@ -276,17 +321,17 @@ msgstr "" "program:`env` 命令,因此你可能需要將 ``/usr/bin/python3`` 寫死 (hardcode) 成" "直譯器路徑。" -#: ../../using/unix.rst:129 +#: ../../using/unix.rst:154 msgid "" "To use shell commands in your Python scripts, look at the :mod:`subprocess` " "module." msgstr "要在 Python 腳本中使用 shell 命令,請見 :mod:`subprocess` 模組。" -#: ../../using/unix.rst:134 +#: ../../using/unix.rst:159 msgid "Custom OpenSSL" msgstr "客製化 OpenSSL" -#: ../../using/unix.rst:136 +#: ../../using/unix.rst:161 msgid "" "To use your vendor's OpenSSL configuration and system trust store, locate " "the directory with ``openssl.cnf`` file or symlink in ``/etc``. On most " @@ -299,7 +344,7 @@ msgstr "" "(symlink)。在大多數發行版上,該檔案會是在 ``/etc/ssl`` 或者 ``/etc/pki/tls`` " "中。該目錄亦應包含一個 ``cert.pem`` 檔案和/或一個 ``certs`` 目錄。" -#: ../../using/unix.rst:142 +#: ../../using/unix.rst:167 msgid "" "$ find /etc/ -name openssl.cnf -printf \"%h\\n\"\n" "/etc/ssl" @@ -307,7 +352,7 @@ msgstr "" "$ find /etc/ -name openssl.cnf -printf \"%h\\n\"\n" "/etc/ssl" -#: ../../using/unix.rst:147 +#: ../../using/unix.rst:172 msgid "" "Download, build, and install OpenSSL. Make sure you use ``install_sw`` and " "not ``install``. The ``install_sw`` target does not override ``openssl.cnf``." @@ -315,7 +360,7 @@ msgstr "" "下載、建置並安裝 OpenSSL。請確保你使用 ``install_sw`` 而不是 ``install``。" "``install_sw`` 的目標不會覆蓋 ``openssl.cnf``。" -#: ../../using/unix.rst:151 +#: ../../using/unix.rst:176 msgid "" "$ curl -O https://www.openssl.org/source/openssl-VERSION.tar.gz\n" "$ tar xzf openssl-VERSION\n" @@ -341,7 +386,7 @@ msgstr "" "$ make install_sw\n" "$ popd" -#: ../../using/unix.rst:165 +#: ../../using/unix.rst:190 msgid "" "Build Python with custom OpenSSL (see the configure ``--with-openssl`` and " "``--with-openssl-rpath`` options)" @@ -349,7 +394,7 @@ msgstr "" "使用客製化 OpenSSL 建置 Python(參見配置 ``--with-openssl`` 和 ``--with-" "openssl-rpath`` 選項)" -#: ../../using/unix.rst:168 +#: ../../using/unix.rst:193 msgid "" "$ pushd python-3.x.x\n" "$ ./configure -C \\\n" @@ -367,7 +412,7 @@ msgstr "" "$ make -j8\n" "$ make altinstall" -#: ../../using/unix.rst:180 +#: ../../using/unix.rst:205 msgid "" "Patch releases of OpenSSL have a backwards compatible ABI. You don't need to " "recompile Python to update OpenSSL. It's sufficient to replace the custom " diff --git a/whatsnew/2.3.po b/whatsnew/2.3.po index d2be7edf2d..48d3561118 100644 --- a/whatsnew/2.3.po +++ b/whatsnew/2.3.po @@ -104,8 +104,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:66 msgid "" -"The union and intersection of sets can be computed with the :meth:" -"`~frozenset.union` and :meth:`~frozenset.intersection` methods; an " +"The union and intersection of sets can be computed with " +"the :meth:`~frozenset.union` and :meth:`~frozenset.intersection` methods; an " "alternative notation uses the bitwise operators ``&`` and ``|``. Mutable " "sets also have in-place versions of these methods, :meth:`!union_update` " "and :meth:`~frozenset.intersection_update`. ::" @@ -135,8 +135,8 @@ msgid "" "the set of all elements in the union that aren't in the intersection. " "Another way of putting it is that the symmetric difference contains all " "elements that are in exactly one set. Again, there's an alternative " -"notation (``^``), and an in-place version with the ungainly name :meth:" -"`~frozenset.symmetric_difference_update`. ::" +"notation (``^``), and an in-place version with the ungainly " +"name :meth:`~frozenset.symmetric_difference_update`. ::" msgstr "" #: ../../whatsnew/2.3.rst:92 @@ -181,7 +181,7 @@ msgstr "" #: ../../whatsnew/2.3.rst:126 msgid "PEP 255: Simple Generators" -msgstr "" +msgstr "PEP 255:簡單產生器" #: ../../whatsnew/2.3.rst:128 msgid "" @@ -209,7 +209,7 @@ msgstr "" #: ../../whatsnew/2.3.rst:145 msgid "Here's the simplest example of a generator function::" -msgstr "" +msgstr "以下是產生器函式最簡單的範例:" #: ../../whatsnew/2.3.rst:147 msgid "" @@ -217,6 +217,9 @@ msgid "" " for i in range(N):\n" " yield i" msgstr "" +"def generate_ints(N):\n" +" for i in range(N):\n" +" yield i" #: ../../whatsnew/2.3.rst:151 msgid "" @@ -234,12 +237,13 @@ msgid "" "of ``i``, similar to a :keyword:`return` statement. The big difference " "between :keyword:`!yield` and a :keyword:`!return` statement is that on " "reaching a :keyword:`!yield` the generator's state of execution is suspended " -"and local variables are preserved. On the next call to the generator's ``." -"next()`` method, the function will resume executing immediately after the :" -"keyword:`!yield` statement. (For complicated reasons, the :keyword:`!yield` " -"statement isn't allowed inside the :keyword:`try` block of a :keyword:`!" -"try`...\\ :keyword:`!finally` statement; read :pep:`255` for a full " -"explanation of the interaction between :keyword:`!yield` and exceptions.)" +"and local variables are preserved. On the next call to the generator's " +"``.next()`` method, the function will resume executing immediately after " +"the :keyword:`!yield` statement. (For complicated reasons, the :keyword:`!" +"yield` statement isn't allowed inside the :keyword:`try` block of " +"a :keyword:`!try`...\\ :keyword:`!finally` statement; read :pep:`255` for a " +"full explanation of the interaction between :keyword:`!yield` and " +"exceptions.)" msgstr "" #: ../../whatsnew/2.3.rst:169 @@ -263,6 +267,20 @@ msgid "" " File \"stdin\", line 2, in generate_ints\n" "StopIteration" msgstr "" +">>> gen = generate_ints(3)\n" +">>> gen\n" +"<generator object at 0x8117f90>\n" +">>> gen.next()\n" +"0\n" +">>> gen.next()\n" +"1\n" +">>> gen.next()\n" +"2\n" +">>> gen.next()\n" +"Traceback (most recent call last):\n" +" File \"stdin\", line 1, in ?\n" +" File \"stdin\", line 2, in generate_ints\n" +"StopIteration" #: ../../whatsnew/2.3.rst:186 msgid "" @@ -354,7 +372,7 @@ msgstr "" #: ../../whatsnew/2.3.rst:247 msgid ":pep:`255` - Simple Generators" -msgstr "" +msgstr ":pep:`255` - 簡單產生器" #: ../../whatsnew/2.3.rst:248 msgid "" @@ -380,14 +398,16 @@ msgid "" "#!/usr/bin/env python\n" "# -*- coding: UTF-8 -*-" msgstr "" +"#!/usr/bin/env python\n" +"# -*- coding: UTF-8 -*-" #: ../../whatsnew/2.3.rst:267 msgid "" "Without such an encoding declaration, the default encoding used is 7-bit " "ASCII. Executing or importing modules that contain string literals with 8-" -"bit characters and have no encoding declaration will result in a :exc:" -"`DeprecationWarning` being signalled by Python 2.3; in 2.4 this will be a " -"syntax error." +"bit characters and have no encoding declaration will result in " +"a :exc:`DeprecationWarning` being signalled by Python 2.3; in 2.4 this will " +"be a syntax error." msgstr "" #: ../../whatsnew/2.3.rst:273 @@ -416,8 +436,8 @@ msgstr "" msgid "" "The new :mod:`zipimport` module adds support for importing modules from a " "ZIP-format archive. You don't need to import the module explicitly; it will " -"be automatically imported if a ZIP archive's filename is added to ``sys." -"path``. For example:" +"be automatically imported if a ZIP archive's filename is added to " +"``sys.path``. For example:" msgstr "" #: ../../whatsnew/2.3.rst:296 @@ -443,11 +463,12 @@ msgstr "" #: ../../whatsnew/2.3.rst:314 msgid "" "An entry in ``sys.path`` can now be the filename of a ZIP archive. The ZIP " -"archive can contain any kind of files, but only files named :file:`\\*.py`, :" -"file:`\\*.pyc`, or :file:`\\*.pyo` can be imported. If an archive only " -"contains :file:`\\*.py` files, Python will not attempt to modify the archive " -"by adding the corresponding :file:`\\*.pyc` file, meaning that if a ZIP " -"archive doesn't contain :file:`\\*.pyc` files, importing may be rather slow." +"archive can contain any kind of files, but only files " +"named :file:`\\*.py`, :file:`\\*.pyc`, or :file:`\\*.pyo` can be imported. " +"If an archive only contains :file:`\\*.py` files, Python will not attempt to " +"modify the archive by adding the corresponding :file:`\\*.pyc` file, meaning " +"that if a ZIP archive doesn't contain :file:`\\*.pyc` files, importing may " +"be rather slow." msgstr "" #: ../../whatsnew/2.3.rst:321 @@ -465,9 +486,9 @@ msgstr "" msgid "" "Written by James C. Ahlstrom, who also provided an implementation. Python " "2.3 follows the specification in :pep:`273`, but uses an implementation " -"written by Just van Rossum that uses the import hooks described in :pep:" -"`302`. See section :ref:`section-pep302` for a description of the new import " -"hooks." +"written by Just van Rossum that uses the import hooks described " +"in :pep:`302`. See section :ref:`section-pep302` for a description of the " +"new import hooks." msgstr "" #: ../../whatsnew/2.3.rst:338 @@ -484,10 +505,11 @@ msgstr "" #: ../../whatsnew/2.3.rst:344 msgid "" "Python now allows using arbitrary Unicode strings (within the limitations of " -"the file system) for all functions that expect file names, most notably the :" -"func:`open` built-in function. If a Unicode string is passed to :func:`os." -"listdir`, Python now returns a list of Unicode strings. A new function, :" -"func:`!os.getcwdu`, returns the current directory as a Unicode string." +"the file system) for all functions that expect file names, most notably " +"the :func:`open` built-in function. If a Unicode string is passed " +"to :func:`os.listdir`, Python now returns a list of Unicode strings. A new " +"function, :func:`!os.getcwdu`, returns the current directory as a Unicode " +"string." msgstr "" #: ../../whatsnew/2.3.rst:350 @@ -499,10 +521,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:353 msgid "" "Other systems also allow Unicode strings as file names but convert them to " -"byte strings before passing them to the system, which can cause a :exc:" -"`UnicodeError` to be raised. Applications can test whether arbitrary Unicode " -"strings are supported as file names by checking :const:`os.path." -"supports_unicode_filenames`, a Boolean value." +"byte strings before passing them to the system, which can cause " +"a :exc:`UnicodeError` to be raised. Applications can test whether arbitrary " +"Unicode strings are supported as file names by " +"checking :const:`os.path.supports_unicode_filenames`, a Boolean value." msgstr "" #: ../../whatsnew/2.3.rst:359 @@ -537,9 +559,9 @@ msgstr "" msgid "" "Python's file objects can now support end of line conventions other than the " "one followed by the platform on which Python is running. Opening a file with " -"the mode ``'U'`` or ``'rU'`` will open a file for reading in :term:" -"`universal newlines` mode. All three line ending conventions will be " -"translated to a ``'\\n'`` in the strings returned by the various file " +"the mode ``'U'`` or ``'rU'`` will open a file for reading " +"in :term:`universal newlines` mode. All three line ending conventions will " +"be translated to a ``'\\n'`` in the strings returned by the various file " "methods such as :meth:`!read` and :meth:`!readline`." msgstr "" @@ -553,9 +575,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:396 msgid "" -"This feature can be disabled when compiling Python by specifying the :option:" -"`!--without-universal-newlines` switch when running Python's :program:" -"`configure` script." +"This feature can be disabled when compiling Python by specifying " +"the :option:`!--without-universal-newlines` switch when running " +"Python's :program:`configure` script." msgstr "" #: ../../whatsnew/2.3.rst:403 @@ -629,15 +651,16 @@ msgstr "" msgid "" "The :class:`~logging.Logger` class is the primary class. Most application " "code will deal with one or more :class:`~logging.Logger` objects, each one " -"used by a particular subsystem of the application. Each :class:`~logging." -"Logger` is identified by a name, and names are organized into a hierarchy " -"using ``.`` as the component separator. For example, you might have :class:" -"`~logging.Logger` instances named ``server``, ``server.auth`` and ``server." -"network``. The latter two instances are below ``server`` in the hierarchy. " -"This means that if you turn up the verbosity for ``server`` or direct " -"``server`` messages to a different handler, the changes will also apply to " -"records logged to ``server.auth`` and ``server.network``. There's also a " -"root :class:`~logging.Logger` that's the parent of all other loggers." +"used by a particular subsystem of the application. " +"Each :class:`~logging.Logger` is identified by a name, and names are " +"organized into a hierarchy using ``.`` as the component separator. For " +"example, you might have :class:`~logging.Logger` instances named ``server``, " +"``server.auth`` and ``server.network``. The latter two instances are below " +"``server`` in the hierarchy. This means that if you turn up the verbosity " +"for ``server`` or direct ``server`` messages to a different handler, the " +"changes will also apply to records logged to ``server.auth`` and " +"``server.network``. There's also a root :class:`~logging.Logger` that's the " +"parent of all other loggers." msgstr "" #: ../../whatsnew/2.3.rst:464 @@ -672,8 +695,8 @@ msgstr "" msgid "" "In the default configuration, informational and debugging messages are " "suppressed and the output is sent to standard error. You can enable the " -"display of informational and debugging messages by calling the :meth:" -"`~logging.Logger.setLevel` method on the root logger." +"display of informational and debugging messages by calling " +"the :meth:`~logging.Logger.setLevel` method on the root logger." msgstr "" #: ../../whatsnew/2.3.rst:486 @@ -730,9 +753,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:519 msgid "" "Log records are usually propagated up the hierarchy, so a message logged to " -"``server.auth`` is also seen by ``server`` and ``root``, but a :class:" -"`~logging.Logger` can prevent this by setting its :attr:`~logging.Logger." -"propagate` attribute to :const:`False`." +"``server.auth`` is also seen by ``server`` and ``root``, but " +"a :class:`~logging.Logger` can prevent this by setting " +"its :attr:`~logging.Logger.propagate` attribute to :const:`False`." msgstr "" #: ../../whatsnew/2.3.rst:523 @@ -743,10 +766,10 @@ msgid "" "any number of different :class:`~logging.Handler` instances. Loggers and " "handlers can also have an attached list of filters, and each filter can " "cause the :class:`~logging.LogRecord` to be ignored or can modify the record " -"before passing it along. When they're finally output, :class:`~logging." -"LogRecord` instances are converted to text by a :class:`~logging.Formatter` " -"class. All of these classes can be replaced by your own specially written " -"classes." +"before passing it along. When they're finally " +"output, :class:`~logging.LogRecord` instances are converted to text by " +"a :class:`~logging.Formatter` class. All of these classes can be replaced " +"by your own specially written classes." msgstr "" #: ../../whatsnew/2.3.rst:533 @@ -773,17 +796,17 @@ msgstr "" #: ../../whatsnew/2.3.rst:552 msgid "" "A Boolean type was added to Python 2.3. Two new constants were added to " -"the :mod:`!__builtin__` module, :const:`True` and :const:`False`. (:const:" -"`True` and :const:`False` constants were added to the built-ins in Python " -"2.2.1, but the 2.2.1 versions are simply set to integer values of 1 and 0 " -"and aren't a different type.)" +"the :mod:`!__builtin__` module, :const:`True` and :const:`False`. " +"(:const:`True` and :const:`False` constants were added to the built-ins in " +"Python 2.2.1, but the 2.2.1 versions are simply set to integer values of 1 " +"and 0 and aren't a different type.)" msgstr "" #: ../../whatsnew/2.3.rst:558 msgid "" "The type object for this new type is named :class:`bool`; the constructor " -"for it takes any Python value and converts it to :const:`True` or :const:" -"`False`. ::" +"for it takes any Python value and converts it to :const:`True` " +"or :const:`False`. ::" msgstr "" #: ../../whatsnew/2.3.rst:561 @@ -829,13 +852,13 @@ msgstr "" msgid "" "Python's Booleans were *not* added for the sake of strict type-checking. A " "very strict language such as Pascal would also prevent you performing " -"arithmetic with Booleans, and would require that the expression in an :" -"keyword:`if` statement always evaluate to a Boolean result. Python is not " -"this strict and never will be, as :pep:`285` explicitly says. This means " -"you can still use any expression in an :keyword:`!if` statement, even ones " -"that evaluate to a list or tuple or some random object. The Boolean type is " -"a subclass of the :class:`int` class so that arithmetic using a Boolean " -"still works. ::" +"arithmetic with Booleans, and would require that the expression in " +"an :keyword:`if` statement always evaluate to a Boolean result. Python is " +"not this strict and never will be, as :pep:`285` explicitly says. This " +"means you can still use any expression in an :keyword:`!if` statement, even " +"ones that evaluate to a list or tuple or some random object. The Boolean " +"type is a subclass of the :class:`int` class so that arithmetic using a " +"Boolean still works. ::" msgstr "" #: ../../whatsnew/2.3.rst:596 @@ -874,9 +897,9 @@ msgstr "" msgid "" "When encoding a Unicode string into a byte string, unencodable characters " "may be encountered. So far, Python has allowed specifying the error " -"processing as either \"strict\" (raising :exc:`UnicodeError`), " -"\"ignore\" (skipping the character), or \"replace\" (using a question mark " -"in the output string), with \"strict\" being the default behavior. It may be " +"processing as either \"strict\" (raising :exc:`UnicodeError`), \"ignore\" " +"(skipping the character), or \"replace\" (using a question mark in the " +"output string), with \"strict\" being the default behavior. It may be " "desirable to specify alternative processing of such errors, such as " "inserting an XML character reference or HTML entity reference into the " "converted string." @@ -1000,14 +1023,14 @@ msgstr "" msgid "" "``sys.path_hooks`` is a list of callable objects; most often they'll be " "classes. Each callable takes a string containing a path and either returns " -"an importer object that will handle imports from this path or raises an :exc:" -"`ImportError` exception if it can't handle this path." +"an importer object that will handle imports from this path or raises " +"an :exc:`ImportError` exception if it can't handle this path." msgstr "" #: ../../whatsnew/2.3.rst:721 msgid "" -"``sys.path_importer_cache`` caches importer objects for each path, so ``sys." -"path_hooks`` will only need to be traversed once for each path." +"``sys.path_importer_cache`` caches importer objects for each path, so " +"``sys.path_hooks`` will only need to be traversed once for each path." msgstr "" #: ../../whatsnew/2.3.rst:724 @@ -1125,9 +1148,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:797 msgid "" "Different dialects of comma-separated files can be defined and registered; " -"currently there are two dialects, both used by Microsoft Excel. A separate :" -"class:`csv.writer` class will generate comma-separated files from a " -"succession of tuples or lists, quoting strings that contain the delimiter." +"currently there are two dialects, both used by Microsoft Excel. A " +"separate :class:`csv.writer` class will generate comma-separated files from " +"a succession of tuples or lists, quoting strings that contain the delimiter." msgstr "" #: ../../whatsnew/2.3.rst:805 @@ -1175,10 +1198,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:836 msgid "" "To reduce the pickling overhead for new-style classes, a new interface for " -"customizing pickling was added using three special methods: :meth:`~object." -"__getstate__`, :meth:`~object.__setstate__`, and :meth:`~object." -"__getnewargs__`. Consult :pep:`307` for the full semantics of these " -"methods." +"customizing pickling was added using three special " +"methods: :meth:`~object.__getstate__`, :meth:`~object.__setstate__`, " +"and :meth:`~object.__getnewargs__`. Consult :pep:`307` for the full " +"semantics of these methods." msgstr "" #: ../../whatsnew/2.3.rst:841 @@ -1552,10 +1575,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:1044 msgid "" "Most type objects are now callable, so you can use them to create new " -"objects such as functions, classes, and modules. (This means that the :mod:" -"`!new` module can be deprecated in a future Python version, because you can " -"now use the type objects available in the :mod:`types` module.) For example, " -"you can create a new module object with the following code:" +"objects such as functions, classes, and modules. (This means that " +"the :mod:`!new` module can be deprecated in a future Python version, because " +"you can now use the type objects available in the :mod:`types` module.) For " +"example, you can create a new module object with the following code:" msgstr "" #: ../../whatsnew/2.3.rst:1052 @@ -1579,16 +1602,16 @@ msgid "" "A new warning, :exc:`PendingDeprecationWarning` was added to indicate " "features which are in the process of being deprecated. The warning will " "*not* be printed by default. To check for use of features that will be " -"deprecated in the future, supply :option:`-Walways::" -"PendingDeprecationWarning:: <-W>` on the command line or use :func:`warnings." -"filterwarnings`." +"deprecated in the future, supply :option:`-" +"Walways::PendingDeprecationWarning:: <-W>` on the command line or " +"use :func:`warnings.filterwarnings`." msgstr "" #: ../../whatsnew/2.3.rst:1065 msgid "" "The process of deprecating string-based exceptions, as in ``raise \"Error " -"occurred\"``, has begun. Raising a string will now trigger :exc:" -"`PendingDeprecationWarning`." +"occurred\"``, has begun. Raising a string will now " +"trigger :exc:`PendingDeprecationWarning`." msgstr "" #: ../../whatsnew/2.3.rst:1069 @@ -1663,8 +1686,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1115 msgid "" "One of the noted incompatibilities between old- and new-style classes has " -"been removed: you can now assign to the :attr:`~type.__name__` and :attr:" -"`~type.__bases__` attributes of new-style classes. There are some " +"been removed: you can now assign to the :attr:`~type.__name__` " +"and :attr:`~type.__bases__` attributes of new-style classes. There are some " "restrictions on what can be assigned to :attr:`!__bases__` along the lines " "of those relating to assigning to an instance's :attr:`~object.__class__` " "attribute." @@ -1794,8 +1817,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1202 msgid "" "The ``SET_LINENO`` opcode is now gone. This may provide a small speed " -"increase, depending on your compiler's idiosyncrasies. See section :ref:" -"`23section-other` for a longer explanation. (Removed by Michael Hudson.)" +"increase, depending on your compiler's idiosyncrasies. See " +"section :ref:`23section-other` for a longer explanation. (Removed by Michael " +"Hudson.)" msgstr "" #: ../../whatsnew/2.3.rst:1206 @@ -1856,18 +1880,19 @@ msgid "" "incompatibilities. When upgrading to Python 2.3, if the new interpreter is " "compiled with a new version of the underlying BerkeleyDB library, you will " "almost certainly have to convert your database files to the new version. " -"You can do this fairly easily with the new scripts :file:`db2pickle.py` and :" -"file:`pickle2db.py` which you will find in the distribution's :file:`Tools/" -"scripts` directory. If you've already been using the PyBSDDB package and " -"importing it as :mod:`!bsddb3`, you will have to change your ``import`` " -"statements to import it as :mod:`!bsddb`." +"You can do this fairly easily with the new scripts :file:`db2pickle.py` " +"and :file:`pickle2db.py` which you will find in the " +"distribution's :file:`Tools/scripts` directory. If you've already been " +"using the PyBSDDB package and importing it as :mod:`!bsddb3`, you will have " +"to change your ``import`` statements to import it as :mod:`!bsddb`." msgstr "" #: ../../whatsnew/2.3.rst:1249 msgid "" "The new :mod:`bz2` module is an interface to the bz2 data compression " -"library. bz2-compressed data is usually smaller than corresponding :mod:" -"`zlib`\\ -compressed data. (Contributed by Gustavo Niemeyer.)" +"library. bz2-compressed data is usually smaller than " +"corresponding :mod:`zlib`\\ -compressed data. (Contributed by Gustavo " +"Niemeyer.)" msgstr "" #: ../../whatsnew/2.3.rst:1253 @@ -1901,18 +1926,18 @@ msgstr "" #: ../../whatsnew/2.3.rst:1270 msgid "" -"Other minor changes to Distutils: it now checks for the :envvar:`CC`, :" -"envvar:`CFLAGS`, :envvar:`!CPP`, :envvar:`LDFLAGS`, and :envvar:`CPPFLAGS` " -"environment variables, using them to override the settings in Python's " -"configuration (contributed by Robert Weber)." +"Other minor changes to Distutils: it now checks for " +"the :envvar:`CC`, :envvar:`CFLAGS`, :envvar:`!CPP`, :envvar:`LDFLAGS`, " +"and :envvar:`CPPFLAGS` environment variables, using them to override the " +"settings in Python's configuration (contributed by Robert Weber)." msgstr "" #: ../../whatsnew/2.3.rst:1275 msgid "" "Previously the :mod:`doctest` module would only search the docstrings of " "public methods and functions for test cases, but it now also examines " -"private ones as well. The :func:`~doctest.DocTestSuite` function creates a :" -"class:`unittest.TestSuite` object from a set of :mod:`doctest` tests." +"private ones as well. The :func:`~doctest.DocTestSuite` function creates " +"a :class:`unittest.TestSuite` object from a set of :mod:`doctest` tests." msgstr "" #: ../../whatsnew/2.3.rst:1280 @@ -1925,10 +1950,10 @@ msgstr "" msgid "" "The :mod:`getopt` module gained a new function, :func:`~getopt.gnu_getopt`, " "that supports the same arguments as the existing :func:`~getopt.getopt` " -"function but uses GNU-style scanning mode. The existing :func:`~getopt." -"getopt` stops processing options as soon as a non-option argument is " -"encountered, but in GNU-style mode processing continues, meaning that " -"options and arguments can be mixed. For example::" +"function but uses GNU-style scanning mode. The " +"existing :func:`~getopt.getopt` stops processing options as soon as a non-" +"option argument is encountered, but in GNU-style mode processing continues, " +"meaning that options and arguments can be mixed. For example::" msgstr "" #: ../../whatsnew/2.3.rst:1289 @@ -1975,10 +2000,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:1314 msgid "" -"The :mod:`heapq` module provides :func:`~heapq.heappush` and :func:`~heapq." -"heappop` functions for adding and removing items while maintaining the heap " -"property on top of some other mutable Python sequence type. Here's an " -"example that uses a Python list::" +"The :mod:`heapq` module provides :func:`~heapq.heappush` " +"and :func:`~heapq.heappop` functions for adding and removing items while " +"maintaining the heap property on top of some other mutable Python sequence " +"type. Here's an example that uses a Python list::" msgstr "" #: ../../whatsnew/2.3.rst:1318 @@ -2063,8 +2088,8 @@ msgid "" "stamps are floats. For compatibility, when using the tuple interface of " "the :class:`~os.stat_result` time stamps will be represented as integers. " "When using named fields (a feature first introduced in Python 2.2), time " -"stamps are still represented as integers, unless :func:`!os." -"stat_float_times` is invoked to enable float return values::" +"stamps are still represented as integers, unless :func:`!" +"os.stat_float_times` is invoked to enable float return values::" msgstr "" #: ../../whatsnew/2.3.rst:1376 @@ -2118,8 +2143,8 @@ msgid "" "The parser objects provided by the :mod:`pyexpat <xml.parsers.expat>` module " "can now optionally buffer character data, resulting in fewer calls to your " "character data handler and therefore faster performance. Setting the parser " -"object's :attr:`~xml.parsers.expat.xmlparser.buffer_text` attribute to :" -"const:`True` will enable buffering." +"object's :attr:`~xml.parsers.expat.xmlparser.buffer_text` attribute " +"to :const:`True` will enable buffering." msgstr "" #: ../../whatsnew/2.3.rst:1410 @@ -2164,8 +2189,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1438 msgid "" -"The :mod:`readline` module also gained a number of new functions: :func:" -"`~readline.get_history_item`, :func:`~readline.get_current_history_length`, " +"The :mod:`readline` module also gained a number of new " +"functions: :func:`~readline.get_history_item`, :func:`~readline.get_current_history_length`, " "and :func:`~readline.redisplay`." msgstr "" @@ -2201,9 +2226,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1459 msgid "" -"Support for more advanced POSIX signal handling was added to the :mod:" -"`signal` but then removed again as it proved impossible to make it work " -"reliably across platforms." +"Support for more advanced POSIX signal handling was added to " +"the :mod:`signal` but then removed again as it proved impossible to make it " +"work reliably across platforms." msgstr "" #: ../../whatsnew/2.3.rst:1463 @@ -2238,8 +2263,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1481 msgid "" -"The new :mod:`tarfile` module allows reading from and writing to :program:" -"`tar`\\ -format archive files. (Contributed by Lars Gustäbel.)" +"The new :mod:`tarfile` module allows reading from and writing " +"to :program:`tar`\\ -format archive files. (Contributed by Lars Gustäbel.)" msgstr "" #: ../../whatsnew/2.3.rst:1484 @@ -2249,8 +2274,8 @@ msgid "" "string and returns a list containing the text split into lines of no more " "than the chosen width. The ``fill(text, width)`` function returns a single " "string, reformatted to fit into lines no longer than the chosen width. (As " -"you can guess, :func:`~textwrap.fill` is built on top of :func:`~textwrap." -"wrap`. For example::" +"you can guess, :func:`~textwrap.fill` is built on top " +"of :func:`~textwrap.wrap`. For example::" msgstr "" #: ../../whatsnew/2.3.rst:1491 @@ -2274,21 +2299,21 @@ msgstr "" #: ../../whatsnew/2.3.rst:1506 msgid "" "The module also contains a :class:`~textwrap.TextWrapper` class that " -"actually implements the text wrapping strategy. Both the :class:`~textwrap." -"TextWrapper` class and the :func:`~textwrap.wrap` and :func:`~textwrap.fill` " -"functions support a number of additional keyword arguments for fine-tuning " -"the formatting; consult the module's documentation for details. (Contributed " -"by Greg Ward.)" +"actually implements the text wrapping strategy. Both " +"the :class:`~textwrap.TextWrapper` class and the :func:`~textwrap.wrap` " +"and :func:`~textwrap.fill` functions support a number of additional keyword " +"arguments for fine-tuning the formatting; consult the module's documentation " +"for details. (Contributed by Greg Ward.)" msgstr "" #: ../../whatsnew/2.3.rst:1512 msgid "" -"The :mod:`!thread` and :mod:`threading` modules now have companion modules, :" -"mod:`!dummy_thread` and :mod:`!dummy_threading`, that provide a do-nothing " -"implementation of the :mod:`!thread` module's interface for platforms where " -"threads are not supported. The intention is to simplify thread-aware " -"modules (ones that *don't* rely on threads to run) by putting the following " -"code at the top::" +"The :mod:`!thread` and :mod:`threading` modules now have companion " +"modules, :mod:`!dummy_thread` and :mod:`!dummy_threading`, that provide a do-" +"nothing implementation of the :mod:`!thread` module's interface for " +"platforms where threads are not supported. The intention is to simplify " +"thread-aware modules (ones that *don't* rely on threads to run) by putting " +"the following code at the top::" msgstr "" #: ../../whatsnew/2.3.rst:1519 @@ -2302,12 +2327,13 @@ msgstr "" #: ../../whatsnew/2.3.rst:1524 msgid "" "In this example, :mod:`!_threading` is used as the module name to make it " -"clear that the module being used is not necessarily the actual :mod:" -"`threading` module. Code can call functions and use classes in :mod:`!" -"_threading` whether or not threads are supported, avoiding an :keyword:`if` " -"statement and making the code slightly clearer. This module will not " -"magically make multithreaded code run without threads; code that waits for " -"another thread to return or to do something will simply hang forever." +"clear that the module being used is not necessarily the " +"actual :mod:`threading` module. Code can call functions and use classes " +"in :mod:`!_threading` whether or not threads are supported, avoiding " +"an :keyword:`if` statement and making the code slightly clearer. This " +"module will not magically make multithreaded code run without threads; code " +"that waits for another thread to return or to do something will simply hang " +"forever." msgstr "" #: ../../whatsnew/2.3.rst:1532 @@ -2361,9 +2387,9 @@ msgid "" "a command, passing it to the correct thread, and waiting for the results. " "Other interfaces can't be handled automatically but :mod:`!Tkinter` will now " "raise an exception on such an access so that you can at least find out about " -"the problem. See https://mail.python.org/pipermail/python-dev/2002-" -"December/031107.html for a more detailed explanation of this change. " -"(Implemented by Martin von Löwis.)" +"the problem. See https://mail.python.org/pipermail/python-dev/2002-December/" +"031107.html for a more detailed explanation of this change. (Implemented by " +"Martin von Löwis.)" msgstr "" #: ../../whatsnew/2.3.rst:1572 @@ -2413,8 +2439,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1598 msgid "" "Adding the mix-in as a superclass provides the full dictionary interface " -"whenever the class defines :meth:`~object.__getitem__`, :meth:`~object." -"__setitem__`, :meth:`~object.__delitem__`, and :meth:`!keys`. For example::" +"whenever the class " +"defines :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__`, " +"and :meth:`!keys`. For example::" msgstr "" #: ../../whatsnew/2.3.rst:1602 @@ -2464,9 +2491,9 @@ msgstr "(由 Raymond Hettinger 所貢獻。)" #: ../../whatsnew/2.3.rst:1641 msgid "" "The DOM implementation in :mod:`xml.dom.minidom` can now generate XML output " -"in a particular encoding by providing an optional encoding argument to the :" -"meth:`~xml.dom.minidom.Node.toxml` and :meth:`~xml.dom.minidom.Node." -"toprettyxml` methods of DOM nodes." +"in a particular encoding by providing an optional encoding argument to " +"the :meth:`~xml.dom.minidom.Node.toxml` " +"and :meth:`~xml.dom.minidom.Node.toprettyxml` methods of DOM nodes." msgstr "" #: ../../whatsnew/2.3.rst:1645 @@ -2523,9 +2550,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1681 msgid "" -"Date and time types suitable for expressing timestamps were added as the :" -"mod:`datetime` module. The types don't support different calendars or many " -"fancy features, and just stick to the basics of representing time." +"Date and time types suitable for expressing timestamps were added as " +"the :mod:`datetime` module. The types don't support different calendars or " +"many fancy features, and just stick to the basics of representing time." msgstr "" #: ../../whatsnew/2.3.rst:1685 @@ -2533,19 +2560,19 @@ msgid "" "The three primary types are: :class:`~datetime.date`, representing a day, " "month, and year; :class:`~datetime.time`, consisting of hour, minute, and " "second; and :class:`~datetime.datetime`, which contains all the attributes " -"of both :class:`~datetime.date` and :class:`~datetime.time`. There's also a :" -"class:`~datetime.timedelta` class representing differences between two " +"of both :class:`~datetime.date` and :class:`~datetime.time`. There's also " +"a :class:`~datetime.timedelta` class representing differences between two " "points in time, and time zone logic is implemented by classes inheriting " "from the abstract :class:`~datetime.tzinfo` class." msgstr "" #: ../../whatsnew/2.3.rst:1692 msgid "" -"You can create instances of :class:`~datetime.date` and :class:`~datetime." -"time` by either supplying keyword arguments to the appropriate constructor, " -"e.g. ``datetime.date(year=1972, month=10, day=15)``, or by using one of a " -"number of class methods. For example, the :meth:`~datetime.date.today` " -"class method returns the current local date." +"You can create instances of :class:`~datetime.date` " +"and :class:`~datetime.time` by either supplying keyword arguments to the " +"appropriate constructor, e.g. ``datetime.date(year=1972, month=10, " +"day=15)``, or by using one of a number of class methods. For example, " +"the :meth:`~datetime.date.today` class method returns the current local date." msgstr "" #: ../../whatsnew/2.3.rst:1698 @@ -2586,12 +2613,12 @@ msgstr "" #: ../../whatsnew/2.3.rst:1720 msgid "" "Instances can be compared, hashed, and converted to strings (the result is " -"the same as that of :meth:`~datetime.datetime.isoformat`). :class:" -"`~datetime.date` and :class:`~datetime.datetime` instances can be subtracted " -"from each other, and added to :class:`~datetime.timedelta` instances. The " -"largest missing feature is that there's no standard library support for " -"parsing strings and getting back a :class:`~datetime.date` or :class:" -"`~datetime.datetime`." +"the same as that " +"of :meth:`~datetime.datetime.isoformat`). :class:`~datetime.date` " +"and :class:`~datetime.datetime` instances can be subtracted from each other, " +"and added to :class:`~datetime.timedelta` instances. The largest missing " +"feature is that there's no standard library support for parsing strings and " +"getting back a :class:`~datetime.date` or :class:`~datetime.datetime`." msgstr "" #: ../../whatsnew/2.3.rst:1727 @@ -2635,8 +2662,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1756 msgid "" -"Parsing a command line is then done by calling the :meth:`~optparse." -"OptionParser.parse_args` method. ::" +"Parsing a command line is then done by calling " +"the :meth:`~optparse.OptionParser.parse_args` method. ::" msgstr "" #: ../../whatsnew/2.3.rst:1758 @@ -2755,22 +2782,23 @@ msgstr "" #: ../../whatsnew/2.3.rst:1842 msgid "" "To allocate and free an undistinguished chunk of memory use the \"raw " -"memory\" family: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, and :c:" -"func:`PyMem_Free`." +"memory\" family: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, " +"and :c:func:`PyMem_Free`." msgstr "" #: ../../whatsnew/2.3.rst:1845 msgid "" "The \"object memory\" family is the interface to the pymalloc facility " "described above and is biased towards a large number of \"small\" " -"allocations: :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, and :c:" -"func:`PyObject_Free`." +"allocations: :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, " +"and :c:func:`PyObject_Free`." msgstr "" #: ../../whatsnew/2.3.rst:1849 msgid "" -"To allocate and free Python objects, use the \"object\" family :c:macro:" -"`PyObject_New`, :c:macro:`PyObject_NewVar`, and :c:func:`PyObject_Del`." +"To allocate and free Python objects, use the \"object\" " +"family :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, " +"and :c:func:`PyObject_Del`." msgstr "" #: ../../whatsnew/2.3.rst:1852 @@ -2778,8 +2806,8 @@ msgid "" "Thanks to lots of work by Tim Peters, pymalloc in 2.3 also provides " "debugging features to catch memory overwrites and doubled frees in both " "extension modules and in the interpreter itself. To enable this support, " -"compile a debugging version of the Python interpreter by running :program:" -"`configure` with :option:`!--with-pydebug`." +"compile a debugging version of the Python interpreter by " +"running :program:`configure` with :option:`!--with-pydebug`." msgstr "" #: ../../whatsnew/2.3.rst:1858 @@ -2804,25 +2832,26 @@ msgstr "" #: ../../whatsnew/2.3.rst:1876 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/2.3.rst:1878 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/2.3.rst:1880 msgid "" "The cycle detection implementation used by the garbage collection has proven " "to be stable, so it's now been made mandatory. You can no longer compile " -"Python without it, and the :option:`!--with-cycle-gc` switch to :program:" -"`configure` has been removed." +"Python without it, and the :option:`!--with-cycle-gc` switch " +"to :program:`configure` has been removed." msgstr "" #: ../../whatsnew/2.3.rst:1885 msgid "" -"Python can now optionally be built as a shared library (:file:`libpython2.3." -"so`) by supplying :option:`!--enable-shared` when running Python's :program:" -"`configure` script. (Contributed by Ondrej Palkovsky.)" +"Python can now optionally be built as a shared library " +"(:file:`libpython2.3.so`) by supplying :option:`!--enable-shared` when " +"running Python's :program:`configure` script. (Contributed by Ondrej " +"Palkovsky.)" msgstr "" #: ../../whatsnew/2.3.rst:1889 @@ -2837,8 +2866,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1894 msgid "" "The interpreter can be compiled without any docstrings for the built-in " -"functions and modules by supplying :option:`!--without-doc-strings` to the :" -"program:`configure` script. This makes the Python executable about 10% " +"functions and modules by supplying :option:`!--without-doc-strings` to " +"the :program:`configure` script. This makes the Python executable about 10% " "smaller, but will also mean that you can't get help for Python's built-ins. " "(Contributed by Gustavo Niemeyer.)" msgstr "" @@ -2857,9 +2886,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1907 msgid "" ":c:func:`PyArg_ParseTuple` accepts new format characters for various sizes " -"of unsigned integers: ``B`` for :c:expr:`unsigned char`, ``H`` for :c:expr:" -"`unsigned short int`, ``I`` for :c:expr:`unsigned int`, and ``K`` for :c:" -"expr:`unsigned long long`." +"of unsigned integers: ``B`` for :c:expr:`unsigned char`, ``H`` " +"for :c:expr:`unsigned short int`, ``I`` for :c:expr:`unsigned int`, and " +"``K`` for :c:expr:`unsigned long long`." msgstr "" #: ../../whatsnew/2.3.rst:1912 @@ -2871,9 +2900,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1915 msgid "" "File objects now manage their internal string buffer differently, increasing " -"it exponentially when needed. This results in the benchmark tests in :file:" -"`Lib/test/test_bufio.py` speeding up considerably (from 57 seconds to 1.7 " -"seconds, according to one measurement)." +"it exponentially when needed. This results in the benchmark tests " +"in :file:`Lib/test/test_bufio.py` speeding up considerably (from 57 seconds " +"to 1.7 seconds, according to one measurement)." msgstr "" #: ../../whatsnew/2.3.rst:1920 @@ -2892,12 +2921,12 @@ msgstr "" #: ../../whatsnew/2.3.rst:1927 msgid "" "If you dynamically allocate type objects in your extension, you should be " -"aware of a change in the rules relating to the :attr:`~type.__module__` and :" -"attr:`~type.__name__` attributes. In summary, you will want to ensure the " -"type's dictionary contains a ``'__module__'`` key; making the module name " -"the part of the type name leading up to the final period will no longer have " -"the desired effect. For more detail, read the API reference documentation " -"or the source." +"aware of a change in the rules relating to the :attr:`~type.__module__` " +"and :attr:`~type.__name__` attributes. In summary, you will want to ensure " +"the type's dictionary contains a ``'__module__'`` key; making the module " +"name the part of the type name leading up to the final period will no longer " +"have the desired effect. For more detail, read the API reference " +"documentation or the source." msgstr "" #: ../../whatsnew/2.3.rst:1938 @@ -2909,11 +2938,11 @@ msgid "" "Support for a port to IBM's OS/2 using the EMX runtime environment was " "merged into the main Python source tree. EMX is a POSIX emulation layer " "over the OS/2 system APIs. The Python port for EMX tries to support all the " -"POSIX-like capability exposed by the EMX runtime, and mostly succeeds; :func:" -"`!fork` and :func:`fcntl` are restricted by the limitations of the " -"underlying emulation layer. The standard OS/2 port, which uses IBM's Visual " -"Age compiler, also gained support for case-sensitive import semantics as " -"part of the integration of the EMX port into CVS. (Contributed by Andrew " +"POSIX-like capability exposed by the EMX runtime, and mostly " +"succeeds; :func:`!fork` and :func:`fcntl` are restricted by the limitations " +"of the underlying emulation layer. The standard OS/2 port, which uses IBM's " +"Visual Age compiler, also gained support for case-sensitive import semantics " +"as part of the integration of the EMX port into CVS. (Contributed by Andrew " "MacIntyre.)" msgstr "" @@ -2934,8 +2963,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1957 msgid "" -"Other new platforms now supported by Python include AtheOS (http://www." -"atheos.cx/), GNU/Hurd, and OpenVMS." +"Other new platforms now supported by Python include AtheOS (http://" +"www.atheos.cx/), GNU/Hurd, and OpenVMS." msgstr "" #: ../../whatsnew/2.3.rst:1966 @@ -3005,10 +3034,11 @@ msgstr "" #: ../../whatsnew/2.3.rst:2006 msgid "" -"A nifty new feature is that trace functions can now assign to the :attr:" -"`~frame.f_lineno` attribute of frame objects, changing the line that will be " -"executed next. A ``jump`` command has been added to the :mod:`pdb` debugger " -"taking advantage of this new feature. (Implemented by Richie Hindle.)" +"A nifty new feature is that trace functions can now assign to " +"the :attr:`~frame.f_lineno` attribute of frame objects, changing the line " +"that will be executed next. A ``jump`` command has been added to " +"the :mod:`pdb` debugger taking advantage of this new feature. (Implemented " +"by Richie Hindle.)" msgstr "" #: ../../whatsnew/2.3.rst:2015 @@ -3057,9 +3087,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:2039 msgid "" -"Large octal and hex literals such as ``0xffffffff`` now trigger a :exc:" -"`FutureWarning`. Currently they're stored as 32-bit numbers and result in a " -"negative value, but in Python 2.4 they'll become positive long integers." +"Large octal and hex literals such as ``0xffffffff`` now trigger " +"a :exc:`FutureWarning`. Currently they're stored as 32-bit numbers and " +"result in a negative value, but in Python 2.4 they'll become positive long " +"integers." msgstr "" #: ../../whatsnew/2.3.rst:2043 diff --git a/whatsnew/2.4.po b/whatsnew/2.4.po index 7c50822863..0d58bc66af 100644 --- a/whatsnew/2.4.po +++ b/whatsnew/2.4.po @@ -136,10 +136,11 @@ msgstr "" msgid "" "The lengthy transition process for this PEP, begun in Python 2.2, takes " "another step forward in Python 2.4. In 2.3, certain integer operations that " -"would behave differently after int/long unification triggered :exc:" -"`FutureWarning` warnings and returned values limited to 32 or 64 bits " -"(depending on your platform). In 2.4, these expressions no longer produce a " -"warning and instead produce a different result that's usually a long integer." +"would behave differently after int/long unification " +"triggered :exc:`FutureWarning` warnings and returned values limited to 32 or " +"64 bits (depending on your platform). In 2.4, these expressions no longer " +"produce a warning and instead produce a different result that's usually a " +"long integer." msgstr "" #: ../../whatsnew/2.4.rst:99 @@ -182,6 +183,9 @@ msgid "" "for link in links:\n" " ..." msgstr "" +"links = [link for link in get_all_links() if not link.followed]\n" +"for link in links:\n" +" ..." #: ../../whatsnew/2.4.rst:129 msgid "instead of ::" @@ -194,6 +198,10 @@ msgid "" " continue\n" " ..." msgstr "" +"for link in get_all_links():\n" +" if link.followed:\n" +" continue\n" +" ..." #: ../../whatsnew/2.4.rst:136 msgid "" @@ -215,6 +223,9 @@ msgid "" "for link in links:\n" " ..." msgstr "" +"links = (link for link in get_all_links() if not link.followed)\n" +"for link in links:\n" +" ..." #: ../../whatsnew/2.4.rst:148 msgid "" @@ -268,6 +279,8 @@ msgid "" ">>> '%(page)i: %(title)s' % {'page':2, 'title': 'The Best of Times'}\n" "'2: The Best of Times'" msgstr "" +">>> '%(page)i: %(title)s' % {'page':2, 'title': 'The Best of Times'}\n" +"'2: The Best of Times'" #: ../../whatsnew/2.4.rst:183 msgid "" @@ -295,6 +308,10 @@ msgid "" ">>> t.substitute({'page':2, 'title': 'The Best of Times'})\n" "'2: The Best of Times'" msgstr "" +">>> import string\n" +">>> t = string.Template('$page: $title')\n" +">>> t.substitute({'page':2, 'title': 'The Best of Times'})\n" +"'2: The Best of Times'" #: ../../whatsnew/2.4.rst:200 msgid "" @@ -309,6 +326,9 @@ msgid "" ">>> t.safe_substitute({'page':3})\n" "'3: $title'" msgstr "" +">>> t = string.Template('$page: $title')\n" +">>> t.safe_substitute({'page':3})\n" +"'3: $title'" #: ../../whatsnew/2.4.rst:211 msgid ":pep:`292` - Simpler String Substitutions" @@ -326,10 +346,10 @@ msgstr "" msgid "" "Python 2.2 extended Python's object model by adding static methods and class " "methods, but it didn't extend Python's syntax to provide any new way of " -"defining static or class methods. Instead, you had to write a :keyword:" -"`def` statement in the usual way, and pass the resulting method to a :func:" -"`staticmethod` or :func:`classmethod` function that would wrap up the " -"function as a method of the new type. Your code would look like this::" +"defining static or class methods. Instead, you had to write " +"a :keyword:`def` statement in the usual way, and pass the resulting method " +"to a :func:`staticmethod` or :func:`classmethod` function that would wrap up " +"the function as a method of the new type. Your code would look like this::" msgstr "" #: ../../whatsnew/2.4.rst:227 @@ -343,8 +363,8 @@ msgstr "" #: ../../whatsnew/2.4.rst:233 msgid "" -"If the method was very long, it would be easy to miss or forget the :func:" -"`classmethod` invocation after the function body." +"If the method was very long, it would be easy to miss or forget " +"the :func:`classmethod` invocation after the function body." msgstr "" #: ../../whatsnew/2.4.rst:236 @@ -378,6 +398,11 @@ msgid "" " def meth (cls):\n" " ..." msgstr "" +"class C:\n" +"\n" +" @classmethod\n" +" def meth (cls):\n" +" ..." #: ../../whatsnew/2.4.rst:256 msgid "" @@ -393,6 +418,11 @@ msgid "" "def f ():\n" " ..." msgstr "" +"@A\n" +"@B\n" +"@C\n" +"def f ():\n" +" ..." #: ../../whatsnew/2.4.rst:265 msgid "It's equivalent to the following pre-decorator code::" @@ -403,6 +433,8 @@ msgid "" "def f(): ...\n" "f = A(B(C(f)))" msgstr "" +"def f(): ...\n" +"f = A(B(C(f)))" #: ../../whatsnew/2.4.rst:270 msgid "" @@ -438,6 +470,18 @@ msgid "" "'decorated'\n" ">>>" msgstr "" +">>> def deco(func):\n" +"... func.attr = 'decorated'\n" +"... return func\n" +"...\n" +">>> @deco\n" +"... def f(): pass\n" +"...\n" +">>> f\n" +"<function f at 0x402ef0d4>\n" +">>> f.attr\n" +"'decorated'\n" +">>>" #: ../../whatsnew/2.4.rst:295 msgid "" @@ -462,6 +506,20 @@ msgid "" "def p2(arg):\n" " print arg*2" msgstr "" +"def require_int (func):\n" +" def wrapper (arg):\n" +" assert isinstance(arg, int)\n" +" return func(arg)\n" +"\n" +" return wrapper\n" +"\n" +"@require_int\n" +"def p1 (arg):\n" +" print arg\n" +"\n" +"@require_int\n" +"def p2(arg):\n" +" print arg*2" #: ../../whatsnew/2.4.rst:313 msgid "" @@ -484,6 +542,9 @@ msgid "" "_deco = C(args)\n" "f = A(B(_deco(f)))" msgstr "" +"def f(): ...\n" +"_deco = C(args)\n" +"f = A(B(_deco(f)))" #: ../../whatsnew/2.4.rst:325 msgid "" @@ -536,6 +597,12 @@ msgid "" "2\n" "1" msgstr "" +">>> for i in reversed(xrange(1,4)):\n" +"... print i\n" +"...\n" +"3\n" +"2\n" +"1" #: ../../whatsnew/2.4.rst:360 msgid "" @@ -546,8 +613,8 @@ msgstr "" #: ../../whatsnew/2.4.rst:363 msgid "" "Note that :func:`reversed` only accepts sequences, not arbitrary iterators. " -"If you want to reverse an iterator, first convert it to a list with :func:" -"`list`. ::" +"If you want to reverse an iterator, first convert it to a list " +"with :func:`list`. ::" msgstr "" #: ../../whatsnew/2.4.rst:367 @@ -581,13 +648,14 @@ msgstr "" #: ../../whatsnew/2.4.rst:386 msgid "" "The standard library provides a number of ways to execute a subprocess, " -"offering different features and different levels of complexity. ``os." -"system(command)`` is easy to use, but slow (it runs a shell process which " -"executes the command) and dangerous (you have to be careful about escaping " -"the shell's metacharacters). The :mod:`!popen2` module offers classes that " -"can capture standard output and standard error from the subprocess, but the " -"naming is confusing. The :mod:`subprocess` module cleans this up, " -"providing a unified interface that offers all the features you might need." +"offering different features and different levels of complexity. " +"``os.system(command)`` is easy to use, but slow (it runs a shell process " +"which executes the command) and dangerous (you have to be careful about " +"escaping the shell's metacharacters). The :mod:`!popen2` module offers " +"classes that can capture standard output and standard error from the " +"subprocess, but the naming is confusing. The :mod:`subprocess` module " +"cleans this up, providing a unified interface that offers all the features " +"you might need." msgstr "" #: ../../whatsnew/2.4.rst:395 @@ -605,6 +673,11 @@ msgid "" " cwd=None, env=None, universal_newlines=False,\n" " startupinfo=None, creationflags=0):" msgstr "" +"class Popen(args, bufsize=0, executable=None,\n" +" stdin=None, stdout=None, stderr=None,\n" +" preexec_fn=None, close_fds=False, shell=False,\n" +" cwd=None, env=None, universal_newlines=False,\n" +" startupinfo=None, creationflags=0):" #: ../../whatsnew/2.4.rst:405 msgid "" @@ -649,26 +722,27 @@ msgstr "" #: ../../whatsnew/2.4.rst:430 msgid "" -"*universal_newlines* opens the child's input and output using Python's :term:" -"`universal newlines` feature." +"*universal_newlines* opens the child's input and output using " +"Python's :term:`universal newlines` feature." msgstr "" #: ../../whatsnew/2.4.rst:433 msgid "" -"Once you've created the :class:`Popen` instance, you can call its :meth:" -"`wait` method to pause until the subprocess has exited, :meth:`poll` to " -"check if it's exited without pausing, or ``communicate(data)`` to send the " -"string *data* to the subprocess's standard input. ``communicate(data)`` " -"then reads any data that the subprocess has sent to its standard output or " -"standard error, returning a tuple ``(stdout_data, stderr_data)``." +"Once you've created the :class:`Popen` instance, you can call " +"its :meth:`wait` method to pause until the subprocess has " +"exited, :meth:`poll` to check if it's exited without pausing, or " +"``communicate(data)`` to send the string *data* to the subprocess's standard " +"input. ``communicate(data)`` then reads any data that the subprocess has " +"sent to its standard output or standard error, returning a tuple " +"``(stdout_data, stderr_data)``." msgstr "" #: ../../whatsnew/2.4.rst:440 msgid "" -":func:`call` is a shortcut that passes its arguments along to the :class:" -"`Popen` constructor, waits for the command to complete, and returns the " -"status code of the subprocess. It can serve as a safer analog to :func:`os." -"system`::" +":func:`call` is a shortcut that passes its arguments along to " +"the :class:`Popen` constructor, waits for the command to complete, and " +"returns the status code of the subprocess. It can serve as a safer analog " +"to :func:`os.system`::" msgstr "" #: ../../whatsnew/2.4.rst:444 @@ -681,6 +755,13 @@ msgid "" " # dpkg returned an error\n" " ..." msgstr "" +"sts = subprocess.call(['dpkg', '-i', '/tmp/new-package.deb'])\n" +"if sts == 0:\n" +" # 成功\n" +" ...\n" +"else:\n" +" # dpkg 回傳一個錯誤\n" +" ..." #: ../../whatsnew/2.4.rst:452 msgid "" @@ -784,6 +865,8 @@ msgid "" ">>> 1.1\n" "1.1000000000000001" msgstr "" +">>> 1.1\n" +"1.1000000000000001" #: ../../whatsnew/2.4.rst:521 msgid "" @@ -816,10 +899,10 @@ msgstr ":class:`Decimal` 型別" #: ../../whatsnew/2.4.rst:540 msgid "" "A new module, :mod:`decimal`, was added to Python's standard library. It " -"contains two classes, :class:`Decimal` and :class:`Context`. :class:" -"`Decimal` instances represent numbers, and :class:`Context` instances are " -"used to wrap up various settings such as the precision and default rounding " -"mode." +"contains two classes, :class:`Decimal` " +"and :class:`Context`. :class:`Decimal` instances represent numbers, " +"and :class:`Context` instances are used to wrap up various settings such as " +"the precision and default rounding mode." msgstr "" #: ../../whatsnew/2.4.rst:545 @@ -838,6 +921,11 @@ msgid "" ">>> decimal.Decimal(\"1.1\")\n" "Decimal(\"1.1\")" msgstr "" +">>> import decimal\n" +">>> decimal.Decimal(1972)\n" +"Decimal(\"1972\")\n" +">>> decimal.Decimal(\"1.1\")\n" +"Decimal(\"1.1\")" #: ../../whatsnew/2.4.rst:556 msgid "" @@ -850,6 +938,8 @@ msgid "" ">>> decimal.Decimal((1, (1, 4, 7, 5), -2))\n" "Decimal(\"-14.75\")" msgstr "" +">>> decimal.Decimal((1, (1, 4, 7, 5), -2))\n" +"Decimal(\"-14.75\")" #: ../../whatsnew/2.4.rst:562 msgid "" @@ -875,6 +965,11 @@ msgid "" ">>> decimal.Decimal('%.12f' % f)\n" "Decimal(\"1.100000000000\")" msgstr "" +">>> f = 1.1\n" +">>> decimal.Decimal(str(f))\n" +"Decimal(\"1.1\")\n" +">>> decimal.Decimal('%.12f' % f)\n" +"Decimal(\"1.100000000000\")" #: ../../whatsnew/2.4.rst:578 msgid "" @@ -902,6 +997,22 @@ msgid "" " ...\n" "decimal.InvalidOperation: x ** (non-integer)" msgstr "" +">>> a = decimal.Decimal('35.72')\n" +">>> b = decimal.Decimal('1.73')\n" +">>> a+b\n" +"Decimal(\"37.45\")\n" +">>> a-b\n" +"Decimal(\"33.99\")\n" +">>> a*b\n" +"Decimal(\"61.7956\")\n" +">>> a/b\n" +"Decimal(\"20.64739884393063583815028902\")\n" +">>> a ** 2\n" +"Decimal(\"1275.9184\")\n" +">>> a**b\n" +"Traceback (most recent call last):\n" +" ...\n" +"decimal.InvalidOperation: x ** (non-integer)" #: ../../whatsnew/2.4.rst:599 msgid "" @@ -920,6 +1031,14 @@ msgid "" "types.\n" ">>>" msgstr "" +">>> a + 4\n" +"Decimal(\"39.72\")\n" +">>> a + 4.5\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: You can interact Decimal only with int, long or Decimal data " +"types.\n" +">>>" #: ../../whatsnew/2.4.rst:610 msgid "" @@ -939,12 +1058,18 @@ msgid "" ">>> cmath.sqrt(-d)\n" "351364.18288201344j" msgstr "" +">>> import math, cmath\n" +">>> d = decimal.Decimal('123456789012.345')\n" +">>> math.sqrt(d)\n" +"351364.18288201344\n" +">>> cmath.sqrt(-d)\n" +"351364.18288201344j" #: ../../whatsnew/2.4.rst:623 msgid "" -":class:`Decimal` instances have a :meth:`sqrt` method that returns a :class:" -"`Decimal`, but if you need other things such as trigonometric functions " -"you'll have to implement them. ::" +":class:`Decimal` instances have a :meth:`sqrt` method that returns " +"a :class:`Decimal`, but if you need other things such as trigonometric " +"functions you'll have to implement them. ::" msgstr "" #: ../../whatsnew/2.4.rst:627 @@ -952,6 +1077,8 @@ msgid "" ">>> d.sqrt()\n" "Decimal(\"351364.1828820134592177245001\")" msgstr "" +">>> d.sqrt()\n" +"Decimal(\"351364.1828820134592177245001\")" #: ../../whatsnew/2.4.rst:632 msgid "The :class:`Context` type" @@ -970,8 +1097,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:639 msgid "" ":attr:`rounding` specifies the rounding mode. The :mod:`decimal` module has " -"constants for the various possibilities: :const:`ROUND_DOWN`, :const:" -"`ROUND_CEILING`, :const:`ROUND_HALF_EVEN`, and various others." +"constants for the various " +"possibilities: :const:`ROUND_DOWN`, :const:`ROUND_CEILING`, :const:`ROUND_HALF_EVEN`, " +"and various others." msgstr "" #: ../../whatsnew/2.4.rst:643 @@ -984,10 +1112,10 @@ msgstr "" #: ../../whatsnew/2.4.rst:648 msgid "" -"There's a thread-local default context available by calling :func:" -"`getcontext`; you can change the properties of this context to alter the " -"default precision, rounding, or trap handling. The following example shows " -"the effect of changing the precision of the default context::" +"There's a thread-local default context available by " +"calling :func:`getcontext`; you can change the properties of this context to " +"alter the default precision, rounding, or trap handling. The following " +"example shows the effect of changing the precision of the default context::" msgstr "" #: ../../whatsnew/2.4.rst:653 @@ -1000,6 +1128,13 @@ msgid "" ">>> decimal.Decimal(1) / decimal.Decimal(7)\n" "Decimal(\"0.142857143\")" msgstr "" +">>> decimal.getcontext().prec\n" +"28\n" +">>> decimal.Decimal(1) / decimal.Decimal(7)\n" +"Decimal(\"0.1428571428571428571428571429\")\n" +">>> decimal.getcontext().prec = 9\n" +">>> decimal.Decimal(1) / decimal.Decimal(7)\n" +"Decimal(\"0.142857143\")" #: ../../whatsnew/2.4.rst:661 msgid "" @@ -1019,6 +1154,14 @@ msgid "" "Decimal(\"Infinity\")\n" ">>>" msgstr "" +">>> decimal.Decimal(1) / decimal.Decimal(0)\n" +"Traceback (most recent call last):\n" +" ...\n" +"decimal.DivisionByZero: x / 0\n" +">>> decimal.getcontext().traps[decimal.DivisionByZero] = False\n" +">>> decimal.Decimal(1) / decimal.Decimal(0)\n" +"Decimal(\"Infinity\")\n" +">>>" #: ../../whatsnew/2.4.rst:674 msgid "" @@ -1088,6 +1231,10 @@ msgid "" " CGIXMLRPCRequestHandler,\\\n" " resolve_dotted_attribute" msgstr "" +"from SimpleXMLRPCServer import SimpleXMLRPCServer,\\\n" +" SimpleXMLRPCRequestHandler,\\\n" +" CGIXMLRPCRequestHandler,\\\n" +" resolve_dotted_attribute" #: ../../whatsnew/2.4.rst:713 msgid "" @@ -1103,6 +1250,10 @@ msgid "" " CGIXMLRPCRequestHandler,\n" " resolve_dotted_attribute)" msgstr "" +"from SimpleXMLRPCServer import (SimpleXMLRPCServer,\n" +" SimpleXMLRPCRequestHandler,\n" +" CGIXMLRPCRequestHandler,\n" +" resolve_dotted_attribute)" #: ../../whatsnew/2.4.rst:722 msgid "" @@ -1156,8 +1307,8 @@ msgstr "" #: ../../whatsnew/2.4.rst:756 msgid "" -"``PyOS_ascii_formatd(buffer, buf_len, format, d)`` converts a :c:expr:" -"`double` to an ASCII string." +"``PyOS_ascii_formatd(buffer, buf_len, format, d)`` converts " +"a :c:expr:`double` to an ASCII string." msgstr "" #: ../../whatsnew/2.4.rst:759 @@ -1165,9 +1316,9 @@ msgid "" "The code for these functions came from the GLib library (`https://developer-" "old.gnome.org/glib/2.26/ <http://web.archive.org/web/20210306104320/https://" "developer.gnome.org/glib/2.26/>`__), whose developers kindly relicensed the " -"relevant functions and donated them to the Python Software Foundation. The :" -"mod:`locale` module can now change the numeric locale, letting extensions " -"such as GTK+ produce the correct results." +"relevant functions and donated them to the Python Software Foundation. " +"The :mod:`locale` module can now change the numeric locale, letting " +"extensions such as GTK+ produce the correct results." msgstr "" #: ../../whatsnew/2.4.rst:768 @@ -1216,9 +1367,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:792 msgid "" -"The :meth:`dict.update` method now accepts the same argument forms as the :" -"class:`dict` constructor. This includes any mapping, any iterable of key/" -"value pairs, and keyword arguments. (Contributed by Raymond Hettinger.)" +"The :meth:`dict.update` method now accepts the same argument forms as " +"the :class:`dict` constructor. This includes any mapping, any iterable of " +"key/value pairs, and keyword arguments. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:796 @@ -1230,9 +1381,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:800 msgid "" -"Strings also gained an :meth:`rsplit` method that works like the :meth:" -"`split` method but splits from the end of the string. (Contributed by Sean " -"Reifschneider.) ::" +"Strings also gained an :meth:`rsplit` method that works like " +"the :meth:`split` method but splits from the end of the string. " +"(Contributed by Sean Reifschneider.) ::" msgstr "" #: ../../whatsnew/2.4.rst:804 @@ -1242,12 +1393,16 @@ msgid "" "'www.python.org'.rsplit('.', 1)\n" "['www.python', 'org']" msgstr "" +">>> 'www.python.org'.split('.', 1)\n" +"['www', 'python.org']\n" +"'www.python.org'.rsplit('.', 1)\n" +"['www.python', 'org']" #: ../../whatsnew/2.4.rst:809 msgid "" -"Three keyword parameters, *cmp*, *key*, and *reverse*, were added to the :" -"meth:`sort` method of lists. These parameters make some common usages of :" -"meth:`sort` simpler. All of these parameters are optional." +"Three keyword parameters, *cmp*, *key*, and *reverse*, were added to " +"the :meth:`sort` method of lists. These parameters make some common usages " +"of :meth:`sort` simpler. All of these parameters are optional." msgstr "" #: ../../whatsnew/2.4.rst:813 @@ -1255,8 +1410,8 @@ msgid "" "For the *cmp* parameter, the value should be a comparison function that " "takes two parameters and returns -1, 0, or +1 depending on how the " "parameters compare. This function will then be used to sort the list. " -"Previously this was the only parameter that could be provided to :meth:" -"`sort`." +"Previously this was the only parameter that could be provided " +"to :meth:`sort`." msgstr "" #: ../../whatsnew/2.4.rst:818 @@ -1308,8 +1463,8 @@ msgstr "" #: ../../whatsnew/2.4.rst:849 msgid "" "Finally, the *reverse* parameter takes a Boolean value. If the value is " -"true, the list will be sorted into reverse order. Instead of ``L.sort(); L." -"reverse()``, you can now write ``L.sort(reverse=True)``." +"true, the list will be sorted into reverse order. Instead of ``L.sort(); " +"L.reverse()``, you can now write ``L.sort(reverse=True)``." msgstr "" #: ../../whatsnew/2.4.rst:853 @@ -1373,8 +1528,8 @@ msgstr "(由 Raymond Hettinger 所貢獻。)" #: ../../whatsnew/2.4.rst:894 ../../whatsnew/2.4.rst:1520 msgid "" -"Integer operations will no longer trigger an :exc:`OverflowWarning`. The :" -"exc:`OverflowWarning` warning will disappear in Python 2.5." +"Integer operations will no longer trigger an :exc:`OverflowWarning`. " +"The :exc:`OverflowWarning` warning will disappear in Python 2.5." msgstr "" #: ../../whatsnew/2.4.rst:897 @@ -1396,9 +1551,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:907 msgid "" "The :func:`zip` built-in function and :func:`itertools.izip` now return an " -"empty list if called with no arguments. Previously they raised a :exc:" -"`TypeError` exception. This makes them more suitable for use with variable " -"length argument lists::" +"empty list if called with no arguments. Previously they raised " +"a :exc:`TypeError` exception. This makes them more suitable for use with " +"variable length argument lists::" msgstr "" #: ../../whatsnew/2.4.rst:912 @@ -1434,36 +1589,38 @@ msgstr "最佳化" msgid "" "The inner loops for list and tuple slicing were optimized and now run about " "one-third faster. The inner loops for dictionaries were also optimized, " -"resulting in performance boosts for :meth:`keys`, :meth:`values`, :meth:" -"`items`, :meth:`iterkeys`, :meth:`itervalues`, and :meth:`iteritems`. " -"(Contributed by Raymond Hettinger.)" +"resulting in performance boosts " +"for :meth:`keys`, :meth:`values`, :meth:`items`, :meth:`iterkeys`, :meth:`itervalues`, " +"and :meth:`iteritems`. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:942 msgid "" "The machinery for growing and shrinking lists was optimized for speed and " "for space efficiency. Appending and popping from lists now runs faster due " -"to more efficient code paths and less frequent use of the underlying system :" -"c:func:`realloc`. List comprehensions also benefit. :meth:`list.extend` " -"was also optimized and no longer converts its argument into a temporary list " -"before extending the base list. (Contributed by Raymond Hettinger.)" +"to more efficient code paths and less frequent use of the underlying " +"system :c:func:`realloc`. List comprehensions also " +"benefit. :meth:`list.extend` was also optimized and no longer converts its " +"argument into a temporary list before extending the base list. (Contributed " +"by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:949 msgid "" ":func:`list`, :func:`tuple`, :func:`map`, :func:`filter`, and :func:`zip` " -"now run several times faster with non-sequence arguments that supply a :meth:" -"`__len__` method. (Contributed by Raymond Hettinger.)" +"now run several times faster with non-sequence arguments that supply " +"a :meth:`__len__` method. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:953 msgid "" -"The methods :meth:`list.__getitem__`, :meth:`dict.__getitem__`, and :meth:" -"`dict.__contains__` are now implemented as :class:`method_descriptor` " -"objects rather than :class:`wrapper_descriptor` objects. This form of " -"access doubles their performance and makes them more suitable for use as " -"arguments to functionals: ``map(mydict.__getitem__, keylist)``. (Contributed " -"by Raymond Hettinger.)" +"The methods :meth:`list.__getitem__`, :meth:`dict.__getitem__`, " +"and :meth:`dict.__contains__` are now implemented " +"as :class:`method_descriptor` objects rather " +"than :class:`wrapper_descriptor` objects. This form of access doubles " +"their performance and makes them more suitable for use as arguments to " +"functionals: ``map(mydict.__getitem__, keylist)``. (Contributed by Raymond " +"Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:960 @@ -1612,18 +1769,18 @@ msgstr "" msgid "" "The :mod:`ConfigParser <configparser>` classes have been enhanced slightly. " "The :meth:`~configparser.ConfigParser.read` method now returns a list of the " -"files that were successfully parsed, and the :meth:`~configparser." -"ConfigParser.set` method raises :exc:`TypeError` if passed a *value* " -"argument that isn't a string. (Contributed by John Belmonte and David " -"Goodger.)" +"files that were successfully parsed, and " +"the :meth:`~configparser.ConfigParser.set` method raises :exc:`TypeError` if " +"passed a *value* argument that isn't a string. (Contributed by John " +"Belmonte and David Goodger.)" msgstr "" #: ../../whatsnew/2.4.rst:1060 msgid "" -"The :mod:`curses` module now supports the ncurses extension :func:" -"`use_default_colors`. On platforms where the terminal supports " -"transparency, this makes it possible to use a transparent background. " -"(Contributed by Jörg Lehmann.)" +"The :mod:`curses` module now supports the ncurses " +"extension :func:`use_default_colors`. On platforms where the terminal " +"supports transparency, this makes it possible to use a transparent " +"background. (Contributed by Jörg Lehmann.)" msgstr "" #: ../../whatsnew/2.4.rst:1065 @@ -1649,19 +1806,19 @@ msgstr "" msgid "" "The :mod:`heapq` module has been converted to C. The resulting tenfold " "improvement in speed makes the module suitable for handling high volumes of " -"data. In addition, the module has two new functions :func:`nlargest` and :" -"func:`nsmallest` that use heaps to find the N largest or smallest values in " -"a dataset without the expense of a full sort. (Contributed by Raymond " -"Hettinger.)" +"data. In addition, the module has two new functions :func:`nlargest` " +"and :func:`nsmallest` that use heaps to find the N largest or smallest " +"values in a dataset without the expense of a full sort. (Contributed by " +"Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:1084 msgid "" "The :mod:`httplib <http>` module now contains constants for HTTP status " "codes defined in various HTTP-related RFC documents. Constants have names " -"such as :const:`OK`, :const:`CREATED`, :const:`CONTINUE`, and :const:" -"`MOVED_PERMANENTLY`; use pydoc to get a full list. (Contributed by Andrew " -"Eland.)" +"such as :const:`OK`, :const:`CREATED`, :const:`CONTINUE`, " +"and :const:`MOVED_PERMANENTLY`; use pydoc to get a full list. (Contributed " +"by Andrew Eland.)" msgstr "" #: ../../whatsnew/2.4.rst:1090 @@ -1703,12 +1860,23 @@ msgid "" "0 [12, 14]\n" ">>>" msgstr "" +">>> import itertools\n" +">>> L = [2, 4, 6, 7, 8, 9, 11, 12, 14]\n" +">>> for key_val, it in itertools.groupby(L, lambda x: x % 2):\n" +"... print key_val, list(it)\n" +"...\n" +"0 [2, 4, 6]\n" +"1 [7]\n" +"0 [8]\n" +"1 [9, 11]\n" +"0 [12, 14]\n" +">>>" #: ../../whatsnew/2.4.rst:1118 msgid "" -":func:`groupby` is typically used with sorted input. The logic for :func:" -"`groupby` is similar to the Unix ``uniq`` filter which makes it handy for " -"eliminating, counting, or identifying duplicate elements::" +":func:`groupby` is typically used with sorted input. The logic " +"for :func:`groupby` is similar to the Unix ``uniq`` filter which makes it " +"handy for eliminating, counting, or identifying duplicate elements::" msgstr "" #: ../../whatsnew/2.4.rst:1122 @@ -1771,19 +1939,19 @@ msgstr "" #: ../../whatsnew/2.4.rst:1165 msgid "" -"A number of functions were added to the :mod:`locale` module, such as :func:" -"`bind_textdomain_codeset` to specify a particular encoding and a family of :" -"func:`!l\\*gettext` functions that return messages in the chosen encoding. " -"(Contributed by Gustavo Niemeyer.)" +"A number of functions were added to the :mod:`locale` module, such " +"as :func:`bind_textdomain_codeset` to specify a particular encoding and a " +"family of :func:`!l\\*gettext` functions that return messages in the chosen " +"encoding. (Contributed by Gustavo Niemeyer.)" msgstr "" #: ../../whatsnew/2.4.rst:1170 msgid "" -"Some keyword arguments were added to the :mod:`logging` package's :func:" -"`basicConfig` function to simplify log configuration. The default behavior " -"is to log messages to standard error, but various keyword arguments can be " -"specified to log to a particular file, change the logging format, or set the " -"logging level. For example::" +"Some keyword arguments were added to the :mod:`logging` " +"package's :func:`basicConfig` function to simplify log configuration. The " +"default behavior is to log messages to standard error, but various keyword " +"arguments can be specified to log to a particular file, change the logging " +"format, or set the logging level. For example::" msgstr "" #: ../../whatsnew/2.4.rst:1176 @@ -1798,15 +1966,15 @@ msgstr "" msgid "" "Other additions to the :mod:`logging` package include a ``log(level, msg)`` " "convenience method, as well as a :class:`TimedRotatingFileHandler` class " -"that rotates its log files at a timed interval. The module already had :" -"class:`RotatingFileHandler`, which rotated logs once the file exceeded a " -"certain size. Both classes derive from a new :class:`BaseRotatingHandler` " +"that rotates its log files at a timed interval. The module already " +"had :class:`RotatingFileHandler`, which rotated logs once the file exceeded " +"a certain size. Both classes derive from a new :class:`BaseRotatingHandler` " "class that can be used to implement other rotating handlers." msgstr "" #: ../../whatsnew/2.4.rst:1188 msgid "(Changes implemented by Vinay Sajip.)" -msgstr "" +msgstr "(由 Vinay Sajip 所實作。)" #: ../../whatsnew/2.4.rst:1190 msgid "" @@ -1828,8 +1996,8 @@ msgid "" "Two new functions were added to the :mod:`operator` module, " "``attrgetter(attr)`` and ``itemgetter(index)``. Both functions return " "callables that take a single argument and return the corresponding attribute " -"or item; these callables make excellent data extractors when used with :func:" -"`map` or :func:`sorted`. For example::" +"or item; these callables make excellent data extractors when used " +"with :func:`map` or :func:`sorted`. For example::" msgstr "" #: ../../whatsnew/2.4.rst:1205 @@ -1855,11 +2023,11 @@ msgstr "" #: ../../whatsnew/2.4.rst:1221 msgid "" "The long-term plan is to deprecate the :mod:`!rfc822` module in some future " -"Python release in favor of the :mod:`email` package. To this end, the :func:" -"`email.Utils.formatdate <email.utils.formatdate>` function has been changed " -"to make it usable as a replacement for :func:`!rfc822.formatdate`. You may " -"want to write new e-mail processing code with this in mind. (Change " -"implemented by Anthony Baxter.)" +"Python release in favor of the :mod:`email` package. To this end, " +"the :func:`email.Utils.formatdate <email.utils.formatdate>` function has " +"been changed to make it usable as a replacement for :func:`!" +"rfc822.formatdate`. You may want to write new e-mail processing code with " +"this in mind. (Change implemented by Anthony Baxter.)" msgstr "" #: ../../whatsnew/2.4.rst:1227 @@ -1977,12 +2145,18 @@ msgid "" "data.number = 42\n" "data.url = ('www.python.org', 80)" msgstr "" +"import threading\n" +"\n" +"data = threading.local()\n" +"data.number = 42\n" +"data.url = ('www.python.org', 80)" #: ../../whatsnew/2.4.rst:1298 msgid "" -"Other threads can assign and retrieve their own values for the :attr:" -"`number` and :attr:`url` attributes. You can subclass :class:`local` to " -"initialize attributes or to add methods. (Contributed by Jim Fulton.)" +"Other threads can assign and retrieve their own values for " +"the :attr:`number` and :attr:`url` attributes. You can " +"subclass :class:`local` to initialize attributes or to add methods. " +"(Contributed by Jim Fulton.)" msgstr "" #: ../../whatsnew/2.4.rst:1302 @@ -2037,9 +2211,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:1338 msgid "" -":mod:`urllib2 <urllib.request>` has been changed to interact with :mod:" -"`cookielib <http.cookiejar>`: :class:`HTTPCookieProcessor` manages a cookie " -"jar that is used when accessing URLs." +":mod:`urllib2 <urllib.request>` has been changed to interact " +"with :mod:`cookielib <http.cookiejar>`: :class:`HTTPCookieProcessor` manages " +"a cookie jar that is used when accessing URLs." msgstr "" #: ../../whatsnew/2.4.rst:1342 @@ -2053,9 +2227,9 @@ msgstr "doctest" #: ../../whatsnew/2.4.rst:1350 msgid "" "The :mod:`doctest` module underwent considerable refactoring thanks to " -"Edward Loper and Tim Peters. Testing can still be as simple as running :" -"func:`doctest.testmod`, but the refactorings allow customizing the module's " -"operation in various ways" +"Edward Loper and Tim Peters. Testing can still be as simple as " +"running :func:`doctest.testmod`, but the refactorings allow customizing the " +"module's operation in various ways" msgstr "" #: ../../whatsnew/2.4.rst:1355 @@ -2094,6 +2268,11 @@ msgid "" "\n" "runner.summarize(verbose=1)" msgstr "" +"runner = doctest.DocTestRunner()\n" +"for t in tests:\n" +" tried, failed = runner.run(t)\n" +"\n" +"runner.summarize(verbose=1)" #: ../../whatsnew/2.4.rst:1380 msgid "The above example produces the following output::" @@ -2107,6 +2286,11 @@ msgid "" "2 passed and 0 failed.\n" "Test passed." msgstr "" +"1 items passed all tests:\n" +" 2 tests in f\n" +"2 tests in 1 items.\n" +"2 passed and 0 failed.\n" +"Test passed." #: ../../whatsnew/2.4.rst:1388 msgid "" @@ -2132,6 +2316,11 @@ msgid "" ">>>\n" "\"\"\"" msgstr "" +"def o (n):\n" +" \"\"\">>> o(1)\n" +"<__main__.C instance at 0x...>\n" +">>>\n" +"\"\"\"" #: ../../whatsnew/2.4.rst:1404 msgid "Another special string, ``<BLANKLINE>``, matches a blank line::" @@ -2145,13 +2334,18 @@ msgid "" ">>>\n" "\"\"\"" msgstr "" +"def p (n):\n" +" \"\"\">>> p(1)\n" +"<BLANKLINE>\n" +">>>\n" +"\"\"\"" #: ../../whatsnew/2.4.rst:1412 msgid "" "Another new capability is producing a diff-style display of the output by " -"specifying the :const:`doctest.REPORT_UDIFF` (unified diffs), :const:" -"`doctest.REPORT_CDIFF` (context diffs), or :const:`doctest.REPORT_NDIFF` " -"(delta-style) option flags. For example::" +"specifying the :const:`doctest.REPORT_UDIFF` (unified " +"diffs), :const:`doctest.REPORT_CDIFF` (context diffs), " +"or :const:`doctest.REPORT_NDIFF` (delta-style) option flags. For example::" msgstr "" #: ../../whatsnew/2.4.rst:1417 @@ -2188,10 +2382,21 @@ msgid "" " +rather\n" "**********************************************************************" msgstr "" +"**********************************************************************\n" +"File \"t.py\", line 15, in g\n" +"Failed example:\n" +" g(4)\n" +"Differences (unified diff with -expected +actual):\n" +" @@ -2,3 +2,3 @@\n" +" is\n" +" a\n" +" -lengthy\n" +" +rather\n" +"**********************************************************************" #: ../../whatsnew/2.4.rst:1449 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/2.4.rst:1451 msgid "Some of the changes to Python's build process and to the C API are:" @@ -2240,9 +2445,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:1476 msgid "" -"A new function, :c:func:`PyArg_VaParseTupleAndKeywords`, is the same as :c:" -"func:`PyArg_ParseTupleAndKeywords` but takes a :c:type:`va_list` instead of " -"a number of arguments. (Contributed by Greg Chapman.)" +"A new function, :c:func:`PyArg_VaParseTupleAndKeywords`, is the same " +"as :c:func:`PyArg_ParseTupleAndKeywords` but takes a :c:type:`va_list` " +"instead of a number of arguments. (Contributed by Greg Chapman.)" msgstr "" #: ../../whatsnew/2.4.rst:1480 @@ -2256,20 +2461,20 @@ msgstr "" #: ../../whatsnew/2.4.rst:1485 msgid "" "Python can now be built with additional profiling for the interpreter " -"itself, intended as an aid to people developing the Python core. Providing :" -"option:`!--enable-profiling` to the :program:`configure` script will let you " -"profile the interpreter with :program:`gprof`, and providing the :option:`!--" -"with-tsc` switch enables profiling using the Pentium's Time-Stamp-Counter " -"register. Note that the :option:`!--with-tsc` switch is slightly misnamed, " -"because the profiling feature also works on the PowerPC platform, though " -"that processor architecture doesn't call that register \"the TSC " -"register\". (Contributed by Jeremy Hylton.)" +"itself, intended as an aid to people developing the Python core. " +"Providing :option:`!--enable-profiling` to the :program:`configure` script " +"will let you profile the interpreter with :program:`gprof`, and providing " +"the :option:`!--with-tsc` switch enables profiling using the Pentium's Time-" +"Stamp-Counter register. Note that the :option:`!--with-tsc` switch is " +"slightly misnamed, because the profiling feature also works on the PowerPC " +"platform, though that processor architecture doesn't call that register " +"\"the TSC register\". (Contributed by Jeremy Hylton.)" msgstr "" #: ../../whatsnew/2.4.rst:1495 msgid "" -"The :c:type:`!tracebackobject` type has been renamed to :c:type:" -"`PyTracebackObject`." +"The :c:type:`!tracebackobject` type has been renamed " +"to :c:type:`PyTracebackObject`." msgstr "" #: ../../whatsnew/2.4.rst:1502 @@ -2354,8 +2559,8 @@ msgstr "" msgid "" "The :func:`signals.signal` function now raises a :exc:`RuntimeError` " "exception for certain illegal values; previously these errors would pass " -"silently. For example, you can no longer set a handler on the :const:" -"`SIGKILL` signal." +"silently. For example, you can no longer set a handler on " +"the :const:`SIGKILL` signal." msgstr "" #: ../../whatsnew/2.4.rst:1560 diff --git a/whatsnew/2.5.po b/whatsnew/2.5.po index e426c7db93..dc93ea0d80 100644 --- a/whatsnew/2.5.po +++ b/whatsnew/2.5.po @@ -55,10 +55,10 @@ msgid "" "statement will make writing cleanup code easier (section :ref:`pep-343`). " "Values can now be passed into generators (section :ref:`pep-342`). Imports " "are now visible as either absolute or relative (section :ref:`pep-328`). " -"Some corner cases of exception handling are handled better (section :ref:" -"`pep-341`). All these improvements are worthwhile, but they're improvements " -"to one specific language feature or another; none of them are broad " -"modifications to Python's semantics." +"Some corner cases of exception handling are handled better " +"(section :ref:`pep-341`). All these improvements are worthwhile, but " +"they're improvements to one specific language feature or another; none of " +"them are broad modifications to Python's semantics." msgstr "" #: ../../whatsnew/2.5.rst:34 @@ -252,8 +252,8 @@ msgstr "" msgid "" "Here's another example, from a program that uses PyGTK. Here a context-" "sensitive pop-up menu is being constructed dynamically. The callback " -"provided for the menu option is a partially applied version of the :meth:" -"`open_item` method, where the first argument has been provided. ::" +"provided for the menu option is a partially applied version of " +"the :meth:`open_item` method, where the first argument has been provided. ::" msgstr "" #: ../../whatsnew/2.5.rst:165 @@ -442,8 +442,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:274 msgid "" -"This defines a package named :mod:`pkg` containing the :mod:`pkg.main` and :" -"mod:`pkg.string` submodules." +"This defines a package named :mod:`pkg` containing the :mod:`pkg.main` " +"and :mod:`pkg.string` submodules." msgstr "" #: ../../whatsnew/2.5.rst:277 @@ -451,9 +451,9 @@ msgid "" "Consider the code in the :file:`main.py` module. What happens if it " "executes the statement ``import string``? In Python 2.4 and earlier, it " "will first look in the package's directory to perform a relative import, " -"finds :file:`pkg/string.py`, imports the contents of that file as the :mod:" -"`pkg.string` module, and that module is bound to the name ``string`` in the :" -"mod:`pkg.main` module's namespace." +"finds :file:`pkg/string.py`, imports the contents of that file as " +"the :mod:`pkg.string` module, and that module is bound to the name " +"``string`` in the :mod:`pkg.main` module's namespace." msgstr "" #: ../../whatsnew/2.5.rst:284 @@ -470,11 +470,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:292 msgid "" "Reading code which relies on relative imports is also less clear, because a " -"reader may be confused about which module, :mod:`string` or :mod:`pkg." -"string`, is intended to be used. Python users soon learned not to duplicate " -"the names of standard library modules in the names of their packages' " -"submodules, but you can't protect against having your submodule's name being " -"used for a new module added in a future version of Python." +"reader may be confused about which module, :mod:`string` " +"or :mod:`pkg.string`, is intended to be used. Python users soon learned not " +"to duplicate the names of standard library modules in the names of their " +"packages' submodules, but you can't protect against having your submodule's " +"name being used for a new module added in a future version of Python." msgstr "" #: ../../whatsnew/2.5.rst:299 @@ -505,10 +505,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:315 msgid "" "This imports the :mod:`string` module relative to the current package, so " -"in :mod:`pkg.main` this will import *name1* and *name2* from :mod:`pkg." -"string`. Additional leading periods perform the relative import starting " -"from the parent of the current package. For example, code in the :mod:`A.B." -"C` module can do::" +"in :mod:`pkg.main` this will import *name1* and *name2* " +"from :mod:`pkg.string`. Additional leading periods perform the relative " +"import starting from the parent of the current package. For example, code " +"in the :mod:`A.B.C` module can do::" msgstr "" #: ../../whatsnew/2.5.rst:320 @@ -559,11 +559,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:349 msgid "" "The :mod:`runpy` module implements a more sophisticated import mechanism so " -"that it's now possible to run modules in a package such as :mod:`pychecker." -"checker`. The module also supports alternative import mechanisms such as " -"the :mod:`zipimport` module. This means you can add a .zip archive's path " -"to ``sys.path`` and then use the :option:`-m` switch to execute code from " -"the archive." +"that it's now possible to run modules in a package such " +"as :mod:`pychecker.checker`. The module also supports alternative import " +"mechanisms such as the :mod:`zipimport` module. This means you can add " +"a .zip archive's path to ``sys.path`` and then use the :option:`-m` switch " +"to execute code from the archive." msgstr "" #: ../../whatsnew/2.5.rst:359 @@ -624,10 +624,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:393 msgid "" "The code in *block-1* is executed. If the code raises an exception, the " -"various :keyword:`except` blocks are tested: if the exception is of class :" -"class:`Exception1`, *handler-1* is executed; otherwise if it's of class :" -"class:`Exception2`, *handler-2* is executed, and so forth. If no exception " -"is raised, the *else-block* is executed." +"various :keyword:`except` blocks are tested: if the exception is of " +"class :class:`Exception1`, *handler-1* is executed; otherwise if it's of " +"class :class:`Exception2`, *handler-2* is executed, and so forth. If no " +"exception is raised, the *else-block* is executed." msgstr "" #: ../../whatsnew/2.5.rst:399 @@ -711,8 +711,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:451 msgid "" -"(:pep:`342` explains the exact rules, which are that a :keyword:`yield`\\ -" -"expression must always be parenthesized except when it occurs at the top-" +"(:pep:`342` explains the exact rules, which are that a :keyword:`yield`\\ " +"-expression must always be parenthesized except when it occurs at the top-" "level expression on the right-hand side of an assignment. This means you " "can write ``val = yield i`` but have to use parentheses when there's an " "operation, as in ``val = (yield i) + 12``.)" @@ -722,8 +722,8 @@ msgstr "" msgid "" "Values are sent into a generator by calling its ``send(value)`` method. The " "generator's code is then resumed and the :keyword:`yield` expression returns " -"the specified *value*. If the regular :meth:`next` method is called, the :" -"keyword:`!yield` returns :const:`None`." +"the specified *value*. If the regular :meth:`next` method is called, " +"the :keyword:`!yield` returns :const:`None`." msgstr "" #: ../../whatsnew/2.5.rst:463 @@ -805,19 +805,19 @@ msgstr "" msgid "" ":meth:`close` raises a new :exc:`GeneratorExit` exception inside the " "generator to terminate the iteration. On receiving this exception, the " -"generator's code must either raise :exc:`GeneratorExit` or :exc:" -"`StopIteration`. Catching the :exc:`GeneratorExit` exception and returning " -"a value is illegal and will trigger a :exc:`RuntimeError`; if the function " -"raises some other exception, that exception is propagated to the caller. :" -"meth:`close` will also be called by Python's garbage collector when the " -"generator is garbage-collected." +"generator's code must either raise :exc:`GeneratorExit` " +"or :exc:`StopIteration`. Catching the :exc:`GeneratorExit` exception and " +"returning a value is illegal and will trigger a :exc:`RuntimeError`; if the " +"function raises some other exception, that exception is propagated to the " +"caller. :meth:`close` will also be called by Python's garbage collector " +"when the generator is garbage-collected." msgstr "" #: ../../whatsnew/2.5.rst:512 msgid "" "If you need to run cleanup code when a :exc:`GeneratorExit` occurs, I " -"suggest using a ``try: ... finally:`` suite instead of catching :exc:" -"`GeneratorExit`." +"suggest using a ``try: ... finally:`` suite instead of " +"catching :exc:`GeneratorExit`." msgstr "" #: ../../whatsnew/2.5.rst:515 @@ -842,21 +842,22 @@ msgid "" "obvious. :meth:`close` is called when a generator is garbage-collected, so " "this means the generator's code gets one last chance to run before the " "generator is destroyed. This last chance means that ``try...finally`` " -"statements in generators can now be guaranteed to work; the :keyword:" -"`finally` clause will now always get a chance to run. The syntactic " -"restriction that you couldn't mix :keyword:`yield` statements with a ``try..." -"finally`` suite has therefore been removed. This seems like a minor bit of " -"language trivia, but using generators and ``try...finally`` is actually " -"necessary in order to implement the :keyword:`with` statement described by :" -"pep:`343`. I'll look at this new statement in the following section." +"statements in generators can now be guaranteed to work; " +"the :keyword:`finally` clause will now always get a chance to run. The " +"syntactic restriction that you couldn't mix :keyword:`yield` statements with " +"a ``try...finally`` suite has therefore been removed. This seems like a " +"minor bit of language trivia, but using generators and ``try...finally`` is " +"actually necessary in order to implement the :keyword:`with` statement " +"described by :pep:`343`. I'll look at this new statement in the following " +"section." msgstr "" #: ../../whatsnew/2.5.rst:536 msgid "" -"Another even more esoteric effect of this change: previously, the :attr:" -"`gi_frame` attribute of a generator was always a frame object. It's now " -"possible for :attr:`gi_frame` to be ``None`` once the generator has been " -"exhausted." +"Another even more esoteric effect of this change: previously, " +"the :attr:`gi_frame` attribute of a generator was always a frame object. " +"It's now possible for :attr:`gi_frame` to be ``None`` once the generator has " +"been exhausted." msgstr "" #: ../../whatsnew/2.5.rst:544 @@ -925,8 +926,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:577 msgid "" "The expression is evaluated, and it should result in an object that supports " -"the context management protocol (that is, has :meth:`~object.__enter__` and :" -"meth:`~object.__exit__` methods." +"the context management protocol (that is, has :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods." msgstr "" #: ../../whatsnew/2.5.rst:581 @@ -939,9 +940,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:586 msgid "" -"After execution of the *with-block* is finished, the object's :meth:`~object." -"__exit__` method is called, even if the block raised an exception, and can " -"therefore run clean-up code." +"After execution of the *with-block* is finished, the " +"object's :meth:`~object.__exit__` method is called, even if the block raised " +"an exception, and can therefore run clean-up code." msgstr "" #: ../../whatsnew/2.5.rst:590 @@ -982,8 +983,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:611 msgid "" -"In this case, *f* is the same object created by :func:`open`, because :meth:" -"`~object.__enter__` returns *self*." +"In this case, *f* is the same object created by :func:`open`, " +"because :meth:`~object.__enter__` returns *self*." msgstr "" #: ../../whatsnew/2.5.rst:614 @@ -1047,8 +1048,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:654 msgid "" "The expression is evaluated and should result in an object called a " -"\"context manager\". The context manager must have :meth:`~object." -"__enter__` and :meth:`~object.__exit__` methods." +"\"context manager\". The context manager must " +"have :meth:`~object.__enter__` and :meth:`~object.__exit__` methods." msgstr "" #: ../../whatsnew/2.5.rst:658 @@ -1065,12 +1066,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:664 msgid "" "If *BLOCK* raises an exception, the ``__exit__(type, value, traceback)`` is " -"called with the exception details, the same values returned by :func:`sys." -"exc_info`. The method's return value controls whether the exception is re-" -"raised: any false value re-raises the exception, and ``True`` will result in " -"suppressing it. You'll only rarely want to suppress the exception, because " -"if you do the author of the code containing the ':keyword:`with`' statement " -"will never realize anything went wrong." +"called with the exception details, the same values returned " +"by :func:`sys.exc_info`. The method's return value controls whether the " +"exception is re-raised: any false value re-raises the exception, and " +"``True`` will result in suppressing it. You'll only rarely want to suppress " +"the exception, because if you do the author of the code containing the " +"':keyword:`with`' statement will never realize anything went wrong." msgstr "" #: ../../whatsnew/2.5.rst:672 @@ -1112,8 +1113,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:693 msgid "" "The transaction should be committed if the code in the block runs flawlessly " -"or rolled back if there's an exception. Here's the basic interface for :" -"class:`DatabaseConnection` that I'll assume::" +"or rolled back if there's an exception. Here's the basic interface " +"for :class:`DatabaseConnection` that I'll assume::" msgstr "" #: ../../whatsnew/2.5.rst:697 @@ -1194,8 +1195,8 @@ msgid "" "generator function instead of defining a new class. The generator should " "yield exactly one value. The code up to the :keyword:`yield` will be " "executed as the :meth:`~object.__enter__` method, and the value yielded will " -"be the method's return value that will get bound to the variable in the ':" -"keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " +"be the method's return value that will get bound to the variable in the " +"':keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " "the :keyword:`yield` will be executed in the :meth:`~object.__exit__` " "method. Any exception raised in the block will be raised by the :keyword:`!" "yield` statement." @@ -1327,12 +1328,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:828 msgid "" "This rearrangement was done because people often want to catch all " -"exceptions that indicate program errors. :exc:`KeyboardInterrupt` and :exc:" -"`SystemExit` aren't errors, though, and usually represent an explicit action " -"such as the user hitting :kbd:`Control-C` or code calling :func:`sys.exit`. " -"A bare ``except:`` will catch all exceptions, so you commonly need to list :" -"exc:`KeyboardInterrupt` and :exc:`SystemExit` in order to re-raise them. " -"The usual pattern is::" +"exceptions that indicate program errors. :exc:`KeyboardInterrupt` " +"and :exc:`SystemExit` aren't errors, though, and usually represent an " +"explicit action such as the user hitting :kbd:`Control-C` or code " +"calling :func:`sys.exit`. A bare ``except:`` will catch all exceptions, so " +"you commonly need to list :exc:`KeyboardInterrupt` and :exc:`SystemExit` in " +"order to re-raise them. The usual pattern is::" msgstr "" #: ../../whatsnew/2.5.rst:835 @@ -1410,9 +1411,9 @@ msgstr "" msgid "" "A limit of 2147483647 items doesn't really matter on a 32-bit platform " "because you'll run out of memory before hitting the length limit. Each list " -"item requires space for a pointer, which is 4 bytes, plus space for a :c:" -"type:`PyObject` representing the item. 2147483647\\*4 is already more bytes " -"than a 32-bit address space can contain." +"item requires space for a pointer, which is 4 bytes, plus space for " +"a :c:type:`PyObject` representing the item. 2147483647\\*4 is already more " +"bytes than a 32-bit address space can contain." msgstr "" #: ../../whatsnew/2.5.rst:894 @@ -1431,19 +1432,21 @@ msgstr "" #: ../../whatsnew/2.5.rst:904 msgid "" "This change most strongly affects authors of C extension modules. Python " -"strings and container types such as lists and tuples now use :c:type:" -"`Py_ssize_t` to store their size. Functions such as :c:func:`PyList_Size` " -"now return :c:type:`Py_ssize_t`. Code in extension modules may therefore " -"need to have some variables changed to :c:type:`Py_ssize_t`." +"strings and container types such as lists and tuples now " +"use :c:type:`Py_ssize_t` to store their size. Functions such " +"as :c:func:`PyList_Size` now return :c:type:`Py_ssize_t`. Code in " +"extension modules may therefore need to have some variables changed " +"to :c:type:`Py_ssize_t`." msgstr "" #: ../../whatsnew/2.5.rst:910 msgid "" "The :c:func:`PyArg_ParseTuple` and :c:func:`Py_BuildValue` functions have a " -"new conversion code, ``n``, for :c:type:`Py_ssize_t`. :c:func:" -"`PyArg_ParseTuple`'s ``s#`` and ``t#`` still output :c:expr:`int` by " -"default, but you can define the macro :c:macro:`PY_SSIZE_T_CLEAN` before " -"including :file:`Python.h` to make them return :c:type:`Py_ssize_t`." +"new conversion code, ``n``, " +"for :c:type:`Py_ssize_t`. :c:func:`PyArg_ParseTuple`'s ``s#`` and ``t#`` " +"still output :c:expr:`int` by default, but you can define the " +"macro :c:macro:`PY_SSIZE_T_CLEAN` before including :file:`Python.h` to " +"make them return :c:type:`Py_ssize_t`." msgstr "" #: ../../whatsnew/2.5.rst:916 @@ -1478,9 +1481,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:941 msgid "" "Slicing can't just use the existing :meth:`__int__` method because that " -"method is also used to implement coercion to integers. If slicing used :" -"meth:`__int__`, floating-point numbers would also become legal slice indexes " -"and that's clearly an undesirable behaviour." +"method is also used to implement coercion to integers. If slicing " +"used :meth:`__int__`, floating-point numbers would also become legal slice " +"indexes and that's clearly an undesirable behaviour." msgstr "" #: ../../whatsnew/2.5.rst:946 @@ -1503,8 +1506,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:953 msgid "" "The return value must be either a Python integer or long integer. The " -"interpreter will check that the type returned is correct, and raises a :exc:" -"`TypeError` if this requirement isn't met." +"interpreter will check that the type returned is correct, and raises " +"a :exc:`TypeError` if this requirement isn't met." msgstr "" #: ../../whatsnew/2.5.rst:957 @@ -1538,9 +1541,9 @@ msgid "" "The :class:`dict` type has a new hook for letting subclasses provide a " "default value when a key isn't contained in the dictionary. When a key isn't " "found, the dictionary's ``__missing__(key)`` method will be called. This " -"hook is used to implement the new :class:`defaultdict` class in the :mod:" -"`collections` module. The following example defines a dictionary that " -"returns zero for any missing key::" +"hook is used to implement the new :class:`defaultdict` class in " +"the :mod:`collections` module. The following example defines a dictionary " +"that returns zero for any missing key::" msgstr "" #: ../../whatsnew/2.5.rst:985 @@ -1657,11 +1660,11 @@ msgstr "(由 Steven Bethard 和 Raymond Hettinger 所貢獻。)" #: ../../whatsnew/2.5.rst:1045 msgid "" "Two new built-in functions, :func:`any` and :func:`all`, evaluate whether an " -"iterator contains any true or false values. :func:`any` returns :const:" -"`True` if any value returned by the iterator is true; otherwise it will " -"return :const:`False`. :func:`all` returns :const:`True` only if all of the " -"values returned by the iterator evaluate as true. (Suggested by Guido van " -"Rossum, and implemented by Raymond Hettinger.)" +"iterator contains any true or false values. :func:`any` " +"returns :const:`True` if any value returned by the iterator is true; " +"otherwise it will return :const:`False`. :func:`all` returns :const:`True` " +"only if all of the values returned by the iterator evaluate as true. " +"(Suggested by Guido van Rossum, and implemented by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.5.rst:1052 @@ -1670,8 +1673,8 @@ msgid "" "integer or a regular integer. If a long integer is returned, the hash of " "that value is taken. In earlier versions the hash value was required to be " "a regular integer, but in 2.5 the :func:`id` built-in was changed to always " -"return non-negative numbers, and users often seem to use ``id(self)`` in :" -"meth:`__hash__` methods (though this is discouraged)." +"return non-negative numbers, and users often seem to use ``id(self)`` " +"in :meth:`__hash__` methods (though this is discouraged)." msgstr "" #: ../../whatsnew/2.5.rst:1061 @@ -1732,12 +1735,12 @@ msgid "" "One error that Python programmers sometimes make is forgetting to include " "an :file:`__init__.py` module in a package directory. Debugging this mistake " "can be confusing, and usually requires running Python with the :option:`-v` " -"switch to log all the paths searched. In Python 2.5, a new :exc:" -"`ImportWarning` warning is triggered when an import would have picked up a " -"directory as a package but no :file:`__init__.py` was found. This warning " -"is silently ignored by default; provide the :option:`-Wd <-W>` option when " -"running the Python executable to display the warning message. (Implemented " -"by Thomas Wouters.)" +"switch to log all the paths searched. In Python 2.5, a " +"new :exc:`ImportWarning` warning is triggered when an import would have " +"picked up a directory as a package but no :file:`__init__.py` was found. " +"This warning is silently ignored by default; provide the :option:`-Wd <-W>` " +"option when running the Python executable to display the warning message. " +"(Implemented by Thomas Wouters.)" msgstr "" #: ../../whatsnew/2.5.rst:1102 @@ -1807,11 +1810,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:1147 msgid "" -"When they were introduced in Python 2.4, the built-in :class:`set` and :" -"class:`frozenset` types were built on top of Python's dictionary type. In " -"2.5 the internal data structure has been customized for implementing sets, " -"and as a result sets will use a third less memory and are somewhat faster. " -"(Implemented by Raymond Hettinger.)" +"When they were introduced in Python 2.4, the built-in :class:`set` " +"and :class:`frozenset` types were built on top of Python's dictionary " +"type. In 2.5 the internal data structure has been customized for " +"implementing sets, and as a result sets will use a third less memory and are " +"somewhat faster. (Implemented by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.5.rst:1153 @@ -1838,8 +1841,8 @@ msgid "" "methods. Iteration uses an internal buffer and the :meth:`!read\\*` " "methods don't use that buffer. Instead they would return the data " "following the buffer, causing the data to appear out of order. Mixing " -"iteration and these methods will now trigger a :exc:`ValueError` from the :" -"meth:`!read\\*` method. (Implemented by Thomas Wouters.)" +"iteration and these methods will now trigger a :exc:`ValueError` from " +"the :meth:`!read\\*` method. (Implemented by Thomas Wouters.)" msgstr "" #: ../../whatsnew/2.5.rst:1178 @@ -1852,8 +1855,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1182 msgid "" "The :mod:`re` module got a 1 or 2% speedup by switching to Python's " -"allocator functions instead of the system's :c:func:`malloc` and :c:func:" -"`free`. (Contributed by Jack Diederich at the NeedForSpeed sprint.)" +"allocator functions instead of the system's :c:func:`malloc` " +"and :c:func:`free`. (Contributed by Jack Diederich at the NeedForSpeed " +"sprint.)" msgstr "" #: ../../whatsnew/2.5.rst:1186 @@ -1911,16 +1915,15 @@ msgstr "" #: ../../whatsnew/2.5.rst:1228 msgid "" -"The :mod:`codecs` module gained support for incremental codecs. The :func:" -"`codec.lookup` function now returns a :class:`CodecInfo` instance instead of " -"a tuple. :class:`CodecInfo` instances behave like a 4-tuple to preserve " -"backward compatibility but also have the attributes :attr:`encode`, :attr:" -"`decode`, :attr:`incrementalencoder`, :attr:`incrementaldecoder`, :attr:" -"`streamwriter`, and :attr:`streamreader`. Incremental codecs can receive " -"input and produce output in multiple chunks; the output is the same as if " -"the entire input was fed to the non-incremental codec. See the :mod:`codecs` " -"module documentation for details. (Designed and implemented by Walter " -"Dörwald.)" +"The :mod:`codecs` module gained support for incremental codecs. " +"The :func:`codec.lookup` function now returns a :class:`CodecInfo` instance " +"instead of a tuple. :class:`CodecInfo` instances behave like a 4-tuple to " +"preserve backward compatibility but also have the " +"attributes :attr:`encode`, :attr:`decode`, :attr:`incrementalencoder`, :attr:`incrementaldecoder`, :attr:`streamwriter`, " +"and :attr:`streamreader`. Incremental codecs can receive input and produce " +"output in multiple chunks; the output is the same as if the entire input was " +"fed to the non-incremental codec. See the :mod:`codecs` module documentation " +"for details. (Designed and implemented by Walter Dörwald.)" msgstr "" #: ../../whatsnew/2.5.rst:1240 @@ -1986,10 +1989,11 @@ msgstr "(由 Guido van Rossum 所貢獻。)" #: ../../whatsnew/2.5.rst:1271 msgid "" -"The :class:`deque` double-ended queue type supplied by the :mod:" -"`collections` module now has a ``remove(value)`` method that removes the " -"first occurrence of *value* in the queue, raising :exc:`ValueError` if the " -"value isn't found. (Contributed by Raymond Hettinger.)" +"The :class:`deque` double-ended queue type supplied by " +"the :mod:`collections` module now has a ``remove(value)`` method that " +"removes the first occurrence of *value* in the queue, " +"raising :exc:`ValueError` if the value isn't found. (Contributed by Raymond " +"Hettinger.)" msgstr "" #: ../../whatsnew/2.5.rst:1276 @@ -2022,12 +2026,12 @@ msgstr "" msgid "" "The :mod:`csv` module, which parses files in comma-separated value format, " "received several enhancements and a number of bugfixes. You can now set the " -"maximum size in bytes of a field by calling the ``csv." -"field_size_limit(new_limit)`` function; omitting the *new_limit* argument " -"will return the currently set limit. The :class:`reader` class now has a :" -"attr:`line_num` attribute that counts the number of physical lines read from " -"the source; records can span multiple physical lines, so :attr:`line_num` is " -"not the same as the number of records read." +"maximum size in bytes of a field by calling the " +"``csv.field_size_limit(new_limit)`` function; omitting the *new_limit* " +"argument will return the currently set limit. The :class:`reader` class now " +"has a :attr:`line_num` attribute that counts the number of physical lines " +"read from the source; records can span multiple physical lines, " +"so :attr:`line_num` is not the same as the number of records read." msgstr "" #: ../../whatsnew/2.5.rst:1301 @@ -2083,10 +2087,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1330 msgid "" -"An *encoding* parameter was added to the :func:`testfile` function and the :" -"class:`DocFileSuite` class to specify the file's encoding. This makes it " -"easier to use non-ASCII characters in tests contained within a docstring. " -"(Contributed by Bjorn Tillenius.)" +"An *encoding* parameter was added to the :func:`testfile` function and " +"the :class:`DocFileSuite` class to specify the file's encoding. This makes " +"it easier to use non-ASCII characters in tests contained within a " +"docstring. (Contributed by Bjorn Tillenius.)" msgstr "" #: ../../whatsnew/2.5.rst:1337 @@ -2099,12 +2103,12 @@ msgstr "" msgid "" "The :mod:`fileinput` module was made more flexible. Unicode filenames are " "now supported, and a *mode* parameter that defaults to ``\"r\"`` was added " -"to the :func:`input` function to allow opening files in binary or :term:" -"`universal newlines` mode. Another new parameter, *openhook*, lets you use " -"a function other than :func:`open` to open the input files. Once you're " -"iterating over the set of files, the :class:`FileInput` object's new :meth:" -"`~fileinput.fileno` returns the file descriptor for the currently opened " -"file. (Contributed by Georg Brandl.)" +"to the :func:`input` function to allow opening files in binary " +"or :term:`universal newlines` mode. Another new parameter, *openhook*, lets " +"you use a function other than :func:`open` to open the input files. Once " +"you're iterating over the set of files, the :class:`FileInput` object's " +"new :meth:`~fileinput.fileno` returns the file descriptor for the currently " +"opened file. (Contributed by Georg Brandl.)" msgstr "" #: ../../whatsnew/2.5.rst:1354 @@ -2171,9 +2175,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1393 msgid "" -"To format strings with multiple %char specifiers, use the new :func:" -"`format_string` function that works like :func:`format` but also supports " -"mixing %char specifiers with arbitrary text." +"To format strings with multiple %char specifiers, use the " +"new :func:`format_string` function that works like :func:`format` but also " +"supports mixing %char specifiers with arbitrary text." msgstr "" #: ../../whatsnew/2.5.rst:1397 @@ -2218,9 +2222,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1425 msgid "" -"New module: the :mod:`!msilib` module allows creating Microsoft Installer :" -"file:`.msi` files and CAB files. Some support for reading the :file:`.msi` " -"database is also included. (Contributed by Martin von Löwis.)" +"New module: the :mod:`!msilib` module allows creating Microsoft " +"Installer :file:`.msi` files and CAB files. Some support for reading " +"the :file:`.msi` database is also included. (Contributed by Martin von " +"Löwis.)" msgstr "" #: ../../whatsnew/2.5.rst:1429 @@ -2233,11 +2238,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:1433 msgid "" "The :mod:`operator` module's :func:`itemgetter` and :func:`attrgetter` " -"functions now support multiple fields. A call such as ``operator." -"attrgetter('a', 'b')`` will return a function that retrieves the :attr:`a` " -"and :attr:`b` attributes. Combining this new feature with the :meth:`sort` " -"method's ``key`` parameter lets you easily sort lists using multiple " -"fields. (Contributed by Raymond Hettinger.)" +"functions now support multiple fields. A call such as " +"``operator.attrgetter('a', 'b')`` will return a function that retrieves " +"the :attr:`a` and :attr:`b` attributes. Combining this new feature with " +"the :meth:`sort` method's ``key`` parameter lets you easily sort lists " +"using multiple fields. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.5.rst:1440 @@ -2251,19 +2256,19 @@ msgstr "" #: ../../whatsnew/2.5.rst:1445 msgid "" -"The :mod:`os` module underwent several changes. The :attr:" -"`stat_float_times` variable now defaults to true, meaning that :func:`os." -"stat` will now return time values as floats. (This doesn't necessarily mean " -"that :func:`os.stat` will return times that are precise to fractions of a " -"second; not all systems support such precision.)" +"The :mod:`os` module underwent several changes. " +"The :attr:`stat_float_times` variable now defaults to true, meaning " +"that :func:`os.stat` will now return time values as floats. (This doesn't " +"necessarily mean that :func:`os.stat` will return times that are precise to " +"fractions of a second; not all systems support such precision.)" msgstr "" #: ../../whatsnew/2.5.rst:1451 msgid "" -"Constants named :const:`os.SEEK_SET`, :const:`os.SEEK_CUR`, and :const:`os." -"SEEK_END` have been added; these are the parameters to the :func:`os.lseek` " -"function. Two new constants for locking are :const:`os.O_SHLOCK` and :const:" -"`os.O_EXLOCK`." +"Constants named :const:`os.SEEK_SET`, :const:`os.SEEK_CUR`, " +"and :const:`os.SEEK_END` have been added; these are the parameters to " +"the :func:`os.lseek` function. Two new constants for locking " +"are :const:`os.O_SHLOCK` and :const:`os.O_EXLOCK`." msgstr "" #: ../../whatsnew/2.5.rst:1456 @@ -2281,9 +2286,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1465 msgid "" "On FreeBSD, the :func:`os.stat` function now returns times with nanosecond " -"resolution, and the returned object now has :attr:`st_gen` and :attr:" -"`st_birthtime`. The :attr:`st_flags` attribute is also available, if the " -"platform supports it. (Contributed by Antti Louko and Diego Pettenò.)" +"resolution, and the returned object now has :attr:`st_gen` " +"and :attr:`st_birthtime`. The :attr:`st_flags` attribute is also available, " +"if the platform supports it. (Contributed by Antti Louko and Diego Pettenò.)" msgstr "" #: ../../whatsnew/2.5.rst:1472 @@ -2314,9 +2319,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1490 msgid "" -"The pybench benchmark suite by Marc-André Lemburg is now included in the :" -"file:`Tools/pybench` directory. The pybench suite is an improvement on the " -"commonly used :file:`pystone.py` program because pybench provides a more " +"The pybench benchmark suite by Marc-André Lemburg is now included in " +"the :file:`Tools/pybench` directory. The pybench suite is an improvement on " +"the commonly used :file:`pystone.py` program because pybench provides a more " "detailed measurement of the interpreter's speed. It times particular " "operations such as function calls, tuple slicing, method lookups, and " "numeric operations, instead of performing many different operations and " @@ -2342,8 +2347,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:1507 msgid "" "The old :mod:`regex` and :mod:`regsub` modules, which have been deprecated " -"ever since Python 2.0, have finally been deleted. Other deleted modules: :" -"mod:`statcache`, :mod:`tzparse`, :mod:`whrandom`." +"ever since Python 2.0, have finally been deleted. Other deleted " +"modules: :mod:`statcache`, :mod:`tzparse`, :mod:`whrandom`." msgstr "" #: ../../whatsnew/2.5.rst:1511 @@ -2356,9 +2361,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1516 msgid "" -"The :mod:`rlcompleter` module is no longer dependent on importing the :mod:" -"`readline` module and therefore now works on non-Unix platforms. (Patch from " -"Robert Kiendl.)" +"The :mod:`rlcompleter` module is no longer dependent on importing " +"the :mod:`readline` module and therefore now works on non-Unix platforms. " +"(Patch from Robert Kiendl.)" msgstr "" #: ../../whatsnew/2.5.rst:1522 @@ -2375,8 +2380,8 @@ msgid "" "The :mod:`socket` module now supports :const:`AF_NETLINK` sockets on Linux, " "thanks to a patch from Philippe Biondi. Netlink sockets are a Linux-" "specific mechanism for communications between a user-space process and " -"kernel code; an introductory article about them is at https://www." -"linuxjournal.com/article/7356. In Python code, netlink addresses are " +"kernel code; an introductory article about them is at https://" +"www.linuxjournal.com/article/7356. In Python code, netlink addresses are " "represented as a tuple of 2 integers, ``(pid, group_mask)``." msgstr "" @@ -2391,9 +2396,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1541 msgid "" -"Socket objects also gained :meth:`getfamily`, :meth:`gettype`, and :meth:" -"`getproto` accessor methods to retrieve the family, type, and protocol " -"values for the socket." +"Socket objects also gained :meth:`getfamily`, :meth:`gettype`, " +"and :meth:`getproto` accessor methods to retrieve the family, type, and " +"protocol values for the socket." msgstr "" #: ../../whatsnew/2.5.rst:1545 @@ -2404,12 +2409,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:1548 msgid "" -"The :mod:`struct` is now faster because it compiles format strings into :" -"class:`Struct` objects with :meth:`pack` and :meth:`unpack` methods. This " -"is similar to how the :mod:`re` module lets you create compiled regular " -"expression objects. You can still use the module-level :func:`pack` and :" -"func:`unpack` functions; they'll create :class:`Struct` objects and cache " -"them. Or you can use :class:`Struct` instances directly::" +"The :mod:`struct` is now faster because it compiles format strings " +"into :class:`Struct` objects with :meth:`pack` and :meth:`unpack` methods. " +"This is similar to how the :mod:`re` module lets you create compiled regular " +"expression objects. You can still use the module-level :func:`pack` " +"and :func:`unpack` functions; they'll create :class:`Struct` objects and " +"cache them. Or you can use :class:`Struct` instances directly::" msgstr "" #: ../../whatsnew/2.5.rst:1555 @@ -2450,10 +2455,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1575 msgid "" -"This information is also available to C extensions via the :c:func:" -"`Py_GetBuildInfo` function that returns a string of build information like " -"this: ``\"trunk:45355:45356M, Apr 13 2006, 07:42:19\"``. (Contributed by " -"Barry Warsaw.)" +"This information is also available to C extensions via " +"the :c:func:`Py_GetBuildInfo` function that returns a string of build " +"information like this: ``\"trunk:45355:45356M, Apr 13 2006, 07:42:19\"``. " +"(Contributed by Barry Warsaw.)" msgstr "" #: ../../whatsnew/2.5.rst:1580 @@ -2466,11 +2471,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:1585 msgid "" -"The :class:`TarFile` class in the :mod:`tarfile` module now has an :meth:" -"`extractall` method that extracts all members from the archive into the " -"current working directory. It's also possible to set a different directory " -"as the extraction target, and to unpack only a subset of the archive's " -"members." +"The :class:`TarFile` class in the :mod:`tarfile` module now has " +"an :meth:`extractall` method that extracts all members from the archive into " +"the current working directory. It's also possible to set a different " +"directory as the extraction target, and to unpack only a subset of the " +"archive's members." msgstr "" #: ../../whatsnew/2.5.rst:1590 @@ -2533,35 +2538,35 @@ msgstr "(由 Ka-Ping Yee 所貢獻。)" #: ../../whatsnew/2.5.rst:1634 msgid "" -"The :mod:`weakref` module's :class:`WeakKeyDictionary` and :class:" -"`WeakValueDictionary` types gained new methods for iterating over the weak " -"references contained in the dictionary. :meth:`iterkeyrefs` and :meth:" -"`keyrefs` methods were added to :class:`WeakKeyDictionary`, and :meth:" -"`itervaluerefs` and :meth:`valuerefs` were added to :class:" -"`WeakValueDictionary`. (Contributed by Fred L. Drake, Jr.)" +"The :mod:`weakref` module's :class:`WeakKeyDictionary` " +"and :class:`WeakValueDictionary` types gained new methods for iterating over " +"the weak references contained in the dictionary. :meth:`iterkeyrefs` " +"and :meth:`keyrefs` methods were added to :class:`WeakKeyDictionary`, " +"and :meth:`itervaluerefs` and :meth:`valuerefs` were added " +"to :class:`WeakValueDictionary`. (Contributed by Fred L. Drake, Jr.)" msgstr "" #: ../../whatsnew/2.5.rst:1641 msgid "" "The :mod:`webbrowser` module received a number of enhancements. It's now " "usable as a script with ``python -m webbrowser``, taking a URL as the " -"argument; there are a number of switches to control the behaviour (:option:" -"`!-n` for a new browser window, :option:`!-t` for a new tab). New module-" -"level functions, :func:`open_new` and :func:`open_new_tab`, were added to " -"support this. The module's :func:`open` function supports an additional " -"feature, an *autoraise* parameter that signals whether to raise the open " -"window when possible. A number of additional browsers were added to the " -"supported list such as Firefox, Opera, Konqueror, and elinks. (Contributed " -"by Oleg Broytmann and Georg Brandl.)" +"argument; there are a number of switches to control the behaviour " +"(:option:`!-n` for a new browser window, :option:`!-t` for a new tab). New " +"module-level functions, :func:`open_new` and :func:`open_new_tab`, were " +"added to support this. The module's :func:`open` function supports an " +"additional feature, an *autoraise* parameter that signals whether to raise " +"the open window when possible. A number of additional browsers were added to " +"the supported list such as Firefox, Opera, Konqueror, and elinks. " +"(Contributed by Oleg Broytmann and Georg Brandl.)" msgstr "" #: ../../whatsnew/2.5.rst:1653 msgid "" -"The :mod:`xmlrpclib <xmlrpc.client>` module now supports returning :class:" -"`~datetime.datetime` objects for the XML-RPC date type. Supply " -"``use_datetime=True`` to the :func:`~xmlrpc.client.loads` function or the :" -"class:`!Unmarshaller` class to enable this feature. (Contributed by Skip " -"Montanaro.)" +"The :mod:`xmlrpclib <xmlrpc.client>` module now supports " +"returning :class:`~datetime.datetime` objects for the XML-RPC date type. " +"Supply ``use_datetime=True`` to the :func:`~xmlrpc.client.loads` function " +"or the :class:`!Unmarshaller` class to enable this feature. (Contributed by " +"Skip Montanaro.)" msgstr "" #: ../../whatsnew/2.5.rst:1660 @@ -2594,10 +2599,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1687 msgid "" -"To load a shared library or DLL, you must create an instance of the :class:" -"`CDLL` class and provide the name or path of the shared library or DLL. Once " -"that's done, you can call arbitrary functions by accessing them as " -"attributes of the :class:`CDLL` object. ::" +"To load a shared library or DLL, you must create an instance of " +"the :class:`CDLL` class and provide the name or path of the shared library " +"or DLL. Once that's done, you can call arbitrary functions by accessing them " +"as attributes of the :class:`CDLL` object. ::" msgstr "" #: ../../whatsnew/2.5.rst:1692 @@ -2614,14 +2619,15 @@ msgstr "" #: ../../whatsnew/2.5.rst:1697 msgid "" -"Type constructors for the various C types are provided: :func:`c_int`, :func:" -"`c_float`, :func:`c_double`, :func:`c_char_p` (equivalent to :c:expr:`char " -"\\*`), and so forth. Unlike Python's types, the C versions are all mutable; " -"you can assign to their :attr:`value` attribute to change the wrapped " -"value. Python integers and strings will be automatically converted to the " -"corresponding C types, but for other types you must call the correct type " -"constructor. (And I mean *must*; getting it wrong will often result in the " -"interpreter crashing with a segmentation fault.)" +"Type constructors for the various C types are " +"provided: :func:`c_int`, :func:`c_float`, :func:`c_double`, :func:`c_char_p` " +"(equivalent to :c:expr:`char \\*`), and so forth. Unlike Python's types, " +"the C versions are all mutable; you can assign to their :attr:`value` " +"attribute to change the wrapped value. Python integers and strings will be " +"automatically converted to the corresponding C types, but for other types " +"you must call the correct type constructor. (And I mean *must*; getting " +"it wrong will often result in the interpreter crashing with a segmentation " +"fault.)" msgstr "" #: ../../whatsnew/2.5.rst:1706 @@ -2644,8 +2650,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:1715 msgid "" -"C functions are assumed to return integers, but you can set the :attr:" -"`restype` attribute of the function object to change this::" +"C functions are assumed to return integers, but you can set " +"the :attr:`restype` attribute of the function object to change this::" msgstr "" #: ../../whatsnew/2.5.rst:1718 @@ -2664,12 +2670,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:1724 msgid "" -":mod:`ctypes` also provides a wrapper for Python's C API as the ``ctypes." -"pythonapi`` object. This object does *not* release the global interpreter " -"lock before calling a function, because the lock must be held when calling " -"into the interpreter's code. There's a :class:`~ctypes.py_object` type " -"constructor that will create a :c:expr:`PyObject *` pointer. A simple " -"usage::" +":mod:`ctypes` also provides a wrapper for Python's C API as the " +"``ctypes.pythonapi`` object. This object does *not* release the global " +"interpreter lock before calling a function, because the lock must be held " +"when calling into the interpreter's code. There's " +"a :class:`~ctypes.py_object` type constructor that will create " +"a :c:expr:`PyObject *` pointer. A simple usage::" msgstr "" #: ../../whatsnew/2.5.rst:1730 @@ -2697,10 +2703,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1740 msgid "" ":mod:`ctypes` has been around for a while, but people still write and " -"distribution hand-coded extension modules because you can't rely on :mod:" -"`ctypes` being present. Perhaps developers will begin to write Python " -"wrappers atop a library accessed through :mod:`ctypes` instead of extension " -"modules, now that :mod:`ctypes` is included with core Python." +"distribution hand-coded extension modules because you can't rely " +"on :mod:`ctypes` being present. Perhaps developers will begin to write " +"Python wrappers atop a library accessed through :mod:`ctypes` instead of " +"extension modules, now that :mod:`ctypes` is included with core Python." msgstr "" #: ../../whatsnew/2.5.rst:1749 @@ -2775,8 +2781,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:1790 msgid "" -"Once you have an :class:`ElementTree` instance, you can call its :meth:" -"`getroot` method to get the root :class:`Element` node." +"Once you have an :class:`ElementTree` instance, you can call " +"its :meth:`getroot` method to get the root :class:`Element` node." msgstr "" #: ../../whatsnew/2.5.rst:1793 @@ -2912,8 +2918,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:1837 msgid "" -"Comments and processing instructions are also represented as :class:" -"`Element` nodes. To check if a node is a comment or processing " +"Comments and processing instructions are also represented " +"as :class:`Element` nodes. To check if a node is a comment or processing " "instructions::" msgstr "" @@ -3222,9 +3228,9 @@ msgstr "wsgiref 套件" #: ../../whatsnew/2.5.rst:2042 msgid "" "The Web Server Gateway Interface (WSGI) v1.0 defines a standard interface " -"between web servers and Python web applications and is described in :pep:" -"`333`. The :mod:`wsgiref` package is a reference implementation of the WSGI " -"specification." +"between web servers and Python web applications and is described " +"in :pep:`333`. The :mod:`wsgiref` package is a reference implementation of " +"the WSGI specification." msgstr "" #: ../../whatsnew/2.5.rst:2049 @@ -3276,11 +3282,11 @@ msgstr "由 Phillip J. Eby 撰寫 PEP。" #: ../../whatsnew/2.5.rst:2080 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/2.5.rst:2082 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/2.5.rst:2084 msgid "" @@ -3301,9 +3307,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:2094 msgid "" "The largest change to the C API came from :pep:`353`, which modifies the " -"interpreter to use a :c:type:`Py_ssize_t` type definition instead of :c:expr:" -"`int`. See the earlier section :ref:`pep-353` for a discussion of this " -"change." +"interpreter to use a :c:type:`Py_ssize_t` type definition instead " +"of :c:expr:`int`. See the earlier section :ref:`pep-353` for a discussion " +"of this change." msgstr "" #: ../../whatsnew/2.5.rst:2099 @@ -3316,9 +3322,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:2104 msgid "" -"It's possible for Python code to obtain AST objects by using the :func:" -"`compile` built-in and specifying ``_ast.PyCF_ONLY_AST`` as the value of " -"the *flags* parameter::" +"It's possible for Python code to obtain AST objects by using " +"the :func:`compile` built-in and specifying ``_ast.PyCF_ONLY_AST`` as the " +"value of the *flags* parameter::" msgstr "" #: ../../whatsnew/2.5.rst:2108 @@ -3343,13 +3349,13 @@ msgstr "" #: ../../whatsnew/2.5.rst:2117 msgid "" -"No official documentation has been written for the AST code yet, but :pep:" -"`339` discusses the design. To start learning about the code, read the " -"definition of the various AST nodes in :file:`Parser/Python.asdl`. A Python " -"script reads this file and generates a set of C structure definitions in :" -"file:`Include/Python-ast.h`. The :c:func:`PyParser_ASTFromString` and :c:" -"func:`!PyParser_ASTFromFile`, defined in :file:`Include/pythonrun.h`, take " -"Python source as input and return the root of an AST representing the " +"No official documentation has been written for the AST code yet, " +"but :pep:`339` discusses the design. To start learning about the code, read " +"the definition of the various AST nodes in :file:`Parser/Python.asdl`. A " +"Python script reads this file and generates a set of C structure definitions " +"in :file:`Include/Python-ast.h`. The :c:func:`PyParser_ASTFromString` " +"and :c:func:`!PyParser_ASTFromFile`, defined in :file:`Include/pythonrun.h`, " +"take Python source as input and return the root of an AST representing the " "contents. This AST can then be turned into a code object by :c:func:`!" "PyAST_Compile`. For more information, read the source code, and then ask " "questions on python-dev." @@ -3379,31 +3385,32 @@ msgstr "" msgid "" "Note that this change means extension modules must be more careful when " "allocating memory. Python's API has many different functions for allocating " -"memory that are grouped into families. For example, :c:func:" -"`PyMem_Malloc`, :c:func:`PyMem_Realloc`, and :c:func:`PyMem_Free` are one " -"family that allocates raw memory, while :c:func:`PyObject_Malloc`, :c:func:" -"`PyObject_Realloc`, and :c:func:`PyObject_Free` are another family that's " -"supposed to be used for creating Python objects." +"memory that are grouped into families. For " +"example, :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, " +"and :c:func:`PyMem_Free` are one family that allocates raw memory, " +"while :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, " +"and :c:func:`PyObject_Free` are another family that's supposed to be used " +"for creating Python objects." msgstr "" #: ../../whatsnew/2.5.rst:2152 msgid "" -"Previously these different families all reduced to the platform's :c:func:" -"`malloc` and :c:func:`free` functions. This meant it didn't matter if you " -"got things wrong and allocated memory with the ``PyMem`` function but freed " -"it with the ``PyObject`` function. With 2.5's changes to obmalloc, these " -"families now do different things and mismatches will probably result in a " -"segfault. You should carefully test your C extension modules with Python " -"2.5." +"Previously these different families all reduced to the " +"platform's :c:func:`malloc` and :c:func:`free` functions. This meant it " +"didn't matter if you got things wrong and allocated memory with the " +"``PyMem`` function but freed it with the ``PyObject`` function. With 2.5's " +"changes to obmalloc, these families now do different things and mismatches " +"will probably result in a segfault. You should carefully test your C " +"extension modules with Python 2.5." msgstr "" #: ../../whatsnew/2.5.rst:2159 msgid "" "The built-in set types now have an official C API. Call :c:func:`PySet_New` " -"and :c:func:`PyFrozenSet_New` to create a new set, :c:func:`PySet_Add` and :" -"c:func:`PySet_Discard` to add and remove elements, and :c:func:" -"`PySet_Contains` and :c:func:`PySet_Size` to examine the set's state. " -"(Contributed by Raymond Hettinger.)" +"and :c:func:`PyFrozenSet_New` to create a new set, :c:func:`PySet_Add` " +"and :c:func:`PySet_Discard` to add and remove elements, " +"and :c:func:`PySet_Contains` and :c:func:`PySet_Size` to examine the set's " +"state. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.5.rst:2165 @@ -3421,9 +3428,9 @@ msgid "" "``Py_LOCAL(type)`` declares the function as returning a value of the " "specified *type* and uses a fast-calling qualifier. " "``Py_LOCAL_INLINE(type)`` does the same thing and also requests the function " -"be inlined. If macro :c:macro:`!PY_LOCAL_AGGRESSIVE` is defined before :" -"file:`python.h` is included, a set of more aggressive optimizations are " -"enabled for the module; you should benchmark the results to find out if " +"be inlined. If macro :c:macro:`!PY_LOCAL_AGGRESSIVE` is defined " +"before :file:`python.h` is included, a set of more aggressive optimizations " +"are enabled for the module; you should benchmark the results to find out if " "these optimizations actually make the code faster. (Contributed by Fredrik " "Lundh at the NeedForSpeed sprint.)" msgstr "" @@ -3472,14 +3479,14 @@ msgstr "" #: ../../whatsnew/2.5.rst:2210 msgid "" -"MacOS X (10.3 and higher): dynamic loading of modules now uses the :c:func:" -"`dlopen` function instead of MacOS-specific functions." +"MacOS X (10.3 and higher): dynamic loading of modules now uses " +"the :c:func:`dlopen` function instead of MacOS-specific functions." msgstr "" #: ../../whatsnew/2.5.rst:2213 msgid "" -"MacOS X: an :option:`!--enable-universalsdk` switch was added to the :" -"program:`configure` script that compiles the interpreter as a universal " +"MacOS X: an :option:`!--enable-universalsdk` switch was added to " +"the :program:`configure` script that compiles the interpreter as a universal " "binary able to run on both PowerPC and Intel processors. (Contributed by " "Ronald Oussoren; :issue:`2573`.)" msgstr "" @@ -3512,8 +3519,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:2238 msgid "" "Previously, the :attr:`gi_frame` attribute of a generator was always a frame " -"object. Because of the :pep:`342` changes described in section :ref:" -"`pep-342`, it's now possible for :attr:`gi_frame` to be ``None``." +"object. Because of the :pep:`342` changes described in " +"section :ref:`pep-342`, it's now possible for :attr:`gi_frame` to be " +"``None``." msgstr "" #: ../../whatsnew/2.5.rst:2242 @@ -3550,11 +3558,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:2261 msgid "" -"Library: The :mod:`SimpleXMLRPCServer <xmlrpc.server>` and :mod:" -"`DocXMLRPCServer <xmlrpc.server>` classes now have a :attr:`rpc_paths` " -"attribute that constrains XML-RPC operations to a limited set of URL paths; " -"the default is to allow only ``'/'`` and ``'/RPC2'``. Setting :attr:" -"`rpc_paths` to ``None`` or an empty tuple disables this path checking." +"Library: The :mod:`SimpleXMLRPCServer <xmlrpc.server>` " +"and :mod:`DocXMLRPCServer <xmlrpc.server>` classes now have " +"a :attr:`rpc_paths` attribute that constrains XML-RPC operations to a " +"limited set of URL paths; the default is to allow only ``'/'`` and ``'/" +"RPC2'``. Setting :attr:`rpc_paths` to ``None`` or an empty tuple disables " +"this path checking." msgstr "" #: ../../whatsnew/2.5.rst:2267 diff --git a/whatsnew/2.6.po b/whatsnew/2.6.po index a7e0c2a770..029e00fe3a 100644 --- a/whatsnew/2.6.po +++ b/whatsnew/2.6.po @@ -44,8 +44,9 @@ msgid "" "incorporates new features and syntax from 3.0 while remaining compatible " "with existing code by not removing older features or syntax. When it's not " "possible to do that, Python 2.6 tries to do what it can, adding " -"compatibility functions in a :mod:`future_builtins` module and a :option:" -"`!-3` switch to warn about usages that will become unsupported in 3.0." +"compatibility functions in a :mod:`future_builtins` module and " +"a :option:`!-3` switch to warn about usages that will become unsupported in " +"3.0." msgstr "" #: ../../whatsnew/2.6.rst:62 @@ -106,8 +107,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:106 msgid "" -"The addition of :func:`functools.reduce` as a synonym for the built-in :func:" -"`reduce` function." +"The addition of :func:`functools.reduce` as a synonym for the built-" +"in :func:`reduce` function." msgstr "" #: ../../whatsnew/2.6.rst:109 @@ -125,16 +126,17 @@ msgid "" "A new command-line switch, :option:`!-3`, enables warnings about features " "that will be removed in Python 3.0. You can run code with this switch to " "see how much work will be necessary to port code to 3.0. The value of this " -"switch is available to Python code as the boolean variable :data:`sys." -"py3kwarning`, and to C extension code as :c:data:`!Py_Py3kWarningFlag`." +"switch is available to Python code as the boolean " +"variable :data:`sys.py3kwarning`, and to C extension code as :c:data:`!" +"Py_Py3kWarningFlag`." msgstr "" #: ../../whatsnew/2.6.rst:126 msgid "" -"The 3\\ *xxx* series of PEPs, which contains proposals for Python 3.0. :pep:" -"`3000` describes the development process for Python 3.0. Start with :pep:" -"`3100` that describes the general goals for Python 3.0, and then explore the " -"higher-numbered PEPs that propose specific features." +"The 3\\ *xxx* series of PEPs, which contains proposals for Python " +"3.0. :pep:`3000` describes the development process for Python 3.0. Start " +"with :pep:`3100` that describes the general goals for Python 3.0, and then " +"explore the higher-numbered PEPs that propose specific features." msgstr "" #: ../../whatsnew/2.6.rst:134 @@ -167,8 +169,8 @@ msgid "" "posted a call for issue trackers, asking volunteers to set up different " "products and import some of the bugs and patches from SourceForge. Four " "different trackers were examined: `Jira <https://www.atlassian.com/software/" -"jira/>`__, `Launchpad <https://launchpad.net/>`__, `Roundup <https://roundup." -"sourceforge.io/>`__, and `Trac <https://trac.edgewall.org/>`__. The " +"jira/>`__, `Launchpad <https://launchpad.net/>`__, `Roundup <https://" +"roundup.sourceforge.io/>`__, and `Trac <https://trac.edgewall.org/>`__. The " "committee eventually settled on Jira and Roundup as the two candidates. " "Jira is a commercial product that offers no-cost hosted instances to free-" "software projects; Roundup is an open-source project that requires " @@ -190,8 +192,8 @@ msgid "" "Hosting of the Python bug tracker is kindly provided by `Upfront Systems " "<https://upfrontsoftware.co.za>`__ of Stellenbosch, South Africa. Martin " "von Löwis put a lot of effort into importing existing bugs and patches from " -"SourceForge; his scripts for this import operation are at ``https://svn." -"python.org/view/tracker/importer/`` and may be useful to other projects " +"SourceForge; his scripts for this import operation are at ``https://" +"svn.python.org/view/tracker/importer/`` and may be useful to other projects " "wishing to move from SourceForge to Roundup." msgstr "" @@ -271,9 +273,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:226 msgid "" "Sphinx is a standalone package that can be used for writing, and almost two " -"dozen other projects (`listed on the Sphinx web site <https://www.sphinx-doc." -"org/en/master/examples.html>`__) have adopted Sphinx as their documentation " -"tool." +"dozen other projects (`listed on the Sphinx web site <https://www.sphinx-" +"doc.org/en/master/examples.html>`__) have adopted Sphinx as their " +"documentation tool." msgstr "" #: ../../whatsnew/2.6.rst:233 @@ -341,8 +343,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:269 msgid "" "The expression is evaluated, and it should result in an object that supports " -"the context management protocol (that is, has :meth:`~object.__enter__` and :" -"meth:`~object.__exit__` methods)." +"the context management protocol (that is, has :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods)." msgstr "" #: ../../whatsnew/2.6.rst:273 @@ -355,9 +357,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:278 msgid "" -"After execution of the *with-block* is finished, the object's :meth:`~object." -"__exit__` method is called, even if the block raised an exception, and can " -"therefore run clean-up code." +"After execution of the *with-block* is finished, the " +"object's :meth:`~object.__exit__` method is called, even if the block raised " +"an exception, and can therefore run clean-up code." msgstr "" #: ../../whatsnew/2.6.rst:282 @@ -388,8 +390,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:296 msgid "" -"In this case, *f* is the same object created by :func:`open`, because :meth:" -"`~object.__enter__` returns *self*." +"In this case, *f* is the same object created by :func:`open`, " +"because :meth:`~object.__enter__` returns *self*." msgstr "" #: ../../whatsnew/2.6.rst:299 @@ -453,8 +455,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:339 msgid "" "The expression is evaluated and should result in an object called a " -"\"context manager\". The context manager must have :meth:`~object." -"__enter__` and :meth:`~object.__exit__` methods." +"\"context manager\". The context manager must " +"have :meth:`~object.__enter__` and :meth:`~object.__exit__` methods." msgstr "" #: ../../whatsnew/2.6.rst:343 @@ -470,15 +472,15 @@ msgstr "*BLOCK* 中的程式碼會被執行。" #: ../../whatsnew/2.6.rst:349 msgid "" -"If *BLOCK* raises an exception, the context manager's :meth:`~object." -"__exit__` method is called with three arguments, the exception details " -"(``type, value, traceback``, the same values returned by :func:`sys." -"exc_info`, which can also be ``None`` if no exception occurred). The " -"method's return value controls whether an exception is re-raised: any false " -"value re-raises the exception, and ``True`` will result in suppressing it. " -"You'll only rarely want to suppress the exception, because if you do the " -"author of the code containing the ':keyword:`with`' statement will never " -"realize anything went wrong." +"If *BLOCK* raises an exception, the context " +"manager's :meth:`~object.__exit__` method is called with three arguments, " +"the exception details (``type, value, traceback``, the same values returned " +"by :func:`sys.exc_info`, which can also be ``None`` if no exception " +"occurred). The method's return value controls whether an exception is re-" +"raised: any false value re-raises the exception, and ``True`` will result in " +"suppressing it. You'll only rarely want to suppress the exception, because " +"if you do the author of the code containing the ':keyword:`with`' statement " +"will never realize anything went wrong." msgstr "" #: ../../whatsnew/2.6.rst:358 @@ -525,8 +527,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:379 msgid "" "The transaction should be committed if the code in the block runs flawlessly " -"or rolled back if there's an exception. Here's the basic interface for :" -"class:`DatabaseConnection` that I'll assume::" +"or rolled back if there's an exception. Here's the basic interface " +"for :class:`DatabaseConnection` that I'll assume::" msgstr "" #: ../../whatsnew/2.6.rst:383 @@ -606,8 +608,8 @@ msgid "" "generator function instead of defining a new class. The generator should " "yield exactly one value. The code up to the :keyword:`yield` will be " "executed as the :meth:`~object.__enter__` method, and the value yielded will " -"be the method's return value that will get bound to the variable in the ':" -"keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " +"be the method's return value that will get bound to the variable in the " +"':keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " "the :keyword:`!yield` will be executed in the :meth:`~object.__exit__` " "method. Any exception raised in the block will be raised by the :keyword:`!" "yield` statement." @@ -777,9 +779,9 @@ msgid "" "If you don't like the default directory, it can be overridden by an " "environment variable. :envvar:`PYTHONUSERBASE` sets the root directory used " "for all Python versions supporting this feature. On Windows, the directory " -"for application-specific data can be changed by setting the :envvar:" -"`APPDATA` environment variable. You can also modify the :file:`site.py` " -"file for your Python installation." +"for application-specific data can be changed by setting " +"the :envvar:`APPDATA` environment variable. You can also modify " +"the :file:`site.py` file for your Python installation." msgstr "" #: ../../whatsnew/2.6.rst:544 @@ -811,14 +813,15 @@ msgstr "" #: ../../whatsnew/2.6.rst:567 msgid "" -"The :mod:`multiprocessing` module started out as an exact emulation of the :" -"mod:`threading` module using processes instead of threads. That goal was " -"discarded along the path to Python 2.6, but the general approach of the " +"The :mod:`multiprocessing` module started out as an exact emulation of " +"the :mod:`threading` module using processes instead of threads. That goal " +"was discarded along the path to Python 2.6, but the general approach of the " "module is still similar. The fundamental class is the :class:`Process`, " -"which is passed a callable object and a collection of arguments. The :meth:" -"`start` method sets the callable running in a subprocess, after which you " -"can call the :meth:`is_alive` method to check whether the subprocess is " -"still running and the :meth:`join` method to wait for the process to exit." +"which is passed a callable object and a collection of arguments. " +"The :meth:`start` method sets the callable running in a subprocess, after " +"which you can call the :meth:`is_alive` method to check whether the " +"subprocess is still running and the :meth:`join` method to wait for the " +"process to exit." msgstr "" #: ../../whatsnew/2.6.rst:577 @@ -905,10 +908,10 @@ msgid "" "Two other classes, :class:`Pool` and :class:`Manager`, provide higher-level " "interfaces. :class:`Pool` will create a fixed number of worker processes, " "and requests can then be distributed to the workers by calling :meth:`apply` " -"or :meth:`apply_async` to add a single request, and :meth:`map` or :meth:" -"`map_async` to add a number of requests. The following code uses a :class:" -"`Pool` to spread requests across 5 worker processes and retrieve a list of " -"results::" +"or :meth:`apply_async` to add a single request, and :meth:`map` " +"or :meth:`map_async` to add a number of requests. The following code uses " +"a :class:`Pool` to spread requests across 5 worker processes and retrieve a " +"list of results::" msgstr "" #: ../../whatsnew/2.6.rst:630 @@ -1086,8 +1089,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:744 msgid "" ">>> import sys\n" -">>> print 'Platform: {0.platform}\\nPython version: {0.version}'." -"format(sys)\n" +">>> print 'Platform: {0.platform}\\nPython version: " +"{0.version}'.format(sys)\n" "Platform: darwin\n" "Python version: 2.6a1+ (trunk:61261M, Mar 5 2008, 20:29:41)\n" "[GCC 4.0.1 (Apple Computer, Inc. build 5367)]'\n" @@ -1097,8 +1100,8 @@ msgid "" "'Content-type: video/mp4'" msgstr "" ">>> import sys\n" -">>> print 'Platform: {0.platform}\\nPython version: {0.version}'." -"format(sys)\n" +">>> print 'Platform: {0.platform}\\nPython version: " +"{0.version}'.format(sys)\n" "Platform: darwin\n" "Python version: 2.6a1+ (trunk:61261M, Mar 5 2008, 20:29:41)\n" "[GCC 4.0.1 (Apple Computer, Inc. build 5367)]'\n" @@ -1442,11 +1445,12 @@ msgstr "" #: ../../whatsnew/2.6.rst:902 msgid "" -"The author is probably trying to catch both :exc:`TypeError` and :exc:" -"`ValueError` exceptions, but this code actually does something different: it " -"will catch :exc:`TypeError` and bind the resulting exception object to the " -"local name ``\"ValueError\"``. The :exc:`ValueError` exception will not be " -"caught at all. The correct code specifies a tuple of exceptions::" +"The author is probably trying to catch both :exc:`TypeError` " +"and :exc:`ValueError` exceptions, but this code actually does something " +"different: it will catch :exc:`TypeError` and bind the resulting exception " +"object to the local name ``\"ValueError\"``. The :exc:`ValueError` " +"exception will not be caught at all. The correct code specifies a tuple of " +"exceptions::" msgstr "" #: ../../whatsnew/2.6.rst:909 @@ -1511,10 +1515,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:945 msgid "" "Python 3.0 adopts Unicode as the language's fundamental string type and " -"denotes 8-bit literals differently, either as ``b'string'`` or using a :" -"class:`bytes` constructor. For future compatibility, Python 2.6 adds :class:" -"`bytes` as a synonym for the :class:`str` type, and it also supports the " -"``b''`` notation." +"denotes 8-bit literals differently, either as ``b'string'`` or using " +"a :class:`bytes` constructor. For future compatibility, Python 2.6 " +"adds :class:`bytes` as a synonym for the :class:`str` type, and it also " +"supports the ``b''`` notation." msgstr "" #: ../../whatsnew/2.6.rst:952 @@ -1522,8 +1526,8 @@ msgid "" "The 2.6 :class:`str` differs from 3.0's :class:`bytes` type in various ways; " "most notably, the constructor is completely different. In 3.0, ``bytes([65, " "66, 67])`` is 3 elements long, containing the bytes representing ``ABC``; in " -"2.6, ``bytes([65, 66, 67])`` returns the 12-byte string representing the :" -"func:`str` of the list." +"2.6, ``bytes([65, 66, 67])`` returns the 12-byte string representing " +"the :func:`str` of the list." msgstr "" #: ../../whatsnew/2.6.rst:958 @@ -1531,9 +1535,9 @@ msgid "" "The primary use of :class:`bytes` in 2.6 will be to write tests of object " "type such as ``isinstance(x, bytes)``. This will help the 2to3 converter, " "which can't tell whether 2.x code intends strings to contain either " -"characters or 8-bit bytes; you can now use either :class:`bytes` or :class:" -"`str` to represent your intention exactly, and the resulting code will also " -"be correct in Python 3.0." +"characters or 8-bit bytes; you can now use either :class:`bytes` " +"or :class:`str` to represent your intention exactly, and the resulting code " +"will also be correct in Python 3.0." msgstr "" #: ../../whatsnew/2.6.rst:965 @@ -1563,10 +1567,9 @@ msgstr "" msgid "" "At the C level, Python 3.0 will rename the existing 8-bit string type, " "called :c:type:`!PyStringObject` in Python 2.x, to :c:type:`PyBytesObject`. " -"Python 2.6 uses ``#define`` to support using the names :c:func:" -"`PyBytesObject`, :c:func:`PyBytes_Check`, :c:func:" -"`PyBytes_FromStringAndSize`, and all the other functions and macros used " -"with strings." +"Python 2.6 uses ``#define`` to support using the " +"names :c:func:`PyBytesObject`, :c:func:`PyBytes_Check`, :c:func:`PyBytes_FromStringAndSize`, " +"and all the other functions and macros used with strings." msgstr "" #: ../../whatsnew/2.6.rst:984 @@ -1601,9 +1604,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:999 msgid "" -"Byte arrays support most of the methods of string types, such as :meth:" -"`startswith`/:meth:`endswith`, :meth:`find`/:meth:`rfind`, and some of the " -"methods of lists, such as :meth:`append`, :meth:`pop`, and :meth:`reverse`." +"Byte arrays support most of the methods of string types, such " +"as :meth:`startswith`/:meth:`endswith`, :meth:`find`/:meth:`rfind`, and some " +"of the methods of lists, such as :meth:`append`, :meth:`pop`, " +"and :meth:`reverse`." msgstr "" #: ../../whatsnew/2.6.rst:1006 @@ -1622,8 +1626,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:1012 msgid "" -"There's also a corresponding C API, with :c:func:`PyByteArray_FromObject`, :" -"c:func:`PyByteArray_FromStringAndSize`, and various other functions." +"There's also a corresponding C API, " +"with :c:func:`PyByteArray_FromObject`, :c:func:`PyByteArray_FromStringAndSize`, " +"and various other functions." msgstr "" #: ../../whatsnew/2.6.rst:1019 @@ -1642,10 +1647,10 @@ msgstr "PEP 3116:新 I/O 函式庫" msgid "" "Python's built-in file objects support a number of methods, but file-like " "objects don't necessarily support all of them. Objects that imitate files " -"usually support :meth:`read` and :meth:`write`, but they may not support :" -"meth:`readline`, for example. Python 3.0 introduces a layered I/O library " -"in the :mod:`io` module that separates buffering and text-handling features " -"from the fundamental read and write operations." +"usually support :meth:`read` and :meth:`write`, but they may not " +"support :meth:`readline`, for example. Python 3.0 introduces a layered I/O " +"library in the :mod:`io` module that separates buffering and text-handling " +"features from the fundamental read and write operations." msgstr "" #: ../../whatsnew/2.6.rst:1037 @@ -1656,12 +1661,12 @@ msgstr "" #: ../../whatsnew/2.6.rst:1040 msgid "" -":class:`RawIOBase` defines raw I/O operations: :meth:`read`, :meth:" -"`readinto`, :meth:`write`, :meth:`seek`, :meth:`tell`, :meth:`truncate`, " +":class:`RawIOBase` defines raw I/O " +"operations: :meth:`read`, :meth:`readinto`, :meth:`write`, :meth:`seek`, :meth:`tell`, :meth:`truncate`, " "and :meth:`close`. Most of the methods of this class will often map to a " -"single system call. There are also :meth:`readable`, :meth:`writable`, and :" -"meth:`seekable` methods for determining what operations a given object will " -"allow." +"single system call. There are also :meth:`readable`, :meth:`writable`, " +"and :meth:`seekable` methods for determining what operations a given object " +"will allow." msgstr "" #: ../../whatsnew/2.6.rst:1048 @@ -1674,37 +1679,37 @@ msgstr "" msgid "" ":class:`BufferedIOBase` is an abstract base class that buffers data in " "memory to reduce the number of system calls used, making I/O processing more " -"efficient. It supports all of the methods of :class:`RawIOBase`, and adds a :" -"attr:`raw` attribute holding the underlying raw object." +"efficient. It supports all of the methods of :class:`RawIOBase`, and adds " +"a :attr:`raw` attribute holding the underlying raw object." msgstr "" #: ../../whatsnew/2.6.rst:1058 msgid "" -"There are five concrete classes implementing this ABC. :class:" -"`BufferedWriter` and :class:`BufferedReader` are for objects that support " -"write-only or read-only usage that have a :meth:`seek` method for random " -"access. :class:`BufferedRandom` objects support read and write access upon " -"the same underlying stream, and :class:`BufferedRWPair` is for objects such " -"as TTYs that have both read and write operations acting upon unconnected " -"streams of data. The :class:`BytesIO` class supports reading, writing, and " -"seeking over an in-memory buffer." +"There are five concrete classes implementing this " +"ABC. :class:`BufferedWriter` and :class:`BufferedReader` are for objects " +"that support write-only or read-only usage that have a :meth:`seek` method " +"for random access. :class:`BufferedRandom` objects support read and write " +"access upon the same underlying stream, and :class:`BufferedRWPair` is for " +"objects such as TTYs that have both read and write operations acting upon " +"unconnected streams of data. The :class:`BytesIO` class supports reading, " +"writing, and seeking over an in-memory buffer." msgstr "" #: ../../whatsnew/2.6.rst:1071 msgid "" ":class:`TextIOBase`: Provides functions for reading and writing strings " -"(remember, strings will be Unicode in Python 3.0), and supporting :term:" -"`universal newlines`. :class:`TextIOBase` defines the :meth:`readline` " -"method and supports iteration upon objects." +"(remember, strings will be Unicode in Python 3.0), and " +"supporting :term:`universal newlines`. :class:`TextIOBase` defines " +"the :meth:`readline` method and supports iteration upon objects." msgstr "" #: ../../whatsnew/2.6.rst:1077 msgid "" "There are two concrete implementations. :class:`TextIOWrapper` wraps a " "buffered I/O object, supporting all of the methods for text I/O and adding " -"a :attr:`buffer` attribute for access to the underlying object. :class:" -"`StringIO` simply buffers everything in memory without ever writing anything " -"to disk." +"a :attr:`buffer` attribute for access to the underlying " +"object. :class:`StringIO` simply buffers everything in memory without ever " +"writing anything to disk." msgstr "" #: ../../whatsnew/2.6.rst:1083 @@ -1831,19 +1836,19 @@ msgid "" "It probably means that accessing items with ``obj[1]`` works. Does it imply " "that setting items with ``obj[2] = value`` works? Or that the object will " "have :meth:`keys`, :meth:`values`, and :meth:`items` methods? What about " -"the iterative variants such as :meth:`iterkeys`? :meth:`copy` and :meth:" -"`update`? Iterating over the object with :func:`iter`?" +"the iterative variants such as :meth:`iterkeys`? :meth:`copy` " +"and :meth:`update`? Iterating over the object with :func:`iter`?" msgstr "" #: ../../whatsnew/2.6.rst:1178 msgid "" "The Python 2.6 :mod:`collections` module includes a number of different ABCs " "that represent these distinctions. :class:`Iterable` indicates that a class " -"defines :meth:`__iter__`, and :class:`Container` means the class defines a :" -"meth:`__contains__` method and therefore supports ``x in y`` expressions. " -"The basic dictionary interface of getting items, setting items, and :meth:" -"`keys`, :meth:`values`, and :meth:`items`, is defined by the :class:" -"`MutableMapping` ABC." +"defines :meth:`__iter__`, and :class:`Container` means the class defines " +"a :meth:`__contains__` method and therefore supports ``x in y`` " +"expressions. The basic dictionary interface of getting items, setting " +"items, and :meth:`keys`, :meth:`values`, and :meth:`items`, is defined by " +"the :class:`MutableMapping` ABC." msgstr "" #: ../../whatsnew/2.6.rst:1187 @@ -1889,11 +1894,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:1207 msgid "" -"For classes that you write, deriving from the ABC is probably clearer. The :" -"meth:`register` method is useful when you've written a new ABC that can " -"describe an existing type or class, or if you want to declare that some " -"third-party class implements an ABC. For example, if you defined a :class:" -"`PrintableType` ABC, it's legal to do::" +"For classes that you write, deriving from the ABC is probably clearer. " +"The :meth:`register` method is useful when you've written a new ABC that " +"can describe an existing type or class, or if you want to declare that some " +"third-party class implements an ABC. For example, if you defined " +"a :class:`PrintableType` ABC, it's legal to do::" msgstr "" #: ../../whatsnew/2.6.rst:1214 @@ -1988,18 +1993,19 @@ msgid "" "In the :class:`Drawable` ABC above, the :meth:`draw_doubled` method renders " "the object at twice its size and can be implemented in terms of other " "methods described in :class:`Drawable`. Classes implementing this ABC " -"therefore don't need to provide their own implementation of :meth:" -"`draw_doubled`, though they can do so. An implementation of :meth:`draw` is " -"necessary, though; the ABC can't provide a useful generic implementation." +"therefore don't need to provide their own implementation " +"of :meth:`draw_doubled`, though they can do so. An implementation " +"of :meth:`draw` is necessary, though; the ABC can't provide a useful generic " +"implementation." msgstr "" #: ../../whatsnew/2.6.rst:1266 msgid "" -"You can apply the ``@abstractmethod`` decorator to methods such as :meth:" -"`draw` that must be implemented; Python will then raise an exception for " -"classes that don't define the method. Note that the exception is only raised " -"when you actually try to create an instance of a subclass lacking the " -"method::" +"You can apply the ``@abstractmethod`` decorator to methods such " +"as :meth:`draw` that must be implemented; Python will then raise an " +"exception for classes that don't define the method. Note that the exception " +"is only raised when you actually try to create an instance of a subclass " +"lacking the method::" msgstr "" #: ../../whatsnew/2.6.rst:1272 @@ -2201,8 +2207,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:1386 msgid "" "Python 3.0 adds several abstract base classes for numeric types inspired by " -"Scheme's numeric tower. These classes were backported to 2.6 as the :mod:" -"`numbers` module." +"Scheme's numeric tower. These classes were backported to 2.6 as " +"the :mod:`numbers` module." msgstr "" #: ../../whatsnew/2.6.rst:1390 @@ -2232,9 +2238,9 @@ msgstr "" msgid "" ":class:`Rational` numbers derive from :class:`Real`, have :attr:`numerator` " "and :attr:`denominator` properties, and can be converted to floats. Python " -"2.6 adds a simple rational-number class, :class:`Fraction`, in the :mod:" -"`fractions` module. (It's called :class:`Fraction` instead of :class:" -"`Rational` to avoid a name clash with :class:`numbers.Rational`.)" +"2.6 adds a simple rational-number class, :class:`Fraction`, in " +"the :mod:`fractions` module. (It's called :class:`Fraction` instead " +"of :class:`Rational` to avoid a name clash with :class:`numbers.Rational`.)" msgstr "" #: ../../whatsnew/2.6.rst:1412 @@ -2247,11 +2253,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:1417 msgid "" -"In Python 3.0, the PEP slightly redefines the existing builtins :func:" -"`round`, :func:`math.floor`, :func:`math.ceil`, and adds a new one, :func:" -"`math.trunc`, that's been backported to Python 2.6. :func:`math.trunc` " -"rounds toward zero, returning the closest :class:`Integral` that's between " -"the function's argument and zero." +"In Python 3.0, the PEP slightly redefines the existing " +"builtins :func:`round`, :func:`math.floor`, :func:`math.ceil`, and adds a " +"new one, :func:`math.trunc`, that's been backported to Python " +"2.6. :func:`math.trunc` rounds toward zero, returning the " +"closest :class:`Integral` that's between the function's argument and zero." msgstr "" #: ../../whatsnew/2.6.rst:1425 @@ -2374,10 +2380,10 @@ msgid "" "The :func:`hasattr` function was catching and ignoring all errors, under the " "assumption that they meant a :meth:`__getattr__` method was failing somehow " "and the return value of :func:`hasattr` would therefore be ``False``. This " -"logic shouldn't be applied to :exc:`KeyboardInterrupt` and :exc:" -"`SystemExit`, however; Python 2.6 will no longer discard such exceptions " -"when :func:`hasattr` encounters them. (Fixed by Benjamin Peterson; :issue:" -"`2196`.)" +"logic shouldn't be applied to :exc:`KeyboardInterrupt` " +"and :exc:`SystemExit`, however; Python 2.6 will no longer discard such " +"exceptions when :func:`hasattr` encounters them. (Fixed by Benjamin " +"Peterson; :issue:`2196`.)" msgstr "" #: ../../whatsnew/2.6.rst:1498 @@ -2441,8 +2447,9 @@ msgstr "" msgid "" "A new builtin, ``next(iterator, [default])`` returns the next item from the " "specified iterator. If the *default* argument is supplied, it will be " -"returned if *iterator* has been exhausted; otherwise, the :exc:" -"`StopIteration` exception will be raised. (Backported in :issue:`2719`.)" +"returned if *iterator* has been exhausted; otherwise, " +"the :exc:`StopIteration` exception will be raised. (Backported " +"in :issue:`2719`.)" msgstr "" #: ../../whatsnew/2.6.rst:1531 @@ -2474,10 +2481,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:1549 msgid "" -"Properties now have three attributes, :attr:`getter`, :attr:`setter` and :" -"attr:`deleter`, that are decorators providing useful shortcuts for adding a " -"getter, setter or deleter function to an existing property. You would use " -"them like this::" +"Properties now have three attributes, :attr:`getter`, :attr:`setter` " +"and :attr:`deleter`, that are decorators providing useful shortcuts for " +"adding a getter, setter or deleter function to an existing property. You " +"would use them like this::" msgstr "" #: ../../whatsnew/2.6.rst:1554 @@ -2528,9 +2535,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:1576 msgid "" -"Several methods of the built-in set types now accept multiple iterables: :" -"meth:`intersection`, :meth:`intersection_update`, :meth:`union`, :meth:" -"`update`, :meth:`difference` and :meth:`difference_update`." +"Several methods of the built-in set types now accept multiple " +"iterables: :meth:`intersection`, :meth:`intersection_update`, :meth:`union`, :meth:`update`, :meth:`difference` " +"and :meth:`difference_update`." msgstr "" #: ../../whatsnew/2.6.rst:1584 @@ -2552,15 +2559,15 @@ msgid "" "Many floating-point features were added. The :func:`float` function will " "now turn the string ``nan`` into an IEEE 754 Not A Number value, and " "``+inf`` and ``-inf`` into positive or negative infinity. This works on any " -"platform with IEEE 754 semantics. (Contributed by Christian Heimes; :issue:" -"`1635`.)" +"platform with IEEE 754 semantics. (Contributed by Christian " +"Heimes; :issue:`1635`.)" msgstr "" #: ../../whatsnew/2.6.rst:1598 msgid "" "Other functions in the :mod:`math` module, :func:`isinf` and :func:`isnan`, " -"return true if their floating-point argument is infinite or Not A Number. (:" -"issue:`1640`)" +"return true if their floating-point argument is infinite or Not A Number. " +"(:issue:`1640`)" msgstr "" #: ../../whatsnew/2.6.rst:1602 @@ -2616,9 +2623,9 @@ msgid "" "objects have a default hash method that uses ``id(obj)`` as the hash value. " "There's no tidy way to remove the :meth:`__hash__` method inherited from a " "parent class, so assigning ``None`` was implemented as an override. At the " -"C level, extensions can set ``tp_hash`` to :c:func:" -"`PyObject_HashNotImplemented`. (Fixed by Nick Coghlan and Amaury Forgeot " -"d'Arc; :issue:`2235`.)" +"C level, extensions can set ``tp_hash`` " +"to :c:func:`PyObject_HashNotImplemented`. (Fixed by Nick Coghlan and Amaury " +"Forgeot d'Arc; :issue:`2235`.)" msgstr "" #: ../../whatsnew/2.6.rst:1640 @@ -2632,8 +2639,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:1646 msgid "" "Generator objects now have a :attr:`gi_code` attribute that refers to the " -"original code object backing the generator. (Contributed by Collin Winter; :" -"issue:`1473257`.)" +"original code object backing the generator. (Contributed by Collin " +"Winter; :issue:`1473257`.)" msgstr "" #: ../../whatsnew/2.6.rst:1650 @@ -2646,8 +2653,8 @@ msgstr "" msgid "" "The :func:`complex` constructor now accepts strings containing parenthesized " "complex numbers, meaning that ``complex(repr(cplx))`` will now round-trip " -"values. For example, ``complex('(3+4j)')`` now returns the value (3+4j). (:" -"issue:`1491866`)" +"values. For example, ``complex('(3+4j)')`` now returns the value (3+4j). " +"(:issue:`1491866`)" msgstr "" #: ../../whatsnew/2.6.rst:1659 @@ -2655,8 +2662,8 @@ msgid "" "The string :meth:`translate` method now accepts ``None`` as the translation " "table parameter, which is treated as the identity transformation. This " "makes it easier to carry out operations that only delete characters. " -"(Contributed by Bengt Richter and implemented by Raymond Hettinger; :issue:" -"`1193128`.)" +"(Contributed by Bengt Richter and implemented by Raymond " +"Hettinger; :issue:`1193128`.)" msgstr "" #: ../../whatsnew/2.6.rst:1665 @@ -2664,26 +2671,26 @@ msgid "" "The built-in :func:`dir` function now checks for a :meth:`__dir__` method on " "the objects it receives. This method must return a list of strings " "containing the names of valid attributes for the object, and lets the object " -"control the value that :func:`dir` produces. Objects that have :meth:" -"`__getattr__` or :meth:`__getattribute__` methods can use this to advertise " -"pseudo-attributes they will honor. (:issue:`1591665`)" +"control the value that :func:`dir` produces. Objects that " +"have :meth:`__getattr__` or :meth:`__getattribute__` methods can use this to " +"advertise pseudo-attributes they will honor. (:issue:`1591665`)" msgstr "" #: ../../whatsnew/2.6.rst:1673 msgid "" "Instance method objects have new attributes for the object and function " -"comprising the method; the new synonym for :attr:`!im_self` is :attr:" -"`~method.__self__`, and :attr:`!im_func` is also available as :attr:`~method." -"__func__`. The old names are still supported in Python 2.6, but are gone in " -"3.0." +"comprising the method; the new synonym for :attr:`!im_self` " +"is :attr:`~method.__self__`, and :attr:`!im_func` is also available " +"as :attr:`~method.__func__`. The old names are still supported in Python " +"2.6, but are gone in 3.0." msgstr "" #: ../../whatsnew/2.6.rst:1679 msgid "" -"An obscure change: when you use the :func:`locals` function inside a :" -"keyword:`class` statement, the resulting dictionary no longer returns free " -"variables. (Free variables, in this case, are variables referenced in the :" -"keyword:`!class` statement that aren't attributes of the class.)" +"An obscure change: when you use the :func:`locals` function inside " +"a :keyword:`class` statement, the resulting dictionary no longer returns " +"free variables. (Free variables, in this case, are variables referenced in " +"the :keyword:`!class` statement that aren't attributes of the class.)" msgstr "" #: ../../whatsnew/2.6.rst:1688 @@ -2694,8 +2701,8 @@ msgstr "最佳化" msgid "" "The :mod:`warnings` module has been rewritten in C. This makes it possible " "to invoke warnings from the parser, and may also make the interpreter's " -"startup faster. (Contributed by Neal Norwitz and Brett Cannon; :issue:" -"`1631171`.)" +"startup faster. (Contributed by Neal Norwitz and Brett " +"Cannon; :issue:`1631171`.)" msgstr "" #: ../../whatsnew/2.6.rst:1695 @@ -2746,9 +2753,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:1729 msgid "" "Unicode strings now use faster code for detecting whitespace and line " -"breaks; this speeds up the :meth:`split` method by about 25% and :meth:" -"`splitlines` by 35%. (Contributed by Antoine Pitrou.) Memory usage is " -"reduced by using pymalloc for the Unicode string's data." +"breaks; this speeds up the :meth:`split` method by about 25% " +"and :meth:`splitlines` by 35%. (Contributed by Antoine Pitrou.) Memory " +"usage is reduced by using pymalloc for the Unicode string's data." msgstr "" #: ../../whatsnew/2.6.rst:1735 @@ -2851,8 +2858,8 @@ msgstr "" msgid "" "The :func:`parse_qs` and :func:`parse_qsl` functions have been relocated " "from the :mod:`!cgi` module to the :mod:`urlparse <urllib.parse>` module. " -"The versions still available in the :mod:`!cgi` module will trigger :exc:" -"`PendingDeprecationWarning` messages in 2.6 (:issue:`600362`)." +"The versions still available in the :mod:`!cgi` module will " +"trigger :exc:`PendingDeprecationWarning` messages in 2.6 (:issue:`600362`)." msgstr "" #: ../../whatsnew/2.6.rst:1815 @@ -2896,8 +2903,8 @@ msgid "" "The revisions also improved the numerical soundness of the :mod:`cmath` " "module. For all functions, the real and imaginary parts of the results are " "accurate to within a few units of least precision (ulps) whenever possible. " -"See :issue:`1381` for the details. The branch cuts for :func:`asinh`, :func:" -"`atanh`: and :func:`atan` have also been corrected." +"See :issue:`1381` for the details. The branch cuts " +"for :func:`asinh`, :func:`atanh`: and :func:`atan` have also been corrected." msgstr "" #: ../../whatsnew/2.6.rst:1841 @@ -2944,9 +2951,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:1870 msgid "" "Several places in the standard library that returned tuples have been " -"modified to return :func:`namedtuple` instances. For example, the :meth:" -"`Decimal.as_tuple` method now returns a named tuple with :attr:`sign`, :attr:" -"`digits`, and :attr:`exponent` fields." +"modified to return :func:`namedtuple` instances. For example, " +"the :meth:`Decimal.as_tuple` method now returns a named tuple " +"with :attr:`sign`, :attr:`digits`, and :attr:`exponent` fields." msgstr "" #: ../../whatsnew/2.6.rst:1877 @@ -2986,8 +2993,8 @@ msgid "" "The :mod:`Cookie <http.cookies>` module's :class:`~http.cookies.Morsel` " "objects now support an :attr:`~http.cookies.Morsel.httponly` attribute. In " "some browsers. cookies with this attribute set cannot be accessed or " -"manipulated by JavaScript code. (Contributed by Arvin Schnell; :issue:" -"`1638033`.)" +"manipulated by JavaScript code. (Contributed by Arvin " +"Schnell; :issue:`1638033`.)" msgstr "" #: ../../whatsnew/2.6.rst:1903 @@ -3008,16 +3015,16 @@ msgstr "" msgid "" "The :class:`Textbox` class in the :mod:`curses.textpad` module now supports " "editing in insert mode as well as overwrite mode. Insert mode is enabled by " -"supplying a true value for the *insert_mode* parameter when creating the :" -"class:`Textbox` instance." +"supplying a true value for the *insert_mode* parameter when creating " +"the :class:`Textbox` instance." msgstr "" #: ../../whatsnew/2.6.rst:1918 msgid "" "The :mod:`datetime` module's :meth:`strftime` methods now support a ``%f`` " "format code that expands to the number of microseconds in the object, zero-" -"padded on the left to six places. (Contributed by Skip Montanaro; :issue:" -"`1158`.)" +"padded on the left to six places. (Contributed by Skip " +"Montanaro; :issue:`1158`.)" msgstr "" #: ../../whatsnew/2.6.rst:1923 @@ -3066,20 +3073,21 @@ msgstr "" #: ../../whatsnew/2.6.rst:1946 msgid "" "An optional ``timeout`` parameter, specifying a timeout measured in seconds, " -"was added to the :class:`ftplib.FTP` class constructor as well as the :meth:" -"`connect` method. (Added by Facundo Batista.) Also, the :class:`FTP` " -"class's :meth:`storbinary` and :meth:`storlines` now take an optional " -"*callback* parameter that will be called with each block of data after the " -"data has been sent. (Contributed by Phil Schwartz; :issue:`1221598`.)" +"was added to the :class:`ftplib.FTP` class constructor as well as " +"the :meth:`connect` method. (Added by Facundo Batista.) Also, " +"the :class:`FTP` class's :meth:`storbinary` and :meth:`storlines` now take " +"an optional *callback* parameter that will be called with each block of data " +"after the data has been sent. (Contributed by Phil " +"Schwartz; :issue:`1221598`.)" msgstr "" #: ../../whatsnew/2.6.rst:1954 msgid "" -"The :func:`reduce` built-in function is also available in the :mod:" -"`functools` module. In Python 3.0, the builtin has been dropped and :func:" -"`reduce` is only available from :mod:`functools`; currently there are no " -"plans to drop the builtin in the 2.x series. (Patched by Christian Heimes; :" -"issue:`1739906`.)" +"The :func:`reduce` built-in function is also available in " +"the :mod:`functools` module. In Python 3.0, the builtin has been dropped " +"and :func:`reduce` is only available from :mod:`functools`; currently there " +"are no plans to drop the builtin in the 2.x series. (Patched by Christian " +"Heimes; :issue:`1739906`.)" msgstr "" #: ../../whatsnew/2.6.rst:1960 @@ -3094,8 +3102,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:1966 msgid "" "The :func:`glob.glob` function can now return Unicode filenames if a Unicode " -"path was used and Unicode filenames are matched within the directory. (:" -"issue:`1001604`)" +"path was used and Unicode filenames are matched within the directory. " +"(:issue:`1001604`)" msgstr "" #: ../../whatsnew/2.6.rst:1970 @@ -3124,17 +3132,18 @@ msgstr "" #: ../../whatsnew/2.6.rst:1983 msgid "" ":mod:`heapq` is now implemented to only use less-than comparison, instead of " -"the less-than-or-equal comparison it previously used. This makes :mod:" -"`heapq`'s usage of a type match the :meth:`list.sort` method. (Contributed " -"by Raymond Hettinger.)" +"the less-than-or-equal comparison it previously used. This " +"makes :mod:`heapq`'s usage of a type match the :meth:`list.sort` method. " +"(Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.6.rst:1989 msgid "" "An optional ``timeout`` parameter, specifying a timeout measured in seconds, " -"was added to the :class:`httplib.HTTPConnection <http.client." -"HTTPConnection>` and :class:`HTTPSConnection <http.client.HTTPSConnection>` " -"class constructors. (Added by Facundo Batista.)" +"was added to the :class:`httplib.HTTPConnection " +"<http.client.HTTPConnection>` and :class:`HTTPSConnection " +"<http.client.HTTPSConnection>` class constructors. (Added by Facundo " +"Batista.)" msgstr "" #: ../../whatsnew/2.6.rst:1994 @@ -3147,8 +3156,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:2000 msgid "" -"Some new functions in the module include :func:`isgenerator`, :func:" -"`isgeneratorfunction`, and :func:`isabstract`." +"Some new functions in the module " +"include :func:`isgenerator`, :func:`isgeneratorfunction`, " +"and :func:`isabstract`." msgstr "" #: ../../whatsnew/2.6.rst:2004 @@ -3272,10 +3282,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2060 msgid "" "``itertools.chain(*iterables)`` is an existing function in :mod:`itertools` " -"that gained a new constructor in Python 2.6. ``itertools.chain." -"from_iterable(iterable)`` takes a single iterable that should return other " -"iterables. :func:`chain` will then return all the elements of the first " -"iterable, then all the elements of the second, and so on. ::" +"that gained a new constructor in Python 2.6. " +"``itertools.chain.from_iterable(iterable)`` takes a single iterable that " +"should return other iterables. :func:`chain` will then return all the " +"elements of the first iterable, then all the elements of the second, and so " +"on. ::" msgstr "" #: ../../whatsnew/2.6.rst:2067 @@ -3292,11 +3303,12 @@ msgstr "" #: ../../whatsnew/2.6.rst:2072 msgid "" -"The :mod:`logging` module's :class:`FileHandler` class and its subclasses :" -"class:`WatchedFileHandler`, :class:`RotatingFileHandler`, and :class:" -"`TimedRotatingFileHandler` now have an optional *delay* parameter to their " -"constructors. If *delay* is true, opening of the log file is deferred until " -"the first :meth:`emit` call is made. (Contributed by Vinay Sajip.)" +"The :mod:`logging` module's :class:`FileHandler` class and its " +"subclasses :class:`WatchedFileHandler`, :class:`RotatingFileHandler`, " +"and :class:`TimedRotatingFileHandler` now have an optional *delay* parameter " +"to their constructors. If *delay* is true, opening of the log file is " +"deferred until the first :meth:`emit` call is made. (Contributed by Vinay " +"Sajip.)" msgstr "" #: ../../whatsnew/2.6.rst:2079 @@ -3348,9 +3360,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:2108 msgid "" -":func:`trunc` rounds a number toward zero, returning the closest :class:" -"`Integral` that's between the function's argument and zero. Added as part of " -"the backport of `PEP 3141's type hierarchy for numbers <#pep-3141>`__." +":func:`trunc` rounds a number toward zero, returning the " +"closest :class:`Integral` that's between the function's argument and zero. " +"Added as part of the backport of `PEP 3141's type hierarchy for numbers " +"<#pep-3141>`__." msgstr "" #: ../../whatsnew/2.6.rst:2113 @@ -3368,8 +3381,8 @@ msgid "" "``sqrt(float('NaN'))`` should return a NaN on all IEEE 754 platforms. Where " "Annex 'F' of the C99 standard recommends signaling 'divide-by-zero' or " "'invalid', Python will raise :exc:`ValueError`. Where Annex 'F' of the C99 " -"standard recommends signaling 'overflow', Python will raise :exc:" -"`OverflowError`. (See :issue:`711019` and :issue:`1640`.)" +"standard recommends signaling 'overflow', Python will " +"raise :exc:`OverflowError`. (See :issue:`711019` and :issue:`1640`.)" msgstr "" #: ../../whatsnew/2.6.rst:2127 @@ -3476,16 +3489,16 @@ msgid "" "In the :mod:`os.path` module, the :func:`splitext` function has been changed " "to not split on leading period characters. This produces better results when " "operating on Unix's dot-files. For example, ``os.path.splitext('.ipython')`` " -"now returns ``('.ipython', '')`` instead of ``('', '.ipython')``. (:issue:" -"`1115886`)" +"now returns ``('.ipython', '')`` instead of ``('', '.ipython')``. " +"(:issue:`1115886`)" msgstr "" #: ../../whatsnew/2.6.rst:2196 msgid "" "A new function, ``os.path.relpath(path, start='.')``, returns a relative " "path from the ``start`` path, if it's supplied, or from the current working " -"directory to the destination ``path``. (Contributed by Richard Barran; :" -"issue:`1339796`.)" +"directory to the destination ``path``. (Contributed by Richard " +"Barran; :issue:`1339796`.)" msgstr "" #: ../../whatsnew/2.6.rst:2201 @@ -3555,9 +3568,9 @@ msgstr "(由 Paul Moore 貢獻;:issue:`2439`。)" #: ../../whatsnew/2.6.rst:2238 msgid "" -"The :mod:`pyexpat` module's :class:`Parser` objects now allow setting their :" -"attr:`buffer_size` attribute to change the size of the buffer used to hold " -"character data. (Contributed by Achim Gaedke; :issue:`1137`.)" +"The :mod:`pyexpat` module's :class:`Parser` objects now allow setting " +"their :attr:`buffer_size` attribute to change the size of the buffer used to " +"hold character data. (Contributed by Achim Gaedke; :issue:`1137`.)" msgstr "" #: ../../whatsnew/2.6.rst:2243 @@ -3612,10 +3625,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2280 msgid "" -"The :mod:`sched` module's :class:`scheduler` instances now have a read-only :" -"attr:`queue` attribute that returns the contents of the scheduler's queue, " -"represented as a list of named tuples with the fields ``(time, priority, " -"action, argument)``. (Contributed by Raymond Hettinger; :issue:`1861`.)" +"The :mod:`sched` module's :class:`scheduler` instances now have a read-" +"only :attr:`queue` attribute that returns the contents of the scheduler's " +"queue, represented as a list of named tuples with the fields ``(time, " +"priority, action, argument)``. (Contributed by Raymond " +"Hettinger; :issue:`1861`.)" msgstr "" #: ../../whatsnew/2.6.rst:2286 @@ -3673,11 +3687,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2322 msgid "" "Event loops will use this by opening a pipe to create two descriptors, one " -"for reading and one for writing. The writable descriptor will be passed to :" -"func:`set_wakeup_fd`, and the readable descriptor will be added to the list " -"of descriptors monitored by the event loop via :c:func:`!select` or :c:func:" -"`!poll`. On receiving a signal, a byte will be written and the main event " -"loop will be woken up, avoiding the need to poll." +"for reading and one for writing. The writable descriptor will be passed " +"to :func:`set_wakeup_fd`, and the readable descriptor will be added to the " +"list of descriptors monitored by the event loop via :c:func:`!select` " +"or :c:func:`!poll`. On receiving a signal, a byte will be written and the " +"main event loop will be woken up, avoiding the need to poll." msgstr "" #: ../../whatsnew/2.6.rst:2330 @@ -3714,8 +3728,8 @@ msgstr "" msgid "" "An implementation of the LMTP protocol (:rfc:`2033`) was also added to the " "module. LMTP is used in place of SMTP when transferring e-mail between " -"agents that don't manage a mail queue. (LMTP implemented by Leif Hedstrom; :" -"issue:`957003`.)" +"agents that don't manage a mail queue. (LMTP implemented by Leif " +"Hedstrom; :issue:`957003`.)" msgstr "" #: ../../whatsnew/2.6.rst:2356 @@ -3747,12 +3761,12 @@ msgstr "" msgid "" "The base classes in the :mod:`SocketServer <socketserver>` module now " "support calling a :meth:`~socketserver.BaseServer.handle_timeout` method " -"after a span of inactivity specified by the server's :attr:`~socketserver." -"BaseServer.timeout` attribute. (Contributed by Michael Pomraning.) The :" -"meth:`~socketserver.BaseServer.serve_forever` method now takes an optional " -"poll interval measured in seconds, controlling how often the server will " -"check for a shutdown request. (Contributed by Pedro Werneck and Jeffrey " -"Yasskin; :issue:`742598`, :issue:`1193577`.)" +"after a span of inactivity specified by the " +"server's :attr:`~socketserver.BaseServer.timeout` attribute. (Contributed " +"by Michael Pomraning.) The :meth:`~socketserver.BaseServer.serve_forever` " +"method now takes an optional poll interval measured in seconds, controlling " +"how often the server will check for a shutdown request. (Contributed by " +"Pedro Werneck and Jeffrey Yasskin; :issue:`742598`, :issue:`1193577`.)" msgstr "" #: ../../whatsnew/2.6.rst:2383 @@ -3770,10 +3784,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2391 msgid "" "The :class:`~subprocess.Popen` objects provided by the :mod:`subprocess` " -"module now have :meth:`~subprocess.Popen.terminate`, :meth:`~subprocess." -"Popen.kill`, and :meth:`~subprocess.Popen.send_signal` methods. On Windows, :" -"meth:`!send_signal` only supports the :py:const:`~signal.SIGTERM` signal, " -"and all these methods are aliases for the Win32 API function :c:func:`!" +"module now " +"have :meth:`~subprocess.Popen.terminate`, :meth:`~subprocess.Popen.kill`, " +"and :meth:`~subprocess.Popen.send_signal` methods. On Windows, :meth:`!" +"send_signal` only supports the :py:const:`~signal.SIGTERM` signal, and all " +"these methods are aliases for the Win32 API function :c:func:`!" "TerminateProcess`. (Contributed by Christian Heimes.)" msgstr "" @@ -3781,10 +3796,10 @@ msgstr "" msgid "" "A new variable in the :mod:`sys` module, :attr:`float_info`, is an object " "containing information derived from the :file:`float.h` file about the " -"platform's floating-point support. Attributes of this object include :attr:" -"`mant_dig` (number of digits in the mantissa), :attr:`epsilon` (smallest " -"difference between 1.0 and the next largest value representable), and " -"several others. (Contributed by Christian Heimes; :issue:`1534`.)" +"platform's floating-point support. Attributes of this object " +"include :attr:`mant_dig` (number of digits in the mantissa), :attr:`epsilon` " +"(smallest difference between 1.0 and the next largest value representable), " +"and several others. (Contributed by Christian Heimes; :issue:`1534`.)" msgstr "" #: ../../whatsnew/2.6.rst:2406 @@ -3812,9 +3827,9 @@ msgstr "" msgid "" "A new function, :func:`getsizeof`, takes a Python object and returns the " "amount of memory used by the object, measured in bytes. Built-in objects " -"return correct results; third-party extensions may not, but can define a :" -"meth:`__sizeof__` method to return the object's size. (Contributed by Robert " -"Schuppenies; :issue:`2898`.)" +"return correct results; third-party extensions may not, but can define " +"a :meth:`__sizeof__` method to return the object's size. (Contributed by " +"Robert Schuppenies; :issue:`2898`.)" msgstr "" #: ../../whatsnew/2.6.rst:2432 @@ -3866,9 +3881,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:2462 msgid "" -"An optional ``timeout`` parameter was added to the :class:`!telnetlib." -"Telnet` class constructor, specifying a timeout measured in seconds. (Added " -"by Facundo Batista.)" +"An optional ``timeout`` parameter was added to the :class:`!" +"telnetlib.Telnet` class constructor, specifying a timeout measured in " +"seconds. (Added by Facundo Batista.)" msgstr "" #: ../../whatsnew/2.6.rst:2466 @@ -3890,17 +3905,18 @@ msgstr "" #: ../../whatsnew/2.6.rst:2476 msgid "" "The :class:`NamedTemporaryFile` and :class:`SpooledTemporaryFile` classes " -"both work as context managers, so you can write ``with tempfile." -"NamedTemporaryFile() as tmp: ...``. (Contributed by Alexander Belopolsky; :" -"issue:`2021`.)" +"both work as context managers, so you can write ``with " +"tempfile.NamedTemporaryFile() as tmp: ...``. (Contributed by Alexander " +"Belopolsky; :issue:`2021`.)" msgstr "" #: ../../whatsnew/2.6.rst:2481 msgid "" "The :mod:`test.test_support <test.support>` module gained a number of " -"context managers useful for writing tests. :func:`~test.support.os_helper." -"EnvironmentVarGuard` is a context manager that temporarily changes " -"environment variables and automatically restores them to their old values." +"context managers useful for writing " +"tests. :func:`~test.support.os_helper.EnvironmentVarGuard` is a context " +"manager that temporarily changes environment variables and automatically " +"restores them to their old values." msgstr "" #: ../../whatsnew/2.6.rst:2487 @@ -3973,22 +3989,22 @@ msgstr "(由 Dwayne Bailey 貢獻;:issue:`1581073`。)" #: ../../whatsnew/2.6.rst:2531 msgid "" -"The :mod:`threading` module API is being changed to use properties such as :" -"attr:`daemon` instead of :meth:`setDaemon` and :meth:`isDaemon` methods, and " -"some methods have been renamed to use underscores instead of camel-case; for " -"example, the :meth:`activeCount` method is renamed to :meth:`active_count`. " -"Both the 2.6 and 3.0 versions of the module support the same properties and " -"renamed methods, but don't remove the old methods. No date has been set for " -"the deprecation of the old APIs in Python 3.x; the old APIs won't be removed " -"in any 2.x version. (Carried out by several people, most notably Benjamin " -"Peterson.)" +"The :mod:`threading` module API is being changed to use properties such " +"as :attr:`daemon` instead of :meth:`setDaemon` and :meth:`isDaemon` methods, " +"and some methods have been renamed to use underscores instead of camel-case; " +"for example, the :meth:`activeCount` method is renamed " +"to :meth:`active_count`. Both the 2.6 and 3.0 versions of the module " +"support the same properties and renamed methods, but don't remove the old " +"methods. No date has been set for the deprecation of the old APIs in Python " +"3.x; the old APIs won't be removed in any 2.x version. (Carried out by " +"several people, most notably Benjamin Peterson.)" msgstr "" #: ../../whatsnew/2.6.rst:2542 msgid "" -"The :mod:`threading` module's :class:`Thread` objects gained an :attr:" -"`ident` property that returns the thread's identifier, a nonzero integer. " -"(Contributed by Gregory P. Smith; :issue:`2871`.)" +"The :mod:`threading` module's :class:`Thread` objects gained " +"an :attr:`ident` property that returns the thread's identifier, a nonzero " +"integer. (Contributed by Gregory P. Smith; :issue:`2871`.)" msgstr "" #: ../../whatsnew/2.6.rst:2547 @@ -3997,8 +4013,8 @@ msgid "" "statement being timed and for the setup code. Two convenience functions were " "added for creating :class:`Timer` instances: ``repeat(stmt, setup, time, " "repeat, number)`` and ``timeit(stmt, setup, time, number)`` create an " -"instance and call the corresponding method. (Contributed by Erik Demaine; :" -"issue:`1533909`.)" +"instance and call the corresponding method. (Contributed by Erik " +"Demaine; :issue:`1533909`.)" msgstr "" #: ../../whatsnew/2.6.rst:2556 @@ -4108,14 +4124,14 @@ msgstr "" #: ../../whatsnew/2.6.rst:2607 msgid "" -"The XML-RPC :class:`SimpleXMLRPCServer <xmlrpc.server>` and :class:" -"`DocXMLRPCServer <xmlrpc.server>` classes can now be prevented from " -"immediately opening and binding to their socket by passing ``False`` as the " -"*bind_and_activate* constructor parameter. This can be used to modify the " -"instance's :attr:`allow_reuse_address` attribute before calling the :meth:" -"`server_bind` and :meth:`server_activate` methods to open the socket and " -"begin listening for connections. (Contributed by Peter Parente; :issue:" -"`1599845`.)" +"The XML-RPC :class:`SimpleXMLRPCServer <xmlrpc.server>` " +"and :class:`DocXMLRPCServer <xmlrpc.server>` classes can now be prevented " +"from immediately opening and binding to their socket by passing ``False`` as " +"the *bind_and_activate* constructor parameter. This can be used to modify " +"the instance's :attr:`allow_reuse_address` attribute before calling " +"the :meth:`server_bind` and :meth:`server_activate` methods to open the " +"socket and begin listening for connections. (Contributed by Peter " +"Parente; :issue:`1599845`.)" msgstr "" #: ../../whatsnew/2.6.rst:2616 @@ -4132,14 +4148,14 @@ msgstr "" #: ../../whatsnew/2.6.rst:2624 msgid "" "The :mod:`xmlrpclib <xmlrpc.client>` module no longer automatically " -"converts :class:`datetime.date` and :class:`datetime.time` to the :class:" -"`xmlrpclib.DateTime <xmlrpc.client.DateTime>` type; the conversion semantics " -"were not necessarily correct for all applications. Code using :mod:`!" -"xmlrpclib` should convert :class:`date` and :class:`~datetime.time` " -"instances. (:issue:`1330538`) The code can also handle dates before 1900 " -"(contributed by Ralf Schmitt; :issue:`2014`) and 64-bit integers represented " -"by using ``<i8>`` in XML-RPC responses (contributed by Riku Lindblad; :issue:" -"`2985`)." +"converts :class:`datetime.date` and :class:`datetime.time` to " +"the :class:`xmlrpclib.DateTime <xmlrpc.client.DateTime>` type; the " +"conversion semantics were not necessarily correct for all applications. " +"Code using :mod:`!xmlrpclib` should convert :class:`date` " +"and :class:`~datetime.time` instances. (:issue:`1330538`) The code can also " +"handle dates before 1900 (contributed by Ralf Schmitt; :issue:`2014`) and 64-" +"bit integers represented by using ``<i8>`` in XML-RPC responses (contributed " +"by Riku Lindblad; :issue:`2985`)." msgstr "" #: ../../whatsnew/2.6.rst:2634 @@ -4193,8 +4209,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:2671 msgid "" -"The :func:`parse` function takes an expression and returns an AST. The :func:" -"`dump` function outputs a representation of a tree, suitable for debugging::" +"The :func:`parse` function takes an expression and returns an AST. " +"The :func:`dump` function outputs a representation of a tree, suitable for " +"debugging::" msgstr "" #: ../../whatsnew/2.6.rst:2675 @@ -4354,8 +4371,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:2761 msgid "" -"``hex(value)``, ``oct(value)``: instead of calling the :meth:`__hex__` or :" -"meth:`__oct__` methods, these versions will call the :meth:`__index__` " +"``hex(value)``, ``oct(value)``: instead of calling the :meth:`__hex__` " +"or :meth:`__oct__` methods, these versions will call the :meth:`__index__` " "method and convert the result to hexadecimal or octal. :func:`oct` will use " "the new ``0o`` notation for its result." msgstr "" @@ -4471,10 +4488,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:2853 msgid "" -"All :mod:`ctypes` data types now support :meth:`from_buffer` and :meth:" -"`from_buffer_copy` methods that create a ctypes instance based on a provided " -"buffer object. :meth:`from_buffer_copy` copies the contents of the object, " -"while :meth:`from_buffer` will share the same memory area." +"All :mod:`ctypes` data types now support :meth:`from_buffer` " +"and :meth:`from_buffer_copy` methods that create a ctypes instance based on " +"a provided buffer object. :meth:`from_buffer_copy` copies the contents of " +"the object, while :meth:`from_buffer` will share the same memory area." msgstr "" #: ../../whatsnew/2.6.rst:2860 @@ -4495,8 +4512,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:2870 msgid "" -"The Win32 LastError variable is similarly supported by the :func:`DLL`, :" -"func:`OleDLL`, and :func:`WinDLL` functions. You supply " +"The Win32 LastError variable is similarly supported by " +"the :func:`DLL`, :func:`OleDLL`, and :func:`WinDLL` functions. You supply " "``use_last_error=True`` as a keyword parameter and then call the module-" "level methods :meth:`set_last_error` and :meth:`get_last_error`." msgstr "" @@ -4541,8 +4558,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:2908 ../../whatsnew/2.6.rst:3262 msgid "" -"String exceptions have been removed. Attempting to use them raises a :exc:" -"`TypeError`." +"String exceptions have been removed. Attempting to use them raises " +"a :exc:`TypeError`." msgstr "" #: ../../whatsnew/2.6.rst:2911 @@ -4561,13 +4578,13 @@ msgstr "" #: ../../whatsnew/2.6.rst:2921 msgid "" -"The list of deprecated modules is: :mod:`!audiodev`, :mod:`!bgenlocations`, :" -"mod:`!buildtools`, :mod:`!bundlebuilder`, :mod:`!Canvas`, :mod:`!compiler`, :" -"mod:`!dircache`, :mod:`!dl`, :mod:`!fpformat`, :mod:`!gensuitemodule`, :mod:" -"`!ihooks`, :mod:`!imageop`, :mod:`!imgfile`, :mod:`!linuxaudiodev`, :mod:`!" -"mhlib`, :mod:`!mimetools`, :mod:`!multifile`, :mod:`!new`, :mod:`!pure`, :" -"mod:`!statvfs`, :mod:`!sunaudiodev`, :mod:`!test.testall`, and :mod:`!" -"toaiff`." +"The list of deprecated modules is: :mod:`!audiodev`, :mod:`!" +"bgenlocations`, :mod:`!buildtools`, :mod:`!bundlebuilder`, :mod:`!" +"Canvas`, :mod:`!compiler`, :mod:`!dircache`, :mod:`!dl`, :mod:`!" +"fpformat`, :mod:`!gensuitemodule`, :mod:`!ihooks`, :mod:`!imageop`, :mod:`!" +"imgfile`, :mod:`!linuxaudiodev`, :mod:`!mhlib`, :mod:`!mimetools`, :mod:`!" +"multifile`, :mod:`!new`, :mod:`!pure`, :mod:`!statvfs`, :mod:`!" +"sunaudiodev`, :mod:`!test.testall`, and :mod:`!toaiff`." msgstr "" #: ../../whatsnew/2.6.rst:2946 @@ -4616,17 +4633,17 @@ msgstr "" #: ../../whatsnew/2.6.rst:2974 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/2.6.rst:2976 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/2.6.rst:2978 msgid "" "Python now must be compiled with C89 compilers (after 19 years!). This " -"means that the Python source tree has dropped its own implementations of :c:" -"func:`!memmove` and :c:func:`!strerror`, which are in the C89 standard " +"means that the Python source tree has dropped its own implementations " +"of :c:func:`!memmove` and :c:func:`!strerror`, which are in the C89 standard " "library." msgstr "" @@ -4639,11 +4656,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2988 msgid "" -"On Mac OS X, Python 2.6 can be compiled as a 4-way universal build. The :" -"program:`configure` script can take a :option:`!--with-universal-archs=[32-" -"bit|64-bit|all]` switch, controlling whether the binaries are built for 32-" -"bit architectures (x86, PowerPC), 64-bit (x86-64 and PPC-64), or both. " -"(Contributed by Ronald Oussoren.)" +"On Mac OS X, Python 2.6 can be compiled as a 4-way universal build. " +"The :program:`configure` script can take a :option:`!--with-universal-" +"archs=[32-bit|64-bit|all]` switch, controlling whether the binaries are " +"built for 32-bit architectures (x86, PowerPC), 64-bit (x86-64 and PPC-64), " +"or both. (Contributed by Ronald Oussoren.)" msgstr "" #: ../../whatsnew/2.6.rst:2995 @@ -4685,9 +4702,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:3021 msgid "" -"The BerkeleyDB module now has a C API object, available as ``bsddb.db." -"api``. This object can be used by other C extensions that wish to use the :" -"mod:`bsddb` module for their own purposes. (Contributed by Duncan Grisby.)" +"The BerkeleyDB module now has a C API object, available as " +"``bsddb.db.api``. This object can be used by other C extensions that wish " +"to use the :mod:`bsddb` module for their own purposes. (Contributed by " +"Duncan Grisby.)" msgstr "" #: ../../whatsnew/2.6.rst:3026 @@ -4715,11 +4733,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:3044 msgid "" "Importing modules simultaneously in two different threads no longer " -"deadlocks; it will now raise an :exc:`ImportError`. A new API function, :c:" -"func:`PyImport_ImportModuleNoBlock`, will look for a module in ``sys." -"modules`` first, then try to import it after acquiring an import lock. If " -"the import lock is held by another thread, an :exc:`ImportError` is raised. " -"(Contributed by Christian Heimes.)" +"deadlocks; it will now raise an :exc:`ImportError`. A new API " +"function, :c:func:`PyImport_ImportModuleNoBlock`, will look for a module in " +"``sys.modules`` first, then try to import it after acquiring an import " +"lock. If the import lock is held by another thread, an :exc:`ImportError` " +"is raised. (Contributed by Christian Heimes.)" msgstr "" #: ../../whatsnew/2.6.rst:3052 @@ -4754,25 +4772,26 @@ msgstr "" msgid "" "Many C extensions define their own little macro for adding integers and " "strings to the module's dictionary in the ``init*`` function. Python 2.6 " -"finally defines standard macros for adding values to a module, :c:macro:" -"`PyModule_AddStringMacro` and :c:macro:`PyModule_AddIntMacro()`. " -"(Contributed by Christian Heimes.)" +"finally defines standard macros for adding values to a " +"module, :c:macro:`PyModule_AddStringMacro` " +"and :c:macro:`PyModule_AddIntMacro()`. (Contributed by Christian Heimes.)" msgstr "" #: ../../whatsnew/2.6.rst:3082 msgid "" "Some macros were renamed in both 3.0 and 2.6 to make it clearer that they " -"are macros, not functions. :c:macro:`!Py_Size()` became :c:macro:" -"`Py_SIZE()`, :c:macro:`!Py_Type()` became :c:macro:`Py_TYPE()`, and :c:macro:" -"`!Py_Refcnt()` became :c:macro:`Py_REFCNT()`. The mixed-case macros are " -"still available in Python 2.6 for backward compatibility. (:issue:`1629`)" +"are macros, not functions. :c:macro:`!Py_Size()` " +"became :c:macro:`Py_SIZE()`, :c:macro:`!Py_Type()` " +"became :c:macro:`Py_TYPE()`, and :c:macro:`!Py_Refcnt()` " +"became :c:macro:`Py_REFCNT()`. The mixed-case macros are still available in " +"Python 2.6 for backward compatibility. (:issue:`1629`)" msgstr "" #: ../../whatsnew/2.6.rst:3091 msgid "" "Distutils now places C extensions it builds in a different directory when " -"running on a debug version of Python. (Contributed by Collin Winter; :issue:" -"`1530959`.)" +"running on a debug version of Python. (Contributed by Collin " +"Winter; :issue:`1530959`.)" msgstr "" #: ../../whatsnew/2.6.rst:3095 @@ -4841,27 +4860,27 @@ msgstr "" #: ../../whatsnew/2.6.rst:3142 msgid "" -"The :mod:`socket` module's socket objects now have an :meth:`~socket.socket." -"ioctl` method that provides a limited interface to the :c:func:`WSAIoctl` " -"system interface." +"The :mod:`socket` module's socket objects now have " +"an :meth:`~socket.socket.ioctl` method that provides a limited interface to " +"the :c:func:`WSAIoctl` system interface." msgstr "" #: ../../whatsnew/2.6.rst:3146 msgid "" -"The :mod:`_winreg <winreg>` module now has a function, :func:`~winreg." -"ExpandEnvironmentStrings`, that expands environment variable references such " -"as ``%NAME%`` in an input string. The handle objects provided by this " -"module now support the context protocol, so they can be used in :keyword:" -"`with` statements. (Contributed by Christian Heimes.)" +"The :mod:`_winreg <winreg>` module now has a " +"function, :func:`~winreg.ExpandEnvironmentStrings`, that expands environment " +"variable references such as ``%NAME%`` in an input string. The handle " +"objects provided by this module now support the context protocol, so they " +"can be used in :keyword:`with` statements. (Contributed by Christian Heimes.)" msgstr "" #: ../../whatsnew/2.6.rst:3153 msgid "" ":mod:`_winreg <winreg>` also has better support for x64 systems, exposing " -"the :func:`~winreg.DisableReflectionKey`, :func:`~winreg." -"EnableReflectionKey`, and :func:`~winreg.QueryReflectionKey` functions, " -"which enable and disable registry reflection for 32-bit processes running on " -"64-bit systems. (:issue:`1753245`)" +"the :func:`~winreg.DisableReflectionKey`, :func:`~winreg.EnableReflectionKey`, " +"and :func:`~winreg.QueryReflectionKey` functions, which enable and disable " +"registry reflection for 32-bit processes running on 64-bit systems. " +"(:issue:`1753245`)" msgstr "" #: ../../whatsnew/2.6.rst:3159 @@ -4884,24 +4903,25 @@ msgstr "" #: ../../whatsnew/2.6.rst:3174 msgid "" -"The :mod:`!macfs` module has been removed. This in turn required the :func:" -"`!macostools.touched` function to be removed because it depended on the :mod:" -"`!macfs` module. (:issue:`1490190`)" +"The :mod:`!macfs` module has been removed. This in turn required " +"the :func:`!macostools.touched` function to be removed because it depended " +"on the :mod:`!macfs` module. (:issue:`1490190`)" msgstr "" #: ../../whatsnew/2.6.rst:3178 msgid "" "Many other Mac OS modules have been deprecated and will be removed in Python " "3.0: :mod:`!_builtinSuites`, :mod:`!aepack`, :mod:`!aetools`, :mod:`!" -"aetypes`, :mod:`!applesingle`, :mod:`!appletrawmain`, :mod:`!appletrunner`, :" -"mod:`!argvemulator`, :mod:`!Audio_mac`, :mod:`!autoGIL`, :mod:`!Carbon`, :" -"mod:`!cfmfile`, :mod:`!CodeWarrior`, :mod:`!ColorPicker`, :mod:`!" -"EasyDialogs`, :mod:`!Explorer`, :mod:`!Finder`, :mod:`!FrameWork`, :mod:`!" -"findertools`, :mod:`!ic`, :mod:`!icglue`, :mod:`!icopen`, :mod:`!" -"macerrors`, :mod:`!MacOS`, :mod:`!macfs`, :mod:`!macostools`, :mod:`!" -"macresource`, :mod:`!MiniAEFrame`, :mod:`!Nav`, :mod:`!Netscape`, :mod:`!" -"OSATerminology`, :mod:`!pimp`, :mod:`!PixMapWrapper`, :mod:`!StdSuites`, :" -"mod:`!SystemEvents`, :mod:`!Terminal`, and :mod:`!terminalcommand`." +"aetypes`, :mod:`!applesingle`, :mod:`!appletrawmain`, :mod:`!" +"appletrunner`, :mod:`!argvemulator`, :mod:`!Audio_mac`, :mod:`!" +"autoGIL`, :mod:`!Carbon`, :mod:`!cfmfile`, :mod:`!CodeWarrior`, :mod:`!" +"ColorPicker`, :mod:`!EasyDialogs`, :mod:`!Explorer`, :mod:`!Finder`, :mod:`!" +"FrameWork`, :mod:`!findertools`, :mod:`!ic`, :mod:`!icglue`, :mod:`!" +"icopen`, :mod:`!macerrors`, :mod:`!MacOS`, :mod:`!macfs`, :mod:`!" +"macostools`, :mod:`!macresource`, :mod:`!MiniAEFrame`, :mod:`!Nav`, :mod:`!" +"Netscape`, :mod:`!OSATerminology`, :mod:`!pimp`, :mod:`!" +"PixMapWrapper`, :mod:`!StdSuites`, :mod:`!SystemEvents`, :mod:`!Terminal`, " +"and :mod:`!terminalcommand`." msgstr "" #: ../../whatsnew/2.6.rst:3221 @@ -4913,10 +4933,10 @@ msgid "" "A number of old IRIX-specific modules were deprecated and will be removed in " "Python 3.0: :mod:`!al` and :mod:`!AL`, :mod:`!cd`, :mod:`!cddb`, :mod:`!" "cdplayer`, :mod:`!CL` and :mod:`!cl`, :mod:`!DEVICE`, :mod:`!ERRNO`, :mod:`!" -"FILE`, :mod:`!FL` and :mod:`!fl`, :mod:`!flp`, :mod:`!fm`, :mod:`!GET`, :mod:" -"`!GLWS`, :mod:`!GL` and :mod:`!gl`, :mod:`!IN`, :mod:`!IOCTL`, :mod:`!" -"jpeg`, :mod:`!panelparser`, :mod:`!readcd`, :mod:`!SV` and :mod:`!sv`, :mod:" -"`!torgb`, :mod:`!videoreader`, and :mod:`!WAIT`." +"FILE`, :mod:`!FL` and :mod:`!fl`, :mod:`!flp`, :mod:`!fm`, :mod:`!" +"GET`, :mod:`!GLWS`, :mod:`!GL` and :mod:`!gl`, :mod:`!IN`, :mod:`!" +"IOCTL`, :mod:`!jpeg`, :mod:`!panelparser`, :mod:`!readcd`, :mod:`!SV` " +"and :mod:`!sv`, :mod:`!torgb`, :mod:`!videoreader`, and :mod:`!WAIT`." msgstr "" #: ../../whatsnew/2.6.rst:3253 @@ -4955,9 +4975,9 @@ msgstr "" msgid "" "The :class:`Decimal` constructor now accepts leading and trailing whitespace " "when passed a string. Previously it would raise an :exc:`InvalidOperation` " -"exception. On the other hand, the :meth:`create_decimal` method of :class:" -"`Context` objects now explicitly disallows extra whitespace, raising a :exc:" -"`ConversionSyntax` exception." +"exception. On the other hand, the :meth:`create_decimal` method " +"of :class:`Context` objects now explicitly disallows extra whitespace, " +"raising a :exc:`ConversionSyntax` exception." msgstr "" #: ../../whatsnew/2.6.rst:3284 @@ -4983,20 +5003,20 @@ msgstr "" #: ../../whatsnew/2.6.rst:3298 msgid "" -"The :mod:`socket` module exception :exc:`socket.error` now inherits from :" -"exc:`IOError`. Previously it wasn't a subclass of :exc:`StandardError` but " -"now it is, through :exc:`IOError`. (Implemented by Gregory P. Smith; :issue:" -"`1706815`.)" +"The :mod:`socket` module exception :exc:`socket.error` now inherits " +"from :exc:`IOError`. Previously it wasn't a subclass " +"of :exc:`StandardError` but now it is, through :exc:`IOError`. (Implemented " +"by Gregory P. Smith; :issue:`1706815`.)" msgstr "" #: ../../whatsnew/2.6.rst:3303 msgid "" "The :mod:`xmlrpclib <xmlrpc.client>` module no longer automatically " -"converts :class:`datetime.date` and :class:`datetime.time` to the :class:" -"`xmlrpclib.DateTime <xmlrpc.client.DateTime>` type; the conversion semantics " -"were not necessarily correct for all applications. Code using :mod:`!" -"xmlrpclib` should convert :class:`date` and :class:`~datetime.time` " -"instances. (:issue:`1330538`)" +"converts :class:`datetime.date` and :class:`datetime.time` to " +"the :class:`xmlrpclib.DateTime <xmlrpc.client.DateTime>` type; the " +"conversion semantics were not necessarily correct for all applications. " +"Code using :mod:`!xmlrpclib` should convert :class:`date` " +"and :class:`~datetime.time` instances. (:issue:`1330538`)" msgstr "" #: ../../whatsnew/2.6.rst:3310 diff --git a/whatsnew/2.7.po b/whatsnew/2.7.po index cc574ea59c..8e84e172e9 100644 --- a/whatsnew/2.7.po +++ b/whatsnew/2.7.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -39,11 +39,11 @@ msgstr "" msgid "" "Numeric handling has been improved in many ways, for both floating-point " "numbers and for the :class:`~decimal.Decimal` class. There are some useful " -"additions to the standard library, such as a greatly enhanced :mod:" -"`unittest` module, the :mod:`argparse` module for parsing command-line " -"options, convenient :class:`~collections.OrderedDict` and :class:" -"`~collections.Counter` classes in the :mod:`collections` module, and many " -"other improvements." +"additions to the standard library, such as a greatly " +"enhanced :mod:`unittest` module, the :mod:`argparse` module for parsing " +"command-line options, convenient :class:`~collections.OrderedDict` " +"and :class:`~collections.Counter` classes in the :mod:`collections` module, " +"and many other improvements." msgstr "" #: ../../whatsnew/2.7.rst:63 @@ -59,9 +59,9 @@ msgid "" "features, but instead provides a convenient overview. For full details, you " "should refer to the documentation for Python 2.7 at https://docs.python.org. " "If you want to understand the rationale for the design and implementation, " -"refer to the PEP for a particular new feature or the issue on https://bugs." -"python.org in which a change was discussed. Whenever possible, \"What's New " -"in Python\" links to the bug/patch item for each change." +"refer to the PEP for a particular new feature or the issue on https://" +"bugs.python.org in which a change was discussed. Whenever possible, " +"\"What's New in Python\" links to the bug/patch item for each change." msgstr "" #: ../../whatsnew/2.7.rst:80 @@ -168,10 +168,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:151 msgid "" "However, there are increasingly many users of Python-based applications who " -"are not directly involved in the development of those applications. :exc:" -"`DeprecationWarning` messages are irrelevant to such users, making them " -"worry about an application that's actually working correctly and burdening " -"application developers with responding to these concerns." +"are not directly involved in the development of those " +"applications. :exc:`DeprecationWarning` messages are irrelevant to such " +"users, making them worry about an application that's actually working " +"correctly and burdening application developers with responding to these " +"concerns." msgstr "" #: ../../whatsnew/2.7.rst:158 @@ -248,8 +249,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:192 msgid "" -"Float-to-string and string-to-float conversions are correctly rounded. The :" -"func:`round` function is also now correctly rounded." +"Float-to-string and string-to-float conversions are correctly rounded. " +"The :func:`round` function is also now correctly rounded." msgstr "" #: ../../whatsnew/2.7.rst:194 @@ -287,8 +288,8 @@ msgid "" "Regular Python dictionaries iterate over key/value pairs in arbitrary order. " "Over the years, a number of authors have written alternative implementations " "that remember the order that the keys were originally inserted. Based on " -"the experiences from those implementations, 2.7 introduces a new :class:" -"`~collections.OrderedDict` class in the :mod:`collections` module." +"the experiences from those implementations, 2.7 introduces a " +"new :class:`~collections.OrderedDict` class in the :mod:`collections` module." msgstr "" #: ../../whatsnew/2.7.rst:222 @@ -440,9 +441,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:294 msgid "" -"The :meth:`~collections.somenamedtuple._asdict` method for :func:" -"`collections.namedtuple` now returns an ordered dictionary with the values " -"appearing in the same order as the underlying tuple indices." +"The :meth:`~collections.somenamedtuple._asdict` method " +"for :func:`collections.namedtuple` now returns an ordered dictionary with " +"the values appearing in the same order as the underlying tuple indices." msgstr "" #: ../../whatsnew/2.7.rst:298 @@ -531,14 +532,14 @@ msgstr "" #: ../../whatsnew/2.7.rst:355 msgid "" "This means Python now supports three different modules for parsing command-" -"line arguments: :mod:`getopt`, :mod:`optparse`, and :mod:`argparse`. The :" -"mod:`getopt` module closely resembles the C library's :c:func:`!getopt` " +"line arguments: :mod:`getopt`, :mod:`optparse`, and :mod:`argparse`. " +"The :mod:`getopt` module closely resembles the C library's :c:func:`!getopt` " "function, so it remains useful if you're writing a Python prototype that " "will eventually be rewritten in C. :mod:`optparse` becomes redundant, but " "there are no plans to remove it because there are many scripts still using " -"it, and there's no automated way to update these scripts. (Making the :mod:" -"`argparse` API consistent with :mod:`optparse`'s interface was discussed but " -"rejected as too messy and difficult.)" +"it, and there's no automated way to update these scripts. (Making " +"the :mod:`argparse` API consistent with :mod:`optparse`'s interface was " +"discussed but rejected as too messy and difficult.)" msgstr "" #: ../../whatsnew/2.7.rst:366 @@ -653,9 +654,9 @@ msgid "" "passing ``'*'``, 1 or more by passing ``'+'``, or an optional argument with " "``'?'``. A top-level parser can contain sub-parsers to define subcommands " "that have different sets of switches, as in ``svn commit``, ``svn " -"checkout``, etc. You can specify an argument's type as :class:`~argparse." -"FileType`, which will automatically open files for you and understands that " -"``'-'`` means standard input or output." +"checkout``, etc. You can specify an argument's type " +"as :class:`~argparse.FileType`, which will automatically open files for you " +"and understands that ``'-'`` means standard input or output." msgstr "" #: ../../whatsnew/2.7.rst:437 @@ -672,8 +673,8 @@ msgstr ":ref:`upgrading-optparse-code`" #: ../../whatsnew/2.7.rst:441 msgid "" -"Part of the Python documentation, describing how to convert code that uses :" -"mod:`optparse`." +"Part of the Python documentation, describing how to convert code that " +"uses :mod:`optparse`." msgstr "" #: ../../whatsnew/2.7.rst:444 @@ -700,10 +701,10 @@ msgstr "" msgid "" "All this flexibility can require a lot of configuration. You can write " "Python statements to create objects and set their properties, but a complex " -"set-up requires verbose but boring code. :mod:`logging` also supports a :" -"func:`~logging.config.fileConfig` function that parses a file, but the file " -"format doesn't support configuring filters, and it's messier to generate " -"programmatically." +"set-up requires verbose but boring code. :mod:`logging` also supports " +"a :func:`~logging.config.fileConfig` function that parses a file, but the " +"file format doesn't support configuring filters, and it's messier to " +"generate programmatically." msgstr "" #: ../../whatsnew/2.7.rst:462 @@ -779,8 +780,8 @@ msgstr "" msgid "" "The :class:`~logging.handlers.SysLogHandler` class now supports syslogging " "over TCP. The constructor has a *socktype* parameter giving the type of " -"socket to use, either :const:`socket.SOCK_DGRAM` for UDP or :const:`socket." -"SOCK_STREAM` for TCP. The default protocol remains UDP." +"socket to use, either :const:`socket.SOCK_DGRAM` for UDP " +"or :const:`socket.SOCK_STREAM` for TCP. The default protocol remains UDP." msgstr "" #: ../../whatsnew/2.7.rst:529 @@ -788,15 +789,16 @@ msgid "" ":class:`~logging.Logger` instances gained a :meth:`~logging.Logger.getChild` " "method that retrieves a descendant logger using a relative path. For " "example, once you retrieve a logger by doing ``log = getLogger('app')``, " -"calling ``log.getChild('network.listen')`` is equivalent to ``getLogger('app." -"network.listen')``." +"calling ``log.getChild('network.listen')`` is equivalent to " +"``getLogger('app.network.listen')``." msgstr "" #: ../../whatsnew/2.7.rst:535 msgid "" -"The :class:`~logging.LoggerAdapter` class gained an :meth:`~logging.Logger." -"isEnabledFor` method that takes a *level* and returns whether the underlying " -"logger would process a message of that level of importance." +"The :class:`~logging.LoggerAdapter` class gained " +"an :meth:`~logging.Logger.isEnabledFor` method that takes a *level* and " +"returns whether the underlying logger would process a message of that level " +"of importance." msgstr "" #: ../../whatsnew/2.7.rst:544 @@ -813,17 +815,18 @@ msgstr "" #: ../../whatsnew/2.7.rst:550 msgid "" -"The dictionary methods :meth:`~dict.keys`, :meth:`~dict.values`, and :meth:" -"`~dict.items` are different in Python 3.x. They return an object called a :" -"dfn:`view` instead of a fully materialized list." +"The dictionary methods :meth:`~dict.keys`, :meth:`~dict.values`, " +"and :meth:`~dict.items` are different in Python 3.x. They return an object " +"called a :dfn:`view` instead of a fully materialized list." msgstr "" #: ../../whatsnew/2.7.rst:554 msgid "" -"It's not possible to change the return values of :meth:`~dict.keys`, :meth:" -"`~dict.values`, and :meth:`~dict.items` in Python 2.7 because too much code " -"would break. Instead the 3.x versions were added under the new names :meth:" -"`!viewkeys`, :meth:`!viewvalues`, and :meth:`!viewitems`." +"It's not possible to change the return values " +"of :meth:`~dict.keys`, :meth:`~dict.values`, and :meth:`~dict.items` in " +"Python 2.7 because too much code would break. Instead the 3.x versions were " +"added under the new names :meth:`!viewkeys`, :meth:`!viewvalues`, " +"and :meth:`!viewitems`." msgstr "" #: ../../whatsnew/2.7.rst:562 @@ -909,8 +912,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:599 msgid "" "You can use the view methods in Python 2.x code, and the 2to3 converter will " -"change them to the standard :meth:`~dict.keys`, :meth:`~dict.values`, and :" -"meth:`~dict.items` methods." +"change them to the standard :meth:`~dict.keys`, :meth:`~dict.values`, " +"and :meth:`~dict.items` methods." msgstr "" #: ../../whatsnew/2.7.rst:605 @@ -919,8 +922,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:606 msgid "" -"PEP written by Guido van Rossum. Backported to 2.7 by Alexandre Vassalotti; :" -"issue:`1967`." +"PEP written by Guido van Rossum. Backported to 2.7 by Alexandre " +"Vassalotti; :issue:`1967`." msgstr "" #: ../../whatsnew/2.7.rst:611 @@ -1095,11 +1098,12 @@ msgstr "" msgid "" "Conversions between floating-point numbers and strings are now correctly " "rounded on most platforms. These conversions occur in many different " -"places: :func:`str` on floats and complex numbers; the :class:`float` and :" -"class:`complex` constructors; numeric formatting; serializing and " -"deserializing floats and complex numbers using the :mod:`marshal`, :mod:" -"`pickle` and :mod:`json` modules; parsing of float and imaginary literals in " -"Python code; and :class:`~decimal.Decimal`-to-float conversion." +"places: :func:`str` on floats and complex numbers; the :class:`float` " +"and :class:`complex` constructors; numeric formatting; serializing and " +"deserializing floats and complex numbers using " +"the :mod:`marshal`, :mod:`pickle` and :mod:`json` modules; parsing of float " +"and imaginary literals in Python code; and :class:`~decimal.Decimal`-to-" +"float conversion." msgstr "" #: ../../whatsnew/2.7.rst:741 @@ -1122,8 +1126,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:757 msgid "" -"Implemented by Eric Smith and Mark Dickinson, using David Gay's :file:`dtoa." -"c` library; :issue:`7117`." +"Implemented by Eric Smith and Mark Dickinson, using David " +"Gay's :file:`dtoa.c` library; :issue:`7117`." msgstr "" #: ../../whatsnew/2.7.rst:760 @@ -1234,9 +1238,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:818 msgid "" -"A low-level change: the :meth:`object.__format__` method now triggers a :exc:" -"`PendingDeprecationWarning` if it's passed a format string, because the :" -"meth:`!__format__` method for :class:`object` converts the object to a " +"A low-level change: the :meth:`object.__format__` method now triggers " +"a :exc:`PendingDeprecationWarning` if it's passed a format string, because " +"the :meth:`!__format__` method for :class:`object` converts the object to a " "string representation and formats that. Previously the method silently " "applied the format string to the string representation, but that could hide " "mistakes in Python code. If you're supplying formatting information such as " @@ -1289,15 +1293,15 @@ msgstr "" #: ../../whatsnew/2.7.rst:851 msgid "" "It's now possible for a subclass of the built-in :class:`!unicode` type to " -"override the :meth:`!__unicode__` method. (Implemented by Victor Stinner; :" -"issue:`1583863`.)" +"override the :meth:`!__unicode__` method. (Implemented by Victor " +"Stinner; :issue:`1583863`.)" msgstr "" #: ../../whatsnew/2.7.rst:855 msgid "" "The :class:`bytearray` type's :meth:`~bytearray.translate` method now " -"accepts ``None`` as its first argument. (Fixed by Georg Brandl; :issue:" -"`4759`.)" +"accepts ``None`` as its first argument. (Fixed by Georg " +"Brandl; :issue:`4759`.)" msgstr "" #: ../../whatsnew/2.7.rst:861 @@ -1320,8 +1324,8 @@ msgstr "" msgid "" "Two new encodings are now supported: \"cp720\", used primarily for Arabic " "text; and \"cp858\", a variant of CP 850 that adds the euro symbol. (CP720 " -"contributed by Alexander Belchenko and Amaury Forgeot d'Arc in :issue:" -"`1616979`; CP858 contributed by Tim Hatch in :issue:`8016`.)" +"contributed by Alexander Belchenko and Amaury Forgeot d'Arc " +"in :issue:`1616979`; CP858 contributed by Tim Hatch in :issue:`8016`.)" msgstr "" #: ../../whatsnew/2.7.rst:879 @@ -1330,14 +1334,14 @@ msgid "" "the :exc:`IOError` exception when trying to open a directory on POSIX " "platforms (noted by Jan Kaliszewski; :issue:`4764`), and now explicitly " "checks for and forbids writing to read-only file objects instead of trusting " -"the C library to catch and report the error (fixed by Stefan Krah; :issue:" -"`5677`)." +"the C library to catch and report the error (fixed by Stefan " +"Krah; :issue:`5677`)." msgstr "" #: ../../whatsnew/2.7.rst:886 msgid "" -"The Python tokenizer now translates line endings itself, so the :func:" -"`compile` built-in function now accepts code using any line-ending " +"The Python tokenizer now translates line endings itself, so " +"the :func:`compile` built-in function now accepts code using any line-ending " "convention. Additionally, it no longer requires that the code end in a " "newline." msgstr "" @@ -1353,15 +1357,15 @@ msgstr "" #: ../../whatsnew/2.7.rst:896 msgid "" "It's now possible to create weak references to old-style class objects. New-" -"style classes were always weak-referenceable. (Fixed by Antoine Pitrou; :" -"issue:`8268`.)" +"style classes were always weak-referenceable. (Fixed by Antoine " +"Pitrou; :issue:`8268`.)" msgstr "" #: ../../whatsnew/2.7.rst:900 msgid "" "When a module object is garbage-collected, the module's dictionary is now " -"only cleared if no one else is holding a reference to the dictionary (:issue:" -"`7140`)." +"only cleared if no one else is holding a reference to the dictionary " +"(:issue:`7140`)." msgstr "" #: ../../whatsnew/2.7.rst:909 @@ -1399,8 +1403,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:934 msgid "" "A new opcode was added to perform the initial setup for :keyword:`with` " -"statements, looking up the :meth:`~object.__enter__` and :meth:`~object." -"__exit__` methods. (Contributed by Benjamin Peterson.)" +"statements, looking up the :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods. (Contributed by Benjamin Peterson.)" msgstr "" #: ../../whatsnew/2.7.rst:938 @@ -1490,8 +1494,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:999 msgid "" "List comprehensions with an ``if`` condition are compiled into faster " -"bytecode. (Patch by Antoine Pitrou, back-ported to 2.7 by Jeffrey Yasskin; :" -"issue:`4715`.)" +"bytecode. (Patch by Antoine Pitrou, back-ported to 2.7 by Jeffrey " +"Yasskin; :issue:`4715`.)" msgstr "" #: ../../whatsnew/2.7.rst:1003 @@ -1520,8 +1524,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:1020 msgid "" "The :mod:`!cPickle` module now special-cases dictionaries, nearly halving " -"the time required to pickle them. (Contributed by Collin Winter; :issue:" -"`5670`.)" +"the time required to pickle them. (Contributed by Collin " +"Winter; :issue:`5670`.)" msgstr "" #: ../../whatsnew/2.7.rst:1027 @@ -1543,8 +1547,8 @@ msgid "" "feature for skipping modules. The constructor now takes an iterable " "containing glob-style patterns such as ``django.*``; the debugger will not " "step into stack frames from a module that matches one of these patterns. " -"(Contributed by Maru Newby after a suggestion by Senthil Kumaran; :issue:" -"`5142`.)" +"(Contributed by Maru Newby after a suggestion by Senthil " +"Kumaran; :issue:`5142`.)" msgstr "" #: ../../whatsnew/2.7.rst:1043 @@ -1586,7 +1590,7 @@ msgid "" ">>> for letter in 'here is a sample of english text':\n" "... c[letter] += 1\n" "...\n" -">>> c \n" +">>> c\n" "Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2,\n" "'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1,\n" "'p': 1, 'r': 1, 'x': 1})\n" @@ -1600,7 +1604,7 @@ msgstr "" ">>> for letter in 'here is a sample of english text':\n" "... c[letter] += 1\n" "...\n" -">>> c \n" +">>> c\n" "Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2,\n" "'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1,\n" "'p': 1, 'r': 1, 'x': 1})\n" @@ -1611,13 +1615,13 @@ msgstr "" #: ../../whatsnew/2.7.rst:1081 msgid "" -"There are three additional :class:`~collections.Counter` methods. :meth:" -"`~collections.Counter.most_common` returns the N most common elements and " -"their counts. :meth:`~collections.Counter.elements` returns an iterator " -"over the contained elements, repeating each element as many times as its " -"count. :meth:`~collections.Counter.subtract` takes an iterable and subtracts " -"one for each element instead of adding; if the argument is a dictionary or " -"another :class:`Counter`, the counts are subtracted. ::" +"There are three additional :class:`~collections.Counter` " +"methods. :meth:`~collections.Counter.most_common` returns the N most common " +"elements and their counts. :meth:`~collections.Counter.elements` returns an " +"iterator over the contained elements, repeating each element as many times " +"as its count. :meth:`~collections.Counter.subtract` takes an iterable and " +"subtracts one for each element instead of adding; if the argument is a " +"dictionary or another :class:`Counter`, the counts are subtracted. ::" msgstr "" #: ../../whatsnew/2.7.rst:1091 @@ -1648,13 +1652,13 @@ msgstr "" #: ../../whatsnew/2.7.rst:1111 msgid "" -"New method: The :class:`~collections.deque` data type now has a :meth:" -"`~collections.deque.count` method that returns the number of contained " -"elements equal to the supplied argument *x*, and a :meth:`~collections.deque." -"reverse` method that reverses the elements of the deque in-place. :class:" -"`~collections.deque` also exposes its maximum length as the read-only :attr:" -"`~collections.deque.maxlen` attribute. (Both features added by Raymond " -"Hettinger.)" +"New method: The :class:`~collections.deque` data type now has " +"a :meth:`~collections.deque.count` method that returns the number of " +"contained elements equal to the supplied argument *x*, and " +"a :meth:`~collections.deque.reverse` method that reverses the elements of " +"the deque in-place. :class:`~collections.deque` also exposes its maximum " +"length as the read-only :attr:`~collections.deque.maxlen` attribute. (Both " +"features added by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.7.rst:1119 @@ -1732,28 +1736,30 @@ msgstr "" #: ../../whatsnew/2.7.rst:1174 msgid "" "The :mod:`ctypes` module now always converts ``None`` to a C ``NULL`` " -"pointer for arguments declared as pointers. (Changed by Thomas Heller; :" -"issue:`4606`.) The underlying `libffi library <https://sourceware.org/" -"libffi/>`__ has been updated to version 3.0.9, containing various fixes for " -"different platforms. (Updated by Matthias Klose; :issue:`8142`.)" +"pointer for arguments declared as pointers. (Changed by Thomas " +"Heller; :issue:`4606`.) The underlying `libffi library <https://" +"sourceware.org/libffi/>`__ has been updated to version 3.0.9, containing " +"various fixes for different platforms. (Updated by Matthias " +"Klose; :issue:`8142`.)" msgstr "" #: ../../whatsnew/2.7.rst:1181 msgid "" "New method: the :mod:`datetime` module's :class:`~datetime.timedelta` class " "gained a :meth:`~datetime.timedelta.total_seconds` method that returns the " -"number of seconds in the duration. (Contributed by Brian Quinlan; :issue:" -"`5788`.)" +"number of seconds in the duration. (Contributed by Brian " +"Quinlan; :issue:`5788`.)" msgstr "" #: ../../whatsnew/2.7.rst:1185 msgid "" -"New method: the :class:`~decimal.Decimal` class gained a :meth:`~decimal." -"Decimal.from_float` class method that performs an exact conversion of a " -"floating-point number to a :class:`!Decimal`. This exact conversion strives " -"for the closest decimal approximation to the floating-point representation's " -"value; the resulting decimal value will therefore still include the " -"inaccuracy, if any. For example, ``Decimal.from_float(0.1)`` returns " +"New method: the :class:`~decimal.Decimal` class gained " +"a :meth:`~decimal.Decimal.from_float` class method that performs an exact " +"conversion of a floating-point number to a :class:`!Decimal`. This exact " +"conversion strives for the closest decimal approximation to the floating-" +"point representation's value; the resulting decimal value will therefore " +"still include the inaccuracy, if any. For example, " +"``Decimal.from_float(0.1)`` returns " "``Decimal('0.1000000000000000055511151231257827021181583404541015625')``. " "(Implemented by Raymond Hettinger; :issue:`4796`.)" msgstr "" @@ -1774,32 +1780,33 @@ msgstr "" msgid "" "The constructor for :class:`~decimal.Decimal` now accepts floating-point " "numbers (added by Raymond Hettinger; :issue:`8257`) and non-European Unicode " -"characters such as Arabic-Indic digits (contributed by Mark Dickinson; :" -"issue:`6595`)." +"characters such as Arabic-Indic digits (contributed by Mark " +"Dickinson; :issue:`6595`)." msgstr "" #: ../../whatsnew/2.7.rst:1210 msgid "" "Most of the methods of the :class:`~decimal.Context` class now accept " "integers as well as :class:`~decimal.Decimal` instances; the only exceptions " -"are the :meth:`~decimal.Context.canonical` and :meth:`~decimal.Context." -"is_canonical` methods. (Patch by Juan José Conti; :issue:`7633`.)" +"are the :meth:`~decimal.Context.canonical` " +"and :meth:`~decimal.Context.is_canonical` methods. (Patch by Juan José " +"Conti; :issue:`7633`.)" msgstr "" #: ../../whatsnew/2.7.rst:1215 msgid "" -"When using :class:`~decimal.Decimal` instances with a string's :meth:`~str." -"format` method, the default alignment was previously left-alignment. This " -"has been changed to right-alignment, which is more sensible for numeric " -"types. (Changed by Mark Dickinson; :issue:`6857`.)" +"When using :class:`~decimal.Decimal` instances with a " +"string's :meth:`~str.format` method, the default alignment was previously " +"left-alignment. This has been changed to right-alignment, which is more " +"sensible for numeric types. (Changed by Mark Dickinson; :issue:`6857`.)" msgstr "" #: ../../whatsnew/2.7.rst:1220 ../../whatsnew/2.7.rst:2484 msgid "" -"Comparisons involving a signaling NaN value (or ``sNAN``) now signal :const:" -"`~decimal.InvalidOperation` instead of silently returning a true or false " -"value depending on the comparison operator. Quiet NaN values (or ``NaN``) " -"are now hashable. (Fixed by Mark Dickinson; :issue:`7279`.)" +"Comparisons involving a signaling NaN value (or ``sNAN``) now " +"signal :const:`~decimal.InvalidOperation` instead of silently returning a " +"true or false value depending on the comparison operator. Quiet NaN values " +"(or ``NaN``) are now hashable. (Fixed by Mark Dickinson; :issue:`7279`.)" msgstr "" #: ../../whatsnew/2.7.rst:1226 @@ -1829,16 +1836,16 @@ msgstr "" msgid "" "The :mod:`email` module's :class:`~email.message.Message` class will now " "accept a Unicode-valued payload, automatically converting the payload to the " -"encoding specified by :attr:`!output_charset`. (Added by R. David Murray; :" -"issue:`1368247`.)" +"encoding specified by :attr:`!output_charset`. (Added by R. David " +"Murray; :issue:`1368247`.)" msgstr "" #: ../../whatsnew/2.7.rst:1247 msgid "" -"The :class:`~fractions.Fraction` class now accepts a single float or :class:" -"`~decimal.Decimal` instance, or two rational numbers, as arguments to its " -"constructor. (Implemented by Mark Dickinson; rationals added in :issue:" -"`5812`, and float/decimal in :issue:`8294`.)" +"The :class:`~fractions.Fraction` class now accepts a single float " +"or :class:`~decimal.Decimal` instance, or two rational numbers, as arguments " +"to its constructor. (Implemented by Mark Dickinson; rationals added " +"in :issue:`5812`, and float/decimal in :issue:`8294`.)" msgstr "" #: ../../whatsnew/2.7.rst:1253 @@ -1852,36 +1859,37 @@ msgstr "" msgid "" "New class: :class:`~ftplib.FTP_TLS` in the :mod:`ftplib` module provides " "secure FTP connections using TLS encapsulation of authentication as well as " -"subsequent control and data transfers. (Contributed by Giampaolo Rodola; :" -"issue:`2054`.)" +"subsequent control and data transfers. (Contributed by Giampaolo " +"Rodola; :issue:`2054`.)" msgstr "" #: ../../whatsnew/2.7.rst:1266 msgid "" "The :meth:`~ftplib.FTP.storbinary` method for binary uploads can now restart " -"uploads thanks to an added *rest* parameter (patch by Pablo Mouzo; :issue:" -"`6845`.)" +"uploads thanks to an added *rest* parameter (patch by Pablo " +"Mouzo; :issue:`6845`.)" msgstr "" #: ../../whatsnew/2.7.rst:1270 msgid "" -"New class decorator: :func:`~functools.total_ordering` in the :mod:" -"`functools` module takes a class that defines an :meth:`~object.__eq__` " -"method and one of :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:" -"`~object.__gt__`, or :meth:`~object.__ge__`, and generates the missing " -"comparison methods. Since the :meth:`!__cmp__` method is being deprecated " -"in Python 3.x, this decorator makes it easier to define ordered classes. " -"(Added by Raymond Hettinger; :issue:`5479`.)" +"New class decorator: :func:`~functools.total_ordering` in " +"the :mod:`functools` module takes a class that defines " +"an :meth:`~object.__eq__` method and one " +"of :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " +"or :meth:`~object.__ge__`, and generates the missing comparison methods. " +"Since the :meth:`!__cmp__` method is being deprecated in Python 3.x, this " +"decorator makes it easier to define ordered classes. (Added by Raymond " +"Hettinger; :issue:`5479`.)" msgstr "" #: ../../whatsnew/2.7.rst:1278 msgid "" "New function: :func:`~functools.cmp_to_key` will take an old-style " "comparison function that expects two arguments and return a new callable " -"that can be used as the *key* parameter to functions such as :func:" -"`sorted`, :func:`min` and :func:`max`, etc. The primary intended use is to " -"help with making code compatible with Python 3.x. (Added by Raymond " -"Hettinger.)" +"that can be used as the *key* parameter to functions such " +"as :func:`sorted`, :func:`min` and :func:`max`, etc. The primary intended " +"use is to help with making code compatible with Python 3.x. (Added by " +"Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.7.rst:1285 @@ -1895,12 +1903,12 @@ msgstr "" msgid "" "The :mod:`gzip` module's :class:`~gzip.GzipFile` now supports the context " "management protocol, so you can write ``with gzip.GzipFile(...) as f:`` " -"(contributed by Hagen Fürstenau; :issue:`3860`), and it now implements the :" -"class:`io.BufferedIOBase` ABC, so you can wrap it with :class:`io." -"BufferedReader` for faster processing (contributed by Nir Aides; :issue:" -"`7471`). It's also now possible to override the modification time recorded " -"in a gzipped file by providing an optional timestamp to the constructor. " -"(Contributed by Jacques Frechet; :issue:`4272`.)" +"(contributed by Hagen Fürstenau; :issue:`3860`), and it now implements " +"the :class:`io.BufferedIOBase` ABC, so you can wrap it " +"with :class:`io.BufferedReader` for faster processing (contributed by Nir " +"Aides; :issue:`7471`). It's also now possible to override the modification " +"time recorded in a gzipped file by providing an optional timestamp to the " +"constructor. (Contributed by Jacques Frechet; :issue:`4272`.)" msgstr "" #: ../../whatsnew/2.7.rst:1299 @@ -1920,18 +1928,19 @@ msgstr "" #: ../../whatsnew/2.7.rst:1309 msgid "" -"The default :class:`~http.client.HTTPResponse` class used by the :mod:" -"`httplib <http>` module now supports buffering, resulting in much faster " -"reading of HTTP responses. (Contributed by Kristján Valur Jónsson; :issue:" -"`4879`.)" +"The default :class:`~http.client.HTTPResponse` class used by " +"the :mod:`httplib <http>` module now supports buffering, resulting in much " +"faster reading of HTTP responses. (Contributed by Kristján Valur " +"Jónsson; :issue:`4879`.)" msgstr "" #: ../../whatsnew/2.7.rst:1313 msgid "" -"The :class:`~http.client.HTTPConnection` and :class:`~http.client." -"HTTPSConnection` classes now support a *source_address* parameter, a " -"``(host, port)`` 2-tuple giving the source address that will be used for the " -"connection. (Contributed by Eldon Ziegler; :issue:`3972`.)" +"The :class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` classes now support a " +"*source_address* parameter, a ``(host, port)`` 2-tuple giving the source " +"address that will be used for the connection. (Contributed by Eldon " +"Ziegler; :issue:`3972`.)" msgstr "" #: ../../whatsnew/2.7.rst:1318 @@ -1986,8 +1995,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:1353 msgid "" -"One minor resulting change: the :class:`io.TextIOBase` class now has an :" -"attr:`~io.TextIOBase.errors` attribute giving the error setting used for " +"One minor resulting change: the :class:`io.TextIOBase` class now has " +"an :attr:`~io.TextIOBase.errors` attribute giving the error setting used for " "encoding and decoding errors (one of ``'strict'``, ``'replace'``, " "``'ignore'``)." msgstr "" @@ -1995,10 +2004,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:1358 msgid "" "The :class:`io.FileIO` class now raises an :exc:`OSError` when passed an " -"invalid file descriptor. (Implemented by Benjamin Peterson; :issue:" -"`4991`.) The :meth:`~io.IOBase.truncate` method now preserves the file " -"position; previously it would change the file position to the end of the new " -"file. (Fixed by Pascal Chambon; :issue:`6939`.)" +"invalid file descriptor. (Implemented by Benjamin " +"Peterson; :issue:`4991`.) The :meth:`~io.IOBase.truncate` method now " +"preserves the file position; previously it would change the file position to " +"the end of the new file. (Fixed by Pascal Chambon; :issue:`6939`.)" msgstr "" #: ../../whatsnew/2.7.rst:1364 @@ -2039,9 +2048,9 @@ msgstr "" msgid "" "The :func:`itertools.count` function now has a *step* argument that allows " "incrementing by values other than 1. :func:`~itertools.count` also now " -"allows keyword arguments, and using non-integer values such as floats or :" -"class:`~decimal.Decimal` instances. (Implemented by Raymond Hettinger; :" -"issue:`5032`.)" +"allows keyword arguments, and using non-integer values such as floats " +"or :class:`~decimal.Decimal` instances. (Implemented by Raymond " +"Hettinger; :issue:`5032`.)" msgstr "" #: ../../whatsnew/2.7.rst:1391 @@ -2078,13 +2087,13 @@ msgstr "" #: ../../whatsnew/2.7.rst:1412 msgid "" -"New functions: the :mod:`math` module gained :func:`~math.erf` and :func:" -"`~math.erfc` for the error function and the complementary error function, :" -"func:`~math.expm1` which computes ``e**x - 1`` with more precision than " -"using :func:`~math.exp` and subtracting 1, :func:`~math.gamma` for the Gamma " -"function, and :func:`~math.lgamma` for the natural log of the Gamma " -"function. (Contributed by Mark Dickinson and nirinA raseliarison; :issue:" -"`3366`.)" +"New functions: the :mod:`math` module gained :func:`~math.erf` " +"and :func:`~math.erfc` for the error function and the complementary error " +"function, :func:`~math.expm1` which computes ``e**x - 1`` with more " +"precision than using :func:`~math.exp` and subtracting " +"1, :func:`~math.gamma` for the Gamma function, and :func:`~math.lgamma` for " +"the natural log of the Gamma function. (Contributed by Mark Dickinson and " +"nirinA raseliarison; :issue:`3366`.)" msgstr "" #: ../../whatsnew/2.7.rst:1420 @@ -2113,13 +2122,14 @@ msgstr "" #: ../../whatsnew/2.7.rst:1437 msgid "" -"New functions: the :mod:`os` module wraps the following POSIX system calls: :" -"func:`~os.getresgid` and :func:`~os.getresuid`, which return the real, " -"effective, and saved GIDs and UIDs; :func:`~os.setresgid` and :func:`~os." -"setresuid`, which set real, effective, and saved GIDs and UIDs to new " -"values; :func:`~os.initgroups`, which initialize the group access list for " -"the current process. (GID/UID functions contributed by Travis H.; :issue:" -"`6508`. Support for initgroups added by Jean-Paul Calderone; :issue:`7333`.)" +"New functions: the :mod:`os` module wraps the following POSIX system " +"calls: :func:`~os.getresgid` and :func:`~os.getresuid`, which return the " +"real, effective, and saved GIDs and UIDs; :func:`~os.setresgid` " +"and :func:`~os.setresuid`, which set real, effective, and saved GIDs and " +"UIDs to new values; :func:`~os.initgroups`, which initialize the group " +"access list for the current process. (GID/UID functions contributed by " +"Travis H.; :issue:`6508`. Support for initgroups added by Jean-Paul " +"Calderone; :issue:`7333`.)" msgstr "" #: ../../whatsnew/2.7.rst:1447 @@ -2131,11 +2141,12 @@ msgstr "" #: ../../whatsnew/2.7.rst:1451 msgid "" -"In the :mod:`os.path` module, the :func:`~os.path.normpath` and :func:`~os." -"path.abspath` functions now preserve Unicode; if their input path is a " -"Unicode string, the return value is also a Unicode string. (:meth:`~os.path." -"normpath` fixed by Matt Giuca in :issue:`5827`; :meth:`~os.path.abspath` " -"fixed by Ezio Melotti in :issue:`3426`.)" +"In the :mod:`os.path` module, the :func:`~os.path.normpath` " +"and :func:`~os.path.abspath` functions now preserve Unicode; if their input " +"path is a Unicode string, the return value is also a Unicode string. " +"(:meth:`~os.path.normpath` fixed by Matt Giuca " +"in :issue:`5827`; :meth:`~os.path.abspath` fixed by Ezio Melotti " +"in :issue:`3426`.)" msgstr "" #: ../../whatsnew/2.7.rst:1457 @@ -2147,24 +2158,26 @@ msgstr "" #: ../../whatsnew/2.7.rst:1461 msgid "" -"The :mod:`re` module's :func:`~re.split`, :func:`~re.sub`, and :func:`~re." -"subn` now accept an optional *flags* argument, for consistency with the " -"other functions in the module. (Added by Gregory P. Smith.)" +"The :mod:`re` module's :func:`~re.split`, :func:`~re.sub`, " +"and :func:`~re.subn` now accept an optional *flags* argument, for " +"consistency with the other functions in the module. (Added by Gregory P. " +"Smith.)" msgstr "" #: ../../whatsnew/2.7.rst:1465 msgid "" "New function: :func:`~runpy.run_path` in the :mod:`runpy` module will " "execute the code at a provided *path* argument. *path* can be the path of a " -"Python source file (:file:`example.py`), a compiled bytecode file (:file:" -"`example.pyc`), a directory (:file:`./package/`), or a zip archive (:file:" -"`example.zip`). If a directory or zip path is provided, it will be added to " -"the front of ``sys.path`` and the module :mod:`__main__` will be imported. " -"It's expected that the directory or zip contains a :file:`__main__.py`; if " -"it doesn't, some other :file:`__main__.py` might be imported from a location " -"later in ``sys.path``. This makes more of the machinery of :mod:`runpy` " -"available to scripts that want to mimic the way Python's command line " -"processes an explicit path name. (Added by Nick Coghlan; :issue:`6816`.)" +"Python source file (:file:`example.py`), a compiled bytecode file " +"(:file:`example.pyc`), a directory (:file:`./package/`), or a zip archive " +"(:file:`example.zip`). If a directory or zip path is provided, it will be " +"added to the front of ``sys.path`` and the module :mod:`__main__` will be " +"imported. It's expected that the directory or zip contains " +"a :file:`__main__.py`; if it doesn't, some other :file:`__main__.py` might " +"be imported from a location later in ``sys.path``. This makes more of the " +"machinery of :mod:`runpy` available to scripts that want to mimic the way " +"Python's command line processes an explicit path name. (Added by Nick " +"Coghlan; :issue:`6816`.)" msgstr "" #: ../../whatsnew/2.7.rst:1479 @@ -2188,27 +2201,28 @@ msgstr "" msgid "" "The :mod:`signal` module no longer re-installs the signal handler unless " "this is truly necessary, which fixes a bug that could make it impossible to " -"catch the EINTR signal robustly. (Fixed by Charles-Francois Natali; :issue:" -"`8354`.)" +"catch the EINTR signal robustly. (Fixed by Charles-Francois " +"Natali; :issue:`8354`.)" msgstr "" #: ../../whatsnew/2.7.rst:1495 msgid "" "New functions: in the :mod:`site` module, three new functions return various " "site- and user-specific paths. :func:`~site.getsitepackages` returns a list " -"containing all global site-packages directories, :func:`~site." -"getusersitepackages` returns the path of the user's site-packages directory, " -"and :func:`~site.getuserbase` returns the value of the :data:`~site." -"USER_BASE` environment variable, giving the path to a directory that can be " -"used to store data. (Contributed by Tarek Ziadé; :issue:`6693`.)" +"containing all global site-packages " +"directories, :func:`~site.getusersitepackages` returns the path of the " +"user's site-packages directory, and :func:`~site.getuserbase` returns the " +"value of the :data:`~site.USER_BASE` environment variable, giving the path " +"to a directory that can be used to store data. (Contributed by Tarek " +"Ziadé; :issue:`6693`.)" msgstr "" #: ../../whatsnew/2.7.rst:1506 msgid "" -"The :mod:`site` module now reports exceptions occurring when the :mod:" -"`sitecustomize` module is imported, and will no longer catch and swallow " -"the :exc:`KeyboardInterrupt` exception. (Fixed by Victor Stinner; :issue:" -"`3137`.)" +"The :mod:`site` module now reports exceptions occurring when " +"the :mod:`sitecustomize` module is imported, and will no longer catch and " +"swallow the :exc:`KeyboardInterrupt` exception. (Fixed by Victor " +"Stinner; :issue:`3137`.)" msgstr "" #: ../../whatsnew/2.7.rst:1511 @@ -2220,25 +2234,27 @@ msgstr "" #: ../../whatsnew/2.7.rst:1516 msgid "" -"The :meth:`~socket.socket.recv_into` and :meth:`~socket.socket." -"recvfrom_into` methods will now write into objects that support the buffer " -"API, most usefully the :class:`bytearray` and :class:`memoryview` objects. " -"(Implemented by Antoine Pitrou; :issue:`8104`.)" +"The :meth:`~socket.socket.recv_into` " +"and :meth:`~socket.socket.recvfrom_into` methods will now write into objects " +"that support the buffer API, most usefully the :class:`bytearray` " +"and :class:`memoryview` objects. (Implemented by Antoine " +"Pitrou; :issue:`8104`.)" msgstr "" #: ../../whatsnew/2.7.rst:1521 msgid "" -"The :mod:`SocketServer <socketserver>` module's :class:`~socketserver." -"TCPServer` class now supports socket timeouts and disabling the Nagle " -"algorithm. The :attr:`!disable_nagle_algorithm` class attribute defaults to " -"``False``; if overridden to be true, new request connections will have the " -"TCP_NODELAY option set to prevent buffering many small sends into a single " -"TCP packet. The :attr:`~socketserver.BaseServer.timeout` class attribute can " -"hold a timeout in seconds that will be applied to the request socket; if no " -"request is received within that time, :meth:`~socketserver.BaseServer." -"handle_timeout` will be called and :meth:`~socketserver.BaseServer." -"handle_request` will return. (Contributed by Kristján Valur Jónsson; :issue:" -"`6192` and :issue:`6267`.)" +"The :mod:`SocketServer <socketserver>` " +"module's :class:`~socketserver.TCPServer` class now supports socket timeouts " +"and disabling the Nagle algorithm. The :attr:`!disable_nagle_algorithm` " +"class attribute defaults to ``False``; if overridden to be true, new request " +"connections will have the TCP_NODELAY option set to prevent buffering many " +"small sends into a single TCP packet. " +"The :attr:`~socketserver.BaseServer.timeout` class attribute can hold a " +"timeout in seconds that will be applied to the request socket; if no request " +"is received within that " +"time, :meth:`~socketserver.BaseServer.handle_timeout` will be called " +"and :meth:`~socketserver.BaseServer.handle_request` will return. " +"(Contributed by Kristján Valur Jónsson; :issue:`6192` and :issue:`6267`.)" msgstr "" #: ../../whatsnew/2.7.rst:1533 @@ -2247,18 +2263,19 @@ msgid "" "of the `pysqlite package <https://github.com/ghaering/pysqlite>`__. Version " "2.6.0 includes a number of bugfixes, and adds the ability to load SQLite " "extensions from shared libraries. Call the ``enable_load_extension(True)`` " -"method to enable extensions, and then call :meth:`~sqlite3.Connection." -"load_extension` to load a particular shared library. (Updated by Gerhard " -"Häring.)" +"method to enable extensions, and then " +"call :meth:`~sqlite3.Connection.load_extension` to load a particular shared " +"library. (Updated by Gerhard Häring.)" msgstr "" #: ../../whatsnew/2.7.rst:1540 msgid "" "The :mod:`ssl` module's :class:`~ssl.SSLSocket` objects now support the " -"buffer API, which fixed a test suite failure (fix by Antoine Pitrou; :issue:" -"`7133`) and automatically set OpenSSL's :c:macro:`!SSL_MODE_AUTO_RETRY`, " -"which will prevent an error code being returned from :meth:`recv` operations " -"that trigger an SSL renegotiation (fix by Antoine Pitrou; :issue:`8222`)." +"buffer API, which fixed a test suite failure (fix by Antoine " +"Pitrou; :issue:`7133`) and automatically set OpenSSL's :c:macro:`!" +"SSL_MODE_AUTO_RETRY`, which will prevent an error code being returned " +"from :meth:`recv` operations that trigger an SSL renegotiation (fix by " +"Antoine Pitrou; :issue:`8222`)." msgstr "" #: ../../whatsnew/2.7.rst:1547 @@ -2280,10 +2297,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:1560 msgid "" -"The version of OpenSSL being used is now available as the module attributes :" -"const:`ssl.OPENSSL_VERSION` (a string), :const:`ssl.OPENSSL_VERSION_INFO` (a " -"5-tuple), and :const:`ssl.OPENSSL_VERSION_NUMBER` (an integer). (Added by " -"Antoine Pitrou; :issue:`8321`.)" +"The version of OpenSSL being used is now available as the module " +"attributes :const:`ssl.OPENSSL_VERSION` (a " +"string), :const:`ssl.OPENSSL_VERSION_INFO` (a 5-tuple), " +"and :const:`ssl.OPENSSL_VERSION_NUMBER` (an integer). (Added by Antoine " +"Pitrou; :issue:`8321`.)" msgstr "" #: ../../whatsnew/2.7.rst:1566 @@ -2299,10 +2317,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:1575 msgid "" -"New function: the :mod:`subprocess` module's :func:`~subprocess." -"check_output` runs a command with a specified set of arguments and returns " -"the command's output as a string when the command runs without error, or " -"raises a :exc:`~subprocess.CalledProcessError` exception otherwise." +"New function: the :mod:`subprocess` " +"module's :func:`~subprocess.check_output` runs a command with a specified " +"set of arguments and returns the command's output as a string when the " +"command runs without error, or raises " +"a :exc:`~subprocess.CalledProcessError` exception otherwise." msgstr "" #: ../../whatsnew/2.7.rst:1582 @@ -2330,10 +2349,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:1596 msgid "" -"New function: :func:`~symtable.Symbol.is_declared_global` in the :mod:" -"`symtable` module returns true for variables that are explicitly declared to " -"be global, false for ones that are implicitly global. (Contributed by Jeremy " -"Hylton.)" +"New function: :func:`~symtable.Symbol.is_declared_global` in " +"the :mod:`symtable` module returns true for variables that are explicitly " +"declared to be global, false for ones that are implicitly global. " +"(Contributed by Jeremy Hylton.)" msgstr "" #: ../../whatsnew/2.7.rst:1601 ../../whatsnew/2.7.rst:2500 @@ -2353,8 +2372,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:1610 msgid "" ":func:`sys.getwindowsversion` also returns a named tuple, with attributes " -"named :attr:`!major`, :attr:`!minor`, :attr:`!build`, :attr:`!platform`, :" -"attr:`!service_pack`, :attr:`!service_pack_major`, :attr:`!" +"named :attr:`!major`, :attr:`!minor`, :attr:`!build`, :attr:`!" +"platform`, :attr:`!service_pack`, :attr:`!service_pack_major`, :attr:`!" "service_pack_minor`, :attr:`!suite_mask`, and :attr:`!product_type`. " "(Contributed by Brian Curtin; :issue:`7766`.)" msgstr "" @@ -2379,8 +2398,8 @@ msgid "" "file will be excluded from the resulting archive. This is more powerful " "than the existing *exclude* argument, which has therefore been deprecated. " "(Added by Lars Gustäbel; :issue:`6856`.) The :class:`~tarfile.TarFile` class " -"also now supports the context management protocol. (Added by Lars Gustäbel; :" -"issue:`7232`.)" +"also now supports the context management protocol. (Added by Lars " +"Gustäbel; :issue:`7232`.)" msgstr "" #: ../../whatsnew/2.7.rst:1636 @@ -2397,10 +2416,10 @@ msgstr "" msgid "" "The Unicode database provided by the :mod:`unicodedata` module is now used " "internally to determine which characters are numeric, whitespace, or " -"represent line breaks. The database also includes information from the :" -"file:`Unihan.txt` data file (patch by Anders Chrigström and Amaury Forgeot " -"d'Arc; :issue:`1571184`) and has been updated to version 5.2.0 (updated by " -"Florent Xicluna; :issue:`8024`)." +"represent line breaks. The database also includes information from " +"the :file:`Unihan.txt` data file (patch by Anders Chrigström and Amaury " +"Forgeot d'Arc; :issue:`1571184`) and has been updated to version 5.2.0 " +"(updated by Florent Xicluna; :issue:`8024`)." msgstr "" #: ../../whatsnew/2.7.rst:1651 ../../whatsnew/2.7.rst:2512 @@ -2440,8 +2459,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:1678 msgid "" "The :mod:`urlparse <urllib.parse>` module also supports IPv6 literal " -"addresses as defined by :rfc:`2732` (contributed by Senthil Kumaran; :issue:" -"`2987`)." +"addresses as defined by :rfc:`2732` (contributed by Senthil " +"Kumaran; :issue:`2987`)." msgstr "" #: ../../whatsnew/2.7.rst:1681 @@ -2470,13 +2489,13 @@ msgstr "" #: ../../whatsnew/2.7.rst:1700 msgid "" -"The XML-RPC client and server, provided by the :mod:`xmlrpclib <xmlrpc." -"client>` and :mod:`SimpleXMLRPCServer <xmlrpc.server>` modules, have " +"The XML-RPC client and server, provided by the :mod:`xmlrpclib " +"<xmlrpc.client>` and :mod:`SimpleXMLRPCServer <xmlrpc.server>` modules, have " "improved performance by supporting HTTP/1.1 keep-alive and by optionally " "using gzip encoding to compress the XML being exchanged. The gzip " -"compression is controlled by the :attr:`!encode_threshold` attribute of :" -"class:`~xmlrpc.server.SimpleXMLRPCRequestHandler`, which contains a size in " -"bytes; responses larger than this will be compressed. (Contributed by " +"compression is controlled by the :attr:`!encode_threshold` attribute " +"of :class:`~xmlrpc.server.SimpleXMLRPCRequestHandler`, which contains a size " +"in bytes; responses larger than this will be compressed. (Contributed by " "Kristján Valur Jónsson; :issue:`6267`.)" msgstr "" @@ -2491,9 +2510,9 @@ msgstr "" msgid "" ":mod:`zipfile` now also supports archiving empty directories and extracts " "them correctly. (Fixed by Kuba Wieczorek; :issue:`4710`.) Reading files out " -"of an archive is faster, and interleaving :meth:`read() <io.BufferedIOBase." -"read>` and :meth:`readline() <io.IOBase.readline>` now works correctly. " -"(Contributed by Nir Aides; :issue:`7610`.)" +"of an archive is faster, and interleaving :meth:`read() " +"<io.BufferedIOBase.read>` and :meth:`readline() <io.IOBase.readline>` now " +"works correctly. (Contributed by Nir Aides; :issue:`7610`.)" msgstr "" #: ../../whatsnew/2.7.rst:1720 @@ -2522,8 +2541,8 @@ msgid "" "useful for implementers of Python interpreters and to users who wish to " "write new importers that can participate in the import process. Python 2.7 " "doesn't contain the complete :mod:`importlib` package, but instead has a " -"tiny subset that contains a single function, :func:`~importlib." -"import_module`." +"tiny subset that contains a single " +"function, :func:`~importlib.import_module`." msgstr "" #: ../../whatsnew/2.7.rst:1747 @@ -2639,10 +2658,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:1818 msgid "" -"The :mod:`tkinter.ttk` module was written by Guilherme Polo and added in :" -"issue:`2983`. An alternate version called ``Tile.py``, written by Martin " -"Franklin and maintained by Kevin Walzer, was proposed for inclusion in :" -"issue:`2618`, but the authors argued that Guilherme Polo's work was more " +"The :mod:`tkinter.ttk` module was written by Guilherme Polo and added " +"in :issue:`2983`. An alternate version called ``Tile.py``, written by " +"Martin Franklin and maintained by Kevin Walzer, was proposed for inclusion " +"in :issue:`2618`, but the authors argued that Guilherme Polo's work was more " "comprehensive." msgstr "" @@ -2714,8 +2733,8 @@ msgstr "" msgid "" ":option:`-f <unittest -f>` or :option:`!--failfast` makes test execution " "stop immediately when a test fails instead of continuing to execute further " -"tests. (Suggested by Cliff Dyer and implemented by Michael Foord; :issue:" -"`8074`.)" +"tests. (Suggested by Cliff Dyer and implemented by Michael " +"Foord; :issue:`8074`.)" msgstr "" #: ../../whatsnew/2.7.rst:1874 @@ -2733,13 +2752,13 @@ msgstr "" #: ../../whatsnew/2.7.rst:1881 msgid "" -"The error messages for :meth:`~unittest.TestCase.assertEqual`, :meth:" -"`~unittest.TestCase.assertTrue`, and :meth:`~unittest.TestCase.assertFalse` " -"failures now provide more information. If you set the :attr:`~unittest." -"TestCase.longMessage` attribute of your :class:`~unittest.TestCase` classes " -"to true, both the standard error message and any additional message you " -"provide will be printed for failures. (Added by Michael Foord; :issue:" -"`5663`.)" +"The error messages " +"for :meth:`~unittest.TestCase.assertEqual`, :meth:`~unittest.TestCase.assertTrue`, " +"and :meth:`~unittest.TestCase.assertFalse` failures now provide more " +"information. If you set the :attr:`~unittest.TestCase.longMessage` " +"attribute of your :class:`~unittest.TestCase` classes to true, both the " +"standard error message and any additional message you provide will be " +"printed for failures. (Added by Michael Foord; :issue:`5663`.)" msgstr "" #: ../../whatsnew/2.7.rst:1888 @@ -2762,22 +2781,24 @@ msgstr "(由 Antoine Pitrou 實作;:issue:`4444`。)" #: ../../whatsnew/2.7.rst:1899 msgid "" "Module- and class-level setup and teardown fixtures are now supported. " -"Modules can contain :func:`~unittest.setUpModule` and :func:`~unittest." -"tearDownModule` functions. Classes can have :meth:`~unittest.TestCase." -"setUpClass` and :meth:`~unittest.TestCase.tearDownClass` methods that must " -"be defined as class methods (using ``@classmethod`` or equivalent). These " -"functions and methods are invoked when the test runner switches to a test " -"case in a different module or class." +"Modules can contain :func:`~unittest.setUpModule` " +"and :func:`~unittest.tearDownModule` functions. Classes can " +"have :meth:`~unittest.TestCase.setUpClass` " +"and :meth:`~unittest.TestCase.tearDownClass` methods that must be defined as " +"class methods (using ``@classmethod`` or equivalent). These functions and " +"methods are invoked when the test runner switches to a test case in a " +"different module or class." msgstr "" #: ../../whatsnew/2.7.rst:1907 msgid "" -"The methods :meth:`~unittest.TestCase.addCleanup` and :meth:`~unittest." -"TestCase.doCleanups` were added. :meth:`~unittest.TestCase.addCleanup` lets " -"you add cleanup functions that will be called unconditionally (after :meth:" -"`~unittest.TestCase.setUp` if :meth:`~unittest.TestCase.setUp` fails, " -"otherwise after :meth:`~unittest.TestCase.tearDown`). This allows for much " -"simpler resource allocation and deallocation during tests (:issue:`5679`)." +"The methods :meth:`~unittest.TestCase.addCleanup` " +"and :meth:`~unittest.TestCase.doCleanups` were " +"added. :meth:`~unittest.TestCase.addCleanup` lets you add cleanup functions " +"that will be called unconditionally (after :meth:`~unittest.TestCase.setUp` " +"if :meth:`~unittest.TestCase.setUp` fails, otherwise " +"after :meth:`~unittest.TestCase.tearDown`). This allows for much simpler " +"resource allocation and deallocation during tests (:issue:`5679`)." msgstr "" #: ../../whatsnew/2.7.rst:1915 @@ -2790,31 +2811,31 @@ msgstr "" #: ../../whatsnew/2.7.rst:1920 msgid "" -":meth:`~unittest.TestCase.assertIsNone` and :meth:`~unittest.TestCase." -"assertIsNotNone` take one expression and verify that the result is or is not " -"``None``." +":meth:`~unittest.TestCase.assertIsNone` " +"and :meth:`~unittest.TestCase.assertIsNotNone` take one expression and " +"verify that the result is or is not ``None``." msgstr "" #: ../../whatsnew/2.7.rst:1923 msgid "" -":meth:`~unittest.TestCase.assertIs` and :meth:`~unittest.TestCase." -"assertIsNot` take two values and check whether the two values evaluate to " -"the same object or not. (Added by Michael Foord; :issue:`2578`.)" +":meth:`~unittest.TestCase.assertIs` " +"and :meth:`~unittest.TestCase.assertIsNot` take two values and check whether " +"the two values evaluate to the same object or not. (Added by Michael " +"Foord; :issue:`2578`.)" msgstr "" #: ../../whatsnew/2.7.rst:1927 msgid "" -":meth:`~unittest.TestCase.assertIsInstance` and :meth:`~unittest.TestCase." -"assertNotIsInstance` check whether the resulting object is an instance of a " -"particular class, or of one of a tuple of classes. (Added by Georg Brandl; :" -"issue:`7031`.)" +":meth:`~unittest.TestCase.assertIsInstance` " +"and :meth:`~unittest.TestCase.assertNotIsInstance` check whether the " +"resulting object is an instance of a particular class, or of one of a tuple " +"of classes. (Added by Georg Brandl; :issue:`7031`.)" msgstr "" #: ../../whatsnew/2.7.rst:1932 msgid "" -":meth:`~unittest.TestCase.assertGreater`, :meth:`~unittest.TestCase." -"assertGreaterEqual`, :meth:`~unittest.TestCase.assertLess`, and :meth:" -"`~unittest.TestCase.assertLessEqual` compare two quantities." +":meth:`~unittest.TestCase.assertGreater`, :meth:`~unittest.TestCase.assertGreaterEqual`, :meth:`~unittest.TestCase.assertLess`, " +"and :meth:`~unittest.TestCase.assertLessEqual` compare two quantities." msgstr "" #: ../../whatsnew/2.7.rst:1936 @@ -2827,10 +2848,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:1941 msgid "" -":meth:`assertRegexpMatches() <unittest.TestCase.assertRegex>` and :meth:" -"`assertNotRegexpMatches() <unittest.TestCase.assertNotRegex>` checks whether " -"the first argument is a string matching or not matching the regular " -"expression provided as the second argument (:issue:`8038`)." +":meth:`assertRegexpMatches() <unittest.TestCase.assertRegex>` " +"and :meth:`assertNotRegexpMatches() <unittest.TestCase.assertNotRegex>` " +"checks whether the first argument is a string matching or not matching the " +"regular expression provided as the second argument (:issue:`8038`)." msgstr "" #: ../../whatsnew/2.7.rst:1946 @@ -2843,8 +2864,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:1951 msgid "" -":meth:`~unittest.TestCase.assertIn` and :meth:`~unittest.TestCase." -"assertNotIn` tests whether *first* is or is not in *second*." +":meth:`~unittest.TestCase.assertIn` " +"and :meth:`~unittest.TestCase.assertNotIn` tests whether *first* is or is " +"not in *second*." msgstr "" #: ../../whatsnew/2.7.rst:1954 @@ -2861,13 +2883,14 @@ msgstr "" #: ../../whatsnew/2.7.rst:1960 msgid "" -"Similarly, :meth:`~unittest.TestCase.assertListEqual` and :meth:`~unittest." -"TestCase.assertTupleEqual` compare the specified types and explain any " -"differences without necessarily printing their full values; these methods " -"are now used by default when comparing lists and tuples using :meth:" -"`~unittest.TestCase.assertEqual`. More generally, :meth:`~unittest.TestCase." -"assertSequenceEqual` compares two sequences and can optionally check whether " -"both sequences are of a particular type." +"Similarly, :meth:`~unittest.TestCase.assertListEqual` " +"and :meth:`~unittest.TestCase.assertTupleEqual` compare the specified types " +"and explain any differences without necessarily printing their full values; " +"these methods are now used by default when comparing lists and tuples " +"using :meth:`~unittest.TestCase.assertEqual`. More " +"generally, :meth:`~unittest.TestCase.assertSequenceEqual` compares two " +"sequences and can optionally check whether both sequences are of a " +"particular type." msgstr "" #: ../../whatsnew/2.7.rst:1968 @@ -2881,45 +2904,47 @@ msgstr "" #: ../../whatsnew/2.7.rst:1973 msgid "" -":meth:`~unittest.TestCase.assertAlmostEqual` and :meth:`~unittest.TestCase." -"assertNotAlmostEqual` test whether *first* and *second* are approximately " -"equal. This method can either round their difference to an optionally " -"specified number of *places* (the default is 7) and compare it to zero, or " -"require the difference to be smaller than a supplied *delta* value." +":meth:`~unittest.TestCase.assertAlmostEqual` " +"and :meth:`~unittest.TestCase.assertNotAlmostEqual` test whether *first* and " +"*second* are approximately equal. This method can either round their " +"difference to an optionally specified number of *places* (the default is 7) " +"and compare it to zero, or require the difference to be smaller than a " +"supplied *delta* value." msgstr "" #: ../../whatsnew/2.7.rst:1979 msgid "" -":meth:`~unittest.TestLoader.loadTestsFromName` properly honors the :attr:" -"`~unittest.TestLoader.suiteClass` attribute of the :class:`~unittest." -"TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.)" +":meth:`~unittest.TestLoader.loadTestsFromName` properly honors " +"the :attr:`~unittest.TestLoader.suiteClass` attribute of " +"the :class:`~unittest.TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.)" msgstr "" #: ../../whatsnew/2.7.rst:1983 msgid "" "A new hook lets you extend the :meth:`~unittest.TestCase.assertEqual` method " -"to handle new data types. The :meth:`~unittest.TestCase." -"addTypeEqualityFunc` method takes a type object and a function. The function " -"will be used when both of the objects being compared are of the specified " -"type. This function should compare the two objects and raise an exception " -"if they don't match; it's a good idea for the function to provide additional " -"information about why the two objects aren't matching, much as the new " -"sequence comparison methods do." +"to handle new data types. " +"The :meth:`~unittest.TestCase.addTypeEqualityFunc` method takes a type " +"object and a function. The function will be used when both of the objects " +"being compared are of the specified type. This function should compare the " +"two objects and raise an exception if they don't match; it's a good idea for " +"the function to provide additional information about why the two objects " +"aren't matching, much as the new sequence comparison methods do." msgstr "" #: ../../whatsnew/2.7.rst:1992 msgid "" -":func:`unittest.main` now takes an optional ``exit`` argument. If false, :" -"func:`~unittest.main` doesn't call :func:`sys.exit`, allowing :func:" -"`~unittest.main` to be used from the interactive interpreter. (Contributed " -"by J. Pablo Fernández; :issue:`3379`.)" +":func:`unittest.main` now takes an optional ``exit`` argument. If " +"false, :func:`~unittest.main` doesn't call :func:`sys.exit`, " +"allowing :func:`~unittest.main` to be used from the interactive interpreter. " +"(Contributed by J. Pablo Fernández; :issue:`3379`.)" msgstr "" #: ../../whatsnew/2.7.rst:1997 msgid "" -":class:`~unittest.TestResult` has new :meth:`~unittest.TestResult." -"startTestRun` and :meth:`~unittest.TestResult.stopTestRun` methods that are " -"called immediately before and after a test run. (Contributed by Robert " +":class:`~unittest.TestResult` has " +"new :meth:`~unittest.TestResult.startTestRun` " +"and :meth:`~unittest.TestResult.stopTestRun` methods that are called " +"immediately before and after a test run. (Contributed by Robert " "Collins; :issue:`5728`.)" msgstr "" @@ -2978,16 +3003,16 @@ msgstr "" #: ../../whatsnew/2.7.rst:2031 msgid "" "ElementTree's code for converting trees to a string has been significantly " -"reworked, making it roughly twice as fast in many cases. The :meth:" -"`ElementTree.write() <xml.etree.ElementTree.ElementTree.write>` and :meth:" -"`Element.write` methods now have a *method* parameter that can be " +"reworked, making it roughly twice as fast in many cases. " +"The :meth:`ElementTree.write() <xml.etree.ElementTree.ElementTree.write>` " +"and :meth:`Element.write` methods now have a *method* parameter that can be " "\"xml\" (the default), \"html\", or \"text\". HTML mode will output empty " "elements as ``<empty></empty>`` instead of ``<empty/>``, and text mode will " -"skip over elements and only output the text chunks. If you set the :attr:" -"`~xml.etree.ElementTree.Element.tag` attribute of an element to ``None`` but " -"leave its children in place, the element will be omitted when the tree is " -"written out, so you don't need to do more extensive rearrangement to remove " -"a single element." +"skip over elements and only output the text chunks. If you set " +"the :attr:`~xml.etree.ElementTree.Element.tag` attribute of an element to " +"``None`` but leave its children in place, the element will be omitted when " +"the tree is written out, so you don't need to do more extensive " +"rearrangement to remove a single element." msgstr "" #: ../../whatsnew/2.7.rst:2044 @@ -2995,17 +3020,18 @@ msgid "" "Namespace handling has also been improved. All ``xmlns:<whatever>`` " "declarations are now output on the root element, not scattered throughout " "the resulting XML. You can set the default namespace for a tree by setting " -"the :attr:`default_namespace` attribute and can register new prefixes with :" -"meth:`~xml.etree.ElementTree.register_namespace`. In XML mode, you can use " -"the true/false *xml_declaration* parameter to suppress the XML declaration." +"the :attr:`default_namespace` attribute and can register new prefixes " +"with :meth:`~xml.etree.ElementTree.register_namespace`. In XML mode, you " +"can use the true/false *xml_declaration* parameter to suppress the XML " +"declaration." msgstr "" #: ../../whatsnew/2.7.rst:2052 msgid "" -"New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree." -"ElementTree.Element.extend` appends the items from a sequence to the " -"element's children. Elements themselves behave like sequences, so it's easy " -"to move children from one element to another::" +"New :class:`~xml.etree.ElementTree.Element` " +"method: :meth:`~xml.etree.ElementTree.Element.extend` appends the items from " +"a sequence to the element's children. Elements themselves behave like " +"sequences, so it's easy to move children from one element to another::" msgstr "" #: ../../whatsnew/2.7.rst:2058 @@ -3024,19 +3050,19 @@ msgstr "" #: ../../whatsnew/2.7.rst:2069 msgid "" -"New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree." -"ElementTree.Element.iter` yields the children of the element as a " -"generator. It's also possible to write ``for child in elem:`` to loop over " -"an element's children. The existing method :meth:`!getiterator` is now " -"deprecated, as is :meth:`!getchildren` which constructs and returns a list " -"of children." +"New :class:`~xml.etree.ElementTree.Element` " +"method: :meth:`~xml.etree.ElementTree.Element.iter` yields the children of " +"the element as a generator. It's also possible to write ``for child in " +"elem:`` to loop over an element's children. The existing method :meth:`!" +"getiterator` is now deprecated, as is :meth:`!getchildren` which constructs " +"and returns a list of children." msgstr "" #: ../../whatsnew/2.7.rst:2076 msgid "" -"New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree." -"ElementTree.Element.itertext` yields all chunks of text that are descendants " -"of the element. For example::" +"New :class:`~xml.etree.ElementTree.Element` " +"method: :meth:`~xml.etree.ElementTree.Element.itertext` yields all chunks of " +"text that are descendants of the element. For example::" msgstr "" #: ../../whatsnew/2.7.rst:2080 @@ -3062,19 +3088,19 @@ msgstr "" #: ../../whatsnew/2.7.rst:2095 msgid "" "Fredrik Lundh develops ElementTree and produced the 1.3 version; you can " -"read his article describing 1.3 at https://web.archive.org/" -"web/20200703234532/http://effbot.org/zone/elementtree-13-intro.htm. Florent " +"read his article describing 1.3 at https://web.archive.org/web/" +"20200703234532/http://effbot.org/zone/elementtree-13-intro.htm. Florent " "Xicluna updated the version included with Python, after discussions on " "python-dev and in :issue:`6472`.)" msgstr "" #: ../../whatsnew/2.7.rst:2105 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/2.7.rst:2107 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/2.7.rst:2109 msgid "" @@ -3102,8 +3128,8 @@ msgstr "" msgid "" ":c:func:`Py_AddPendingCall` is now thread-safe, letting any worker thread " "submit notifications to the main Python thread. This is particularly useful " -"for asynchronous IO operations. (Contributed by Kristján Valur Jónsson; :" -"issue:`4293`.)" +"for asynchronous IO operations. (Contributed by Kristján Valur " +"Jónsson; :issue:`4293`.)" msgstr "" #: ../../whatsnew/2.7.rst:2131 @@ -3134,11 +3160,12 @@ msgstr "" #: ../../whatsnew/2.7.rst:2150 msgid "" -"New functions: :c:func:`PyLong_AsLongAndOverflow` and :c:func:" -"`PyLong_AsLongLongAndOverflow` approximates a Python long integer as a C :c:" -"expr:`long` or :c:expr:`long long`. If the number is too large to fit into " -"the output type, an *overflow* flag is set and returned to the caller. " -"(Contributed by Case Van Horsen; :issue:`7528` and :issue:`7767`.)" +"New functions: :c:func:`PyLong_AsLongAndOverflow` " +"and :c:func:`PyLong_AsLongLongAndOverflow` approximates a Python long " +"integer as a C :c:expr:`long` or :c:expr:`long long`. If the number is too " +"large to fit into the output type, an *overflow* flag is set and returned to " +"the caller. (Contributed by Case Van Horsen; :issue:`7528` " +"and :issue:`7767`.)" msgstr "" #: ../../whatsnew/2.7.rst:2157 @@ -3184,14 +3211,12 @@ msgstr "" #: ../../whatsnew/2.7.rst:2183 msgid "" -"New macros: the Python header files now define the following macros: :c:" -"macro:`Py_ISALNUM`, :c:macro:`Py_ISALPHA`, :c:macro:`Py_ISDIGIT`, :c:macro:" -"`Py_ISLOWER`, :c:macro:`Py_ISSPACE`, :c:macro:`Py_ISUPPER`, :c:macro:" -"`Py_ISXDIGIT`, :c:macro:`Py_TOLOWER`, and :c:macro:`Py_TOUPPER`. All of " -"these functions are analogous to the C standard macros for classifying " -"characters, but ignore the current locale setting, because in several places " -"Python needs to analyze characters in a locale-independent way. (Added by " -"Eric Smith; :issue:`5793`.)" +"New macros: the Python header files now define the following " +"macros: :c:macro:`Py_ISALNUM`, :c:macro:`Py_ISALPHA`, :c:macro:`Py_ISDIGIT`, :c:macro:`Py_ISLOWER`, :c:macro:`Py_ISSPACE`, :c:macro:`Py_ISUPPER`, :c:macro:`Py_ISXDIGIT`, :c:macro:`Py_TOLOWER`, " +"and :c:macro:`Py_TOUPPER`. All of these functions are analogous to the C " +"standard macros for classifying characters, but ignore the current locale " +"setting, because in several places Python needs to analyze characters in a " +"locale-independent way. (Added by Eric Smith; :issue:`5793`.)" msgstr "" #: ../../whatsnew/2.7.rst:2201 @@ -3236,16 +3261,17 @@ msgstr "" #: ../../whatsnew/2.7.rst:2230 msgid "" -"The :c:func:`Py_Finalize` function now calls the internal :func:`!threading." -"_shutdown` function; this prevents some exceptions from being raised when an " -"interpreter shuts down. (Patch by Adam Olsen; :issue:`1722344`.)" +"The :c:func:`Py_Finalize` function now calls the internal :func:`!" +"threading._shutdown` function; this prevents some exceptions from being " +"raised when an interpreter shuts down. (Patch by Adam " +"Olsen; :issue:`1722344`.)" msgstr "" #: ../../whatsnew/2.7.rst:2235 msgid "" "When using the :c:type:`PyMemberDef` structure to define attributes of a " -"type, Python will no longer let you try to delete or set a :c:macro:" -"`T_STRING_INPLACE` attribute." +"type, Python will no longer let you try to delete or set " +"a :c:macro:`T_STRING_INPLACE` attribute." msgstr "" #: ../../whatsnew/2.7.rst:2241 @@ -3258,8 +3284,8 @@ msgstr "" msgid "" "New configure option: the :option:`!--with-system-expat` switch allows " "building the :mod:`pyexpat <xml.parsers.expat>` module to use the system " -"Expat library. (Contributed by Arfrever Frehtes Taifersar Arahesis; :issue:" -"`7609`.)" +"Expat library. (Contributed by Arfrever Frehtes Taifersar " +"Arahesis; :issue:`7609`.)" msgstr "" #: ../../whatsnew/2.7.rst:2249 @@ -3267,8 +3293,8 @@ msgid "" "New configure option: the :option:`!--with-valgrind` option will now disable " "the pymalloc allocator, which is difficult for the Valgrind memory-error " "detector to analyze correctly. Valgrind will therefore be better at " -"detecting memory leaks and overruns. (Contributed by James Henstridge; :" -"issue:`2422`.)" +"detecting memory leaks and overruns. (Contributed by James " +"Henstridge; :issue:`2422`.)" msgstr "" #: ../../whatsnew/2.7.rst:2256 @@ -3283,8 +3309,8 @@ msgid "" "The :program:`configure` script now checks for floating-point rounding bugs " "on certain 32-bit Intel chips and defines a :c:macro:`X87_DOUBLE_ROUNDING` " "preprocessor definition. No code currently uses this definition, but it's " -"available if anyone wishes to use it. (Added by Mark Dickinson; :issue:" -"`2937`.)" +"available if anyone wishes to use it. (Added by Mark " +"Dickinson; :issue:`2937`.)" msgstr "" #: ../../whatsnew/2.7.rst:2267 @@ -3314,12 +3340,12 @@ msgstr "" msgid "" "Python 3.1 adds a new C datatype, :c:type:`PyCapsule`, for providing a C API " "to an extension module. A capsule is essentially the holder of a C ``void " -"*`` pointer, and is made available as a module attribute; for example, the :" -"mod:`socket` module's API is exposed as ``socket.CAPI``, and :mod:" -"`unicodedata` exposes ``ucnhash_CAPI``. Other extensions can import the " -"module, access its dictionary to get the capsule object, and then get the " -"``void *`` pointer, which will usually point to an array of pointers to the " -"module's various API functions." +"*`` pointer, and is made available as a module attribute; for example, " +"the :mod:`socket` module's API is exposed as ``socket.CAPI``, " +"and :mod:`unicodedata` exposes ``ucnhash_CAPI``. Other extensions can " +"import the module, access its dictionary to get the capsule object, and then " +"get the ``void *`` pointer, which will usually point to an array of pointers " +"to the module's various API functions." msgstr "" #: ../../whatsnew/2.7.rst:2292 @@ -3357,8 +3383,8 @@ msgid "" "Python 2.7 now uses capsules internally to provide various extension-module " "APIs, but the :c:func:`!PyCObject_AsVoidPtr` was modified to handle " "capsules, preserving compile-time compatibility with the :c:type:`!" -"PyCObject` interface. Use of :c:func:`!PyCObject_AsVoidPtr` will signal a :" -"exc:`PendingDeprecationWarning`, which is silent by default." +"PyCObject` interface. Use of :c:func:`!PyCObject_AsVoidPtr` will signal " +"a :exc:`PendingDeprecationWarning`, which is silent by default." msgstr "" #: ../../whatsnew/2.7.rst:2322 @@ -3373,11 +3399,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:2331 msgid "" -"The :mod:`msvcrt` module now contains some constants from the :file:" -"`crtassem.h` header file: :data:`~msvcrt.CRT_ASSEMBLY_VERSION`, :data:" -"`~msvcrt.VC_ASSEMBLY_PUBLICKEYTOKEN`, and :data:`~msvcrt." -"LIBRARIES_ASSEMBLY_NAME_PREFIX`. (Contributed by David Cournapeau; :issue:" -"`4365`.)" +"The :mod:`msvcrt` module now contains some constants from " +"the :file:`crtassem.h` header " +"file: :data:`~msvcrt.CRT_ASSEMBLY_VERSION`, :data:`~msvcrt.VC_ASSEMBLY_PUBLICKEYTOKEN`, " +"and :data:`~msvcrt.LIBRARIES_ASSEMBLY_NAME_PREFIX`. (Contributed by David " +"Cournapeau; :issue:`4365`.)" msgstr "" #: ../../whatsnew/2.7.rst:2338 @@ -3385,9 +3411,10 @@ msgid "" "The :mod:`_winreg <winreg>` module for accessing the registry now implements " "the :func:`~winreg.CreateKeyEx` and :func:`~winreg.DeleteKeyEx` functions, " "extended versions of previously supported functions that take several extra " -"arguments. The :func:`~winreg.DisableReflectionKey`, :func:`~winreg." -"EnableReflectionKey`, and :func:`~winreg.QueryReflectionKey` were also " -"tested and documented. (Implemented by Brian Curtin: :issue:`7347`.)" +"arguments. " +"The :func:`~winreg.DisableReflectionKey`, :func:`~winreg.EnableReflectionKey`, " +"and :func:`~winreg.QueryReflectionKey` were also tested and documented. " +"(Implemented by Brian Curtin: :issue:`7347`.)" msgstr "" #: ../../whatsnew/2.7.rst:2346 @@ -3400,11 +3427,12 @@ msgstr "" #: ../../whatsnew/2.7.rst:2350 msgid "" "The :func:`os.kill` function now works on Windows. The signal value can be " -"the constants :const:`~signal.CTRL_C_EVENT`, :const:`~signal." -"CTRL_BREAK_EVENT`, or any integer. The first two constants will send :kbd:" -"`Control-C` and :kbd:`Control-Break` keystroke events to subprocesses; any " -"other value will use the :c:func:`!TerminateProcess` API. (Contributed by " -"Miki Tebeka; :issue:`1220212`.)" +"the " +"constants :const:`~signal.CTRL_C_EVENT`, :const:`~signal.CTRL_BREAK_EVENT`, " +"or any integer. The first two constants will send :kbd:`Control-C` " +"and :kbd:`Control-Break` keystroke events to subprocesses; any other value " +"will use the :c:func:`!TerminateProcess` API. (Contributed by Miki " +"Tebeka; :issue:`1220212`.)" msgstr "" #: ../../whatsnew/2.7.rst:2357 @@ -3425,10 +3453,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:2369 msgid "" -"The path ``/Library/Python/2.7/site-packages`` is now appended to ``sys." -"path``, in order to share added packages between the system installation and " -"a user-installed copy of the same version. (Changed by Ronald Oussoren; :" -"issue:`4865`.)" +"The path ``/Library/Python/2.7/site-packages`` is now appended to " +"``sys.path``, in order to share added packages between the system " +"installation and a user-installed copy of the same version. (Changed by " +"Ronald Oussoren; :issue:`4865`.)" msgstr "" #: ../../whatsnew/2.7.rst:2376 @@ -3449,10 +3477,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:2389 msgid "" -"FreeBSD 7.1's :const:`!SO_SETFIB` constant, used with the :func:`~socket." -"socket` methods :func:`~socket.socket.getsockopt`/:func:`~socket.socket." -"setsockopt` to select an alternate routing table, is now available in the :" -"mod:`socket` module. (Added by Kyle VanderBeek; :issue:`8235`.)" +"FreeBSD 7.1's :const:`!SO_SETFIB` constant, used with " +"the :func:`~socket.socket` " +"methods :func:`~socket.socket.getsockopt`/:func:`~socket.socket.setsockopt` " +"to select an alternate routing table, is now available in the :mod:`socket` " +"module. (Added by Kyle VanderBeek; :issue:`8235`.)" msgstr "" #: ../../whatsnew/2.7.rst:2395 @@ -3471,8 +3500,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2405 msgid "" -"The :file:`Tools/i18n/msgfmt.py` script now understands plural forms in :" -"file:`.po` files. (Fixed by Martin von Löwis; :issue:`5464`.)" +"The :file:`Tools/i18n/msgfmt.py` script now understands plural forms " +"in :file:`.po` files. (Fixed by Martin von Löwis; :issue:`5464`.)" msgstr "" #: ../../whatsnew/2.7.rst:2409 @@ -3488,9 +3517,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:2416 msgid "" "The :file:`regrtest.py` script now takes a :option:`!--randseed=` switch " -"that takes an integer that will be used as the random seed for the :option:" -"`!-r` option that executes tests in random order. The :option:`!-r` option " -"also reports the seed that was used (Added by Collin Winter.)" +"that takes an integer that will be used as the random seed for " +"the :option:`!-r` option that executes tests in random order. The :option:`!-" +"r` option also reports the seed that was used (Added by Collin Winter.)" msgstr "" #: ../../whatsnew/2.7.rst:2422 @@ -3532,8 +3561,8 @@ msgstr "" msgid "" "The string :meth:`format` method changed the default precision used for " "floating-point and complex numbers from 6 decimal places to 12, which " -"matches the precision used by :func:`str`. (Changed by Eric Smith; :issue:" -"`5920`.)" +"matches the precision used by :func:`str`. (Changed by Eric " +"Smith; :issue:`5920`.)" msgstr "" #: ../../whatsnew/2.7.rst:2454 @@ -3547,10 +3576,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:2460 msgid "" -"Due to a bug in Python 2.6, the *exc_value* parameter to :meth:`~object." -"__exit__` methods was often the string representation of the exception, not " -"an instance. This was fixed in 2.7, so *exc_value* will be an instance as " -"expected. (Fixed by Florent Xicluna; :issue:`7853`.)" +"Due to a bug in Python 2.6, the *exc_value* parameter " +"to :meth:`~object.__exit__` methods was often the string representation of " +"the exception, not an instance. This was fixed in 2.7, so *exc_value* will " +"be an instance as expected. (Fixed by Florent Xicluna; :issue:`7853`.)" msgstr "" #: ../../whatsnew/2.7.rst:2470 @@ -3560,18 +3589,18 @@ msgstr "" #: ../../whatsnew/2.7.rst:2472 msgid "" "Operations with :class:`~datetime.datetime` instances that resulted in a " -"year falling outside the supported range didn't always raise :exc:" -"`OverflowError`. Such errors are now checked more carefully and will now " -"raise the exception. (Reported by Mark Leander, patch by Anand B. Pillai and " -"Alexander Belopolsky; :issue:`7150`.)" +"year falling outside the supported range didn't always " +"raise :exc:`OverflowError`. Such errors are now checked more carefully and " +"will now raise the exception. (Reported by Mark Leander, patch by Anand B. " +"Pillai and Alexander Belopolsky; :issue:`7150`.)" msgstr "" #: ../../whatsnew/2.7.rst:2478 msgid "" -"When using :class:`~decimal.Decimal` instances with a string's :meth:" -"`format` method, the default alignment was previously left-alignment. This " -"has been changed to right-alignment, which might change the output of your " -"programs. (Changed by Mark Dickinson; :issue:`6857`.)" +"When using :class:`~decimal.Decimal` instances with a " +"string's :meth:`format` method, the default alignment was previously left-" +"alignment. This has been changed to right-alignment, which might change the " +"output of your programs. (Changed by Mark Dickinson; :issue:`6857`.)" msgstr "" #: ../../whatsnew/2.7.rst:2490 @@ -3602,9 +3631,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:2545 msgid "" -"Use the new :c:func:`PyOS_string_to_double` function instead of the old :c:" -"func:`!PyOS_ascii_strtod` and :c:func:`!PyOS_ascii_atof` functions, which " -"are now deprecated." +"Use the new :c:func:`PyOS_string_to_double` function instead of the " +"old :c:func:`!PyOS_ascii_strtod` and :c:func:`!PyOS_ascii_atof` functions, " +"which are now deprecated." msgstr "" #: ../../whatsnew/2.7.rst:2549 @@ -3646,8 +3675,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2580 msgid "" -"In debug mode, the ``[xxx refs]`` statistic is not written by default, the :" -"envvar:`!PYTHONSHOWREFCOUNT` environment variable now must also be set. " +"In debug mode, the ``[xxx refs]`` statistic is not written by default, " +"the :envvar:`!PYTHONSHOWREFCOUNT` environment variable now must also be set. " "(Contributed by Victor Stinner; :issue:`31733`.)" msgstr "" @@ -3656,8 +3685,8 @@ msgid "" "When Python is compiled with ``COUNT_ALLOC`` defined, allocation counts are " "no longer dumped by default anymore: the :envvar:`!PYTHONSHOWALLOCCOUNT` " "environment variable must now also be set. Moreover, allocation counts are " -"now dumped into stderr, rather than stdout. (Contributed by Victor Stinner; :" -"issue:`31692`.)" +"now dumped into stderr, rather than stdout. (Contributed by Victor " +"Stinner; :issue:`31692`.)" msgstr "" #: ../../whatsnew/2.7.rst:2593 @@ -3720,8 +3749,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2626 msgid "" "OpenSSL 1.0.1h was upgraded for the official Windows installers published on " -"python.org. (Contributed by Zachary Ware in :issue:`21671` for :cve:" -"`2014-0224`.)" +"python.org. (Contributed by Zachary Ware in :issue:`21671` " +"for :cve:`2014-0224`.)" msgstr "" #: ../../whatsnew/2.7.rst:2629 @@ -3751,10 +3780,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:2643 msgid "" -":data:`hashlib.algorithms_guaranteed` and :data:`hashlib." -"algorithms_available` were backported from Python 3 to make it easier for " -"Python 2 applications to select the strongest available hash algorithm. " -"(Contributed by Alex Gaynor in :issue:`21307`)" +":data:`hashlib.algorithms_guaranteed` " +"and :data:`hashlib.algorithms_available` were backported from Python 3 to " +"make it easier for Python 2 applications to select the strongest available " +"hash algorithm. (Contributed by Alex Gaynor in :issue:`21307`)" msgstr "" #: ../../whatsnew/2.7.rst:2650 @@ -3818,7 +3847,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:2690 msgid "Documentation Changes" -msgstr "" +msgstr "文件更動" #: ../../whatsnew/2.7.rst:2692 msgid "" @@ -3833,8 +3862,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2700 msgid "" "However, as this migration is currently still incomplete, the legacy " -"versions of those guides remaining available as :ref:`install-index` and :" -"ref:`setuptools-index`." +"versions of those guides remaining available as :ref:`install-index` " +"and :ref:`setuptools-index`." msgstr "" #: ../../whatsnew/2.7.rst:2706 @@ -3854,9 +3883,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:2713 msgid "" -":pep:`476` updated :mod:`httplib <http>` and modules which use it, such as :" -"mod:`urllib2 <urllib.request>` and :mod:`xmlrpclib <xmlrpc.client>`, to now " -"verify that the server presents a certificate which is signed by a " +":pep:`476` updated :mod:`httplib <http>` and modules which use it, such " +"as :mod:`urllib2 <urllib.request>` and :mod:`xmlrpclib <xmlrpc.client>`, to " +"now verify that the server presents a certificate which is signed by a " "Certificate Authority in the platform trust store and whose hostname matches " "the hostname being requested by default, significantly improving security " "for many applications. This change was made in the Python 2.7.9 release." @@ -3939,8 +3968,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2772 msgid "" -"More selective regeneration targets are also defined - see :source:`Makefile." -"pre.in` for details." +"More selective regeneration targets are also defined - " +"see :source:`Makefile.pre.in` for details." msgstr "" #: ../../whatsnew/2.7.rst:2775 ../../whatsnew/2.7.rst:2788 diff --git a/whatsnew/3.0.po b/whatsnew/3.0.po index 77d4d2f766..ed4c8da527 100644 --- a/whatsnew/3.0.po +++ b/whatsnew/3.0.po @@ -152,26 +152,26 @@ msgstr "一些眾所周知的 API 不再回傳串列:" #: ../../whatsnew/3.0.rst:147 msgid "" -":class:`dict` methods :meth:`dict.keys`, :meth:`dict.items` and :meth:`dict." -"values` return \"views\" instead of lists. For example, this no longer " -"works: ``k = d.keys(); k.sort()``. Use ``k = sorted(d)`` instead (this " -"works in Python 2.5 too and is just as efficient)." +":class:`dict` methods :meth:`dict.keys`, :meth:`dict.items` " +"and :meth:`dict.values` return \"views\" instead of lists. For example, " +"this no longer works: ``k = d.keys(); k.sort()``. Use ``k = sorted(d)`` " +"instead (this works in Python 2.5 too and is just as efficient)." msgstr "" #: ../../whatsnew/3.0.rst:153 msgid "" -"Also, the :meth:`!dict.iterkeys`, :meth:`!dict.iteritems` and :meth:`!dict." -"itervalues` methods are no longer supported." +"Also, the :meth:`!dict.iterkeys`, :meth:`!dict.iteritems` and :meth:`!" +"dict.itervalues` methods are no longer supported." msgstr "" #: ../../whatsnew/3.0.rst:156 msgid "" ":func:`map` and :func:`filter` return iterators. If you really need a list " -"and the input sequences are all of equal length, a quick fix is to wrap :" -"func:`map` in :func:`list`, e.g. ``list(map(...))``, but a better fix is " -"often to use a list comprehension (especially when the original code uses :" -"keyword:`lambda`), or rewriting the code so it doesn't need a list at all. " -"Particularly tricky is :func:`map` invoked for the side effects of the " +"and the input sequences are all of equal length, a quick fix is to " +"wrap :func:`map` in :func:`list`, e.g. ``list(map(...))``, but a better fix " +"is often to use a list comprehension (especially when the original code " +"uses :keyword:`lambda`), or rewriting the code so it doesn't need a list at " +"all. Particularly tricky is :func:`map` invoked for the side effects of the " "function; the correct transformation is to use a regular :keyword:`for` loop " "(since creating a list would just be wasteful)." msgstr "" @@ -179,10 +179,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:167 msgid "" "If the input sequences are not of equal length, :func:`map` will stop at the " -"termination of the shortest of the sequences. For full compatibility with :" -"func:`map` from Python 2.x, also wrap the sequences in :func:`itertools." -"zip_longest`, e.g. ``map(func, *sequences)`` becomes ``list(map(func, " -"itertools.zip_longest(*sequences)))``." +"termination of the shortest of the sequences. For full compatibility " +"with :func:`map` from Python 2.x, also wrap the sequences " +"in :func:`itertools.zip_longest`, e.g. ``map(func, *sequences)`` becomes " +"``list(map(func, itertools.zip_longest(*sequences)))``." msgstr "" #: ../../whatsnew/3.0.rst:173 @@ -255,9 +255,9 @@ msgid "" "The :data:`!sys.maxint` constant was removed, since there is no longer a " "limit to the value of integers. However, :data:`sys.maxsize` can be used as " "an integer larger than any practical list or string index. It conforms to " -"the implementation's \"natural\" integer size and is typically the same as :" -"data:`!sys.maxint` in previous releases on the same platform (assuming the " -"same build options)." +"the implementation's \"natural\" integer size and is typically the same " +"as :data:`!sys.maxint` in previous releases on the same platform (assuming " +"the same build options)." msgstr "" #: ../../whatsnew/3.0.rst:224 @@ -285,14 +285,14 @@ msgstr "" msgid "" "Python 3.0 uses the concepts of *text* and (binary) *data* instead of " "Unicode strings and 8-bit strings. All text is Unicode; however *encoded* " -"Unicode is represented as binary data. The type used to hold text is :class:" -"`str`, the type used to hold data is :class:`bytes`. The biggest difference " -"with the 2.x situation is that any attempt to mix text and data in Python " -"3.0 raises :exc:`TypeError`, whereas if you were to mix Unicode and 8-bit " -"strings in Python 2.x, it would work if the 8-bit string happened to contain " -"only 7-bit (ASCII) bytes, but you would get :exc:`UnicodeDecodeError` if it " -"contained non-ASCII values. This value-specific behavior has caused " -"numerous sad faces over the years." +"Unicode is represented as binary data. The type used to hold text " +"is :class:`str`, the type used to hold data is :class:`bytes`. The biggest " +"difference with the 2.x situation is that any attempt to mix text and data " +"in Python 3.0 raises :exc:`TypeError`, whereas if you were to mix Unicode " +"and 8-bit strings in Python 2.x, it would work if the 8-bit string happened " +"to contain only 7-bit (ASCII) bytes, but you would " +"get :exc:`UnicodeDecodeError` if it contained non-ASCII values. This value-" +"specific behavior has caused numerous sad faces over the years." msgstr "" #: ../../whatsnew/3.0.rst:250 @@ -301,9 +301,9 @@ msgid "" "uses Unicode, encodings or binary data most likely has to change. The " "change is for the better, as in the 2.x world there were numerous bugs " "having to do with mixing encoded and unencoded text. To be prepared in " -"Python 2.x, start using :class:`!unicode` for all unencoded text, and :class:" -"`str` for binary or encoded data only. Then the ``2to3`` tool will do most " -"of the work for you." +"Python 2.x, start using :class:`!unicode` for all unencoded text, " +"and :class:`str` for binary or encoded data only. Then the ``2to3`` tool " +"will do most of the work for you." msgstr "" #: ../../whatsnew/3.0.rst:258 @@ -315,10 +315,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:261 msgid "" "As the :class:`str` and :class:`bytes` types cannot be mixed, you must " -"always explicitly convert between them. Use :meth:`str.encode` to go from :" -"class:`str` to :class:`bytes`, and :meth:`bytes.decode` to go from :class:" -"`bytes` to :class:`str`. You can also use ``bytes(s, encoding=...)`` and " -"``str(b, encoding=...)``, respectively." +"always explicitly convert between them. Use :meth:`str.encode` to go " +"from :class:`str` to :class:`bytes`, and :meth:`bytes.decode` to go " +"from :class:`bytes` to :class:`str`. You can also use ``bytes(s, " +"encoding=...)`` and ``str(b, encoding=...)``, respectively." msgstr "" #: ../../whatsnew/3.0.rst:268 @@ -326,8 +326,8 @@ msgid "" "Like :class:`str`, the :class:`bytes` type is immutable. There is a " "separate *mutable* type to hold buffered binary data, :class:`bytearray`. " "Nearly all APIs that accept :class:`bytes` also accept :class:`bytearray`. " -"The mutable API is based on :class:`collections.MutableSequence <collections." -"abc.MutableSequence>`." +"The mutable API is based on :class:`collections.MutableSequence " +"<collections.abc.MutableSequence>`." msgstr "" #: ../../whatsnew/3.0.rst:274 @@ -342,11 +342,11 @@ msgstr "" #: ../../whatsnew/3.0.rst:281 msgid "" -"The built-in :class:`!basestring` abstract type was removed. Use :class:" -"`str` instead. The :class:`str` and :class:`bytes` types don't have " -"functionality enough in common to warrant a shared base class. The ``2to3`` " -"tool (see below) replaces every occurrence of :class:`!basestring` with :" -"class:`str`." +"The built-in :class:`!basestring` abstract type was removed. " +"Use :class:`str` instead. The :class:`str` and :class:`bytes` types don't " +"have functionality enough in common to warrant a shared base class. The " +"``2to3`` tool (see below) replaces every occurrence of :class:`!basestring` " +"with :class:`str`." msgstr "" #: ../../whatsnew/3.0.rst:287 @@ -369,10 +369,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:304 msgid "" -"The initial values of :data:`sys.stdin`, :data:`sys.stdout` and :data:`sys." -"stderr` are now unicode-only text files (i.e., they are instances of :class:" -"`io.TextIOBase`). To read and write bytes data with these streams, you need " -"to use their :data:`io.TextIOBase.buffer` attribute." +"The initial values of :data:`sys.stdin`, :data:`sys.stdout` " +"and :data:`sys.stderr` are now unicode-only text files (i.e., they are " +"instances of :class:`io.TextIOBase`). To read and write bytes data with " +"these streams, you need to use their :data:`io.TextIOBase.buffer` attribute." msgstr "" #: ../../whatsnew/3.0.rst:310 @@ -381,14 +381,14 @@ msgid "" "can present platform-specific problems because on some platforms filenames " "are arbitrary byte strings. (On the other hand, on Windows filenames are " "natively stored as Unicode.) As a work-around, most APIs (e.g. :func:`open` " -"and many functions in the :mod:`os` module) that take filenames accept :" -"class:`bytes` objects as well as strings, and a few APIs have a way to ask " -"for a :class:`bytes` return value. Thus, :func:`os.listdir` returns a list " -"of :class:`bytes` instances if the argument is a :class:`bytes` instance, " -"and :func:`os.getcwdb` returns the current working directory as a :class:" -"`bytes` instance. Note that when :func:`os.listdir` returns a list of " -"strings, filenames that cannot be decoded properly are omitted rather than " -"raising :exc:`UnicodeError`." +"and many functions in the :mod:`os` module) that take filenames " +"accept :class:`bytes` objects as well as strings, and a few APIs have a way " +"to ask for a :class:`bytes` return value. Thus, :func:`os.listdir` returns " +"a list of :class:`bytes` instances if the argument is a :class:`bytes` " +"instance, and :func:`os.getcwdb` returns the current working directory as " +"a :class:`bytes` instance. Note that when :func:`os.listdir` returns a list " +"of strings, filenames that cannot be decoded properly are omitted rather " +"than raising :exc:`UnicodeError`." msgstr "" #: ../../whatsnew/3.0.rst:325 @@ -420,8 +420,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:340 msgid "" "The :mod:`!StringIO` and :mod:`!cStringIO` modules are gone. Instead, " -"import the :mod:`io` module and use :class:`io.StringIO` or :class:`io." -"BytesIO` for text and data respectively." +"import the :mod:`io` module and use :class:`io.StringIO` " +"or :class:`io.BytesIO` for text and data respectively." msgstr "" #: ../../whatsnew/3.0.rst:344 @@ -472,8 +472,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:374 msgid "" ":pep:`3104`: :keyword:`nonlocal` statement. Using ``nonlocal x`` you can " -"now assign directly to a variable in an outer (but non-global) scope. :" -"keyword:`!nonlocal` is a new reserved word." +"now assign directly to a variable in an outer (but non-global) " +"scope. :keyword:`!nonlocal` is a new reserved word." msgstr "" #: ../../whatsnew/3.0.rst:378 @@ -531,8 +531,8 @@ msgstr "語法變更" #: ../../whatsnew/3.0.rst:408 msgid "" -":pep:`3109` and :pep:`3134`: new :keyword:`raise` statement syntax: :samp:" -"`raise [{expr} [from {expr}]]`. See below." +":pep:`3109` and :pep:`3134`: new :keyword:`raise` statement " +"syntax: :samp:`raise [{expr} [from {expr}]]`. See below." msgstr "" #: ../../whatsnew/3.0.rst:411 @@ -549,8 +549,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:417 msgid "" -"Change from :keyword:`except` *exc*, *var* to :keyword:`!except` *exc* :" -"keyword:`!as` *var*. See :pep:`3110`." +"Change from :keyword:`except` *exc*, *var* to :keyword:`!except` " +"*exc* :keyword:`!as` *var*. See :pep:`3110`." msgstr "" #: ../../whatsnew/3.0.rst:420 @@ -693,9 +693,10 @@ msgstr ":ref:`pep-0371`。" msgid "" ":ref:`pep-3101`. Note: the 2.6 description mentions the :meth:`format` " "method for both 8-bit and Unicode strings. In 3.0, only the :class:`str` " -"type (text strings with Unicode support) supports this method; the :class:" -"`bytes` type does not. The plan is to eventually make this the only API for " -"string formatting, and to start deprecating the ``%`` operator in Python 3.1." +"type (text strings with Unicode support) supports this method; " +"the :class:`bytes` type does not. The plan is to eventually make this the " +"only API for string formatting, and to start deprecating the ``%`` operator " +"in Python 3.1." msgstr "" #: ../../whatsnew/3.0.rst:507 @@ -723,11 +724,11 @@ msgid "" ":ref:`pep-3116`. The :mod:`io` module is now the standard way of doing file " "I/O. The built-in :func:`open` function is now an alias for :func:`io.open` " "and has additional keyword arguments *encoding*, *errors*, *newline* and " -"*closefd*. Also note that an invalid *mode* argument now raises :exc:" -"`ValueError`, not :exc:`IOError`. The binary file object underlying a text " -"file object can be accessed as :attr:`!f.buffer` (but beware that the text " -"object maintains a buffer of itself in order to speed up the encoding and " -"decoding operations)." +"*closefd*. Also note that an invalid *mode* argument now " +"raises :exc:`ValueError`, not :exc:`IOError`. The binary file object " +"underlying a text file object can be accessed as :attr:`!f.buffer` (but " +"beware that the text object maintains a buffer of itself in order to speed " +"up the encoding and decoding operations)." msgstr "" #: ../../whatsnew/3.0.rst:529 @@ -738,12 +739,12 @@ msgstr "" #: ../../whatsnew/3.0.rst:533 msgid "" -":ref:`pep-3119`. The :mod:`abc` module and the ABCs defined in the :mod:" -"`collections` module plays a somewhat more prominent role in the language " -"now, and built-in collection types like :class:`dict` and :class:`list` " -"conform to the :class:`collections.MutableMapping <collections.abc." -"MutableMapping>` and :class:`collections.MutableSequence <collections.abc." -"MutableSequence>` ABCs, respectively." +":ref:`pep-3119`. The :mod:`abc` module and the ABCs defined in " +"the :mod:`collections` module plays a somewhat more prominent role in the " +"language now, and built-in collection types like :class:`dict` " +"and :class:`list` conform to the :class:`collections.MutableMapping " +"<collections.abc.MutableMapping>` and :class:`collections.MutableSequence " +"<collections.abc.MutableSequence>` ABCs, respectively." msgstr "" #: ../../whatsnew/3.0.rst:539 @@ -789,8 +790,8 @@ msgid "" "The :mod:`!bsddb3` package was removed because its presence in the core " "standard library has proved over time to be a particular burden for the core " "developers due to testing instability and Berkeley DB's release schedule. " -"However, the package is alive and well, externally maintained at https://www." -"jcea.es/programacion/pybsddb.htm." +"However, the package is alive and well, externally maintained at https://" +"www.jcea.es/programacion/pybsddb.htm." msgstr "" #: ../../whatsnew/3.0.rst:572 @@ -895,8 +896,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:606 msgid "" -":mod:`dbm` (:mod:`!anydbm`, :mod:`!dbhash`, :mod:`!dbm`, :mod:`!dumbdbm`, :" -"mod:`!gdbm`, :mod:`!whichdb`)." +":mod:`dbm` (:mod:`!anydbm`, :mod:`!dbhash`, :mod:`!dbm`, :mod:`!" +"dumbdbm`, :mod:`!gdbm`, :mod:`!whichdb`)." msgstr "" ":mod:`dbm`\\ (:mod:`!anydbm`、:mod:`!dbhash`、:mod:`!dbm`、:mod:`!" "dumbdbm`、:mod:`!gdbm`、:mod:`!whichdb`\\ )。" @@ -949,17 +950,18 @@ msgstr "移除 :mod:`!sets`。請使用內建的 :func:`set` 類別。" #: ../../whatsnew/3.0.rst:631 msgid "" -"Cleanup of the :mod:`sys` module: removed :func:`!sys.exitfunc`, :func:`!sys." -"exc_clear`, :data:`!sys.exc_type`, :data:`!sys.exc_value`, :data:`!sys." -"exc_traceback`. (Note that :data:`sys.last_type` etc. remain.)" +"Cleanup of the :mod:`sys` module: removed :func:`!sys.exitfunc`, :func:`!" +"sys.exc_clear`, :data:`!sys.exc_type`, :data:`!sys.exc_value`, :data:`!" +"sys.exc_traceback`. (Note that :data:`sys.last_type` etc. remain.)" msgstr "" #: ../../whatsnew/3.0.rst:636 msgid "" "Cleanup of the :class:`array.array` type: the :meth:`!read` and :meth:`!" -"write` methods are gone; use :meth:`~array.array.fromfile` and :meth:`~array." -"array.tofile` instead. Also, the ``'c'`` typecode for array is gone -- use " -"either ``'b'`` for bytes or ``'u'`` for Unicode characters." +"write` methods are gone; use :meth:`~array.array.fromfile` " +"and :meth:`~array.array.tofile` instead. Also, the ``'c'`` typecode for " +"array is gone -- use either ``'b'`` for bytes or ``'u'`` for Unicode " +"characters." msgstr "" #: ../../whatsnew/3.0.rst:642 @@ -973,8 +975,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:645 msgid "" "Cleanup of the :mod:`!thread` module: :func:`!acquire_lock` and :func:`!" -"release_lock` are gone; use :meth:`~threading.Lock.acquire` and :meth:" -"`~threading.Lock.release` instead." +"release_lock` are gone; use :meth:`~threading.Lock.acquire` " +"and :meth:`~threading.Lock.release` instead." msgstr "" #: ../../whatsnew/3.0.rst:649 @@ -988,8 +990,8 @@ msgstr "移除 :mod:`!new` 模組。" #: ../../whatsnew/3.0.rst:653 msgid "" -"The functions :func:`!os.tmpnam`, :func:`!os.tempnam` and :func:`!os." -"tmpfile` have been removed in favor of the :mod:`tempfile` module." +"The functions :func:`!os.tmpnam`, :func:`!os.tempnam` and :func:`!" +"os.tmpfile` have been removed in favor of the :mod:`tempfile` module." msgstr "" #: ../../whatsnew/3.0.rst:657 @@ -1000,10 +1002,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:661 msgid "" -":data:`!string.letters` and its friends (:data:`!string.lowercase` and :data:" -"`!string.uppercase`) are gone. Use :data:`string.ascii_letters` etc. " -"instead. (The reason for the removal is that :data:`!string.letters` and " -"friends had locale-specific behavior, which is a bad idea for such " +":data:`!string.letters` and its friends (:data:`!string.lowercase` " +"and :data:`!string.uppercase`) are gone. Use :data:`string.ascii_letters` " +"etc. instead. (The reason for the removal is that :data:`!string.letters` " +"and friends had locale-specific behavior, which is a bad idea for such " "attractively named global \"constants\".)" msgstr "" @@ -1011,8 +1013,8 @@ msgstr "" msgid "" "Renamed module :mod:`!__builtin__` to :mod:`builtins` (removing the " "underscores, adding an 's'). The :data:`!__builtins__` variable found in " -"most global namespaces is unchanged. To modify a builtin, you should use :" -"mod:`builtins`, not :data:`!__builtins__`!" +"most global namespaces is unchanged. To modify a builtin, you should " +"use :mod:`builtins`, not :data:`!__builtins__`!" msgstr "" #: ../../whatsnew/3.0.rst:675 @@ -1039,21 +1041,22 @@ msgstr "" #: ../../whatsnew/3.0.rst:690 msgid "" -":pep:`352`: All exceptions must be derived (directly or indirectly) from :" -"exc:`BaseException`. This is the root of the exception hierarchy. This is " -"not new as a recommendation, but the *requirement* to inherit from :exc:" -"`BaseException` is new. (Python 2.6 still allowed classic classes to be " -"raised, and placed no restriction on what you can catch.) As a consequence, " -"string exceptions are finally truly and utterly dead." +":pep:`352`: All exceptions must be derived (directly or indirectly) " +"from :exc:`BaseException`. This is the root of the exception hierarchy. " +"This is not new as a recommendation, but the *requirement* to inherit " +"from :exc:`BaseException` is new. (Python 2.6 still allowed classic classes " +"to be raised, and placed no restriction on what you can catch.) As a " +"consequence, string exceptions are finally truly and utterly dead." msgstr "" #: ../../whatsnew/3.0.rst:698 msgid "" -"Almost all exceptions should actually derive from :exc:`Exception`; :exc:" -"`BaseException` should only be used as a base class for exceptions that " -"should only be handled at the top level, such as :exc:`SystemExit` or :exc:" -"`KeyboardInterrupt`. The recommended idiom for handling all exceptions " -"except for this latter category is to use :keyword:`except` :exc:`Exception`." +"Almost all exceptions should actually derive " +"from :exc:`Exception`; :exc:`BaseException` should only be used as a base " +"class for exceptions that should only be handled at the top level, such " +"as :exc:`SystemExit` or :exc:`KeyboardInterrupt`. The recommended idiom for " +"handling all exceptions except for this latter category is to " +"use :keyword:`except` :exc:`Exception`." msgstr "" #: ../../whatsnew/3.0.rst:705 @@ -1062,8 +1065,8 @@ msgstr ":exc:`!StandardError` 已被移除。" #: ../../whatsnew/3.0.rst:707 msgid "" -"Exceptions no longer behave as sequences. Use the :attr:`~BaseException." -"args` attribute instead." +"Exceptions no longer behave as sequences. Use " +"the :attr:`~BaseException.args` attribute instead." msgstr "" #: ../../whatsnew/3.0.rst:710 @@ -1079,8 +1082,8 @@ msgstr "" msgid "" ":pep:`3110`: Catching exceptions. You must now use :samp:`except " "{SomeException} as {variable}` instead of :samp:`except {SomeException}, " -"{variable}`. Moreover, the *variable* is explicitly deleted when the :" -"keyword:`except` block is left." +"{variable}`. Moreover, the *variable* is explicitly deleted when " +"the :keyword:`except` block is left." msgstr "" #: ../../whatsnew/3.0.rst:722 @@ -1104,19 +1107,19 @@ msgid "" "object, probably an exception that was previously caught). In this case, the " "primary exception is stored on the :attr:`~BaseException.__cause__` " "attribute of the secondary exception. The traceback printed when an " -"unhandled exception occurs walks the chain of :attr:`!__cause__` and :attr:" -"`~BaseException.__context__` attributes and prints a separate traceback for " -"each component of the chain, with the primary exception at the top. (Java " -"users may recognize this behavior.)" +"unhandled exception occurs walks the chain of :attr:`!__cause__` " +"and :attr:`~BaseException.__context__` attributes and prints a separate " +"traceback for each component of the chain, with the primary exception at the " +"top. (Java users may recognize this behavior.)" msgstr "" #: ../../whatsnew/3.0.rst:743 msgid "" -":pep:`3134`: Exception objects now store their traceback as the :attr:" -"`~BaseException.__traceback__` attribute. This means that an exception " -"object now contains all the information pertaining to an exception, and " -"there are fewer reasons to use :func:`sys.exc_info` (though the latter is " -"not removed)." +":pep:`3134`: Exception objects now store their traceback as " +"the :attr:`~BaseException.__traceback__` attribute. This means that an " +"exception object now contains all the information pertaining to an " +"exception, and there are fewer reasons to use :func:`sys.exc_info` (though " +"the latter is not removed)." msgstr "" #: ../../whatsnew/3.0.rst:749 @@ -1136,8 +1139,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:761 msgid "" -"``!=`` now returns the opposite of ``==``, unless ``==`` returns :data:" -"`NotImplemented`." +"``!=`` now returns the opposite of ``==``, unless ``==`` " +"returns :data:`NotImplemented`." msgstr "" #: ../../whatsnew/3.0.rst:764 @@ -1157,15 +1160,15 @@ msgstr "" #: ../../whatsnew/3.0.rst:774 msgid "" -":pep:`3114`: the standard :meth:`next` method has been renamed to :meth:" -"`~iterator.__next__`." +":pep:`3114`: the standard :meth:`next` method has been renamed " +"to :meth:`~iterator.__next__`." msgstr "" #: ../../whatsnew/3.0.rst:777 msgid "" -"The :meth:`!__oct__` and :meth:`!__hex__` special methods are removed -- :" -"func:`oct` and :func:`hex` use :meth:`~object.__index__` now to convert the " -"argument to an integer." +"The :meth:`!__oct__` and :meth:`!__hex__` special methods are removed " +"-- :func:`oct` and :func:`hex` use :meth:`~object.__index__` now to convert " +"the argument to an integer." msgstr "" #: ../../whatsnew/3.0.rst:781 @@ -1174,14 +1177,14 @@ msgstr "移除對 :attr:`!__members__` 和 :attr:`!__methods__` 的支援。" #: ../../whatsnew/3.0.rst:783 msgid "" -"The function attributes named :attr:`!func_X` have been renamed to use the :" -"attr:`!__X__` form, freeing up these names in the function attribute " -"namespace for user-defined attributes. To wit, :attr:`!func_closure`, :attr:" -"`!func_code`, :attr:`!func_defaults`, :attr:`!func_dict`, :attr:`!" -"func_doc`, :attr:`!func_globals`, :attr:`!func_name` were renamed to :attr:" -"`~function.__closure__`, :attr:`~function.__code__`, :attr:`~function." -"__defaults__`, :attr:`~function.__dict__`, :attr:`~function.__doc__`, :attr:" -"`~function.__globals__`, :attr:`~function.__name__`, respectively." +"The function attributes named :attr:`!func_X` have been renamed to use " +"the :attr:`!__X__` form, freeing up these names in the function attribute " +"namespace for user-defined attributes. To wit, :attr:`!" +"func_closure`, :attr:`!func_code`, :attr:`!func_defaults`, :attr:`!" +"func_dict`, :attr:`!func_doc`, :attr:`!func_globals`, :attr:`!func_name` " +"were renamed " +"to :attr:`~function.__closure__`, :attr:`~function.__code__`, :attr:`~function.__defaults__`, :attr:`~function.__dict__`, :attr:`~function.__doc__`, :attr:`~function.__globals__`, :attr:`~function.__name__`, " +"respectively." msgstr "" #: ../../whatsnew/3.0.rst:794 @@ -1212,8 +1215,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:811 msgid "" -"A new built-in function :func:`next` was added to call the :meth:`~iterator." -"__next__` method on an object." +"A new built-in function :func:`next` was added to call " +"the :meth:`~iterator.__next__` method on an object." msgstr "" #: ../../whatsnew/3.0.rst:814 @@ -1251,8 +1254,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:835 msgid "" -"Removed :func:`!execfile`. Instead of ``execfile(fn)`` use ``exec(open(fn)." -"read())``." +"Removed :func:`!execfile`. Instead of ``execfile(fn)`` use " +"``exec(open(fn).read())``." msgstr "" "移除 :func:`!execfile`。請使用 ``exec(open(fn).read())`` 來替換 " "``execfile(fn)``。" @@ -1281,7 +1284,7 @@ msgstr "" #: ../../whatsnew/3.0.rst:854 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.0.rst:856 msgid "" @@ -1319,9 +1322,9 @@ msgstr "" #: ../../whatsnew/3.0.rst:873 msgid "" -"New C API :c:func:`PyImport_ImportModuleNoBlock`, works like :c:func:" -"`PyImport_ImportModule` but won't block on the import lock (returning an " -"error instead)." +"New C API :c:func:`PyImport_ImportModuleNoBlock`, works " +"like :c:func:`PyImport_ImportModule` but won't block on the import lock " +"(returning an error instead)." msgstr "" #: ../../whatsnew/3.0.rst:877 @@ -1339,7 +1342,7 @@ msgstr "" #: ../../whatsnew/3.0.rst:886 msgid "Performance" -msgstr "" +msgstr "效能" #: ../../whatsnew/3.0.rst:888 msgid "" @@ -1387,8 +1390,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:920 msgid "" "It is not recommended to try to write source code that runs unchanged under " -"both Python 2.6 and 3.0; you'd have to use a very contorted coding style, e." -"g. avoiding ``print`` statements, metaclasses, and much more. If you are " +"both Python 2.6 and 3.0; you'd have to use a very contorted coding style, " +"e.g. avoiding ``print`` statements, metaclasses, and much more. If you are " "maintaining a library that needs to support both Python 2.6 and Python 3.0, " "the best approach is to modify step 3 above by editing the 2.6 version of " "the source code and running the ``2to3`` translator again, rather than " diff --git a/whatsnew/3.1.po b/whatsnew/3.1.po index df59f43bf2..627d4d2ac6 100644 --- a/whatsnew/3.1.po +++ b/whatsnew/3.1.po @@ -46,8 +46,8 @@ msgid "" "Regular Python dictionaries iterate over key/value pairs in arbitrary order. " "Over the years, a number of authors have written alternative implementations " "that remember the order that the keys were originally inserted. Based on " -"the experiences from those implementations, a new :class:`collections." -"OrderedDict` class has been introduced." +"the experiences from those implementations, a " +"new :class:`collections.OrderedDict` class has been introduced." msgstr "" #: ../../whatsnew/3.1.rst:62 @@ -139,8 +139,8 @@ msgstr "" #: ../../whatsnew/3.1.rst:123 msgid "" -"The supported types are :class:`int`, :class:`float`, :class:`complex` and :" -"class:`decimal.Decimal`." +"The supported types are :class:`int`, :class:`float`, :class:`complex` " +"and :class:`decimal.Decimal`." msgstr "" #: ../../whatsnew/3.1.rst:126 @@ -243,10 +243,10 @@ msgstr "(由 Eric Smith 貢獻;:issue:`5237`。)" msgid "" "The :func:`!string.maketrans` function is deprecated and is replaced by new " "static methods, :meth:`bytes.maketrans` and :meth:`bytearray.maketrans`. " -"This change solves the confusion around which types were supported by the :" -"mod:`string` module. Now, :class:`str`, :class:`bytes`, and :class:" -"`bytearray` each have their own **maketrans** and **translate** methods with " -"intermediate translation tables of the appropriate type." +"This change solves the confusion around which types were supported by " +"the :mod:`string` module. Now, :class:`str`, :class:`bytes`, " +"and :class:`bytearray` each have their own **maketrans** and **translate** " +"methods with intermediate translation tables of the appropriate type." msgstr "" #: ../../whatsnew/3.1.rst:184 @@ -438,13 +438,13 @@ msgstr "(由 Raymond Hettinger 和 Mark Dickinso 貢獻。)" #: ../../whatsnew/3.1.rst:285 msgid "" -"The :mod:`itertools` module grew two new functions. The :func:`itertools." -"combinations_with_replacement` function is one of four for generating " -"combinatorics including permutations and Cartesian products. The :func:" -"`itertools.compress` function mimics its namesake from APL. Also, the " -"existing :func:`itertools.count` function now has an optional *step* " -"argument and can accept any type of counting sequence including :class:" -"`fractions.Fraction` and :class:`decimal.Decimal`::" +"The :mod:`itertools` module grew two new functions. " +"The :func:`itertools.combinations_with_replacement` function is one of four " +"for generating combinatorics including permutations and Cartesian products. " +"The :func:`itertools.compress` function mimics its namesake from APL. Also, " +"the existing :func:`itertools.count` function now has an optional *step* " +"argument and can accept any type of counting sequence " +"including :class:`fractions.Fraction` and :class:`decimal.Decimal`::" msgstr "" #: ../../whatsnew/3.1.rst:294 @@ -522,10 +522,11 @@ msgstr "(由 Gregory Smith 貢獻。)" #: ../../whatsnew/3.1.rst:330 msgid "" -"The :mod:`logging` module now implements a simple :class:`logging." -"NullHandler` class for applications that are not using logging but are " -"calling library code that does. Setting-up a null handler will suppress " -"spurious warnings such as \"No handlers could be found for logger foo\"::" +"The :mod:`logging` module now implements a " +"simple :class:`logging.NullHandler` class for applications that are not " +"using logging but are calling library code that does. Setting-up a null " +"handler will suppress spurious warnings such as \"No handlers could be found " +"for logger foo\"::" msgstr "" #: ../../whatsnew/3.1.rst:335 @@ -553,8 +554,8 @@ msgstr "(由 Andi Vajda 貢獻;:issue:`4195`。)" #: ../../whatsnew/3.1.rst:346 msgid "" -"The :mod:`pdb` module can now access and display source code loaded via :mod:" -"`zipimport` (or any other conformant :pep:`302` loader)." +"The :mod:`pdb` module can now access and display source code loaded " +"via :mod:`zipimport` (or any other conformant :pep:`302` loader)." msgstr "" #: ../../whatsnew/3.1.rst:349 @@ -631,13 +632,11 @@ msgstr "" #: ../../whatsnew/3.1.rst:383 msgid "" -"In addition, several new assertion methods were added including :meth:" -"`~unittest.TestCase.assertSetEqual`, :meth:`~unittest.TestCase." -"assertDictEqual`, :meth:`!assertDictContainsSubset`, :meth:`~unittest." -"TestCase.assertListEqual`, :meth:`~unittest.TestCase.assertTupleEqual`, :" -"meth:`~unittest.TestCase.assertSequenceEqual`, :meth:`assertRaisesRegexp() " -"<unittest.TestCase.assertRaisesRegex>`, :meth:`~unittest.TestCase." -"assertIsNone`, and :meth:`~unittest.TestCase.assertIsNotNone`." +"In addition, several new assertion methods were added " +"including :meth:`~unittest.TestCase.assertSetEqual`, :meth:`~unittest.TestCase.assertDictEqual`, :meth:`!" +"assertDictContainsSubset`, :meth:`~unittest.TestCase.assertListEqual`, :meth:`~unittest.TestCase.assertTupleEqual`, :meth:`~unittest.TestCase.assertSequenceEqual`, :meth:`assertRaisesRegexp() " +"<unittest.TestCase.assertRaisesRegex>`, :meth:`~unittest.TestCase.assertIsNone`, " +"and :meth:`~unittest.TestCase.assertIsNotNone`." msgstr "" #: ../../whatsnew/3.1.rst:394 @@ -771,8 +770,8 @@ msgstr "" #: ../../whatsnew/3.1.rst:469 msgid "" -"(Contributed by Antoine Pitrou along with a number of other participants, :" -"issue:`4753`)." +"(Contributed by Antoine Pitrou along with a number of other " +"participants, :issue:`4753`)." msgstr "(由 Antoine Pitrou 和其他一些參與者共同貢獻,:issue:`4753`)。" #: ../../whatsnew/3.1.rst:472 @@ -828,11 +827,11 @@ msgstr "(由 Roger D. Serwy 貢獻;:issue:`5150`。)" #: ../../whatsnew/3.1.rst:500 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.1.rst:502 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/3.1.rst:504 msgid "" @@ -882,7 +881,7 @@ msgstr "(由 Mark Dickinson 和 Lisandro Dalcrin 貢獻;:issue:`5175`。)" #: ../../whatsnew/3.1.rst:530 msgid "" "Deprecated :c:func:`!PyNumber_Int`. Use :c:func:`PyNumber_Long` instead." -msgstr "" +msgstr "已棄用 :c:func:`!PyNumber_Int`。請改用 :c:func:`PyNumber_Long`。" #: ../../whatsnew/3.1.rst:532 msgid "(Contributed by Mark Dickinson; :issue:`4910`.)" @@ -950,6 +949,25 @@ msgid "" " 2.718281828459045\n" "**********************************************************************" msgstr "" +"def e():\n" +" '''計算自然對數的底。\n" +"\n" +" >>> e()\n" +" 2.7182818284590451\n" +"\n" +" '''\n" +" return sum(1/math.factorial(x) for x in reversed(range(30)))\n" +"\n" +"doctest.testmod()\n" +"\n" +"**********************************************************************\n" +"Failed example:\n" +" e()\n" +"Expected:\n" +" 2.7182818284590451\n" +"Got:\n" +" 2.718281828459045\n" +"**********************************************************************" #: ../../whatsnew/3.1.rst:576 msgid "" diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index 44170c01ff..f156bfa873 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -32,8 +32,8 @@ msgstr "Pablo Galindo Salgado" #: ../../whatsnew/3.10.rst:47 msgid "" "This article explains the new features in Python 3.10, compared to 3.9. " -"Python 3.10 was released on October 4, 2021. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.10 was released on October 4, 2021. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.10 與 3.9 相比多了哪些新功能。Python 3.10 已於 2021 年 " "10 月 4 日發布。有關完整詳細資訊,請參閱 :ref:`changelog <changelog>`。" @@ -216,15 +216,15 @@ msgstr "" #: ../../whatsnew/3.10.rst:142 msgid "" -"This new syntax uses the non LL(1) capacities of the new parser. Check :pep:" -"`617` for more details." +"This new syntax uses the non LL(1) capacities of the new parser. " +"Check :pep:`617` for more details." msgstr "" "此新語法使用新剖析器的非 LL(1) 功能。檢查 :pep:`617` 了解更多詳細資訊。" #: ../../whatsnew/3.10.rst:145 msgid "" -"(Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolaou in :" -"issue:`12782` and :issue:`40334`.)" +"(Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolaou " +"in :issue:`12782` and :issue:`40334`.)" msgstr "" "(由 Guido van Rossum、Pablo Galindo 和 Lysandros Nikolaou 在 :issue:`12782` " "和 :issue:`40334` 中貢獻。)" @@ -309,8 +309,8 @@ msgstr "這些改進是受到 PyPy 直譯器的啟發。" #: ../../whatsnew/3.10.rst:191 msgid "" -"(Contributed by Pablo Galindo in :issue:`42864` and Batuhan Taskaya in :" -"issue:`40176`.)" +"(Contributed by Pablo Galindo in :issue:`42864` and Batuhan Taskaya " +"in :issue:`40176`.)" msgstr "" "(由 Pablo Galindo 在 :issue:`42864` 和 Batuhan Taskaya 在 :issue:`40176` 中" "貢獻。)" @@ -718,12 +718,12 @@ msgstr "影格 (frame) 物件的 :attr:`~frame.f_lineno` 屬性總會包含預 msgid "" "The :attr:`~codeobject.co_lnotab` attribute of :ref:`code objects <code-" "objects>` is deprecated and will be removed in 3.12. Code that needs to " -"convert from offset to line number should use the new :meth:`~codeobject." -"co_lines` method instead." +"convert from offset to line number should use the " +"new :meth:`~codeobject.co_lines` method instead." msgstr "" ":ref:`程式碼物件 <code-objects>`\\ 的 :attr:`~codeobject.co_lnotab` 屬性已棄" -"用,並將在 3.12 中刪除。需要從偏移量轉換為列號的程式碼應使用新的 :meth:" -"`~codeobject.co_lines` 方法。" +"用,並將在 3.12 中刪除。需要從偏移量轉換為列號的程式碼應使用新" +"的 :meth:`~codeobject.co_lines` 方法。" #: ../../whatsnew/3.10.rst:412 msgid "PEP 634: Structural Pattern Matching" @@ -1220,8 +1220,8 @@ msgstr "" #: ../../whatsnew/3.10.rst:684 msgid "" -"For the full specification see :pep:`634`. Motivation and rationale are in :" -"pep:`635`, and a longer tutorial is in :pep:`636`." +"For the full specification see :pep:`634`. Motivation and rationale are " +"in :pep:`635`, and a longer tutorial is in :pep:`636`." msgstr "" "有關完整規範,請參閱 :pep:`634`。動機和基本原理位於 :pep:`635` 中,較完整的教" "學位於 :pep:`636` 中。" @@ -1254,9 +1254,9 @@ msgid "" "emitted when :data:`sys.flags.warn_default_encoding <sys.flags>` is true and " "locale-specific default encoding is used." msgstr "" -"為了發現這種錯誤,新增了一個可選的 ``EncodingWarning``。當 :data:`sys.flags." -"warn_default_encoding <sys.flags>` 為 true 且使用特定於語言環境的預設編碼時," -"會發出該信號。" +"為了發現這種錯誤,新增了一個可選的 ``EncodingWarning``。" +"當 :data:`sys.flags.warn_default_encoding <sys.flags>` 為 true 且使用特定於語" +"言環境的預設編碼時,會發出該信號。" #: ../../whatsnew/3.10.rst:706 msgid "" @@ -1276,8 +1276,8 @@ msgstr "與型別提示相關的新功能" #: ../../whatsnew/3.10.rst:716 msgid "" -"This section covers major changes affecting :pep:`484` type hints and the :" -"mod:`typing` module." +"This section covers major changes affecting :pep:`484` type hints and " +"the :mod:`typing` module." msgstr "本節介紹影響 :pep:`484` 型別提示和 :mod:`typing` 模組的主要更改。" #: ../../whatsnew/3.10.rst:721 @@ -1291,16 +1291,16 @@ msgid "" "of using :data:`typing.Union`, especially in type hints." msgstr "" "引入了一種新的聯集運算子,該運算子啟用像是 ``X | Y`` 的語法。這提供了一種在型" -"別提示中更清晰的方式來表達「型別 X 或型別 Y」,來取代使用 :data:`typing." -"Union`。" +"別提示中更清晰的方式來表達「型別 X 或型別 Y」,來取代使" +"用 :data:`typing.Union`。" #: ../../whatsnew/3.10.rst:727 msgid "" "In previous versions of Python, to apply a type hint for functions accepting " "arguments of multiple types, :data:`typing.Union` was used::" msgstr "" -"在以前版本的 Python 中,要使用接受多種型別參數之型別提示的函式,要使用 :data:" -"`typing.Union`: ::" +"在以前版本的 Python 中,要使用接受多種型別參數之型別提示的函式,要使" +"用 :data:`typing.Union`: ::" #: ../../whatsnew/3.10.rst:730 msgid "" @@ -1324,8 +1324,8 @@ msgstr "" #: ../../whatsnew/3.10.rst:740 msgid "" -"This new syntax is also accepted as the second argument to :func:" -"`isinstance` and :func:`issubclass`::" +"This new syntax is also accepted as the second argument " +"to :func:`isinstance` and :func:`issubclass`::" msgstr "" "這種新語法也接受作為 :func:`isinstance` 和 :func:`issubclass` 的第二個引" "數: ::" @@ -1388,12 +1388,11 @@ msgstr "" #: ../../whatsnew/3.10.rst:769 msgid "" -"See :class:`typing.Callable`, :class:`typing.ParamSpec`, :class:`typing." -"Concatenate`, :class:`typing.ParamSpecArgs`, :class:`typing." -"ParamSpecKwargs`, and :pep:`612` for more details." +"See :class:`typing.Callable`, :class:`typing.ParamSpec`, :class:`typing.Concatenate`, :class:`typing.ParamSpecArgs`, :class:`typing.ParamSpecKwargs`, " +"and :pep:`612` for more details." msgstr "" -"請參閱 :class:`typing.Callable`、:class:`typing.ParamSpec`、:class:`typing." -"Concatenate`、:class:`typing.ParamSpecArgs`、:class:`typing.ParamSpecKwargs` " +"請參" +"閱 :class:`typing.Callable`、:class:`typing.ParamSpec`、:class:`typing.Concatenate`、:class:`typing.ParamSpecArgs`、:class:`typing.ParamSpecKwargs` " "和 :pep:`612` 以了解更多詳情。" #: ../../whatsnew/3.10.rst:773 @@ -1457,8 +1456,8 @@ msgstr "PEP 647:使用者定義的型別防護" msgid "" ":data:`~typing.TypeGuard` has been added to the :mod:`typing` module to " "annotate type guard functions and improve information provided to static " -"type checkers during type narrowing. For more information, please see :data:" -"`~typing.TypeGuard`\\ 's documentation, and :pep:`647`." +"type checkers during type narrowing. For more information, please " +"see :data:`~typing.TypeGuard`\\ 's documentation, and :pep:`647`." msgstr "" ":data:`~typing.TypeGuard`\\ (型別防護)已新增到 :mod:`typing` 模組中,用以註" "釋型別防護函式並改進在型別窄縮 (type narrowing) 期間提供給靜態型別檢查器的資" @@ -1483,20 +1482,20 @@ msgid "" "population count. (Contributed by Niklas Fiekas in :issue:`29882`.)" msgstr "" ":class:`int` 型別有一個新方法 :meth:`int.bit_count`,回傳給定整數的二進位展開" -"式中 1 的數量,也稱為總體計數 (population count)。(由 Niklas Fiekas 在 :" -"issue:`29882` 中貢獻。)" +"式中 1 的數量,也稱為總體計數 (population count)。(由 Niklas Fiekas " +"在 :issue:`29882` 中貢獻。)" #: ../../whatsnew/3.10.rst:816 msgid "" -"The views returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:`dict." -"items` now all have a ``mapping`` attribute that gives a :class:`types." -"MappingProxyType` object wrapping the original dictionary. (Contributed by " -"Dennis Sweeney in :issue:`40890`.)" +"The views returned by :meth:`dict.keys`, :meth:`dict.values` " +"and :meth:`dict.items` now all have a ``mapping`` attribute that gives " +"a :class:`types.MappingProxyType` object wrapping the original dictionary. " +"(Contributed by Dennis Sweeney in :issue:`40890`.)" msgstr "" ":meth:`dict.keys`、:meth:`dict.values` 和 :meth:`dict.items` 回傳的視圖 " -"(view) 現在都有一個 ``mapping`` 屬性,該屬性提供 :class:`types." -"MappingProxyType` 包裝原始的字典物件。(由 Dennis Sweeney 在 :issue:`40890` " -"中貢獻。)" +"(view) 現在都有一個 ``mapping`` 屬性,該屬性提" +"供 :class:`types.MappingProxyType` 包裝原始的字典物件。(由 Dennis Sweeney " +"在 :issue:`40890` 中貢獻。)" #: ../../whatsnew/3.10.rst:821 msgid "" @@ -1511,13 +1510,15 @@ msgid "" "Builtin and extension functions that take integer arguments no longer " "accept :class:`~decimal.Decimal`\\ s, :class:`~fractions.Fraction`\\ s and " "other objects that can be converted to integers only with a loss (e.g. that " -"have the :meth:`~object.__int__` method but do not have the :meth:`~object." -"__index__` method). (Contributed by Serhiy Storchaka in :issue:`37999`.)" -msgstr "" -"採用整數引數的內建函式和擴充函式不再接受 :class:`~decimal.Decimal`、:class:" -"`~fractions.Fraction` 以及其他只能在有損失的情況下轉換為整數的物件(例如有 :" -"meth:`~object.__int__` 方法,但沒有 :meth:`~object.__index__` 方法)。(由 " -"Serhiy Storchaka 在 :issue:`37999` 中貢獻。)" +"have the :meth:`~object.__int__` method but do not have " +"the :meth:`~object.__index__` method). (Contributed by Serhiy Storchaka " +"in :issue:`37999`.)" +msgstr "" +"採用整數引數的內建函式和擴充函式不再接" +"受 :class:`~decimal.Decimal`、:class:`~fractions.Fraction` 以及其他只能在有損" +"失的情況下轉換為整數的物件(例如有 :meth:`~object.__int__` 方法,但沒" +"有 :meth:`~object.__index__` 方法)。(由 Serhiy Storchaka 在 :issue:`37999` " +"中貢獻。)" #: ../../whatsnew/3.10.rst:831 msgid "" @@ -1557,21 +1558,21 @@ msgid "" "respectively. (Contributed by Joshua Bronson, Daniel Pope, and Justin Wang " "in :issue:`31861`.)" msgstr "" -"新增兩個內建函式 -- :func:`aiter` 和 :func:`anext`,分別為 :func:`iter` 和 :" -"func:`next` 提供非同步的對應函式。(由 Joshua Bronson、Daniel Pope 和 Justin " -"Wang 在 :issue:`31861` 中貢獻。)" +"新增兩個內建函式 -- :func:`aiter` 和 :func:`anext`,分別為 :func:`iter` " +"和 :func:`next` 提供非同步的對應函式。(由 Joshua Bronson、Daniel Pope 和 " +"Justin Wang 在 :issue:`31861` 中貢獻。)" #: ../../whatsnew/3.10.rst:849 msgid "" -"Static methods (:func:`@staticmethod <staticmethod>`) and class methods (:" -"func:`@classmethod <classmethod>`) now inherit the method attributes " +"Static methods (:func:`@staticmethod <staticmethod>`) and class methods " +"(:func:`@classmethod <classmethod>`) now inherit the method attributes " "(``__module__``, ``__name__``, ``__qualname__``, ``__doc__``, " "``__annotations__``) and have a new ``__wrapped__`` attribute. Moreover, " "static methods are now callable as regular functions. (Contributed by Victor " "Stinner in :issue:`43682`.)" msgstr "" -"靜態方法 (:func:`@staticmethod <staticmethod>`) 和類別方法 (:func:" -"`@classmethod <classmethod>`) 現在繼承方法屬性 (``__module__``, " +"靜態方法 (:func:`@staticmethod <staticmethod>`) 和類別方法 " +"(:func:`@classmethod <classmethod>`) 現在繼承方法屬性 (``__module__``, " "``__name__``, ``__qualname__``, ``__doc__``, ``__annotations__``) 並有一個新" "的 ``__wrapped__`` 屬性。此外,靜態方法現在可以像是常規函式般呼叫。(由 " "Victor Stinner 在 :issue:`43682` 中貢獻。)" @@ -1580,8 +1581,8 @@ msgstr "" msgid "" "Annotations for complex targets (everything beside ``simple name`` targets " "defined by :pep:`526`) no longer cause any runtime effects with ``from " -"__future__ import annotations``. (Contributed by Batuhan Taskaya in :issue:" -"`42737`.)" +"__future__ import annotations``. (Contributed by Batuhan Taskaya " +"in :issue:`42737`.)" msgstr "" "複雜目標(除 :pep:`526` 定義的 ``simple name`` 目標之外的所有內容)的註釋不再" "使用 ``from __future__ import comments`` 造成任何執行環境 (runtime) 影響。" @@ -1597,15 +1598,15 @@ msgid "" msgstr "" "類別和模組物件現在會根據需求來延遲建立 (lazy-create) 空的註釋字典 " "(annotations dicts)。註釋字典存儲在物件的 ``__dict__`` 中以達成向後相容性。這" -"改進了 ``__annotations__`` 使用方式的最佳實踐方法;有關更多資訊,請參閱 :ref:" -"`annotations-howto`。(由 Larry Hastings 在 :issue:`43901` 中貢獻。)" +"改進了 ``__annotations__`` 使用方式的最佳實踐方法;有關更多資訊,請參" +"閱 :ref:`annotations-howto`。(由 Larry Hastings 在 :issue:`43901` 中貢獻。)" #: ../../whatsnew/3.10.rst:867 msgid "" "Annotations consist of ``yield``, ``yield from``, ``await`` or named " "expressions are now forbidden under ``from __future__ import annotations`` " -"due to their side effects. (Contributed by Batuhan Taskaya in :issue:" -"`42725`.)" +"due to their side effects. (Contributed by Batuhan Taskaya " +"in :issue:`42725`.)" msgstr "" "附名運算式或由 ``yield``、``yield from``、``await`` 組成的註釋現在在 ``from " "__future__ import comments`` 下被禁止,因為它們有些不預期的行為。(由 " @@ -1624,12 +1625,12 @@ msgstr "" #: ../../whatsnew/3.10.rst:877 msgid "" -"Hashes of NaN values of both :class:`float` type and :class:`decimal." -"Decimal` type now depend on object identity. Formerly, they always hashed to " -"``0`` even though NaN values are not equal to one another. This caused " -"potentially quadratic runtime behavior due to excessive hash collisions when " -"creating dictionaries and sets containing multiple NaNs. (Contributed by " -"Raymond Hettinger in :issue:`43475`.)" +"Hashes of NaN values of both :class:`float` type " +"and :class:`decimal.Decimal` type now depend on object identity. Formerly, " +"they always hashed to ``0`` even though NaN values are not equal to one " +"another. This caused potentially quadratic runtime behavior due to excessive " +"hash collisions when creating dictionaries and sets containing multiple " +"NaNs. (Contributed by Raymond Hettinger in :issue:`43475`.)" msgstr "" ":class:`float` 型別和 :class:`decimal.Decimal` 型別的 NaN 值的雜湊值現在取決" "於物件的標識值 (identity)。以前即使 NaN 值彼此不相等,它們也總是被雜湊為 " @@ -1640,11 +1641,11 @@ msgstr "" #: ../../whatsnew/3.10.rst:884 msgid "" "A :exc:`SyntaxError` (instead of a :exc:`NameError`) will be raised when " -"deleting the :const:`__debug__` constant. (Contributed by Donghee Na in :" -"issue:`45000`.)" +"deleting the :const:`__debug__` constant. (Contributed by Donghee Na " +"in :issue:`45000`.)" msgstr "" -"刪除 :const:`__debug__` 常數時將引發 :exc:`SyntaxError` (而不是 :exc:" -"`NameError`)。(由 Donghee Na 在 :issue:`45000` 中貢獻。)" +"刪除 :const:`__debug__` 常數時將引發 :exc:`SyntaxError` (而不" +"是 :exc:`NameError`)。(由 Donghee Na 在 :issue:`45000` 中貢獻。)" #: ../../whatsnew/3.10.rst:887 msgid "" @@ -1673,9 +1674,9 @@ msgstr "asyncio" #: ../../whatsnew/3.10.rst:903 msgid "" -"Add missing :meth:`~asyncio.events.AbstractEventLoop." -"connect_accepted_socket` method. (Contributed by Alex Grönholm in :issue:" -"`41332`.)" +"Add " +"missing :meth:`~asyncio.events.AbstractEventLoop.connect_accepted_socket` " +"method. (Contributed by Alex Grönholm in :issue:`41332`.)" msgstr "" "新增缺少的 :meth:`~asyncio.events.AbstractEventLoop.connect_accepted_socket` " "方法。(由 Alex Grönholm 在 :issue:`41332` 中貢獻。)" @@ -1705,8 +1706,8 @@ msgid "" "Zackery Spytz in :issue:`31956`.)" msgstr "" ":class:`array.array` 的 :meth:`~array.array.index` 方法現在具有可選的 " -"*start* 和 *stop* 參數。(由 Anders Lorentsen 和 Zackery Spytz 在 :issue:" -"`31956` 中貢獻。)" +"*start* 和 *stop* 參數。(由 Anders Lorentsen 和 Zackery Spytz " +"在 :issue:`31956` 中貢獻。)" #: ../../whatsnew/3.10.rst:921 msgid "asynchat, asyncore, smtpd" @@ -1718,8 +1719,8 @@ msgid "" "since Python 3.6. An import-time :class:`DeprecationWarning` has now been " "added to all three of these modules." msgstr "" -"自 Python 3.6 起,這些模組在其文件中被標記為已棄用。引入時的 :class:" -"`DeprecationWarning` 現已新增到這三個模組中。" +"自 Python 3.6 起,這些模組在其文件中被標記為已棄用。引入時" +"的 :class:`DeprecationWarning` 現已新增到這三個模組中。" #: ../../whatsnew/3.10.rst:927 msgid "base64" @@ -1751,8 +1752,9 @@ msgstr "bisect" #: ../../whatsnew/3.10.rst:941 msgid "" -"Added the possibility of providing a *key* function to the APIs in the :mod:" -"`bisect` module. (Contributed by Raymond Hettinger in :issue:`4356`.)" +"Added the possibility of providing a *key* function to the APIs in " +"the :mod:`bisect` module. (Contributed by Raymond Hettinger " +"in :issue:`4356`.)" msgstr "" "新增向 :mod:`bisect` 模組 API 提供 *key* 函式的可能性。(由 Raymond " "Hettinger 在 :issue:`4356` 中貢獻。)" @@ -1776,28 +1778,29 @@ msgstr "collections.abc" #: ../../whatsnew/3.10.rst:953 msgid "" "The ``__args__`` of the :ref:`parameterized generic <types-genericalias>` " -"for :class:`collections.abc.Callable` are now consistent with :data:`typing." -"Callable`. :class:`collections.abc.Callable` generic now flattens type " -"parameters, similar to what :data:`typing.Callable` currently does. This " -"means that ``collections.abc.Callable[[int, str], str]`` will have " -"``__args__`` of ``(int, str, str)``; previously this was ``([int, str], " +"for :class:`collections.abc.Callable` are now consistent " +"with :data:`typing.Callable`. :class:`collections.abc.Callable` generic now " +"flattens type parameters, similar to what :data:`typing.Callable` currently " +"does. This means that ``collections.abc.Callable[[int, str], str]`` will " +"have ``__args__`` of ``(int, str, str)``; previously this was ``([int, str], " "str)``. To allow this change, :class:`types.GenericAlias` can now be " -"subclassed, and a subclass will be returned when subscripting the :class:" -"`collections.abc.Callable` type. Note that a :exc:`TypeError` may be raised " -"for invalid forms of parameterizing :class:`collections.abc.Callable` which " -"may have passed silently in Python 3.9. (Contributed by Ken Jin in :issue:" -"`42195`.)" +"subclassed, and a subclass will be returned when subscripting " +"the :class:`collections.abc.Callable` type. Note that a :exc:`TypeError` " +"may be raised for invalid forms of " +"parameterizing :class:`collections.abc.Callable` which may have passed " +"silently in Python 3.9. (Contributed by Ken Jin in :issue:`42195`.)" msgstr "" ":class:`collections.abc.Callable` 的\\ :ref:`參數化泛型 (parameterized " -"generic) <types-genericalias>` 的 ``__args__`` 現在與 :data:`typing." -"Callable` 一致。:class:`collections.abc.Callable` 泛型現在會將型別參數攤平," -"類似於 :data:`typing.Callable` 目前的做法。這意味著 ``collections.abc." -"Callable[[int, str], str]`` 將具有 ``(int, str, str)`` 的 ``__args__``;在以" -"前這是 ``([int, str], str)``。為了允許此更改,現在可以對 :class:`types." -"GenericAlias` 進行子類別化,並且在下標 (subscript) :class:`collections.abc." -"Callable` 型別時將回傳子類別。請注意,對於無效形式的 :class:`collections.abc." -"Callable` 參數化可能會引發 :exc:`TypeError`,而在 Python 3.9 中該參數可能會無" -"引發例外地傳遞。(由 Ken Jin 在 :issue:`42195` 中貢獻。)" +"generic) <types-genericalias>` 的 ``__args__`` 現在" +"與 :data:`typing.Callable` 一致。:class:`collections.abc.Callable` 泛型現在會" +"將型別參數攤平,類似於 :data:`typing.Callable` 目前的做法。這意味著 " +"``collections.abc.Callable[[int, str], str]`` 將具有 ``(int, str, str)`` 的 " +"``__args__``;在以前這是 ``([int, str], str)``。為了允許此更改,現在可以" +"對 :class:`types.GenericAlias` 進行子類別化,並且在下標 " +"(subscript) :class:`collections.abc.Callable` 型別時將回傳子類別。請注意,對" +"於無效形式的 :class:`collections.abc.Callable` 參數化可能會引" +"發 :exc:`TypeError`,而在 Python 3.9 中該參數可能會無引發例外地傳遞。(由 " +"Ken Jin 在 :issue:`42195` 中貢獻。)" #: ../../whatsnew/3.10.rst:966 msgid "contextlib" @@ -1836,17 +1839,18 @@ msgstr "curses" #: ../../whatsnew/3.10.rst:981 msgid "" "The extended color functions added in ncurses 6.1 will be used transparently " -"by :func:`curses.color_content`, :func:`curses.init_color`, :func:`curses." -"init_pair`, and :func:`curses.pair_content`. A new function, :func:`curses." -"has_extended_color_support`, indicates whether extended color support is " -"provided by the underlying ncurses library. (Contributed by Jeffrey " -"Kintscher and Hans Petter Jansson in :issue:`36982`.)" -msgstr "" -"ncurses 6.1 中新增的擴充顏色函式將由 :func:`curses.color_content`、:func:" -"`curses.init_color`、:func:`curses.init_pair` 和 :func:`curses.pair_content` " -"透明地使用。新函式 :func:`curses.has_extended_color_support` 表示了底層的 " -"ncurses 函式庫是否支援擴充顏色。(由 Jeffrey Kintscher 和 Hans Petter " -"Jansson 在 :issue:`36982` 中貢獻。)" +"by :func:`curses.color_content`, :func:`curses.init_color`, :func:`curses.init_pair`, " +"and :func:`curses.pair_content`. A new " +"function, :func:`curses.has_extended_color_support`, indicates whether " +"extended color support is provided by the underlying ncurses library. " +"(Contributed by Jeffrey Kintscher and Hans Petter Jansson in :issue:`36982`.)" +msgstr "" +"ncurses 6.1 中新增的擴充顏色函式將" +"由 :func:`curses.color_content`、:func:`curses.init_color`、:func:`curses.init_pair` " +"和 :func:`curses.pair_content` 透明地使用。新函" +"式 :func:`curses.has_extended_color_support` 表示了底層的 ncurses 函式庫是否" +"支援擴充顏色。(由 Jeffrey Kintscher 和 Hans Petter Jansson " +"在 :issue:`36982` 中貢獻。)" #: ../../whatsnew/3.10.rst:988 msgid "" @@ -1991,18 +1995,18 @@ msgid "" "3.12. Its functionality for specifying package builds has already been " "completely replaced by third-party packages ``setuptools`` and " "``packaging``, and most other commonly used APIs are available elsewhere in " -"the standard library (such as :mod:`platform`, :mod:`shutil`, :mod:" -"`subprocess` or :mod:`sysconfig`). There are no plans to migrate any other " -"functionality from ``distutils``, and applications that are using other " -"functions should plan to make private copies of the code. Refer to :pep:" -"`632` for discussion." +"the standard library (such " +"as :mod:`platform`, :mod:`shutil`, :mod:`subprocess` or :mod:`sysconfig`). " +"There are no plans to migrate any other functionality from ``distutils``, " +"and applications that are using other functions should plan to make private " +"copies of the code. Refer to :pep:`632` for discussion." msgstr "" "整個 ``distutils`` 套件已被棄用,將在 Python 3.12 中刪除。它指定套件建置的功" "能已經完全被第三方套件 ``setuptools`` 和 ``packaging`` 所取代,並且大多數其他" -"常用的 API 都可以在標準函式庫的其他地方被找到(例如 :mod:`platform` 、:mod:" -"`shutil`、:mod:`subprocess` 或 :mod:`sysconfig`)。目前沒有將 ``distutils`` " -"遷移任何其他地方的計畫,且使用其他功能的應用程式應該開始規劃如何取得程式碼的" -"私有副本。請參閱 :pep:`632` 的討論。" +"常用的 API 都可以在標準函式庫的其他地方被找到(例" +"如 :mod:`platform` 、:mod:`shutil`、:mod:`subprocess` 或 :mod:`sysconfig`)。" +"目前沒有將 ``distutils`` 遷移任何其他地方的計畫,且使用其他功能的應用程式應該" +"開始規劃如何取得程式碼的私有副本。請參閱 :pep:`632` 的討論。" #: ../../whatsnew/3.10.rst:1072 msgid "" @@ -2011,8 +2015,8 @@ msgid "" "Windows. (Contributed by Victor Stinner in :issue:`42802`.)" msgstr "" "Python 3.8 中不推薦使用的 ``bdist_wininst`` 命令已被刪除。現在建議使用 " -"``bdist_wheel`` 命令來在 Windows 上發布二進位套件。(由 Victor Stinner 在 :" -"issue:`42802` 中貢獻。)" +"``bdist_wheel`` 命令來在 Windows 上發布二進位套件。(由 Victor Stinner " +"在 :issue:`42802` 中貢獻。)" #: ../../whatsnew/3.10.rst:1078 msgid "doctest" @@ -2021,8 +2025,8 @@ msgstr "doctest" #: ../../whatsnew/3.10.rst:1080 ../../whatsnew/3.10.rst:1215 #: ../../whatsnew/3.10.rst:1242 ../../whatsnew/3.10.rst:1341 msgid "" -"When a module does not define ``__loader__``, fall back to ``__spec__." -"loader``. (Contributed by Brett Cannon in :issue:`42133`.)" +"When a module does not define ``__loader__``, fall back to " +"``__spec__.loader``. (Contributed by Brett Cannon in :issue:`42133`.)" msgstr "" "當模組未定義 ``__loader__`` 時,回退到 ``__spec__.loader`` 。(由 Brett " "Cannon 在 :issue:`42133` 中貢獻。)" @@ -2036,8 +2040,8 @@ msgid "" ":func:`encodings.normalize_encoding` now ignores non-ASCII characters. " "(Contributed by Hai Shi in :issue:`39337`.)" msgstr "" -":func:`encodings.normalize_encoding` 現在會忽略非 ASCII 字元。(Hai Shi 在 :" -"issue:`39337` 中貢獻。)" +":func:`encodings.normalize_encoding` 現在會忽略非 ASCII 字元。(Hai Shi " +"在 :issue:`39337` 中貢獻。)" #: ../../whatsnew/3.10.rst:1090 msgid "enum" @@ -2045,23 +2049,25 @@ msgstr "enum" #: ../../whatsnew/3.10.rst:1092 msgid "" -":class:`~enum.Enum` :func:`~object.__repr__` now returns ``enum_name." -"member_name`` and :func:`~object.__str__` now returns ``member_name``. " -"Stdlib enums available as module constants have a :func:`repr` of " -"``module_name.member_name``. (Contributed by Ethan Furman in :issue:`40066`.)" +":class:`~enum.Enum` :func:`~object.__repr__` now returns " +"``enum_name.member_name`` and :func:`~object.__str__` now returns " +"``member_name``. Stdlib enums available as module constants have " +"a :func:`repr` of ``module_name.member_name``. (Contributed by Ethan Furman " +"in :issue:`40066`.)" msgstr "" -":class:`~enum.Enum` :func:`~object.__repr__` 現在會回傳 ``enum_name." -"member_name`` 、:func:`~object.__str__` 現在會回傳 ``member_name`` 。可用作模" -"組常數的標準函式庫列舉會有 ``module_name.member_name`` 的 :func:`repr`。(由 " -"Ethan Furman 在 :issue:`40066` 中貢獻。)" +":class:`~enum.Enum` :func:`~object.__repr__` 現在會回傳 " +"``enum_name.member_name`` 、:func:`~object.__str__` 現在會回傳 " +"``member_name`` 。可用作模組常數的標準函式庫列舉會有 " +"``module_name.member_name`` 的 :func:`repr`。(由 Ethan Furman " +"在 :issue:`40066` 中貢獻。)" #: ../../whatsnew/3.10.rst:1097 msgid "" "Add :class:`enum.StrEnum` for enums where all members are strings. " "(Contributed by Ethan Furman in :issue:`41816`.)" msgstr "" -"新增 :class:`enum.StrEnum`,為所有成員都是字串的列舉。(由 Ethan Furman 在 :" -"issue:`41816` 中貢獻。)" +"新增 :class:`enum.StrEnum`,為所有成員都是字串的列舉。(由 Ethan Furman " +"在 :issue:`41816` 中貢獻。)" #: ../../whatsnew/3.10.rst:1101 msgid "fileinput" @@ -2069,8 +2075,9 @@ msgstr "fileinput" #: ../../whatsnew/3.10.rst:1103 msgid "" -"Add *encoding* and *errors* parameters in :func:`fileinput.input` and :class:" -"`fileinput.FileInput`. (Contributed by Inada Naoki in :issue:`43712`.)" +"Add *encoding* and *errors* parameters in :func:`fileinput.input` " +"and :class:`fileinput.FileInput`. (Contributed by Inada Naoki " +"in :issue:`43712`.)" msgstr "" "在 :func:`fileinput.input` 和 :class:`fileinput.FileInput` 中新增 *encoding* " "和 *errors* 參數。(由 Inada Naoki 在 :issue:`43712` 中貢獻。)" @@ -2092,8 +2099,8 @@ msgstr "faulthandler" #: ../../whatsnew/3.10.rst:1114 msgid "" "The :mod:`faulthandler` module now detects if a fatal error occurs during a " -"garbage collector collection. (Contributed by Victor Stinner in :issue:" -"`44466`.)" +"garbage collector collection. (Contributed by Victor Stinner " +"in :issue:`44466`.)" msgstr "" ":mod:`faulthandler` 模組現在可以檢測垃圾收集器 (garbage collector) 在收集期間" "是否發生嚴重錯誤。(由 Victor Stinner 在 :issue:`44466` 中貢獻。)" @@ -2104,12 +2111,13 @@ msgstr "gc" #: ../../whatsnew/3.10.rst:1121 msgid "" -"Add audit hooks for :func:`gc.get_objects`, :func:`gc.get_referrers` and :" -"func:`gc.get_referents`. (Contributed by Pablo Galindo in :issue:`43439`.)" +"Add audit hooks for :func:`gc.get_objects`, :func:`gc.get_referrers` " +"and :func:`gc.get_referents`. (Contributed by Pablo Galindo " +"in :issue:`43439`.)" msgstr "" -"為 :func:`gc.get_objects`、:func:`gc.get_referrers` 和 :func:`gc." -"get_referents` 新增稽核掛鉤 (audit hooks)。(由 Pablo Galindo 在 :issue:" -"`43439` 中貢獻。)" +"為 :func:`gc.get_objects`、:func:`gc.get_referrers` " +"和 :func:`gc.get_referents` 新增稽核掛鉤 (audit hooks)。(由 Pablo Galindo " +"在 :issue:`43439` 中貢獻。)" #: ../../whatsnew/3.10.rst:1125 msgid "glob" @@ -2117,9 +2125,9 @@ msgstr "glob" #: ../../whatsnew/3.10.rst:1127 msgid "" -"Add the *root_dir* and *dir_fd* parameters in :func:`~glob.glob` and :func:" -"`~glob.iglob` which allow to specify the root directory for searching. " -"(Contributed by Serhiy Storchaka in :issue:`38144`.)" +"Add the *root_dir* and *dir_fd* parameters in :func:`~glob.glob` " +"and :func:`~glob.iglob` which allow to specify the root directory for " +"searching. (Contributed by Serhiy Storchaka in :issue:`38144`.)" msgstr "" "在 :func:`~glob.glob` 和 :func:`~glob.iglob` 中新增 *root_dir* 和 *dir_fd* 參" "數,允許指定搜索的根目錄。(由 Serhiy Storchaka 在 :issue:`38144` 中貢獻。)" @@ -2133,8 +2141,8 @@ msgid "" "The hashlib module requires OpenSSL 1.1.1 or newer. (Contributed by " "Christian Heimes in :pep:`644` and :issue:`43669`.)" msgstr "" -"hashlib 模組需要 OpenSSL 1.1.1 或更高版本。(由 Christian Heimes 在 :pep:" -"`644` 和 :issue:`43669` 中貢獻。)" +"hashlib 模組需要 OpenSSL 1.1.1 或更高版本。(由 Christian Heimes " +"在 :pep:`644` 和 :issue:`43669` 中貢獻。)" #: ../../whatsnew/3.10.rst:1137 msgid "" @@ -2151,8 +2159,8 @@ msgid "" "with OpenSSL support. (Contributed by Christian Heimes in :issue:`43880`.)" msgstr "" "純 Python 的 :func:`~hashlib.pbkdf2_hmac` 回退已被棄用。將來只有在有 OpenSSL " -"支援的建置 Python 中才能夠使用 PBKDF2-HMAC。(由 Christian Heimes 在 :issue:" -"`43880` 中貢獻。)" +"支援的建置 Python 中才能夠使用 PBKDF2-HMAC。(由 Christian Heimes " +"在 :issue:`43880` 中貢獻。)" #: ../../whatsnew/3.10.rst:1146 msgid "hmac" @@ -2163,8 +2171,8 @@ msgid "" "The hmac module now uses OpenSSL's HMAC implementation internally. " "(Contributed by Christian Heimes in :issue:`40645`.)" msgstr "" -"hmac 模組現在在內部使用 OpenSSL 的 HMAC 實作。(由 Christian Heimes 在 :" -"issue:`40645` 中貢獻。)" +"hmac 模組現在在內部使用 OpenSSL 的 HMAC 實作。(由 Christian Heimes " +"在 :issue:`40645` 中貢獻。)" #: ../../whatsnew/3.10.rst:1152 msgid "IDLE and idlelib" @@ -2173,8 +2181,8 @@ msgstr "IDLE 和 idlelib" #: ../../whatsnew/3.10.rst:1154 msgid "" "Make IDLE invoke :func:`sys.excepthook` (when started without '-n'). User " -"hooks were previously ignored. (Contributed by Ken Hilton in :issue:" -"`43008`.)" +"hooks were previously ignored. (Contributed by Ken Hilton " +"in :issue:`43008`.)" msgstr "" "讓 IDLE 調用 :func:`sys.excepthook` (在沒有 ``-n`` 的情況下啟動時)。使用者" "掛鉤 (user hooks) 在以前是被忽略的。(由 Ken Hilton 在 :issue:`43008` 中貢" @@ -2185,10 +2193,10 @@ msgid "" "Rearrange the settings dialog. Split the General tab into Windows and Shell/" "Ed tabs. Move help sources, which extend the Help menu, to the Extensions " "tab. Make space for new options and shorten the dialog. The latter makes " -"the dialog better fit small screens. (Contributed by Terry Jan Reedy in :" -"issue:`40468`.) Move the indent space setting from the Font tab to the new " -"Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy in :issue:" -"`33962`.)" +"the dialog better fit small screens. (Contributed by Terry Jan Reedy " +"in :issue:`40468`.) Move the indent space setting from the Font tab to the " +"new Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy " +"in :issue:`33962`.)" msgstr "" "重新排列設定對話框。將 General 分頁拆分為 Windows 和 Shell/Ed 分頁。將擴充 " "Help 選單的幫助來源移至 Extensions 分頁。為新選項騰出空間並縮短對話框,而後者" @@ -2210,9 +2218,9 @@ msgid "" "the selected text. This option also appears on the context menu for the " "text. (Contributed by Tal Einat in :issue:`37903`.)" msgstr "" -"新增 Shell 側邊欄。將主要提示字元 (``>>>``) 移至側邊欄。將輔助提示字元(``..." -"``)新增到側邊欄。點擊左鍵再拖動能夠選擇一行或多行文字,和編輯器列號側邊欄操" -"作一樣。選擇文字列後點擊右鍵會顯示帶有「一併複製提示字元 (copy with " +"新增 Shell 側邊欄。將主要提示字元 (``>>>``) 移至側邊欄。將輔助提示字元" +"(``...``)新增到側邊欄。點擊左鍵再拖動能夠選擇一行或多行文字,和編輯器列號側" +"邊欄操作一樣。選擇文字列後點擊右鍵會顯示帶有「一併複製提示字元 (copy with " "prompts)」的情境選單,這會將側邊欄中提示字元與所選文字並排,此選項也會出現在" "文字的情境選單上。(由 Tal Einat 在 :issue:`37903` 中貢獻。)" @@ -2229,11 +2237,12 @@ msgstr "" #: ../../whatsnew/3.10.rst:1182 msgid "" -"Highlight the new :ref:`soft keywords <soft-keywords>` :keyword:`match`, :" -"keyword:`case <match>`, and :keyword:`_ <wildcard-patterns>` in pattern-" -"matching statements. However, this highlighting is not perfect and will be " -"incorrect in some rare cases, including some ``_``-s in ``case`` patterns. " -"(Contributed by Tal Einat in :issue:`44010`.)" +"Highlight the new :ref:`soft keywords <soft-" +"keywords>` :keyword:`match`, :keyword:`case <match>`, and :keyword:`_ " +"<wildcard-patterns>` in pattern-matching statements. However, this " +"highlighting is not perfect and will be incorrect in some rare cases, " +"including some ``_``-s in ``case`` patterns. (Contributed by Tal Einat " +"in :issue:`44010`.)" msgstr "" "突顯 (highlight) 模式匹配陳述式中的新\\ :ref:`軟關鍵字 (soft keywords) <soft-" "keywords>` :keyword:`match`、:keyword:`case <match>` 和 :keyword:`_ " @@ -2257,8 +2266,8 @@ msgid "" "Include prompts when saving Shell with inputs and outputs. (Contributed by " "Terry Jan Reedy in :gh:`95191`.)" msgstr "" -"保存帶有輸入和輸出的 Shell 時,會包含提示字元。(由 Terry Jan Reedy 在 :gh:" -"`95191` 中貢獻。)" +"保存帶有輸入和輸出的 Shell 時,會包含提示字元。(由 Terry Jan Reedy " +"在 :gh:`95191` 中貢獻。)" #: ../../whatsnew/3.10.rst:1197 msgid "importlib.metadata" @@ -2269,19 +2278,19 @@ msgid "" "Feature parity with ``importlib_metadata`` 4.6 (`history <https://importlib-" "metadata.readthedocs.io/en/latest/history.html>`_)." msgstr "" -"與 ``importlib_metadata`` 4.6 功能相同(`歷史 <https://importlib-metadata." -"readthedocs.io/en/latest/history.html>`_)。" +"與 ``importlib_metadata`` 4.6 功能相同(`歷史 <https://importlib-" +"metadata.readthedocs.io/en/latest/history.html>`_)。" #: ../../whatsnew/3.10.rst:1202 msgid "" ":ref:`importlib.metadata entry points <entry-points>` now provide a nicer " -"experience for selecting entry points by group and name through a new :ref:" -"`importlib.metadata.EntryPoints <entry-points>` class. See the Compatibility " -"Note in the docs for more info on the deprecation and usage." +"experience for selecting entry points by group and name through a " +"new :ref:`importlib.metadata.EntryPoints <entry-points>` class. See the " +"Compatibility Note in the docs for more info on the deprecation and usage." msgstr "" -":ref:`importlib.metadata 入口點 <entry-points>`\\ 現在透過新的 :ref:" -"`importlib.metadata.EntryPoints <entry-points>` 類別提供了以群組和名稱選擇入" -"口點的更好體驗。有關棄用與用法的更多資訊,請參閱文件中的相容性說明。" +":ref:`importlib.metadata 入口點 <entry-points>`\\ 現在透過新" +"的 :ref:`importlib.metadata.EntryPoints <entry-points>` 類別提供了以群組和名" +"稱選擇入口點的更好體驗。有關棄用與用法的更多資訊,請參閱文件中的相容性說明。" #: ../../whatsnew/3.10.rst:1208 msgid "" @@ -2290,8 +2299,8 @@ msgid "" "their :ref:`importlib.metadata.Distribution <distributions>`." msgstr "" "新增了 :ref:`importlib.metadata.packages_distributions() <package-" -"distributions>` 用於將頂階 Python 模組和套件解析出 :ref:`importlib.metadata." -"Distribution <distributions>`。" +"distributions>` 用於將頂階 Python 模組和套件解析" +"出 :ref:`importlib.metadata.Distribution <distributions>`。" #: ../../whatsnew/3.10.rst:1213 msgid "inspect" @@ -2303,25 +2312,27 @@ msgid "" "defined on an object. It works around the quirks of accessing the " "annotations on various types of objects, and makes very few assumptions " "about the object it examines. :func:`inspect.get_annotations` can also " -"correctly un-stringize stringized annotations. :func:`inspect." -"get_annotations` is now considered best practice for accessing the " -"annotations dict defined on any Python object; for more information on best " -"practices for working with annotations, please see :ref:`annotations-howto`. " -"Relatedly, :func:`inspect.signature`, :func:`inspect.Signature." -"from_callable`, and :func:`!inspect.Signature.from_function` now call :func:" -"`inspect.get_annotations` to retrieve annotations. This means :func:`inspect." -"signature` and :func:`inspect.Signature.from_callable` can also now un-" -"stringize stringized annotations. (Contributed by Larry Hastings in :issue:" -"`43817`.)" +"correctly un-stringize stringized " +"annotations. :func:`inspect.get_annotations` is now considered best " +"practice for accessing the annotations dict defined on any Python object; " +"for more information on best practices for working with annotations, please " +"see :ref:`annotations-howto`. " +"Relatedly, :func:`inspect.signature`, :func:`inspect.Signature.from_callable`, " +"and :func:`!inspect.Signature.from_function` now " +"call :func:`inspect.get_annotations` to retrieve annotations. This " +"means :func:`inspect.signature` and :func:`inspect.Signature.from_callable` " +"can also now un-stringize stringized annotations. (Contributed by Larry " +"Hastings in :issue:`43817`.)" msgstr "" "新增 :func:`inspect.get_annotations`,它可以安全地計算物件上定義的註釋。它是" "存取各種型別物件註釋的怪作法 (quirks) 的變通解法 (work around),並且對其檢查" "的物件做出很少的假設。 :func:`inspect.get_annotations` 也可以正確地取消字串化" "註釋 (stringized annotations)。 :func:`inspect.get_annotations` 現在被認為是" "存取任何 Python 物件上定義的註釋字典的最佳實踐;有關使用註釋的最佳實踐的更多" -"資訊,請參閱 :ref:`annotations-howto`。相關地,:func:`inspect.signature`、:" -"func:`inspect.Signature.from_callable` 和 :func:`!inspect.Signature." -"from_function` 現在呼叫 :func:`inspect.get_annotations` 來檢索註釋。這意味" +"資訊,請參閱 :ref:`annotations-howto`。相關" +"地,:func:`inspect.signature`、:func:`inspect.Signature.from_callable` " +"和 :func:`!inspect.Signature.from_function` 現在呼" +"叫 :func:`inspect.get_annotations` 來檢索註釋。這意味" "著 :func:`inspect.signature` 和 :func:`inspect.Signature.from_callable` 現在" "也可以取消字串化註釋。(由 Larry Hastings 在 :issue:`43817` 中貢獻。)" @@ -2331,8 +2342,8 @@ msgstr "itertools" #: ../../whatsnew/3.10.rst:1236 msgid "" -"Add :func:`itertools.pairwise`. (Contributed by Raymond Hettinger in :issue:" -"`38200`.)" +"Add :func:`itertools.pairwise`. (Contributed by Raymond Hettinger " +"in :issue:`38200`.)" msgstr "" "新增 :func:`itertools.pairwise`。(由 Raymond Hettinger 在 :issue:`38200` 中" "貢獻。)" @@ -2350,14 +2361,14 @@ msgid "" "Add :func:`os.cpu_count` support for VxWorks RTOS. (Contributed by Peixing " "Xin in :issue:`41440`.)" msgstr "" -"為 VxWorks RTOS 新增 :func:`os.cpu_count` 支援。(由 Peixing Xin 在 :issue:" -"`41440` 中貢獻。)" +"為 VxWorks RTOS 新增 :func:`os.cpu_count` 支援。(由 Peixing Xin " +"在 :issue:`41440` 中貢獻。)" #: ../../whatsnew/3.10.rst:1251 msgid "" "Add a new function :func:`os.eventfd` and related helpers to wrap the " -"``eventfd2`` syscall on Linux. (Contributed by Christian Heimes in :issue:" -"`41001`.)" +"``eventfd2`` syscall on Linux. (Contributed by Christian Heimes " +"in :issue:`41001`.)" msgstr "" "新增函式 :func:`os.eventfd` 和相關幫助程式來包裝 Linux 上的 ``eventfd2`` 系統" "呼叫。(由 Christian Heimes 在 :issue:`41001` 中貢獻。)" @@ -2377,12 +2388,12 @@ msgstr "" #: ../../whatsnew/3.10.rst:1260 msgid "" "Add :const:`~os.O_EVTONLY`, :const:`~os.O_FSYNC`, :const:`~os.O_SYMLINK` " -"and :const:`~os.O_NOFOLLOW_ANY` for macOS. (Contributed by Donghee Na in :" -"issue:`43106`.)" +"and :const:`~os.O_NOFOLLOW_ANY` for macOS. (Contributed by Donghee Na " +"in :issue:`43106`.)" msgstr "" -"為 macOS 新增 :const:`~os.O_EVTONLY`、:const:`~os.O_FSYNC`、:const:`~os." -"O_SYMLINK` 和 :const:`~os.O_NOFOLLOW_ANY`。(由 Donghee Na 在 :issue:`43106` " -"中貢獻。)" +"為 macOS 新" +"增 :const:`~os.O_EVTONLY`、:const:`~os.O_FSYNC`、:const:`~os.O_SYMLINK` " +"和 :const:`~os.O_NOFOLLOW_ANY`。(由 Donghee Na 在 :issue:`43106` 中貢獻。)" #: ../../whatsnew/3.10.rst:1265 msgid "os.path" @@ -2395,8 +2406,8 @@ msgid "" "symlink loop is encountered. (Contributed by Barney Gale in :issue:`43757`.)" msgstr "" ":func:`os.path.realpath` 現在接受一個 *strict* 僅限關鍵字引數。當設定為 " -"``True`` 時,如果路徑不存在或遇到符號鏈接循環 (symlink loop),則會引發 :exc:" -"`OSError`。(由 Barney Gale 在 :issue:`43757` 中貢獻。)" +"``True`` 時,如果路徑不存在或遇到符號鏈接循環 (symlink loop),則會引" +"發 :exc:`OSError`。(由 Barney Gale 在 :issue:`43757` 中貢獻。)" #: ../../whatsnew/3.10.rst:1273 msgid "pathlib" @@ -2412,8 +2423,9 @@ msgstr "" #: ../../whatsnew/3.10.rst:1278 msgid "" -"Add negative indexing support to :attr:`PurePath.parents <pathlib.PurePath." -"parents>`. (Contributed by Yaroslav Pankovych in :issue:`21041`.)" +"Add negative indexing support to :attr:`PurePath.parents " +"<pathlib.PurePath.parents>`. (Contributed by Yaroslav Pankovych " +"in :issue:`21041`.)" msgstr "" "向 :attr:`PurePath.parents <pathlib.PurePath.parents>` 新增負索引支援。(由 " "Yaroslav Pankovych 在 :issue:`21041` 中貢獻。)" @@ -2421,20 +2433,20 @@ msgstr "" #: ../../whatsnew/3.10.rst:1282 msgid "" "Add :meth:`Path.hardlink_to <pathlib.Path.hardlink_to>` method that " -"supersedes :meth:`!link_to`. The new method has the same argument order as :" -"meth:`~pathlib.Path.symlink_to`. (Contributed by Barney Gale in :issue:" -"`39950`.)" +"supersedes :meth:`!link_to`. The new method has the same argument order " +"as :meth:`~pathlib.Path.symlink_to`. (Contributed by Barney Gale " +"in :issue:`39950`.)" msgstr "" -"新增替代 :meth:`!link_to` 的 :meth:`Path.hardlink_to <pathlib.Path." -"hardlink_to>` 方法。新方法與 :meth:`~pathlib.Path.symlink_to` 具有相同的引數" -"順序。(由 Barney Gale 在 :issue:`39950` 中貢獻。)" +"新增替代 :meth:`!link_to` 的 :meth:`Path.hardlink_to " +"<pathlib.Path.hardlink_to>` 方法。新方法與 :meth:`~pathlib.Path.symlink_to` " +"具有相同的引數順序。(由 Barney Gale 在 :issue:`39950` 中貢獻。)" #: ../../whatsnew/3.10.rst:1287 msgid "" ":meth:`pathlib.Path.stat` and :meth:`~pathlib.Path.chmod` now accept a " "*follow_symlinks* keyword-only argument for consistency with corresponding " -"functions in the :mod:`os` module. (Contributed by Barney Gale in :issue:" -"`39906`.)" +"functions in the :mod:`os` module. (Contributed by Barney Gale " +"in :issue:`39906`.)" msgstr "" ":meth:`pathlib.Path.stat` 和 :meth:`~pathlib.Path.chmod` 現在接受 " "*follow_symlinks* 僅限關鍵字引數,以與 :mod:`os` 模組中的相應函式保持一致。" @@ -2445,16 +2457,15 @@ msgid "platform" msgstr "platform" #: ../../whatsnew/3.10.rst:1295 -#, fuzzy msgid "" "Add :func:`platform.freedesktop_os_release` to retrieve operation system " "identification from `freedesktop.org os-release <https://www.freedesktop.org/" "software/systemd/man/os-release.html>`_ standard file. (Contributed by " "Christian Heimes in :issue:`28468`.)" msgstr "" -"新增 :func:`platform.freedesktop_os_release()` 以從 `freedesktop.org os-" +"新增 :func:`platform.freedesktop_os_release` 以從 `freedesktop.org os-" "release <https://www.freedesktop.org/software/systemd/man/os-release.html>`_ " -"標準檔案中檢索出作業系統標識。(由 Christian Heimes 在 :issue:`28468` 中貢" +"標準檔案中檢索出作業系統識別。(由 Christian Heimes 在 :issue:`28468` 中貢" "獻。)" #: ../../whatsnew/3.10.rst:1301 @@ -2496,13 +2507,14 @@ msgstr "pyclbr" #: ../../whatsnew/3.10.rst:1318 msgid "" "Add an ``end_lineno`` attribute to the ``Function`` and ``Class`` objects in " -"the tree returned by :func:`pyclbr.readmodule` and :func:`pyclbr." -"readmodule_ex`. It matches the existing (start) ``lineno``. (Contributed by " -"Aviral Srivastava in :issue:`38307`.)" +"the tree returned by :func:`pyclbr.readmodule` " +"and :func:`pyclbr.readmodule_ex`. It matches the existing (start) " +"``lineno``. (Contributed by Aviral Srivastava in :issue:`38307`.)" msgstr "" -"將 ``end_lineno`` 屬性新增到 :func:`pyclbr.readmodule` 和 :func:`pyclbr." -"readmodule_ex` 回傳的樹中的 ``Function`` 和 ``Class`` 物件。它與現有的(開" -"始) ``lineno`` 匹配。(由 Aviral Srivastava 在 :issue:`38307` 中貢獻。)" +"將 ``end_lineno`` 屬性新增到 :func:`pyclbr.readmodule` " +"和 :func:`pyclbr.readmodule_ex` 回傳的樹中的 ``Function`` 和 ``Class`` 物件。" +"它與現有的(開始) ``lineno`` 匹配。(由 Aviral Srivastava 在 :issue:`38307` " +"中貢獻。)" #: ../../whatsnew/3.10.rst:1324 msgid "shelve" @@ -2514,9 +2526,9 @@ msgid "" "default instead of :mod:`pickle` protocol ``3`` when creating shelves. " "(Contributed by Zackery Spytz in :issue:`34204`.)" msgstr "" -"現在,:mod:`shelve` 模組在建立 shelve 時預設使用 :const:`pickle." -"DEFAULT_PROTOCOL`,而不是 :mod:`pickle` 的協議 ``3``。(由 Zackery Spytz 在 :" -"issue:`34204` 中貢獻。)" +"現在,:mod:`shelve` 模組在建立 shelve 時預設使" +"用 :const:`pickle.DEFAULT_PROTOCOL`,而不是 :mod:`pickle` 的協議 ``3``。(由 " +"Zackery Spytz 在 :issue:`34204` 中貢獻。)" #: ../../whatsnew/3.10.rst:1331 msgid "statistics" @@ -2524,9 +2536,10 @@ msgstr "statistics" #: ../../whatsnew/3.10.rst:1333 msgid "" -"Add :func:`~statistics.covariance`, Pearson's :func:`~statistics." -"correlation`, and simple :func:`~statistics.linear_regression` functions. " -"(Contributed by Tymoteusz Wołodźko in :issue:`38490`.)" +"Add :func:`~statistics.covariance`, " +"Pearson's :func:`~statistics.correlation`, and " +"simple :func:`~statistics.linear_regression` functions. (Contributed by " +"Tymoteusz Wołodźko in :issue:`38490`.)" msgstr "" "新增 :func:`~statistics.covariance`、Pearson :func:`~statistics.correlation` " "和簡單 :func:`~statistics.linear_regression` 函式。(由 Tymoteusz Wołodźko " @@ -2553,8 +2566,8 @@ msgid "" "Add option to create MPTCP sockets with ``IPPROTO_MPTCP`` (Contributed by " "Rui Cunha in :issue:`43571`.)" msgstr "" -"新增使用 ``IPPROTO_MPTCP`` 建立 MPTCP socket 的選項(由 Rui Cunha 在 :issue:" -"`43571` 中貢獻。)" +"新增使用 ``IPPROTO_MPTCP`` 建立 MPTCP socket 的選項(由 Rui Cunha " +"在 :issue:`43571` 中貢獻。)" #: ../../whatsnew/3.10.rst:1353 msgid "" @@ -2578,44 +2591,45 @@ msgstr "" #: ../../whatsnew/3.10.rst:1362 msgid "" -"The ssl module has preliminary support for OpenSSL 3.0.0 and new option :" -"const:`~ssl.OP_IGNORE_UNEXPECTED_EOF`. (Contributed by Christian Heimes in :" -"issue:`38820`, :issue:`43794`, :issue:`43788`, :issue:`43791`, :issue:" -"`43799`, :issue:`43920`, :issue:`43789`, and :issue:`43811`.)" +"The ssl module has preliminary support for OpenSSL 3.0.0 and new " +"option :const:`~ssl.OP_IGNORE_UNEXPECTED_EOF`. (Contributed by Christian " +"Heimes " +"in :issue:`38820`, :issue:`43794`, :issue:`43788`, :issue:`43791`, :issue:`43799`, :issue:`43920`, :issue:`43789`, " +"and :issue:`43811`.)" msgstr "" -"ssl 模組初步支援 OpenSSL 3.0.0 和新選項 :const:`~ssl." -"OP_IGNORE_UNEXPECTED_EOF`。(由 Christian Heimes 於 :issue:`38820`、:issue:" -"`43794`、:issue:`43788`、:issue:`43791`、:issue:`43799`、:issue:`43920`、:" -"issue:`43789` 和 :issue:`43811` 貢獻。)" +"ssl 模組初步支援 OpenSSL 3.0.0 和新選" +"項 :const:`~ssl.OP_IGNORE_UNEXPECTED_EOF`。(由 Christian Heimes " +"於 :issue:`38820`、:issue:`43794`、:issue:`43788`、:issue:`43791`、:issue:`43799`、:issue:`43920`、:issue:`43789` " +"和 :issue:`43811` 貢獻。)" #: ../../whatsnew/3.10.rst:1368 msgid "" -"Deprecated function and use of deprecated constants now result in a :exc:" -"`DeprecationWarning`. :attr:`ssl.SSLContext.options` has :data:`~ssl." -"OP_NO_SSLv2` and :data:`~ssl.OP_NO_SSLv3` set by default and therefore " -"cannot warn about setting the flag again. The :ref:`deprecation section " -"<whatsnew310-deprecated>` has a list of deprecated features. (Contributed by " -"Christian Heimes in :issue:`43880`.)" -msgstr "" -"已棄用函式和使用已棄用常數現在會導致 :exc:`DeprecationWarning`。 :attr:`ssl." -"SSLContext.options` 預設設定有 :data:`~ssl.OP_NO_SSLv2` 和 :data:`~ssl." -"OP_NO_SSLv3`,因此無法再次發出設定該旗標的警告。:ref:`棄用部分 <whatsnew310-" -"deprecated>`\\ 包含已棄用功能的列表。(由 Christian Heimes 在 :issue:`43880` " -"中貢獻。)" +"Deprecated function and use of deprecated constants now result in " +"a :exc:`DeprecationWarning`. :attr:`ssl.SSLContext.options` " +"has :data:`~ssl.OP_NO_SSLv2` and :data:`~ssl.OP_NO_SSLv3` set by default and " +"therefore cannot warn about setting the flag again. The :ref:`deprecation " +"section <whatsnew310-deprecated>` has a list of deprecated features. " +"(Contributed by Christian Heimes in :issue:`43880`.)" +msgstr "" +"已棄用函式和使用已棄用常數現在會導" +"致 :exc:`DeprecationWarning`。 :attr:`ssl.SSLContext.options` 預設設定" +"有 :data:`~ssl.OP_NO_SSLv2` 和 :data:`~ssl.OP_NO_SSLv3`,因此無法再次發出設定" +"該旗標的警告。:ref:`棄用部分 <whatsnew310-deprecated>`\\ 包含已棄用功能的列" +"表。(由 Christian Heimes 在 :issue:`43880` 中貢獻。)" #: ../../whatsnew/3.10.rst:1376 msgid "" "The ssl module now has more secure default settings. Ciphers without forward " "secrecy or SHA-1 MAC are disabled by default. Security level 2 prohibits " -"weak RSA, DH, and ECC keys with less than 112 bits of security. :class:`~ssl." -"SSLContext` defaults to minimum protocol version TLS 1.2. Settings are based " -"on Hynek Schlawack's research. (Contributed by Christian Heimes in :issue:" -"`43998`.)" +"weak RSA, DH, and ECC keys with less than 112 bits of " +"security. :class:`~ssl.SSLContext` defaults to minimum protocol version TLS " +"1.2. Settings are based on Hynek Schlawack's research. (Contributed by " +"Christian Heimes in :issue:`43998`.)" msgstr "" "ssl 模組現在具有更安全的預設設定。預設情況下禁用沒有前向保密或 SHA-1 MAC 的密" -"碼。安全級別 2 禁止安全性低於 112 位元的弱 RSA、DH 和 ECC 密鑰。 :class:" -"`~ssl.SSLContext` 預設為最低協議版本 TLS 1.2。設定基於 Hynek Schlawack 的研" -"究。(由 Christian Heimes 在 :issue:`43998` 中貢獻。)" +"碼。安全級別 2 禁止安全性低於 112 位元的弱 RSA、DH 和 ECC 密" +"鑰。 :class:`~ssl.SSLContext` 預設為最低協議版本 TLS 1.2。設定基於 Hynek " +"Schlawack 的研究。(由 Christian Heimes 在 :issue:`43998` 中貢獻。)" #: ../../whatsnew/3.10.rst:1383 msgid "" @@ -2649,8 +2663,8 @@ msgid "" "A new verify flag :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN` has been added. " "(Contributed by l0x in :issue:`40849`.)" msgstr "" -"新增驗證旗標 :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN`。(由 l0x 在 :issue:" -"`40849` 中貢獻。)" +"新增驗證旗標 :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN`。(由 l0x " +"在 :issue:`40849` 中貢獻。)" #: ../../whatsnew/3.10.rst:1398 msgid "sqlite3" @@ -2658,13 +2672,15 @@ msgstr "sqlite3" #: ../../whatsnew/3.10.rst:1400 msgid "" -"Add audit events for :func:`~sqlite3.connect/handle`, :meth:`~sqlite3." -"Connection.enable_load_extension`, and :meth:`~sqlite3.Connection." -"load_extension`. (Contributed by Erlend E. Aasland in :issue:`43762`.)" +"Add audit events for :func:`~sqlite3.connect/" +"handle`, :meth:`~sqlite3.Connection.enable_load_extension`, " +"and :meth:`~sqlite3.Connection.load_extension`. (Contributed by Erlend E. " +"Aasland in :issue:`43762`.)" msgstr "" -"新增 :func:`~sqlite3.connect/handle`、:meth:`~sqlite3.Connection." -"enable_load_extension` 和 :meth:`~sqlite3.Connection.load_extension` 的稽核事" -"件。(由 Erlend E. Aasland 在 :issue:`43762` 中貢獻。)" +"新增 :func:`~sqlite3.connect/" +"handle`、:meth:`~sqlite3.Connection.enable_load_extension` " +"和 :meth:`~sqlite3.Connection.load_extension` 的稽核事件。(由 Erlend E. " +"Aasland 在 :issue:`43762` 中貢獻。)" #: ../../whatsnew/3.10.rst:1406 msgid "sys" @@ -2708,12 +2724,13 @@ msgstr "threading" #: ../../whatsnew/3.10.rst:1426 msgid "" "Add :func:`threading.gettrace` and :func:`threading.getprofile` to retrieve " -"the functions set by :func:`threading.settrace` and :func:`threading." -"setprofile` respectively. (Contributed by Mario Corchero in :issue:`42251`.)" +"the functions set by :func:`threading.settrace` " +"and :func:`threading.setprofile` respectively. (Contributed by Mario " +"Corchero in :issue:`42251`.)" msgstr "" -"新增 :func:`threading.gettrace` 和 :func:`threading.getprofile` 分別取得 :" -"func:`threading.settrace` 和 :func:`threading.setprofile` 設定的函式。(由 " -"Mario Corchero 在 :issue:`42251` 中貢獻。)" +"新增 :func:`threading.gettrace` 和 :func:`threading.getprofile` 分別取" +"得 :func:`threading.settrace` 和 :func:`threading.setprofile` 設定的函式。" +"(由 Mario Corchero 在 :issue:`42251` 中貢獻。)" #: ../../whatsnew/3.10.rst:1431 msgid "" @@ -2721,9 +2738,9 @@ msgid "" "of :func:`threading.excepthook` in case it is set to a broken or a different " "value. (Contributed by Mario Corchero in :issue:`42308`.)" msgstr "" -"新增 :data:`threading.__excepthook__` 以允許取得 :func:`threading." -"excepthook` 的原始值,以防它被設定為損壞或不同的值。(由 Mario Corchero 在 :" -"issue:`42308` 中貢獻。)" +"新增 :data:`threading.__excepthook__` 以允許取" +"得 :func:`threading.excepthook` 的原始值,以防它被設定為損壞或不同的值。(由 " +"Mario Corchero 在 :issue:`42308` 中貢獻。)" #: ../../whatsnew/3.10.rst:1437 msgid "traceback" @@ -2731,15 +2748,14 @@ msgstr "traceback" #: ../../whatsnew/3.10.rst:1439 msgid "" -"The :func:`~traceback.format_exception`, :func:`~traceback." -"format_exception_only`, and :func:`~traceback.print_exception` functions can " -"now take an exception object as a positional-only argument. (Contributed by " -"Zackery Spytz and Matthias Bussonnier in :issue:`26389`.)" +"The :func:`~traceback.format_exception`, :func:`~traceback.format_exception_only`, " +"and :func:`~traceback.print_exception` functions can now take an exception " +"object as a positional-only argument. (Contributed by Zackery Spytz and " +"Matthias Bussonnier in :issue:`26389`.)" msgstr "" -":func:`~traceback.format_exception`、:func:`~traceback." -"format_exception_only` 和 :func:`~traceback.print_exception` 函式現在可以將例" -"外物件作為僅限位置引數。(由 Zackery Spytz 和 Matthias Bussonnier 在 :issue:" -"`26389` 中貢獻。)" +":func:`~traceback.format_exception`、:func:`~traceback.format_exception_only` " +"和 :func:`~traceback.print_exception` 函式現在可以將例外物件作為僅限位置引" +"數。(由 Zackery Spytz 和 Matthias Bussonnier 在 :issue:`26389` 中貢獻。)" #: ../../whatsnew/3.10.rst:1446 msgid "types" @@ -2747,14 +2763,14 @@ msgstr "types" #: ../../whatsnew/3.10.rst:1448 msgid "" -"Reintroduce the :data:`types.EllipsisType`, :data:`types.NoneType` and :data:" -"`types.NotImplementedType` classes, providing a new set of types readily " -"interpretable by type checkers. (Contributed by Bas van Beek in :issue:" -"`41810`.)" +"Reintroduce the :data:`types.EllipsisType`, :data:`types.NoneType` " +"and :data:`types.NotImplementedType` classes, providing a new set of types " +"readily interpretable by type checkers. (Contributed by Bas van Beek " +"in :issue:`41810`.)" msgstr "" -"重新引入 :data:`types.EllipsisType`、:data:`types.NoneType` 和 :data:`types." -"NotImplementedType` 類別,提供一組易於型別檢查器直譯的新型別。(由 Bas van " -"Beek 在 :issue:`41810` 中貢獻。)" +"重新引入 :data:`types.EllipsisType`、:data:`types.NoneType` " +"和 :data:`types.NotImplementedType` 類別,提供一組易於型別檢查器直譯的新型" +"別。(由 Bas van Beek 在 :issue:`41810` 中貢獻。)" #: ../../whatsnew/3.10.rst:1454 msgid "typing" @@ -2766,8 +2782,9 @@ msgstr "有關重大更改,請參閱\\ :ref:`new-feat-related-type-hints`。" #: ../../whatsnew/3.10.rst:1458 msgid "" -"The behavior of :class:`typing.Literal` was changed to conform with :pep:" -"`586` and to match the behavior of static type checkers specified in the PEP." +"The behavior of :class:`typing.Literal` was changed to conform " +"with :pep:`586` and to match the behavior of static type checkers specified " +"in the PEP." msgstr "" ":class:`typing.Literal` 的行為已更改為符合 :pep:`586` 並匹配 PEP 中指定的靜態" "型別檢查器的行為。" @@ -2799,7 +2816,7 @@ msgid "" "Note that declaring ``Literal`` with unhashable parameters will not throw an " "error::" msgstr "" -"如果 ``Literal`` 物件的任ㄧ參數不是\\ :term:`可雜湊的 <hashable>`,那麼它們現" +"如果 ``Literal`` 物件的任一參數不是\\ :term:`可雜湊的 <hashable>`,那麼它們現" "在將在相等性比較期間引發 :exc:`TypeError` 例外。請注意,使用不可雜湊的參數宣" "告 ``Literal`` 不會引發錯誤: ::" @@ -2826,19 +2843,20 @@ msgstr "(由 Yurii Karabas 在 :issue:`42345` 中貢獻。)" #: ../../whatsnew/3.10.rst:1481 msgid "" "Add new function :func:`typing.is_typeddict` to introspect if an annotation " -"is a :class:`typing.TypedDict`. (Contributed by Patrick Reader in :issue:" -"`41792`.)" +"is a :class:`typing.TypedDict`. (Contributed by Patrick Reader " +"in :issue:`41792`.)" msgstr "" -"新增函式 :func:`typing.is_typeddict` 來自我審查 (introspect) 註釋是否為 :" -"class:`typing.TypedDict`。(由 Patrick Reader 在 :issue:`41792` 中貢獻。)" +"新增函式 :func:`typing.is_typeddict` 來自我審查 (introspect) 註釋是否" +"為 :class:`typing.TypedDict`。(由 Patrick Reader 在 :issue:`41792` 中貢" +"獻。)" #: ../../whatsnew/3.10.rst:1485 msgid "" "Subclasses of ``typing.Protocol`` which only have data variables declared " "will now raise a ``TypeError`` when checked with ``isinstance`` unless they " "are decorated with :func:`~typing.runtime_checkable`. Previously, these " -"checks passed silently. Users should decorate their subclasses with the :" -"func:`!runtime_checkable` decorator if they want runtime protocols. " +"checks passed silently. Users should decorate their subclasses with " +"the :func:`!runtime_checkable` decorator if they want runtime protocols. " "(Contributed by Yurii Karabas in :issue:`38908`.)" msgstr "" "僅宣告了資料變數的 ``typing.Protocol`` 子類別現在在使用 ``isinstance`` 檢查時" @@ -2849,16 +2867,16 @@ msgstr "" #: ../../whatsnew/3.10.rst:1493 msgid "" -"Importing from the ``typing.io`` and ``typing.re`` submodules will now emit :" -"exc:`DeprecationWarning`. These submodules have been deprecated since " +"Importing from the ``typing.io`` and ``typing.re`` submodules will now " +"emit :exc:`DeprecationWarning`. These submodules have been deprecated since " "Python 3.8 and will be removed in a future version of Python. Anything " "belonging to those submodules should be imported directly from :mod:`typing` " "instead. (Contributed by Sebastian Rittau in :issue:`38291`.)" msgstr "" -"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發出 :exc:" -"`DeprecationWarning`。這些子模組自 Python 3.8 起已被棄用,並將在未來版本的 " -"Python 中刪除。屬於這些子模組的任何內容都應該直接從 :mod:`typing` 引入。 " -"(由 Sebastian Rittau 在 :issue:`38291` 中貢獻。)" +"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發" +"出 :exc:`DeprecationWarning`。這些子模組自 Python 3.8 起已被棄用,並將在未來" +"版本的 Python 中刪除。屬於這些子模組的任何內容都應該直接從 :mod:`typing` 引" +"入。 (由 Sebastian Rittau 在 :issue:`38291` 中貢獻。)" #: ../../whatsnew/3.10.rst:1501 msgid "unittest" @@ -2870,43 +2888,43 @@ msgid "" "existing :meth:`~unittest.TestCase.assertLogs`. (Contributed by Kit Yan Choi " "in :issue:`39385`.)" msgstr "" -"新增方法 :meth:`~unittest.TestCase.assertNoLogs` 以補足現有的 :meth:" -"`~unittest.TestCase.assertLogs`。(由 Kit Yan Choi 在 :issue:`39385` 中貢" -"獻。)" +"新增方法 :meth:`~unittest.TestCase.assertNoLogs` 以補足現有" +"的 :meth:`~unittest.TestCase.assertLogs`。(由 Kit Yan Choi " +"在 :issue:`39385` 中貢獻。)" #: ../../whatsnew/3.10.rst:1508 msgid "urllib.parse" msgstr "urllib.parse" #: ../../whatsnew/3.10.rst:1510 -#, fuzzy msgid "" "Python versions earlier than Python 3.10 allowed using both ``;`` and ``&`` " -"as query parameter separators in :func:`urllib.parse.parse_qs` and :func:" -"`urllib.parse.parse_qsl`. Due to security concerns, and to conform with " -"newer W3C recommendations, this has been changed to allow only a single " -"separator key, with ``&`` as the default. This change also affects :func:`!" -"cgi.parse` and :func:`!cgi.parse_multipart` as they use the affected " -"functions internally. For more details, please see their respective " -"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " -"in :issue:`42967`.)" -msgstr "" -"Python 3.10 之前的 Python 版本允許在 :func:`urllib.parse.parse_qs` 和 :func:" -"`urllib.parse.parse_qsl` 中使用 ``;`` 和 ``&`` 作為查詢參數 (query " +"as query parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their " +"respective documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran " +"and Ken Jin in :issue:`42967`.)" +msgstr "" +"Python 3.10 之前的 Python 版本允許在 :func:`urllib.parse.parse_qs` " +"和 :func:`urllib.parse.parse_qsl` 中使用 ``;`` 和 ``&`` 作為查詢參數 (query " "parameter) 的分隔符號。出於安全考慮,並且為了符合更新的 W3C 建議,已將其更改" -"為僅允許單個分隔符號鍵,預設為 ``&``。此更改還會影響 :func:`cgi.parse` 和 :" -"func:`cgi.parse_multipart`,因為它們在內部使用受影響的函式。有關更多詳細資" -"訊,請參閱各自的文件。(由 Adam Goldschmidt、Senthil Kumaran 和 Ken Jin 在 :" -"issue:`42967` 中貢獻。)" +"為僅允許單個分隔符號鍵,預設為 ``&``。此更改還會影響 :func:`!cgi.parse` " +"和 :func:`!cgi.parse_multipart`,因為它們在內部使用受影響的函式。有關更多詳細" +"資訊,請參閱各自的文件。(由 Adam Goldschmidt、Senthil Kumaran 和 Ken Jin " +"在 :issue:`42967` 中貢獻。)" #: ../../whatsnew/3.10.rst:1520 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " -"forms of attacks. Following the WHATWG specification that updates :rfc:" -"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " -"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " -"attacks. The removal characters are controlled by a new module level " -"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" +"forms of attacks. Following the WHATWG specification that " +"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " +"characters are stripped from the URL by the parser in :mod:`urllib.parse` " +"preventing such attacks. The removal characters are controlled by a new " +"module level variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. " +"(See :gh:`88048`)" msgstr "" #: ../../whatsnew/3.10.rst:1528 @@ -2915,9 +2933,9 @@ msgstr "xml" #: ../../whatsnew/3.10.rst:1530 msgid "" -"Add a :class:`~xml.sax.handler.LexicalHandler` class to the :mod:`xml.sax." -"handler` module. (Contributed by Jonathan Gossage and Zackery Spytz in :" -"issue:`35018`.)" +"Add a :class:`~xml.sax.handler.LexicalHandler` class to " +"the :mod:`xml.sax.handler` module. (Contributed by Jonathan Gossage and " +"Zackery Spytz in :issue:`35018`.)" msgstr "" "新增 :class:`~xml.sax.handler.LexicalHandler` 類別到 :mod:`xml.sax.handler` " "模組。(由 Jonathan Gossage 和 Zackery Spytz 在 :issue:`35018` 中貢獻。)" @@ -2928,14 +2946,15 @@ msgstr "zipimport" #: ../../whatsnew/3.10.rst:1536 msgid "" -"Add methods related to :pep:`451`: :meth:`~zipimport.zipimporter." -"find_spec`, :meth:`zipimport.zipimporter.create_module`, and :meth:" -"`zipimport.zipimporter.exec_module`. (Contributed by Brett Cannon in :issue:" -"`42131`.)" +"Add methods related " +"to :pep:`451`: :meth:`~zipimport.zipimporter.find_spec`, :meth:`zipimport.zipimporter.create_module`, " +"and :meth:`zipimport.zipimporter.exec_module`. (Contributed by Brett Cannon " +"in :issue:`42131`.)" msgstr "" -"新增與 :pep:`451` 相關的方法::meth:`~zipimport.zipimporter.find_spec`、:" -"meth:`zipimport.zipimporter.create_module` 和 :meth:`zipimport.zipimporter." -"exec_module`。(由 Brett Cannon 在 :issue:`42131` 中貢獻。)" +"新增與 :pep:`451` 相關的方" +"法::meth:`~zipimport.zipimporter.find_spec`、:meth:`zipimport.zipimporter.create_module` " +"和 :meth:`zipimport.zipimporter.exec_module`。(由 Brett Cannon " +"在 :issue:`42131` 中貢獻。)" #: ../../whatsnew/3.10.rst:1541 msgid "" @@ -2952,8 +2971,8 @@ msgstr "最佳化" #: ../../whatsnew/3.10.rst:1548 msgid "" "Constructors :func:`str`, :func:`bytes` and :func:`bytearray` are now faster " -"(around 30--40% for small objects). (Contributed by Serhiy Storchaka in :" -"issue:`41334`.)" +"(around 30--40% for small objects). (Contributed by Serhiy Storchaka " +"in :issue:`41334`.)" msgstr "" "建構函式 :func:`str`、:func:`bytes` 和 :func:`bytearray` 現在更快了(對於小型" "物件大約快了 30--40%)。(由 Serhiy Storchaka 在 :issue:`41334` 中貢獻。)" @@ -2961,10 +2980,10 @@ msgstr "" #: ../../whatsnew/3.10.rst:1552 msgid "" "The :mod:`runpy` module now imports fewer modules. The ``python3 -m module-" -"name`` command startup time is 1.4x faster in average. On Linux, ``python3 -" -"I -m module-name`` imports 69 modules on Python 3.9, whereas it only imports " -"51 modules (-18) on Python 3.10. (Contributed by Victor Stinner in :issue:" -"`41006` and :issue:`41718`.)" +"name`` command startup time is 1.4x faster in average. On Linux, ``python3 " +"-I -m module-name`` imports 69 modules on Python 3.9, whereas it only " +"imports 51 modules (-18) on Python 3.10. (Contributed by Victor Stinner " +"in :issue:`41006` and :issue:`41718`.)" msgstr "" ":mod:`runpy` 模組現在引入更少的模組。``python3 -m module-name`` 指令啟動時間" "平均快了 1.4 倍。在 Linux 上,``python3 -I -m module-name`` 在 Python 3.9 上" @@ -2989,10 +3008,10 @@ msgid "" "When building Python with :option:`--enable-optimizations` now ``-fno-" "semantic-interposition`` is added to both the compile and link line. This " "speeds builds of the Python interpreter created with :option:`--enable-" -"shared` with ``gcc`` by up to 30%. See `this article <https://developers." -"redhat.com/blog/2020/06/25/red-hat-enterprise-linux-8-2-brings-faster-" -"python-3-8-run-speeds/>`_ for more details. (Contributed by Victor Stinner " -"and Pablo Galindo in :issue:`38980`.)" +"shared` with ``gcc`` by up to 30%. See `this article <https://" +"developers.redhat.com/blog/2020/06/25/red-hat-enterprise-linux-8-2-brings-" +"faster-python-3-8-run-speeds/>`_ for more details. (Contributed by Victor " +"Stinner and Pablo Galindo in :issue:`38980`.)" msgstr "" "當使用 :option:`--enable-optimizations` 建置 Python 時,現在 ``-fno-semantic-" "interposition`` 被新增到編譯和鏈接列 (link line) 中。這使得使用 :option:`--" @@ -3003,18 +3022,18 @@ msgstr "" #: ../../whatsnew/3.10.rst:1572 msgid "" -"Use a new output buffer management code for :mod:`bz2` / :mod:`lzma` / :mod:" -"`zlib` modules, and add ``.readall()`` function to ``_compression." -"DecompressReader`` class. bz2 decompression is now 1.09x ~ 1.17x faster, " -"lzma decompression 1.20x ~ 1.32x faster, ``GzipFile.read(-1)`` 1.11x ~ 1.18x " -"faster. (Contributed by Ma Lin, reviewed by Gregory P. Smith, in :issue:" -"`41486`)" +"Use a new output buffer management code " +"for :mod:`bz2` / :mod:`lzma` / :mod:`zlib` modules, and add ``.readall()`` " +"function to ``_compression.DecompressReader`` class. bz2 decompression is " +"now 1.09x ~ 1.17x faster, lzma decompression 1.20x ~ 1.32x faster, " +"``GzipFile.read(-1)`` 1.11x ~ 1.18x faster. (Contributed by Ma Lin, reviewed " +"by Gregory P. Smith, in :issue:`41486`)" msgstr "" "對 :mod:`bz2` / :mod:`lzma` / :mod:`zlib` 模組使用新的輸出緩衝區管理程式碼," "並將 ``.readall()`` 函式新增到 ``_compression.DecompressReader`` 類別。 bz2 " "解壓縮速度提高了 1.09x ~ 1.17x,lzma 解壓縮速度提高了 1.20x ~ 1.32x," -"``GzipFile.read(-1)`` 速度提高了 1.11x ~ 1.18x。(由 Ma Lin 於 :issue:" -"`41486` 貢獻、由 Gregory P. Smith 審閱)" +"``GzipFile.read(-1)`` 速度提高了 1.11x ~ 1.18x。(由 Ma Lin " +"於 :issue:`41486` 貢獻、由 Gregory P. Smith 審閱)" #: ../../whatsnew/3.10.rst:1578 msgid "" @@ -3045,25 +3064,27 @@ msgstr "" msgid "" "Add micro-optimizations to ``_PyType_Lookup()`` to improve type attribute " "cache lookup performance in the common case of cache hits. This makes the " -"interpreter 1.04 times faster on average. (Contributed by Dino Viehland in :" -"issue:`43452`.)" +"interpreter 1.04 times faster on average. (Contributed by Dino Viehland " +"in :issue:`43452`.)" msgstr "" "向 ``_PyType_Lookup()`` 新增微最佳化以提高快取命中的常見情況下的型別屬性快取" -"查找性能。這使得直譯器平均速度提高了 1.04 倍。(由 Dino Viehland 在 :issue:" -"`43452` 中貢獻。)" +"查找性能。這使得直譯器平均速度提高了 1.04 倍。(由 Dino Viehland " +"在 :issue:`43452` 中貢獻。)" #: ../../whatsnew/3.10.rst:1594 msgid "" "The following built-in functions now support the faster :pep:`590` " -"vectorcall calling convention: :func:`map`, :func:`filter`, :func:" -"`reversed`, :func:`bool` and :func:`float`. (Contributed by Donghee Na and " -"Jeroen Demeyer in :issue:`43575`, :issue:`43287`, :issue:`41922`, :issue:" -"`41873` and :issue:`41870`.)" -msgstr "" -"以下內建函式現在支援更快的 :pep:`590` vectorcall 呼叫慣例::func:`map`、:" -"func:`filter`、:func:`reversed`、:func:`bool` 和 :func:`float`。(由 Donghee " -"Na 和 Jeroen Demeyer 在 :issue:`43575`、:issue:`43287`、:issue:`41922`、:" -"issue:`41873` 和 :issue:`41870` 中貢獻。)" +"vectorcall calling " +"convention: :func:`map`, :func:`filter`, :func:`reversed`, :func:`bool` " +"and :func:`float`. (Contributed by Donghee Na and Jeroen Demeyer " +"in :issue:`43575`, :issue:`43287`, :issue:`41922`, :issue:`41873` " +"and :issue:`41870`.)" +msgstr "" +"以下內建函式現在支援更快的 :pep:`590` vectorcall 呼叫慣" +"例::func:`map`、:func:`filter`、:func:`reversed`、:func:`bool` " +"和 :func:`float`。(由 Donghee Na 和 Jeroen Demeyer " +"在 :issue:`43575`、:issue:`43287`、:issue:`41922`、:issue:`41873` " +"和 :issue:`41870` 中貢獻。)" #: ../../whatsnew/3.10.rst:1598 msgid "" @@ -3073,10 +3094,10 @@ msgid "" "in :mod:`gzip` and :mod:`lzma` have always been. (Contributed by Inada " "Naoki in :issue:`43785`.)" msgstr "" -"通過刪除內部 ``RLock``,:class:`~bz2.BZ2File` 的性能得到了改進。這使得 :" -"class:`!BZ2File` 在面對多個同時的讀取器或寫入器時執行緒不安全,就像 :mod:" -"`gzip` 和 :mod:`lzma` 中的等效類別一樣。(由 Inada Naoki 在 :issue:`43785` 中" -"貢獻。)" +"通過刪除內部 ``RLock``,:class:`~bz2.BZ2File` 的性能得到了改進。這使" +"得 :class:`!BZ2File` 在面對多個同時的讀取器或寫入器時執行緒不安全,就" +"像 :mod:`gzip` 和 :mod:`lzma` 中的等效類別一樣。(由 Inada Naoki " +"在 :issue:`43785` 中貢獻。)" #: ../../whatsnew/3.10.rst:1606 ../../whatsnew/3.10.rst:2212 msgid "Deprecated" @@ -3089,44 +3110,46 @@ msgid "" "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). Starting in this release, a " "deprecation warning is raised if the numeric literal is immediately followed " -"by one of keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:" -"`if`, :keyword:`in`, :keyword:`is` and :keyword:`or`. In future releases it " -"will be changed to syntax warning, and finally to syntax error. (Contributed " -"by Serhiy Storchaka in :issue:`43833`.)" +"by one of " +"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " +"and :keyword:`or`. In future releases it will be changed to syntax warning, " +"and finally to syntax error. (Contributed by Serhiy Storchaka " +"in :issue:`43833`.)" msgstr "" "目前 Python 接受緊跟關鍵字的數字字面值 (numeric literals),例如 ``0in x``、" "``1or x``、``0if 1else 2``。它允許了令人困惑和不明確的運算式,例如 ``[0x1for " "x in y]`` (可以直譯為 ``[0x1 for x in y]`` 或 ``[0x1f or x in y]`` )。從此" -"版本開始,如果數字字面值後緊跟關鍵字 :keyword:`and`、:keyword:`else`、:" -"keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` 與 :keyword:`or` " -"其中之一,則會引發棄用警告。在未來的版本中,它將被變更為語法警告,最後成為為" -"語法錯誤。(由 Serhiy Storchaka 在 :issue:`43833` 中貢獻。)" +"版本開始,如果數字字面值後緊跟關鍵" +"字 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " +"與 :keyword:`or` 其中之一,則會引發棄用警告。在未來的版本中,它將被變更為語法" +"警告,最後成為為語法錯誤。(由 Serhiy Storchaka 在 :issue:`43833` 中貢獻。)" #: ../../whatsnew/3.10.rst:1619 msgid "" "Starting in this release, there will be a concerted effort to begin cleaning " "up old import semantics that were kept for Python 2.7 compatibility. " -"Specifically, :meth:`!find_loader`/:meth:`!find_module` (superseded by :meth:" -"`~importlib.abc.MetaPathFinder.find_spec`), :meth:`~importlib.abc.Loader." -"load_module` (superseded by :meth:`~importlib.abc.Loader.exec_module`), :" -"meth:`!module_repr` (which the import system takes care of for you), the " +"Specifically, :meth:`!find_loader`/:meth:`!find_module` (superseded " +"by :meth:`~importlib.abc.MetaPathFinder.find_spec`), :meth:`~importlib.abc.Loader.load_module` " +"(superseded by :meth:`~importlib.abc.Loader.exec_module`), :meth:`!" +"module_repr` (which the import system takes care of for you), the " "``__package__`` attribute (superseded by ``__spec__.parent``), the " "``__loader__`` attribute (superseded by ``__spec__.loader``), and the " "``__cached__`` attribute (superseded by ``__spec__.cached``) will slowly be " -"removed (as well as other classes and methods in :mod:`importlib`). :exc:" -"`ImportWarning` and/or :exc:`DeprecationWarning` will be raised as " -"appropriate to help identify code which needs updating during this " -"transition." +"removed (as well as other classes and methods " +"in :mod:`importlib`). :exc:`ImportWarning` and/or :exc:`DeprecationWarning` " +"will be raised as appropriate to help identify code which needs updating " +"during this transition." msgstr "" "從這個版本開始,我們將齊心協力開始清理為相容 Python 2.7 而保留的舊引入語義。" -"具體來說, :meth:`!find_loader`/:meth:`!find_module` (被 :meth:`~importlib." -"abc.MetaPathFinder.find_spec` 取代)、:meth:`~importlib.abc.Loader." -"load_module` (被 :meth:`~importlib.abc.Loader.exec_module` 取代)、 :meth:`!" -"module_repr` (引入系統負責處理你)、``__package__`` 屬性(由 ``__spec__." -"parent`` 取代)、 ``__loader__`` 屬性(由 ``__spec__.loader`` 取代)和 " -"``__cached__`` 屬性(由 ``__spec__.cached`` 取代)將慢慢被刪除(以及 :mod:" -"`importlib` 中的其他類別和方法)。將酌情引發 :exc:`ImportWarning` 和/或 :exc:" -"`DeprecationWarning` 以幫助識別在此轉換期間需要更新的程式碼。" +"具體來說, :meth:`!find_loader`/:meth:`!find_module` " +"(被 :meth:`~importlib.abc.MetaPathFinder.find_spec` 取" +"代)、:meth:`~importlib.abc.Loader.load_module` " +"(被 :meth:`~importlib.abc.Loader.exec_module` 取代)、 :meth:`!module_repr` " +"(引入系統負責處理你)、``__package__`` 屬性(由 ``__spec__.parent`` 取" +"代)、 ``__loader__`` 屬性(由 ``__spec__.loader`` 取代)和 ``__cached__`` 屬" +"性(由 ``__spec__.cached`` 取代)將慢慢被刪除(以及 :mod:`importlib` 中的其他" +"類別和方法)。將酌情引發 :exc:`ImportWarning` 和/" +"或 :exc:`DeprecationWarning` 以幫助識別在此轉換期間需要更新的程式碼。" #: ../../whatsnew/3.10.rst:1636 msgid "" @@ -3139,24 +3162,25 @@ msgstr "" #: ../../whatsnew/3.10.rst:1640 msgid "" -"Non-integer arguments to :func:`random.randrange` are deprecated. The :exc:" -"`ValueError` is deprecated in favor of a :exc:`TypeError`. (Contributed by " -"Serhiy Storchaka and Raymond Hettinger in :issue:`37319`.)" +"Non-integer arguments to :func:`random.randrange` are deprecated. " +"The :exc:`ValueError` is deprecated in favor of a :exc:`TypeError`. " +"(Contributed by Serhiy Storchaka and Raymond Hettinger in :issue:`37319`.)" msgstr "" ":func:`random.randrange` 的非整數引數已棄用。:exc:`ValueError` 已被棄用,取而" -"代之的是 :exc:`TypeError`。(由 Serhiy Storchaka 和 Raymond Hettinger 在 :" -"issue:`37319` 中貢獻。)" +"代之的是 :exc:`TypeError`。(由 Serhiy Storchaka 和 Raymond Hettinger " +"在 :issue:`37319` 中貢獻。)" #: ../../whatsnew/3.10.rst:1644 msgid "" "The various ``load_module()`` methods of :mod:`importlib` have been " -"documented as deprecated since Python 3.6, but will now also trigger a :exc:" -"`DeprecationWarning`. Use :meth:`~importlib.abc.Loader.exec_module` instead. " -"(Contributed by Brett Cannon in :issue:`26131`.)" +"documented as deprecated since Python 3.6, but will now also trigger " +"a :exc:`DeprecationWarning`. Use :meth:`~importlib.abc.Loader.exec_module` " +"instead. (Contributed by Brett Cannon in :issue:`26131`.)" msgstr "" ":mod:`importlib` 的各種 ``load_module()`` 方法自 Python 3.6 起已被記錄為已棄" -"用,但現在也會觸發 :exc:`DeprecationWarning`。請改用 :meth:`~importlib.abc." -"Loader.exec_module`。(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" +"用,但現在也會觸發 :exc:`DeprecationWarning`。請改" +"用 :meth:`~importlib.abc.Loader.exec_module`。(由 Brett Cannon " +"在 :issue:`26131` 中貢獻。)" #: ../../whatsnew/3.10.rst:1650 msgid "" @@ -3164,18 +3188,20 @@ msgid "" "for :meth:`~zipimport.zipimporter.exec_module`. (Contributed by Brett Cannon " "in :issue:`26131`.)" msgstr "" -":meth:`!zimport.zipimporter.load_module` 已被棄用,請用 :meth:`~zipimport." -"zipimporter.exec_module`。(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" +":meth:`!zimport.zipimporter.load_module` 已被棄用,請" +"用 :meth:`~zipimport.zipimporter.exec_module`。(由 Brett Cannon " +"在 :issue:`26131` 中貢獻。)" #: ../../whatsnew/3.10.rst:1654 msgid "" "The use of :meth:`~importlib.abc.Loader.load_module` by the import system " -"now triggers an :exc:`ImportWarning` as :meth:`~importlib.abc.Loader." -"exec_module` is preferred. (Contributed by Brett Cannon in :issue:`26131`.)" +"now triggers an :exc:`ImportWarning` " +"as :meth:`~importlib.abc.Loader.exec_module` is preferred. (Contributed by " +"Brett Cannon in :issue:`26131`.)" msgstr "" -"引入系統使用 :meth:`~importlib.abc.Loader.load_module` 現在會觸發 :exc:" -"`ImportWarning`,因為 :meth:`~importlib.abc.Loader.exec_module` 是當前首選。" -"(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" +"引入系統使用 :meth:`~importlib.abc.Loader.load_module` 現在會觸" +"發 :exc:`ImportWarning`,因為 :meth:`~importlib.abc.Loader.exec_module` 是當" +"前首選。(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" #: ../../whatsnew/3.10.rst:1659 msgid "" @@ -3188,78 +3214,86 @@ msgid "" msgstr "" "引入系統使用 :meth:`!importlib.abc.MetaPathFinder.find_module` 和 :meth:`!" "importlib.abc.PathEntryFinder.find_module` 現在會觸發 :exc:`ImportWarning`," -"因為 :meth:`importlib.abc.MetaPathFinder.find_spec` 和 :meth:`importlib.abc." -"PathEntryFinder.find_spec` 分別是替代方案的首選。你可以使用 :func:`importlib." -"util.spec_from_loader` 來幫助移植。(由 Brett Cannon 在 :issue:`42134` 中貢" -"獻。)" +"因為 :meth:`importlib.abc.MetaPathFinder.find_spec` " +"和 :meth:`importlib.abc.PathEntryFinder.find_spec` 分別是替代方案的首選。你可" +"以使用 :func:`importlib.util.spec_from_loader` 來幫助移植。(由 Brett Cannon " +"在 :issue:`42134` 中貢獻。)" #: ../../whatsnew/3.10.rst:1668 msgid "" "The use of :meth:`!importlib.abc.PathEntryFinder.find_loader` by the import " -"system now triggers an :exc:`ImportWarning` as :meth:`importlib.abc." -"PathEntryFinder.find_spec` is preferred. You can use :func:`importlib.util." -"spec_from_loader` to help in porting. (Contributed by Brett Cannon in :issue:" -"`43672`.)" +"system now triggers an :exc:`ImportWarning` " +"as :meth:`importlib.abc.PathEntryFinder.find_spec` is preferred. You can " +"use :func:`importlib.util.spec_from_loader` to help in porting. (Contributed " +"by Brett Cannon in :issue:`43672`.)" msgstr "" -"引入系統使用 :meth:`!importlib.abc.PathEntryFinder.find_loader` 現在會觸發 :" -"exc:`ImportWarning`,因為 :meth:`importlib.abc.PathEntryFinder.find_spec` 是" -"首選。你可以使用 :func:`importlib.util.spec_from_loader` 來幫助移植。(由 " -"Brett Cannon 在 :issue:`43672` 中貢獻。)" +"引入系統使用 :meth:`!importlib.abc.PathEntryFinder.find_loader` 現在會觸" +"發 :exc:`ImportWarning`,因" +"為 :meth:`importlib.abc.PathEntryFinder.find_spec` 是首選。你可以使" +"用 :func:`importlib.util.spec_from_loader` 來幫助移植。(由 Brett Cannon " +"在 :issue:`43672` 中貢獻。)" #: ../../whatsnew/3.10.rst:1674 msgid "" -"The various implementations of :meth:`!importlib.abc.MetaPathFinder." -"find_module` ( :meth:`!importlib.machinery.BuiltinImporter.find_module`, :" -"meth:`!importlib.machinery.FrozenImporter.find_module`, :meth:`!importlib." -"machinery.WindowsRegistryFinder.find_module`, :meth:`!importlib.machinery." -"PathFinder.find_module`, :meth:`!importlib.abc.MetaPathFinder." -"find_module` ), :meth:`!importlib.abc.PathEntryFinder.find_module` ( :meth:`!" -"importlib.machinery.FileFinder.find_module` ), and :meth:`!importlib.abc." -"PathEntryFinder.find_loader` ( :meth:`!importlib.machinery.FileFinder." -"find_loader` ) now raise :exc:`DeprecationWarning` and are slated for " -"removal in Python 3.12 (previously they were documented as deprecated in " -"Python 3.4). (Contributed by Brett Cannon in :issue:`42135`.)" +"The various implementations of :meth:`!" +"importlib.abc.MetaPathFinder.find_module` ( :meth:`!" +"importlib.machinery.BuiltinImporter.find_module`, :meth:`!" +"importlib.machinery.FrozenImporter.find_module`, :meth:`!" +"importlib.machinery.WindowsRegistryFinder.find_module`, :meth:`!" +"importlib.machinery.PathFinder.find_module`, :meth:`!" +"importlib.abc.MetaPathFinder.find_module` ), :meth:`!" +"importlib.abc.PathEntryFinder.find_module` ( :meth:`!" +"importlib.machinery.FileFinder.find_module` ), and :meth:`!" +"importlib.abc.PathEntryFinder.find_loader` ( :meth:`!" +"importlib.machinery.FileFinder.find_loader` ) now " +"raise :exc:`DeprecationWarning` and are slated for removal in Python 3.12 " +"(previously they were documented as deprecated in Python 3.4). (Contributed " +"by Brett Cannon in :issue:`42135`.)" msgstr "" ":meth:`!importlib.abc.MetaPathFinder.find_module` 的各種實作(:meth:`!" -"importlib.machinery.BuiltinImporter.find_module`、:meth:`!importlib." -"machinery.FrozenImporter.find_module`、:meth:`!importlib.machinery." -"WindowsRegistryFinder.find_module`、:meth:`!importlib.machinery.PathFinder." -"find_module`、:meth:`!importlib.abc.MetaPathFinder.find_module` )、:meth:`!" -"importlib.abc.PathEntryFinder.find_module` (:meth:`!importlib.machinery." -"FileFinder.find_module` ) 和 :meth:`!importlib.abc.PathEntryFinder." -"find_loader` (:meth:`!importlib.machinery.FileFinder.find_loader` ) 現在引" +"importlib.machinery.BuiltinImporter.find_module`、:meth:`!" +"importlib.machinery.FrozenImporter.find_module`、:meth:`!" +"importlib.machinery.WindowsRegistryFinder.find_module`、:meth:`!" +"importlib.machinery.PathFinder.find_module`、:meth:`!" +"importlib.abc.MetaPathFinder.find_module` )、:meth:`!" +"importlib.abc.PathEntryFinder.find_module` (:meth:`!" +"importlib.machinery.FileFinder.find_module` ) 和 :meth:`!" +"importlib.abc.PathEntryFinder.find_loader` (:meth:`!" +"importlib.machinery.FileFinder.find_loader` ) 現在引" "發 :exc:`DeprecationWarning` 並計劃在 Python 3.12 中刪除(之前它們已在 " "Python 3.4 中被記錄為已棄用)。(由 Brett Cannon 在 :issue:`42135` 中貢獻。)" #: ../../whatsnew/3.10.rst:1689 msgid "" -":class:`!importlib.abc.Finder` is deprecated (including its sole method, :" -"meth:`!find_module`). Both :class:`importlib.abc.MetaPathFinder` and :class:" -"`importlib.abc.PathEntryFinder` no longer inherit from the class. Users " -"should inherit from one of these two classes as appropriate instead. " +":class:`!importlib.abc.Finder` is deprecated (including its sole " +"method, :meth:`!find_module`). Both :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.PathEntryFinder` no longer inherit from the class. " +"Users should inherit from one of these two classes as appropriate instead. " "(Contributed by Brett Cannon in :issue:`42135`.)" msgstr "" ":class:`!importlib.abc.Finder` 已被棄用(包括其唯一方法 :meth:`!" -"find_module`)。:class:`importlib.abc.MetaPathFinder` 和 :class:`importlib." -"abc.PathEntryFinder` 都不再從該類別繼承。使用者應該根據需求來選擇其一以繼承。" -"(由 Brett Cannon 在 :issue:`42135` 中貢獻。)" +"find_module`)。:class:`importlib.abc.MetaPathFinder` " +"和 :class:`importlib.abc.PathEntryFinder` 都不再從該類別繼承。使用者應該根據" +"需求來選擇其一以繼承。(由 Brett Cannon 在 :issue:`42135` 中貢獻。)" #: ../../whatsnew/3.10.rst:1696 msgid "" "The deprecations of :mod:`!imp`, :func:`!importlib.find_loader`, :func:`!" -"importlib.util.set_package_wrapper`, :func:`!importlib.util." -"set_loader_wrapper`, :func:`!importlib.util.module_for_loader`, :class:`!" -"pkgutil.ImpImporter`, and :class:`!pkgutil.ImpLoader` have all been updated " -"to list Python 3.12 as the slated version of removal (they began raising :" -"exc:`DeprecationWarning` in previous versions of Python). (Contributed by " -"Brett Cannon in :issue:`43720`.)" -msgstr "" -"棄用 :mod:`!imp`、:func:`!importlib.find_loader`、:func:`!importlib.util." -"set_package_wrapper`、:func:`!importlib.util.set_loader_wrapper`、:func:`!" +"importlib.util.set_package_wrapper`, :func:`!" +"importlib.util.set_loader_wrapper`, :func:`!" +"importlib.util.module_for_loader`, :class:`!pkgutil.ImpImporter`, " +"and :class:`!pkgutil.ImpLoader` have all been updated to list Python 3.12 as " +"the slated version of removal (they began raising :exc:`DeprecationWarning` " +"in previous versions of Python). (Contributed by Brett Cannon " +"in :issue:`43720`.)" +msgstr "" +"棄用 :mod:`!imp`、:func:`!importlib.find_loader`、:func:`!" +"importlib.util.set_package_wrapper`、:func:`!" +"importlib.util.set_loader_wrapper`、:func:`!" "importlib.util.module_for_loader`、:class:`!pkgutil.ImpImporter` 和 :class:`!" "pkgutil.ImpLoader` 均已更新,將於 Python 3.12 列為預定的刪除版本(它們開始在" -"過去版本的 Python 中引發 :exc:`DeprecationWarning`) 。(由 Brett Cannon 在 :" -"issue:`43720` 中貢獻。)" +"過去版本的 Python 中引發 :exc:`DeprecationWarning`) 。(由 Brett Cannon " +"在 :issue:`43720` 中貢獻。)" #: ../../whatsnew/3.10.rst:1706 msgid "" @@ -3274,22 +3308,22 @@ msgstr "" #: ../../whatsnew/3.10.rst:1712 msgid "" -":meth:`!importlib.abc.Loader.module_repr`, :meth:`!importlib.machinery." -"FrozenLoader.module_repr`, and :meth:`!importlib.machinery.BuiltinLoader." -"module_repr` are deprecated and slated for removal in Python 3.12. " -"(Contributed by Brett Cannon in :issue:`42136`.)" +":meth:`!importlib.abc.Loader.module_repr`, :meth:`!" +"importlib.machinery.FrozenLoader.module_repr`, and :meth:`!" +"importlib.machinery.BuiltinLoader.module_repr` are deprecated and slated for " +"removal in Python 3.12. (Contributed by Brett Cannon in :issue:`42136`.)" msgstr "" -":meth:`!importlib.abc.Loader.module_repr`、:meth:`!importlib.machinery." -"FrozenLoader.module_repr` 和 :meth:`!importlib.machinery.BuiltinLoader." -"module_repr` 已棄用並計劃在 Python 3.12 中刪除。(由 Brett Cannon 在 :issue:" -"`42136` 中貢獻。)" +":meth:`!importlib.abc.Loader.module_repr`、:meth:`!" +"importlib.machinery.FrozenLoader.module_repr` 和 :meth:`!" +"importlib.machinery.BuiltinLoader.module_repr` 已棄用並計劃在 Python 3.12 中" +"刪除。(由 Brett Cannon 在 :issue:`42136` 中貢獻。)" #: ../../whatsnew/3.10.rst:1718 msgid "" "``sqlite3.OptimizedUnicode`` has been undocumented and obsolete since Python " "3.3, when it was made an alias to :class:`str`. It is now deprecated, " -"scheduled for removal in Python 3.12. (Contributed by Erlend E. Aasland in :" -"issue:`42264`.)" +"scheduled for removal in Python 3.12. (Contributed by Erlend E. Aasland " +"in :issue:`42264`.)" msgstr "" "自 Python 3.3 起,``sqlite3.OptimizedUnicode`` 就沒有文件記錄並且已過時,當時" "它被用作 :class:`str` 的別名。它現已被棄用,並計劃在 Python 3.12 中刪除。" @@ -3358,8 +3392,8 @@ msgid "" "3.12. Use :meth:`pathlib.Path.hardlink_to` instead. (Contributed by Barney " "Gale in :issue:`39950`.)" msgstr "" -":meth:`!pathlib.Path.link_to` 已棄用並計劃在 Python 3.12 中刪除。請改用 :" -"meth:`pathlib.Path.hardlink_to`。(由 Barney Gale 在 :issue:`39950` 中貢" +":meth:`!pathlib.Path.link_to` 已棄用並計劃在 Python 3.12 中刪除。請改" +"用 :meth:`pathlib.Path.hardlink_to`。(由 Barney Gale 在 :issue:`39950` 中貢" "獻。)" #: ../../whatsnew/3.10.rst:1756 @@ -3367,8 +3401,8 @@ msgid "" "``cgi.log()`` is deprecated and slated for removal in Python 3.12. " "(Contributed by Inada Naoki in :issue:`41139`.)" msgstr "" -"``cgi.log()`` 已棄用並計劃在 Python 3.12 中刪除。(由 Inada Naoki 在 :issue:" -"`41139` 中貢獻。)" +"``cgi.log()`` 已棄用並計劃在 Python 3.12 中刪除。(由 Inada Naoki " +"在 :issue:`41139` 中貢獻。)" #: ../../whatsnew/3.10.rst:1759 msgid "" @@ -3382,25 +3416,27 @@ msgstr "" msgid "" ":data:`!OP_NO_SSLv2`, :data:`!OP_NO_SSLv3`, :data:`!OP_NO_TLSv1`, :data:`!" "OP_NO_TLSv1_1`, :data:`!OP_NO_TLSv1_2`, and :data:`!OP_NO_TLSv1_3` are " -"replaced by :attr:`~ssl.SSLContext.minimum_version` and :attr:`~ssl." -"SSLContext.maximum_version`." +"replaced by :attr:`~ssl.SSLContext.minimum_version` " +"and :attr:`~ssl.SSLContext.maximum_version`." msgstr "" ":data:`!OP_NO_SSLv2`、:data:`!OP_NO_SSLv3`、:data:`!OP_NO_TLSv1`、:data:`!" "OP_NO_TLSv1_1`、:data:`!OP_NO_TLSv1_2`、和 :data:`!OP_NO_TLSv1_3` 已被替換" -"為 :attr:`~ssl.sslSSLContext.minimum_version` 和 :attr:`~ssl.sslSSLContext." -"maximum_version`。" +"為 :attr:`~ssl.sslSSLContext.minimum_version` " +"和 :attr:`~ssl.sslSSLContext.maximum_version`。" #: ../../whatsnew/3.10.rst:1768 msgid "" -":data:`!PROTOCOL_SSLv2`, :data:`!PROTOCOL_SSLv3`, :data:`!PROTOCOL_SSLv23`, :" -"data:`!PROTOCOL_TLSv1`, :data:`!PROTOCOL_TLSv1_1`, :data:`!" -"PROTOCOL_TLSv1_2`, and :const:`!PROTOCOL_TLS` are deprecated in favor of :" -"const:`~ssl.PROTOCOL_TLS_CLIENT` and :const:`~ssl.PROTOCOL_TLS_SERVER`" +":data:`!PROTOCOL_SSLv2`, :data:`!PROTOCOL_SSLv3`, :data:`!" +"PROTOCOL_SSLv23`, :data:`!PROTOCOL_TLSv1`, :data:`!" +"PROTOCOL_TLSv1_1`, :data:`!PROTOCOL_TLSv1_2`, and :const:`!PROTOCOL_TLS` are " +"deprecated in favor of :const:`~ssl.PROTOCOL_TLS_CLIENT` " +"and :const:`~ssl.PROTOCOL_TLS_SERVER`" msgstr "" -":data:`!PROTOCOL_SSLv2`、:data:`!PROTOCOL_SSLv3`、:data:`!PROTOCOL_SSLv23`、:" -"data:`!PROTOCOL_TLSv1`、:data:`!PROTOCOL_TLSv1_1`、:data:`!PROTOCOL_TLSv1_2` " -"和 :const:`!PROTOCOL_TLS` 已棄用,取而代之的是 :const:`~ssl." -"PROTOCOL_TLS_CLIENT` 和 :const:`~ssl.PROTOCOL_TLS_SERVER`" +":data:`!PROTOCOL_SSLv2`、:data:`!PROTOCOL_SSLv3`、:data:`!" +"PROTOCOL_SSLv23`、:data:`!PROTOCOL_TLSv1`、:data:`!" +"PROTOCOL_TLSv1_1`、:data:`!PROTOCOL_TLSv1_2` 和 :const:`!PROTOCOL_TLS` 已棄" +"用,取而代之的是 :const:`~ssl.PROTOCOL_TLS_CLIENT` " +"和 :const:`~ssl.PROTOCOL_TLS_SERVER`" #: ../../whatsnew/3.10.rst:1774 msgid ":func:`!wrap_socket` is replaced by :meth:`ssl.SSLContext.wrap_socket`" @@ -3416,11 +3452,11 @@ msgstr ":func:`!RAND_pseudo_bytes`, :func:`!RAND_egd`" #: ../../whatsnew/3.10.rst:1780 msgid "" -"NPN features like :meth:`ssl.SSLSocket.selected_npn_protocol` and :meth:`ssl." -"SSLContext.set_npn_protocols` are replaced by ALPN." +"NPN features like :meth:`ssl.SSLSocket.selected_npn_protocol` " +"and :meth:`ssl.SSLContext.set_npn_protocols` are replaced by ALPN." msgstr "" -"NPN 功能如 :meth:`ssl.SSLSocket.selected_npn_protocol` 和 :meth:`ssl." -"SSLContext.set_npn_protocols` 已被 ALPN 取代。" +"NPN 功能如 :meth:`ssl.SSLSocket.selected_npn_protocol` " +"和 :meth:`ssl.SSLContext.set_npn_protocols` 已被 ALPN 取代。" #: ../../whatsnew/3.10.rst:1783 msgid "" @@ -3435,16 +3471,16 @@ msgstr "" #: ../../whatsnew/3.10.rst:1788 msgid "" -"Importing from the ``typing.io`` and ``typing.re`` submodules will now emit :" -"exc:`DeprecationWarning`. These submodules will be removed in a future " -"version of Python. Anything belonging to these submodules should be " +"Importing from the ``typing.io`` and ``typing.re`` submodules will now " +"emit :exc:`DeprecationWarning`. These submodules will be removed in a " +"future version of Python. Anything belonging to these submodules should be " "imported directly from :mod:`typing` instead. (Contributed by Sebastian " "Rittau in :issue:`38291`.)" msgstr "" -"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發出 :exc:" -"`DeprecationWarning`。這些子模組將在 Python 的未來版本中刪除。屬於這些子模組" -"的任何內容都應該直接從 :mod:`typing` 引入。(由 Sebastian Rittau 在 :issue:" -"`38291` 中貢獻。)" +"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發" +"出 :exc:`DeprecationWarning`。這些子模組將在 Python 的未來版本中刪除。屬於這" +"些子模組的任何內容都應該直接從 :mod:`typing` 引入。(由 Sebastian Rittau " +"在 :issue:`38291` 中貢獻。)" #: ../../whatsnew/3.10.rst:1797 ../../whatsnew/3.10.rst:2220 msgid "Removed" @@ -3454,8 +3490,8 @@ msgstr "已刪除" msgid "" "Removed special methods ``__int__``, ``__float__``, ``__floordiv__``, " "``__mod__``, ``__divmod__``, ``__rfloordiv__``, ``__rmod__`` and " -"``__rdivmod__`` of the :class:`complex` class. They always raised a :exc:" -"`TypeError`. (Contributed by Serhiy Storchaka in :issue:`41974`.)" +"``__rdivmod__`` of the :class:`complex` class. They always raised " +"a :exc:`TypeError`. (Contributed by Serhiy Storchaka in :issue:`41974`.)" msgstr "" "刪除了 :class:`complex` 類別的特殊方法 ``__int__``、``__float__``、" "``__floordiv__``、``__mod__``、``__divmod__``、``__rfloordiv__``、" @@ -3467,8 +3503,8 @@ msgid "" "The ``ParserBase.error()`` method from the private and undocumented " "``_markupbase`` module has been removed. :class:`html.parser.HTMLParser` is " "the only subclass of ``ParserBase`` and its ``error()`` implementation was " -"already removed in Python 3.5. (Contributed by Berker Peksag in :issue:" -"`31844`.)" +"already removed in Python 3.5. (Contributed by Berker Peksag " +"in :issue:`31844`.)" msgstr "" "``_markupbase`` 模組中私有、未於文件記錄的 ``ParserBase.error()`` 方法已被刪" "除。:class:`html.parser.HTMLParser` 是 ``ParserBase`` 的唯一子類別,它的 " @@ -3479,12 +3515,12 @@ msgstr "" msgid "" "Removed the ``unicodedata.ucnhash_CAPI`` attribute which was an internal " "PyCapsule object. The related private ``_PyUnicode_Name_CAPI`` structure was " -"moved to the internal C API. (Contributed by Victor Stinner in :issue:" -"`42157`.)" +"moved to the internal C API. (Contributed by Victor Stinner " +"in :issue:`42157`.)" msgstr "" "刪除了 ``unicodedata.ucnhash_CAPI`` 屬性,該屬性是內部 PyCapsule 物件。相關的" -"私有 ``_PyUnicode_Name_CAPI`` 結構已移至內部 C API。(由 Victor Stinner 在 :" -"issue:`42157` 中貢獻。)" +"私有 ``_PyUnicode_Name_CAPI`` 結構已移至內部 C API。(由 Victor Stinner " +"在 :issue:`42157` 中貢獻。)" #: ../../whatsnew/3.10.rst:1816 msgid "" @@ -3528,24 +3564,24 @@ msgid "" "now due to the :mod:`!_warnings` module was converted to a builtin module in " "2.6. (Contributed by Hai Shi in :issue:`42599`.)" msgstr "" -"刪除了 :c:func:`!PyModule_GetWarningsModule` 函式,該函式現在無用,因為 :mod:" -"`!_warnings` 模組在 2.6 中已轉換為內建模組。(由 Hai Shi 在 :issue:`42599` 中" -"貢獻。)" +"刪除了 :c:func:`!PyModule_GetWarningsModule` 函式,該函式現在無用,因" +"為 :mod:`!_warnings` 模組在 2.6 中已轉換為內建模組。(由 Hai Shi " +"在 :issue:`42599` 中貢獻。)" #: ../../whatsnew/3.10.rst:1837 msgid "" "Remove deprecated aliases to :ref:`collections-abstract-base-classes` from " -"the :mod:`collections` module. (Contributed by Victor Stinner in :issue:" -"`37324`.)" +"the :mod:`collections` module. (Contributed by Victor Stinner " +"in :issue:`37324`.)" msgstr "" "從 :mod:`collections` 模組中刪除已棄用的、對 :ref:`collections-abstract-base-" "classes` 的別名。(由 Victor Stinner 在 :issue:`37324` 中貢獻。)" #: ../../whatsnew/3.10.rst:1841 msgid "" -"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ 's :" -"doc:`high-level API <../library/asyncio-api-index>` following deprecation in " -"Python 3.8. The motivation behind this change is multifold:" +"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ " +"'s :doc:`high-level API <../library/asyncio-api-index>` following " +"deprecation in Python 3.8. The motivation behind this change is multifold:" msgstr "" "在 Python 3.8 中棄用後,``loop`` 參數已從大多數 :mod:`asyncio` 的\\ :doc:`高" "階 API <../library/asyncio-api-index>` 中刪除。這一變化的背後動機是多方面的:" @@ -3574,16 +3610,16 @@ msgid "" "Note that the low-level API will still accept ``loop``. See :ref:`changes-" "python-api` for examples of how to replace existing code." msgstr "" -"請注意,低階 API 仍會接受 ``loop``。有關如何替換現有程式碼的範例,請參閱 :" -"ref:`changes-python-api`。" +"請注意,低階 API 仍會接受 ``loop``。有關如何替換現有程式碼的範例,請參" +"閱 :ref:`changes-python-api`。" #: ../../whatsnew/3.10.rst:1855 ../../whatsnew/3.10.rst:1927 msgid "" "(Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and Kyle " "Stanley in :issue:`42392`.)" msgstr "" -"(由 Yurii Karabas、Andrew Svetlov、Yury Selivanov 和 Kyle Stanley 在 :issue:" -"`42392` 中貢獻。)" +"(由 Yurii Karabas、Andrew Svetlov、Yury Selivanov 和 Kyle Stanley " +"在 :issue:`42392` 中貢獻。)" #: ../../whatsnew/3.10.rst:1860 ../../whatsnew/3.10.rst:2147 msgid "Porting to Python 3.10" @@ -3615,26 +3651,27 @@ msgstr "" #: ../../whatsnew/3.10.rst:1880 msgid "Changes in the Python API" -msgstr "Python API 的變化" +msgstr "Python API 的變更" #: ../../whatsnew/3.10.rst:1882 msgid "" -"The *etype* parameters of the :func:`~traceback.format_exception`, :func:" -"`~traceback.format_exception_only`, and :func:`~traceback.print_exception` " -"functions in the :mod:`traceback` module have been renamed to *exc*. " -"(Contributed by Zackery Spytz and Matthias Bussonnier in :issue:`26389`.)" +"The *etype* parameters of " +"the :func:`~traceback.format_exception`, :func:`~traceback.format_exception_only`, " +"and :func:`~traceback.print_exception` functions in the :mod:`traceback` " +"module have been renamed to *exc*. (Contributed by Zackery Spytz and " +"Matthias Bussonnier in :issue:`26389`.)" msgstr "" -":func:`~traceback.format_exception`、:func:`~traceback." -"format_exception_only` 和 :mod:`traceback` 模組中的 :func:`~traceback." -"print_exception` 函式的 *etype* 參數已重命名為 *exc*。(由 Zackery Spytz 和 " -"Matthias Bussonnier 在 :issue:`26389` 中貢獻。)" +":func:`~traceback.format_exception`、:func:`~traceback.format_exception_only` " +"和 :mod:`traceback` 模組中的 :func:`~traceback.print_exception` 函式的 " +"*etype* 參數已重命名為 *exc*。(由 Zackery Spytz 和 Matthias Bussonnier " +"在 :issue:`26389` 中貢獻。)" #: ../../whatsnew/3.10.rst:1888 msgid "" -":mod:`atexit`: At Python exit, if a callback registered with :func:`atexit." -"register` fails, its exception is now logged. Previously, only some " -"exceptions were logged, and the last exception was always silently ignored. " -"(Contributed by Victor Stinner in :issue:`42639`.)" +":mod:`atexit`: At Python exit, if a callback registered " +"with :func:`atexit.register` fails, its exception is now logged. Previously, " +"only some exceptions were logged, and the last exception was always silently " +"ignored. (Contributed by Victor Stinner in :issue:`42639`.)" msgstr "" ":mod:`atexit`:在 Python 退出時,如果一個使用 :func:`atexit.register` 註冊的" "回呼 (callback) 失敗,該例外現在會被記錄下來。在以前只記錄一些例外,並且最後" @@ -3649,34 +3686,35 @@ msgid "" "accesses the arguments via :func:`typing.get_args` or ``__args__`` need to " "account for this change. Furthermore, :exc:`TypeError` may be raised for " "invalid forms of parameterizing :class:`collections.abc.Callable` which may " -"have passed silently in Python 3.9. (Contributed by Ken Jin in :issue:" -"`42195`.)" -msgstr "" -":class:`collections.abc.Callable` 泛型現在會攤平型別參數,類似於 :data:" -"`typing.Callable` 目前的做法。這意味著 ``collections.abc.Callable[[int, " -"str], str]`` 將具有 ``(int, str, str)`` 的 ``__args__``;以前這是 ``([int, " -"str], str)``。透過 :func:`typing.get_args` 或 ``__args__`` 存取參數的程式碼需" -"要考慮此變更。此外,對於無效形式的參數化 :class:`collections.abc.Callable`," -"可能會引發 :exc:`TypeError`,而在 Python 3.9 中,該參數可能已被默默地傳遞。" -"(由 Ken Jin 在 :issue:`42195` 中貢獻。)" +"have passed silently in Python 3.9. (Contributed by Ken Jin " +"in :issue:`42195`.)" +msgstr "" +":class:`collections.abc.Callable` 泛型現在會攤平型別參數,類似" +"於 :data:`typing.Callable` 目前的做法。這意味著 " +"``collections.abc.Callable[[int, str], str]`` 將具有 ``(int, str, str)`` 的 " +"``__args__``;以前這是 ``([int, str], str)``。透過 :func:`typing.get_args` " +"或 ``__args__`` 存取參數的程式碼需要考慮此變更。此外,對於無效形式的參數" +"化 :class:`collections.abc.Callable`,可能會引發 :exc:`TypeError`,而在 " +"Python 3.9 中,該參數可能已被默默地傳遞。(由 Ken Jin 在 :issue:`42195` 中貢" +"獻。)" #: ../../whatsnew/3.10.rst:1904 msgid "" ":meth:`socket.htons` and :meth:`socket.ntohs` now raise :exc:`OverflowError` " "instead of :exc:`DeprecationWarning` if the given parameter will not fit in " -"a 16-bit unsigned integer. (Contributed by Erlend E. Aasland in :issue:" -"`42393`.)" +"a 16-bit unsigned integer. (Contributed by Erlend E. Aasland " +"in :issue:`42393`.)" msgstr "" -"如果給定參數不適合 16 位元無符號整數 (16-bit unsigned integer),:meth:" -"`socket.htons` 和 :meth:`socket.ntohs` 現在會引發 :exc:`OverflowError` 而不" -"是 :exc:`DeprecationWarning`。(由 Erlend E. Aasland 在 :issue:`42393` 中貢" -"獻。)" +"如果給定參數不適合 16 位元無符號整數 (16-bit unsigned " +"integer),:meth:`socket.htons` 和 :meth:`socket.ntohs` 現在會引" +"發 :exc:`OverflowError` 而不是 :exc:`DeprecationWarning`。(由 Erlend E. " +"Aasland 在 :issue:`42393` 中貢獻。)" #: ../../whatsnew/3.10.rst:1909 msgid "" -"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ 's :" -"doc:`high-level API <../library/asyncio-api-index>` following deprecation in " -"Python 3.8." +"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ " +"'s :doc:`high-level API <../library/asyncio-api-index>` following " +"deprecation in Python 3.8." msgstr "" "在 Python 3.8 中棄用後,``loop`` 參數已從大多數 :mod:`asyncio` 的\\ :doc:`高" "階 API <../library/asyncio-api-index>` 中刪除。" @@ -3718,17 +3756,18 @@ msgstr "" msgid "" "The :data:`types.FunctionType` constructor now inherits the current builtins " "if the *globals* dictionary has no ``\"__builtins__\"`` key, rather than " -"using ``{\"None\": None}`` as builtins: same behavior as :func:`eval` and :" -"func:`exec` functions. Defining a function with ``def function(...): ...`` " -"in Python is not affected, globals cannot be overridden with this syntax: it " -"also inherits the current builtins. (Contributed by Victor Stinner in :issue:" -"`42990`.)" -msgstr "" -"如果 *globals* 字典沒有 ``\"__builtins__\"`` 鍵,則 :data:`types." -"FunctionType` 建構函式現在會繼承當前的內建物件,而不是使用 ``{\"None\": None}" -"``:相同行為如 :func:`eval` 和 :func:`exec` 函式。在 Python 中使用 ``def " -"function(...): ...`` 定義函式不受影響,全域變數不能用此語法覆蓋:它也繼承當前" -"的內建物件。(由 Victor Stinner 在 :issue:`42990` 中貢獻。)" +"using ``{\"None\": None}`` as builtins: same behavior as :func:`eval` " +"and :func:`exec` functions. Defining a function with ``def " +"function(...): ...`` in Python is not affected, globals cannot be overridden " +"with this syntax: it also inherits the current builtins. (Contributed by " +"Victor Stinner in :issue:`42990`.)" +msgstr "" +"如果 *globals* 字典沒有 ``\"__builtins__\"`` 鍵," +"則 :data:`types.FunctionType` 建構函式現在會繼承當前的內建物件,而不是使用 " +"``{\"None\": None}``:相同行為如 :func:`eval` 和 :func:`exec` 函式。在 " +"Python 中使用 ``def function(...): ...`` 定義函式不受影響,全域變數不能用此語" +"法覆蓋:它也繼承當前的內建物件。(由 Victor Stinner 在 :issue:`42990` 中貢" +"獻。)" #: ../../whatsnew/3.10.rst:1939 msgid "Changes in the C API" @@ -3782,14 +3821,15 @@ msgstr "" msgid "" "To compile a file given a ``char *`` filename, explicitly open the file, " "read it and compile the result. One way to do this is using the :py:mod:`io` " -"module with :c:func:`PyImport_ImportModule`, :c:func:`PyObject_CallMethod`, :" -"c:func:`PyBytes_AsString` and :c:func:`Py_CompileString`, as sketched below. " -"(Declarations and error handling are omitted.) ::" +"module " +"with :c:func:`PyImport_ImportModule`, :c:func:`PyObject_CallMethod`, :c:func:`PyBytes_AsString` " +"and :c:func:`Py_CompileString`, as sketched below. (Declarations and error " +"handling are omitted.) ::" msgstr "" "要編譯給定 ``char *`` 檔案名稱的檔案,請顯式打開該檔案,讀取它並編譯結果。一" -"種方法是使用 :py:mod:`io` 模組和 :c:func:`PyImport_ImportModule`、:c:func:" -"`PyObject_CallMethod`、:c:func:`PyBytes_AsString` 和 :c:func:" -"`Py_CompileString`,如下所示。(宣告和錯誤處理在此被省略。): ::" +"種方法是使用 :py:mod:`io` 模組" +"和 :c:func:`PyImport_ImportModule`、:c:func:`PyObject_CallMethod`、:c:func:`PyBytes_AsString` " +"和 :c:func:`Py_CompileString`,如下所示。(宣告和錯誤處理在此被省略。): ::" #: ../../whatsnew/3.10.rst:1966 msgid "" @@ -3816,8 +3856,8 @@ msgid "" "string. This means that this number needs to be multiplied by 2 to be used " "with APIs that expect a byte offset instead (like :c:func:`PyCode_Addr2Line` " "for example). Notice as well that the :attr:`!f_lasti` member of " -"``FrameObject`` objects is not considered stable: please use :c:func:" -"`PyFrame_GetLineNumber` instead." +"``FrameObject`` objects is not considered stable: please " +"use :c:func:`PyFrame_GetLineNumber` instead." msgstr "" "對於 ``FrameObject`` 物件,:attr:`~frame.f_lasti` 成員現在表示了字碼偏移量 " "(wordcode offset),而不是位元組碼字串的簡單偏移量。這意味著這個數字需要乘以 " @@ -3871,8 +3911,8 @@ msgid "" "The :mod:`atexit` module must now always be built as a built-in module. " "(Contributed by Victor Stinner in :issue:`42639`.)" msgstr "" -":mod:`atexit` 模組現在必須都被建置為內建模組。(由 Victor Stinner 在 :issue:" -"`42639` 中貢獻。)" +":mod:`atexit` 模組現在必須都被建置為內建模組。(由 Victor Stinner " +"在 :issue:`42639` 中貢獻。)" #: ../../whatsnew/3.10.rst:2004 msgid "" @@ -3881,8 +3921,8 @@ msgid "" "Petazzoni and Peixing Xin in :issue:`27640`.)" msgstr "" "將 :option:`--disable-test-modules` 選項新增到 ``configure`` 腳本中:不建置也" -"不安裝測試模組。(由 Xavier de Gaye、Thomas Petazzoni 和 Peixing Xin 在 :" -"issue:`27640` 中貢獻。)" +"不安裝測試模組。(由 Xavier de Gaye、Thomas Petazzoni 和 Peixing Xin " +"在 :issue:`27640` 中貢獻。)" #: ../../whatsnew/3.10.rst:2008 msgid "" @@ -3901,12 +3941,12 @@ msgstr "" msgid "" "Some Linux distribution packaging policies recommend against bundling " "dependencies. For example, Fedora installs wheel packages in the ``/usr/" -"share/python-wheels/`` directory and don't install the ``ensurepip." -"_bundled`` package." +"share/python-wheels/`` directory and don't install the " +"``ensurepip._bundled`` package." msgstr "" "一些 Linux 發行版的打包策略建議不要一併包入依賴項目。例如,Fedora 在 ``/usr/" -"share/python-wheels/`` 目錄中安裝 wheel 套件,並且不安裝 ``ensurepip." -"_bundled`` 套件。" +"share/python-wheels/`` 目錄中安裝 wheel 套件,並且不安裝 " +"``ensurepip._bundled`` 套件。" #: ../../whatsnew/3.10.rst:2019 msgid "(Contributed by Victor Stinner in :issue:`42856`.)" @@ -3919,8 +3959,8 @@ msgid "" "library and not install the ``python.o`` object file." msgstr "" "新增 :option:`configure --without-static-libpython 選項 <--without-static-" -"libpython>` 以不建置 ``libpythonMAJOR.MINOR.a`` 靜態函式庫且不安裝 ``python." -"o`` 目標檔案。" +"libpython>` 以不建置 ``libpythonMAJOR.MINOR.a`` 靜態函式庫且不安裝 " +"``python.o`` 目標檔案。" #: ../../whatsnew/3.10.rst:2025 msgid "(Contributed by Victor Stinner in :issue:`43103`.)" @@ -3966,8 +4006,9 @@ msgid "" "and ABI stability guarantees along with best practices for using the Stable " "ABI." msgstr "" -"用於擴充模組或嵌入 Python 的穩定 ABI(應用程式二進位介面)現已明確定義。 :" -"ref:`stable` 描述了 C API 和 ABI 穩定性保證以及使用穩定 ABI 的最佳實踐。" +"用於擴充模組或嵌入 Python 的穩定 ABI(應用程式二進位介面)現已明確定" +"義。 :ref:`stable` 描述了 C API 和 ABI 穩定性保證以及使用穩定 ABI 的最佳實" +"踐。" #: ../../whatsnew/3.10.rst:2050 msgid "(Contributed by Petr Viktorin in :pep:`652` and :issue:`43795`.)" @@ -3975,9 +4016,9 @@ msgstr "(由 Petr Viktorin 在 :pep:`652` 和 :issue:`43795` 中貢獻。)" #: ../../whatsnew/3.10.rst:2055 msgid "" -"The result of :c:func:`PyNumber_Index` now always has exact type :class:" -"`int`. Previously, the result could have been an instance of a subclass of " -"``int``. (Contributed by Serhiy Storchaka in :issue:`40792`.)" +"The result of :c:func:`PyNumber_Index` now always has exact " +"type :class:`int`. Previously, the result could have been an instance of a " +"subclass of ``int``. (Contributed by Serhiy Storchaka in :issue:`40792`.)" msgstr "" ":c:func:`PyNumber_Index` 的結果現在都具有精確的 :class:`int` 型別。在以前,結" "果可能是 ``int`` 子類別的實例。(由 Serhiy Storchaka 在 :issue:`40792` 中貢" @@ -3990,20 +4031,21 @@ msgid "" "Python executable. (Contributed by Victor Stinner in :issue:`23427`.)" msgstr "" "將新的 :c:member:`~PyConfig.orig_argv` 成員新增到 :c:type:`PyConfig` 結構:傳" -"遞給 Python 可執行檔案的原始命令列參數列表。(由 Victor Stinner 在 :issue:" -"`23427` 中貢獻。)" +"遞給 Python 可執行檔案的原始命令列參數列表。(由 Victor Stinner " +"在 :issue:`23427` 中貢獻。)" #: ../../whatsnew/3.10.rst:2064 msgid "" -"The :c:func:`PyDateTime_DATE_GET_TZINFO` and :c:func:" -"`PyDateTime_TIME_GET_TZINFO` macros have been added for accessing the " -"``tzinfo`` attributes of :class:`datetime.datetime` and :class:`datetime." -"time` objects. (Contributed by Zackery Spytz in :issue:`30155`.)" +"The :c:func:`PyDateTime_DATE_GET_TZINFO` " +"and :c:func:`PyDateTime_TIME_GET_TZINFO` macros have been added for " +"accessing the ``tzinfo`` attributes of :class:`datetime.datetime` " +"and :class:`datetime.time` objects. (Contributed by Zackery Spytz " +"in :issue:`30155`.)" msgstr "" -"新增了 :c:func:`PyDateTime_DATE_GET_TZINFO` 和 :c:func:" -"`PyDateTime_TIME_GET_TZINFO` 巨集,用於存取 :class:`datetime.datetime` 和 :" -"class:`datetime.time` 物件的 ``tzinfo`` 屬性。(由 Zackery Spytz 在 :issue:" -"`30155` 中貢獻。)" +"新增了 :c:func:`PyDateTime_DATE_GET_TZINFO` " +"和 :c:func:`PyDateTime_TIME_GET_TZINFO` 巨集,用於存" +"取 :class:`datetime.datetime` 和 :class:`datetime.time` 物件的 ``tzinfo`` 屬" +"性。(由 Zackery Spytz 在 :issue:`30155` 中貢獻。)" #: ../../whatsnew/3.10.rst:2070 msgid "" @@ -4032,13 +4074,13 @@ msgstr "" #: ../../whatsnew/3.10.rst:2081 msgid "" -"Add :c:func:`PyModule_AddObjectRef` function: similar to :c:func:" -"`PyModule_AddObject` but don't steal a reference to the value on success. " -"(Contributed by Victor Stinner in :issue:`1635741`.)" +"Add :c:func:`PyModule_AddObjectRef` function: similar " +"to :c:func:`PyModule_AddObject` but don't steal a reference to the value on " +"success. (Contributed by Victor Stinner in :issue:`1635741`.)" msgstr "" -"新增 :c:func:`PyModule_AddObjectRef` 函式:類似於 :c:func:" -"`PyModule_AddObject` 但成功時不竊取對值的參照。(由 Victor Stinner 在 :issue:" -"`1635741` 中貢獻。)" +"新增 :c:func:`PyModule_AddObjectRef` 函式:類似" +"於 :c:func:`PyModule_AddObject` 但成功時不竊取對值的參照。(由 Victor " +"Stinner 在 :issue:`1635741` 中貢獻。)" #: ../../whatsnew/3.10.rst:2086 msgid "" @@ -4051,9 +4093,9 @@ msgstr "" #: ../../whatsnew/3.10.rst:2090 msgid "" -"The :c:func:`PyType_FromSpecWithBases` and :c:func:" -"`PyType_FromModuleAndSpec` functions now accept a single class as the " -"*bases* argument. (Contributed by Serhiy Storchaka in :issue:`42423`.)" +"The :c:func:`PyType_FromSpecWithBases` " +"and :c:func:`PyType_FromModuleAndSpec` functions now accept a single class " +"as the *bases* argument. (Contributed by Serhiy Storchaka in :issue:`42423`.)" msgstr "" ":c:func:`PyType_FromSpecWithBases` 和 :c:func:`PyType_FromModuleAndSpec` 函式" "現在接受單個類別作為 *bases* 引數。(由 Serhiy Storchaka 在 :issue:`42423` 中" @@ -4097,12 +4139,12 @@ msgid "" "The limited C API is now supported if :ref:`Python is built in debug mode " "<debug-build>` (if the ``Py_DEBUG`` macro is defined). In the limited C API, " "the :c:func:`Py_INCREF` and :c:func:`Py_DECREF` functions are now " -"implemented as opaque function calls, rather than accessing directly the :c:" -"member:`PyObject.ob_refcnt` member, if Python is built in debug mode and the " -"``Py_LIMITED_API`` macro targets Python 3.10 or newer. It became possible to " -"support the limited C API in debug mode because the :c:type:`PyObject` " -"structure is the same in release and debug mode since Python 3.8 (see :issue:" -"`36465`)." +"implemented as opaque function calls, rather than accessing directly " +"the :c:member:`PyObject.ob_refcnt` member, if Python is built in debug mode " +"and the ``Py_LIMITED_API`` macro targets Python 3.10 or newer. It became " +"possible to support the limited C API in debug mode because " +"the :c:type:`PyObject` structure is the same in release and debug mode since " +"Python 3.8 (see :issue:`36465`)." msgstr "" "如 :ref:`Python 是在除錯模式 (debug mode) <debug-build>` 下建置的(如果有定" "義 ``Py_DEBUG`` 巨集),現在會支援受限 C API。在受限 C API 中,如果 Python 是" @@ -4115,8 +4157,8 @@ msgstr "" #: ../../whatsnew/3.10.rst:2120 msgid "" "The limited C API is still not supported in the :option:`--with-trace-refs` " -"special build (``Py_TRACE_REFS`` macro). (Contributed by Victor Stinner in :" -"issue:`43688`.)" +"special build (``Py_TRACE_REFS`` macro). (Contributed by Victor Stinner " +"in :issue:`43688`.)" msgstr "" ":option:`--with-trace-refs` 特殊建置(``Py_TRACE_REFS`` 巨集)仍不支援受限 C " "API。(由 Victor Stinner 在 :issue:`43688` 中貢獻。)" @@ -4124,28 +4166,29 @@ msgstr "" #: ../../whatsnew/3.10.rst:2124 msgid "" "Add the :c:func:`Py_Is(x, y) <Py_Is>` function to test if the *x* object is " -"the *y* object, the same as ``x is y`` in Python. Add also the :c:func:" -"`Py_IsNone`, :c:func:`Py_IsTrue`, :c:func:`Py_IsFalse` functions to test if " -"an object is, respectively, the ``None`` singleton, the ``True`` singleton " -"or the ``False`` singleton. (Contributed by Victor Stinner in :issue:" -"`43753`.)" +"the *y* object, the same as ``x is y`` in Python. Add also " +"the :c:func:`Py_IsNone`, :c:func:`Py_IsTrue`, :c:func:`Py_IsFalse` functions " +"to test if an object is, respectively, the ``None`` singleton, the ``True`` " +"singleton or the ``False`` singleton. (Contributed by Victor Stinner " +"in :issue:`43753`.)" msgstr "" "新增 :c:func:`Py_Is(x, y) <Py_Is>` 函式來測試 *x* 物件是否為 *y* 物件,與 " -"Python 中的 ``x is y`` 相同。還新增 :c:func:`Py_IsNone`、:c:func:" -"`Py_IsTrue`、:c:func:`Py_IsFalse` 函式來分別測試物件是否為 ``None`` 單例、 " -"``True`` 單例或 ``False`` 單例。(由 Victor Stinner 在 :issue:`43753` 中貢" -"獻。)" +"Python 中的 ``x is y`` 相同。還新" +"增 :c:func:`Py_IsNone`、:c:func:`Py_IsTrue`、:c:func:`Py_IsFalse` 函式來分別" +"測試物件是否為 ``None`` 單例、 ``True`` 單例或 ``False`` 單例。(由 Victor " +"Stinner 在 :issue:`43753` 中貢獻。)" #: ../../whatsnew/3.10.rst:2131 msgid "" -"Add new functions to control the garbage collector from C code: :c:func:" -"`PyGC_Enable()`, :c:func:`PyGC_Disable()`, :c:func:`PyGC_IsEnabled()`. These " -"functions allow to activate, deactivate and query the state of the garbage " -"collector from C code without having to import the :mod:`gc` module." +"Add new functions to control the garbage collector from C " +"code: :c:func:`PyGC_Enable()`, :c:func:`PyGC_Disable()`, :c:func:`PyGC_IsEnabled()`. " +"These functions allow to activate, deactivate and query the state of the " +"garbage collector from C code without having to import the :mod:`gc` module." msgstr "" -"新增函式以從 C 程式碼控制垃圾收集器::c:func:`PyGC_Enable()`、:c:func:" -"`PyGC_Disable()`、:c:func:`PyGC_IsEnabled()`。這些函式使得能夠從 C 程式碼啟" -"用、停用和查詢垃圾收集器的狀態,而無需引入 :mod:`gc` 模組。" +"新增函式以從 C 程式碼控制垃圾收集" +"器::c:func:`PyGC_Enable()`、:c:func:`PyGC_Disable()`、:c:func:`PyGC_IsEnabled()`。" +"這些函式使得能夠從 C 程式碼啟用、停用和查詢垃圾收集器的狀態,而無需引" +"入 :mod:`gc` 模組。" #: ../../whatsnew/3.10.rst:2138 msgid "" @@ -4162,21 +4205,21 @@ msgid "" "(Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.)" msgstr "" "新增 :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` 型別旗標用於建立不可變型別物件:無法" -"設定或刪除型別屬性。(由 Victor Stinner 和 Erlend E. Aasland 在 :issue:" -"`43908` 中貢獻。)" +"設定或刪除型別屬性。(由 Victor Stinner 和 Erlend E. Aasland " +"在 :issue:`43908` 中貢獻。)" #: ../../whatsnew/3.10.rst:2149 msgid "" -"The ``PY_SSIZE_T_CLEAN`` macro must now be defined to use :c:func:" -"`PyArg_ParseTuple` and :c:func:`Py_BuildValue` formats which use ``#``: " -"``es#``, ``et#``, ``s#``, ``u#``, ``y#``, ``z#``, ``U#`` and ``Z#``. See :" -"ref:`arg-parsing` and :pep:`353`. (Contributed by Victor Stinner in :issue:" -"`40943`.)" +"The ``PY_SSIZE_T_CLEAN`` macro must now be defined to " +"use :c:func:`PyArg_ParseTuple` and :c:func:`Py_BuildValue` formats which use " +"``#``: ``es#``, ``et#``, ``s#``, ``u#``, ``y#``, ``z#``, ``U#`` and ``Z#``. " +"See :ref:`arg-parsing` and :pep:`353`. (Contributed by Victor Stinner " +"in :issue:`40943`.)" msgstr "" -"現在必須定義 ``PY_SSIZE_T_CLEAN`` 巨集以使用 :c:func:`PyArg_ParseTuple` 和 :" -"c:func:`Py_BuildValue` 格式,這些格式使用 ``#``: ``es#``, ``et#``、``s#``、" -"``u#``、``y#``、``z#``、``U#`` 和 ``Z#``。請參閱 :ref:`arg-parsing` 和 :pep:" -"`353`。(由 Victor Stinner 在 :issue:`40943` 中貢獻。)" +"現在必須定義 ``PY_SSIZE_T_CLEAN`` 巨集以使用 :c:func:`PyArg_ParseTuple` " +"和 :c:func:`Py_BuildValue` 格式,這些格式使用 ``#``: ``es#``, ``et#``、" +"``s#``、``u#``、``y#``、``z#``、``U#`` 和 ``Z#``。請參閱 :ref:`arg-parsing` " +"和 :pep:`353`。(由 Victor Stinner 在 :issue:`40943` 中貢獻。)" #: ../../whatsnew/3.10.rst:2155 msgid "" @@ -4210,9 +4253,9 @@ msgid "" "for historical reason. It is no longer allowed. (Contributed by Victor " "Stinner in :issue:`40839`.)" msgstr "" -"由於過去的種種原因,過去在不持有 :term:`GIL` 的情況下呼叫 :c:func:" -"`PyDict_GetItem` 是被允許的。目前已被禁止。(由 Victor Stinner 在 :issue:" -"`40839` 中貢獻。)" +"由於過去的種種原因,過去在不持有 :term:`GIL` 的情況下呼" +"叫 :c:func:`PyDict_GetItem` 是被允許的。目前已被禁止。(由 Victor Stinner " +"在 :issue:`40839` 中貢獻。)" #: ../../whatsnew/3.10.rst:2170 msgid "" @@ -4237,57 +4280,58 @@ msgstr "" #: ../../whatsnew/3.10.rst:2179 msgid "" -":c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:" -"func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and :c:func:" -"`Py_GetProgramName` functions now return ``NULL`` if called before :c:func:" -"`Py_Initialize` (before Python is initialized). Use the new :ref:`init-" -"config` API to get the :ref:`init-path-config`. (Contributed by Victor " -"Stinner in :issue:`42260`.)" +":c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` " +"and :c:func:`Py_GetProgramName` functions now return ``NULL`` if called " +"before :c:func:`Py_Initialize` (before Python is initialized). Use the " +"new :ref:`init-config` API to get the :ref:`init-path-config`. (Contributed " +"by Victor Stinner in :issue:`42260`.)" msgstr "" -"如果在 :c:func:`Py_Initialize` 之前(Python 初始化之前)被呼叫,:c:func:" -"`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:`Py_GetExecPrefix`、:c:func:" -"`Py_GetProgramFullPath`、:c:func:`Py_GetPythonHome` 和 :c:func:" -"`Py_GetProgramName` 現在會回傳 ``NULL``。使用新的 :ref:`init-config` API 來獲" -"取 :ref:`init-path-config`。(由 Victor Stinner 在 :issue:`42260` 中貢獻。)" +"如果在 :c:func:`Py_Initialize` 之前(Python 初始化之前)被呼" +"叫,:c:func:`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:`Py_GetExecPrefix`、:c:func:`Py_GetProgramFullPath`、:c:func:`Py_GetPythonHome` " +"和 :c:func:`Py_GetProgramName` 現在會回傳 ``NULL``。使用新的 :ref:`init-" +"config` API 來獲取 :ref:`init-path-config`。(由 Victor Stinner " +"在 :issue:`42260` 中貢獻。)" #: ../../whatsnew/3.10.rst:2186 msgid "" -":c:func:`PyList_SET_ITEM`, :c:func:`PyTuple_SET_ITEM` and :c:func:" -"`PyCell_SET` macros can no longer be used as l-value or r-value. For " -"example, ``x = PyList_SET_ITEM(a, b, c)`` and ``PyList_SET_ITEM(a, b, c) = " -"x`` now fail with a compiler error. It prevents bugs like ``if " +":c:func:`PyList_SET_ITEM`, :c:func:`PyTuple_SET_ITEM` " +"and :c:func:`PyCell_SET` macros can no longer be used as l-value or r-value. " +"For example, ``x = PyList_SET_ITEM(a, b, c)`` and ``PyList_SET_ITEM(a, b, c) " +"= x`` now fail with a compiler error. It prevents bugs like ``if " "(PyList_SET_ITEM (a, b, c) < 0) ...`` test. (Contributed by Zackery Spytz " "and Victor Stinner in :issue:`30459`.)" msgstr "" -":c:func:`PyList_SET_ITEM`、:c:func:`PyTuple_SET_ITEM` 和 :c:func:" -"`PyCell_SET` 巨集不能再用作左值 (l-value) 或右值 (r-value)。例如,``x = " -"PyList_SET_ITEM(a, b, c)`` 和 ``PyList_SET_ITEM(a, b, c) = x`` 現在會失敗並出" -"現編譯器錯誤。它可以防止如 ``if (PyList_SET_ITEM (a, b, c) < 0) ...`` 測試之" -"類的錯誤。(由 Zackery Spytz 和 Victor Stinner 在 :issue:`30459` 中貢獻。)" +":c:func:`PyList_SET_ITEM`、:c:func:`PyTuple_SET_ITEM` " +"和 :c:func:`PyCell_SET` 巨集不能再用作左值 (l-value) 或右值 (r-value)。例如," +"``x = PyList_SET_ITEM(a, b, c)`` 和 ``PyList_SET_ITEM(a, b, c) = x`` 現在會失" +"敗並出現編譯器錯誤。它可以防止如 ``if (PyList_SET_ITEM (a, b, c) < 0) ...`` " +"測試之類的錯誤。(由 Zackery Spytz 和 Victor Stinner 在 :issue:`30459` 中貢" +"獻。)" #: ../../whatsnew/3.10.rst:2193 msgid "" "The non-limited API files ``odictobject.h``, ``parser_interface.h``, " -"``picklebufobject.h``, ``pyarena.h``, ``pyctype.h``, ``pydebug.h``, ``pyfpe." -"h``, and ``pytime.h`` have been moved to the ``Include/cpython`` directory. " -"These files must not be included directly, as they are already included in " -"``Python.h``; see :ref:`api-includes`. If they have been included directly, " -"consider including ``Python.h`` instead. (Contributed by Nicholas Sim in :" -"issue:`35134`.)" -msgstr "" -"非受限 API 檔案 ``odictobject.h``、``parser_interface.h``、``picklebufobject." -"h``、``pyarena.h``、``pyctype.h``、``pydebug.h``、``pyfpe.h`` 和 ``pytime." -"h`` 已移至 ``Include/cpython`` 目錄。這些檔案不得直接被引入,因為它們已於 " -"``Python.h`` 中引入;請參閱 :ref:`api-includes`。如果直接引入它們,請考慮改為" -"引入 ``Python.h``。(由 Nicholas Sim 在 :issue:`35134` 中貢獻。)" +"``picklebufobject.h``, ``pyarena.h``, ``pyctype.h``, ``pydebug.h``, " +"``pyfpe.h``, and ``pytime.h`` have been moved to the ``Include/cpython`` " +"directory. These files must not be included directly, as they are already " +"included in ``Python.h``; see :ref:`api-includes`. If they have been " +"included directly, consider including ``Python.h`` instead. (Contributed by " +"Nicholas Sim in :issue:`35134`.)" +msgstr "" +"非受限 API 檔案 ``odictobject.h``、``parser_interface.h``、" +"``picklebufobject.h``、``pyarena.h``、``pyctype.h``、``pydebug.h``、" +"``pyfpe.h`` 和 ``pytime.h`` 已移至 ``Include/cpython`` 目錄。這些檔案不得直接" +"被引入,因為它們已於 ``Python.h`` 中引入;請參閱 :ref:`api-includes`。如果直" +"接引入它們,請考慮改為引入 ``Python.h``。(由 Nicholas Sim 在 :issue:`35134` " +"中貢獻。)" #: ../../whatsnew/3.10.rst:2201 msgid "" "Use the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` type flag to create immutable " "type objects. Do not rely on :c:macro:`Py_TPFLAGS_HEAPTYPE` to decide if a " "type object is mutable or not; check if :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` " -"is set instead. (Contributed by Victor Stinner and Erlend E. Aasland in :" -"issue:`43908`.)" +"is set instead. (Contributed by Victor Stinner and Erlend E. Aasland " +"in :issue:`43908`.)" msgstr "" "使用 :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` 型別旗標來建立不可變型別物件。不要依" "賴 :c:macro:`Py_TPFLAGS_HEAPTYPE` 來決定型別物件是否可變;應改為檢查是否設定" @@ -4323,27 +4367,27 @@ msgstr "" #: ../../whatsnew/3.10.rst:2225 msgid "" -"``Py_UNICODE_strlen``: use :c:func:`PyUnicode_GetLength` or :c:macro:" -"`PyUnicode_GET_LENGTH`" +"``Py_UNICODE_strlen``: use :c:func:`PyUnicode_GetLength` " +"or :c:macro:`PyUnicode_GET_LENGTH`" msgstr "" -"``Py_UNICODE_strlen``:使用 :c:func:`PyUnicode_GetLength` 或 :c:macro:" -"`PyUnicode_GET_LENGTH`" +"``Py_UNICODE_strlen``:使用 :c:func:`PyUnicode_GetLength` " +"或 :c:macro:`PyUnicode_GET_LENGTH`" #: ../../whatsnew/3.10.rst:2227 msgid "" -"``Py_UNICODE_strcat``: use :c:func:`PyUnicode_CopyCharacters` or :c:func:" -"`PyUnicode_FromFormat`" +"``Py_UNICODE_strcat``: use :c:func:`PyUnicode_CopyCharacters` " +"or :c:func:`PyUnicode_FromFormat`" msgstr "" -"``Py_UNICODE_strcat``:使用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:" -"`PyUnicode_FromFormat`" +"``Py_UNICODE_strcat``:使用 :c:func:`PyUnicode_CopyCharacters` " +"或 :c:func:`PyUnicode_FromFormat`" #: ../../whatsnew/3.10.rst:2229 msgid "" -"``Py_UNICODE_strcpy``, ``Py_UNICODE_strncpy``: use :c:func:" -"`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`" +"``Py_UNICODE_strcpy``, ``Py_UNICODE_strncpy``: " +"use :c:func:`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`" msgstr "" -"``Py_UNICODE_strcpy``、``Py_UNICODE_strncpy``:使用 :c:func:" -"`PyUnicode_CopyCharacters` 或 :c:func:`PyUnicode_Substring`" +"``Py_UNICODE_strcpy``、``Py_UNICODE_strncpy``:使" +"用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:`PyUnicode_Substring`" #: ../../whatsnew/3.10.rst:2231 msgid "``Py_UNICODE_strcmp``: use :c:func:`PyUnicode_Compare`" @@ -4355,11 +4399,11 @@ msgstr "``Py_UNICODE_strncmp``:使用 :c:func:`PyUnicode_Tailmatch`" #: ../../whatsnew/3.10.rst:2233 msgid "" -"``Py_UNICODE_strchr``, ``Py_UNICODE_strrchr``: use :c:func:" -"`PyUnicode_FindChar`" +"``Py_UNICODE_strchr``, ``Py_UNICODE_strrchr``: " +"use :c:func:`PyUnicode_FindChar`" msgstr "" -"``Py_UNICODE_strchr``、``Py_UNICODE_strrchr``:使用 :c:func:" -"`PyUnicode_FindChar`" +"``Py_UNICODE_strchr``、``Py_UNICODE_strrchr``:使" +"用 :c:func:`PyUnicode_FindChar`" #: ../../whatsnew/3.10.rst:2236 msgid "" @@ -4371,17 +4415,18 @@ msgstr "" #: ../../whatsnew/3.10.rst:2239 msgid "" -"Removed ``PyLong_FromUnicode()``. Please migrate to :c:func:" -"`PyLong_FromUnicodeObject`. (Contributed by Inada Naoki in :issue:`41103`.)" +"Removed ``PyLong_FromUnicode()``. Please migrate " +"to :c:func:`PyLong_FromUnicodeObject`. (Contributed by Inada Naoki " +"in :issue:`41103`.)" msgstr "" "刪除了 ``PyLong_FromUnicode()``。請改用 :c:func:`PyLong_FromUnicodeObject`。" "(由 Inada Naoki 在 :issue:`41103` 中貢獻。)" #: ../../whatsnew/3.10.rst:2242 msgid "" -"Removed ``PyUnicode_AsUnicodeCopy()``. Please use :c:func:" -"`PyUnicode_AsUCS4Copy` or :c:func:`PyUnicode_AsWideCharString` (Contributed " -"by Inada Naoki in :issue:`41103`.)" +"Removed ``PyUnicode_AsUnicodeCopy()``. Please " +"use :c:func:`PyUnicode_AsUCS4Copy` or :c:func:`PyUnicode_AsWideCharString` " +"(Contributed by Inada Naoki in :issue:`41103`.)" msgstr "" "刪除了 ``PyUnicode_AsUnicodeCopy()``。請改用 :c:func:`PyUnicode_AsUCS4Copy` " "或 :c:func:`PyUnicode_AsWideCharString` (由 Inada Naoki 在 :issue:`41103` 中" @@ -4400,9 +4445,9 @@ msgstr "" #: ../../whatsnew/3.10.rst:2250 msgid "" "Removed undocumented macros ``Py_ALLOW_RECURSION`` and " -"``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of the :c:" -"type:`PyInterpreterState` structure. (Contributed by Serhiy Storchaka in :" -"issue:`41936`.)" +"``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of " +"the :c:type:`PyInterpreterState` structure. (Contributed by Serhiy Storchaka " +"in :issue:`41936`.)" msgstr "" "刪除了未被說明文件記錄的巨集 ``Py_ALLOW_RECURSION`` 和 " "``Py_END_ALLOW_RECURSION`` 以及 :c:type:`PyInterpreterState` 結構的 " @@ -4411,8 +4456,9 @@ msgstr "" #: ../../whatsnew/3.10.rst:2255 msgid "" "Removed the undocumented ``PyOS_InitInterrupts()`` function. Initializing " -"Python already implicitly installs signal handlers: see :c:member:`PyConfig." -"install_signal_handlers`. (Contributed by Victor Stinner in :issue:`41713`.)" +"Python already implicitly installs signal handlers: " +"see :c:member:`PyConfig.install_signal_handlers`. (Contributed by Victor " +"Stinner in :issue:`41713`.)" msgstr "" "刪除了未被說明文件記錄的 ``PyOS_InitInterrupts()`` 函式。初始化 Python 已經隱" "式安裝信號處理程式:請參閱 :c:member:`PyConfig.install_signal_handlers`。" @@ -4463,8 +4509,8 @@ msgid "" "it could not be used, because the ``symtable.h`` header file was excluded " "from the limited C API." msgstr "" -"``Py_SymtableString()`` 函式錯誤地成為穩定 ABI 的一部分,但它因為 ``symtable." -"h`` 標頭檔被排除在受限 C API 之外而無法使用。" +"``Py_SymtableString()`` 函式錯誤地成為穩定 ABI 的一部分,但它因為 " +"``symtable.h`` 標頭檔被排除在受限 C API 之外而無法使用。" #: ../../whatsnew/3.10.rst:2278 msgid "" @@ -4498,8 +4544,8 @@ msgstr "" "刪除 ``ast.h``、``asdl.h`` 和 ``Python-ast.h`` 標頭檔。這些函式沒有文件記錄," "並且被排除在受限 C API 之外。這些標頭檔定義的大多數名稱都沒有前綴 ``Py``,因" "此可能會產生名稱衝突。例如,``Python-ast.h`` 定義了一個 ``Yield`` 巨集,它與 " -"Windows ``<winbase.h>`` 標頭使用的 ``Yield`` 有名稱衝突。請改用 Python :mod:" -"`ast` 模組。(由 Victor Stinner 在 :issue:`43244` 中貢獻。)" +"Windows ``<winbase.h>`` 標頭使用的 ``Yield`` 有名稱衝突。請改用 " +"Python :mod:`ast` 模組。(由 Victor Stinner 在 :issue:`43244` 中貢獻。)" #: ../../whatsnew/3.10.rst:2295 msgid "" @@ -4553,8 +4599,8 @@ msgid "" "These functions were undocumented and excluded from the limited C API. " "(Contributed by Victor Stinner in :issue:`43244`.)" msgstr "" -"這些函式沒有文件記錄,並且被排除在受限 C API 之外。(由 Victor Stinner 在 :" -"issue:`43244` 中貢獻。)" +"這些函式沒有文件記錄,並且被排除在受限 C API 之外。(由 Victor Stinner " +"在 :issue:`43244` 中貢獻。)" #: ../../whatsnew/3.10.rst:2312 msgid "Remove the ``pyarena.h`` header file with functions:" @@ -4579,8 +4625,8 @@ msgstr "``PyArena_AddPyObject()``" #: ../../whatsnew/3.10.rst:2319 msgid "" "These functions were undocumented, excluded from the limited C API, and were " -"only used internally by the compiler. (Contributed by Victor Stinner in :" -"issue:`43244`.)" +"only used internally by the compiler. (Contributed by Victor Stinner " +"in :issue:`43244`.)" msgstr "" "這些函式沒有文件記錄、被排除在受限 C API 之外,並僅被編譯器於內部使用。(由 " "Victor Stinner 在 :issue:`43244` 中貢獻。)" @@ -4619,8 +4665,8 @@ msgid "" "The deprecated :mod:`!mailcap` module now refuses to inject unsafe text " "(filenames, MIME types, parameters) into shell commands. Instead of using " "such text, it will warn and act as if a match was not found (or for test " -"commands, as if the test failed). (Contributed by Petr Viktorin in :gh:" -"`98966`.)" +"commands, as if the test failed). (Contributed by Petr Viktorin " +"in :gh:`98966`.)" msgstr "" #: ../../whatsnew/3.10.rst:2350 diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po index 0d18eb3a67..79695ce8ce 100644 --- a/whatsnew/3.11.po +++ b/whatsnew/3.11.po @@ -33,8 +33,8 @@ msgstr "Pablo Galindo Salgado" #: ../../whatsnew/3.11.rst:47 msgid "" "This article explains the new features in Python 3.11, compared to 3.10. " -"Python 3.11 was released on October 24, 2022. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.11 was released on October 24, 2022. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "此文章解釋了 Python 3.11 和 3.10 相比多了哪些新功能。Python 3.11 於 2022 年 " "10 月 24 日發布。完整細節請見 :ref:`changelog`。" @@ -46,8 +46,8 @@ msgstr "發布重點摘要" #: ../../whatsnew/3.11.rst:60 msgid "" "Python 3.11 is between 10-60% faster than Python 3.10. On average, we " -"measured a 1.25x speedup on the standard benchmark suite. See :ref:" -"`whatsnew311-faster-cpython` for details." +"measured a 1.25x speedup on the standard benchmark suite. " +"See :ref:`whatsnew311-faster-cpython` for details." msgstr "" "Python 3.11 比 Python 3.10 快了 10-60%。我們使用了標準基準量測套裝軟體 " "(benchmark suite) 測得平均加速了 1.25x。細節請見\\ :ref:`whatsnew311-faster-" @@ -244,13 +244,13 @@ msgstr "" #: ../../whatsnew/3.11.rst:159 msgid "" "Additionally, the information used by the enhanced traceback feature is made " -"available via a general API, that can be used to correlate :term:`bytecode` :" -"ref:`instructions <bytecodes>` with source code location. This information " -"can be retrieved using:" +"available via a general API, that can be used to " +"correlate :term:`bytecode` :ref:`instructions <bytecodes>` with source code " +"location. This information can be retrieved using:" msgstr "" -"此外,強化回溯特性所使用的資訊可以透過一般的 API 來取得,以用來使 :term:" -"`bytecode` :ref:`指示 (instruction) <bytecodes>`\\ 與原始碼位置相互關聯。此項" -"資訊可以用以下方式取得:" +"此外,強化回溯特性所使用的資訊可以透過一般的 API 來取得,以用來" +"使 :term:`bytecode` :ref:`指示 (instruction) <bytecodes>`\\ 與原始碼位置相互" +"關聯。此項資訊可以用以下方式取得:" #: ../../whatsnew/3.11.rst:164 msgid "The :meth:`codeobject.co_positions` method in Python." @@ -265,8 +265,8 @@ msgid "" "See :pep:`657` for more details. (Contributed by Pablo Galindo, Batuhan " "Taskaya and Ammar Askar in :issue:`43950`.)" msgstr "" -"詳情請見 :pep:`657`。(由 Pablo Galindo、Batuhan Taskaya 與 Ammar Askar 於 :" -"issue:`43950` 中所貢獻。)" +"詳情請見 :pep:`657`。(由 Pablo Galindo、Batuhan Taskaya 與 Ammar Askar " +"於 :issue:`43950` 中所貢獻。)" #: ../../whatsnew/3.11.rst:171 msgid "" @@ -274,8 +274,8 @@ msgid "" "may result in a small increase in interpreter memory usage and disk usage " "for compiled Python files. To avoid storing the extra information and " "deactivate printing the extra traceback information, use the :option:`-X " -"no_debug_ranges <-X>` command line option or the :envvar:" -"`PYTHONNODEBUGRANGES` environment variable." +"no_debug_ranges <-X>` command line option or " +"the :envvar:`PYTHONNODEBUGRANGES` environment variable." msgstr "" "這個特性必須要將欄的位置 (column position) 儲存於 :ref:`codeobjects`,這可能" "會導致直譯器用於編譯 Python 檔案的記憶體使用量與硬碟使用量增加。為了避免儲存" @@ -289,16 +289,16 @@ msgstr "PEP 654:例外群組與 ``except*``" #: ../../whatsnew/3.11.rst:185 msgid "" ":pep:`654` introduces language features that enable a program to raise and " -"handle multiple unrelated exceptions simultaneously. The builtin types :exc:" -"`ExceptionGroup` and :exc:`BaseExceptionGroup` make it possible to group " -"exceptions and raise them together, and the new :keyword:`except* " +"handle multiple unrelated exceptions simultaneously. The builtin " +"types :exc:`ExceptionGroup` and :exc:`BaseExceptionGroup` make it possible " +"to group exceptions and raise them together, and the new :keyword:`except* " "<except_star>` syntax generalizes :keyword:`except` to match subgroups of " "exception groups." msgstr "" ":pep:`654` 引入了新的的語言特性,可讓程式同時引發並處理多個相互無關的例外。內" "建型別 :exc:`ExceptionGroup` 和 :exc:`BaseExceptionGroup` 使得程式可為多個例" -"外組成群組並同時引發,新的 :keyword:`except* <except_star>` 語法也將 :" -"keyword:`except` 泛用化、能夠比對例外群組的子群組。" +"外組成群組並同時引發,新的 :keyword:`except* <except_star>` 語法也" +"將 :keyword:`except` 泛用化、能夠比對例外群組的子群組。" #: ../../whatsnew/3.11.rst:192 msgid "See :pep:`654` for more details." @@ -346,33 +346,33 @@ msgstr "Windows ``py.exe`` 啟動程式 (launcher) 的改進" #: ../../whatsnew/3.11.rst:219 msgid "" "The copy of the :ref:`launcher` included with Python 3.11 has been " -"significantly updated. It now supports company/tag syntax as defined in :pep:" -"`514` using the :samp:`-V:{<company>}/{<tag>}` argument instead of the " -"limited :samp:`-{<major>}.{<minor>}`. This allows launching distributions " -"other than ``PythonCore``, the one hosted on `python.org <https://www.python." -"org>`_." +"significantly updated. It now supports company/tag syntax as defined " +"in :pep:`514` using the :samp:`-V:{<company>}/{<tag>}` argument instead of " +"the limited :samp:`-{<major>}.{<minor>}`. This allows launching " +"distributions other than ``PythonCore``, the one hosted on `python.org " +"<https://www.python.org>`_." msgstr "" -"Python 3.11 所包含的 :ref:`launcher` 複製品有了顯著的改善。它現在支援 :pep:" -"`514` 所定義的公司/標籤 (tag) 語法,可用 :samp:`-V:{<company>}/{<tag>}` 引數" -"來取代受限的 :samp:`-{<major>}.{<minor>}`。這允許了 `python.org <https://www." -"python.org>`_ 上的 ``PythonCore`` 以外的發行版本發布。" +"Python 3.11 所包含的 :ref:`launcher` 複製品有了顯著的改善。它現在支" +"援 :pep:`514` 所定義的公司/標籤 (tag) 語法,可用 :samp:`-V:{<company>}/" +"{<tag>}` 引數來取代受限的 :samp:`-{<major>}.{<minor>}`。這允許了 `python.org " +"<https://www.python.org>`_ 上的 ``PythonCore`` 以外的發行版本發布。" #: ../../whatsnew/3.11.rst:225 msgid "" "When using ``-V:`` selectors, either company or tag can be omitted, but all " "installs will be searched. For example, ``-V:OtherPython/`` will select the " -"\"best\" tag registered for ``OtherPython``, while ``-V:3.11`` or ``-" -"V:/3.11`` will select the \"best\" distribution with tag ``3.11``." +"\"best\" tag registered for ``OtherPython``, while ``-V:3.11`` or ``-V:/" +"3.11`` will select the \"best\" distribution with tag ``3.11``." msgstr "" -"使用 ``-V:`` 選擇器時,可以省略公司或標籤,但會搜索所有安裝。例如,``-V:" -"OtherPython/`` 將選擇 ``OtherPython`` 註冊的「最佳」標籤,而 ``-V:3.11`` 或 " -"``-V:/3.11`` 將選擇帶有 ``3.11`` 標籤的「最佳」發行版。" +"使用 ``-V:`` 選擇器時,可以省略公司或標籤,但會搜索所有安裝。例如,``-" +"V:OtherPython/`` 將選擇 ``OtherPython`` 註冊的「最佳」標籤,而 ``-V:3.11`` " +"或 ``-V:/3.11`` 將選擇帶有 ``3.11`` 標籤的「最佳」發行版。" #: ../../whatsnew/3.11.rst:230 msgid "" -"When using the legacy :samp:`-{<major>}`, :samp:`-{<major>}.{<minor>}`, :" -"samp:`-{<major>}-{<bitness>}` or :samp:`-{<major>}.{<minor>}-{<bitness>}` " -"arguments, all existing behaviour should be preserved from past versions, " +"When using the legacy :samp:`-{<major>}`, :samp:`-{<major>}.{<minor>}" +"`, :samp:`-{<major>}-{<bitness>}` or :samp:`-{<major>}.{<minor>}-{<bitness>}" +"` arguments, all existing behaviour should be preserved from past versions, " "and only releases from ``PythonCore`` will be selected. However, the ``-64`` " "suffix now implies \"not 32-bit\" (not necessarily x86-64), as there are " "multiple supported 64-bit platforms. 32-bit runtimes are detected by " @@ -393,8 +393,8 @@ msgstr "型別提示相關的新特性" #: ../../whatsnew/3.11.rst:246 msgid "" -"This section covers major changes affecting :pep:`484` type hints and the :" -"mod:`typing` module." +"This section covers major changes affecting :pep:`484` type hints and " +"the :mod:`typing` module." msgstr "" "這個部分涵蓋影響 :pep:`484` 型別提示 (type hints) 與 :mod:`typing` 模組的重大" "變更。" @@ -406,10 +406,10 @@ msgstr "PEP 646:可變參數泛型 (variadic generics)" #: ../../whatsnew/3.11.rst:255 msgid "" ":pep:`484` previously introduced :data:`~typing.TypeVar`, enabling creation " -"of generics parameterised with a single type. :pep:`646` adds :data:`~typing." -"TypeVarTuple`, enabling parameterisation with an *arbitrary* number of " -"types. In other words, a :data:`~typing.TypeVarTuple` is a *variadic* type " -"variable, enabling *variadic* generics." +"of generics parameterised with a single type. :pep:`646` " +"adds :data:`~typing.TypeVarTuple`, enabling parameterisation with an " +"*arbitrary* number of types. In other words, a :data:`~typing.TypeVarTuple` " +"is a *variadic* type variable, enabling *variadic* generics." msgstr "" ":pep:`484` 先前引入了 :data:`~typing.TypeVar`,開啟了帶有單一型別的泛型參數" "化。:pep:`646` 新增 :data:`~typing.TypeVarTuple`,開啟了帶有\\ *任意*\\ 數量" @@ -450,9 +450,9 @@ msgstr "PEP 655:標記獨立 ``TypedDict`` 項目為必要或不必要" #: ../../whatsnew/3.11.rst:280 msgid "" ":data:`~typing.Required` and :data:`~typing.NotRequired` provide a " -"straightforward way to mark whether individual items in a :class:`~typing." -"TypedDict` must be present. Previously, this was only possible using " -"inheritance." +"straightforward way to mark whether individual items in " +"a :class:`~typing.TypedDict` must be present. Previously, this was only " +"possible using inheritance." msgstr "" ":data:`~typing.Required` 與 :data:`~typing.NotRequired` 提供了標記一個獨立項" "目在 :class:`~typing.TypedDict` 中是否必須存在的直覺方法。在這之前,這只有透" @@ -524,9 +524,9 @@ msgstr "" #: ../../whatsnew/3.11.rst:322 msgid "" -"Common use cases include alternative constructors provided as :func:" -"`classmethod <classmethod>`\\s, and :meth:`~object.__enter__` methods that " -"return ``self``::" +"Common use cases include alternative constructors provided " +"as :func:`classmethod <classmethod>`\\s, and :meth:`~object.__enter__` " +"methods that return ``self``::" msgstr "" "常見用例包括作為 :func:`classmethod <classmethod>` 的替代建構函式和會回傳 " "``self`` 的 :meth:`~object.__enter__` 方法: ::" @@ -644,8 +644,8 @@ msgid "" ":data:`~typing.dataclass_transform` may be used to decorate a class, " "metaclass, or a function that is itself a decorator. The presence of " "``@dataclass_transform()`` tells a static type checker that the decorated " -"object performs runtime \"magic\" that transforms a class, giving it :func:" -"`dataclass <dataclasses.dataclass>`-like behaviors." +"object performs runtime \"magic\" that transforms a class, giving " +"it :func:`dataclass <dataclasses.dataclass>`-like behaviors." msgstr "" ":data:`~typing.dataclass_transform` 可以用來裝飾一個類別、元類別 " "(metaclass)、或是一個本身就是裝飾器的函式。``@dataclass_transform()`` 的存在" @@ -700,8 +700,8 @@ msgid "" "python-dev@python.org/message/VIZEBX5EYMSYIJNDBF6DMUMZOCWHARSO/>`__ for more " "information." msgstr "" -":pep:`563` 標註的推遲求值 (Postponed Evaluation of Annotations)(\\ ``from " -"__future__ import annotations`` :ref:`future 陳述式 <future>`\\ )最初計劃在 " +":pep:`563` 推遲對註釋的求值 (Postponed Evaluation of Annotations)(``from " +"__future__ import annotations`` :ref:`future 陳述式 <future>`)最初計劃在 " "Python 3.10 中發布,但已被無限期擱置。請參閱\\ `來自指導委員會 (Steering " "Counsil) 的訊息 <https://mail.python.org/archives/list/python-dev@python.org/" "message/VIZEBX5EYMSYIJNDBF6DMUMZOCWHARSO/>`__\\ 以獲得更多資訊。" @@ -732,51 +732,51 @@ msgstr "" #: ../../whatsnew/3.11.rst:447 msgid "" -"A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` in :" -"keyword:`with` statements and :meth:`contextlib.ExitStack.enter_context` for " -"objects that do not support the :term:`context manager` protocol, and in :" -"keyword:`async with` statements and :meth:`contextlib.AsyncExitStack." -"enter_async_context` for objects not supporting the :term:`asynchronous " -"context manager` protocol. (Contributed by Serhiy Storchaka in :issue:" -"`12022` and :issue:`44471`.)" +"A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` " +"in :keyword:`with` statements and :meth:`contextlib.ExitStack.enter_context` " +"for objects that do not support the :term:`context manager` protocol, and " +"in :keyword:`async with` statements " +"and :meth:`contextlib.AsyncExitStack.enter_async_context` for objects not " +"supporting the :term:`asynchronous context manager` protocol. (Contributed " +"by Serhiy Storchaka in :issue:`12022` and :issue:`44471`.)" msgstr "" "現在在不支援 :term:`context manager` 協議的物件上使用 :keyword:`with` 陳述式" "和 :meth:`contextlib.ExitStack.enter_context` 或在不支援 :term:`asynchronous " -"context manager` 協議的物件上使用 :keyword:`async with` 陳述式和 :meth:" -"`contextlib.AsyncExitStack.enter_async_context`,會引發 :exc:`TypeError` 而不" -"是 :exc:`AttributeError`。(由 Serhiy Storchaka 在 :issue:`12022` 和 :issue:" -"`44471` 中貢獻。)" +"context manager` 協議的物件上使用 :keyword:`async with` 陳述式" +"和 :meth:`contextlib.AsyncExitStack.enter_async_context`,會引" +"發 :exc:`TypeError` 而不是 :exc:`AttributeError`。(由 Serhiy Storchaka " +"在 :issue:`12022` 和 :issue:`44471` 中貢獻。)" #: ../../whatsnew/3.11.rst:455 msgid "" "Added :meth:`object.__getstate__`, which provides the default implementation " "of the :meth:`!__getstate__` method. :mod:`copy`\\ing and :mod:`pickle`\\ing " -"instances of subclasses of builtin types :class:`bytearray`, :class:`set`, :" -"class:`frozenset`, :class:`collections.OrderedDict`, :class:`collections." -"deque`, :class:`weakref.WeakSet`, and :class:`datetime.tzinfo` now copies " -"and pickles instance attributes implemented as :term:`slots <__slots__>`. " -"This change has an unintended side effect: It trips up a small minority of " -"existing Python projects not expecting :meth:`object.__getstate__` to exist. " -"See the later comments on :gh:`70766` for discussions of what workarounds " -"such code may need. (Contributed by Serhiy Storchaka in :issue:`26579`.)" +"instances of subclasses of builtin " +"types :class:`bytearray`, :class:`set`, :class:`frozenset`, :class:`collections.OrderedDict`, :class:`collections.deque`, :class:`weakref.WeakSet`, " +"and :class:`datetime.tzinfo` now copies and pickles instance attributes " +"implemented as :term:`slots <__slots__>`. This change has an unintended side " +"effect: It trips up a small minority of existing Python projects not " +"expecting :meth:`object.__getstate__` to exist. See the later comments " +"on :gh:`70766` for discussions of what workarounds such code may need. " +"(Contributed by Serhiy Storchaka in :issue:`26579`.)" msgstr "" #: ../../whatsnew/3.11.rst:470 msgid "" "Added a :option:`-P` command line option and a :envvar:`PYTHONSAFEPATH` " -"environment variable, which disable the automatic prepending to :data:`sys." -"path` of the script's directory when running a script, or the current " -"directory when using :option:`-c` and :option:`-m`. This ensures only stdlib " -"and installed modules are picked up by :keyword:`import`, and avoids " -"unintentionally or maliciously shadowing modules with those in a local (and " -"typically user-writable) directory. (Contributed by Victor Stinner in :gh:" -"`57684`.)" +"environment variable, which disable the automatic prepending " +"to :data:`sys.path` of the script's directory when running a script, or the " +"current directory when using :option:`-c` and :option:`-m`. This ensures " +"only stdlib and installed modules are picked up by :keyword:`import`, and " +"avoids unintentionally or maliciously shadowing modules with those in a " +"local (and typically user-writable) directory. (Contributed by Victor " +"Stinner in :gh:`57684`.)" msgstr "" "新增了一個 :option:`-P` 命令列選項和一個 :envvar:`PYTHONSAFEPATH` 環境變數," "它們禁用了當使用 :option:`-c` 和 :option:`-m` 以在運行腳本或當前目錄時自動添" -"加到腳本目錄的 :data:`sys.path`。這確保只有 stdlib 和已安裝的模組會被 :" -"keyword:`import` 取用,以避免不小心或被惡意地將模組與本地(通常是使用者可寫入" -"的)目錄中的模組重疊。(由 Victor Stinner 在 :gh:`57684` 中貢獻。)" +"加到腳本目錄的 :data:`sys.path`。這確保只有 stdlib 和已安裝的模組會" +"被 :keyword:`import` 取用,以避免不小心或被惡意地將模組與本地(通常是使用者可" +"寫入的)目錄中的模組重疊。(由 Victor Stinner 在 :gh:`57684` 中貢獻。)" #: ../../whatsnew/3.11.rst:481 msgid "" @@ -797,10 +797,10 @@ msgid "" "Thomas Grainger in :gh:`91181`.)" msgstr "" ":data:`sys.path` 不再接受位元組。支援已在 Python 3.2 和 3.6 之間的某個時間停" -"止,直到 Python 3.10.0 發布後才引起人們的注意。此外,由於混合使用 :class:" -"`str` 和 :class:`bytes` 鍵時 :option:`-b` 和 :data:`sys.path_importer_cache` " -"會出現的交互作用,恢復這項支援會出現問題。(由 Thomas Grainger 在 :gh:" -"`91181` 中貢獻。)" +"止,直到 Python 3.10.0 發布後才引起人們的注意。此外,由於混合使" +"用 :class:`str` 和 :class:`bytes` 鍵時 :option:`-b` " +"和 :data:`sys.path_importer_cache` 會出現的交互作用,恢復這項支援會出現問題。" +"(由 Thomas Grainger 在 :gh:`91181` 中貢獻。)" #: ../../whatsnew/3.11.rst:497 msgid "Other CPython Implementation Changes" @@ -808,15 +808,15 @@ msgstr "其他 CPython 實作更動" #: ../../whatsnew/3.11.rst:499 msgid "" -"The special methods :meth:`~object.__complex__` for :class:`complex` and :" -"meth:`~object.__bytes__` for :class:`bytes` are implemented to support the :" -"class:`typing.SupportsComplex` and :class:`typing.SupportsBytes` protocols. " -"(Contributed by Mark Dickinson and Donghee Na in :issue:`24234`.)" +"The special methods :meth:`~object.__complex__` for :class:`complex` " +"and :meth:`~object.__bytes__` for :class:`bytes` are implemented to support " +"the :class:`typing.SupportsComplex` and :class:`typing.SupportsBytes` " +"protocols. (Contributed by Mark Dickinson and Donghee Na in :issue:`24234`.)" msgstr "" "為支援 :class:`typing.SupportsComplex` 與 :class:`typing.SupportsBytes` 協" -"定,實作了 :class:`complex` 與 :class:`bytes` 的特殊方法 :meth:`~object." -"__complex__` 與 :meth:`~object.__bytes__`。(由 Mark Dickinson 和 Donghee Na " -"於 :issue:`24234` 中所貢獻。)" +"定,實作了 :class:`complex` 與 :class:`bytes` 的特殊方" +"法 :meth:`~object.__complex__` 與 :meth:`~object.__bytes__`。(由 Mark " +"Dickinson 和 Donghee Na 於 :issue:`24234` 中所貢獻。)" #: ../../whatsnew/3.11.rst:504 msgid "" @@ -830,16 +830,16 @@ msgstr "" "新增 ``siphash13`` 以作為內部的雜湊演算法,它有與 ``siphash24`` 相似的安全特" "性,但是在處理較長的輸入時會更快一些。現在是 :class:`str`、:class:`bytes` 和" "一些其他型別的 :func:`hash` 預設演算法。:pep:`552` :ref:`基於雜湊的 .pyc 檔" -"案 <pyc-invalidation>` 現在也使用 ``siphash13``。(由 Inada Naoki 於 :issue:" -"`29410` 中貢獻。)" +"案 <pyc-invalidation>` 現在也使用 ``siphash13``。(由 Inada Naoki " +"於 :issue:`29410` 中貢獻。)" #: ../../whatsnew/3.11.rst:513 msgid "" "When an active exception is re-raised by a :keyword:`raise` statement with " -"no parameters, the traceback attached to this exception is now always ``sys." -"exc_info()[1].__traceback__``. This means that changes made to the traceback " -"in the current :keyword:`except` clause are reflected in the re-raised " -"exception. (Contributed by Irit Katriel in :issue:`45711`.)" +"no parameters, the traceback attached to this exception is now always " +"``sys.exc_info()[1].__traceback__``. This means that changes made to the " +"traceback in the current :keyword:`except` clause are reflected in the re-" +"raised exception. (Contributed by Irit Katriel in :issue:`45711`.)" msgstr "" "當一個仍有效的例外被 :keyword:`raise` 陳述式在沒有參數的情況下重新引發,被附" "於該例外的追蹤資訊現在都會是 ``sys.exc_info()[1].__traceback__``。這代表對於" @@ -876,9 +876,10 @@ msgid "" "initialize :data:`sys.path`. Otherwise, initialization will recalculate the " "path and replace any values added to ``module_search_paths``." msgstr "" -"初始化中若是要用 :c:member:`PyConfig.module_search_paths` 來初始化 :data:" -"`sys.path`,則現在 :c:member:`PyConfig.module_search_paths_set` 必須被設為 " -"1。否則,初始化會重新計算路徑並取代所有被加到 ``module_search_paths`` 的值。" +"初始化中若是要用 :c:member:`PyConfig.module_search_paths` 來初始" +"化 :data:`sys.path`,則現在 :c:member:`PyConfig.module_search_paths_set` 必須" +"被設為 1。否則,初始化會重新計算路徑並取代所有被加到 ``module_search_paths`` " +"的值。" #: ../../whatsnew/3.11.rst:536 msgid "" @@ -889,9 +890,9 @@ msgid "" "help-all`. (Contributed by Éric Araujo in :issue:`46142`.)" msgstr "" ":option:`--help` 選項的輸出現在會在 50 列、80 欄的大小之內,:ref:`Python 環境" -"變數 <using-on-envvars>`\\ 和 :option:`-X` 選項的資訊現在能夠分別透過 :" -"option:`--help-env` 和 :option:`--help-xoptions` 旗標與 :option:`--help-all` " -"一起使用來取得。(由 Éric Araujo 於 :issue:`46142` 中貢獻。)" +"變數 <using-on-envvars>`\\ 和 :option:`-X` 選項的資訊現在能夠分別透" +"過 :option:`--help-env` 和 :option:`--help-xoptions` 旗標與 :option:`--help-" +"all` 一起使用來取得。(由 Éric Araujo 於 :issue:`46142` 中貢獻。)" #: ../../whatsnew/3.11.rst:543 msgid "" @@ -907,11 +908,11 @@ msgid "" msgstr "" "在除 2(binary、二進制)、4、8(octal、八進制)、16(hexadecimal、十六進制)" "或 32 以外的基數中,例如以 10(decimal、十進制)為基數,進行 :class:`int` " -"和 :class:`str` 之間的轉換且字串形式的位數超過限制,現在會引發 :exc:" -"`ValueError`,以避免由於演算法複雜性而導致的潛在阻斷服務攻擊 (denial of " -"service attacks)。這是針對 :cve:`2020-10735` 的緩解措施,可以透過環境變數、命" -"令列旗標或 :mod:`sys` API 來設定或禁用此限制。請參閱\\ :ref:`整數字串轉換長度" -"限制 <int_max_str_digits>` 文件。預設限制為字串形式的 4300 位數字。" +"和 :class:`str` 之間的轉換且字串形式的位數超過限制,現在會引" +"發 :exc:`ValueError`,以避免由於演算法複雜性而導致的潛在阻斷服務攻擊 (denial " +"of service attacks)。這是針對 :cve:`2020-10735` 的緩解措施,可以透過環境變" +"數、命令列旗標或 :mod:`sys` API 來設定或禁用此限制。請參閱\\ :ref:`整數字串轉" +"換長度限制 <int_max_str_digits>` 文件。預設限制為字串形式的 4300 位數字。" #: ../../whatsnew/3.11.rst:557 msgid "New Modules" @@ -945,9 +946,9 @@ msgstr "asyncio" msgid "" "Added the :class:`~asyncio.TaskGroup` class, an :ref:`asynchronous context " "manager <async-context-managers>` holding a group of tasks that will wait " -"for all of them upon exit. For new code this is recommended over using :func:" -"`~asyncio.create_task` and :func:`~asyncio.gather` directly. (Contributed by " -"Yury Selivanov and others in :gh:`90908`.)" +"for all of them upon exit. For new code this is recommended over " +"using :func:`~asyncio.create_task` and :func:`~asyncio.gather` directly. " +"(Contributed by Yury Selivanov and others in :gh:`90908`.)" msgstr "" "添加了 :class:`~asyncio.TaskGroup` 類別,為一個會持有任務群組並在退出時等待全" "部完成的\\ :ref:`非同步情境管理器 (asynchronous context manager) <async-" @@ -959,8 +960,8 @@ msgstr "" msgid "" "Added :func:`~asyncio.timeout`, an asynchronous context manager for setting " "a timeout on asynchronous operations. For new code this is recommended over " -"using :func:`~asyncio.wait_for` directly. (Contributed by Andrew Svetlov in :" -"gh:`90927`.)" +"using :func:`~asyncio.wait_for` directly. (Contributed by Andrew Svetlov " +"in :gh:`90927`.)" msgstr "" "新增 :func:`~asyncio.timeout`,是一個用來為一個非同步操作設置超時的非同步情境" "管理器,新的程式建議直接使用它以取代 :func:`~asyncio.wait_for`。(由 Andrew " @@ -986,9 +987,9 @@ msgstr "" #: ../../whatsnew/3.11.rst:599 msgid "" -"Added keyword argument *all_errors* to :meth:`asyncio.loop." -"create_connection` so that multiple connection errors can be raised as an :" -"exc:`ExceptionGroup`." +"Added keyword argument *all_errors* " +"to :meth:`asyncio.loop.create_connection` so that multiple connection errors " +"can be raised as an :exc:`ExceptionGroup`." msgstr "" "在 :meth:`asyncio.loop.create_connection` 新增關鍵字引數 *all_errors*,這樣多" "個連接錯誤就可以一起用一個 :exc:`ExceptionGroup` 來引發。" @@ -996,25 +997,27 @@ msgstr "" #: ../../whatsnew/3.11.rst:602 msgid "" "Added the :meth:`asyncio.StreamWriter.start_tls` method for upgrading " -"existing stream-based connections to TLS. (Contributed by Ian Good in :issue:" -"`34975`.)" +"existing stream-based connections to TLS. (Contributed by Ian Good " +"in :issue:`34975`.)" msgstr "" "新增 :meth:`asyncio.StreamWriter.start_tls` 方法,用來將已存在的串流連線升級" "至 TLS。(由 Ian Good 於 :issue:`34975` 中貢獻。)" #: ../../whatsnew/3.11.rst:606 msgid "" -"Added raw datagram socket functions to the event loop: :meth:`~asyncio.loop." -"sock_sendto`, :meth:`~asyncio.loop.sock_recvfrom` and :meth:`~asyncio.loop." -"sock_recvfrom_into`. These have implementations in :class:`~asyncio." -"SelectorEventLoop` and :class:`~asyncio.ProactorEventLoop`. (Contributed by " -"Alex Grönholm in :issue:`46805`.)" +"Added raw datagram socket functions to the event " +"loop: :meth:`~asyncio.loop.sock_sendto`, :meth:`~asyncio.loop.sock_recvfrom` " +"and :meth:`~asyncio.loop.sock_recvfrom_into`. These have implementations " +"in :class:`~asyncio.SelectorEventLoop` " +"and :class:`~asyncio.ProactorEventLoop`. (Contributed by Alex Grönholm " +"in :issue:`46805`.)" msgstr "" -"在事件迴圈增加原始資料元 (raw datagram) socket 函式::meth:`~asyncio.loop." -"sock_sendto`、:meth:`~asyncio.loop.sock_recvfrom` 和 :meth:`~asyncio.loop." -"sock_recvfrom_into`。以上在 :class:`~asyncio.SelectorEventLoop` 和 :class:" -"`~asyncio.ProactorEventLoop` 中都有實作。(由 Alex Grönholm 在 :issue:" -"`46805` 中貢獻。)" +"在事件迴圈增加原始資料元 (raw datagram) socket 函" +"式::meth:`~asyncio.loop.sock_sendto`、:meth:`~asyncio.loop.sock_recvfrom` " +"和 :meth:`~asyncio.loop.sock_recvfrom_into`。以上" +"在 :class:`~asyncio.SelectorEventLoop` " +"和 :class:`~asyncio.ProactorEventLoop` 中都有實作。(由 Alex Grönholm " +"在 :issue:`46805` 中貢獻。)" #: ../../whatsnew/3.11.rst:614 msgid "" @@ -1022,9 +1025,9 @@ msgid "" "methods to :class:`~asyncio.Task`. These are primarily intended for internal " "use, notably by :class:`~asyncio.TaskGroup`." msgstr "" -"於 :class:`~asyncio.Task` 新增 :meth:`~asyncio.Task.cancelling` 和 :meth:" -"`~asyncio.Task.uncancel` 方法。這些預期是只用於內部,尤其是 :class:`~asyncio." -"TaskGroup`。" +"於 :class:`~asyncio.Task` 新增 :meth:`~asyncio.Task.cancelling` " +"和 :meth:`~asyncio.Task.uncancel` 方法。這些預期是只用於內部,尤其" +"是 :class:`~asyncio.TaskGroup`。" #: ../../whatsnew/3.11.rst:623 msgid "contextlib" @@ -1037,8 +1040,8 @@ msgid "" "around :func:`~os.chdir`. (Contributed by Filipe Laíns in :issue:`25625`)" msgstr "" "添加了非平行安全的 :func:`~contextlib.chdir` 情境管理器來更改當前工作目錄,然" -"後在退出時恢復它。:func:`~os.chdir` 的簡單包裝器。(由 Filipe Laíns 在 :" -"issue:`25625` 中貢獻)" +"後在退出時恢復它。:func:`~os.chdir` 的簡單包裝器。(由 Filipe Laíns " +"在 :issue:`25625` 中貢獻)" #: ../../whatsnew/3.11.rst:633 msgid "dataclasses" @@ -1046,10 +1049,10 @@ msgstr "dataclasses" #: ../../whatsnew/3.11.rst:635 msgid "" -"Change field default mutability check, allowing only defaults which are :" -"term:`hashable` instead of any object which is not an instance of :class:" -"`dict`, :class:`list` or :class:`set`. (Contributed by Eric V. Smith in :" -"issue:`44674`.)" +"Change field default mutability check, allowing only defaults which " +"are :term:`hashable` instead of any object which is not an instance " +"of :class:`dict`, :class:`list` or :class:`set`. (Contributed by Eric V. " +"Smith in :issue:`44674`.)" msgstr "" "更改欄位預設的可變性檢查 (mutability check),僅允許預設值是 :term:`hashable` " "而不是任何非 :class:`dict`、:class:`list` 或 :class:`set` 實例的物件。(由 " @@ -1061,8 +1064,9 @@ msgstr "datetime" #: ../../whatsnew/3.11.rst:646 msgid "" -"Add :const:`datetime.UTC`, a convenience alias for :attr:`datetime.timezone." -"utc`. (Contributed by Kabir Kwatra in :gh:`91973`.)" +"Add :const:`datetime.UTC`, a convenience alias " +"for :attr:`datetime.timezone.utc`. (Contributed by Kabir Kwatra " +"in :gh:`91973`.)" msgstr "" "新增 :const:`datetime.UTC`,一個 :attr:`datetime.timezone.utc` 的方便別名。" "(由 Kabir Kwatra 於 :gh:`91973` 所貢獻。)" @@ -1074,10 +1078,10 @@ msgid "" "ISO 8601 formats (barring only those that support fractional hours and " "minutes). (Contributed by Paul Ganssle in :gh:`80010`.)" msgstr "" -":meth:`datetime.date.fromisoformat`、:meth:`datetime.time.fromisoformat` 和 :" -"meth:`datetime.datetime.fromisoformat` 現在可以用來剖析大部分的 ISO 8601 格式" -"(除了那些支援分數形式的小時與分鐘)。(由 Paul Ganssle 於 :gh:`80010` 中所貢" -"獻。)" +":meth:`datetime.date.fromisoformat`、:meth:`datetime.time.fromisoformat` " +"和 :meth:`datetime.datetime.fromisoformat` 現在可以用來剖析大部分的 ISO 8601 " +"格式(除了那些支援分數形式的小時與分鐘)。(由 Paul Ganssle 於 :gh:`80010` 中" +"所貢獻。)" #: ../../whatsnew/3.11.rst:658 msgid "enum" @@ -1099,44 +1103,45 @@ msgstr "增加 :class:`~enum.StrEnum`,列舉 (enum) 內的成員必須是字 #: ../../whatsnew/3.11.rst:666 msgid "" -"Added :class:`~enum.ReprEnum`, which only modifies the :meth:`~object." -"__repr__` of members while returning their literal values (rather than " -"names) for :meth:`~object.__str__` and :meth:`~object.__format__` (used by :" -"func:`str`, :func:`format` and :term:`f-string`\\s)." +"Added :class:`~enum.ReprEnum`, which only modifies " +"the :meth:`~object.__repr__` of members while returning their literal values " +"(rather than names) for :meth:`~object.__str__` " +"and :meth:`~object.__format__` (used by :func:`str`, :func:`format` " +"and :term:`f-string`\\s)." msgstr "" "新增 :class:`~enum.ReprEnum`,它只修改成員的 :meth:`~object.__repr__`,同時回" -"傳成員的文本值 (literal value)(而不是名稱),以用於(為 :func:`str`、:func:" -"`format` 和 :term:`f-string` 所使用的)\\ :meth:`~object.__str__` 和 :meth:" -"`~object.__format__`。" +"傳成員的文本值 (literal value)(而不是名稱),以用於" +"(為 :func:`str`、:func:`format` 和 :term:`f-string` 所使用的)" +"\\ :meth:`~object.__str__` 和 :meth:`~object.__format__`。" #: ../../whatsnew/3.11.rst:672 msgid "" -"Changed :meth:`Enum.__format__() <enum.Enum.__format__>` (the default for :" -"func:`format`, :meth:`str.format` and :term:`f-string`\\s) to always produce " -"the same result as :meth:`Enum.__str__() <enum.Enum.__str__>`: for enums " -"inheriting from :class:`~enum.ReprEnum` it will be the member's value; for " -"all other enums it will be the enum and member name (e.g. ``Color.RED``)." +"Changed :meth:`Enum.__format__() <enum.Enum.__format__>` (the default " +"for :func:`format`, :meth:`str.format` and :term:`f-string`\\s) to always " +"produce the same result as :meth:`Enum.__str__() <enum.Enum.__str__>`: for " +"enums inheriting from :class:`~enum.ReprEnum` it will be the member's value; " +"for all other enums it will be the enum and member name (e.g. ``Color.RED``)." msgstr "" -"改變了 :meth:`Enum.__format__() <enum.Enum.__format__>` (被 :func:" -"`format`、:meth:`str.format` 和 :term:`f-string` 預設使用),以使其與 :meth:" -"`enum.Enum.__str__ <enum.Enum.__str__>` 產生相同結果:對於繼承自 :class:" -"`~enum.ReprEnum` 的列舉,這會是成員之值;而其他的列舉會是列舉與成員名稱(例" -"如 ``Color.RED``)。" +"改變了 :meth:`Enum.__format__() <enum.Enum.__format__>` " +"(被 :func:`format`、:meth:`str.format` 和 :term:`f-string` 預設使用),以使" +"其與 :meth:`enum.Enum.__str__ <enum.Enum.__str__>` 產生相同結果:對於繼承" +"自 :class:`~enum.ReprEnum` 的列舉,這會是成員之值;而其他的列舉會是列舉與成員" +"名稱(例如 ``Color.RED``)。" #: ../../whatsnew/3.11.rst:678 msgid "" -"Added a new *boundary* class parameter to :class:`~enum.Flag` enums and the :" -"class:`~enum.FlagBoundary` enum with its options, to control how to handle " -"out-of-range flag values." +"Added a new *boundary* class parameter to :class:`~enum.Flag` enums and " +"the :class:`~enum.FlagBoundary` enum with its options, to control how to " +"handle out-of-range flag values." msgstr "" -"新增 *boundary* 類別參數與其選項到 :class:`~enum.Flag` 列舉和 :class:`~enum." -"FlagBoundary` 列舉以控制處理超出範圍旗標數值的方法。" +"新增 *boundary* 類別參數與其選項到 :class:`~enum.Flag` 列舉" +"和 :class:`~enum.FlagBoundary` 列舉以控制處理超出範圍旗標數值的方法。" #: ../../whatsnew/3.11.rst:682 msgid "" -"Added the :func:`~enum.verify` enum decorator and the :class:`~enum." -"EnumCheck` enum with its options, to check enum classes against several " -"specific constraints." +"Added the :func:`~enum.verify` enum decorator and " +"the :class:`~enum.EnumCheck` enum with its options, to check enum classes " +"against several specific constraints." msgstr "" "新增了 :func:`~enum.verify` 列舉裝飾器和 :class:`~enum.EnumCheck` 列舉及其選" "項,以根據幾個特定限制檢查列舉類別。" @@ -1151,34 +1156,35 @@ msgstr "" #: ../../whatsnew/3.11.rst:689 msgid "" -"Added the :func:`~enum.property` decorator, which works like :func:" -"`property` except for enums. Use this instead of :func:`types." -"DynamicClassAttribute`." +"Added the :func:`~enum.property` decorator, which works " +"like :func:`property` except for enums. Use this instead " +"of :func:`types.DynamicClassAttribute`." msgstr "" "新增 :func:`~enum.property` 裝飾器,它的作用類似 :func:`property` 但是是用於" "列舉,用以替代 :func:`types.DynamicClassAttribute`。" #: ../../whatsnew/3.11.rst:693 msgid "" -"Added the :func:`~enum.global_enum` enum decorator, which adjusts :meth:" -"`~object.__repr__` and :meth:`~object.__str__` to show values as members of " -"their module rather than the enum class. For example, ``'re.ASCII'`` for " -"the :const:`~re.ASCII` member of :class:`re.RegexFlag` rather than " -"``'RegexFlag.ASCII'``." +"Added the :func:`~enum.global_enum` enum decorator, which " +"adjusts :meth:`~object.__repr__` and :meth:`~object.__str__` to show values " +"as members of their module rather than the enum class. For example, " +"``'re.ASCII'`` for the :const:`~re.ASCII` member of :class:`re.RegexFlag` " +"rather than ``'RegexFlag.ASCII'``." msgstr "" "新增 :func:`~enum.global_enum` 列舉裝飾器,用來調整 :meth:`~object.__repr__` " -"和 :meth:`~object.__str__` 以模組成員形式而非列舉類別來顯示值。例如,:class:" -"`re.RegexFlag` 的 :const:`~re.ASCII` 成員的 ``'re.ASCII'``,而非 " +"和 :meth:`~object.__str__` 以模組成員形式而非列舉類別來顯示值。例" +"如,:class:`re.RegexFlag` 的 :const:`~re.ASCII` 成員的 ``'re.ASCII'``,而非 " "``'RegexFlag.ASCII'``。" #: ../../whatsnew/3.11.rst:699 msgid "" -"Enhanced :class:`~enum.Flag` to support :func:`len`, iteration and :keyword:" -"`in`/:keyword:`not in` on its members. For example, the following now works: " -"``len(AFlag(3)) == 2 and list(AFlag(3)) == (AFlag.ONE, AFlag.TWO)``" +"Enhanced :class:`~enum.Flag` to support :func:`len`, iteration " +"and :keyword:`in`/:keyword:`not in` on its members. For example, the " +"following now works: ``len(AFlag(3)) == 2 and list(AFlag(3)) == (AFlag.ONE, " +"AFlag.TWO)``" msgstr "" -"強化 :class:`~enum.Flag` 以支援使用 :func:`len`、疊代 (iteration) 和 :" -"keyword:`in`/:keyword:`not in` 於其成員。例如,以下程式現在能夠作用了:" +"強化 :class:`~enum.Flag` 以支援使用 :func:`len`、疊代 (iteration) " +"和 :keyword:`in`/:keyword:`not in` 於其成員。例如,以下程式現在能夠作用了:" "``len(AFlag(3)) == 2 and list(AFlag(3)) == (AFlag.ONE, AFlag.TWO)``" #: ../../whatsnew/3.11.rst:704 @@ -1187,9 +1193,9 @@ msgid "" "defined before :meth:`~object.__init_subclass__` is called; :func:`dir` now " "includes methods, etc., from mixed-in data types." msgstr "" -"更改了 :class:`~enum.Enum` 和 :class:`~enum.Flag` 以在呼叫 :meth:`~object." -"__init_subclass__` 之前就定義成員;:func:`dir` 現在包括來自混合資料型別的方" -"法。" +"更改了 :class:`~enum.Enum` 和 :class:`~enum.Flag` 以在呼" +"叫 :meth:`~object.__init_subclass__` 之前就定義成員;:func:`dir` 現在包括來自" +"混合資料型別的方法。" #: ../../whatsnew/3.11.rst:709 msgid "" @@ -1242,11 +1248,11 @@ msgstr "functools" #: ../../whatsnew/3.11.rst:743 msgid "" -":func:`functools.singledispatch` now supports :data:`types.UnionType` and :" -"data:`typing.Union` as annotations to the dispatch argument.::" +":func:`functools.singledispatch` now supports :data:`types.UnionType` " +"and :data:`typing.Union` as annotations to the dispatch argument.::" msgstr "" -":func:`functools.singledispatch` 現在支援 :data:`types.UnionType` 和 :data:" -"`typing.Union` 作為調度 (dispatch) 引數的標註。 ::" +":func:`functools.singledispatch` 現在支援 :data:`types.UnionType` " +"和 :data:`typing.Union` 作為調度 (dispatch) 引數的標註。 ::" #: ../../whatsnew/3.11.rst:746 msgid "" @@ -1272,6 +1278,27 @@ msgid "" "... print(i, elem)\n" "..." msgstr "" +">>> from functools import singledispatch\n" +">>> @singledispatch\n" +"... def fun(arg, verbose=False):\n" +"... if verbose:\n" +"... print(\"Let me just say,\", end=\" \")\n" +"... print(arg)\n" +"...\n" +">>> @fun.register\n" +"... def _(arg: int | float, verbose=False):\n" +"... if verbose:\n" +"... print(\"Strength in numbers, eh?\", end=\" \")\n" +"... print(arg)\n" +"...\n" +">>> from typing import Union\n" +">>> @fun.register\n" +"... def _(arg: Union[list, set], verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)\n" +"..." #: ../../whatsnew/3.11.rst:768 msgid "(Contributed by Yurii Karabas in :issue:`46014`.)" @@ -1284,13 +1311,14 @@ msgstr "gzip" #: ../../whatsnew/3.11.rst:776 msgid "" "The :func:`gzip.compress` function is now faster when used with the " -"**mtime=0** argument as it delegates the compression entirely to a single :" -"func:`zlib.compress` operation. There is one side effect of this change: The " -"gzip file header contains an \"OS\" byte in its header. That was " -"traditionally always set to a value of 255 representing \"unknown\" by the :" -"mod:`gzip` module. Now, when using :func:`~gzip.compress` with **mtime=0**, " -"it may be set to a different value by the underlying zlib C library Python " -"was linked against. (See :gh:`112346` for details on the side effect.)" +"**mtime=0** argument as it delegates the compression entirely to a " +"single :func:`zlib.compress` operation. There is one side effect of this " +"change: The gzip file header contains an \"OS\" byte in its header. That was " +"traditionally always set to a value of 255 representing \"unknown\" by " +"the :mod:`gzip` module. Now, when using :func:`~gzip.compress` with " +"**mtime=0**, it may be set to a different value by the underlying zlib C " +"library Python was linked against. (See :gh:`112346` for details on the side " +"effect.)" msgstr "" #: ../../whatsnew/3.11.rst:789 @@ -1344,8 +1372,8 @@ msgid "" "Include prompts when saving Shell with inputs and outputs. (Contributed by " "Terry Jan Reedy in :gh:`95191`.)" msgstr "" -"當帶有輸入與輸出地儲存 Shell 時,也會包含提示字元。(由 Terry Jan Reedy 於 :" -"gh:`95191` 中所貢獻。)" +"當帶有輸入與輸出地儲存 Shell 時,也會包含提示字元。(由 Terry Jan Reedy " +"於 :gh:`95191` 中所貢獻。)" #: ../../whatsnew/3.11.rst:822 msgid "inspect" @@ -1364,11 +1392,12 @@ msgstr "" #: ../../whatsnew/3.11.rst:828 msgid "" "Add :func:`~inspect.ismethodwrapper` for checking if the type of an object " -"is a :class:`~types.MethodWrapperType`. (Contributed by Hakan Çelik in :" -"issue:`29418`.)" +"is a :class:`~types.MethodWrapperType`. (Contributed by Hakan Çelik " +"in :issue:`29418`.)" msgstr "" -"新增 :func:`inspect.ismethodwrapper`,用來檢查一個物件的型別是否為 :class:" -"`~types.MethodWrapperType`。(由 Hakan Çelik 於 :issue:`29418` 中所貢獻。)" +"新增 :func:`inspect.ismethodwrapper`,用來檢查一個物件的型別是否" +"為 :class:`~types.MethodWrapperType`。(由 Hakan Çelik 於 :issue:`29418` 中所" +"貢獻。)" #: ../../whatsnew/3.11.rst:832 msgid "" @@ -1378,10 +1407,10 @@ msgid "" "interfaces) that includes the extended :pep:`657` position information (end " "line number, column and end column). The affected functions are:" msgstr "" -"更改 :mod:`inspect` 模組中與幀相關的函式以回傳新的 :class:`~inspect." -"FrameInfo` 和 :class:`~inspect.Traceback` 類別實例(向後相容之前類似於 :term:" -"`named tuple` 的介面),包括擴充的 :pep:`657` 位置資訊(結束行號、欄和結束" -"欄)。受影響的功能是:" +"更改 :mod:`inspect` 模組中與幀相關的函式以回傳新" +"的 :class:`~inspect.FrameInfo` 和 :class:`~inspect.Traceback` 類別實例(向後" +"相容之前類似於 :term:`named tuple` 的介面),包括擴充的 :pep:`657` 位置資訊" +"(結束行號、欄和結束欄)。受影響的功能是:" #: ../../whatsnew/3.11.rst:838 msgid ":func:`inspect.getframeinfo`" @@ -1414,8 +1443,8 @@ msgstr "locale" #: ../../whatsnew/3.11.rst:852 msgid "" "Add :func:`locale.getencoding` to get the current locale encoding. It is " -"similar to ``locale.getpreferredencoding(False)`` but ignores the :ref:" -"`Python UTF-8 Mode <utf8-mode>`." +"similar to ``locale.getpreferredencoding(False)`` but ignores " +"the :ref:`Python UTF-8 Mode <utf8-mode>`." msgstr "" "新增 :func:`locale.getencoding` 以取得當前的區域編碼 (locale encoding)。和 " "``locale.getpreferredencoding(False)`` 類似但不考慮 :ref:`Python UTF-8 模式 " @@ -1428,9 +1457,9 @@ msgstr "logging" #: ../../whatsnew/3.11.rst:862 msgid "" "Added :func:`~logging.getLevelNamesMapping` to return a mapping from logging " -"level names (e.g. ``'CRITICAL'``) to the values of their corresponding :ref:" -"`levels` (e.g. ``50``, by default). (Contributed by Andrei Kulakovin in :gh:" -"`88024`.)" +"level names (e.g. ``'CRITICAL'``) to the values of their " +"corresponding :ref:`levels` (e.g. ``50``, by default). (Contributed by " +"Andrei Kulakovin in :gh:`88024`.)" msgstr "" "新增 :func:`~logging.getLevelNamesMapping` 以回傳一個日誌級別名稱(例如 " "``'CRITICAL'``)指到對應的 :ref:`levels` 數值(例如,預設為 ``50``)的對映。" @@ -1438,17 +1467,19 @@ msgstr "" #: ../../whatsnew/3.11.rst:867 msgid "" -"Added a :meth:`~logging.handlers.SysLogHandler.createSocket` method to :" -"class:`~logging.handlers.SysLogHandler`, to match :meth:`SocketHandler." -"createSocket() <logging.handlers.SocketHandler.createSocket>`. It is called " -"automatically during handler initialization and when emitting an event, if " -"there is no active socket. (Contributed by Kirill Pinchuk in :gh:`88457`.)" +"Added a :meth:`~logging.handlers.SysLogHandler.createSocket` method " +"to :class:`~logging.handlers.SysLogHandler`, to " +"match :meth:`SocketHandler.createSocket() " +"<logging.handlers.SocketHandler.createSocket>`. It is called automatically " +"during handler initialization and when emitting an event, if there is no " +"active socket. (Contributed by Kirill Pinchuk in :gh:`88457`.)" msgstr "" -"添加了一個 :meth:`~logging.handlers.SysLogHandler.createSocket` 方法到 :" -"class:`~logging.handlers.SysLogHandler`,以匹配 :meth:`SocketHandler." -"createSocket() <logging.handlers.SocketHandler.createSocket>` 。如果沒有已啟" -"用的 socket,它會在處理程式初始化期間和發出一個事件時自動呼叫。(由 Kirill " -"Pinchuk 在 :gh:`88457` 中貢獻。)" +"添加了一個 :meth:`~logging.handlers.SysLogHandler.createSocket` 方法" +"到 :class:`~logging.handlers.SysLogHandler`,以匹" +"配 :meth:`SocketHandler.createSocket() " +"<logging.handlers.SocketHandler.createSocket>` 。如果沒有已啟用的 socket,它" +"會在處理程式初始化期間和發出一個事件時自動呼叫。(由 Kirill Pinchuk " +"在 :gh:`88457` 中貢獻。)" #: ../../whatsnew/3.11.rst:879 msgid "math" @@ -1459,29 +1490,29 @@ msgid "" "Add :func:`math.exp2`: return 2 raised to the power of x. (Contributed by " "Gideon Mitchell in :issue:`45917`.)" msgstr "" -"新增 :func:`math.exp2`:回傳 2 的 x 次方。(由 Gideon Mitchell 於 :issue:" -"`45917` 中所貢獻。)" +"新增 :func:`math.exp2`:回傳 2 的 x 次方。(由 Gideon Mitchell " +"於 :issue:`45917` 中所貢獻。)" #: ../../whatsnew/3.11.rst:884 msgid "" "Add :func:`math.cbrt`: return the cube root of x. (Contributed by Ajith " "Ramachandran in :issue:`44357`.)" msgstr "" -"新增 :func:`math.cbrt`:回傳 x 的立方根。(由 Ajith Ramachandran 於 :issue:" -"`44357` 中所貢獻。)" +"新增 :func:`math.cbrt`:回傳 x 的立方根。(由 Ajith Ramachandran " +"於 :issue:`44357` 中所貢獻。)" #: ../../whatsnew/3.11.rst:887 msgid "" "The behaviour of two :func:`math.pow` corner cases was changed, for " -"consistency with the IEEE 754 specification. The operations ``math.pow(0.0, -" -"math.inf)`` and ``math.pow(-0.0, -math.inf)`` now return ``inf``. Previously " -"they raised :exc:`ValueError`. (Contributed by Mark Dickinson in :issue:" -"`44339`.)" +"consistency with the IEEE 754 specification. The operations ``math.pow(0.0, " +"-math.inf)`` and ``math.pow(-0.0, -math.inf)`` now return ``inf``. " +"Previously they raised :exc:`ValueError`. (Contributed by Mark Dickinson " +"in :issue:`44339`.)" msgstr "" "為了與 IEEE 754 規範保持一致,更改了兩個 :func:`math.pow` 邊角案例 (corner " "case) 的行為。``math.pow(0.0, -math.inf)`` 和 ``math.pow(-0.0, -math.inf)`` " -"現在回傳 ``inf``,之前它們會引發 :exc:`ValueError`。(由 Mark Dickinson 在 :" -"issue:`44339` 中貢獻。)" +"現在回傳 ``inf``,之前它們會引發 :exc:`ValueError`。(由 Mark Dickinson " +"在 :issue:`44339` 中貢獻。)" #: ../../whatsnew/3.11.rst:893 msgid "" @@ -1497,9 +1528,9 @@ msgstr "operator" #: ../../whatsnew/3.11.rst:902 msgid "" -"A new function ``operator.call`` has been added, such that ``operator." -"call(obj, *args, **kwargs) == obj(*args, **kwargs)``. (Contributed by Antony " -"Lee in :issue:`44019`.)" +"A new function ``operator.call`` has been added, such that " +"``operator.call(obj, *args, **kwargs) == obj(*args, **kwargs)``. " +"(Contributed by Antony Lee in :issue:`44019`.)" msgstr "" "新增 ``operator.call`` 函式,使得 ``operator.call(obj, *args, **kwargs) == " "obj(*args, **kwargs)``。(由 Antony Lee 於 :issue:`44019` 中所貢獻。)" @@ -1511,8 +1542,8 @@ msgstr "os" #: ../../whatsnew/3.11.rst:912 msgid "" "On Windows, :func:`os.urandom` now uses ``BCryptGenRandom()``, instead of " -"``CryptGenRandom()`` which is deprecated. (Contributed by Donghee Na in :" -"issue:`44611`.)" +"``CryptGenRandom()`` which is deprecated. (Contributed by Donghee Na " +"in :issue:`44611`.)" msgstr "" "在 Windows 上,:func:`os.urandom` 現在使用 ``BCryptGenRandom()`` 以取代被棄用" "的 ``CryptGenRandom()``。(由 Donghee Na 於 :issue:`44611` 中所貢獻。)" @@ -1524,9 +1555,9 @@ msgstr "pathlib" #: ../../whatsnew/3.11.rst:922 msgid "" ":meth:`~pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` return only " -"directories if *pattern* ends with a pathname components separator: :data:" -"`~os.sep` or :data:`~os.altsep`. (Contributed by Eisuke Kawasima in :issue:" -"`22276` and :issue:`33392`.)" +"directories if *pattern* ends with a pathname components " +"separator: :data:`~os.sep` or :data:`~os.altsep`. (Contributed by Eisuke " +"Kawasima in :issue:`22276` and :issue:`33392`.)" msgstr "" "如果 *pattern* 以路徑名稱元件分隔符號 :data:`~os.sep` 或 :data:`~os.altsep` " "結尾,:meth:`~pathlib.Path.glob` 和 :meth:`~pathlib.Path.rglob` 只回傳目錄。" @@ -1544,8 +1575,8 @@ msgid "" msgstr "" "現在規則運算式 (regular expression) 是有支援原子性群組 (atomic grouping) " "(``(?>...)``) 和佔有性量詞 (possessive quantifier) (``*+``, ``++``, ``?+``, " -"``{m,n}+``) 的。(由 Jeffrey C. Jacobs 和 Serhiy Storchaka 在 :issue:" -"`433030` 中貢獻。)" +"``{m,n}+``) 的。(由 Jeffrey C. Jacobs 和 Serhiy Storchaka " +"在 :issue:`433030` 中貢獻。)" #: ../../whatsnew/3.11.rst:941 msgid "shutil" @@ -1556,8 +1587,8 @@ msgid "" "Add optional parameter *dir_fd* in :func:`shutil.rmtree`. (Contributed by " "Serhiy Storchaka in :issue:`46245`.)" msgstr "" -"新增 :func:`shutil.rmtree` 的可選參數 *dir_fd*。(由 Serhiy Storchaka 於 :" -"issue:`46245` 中所貢獻。)" +"新增 :func:`shutil.rmtree` 的可選參數 *dir_fd*。(由 Serhiy Storchaka " +"於 :issue:`46245` 中所貢獻。)" #: ../../whatsnew/3.11.rst:950 msgid "socket" @@ -1565,8 +1596,8 @@ msgstr "socket" #: ../../whatsnew/3.11.rst:952 msgid "" -"Add CAN Socket support for NetBSD. (Contributed by Thomas Klausner in :issue:" -"`30512`.)" +"Add CAN Socket support for NetBSD. (Contributed by Thomas Klausner " +"in :issue:`30512`.)" msgstr "" "新增 NetBSD 對於 CAN Socket 的支援。(由 Thomas Klausner 於 :issue:`30512` 中" "所貢獻。)" @@ -1578,8 +1609,8 @@ msgid "" "raising the last error. (Contributed by Irit Katriel in :issue:`29980`.)" msgstr "" "當連接失敗時,:meth:`~socket.create_connection` 有個選項可以引發一個包含所有" -"錯誤的 :exc:`ExceptionGroup`,而非只引發最後一個錯誤。(由 Irit Katriel 於 :" -"issue:`29980` 中貢獻。)" +"錯誤的 :exc:`ExceptionGroup`,而非只引發最後一個錯誤。(由 Irit Katriel " +"於 :issue:`29980` 中貢獻。)" #: ../../whatsnew/3.11.rst:964 msgid "sqlite3" @@ -1587,48 +1618,49 @@ msgstr "sqlite3" #: ../../whatsnew/3.11.rst:966 msgid "" -"You can now disable the authorizer by passing :const:`None` to :meth:" -"`~sqlite3.Connection.set_authorizer`. (Contributed by Erlend E. Aasland in :" -"issue:`44491`.)" +"You can now disable the authorizer by passing :const:`None` " +"to :meth:`~sqlite3.Connection.set_authorizer`. (Contributed by Erlend E. " +"Aasland in :issue:`44491`.)" msgstr "" -"現在可以透過將 :const:`None` 傳遞給 :meth:`~sqlite3.Connection." -"set_authorizer` 來停用 authorizer。(由 Erlend E. Aasland 於 :issue:`44491` " -"中貢獻。)" +"現在可以透過將 :const:`None` 傳遞" +"給 :meth:`~sqlite3.Connection.set_authorizer` 來停用 authorizer。(由 " +"Erlend E. Aasland 於 :issue:`44491` 中貢獻。)" #: ../../whatsnew/3.11.rst:970 msgid "" "Collation name :meth:`~sqlite3.Connection.create_collation` can now contain " -"any Unicode character. Collation names with invalid characters now raise :" -"exc:`UnicodeEncodeError` instead of :exc:`sqlite3.ProgrammingError`. " +"any Unicode character. Collation names with invalid characters now " +"raise :exc:`UnicodeEncodeError` instead of :exc:`sqlite3.ProgrammingError`. " "(Contributed by Erlend E. Aasland in :issue:`44688`.)" msgstr "" "定序 (collation) 名稱 :meth:`~sqlite3.Connection.create_collation` 現在可以包" -"含任何 Unicode 字元。帶有無效字元的定序名稱現在會引發 :exc:" -"`UnicodeEncodeError` 而不是 :exc:`sqlite3.ProgrammingError`。(由 Erlend E. " -"Aasland 在 :issue:`44688` 中貢獻。)" +"含任何 Unicode 字元。帶有無效字元的定序名稱現在會引" +"發 :exc:`UnicodeEncodeError` 而不是 :exc:`sqlite3.ProgrammingError`。(由 " +"Erlend E. Aasland 在 :issue:`44688` 中貢獻。)" #: ../../whatsnew/3.11.rst:975 msgid "" -":mod:`sqlite3` exceptions now include the SQLite extended error code as :" -"attr:`~sqlite3.Error.sqlite_errorcode` and the SQLite error name as :attr:" -"`~sqlite3.Error.sqlite_errorname`. (Contributed by Aviv Palivoda, Daniel " -"Shahaf, and Erlend E. Aasland in :issue:`16379` and :issue:`24139`.)" +":mod:`sqlite3` exceptions now include the SQLite extended error code " +"as :attr:`~sqlite3.Error.sqlite_errorcode` and the SQLite error name " +"as :attr:`~sqlite3.Error.sqlite_errorname`. (Contributed by Aviv Palivoda, " +"Daniel Shahaf, and Erlend E. Aasland in :issue:`16379` and :issue:`24139`.)" msgstr "" -":mod:`sqlite3` 例外現在包含 SQLite 擴充錯誤碼和 SQLite 錯誤名稱(分別為 :" -"attr:`~sqlite3.Error.sqlite_errorcode` 和 :attr:`~sqlite3.Error." -"sqlite_errorname`)。(由 Aviv Palivoda、Daniel Shahaf 和 Erlend E. Aasland " -"在 :issue:`16379` 和 :issue:`24139` 中貢獻。)" +":mod:`sqlite3` 例外現在包含 SQLite 擴充錯誤碼和 SQLite 錯誤名稱(分別" +"為 :attr:`~sqlite3.Error.sqlite_errorcode` " +"和 :attr:`~sqlite3.Error.sqlite_errorname`)。(由 Aviv Palivoda、Daniel " +"Shahaf 和 Erlend E. Aasland 在 :issue:`16379` 和 :issue:`24139` 中貢獻。)" #: ../../whatsnew/3.11.rst:981 msgid "" -"Add :meth:`~sqlite3.Connection.setlimit` and :meth:`~sqlite3.Connection." -"getlimit` to :class:`sqlite3.Connection` for setting and getting SQLite " -"limits by connection basis. (Contributed by Erlend E. Aasland in :issue:" -"`45243`.)" +"Add :meth:`~sqlite3.Connection.setlimit` " +"and :meth:`~sqlite3.Connection.getlimit` to :class:`sqlite3.Connection` for " +"setting and getting SQLite limits by connection basis. (Contributed by " +"Erlend E. Aasland in :issue:`45243`.)" msgstr "" -"將 :meth:`~sqlite3.Connection.setlimit` 和 :meth:`~sqlite3.Connection." -"getlimit` 新增到 :class:`sqlite3.Connection` 以根據連線來設定和取得 SQLite 限" -"制。(由 Erlend E. Aasland 在 :issue:`45243` 中貢獻。)" +"將 :meth:`~sqlite3.Connection.setlimit` " +"和 :meth:`~sqlite3.Connection.getlimit` 新增到 :class:`sqlite3.Connection` 以" +"根據連線來設定和取得 SQLite 限制。(由 Erlend E. Aasland 在 :issue:`45243` 中" +"貢獻。)" #: ../../whatsnew/3.11.rst:986 msgid "" @@ -1659,40 +1691,43 @@ msgid "" "(Contributed by Erlend E. Aasland in :issue:`44092`.)" msgstr "" "跨越不同回滾 (rollback) 的拿取動作不再引發 :exc:`~sqlite3.InterfaceError`,我" -"們將其留給 SQLite 函式庫來處理這些情況。(由 Erlend E. Aasland 在 :issue:" -"`44092` 中貢獻。)" +"們將其留給 SQLite 函式庫來處理這些情況。(由 Erlend E. Aasland " +"在 :issue:`44092` 中貢獻。)" #: ../../whatsnew/3.11.rst:1000 msgid "" -"Add :meth:`~sqlite3.Connection.serialize` and :meth:`~sqlite3.Connection." -"deserialize` to :class:`sqlite3.Connection` for serializing and " -"deserializing databases. (Contributed by Erlend E. Aasland in :issue:" -"`41930`.)" +"Add :meth:`~sqlite3.Connection.serialize` " +"and :meth:`~sqlite3.Connection.deserialize` to :class:`sqlite3.Connection` " +"for serializing and deserializing databases. (Contributed by Erlend E. " +"Aasland in :issue:`41930`.)" msgstr "" -"將 :meth:`~sqlite3.Connection.serialize` 和 :meth:`~sqlite3.Connection." -"deserialize` 新增到 :class:`sqlite3.Connection` 以用於序列化和反序列化資料" -"庫。(由 Erlend E. Aasland 在 :issue:`41930` 中貢獻。)" +"將 :meth:`~sqlite3.Connection.serialize` " +"和 :meth:`~sqlite3.Connection.deserialize` 新增" +"到 :class:`sqlite3.Connection` 以用於序列化和反序列化資料庫。(由 Erlend E. " +"Aasland 在 :issue:`41930` 中貢獻。)" #: ../../whatsnew/3.11.rst:1005 msgid "" -"Add :meth:`~sqlite3.Connection.create_window_function` to :class:`sqlite3." -"Connection` for creating aggregate window functions. (Contributed by Erlend " -"E. Aasland in :issue:`34916`.)" +"Add :meth:`~sqlite3.Connection.create_window_function` " +"to :class:`sqlite3.Connection` for creating aggregate window functions. " +"(Contributed by Erlend E. Aasland in :issue:`34916`.)" msgstr "" -"於 :class:`sqlite3.Connection` 加入 :meth:`~sqlite3.Connection." -"create_window_function` 已建立聚合視窗函式 (aggregate window function)。(由 " -"Erlend E. Aasland 於 :issue:`34916` 中貢獻。)" +"於 :class:`sqlite3.Connection` 加" +"入 :meth:`~sqlite3.Connection.create_window_function` 已建立聚合視窗函式 " +"(aggregate window function)。(由 Erlend E. Aasland 於 :issue:`34916` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:1009 msgid "" -"Add :meth:`~sqlite3.Connection.blobopen` to :class:`sqlite3.Connection`. :" -"class:`sqlite3.Blob` allows incremental I/O operations on blobs. " -"(Contributed by Aviv Palivoda and Erlend E. Aasland in :issue:`24905`.)" +"Add :meth:`~sqlite3.Connection.blobopen` " +"to :class:`sqlite3.Connection`. :class:`sqlite3.Blob` allows incremental I/O " +"operations on blobs. (Contributed by Aviv Palivoda and Erlend E. Aasland " +"in :issue:`24905`.)" msgstr "" -"在 :class:`sqlite3.Connection` 新增 :meth:`~sqlite3.Connection.blobopen`。 :" -"class:`sqlite3.Blob` 允許對 blob 進行增量 I/O 操作 (incremental I/O " -"operations)。(由 Aviv Palivoda 和 Erlend E. Aasland 在 :issue:`24905` 中貢" -"獻。)" +"在 :class:`sqlite3.Connection` 新" +"增 :meth:`~sqlite3.Connection.blobopen`。 :class:`sqlite3.Blob` 允許對 blob " +"進行增量 I/O 操作 (incremental I/O operations)。(由 Aviv Palivoda 和 Erlend " +"E. Aasland 在 :issue:`24905` 中貢獻。)" #: ../../whatsnew/3.11.rst:1017 msgid "string" @@ -1700,15 +1735,15 @@ msgstr "string" #: ../../whatsnew/3.11.rst:1019 msgid "" -"Add :meth:`~string.Template.get_identifiers` and :meth:`~string.Template." -"is_valid` to :class:`string.Template`, which respectively return all valid " -"placeholders, and whether any invalid placeholders are present. (Contributed " -"by Ben Kehoe in :gh:`90465`.)" +"Add :meth:`~string.Template.get_identifiers` " +"and :meth:`~string.Template.is_valid` to :class:`string.Template`, which " +"respectively return all valid placeholders, and whether any invalid " +"placeholders are present. (Contributed by Ben Kehoe in :gh:`90465`.)" msgstr "" -"新增 :meth:`~string.Template.get_identifiers` 和 :meth:`~string.Template." -"is_valid` 於 :class:`string.Template`,分別能夠回傳所有合格的預留位置 " -"(placeholder) 與是否有任何不合格的預留位置存在。(由 Ben Kehoe 於 :gh:" -"`90465` 中貢獻。)" +"新增 :meth:`~string.Template.get_identifiers` " +"和 :meth:`~string.Template.is_valid` 於 :class:`string.Template`,分別能夠回" +"傳所有合格的預留位置 (placeholder) 與是否有任何不合格的預留位置存在。(由 " +"Ben Kehoe 於 :gh:`90465` 中貢獻。)" #: ../../whatsnew/3.11.rst:1029 msgid "sys" @@ -1719,8 +1754,8 @@ msgid "" ":func:`sys.exc_info` now derives the ``type`` and ``traceback`` fields from " "the ``value`` (the exception instance), so when an exception is modified " "while it is being handled, the changes are reflected in the results of " -"subsequent calls to :func:`!exc_info`. (Contributed by Irit Katriel in :" -"issue:`45711`.)" +"subsequent calls to :func:`!exc_info`. (Contributed by Irit Katriel " +"in :issue:`45711`.)" msgstr "" ":func:`sys.exc_info` 現在從 ``value``\\ (例外實例)衍生出 ``type`` 和 " "``traceback`` 欄位,因此當例外在處理過程中被修改時,變更會反映在 :func:`!" @@ -1729,20 +1764,20 @@ msgstr "" #: ../../whatsnew/3.11.rst:1037 msgid "" "Add :func:`sys.exception` which returns the active exception instance " -"(equivalent to ``sys.exc_info()[1]``). (Contributed by Irit Katriel in :" -"issue:`46328`.)" +"(equivalent to ``sys.exc_info()[1]``). (Contributed by Irit Katriel " +"in :issue:`46328`.)" msgstr "" -"新增會回傳活躍例外實例 (active exception instance) 的 :func:`sys." -"exception`\\ (等價於 ``sys.exc_info()[1]``\\ )。(由 Irit Katriel 於 :" -"issue:`46328` 中所貢獻。)" +"新增會回傳活躍例外實例 (active exception instance) " +"的 :func:`sys.exception`\\ (等價於 ``sys.exc_info()[1]``\\ )。(由 Irit " +"Katriel 於 :issue:`46328` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1041 msgid "" "Add the :data:`sys.flags.safe_path <sys.flags>` flag. (Contributed by Victor " "Stinner in :gh:`57684`.)" msgstr "" -"新增 :data:`sys.flags.safe_path <sys.flags>` 旗標。(由 Victor Stinner 於 :" -"gh:`57684` 中所貢獻。)" +"新增 :data:`sys.flags.safe_path <sys.flags>` 旗標。(由 Victor Stinner " +"於 :gh:`57684` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1048 msgid "sysconfig" @@ -1778,13 +1813,13 @@ msgid "" ":class:`~tempfile.SpooledTemporaryFile` objects now fully implement the " "methods of :class:`io.BufferedIOBase` or :class:`io.TextIOBase` (depending " "on file mode). This lets them work correctly with APIs that expect file-like " -"objects, such as compression modules. (Contributed by Carey Metcalfe in :gh:" -"`70363`.)" +"objects, such as compression modules. (Contributed by Carey Metcalfe " +"in :gh:`70363`.)" msgstr "" -":class:`~tempfile.SpooledTemporaryFile` 物件現在完整實作了 :class:`io." -"BufferedIOBase` 或 :class:`io.TextIOBase` 的方法(取決於檔案模式),這使它們" -"能夠正確地使用需要類檔案物件的 API,例如壓縮模組。(由 Carey Metcalfe 在 :gh:" -"`70363` 中貢獻。)" +":class:`~tempfile.SpooledTemporaryFile` 物件現在完整實作" +"了 :class:`io.BufferedIOBase` 或 :class:`io.TextIOBase` 的方法(取決於檔案模" +"式),這使它們能夠正確地使用需要類檔案物件的 API,例如壓縮模組。(由 Carey " +"Metcalfe 在 :gh:`70363` 中貢獻。)" #: ../../whatsnew/3.11.rst:1080 msgid "threading" @@ -1796,13 +1831,13 @@ msgid "" "(glibc 2.30 and newer), the :meth:`threading.Lock.acquire` method now uses " "the monotonic clock (:const:`time.CLOCK_MONOTONIC`) for the timeout, rather " "than using the system clock (:const:`time.CLOCK_REALTIME`), to not be " -"affected by system clock changes. (Contributed by Victor Stinner in :issue:" -"`41710`.)" +"affected by system clock changes. (Contributed by Victor Stinner " +"in :issue:`41710`.)" msgstr "" "在 Unix 上,如果 ``sem_clockwait()`` 函式在 C 函式庫(glibc 2.30 與其更新的版" -"本)中可被使用,則 :meth:`threading.Lock.acquire` 方法現在會使用單調時鐘 (:" -"const:`time. CLOCK_MONOTONIC`) 用於超時 (timeout),而不是使用系統時鐘 (:" -"const:`time.CLOCK_REALTIME`),以免受系統時鐘變化的影響。 由 Victor Stinner " +"本)中可被使用,則 :meth:`threading.Lock.acquire` 方法現在會使用單調時鐘 " +"(:const:`time. CLOCK_MONOTONIC`) 用於超時 (timeout),而不是使用系統時鐘 " +"(:const:`time.CLOCK_REALTIME`),以免受系統時鐘變化的影響。 由 Victor Stinner " "在 :issue:`41710` 中貢獻。)" #: ../../whatsnew/3.11.rst:1093 @@ -1818,9 +1853,10 @@ msgid "" "Benjamin Szőke and Victor Stinner in :issue:`21302`.)" msgstr "" "在 Unix 上,如果可用的話,:func:`time.sleep` 現在會使用 " -"``clock_nanosleep()`` 或 ``nanosleep()`` 函式,其解析度為 1 納秒(10\\ :sup:" -"`-9` 秒),而不是使用解析度為 1 微秒(10\\ :sup:`-6` 秒)的 ``select()``。" -"(由 Benjamin Szőke 和 Victor Stinner 在 :issue:`21302` 中貢獻。)" +"``clock_nanosleep()`` 或 ``nanosleep()`` 函式,其解析度為 1 納秒" +"(10\\ :sup:`-9` 秒),而不是使用解析度為 1 微秒(10\\ :sup:`-6` 秒)的 " +"``select()``。(由 Benjamin Szőke 和 Victor Stinner 在 :issue:`21302` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:1101 msgid "" @@ -1829,15 +1865,15 @@ msgid "" "hardware/drivers/kernel/high-resolution-timers>`_ which has a resolution of " "100 nanoseconds (10\\ :sup:`-7` seconds). Previously, it had a resolution of " "1 millisecond (10\\ :sup:`-3` seconds). (Contributed by Benjamin Szőke, " -"Donghee Na, Eryk Sun and Victor Stinner in :issue:`21302` and :issue:" -"`45429`.)" +"Donghee Na, Eryk Sun and Victor Stinner in :issue:`21302` " +"and :issue:`45429`.)" msgstr "" "在 Windows 8.1 或更新的平台上,:func:`time.sleep` 現在使用了一個基於\\ `高解" "析度計時器 <https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/" "high-resolution-timers>`_\\ 的可等待 (waitable) 計時器,解析度為 100 奈秒" "(即 10\\ :sup:`-7` 秒)。在這之前,它只有 1 微秒(10\\ :sup:`-3` 秒) 的解析" -"度。(由 Benjamin Szőke、Donghee Na、Eryk Sun 和 Victor Stinner 於 :issue:" -"`21302` 與 :issue:`45429` 中貢獻。)" +"度。(由 Benjamin Szőke、Donghee Na、Eryk Sun 和 Victor Stinner " +"於 :issue:`21302` 與 :issue:`45429` 中貢獻。)" #: ../../whatsnew/3.11.rst:1112 msgid "tkinter" @@ -1868,13 +1904,13 @@ msgstr "" #: ../../whatsnew/3.11.rst:1129 msgid "" -"Add :func:`traceback.TracebackException.print`, which prints the formatted :" -"exc:`~traceback.TracebackException` instance to a file. (Contributed by Irit " -"Katriel in :issue:`33809`.)" +"Add :func:`traceback.TracebackException.print`, which prints the " +"formatted :exc:`~traceback.TracebackException` instance to a file. " +"(Contributed by Irit Katriel in :issue:`33809`.)" msgstr "" -"新增 :func:`traceback.TracebackException.print`,它會印出格式化的 :exc:" -"`~traceback.TracebackException` 實例至一個檔案。(由 Irit Katriel 在 :issue:" -"`33809` 中貢獻。)" +"新增 :func:`traceback.TracebackException.print`,它會印出格式化" +"的 :exc:`~traceback.TracebackException` 實例至一個檔案。(由 Irit Katriel " +"在 :issue:`33809` 中貢獻。)" #: ../../whatsnew/3.11.rst:1137 msgid "typing" @@ -1886,14 +1922,16 @@ msgstr "重大變更請見 :ref:`new-feat-related-type-hints-311`。" #: ../../whatsnew/3.11.rst:1141 msgid "" -"Add :func:`typing.assert_never` and :class:`typing.Never`. :func:`typing." -"assert_never` is useful for asking a type checker to confirm that a line of " -"code is not reachable. At runtime, it raises an :exc:`AssertionError`. " -"(Contributed by Jelle Zijlstra in :gh:`90633`.)" +"Add :func:`typing.assert_never` " +"and :class:`typing.Never`. :func:`typing.assert_never` is useful for asking " +"a type checker to confirm that a line of code is not reachable. At runtime, " +"it raises an :exc:`AssertionError`. (Contributed by Jelle Zijlstra " +"in :gh:`90633`.)" msgstr "" -"新增 :func:`typing.assert_never` 和 :class:`typing.Never`。 :func:`typing." -"assert_never` 可用於要型別檢查器確認某行程式碼是否不可觸及。在執行環境,它會" -"引發 :exc:`AssertionError`。(由 Jelle Zijlstra 在 :gh:`90633` 中貢獻。)" +"新增 :func:`typing.assert_never` " +"和 :class:`typing.Never`。 :func:`typing.assert_never` 可用於要型別檢查器確認" +"某行程式碼是否不可觸及。在執行環境,它會引發 :exc:`AssertionError`。(由 " +"Jelle Zijlstra 在 :gh:`90633` 中貢獻。)" #: ../../whatsnew/3.11.rst:1147 msgid "" @@ -1921,16 +1959,16 @@ msgid "" ":data:`typing.TypedDict` types can now be generic. (Contributed by Samodya " "Abeysiriwardane in :gh:`89026`.)" msgstr "" -":data:`typing.TypedDict` 型別現可為泛型。(由 Samodya Abeysiriwardane 於 :gh:" -"`89026` 中所貢獻。)" +":data:`typing.TypedDict` 型別現可為泛型。(由 Samodya Abeysiriwardane " +"於 :gh:`89026` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1160 msgid "" ":class:`~typing.NamedTuple` types can now be generic. (Contributed by Serhiy " "Storchaka in :issue:`43923`.)" msgstr "" -":class:`~typing.NamedTuple` 型別現可為泛型。(由 Serhiy Storchaka 於 :issue:" -"`43923` 中所貢獻。)" +":class:`~typing.NamedTuple` 型別現可為泛型。(由 Serhiy Storchaka " +"於 :issue:`43923` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1163 msgid "" @@ -1953,8 +1991,8 @@ msgstr "" msgid "" "The :func:`typing.get_overloads` function can be used for introspecting the " "overloads of a function. :func:`typing.clear_overloads` can be used to clear " -"all registered overloads of a function. (Contributed by Jelle Zijlstra in :" -"gh:`89263`.)" +"all registered overloads of a function. (Contributed by Jelle Zijlstra " +"in :gh:`89263`.)" msgstr "" ":func:`typing.get_overloads` 函式可用於自我檢查 (introspect) 一個函式的過載 " "(overload)。:func:`typing.clear_overloads` 可用於清除一個函式的所有已註冊過" @@ -1993,28 +2031,28 @@ msgid "" "references in :ref:`PEP 585 generic aliases <types-genericalias>`. " "(Contributed by Niklas Rosenstein in :gh:`85542`.)" msgstr "" -"作為\\ :ref:`PEP 585 泛化別名 <types-genericalias>`\\ 中的前向參照,:func:" -"`typing.get_type_hints` 現支援了為字串求值 (evaluate)。(由 Niklas " +"作為\\ :ref:`PEP 585 泛化別名 <types-genericalias>`\\ 中的前向參" +"照,:func:`typing.get_type_hints` 現支援了為字串求值 (evaluate)。(由 Niklas " "Rosenstein 在 :gh:`85542` 中貢獻。)" #: ../../whatsnew/3.11.rst:1192 msgid "" ":func:`typing.get_type_hints` no longer adds :data:`~typing.Optional` to " -"parameters with ``None`` as a default. (Contributed by Nikita Sobolev in :gh:" -"`90353`.)" +"parameters with ``None`` as a default. (Contributed by Nikita Sobolev " +"in :gh:`90353`.)" msgstr "" ":func:`typing.get_type_hints` 不再將 :data:`~typing.Optional` 新增到預設為 " "``None`` 的參數中。(由 Nikita Sobolev 在 :gh:`90353` 中貢獻。)" #: ../../whatsnew/3.11.rst:1196 msgid "" -":func:`typing.get_type_hints` now supports evaluating bare stringified :data:" -"`~typing.ClassVar` annotations. (Contributed by Gregory Beauregard in :gh:" -"`90711`.)" +":func:`typing.get_type_hints` now supports evaluating bare " +"stringified :data:`~typing.ClassVar` annotations. (Contributed by Gregory " +"Beauregard in :gh:`90711`.)" msgstr "" ":func:`typing.get_type_hints` 現在支援為無修飾 (bare) 字串化 (stringified) " -"的 :data:`~typing.ClassVar` 標註來求值。(由 Gregory Beauregard 在 :gh:" -"`90711` 中貢獻。)" +"的 :data:`~typing.ClassVar` 標註來求值。(由 Gregory Beauregard " +"在 :gh:`90711` 中貢獻。)" #: ../../whatsnew/3.11.rst:1200 msgid "" @@ -2043,17 +2081,21 @@ msgstr "unittest" #: ../../whatsnew/3.11.rst:1219 msgid "" -"Added methods :meth:`~unittest.TestCase.enterContext` and :meth:`~unittest." -"TestCase.enterClassContext` of class :class:`~unittest.TestCase`, method :" -"meth:`~unittest.IsolatedAsyncioTestCase.enterAsyncContext` of class :class:" -"`~unittest.IsolatedAsyncioTestCase` and function :func:`unittest." -"enterModuleContext`. (Contributed by Serhiy Storchaka in :issue:`45046`.)" -msgstr "" -"新增 :class:`~unittest.TestCase` 類別的 :meth:`~unittest.TestCase." -"enterContext` 與 :meth:`~unittest.TestCase.enterClassContext` 方法、 :class:" -"`~unittest.IsolatedAsyncioTestCase` 類別 的 :meth:`~unittest." -"IsolatedAsyncioTestCase.enterAsyncContext` 方法、:func:`unittest." -"enterModuleContext` 函式。(由 Serhiy Storchaka 於 :issue:`45046` 貢獻。)" +"Added methods :meth:`~unittest.TestCase.enterContext` " +"and :meth:`~unittest.TestCase.enterClassContext` of " +"class :class:`~unittest.TestCase`, " +"method :meth:`~unittest.IsolatedAsyncioTestCase.enterAsyncContext` of " +"class :class:`~unittest.IsolatedAsyncioTestCase` and " +"function :func:`unittest.enterModuleContext`. (Contributed by Serhiy " +"Storchaka in :issue:`45046`.)" +msgstr "" +"新增 :class:`~unittest.TestCase` 類別" +"的 :meth:`~unittest.TestCase.enterContext` " +"與 :meth:`~unittest.TestCase.enterClassContext` 方" +"法、 :class:`~unittest.IsolatedAsyncioTestCase` 類別 " +"的 :meth:`~unittest.IsolatedAsyncioTestCase.enterAsyncContext` 方" +"法、:func:`unittest.enterModuleContext` 函式。(由 Serhiy Storchaka " +"於 :issue:`45046` 貢獻。)" #: ../../whatsnew/3.11.rst:1231 msgid "venv" @@ -2067,8 +2109,8 @@ msgid "" "installation scheme is the default. That means that downstream distributors " "can change the default sysconfig install scheme without changing behavior of " "virtual environments. Third party code that also creates new virtual " -"environments should do the same. (Contributed by Miro Hrončok in :issue:" -"`45413`.)" +"environments should do the same. (Contributed by Miro Hrončok " +"in :issue:`45413`.)" msgstr "" "建立新的 Python 虛擬環境時,*venv* :ref:`sysconfig 安裝方案 " "<installation_paths>`\\ 會被用於確定環境內的路徑。當 Python 在虛擬環境中運行" @@ -2082,10 +2124,10 @@ msgstr "warnings" #: ../../whatsnew/3.11.rst:1249 msgid "" -":func:`warnings.catch_warnings` now accepts arguments for :func:`warnings." -"simplefilter`, providing a more concise way to locally ignore warnings or " -"convert them to errors. (Contributed by Zac Hatfield-Dodds in :issue:" -"`47074`.)" +":func:`warnings.catch_warnings` now accepts arguments " +"for :func:`warnings.simplefilter`, providing a more concise way to locally " +"ignore warnings or convert them to errors. (Contributed by Zac Hatfield-" +"Dodds in :issue:`47074`.)" msgstr "" ":func:`warnings.catch_warnings` 現在接受 :func:`warnings.simplefilter` 的引" "數,提供了一種更簡潔的方法來在本地端忽略警告或將它們轉換為錯誤。(由 Zac " @@ -2097,8 +2139,8 @@ msgstr "zipfile" #: ../../whatsnew/3.11.rst:1259 msgid "" -"Added support for specifying member name encoding for reading metadata in a :" -"class:`~zipfile.ZipFile`'s directory and file headers. (Contributed by " +"Added support for specifying member name encoding for reading metadata in " +"a :class:`~zipfile.ZipFile`'s directory and file headers. (Contributed by " "Stephen J. Turnbull and Serhiy Storchaka in :issue:`28080`.)" msgstr "" "新增了對指定成員名稱編碼的支援,以便在 :class:`~zipfile.ZipFile` 的目錄和檔案" @@ -2115,13 +2157,13 @@ msgstr "" #: ../../whatsnew/3.11.rst:1267 msgid "" -"Added :attr:`~zipfile.Path.stem`, :attr:`~zipfile.Path.suffix` and :attr:" -"`~zipfile.Path.suffixes` to :class:`zipfile.Path`. (Contributed by Miguel " -"Brito in :gh:`88261`.)" +"Added :attr:`~zipfile.Path.stem`, :attr:`~zipfile.Path.suffix` " +"and :attr:`~zipfile.Path.suffixes` to :class:`zipfile.Path`. (Contributed by " +"Miguel Brito in :gh:`88261`.)" msgstr "" -"於 :class:`zipfile.Path` 新增 :attr:`~zipfile.Path.stem`、:attr:`~zipfile." -"Path.suffix` 和 :attr:`~zipfile.Path.suffixes`。(由 Miguel Brito 於 :gh:" -"`88261` 貢獻。)" +"於 :class:`zipfile.Path` 新" +"增 :attr:`~zipfile.Path.stem`、:attr:`~zipfile.Path.suffix` " +"和 :attr:`~zipfile.Path.suffixes`。(由 Miguel Brito 於 :gh:`88261` 貢獻。)" #: ../../whatsnew/3.11.rst:1275 msgid "Optimizations" @@ -2129,8 +2171,9 @@ msgstr "最佳化" #: ../../whatsnew/3.11.rst:1277 msgid "" -"This section covers specific optimizations independent of the :ref:" -"`whatsnew311-faster-cpython` project, which is covered in its own section." +"This section covers specific optimizations independent of " +"the :ref:`whatsnew311-faster-cpython` project, which is covered in its own " +"section." msgstr "" "這個部分會涵蓋到特定的最佳化,但獨立於擁有自己一個說明的\\ :ref:`whatsnew311-" "faster-cpython` 計畫。" @@ -2151,8 +2194,8 @@ msgstr "" msgid "" "Integer division (``//``) is better tuned for optimization by compilers. It " "is now around 20% faster on x86-64 when dividing an :class:`int` by a value " -"smaller than ``2**30``. (Contributed by Gregory P. Smith and Tim Peters in :" -"gh:`90564`.)" +"smaller than ``2**30``. (Contributed by Gregory P. Smith and Tim Peters " +"in :gh:`90564`.)" msgstr "" "整數除法 (``//``) 為了編譯器最佳化而被調校過。現在將 :class:`int` 除以小於 " "``2**30`` 的值時,在 x86-64 上快了大約 20%。(由 Gregory P. Smith 和 Tim " @@ -2168,20 +2211,21 @@ msgstr "" #: ../../whatsnew/3.11.rst:1294 msgid "" -"Resizing lists is streamlined for the common case, speeding up :meth:`list." -"append` by ≈15% and simple :term:`list comprehension`\\s by up to 20-30% " -"(Contributed by Dennis Sweeney in :gh:`91165`.)" +"Resizing lists is streamlined for the common case, speeding " +"up :meth:`list.append` by ≈15% and simple :term:`list comprehension`\\s by " +"up to 20-30% (Contributed by Dennis Sweeney in :gh:`91165`.)" msgstr "" "調整 list 大小在常見情況下增進了效能,為 :meth:`list.append` 加快了約 15% 並" -"為簡單的 :term:`list comprehension` 加快了高達 20-30%(由 Dennis Sweeney 在 :" -"gh:`91165` 中貢獻。)" +"為簡單的 :term:`list comprehension` 加快了高達 20-30%(由 Dennis Sweeney " +"在 :gh:`91165` 中貢獻。)" #: ../../whatsnew/3.11.rst:1299 msgid "" "Dictionaries don't store hash values when all keys are Unicode objects, " -"decreasing :class:`dict` size. For example, ``sys.getsizeof(dict." -"fromkeys(\"abcdefg\"))`` is reduced from 352 bytes to 272 bytes (23% " -"smaller) on 64-bit platforms. (Contributed by Inada Naoki in :issue:`46845`.)" +"decreasing :class:`dict` size. For example, " +"``sys.getsizeof(dict.fromkeys(\"abcdefg\"))`` is reduced from 352 bytes to " +"272 bytes (23% smaller) on 64-bit platforms. (Contributed by Inada Naoki " +"in :issue:`46845`.)" msgstr "" "當所有鍵都是 Unicode 物件時,字典不存儲雜湊值,減少了 :class:`dict` 的大小。" "例如,``sys.getsizeof(dict.fromkeys(\"abcdefg\"))`` 在 64-bit 平台上從 352 位" @@ -2195,8 +2239,8 @@ msgid "" "for a ≈60 MiB file. (Contributed by msoxzw in :gh:`91487`.)" msgstr "" "使用 :class:`asyncio.DatagramProtocol` 以透過 UDP 傳輸大文件時,現在速度提高" -"了幾個數量級,傳輸 ≈60 MiB 檔案的速度提高了 100 多倍。(由 msoxzw 在 :gh:" -"`91487` 中貢獻。)" +"了幾個數量級,傳輸 ≈60 MiB 檔案的速度提高了 100 多倍。(由 msoxzw " +"在 :gh:`91487` 中貢獻。)" #: ../../whatsnew/3.11.rst:1310 msgid "" @@ -2205,21 +2249,22 @@ msgid "" "(Contributed by Serhiy Storchaka in :issue:`37295`.)" msgstr "" ":mod:`math` 函式 :func:`~math.comb` 和 :func:`~math.perm` 針對較大引數現在快" -"了 ≈10 倍(對於更大的 *k* 有更大的加速)。(由 Serhiy Storchaka 在 :issue:" -"`37295` 中貢獻。)" +"了 ≈10 倍(對於更大的 *k* 有更大的加速)。(由 Serhiy Storchaka " +"在 :issue:`37295` 中貢獻。)" #: ../../whatsnew/3.11.rst:1314 msgid "" -"The :mod:`statistics` functions :func:`~statistics.mean`, :func:`~statistics." -"variance` and :func:`~statistics.stdev` now consume iterators in one pass " -"rather than converting them to a :class:`list` first. This is twice as fast " -"and can save substantial memory. (Contributed by Raymond Hettinger in :gh:" -"`90415`.)" +"The :mod:`statistics` " +"functions :func:`~statistics.mean`, :func:`~statistics.variance` " +"and :func:`~statistics.stdev` now consume iterators in one pass rather than " +"converting them to a :class:`list` first. This is twice as fast and can save " +"substantial memory. (Contributed by Raymond Hettinger in :gh:`90415`.)" msgstr "" -":mod:`statistics` 函式 :func:`~statistics.mean`、:func:`~statistics." -"variance` 和 :func:`~statistics.stdev` 現在會一次性的消耗疊代器,而不是先將它" -"們轉換為 :class:`list`,這讓速度提升為兩倍並可以節省大量記憶體空間。(由 " -"Raymond Hettinger 在 :gh:`90415` 中貢獻。)" +":mod:`statistics` 函" +"式 :func:`~statistics.mean`、:func:`~statistics.variance` " +"和 :func:`~statistics.stdev` 現在會一次性的消耗疊代器,而不是先將它們轉換" +"為 :class:`list`,這讓速度提升為兩倍並可以節省大量記憶體空間。(由 Raymond " +"Hettinger 在 :gh:`90415` 中貢獻。)" #: ../../whatsnew/3.11.rst:1320 msgid "" @@ -2252,9 +2297,9 @@ msgid "" "startup` and :ref:`whatsnew311-faster-runtime`. Optimizations not covered by " "this project are listed separately under :ref:`whatsnew311-optimizations`." msgstr "" -"此計畫專注在 Python 的 :ref:`whatsnew311-faster-startup` 和 :ref:" -"`whatsnew311-faster-runtime`。不在此專案內的最佳化被獨立列出在 :ref:" -"`whatsnew311-optimizations`。" +"此計畫專注在 Python 的 :ref:`whatsnew311-faster-startup` " +"和 :ref:`whatsnew311-faster-runtime`。不在此專案內的最佳化被獨立列出" +"在 :ref:`whatsnew311-optimizations`。" #: ../../whatsnew/3.11.rst:1346 msgid "Faster Startup" @@ -2287,9 +2332,9 @@ msgid "" "statically allocated by the interpreter. This reduces the steps in module " "execution process to:" msgstr "" -"在 Python 3.11 中,核心模組在 Python 啟動時必須被「凍結」,這意味著它們的\\ :" -"ref:`程式碼物件 <codeobjects>`\\ (和位元組碼)是由直譯器靜態分配的。這將模組" -"執行過程中的步驟減少為:" +"在 Python 3.11 中,核心模組在 Python 啟動時必須被「凍結」,這意味著它們的" +"\\ :ref:`程式碼物件 <codeobjects>`\\ (和位元組碼)是由直譯器靜態分配的。這將" +"模組執行過程中的步驟減少為:" #: ../../whatsnew/3.11.rst:1367 msgid "Statically allocated code object -> Evaluate" @@ -2345,10 +2390,10 @@ msgstr "" #: ../../whatsnew/3.11.rst:1396 msgid "" "Old-style :ref:`frame objects <frame-objects>` are now created only when " -"requested by debuggers or by Python introspection functions such as :func:" -"`sys._getframe` and :func:`inspect.currentframe`. For most user code, no " -"frame objects are created at all. As a result, nearly all Python functions " -"calls have sped up significantly. We measured a 3-7% speedup in " +"requested by debuggers or by Python introspection functions such " +"as :func:`sys._getframe` and :func:`inspect.currentframe`. For most user " +"code, no frame objects are created at all. As a result, nearly all Python " +"functions calls have sped up significantly. We measured a 3-7% speedup in " "pyperformance." msgstr "" "舊式\\ :ref:`幀物件 <frame-objects>`\\ 現在僅在除錯器或 Python 自我檢查函式" @@ -2388,13 +2433,14 @@ msgid "" "Most Python function calls now consume no C stack space, speeding them up. " "In simple recursive functions like fibonacci or factorial, we observed a " "1.7x speedup. This also means recursive functions can recurse significantly " -"deeper (if the user increases the recursion limit with :func:`sys." -"setrecursionlimit`). We measured a 1-3% improvement in pyperformance." +"deeper (if the user increases the recursion limit " +"with :func:`sys.setrecursionlimit`). We measured a 1-3% improvement in " +"pyperformance." msgstr "" "現在大多數 Python 函式的呼叫因為不會佔用 C 堆疊空間而被加速。在斐波那契 " "(fibonacci) 或階乘等簡單遞迴函式中,觀察到 1.7 倍的加速。這也意味著遞迴函式可" -"以遞迴得更深(如果使用者有增加\\ :func:`遞迴限制 <sys." -"setrecursionlimit>`\\ )。我們在 pyperformance 測得 1-3% 的改進。" +"以遞迴得更深(如果使用者有增加\\ :func:`遞迴限制 " +"<sys.setrecursionlimit>`\\ )。我們在 pyperformance 測得 1-3% 的改進。" #: ../../whatsnew/3.11.rst:1427 msgid "(Contributed by Pablo Galindo and Mark Shannon in :issue:`45256`.)" @@ -2422,8 +2468,8 @@ msgid "" "more specialized one. This specialized operation uses fast paths available " "only to those use cases/types, which generally outperform their generic " "counterparts. This also brings in another concept called *inline caching*, " -"where Python caches the results of expensive operations directly in the :" -"term:`bytecode`." +"where Python caches the results of expensive operations directly in " +"the :term:`bytecode`." msgstr "" "在執行環境,Python 將嘗試在執行中的程式碼內尋找常用模式和型別穩定,然後 " "Python 將用更特化的操作替換當前操作。這種特化操作運用了僅適用於那些用例/型別" @@ -2455,13 +2501,13 @@ msgstr "" #: ../../whatsnew/3.11.rst:1457 msgid "" -"(PEP written by Mark Shannon, with ideas inspired by Stefan Brunthaler. See :" -"pep:`659` for more information. Implementation by Mark Shannon and Brandt " -"Bucher, with additional help from Irit Katriel and Dennis Sweeney.)" +"(PEP written by Mark Shannon, with ideas inspired by Stefan Brunthaler. " +"See :pep:`659` for more information. Implementation by Mark Shannon and " +"Brandt Bucher, with additional help from Irit Katriel and Dennis Sweeney.)" msgstr "" -"(PEP 由 Mark Shannon 撰寫、概念啟發自 Stefan Brunthaler。詳情請見 :pep:" -"`659`。由 Mark Shannon 和 Brandt Bucher 實作,Irit Katriel 和 Dennis Sweeney " -"亦提供了額外的幫助。)" +"(PEP 由 Mark Shannon 撰寫、概念啟發自 Stefan Brunthaler。詳情請" +"見 :pep:`659`。由 Mark Shannon 和 Brandt Bucher 實作,Irit Katriel 和 Dennis " +"Sweeney 亦提供了額外的幫助。)" #: ../../whatsnew/3.11.rst:1465 msgid "Operation" @@ -2501,9 +2547,9 @@ msgstr "``x * x``" #: ../../whatsnew/3.11.rst:1468 msgid "" -"Binary add, multiply and subtract for common types such as :class:`int`, :" -"class:`float` and :class:`str` take custom fast paths for their underlying " -"types." +"Binary add, multiply and subtract for common types such " +"as :class:`int`, :class:`float` and :class:`str` take custom fast paths for " +"their underlying types." msgstr "" "常見型別如 :class:`int`、:class:`float` 與 :class:`str` 的二元加法、乘法與減" "法,為底層型別採取了特製的快速路徑。" @@ -2526,16 +2572,16 @@ msgstr "``a[i]``" #: ../../whatsnew/3.11.rst:1474 msgid "" -"Subscripting container types such as :class:`list`, :class:`tuple` and :" -"class:`dict` directly index the underlying data structures." +"Subscripting container types such as :class:`list`, :class:`tuple` " +"and :class:`dict` directly index the underlying data structures." msgstr "" "下標容器型別如 :class:`list`、:class:`tuple` 和 :class:`dict` 直接索引底層的" "資料結構。" #: ../../whatsnew/3.11.rst:1478 msgid "" -"Subscripting custom :meth:`~object.__getitem__` is also inlined similar to :" -"ref:`inline-calls`." +"Subscripting custom :meth:`~object.__getitem__` is also inlined similar " +"to :ref:`inline-calls`." msgstr "" "下標自定義 :meth:`~object.__getitem__` 也是行內的,類似於 :ref:`inline-" "calls`。" @@ -2578,8 +2624,8 @@ msgstr "``C(arg)``" #: ../../whatsnew/3.11.rst:1484 msgid "" -"Calls to common builtin (C) functions and types such as :func:`len` and :" -"class:`str` directly call their underlying C version. This avoids going " +"Calls to common builtin (C) functions and types such as :func:`len` " +"and :class:`str` directly call their underlying C version. This avoids going " "through the internal calling convention." msgstr "" "常見內建 (C) 函式和型別的呼叫,例如 :func:`len` 和 :class:`str`,會直接呼叫它" @@ -2717,8 +2763,8 @@ msgstr "" #: ../../whatsnew/3.11.rst:1513 msgid "" "A similar optimization already existed since Python 3.10. 3.11 specializes " -"for more forms. Furthermore, all attribute loads should be sped up by :issue:" -"`45947`." +"for more forms. Furthermore, all attribute loads should be sped up " +"by :issue:`45947`." msgstr "" "類似的最佳化自從 Python 3.10 就存在。3.11 特別處理了更多形式。此外,所有屬性" "載入也被 :issue:`45947` 所加速。" @@ -2734,17 +2780,17 @@ msgid "" "Mark Shannon in :issue:`45340` and :issue:`40116`.)" msgstr "" "物件現在因為使用了惰性建立的物件命名空間所以需要更少的記憶體。它們的命名空間" -"字典現在也更自由地共享鍵。(由 Mark Shannon 於 :issue:`45340` 和 :issue:" -"`40116` 貢獻。 )" +"字典現在也更自由地共享鍵。(由 Mark Shannon 於 :issue:`45340` " +"和 :issue:`40116` 貢獻。 )" #: ../../whatsnew/3.11.rst:1527 msgid "" -"\"Zero-cost\" exceptions are implemented, eliminating the cost of :keyword:" -"`try` statements when no exception is raised. (Contributed by Mark Shannon " -"in :issue:`40222`.)" +"\"Zero-cost\" exceptions are implemented, eliminating the cost " +"of :keyword:`try` statements when no exception is raised. (Contributed by " +"Mark Shannon in :issue:`40222`.)" msgstr "" -"實作了「無代價 (Zero-cost)」的例外,消除了在沒有例外被引發時的 :keyword:" -"`try` 陳述式開銷。(由 Mark Shannon 於 :issue:`40222` 貢獻。)" +"實作了「無代價 (Zero-cost)」的例外,消除了在沒有例外被引發時" +"的 :keyword:`try` 陳述式開銷。(由 Mark Shannon 於 :issue:`40222` 貢獻。)" #: ../../whatsnew/3.11.rst:1531 msgid "" @@ -2760,9 +2806,9 @@ msgid "" ":mod:`re`'s regular expression matching engine has been partially " "refactored, and now uses computed gotos (or \"threaded code\") on supported " "platforms. As a result, Python 3.11 executes the `pyperformance regular " -"expression benchmarks <https://pyperformance.readthedocs.io/benchmarks." -"html#regex-dna>`_ up to 10% faster than Python 3.10. (Contributed by Brandt " -"Bucher in :gh:`91404`.)" +"expression benchmarks <https://pyperformance.readthedocs.io/" +"benchmarks.html#regex-dna>`_ up to 10% faster than Python 3.10. (Contributed " +"by Brandt Bucher in :gh:`91404`.)" msgstr "" ":mod:`re` 的正規表示式比對引擎部分被重構,且現在會有支援的平台上使用 " "computed gotos(或者「執行緒程式碼 (threaded code)」),因此 Python 3.11 在執" @@ -2897,9 +2943,9 @@ msgstr ":opcode:`MAKE_CELL` 被用於建立 :ref:`cell-objects`。" #: ../../whatsnew/3.11.rst:1632 msgid "" -":opcode:`CHECK_EG_MATCH` and :opcode:`!PREP_RERAISE_STAR`, to handle the :" -"ref:`new exception groups and except* <whatsnew311-pep654>` added in :pep:" -"`654`." +":opcode:`CHECK_EG_MATCH` and :opcode:`!PREP_RERAISE_STAR`, to handle " +"the :ref:`new exception groups and except* <whatsnew311-pep654>` added " +"in :pep:`654`." msgstr "" ":opcode:`CHECK_EG_MATCH` 和 :opcode:`!PREP_RERAISE_STAR`,處理 :pep:`654` 所" "加入的\\ :ref:`新增例外群組和 except* <whatsnew311-pep654>`。" @@ -3140,11 +3186,12 @@ msgstr "語言/內建" #: ../../whatsnew/3.11.rst:1720 msgid "" "Chaining :class:`classmethod` descriptors (introduced in :issue:`19072`) is " -"now deprecated. It can no longer be used to wrap other descriptors such as :" -"class:`property`. The core design of this feature was flawed and caused a " -"number of downstream problems. To \"pass-through\" a :class:`classmethod`, " -"consider using the :attr:`!__wrapped__` attribute that was added in Python " -"3.10. (Contributed by Raymond Hettinger in :gh:`89519`.)" +"now deprecated. It can no longer be used to wrap other descriptors such " +"as :class:`property`. The core design of this feature was flawed and caused " +"a number of downstream problems. To \"pass-through\" " +"a :class:`classmethod`, consider using the :attr:`!__wrapped__` attribute " +"that was added in Python 3.10. (Contributed by Raymond Hettinger " +"in :gh:`89519`.)" msgstr "" "鏈接 :class:`classmethod` 描述器(在 :issue:`19072` 中引入)現已棄用。它不能" "再用於包裝其他描述器,例如 :class:`property`。此功能的核心設計存在缺陷,並導" @@ -3156,26 +3203,26 @@ msgstr "" msgid "" "Octal escapes in string and bytes literals with values larger than ``0o377`` " "(255 in decimal) now produce a :exc:`DeprecationWarning`. In a future Python " -"version, they will raise a :exc:`SyntaxWarning` and eventually a :exc:" -"`SyntaxError`. (Contributed by Serhiy Storchaka in :gh:`81548`.)" +"version, they will raise a :exc:`SyntaxWarning` and eventually " +"a :exc:`SyntaxError`. (Contributed by Serhiy Storchaka in :gh:`81548`.)" msgstr "" "值大於 ``0o377``\\(十進位為 255)的字串和位元組文本值 (bytes literal) 中的八" "進位跳脫 (octal escape) 現在會產生 :exc:`DeprecationWarning`。在未來的 " -"Python 版本中,他們將引發一個 :exc:`SyntaxWarning` 並最終引發一個 :exc:" -"`SyntaxError`。(由 Serhiy Storchaka 在 :gh:`81548` 中貢獻。)" +"Python 版本中,他們將引發一個 :exc:`SyntaxWarning` 並最終引發一" +"個 :exc:`SyntaxError`。(由 Serhiy Storchaka 在 :gh:`81548` 中貢獻。)" #: ../../whatsnew/3.11.rst:1734 msgid "" "The delegation of :func:`int` to :meth:`~object.__trunc__` is now " "deprecated. Calling ``int(a)`` when ``type(a)`` implements :meth:`!" "__trunc__` but not :meth:`~object.__int__` or :meth:`~object.__index__` now " -"raises a :exc:`DeprecationWarning`. (Contributed by Zackery Spytz in :issue:" -"`44977`.)" +"raises a :exc:`DeprecationWarning`. (Contributed by Zackery Spytz " +"in :issue:`44977`.)" msgstr "" ":func:`int` 到 :meth:`~object.__trunc__` 的授權 (delegation) 現已棄用。當 " -"``type(a)`` 有實作 :meth:`!__trunc__` 但沒有 :meth:`~object.__int__` 或 :" -"meth:`~object.__index__`,呼叫 ``int(a)`` 現在會引發一個 :exc:" -"`DeprecationWarning`。(由 Zackery Spytz 在 :issue:`44977` 中貢獻。)" +"``type(a)`` 有實作 :meth:`!__trunc__` 但沒有 :meth:`~object.__int__` " +"或 :meth:`~object.__index__`,呼叫 ``int(a)`` 現在會引發一" +"個 :exc:`DeprecationWarning`。(由 Zackery Spytz 在 :issue:`44977` 中貢獻。)" #: ../../whatsnew/3.11.rst:1744 msgid "Modules" @@ -3265,8 +3312,8 @@ msgstr ":mod:`!sunau`" #: ../../whatsnew/3.11.rst:1761 msgid "" -"(Contributed by Brett Cannon in :issue:`47061` and Victor Stinner in :gh:" -"`68966`.)" +"(Contributed by Brett Cannon in :issue:`47061` and Victor Stinner " +"in :gh:`68966`.)" msgstr "" "(由 Brett Cannon 和 Victor Stinner 分別於 :issue:`47061` 與 :gh:`68966` 中所" "貢獻。)" @@ -3283,21 +3330,20 @@ msgstr "" "除。(由 Hugo van Kemenade 於 :issue:`47022` 中貢獻。)" #: ../../whatsnew/3.11.rst:1769 -#, fuzzy msgid "" "The :mod:`!lib2to3` package and ``2to3`` tool are now deprecated and may not " "be able to parse Python 3.10 or newer. See :pep:`617`, introducing the new " "PEG parser, for details. (Contributed by Victor Stinner in :issue:`40360`.)" msgstr "" -":mod:`lib2to3` 套件和 :ref:`2to3 <2to3-reference>` 工具現已棄用,可能無法剖" -"析 Python 3.10 或更新版本。有關詳細資訊請參閱 :pep:`617`,它引入了新的 PEG 剖" -"析器。(由 Victor Stinner 在 :issue:`40360` 中貢獻。)" +":mod:!lib2to3` 套件和 ``2to3`` 工具現已棄用,可能無法剖析 Python 3.10 或更新" +"版本。有關詳細資訊請參閱 :pep:`617`,它引入了新的 PEG 剖析器。(由 Victor " +"Stinner 在 :issue:`40360` 中貢獻。)" #: ../../whatsnew/3.11.rst:1774 msgid "" "Undocumented modules :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!" -"sre_parse` are now deprecated. (Contributed by Serhiy Storchaka in :issue:" -"`47152`.)" +"sre_parse` are now deprecated. (Contributed by Serhiy Storchaka " +"in :issue:`47152`.)" msgstr "" "未被記錄於文件中的 :mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!" "sre_parse` 模組現在已被棄用。(由 Serhiy Storchaka 在 :issue:`47152` 中貢" @@ -3337,15 +3383,16 @@ msgid "" ":class:`!configparser.LegacyInterpolation` has been deprecated in the " "docstring since Python 3.2, and is not listed in the :mod:`configparser` " "documentation. It now emits a :exc:`DeprecationWarning` and will be removed " -"in Python 3.13. Use :class:`configparser.BasicInterpolation` or :class:" -"`configparser.ExtendedInterpolation` instead. (Contributed by Hugo van " -"Kemenade in :issue:`46607`.)" +"in Python 3.13. Use :class:`configparser.BasicInterpolation` " +"or :class:`configparser.ExtendedInterpolation` instead. (Contributed by Hugo " +"van Kemenade in :issue:`46607`.)" msgstr "" ":class:`!configparser.LegacyInterpolation` 自 Python 3.2 起已在文件字串中棄" -"用,並且未在 :mod:`configparser` 文檔中列出。它現在會發出一個 :exc:" -"`DeprecationWarning` 並將在 Python 3.13 中刪除。請改用 :class:`configparser." -"BasicInterpolation` 或 :class:`configparser.ExtendedInterpolation`。(由 " -"Hugo van Kemenade 在 :issue:`46607` 中貢獻。)" +"用,並且未在 :mod:`configparser` 文檔中列出。它現在會發出一" +"個 :exc:`DeprecationWarning` 並將在 Python 3.13 中刪除。請改" +"用 :class:`configparser.BasicInterpolation` " +"或 :class:`configparser.ExtendedInterpolation`。(由 Hugo van Kemenade " +"在 :issue:`46607` 中貢獻。)" #: ../../whatsnew/3.11.rst:1801 msgid "" @@ -3389,9 +3436,10 @@ msgstr ":func:`!importlib.resources.path`" #: ../../whatsnew/3.11.rst:1814 msgid "" "The :func:`locale.getdefaultlocale` function is deprecated and will be " -"removed in Python 3.15. Use :func:`locale.setlocale`, :func:`locale." -"getpreferredencoding(False) <locale.getpreferredencoding>` and :func:`locale." -"getlocale` functions instead. (Contributed by Victor Stinner in :gh:`90817`.)" +"removed in Python 3.15. " +"Use :func:`locale.setlocale`, :func:`locale.getpreferredencoding(False) " +"<locale.getpreferredencoding>` and :func:`locale.getlocale` functions " +"instead. (Contributed by Victor Stinner in :gh:`90817`.)" msgstr "" ":func:`locale.getdefaultlocale` 函式已被棄用且將於 Python 3.15 中移除。請改" "用 :func:`locale.setlocale`、:func:`locale.getpreferredencoding(False) " @@ -3399,25 +3447,24 @@ msgstr "" "於 :gh:`90817` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1820 -#, fuzzy msgid "" "The :func:`!locale.resetlocale` function is deprecated and will be removed " "in Python 3.13. Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. " "(Contributed by Victor Stinner in :gh:`90817`.)" msgstr "" -":func:`locale.resetlocale` 函式已棄用並將於 Python 3.13 中移除,請改用 " -"``locale.setlocale(locale.LC_ALL, \"\")``。(由 Victor Stinner 於 :gh:" -"`90817` 中所貢獻。)" +":func:`!locale.resetlocale` 函式已棄用並將於 Python 3.13 中移除,請改用 " +"``locale.setlocale(locale.LC_ALL, \"\")``。(由 Victor Stinner " +"於 :gh:`90817` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1824 msgid "" "Stricter rules will now be applied for numerical group references and group " "names in :ref:`regular expressions <re-syntax>`. Only sequences of ASCII " -"digits will now be accepted as a numerical reference, and the group name in :" -"class:`bytes` patterns and replacement strings can only contain ASCII " +"digits will now be accepted as a numerical reference, and the group name " +"in :class:`bytes` patterns and replacement strings can only contain ASCII " "letters, digits and underscores. For now, a deprecation warning is raised " -"for syntax violating these rules. (Contributed by Serhiy Storchaka in :gh:" -"`91760`.)" +"for syntax violating these rules. (Contributed by Serhiy Storchaka " +"in :gh:`91760`.)" msgstr "" "現在將對\\ :ref:`規則運算式 <re-syntax>`\\ 中的數值群組參照 (numerical group " "references) 和群組名稱套用更嚴格的規則。現在只接受 ASCII 數字序列作為數值參" @@ -3435,22 +3482,21 @@ msgid "" msgstr "" "在 :mod:`re` 模組中,:func:`!re.template` 函式和相應的 :const:`!re.TEMPLATE` " "和 :const:`!re.T` 旗標被棄用,因為它們沒被記錄於文件中並且缺乏明顯的目的。它" -"們將在 Python 3.13 中被刪除。(由 Serhiy Storchaka 和 Miro Hrončok 在 :gh:" -"`92728` 中貢獻。)" +"們將在 Python 3.13 中被刪除。(由 Serhiy Storchaka 和 Miro Hrončok " +"在 :gh:`92728` 中貢獻。)" #: ../../whatsnew/3.11.rst:1838 -#, fuzzy msgid "" ":func:`!turtle.settiltangle` has been deprecated since Python 3.1; it now " -"emits a deprecation warning and will be removed in Python 3.13. Use :func:" -"`turtle.tiltangle` instead (it was earlier incorrectly marked as deprecated, " -"and its docstring is now corrected). (Contributed by Hugo van Kemenade in :" -"issue:`45837`.)" +"emits a deprecation warning and will be removed in Python 3.13. " +"Use :func:`turtle.tiltangle` instead (it was earlier incorrectly marked as " +"deprecated, and its docstring is now corrected). (Contributed by Hugo van " +"Kemenade in :issue:`45837`.)" msgstr "" -":func:`turtle.settiltangle` 自 Python 3.1 以來已被棄用;它現在會發出棄用警" +":func:`!turtle.settiltangle` 自 Python 3.1 以來已被棄用;它現在會發出棄用警" "告,並將在 Python 3.13 中刪除。請改用 :func:`turtle.tiltangle`\\ (它之前被錯" -"誤地標記為已棄用,其文件字串現在已更正)。(由 Hugo van Kemenade 在 :issue:" -"`45837` 中貢獻。)" +"誤地標記為已棄用,其文件字串現在已更正)。(由 Hugo van Kemenade " +"在 :issue:`45837` 中貢獻。)" #: ../../whatsnew/3.11.rst:1844 msgid "" @@ -3479,18 +3525,18 @@ msgid "" "itself. (Contributed by Donghee Na in :issue:`42255`.)" msgstr "" ":class:`!webbrowser.MacOSX` 已被棄用且將於 Python 3.13 中移除。它並沒有被測試" -"過、沒紀錄於文件、也沒有被 :mod:`webbrowser` 本身使用。(由 Donghee Na 於 :" -"issue:`42255`。)" +"過、沒紀錄於文件、也沒有被 :mod:`webbrowser` 本身使用。(由 Donghee Na " +"於 :issue:`42255`。)" #: ../../whatsnew/3.11.rst:1858 msgid "" -"The behavior of returning a value from a :class:`~unittest.TestCase` and :" -"class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the " +"The behavior of returning a value from a :class:`~unittest.TestCase` " +"and :class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the " "default ``None`` value) is now deprecated." msgstr "" -"回傳從 :class:`~unittest.TestCase` 和 :class:`~unittest." -"IsolatedAsyncioTestCase` 測試方法(預設的 ``None`` 值除外)給定值的行為現已棄" -"用。" +"回傳從 :class:`~unittest.TestCase` " +"和 :class:`~unittest.IsolatedAsyncioTestCase` 測試方法(預設的 ``None`` 值除" +"外)給定值的行為現已棄用。" #: ../../whatsnew/3.11.rst:1862 msgid "" @@ -3824,15 +3870,16 @@ msgstr "被移除的 C API 被\\ :ref:`獨立列出 <whatsnew311-c-api-removed>` #: ../../whatsnew/3.11.rst:1955 msgid "" "Removed the :func:`!@asyncio.coroutine` :term:`decorator` enabling legacy " -"generator-based coroutines to be compatible with :keyword:`async` / :keyword:" -"`await` code. The function has been deprecated since Python 3.8 and the " -"removal was initially scheduled for Python 3.10. Use :keyword:`async def` " -"instead. (Contributed by Illia Volochii in :issue:`43216`.)" +"generator-based coroutines to be compatible " +"with :keyword:`async` / :keyword:`await` code. The function has been " +"deprecated since Python 3.8 and the removal was initially scheduled for " +"Python 3.10. Use :keyword:`async def` instead. (Contributed by Illia " +"Volochii in :issue:`43216`.)" msgstr "" "刪除了 :func:`!@asyncio.coroutine` :term:`decorator` 使遺留的基於生成器的協" "程 (generator-based coroutine) 與 :keyword:`async` / :keyword:`await` 程式碼" -"相容。該函式自 Python 3.8 起已被棄用,計劃於 Python 3.10 刪除。請改用 :" -"keyword:`async def`。(由 Illia Volochii 在 :issue:`43216` 中貢獻。)" +"相容。該函式自 Python 3.8 起已被棄用,計劃於 Python 3.10 刪除。請改" +"用 :keyword:`async def`。(由 Illia Volochii 在 :issue:`43216` 中貢獻。)" #: ../../whatsnew/3.11.rst:1962 msgid "" @@ -3840,29 +3887,30 @@ msgid "" "generator-based coroutine objects in the debug mode. (Contributed by Illia " "Volochii in :issue:`43216`.)" msgstr "" -"移除除錯模式中用於包裝遺留基於產生器之協程物件的 :class:`!asyncio.coroutines." -"CoroWrapper`。(由 Illia Volochii 於 :issue:`43216` 中貢獻。)" +"移除除錯模式中用於包裝遺留基於產生器之協程物件的 :class:`!" +"asyncio.coroutines.CoroWrapper`。(由 Illia Volochii 於 :issue:`43216` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:1966 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint`, disabled in Python 3.9, is now " -"entirely removed. This is because of the behavior of the socket option " -"``SO_REUSEADDR`` in UDP. (Contributed by Hugo van Kemenade in :issue:" -"`45129`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint`, disabled in Python 3.9, is " +"now entirely removed. This is because of the behavior of the socket option " +"``SO_REUSEADDR`` in UDP. (Contributed by Hugo van Kemenade " +"in :issue:`45129`.)" msgstr "" -"因為有重大的安全性考量,Python 3.9 中停用的 :meth:`asyncio.loop." -"create_datagram_endpoint` 之 *reuse_address* 參數目前已經移除。這是因為 UDP " -"socket 選項 ``SO_REUSEADDR`` 的行為所致。(由 Hugo van Kemenade 於 :issue:" -"`45129` 中貢獻。)" +"因為有重大的安全性考量,Python 3.9 中停用" +"的 :meth:`asyncio.loop.create_datagram_endpoint` 之 *reuse_address* 參數目前" +"已經移除。這是因為 UDP socket 選項 ``SO_REUSEADDR`` 的行為所致。(由 Hugo " +"van Kemenade 於 :issue:`45129` 中貢獻。)" #: ../../whatsnew/3.11.rst:1972 msgid "" "Removed the :mod:`!binhex` module, deprecated in Python 3.9. Also removed " "the related, similarly-deprecated :mod:`binascii` functions:" msgstr "" -"移除 Python 3.9 中棄用的 :mod:`!binhex` 模組,與其相關且相似的 :mod:" -"`binascii` 函式也一併被移除:" +"移除 Python 3.9 中棄用的 :mod:`!binhex` 模組,與其相關且相似" +"的 :mod:`binascii` 函式也一併被移除:" #: ../../whatsnew/3.11.rst:1975 msgid ":func:`!binascii.a2b_hqx`" @@ -3900,32 +3948,34 @@ msgstr "" #: ../../whatsnew/3.11.rst:1988 msgid "" -"Removed the :meth:`~object.__getitem__` methods of :class:`xml.dom.pulldom." -"DOMEventStream`, :class:`wsgiref.util.FileWrapper` and :class:`fileinput." -"FileInput`, deprecated since Python 3.9. (Contributed by Hugo van Kemenade " -"in :issue:`45132`.)" +"Removed the :meth:`~object.__getitem__` methods " +"of :class:`xml.dom.pulldom.DOMEventStream`, :class:`wsgiref.util.FileWrapper` " +"and :class:`fileinput.FileInput`, deprecated since Python 3.9. (Contributed " +"by Hugo van Kemenade in :issue:`45132`.)" msgstr "" -"將 :class:`xml.dom.pulldom.DOMEventStream`、:class:`wsgiref.util." -"FileWrapper` 和 :class:`fileinput.FileInput` 自 Python 3.9 中棄用的 :meth:" -"`~object.__getitem__` 方法移除。(由 Hugo van Kemenade 在 :issue:`45132` 中貢" -"獻。)" +"將 :class:`xml.dom.pulldom.DOMEventStream`、:class:`wsgiref.util.FileWrapper` " +"和 :class:`fileinput.FileInput` 自 Python 3.9 中棄用" +"的 :meth:`~object.__getitem__` 方法移除。(由 Hugo van Kemenade " +"在 :issue:`45132` 中貢獻。)" #: ../../whatsnew/3.11.rst:1993 msgid "" "Removed the deprecated :mod:`gettext` functions :func:`!lgettext`, :func:`!" -"ldgettext`, :func:`!lngettext` and :func:`!ldngettext`. Also removed the :" -"func:`!bind_textdomain_codeset` function, the :meth:`!NullTranslations." -"output_charset` and :meth:`!NullTranslations.set_output_charset` methods, " -"and the *codeset* parameter of :func:`!translation` and :func:`!install`, " -"since they are only used for the :func:`!l*gettext` functions. (Contributed " -"by Donghee Na and Serhiy Storchaka in :issue:`44235`.)" -msgstr "" -"刪除了已棄用的 :mod:`gettext` 函式 :func:`!lgettext`、:func:`!ldgettext`、:" -"func:`!lngettext` 和 :func:`!ldngettext`,也刪除了 :func:`!" -"bind_textdomain_codeset` 函式、:meth:`!NullTranslations.output_charset` 和 :" -"meth:`!NullTranslations.set_output_charset` 方法,以及 :func:`!translation` " -"和 :func:`!install` 的 *codeset* 參數,因為它們僅被用於 :func:`!l*gettext` 函" -"式。(由 Donghee Na 和 Serhiy Storchaka 在 :issue:`44235` 中貢獻。)" +"ldgettext`, :func:`!lngettext` and :func:`!ldngettext`. Also removed " +"the :func:`!bind_textdomain_codeset` function, the :meth:`!" +"NullTranslations.output_charset` and :meth:`!" +"NullTranslations.set_output_charset` methods, and the *codeset* parameter " +"of :func:`!translation` and :func:`!install`, since they are only used for " +"the :func:`!l*gettext` functions. (Contributed by Donghee Na and Serhiy " +"Storchaka in :issue:`44235`.)" +msgstr "" +"刪除了已棄用的 :mod:`gettext` 函式 :func:`!lgettext`、:func:`!" +"ldgettext`、:func:`!lngettext` 和 :func:`!ldngettext`,也刪除了 :func:`!" +"bind_textdomain_codeset` 函式、:meth:`!NullTranslations.output_charset` " +"和 :meth:`!NullTranslations.set_output_charset` 方法,以及 :func:`!" +"translation` 和 :func:`!install` 的 *codeset* 參數,因為它們僅被用於 :func:`!" +"l*gettext` 函式。(由 Donghee Na 和 Serhiy Storchaka 在 :issue:`44235` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:2003 msgid "Removed from the :mod:`inspect` module:" @@ -3933,30 +3983,31 @@ msgstr "於 :mod:`inspect` 模組中移除:" #: ../../whatsnew/3.11.rst:2005 msgid "" -"The :func:`!getargspec` function, deprecated since Python 3.0; use :func:" -"`inspect.signature` or :func:`inspect.getfullargspec` instead." +"The :func:`!getargspec` function, deprecated since Python 3.0; " +"use :func:`inspect.signature` or :func:`inspect.getfullargspec` instead." msgstr "" -"Python 3.0 中棄用的 :func:`!getargspec`;改用 :func:`inspect.signature` 或 :" -"func:`inspect.getfullargspec`。" +"Python 3.0 中棄用的 :func:`!getargspec`;改用 :func:`inspect.signature` " +"或 :func:`inspect.getfullargspec`。" #: ../../whatsnew/3.11.rst:2008 msgid "" -"The :func:`!formatargspec` function, deprecated since Python 3.5; use the :" -"func:`inspect.signature` function or the :class:`inspect.Signature` object " -"directly." +"The :func:`!formatargspec` function, deprecated since Python 3.5; use " +"the :func:`inspect.signature` function or the :class:`inspect.Signature` " +"object directly." msgstr "" -"Python 3.5 中棄用的 :func:`!formatargspec` 函式;請直接用 :func:`inspect." -"signature` 函式或 :class:`inspect.Signature` 物件。" +"Python 3.5 中棄用的 :func:`!formatargspec` 函式;請直接" +"用 :func:`inspect.signature` 函式或 :class:`inspect.Signature` 物件。" #: ../../whatsnew/3.11.rst:2012 msgid "" -"The undocumented :meth:`!Signature.from_builtin` and :meth:`!Signature." -"from_function` methods, deprecated since Python 3.5; use the :meth:" -"`Signature.from_callable() <inspect.Signature.from_callable>` method instead." +"The undocumented :meth:`!Signature.from_builtin` and :meth:`!" +"Signature.from_function` methods, deprecated since Python 3.5; use " +"the :meth:`Signature.from_callable() <inspect.Signature.from_callable>` " +"method instead." msgstr "" -"Python 3.5 中停用且沒有被紀錄於文件上的 :meth:`!Signature.from_builtin` 和 :" -"meth:`!Signature.from_function` 方法;改用 :meth:`Signature.from_callable() " -"<inspect.Signature.from_callable>` 方法。" +"Python 3.5 中停用且沒有被紀錄於文件上的 :meth:`!Signature.from_builtin` " +"和 :meth:`!Signature.from_function` 方法;改" +"用 :meth:`Signature.from_callable() <inspect.Signature.from_callable>` 方法。" #: ../../whatsnew/3.11.rst:2017 msgid "(Contributed by Hugo van Kemenade in :issue:`45320`.)" @@ -3964,9 +4015,9 @@ msgstr "(由 Hugo van Kemenade 於 :issue:`45320` 中所貢獻。)" #: ../../whatsnew/3.11.rst:2019 msgid "" -"Removed the :meth:`~object.__class_getitem__` method from :class:`pathlib." -"PurePath`, because it was not used and added by mistake in previous " -"versions. (Contributed by Nikita Sobolev in :issue:`46483`.)" +"Removed the :meth:`~object.__class_getitem__` method " +"from :class:`pathlib.PurePath`, because it was not used and added by mistake " +"in previous versions. (Contributed by Nikita Sobolev in :issue:`46483`.)" msgstr "" "自 :class:`pathlib.PurePath` 中移除 :meth:`~object.__class_getitem__` 方法," "因為它是前一版本中誤加且沒被使用。(由 Nikita Sobolev 於 :issue:`46483` 中所" @@ -3983,8 +4034,8 @@ msgstr "" #: ../../whatsnew/3.11.rst:2028 msgid "" -"Removed the deprecated :meth:`!split` method of :class:`!_tkinter." -"TkappType`. (Contributed by Erlend E. Aasland in :issue:`38371`.)" +"Removed the deprecated :meth:`!split` method of :class:`!" +"_tkinter.TkappType`. (Contributed by Erlend E. Aasland in :issue:`38371`.)" msgstr "" "移除 :class:`!_tkinter.TkappType` 已被棄用的 :meth:`!split` 方法。(由 " "Erlend E. Aasland 於 :issue:`38371` 貢獻。)" @@ -4017,8 +4068,8 @@ msgid "" "corresponding :c:macro:`!EXPERIMENTAL_ISOLATED_SUBINTERPRETERS` macro) have " "been removed." msgstr "" -"移除 :option:`!--experimental-isolated-subinterpreters` 配置旗標(與對應的 :" -"c:macro:`!EXPERIMENTAL_ISOLATED_SUBINTERPRETERS` 巨集)。" +"移除 :option:`!--experimental-isolated-subinterpreters` 配置旗標(與對應" +"的 :c:macro:`!EXPERIMENTAL_ISOLATED_SUBINTERPRETERS` 巨集)。" #: ../../whatsnew/3.11.rst:2045 msgid "" @@ -4050,31 +4101,31 @@ msgstr "C API 的移植被\\ :ref:`獨立列出 <whatsnew311-c-api-porting>`。" #: ../../whatsnew/3.11.rst:2063 msgid "" -":func:`open`, :func:`io.open`, :func:`codecs.open` and :class:`fileinput." -"FileInput` no longer accept ``'U'`` (\"universal newline\") in the file " -"mode. In Python 3, \"universal newline\" mode is used by default whenever a " -"file is opened in text mode, and the ``'U'`` flag has been deprecated since " -"Python 3.3. The :ref:`newline parameter <open-newline-parameter>` to these " -"functions controls how universal newlines work. (Contributed by Victor " -"Stinner in :issue:`37330`.)" -msgstr "" -":func:`open`、:func:`io.open`、:func:`codecs.open` 和 :class:`fileinput." -"FileInput` 不再接受 ``'U'``\\ (\"universal newline\",通用換行符)文件模式。" -"在 Python 3 中,每當以文本模式 (text mode) 打開檔案時,預設情況下會使用「通用" -"換行符」模式,並且自 Python 3.3 以來就不推薦使用 ``'U'`` 旗標。這些函式的 :" -"ref:`newline 參數 <open-newline-parameter>`\\ 控制了通用換行符的作用方式。" -"(由 Victor Stinner 在 :issue:`37330` 中貢獻。)" +":func:`open`, :func:`io.open`, :func:`codecs.open` " +"and :class:`fileinput.FileInput` no longer accept ``'U'`` (\"universal " +"newline\") in the file mode. In Python 3, \"universal newline\" mode is used " +"by default whenever a file is opened in text mode, and the ``'U'`` flag has " +"been deprecated since Python 3.3. The :ref:`newline parameter <open-newline-" +"parameter>` to these functions controls how universal newlines work. " +"(Contributed by Victor Stinner in :issue:`37330`.)" +msgstr "" +":func:`open`、:func:`io.open`、:func:`codecs.open` " +"和 :class:`fileinput.FileInput` 不再接受 ``'U'``\\ (\"universal newline\"," +"通用換行符)文件模式。在 Python 3 中,每當以文本模式 (text mode) 打開檔案時," +"預設情況下會使用「通用換行符」模式,並且自 Python 3.3 以來就不推薦使用 " +"``'U'`` 旗標。這些函式的 :ref:`newline 參數 <open-newline-parameter>`\\ 控制" +"了通用換行符的作用方式。(由 Victor Stinner 在 :issue:`37330` 中貢獻。)" #: ../../whatsnew/3.11.rst:2072 msgid "" -":class:`ast.AST` node positions are now validated when provided to :func:" -"`compile` and other related functions. If invalid positions are detected, a :" -"exc:`ValueError` will be raised. (Contributed by Pablo Galindo in :gh:" -"`93351`)" +":class:`ast.AST` node positions are now validated when provided " +"to :func:`compile` and other related functions. If invalid positions are " +"detected, a :exc:`ValueError` will be raised. (Contributed by Pablo Galindo " +"in :gh:`93351`)" msgstr "" ":class:`ast.AST` 節點位置現在會在提供給 :func:`compile` 和其他相關函式時被驗" -"證。如果檢測到無效位置,則會引發 :exc:`ValueError`。(由 Pablo Galindo 在 :" -"gh:`93351` 中貢獻)" +"證。如果檢測到無效位置,則會引發 :exc:`ValueError`。(由 Pablo Galindo " +"在 :gh:`93351` 中貢獻)" #: ../../whatsnew/3.11.rst:2076 msgid "" @@ -4082,21 +4133,23 @@ msgid "" "executors to :meth:`asyncio.loop.set_default_executor` following a " "deprecation in Python 3.8. (Contributed by Illia Volochii in :issue:`43234`.)" msgstr "" -"在 Python 3.8 中棄用後,禁止將非 :class:`concurrent.futures." -"ThreadPoolExecutor` 執行器傳遞給 :meth:`asyncio.loop.set_default_executor`。" -"(由 Illia Volochii 在 :issue:`43234` 中貢獻。)" +"在 Python 3.8 中棄用後,禁止將" +"非 :class:`concurrent.futures.ThreadPoolExecutor` 執行器傳遞" +"給 :meth:`asyncio.loop.set_default_executor`。(由 Illia Volochii " +"在 :issue:`43234` 中貢獻。)" #: ../../whatsnew/3.11.rst:2081 msgid "" -":mod:`calendar`: The :class:`calendar.LocaleTextCalendar` and :class:" -"`calendar.LocaleHTMLCalendar` classes now use :func:`locale.getlocale`, " -"instead of using :func:`locale.getdefaultlocale`, if no locale is specified. " +":mod:`calendar`: The :class:`calendar.LocaleTextCalendar` " +"and :class:`calendar.LocaleHTMLCalendar` classes now " +"use :func:`locale.getlocale`, instead of " +"using :func:`locale.getdefaultlocale`, if no locale is specified. " "(Contributed by Victor Stinner in :issue:`46659`.)" msgstr "" -":mod:`calendar`::class:`calendar.LocaleTextCalendar` 和 :class:`calendar." -"LocaleHTMLCalendar` 類別如果沒有指定語言環境,現在會使用 :func:`locale." -"getlocale` 而非 :func:`locale.getdefaultlocale`。(由 Victor Stinner 在 :" -"issue:`46659` 中貢獻。)" +":mod:`calendar`::class:`calendar.LocaleTextCalendar` " +"和 :class:`calendar.LocaleHTMLCalendar` 類別如果沒有指定語言環境,現在會使" +"用 :func:`locale.getlocale` 而非 :func:`locale.getdefaultlocale`。(由 " +"Victor Stinner 在 :issue:`46659` 中貢獻。)" #: ../../whatsnew/3.11.rst:2087 msgid "" @@ -4111,19 +4164,20 @@ msgstr "" msgid "" "The *population* parameter of :func:`random.sample` must be a sequence, and " "automatic conversion of :class:`set`\\s to :class:`list`\\s is no longer " -"supported. Also, if the sample size is larger than the population size, a :" -"exc:`ValueError` is raised. (Contributed by Raymond Hettinger in :issue:" -"`40465`.)" +"supported. Also, if the sample size is larger than the population size, " +"a :exc:`ValueError` is raised. (Contributed by Raymond Hettinger " +"in :issue:`40465`.)" msgstr "" -":func:`random.sample` 的 *population* 參數必須是一個序列,不再支援 :class:" -"`set` 到 :class:`list` 的自動轉換。此外,如果抽樣大小大於總體大小,則會引發 :" -"exc:`ValueError`。(由 Raymond Hettinger 在 :issue:`40465` 中貢獻。)" +":func:`random.sample` 的 *population* 參數必須是一個序列,不再支" +"援 :class:`set` 到 :class:`list` 的自動轉換。此外,如果抽樣大小大於總體大小," +"則會引發 :exc:`ValueError`。(由 Raymond Hettinger 在 :issue:`40465` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:2097 msgid "" "The *random* optional parameter of :func:`random.shuffle` was removed. It " -"was previously an arbitrary random function to use for the shuffle; now, :" -"func:`random.random` (its previous default) will always be used." +"was previously an arbitrary random function to use for the shuffle; " +"now, :func:`random.random` (its previous default) will always be used." msgstr "" "刪除了 :func:`random.shuffle` 的 *random* 可選參數。它以前是用於隨機排列 " "(shuffle) 的任意隨機函式;現在都會使用 :func:`random.random`\\ (這是它以前的" @@ -4133,8 +4187,8 @@ msgstr "" msgid "" "In :mod:`re` :ref:`re-syntax`, global inline flags (e.g. ``(?i)``) can now " "only be used at the start of regular expressions. Using them elsewhere has " -"been deprecated since Python 3.6. (Contributed by Serhiy Storchaka in :issue:" -"`47066`.)" +"been deprecated since Python 3.6. (Contributed by Serhiy Storchaka " +"in :issue:`47066`.)" msgstr "" "在 :mod:`re` :ref:`re-syntax` 中,全域行內旗標(例如 ``(?i)``)現在只能在規則" "運算式的開頭使用。自 Python 3.6 以來,在其他地方使用它們已被棄用。(由 " @@ -4166,8 +4220,8 @@ msgid "" "limited subset of POSIX APIs; Python standard libraries features and modules " "related to networking, processes, threading, signals, mmap, and users/groups " "are not available or don't work. (Emscripten contributed by Christian Heimes " -"and Ethan Smith in :gh:`84461` and WASI contributed by Christian Heimes in :" -"gh:`90473`; platforms promoted in :gh:`95085`)" +"and Ethan Smith in :gh:`84461` and WASI contributed by Christian Heimes " +"in :gh:`90473`; platforms promoted in :gh:`95085`)" msgstr "" "CPython 現在有 :pep:`11` :pep:`Tier 3 支援 <11#tier-3>` 以用於交叉編譯至 " "`WebAssembly <https://webassembly.org/>`_ 平台 `Emscripten <https://" @@ -4188,8 +4242,8 @@ msgid "" "A `C11 <https://en.cppreference.com/w/c/11>`_ compiler and standard library. " "`Optional C11 features <https://en.wikipedia.org/wiki/" "C11_(C_standard_revision)#Optional_features>`_ are not required. " -"(Contributed by Victor Stinner in :issue:`46656`, :issue:`45440` and :issue:" -"`46640`.)" +"(Contributed by Victor Stinner in :issue:`46656`, :issue:`45440` " +"and :issue:`46640`.)" msgstr "" "`C11 <https://en.cppreference.com/w/c/11>`_ 編譯器與標準函式庫。`可選的 C11 " "特性 <https://en.wikipedia.org/wiki/" @@ -4229,16 +4283,16 @@ msgid "" "detected by `pkg-config <https://www.freedesktop.org/wiki/Software/pkg-" "config/>`_ (when available). :mod:`tkinter` now requires a pkg-config " "command to detect development settings for `Tcl/Tk`_ headers and libraries. " -"(Contributed by Christian Heimes and Erlend Egeberg Aasland in :issue:" -"`45847`, :issue:`45747`, and :issue:`45763`.)" +"(Contributed by Christian Heimes and Erlend Egeberg Aasland " +"in :issue:`45847`, :issue:`45747`, and :issue:`45763`.)" msgstr "" "大多數 stdlib 擴充模組的依賴套件、編譯器旗標 (compiler flag) 和鏈接器旗標 " "(linker flags) 現在可以透過 :program:`configure` 檢測出來。(當可用時)\\ " "`pkg-config <https://www.freedesktop.org/wiki/Software/pkg-config/>`_ 會檢測" "出 libffi、libnsl、libsqlite3、zlib、bzip2、liblzma、libcrypt、Tcl/Tk 和 " "uuid 旗標。:mod:`tkinter` 現在需要一個 pkg-config 命令來檢測 `Tcl/Tk`_ 標頭檔" -"和函式庫的開發設定。(由 Christian Heimes 和 Erlend Egeberg Aasland 在 :" -"issue:`45847`、:issue:`45747` 和 :issue:`45763` 中貢獻。)" +"和函式庫的開發設定。(由 Christian Heimes 和 Erlend Egeberg Aasland " +"在 :issue:`45847`、:issue:`45747` 和 :issue:`45763` 中貢獻。)" #: ../../whatsnew/3.11.rst:2162 msgid "" @@ -4251,20 +4305,20 @@ msgstr "" msgid "" "CPython can now be built with the `ThinLTO <https://clang.llvm.org/docs/" "ThinLTO.html>`_ option via passing ``thin`` to :option:`--with-lto`, i.e. " -"``--with-lto=thin``. (Contributed by Donghee Na and Brett Holman in :issue:" -"`44340`.)" +"``--with-lto=thin``. (Contributed by Donghee Na and Brett Holman " +"in :issue:`44340`.)" msgstr "" "CPython 現在可以透過將 ``thin`` 傳遞給 :option:`--with-lto`\\ (也就是 ``--" -"with-lto=thin``\\ )來以 `ThinLTO <https://clang.llvm.org/docs/ThinLTO." -"html>`_ 選項建置。(由 Donghee Na 與 Brett Holman 於 :issue:`44340` 中所貢" -"獻。)" +"with-lto=thin``\\ )來以 `ThinLTO <https://clang.llvm.org/docs/" +"ThinLTO.html>`_ 選項建置。(由 Donghee Na 與 Brett Holman 於 :issue:`44340` " +"中所貢獻。)" #: ../../whatsnew/3.11.rst:2170 msgid "" "Freelists for object structs can now be disabled. A new :program:`configure` " "option :option:`--without-freelists` can be used to disable all freelists " -"except empty tuple singleton. (Contributed by Christian Heimes in :issue:" -"`45522`.)" +"except empty tuple singleton. (Contributed by Christian Heimes " +"in :issue:`45522`.)" msgstr "" #: ../../whatsnew/3.11.rst:2175 @@ -4272,13 +4326,14 @@ msgid "" "``Modules/Setup`` and ``Modules/makesetup`` have been improved and tied up. " "Extension modules can now be built through ``makesetup``. All except some " "test modules can be linked statically into a main binary or library. " -"(Contributed by Brett Cannon and Christian Heimes in :issue:`45548`, :issue:" -"`45570`, :issue:`45571`, and :issue:`43974`.)" +"(Contributed by Brett Cannon and Christian Heimes " +"in :issue:`45548`, :issue:`45570`, :issue:`45571`, and :issue:`43974`.)" msgstr "" "``Modules/Setup`` 和 ``Modules/makesetup`` 已得到改進和綁定。現在可以通過 " "``makesetup`` 建置擴充模組。除了一些測試模組外,所有模組都可以靜態鏈接到主要" -"的二進制文件或函式庫中。(由 Brett Cannon 和 Christian Heimes 在 :issue:" -"`45548`、:issue:`45570`、:issue:`45571` 和 :issue:`43974` 中貢獻。)" +"的二進制文件或函式庫中。(由 Brett Cannon 和 Christian Heimes " +"在 :issue:`45548`、:issue:`45570`、:issue:`45571` 和 :issue:`43974` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:2182 msgid "" @@ -4299,20 +4354,20 @@ msgid "" "build Python with RHEL 7's and CentOS 7's Tcl/Tk and OpenSSL." msgstr "" "RHEL 7 和 CentOS 7 上的開發套件並無提供 ``tcl.pc`` 和 ``tk.pc``;要使用 " -"``TCLTK_LIBS=\"-ltk8.5 -ltkstub8.5 -ltcl8.5\"``。目錄 ``Misc/rhel7`` 包含 ``." -"pc`` 檔案與如何使用 RHEL 7 和 CentOS 7 的 Tcl/Tk 與 OpenSSL 建置 Python 的指" -"示。" +"``TCLTK_LIBS=\"-ltk8.5 -ltkstub8.5 -ltcl8.5\"``。目錄 ``Misc/rhel7`` 包含 " +"``.pc`` 檔案與如何使用 RHEL 7 和 CentOS 7 的 Tcl/Tk 與 OpenSSL 建置 Python 的" +"指示。" #: ../../whatsnew/3.11.rst:2193 msgid "" "CPython will now use 30-bit digits by default for the Python :class:`int` " "implementation. Previously, the default was to use 30-bit digits on " "platforms with ``SIZEOF_VOID_P >= 8``, and 15-bit digits otherwise. It's " -"still possible to explicitly request use of 15-bit digits via either the :" -"option:`--enable-big-digits` option to the configure script or (for Windows) " -"the ``PYLONG_BITS_IN_DIGIT`` variable in ``PC/pyconfig.h``, but this option " -"may be removed at some point in the future. (Contributed by Mark Dickinson " -"in :issue:`45569`.)" +"still possible to explicitly request use of 15-bit digits via either " +"the :option:`--enable-big-digits` option to the configure script or (for " +"Windows) the ``PYLONG_BITS_IN_DIGIT`` variable in ``PC/pyconfig.h``, but " +"this option may be removed at some point in the future. (Contributed by Mark " +"Dickinson in :issue:`45569`.)" msgstr "" "CPython 現在預設使用 30-bit 數字來實作 Python :class:`int`。以前,在 " "``SIZEOF_VOID_P >= 8`` 的平台上預設使用 30-bit 數字,否則使用 15-bit 數字,但" @@ -4330,8 +4385,8 @@ msgid "" "Add a new :c:func:`PyType_GetName` function to get type's short name. " "(Contributed by Hai Shi in :issue:`42035`.)" msgstr "" -"新增 :c:func:`PyType_GetName` 函式來取得型別的短名。(由 Hai Shi 於 :issue:" -"`42035` 中所貢獻。)" +"新增 :c:func:`PyType_GetName` 函式來取得型別的短名。(由 Hai Shi " +"於 :issue:`42035` 中所貢獻。)" #: ../../whatsnew/3.11.rst:2216 msgid "" @@ -4343,20 +4398,20 @@ msgstr "" #: ../../whatsnew/3.11.rst:2219 msgid "" -"Add new :c:func:`PyThreadState_EnterTracing` and :c:func:" -"`PyThreadState_LeaveTracing` functions to the limited C API to suspend and " -"resume tracing and profiling. (Contributed by Victor Stinner in :issue:" -"`43760`.)" +"Add new :c:func:`PyThreadState_EnterTracing` " +"and :c:func:`PyThreadState_LeaveTracing` functions to the limited C API to " +"suspend and resume tracing and profiling. (Contributed by Victor Stinner " +"in :issue:`43760`.)" msgstr "" -"在受限 C API (limited C API) 中新增 :c:func:`PyThreadState_EnterTracing` 和 :" -"c:func:`PyThreadState_LeaveTracing` 函式來中止和繼續追蹤 (tracing) 和性能分" -"析 (profiling)。(由 Victor Stinner 於 :issue:`43760` 中貢獻。)" +"在受限 C API (limited C API) 中新增 :c:func:`PyThreadState_EnterTracing` " +"和 :c:func:`PyThreadState_LeaveTracing` 函式來中止和繼續追蹤 (tracing) 和性能" +"分析 (profiling)。(由 Victor Stinner 於 :issue:`43760` 中貢獻。)" #: ../../whatsnew/3.11.rst:2224 msgid "" -"Added the :c:data:`Py_Version` constant which bears the same value as :c:" -"macro:`PY_VERSION_HEX`. (Contributed by Gabriele N. Tornetta in :issue:" -"`43931`.)" +"Added the :c:data:`Py_Version` constant which bears the same value " +"as :c:macro:`PY_VERSION_HEX`. (Contributed by Gabriele N. Tornetta " +"in :issue:`43931`.)" msgstr "" "添加了 :c:data:`Py_Version` 常數,其值與 :c:macro:`PY_VERSION_HEX` 相同。" "(由 Gabriele N. Tornetta 在 :issue:`43931` 中貢獻。)" @@ -4417,11 +4472,11 @@ msgstr ":c:func:`PyMemoryView_FromBuffer`" #: ../../whatsnew/3.11.rst:2243 msgid "" -":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." -"bf_releasebuffer` type slots" +":c:member:`~PyBufferProcs.bf_getbuffer` " +"and :c:member:`~PyBufferProcs.bf_releasebuffer` type slots" msgstr "" -":c:member:`~PyBufferProcs.bf_getbuffer` 與 :c:member:`~PyBufferProcs." -"bf_releasebuffer` 型別插槽 (type slot)" +":c:member:`~PyBufferProcs.bf_getbuffer` " +"與 :c:member:`~PyBufferProcs.bf_releasebuffer` 型別插槽 (type slot)" #: ../../whatsnew/3.11.rst:2246 msgid "(Contributed by Christian Heimes in :issue:`45459`.)" @@ -4440,39 +4495,38 @@ msgstr "" #: ../../whatsnew/3.11.rst:2253 msgid "" -"Add new functions to pack and unpack C double (serialize and deserialize): :" -"c:func:`PyFloat_Pack2`, :c:func:`PyFloat_Pack4`, :c:func:`PyFloat_Pack8`, :c:" -"func:`PyFloat_Unpack2`, :c:func:`PyFloat_Unpack4` and :c:func:" -"`PyFloat_Unpack8`. (Contributed by Victor Stinner in :issue:`46906`.)" +"Add new functions to pack and unpack C double (serialize and " +"deserialize): :c:func:`PyFloat_Pack2`, :c:func:`PyFloat_Pack4`, :c:func:`PyFloat_Pack8`, :c:func:`PyFloat_Unpack2`, :c:func:`PyFloat_Unpack4` " +"and :c:func:`PyFloat_Unpack8`. (Contributed by Victor Stinner " +"in :issue:`46906`.)" msgstr "" -"新增函式以打包 (pack) 和取出 (unpack) C double(序列化和反序列化)::c:func:" -"`PyFloat_Pack2`、:c:func:`PyFloat_Pack4`、:c:func:`PyFloat_Pack8`、:c:func:" -"`PyFloat_Unpack2` , :c:func:`PyFloat_Unpack4` 和 :c:func:`PyFloat_Unpack8`。" -"(由 Victor Stinner 在 :issue:`46906` 中貢獻。)" +"新增函式以打包 (pack) 和取出 (unpack) C double(序列化和反序列" +"化)::c:func:`PyFloat_Pack2`、:c:func:`PyFloat_Pack4`、:c:func:`PyFloat_Pack8`、:c:func:`PyFloat_Unpack2` , :c:func:`PyFloat_Unpack4` " +"和 :c:func:`PyFloat_Unpack8`。(由 Victor Stinner 在 :issue:`46906` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:2259 msgid "" -"Add new functions to get frame object attributes: :c:func:" -"`PyFrame_GetBuiltins`, :c:func:`PyFrame_GetGenerator`, :c:func:" -"`PyFrame_GetGlobals`, :c:func:`PyFrame_GetLasti`." +"Add new functions to get frame object " +"attributes: :c:func:`PyFrame_GetBuiltins`, :c:func:`PyFrame_GetGenerator`, :c:func:`PyFrame_GetGlobals`, :c:func:`PyFrame_GetLasti`." msgstr "" -"新增取得幀物件屬性的函式::c:func:`PyFrame_GetBuiltins`、:c:func:" -"`PyFrame_GetGenerator`、:c:func:`PyFrame_GetGlobals`、:c:func:" -"`PyFrame_GetLasti`。" +"新增取得幀物件屬性的函" +"式::c:func:`PyFrame_GetBuiltins`、:c:func:`PyFrame_GetGenerator`、:c:func:`PyFrame_GetGlobals`、:c:func:`PyFrame_GetLasti`。" #: ../../whatsnew/3.11.rst:2263 msgid "" -"Added two new functions to get and set the active exception instance: :c:" -"func:`PyErr_GetHandledException` and :c:func:`PyErr_SetHandledException`. " -"These are alternatives to :c:func:`PyErr_SetExcInfo()` and :c:func:" -"`PyErr_GetExcInfo()` which work with the legacy 3-tuple representation of " -"exceptions. (Contributed by Irit Katriel in :issue:`46343`.)" +"Added two new functions to get and set the active exception " +"instance: :c:func:`PyErr_GetHandledException` " +"and :c:func:`PyErr_SetHandledException`. These are alternatives " +"to :c:func:`PyErr_SetExcInfo()` and :c:func:`PyErr_GetExcInfo()` which work " +"with the legacy 3-tuple representation of exceptions. (Contributed by Irit " +"Katriel in :issue:`46343`.)" msgstr "" -"添加了兩個新函式來獲得和設置仍在作用的例外實例::c:func:" -"`PyErr_GetHandledException` 和 :c:func:`PyErr_SetHandledException`。這些是 :" -"c:func:`PyErr_SetExcInfo()` 和 :c:func:`PyErr_GetExcInfo()` 的替代品,它們與" -"例外的遺留三元組表示法一起作用。(由 Irit Katriel 在 :issue:`46343` 中貢" -"獻。)" +"添加了兩個新函式來獲得和設置仍在作用的例外實" +"例::c:func:`PyErr_GetHandledException` " +"和 :c:func:`PyErr_SetHandledException`。這些是 :c:func:`PyErr_SetExcInfo()` " +"和 :c:func:`PyErr_GetExcInfo()` 的替代品,它們與例外的遺留三元組表示法一起作" +"用。(由 Irit Katriel 在 :issue:`46343` 中貢獻。)" #: ../../whatsnew/3.11.rst:2270 msgid "" @@ -4493,11 +4547,11 @@ msgid "" "expected types. See :pep:`670` for more details. (Contributed by Victor " "Stinner and Erlend E. Aasland in :gh:`89653`.)" msgstr "" -"一些巨集已轉換為行內靜態函式以避免\\ `巨集陷阱 (macro pitfalls) <https://gcc." -"gnu.org/onlinedocs/cpp/Macro-Pitfalls.html>`_。這種變化對用戶來說應該是透明" -"的,因為替換函式會將它們的引數轉換為預期的型別,以避免由於靜態型別檢查而產生" -"的編譯器警告。但是,當受限 C API 設置為 >=3.11 時,這些轉換不會完成,使用者需" -"要將引數轉換為他們期望的型別。有關更多詳細資訊,請參閱 :pep:`670`。(由 " +"一些巨集已轉換為行內靜態函式以避免\\ `巨集陷阱 (macro pitfalls) <https://" +"gcc.gnu.org/onlinedocs/cpp/Macro-Pitfalls.html>`_。這種變化對用戶來說應該是透" +"明的,因為替換函式會將它們的引數轉換為預期的型別,以避免由於靜態型別檢查而產" +"生的編譯器警告。但是,當受限 C API 設置為 >=3.11 時,這些轉換不會完成,使用者" +"需要將引數轉換為他們期望的型別。有關更多詳細資訊,請參閱 :pep:`670`。(由 " "Victor Stinner 和 Erlend E. Aasland 在 :gh:`89653` 中貢獻。)" #: ../../whatsnew/3.11.rst:2292 @@ -4558,17 +4612,17 @@ msgstr "" #: ../../whatsnew/3.11.rst:2318 msgid "" ":c:type:`PyCodeObject` no longer has the ``co_code``, ``co_varnames``, " -"``co_cellvars`` and ``co_freevars`` fields. Instead, use :c:func:" -"`PyCode_GetCode`, :c:func:`PyCode_GetVarnames`, :c:func:`PyCode_GetCellvars` " +"``co_cellvars`` and ``co_freevars`` fields. Instead, " +"use :c:func:`PyCode_GetCode`, :c:func:`PyCode_GetVarnames`, :c:func:`PyCode_GetCellvars` " "and :c:func:`PyCode_GetFreevars` respectively to access them via the C API. " "(Contributed by Brandt Bucher in :issue:`46841` and Ken Jin in :gh:`92154` " "and :gh:`94936`.)" msgstr "" ":c:type:`PyCodeObject` 不再會有 ``co_code``、``co_varnames``、" -"``co_cellvars`` 和 ``co_freevars`` 欄位。分別被改為透過 C API 的 :c:func:" -"`PyCode_GetCode`、:c:func:`PyCode_GetVarnames`、:c:func:`PyCode_GetCellvars` " -"和 :c:func:`PyCode_GetFreevars` 來存取。(由 Brandt Bucher 在 :issue:" -"`46841`、Ken Jin 在 :gh:`92154` 與 :gh:`94936` 中貢獻。)" +"``co_cellvars`` 和 ``co_freevars`` 欄位。分別被改為透過 C API " +"的 :c:func:`PyCode_GetCode`、:c:func:`PyCode_GetVarnames`、:c:func:`PyCode_GetCellvars` " +"和 :c:func:`PyCode_GetFreevars` 來存取。(由 Brandt Bucher " +"在 :issue:`46841`、Ken Jin 在 :gh:`92154` 與 :gh:`94936` 中貢獻。)" #: ../../whatsnew/3.11.rst:2326 msgid "" @@ -4667,24 +4721,25 @@ msgstr "" msgid "" "The :c:func:`PyType_Ready` function now raises an error if a type is defined " "with the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set but has no traverse function " -"(:c:member:`PyTypeObject.tp_traverse`). (Contributed by Victor Stinner in :" -"issue:`44263`.)" +"(:c:member:`PyTypeObject.tp_traverse`). (Contributed by Victor Stinner " +"in :issue:`44263`.)" msgstr "" "如果一個型別是以 :c:macro:`Py_TPFLAGS_HAVE_GC` 旗標來定義,但卻沒有遍歷函式 " -"(traverse function) (:c:member:`PyTypeObject.tp_traverse`),那 :c:func:" -"`PyType_Ready` 函式現在會引發一個錯誤。(由 Victor Stinner 於 :issue:`44263` " -"中貢獻。)" +"(traverse function) (:c:member:`PyTypeObject.tp_traverse`)," +"那 :c:func:`PyType_Ready` 函式現在會引發一個錯誤。(由 Victor Stinner " +"於 :issue:`44263` 中貢獻。)" #: ../../whatsnew/3.11.rst:2372 msgid "" "Heap types with the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag can now inherit " -"the :pep:`590` vectorcall protocol. Previously, this was only possible for :" -"ref:`static types <static-types>`. (Contributed by Erlend E. Aasland in :" -"issue:`43908`)" +"the :pep:`590` vectorcall protocol. Previously, this was only possible " +"for :ref:`static types <static-types>`. (Contributed by Erlend E. Aasland " +"in :issue:`43908`)" msgstr "" -"帶有 :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` 旗標的堆積型別現在可以繼承 :pep:" -"`590` 向量呼叫協定 (vectorcall protocol)。以前這僅適用於 :ref:`static types " -"<static-types>`。(由 Erlend E. Aasland 在 :issue:`43908` 中貢獻)。" +"帶有 :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` 旗標的堆積型別現在可以繼" +"承 :pep:`590` 向量呼叫協定 (vectorcall protocol)。以前這僅適用" +"於 :ref:`static types <static-types>`。(由 Erlend E. Aasland " +"在 :issue:`43908` 中貢獻)。" #: ../../whatsnew/3.11.rst:2377 msgid "" @@ -4694,9 +4749,9 @@ msgid "" "Python 3.9). For backward compatibility, this macro can be used::" msgstr "" "由於 :c:func:`Py_TYPE()` 更改為行內靜態函式 (inline static function),因此 " -"``Py_TYPE(obj) = new_type`` 必須替換為 ``Py_SET_TYPE(obj, new_type)``:參見 :" -"c:func:`Py_SET_TYPE()` 函式(自 Python 3.9 起可用)。為了向後相容,可以使用這" -"個巨集:" +"``Py_TYPE(obj) = new_type`` 必須替換為 ``Py_SET_TYPE(obj, new_type)``:參" +"見 :c:func:`Py_SET_TYPE()` 函式(自 Python 3.9 起可用)。為了向後相容,可以使" +"用這個巨集:" #: ../../whatsnew/3.11.rst:2383 msgid "" @@ -4724,9 +4779,9 @@ msgid "" "Python 3.9). For backward compatibility, this macro can be used::" msgstr "" "由於 :c:func:`Py_SIZE()` 更改為行內靜態函式,因此 ``Py_SIZE(obj) = " -"new_size`` 必須替換為 ``Py_SET_SIZE(obj, new_size)``:參見 :c:func:" -"`Py_SET_SIZE()` 函式(自 Python 3.9 起可用)。為了向後相容,可以使用這個巨" -"集:" +"new_size`` 必須替換為 ``Py_SET_SIZE(obj, new_size)``:參" +"見 :c:func:`Py_SET_SIZE()` 函式(自 Python 3.9 起可用)。為了向後相容,可以使" +"用這個巨集:" #: ../../whatsnew/3.11.rst:2397 msgid "" @@ -4744,9 +4799,9 @@ msgstr "" #: ../../whatsnew/3.11.rst:2405 msgid "" -"``<Python.h>`` no longer includes the header files ``<stdlib.h>``, ``<stdio." -"h>``, ``<errno.h>`` and ``<string.h>`` when the ``Py_LIMITED_API`` macro is " -"set to ``0x030b0000`` (Python 3.11) or higher. C extensions should " +"``<Python.h>`` no longer includes the header files ``<stdlib.h>``, " +"``<stdio.h>``, ``<errno.h>`` and ``<string.h>`` when the ``Py_LIMITED_API`` " +"macro is set to ``0x030b0000`` (Python 3.11) or higher. C extensions should " "explicitly include the header files after ``#include <Python.h>``. " "(Contributed by Victor Stinner in :issue:`45434`.)" msgstr "" @@ -4780,8 +4835,8 @@ msgid "" "Victor Stinner in :issue:`46007`.)" msgstr "" ":c:func:`!PyUnicode_CHECK_INTERNED` 巨集已從受限 C API 中移出,它從來沒辦法被" -"使用,因為它使用了受限 C API 不提供的內部結構。(由 Victor Stinner 於 :issue:" -"`46007` 中所貢獻。)" +"使用,因為它使用了受限 C API 不提供的內部結構。(由 Victor Stinner " +"於 :issue:`46007` 中所貢獻。)" #: ../../whatsnew/3.11.rst:2424 msgid "" @@ -4891,8 +4946,8 @@ msgid "" "it may be faster." msgstr "" "``f_lasti``:使用 :c:func:`PyFrame_GetLasti`。程式碼中 ``f_lasti`` 有與 " -"``PyCode_Addr2Line()`` 同時使用的部分應該改用 :c:func:" -"`PyFrame_GetLineNumber`;它可能會更快。" +"``PyCode_Addr2Line()`` 同時使用的部分應該改" +"用 :c:func:`PyFrame_GetLineNumber`;它可能會更快。" #: ../../whatsnew/3.11.rst:2464 msgid "``f_lineno``: use :c:func:`PyFrame_GetLineNumber`" @@ -4940,25 +4995,25 @@ msgstr "``f_valuestack``:已移除。" #: ../../whatsnew/3.11.rst:2474 msgid "" -"The Python frame object is now created lazily. A side effect is that the :" -"attr:`~frame.f_back` member must not be accessed directly, since its value " -"is now also computed lazily. The :c:func:`PyFrame_GetBack` function must be " -"called instead." +"The Python frame object is now created lazily. A side effect is that " +"the :attr:`~frame.f_back` member must not be accessed directly, since its " +"value is now also computed lazily. The :c:func:`PyFrame_GetBack` function " +"must be called instead." msgstr "" "Python 幀物件的建立現為惰性的 (lazily),一個副作用是 :attr:`~frame.f_back` 成" -"員不能被直接存取,因為其職的計算也是惰性的,要改呼叫 :c:func:" -"`PyFrame_GetBack`。" +"員不能被直接存取,因為其職的計算也是惰性的,要改呼" +"叫 :c:func:`PyFrame_GetBack`。" #: ../../whatsnew/3.11.rst:2480 msgid "" -"Debuggers that accessed the :attr:`~frame.f_locals` directly *must* call :c:" -"func:`PyFrame_GetLocals` instead. They no longer need to call :c:func:`!" -"PyFrame_FastToLocalsWithError` or :c:func:`!PyFrame_LocalsToFast`, in fact " -"they should not call those functions. The necessary updating of the frame is " -"now managed by the virtual machine." +"Debuggers that accessed the :attr:`~frame.f_locals` directly *must* " +"call :c:func:`PyFrame_GetLocals` instead. They no longer need to " +"call :c:func:`!PyFrame_FastToLocalsWithError` or :c:func:`!" +"PyFrame_LocalsToFast`, in fact they should not call those functions. The " +"necessary updating of the frame is now managed by the virtual machine." msgstr "" -"直接存取 :attr:`~frame.f_locals` 的除錯器\\ *必須*\\ 改為呼叫 :c:func:" -"`PyFrame_GetLocals`。他們不再需要呼叫 :c:func:`!" +"直接存取 :attr:`~frame.f_locals` 的除錯器\\ *必須*\\ 改為呼" +"叫 :c:func:`PyFrame_GetLocals`。他們不再需要呼叫 :c:func:`!" "PyFrame_FastToLocalsWithError` 或 :c:func:`!PyFrame_LocalsToFast`,事實上他們" "不應該呼叫這些函式。框架的必要更新現在由虛擬機管理。" @@ -5030,13 +5085,13 @@ msgstr "" #: ../../whatsnew/3.11.rst:2516 msgid "" -"``tracing``: changed, use :c:func:`PyThreadState_EnterTracing` and :c:func:" -"`PyThreadState_LeaveTracing` (functions added to Python 3.11 by :issue:" -"`43760`)." +"``tracing``: changed, use :c:func:`PyThreadState_EnterTracing` " +"and :c:func:`PyThreadState_LeaveTracing` (functions added to Python 3.11 " +"by :issue:`43760`)." msgstr "" -"``tracing``:已變更,改用 :c:func:`PyThreadState_EnterTracing` 和 :c:func:" -"`PyThreadState_LeaveTracing`\\ (:issue:`43760` 於 Python 3.11 中新增的函" -"式)。" +"``tracing``:已變更,改用 :c:func:`PyThreadState_EnterTracing` " +"和 :c:func:`PyThreadState_LeaveTracing`\\ (:issue:`43760` 於 Python 3.11 中" +"新增的函式)。" #: ../../whatsnew/3.11.rst:2519 msgid "" @@ -5135,7 +5190,7 @@ msgid "" "Or use `the pythoncapi-compat project <https://github.com/python/pythoncapi-" "compat>`__ to get these functions on old Python functions." msgstr "" -"或是使用 `pythoncap-compat 計畫 <https://github.com/python/pythoncapi-" +"或是使用 `pythoncap-compat 專案 <https://github.com/python/pythoncapi-" "compat>`__\\ 來在舊版 Python 函式中取得它們。" #: ../../whatsnew/3.11.rst:2563 @@ -5151,22 +5206,23 @@ msgid "" "initialize :data:`sys.path`. Otherwise, initialization will recalculate the " "path and replace any values added to ``module_search_paths``." msgstr "" -"初始化中若是要用 :c:member:`PyConfig.module_search_paths` 來初始化 :data:" -"`sys.path`,則現在 :c:member:`PyConfig.module_search_paths_set` 必須被設為 " -"1。否則,初始化會重新計算路徑並取代所有被加到 ``module_search_paths`` 的值。" +"初始化中若是要用 :c:member:`PyConfig.module_search_paths` 來初始" +"化 :data:`sys.path`,則現在 :c:member:`PyConfig.module_search_paths_set` 必須" +"被設為 1。否則,初始化會重新計算路徑並取代所有被加到 ``module_search_paths`` " +"的值。" #: ../../whatsnew/3.11.rst:2571 msgid "" ":c:func:`PyConfig_Read` no longer calculates the initial search path, and " "will not fill any values into :c:member:`PyConfig.module_search_paths`. To " -"calculate default paths and then modify them, finish initialization and use :" -"c:func:`PySys_GetObject` to retrieve :data:`sys.path` as a Python list " +"calculate default paths and then modify them, finish initialization and " +"use :c:func:`PySys_GetObject` to retrieve :data:`sys.path` as a Python list " "object and modify it directly." msgstr "" -":c:func:`PyConfig_Read` 不再計算初始搜索路徑,並且不會將任何值填充到 :c:" -"member:`PyConfig.module_search_paths` 中。若要計算預設路徑然後修改它們,完成" -"初始化並使用 :c:func:`PySys_GetObject` 以取得 :data:`sys.path` 作為 Python 列" -"表物件並直接修改它。" +":c:func:`PyConfig_Read` 不再計算初始搜索路徑,並且不會將任何值填充" +"到 :c:member:`PyConfig.module_search_paths` 中。若要計算預設路徑然後修改它" +"們,完成初始化並使用 :c:func:`PySys_GetObject` 以取得 :data:`sys.path` 作為 " +"Python 列表物件並直接修改它。" #: ../../whatsnew/3.11.rst:2582 msgid "" @@ -5232,11 +5288,12 @@ msgstr "" #: ../../whatsnew/3.11.rst:2601 msgid "" -"Deprecate the ``ob_shash`` member of the :c:type:`PyBytesObject`. Use :c:" -"func:`PyObject_Hash` instead. (Contributed by Inada Naoki in :issue:`46864`.)" +"Deprecate the ``ob_shash`` member of the :c:type:`PyBytesObject`. " +"Use :c:func:`PyObject_Hash` instead. (Contributed by Inada Naoki " +"in :issue:`46864`.)" msgstr "" -"棄用 :c:type:`PyBytesObject` 中的 ``ob_shash`` 成員。請改用 :c:func:" -"`PyObject_Hash`。(由 Inada Naoki 於 :issue:`46864` 中所貢獻。)" +"棄用 :c:type:`PyBytesObject` 中的 ``ob_shash`` 成員。請改" +"用 :c:func:`PyObject_Hash`。(由 Inada Naoki 於 :issue:`46864` 中所貢獻。)" #: ../../whatsnew/3.11.rst:2610 msgid "" @@ -5366,8 +5423,8 @@ msgstr "" #: ../../whatsnew/3.11.rst:2659 msgid "" "Remove the ``Py_FORCE_DOUBLE()`` macro. It was used by the " -"``Py_IS_INFINITY()`` macro. (Contributed by Victor Stinner in :issue:" -"`45440`.)" +"``Py_IS_INFINITY()`` macro. (Contributed by Victor Stinner " +"in :issue:`45440`.)" msgstr "" "移除 ``Py_FORCE_DOUBLE()`` 巨集。它先前被用於 ``Py_IS_INFINITY()`` 巨集。" "(由 Victor Stinner 於 :issue:`45440` 中所貢獻。)" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index 4f0abbe638..c5db73d435 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-03-27 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,8 +31,8 @@ msgstr "Adam Turner" #: ../../whatsnew/3.12.rst:48 msgid "" "This article explains the new features in Python 3.12, compared to 3.11. " -"Python 3.12 was released on October 2, 2023. For full details, see " -"the :ref:`changelog <changelog>`." +"Python 3.12 was released on October 2, 2023. For full details, see the :ref:" +"`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.12 與 3.11 相比多了哪些新功能。 Python 3.12 於 2023 年 " "10 月 2 日發布。完整詳情請見 :ref:`changelog <changelog>`。" @@ -54,16 +54,25 @@ msgid "" "Filesystem support in :mod:`os` and :mod:`pathlib` has seen a number of " "improvements, and several modules have better performance." msgstr "" +"Python 3.12 是 Python 程式語言的穩定版本,包含了語言和標準函式庫的綜合變更。" +"標準函式庫的變更主要集中在清理棄用的 API、可用性和正確性。值得注意的是,:mod:" +"`!distutils` 套件已從標準函式庫中移除。:mod:`os` 和 :mod:`pathlib` 中的檔案系" +"統支援進行了許多改進,並且有數個模組得到更好的效能。" #: ../../whatsnew/3.12.rst:69 msgid "" "The language changes focus on usability, as :term:`f-strings <f-string>` " "have had many limitations removed and 'Did you mean ...' suggestions " "continue to improve. The new :ref:`type parameter syntax <whatsnew312-" -"pep695>` and :keyword:`type` statement improve ergonomics for " -"using :term:`generic types <generic type>` and :term:`type aliases <type " -"alias>` with static type checkers." +"pep695>` and :keyword:`type` statement improve ergonomics for using :term:" +"`generic types <generic type>` and :term:`type aliases <type alias>` with " +"static type checkers." msgstr "" +"語言變更主要集中在可用性,因為 :term:`f-字串 <f-string>`\\ 已經移除了許多限" +"制,並且持續改進 'Did you mean ...' 建議。新的\\ :ref:`型別參數語法 " +"<whatsnew312-pep695>`\\ 和 :keyword:`type` 陳述式改進了\\ :term:`泛型型別 " +"<generic type>`\\ 和\\ :term:`型別別名 <type alias>`\\ 在與靜態型別檢查器一起" +"使用上的效率。" #: ../../whatsnew/3.12.rst:76 msgid "" @@ -75,6 +84,10 @@ msgid "" "change, refer to the PEP for a particular new feature; but note that PEPs " "usually are not kept up-to-date once a feature has been fully implemented." msgstr "" +"這篇文章並不試圖提供所有新功能的完整規格,而是提供一個方便的概覽。完整詳情應" +"參考文件,如\\ :ref:`標準函式庫參考 <library-index>`\\ 和\\ :ref:`語言參考 " +"<reference-index>`。如果你想了解某個新功能的完整實作和設計理念,請參考該功能" +"的 PEP;但請注意 PEP 通常在功能完全實作後就不再更新。" #: ../../whatsnew/3.12.rst:90 msgid "New syntax features:" @@ -82,8 +95,8 @@ msgstr "新增語法特性:" #: ../../whatsnew/3.12.rst:92 msgid "" -":ref:`PEP 695 <whatsnew312-pep695>`, type parameter syntax and " -"the :keyword:`type` statement" +":ref:`PEP 695 <whatsnew312-pep695>`, type parameter syntax and the :keyword:" +"`type` statement" msgstr "" ":ref:`PEP 695 <whatsnew312-pep695>`,型別參數語法和 :keyword:`type` 陳述式" @@ -96,6 +109,7 @@ msgid "" ":ref:`PEP 701 <whatsnew312-pep701>`, :term:`f-strings <f-string>` in the " "grammar" msgstr "" +":ref:`PEP 701 <whatsnew312-pep701>`,文法中的 :term:`f-字串 <f-string>`" #: ../../whatsnew/3.12.rst:98 msgid "Interpreter improvements:" @@ -106,15 +120,17 @@ msgid "" ":ref:`PEP 684 <whatsnew312-pep684>`, a unique per-interpreter :term:`GIL " "<global interpreter lock>`" msgstr "" +":ref:`PEP 684 <whatsnew312-pep684>`,直譯器各別持有的 :term:`GIL <global " +"interpreter lock>`" #: ../../whatsnew/3.12.rst:102 msgid ":ref:`PEP 669 <whatsnew312-pep669>`, low impact monitoring" -msgstr "" +msgstr ":ref:`PEP 669 <whatsnew312-pep669>`,低影響監控" #: ../../whatsnew/3.12.rst:103 msgid "" -"`Improved 'Did you mean ...' suggestions <improved error messages_>`_ " -"for :exc:`NameError`, :exc:`ImportError`, and :exc:`SyntaxError` exceptions" +"`Improved 'Did you mean ...' suggestions <improved error messages_>`_ for :" +"exc:`NameError`, :exc:`ImportError`, and :exc:`SyntaxError` exceptions" msgstr "" #: ../../whatsnew/3.12.rst:106 @@ -137,19 +153,19 @@ msgstr ":class:`pathlib.Path` 類別現在支援子類別化" #: ../../whatsnew/3.12.rst:114 msgid "The :mod:`os` module received several improvements for Windows support" -msgstr "" +msgstr ":mod:`os` 模組在 Windows 支援上有了數項改進" #: ../../whatsnew/3.12.rst:115 msgid "" -"A :ref:`command-line interface <sqlite3-cli>` has been added to " -"the :mod:`sqlite3` module" +"A :ref:`command-line interface <sqlite3-cli>` has been added to the :mod:" +"`sqlite3` module" msgstr "" "一個\\ :ref:`命令列介面 <sqlite3-cli>`\\ 已被加入 :mod:`sqlite3` 模組中" #: ../../whatsnew/3.12.rst:117 msgid "" -":func:`isinstance` checks against :func:`runtime-checkable protocols " -"<typing.runtime_checkable>` enjoy a speed up of between two and 20 times" +":func:`isinstance` checks against :func:`runtime-checkable protocols <typing." +"runtime_checkable>` enjoy a speed up of between two and 20 times" msgstr "" #: ../../whatsnew/3.12.rst:119 @@ -220,8 +236,8 @@ msgid "" ":ref:`PEP 692 <whatsnew312-pep692>`, using :class:`~typing.TypedDict` to " "annotate :term:`**kwargs <argument>`" msgstr "" -":ref:`PEP 692 <whatsnew312-pep692>`、使用 :class:`~typing.TypedDict` 來標" -"註 :term:`**kwargs <argument>`" +":ref:`PEP 692 <whatsnew312-pep692>`、使用 :class:`~typing.TypedDict` 來標註 :" +"term:`**kwargs <argument>`" #: ../../whatsnew/3.12.rst:149 msgid ":ref:`PEP 698 <whatsnew312-pep698>`, :func:`typing.override` decorator" @@ -261,11 +277,11 @@ msgid "" "removed, along with several :class:`unittest.TestCase` `method aliases " "<unittest-TestCase-removed-aliases_>`_." msgstr "" -":mod:`!asynchat`、:mod:`!asyncore` 和 :mod:`!imp` 模組以及幾" -"個 :class:`unittest.TestCase` 的\\ `方法別名 <unittest-TestCase-removed-" -"aliases_>`_\\ 已被刪除。" +":mod:`!asynchat`、:mod:`!asyncore` 和 :mod:`!imp` 模組以及幾個 :class:" +"`unittest.TestCase` 的\\ `方法別名 <unittest-TestCase-removed-aliases_>`_\\ " +"已被刪除。" -#: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1832 +#: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1840 msgid "New Features" msgstr "新增功能" @@ -282,8 +298,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:187 msgid "" -":pep:`695` introduces a new, more compact and explicit way to " -"create :ref:`generic classes <generic-classes>` and :ref:`functions <generic-" +":pep:`695` introduces a new, more compact and explicit way to create :ref:" +"`generic classes <generic-classes>` and :ref:`functions <generic-" "functions>`::" msgstr "" @@ -330,9 +346,9 @@ msgstr "type Point[T] = tuple[T, T]" #: ../../whatsnew/3.12.rst:210 msgid "" -"The new syntax allows declaring :class:`~typing.TypeVarTuple` " -"and :class:`~typing.ParamSpec` parameters, as well " -"as :class:`~typing.TypeVar` parameters with bounds or constraints::" +"The new syntax allows declaring :class:`~typing.TypeVarTuple` and :class:" +"`~typing.ParamSpec` parameters, as well as :class:`~typing.TypeVar` " +"parameters with bounds or constraints::" msgstr "" #: ../../whatsnew/3.12.rst:214 @@ -428,11 +444,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:290 msgid "" "Backslashes and unicode characters: before Python 3.12 f-string expressions " -"couldn't contain any ``\\`` character. This also affected " -"unicode :ref:`escape sequences <escape-sequences>` (such as ``\\N{snowman}" -"``) as these contain the ``\\N`` part that previously could not be part of " -"expression components of f-strings. Now, you can define expressions like " -"this:" +"couldn't contain any ``\\`` character. This also affected unicode :ref:" +"`escape sequences <escape-sequences>` (such as ``\\N{snowman}``) as these " +"contain the ``\\N`` part that previously could not be part of expression " +"components of f-strings. Now, you can define expressions like this:" msgstr "" #: ../../whatsnew/3.12.rst:303 @@ -492,7 +507,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:337 msgid "PEP 684: A Per-Interpreter GIL" -msgstr "" +msgstr "PEP 684:直譯器各別持有的 GIL" #: ../../whatsnew/3.12.rst:339 msgid "" @@ -502,6 +517,10 @@ msgid "" "CPU cores. This is currently only available through the C-API, though a " "Python API is :pep:`anticipated for 3.13 <554>`." msgstr "" +":pep:`684` 引入了直譯器各別持有的 :term:`GIL <global interpreter lock>`,因此" +"子直譯器現在可以使用各個直譯器特有的 GIL 來建立。這使得 Python 程式可以充分利" +"用多個 CPU 核心。目前這僅透過 C-API 使用,不過 Python API :pep:`預計在 3.13 " +"中釋出 <554>`。" #: ../../whatsnew/3.12.rst:345 msgid "" @@ -568,17 +587,16 @@ msgstr "" #: ../../whatsnew/3.12.rst:386 msgid "" ":pep:`688` introduces a way to use the :ref:`buffer protocol " -"<bufferobjects>` from Python code. Classes that implement " -"the :meth:`~object.__buffer__` method are now usable as buffer types." +"<bufferobjects>` from Python code. Classes that implement the :meth:`~object." +"__buffer__` method are now usable as buffer types." msgstr "" #: ../../whatsnew/3.12.rst:390 msgid "" "The new :class:`collections.abc.Buffer` ABC provides a standard way to " -"represent buffer objects, for example in type annotations. The " -"new :class:`inspect.BufferFlags` enum represents the flags that can be used " -"to customize buffer creation. (Contributed by Jelle Zijlstra " -"in :gh:`102500`.)" +"represent buffer objects, for example in type annotations. The new :class:" +"`inspect.BufferFlags` enum represents the flags that can be used to " +"customize buffer creation. (Contributed by Jelle Zijlstra in :gh:`102500`.)" msgstr "" #: ../../whatsnew/3.12.rst:399 @@ -657,8 +675,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:459 msgid "" "Improve the :exc:`SyntaxError` error message when the user types ``import x " -"from y`` instead of ``from y import x``. (Contributed by Pablo Galindo " -"in :gh:`98931`.)" +"from y`` instead of ``from y import x``. (Contributed by Pablo Galindo in :" +"gh:`98931`.)" msgstr "" #: ../../whatsnew/3.12.rst:469 @@ -671,13 +689,14 @@ msgstr "" #: ../../whatsnew/3.12.rst:480 msgid "New Features Related to Type Hints" -msgstr "" +msgstr "型別提示相關的新特性" #: ../../whatsnew/3.12.rst:482 msgid "" -"This section covers major changes affecting :pep:`type hints <484>` and " -"the :mod:`typing` module." +"This section covers major changes affecting :pep:`type hints <484>` and the :" +"mod:`typing` module." msgstr "" +"本節涵蓋了影響\\ :pep:`型別提示 <484>`\\ 和 :mod:`typing` 模組的主要變更。" #: ../../whatsnew/3.12.rst:488 msgid "PEP 692: Using ``TypedDict`` for more precise ``**kwargs`` typing" @@ -782,18 +801,17 @@ msgid "" "a :exc:`SyntaxWarning`, instead of :exc:`DeprecationWarning`. For example, " "``re.compile(\"\\d+\\.\\d+\")`` now emits a :exc:`SyntaxWarning` " "(``\"\\d\"`` is an invalid escape sequence, use raw strings for regular " -"expression: ``re.compile(r\"\\d+\\.\\d+\")``). In a future Python " -"version, :exc:`SyntaxError` will eventually be raised, instead " -"of :exc:`SyntaxWarning`. (Contributed by Victor Stinner in :gh:`98401`.)" +"expression: ``re.compile(r\"\\d+\\.\\d+\")``). In a future Python version, :" +"exc:`SyntaxError` will eventually be raised, instead of :exc:" +"`SyntaxWarning`. (Contributed by Victor Stinner in :gh:`98401`.)" msgstr "" #: ../../whatsnew/3.12.rst:557 msgid "" "Octal escapes with value larger than ``0o377`` (ex: ``\"\\477\"``), " -"deprecated in Python 3.11, now produce a :exc:`SyntaxWarning`, instead " -"of :exc:`DeprecationWarning`. In a future Python version they will be " -"eventually a :exc:`SyntaxError`. (Contributed by Victor Stinner " -"in :gh:`98401`.)" +"deprecated in Python 3.11, now produce a :exc:`SyntaxWarning`, instead of :" +"exc:`DeprecationWarning`. In a future Python version they will be eventually " +"a :exc:`SyntaxError`. (Contributed by Victor Stinner in :gh:`98401`.)" msgstr "" #: ../../whatsnew/3.12.rst:563 @@ -816,9 +834,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:574 msgid "" "When a ``try-except*`` construct handles the entire :exc:`ExceptionGroup` " -"and raises one other exception, that exception is no longer wrapped in " -"an :exc:`ExceptionGroup`. Also changed in version 3.11.4. (Contributed by " -"Irit Katriel in :gh:`103590`.)" +"and raises one other exception, that exception is no longer wrapped in an :" +"exc:`ExceptionGroup`. Also changed in version 3.11.4. (Contributed by Irit " +"Katriel in :gh:`103590`.)" msgstr "" #: ../../whatsnew/3.12.rst:579 @@ -827,8 +845,8 @@ msgid "" "Python bytecode evaluation loop instead of object allocations. The GC can " "also run when :c:func:`PyErr_CheckSignals` is called so C extensions that " "need to run for a long time without executing any Python code also have a " -"chance to execute the GC periodically. (Contributed by Pablo Galindo " -"in :gh:`97922`.)" +"chance to execute the GC periodically. (Contributed by Pablo Galindo in :gh:" +"`97922`.)" msgstr "" #: ../../whatsnew/3.12.rst:586 @@ -884,13 +902,12 @@ msgstr "" #: ../../whatsnew/3.12.rst:616 msgid "" "Add :ref:`support for the perf profiler <perf_profiling>` through the new " -"environment variable :envvar:`PYTHONPERFSUPPORT` and command-line " -"option :option:`-X perf <-X>`, as well as the " -"new :func:`sys.activate_stack_trampoline`, :func:`sys.deactivate_stack_trampoline`, " -"and :func:`sys.is_stack_trampoline_active` functions. (Design by Pablo " -"Galindo. Contributed by Pablo Galindo and Christian Heimes with " -"contributions from Gregory P. Smith [Google] and Mark Shannon " -"in :gh:`96123`.)" +"environment variable :envvar:`PYTHONPERFSUPPORT` and command-line option :" +"option:`-X perf <-X>`, as well as the new :func:`sys." +"activate_stack_trampoline`, :func:`sys.deactivate_stack_trampoline`, and :" +"func:`sys.is_stack_trampoline_active` functions. (Design by Pablo Galindo. " +"Contributed by Pablo Galindo and Christian Heimes with contributions from " +"Gregory P. Smith [Google] and Mark Shannon in :gh:`96123`.)" msgstr "" #: ../../whatsnew/3.12.rst:628 @@ -911,8 +928,8 @@ msgstr "array" #: ../../whatsnew/3.12.rst:639 msgid "" -"The :class:`array.array` class now supports subscripting, making it " -"a :term:`generic type`. (Contributed by Jelle Zijlstra in :gh:`98658`.)" +"The :class:`array.array` class now supports subscripting, making it a :term:" +"`generic type`. (Contributed by Jelle Zijlstra in :gh:`98658`.)" msgstr "" #: ../../whatsnew/3.12.rst:643 @@ -929,28 +946,25 @@ msgstr "" #: ../../whatsnew/3.12.rst:650 msgid "" -"Add :func:`asyncio.eager_task_factory` " -"and :func:`asyncio.create_eager_task_factory` functions to allow opting an " -"event loop in to eager task execution, making some use-cases 2x to 5x " -"faster. (Contributed by Jacob Bower & Itamar Oren " -"in :gh:`102853`, :gh:`104140`, and :gh:`104138`)" +"Add :func:`asyncio.eager_task_factory` and :func:`asyncio." +"create_eager_task_factory` functions to allow opting an event loop in to " +"eager task execution, making some use-cases 2x to 5x faster. (Contributed by " +"Jacob Bower & Itamar Oren in :gh:`102853`, :gh:`104140`, and :gh:`104138`)" msgstr "" #: ../../whatsnew/3.12.rst:655 msgid "" "On Linux, :mod:`asyncio` uses :class:`asyncio.PidfdChildWatcher` by default " -"if :func:`os.pidfd_open` is available and functional instead " -"of :class:`asyncio.ThreadedChildWatcher`. (Contributed by Kumar Aditya " -"in :gh:`98024`.)" +"if :func:`os.pidfd_open` is available and functional instead of :class:" +"`asyncio.ThreadedChildWatcher`. (Contributed by Kumar Aditya in :gh:`98024`.)" msgstr "" #: ../../whatsnew/3.12.rst:660 msgid "" -"The event loop now uses the best available child watcher for each platform " -"(:class:`asyncio.PidfdChildWatcher` if supported " -"and :class:`asyncio.ThreadedChildWatcher` otherwise), so manually " -"configuring a child watcher is not recommended. (Contributed by Kumar Aditya " -"in :gh:`94597`.)" +"The event loop now uses the best available child watcher for each platform (:" +"class:`asyncio.PidfdChildWatcher` if supported and :class:`asyncio." +"ThreadedChildWatcher` otherwise), so manually configuring a child watcher is " +"not recommended. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" #: ../../whatsnew/3.12.rst:666 @@ -967,9 +981,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:673 msgid "" -":func:`asyncio.iscoroutine` now returns ``False`` for generators " -"as :mod:`asyncio` does not support legacy generator-based coroutines. " -"(Contributed by Kumar Aditya in :gh:`102748`.)" +":func:`asyncio.iscoroutine` now returns ``False`` for generators as :mod:" +"`asyncio` does not support legacy generator-based coroutines. (Contributed " +"by Kumar Aditya in :gh:`102748`.)" msgstr "" #: ../../whatsnew/3.12.rst:677 @@ -985,8 +999,8 @@ msgstr "calendar" #: ../../whatsnew/3.12.rst:684 msgid "" "Add enums :data:`calendar.Month` and :data:`calendar.Day` defining months of " -"the year and days of the week. (Contributed by Prince Roshan " -"in :gh:`103636`.)" +"the year and days of the week. (Contributed by Prince Roshan in :gh:" +"`103636`.)" msgstr "" #: ../../whatsnew/3.12.rst:689 @@ -996,8 +1010,8 @@ msgstr "csv" #: ../../whatsnew/3.12.rst:691 msgid "" "Add :const:`csv.QUOTE_NOTNULL` and :const:`csv.QUOTE_STRINGS` flags to " -"provide finer grained control of ``None`` and empty strings " -"by :class:`~csv.reader` and :class:`~csv.writer` objects." +"provide finer grained control of ``None`` and empty strings by :class:`~csv." +"reader` and :class:`~csv.writer` objects." msgstr "" #: ../../whatsnew/3.12.rst:696 @@ -1007,10 +1021,10 @@ msgstr "dis" #: ../../whatsnew/3.12.rst:698 msgid "" "Pseudo instruction opcodes (which are used by the compiler but do not appear " -"in executable bytecode) are now exposed in the :mod:`dis` " -"module. :opcode:`HAVE_ARGUMENT` is still relevant to real opcodes, but it is " -"not useful for pseudo instructions. Use the new :data:`dis.hasarg` " -"collection instead. (Contributed by Irit Katriel in :gh:`94216`.)" +"in executable bytecode) are now exposed in the :mod:`dis` module. :opcode:" +"`HAVE_ARGUMENT` is still relevant to real opcodes, but it is not useful for " +"pseudo instructions. Use the new :data:`dis.hasarg` collection instead. " +"(Contributed by Irit Katriel in :gh:`94216`.)" msgstr "" #: ../../whatsnew/3.12.rst:706 @@ -1104,8 +1118,8 @@ msgid "" "Add :func:`math.sumprod` for computing a sum of products. (Contributed by " "Raymond Hettinger in :gh:`100485`.)" msgstr "" -"新增 :func:`math.sumprod` 以計算乘積總和。(由 Raymond Hettinger " -"於 :gh:`100485` 中貢獻。)" +"新增 :func:`math.sumprod` 以計算乘積總和。(由 Raymond Hettinger 於 :gh:" +"`100485` 中貢獻。)" #: ../../whatsnew/3.12.rst:752 msgid "" @@ -1120,16 +1134,16 @@ msgstr "os" #: ../../whatsnew/3.12.rst:759 msgid "" -"Add :const:`os.PIDFD_NONBLOCK` to open a file descriptor for a process " -"with :func:`os.pidfd_open` in non-blocking mode. (Contributed by Kumar " -"Aditya in :gh:`93312`.)" +"Add :const:`os.PIDFD_NONBLOCK` to open a file descriptor for a process with :" +"func:`os.pidfd_open` in non-blocking mode. (Contributed by Kumar Aditya in :" +"gh:`93312`.)" msgstr "" #: ../../whatsnew/3.12.rst:763 msgid "" ":class:`os.DirEntry` now includes an :meth:`os.DirEntry.is_junction` method " -"to check if the entry is a junction. (Contributed by Charles Machalow " -"in :gh:`99547`.)" +"to check if the entry is a junction. (Contributed by Charles Machalow in :gh:" +"`99547`.)" msgstr "" #: ../../whatsnew/3.12.rst:767 @@ -1148,8 +1162,8 @@ msgid "" "with other platforms). ``st_dev`` may be up to 64 bits and ``st_ino`` up to " "128 bits depending on your file system, and ``st_rdev`` is always set to " "zero rather than incorrect values. Both functions may be significantly " -"faster on newer releases of Windows. (Contributed by Steve Dower " -"in :gh:`99726`.)" +"faster on newer releases of Windows. (Contributed by Steve Dower in :gh:" +"`99726`.)" msgstr "" #: ../../whatsnew/3.12.rst:782 @@ -1178,10 +1192,10 @@ msgstr "pathlib" #: ../../whatsnew/3.12.rst:793 msgid "" -"Add support for subclassing :class:`pathlib.PurePath` " -"and :class:`pathlib.Path`, plus their Posix- and Windows-specific variants. " -"Subclasses may override the :meth:`pathlib.PurePath.with_segments` method to " -"pass information between path instances." +"Add support for subclassing :class:`pathlib.PurePath` and :class:`pathlib." +"Path`, plus their Posix- and Windows-specific variants. Subclasses may " +"override the :meth:`pathlib.PurePath.with_segments` method to pass " +"information between path instances." msgstr "" #: ../../whatsnew/3.12.rst:798 @@ -1195,49 +1209,61 @@ msgstr "" msgid "" "Add *walk_up* optional parameter to :meth:`pathlib.PurePath.relative_to` to " "allow the insertion of ``..`` entries in the result; this behavior is more " -"consistent with :func:`os.path.relpath`. (Contributed by Domenico Ragusa " -"in :gh:`84538`.)" +"consistent with :func:`os.path.relpath`. (Contributed by Domenico Ragusa in :" +"gh:`84538`.)" msgstr "" #: ../../whatsnew/3.12.rst:807 msgid "" -"Add :meth:`pathlib.Path.is_junction` as a proxy " -"to :func:`os.path.isjunction`. (Contributed by Charles Machalow " -"in :gh:`99547`.)" +"Add :meth:`pathlib.Path.is_junction` as a proxy to :func:`os.path." +"isjunction`. (Contributed by Charles Machalow in :gh:`99547`.)" msgstr "" #: ../../whatsnew/3.12.rst:810 msgid "" -"Add *case_sensitive* optional parameter " -"to :meth:`pathlib.Path.glob`, :meth:`pathlib.Path.rglob` " -"and :meth:`pathlib.PurePath.match` for matching the path's case sensitivity, " -"allowing for more precise control over the matching process." +"Add *case_sensitive* optional parameter to :meth:`pathlib.Path.glob`, :meth:" +"`pathlib.Path.rglob` and :meth:`pathlib.PurePath.match` for matching the " +"path's case sensitivity, allowing for more precise control over the matching " +"process." msgstr "" #: ../../whatsnew/3.12.rst:815 +#, fuzzy +msgid "platform" +msgstr ":mod:`platform`:" + +#: ../../whatsnew/3.12.rst:817 +msgid "" +"Add support for detecting Windows 11 and Windows Server releases past 2012. " +"Previously, lookups on Windows Server platforms newer than Windows Server " +"2012 and on Windows 11 would return ``Windows-10``. (Contributed by Steve " +"Dower in :gh:`89545`.)" +msgstr "" + +#: ../../whatsnew/3.12.rst:823 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.12.rst:817 +#: ../../whatsnew/3.12.rst:825 msgid "" "Add convenience variables to hold values temporarily for debug session and " "provide quick access to values like the current frame or the return value. " "(Contributed by Tian Gao in :gh:`103693`.)" msgstr "" -#: ../../whatsnew/3.12.rst:823 +#: ../../whatsnew/3.12.rst:831 msgid "random" msgstr "random" -#: ../../whatsnew/3.12.rst:825 +#: ../../whatsnew/3.12.rst:833 msgid "" -"Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger " -"in :gh:`81620`.)" +"Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger in :gh:" +"`81620`.)" msgstr "" "新增 :func:`random.binomialvariate`。(由 Raymond Hettinger 於 :gh:`81620` 中" "貢獻。)" -#: ../../whatsnew/3.12.rst:828 +#: ../../whatsnew/3.12.rst:836 msgid "" "Add a default of ``lambd=1.0`` to :func:`random.expovariate`. (Contributed " "by Raymond Hettinger in :gh:`100234`.)" @@ -1245,11 +1271,11 @@ msgstr "" "將預設值 ``lambd=1.0`` 加入至 :func:`random.expovariate` 中。(由 Raymond " "Hettinger 在 :gh:`100234` 中貢獻。)" -#: ../../whatsnew/3.12.rst:832 +#: ../../whatsnew/3.12.rst:840 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.12.rst:834 +#: ../../whatsnew/3.12.rst:842 msgid "" ":func:`shutil.make_archive` now passes the *root_dir* argument to custom " "archivers which support it. In this case it no longer temporarily changes " @@ -1257,7 +1283,7 @@ msgid "" "archiving. (Contributed by Serhiy Storchaka in :gh:`74696`.)" msgstr "" -#: ../../whatsnew/3.12.rst:840 +#: ../../whatsnew/3.12.rst:848 msgid "" ":func:`shutil.rmtree` now accepts a new argument *onexc* which is an error " "handler like *onerror* but which expects an exception instance rather than a " @@ -1265,14 +1291,14 @@ msgid "" "Katriel in :gh:`102828`.)" msgstr "" -#: ../../whatsnew/3.12.rst:845 +#: ../../whatsnew/3.12.rst:853 msgid "" ":func:`shutil.which` now consults the *PATHEXT* environment variable to find " "matches within *PATH* on Windows even when the given *cmd* includes a " "directory component. (Contributed by Charles Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:850 +#: ../../whatsnew/3.12.rst:858 msgid "" ":func:`shutil.which` will call ``NeedCurrentDirectoryForExePathW`` when " "querying for executables on Windows to determine if the current working " @@ -1280,99 +1306,96 @@ msgid "" "Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:855 +#: ../../whatsnew/3.12.rst:863 msgid "" ":func:`shutil.which` will return a path matching the *cmd* with a component " "from ``PATHEXT`` prior to a direct match elsewhere in the search path on " "Windows. (Contributed by Charles Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:861 ../../whatsnew/3.12.rst:1536 +#: ../../whatsnew/3.12.rst:869 ../../whatsnew/3.12.rst:1544 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.12.rst:863 +#: ../../whatsnew/3.12.rst:871 msgid "" "Add a :ref:`command-line interface <sqlite3-cli>`. (Contributed by Erlend E. " "Aasland in :gh:`77617`.)" msgstr "" -"新增\\ :ref:`命令列介面 <sqlite3-cli>`。(由 Erlend E. Aasland " -"於 :gh:`77617` 中貢獻。)" +"新增\\ :ref:`命令列介面 <sqlite3-cli>`。(由 Erlend E. Aasland 於 :gh:" +"`77617` 中貢獻。)" -#: ../../whatsnew/3.12.rst:866 +#: ../../whatsnew/3.12.rst:874 msgid "" -"Add the :attr:`sqlite3.Connection.autocommit` attribute " -"to :class:`sqlite3.Connection` and the *autocommit* parameter " -"to :func:`sqlite3.connect` to control :pep:`249`-compliant :ref:`transaction " -"handling <sqlite3-transaction-control-autocommit>`. (Contributed by Erlend " -"E. Aasland in :gh:`83638`.)" +"Add the :attr:`sqlite3.Connection.autocommit` attribute to :class:`sqlite3." +"Connection` and the *autocommit* parameter to :func:`sqlite3.connect` to " +"control :pep:`249`-compliant :ref:`transaction handling <sqlite3-transaction-" +"control-autocommit>`. (Contributed by Erlend E. Aasland in :gh:`83638`.)" msgstr "" -#: ../../whatsnew/3.12.rst:873 +#: ../../whatsnew/3.12.rst:881 msgid "" -"Add *entrypoint* keyword-only parameter " -"to :meth:`sqlite3.Connection.load_extension`, for overriding the SQLite " -"extension entry point. (Contributed by Erlend E. Aasland in :gh:`103015`.)" +"Add *entrypoint* keyword-only parameter to :meth:`sqlite3.Connection." +"load_extension`, for overriding the SQLite extension entry point. " +"(Contributed by Erlend E. Aasland in :gh:`103015`.)" msgstr "" -#: ../../whatsnew/3.12.rst:878 +#: ../../whatsnew/3.12.rst:886 msgid "" -"Add :meth:`sqlite3.Connection.getconfig` " -"and :meth:`sqlite3.Connection.setconfig` to :class:`sqlite3.Connection` to " -"make configuration changes to a database connection. (Contributed by Erlend " -"E. Aasland in :gh:`103489`.)" +"Add :meth:`sqlite3.Connection.getconfig` and :meth:`sqlite3.Connection." +"setconfig` to :class:`sqlite3.Connection` to make configuration changes to a " +"database connection. (Contributed by Erlend E. Aasland in :gh:`103489`.)" msgstr "" -#: ../../whatsnew/3.12.rst:884 +#: ../../whatsnew/3.12.rst:892 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.12.rst:886 +#: ../../whatsnew/3.12.rst:894 msgid "" "Extend :func:`statistics.correlation` to include as a ``ranked`` method for " "computing the Spearman correlation of ranked data. (Contributed by Raymond " "Hettinger in :gh:`95861`.)" msgstr "" -#: ../../whatsnew/3.12.rst:891 +#: ../../whatsnew/3.12.rst:899 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.12.rst:893 +#: ../../whatsnew/3.12.rst:901 msgid "" "Add the :mod:`sys.monitoring` namespace to expose the new :ref:`PEP 669 " -"<whatsnew312-pep669>` monitoring API. (Contributed by Mark Shannon " -"in :gh:`103082`.)" +"<whatsnew312-pep669>` monitoring API. (Contributed by Mark Shannon in :gh:" +"`103082`.)" msgstr "" -#: ../../whatsnew/3.12.rst:897 +#: ../../whatsnew/3.12.rst:905 msgid "" -"Add :func:`sys.activate_stack_trampoline` " -"and :func:`sys.deactivate_stack_trampoline` for activating and deactivating " -"stack profiler trampolines, and :func:`sys.is_stack_trampoline_active` for " -"querying if stack profiler trampolines are active. (Contributed by Pablo " -"Galindo and Christian Heimes with contributions from Gregory P. Smith " -"[Google] and Mark Shannon in :gh:`96123`.)" +"Add :func:`sys.activate_stack_trampoline` and :func:`sys." +"deactivate_stack_trampoline` for activating and deactivating stack profiler " +"trampolines, and :func:`sys.is_stack_trampoline_active` for querying if " +"stack profiler trampolines are active. (Contributed by Pablo Galindo and " +"Christian Heimes with contributions from Gregory P. Smith [Google] and Mark " +"Shannon in :gh:`96123`.)" msgstr "" -#: ../../whatsnew/3.12.rst:906 +#: ../../whatsnew/3.12.rst:914 msgid "" "Add :data:`sys.last_exc` which holds the last unhandled exception that was " "raised (for post-mortem debugging use cases). Deprecate the three fields " -"that have the same information in its legacy " -"form: :data:`sys.last_type`, :data:`sys.last_value` " -"and :data:`sys.last_traceback`. (Contributed by Irit Katriel " -"in :gh:`102778`.)" +"that have the same information in its legacy form: :data:`sys.last_type`, :" +"data:`sys.last_value` and :data:`sys.last_traceback`. (Contributed by Irit " +"Katriel in :gh:`102778`.)" msgstr "" -#: ../../whatsnew/3.12.rst:912 ../../whatsnew/3.12.rst:1731 +#: ../../whatsnew/3.12.rst:920 ../../whatsnew/3.12.rst:1739 msgid "" ":func:`sys._current_exceptions` now returns a mapping from thread-id to an " "exception instance, rather than to a ``(typ, exc, tb)`` tuple. (Contributed " "by Irit Katriel in :gh:`103176`.)" msgstr "" -#: ../../whatsnew/3.12.rst:916 +#: ../../whatsnew/3.12.rst:924 msgid "" ":func:`sys.setrecursionlimit` and :func:`sys.getrecursionlimit`. The " "recursion limit now applies only to Python code. Builtin functions do not " @@ -1380,11 +1403,11 @@ msgid "" "prevents recursion from causing a virtual machine crash." msgstr "" -#: ../../whatsnew/3.12.rst:922 +#: ../../whatsnew/3.12.rst:930 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.12.rst:924 +#: ../../whatsnew/3.12.rst:932 msgid "" "The :class:`tempfile.NamedTemporaryFile` function has a new optional " "parameter *delete_on_close* (Contributed by Evgeny Zorin in :gh:`58451`.)" @@ -1392,7 +1415,7 @@ msgstr "" ":class:`tempfile.NamedTemporaryFile` 函式新增了一個選擇性參數 " "*delete_on_close* (由 Evgeny Zorin 於 :gh:`58451` 中貢獻。)" -#: ../../whatsnew/3.12.rst:926 +#: ../../whatsnew/3.12.rst:934 msgid "" ":func:`tempfile.mkdtemp` now always returns an absolute path, even if the " "argument provided to the *dir* parameter is a relative path." @@ -1400,23 +1423,23 @@ msgstr "" ":func:`tempfile.mkdtemp` 現在總是會傳回絕對路徑,即使提供給 *dir* 參數的引數" "是相對路徑。" -#: ../../whatsnew/3.12.rst:930 +#: ../../whatsnew/3.12.rst:938 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.12.rst:932 +#: ../../whatsnew/3.12.rst:940 msgid "" -"Add :func:`threading.settrace_all_threads` " -"and :func:`threading.setprofile_all_threads` that allow to set tracing and " -"profiling functions in all running threads in addition to the calling one. " -"(Contributed by Pablo Galindo in :gh:`93503`.)" +"Add :func:`threading.settrace_all_threads` and :func:`threading." +"setprofile_all_threads` that allow to set tracing and profiling functions in " +"all running threads in addition to the calling one. (Contributed by Pablo " +"Galindo in :gh:`93503`.)" msgstr "" -#: ../../whatsnew/3.12.rst:938 +#: ../../whatsnew/3.12.rst:946 msgid "tkinter" msgstr "tkinter" -#: ../../whatsnew/3.12.rst:940 +#: ../../whatsnew/3.12.rst:948 msgid "" "``tkinter.Canvas.coords()`` now flattens its arguments. It now accepts not " "only coordinates as separate arguments (``x1, y1, x2, y2, ...``) and a " @@ -1426,48 +1449,47 @@ msgid "" "in :gh:`94473`.)" msgstr "" -#: ../../whatsnew/3.12.rst:949 +#: ../../whatsnew/3.12.rst:957 msgid "tokenize" msgstr "tokenize" -#: ../../whatsnew/3.12.rst:951 +#: ../../whatsnew/3.12.rst:959 msgid "" "The :mod:`tokenize` module includes the changes introduced in :pep:`701`. " -"(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) " -"See :ref:`whatsnew312-porting-to-python312` for more information on the " -"changes to the :mod:`tokenize` module." +"(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) See :" +"ref:`whatsnew312-porting-to-python312` for more information on the changes " +"to the :mod:`tokenize` module." msgstr "" -#: ../../whatsnew/3.12.rst:957 +#: ../../whatsnew/3.12.rst:965 msgid "types" msgstr "types" -#: ../../whatsnew/3.12.rst:959 +#: ../../whatsnew/3.12.rst:967 msgid "" -"Add :func:`types.get_original_bases` to allow for further introspection " -"of :ref:`user-defined-generics` when subclassed. (Contributed by James " -"Hilton-Balfe and Alex Waygood in :gh:`101827`.)" +"Add :func:`types.get_original_bases` to allow for further introspection of :" +"ref:`user-defined-generics` when subclassed. (Contributed by James Hilton-" +"Balfe and Alex Waygood in :gh:`101827`.)" msgstr "" -#: ../../whatsnew/3.12.rst:966 +#: ../../whatsnew/3.12.rst:974 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.12.rst:968 +#: ../../whatsnew/3.12.rst:976 msgid "" -":func:`isinstance` checks against :func:`runtime-checkable protocols " -"<typing.runtime_checkable>` now use :func:`inspect.getattr_static` rather " -"than :func:`hasattr` to lookup whether attributes exist. This means that " -"descriptors and :meth:`~object.__getattr__` methods are no longer " -"unexpectedly evaluated during ``isinstance()`` checks against runtime-" -"checkable protocols. However, it may also mean that some objects which used " -"to be considered instances of a runtime-checkable protocol may no longer be " -"considered instances of that protocol on Python 3.12+, and vice versa. Most " -"users are unlikely to be affected by this change. (Contributed by Alex " -"Waygood in :gh:`102433`.)" +":func:`isinstance` checks against :func:`runtime-checkable protocols <typing." +"runtime_checkable>` now use :func:`inspect.getattr_static` rather than :func:" +"`hasattr` to lookup whether attributes exist. This means that descriptors " +"and :meth:`~object.__getattr__` methods are no longer unexpectedly evaluated " +"during ``isinstance()`` checks against runtime-checkable protocols. However, " +"it may also mean that some objects which used to be considered instances of " +"a runtime-checkable protocol may no longer be considered instances of that " +"protocol on Python 3.12+, and vice versa. Most users are unlikely to be " +"affected by this change. (Contributed by Alex Waygood in :gh:`102433`.)" msgstr "" -#: ../../whatsnew/3.12.rst:979 +#: ../../whatsnew/3.12.rst:987 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " @@ -1475,7 +1497,7 @@ msgid "" "on :func:`isinstance` checks comparing objects to the protocol. For example::" msgstr "" -#: ../../whatsnew/3.12.rst:984 +#: ../../whatsnew/3.12.rst:992 msgid "" ">>> from typing import Protocol, runtime_checkable\n" ">>> @runtime_checkable\n" @@ -1512,31 +1534,31 @@ msgstr "" ">>> isinstance(f, HasX) # 沒有改變,即便 HasX 現在有 \"y\" 屬性\n" "True" -#: ../../whatsnew/3.12.rst:1001 +#: ../../whatsnew/3.12.rst:1009 msgid "" "This change was made in order to speed up ``isinstance()`` checks against " "runtime-checkable protocols." msgstr "" -#: ../../whatsnew/3.12.rst:1004 +#: ../../whatsnew/3.12.rst:1012 msgid "" "The performance profile of :func:`isinstance` checks against :func:`runtime-" "checkable protocols <typing.runtime_checkable>` has changed significantly. " "Most ``isinstance()`` checks against protocols with only a few members " "should be at least 2x faster than in 3.11, and some may be 20x faster or " "more. However, ``isinstance()`` checks against protocols with many members " -"may be slower than in Python 3.11. (Contributed by Alex Waygood " -"in :gh:`74690` and :gh:`103193`.)" +"may be slower than in Python 3.11. (Contributed by Alex Waygood in :gh:" +"`74690` and :gh:`103193`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1012 +#: ../../whatsnew/3.12.rst:1020 msgid "" "All :data:`typing.TypedDict` and :data:`typing.NamedTuple` classes now have " "the ``__orig_bases__`` attribute. (Contributed by Adrian Garcia Badaracco " "in :gh:`103699`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1016 +#: ../../whatsnew/3.12.rst:1024 msgid "" "Add ``frozen_default`` parameter to :func:`typing.dataclass_transform`. " "(Contributed by Erik De Bonte in :gh:`99957`.)" @@ -1544,26 +1566,26 @@ msgstr "" "新增 ``frozen_default`` 參數至 :func:`typing.dataclass_transform`。(由 Erik " "De Bonte 於 :gh:`99957` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1020 +#: ../../whatsnew/3.12.rst:1028 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.12.rst:1022 +#: ../../whatsnew/3.12.rst:1030 msgid "" "The Unicode database has been updated to version 15.0.0. (Contributed by " "Benjamin Peterson in :gh:`96734`)." msgstr "" -#: ../../whatsnew/3.12.rst:1026 ../../whatsnew/3.12.rst:1576 +#: ../../whatsnew/3.12.rst:1034 ../../whatsnew/3.12.rst:1584 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.12.rst:1028 +#: ../../whatsnew/3.12.rst:1036 msgid "" "Add a ``--durations`` command line option, showing the N slowest test cases::" msgstr "新增 ``--durations`` 命令列選項,顯示 N 個最慢的測試案例:" -#: ../../whatsnew/3.12.rst:1030 +#: ../../whatsnew/3.12.rst:1038 msgid "" "python3 -m unittest --durations=3 lib.tests.test_threading\n" ".....\n" @@ -1593,15 +1615,15 @@ msgstr "" "\n" "OK (skipped=3)" -#: ../../whatsnew/3.12.rst:1044 +#: ../../whatsnew/3.12.rst:1052 msgid "(Contributed by Giampaolo Rodola in :gh:`48330`)" msgstr "(由 Giampaolo Rodola 於 :gh:`48330` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1047 +#: ../../whatsnew/3.12.rst:1055 msgid "uuid" msgstr "uuid" -#: ../../whatsnew/3.12.rst:1049 +#: ../../whatsnew/3.12.rst:1057 msgid "" "Add a :ref:`command-line interface <uuid-cli>`. (Contributed by Adam Chhina " "in :gh:`88597`.)" @@ -1609,33 +1631,33 @@ msgstr "" "新增一個\\ :ref:`命令列介面 <uuid-cli>`。(由 Adam Chhina 於 :gh:`88597` 中貢" "獻。)" -#: ../../whatsnew/3.12.rst:1054 +#: ../../whatsnew/3.12.rst:1062 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.12.rst:1056 +#: ../../whatsnew/3.12.rst:1064 msgid "" "Remove ``wstr`` and ``wstr_length`` members from Unicode objects. It reduces " "object size by 8 or 16 bytes on 64bit platform. (:pep:`623`) (Contributed by " "Inada Naoki in :gh:`92536`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1060 +#: ../../whatsnew/3.12.rst:1068 msgid "" "Add experimental support for using the BOLT binary optimizer in the build " "process, which improves performance by 1-5%. (Contributed by Kevin " "Modzelewski in :gh:`90536` and tuned by Donghee Na in :gh:`101525`)" msgstr "" -#: ../../whatsnew/3.12.rst:1064 +#: ../../whatsnew/3.12.rst:1072 msgid "" -"Speed up the regular expression substitution (functions :func:`re.sub` " -"and :func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " +"Speed up the regular expression substitution (functions :func:`re.sub` and :" +"func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " "replacement strings containing group references by 2--3 times. (Contributed " "by Serhiy Storchaka in :gh:`91524`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1069 +#: ../../whatsnew/3.12.rst:1077 msgid "" "Speed up :class:`asyncio.Task` creation by deferring expensive string " "formatting. (Contributed by Itamar Oren in :gh:`103793`.)" @@ -1643,54 +1665,53 @@ msgstr "" "透過延遲運算較繁重的字串格式化來加速 :class:`asyncio.Task` 的建立。(由 " "Itamar Oren 於 :gh:`103793` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1072 +#: ../../whatsnew/3.12.rst:1080 msgid "" "The :func:`tokenize.tokenize` and :func:`tokenize.generate_tokens` functions " -"are up to 64% faster as a side effect of the changes required to " -"cover :pep:`701` in the :mod:`tokenize` module. (Contributed by Marta Gómez " -"Macías and Pablo Galindo in :gh:`102856`.)" +"are up to 64% faster as a side effect of the changes required to cover :pep:" +"`701` in the :mod:`tokenize` module. (Contributed by Marta Gómez Macías and " +"Pablo Galindo in :gh:`102856`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1077 +#: ../../whatsnew/3.12.rst:1085 msgid "" -"Speed up :func:`super` method calls and attribute loads via the " -"new :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and " -"Vladimir Matveev in :gh:`103497`.)" +"Speed up :func:`super` method calls and attribute loads via the new :opcode:" +"`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and Vladimir " +"Matveev in :gh:`103497`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1083 +#: ../../whatsnew/3.12.rst:1091 msgid "CPython bytecode changes" msgstr "CPython 位元組碼變更" -#: ../../whatsnew/3.12.rst:1085 +#: ../../whatsnew/3.12.rst:1093 msgid "" -"Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged " -"into :opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the " -"old :opcode:`!LOAD_METHOD` instruction if the low bit of its oparg is set. " -"(Contributed by Ken Jin in :gh:`93429`.)" +"Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged into :" +"opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the old :opcode:" +"`!LOAD_METHOD` instruction if the low bit of its oparg is set. (Contributed " +"by Ken Jin in :gh:`93429`.)" msgstr "" -"移除 :opcode:`!LOAD_METHOD` 指令。它已經合併" -"至 :opcode:`LOAD_ATTR`。:opcode:`LOAD_ATTR` 現在會像舊的 :opcode:`!" -"LOAD_METHOD` 指令一樣行為,如果其 oparg 的低位元 (low bit) 有被設定。(由 " -"Ken Jin 於 :gh:`93429` 中貢獻。)" +"移除 :opcode:`!LOAD_METHOD` 指令。它已經合併至 :opcode:`LOAD_ATTR`。:opcode:" +"`LOAD_ATTR` 現在會像舊的 :opcode:`!LOAD_METHOD` 指令一樣行為,如果其 oparg 的" +"低位元 (low bit) 有被設定。(由 Ken Jin 於 :gh:`93429` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1090 +#: ../../whatsnew/3.12.rst:1098 msgid "" "Remove the :opcode:`!JUMP_IF_FALSE_OR_POP` and :opcode:`!" -"JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel " -"in :gh:`102859`.)" +"JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel in :gh:" +"`102859`.)" msgstr "" "移除 :opcode:`!JUMP_IF_FALSE_OR_POP` 和 :opcode:`!JUMP_IF_TRUE_OR_POP` 指令。" "(由 Irit Katriel 於 :gh:`102859` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1093 +#: ../../whatsnew/3.12.rst:1101 msgid "" -"Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon " -"in :gh:`92925`.)" +"Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon in :" +"gh:`92925`.)" msgstr "" "移除 :opcode:`!PRECALL` 指令。(由 Mark Shannon 於 :gh:`92925` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1096 +#: ../../whatsnew/3.12.rst:1104 msgid "" "Add the :opcode:`BINARY_SLICE` and :opcode:`STORE_SLICE` instructions. " "(Contributed by Mark Shannon in :gh:`94163`.)" @@ -1698,7 +1719,7 @@ msgstr "" "新增 :opcode:`BINARY_SLICE` 和 :opcode:`STORE_SLICE` 指令。(由 Mark Shannon " "於 :gh:`94163` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1099 +#: ../../whatsnew/3.12.rst:1107 msgid "" "Add the :opcode:`CALL_INTRINSIC_1` instructions. (Contributed by Mark " "Shannon in :gh:`99005`.)" @@ -1706,7 +1727,7 @@ msgstr "" "新增 :opcode:`CALL_INTRINSIC_1` 指令。(由 Mark Shannon 於 :gh:`99005` 中貢" "獻。)" -#: ../../whatsnew/3.12.rst:1102 +#: ../../whatsnew/3.12.rst:1110 msgid "" "Add the :opcode:`CALL_INTRINSIC_2` instruction. (Contributed by Irit Katriel " "in :gh:`101799`.)" @@ -1714,7 +1735,7 @@ msgstr "" "新增 :opcode:`CALL_INTRINSIC_2` 指令。(由 Irit Katriel 於 :gh:`101799` 中貢" "獻。)" -#: ../../whatsnew/3.12.rst:1105 +#: ../../whatsnew/3.12.rst:1113 msgid "" "Add the :opcode:`CLEANUP_THROW` instruction. (Contributed by Brandt Bucher " "in :gh:`90997`.)" @@ -1722,14 +1743,14 @@ msgstr "" "新增 :opcode:`CLEANUP_THROW` 指令。(由 Brandt Bucher 於 :gh:`90997` 中貢" "獻。)" -#: ../../whatsnew/3.12.rst:1108 +#: ../../whatsnew/3.12.rst:1116 msgid "" -"Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon " -"in :gh:`103082`.)" +"Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon in :gh:" +"`103082`.)" msgstr "" "新增 :opcode:`!END_SEND` 指令。(由 Mark Shannon 於 :gh:`103082` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1111 +#: ../../whatsnew/3.12.rst:1119 msgid "" "Add the :opcode:`LOAD_FAST_AND_CLEAR` instruction as part of the " "implementation of :pep:`709`. (Contributed by Carl Meyer in :gh:`101441`.)" @@ -1737,7 +1758,7 @@ msgstr "" "新增 :opcode:`LOAD_FAST_AND_CLEAR` 指令作為 :pep:`709` 實作的一部分。(由 " "Carl Meyer 於 :gh:`101441` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1114 +#: ../../whatsnew/3.12.rst:1122 msgid "" "Add the :opcode:`LOAD_FAST_CHECK` instruction. (Contributed by Dennis " "Sweeney in :gh:`93143`.)" @@ -1745,60 +1766,59 @@ msgstr "" "新增 :opcode:`LOAD_FAST_CHECK` 指令。(由 Dennis Sweeney 於 :gh:`93143` 中貢" "獻。)" -#: ../../whatsnew/3.12.rst:1117 +#: ../../whatsnew/3.12.rst:1125 msgid "" -"Add " -"the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:`LOAD_FROM_DICT_OR_GLOBALS`, " -"and :opcode:`LOAD_LOCALS` opcodes as part of the implementation " -"of :pep:`695`. Remove the :opcode:`!LOAD_CLASSDEREF` opcode, which can be " -"replaced with :opcode:`LOAD_LOCALS` plus :opcode:`LOAD_FROM_DICT_OR_DEREF`. " -"(Contributed by Jelle Zijlstra in :gh:`103764`.)" +"Add the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:" +"`LOAD_FROM_DICT_OR_GLOBALS`, and :opcode:`LOAD_LOCALS` opcodes as part of " +"the implementation of :pep:`695`. Remove the :opcode:`!LOAD_CLASSDEREF` " +"opcode, which can be replaced with :opcode:`LOAD_LOCALS` plus :opcode:" +"`LOAD_FROM_DICT_OR_DEREF`. (Contributed by Jelle Zijlstra in :gh:`103764`.)" msgstr "" "新增 :opcode:`LOAD_FROM_DICT_OR_DEREF`、:opcode:`LOAD_FROM_DICT_OR_GLOBALS` " "和 :opcode:`LOAD_LOCALS` 操作碼作為 :pep:`695` 實作的一部分。移除 :opcode:`!" -"LOAD_CLASSDEREF` 操作碼,可以用 :opcode:`LOAD_LOCALS` 加" -"上 :opcode:`LOAD_FROM_DICT_OR_DEREF` 來取代。(由 Jelle Zijlstra " -"於 :gh:`103764` 中貢獻。)" +"LOAD_CLASSDEREF` 操作碼,可以用 :opcode:`LOAD_LOCALS` 加上 :opcode:" +"`LOAD_FROM_DICT_OR_DEREF` 來取代。(由 Jelle Zijlstra 於 :gh:`103764` 中貢" +"獻。)" -#: ../../whatsnew/3.12.rst:1123 +#: ../../whatsnew/3.12.rst:1131 msgid "" "Add the :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer " "and Vladimir Matveev in :gh:`103497`.)" msgstr "" -"新增 :opcode:`LOAD_SUPER_ATTR` 指令。(由 Carl Meyer 和 Vladimir Matveev " -"於 :gh:`103497` 中貢獻。)" +"新增 :opcode:`LOAD_SUPER_ATTR` 指令。(由 Carl Meyer 和 Vladimir Matveev 於 :" +"gh:`103497` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1126 +#: ../../whatsnew/3.12.rst:1134 msgid "" -"Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang " -"in :gh:`101632`.)" +"Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang in :" +"gh:`101632`.)" msgstr "" "新增 :opcode:`RETURN_CONST` 指令。(由 Wenyang Wang 於 :gh:`101632` 中貢" "獻。)" -#: ../../whatsnew/3.12.rst:1129 +#: ../../whatsnew/3.12.rst:1137 msgid "Demos and Tools" msgstr "" -#: ../../whatsnew/3.12.rst:1131 +#: ../../whatsnew/3.12.rst:1139 msgid "" "Remove the ``Tools/demo/`` directory which contained old demo scripts. A " "copy can be found in the `old-demos project <https://github.com/gvanrossum/" "old-demos>`_. (Contributed by Victor Stinner in :gh:`97681`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1136 +#: ../../whatsnew/3.12.rst:1144 msgid "" "Remove outdated example scripts of the ``Tools/scripts/`` directory. A copy " "can be found in the `old-demos project <https://github.com/gvanrossum/old-" "demos>`_. (Contributed by Victor Stinner in :gh:`97669`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1143 ../../whatsnew/3.12.rst:2134 +#: ../../whatsnew/3.12.rst:1151 ../../whatsnew/3.12.rst:2142 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.12.rst:1145 +#: ../../whatsnew/3.12.rst:1153 #: ../../deprecations/pending-removal-in-3.14.rst:4 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" @@ -1809,7 +1829,7 @@ msgstr "" "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " "於 :gh:`92248` 貢獻。)" -#: ../../whatsnew/3.12.rst:1150 +#: ../../whatsnew/3.12.rst:1158 msgid "" ":mod:`ast`: The following :mod:`ast` features have been deprecated in " "documentation since Python 3.8, now cause a :exc:`DeprecationWarning` to be " @@ -1820,66 +1840,67 @@ msgstr "" "或使用時會在 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移" "除:" -#: ../../whatsnew/3.12.rst:1154 +#: ../../whatsnew/3.12.rst:1162 #: ../../deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" -#: ../../whatsnew/3.12.rst:1155 +#: ../../whatsnew/3.12.rst:1163 #: ../../deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" -#: ../../whatsnew/3.12.rst:1156 +#: ../../whatsnew/3.12.rst:1164 #: ../../deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" -#: ../../whatsnew/3.12.rst:1157 +#: ../../whatsnew/3.12.rst:1165 #: ../../deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" -#: ../../whatsnew/3.12.rst:1158 +#: ../../whatsnew/3.12.rst:1166 #: ../../deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" -#: ../../whatsnew/3.12.rst:1160 +#: ../../whatsnew/3.12.rst:1168 #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" -"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " -"in :gh:`90953`.)" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" +"`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" -#: ../../whatsnew/3.12.rst:1163 +#: ../../whatsnew/3.12.rst:1171 #: ../../deprecations/pending-removal-in-3.14.rst:22 #: ../../deprecations/pending-removal-in-3.16.rst:19 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../whatsnew/3.12.rst:1165 +#: ../../whatsnew/3.12.rst:1173 msgid "" -"The child watcher " -"classes :class:`asyncio.MultiLoopChildWatcher`, :class:`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher` " -"and :class:`asyncio.SafeChildWatcher` are deprecated and will be removed in " -"Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +"The child watcher classes :class:`asyncio.MultiLoopChildWatcher`, :class:" +"`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher` and :class:" +"`asyncio.SafeChildWatcher` are deprecated and will be removed in Python " +"3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1171 +#: ../../whatsnew/3.12.rst:1179 #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" -":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -"and :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated " -"and will be removed in Python 3.14. (Contributed by Kumar Aditya " -"in :gh:`94597`.)" +":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" +"`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." +"AbstractEventLoopPolicy.get_child_watcher` are deprecated and will be " +"removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -"和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 " -"Python 3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:" +"`asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`asyncio." +"AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" +"除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" -#: ../../whatsnew/3.12.rst:1177 +#: ../../whatsnew/3.12.rst:1185 #: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " @@ -1891,122 +1912,116 @@ msgstr "" "件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" -#: ../../whatsnew/3.12.rst:1182 +#: ../../whatsnew/3.12.rst:1190 #: ../../deprecations/pending-removal-in-future.rst:41 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` " -"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " -"in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../whatsnew/3.12.rst:1186 +#: ../../whatsnew/3.12.rst:1194 msgid "" ":mod:`collections.abc`: Deprecated :class:`collections.abc.ByteString`. " "Prefer :class:`Sequence` or :class:`collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, " -"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " -"in :gh:`91896`.)" +"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." +"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1191 +#: ../../whatsnew/3.12.rst:1199 msgid "" -":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime.utcnow` " -"and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and will be " -"removed in a future version. Instead, use timezone-aware objects to " -"represent datetimes in UTC: respectively, " -"call :meth:`~datetime.datetime.now` " -"and :meth:`~datetime.datetime.fromtimestamp` with the *tz* parameter set " -"to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" +":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime." +"utcnow` and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and " +"will be removed in a future version. Instead, use timezone-aware objects to " +"represent datetimes in UTC: respectively, call :meth:`~datetime.datetime." +"now` and :meth:`~datetime.datetime.fromtimestamp` with the *tz* parameter " +"set to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1199 +#: ../../whatsnew/3.12.rst:1207 msgid "" -":mod:`email`: Deprecate the *isdst* parameter " -"in :func:`email.utils.localtime`. (Contributed by Alan Williams " -"in :gh:`72346`.)" +":mod:`email`: Deprecate the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" ":mod:`email`:棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1202 +#: ../../whatsnew/3.12.rst:1210 msgid "" ":mod:`importlib.abc`: Deprecated the following classes, scheduled for " "removal in Python 3.14:" msgstr ":mod:`importlib.abc`:棄用下列類別,預定於 Python 3.14 中移除:" -#: ../../whatsnew/3.12.rst:1205 +#: ../../whatsnew/3.12.rst:1213 #: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../whatsnew/3.12.rst:1206 +#: ../../whatsnew/3.12.rst:1214 #: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../whatsnew/3.12.rst:1207 +#: ../../whatsnew/3.12.rst:1215 #: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../whatsnew/3.12.rst:1209 +#: ../../whatsnew/3.12.rst:1217 #: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../whatsnew/3.12.rst:1211 +#: ../../whatsnew/3.12.rst:1219 #: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../whatsnew/3.12.rst:1212 +#: ../../whatsnew/3.12.rst:1220 #: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../whatsnew/3.12.rst:1214 +#: ../../whatsnew/3.12.rst:1222 #: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../whatsnew/3.12.rst:1216 +#: ../../whatsnew/3.12.rst:1224 msgid "" ":mod:`itertools`: Deprecate the support for copy, deepcopy, and pickle " "operations, which is undocumented, inefficient, historically buggy, and " "inconsistent. This will be removed in 3.14 for a significant reduction in " -"code volume and maintenance burden. (Contributed by Raymond Hettinger " -"in :gh:`101588`.)" +"code volume and maintenance burden. (Contributed by Raymond Hettinger in :gh:" +"`101588`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1222 +#: ../../whatsnew/3.12.rst:1230 msgid "" ":mod:`multiprocessing`: In Python 3.14, the default :mod:`multiprocessing` " "start method will change to a safer one on Linux, BSDs, and other non-macOS " "POSIX platforms where ``'fork'`` is currently the default (:gh:`84559`). " "Adding a runtime warning about this was deemed too disruptive as the " -"majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` " -"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " -"your code *requires* ``'fork'``. See :ref:`contexts and start methods " -"<multiprocessing-start-methods>`." +"majority of code is not expected to care. Use the :func:`~multiprocessing." +"get_context` or :func:`~multiprocessing.set_start_method` APIs to explicitly " +"specify when your code *requires* ``'fork'``. See :ref:`contexts and start " +"methods <multiprocessing-start-methods>`." msgstr "" -#: ../../whatsnew/3.12.rst:1232 +#: ../../whatsnew/3.12.rst:1240 msgid "" ":mod:`pkgutil`: :func:`pkgutil.find_loader` and :func:`pkgutil.get_loader` " -"are deprecated and will be removed in Python 3.14; " -"use :func:`importlib.util.find_spec` instead. (Contributed by Nikita Sobolev " -"in :gh:`97850`.)" +"are deprecated and will be removed in Python 3.14; use :func:`importlib.util." +"find_spec` instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`pkgutil.find_loader` 和 :func:`pkgutil.get_loader` 已" "被棄用並將在 Python 3.14 中移除;請改用 :func:`importlib.util.find_spec`。" "(由 Nikita Sobolev 於 :gh:`97850` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1237 +#: ../../whatsnew/3.12.rst:1245 msgid "" ":mod:`pty`: The module has two undocumented ``master_open()`` and " "``slave_open()`` functions that have been deprecated since Python 2 but only " @@ -2014,11 +2029,11 @@ msgid "" "(Contributed by Soumendra Ganguly and Gregory P. Smith in :gh:`85984`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1242 +#: ../../whatsnew/3.12.rst:1250 msgid ":mod:`os`:" msgstr ":mod:`os`:" -#: ../../whatsnew/3.12.rst:1244 +#: ../../whatsnew/3.12.rst:1252 msgid "" "The ``st_ctime`` fields return by :func:`os.stat` and :func:`os.lstat` on " "Windows are deprecated. In a future release, they will contain the last " @@ -2027,50 +2042,49 @@ msgid "" "``st_birthtime`` field. (Contributed by Steve Dower in :gh:`99726`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1250 +#: ../../whatsnew/3.12.rst:1258 msgid "" -"On POSIX platforms, :func:`os.fork` can now raise " -"a :exc:`DeprecationWarning` when it can detect being called from a " -"multithreaded process. There has always been a fundamental incompatibility " -"with the POSIX platform when doing so. Even if such code *appeared* to work. " -"We added the warning to raise awareness as issues encountered by code doing " -"this are becoming more frequent. See the :func:`os.fork` documentation for " -"more details along with `this discussion on fork being incompatible with " -"threads <https://discuss.python.org/t/concerns-regarding-deprecation-of-fork-" -"with-alive-threads/33555>`_ for *why* we're now surfacing this longstanding " +"On POSIX platforms, :func:`os.fork` can now raise a :exc:" +"`DeprecationWarning` when it can detect being called from a multithreaded " +"process. There has always been a fundamental incompatibility with the POSIX " +"platform when doing so. Even if such code *appeared* to work. We added the " +"warning to raise awareness as issues encountered by code doing this are " +"becoming more frequent. See the :func:`os.fork` documentation for more " +"details along with `this discussion on fork being incompatible with threads " +"<https://discuss.python.org/t/concerns-regarding-deprecation-of-fork-with-" +"alive-threads/33555>`_ for *why* we're now surfacing this longstanding " "platform compatibility problem to developers." msgstr "" -#: ../../whatsnew/3.12.rst:1260 +#: ../../whatsnew/3.12.rst:1268 msgid "" -"When this warning appears due to usage of :mod:`multiprocessing` " -"or :mod:`concurrent.futures` the fix is to use a " -"different :mod:`multiprocessing` start method such as ``\"spawn\"`` or " -"``\"forkserver\"``." +"When this warning appears due to usage of :mod:`multiprocessing` or :mod:" +"`concurrent.futures` the fix is to use a different :mod:`multiprocessing` " +"start method such as ``\"spawn\"`` or ``\"forkserver\"``." msgstr "" -#: ../../whatsnew/3.12.rst:1264 +#: ../../whatsnew/3.12.rst:1272 msgid "" ":mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree` is " -"deprecated; use *onexc* instead. (Contributed by Irit Katriel " -"in :gh:`102828`.)" +"deprecated; use *onexc* instead. (Contributed by Irit Katriel in :gh:" +"`102828`.)" msgstr "" ":mod:`shutil`::func:`shutil.rmtree` 的 *onerror* 引數已被棄用,請改用 " "*onexc*。(由 Irit Katriel 於 :gh:`102828` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1267 +#: ../../whatsnew/3.12.rst:1275 #: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../whatsnew/3.12.rst:1269 +#: ../../whatsnew/3.12.rst:1277 msgid "" ":ref:`default adapters and converters <sqlite3-default-converters>` are now " "deprecated. Instead, use the :ref:`sqlite3-adapter-converter-recipes` and " "tailor them to your needs. (Contributed by Erlend E. Aasland in :gh:`90016`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1275 +#: ../../whatsnew/3.12.rst:1283 msgid "" "In :meth:`~sqlite3.Cursor.execute`, :exc:`DeprecationWarning` is now emitted " "when :ref:`named placeholders <sqlite3-placeholders>` are used together with " @@ -2080,44 +2094,43 @@ msgid "" "Erlend E. Aasland in :gh:`101698`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1282 +#: ../../whatsnew/3.12.rst:1290 msgid "" -":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` " -"and :data:`sys.last_traceback` fields are deprecated. " -"Use :data:`sys.last_exc` instead. (Contributed by Irit Katriel " -"in :gh:`102778`.)" +":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` and :data:`sys." +"last_traceback` fields are deprecated. Use :data:`sys.last_exc` instead. " +"(Contributed by Irit Katriel in :gh:`102778`.)" msgstr "" -":mod:`sys`::data:`sys.last_type`、:data:`sys.last_value` " -"和 :data:`sys.last_traceback` 欄位已被棄用。請改用 :data:`sys.last_exc`。" -"(由 Irit Katriel 於 :gh:`102778` 中貢獻。)" +":mod:`sys`::data:`sys.last_type`、:data:`sys.last_value` 和 :data:`sys." +"last_traceback` 欄位已被棄用。請改用 :data:`sys.last_exc`。(由 Irit Katriel " +"於 :gh:`102778` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1286 +#: ../../whatsnew/3.12.rst:1294 msgid "" ":mod:`tarfile`: Extracting tar archives without specifying *filter* is " "deprecated until Python 3.14, when ``'data'`` filter will become the " "default. See :ref:`tarfile-extraction-filter` for details." msgstr "" -#: ../../whatsnew/3.12.rst:1290 -#: ../../deprecations/pending-removal-in-3.15.rst:71 +#: ../../whatsnew/3.12.rst:1298 +#: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../whatsnew/3.12.rst:1292 +#: ../../whatsnew/3.12.rst:1300 msgid "" -":class:`typing.Hashable` and :class:`typing.Sized`, aliases " -"for :class:`collections.abc.Hashable` and :class:`collections.abc.Sized` " -"respectively, are deprecated. (:gh:`94309`.)" +":class:`typing.Hashable` and :class:`typing.Sized`, aliases for :class:" +"`collections.abc.Hashable` and :class:`collections.abc.Sized` respectively, " +"are deprecated. (:gh:`94309`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1296 +#: ../../whatsnew/3.12.rst:1304 msgid "" -":class:`typing.ByteString`, deprecated since Python 3.9, now causes " -"a :exc:`DeprecationWarning` to be emitted when it is used. (Contributed by " -"Alex Waygood in :gh:`91896`.)" +":class:`typing.ByteString`, deprecated since Python 3.9, now causes a :exc:" +"`DeprecationWarning` to be emitted when it is used. (Contributed by Alex " +"Waygood in :gh:`91896`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1300 +#: ../../whatsnew/3.12.rst:1308 msgid "" ":mod:`xml.etree.ElementTree`: The module now emits :exc:`DeprecationWarning` " "when testing the truth value of an :class:`xml.etree.ElementTree.Element`. " @@ -2125,32 +2138,32 @@ msgid "" "implementation emitted nothing. (Contributed by Jacob Walls in :gh:`83122`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1306 +#: ../../whatsnew/3.12.rst:1314 msgid "" "The 3-arg signatures (type, value, traceback) of :meth:`coroutine throw() " -"<coroutine.throw>`, :meth:`generator throw() <generator.throw>` " -"and :meth:`async generator throw() <agen.athrow>` are deprecated and may be " -"removed in a future version of Python. Use the single-arg versions of these " -"functions instead. (Contributed by Ofey Chan in :gh:`89874`.)" +"<coroutine.throw>`, :meth:`generator throw() <generator.throw>` and :meth:" +"`async generator throw() <agen.athrow>` are deprecated and may be removed in " +"a future version of Python. Use the single-arg versions of these functions " +"instead. (Contributed by Ofey Chan in :gh:`89874`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1312 +#: ../../whatsnew/3.12.rst:1320 msgid "" ":exc:`DeprecationWarning` is now raised when :attr:`~module.__package__` on " -"a module differs from :attr:`__spec__.parent " -"<importlib.machinery.ModuleSpec.parent>` (previously it " -"was :exc:`ImportWarning`). (Contributed by Brett Cannon in :gh:`65961`.)" +"a module differs from :attr:`__spec__.parent <importlib.machinery.ModuleSpec." +"parent>` (previously it was :exc:`ImportWarning`). (Contributed by Brett " +"Cannon in :gh:`65961`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1318 +#: ../../whatsnew/3.12.rst:1326 msgid "" "Setting :attr:`~module.__package__` or :attr:`~module.__cached__` on a " "module is deprecated, and will cease to be set or taken into consideration " -"by the import system in Python 3.14. (Contributed by Brett Cannon " -"in :gh:`65961`.)" +"by the import system in Python 3.14. (Contributed by Brett Cannon in :gh:" +"`65961`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1322 +#: ../../whatsnew/3.12.rst:1330 msgid "" "The bitwise inversion operator (``~``) on bool is deprecated. It will throw " "an error in Python 3.16. Use ``not`` for logical negation of bools instead. " @@ -2159,16 +2172,16 @@ msgid "" "Tim Hoffmann in :gh:`103487`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1328 +#: ../../whatsnew/3.12.rst:1336 msgid "" "Accessing :attr:`~codeobject.co_lnotab` on code objects was deprecated in " -"Python 3.10 via :pep:`626`, but it only got a " -"proper :exc:`DeprecationWarning` in 3.12. May be removed in 3.15. " -"(Contributed by Nikita Sobolev in :gh:`101866`.)" +"Python 3.10 via :pep:`626`, but it only got a proper :exc:" +"`DeprecationWarning` in 3.12. May be removed in 3.15. (Contributed by Nikita " +"Sobolev in :gh:`101866`.)" msgstr "" -"自 3.10 起,於程式碼物件存取 :attr:`~codeobject.co_lnotab` 的功能已" -"在 :pep:`626` 中被棄用,但只在 3.12 中於適時發出 :exc:`DeprecationWarning`。" -"可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:`101866` 貢獻。)" +"自 3.10 起,於程式碼物件存取 :attr:`~codeobject.co_lnotab` 的功能已在 :pep:" +"`626` 中被棄用,但只在 3.12 中於適時發出 :exc:`DeprecationWarning`。可能在 " +"3.15 中移除。(由 Nikita Sobolev 於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.13.rst:2 msgid "Pending Removal in Python 3.13" @@ -2360,35 +2373,32 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" -"The child watcher " -"classes :class:`~asyncio.MultiLoopChildWatcher`, :class:`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` " -"and :class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " +"The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" +"`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" +"class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " "Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類" -"別::class:`~asyncio.MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio.AbstractChildWatcher` " -"和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar Aditya 於 :gh:`94597` 貢" -"獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`~asyncio." +"MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio." +"AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " +"Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, " -"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " -"in :gh:`91896`.)" -msgstr "" -":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" -"用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" -"時,請改用聯集,如 ``bytes | bytearray``," -"或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" -"獻。)" +"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." +"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" +msgstr "" +":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改用 :" +"class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用時,請" +"改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " +"Shantanu Jain 於 :gh:`91896` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" -":mod:`email`: Deprecated the *isdst* parameter " -"in :func:`email.utils.localtime`. (Contributed by Alan Williams " -"in :gh:`72346`.)" +":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" @@ -2414,25 +2424,24 @@ msgid "" "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " "currently the default (:gh:`84559`). Adding a runtime warning about this was " "deemed too disruptive as the majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` " -"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " -"your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`." +"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." +"set_start_method` APIs to explicitly specify when your code *requires* " +"``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" ":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" "台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" -"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使" -"用 :func:`~multiprocessing.get_context` " -"或 :func:`~multiprocessing.set_start_method` API 來明確指定你的程式碼何時\\ *" -"需要* ``'fork'``。請參閱 :ref:`multiprocessing-start-methods`。" +"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" +"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " +"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" +"`multiprocessing-start-methods`。" #: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" -":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " -"and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments is " -"deprecated." +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." +"PurePath.relative_to`: passing additional arguments is deprecated." msgstr "" -":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` " -"和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" +":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" +"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" #: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" @@ -2441,9 +2450,8 @@ msgid "" "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " -"現在會引發 :exc:`DeprecationWarning`;請改" -"用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" -"獻。)" +"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." +"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" @@ -2463,9 +2471,9 @@ msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" #: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" -":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " -"if :ref:`named placeholders <sqlite3-placeholders>` are used and " -"*parameters* is a sequence instead of a :class:`dict`." +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" +"ref:`named placeholders <sqlite3-placeholders>` are used and *parameters* is " +"a sequence instead of a :class:`dict`." msgstr "" ":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" "使用 :ref:`named placeholders <sqlite3-placeholders>` 且 *parameters* 是序列" @@ -2482,8 +2490,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " -"intended to be a public API. (Contributed by Gregory P. Smith " -"in :gh:`88168`.)" +"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" +"`88168`.)" msgstr "" ":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" "(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" @@ -2500,10 +2508,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to " -"set :attr:`__spec__.cached <importlib.machinery.ModuleSpec.cached>` is " -"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " -"into consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached <importlib.machinery.ModuleSpec.cached>` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "<importlib.machinery.ModuleSpec.cached>` 的做法已被棄用。在 Python 3.15 中," @@ -2511,11 +2519,10 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to " -"set :attr:`__spec__.parent <importlib.machinery.ModuleSpec.parent>` is " -"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " -"take into consideration by the import system or standard library. " -"(:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent <importlib.machinery.ModuleSpec.parent>` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "<importlib.machinery.ModuleSpec.parent>` 的做法已被棄用。在 Python 3.15 中," @@ -2555,41 +2562,48 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:58 +msgid ":mod:`importlib`:" +msgstr ":mod:`importlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "``load_module()`` method:請改用 ``exec_module()``。" + +#: ../../deprecations/pending-removal-in-3.15.rst:36 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:34 +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 " -"(:gh:`90817`), but has been postponed to Python 3.15. " -"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " -"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " -"in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" -"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " -"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" -"獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " -"Use :func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" -"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:48 +#: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -2598,11 +2612,23 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:54 +#: ../../deprecations/pending-removal-in-3.15.rst:58 +msgid ":mod:`sysconfig`:" +msgstr ":mod:`sysconfig`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" +":func:`sysconfig.is_python_build` 的 *check_home* 引數自 Python 3.12 起已被棄" +"用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:63 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:56 +#: ../../deprecations/pending-removal-in-3.15.rst:65 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -2613,11 +2639,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`types`:" msgstr ":mod:`types`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -2625,22 +2651,22 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" -"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " -"於 :gh:`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:73 +#: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" -"The undocumented keyword argument syntax for " -"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " -"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " -"3.13. Use the class-based syntax or the functional syntax instead." +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " +"has been deprecated since Python 3.13. Use the class-based syntax or the " +"functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:79 +#: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -2650,20 +2676,19 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:84 +#: ../../deprecations/pending-removal-in-3.15.rst:93 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:86 +#: ../../deprecations/pending-removal-in-3.15.rst:95 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " -"and :meth:`~wave.Wave_read.getmarkers` methods of " -"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " -"deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" -"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " -"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending removal in Python 3.16" @@ -2671,10 +2696,10 @@ msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to " -"set :attr:`__spec__.loader <importlib.machinery.ModuleSpec.loader>` is " -"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " -"taken into consideration by the import system or the standard library." +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader <importlib.machinery.ModuleSpec.loader>` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" "在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " "<importlib.machinery.ModuleSpec.loader>` 的做法將於 Python 3.16 被棄用。在 " @@ -2701,8 +2726,8 @@ msgid "" "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" -"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " -"於 :gh:`122875` 貢獻。)" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" +"gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 #: ../../deprecations/pending-removal-in-future.rst:12 @@ -2812,17 +2837,17 @@ msgid "" "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of " -"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " -"and :keyword:`or`. In a future release it will be changed to a syntax " -"error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " "1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" -"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " -"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" -"法錯誤。(:gh:`87999`)" +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" +"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" +"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" +"本中,它將被更改為語法錯誤。(:gh:`87999`)" #: ../../deprecations/pending-removal-in-future.rst:26 msgid "" @@ -2835,18 +2860,18 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:29 msgid "" -"Support for ``__float__()`` method returning a strict subclass " -"of :class:`float`: these methods will be required to return an instance " -"of :class:`float`." +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" #: ../../deprecations/pending-removal-in-future.rst:32 msgid "" -"Support for ``__complex__()`` method returning a strict subclass " -"of :class:`complex`: these methods will be required to return an instance " -"of :class:`complex`." +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" @@ -2857,10 +2882,10 @@ msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" #: ../../deprecations/pending-removal-in-future.rst:36 msgid "" -"Passing a complex number as the *real* or *imag* argument in " -"the :func:`complex` constructor is now deprecated; it should only be passed " -"as a single positional argument. (Contributed by Serhiy Storchaka " -"in :gh:`109218`.)" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" @@ -2878,33 +2903,25 @@ msgstr ":mod:`datetime`:" #: ../../deprecations/pending-removal-in-future.rst:51 msgid "" -":meth:`~datetime.datetime.utcnow`: use " -"``datetime.datetime.now(tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 " -"``datetime.datetime.now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." +"now(tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:53 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:56 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" -#: ../../deprecations/pending-removal-in-future.rst:58 -msgid ":mod:`importlib`:" -msgstr ":mod:`importlib`:" - #: ../../deprecations/pending-removal-in-future.rst:60 -msgid "``load_module()`` method: use ``exec_module()`` instead." -msgstr "``load_module()`` method:請改用 ``exec_module()``。" - -#: ../../deprecations/pending-removal-in-future.rst:61 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -2912,39 +2929,39 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:65 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:67 +#: ../../deprecations/pending-removal-in-future.rst:66 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:68 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" -"用 :meth:`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" +"`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:71 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:75 +#: ../../deprecations/pending-removal-in-future.rst:74 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:76 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -2952,7 +2969,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:80 +#: ../../deprecations/pending-removal-in-future.rst:79 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -2964,12 +2981,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:87 +#: ../../deprecations/pending-removal-in-future.rst:86 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:88 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -2977,115 +2994,108 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:91 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:94 +#: ../../deprecations/pending-removal-in-future.rst:93 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:94 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " -"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " -"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" +"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:97 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 -msgid "" -":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " -"ignored." -msgstr "" -":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" - -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "" -":meth:`!threading.Condition.notifyAll`: " -"use :meth:`~threading.Condition.notify_all`." +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請" -"用 :meth:`~threading.Condition.notify_all`。" +":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." +"notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:111 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " -"use :attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " -"use :attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" -"用 :attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" +"attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:116 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:121 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:119 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:121 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -3093,119 +3103,119 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:127 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:129 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:135 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "" -":mod:`urllib.request`: :class:`~urllib.request.URLopener` " -"and :class:`~urllib.request.FancyURLopener` style of invoking requests is " -"deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods." +":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" +"`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " +"Use newer :func:`~urllib.request.urlopen` functions and methods." msgstr "" -":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` " -"和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" -"的 :func:`~urllib.request.urlopen` 函式和方法。" +":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` 和 :" +"class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" +"`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:145 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of " -"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " -"release it will always return ``True``. Prefer explicit ``len(elem)`` or " -"``elem is not None`` tests instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用" -"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" -"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." +"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " +"``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:154 +#: ../../deprecations/pending-removal-in-future.rst:150 msgid "" -":meth:`zipimport.zipimporter.load_module` is deprecated: " -"use :meth:`~zipimport.zipimporter.exec_module` instead." +":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" +"`~zipimport.zipimporter.exec_module` instead." msgstr "" -":meth:`zipimport.zipimporter.load_module` 已被棄用:請改" -"用 :meth:`~zipimport.zipimporter.exec_module`。" +":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." +"zipimporter.exec_module`。" -#: ../../whatsnew/3.12.rst:1347 ../../whatsnew/3.12.rst:2229 +#: ../../whatsnew/3.12.rst:1355 ../../whatsnew/3.12.rst:2237 msgid "Removed" msgstr "已移除" -#: ../../whatsnew/3.12.rst:1350 +#: ../../whatsnew/3.12.rst:1358 msgid "asynchat and asyncore" msgstr "asynchat 和 asyncore" -#: ../../whatsnew/3.12.rst:1352 +#: ../../whatsnew/3.12.rst:1360 msgid "" "These two modules have been removed according to the schedule in :pep:`594`, " "having been deprecated in Python 3.6. Use :mod:`asyncio` instead. " "(Contributed by Nikita Sobolev in :gh:`96580`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1359 +#: ../../whatsnew/3.12.rst:1367 msgid "configparser" msgstr "configparser" -#: ../../whatsnew/3.12.rst:1361 +#: ../../whatsnew/3.12.rst:1369 msgid "" "Several names deprecated in the :mod:`configparser` way back in 3.2 have " "been removed per :gh:`89336`:" msgstr "" "根據 :gh:`89336`,已移除了在 3.2 中被 :mod:`configparser` 棄用的幾個名稱:" -#: ../../whatsnew/3.12.rst:1364 +#: ../../whatsnew/3.12.rst:1372 msgid "" ":class:`configparser.ParsingError` no longer has a ``filename`` attribute or " "argument. Use the ``source`` attribute and argument instead." @@ -3213,27 +3223,27 @@ msgstr "" ":class:`configparser.ParsingError` 不再具有 ``filename`` 屬性或引數。請改用 " "``source`` 屬性和引數。" -#: ../../whatsnew/3.12.rst:1366 +#: ../../whatsnew/3.12.rst:1374 msgid "" ":mod:`configparser` no longer has a ``SafeConfigParser`` class. Use the " "shorter :class:`~configparser.ConfigParser` name instead." msgstr "" -":mod:`configparser` 不再具有 ``SafeConfigParser`` 類別。請改用較短" -"的 :class:`~configparser.ConfigParser` 名稱。" +":mod:`configparser` 不再具有 ``SafeConfigParser`` 類別。請改用較短的 :class:" +"`~configparser.ConfigParser` 名稱。" -#: ../../whatsnew/3.12.rst:1368 +#: ../../whatsnew/3.12.rst:1376 msgid "" -":class:`configparser.ConfigParser` no longer has a ``readfp`` method. " -"Use :meth:`~configparser.ConfigParser.read_file` instead." +":class:`configparser.ConfigParser` no longer has a ``readfp`` method. Use :" +"meth:`~configparser.ConfigParser.read_file` instead." msgstr "" -":class:`configparser.ConfigParser` 不再具有 ``readfp`` 方法。請改" -"用 :meth:`~configparser.ConfigParser.read_file`。" +":class:`configparser.ConfigParser` 不再具有 ``readfp`` 方法。請改用 :meth:" +"`~configparser.ConfigParser.read_file`。" -#: ../../whatsnew/3.12.rst:1374 +#: ../../whatsnew/3.12.rst:1382 msgid "distutils" msgstr "distutils" -#: ../../whatsnew/3.12.rst:1376 +#: ../../whatsnew/3.12.rst:1384 msgid "" "Remove the :py:mod:`!distutils` package. It was deprecated in Python 3.10 " "by :pep:`632` \"Deprecate distutils module\". For projects still using " @@ -3242,17 +3252,17 @@ msgid "" "Victor Stinner in :gh:`92584`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1383 +#: ../../whatsnew/3.12.rst:1391 msgid "ensurepip" msgstr "ensurepip" -#: ../../whatsnew/3.12.rst:1385 +#: ../../whatsnew/3.12.rst:1393 msgid "" "Remove the bundled setuptools wheel from :mod:`ensurepip`, and stop " "installing setuptools in environments created by :mod:`venv`." msgstr "" -#: ../../whatsnew/3.12.rst:1388 +#: ../../whatsnew/3.12.rst:1396 msgid "" "``pip (>= 22.1)`` does not require setuptools to be installed in the " "environment. ``setuptools``-based (and ``distutils``-based) packages can " @@ -3260,7 +3270,7 @@ msgid "" "the build environment it uses for building a package." msgstr "" -#: ../../whatsnew/3.12.rst:1394 +#: ../../whatsnew/3.12.rst:1402 msgid "" "``easy_install``, ``pkg_resources``, ``setuptools`` and ``distutils`` are no " "longer provided by default in environments created with ``venv`` or " @@ -3270,15 +3280,15 @@ msgid "" "(typically, using pip)." msgstr "" -#: ../../whatsnew/3.12.rst:1401 +#: ../../whatsnew/3.12.rst:1409 msgid "(Contributed by Pradyun Gedam in :gh:`95299`.)" msgstr "(由 Pradyun Gedam 於 :gh:`95299` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1404 +#: ../../whatsnew/3.12.rst:1412 msgid "enum" msgstr "enum" -#: ../../whatsnew/3.12.rst:1406 +#: ../../whatsnew/3.12.rst:1414 msgid "" "Remove :mod:`enum`'s ``EnumMeta.__getattr__``, which is no longer needed for " "enum attribute access. (Contributed by Ethan Furman in :gh:`95083`.)" @@ -3286,11 +3296,11 @@ msgstr "" "移除 :mod:`enum` 的 ``EnumMeta.__getattr__``,對於列舉屬性的訪問不再會需要" "它。" -#: ../../whatsnew/3.12.rst:1411 +#: ../../whatsnew/3.12.rst:1419 msgid "ftplib" msgstr "ftplib" -#: ../../whatsnew/3.12.rst:1413 +#: ../../whatsnew/3.12.rst:1421 msgid "" "Remove :mod:`ftplib`'s ``FTP_TLS.ssl_version`` class attribute: use the " "*context* parameter instead. (Contributed by Victor Stinner in :gh:`94172`.)" @@ -3298,43 +3308,43 @@ msgstr "" "移除 :mod:`ftplib` 的 ``FTP_TLS.ssl_version`` 類別屬性:請改用 *context* 參" "數。(由 Victor Stinner 於 :gh:`94172` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1418 +#: ../../whatsnew/3.12.rst:1426 msgid "gzip" msgstr "gzip" -#: ../../whatsnew/3.12.rst:1420 +#: ../../whatsnew/3.12.rst:1428 msgid "" "Remove the ``filename`` attribute of :mod:`gzip`'s :class:`gzip.GzipFile`, " "deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute " "instead. In write mode, the ``filename`` attribute added ``'.gz'`` file " -"extension if it was not present. (Contributed by Victor Stinner " -"in :gh:`94196`.)" +"extension if it was not present. (Contributed by Victor Stinner in :gh:" +"`94196`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1427 +#: ../../whatsnew/3.12.rst:1435 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.12.rst:1429 +#: ../../whatsnew/3.12.rst:1437 msgid "" -"Remove the pure Python implementation " -"of :mod:`hashlib`'s :func:`hashlib.pbkdf2_hmac`, deprecated in Python 3.10. " -"Python 3.10 and newer requires OpenSSL 1.1.1 (:pep:`644`): this OpenSSL " -"version provides a C implementation of :func:`~hashlib.pbkdf2_hmac` which is " -"faster. (Contributed by Victor Stinner in :gh:`94199`.)" +"Remove the pure Python implementation of :mod:`hashlib`'s :func:`hashlib." +"pbkdf2_hmac`, deprecated in Python 3.10. Python 3.10 and newer requires " +"OpenSSL 1.1.1 (:pep:`644`): this OpenSSL version provides a C implementation " +"of :func:`~hashlib.pbkdf2_hmac` which is faster. (Contributed by Victor " +"Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1436 ../../whatsnew/3.12.rst:1465 +#: ../../whatsnew/3.12.rst:1444 ../../whatsnew/3.12.rst:1473 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.12.rst:1438 +#: ../../whatsnew/3.12.rst:1446 msgid "" "Many previously deprecated cleanups in :mod:`importlib` have now been " "completed:" msgstr "現已完成清理 :mod:`importlib` 中許多過去已經棄用的東西:" -#: ../../whatsnew/3.12.rst:1441 +#: ../../whatsnew/3.12.rst:1449 msgid "" "References to, and support for :meth:`!module_repr` has been removed. " "(Contributed by Barry Warsaw in :gh:`97850`.)" @@ -3342,136 +3352,136 @@ msgstr "" "對 :meth:`!module_repr` 的參照和支援已刪除。(由 Barry Warsaw 在 :gh:`97850` " "中貢獻。)" -#: ../../whatsnew/3.12.rst:1444 +#: ../../whatsnew/3.12.rst:1452 msgid "" "``importlib.util.set_package``, ``importlib.util.set_loader`` and " "``importlib.util.module_for_loader`` have all been removed. (Contributed by " "Brett Cannon and Nikita Sobolev in :gh:`65961` and :gh:`97850`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1448 +#: ../../whatsnew/3.12.rst:1456 msgid "" "Support for ``find_loader()`` and ``find_module()`` APIs have been removed. " "(Contributed by Barry Warsaw in :gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1451 +#: ../../whatsnew/3.12.rst:1459 msgid "" "``importlib.abc.Finder``, ``pkgutil.ImpImporter``, and ``pkgutil.ImpLoader`` " "have been removed. (Contributed by Barry Warsaw in :gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1457 ../../whatsnew/3.12.rst:1465 +#: ../../whatsnew/3.12.rst:1465 ../../whatsnew/3.12.rst:1473 msgid "imp" msgstr "imp" -#: ../../whatsnew/3.12.rst:1459 +#: ../../whatsnew/3.12.rst:1467 msgid "" -"The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw " -"in :gh:`98040`.)" +"The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :" +"gh:`98040`.)" msgstr ":mod:`!imp` 模組已被移除。(由 Barry Warsaw 在 :gh:`98040` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1462 +#: ../../whatsnew/3.12.rst:1470 msgid "To migrate, consult the following correspondence table:" msgstr "要遷移的話請參考以下對應表:" -#: ../../whatsnew/3.12.rst:1467 +#: ../../whatsnew/3.12.rst:1475 msgid "``imp.NullImporter``" msgstr "``imp.NullImporter``" -#: ../../whatsnew/3.12.rst:1467 +#: ../../whatsnew/3.12.rst:1475 msgid "Insert ``None`` into ``sys.path_importer_cache``" msgstr "將 ``None`` 插入 ``sys.path_importer_cache``" -#: ../../whatsnew/3.12.rst:1468 +#: ../../whatsnew/3.12.rst:1476 msgid "``imp.cache_from_source()``" msgstr "``imp.cache_from_source()``" -#: ../../whatsnew/3.12.rst:1468 +#: ../../whatsnew/3.12.rst:1476 msgid ":func:`importlib.util.cache_from_source`" msgstr ":func:`importlib.util.cache_from_source`" -#: ../../whatsnew/3.12.rst:1469 +#: ../../whatsnew/3.12.rst:1477 msgid "``imp.find_module()``" msgstr "``imp.find_module()``" -#: ../../whatsnew/3.12.rst:1469 +#: ../../whatsnew/3.12.rst:1477 msgid ":func:`importlib.util.find_spec`" msgstr ":func:`importlib.util.find_spec`" -#: ../../whatsnew/3.12.rst:1470 +#: ../../whatsnew/3.12.rst:1478 msgid "``imp.get_magic()``" msgstr "``imp.get_magic()``" -#: ../../whatsnew/3.12.rst:1470 +#: ../../whatsnew/3.12.rst:1478 msgid ":const:`importlib.util.MAGIC_NUMBER`" msgstr ":const:`importlib.util.MAGIC_NUMBER`" -#: ../../whatsnew/3.12.rst:1471 +#: ../../whatsnew/3.12.rst:1479 msgid "``imp.get_suffixes()``" msgstr "``imp.get_suffixes()``" -#: ../../whatsnew/3.12.rst:1471 +#: ../../whatsnew/3.12.rst:1479 msgid "" -":const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery.EXTENSION_SUFFIXES`, " -"and :const:`importlib.machinery.BYTECODE_SUFFIXES`" +":const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery." +"EXTENSION_SUFFIXES`, and :const:`importlib.machinery.BYTECODE_SUFFIXES`" msgstr "" -":const:`importlib.machinery.SOURCE_SUFFIXES`、:const:`importlib.machinery.EXTENSION_SUFFIXES` " -"和 :const:`importlib.machinery.BYTECODE_SUFFIXES`" +":const:`importlib.machinery.SOURCE_SUFFIXES`、:const:`importlib.machinery." +"EXTENSION_SUFFIXES` 和 :const:`importlib.machinery.BYTECODE_SUFFIXES`" -#: ../../whatsnew/3.12.rst:1472 +#: ../../whatsnew/3.12.rst:1480 msgid "``imp.get_tag()``" msgstr "``imp.get_tag()``" -#: ../../whatsnew/3.12.rst:1472 +#: ../../whatsnew/3.12.rst:1480 msgid ":attr:`sys.implementation.cache_tag <sys.implementation>`" msgstr ":attr:`sys.implementation.cache_tag <sys.implementation>`" -#: ../../whatsnew/3.12.rst:1473 +#: ../../whatsnew/3.12.rst:1481 msgid "``imp.load_module()``" msgstr "``imp.load_module()``" -#: ../../whatsnew/3.12.rst:1473 +#: ../../whatsnew/3.12.rst:1481 msgid ":func:`importlib.import_module`" msgstr ":func:`importlib.import_module`" -#: ../../whatsnew/3.12.rst:1474 +#: ../../whatsnew/3.12.rst:1482 msgid "``imp.new_module(name)``" msgstr "``imp.new_module(name)``" -#: ../../whatsnew/3.12.rst:1474 +#: ../../whatsnew/3.12.rst:1482 msgid "``types.ModuleType(name)``" msgstr "``types.ModuleType(name)``" -#: ../../whatsnew/3.12.rst:1475 +#: ../../whatsnew/3.12.rst:1483 msgid "``imp.reload()``" msgstr "``imp.reload()``" -#: ../../whatsnew/3.12.rst:1475 +#: ../../whatsnew/3.12.rst:1483 msgid ":func:`importlib.reload`" msgstr ":func:`importlib.reload`" -#: ../../whatsnew/3.12.rst:1476 +#: ../../whatsnew/3.12.rst:1484 msgid "``imp.source_from_cache()``" msgstr "``imp.source_from_cache()``" -#: ../../whatsnew/3.12.rst:1476 +#: ../../whatsnew/3.12.rst:1484 msgid ":func:`importlib.util.source_from_cache`" msgstr ":func:`importlib.util.source_from_cache`" -#: ../../whatsnew/3.12.rst:1477 +#: ../../whatsnew/3.12.rst:1485 msgid "``imp.load_source()``" msgstr "``imp.load_source()``" -#: ../../whatsnew/3.12.rst:1477 +#: ../../whatsnew/3.12.rst:1485 msgid "*See below*" msgstr "*見下文*" -#: ../../whatsnew/3.12.rst:1480 +#: ../../whatsnew/3.12.rst:1488 msgid "Replace ``imp.load_source()`` with::" msgstr "用以下取代 ``imp.load_source()``: ::" -#: ../../whatsnew/3.12.rst:1482 +#: ../../whatsnew/3.12.rst:1490 msgid "" "import importlib.util\n" "import importlib.machinery\n" @@ -3501,37 +3511,37 @@ msgstr "" " loader.exec_module(module)\n" " return module" -#: ../../whatsnew/3.12.rst:1495 +#: ../../whatsnew/3.12.rst:1503 msgid "Remove :mod:`!imp` functions and attributes with no replacements:" msgstr "移除 :mod:`!imp` 函式和屬性、沒有替代方案:" -#: ../../whatsnew/3.12.rst:1497 +#: ../../whatsnew/3.12.rst:1505 msgid "Undocumented functions:" msgstr "未以文件記錄的函式:" -#: ../../whatsnew/3.12.rst:1499 +#: ../../whatsnew/3.12.rst:1507 msgid "``imp.init_builtin()``" msgstr "``imp.init_builtin()``" -#: ../../whatsnew/3.12.rst:1500 +#: ../../whatsnew/3.12.rst:1508 msgid "``imp.load_compiled()``" msgstr "``imp.load_compiled()``" -#: ../../whatsnew/3.12.rst:1501 +#: ../../whatsnew/3.12.rst:1509 msgid "``imp.load_dynamic()``" msgstr "``imp.load_dynamic()``" -#: ../../whatsnew/3.12.rst:1502 +#: ../../whatsnew/3.12.rst:1510 msgid "``imp.load_package()``" msgstr "``imp.load_package()``" -#: ../../whatsnew/3.12.rst:1504 +#: ../../whatsnew/3.12.rst:1512 msgid "" "``imp.lock_held()``, ``imp.acquire_lock()``, ``imp.release_lock()``: the " "locking scheme has changed in Python 3.3 to per-module locks." msgstr "" -#: ../../whatsnew/3.12.rst:1506 +#: ../../whatsnew/3.12.rst:1514 msgid "" "``imp.find_module()`` constants: ``SEARCH_ERROR``, ``PY_SOURCE``, " "``PY_COMPILED``, ``C_EXTENSION``, ``PY_RESOURCE``, ``PKG_DIRECTORY``, " @@ -3541,86 +3551,91 @@ msgstr "" "``PY_COMPILED``、``C_EXTENSION``、``PY_RESOURCE``、``PKG_DIRECTORY``、" "``C_BUILTIN``、``PY_FROZEN``、``PY_CODERESOURCE``、``IMP_HOOK``。" -#: ../../whatsnew/3.12.rst:1511 +#: ../../whatsnew/3.12.rst:1519 msgid "io" msgstr "io" -#: ../../whatsnew/3.12.rst:1513 +#: ../../whatsnew/3.12.rst:1521 msgid "" "Remove :mod:`io`'s ``io.OpenWrapper`` and ``_pyio.OpenWrapper``, deprecated " -"in Python 3.10: just use :func:`open` instead. The :func:`open` " -"(:func:`io.open`) function is a built-in function. Since Python " -"3.10, :func:`!_pyio.open` is also a static method. (Contributed by Victor " -"Stinner in :gh:`94169`.)" +"in Python 3.10: just use :func:`open` instead. The :func:`open` (:func:`io." +"open`) function is a built-in function. Since Python 3.10, :func:`!_pyio." +"open` is also a static method. (Contributed by Victor Stinner in :gh:" +"`94169`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1520 +#: ../../whatsnew/3.12.rst:1528 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.12.rst:1522 +#: ../../whatsnew/3.12.rst:1530 msgid "" "Remove :mod:`locale`'s :func:`!locale.format` function, deprecated in Python " "3.7: use :func:`locale.format_string` instead. (Contributed by Victor " "Stinner in :gh:`94226`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1527 +#: ../../whatsnew/3.12.rst:1535 msgid "smtpd" msgstr "smtpd" -#: ../../whatsnew/3.12.rst:1529 +#: ../../whatsnew/3.12.rst:1537 msgid "" -"The ``smtpd`` module has been removed according to the schedule " -"in :pep:`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use " -"the :pypi:`aiosmtpd` PyPI module or any other :mod:`asyncio`-based server " -"instead. (Contributed by Oleg Iarygin in :gh:`93243`.)" +"The ``smtpd`` module has been removed according to the schedule in :pep:" +"`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use the :pypi:" +"`aiosmtpd` PyPI module or any other :mod:`asyncio`-based server instead. " +"(Contributed by Oleg Iarygin in :gh:`93243`.)" msgstr "" +"根據 :pep:`594` 的時間表移除 ``smtpd`` 模組,它在 Python 3.4.7 和 3.5.4 中已" +"被棄用。請改用 PyPI 上的 :pypi:`aiosmtpd` 模組或任何其他基於 :mod:`asyncio` " +"的伺服器。" -#: ../../whatsnew/3.12.rst:1538 +#: ../../whatsnew/3.12.rst:1546 msgid "" "The following undocumented :mod:`sqlite3` features, deprecated in Python " "3.10, are now removed:" msgstr "" +"以下未以文件記錄的 :mod:`sqlite3` 功能已在 Python 3.10 中被棄用、現在已被移" +"除:" -#: ../../whatsnew/3.12.rst:1541 +#: ../../whatsnew/3.12.rst:1549 msgid "``sqlite3.enable_shared_cache()``" msgstr "``sqlite3.enable_shared_cache()``" -#: ../../whatsnew/3.12.rst:1542 +#: ../../whatsnew/3.12.rst:1550 msgid "``sqlite3.OptimizedUnicode``" msgstr "``sqlite3.OptimizedUnicode``" -#: ../../whatsnew/3.12.rst:1544 +#: ../../whatsnew/3.12.rst:1552 msgid "" "If a shared cache must be used, open the database in URI mode using the " "``cache=shared`` query parameter." msgstr "" -#: ../../whatsnew/3.12.rst:1547 +#: ../../whatsnew/3.12.rst:1555 msgid "" -"The ``sqlite3.OptimizedUnicode`` text factory has been an alias " -"for :class:`str` since Python 3.3. Code that previously set the text factory " -"to ``OptimizedUnicode`` can either use ``str`` explicitly, or rely on the " +"The ``sqlite3.OptimizedUnicode`` text factory has been an alias for :class:" +"`str` since Python 3.3. Code that previously set the text factory to " +"``OptimizedUnicode`` can either use ``str`` explicitly, or rely on the " "default value which is also ``str``." msgstr "" -#: ../../whatsnew/3.12.rst:1552 +#: ../../whatsnew/3.12.rst:1560 msgid "(Contributed by Erlend E. Aasland in :gh:`92548`.)" msgstr "(由 Erlend E. Aasland 於 :gh:`92548` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1555 +#: ../../whatsnew/3.12.rst:1563 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.12.rst:1557 +#: ../../whatsnew/3.12.rst:1565 msgid "" "Remove :mod:`ssl`'s :func:`!ssl.RAND_pseudo_bytes` function, deprecated in " "Python 3.6: use :func:`os.urandom` or :func:`ssl.RAND_bytes` instead. " "(Contributed by Victor Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1561 +#: ../../whatsnew/3.12.rst:1569 msgid "" "Remove the :func:`!ssl.match_hostname` function. It was deprecated in Python " "3.7. OpenSSL performs hostname matching since Python 3.7, Python no longer " @@ -3628,175 +3643,178 @@ msgid "" "Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1567 +#: ../../whatsnew/3.12.rst:1575 msgid "" "Remove the :func:`!ssl.wrap_socket` function, deprecated in Python 3.7: " -"instead, create a :class:`ssl.SSLContext` object and call " -"its :class:`ssl.SSLContext.wrap_socket` method. Any package that still " -"uses :func:`!ssl.wrap_socket` is broken and insecure. The function neither " -"sends a SNI TLS extension nor validates the server hostname. Code is subject " -"to :cwe:`295` (Improper Certificate Validation). (Contributed by Victor " -"Stinner in :gh:`94199`.)" +"instead, create a :class:`ssl.SSLContext` object and call its :class:`ssl." +"SSLContext.wrap_socket` method. Any package that still uses :func:`!ssl." +"wrap_socket` is broken and insecure. The function neither sends a SNI TLS " +"extension nor validates the server hostname. Code is subject to :cwe:`295` " +"(Improper Certificate Validation). (Contributed by Victor Stinner in :gh:" +"`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1578 +#: ../../whatsnew/3.12.rst:1586 msgid "Remove many long-deprecated :mod:`unittest` features:" msgstr "移除許多 :mod:`unittest` 中被棄用已久的功能:" -#: ../../whatsnew/3.12.rst:1582 +#: ../../whatsnew/3.12.rst:1590 msgid "A number of :class:`~unittest.TestCase` method aliases:" msgstr "許多 :class:`~unittest.TestCase` 方法別名:" -#: ../../whatsnew/3.12.rst:1585 +#: ../../whatsnew/3.12.rst:1593 msgid "Deprecated alias" msgstr "已棄用的別名" -#: ../../whatsnew/3.12.rst:1585 +#: ../../whatsnew/3.12.rst:1593 msgid "Method Name" msgstr "方法名稱" -#: ../../whatsnew/3.12.rst:1585 +#: ../../whatsnew/3.12.rst:1593 msgid "Deprecated in" msgstr "已棄用於" -#: ../../whatsnew/3.12.rst:1587 +#: ../../whatsnew/3.12.rst:1595 msgid "``failUnless``" msgstr "``failUnless``" -#: ../../whatsnew/3.12.rst:1587 ../../whatsnew/3.12.rst:1594 +#: ../../whatsnew/3.12.rst:1595 ../../whatsnew/3.12.rst:1602 msgid ":meth:`.assertTrue`" msgstr ":meth:`.assertTrue`" -#: ../../whatsnew/3.12.rst:1587 ../../whatsnew/3.12.rst:1588 -#: ../../whatsnew/3.12.rst:1589 ../../whatsnew/3.12.rst:1590 -#: ../../whatsnew/3.12.rst:1591 ../../whatsnew/3.12.rst:1592 -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1595 ../../whatsnew/3.12.rst:1596 +#: ../../whatsnew/3.12.rst:1597 ../../whatsnew/3.12.rst:1598 +#: ../../whatsnew/3.12.rst:1599 ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1601 msgid "3.1" msgstr "3.1" -#: ../../whatsnew/3.12.rst:1588 +#: ../../whatsnew/3.12.rst:1596 msgid "``failIf``" msgstr "``failIf``" -#: ../../whatsnew/3.12.rst:1588 +#: ../../whatsnew/3.12.rst:1596 msgid ":meth:`.assertFalse`" msgstr ":meth:`.assertFalse`" -#: ../../whatsnew/3.12.rst:1589 +#: ../../whatsnew/3.12.rst:1597 msgid "``failUnlessEqual``" msgstr "``failUnlessEqual``" -#: ../../whatsnew/3.12.rst:1589 ../../whatsnew/3.12.rst:1595 +#: ../../whatsnew/3.12.rst:1597 ../../whatsnew/3.12.rst:1603 msgid ":meth:`.assertEqual`" msgstr ":meth:`.assertEqual`" -#: ../../whatsnew/3.12.rst:1590 +#: ../../whatsnew/3.12.rst:1598 msgid "``failIfEqual``" msgstr "``failIfEqual``" -#: ../../whatsnew/3.12.rst:1590 ../../whatsnew/3.12.rst:1596 +#: ../../whatsnew/3.12.rst:1598 ../../whatsnew/3.12.rst:1604 msgid ":meth:`.assertNotEqual`" msgstr ":meth:`.assertNotEqual`" -#: ../../whatsnew/3.12.rst:1591 +#: ../../whatsnew/3.12.rst:1599 msgid "``failUnlessAlmostEqual``" msgstr "``failUnlessAlmostEqual``" -#: ../../whatsnew/3.12.rst:1591 ../../whatsnew/3.12.rst:1597 +#: ../../whatsnew/3.12.rst:1599 ../../whatsnew/3.12.rst:1605 msgid ":meth:`.assertAlmostEqual`" msgstr ":meth:`.assertAlmostEqual`" -#: ../../whatsnew/3.12.rst:1592 +#: ../../whatsnew/3.12.rst:1600 msgid "``failIfAlmostEqual``" msgstr "``failIfAlmostEqual``" -#: ../../whatsnew/3.12.rst:1592 ../../whatsnew/3.12.rst:1598 +#: ../../whatsnew/3.12.rst:1600 ../../whatsnew/3.12.rst:1606 msgid ":meth:`.assertNotAlmostEqual`" msgstr ":meth:`.assertNotAlmostEqual`" -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1601 msgid "``failUnlessRaises``" msgstr "``failUnlessRaises``" -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1601 msgid ":meth:`.assertRaises`" msgstr ":meth:`.assertRaises`" -#: ../../whatsnew/3.12.rst:1594 +#: ../../whatsnew/3.12.rst:1602 msgid "``assert_``" msgstr "``assert_``" -#: ../../whatsnew/3.12.rst:1594 ../../whatsnew/3.12.rst:1595 -#: ../../whatsnew/3.12.rst:1596 ../../whatsnew/3.12.rst:1597 -#: ../../whatsnew/3.12.rst:1598 ../../whatsnew/3.12.rst:1599 -#: ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1602 ../../whatsnew/3.12.rst:1603 +#: ../../whatsnew/3.12.rst:1604 ../../whatsnew/3.12.rst:1605 +#: ../../whatsnew/3.12.rst:1606 ../../whatsnew/3.12.rst:1607 +#: ../../whatsnew/3.12.rst:1608 msgid "3.2" msgstr "3.2" -#: ../../whatsnew/3.12.rst:1595 +#: ../../whatsnew/3.12.rst:1603 msgid "``assertEquals``" msgstr "``assertEquals``" -#: ../../whatsnew/3.12.rst:1596 +#: ../../whatsnew/3.12.rst:1604 msgid "``assertNotEquals``" msgstr "``assertNotEquals``" -#: ../../whatsnew/3.12.rst:1597 +#: ../../whatsnew/3.12.rst:1605 msgid "``assertAlmostEquals``" msgstr "``assertAlmostEquals``" -#: ../../whatsnew/3.12.rst:1598 +#: ../../whatsnew/3.12.rst:1606 msgid "``assertNotAlmostEquals``" msgstr "``assertNotAlmostEquals``" -#: ../../whatsnew/3.12.rst:1599 +#: ../../whatsnew/3.12.rst:1607 msgid "``assertRegexpMatches``" msgstr "``assertRegexpMatches``" -#: ../../whatsnew/3.12.rst:1599 +#: ../../whatsnew/3.12.rst:1607 msgid ":meth:`.assertRegex`" msgstr ":meth:`.assertRegex`" -#: ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1608 msgid "``assertRaisesRegexp``" msgstr "``assertRaisesRegexp``" -#: ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1608 msgid ":meth:`.assertRaisesRegex`" msgstr ":meth:`.assertRaisesRegex`" -#: ../../whatsnew/3.12.rst:1601 +#: ../../whatsnew/3.12.rst:1609 msgid "``assertNotRegexpMatches``" msgstr "``assertNotRegexpMatches``" -#: ../../whatsnew/3.12.rst:1601 +#: ../../whatsnew/3.12.rst:1609 msgid ":meth:`.assertNotRegex`" msgstr ":meth:`.assertNotRegex`" -#: ../../whatsnew/3.12.rst:1601 +#: ../../whatsnew/3.12.rst:1609 msgid "3.5" msgstr "3.5" -#: ../../whatsnew/3.12.rst:1604 +#: ../../whatsnew/3.12.rst:1612 msgid "" "You can use https://github.com/isidentical/teyit to automatically modernise " "your unit tests." msgstr "" +"你可以使用 https://github.com/isidentical/teyit 來自動現代化你的單元測試。" -#: ../../whatsnew/3.12.rst:1607 +#: ../../whatsnew/3.12.rst:1615 msgid "" "Undocumented and broken :class:`~unittest.TestCase` method " "``assertDictContainsSubset`` (deprecated in Python 3.2)." msgstr "" +"未以文件記錄且已失效的 :class:`~unittest.TestCase` 方法 " +"``assertDictContainsSubset``\\ (自 Python 3.2 起已棄用)。" -#: ../../whatsnew/3.12.rst:1610 +#: ../../whatsnew/3.12.rst:1618 msgid "" -"Undocumented :meth:`TestLoader.loadTestsFromModule " -"<unittest.TestLoader.loadTestsFromModule>` parameter *use_load_tests* " -"(deprecated and ignored since Python 3.5)." +"Undocumented :meth:`TestLoader.loadTestsFromModule <unittest.TestLoader." +"loadTestsFromModule>` parameter *use_load_tests* (deprecated and ignored " +"since Python 3.5)." msgstr "" -#: ../../whatsnew/3.12.rst:1614 +#: ../../whatsnew/3.12.rst:1622 msgid "" "An alias of the :class:`~unittest.TextTestResult` class: ``_TextTestResult`` " "(deprecated in Python 3.2)." @@ -3804,26 +3822,26 @@ msgstr "" "對 :class:`~unittest.TextTestResult` 類別的別名:``_TextTestResult``\\ (自 " "Python 3.2 起已棄用)。" -#: ../../whatsnew/3.12.rst:1617 +#: ../../whatsnew/3.12.rst:1625 msgid "(Contributed by Serhiy Storchaka in :gh:`89325`.)" msgstr "(由 Serhiy Storchaka 於 :gh:`89325` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1620 +#: ../../whatsnew/3.12.rst:1628 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.12.rst:1622 +#: ../../whatsnew/3.12.rst:1630 msgid "" "Remove support for obsolete browsers from :mod:`webbrowser`. The removed " "browsers include: Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, " "Firebird, and Firefox versions 35 and below (:gh:`102871`)." msgstr "" -#: ../../whatsnew/3.12.rst:1627 +#: ../../whatsnew/3.12.rst:1635 msgid "xml.etree.ElementTree" msgstr "xml.etree.ElementTree" -#: ../../whatsnew/3.12.rst:1629 +#: ../../whatsnew/3.12.rst:1637 msgid "" "Remove the ``ElementTree.Element.copy()`` method of the pure Python " "implementation, deprecated in Python 3.10, use the :func:`copy.copy` " @@ -3832,41 +3850,40 @@ msgid "" "Stinner in :gh:`94383`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1636 +#: ../../whatsnew/3.12.rst:1644 msgid "zipimport" msgstr "zipimport" -#: ../../whatsnew/3.12.rst:1638 +#: ../../whatsnew/3.12.rst:1646 msgid "" "Remove :mod:`zipimport`'s ``find_loader()`` and ``find_module()`` methods, " -"deprecated in Python 3.10: use the ``find_spec()`` method instead. " -"See :pep:`451` for the rationale. (Contributed by Victor Stinner " -"in :gh:`94379`.)" +"deprecated in Python 3.10: use the ``find_spec()`` method instead. See :pep:" +"`451` for the rationale. (Contributed by Victor Stinner in :gh:`94379`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1644 +#: ../../whatsnew/3.12.rst:1652 msgid "Others" msgstr "其他" -#: ../../whatsnew/3.12.rst:1646 +#: ../../whatsnew/3.12.rst:1654 msgid "" -"Remove the ``suspicious`` rule from the documentation :file:`Makefile` " -"and :file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint <https://" -"github.com/sphinx-contrib/sphinx-lint>`_. (Contributed by Julien Palard " -"in :gh:`98179`.)" +"Remove the ``suspicious`` rule from the documentation :file:`Makefile` and :" +"file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint <https://github." +"com/sphinx-contrib/sphinx-lint>`_. (Contributed by Julien Palard in :gh:" +"`98179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1651 +#: ../../whatsnew/3.12.rst:1659 msgid "" -"Remove the *keyfile* and *certfile* parameters from " -"the :mod:`ftplib`, :mod:`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, " -"and the *key_file*, *cert_file* and *check_hostname* parameters from " -"the :mod:`http.client` module, all deprecated since Python 3.6. Use the " -"*context* parameter (*ssl_context* in :mod:`imaplib`) instead. (Contributed " -"by Victor Stinner in :gh:`94172`.)" +"Remove the *keyfile* and *certfile* parameters from the :mod:`ftplib`, :mod:" +"`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, and the *key_file*, " +"*cert_file* and *check_hostname* parameters from the :mod:`http.client` " +"module, all deprecated since Python 3.6. Use the *context* parameter " +"(*ssl_context* in :mod:`imaplib`) instead. (Contributed by Victor Stinner " +"in :gh:`94172`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1659 +#: ../../whatsnew/3.12.rst:1667 msgid "" "Remove ``Jython`` compatibility hacks from several stdlib modules and tests. " "(Contributed by Nikita Sobolev in :gh:`99482`.)" @@ -3874,29 +3891,29 @@ msgstr "" "移除數個標準函式庫模組與測試中的 ``Jython`` 相容性修補程式。(由 Nikita " "Sobolev 於 :gh:`99482` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1662 +#: ../../whatsnew/3.12.rst:1670 msgid "" -"Remove ``_use_broken_old_ctypes_structure_semantics_`` flag " -"from :mod:`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" +"Remove ``_use_broken_old_ctypes_structure_semantics_`` flag from :mod:" +"`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" msgstr "" "移除 :mod:`ctypes` 模組中的 ``_use_broken_old_ctypes_structure_semantics_`` " "旗標。(由 Nikita Sobolev 於 :gh:`99285` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1670 ../../whatsnew/3.12.rst:1994 +#: ../../whatsnew/3.12.rst:1678 ../../whatsnew/3.12.rst:2002 msgid "Porting to Python 3.12" msgstr "移植至 Python 3.12" -#: ../../whatsnew/3.12.rst:1672 +#: ../../whatsnew/3.12.rst:1680 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.12.rst:1676 +#: ../../whatsnew/3.12.rst:1684 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.12.rst:1678 +#: ../../whatsnew/3.12.rst:1686 msgid "" "More strict rules are now applied for numerical group references and group " "names in regular expressions. Only sequence of ASCII digits is now accepted " @@ -3905,7 +3922,7 @@ msgid "" "(Contributed by Serhiy Storchaka in :gh:`91760`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1685 +#: ../../whatsnew/3.12.rst:1693 msgid "" "Remove ``randrange()`` functionality deprecated since Python 3.10. " "Formerly, ``randrange(10.0)`` losslessly converted to ``randrange(10)``. " @@ -3913,11 +3930,11 @@ msgid "" "integer values such as ``randrange(10.5)`` or ``randrange('10')`` has been " "changed from :exc:`ValueError` to :exc:`TypeError`. This also prevents bugs " "where ``randrange(1e25)`` would silently select from a larger range than " -"``randrange(10**25)``. (Originally suggested by Serhiy " -"Storchaka :gh:`86388`.)" +"``randrange(10**25)``. (Originally suggested by Serhiy Storchaka :gh:" +"`86388`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1693 +#: ../../whatsnew/3.12.rst:1701 msgid "" ":class:`argparse.ArgumentParser` changed encoding and error handler for " "reading arguments from file (e.g. ``fromfile_prefix_chars`` option) from " @@ -3927,29 +3944,29 @@ msgid "" "on Windows." msgstr "" -#: ../../whatsnew/3.12.rst:1699 +#: ../../whatsnew/3.12.rst:1707 msgid "" "Remove the ``asyncore``-based ``smtpd`` module deprecated in Python 3.4.7 " -"and 3.5.4. A recommended replacement is the :mod:`asyncio`-" -"based :pypi:`aiosmtpd` PyPI module." +"and 3.5.4. A recommended replacement is the :mod:`asyncio`-based :pypi:" +"`aiosmtpd` PyPI module." msgstr "" -#: ../../whatsnew/3.12.rst:1703 +#: ../../whatsnew/3.12.rst:1711 msgid "" ":func:`shlex.split`: Passing ``None`` for *s* argument now raises an " "exception, rather than reading :data:`sys.stdin`. The feature was deprecated " "in Python 3.9. (Contributed by Victor Stinner in :gh:`94352`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1708 +#: ../../whatsnew/3.12.rst:1716 msgid "" -"The :mod:`os` module no longer accepts bytes-like paths, " -"like :class:`bytearray` and :class:`memoryview` types: only the " -"exact :class:`bytes` type is accepted for bytes strings. (Contributed by " -"Victor Stinner in :gh:`98393`.)" +"The :mod:`os` module no longer accepts bytes-like paths, like :class:" +"`bytearray` and :class:`memoryview` types: only the exact :class:`bytes` " +"type is accepted for bytes strings. (Contributed by Victor Stinner in :gh:" +"`98393`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1713 +#: ../../whatsnew/3.12.rst:1721 msgid "" ":func:`syslog.openlog` and :func:`syslog.closelog` now fail if used in " "subinterpreters. :func:`syslog.syslog` may still be used in subinterpreters, " @@ -3961,7 +3978,7 @@ msgid "" "(Contributed by Donghee Na in :gh:`99127`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1722 +#: ../../whatsnew/3.12.rst:1730 msgid "" "The undocumented locking behavior of :func:`~functools.cached_property` is " "removed, because it locked across all instances of the class, leading to " @@ -3973,36 +3990,34 @@ msgid "" "property getter function or around multi-threaded access points." msgstr "" -#: ../../whatsnew/3.12.rst:1735 +#: ../../whatsnew/3.12.rst:1743 msgid "" -"When extracting tar files using :mod:`tarfile` " -"or :func:`shutil.unpack_archive`, pass the *filter* argument to limit " -"features that may be surprising or dangerous. See :ref:`tarfile-extraction-" -"filter` for details." +"When extracting tar files using :mod:`tarfile` or :func:`shutil." +"unpack_archive`, pass the *filter* argument to limit features that may be " +"surprising or dangerous. See :ref:`tarfile-extraction-filter` for details." msgstr "" -#: ../../whatsnew/3.12.rst:1740 +#: ../../whatsnew/3.12.rst:1748 msgid "" -"The output of the :func:`tokenize.tokenize` " -"and :func:`tokenize.generate_tokens` functions is now changed due to the " -"changes introduced in :pep:`701`. This means that ``STRING`` tokens are not " -"emitted any more for f-strings and the tokens described in :pep:`701` are " -"now produced instead: ``FSTRING_START``, ``FSTRING_MIDDLE`` and " -"``FSTRING_END`` are now emitted for f-string \"string\" parts in addition to " -"the appropriate tokens for the tokenization in the expression components. " -"For example for the f-string ``f\"start {1+1} end\"`` the old version of the " -"tokenizer emitted::" +"The output of the :func:`tokenize.tokenize` and :func:`tokenize." +"generate_tokens` functions is now changed due to the changes introduced in :" +"pep:`701`. This means that ``STRING`` tokens are not emitted any more for f-" +"strings and the tokens described in :pep:`701` are now produced instead: " +"``FSTRING_START``, ``FSTRING_MIDDLE`` and ``FSTRING_END`` are now emitted " +"for f-string \"string\" parts in addition to the appropriate tokens for the " +"tokenization in the expression components. For example for the f-string " +"``f\"start {1+1} end\"`` the old version of the tokenizer emitted::" msgstr "" -#: ../../whatsnew/3.12.rst:1749 +#: ../../whatsnew/3.12.rst:1757 msgid "1,0-1,18: STRING 'f\"start {1+1} end\"'" msgstr "1,0-1,18: STRING 'f\"start {1+1} end\"'" -#: ../../whatsnew/3.12.rst:1751 +#: ../../whatsnew/3.12.rst:1759 msgid "while the new version emits::" msgstr "" -#: ../../whatsnew/3.12.rst:1753 +#: ../../whatsnew/3.12.rst:1761 msgid "" "1,0-1,2: FSTRING_START 'f\"'\n" "1,2-1,8: FSTRING_MIDDLE 'start '\n" @@ -4024,54 +4039,54 @@ msgstr "" "1,13-1,17: FSTRING_MIDDLE ' end'\n" "1,17-1,18: FSTRING_END '\"'" -#: ../../whatsnew/3.12.rst:1763 +#: ../../whatsnew/3.12.rst:1771 msgid "" "Additionally, there may be some minor behavioral changes as a consequence of " "the changes required to support :pep:`701`. Some of these changes include:" msgstr "" -#: ../../whatsnew/3.12.rst:1766 +#: ../../whatsnew/3.12.rst:1774 msgid "" "The ``type`` attribute of the tokens emitted when tokenizing some invalid " "Python characters such as ``!`` has changed from ``ERRORTOKEN`` to ``OP``." msgstr "" -#: ../../whatsnew/3.12.rst:1769 +#: ../../whatsnew/3.12.rst:1777 msgid "" "Incomplete single-line strings now also raise :exc:`tokenize.TokenError` as " "incomplete multiline strings do." msgstr "" -#: ../../whatsnew/3.12.rst:1772 +#: ../../whatsnew/3.12.rst:1780 msgid "" "Some incomplete or invalid Python code now raises :exc:`tokenize.TokenError` " "instead of returning arbitrary ``ERRORTOKEN`` tokens when tokenizing it." msgstr "" -#: ../../whatsnew/3.12.rst:1775 +#: ../../whatsnew/3.12.rst:1783 msgid "" "Mixing tabs and spaces as indentation in the same file is not supported " "anymore and will raise a :exc:`TabError`." msgstr "" -#: ../../whatsnew/3.12.rst:1778 +#: ../../whatsnew/3.12.rst:1786 msgid "" "The :mod:`threading` module now expects the :mod:`!_thread` module to have " "an ``_is_main_interpreter`` attribute. It is a function with no arguments " "that returns ``True`` if the current interpreter is the main interpreter." msgstr "" -#: ../../whatsnew/3.12.rst:1783 +#: ../../whatsnew/3.12.rst:1791 msgid "" "Any library or application that provides a custom ``_thread`` module should " "provide ``_is_main_interpreter()``. (See :gh:`112826`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1788 +#: ../../whatsnew/3.12.rst:1796 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.12.rst:1790 +#: ../../whatsnew/3.12.rst:1798 msgid "" "Python no longer uses :file:`setup.py` to build shared C extension modules. " "Build parameters like headers and libraries are detected in ``configure`` " @@ -4080,69 +4095,69 @@ msgid "" "in :gh:`93939`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1796 +#: ../../whatsnew/3.12.rst:1804 msgid "" "``va_start()`` with two parameters, like ``va_start(args, format),`` is now " "required to build Python. ``va_start()`` is no longer called with a single " "parameter. (Contributed by Kumar Aditya in :gh:`93207`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1801 +#: ../../whatsnew/3.12.rst:1809 msgid "" "CPython now uses the ThinLTO option as the default link time optimization " "policy if the Clang compiler accepts the flag. (Contributed by Donghee Na " "in :gh:`89536`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1805 +#: ../../whatsnew/3.12.rst:1813 msgid "" -"Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to " -"override :mod:`compileall` options (default: ``-j0``) in ``make install``. " -"Also merged the 3 ``compileall`` commands into a single command to " -"build .pyc files for all optimization levels (0, 1, 2) at once. (Contributed " -"by Victor Stinner in :gh:`99289`.)" +"Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to override :mod:" +"`compileall` options (default: ``-j0``) in ``make install``. Also merged the " +"3 ``compileall`` commands into a single command to build .pyc files for all " +"optimization levels (0, 1, 2) at once. (Contributed by Victor Stinner in :gh:" +"`99289`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1811 +#: ../../whatsnew/3.12.rst:1819 msgid "Add platform triplets for 64-bit LoongArch:" msgstr "" -#: ../../whatsnew/3.12.rst:1813 +#: ../../whatsnew/3.12.rst:1821 msgid "loongarch64-linux-gnusf" msgstr "loongarch64-linux-gnusf" -#: ../../whatsnew/3.12.rst:1814 +#: ../../whatsnew/3.12.rst:1822 msgid "loongarch64-linux-gnuf32" msgstr "loongarch64-linux-gnuf32" -#: ../../whatsnew/3.12.rst:1815 +#: ../../whatsnew/3.12.rst:1823 msgid "loongarch64-linux-gnu" msgstr "loongarch64-linux-gnu" -#: ../../whatsnew/3.12.rst:1817 +#: ../../whatsnew/3.12.rst:1825 msgid "(Contributed by Zhang Na in :gh:`90656`.)" msgstr "(由 Zhang Na 於 :gh:`90656` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1819 +#: ../../whatsnew/3.12.rst:1827 msgid "``PYTHON_FOR_REGEN`` now require Python 3.10 or newer." msgstr "``PYTHON_FOR_REGEN`` 現在需要 Python 3.10 或更新的版本。" -#: ../../whatsnew/3.12.rst:1821 +#: ../../whatsnew/3.12.rst:1829 msgid "" "Autoconf 2.71 and aclocal 1.16.4 is now required to regenerate :file:`!" "configure`. (Contributed by Christian Heimes in :gh:`89886`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1825 +#: ../../whatsnew/3.12.rst:1833 msgid "" "Windows builds and macOS installers from python.org now use OpenSSL 3.0." msgstr "" -#: ../../whatsnew/3.12.rst:1829 +#: ../../whatsnew/3.12.rst:1837 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.12.rst:1836 +#: ../../whatsnew/3.12.rst:1844 msgid "" ":pep:`697`: Introduce the :ref:`Unstable C API tier <unstable-c-api>`, " "intended for low-level tools like debuggers and JIT compilers. This API may " @@ -4150,15 +4165,15 @@ msgid "" "contents are marked by the ``PyUnstable_`` prefix in names." msgstr "" -#: ../../whatsnew/3.12.rst:1842 +#: ../../whatsnew/3.12.rst:1850 msgid "Code object constructors:" msgstr "程式碼物件建構函式:" -#: ../../whatsnew/3.12.rst:1844 +#: ../../whatsnew/3.12.rst:1852 msgid "``PyUnstable_Code_New()`` (renamed from ``PyCode_New``)" msgstr "``PyUnstable_Code_New()``\\ (自 ``PyCode_New`` 重新命名)" -#: ../../whatsnew/3.12.rst:1845 +#: ../../whatsnew/3.12.rst:1853 msgid "" "``PyUnstable_Code_NewWithPosOnlyArgs()`` (renamed from " "``PyCode_NewWithPosOnlyArgs``)" @@ -4166,11 +4181,11 @@ msgstr "" "``PyUnstable_Code_NewWithPosOnlyArgs()``\\ (自 " "``PyCode_NewWithPosOnlyArgs`` 重新命名)" -#: ../../whatsnew/3.12.rst:1847 +#: ../../whatsnew/3.12.rst:1855 msgid "Extra storage for code objects (:pep:`523`):" msgstr "程式碼物件的額外儲存 (:pep:`523`):" -#: ../../whatsnew/3.12.rst:1849 +#: ../../whatsnew/3.12.rst:1857 msgid "" "``PyUnstable_Eval_RequestCodeExtraIndex()`` (renamed from " "``_PyEval_RequestCodeExtraIndex``)" @@ -4178,31 +4193,31 @@ msgstr "" "``PyUnstable_Eval_RequestCodeExtraIndex()``\\ (自 " "``_PyEval_RequestCodeExtraIndex`` 重新命名)" -#: ../../whatsnew/3.12.rst:1850 +#: ../../whatsnew/3.12.rst:1858 msgid "``PyUnstable_Code_GetExtra()`` (renamed from ``_PyCode_GetExtra``)" msgstr "``PyUnstable_Code_GetExtra()``\\ (自 ``_PyCode_GetExtra`` 重新命名)" -#: ../../whatsnew/3.12.rst:1851 +#: ../../whatsnew/3.12.rst:1859 msgid "``PyUnstable_Code_SetExtra()`` (renamed from ``_PyCode_SetExtra``)" msgstr "``PyUnstable_Code_SetExtra()``\\ (自 ``_PyCode_SetExtra`` 重新命名)" -#: ../../whatsnew/3.12.rst:1853 +#: ../../whatsnew/3.12.rst:1861 msgid "" "The original names will continue to be available until the respective API " "changes." msgstr "原始名稱將可繼續使用,直到相應的 API 發生變更。" -#: ../../whatsnew/3.12.rst:1856 +#: ../../whatsnew/3.12.rst:1864 msgid "(Contributed by Petr Viktorin in :gh:`101101`.)" msgstr "(由 Petr Viktorin 於 :gh:`101101` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1858 +#: ../../whatsnew/3.12.rst:1866 msgid "" ":pep:`697`: Add an API for extending types whose instance memory layout is " "opaque:" msgstr "" -#: ../../whatsnew/3.12.rst:1861 +#: ../../whatsnew/3.12.rst:1869 msgid "" ":c:member:`PyType_Spec.basicsize` can be zero or negative to specify " "inheriting or extending the base class size." @@ -4210,267 +4225,266 @@ msgstr "" ":c:member:`PyType_Spec.basicsize` 可以為零或負數來指定繼承或擴充基底類別大" "小。" -#: ../../whatsnew/3.12.rst:1863 +#: ../../whatsnew/3.12.rst:1871 msgid "" ":c:func:`PyObject_GetTypeData` and :c:func:`PyType_GetTypeDataSize` added to " "allow access to subclass-specific instance data." msgstr "" -#: ../../whatsnew/3.12.rst:1865 +#: ../../whatsnew/3.12.rst:1873 msgid "" ":c:macro:`Py_TPFLAGS_ITEMS_AT_END` and :c:func:`PyObject_GetItemData` added " -"to allow safely extending certain variable-sized types, " -"including :c:var:`PyType_Type`." +"to allow safely extending certain variable-sized types, including :c:var:" +"`PyType_Type`." msgstr "" -#: ../../whatsnew/3.12.rst:1868 +#: ../../whatsnew/3.12.rst:1876 msgid "" ":c:macro:`Py_RELATIVE_OFFSET` added to allow defining :c:type:`members " "<PyMemberDef>` in terms of a subclass-specific struct." msgstr "" -#: ../../whatsnew/3.12.rst:1871 +#: ../../whatsnew/3.12.rst:1879 msgid "(Contributed by Petr Viktorin in :gh:`103509`.)" msgstr "(由 Petr Viktorin 於 :gh:`103509` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1873 +#: ../../whatsnew/3.12.rst:1881 msgid "" -"Add the new :ref:`limited C API <limited-c-api>` " -"function :c:func:`PyType_FromMetaclass`, which generalizes the " -"existing :c:func:`PyType_FromModuleAndSpec` using an additional metaclass " -"argument. (Contributed by Wenzel Jakob in :gh:`93012`.)" +"Add the new :ref:`limited C API <limited-c-api>` function :c:func:" +"`PyType_FromMetaclass`, which generalizes the existing :c:func:" +"`PyType_FromModuleAndSpec` using an additional metaclass argument. " +"(Contributed by Wenzel Jakob in :gh:`93012`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1878 +#: ../../whatsnew/3.12.rst:1886 msgid "" "API for creating objects that can be called using :ref:`the vectorcall " "protocol <vectorcall>` was added to the :ref:`Limited API <stable>`:" msgstr "" -#: ../../whatsnew/3.12.rst:1882 +#: ../../whatsnew/3.12.rst:1890 msgid ":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`" msgstr ":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`" -#: ../../whatsnew/3.12.rst:1883 +#: ../../whatsnew/3.12.rst:1891 msgid ":c:func:`PyVectorcall_NARGS`" msgstr ":c:func:`PyVectorcall_NARGS`" -#: ../../whatsnew/3.12.rst:1884 +#: ../../whatsnew/3.12.rst:1892 msgid ":c:func:`PyVectorcall_Call`" msgstr ":c:func:`PyVectorcall_Call`" -#: ../../whatsnew/3.12.rst:1885 +#: ../../whatsnew/3.12.rst:1893 msgid ":c:type:`vectorcallfunc`" msgstr ":c:type:`vectorcallfunc`" -#: ../../whatsnew/3.12.rst:1887 +#: ../../whatsnew/3.12.rst:1895 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class " "when the class's :py:meth:`~object.__call__` method is reassigned. This " "makes vectorcall safe to use with mutable types (i.e. heap types without the " "immutable flag, :c:macro:`Py_TPFLAGS_IMMUTABLETYPE`). Mutable types that do " "not override :c:member:`~PyTypeObject.tp_call` now inherit the " -"``Py_TPFLAGS_HAVE_VECTORCALL`` flag. (Contributed by Petr Viktorin " -"in :gh:`93274`.)" +"``Py_TPFLAGS_HAVE_VECTORCALL`` flag. (Contributed by Petr Viktorin in :gh:" +"`93274`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1895 +#: ../../whatsnew/3.12.rst:1903 msgid "" -"The :c:macro:`Py_TPFLAGS_MANAGED_DICT` " -"and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows " -"extensions classes to support object :attr:`~object.__dict__` and weakrefs " -"with less bookkeeping, using less memory and with faster access." +"The :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" +"`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows extensions " +"classes to support object :attr:`~object.__dict__` and weakrefs with less " +"bookkeeping, using less memory and with faster access." msgstr "" -#: ../../whatsnew/3.12.rst:1900 +#: ../../whatsnew/3.12.rst:1908 msgid "" "API for performing calls using :ref:`the vectorcall protocol <vectorcall>` " "was added to the :ref:`Limited API <stable>`:" msgstr "" -#: ../../whatsnew/3.12.rst:1904 +#: ../../whatsnew/3.12.rst:1912 msgid ":c:func:`PyObject_Vectorcall`" msgstr ":c:func:`PyObject_Vectorcall`" -#: ../../whatsnew/3.12.rst:1905 +#: ../../whatsnew/3.12.rst:1913 msgid ":c:func:`PyObject_VectorcallMethod`" msgstr ":c:func:`PyObject_VectorcallMethod`" -#: ../../whatsnew/3.12.rst:1906 +#: ../../whatsnew/3.12.rst:1914 msgid ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`" msgstr ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`" -#: ../../whatsnew/3.12.rst:1908 +#: ../../whatsnew/3.12.rst:1916 msgid "" "This means that both the incoming and outgoing ends of the vector call " "protocol are now available in the :ref:`Limited API <stable>`. (Contributed " "by Wenzel Jakob in :gh:`98586`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1912 +#: ../../whatsnew/3.12.rst:1920 msgid "" -"Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` " -"and :c:func:`PyEval_SetTraceAllThreads`, that allow to set tracing and " -"profiling functions in all running threads in addition to the calling one. " +"Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` and :c:" +"func:`PyEval_SetTraceAllThreads`, that allow to set tracing and profiling " +"functions in all running threads in addition to the calling one. " "(Contributed by Pablo Galindo in :gh:`93503`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1918 +#: ../../whatsnew/3.12.rst:1926 msgid "" "Add new function :c:func:`PyFunction_SetVectorcall` to the C API which sets " "the vectorcall field of a given :c:type:`PyFunctionObject`. (Contributed by " "Andrew Frost in :gh:`92257`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1922 +#: ../../whatsnew/3.12.rst:1930 msgid "" -"The C API now permits registering callbacks " -"via :c:func:`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to " -"be called whenever a dictionary is modified. This is intended for use by " -"optimizing interpreters, JIT compilers, or debuggers. (Contributed by Carl " -"Meyer in :gh:`91052`.)" +"The C API now permits registering callbacks via :c:func:" +"`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to be called " +"whenever a dictionary is modified. This is intended for use by optimizing " +"interpreters, JIT compilers, or debuggers. (Contributed by Carl Meyer in :gh:" +"`91052`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1928 +#: ../../whatsnew/3.12.rst:1936 msgid "" "Add :c:func:`PyType_AddWatcher` and :c:func:`PyType_Watch` API to register " "callbacks to receive notification on changes to a type. (Contributed by Carl " "Meyer in :gh:`91051`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1932 +#: ../../whatsnew/3.12.rst:1940 msgid "" "Add :c:func:`PyCode_AddWatcher` and :c:func:`PyCode_ClearWatcher` APIs to " "register callbacks to receive notification on creation and destruction of " "code objects. (Contributed by Itamar Oren in :gh:`91054`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1937 +#: ../../whatsnew/3.12.rst:1945 msgid "" "Add :c:func:`PyFrame_GetVar` and :c:func:`PyFrame_GetVarString` functions to " -"get a frame variable by its name. (Contributed by Victor Stinner " -"in :gh:`91248`.)" +"get a frame variable by its name. (Contributed by Victor Stinner in :gh:" +"`91248`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1941 +#: ../../whatsnew/3.12.rst:1949 msgid "" -"Add :c:func:`PyErr_GetRaisedException` " -"and :c:func:`PyErr_SetRaisedException` for saving and restoring the current " -"exception. These functions return and accept a single exception object, " -"rather than the triple arguments of the now-deprecated :c:func:`PyErr_Fetch` " -"and :c:func:`PyErr_Restore`. This is less error prone and a bit more " -"efficient. (Contributed by Mark Shannon in :gh:`101578`.)" +"Add :c:func:`PyErr_GetRaisedException` and :c:func:" +"`PyErr_SetRaisedException` for saving and restoring the current exception. " +"These functions return and accept a single exception object, rather than the " +"triple arguments of the now-deprecated :c:func:`PyErr_Fetch` and :c:func:" +"`PyErr_Restore`. This is less error prone and a bit more efficient. " +"(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1949 +#: ../../whatsnew/3.12.rst:1957 msgid "" "Add ``_PyErr_ChainExceptions1``, which takes an exception instance, to " "replace the legacy-API ``_PyErr_ChainExceptions``, which is now deprecated. " "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1953 +#: ../../whatsnew/3.12.rst:1961 msgid "" "Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs` as " -"convenience functions for retrieving and modifying " -"the :attr:`~BaseException.args` passed to the exception's constructor. " -"(Contributed by Mark Shannon in :gh:`101578`.)" +"convenience functions for retrieving and modifying the :attr:`~BaseException." +"args` passed to the exception's constructor. (Contributed by Mark Shannon " +"in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1958 +#: ../../whatsnew/3.12.rst:1966 msgid "" "Add :c:func:`PyErr_DisplayException`, which takes an exception instance, to " "replace the legacy-api :c:func:`!PyErr_Display`. (Contributed by Irit " "Katriel in :gh:`102755`)." msgstr "" -#: ../../whatsnew/3.12.rst:1964 +#: ../../whatsnew/3.12.rst:1972 msgid "" ":pep:`683`: Introduce *Immortal Objects*, which allows objects to bypass " "reference counts, and related changes to the C-API:" msgstr "" -#: ../../whatsnew/3.12.rst:1967 +#: ../../whatsnew/3.12.rst:1975 msgid "``_Py_IMMORTAL_REFCNT``: The reference count that defines an object" msgstr "``_Py_IMMORTAL_REFCNT``:定義物件的參照計數" -#: ../../whatsnew/3.12.rst:1968 +#: ../../whatsnew/3.12.rst:1976 msgid "as immortal." msgstr "" -#: ../../whatsnew/3.12.rst:1969 +#: ../../whatsnew/3.12.rst:1977 msgid "" "``_Py_IsImmortal`` Checks if an object has the immortal reference count." msgstr "" -#: ../../whatsnew/3.12.rst:1970 +#: ../../whatsnew/3.12.rst:1978 msgid "``PyObject_HEAD_INIT`` This will now initialize reference count to" msgstr "``PyObject_HEAD_INIT`` 這現在將初始化參照計數" -#: ../../whatsnew/3.12.rst:1971 +#: ../../whatsnew/3.12.rst:1979 msgid "``_Py_IMMORTAL_REFCNT`` when used with ``Py_BUILD_CORE``." msgstr "``_Py_IMMORTAL_REFCNT``\\ (與 ``Py_BUILD_CORE`` 一起使用時)。" -#: ../../whatsnew/3.12.rst:1972 +#: ../../whatsnew/3.12.rst:1980 msgid "``SSTATE_INTERNED_IMMORTAL`` An identifier for interned unicode objects" msgstr "" -#: ../../whatsnew/3.12.rst:1973 +#: ../../whatsnew/3.12.rst:1981 msgid "that are immortal." msgstr "" -#: ../../whatsnew/3.12.rst:1974 +#: ../../whatsnew/3.12.rst:1982 msgid "``SSTATE_INTERNED_IMMORTAL_STATIC`` An identifier for interned unicode" msgstr "" -#: ../../whatsnew/3.12.rst:1975 +#: ../../whatsnew/3.12.rst:1983 msgid "objects that are immortal and static" msgstr "" -#: ../../whatsnew/3.12.rst:1976 +#: ../../whatsnew/3.12.rst:1984 msgid "``sys.getunicodeinternedsize`` This returns the total number of unicode" msgstr "``sys.getunicodeinternedsize`` 這會回傳 unicode 的總數" -#: ../../whatsnew/3.12.rst:1977 +#: ../../whatsnew/3.12.rst:1985 msgid "" "objects that have been interned. This is now needed for :file:`refleak.py` " "to correctly track reference counts and allocated blocks" msgstr "" -#: ../../whatsnew/3.12.rst:1980 +#: ../../whatsnew/3.12.rst:1988 msgid "(Contributed by Eddie Elizondo in :gh:`84436`.)" msgstr "(由 Eddie Elizondo 於 :gh:`84436` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1982 +#: ../../whatsnew/3.12.rst:1990 msgid "" -":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function " -"and :c:type:`PyInterpreterConfig`, which may be used to create sub-" -"interpreters with their own GILs. (See :ref:`whatsnew312-pep684` for more " -"info.) (Contributed by Eric Snow in :gh:`104110`.)" +":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function and :" +"c:type:`PyInterpreterConfig`, which may be used to create sub-interpreters " +"with their own GILs. (See :ref:`whatsnew312-pep684` for more info.) " +"(Contributed by Eric Snow in :gh:`104110`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1988 +#: ../../whatsnew/3.12.rst:1996 msgid "" -"In the limited C API version 3.12, :c:func:`Py_INCREF` " -"and :c:func:`Py_DECREF` functions are now implemented as opaque function " -"calls to hide implementation details. (Contributed by Victor Stinner " -"in :gh:`105387`.)" +"In the limited C API version 3.12, :c:func:`Py_INCREF` and :c:func:" +"`Py_DECREF` functions are now implemented as opaque function calls to hide " +"implementation details. (Contributed by Victor Stinner in :gh:`105387`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1996 +#: ../../whatsnew/3.12.rst:2004 msgid "" "Legacy Unicode APIs based on ``Py_UNICODE*`` representation has been " "removed. Please migrate to APIs based on UTF-8 or ``wchar_t*``." msgstr "" -#: ../../whatsnew/3.12.rst:1999 +#: ../../whatsnew/3.12.rst:2007 msgid "" "Argument parsing functions like :c:func:`PyArg_ParseTuple` doesn't support " "``Py_UNICODE*`` based format (e.g. ``u``, ``Z``) anymore. Please migrate to " "other formats for Unicode like ``s``, ``z``, ``es``, and ``U``." msgstr "" -#: ../../whatsnew/3.12.rst:2003 +#: ../../whatsnew/3.12.rst:2011 msgid "" "``tp_weaklist`` for all static builtin types is always ``NULL``. This is an " "internal-only field on ``PyTypeObject`` but we're pointing out the change in " @@ -4479,7 +4493,7 @@ msgid "" "necessary, the (internal-only) ``_PyObject_GET_WEAKREFS_LISTPTR()`` macro." msgstr "" -#: ../../whatsnew/3.12.rst:2010 +#: ../../whatsnew/3.12.rst:2018 msgid "" "This internal-only :c:member:`PyTypeObject.tp_subclasses` may now not be a " "valid object pointer. Its type was changed to :c:expr:`void *` to reflect " @@ -4487,53 +4501,51 @@ msgid "" "only field directly." msgstr "" -#: ../../whatsnew/3.12.rst:2015 +#: ../../whatsnew/3.12.rst:2023 msgid "" -"To get a list of subclasses, call the Python " -"method :py:meth:`~type.__subclasses__` (using :c:func:`PyObject_CallMethod`, " -"for example)." +"To get a list of subclasses, call the Python method :py:meth:`~type." +"__subclasses__` (using :c:func:`PyObject_CallMethod`, for example)." msgstr "" -#: ../../whatsnew/3.12.rst:2019 +#: ../../whatsnew/3.12.rst:2027 msgid "" "Add support of more formatting options (left aligning, octals, uppercase " "hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C " "strings, variable width and precision) in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Serhiy Storchaka " -"in :gh:`98836`.)" +"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Serhiy Storchaka in :gh:" +"`98836`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2025 +#: ../../whatsnew/3.12.rst:2033 msgid "" -"An unrecognized format character in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In " -"previous versions it caused all the rest of the format string to be copied " -"as-is to the result string, and any extra arguments discarded. (Contributed " -"by Serhiy Storchaka in :gh:`95781`.)" +"An unrecognized format character in :c:func:`PyUnicode_FromFormat` and :c:" +"func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In previous " +"versions it caused all the rest of the format string to be copied as-is to " +"the result string, and any extra arguments discarded. (Contributed by Serhiy " +"Storchaka in :gh:`95781`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2031 +#: ../../whatsnew/3.12.rst:2039 msgid "" -"Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Philip Georgi " -"in :gh:`95504`.)" +"Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` and :c:func:" +"`PyUnicode_FromFormatV`. (Contributed by Philip Georgi in :gh:`95504`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2035 +#: ../../whatsnew/3.12.rst:2043 msgid "" "Extension classes wanting to add a :attr:`~object.__dict__` or weak " -"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` " -"and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " +"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" +"`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " "``tp_weaklistoffset``, respectively. The use of ``tp_dictoffset`` and " "``tp_weaklistoffset`` is still supported, but does not fully support " "multiple inheritance (:gh:`95589`), and performance may be worse. Classes " "declaring :c:macro:`Py_TPFLAGS_MANAGED_DICT` must call :c:func:`!" "_PyObject_VisitManagedDict` and :c:func:`!_PyObject_ClearManagedDict` to " -"traverse and clear their instance's dictionaries. To clear weakrefs, " -"call :c:func:`PyObject_ClearWeakRefs`, as before." +"traverse and clear their instance's dictionaries. To clear weakrefs, call :c:" +"func:`PyObject_ClearWeakRefs`, as before." msgstr "" -#: ../../whatsnew/3.12.rst:2047 +#: ../../whatsnew/3.12.rst:2055 msgid "" "The :c:func:`PyUnicode_FSDecoder` function no longer accepts bytes-like " "paths, like :class:`bytearray` and :class:`memoryview` types: only the " @@ -4541,7 +4553,7 @@ msgid "" "Victor Stinner in :gh:`98393`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2052 +#: ../../whatsnew/3.12.rst:2060 msgid "" "The :c:macro:`Py_CLEAR`, :c:macro:`Py_SETREF` and :c:macro:`Py_XSETREF` " "macros now only evaluate their arguments once. If an argument has side " @@ -4549,15 +4561,15 @@ msgid "" "Stinner in :gh:`98724`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2057 +#: ../../whatsnew/3.12.rst:2065 msgid "" -"The interpreter's error indicator is now always normalized. This means " -"that :c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other " -"functions that set the error indicator now normalize the exception before " -"storing it. (Contributed by Mark Shannon in :gh:`101578`.)" +"The interpreter's error indicator is now always normalized. This means that :" +"c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other functions " +"that set the error indicator now normalize the exception before storing it. " +"(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2062 +#: ../../whatsnew/3.12.rst:2070 msgid "" "``_Py_RefTotal`` is no longer authoritative and only kept around for ABI " "compatibility. Note that it is an internal global and only available on " @@ -4565,25 +4577,25 @@ msgid "" "``_Py_GetGlobalRefTotal()``." msgstr "" -#: ../../whatsnew/3.12.rst:2067 +#: ../../whatsnew/3.12.rst:2075 msgid "" "The following functions now select an appropriate metaclass for the newly " "created type:" msgstr "" -#: ../../whatsnew/3.12.rst:2070 +#: ../../whatsnew/3.12.rst:2078 msgid ":c:func:`PyType_FromSpec`" msgstr ":c:func:`PyType_FromSpec`" -#: ../../whatsnew/3.12.rst:2071 +#: ../../whatsnew/3.12.rst:2079 msgid ":c:func:`PyType_FromSpecWithBases`" msgstr ":c:func:`PyType_FromSpecWithBases`" -#: ../../whatsnew/3.12.rst:2072 +#: ../../whatsnew/3.12.rst:2080 msgid ":c:func:`PyType_FromModuleAndSpec`" msgstr ":c:func:`PyType_FromModuleAndSpec`" -#: ../../whatsnew/3.12.rst:2074 +#: ../../whatsnew/3.12.rst:2082 msgid "" "Creating classes whose metaclass overrides :c:member:`~PyTypeObject.tp_new` " "is deprecated, and in Python 3.14+ it will be disallowed. Note that these " @@ -4591,14 +4603,14 @@ msgid "" "initialization." msgstr "" -#: ../../whatsnew/3.12.rst:2079 +#: ../../whatsnew/3.12.rst:2087 msgid "" "Note that :c:func:`PyType_FromMetaclass` (added in Python 3.12) already " -"disallows creating classes whose metaclass overrides ``tp_new`` " -"(:meth:`~object.__new__` in Python)." +"disallows creating classes whose metaclass overrides ``tp_new`` (:meth:" +"`~object.__new__` in Python)." msgstr "" -#: ../../whatsnew/3.12.rst:2083 +#: ../../whatsnew/3.12.rst:2091 msgid "" "Since ``tp_new`` overrides almost everything ``PyType_From*`` functions do, " "the two are incompatible with each other. The existing behavior -- ignoring " @@ -4607,38 +4619,38 @@ msgid "" "general workaround. One of the following may work for you:" msgstr "" -#: ../../whatsnew/3.12.rst:2090 +#: ../../whatsnew/3.12.rst:2098 msgid "If you control the metaclass, avoid using ``tp_new`` in it:" msgstr "" -#: ../../whatsnew/3.12.rst:2092 +#: ../../whatsnew/3.12.rst:2100 msgid "" -"If initialization can be skipped, it can be done " -"in :c:member:`~PyTypeObject.tp_init` instead." +"If initialization can be skipped, it can be done in :c:member:`~PyTypeObject." +"tp_init` instead." msgstr "" -#: ../../whatsnew/3.12.rst:2094 +#: ../../whatsnew/3.12.rst:2102 msgid "" "If the metaclass doesn't need to be instantiated from Python, set its " -"``tp_new`` to ``NULL`` using " -"the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag. This makes it " -"acceptable for ``PyType_From*`` functions." +"``tp_new`` to ``NULL`` using the :c:macro:" +"`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag. This makes it acceptable for " +"``PyType_From*`` functions." msgstr "" -#: ../../whatsnew/3.12.rst:2099 +#: ../../whatsnew/3.12.rst:2107 msgid "" "Avoid ``PyType_From*`` functions: if you don't need C-specific features " "(slots or setting the instance size), create types by :ref:`calling <call>` " "the metaclass." msgstr "" -#: ../../whatsnew/3.12.rst:2103 +#: ../../whatsnew/3.12.rst:2111 msgid "" "If you *know* the ``tp_new`` can be skipped safely, filter the deprecation " "warning out using :func:`warnings.catch_warnings` from Python." msgstr "" -#: ../../whatsnew/3.12.rst:2106 +#: ../../whatsnew/3.12.rst:2114 msgid "" ":c:var:`PyOS_InputHook` and :c:var:`PyOS_ReadlineFunctionPointer` are no " "longer called in :ref:`subinterpreters <sub-interpreter-support>`. This is " @@ -4646,33 +4658,33 @@ msgid "" "callbacks have no way of recovering extension module state)." msgstr "" -#: ../../whatsnew/3.12.rst:2111 +#: ../../whatsnew/3.12.rst:2119 msgid "" "This also avoids situations where extensions may find themselves running in " "a subinterpreter that they don't support (or haven't yet been loaded in). " "See :gh:`104668` for more info." msgstr "" -#: ../../whatsnew/3.12.rst:2115 +#: ../../whatsnew/3.12.rst:2123 msgid "" ":c:struct:`PyLongObject` has had its internals changed for better " "performance. Although the internals of :c:struct:`PyLongObject` are private, " "they are used by some extension modules. The internal fields should no " -"longer be accessed directly, instead the API functions beginning " -"``PyLong_...`` should be used instead. Two new *unstable* API functions are " -"provided for efficient access to the value of :c:struct:`PyLongObject`\\s " -"which fit into a single machine word:" +"longer be accessed directly, instead the API functions beginning ``PyLong_..." +"`` should be used instead. Two new *unstable* API functions are provided for " +"efficient access to the value of :c:struct:`PyLongObject`\\s which fit into " +"a single machine word:" msgstr "" -#: ../../whatsnew/3.12.rst:2123 +#: ../../whatsnew/3.12.rst:2131 msgid ":c:func:`PyUnstable_Long_IsCompact`" msgstr ":c:func:`PyUnstable_Long_IsCompact`" -#: ../../whatsnew/3.12.rst:2124 +#: ../../whatsnew/3.12.rst:2132 msgid ":c:func:`PyUnstable_Long_CompactValue`" msgstr ":c:func:`PyUnstable_Long_CompactValue`" -#: ../../whatsnew/3.12.rst:2126 +#: ../../whatsnew/3.12.rst:2134 msgid "" "Custom allocators, set via :c:func:`PyMem_SetAllocator`, are now required to " "be thread-safe, regardless of memory domain. Allocators that don't have " @@ -4681,85 +4693,85 @@ msgid "" "create a new GitHub issue and CC ``@ericsnowcurrently``." msgstr "" -#: ../../whatsnew/3.12.rst:2136 +#: ../../whatsnew/3.12.rst:2144 msgid "" -"In accordance with :pep:`699`, the ``ma_version_tag`` field " -"in :c:type:`PyDictObject` is deprecated for extension modules. Accessing " -"this field will generate a compiler warning at compile time. This field will " -"be removed in Python 3.14. (Contributed by Ramvikrams and Kumar Aditya " -"in :gh:`101193`. PEP by Ken Jin.)" +"In accordance with :pep:`699`, the ``ma_version_tag`` field in :c:type:" +"`PyDictObject` is deprecated for extension modules. Accessing this field " +"will generate a compiler warning at compile time. This field will be removed " +"in Python 3.14. (Contributed by Ramvikrams and Kumar Aditya in :gh:`101193`. " +"PEP by Ken Jin.)" msgstr "" -#: ../../whatsnew/3.12.rst:2141 +#: ../../whatsnew/3.12.rst:2149 msgid "Deprecate global configuration variable:" msgstr "棄用全域配置變數:" -#: ../../whatsnew/3.12.rst:2143 +#: ../../whatsnew/3.12.rst:2151 msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug`" msgstr ":c:var:`Py_DebugFlag`: 請改用 :c:member:`PyConfig.parser_debug`" -#: ../../whatsnew/3.12.rst:2144 +#: ../../whatsnew/3.12.rst:2152 msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose`" msgstr ":c:var:`Py_VerboseFlag`: 請改用 :c:member:`PyConfig.verbose`" -#: ../../whatsnew/3.12.rst:2145 +#: ../../whatsnew/3.12.rst:2153 msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet`" msgstr ":c:var:`Py_QuietFlag`: 請改用 :c:member:`PyConfig.quiet`" -#: ../../whatsnew/3.12.rst:2146 +#: ../../whatsnew/3.12.rst:2154 msgid ":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive`" msgstr ":c:var:`Py_InteractiveFlag`: 請改用 :c:member:`PyConfig.interactive`" -#: ../../whatsnew/3.12.rst:2147 +#: ../../whatsnew/3.12.rst:2155 msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect`" msgstr ":c:var:`Py_InspectFlag`: 請改用 :c:member:`PyConfig.inspect`" -#: ../../whatsnew/3.12.rst:2148 +#: ../../whatsnew/3.12.rst:2156 msgid ":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level`" msgstr "" ":c:var:`Py_OptimizeFlag`: 請改用 :c:member:`PyConfig.optimization_level`" -#: ../../whatsnew/3.12.rst:2149 +#: ../../whatsnew/3.12.rst:2157 msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import`" msgstr ":c:var:`Py_NoSiteFlag`: 請改用 :c:member:`PyConfig.site_import`" -#: ../../whatsnew/3.12.rst:2150 +#: ../../whatsnew/3.12.rst:2158 msgid ":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning`" msgstr "" ":c:var:`Py_BytesWarningFlag`: 請改用 :c:member:`PyConfig.bytes_warning`" -#: ../../whatsnew/3.12.rst:2151 +#: ../../whatsnew/3.12.rst:2159 msgid ":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings`" msgstr "" ":c:var:`Py_FrozenFlag`: 請改用 :c:member:`PyConfig.pathconfig_warnings`" -#: ../../whatsnew/3.12.rst:2152 +#: ../../whatsnew/3.12.rst:2160 msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment`" msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`: 請改" -"用 :c:member:`PyConfig.use_environment`" +":c:var:`Py_IgnoreEnvironmentFlag`: 請改用 :c:member:`PyConfig." +"use_environment`" -#: ../../whatsnew/3.12.rst:2153 +#: ../../whatsnew/3.12.rst:2161 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode`" msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`: 請改用 :c:member:`PyConfig.write_bytecode`" -#: ../../whatsnew/3.12.rst:2154 +#: ../../whatsnew/3.12.rst:2162 msgid "" ":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig.user_site_directory`" msgstr "" -":c:var:`Py_NoUserSiteDirectory`: 請改" -"用 :c:member:`PyConfig.user_site_directory`" +":c:var:`Py_NoUserSiteDirectory`: 請改用 :c:member:`PyConfig." +"user_site_directory`" -#: ../../whatsnew/3.12.rst:2155 +#: ../../whatsnew/3.12.rst:2163 msgid "" ":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio`" msgstr "" ":c:var:`Py_UnbufferedStdioFlag`: 請改用 :c:member:`PyConfig.buffered_stdio`" -#: ../../whatsnew/3.12.rst:2156 +#: ../../whatsnew/3.12.rst:2164 msgid "" ":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed`" @@ -4767,160 +4779,157 @@ msgstr "" ":c:var:`Py_HashRandomizationFlag`: 請改用 :c:member:`PyConfig.use_hash_seed` " "和 :c:member:`PyConfig.hash_seed`" -#: ../../whatsnew/3.12.rst:2158 +#: ../../whatsnew/3.12.rst:2166 msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated`" msgstr ":c:var:`Py_IsolatedFlag`: 請改用 :c:member:`PyConfig.isolated`" -#: ../../whatsnew/3.12.rst:2159 +#: ../../whatsnew/3.12.rst:2167 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -"use :c:member:`PyPreConfig.legacy_windows_fs_encoding`" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`" msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: 請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: 請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`" -#: ../../whatsnew/3.12.rst:2160 +#: ../../whatsnew/3.12.rst:2168 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: " -"use :c:member:`PyConfig.legacy_windows_stdio`" +":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." +"legacy_windows_stdio`" msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`: 請改" -"用 :c:member:`PyConfig.legacy_windows_stdio`" +":c:var:`Py_LegacyWindowsStdioFlag`: 請改用 :c:member:`PyConfig." +"legacy_windows_stdio`" -#: ../../whatsnew/3.12.rst:2161 +#: ../../whatsnew/3.12.rst:2169 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: " -"use :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." +"filesystem_encoding`" msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`: 請改" -"用 :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_FileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." +"filesystem_encoding`" -#: ../../whatsnew/3.12.rst:2162 +#: ../../whatsnew/3.12.rst:2170 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: " -"use :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." +"filesystem_encoding`" msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: 請改" -"用 :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_HasFileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." +"filesystem_encoding`" -#: ../../whatsnew/3.12.rst:2163 +#: ../../whatsnew/3.12.rst:2171 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -"use :c:member:`PyConfig.filesystem_errors`" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." +"filesystem_errors`" msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: 請改" -"用 :c:member:`PyConfig.filesystem_errors`" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: 請改用 :c:member:`PyConfig." +"filesystem_errors`" -#: ../../whatsnew/3.12.rst:2164 +#: ../../whatsnew/3.12.rst:2172 msgid "" -":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` " -"(see :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:" +"`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`: 請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參" -"見 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: 請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參見 :c:" +"func:`Py_PreInitialize`)" -#: ../../whatsnew/3.12.rst:2166 +#: ../../whatsnew/3.12.rst:2174 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` instead. (Contributed by Victor Stinner " -"in :gh:`77782`.)" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead. (Contributed by Victor Stinner in :gh:`77782`.)" msgstr "" ":c:func:`Py_InitializeFromConfig` API 應改為與 :c:type:`PyConfig` 一起使用。" "(由 Victor Stinner 於 :gh:`77782` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2170 +#: ../../whatsnew/3.12.rst:2178 msgid "" "Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable " "bases is deprecated and will be disabled in Python 3.14. (:gh:`95388`)" msgstr "" -#: ../../whatsnew/3.12.rst:2173 +#: ../../whatsnew/3.12.rst:2181 msgid "" "The :file:`structmember.h` header is deprecated, though it continues to be " "available and there are no plans to remove it." msgstr ":file:`structmember.h` 標頭已棄用,但仍可使用,且還沒有移除它的計畫。" -#: ../../whatsnew/3.12.rst:2176 +#: ../../whatsnew/3.12.rst:2184 msgid "" "Its contents are now available just by including :file:`Python.h`, with a " "``Py`` prefix added if it was missing:" msgstr "" -#: ../../whatsnew/3.12.rst:2179 +#: ../../whatsnew/3.12.rst:2187 msgid "" -":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` " -"and :c:func:`PyMember_SetOne`" +":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` and :c:func:" +"`PyMember_SetOne`" msgstr "" -":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` " -"和 :c:func:`PyMember_SetOne`" +":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` 和 :c:func:" +"`PyMember_SetOne`" -#: ../../whatsnew/3.12.rst:2181 +#: ../../whatsnew/3.12.rst:2189 msgid "" "Type macros like :c:macro:`Py_T_INT`, :c:macro:`Py_T_DOUBLE`, etc. " "(previously ``T_INT``, ``T_DOUBLE``, etc.)" msgstr "" -#: ../../whatsnew/3.12.rst:2183 +#: ../../whatsnew/3.12.rst:2191 msgid "" -"The flags :c:macro:`Py_READONLY` (previously ``READONLY``) " -"and :c:macro:`Py_AUDIT_READ` (previously all uppercase)" +"The flags :c:macro:`Py_READONLY` (previously ``READONLY``) and :c:macro:" +"`Py_AUDIT_READ` (previously all uppercase)" msgstr "" -":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)" -"和 :c:macro:`Py_AUDIT_READ`\\ (先前全大寫)旗標" +":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)和 :c:macro:" +"`Py_AUDIT_READ`\\ (先前全大寫)旗標" -#: ../../whatsnew/3.12.rst:2186 +#: ../../whatsnew/3.12.rst:2194 msgid "Several items are not exposed from :file:`Python.h`:" msgstr "數個項目不再從 :file:`Python.h` 中公開:" -#: ../../whatsnew/3.12.rst:2188 +#: ../../whatsnew/3.12.rst:2196 msgid ":c:macro:`T_OBJECT` (use :c:macro:`Py_T_OBJECT_EX`)" msgstr ":c:macro:`T_OBJECT`\\ (請改用 :c:macro:`Py_T_OBJECT_EX`)" -#: ../../whatsnew/3.12.rst:2189 +#: ../../whatsnew/3.12.rst:2197 msgid ":c:macro:`T_NONE` (previously undocumented, and pretty quirky)" msgstr ":c:macro:`T_NONE`\\ (先前未記錄於文件上,且相當古怪)" -#: ../../whatsnew/3.12.rst:2190 +#: ../../whatsnew/3.12.rst:2198 msgid "The macro ``WRITE_RESTRICTED`` which does nothing." msgstr "不做任何事的巨集 ``WRITE_RESTRICTED``。" -#: ../../whatsnew/3.12.rst:2191 +#: ../../whatsnew/3.12.rst:2199 msgid "" -"The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents " -"of :c:macro:`Py_AUDIT_READ`." +"The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of :c:macro:" +"`Py_AUDIT_READ`." msgstr "" -"``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當" -"於 :c:macro:`Py_AUDIT_READ`。" +"``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當於 :c:macro:" +"`Py_AUDIT_READ`。" -#: ../../whatsnew/3.12.rst:2193 +#: ../../whatsnew/3.12.rst:2201 msgid "" -"In some configurations, ``<stddef.h>`` is not included " -"from :file:`Python.h`. It should be included manually when using " -"``offsetof()``." +"In some configurations, ``<stddef.h>`` is not included from :file:`Python." +"h`. It should be included manually when using ``offsetof()``." msgstr "" -#: ../../whatsnew/3.12.rst:2196 +#: ../../whatsnew/3.12.rst:2204 msgid "" "The deprecated header continues to provide its original contents under the " "original names. Your old code can stay unchanged, unless the extra include " "and non-namespaced macros bother you greatly." msgstr "" -#: ../../whatsnew/3.12.rst:2201 +#: ../../whatsnew/3.12.rst:2209 msgid "" "(Contributed in :gh:`47146` by Petr Viktorin, based on earlier work by " "Alexander Belopolsky and Matthias Braun.)" msgstr "" -#: ../../whatsnew/3.12.rst:2204 +#: ../../whatsnew/3.12.rst:2212 msgid "" -":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. " -"Use :c:func:`PyErr_GetRaisedException` " -"and :c:func:`PyErr_SetRaisedException` instead. (Contributed by Mark Shannon " -"in :gh:`101578`.)" +":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. Use :c:" +"func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` " +"instead. (Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2209 +#: ../../whatsnew/3.12.rst:2217 msgid "" ":c:func:`!PyErr_Display` is deprecated. Use :c:func:`PyErr_DisplayException` " "instead. (Contributed by Irit Katriel in :gh:`102755`)." @@ -4928,7 +4937,7 @@ msgstr "" ":c:func:`!PyErr_Display` 已棄用,請改用 :c:func:`PyErr_DisplayException`。" "(由 Irit Katriel 於 :gh:`102755` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2212 +#: ../../whatsnew/3.12.rst:2220 msgid "" "``_PyErr_ChainExceptions`` is deprecated. Use ``_PyErr_ChainExceptions1`` " "instead. (Contributed by Irit Katriel in :gh:`102192`.)" @@ -4936,32 +4945,31 @@ msgstr "" "``_PyErr_ChainExceptions`` 已棄用,請改用 ``_PyErr_ChainExceptions1``。(由 " "Irit Katriel 於 :gh:`102192` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2215 +#: ../../whatsnew/3.12.rst:2223 msgid "" -"Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` " -"or :c:func:`PyType_FromModuleAndSpec` to create a class whose metaclass " -"overrides :c:member:`~PyTypeObject.tp_new` is deprecated. Call the metaclass " -"instead." +"Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` or :c:" +"func:`PyType_FromModuleAndSpec` to create a class whose metaclass overrides :" +"c:member:`~PyTypeObject.tp_new` is deprecated. Call the metaclass instead." msgstr "" -"使用 :c:func:`PyType_FromSpec`、:c:func:`PyType_FromSpecWithBases` " -"或 :c:func:`PyType_FromModuleAndSpec` 建立一個其元類別覆" -"寫 :c:member:`~PyTypeObject.tp_new` 的類別已被棄用。請改為呼叫元類別。" +"使用 :c:func:`PyType_FromSpec`、:c:func:`PyType_FromSpecWithBases` 或 :c:" +"func:`PyType_FromModuleAndSpec` 建立一個其元類別覆寫 :c:member:" +"`~PyTypeObject.tp_new` 的類別已被棄用。請改為呼叫元類別。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 msgid "" "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " "(:pep:`699`; :gh:`101193`)." msgstr "" -":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 " -"(:pep:`699`;:gh:`101193`)。" +":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 (:pep:" +"`699`;:gh:`101193`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 msgid "" "Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable " "bases (:gh:`95388`)." msgstr "" -"使用可變基底建立\\ :c:data:`不可變型別 <Py_TPFLAGS_IMMUTABLETYPE>` " -"(:gh:`95388`)。" +"使用可變基底建立\\ :c:data:`不可變型別 <Py_TPFLAGS_IMMUTABLETYPE>` (:gh:" +"`95388`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 msgid "" @@ -4991,8 +4999,8 @@ msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` instead." +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" @@ -5049,24 +5057,24 @@ msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改" -"用 :c:member:`PyConfig.use_environment`。" +":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." +"use_environment`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改" -"用 :c:member:`PyConfig.write_bytecode`。" +":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." +"write_bytecode`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: " -"Use :c:member:`PyConfig.user_site_directory` instead." +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` instead." msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改" -"用 :c:member:`PyConfig.user_site_directory`。" +":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." +"user_site_directory`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" @@ -5089,51 +5097,51 @@ msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` instead." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` instead." msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: " -"Use :c:member:`PyConfig.legacy_windows_stdio` instead." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` instead." msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改" -"用 :c:member:`PyConfig.legacy_windows_stdio`。" +":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." +"legacy_windows_stdio`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` instead." +":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`。" +":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` instead." +":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` instead." msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`。" +":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -"Use :c:member:`PyConfig.filesystem_errors` instead." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" -"用 :c:member:`PyConfig.filesystem_errors`。" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." +"filesystem_errors`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. " -"(see :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" +"c:func:`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" -"見 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" +"func:`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 msgid "The bundled copy of ``libmpdecimal``." @@ -5141,27 +5149,27 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: " -"Use :c:func:`PyImport_ImportModule` instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改" -"用 :c:func:`PyImport_ImportModule`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" +"`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " -"Use :c:func:`PyWeakref_GetRef` instead." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" -"用 :c:func:`PyWeakref_GetRef`。" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " -"Use :c:type:`wchar_t` instead." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" -"用 :c:type:`wchar_t`。" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" @@ -5172,16 +5180,16 @@ msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " -"和 :data:`!warnings.filters`。" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" +"data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 msgid "" -":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " -"and :data:`sys.exec_prefix` instead." +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." +"exec_prefix` instead." msgstr "" -":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " -"與 :data:`sys.exec_prefix`。" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" +"`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." @@ -5192,8 +5200,8 @@ msgid "" ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " "instead." msgstr "" -":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " -"與 :data:`sys.prefix`。" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." +"prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." @@ -5205,11 +5213,11 @@ msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or " -"the :envvar:`PYTHONHOME` environment variable instead." +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" +"`PYTHONHOME` environment variable instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " -"或 :envvar:`PYTHONHOME` 環境變數。" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" +"`PYTHONHOME` 環境變數。" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" @@ -5230,8 +5238,8 @@ msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" -":c:func:`PyErr_NormalizeException`:請改" -"用 :c:func:`PyErr_GetRaisedException`。" +":c:func:`PyErr_NormalizeException`:請改用 :c:func:" +"`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" @@ -5251,11 +5259,11 @@ msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " -"and :c:func:`PySlice_AdjustIndices` instead." +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." msgstr "" -":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " -"和 :c:func:`PySlice_AdjustIndices`。" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" +"`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" @@ -5301,8 +5309,8 @@ msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" -":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" -"叫 :c:func:`PyObject_Hash`。" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" +"`PyObject_Hash`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." @@ -5342,57 +5350,66 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.12.rst:2231 +#: ../../whatsnew/3.12.rst:2239 msgid "" "Remove the :file:`token.h` header file. There was never any public tokenizer " "C API. The :file:`token.h` header file was only designed to be used by " "Python internals. (Contributed by Victor Stinner in :gh:`92651`.)" msgstr "" +"移除 :file:`token.h` 標頭檔案。從未有任何公開的 tokenizer C API。:file:" +"`token.h` 標頭檔案的設計是僅限用於 Python 內部。(由 Victor Stinner 於 :gh:" +"`92651` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2236 +#: ../../whatsnew/3.12.rst:2244 msgid "Legacy Unicode APIs have been removed. See :pep:`623` for detail." msgstr "" -#: ../../whatsnew/3.12.rst:2238 +#: ../../whatsnew/3.12.rst:2246 msgid ":c:macro:`!PyUnicode_WCHAR_KIND`" msgstr ":c:macro:`!PyUnicode_WCHAR_KIND`" -#: ../../whatsnew/3.12.rst:2239 +#: ../../whatsnew/3.12.rst:2247 msgid ":c:func:`!PyUnicode_AS_UNICODE`" msgstr ":c:func:`!PyUnicode_AS_UNICODE`" -#: ../../whatsnew/3.12.rst:2240 +#: ../../whatsnew/3.12.rst:2248 msgid ":c:func:`!PyUnicode_AsUnicode`" msgstr ":c:func:`!PyUnicode_AsUnicode`" -#: ../../whatsnew/3.12.rst:2241 +#: ../../whatsnew/3.12.rst:2249 msgid ":c:func:`!PyUnicode_AsUnicodeAndSize`" msgstr ":c:func:`!PyUnicode_AsUnicodeAndSize`" -#: ../../whatsnew/3.12.rst:2242 +#: ../../whatsnew/3.12.rst:2250 msgid ":c:func:`!PyUnicode_AS_DATA`" msgstr ":c:func:`!PyUnicode_AS_DATA`" -#: ../../whatsnew/3.12.rst:2243 +#: ../../whatsnew/3.12.rst:2251 msgid ":c:func:`!PyUnicode_FromUnicode`" msgstr ":c:func:`!PyUnicode_FromUnicode`" -#: ../../whatsnew/3.12.rst:2244 +#: ../../whatsnew/3.12.rst:2252 msgid ":c:func:`!PyUnicode_GET_SIZE`" msgstr ":c:func:`!PyUnicode_GET_SIZE`" -#: ../../whatsnew/3.12.rst:2245 +#: ../../whatsnew/3.12.rst:2253 msgid ":c:func:`!PyUnicode_GetSize`" msgstr ":c:func:`!PyUnicode_GetSize`" -#: ../../whatsnew/3.12.rst:2246 +#: ../../whatsnew/3.12.rst:2254 msgid ":c:func:`!PyUnicode_GET_DATA_SIZE`" msgstr ":c:func:`!PyUnicode_GET_DATA_SIZE`" -#: ../../whatsnew/3.12.rst:2248 +#: ../../whatsnew/3.12.rst:2256 msgid "" "Remove the ``PyUnicode_InternImmortal()`` function macro. (Contributed by " "Victor Stinner in :gh:`85858`.)" msgstr "" -"移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner " -"於 :gh:`85858` 中貢獻。)" +"移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner 於 :gh:" +"`85858` 中貢獻。)" + +#~ msgid "" +#~ ":func:`sysconfig.is_python_build` *check_home* parameter is deprecated " +#~ "and ignored." +#~ msgstr "" +#~ ":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index fe2d9f58d6..451ededb40 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-02-28 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -482,6 +482,7 @@ msgstr "" " ^^^^^^^^\n" "AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/" "home/me/numpy.py' if it has the same name as a library you intended to " +"import)" #: ../../whatsnew/3.13.rst:294 msgid "(Contributed by Shantanu Jain in :gh:`95754`.)" @@ -2262,7 +2263,7 @@ msgid "" "the :mod:`email.message` module or the :pypi:`multipart` library for " "``POST`` and ``PUT`` requests." msgstr "" -":class:`!cgi.FieldStorage`,在於``GET`` 和 ``HEAD`` 請求中通常可以" +":class:`!cgi.FieldStorage`,在於 ``GET`` 和 ``HEAD`` 請求中通常可以" "被 :func:`urllib.parse.parse_qsl` 取代,而在於 ``POST`` 和 ``PUT`` 請求中可以" "被 :mod:`email.message` 模組或 :pypi:`multipart` 函式庫取代。" @@ -2872,7 +2873,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1911 -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" @@ -2884,7 +2885,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1918 -#: ../../deprecations/pending-removal-in-3.15.rst:48 +#: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" @@ -2971,7 +2972,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1972 -#: ../../deprecations/pending-removal-in-3.15.rst:71 +#: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" @@ -3014,7 +3015,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:2005 -#: ../../deprecations/pending-removal-in-3.15.rst:84 +#: ../../deprecations/pending-removal-in-3.15.rst:93 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" @@ -3321,10 +3322,19 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:58 +msgid ":mod:`importlib`:" +msgstr ":mod:`importlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "``load_module()`` method:請改用 ``exec_module()``。" + +#: ../../deprecations/pending-removal-in-3.15.rst:36 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:34 +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 " @@ -3339,7 +3349,7 @@ msgstr "" "和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" "獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " "Use :func:`os.path.isreserved` to detect reserved paths on Windows." @@ -3347,7 +3357,7 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" "用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -3356,11 +3366,23 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:54 +#: ../../deprecations/pending-removal-in-3.15.rst:58 +msgid ":mod:`sysconfig`:" +msgstr ":mod:`sysconfig`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" +":func:`sysconfig.is_python_build` 的 *check_home* 引數自 Python 3.12 起已被棄" +"用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:63 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:56 +#: ../../deprecations/pending-removal-in-3.15.rst:65 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -3371,11 +3393,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`types`:" msgstr ":mod:`types`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -3387,7 +3409,7 @@ msgstr "" "出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " "於 :gh:`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:73 +#: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" "The undocumented keyword argument syntax for " "creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " @@ -3398,7 +3420,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:79 +#: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -3408,7 +3430,7 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:86 +#: ../../deprecations/pending-removal-in-3.15.rst:95 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " "and :meth:`~wave.Wave_read.getmarkers` methods of " @@ -3649,15 +3671,7 @@ msgstr "" msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" -#: ../../deprecations/pending-removal-in-future.rst:58 -msgid ":mod:`importlib`:" -msgstr ":mod:`importlib`:" - #: ../../deprecations/pending-removal-in-future.rst:60 -msgid "``load_module()`` method: use ``exec_module()`` instead." -msgstr "``load_module()`` method:請改用 ``exec_module()``。" - -#: ../../deprecations/pending-removal-in-future.rst:61 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -3665,19 +3679,19 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:65 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:67 +#: ../../deprecations/pending-removal-in-future.rst:66 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:68 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." @@ -3685,19 +3699,19 @@ msgstr "" ":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" "用 :meth:`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:71 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:75 +#: ../../deprecations/pending-removal-in-future.rst:74 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:76 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -3705,7 +3719,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:80 +#: ../../deprecations/pending-removal-in-future.rst:79 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -3717,12 +3731,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:87 +#: ../../deprecations/pending-removal-in-future.rst:86 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:88 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -3730,15 +3744,15 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:91 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:94 +#: ../../deprecations/pending-removal-in-future.rst:93 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:94 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " "and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." @@ -3746,58 +3760,51 @@ msgstr "" ":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " "和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:97 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 -msgid "" -":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " -"ignored." -msgstr "" -":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" - -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "" ":meth:`!threading.Condition.notifyAll`: " "use :meth:`~threading.Condition.notify_all`." @@ -3805,11 +3812,11 @@ msgstr "" ":meth:`!threading.Condition.notifyAll`:請" "用 :meth:`~threading.Condition.notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:111 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " "use :attr:`threading.Thread.daemon` attribute." @@ -3817,7 +3824,7 @@ msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " "use :attr:`threading.Thread.name` attribute." @@ -3825,20 +3832,20 @@ msgstr "" ":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" "用 :attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:116 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:121 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:119 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:121 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -3846,58 +3853,58 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:127 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:129 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:135 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "" ":mod:`urllib.request`: :class:`~urllib.request.URLopener` " "and :class:`~urllib.request.FancyURLopener` style of invoking requests is " @@ -3907,13 +3914,13 @@ msgstr "" "和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" "的 :func:`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:145 msgid "" ":mod:`xml.etree.ElementTree`: Testing the truth value of " "an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " @@ -3924,7 +3931,7 @@ msgstr "" "對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" "回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:154 +#: ../../deprecations/pending-removal-in-future.rst:150 msgid "" ":meth:`zipimport.zipimporter.load_module` is deprecated: " "use :meth:`~zipimport.zipimporter.exec_module` instead." @@ -4610,6 +4617,7 @@ msgid "" "Remove the following old functions to configure the Python initialization, " "deprecated in Python 3.11:" msgstr "" +"移除以下設定 Python 初始化的舊函式,這些函式在 Python 3.11 中已被棄用:" #: ../../whatsnew/3.13.rst:2415 msgid "" @@ -4711,6 +4719,10 @@ msgid "" "PyEval_ThreadsInitialized` always returns non-zero. (Contributed by Victor " "Stinner in :gh:`105182`.)" msgstr "" +"移除在 Python 3.9 中已被棄用的 :c:func:`!PyEval_ThreadsInitialized` 函式。自 " +"Python 3.7 起,:c:func:`!Py_Initialize` 總是會建立 GIL:呼叫 :c:func:`!" +"PyEval_InitThreads` 不會有任何作用,而 :c:func:`!PyEval_ThreadsInitialized` " +"總是會回傳非零值。(由 Victor Stinner 於 :gh:`105182` 貢獻。)" #: ../../whatsnew/3.13.rst:2455 msgid "" @@ -4720,6 +4732,11 @@ msgid "" "to get :c:func:`PyInterpreterState_Get()` on Python 3.8 and older. " "(Contributed by Victor Stinner in :gh:`106320`.)" msgstr "" +"移除 :c:func:`!_PyInterpreterState_Get` 這個" +"對 :c:func:`PyInterpreterState_Get()` 的別名,這個別名是為了與 Python 3.8 的" +"向後相容性而保留的。`pythoncapi-compat 專案`_\\ 可以用於在 Python 3.8 和更舊" +"的版本中取得 :c:func:`PyInterpreterState_Get()`。(由 Victor Stinner " +"於 :gh:`106320` 貢獻。)" #: ../../whatsnew/3.13.rst:2462 msgid "" @@ -4727,6 +4744,9 @@ msgid "" "PyObject_Vectorcall` which is available since Python 3.8 (:pep:`590`). " "(Contributed by Victor Stinner in :gh:`106023`.)" msgstr "" +"移除私有的 :c:func:`!_PyObject_FastCall` 函式:請改用自 Python 3.8 起可用" +"的 :c:func:`!PyObject_Vectorcall` 函式(:pep:`590`)。(由 Victor Stinner " +"於 :gh:`106023` 貢獻。)" #: ../../whatsnew/3.13.rst:2467 msgid "" @@ -4749,6 +4769,9 @@ msgid "" "``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``. (Contributed by Irit Katriel " "in :gh:`105111`.)" msgstr "" +"移除舊的垃圾桶巨集 ``Py_TRASHCAN_SAFE_BEGIN`` 和 ``Py_TRASHCAN_SAFE_END``。請" +"將兩者都替換為新的巨集 ``Py_TRASHCAN_BEGIN`` 和 ``Py_TRASHCAN_END``。(由 " +"Irit Katriel 在 :gh:`105111` 中貢獻。)" #: ../../whatsnew/3.13.rst:2481 msgid "Deprecated C APIs" @@ -4756,7 +4779,7 @@ msgstr "器用的 C API" #: ../../whatsnew/3.13.rst:2483 msgid "Deprecate old Python initialization functions:" -msgstr "" +msgstr "棄用舊的 Python 初始化函式:" #: ../../whatsnew/3.13.rst:2485 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 @@ -4810,6 +4833,10 @@ msgid "" "and :c:func:`PyEval_GetLocals` functions, which return a :term:`borrowed " "reference`. (Soft deprecated as part of :pep:`667`.)" msgstr "" +":term:`軟性棄用 <soft " +"deprecated>` :c:func:`PyEval_GetBuiltins`、:c:func:`PyEval_GetGlobals` " +"和 :c:func:`PyEval_GetLocals` 函式,這些函式會回傳一個\\ :term:`借用參照 " +"<borrowed reference>`。(作為 :pep:`667` 一部分的軟性棄用。)" #: ../../whatsnew/3.13.rst:2509 msgid "" @@ -4817,6 +4844,9 @@ msgid "" "an alias to :c:func:`PyImport_ImportModule` since Python 3.3. (Contributed " "by Victor Stinner in :gh:`105396`.)" msgstr "" +"棄用 :c:func:`PyImport_ImportModuleNoBlock` 函式,這只是自 Python 3.3 起" +"的 :c:func:`PyImport_ImportModule` 的別名。(由 Victor Stinner " +"在 :gh:`105396` 中貢獻。)" #: ../../whatsnew/3.13.rst:2513 msgid "" @@ -4825,6 +4855,9 @@ msgid "" "or :c:func:`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka " "in :gh:`86493`.)" msgstr "" +":term:`軟性棄用 <soft deprecated>` :c:func:`PyModule_AddObject` 函式。應該改" +"用 :c:func:`PyModule_Add` 或 :c:func:`PyModule_AddObjectRef`。(由 Serhiy " +"Storchaka 在 :gh:`86493` 中貢獻。)" #: ../../whatsnew/3.13.rst:2519 msgid "" @@ -4834,6 +4867,10 @@ msgid "" "are just aliases to :c:type:`!wchar_t`. (Contributed by Victor Stinner " "in :gh:`105156`.)" msgstr "" +"棄用舊的 ``Py_UNICODE`` 和 ``PY_UNICODE_TYPE`` 型別以及 :c:macro:`!" +"Py_UNICODE_WIDE` 定義。請直接使用 :c:type:`wchar_t` 型別。自 Python 3.3 起," +"``Py_UNICODE`` 和 ``PY_UNICODE_TYPE`` 只是 :c:type:`!wchar_t` 的別名。(由 " +"Victor Stinner 在 :gh:`105156` 中貢獻。)" #: ../../whatsnew/3.13.rst:2526 msgid "" @@ -4844,6 +4881,12 @@ msgid "" "can be used to get :c:func:`PyWeakref_GetRef` on Python 3.12 and older. " "(Contributed by Victor Stinner in :gh:`105927`.)" msgstr "" +"棄用 :c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT` 函式,這" +"些函式會回傳一個\\ :term:`借用參照 <borrowed reference>`。請改用新" +"的 :c:func:`PyWeakref_GetRef` 函式,這個函式會回傳一個\\ :term:`強參照 " +"<strong reference>`。`pythoncapi-compat 專案`_\\ 可以用於在 Python 3.12 和更" +"舊的版本中取得 :c:func:`PyWeakref_GetRef`。(由 Victor Stinner " +"在 :gh:`105927` 中貢獻。)" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 msgid "" @@ -5662,10 +5705,12 @@ msgid "" "The `pythoncapi-compat project`_ can be used to get most of these new " "functions on Python 3.12 and older." msgstr "" +"可以使用 `pythoncapi-compat 專案`_\\ 來在 Python 3.12 及更舊的版本中取用大部" +"分的這些新函式。" #: ../../whatsnew/3.13.rst:2798 msgid "Regression Test Changes" -msgstr "" +msgstr "迴歸測試的變更" #: ../../whatsnew/3.13.rst:2800 msgid "" @@ -5675,6 +5720,10 @@ msgid "" "interpreter, before ``site.py`` is executed. (Contributed by Łukasz Langa " "in :gh:`110769`.)" msgstr "" +"使用 :file:`configure` :option:`--with-pydebug` 建置的 Python 現在支" +"援 :option:`-X presite=package.module <-X>` 命令列選項。如果使用它就會指定一" +"個應該在解譯器生命週期的早期階段、在執行 ``site.py`` 之前被引入的模組。(由 " +"Łukasz Langa 在 :gh:`110769` 中貢獻。)" #: ../../whatsnew/3.13.rst:2808 msgid "Notable changes in 3.13.1" @@ -5686,3 +5735,11 @@ msgid "" "only exists in specialized builds of Python, may now return objects from " "other interpreters than the one it's called in." msgstr "" +"先前未以文件記錄的特殊函式 :func:`sys.getobjects`,只存在於 Python 的特殊建置" +"中,現在可能會回傳來自於呼叫它的直譯器之外的物件。" + +#~ msgid "" +#~ ":func:`sysconfig.is_python_build` *check_home* parameter is deprecated " +#~ "and ignored." +#~ msgstr "" +#~ ":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" diff --git a/whatsnew/3.2.po b/whatsnew/3.2.po index 2ed7e65d36..eef8f7784e 100644 --- a/whatsnew/3.2.po +++ b/whatsnew/3.2.po @@ -90,10 +90,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:95 msgid "" "This module has already had widespread success in the community as a third-" -"party module. Being more fully featured than its predecessor, the :mod:" -"`argparse` module is now the preferred module for command-line processing. " -"The older module is still being kept available because of the substantial " -"amount of legacy code that depends on it." +"party module. Being more fully featured than its predecessor, " +"the :mod:`argparse` module is now the preferred module for command-line " +"processing. The older module is still being kept available because of the " +"substantial amount of legacy code that depends on it." msgstr "" #: ../../whatsnew/3.2.rst:101 @@ -234,8 +234,8 @@ msgstr "由 Steven Bethard 撰寫 PEP。" #: ../../whatsnew/3.2.rst:178 msgid "" -":ref:`upgrading-optparse-code` for details on the differences from :mod:" -"`optparse`." +":ref:`upgrading-optparse-code` for details on the differences " +"from :mod:`optparse`." msgstr "" #: ../../whatsnew/3.2.rst:182 @@ -254,20 +254,20 @@ msgstr "" #: ../../whatsnew/3.2.rst:191 msgid "" -"To support a more flexible style, the module now offers :func:`logging." -"config.dictConfig` for specifying logging configuration with plain Python " -"dictionaries. The configuration options include formatters, handlers, " -"filters, and loggers. Here's a working example of a configuration " -"dictionary::" +"To support a more flexible style, the module now " +"offers :func:`logging.config.dictConfig` for specifying logging " +"configuration with plain Python dictionaries. The configuration options " +"include formatters, handlers, filters, and loggers. Here's a working " +"example of a configuration dictionary::" msgstr "" #: ../../whatsnew/3.2.rst:197 msgid "" "{\"version\": 1,\n" -" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: " -"%(message)s\"},\n" -" \"full\": {\"format\": \"%(asctime)s %(name)-15s " -"%(levelname)-8s %(message)s\"}\n" +" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: %" +"(message)s\"},\n" +" \"full\": {\"format\": \"%(asctime)s %(name)-15s %" +"(levelname)-8s %(message)s\"}\n" " },\n" " \"handlers\": {\"console\": {\n" " \"class\": \"logging.StreamHandler\",\n" @@ -284,10 +284,10 @@ msgid "" "\"console_priority\"]}}" msgstr "" "{\"version\": 1,\n" -" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: " -"%(message)s\"},\n" -" \"full\": {\"format\": \"%(asctime)s %(name)-15s " -"%(levelname)-8s %(message)s\"}\n" +" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: %" +"(message)s\"},\n" +" \"full\": {\"format\": \"%(asctime)s %(name)-15s %" +"(levelname)-8s %(message)s\"}\n" " },\n" " \"handlers\": {\"console\": {\n" " \"class\": \"logging.StreamHandler\",\n" @@ -344,12 +344,12 @@ msgstr "" #: ../../whatsnew/3.2.rst:241 msgid "" -"The design for :mod:`concurrent.futures` was inspired by the *java.util." -"concurrent* package. In that model, a running call and its result are " -"represented by a :class:`~concurrent.futures.Future` object that abstracts " -"features common to threads, processes, and remote procedure calls. That " -"object supports status checks (running or done), timeouts, cancellations, " -"adding callbacks, and access to results or exceptions." +"The design for :mod:`concurrent.futures` was inspired by the " +"*java.util.concurrent* package. In that model, a running call and its " +"result are represented by a :class:`~concurrent.futures.Future` object that " +"abstracts features common to threads, processes, and remote procedure " +"calls. That object supports status checks (running or done), timeouts, " +"cancellations, adding callbacks, and access to results or exceptions." msgstr "" #: ../../whatsnew/3.2.rst:248 @@ -372,14 +372,15 @@ msgstr "" #: ../../whatsnew/3.2.rst:260 msgid "" -"Both classes share a common interface with three methods: :meth:`~concurrent." -"futures.Executor.submit` for scheduling a callable and returning a :class:" -"`~concurrent.futures.Future` object; :meth:`~concurrent.futures.Executor." -"map` for scheduling many asynchronous calls at a time, and :meth:" -"`~concurrent.futures.Executor.shutdown` for freeing resources. The class is " -"a :term:`context manager` and can be used in a :keyword:`with` statement to " -"assure that resources are automatically released when currently pending " -"futures are done executing." +"Both classes share a common interface with three " +"methods: :meth:`~concurrent.futures.Executor.submit` for scheduling a " +"callable and returning a :class:`~concurrent.futures.Future` " +"object; :meth:`~concurrent.futures.Executor.map` for scheduling many " +"asynchronous calls at a time, " +"and :meth:`~concurrent.futures.Executor.shutdown` for freeing resources. " +"The class is a :term:`context manager` and can be used in a :keyword:`with` " +"statement to assure that resources are automatically released when currently " +"pending futures are done executing." msgstr "" #: ../../whatsnew/3.2.rst:269 @@ -421,8 +422,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:287 msgid "" ":ref:`Code for computing prime numbers in parallel<processpoolexecutor-" -"example>`, an example demonstrating :class:`~concurrent.futures." -"ProcessPoolExecutor`." +"example>`, an example " +"demonstrating :class:`~concurrent.futures.ProcessPoolExecutor`." msgstr "" #: ../../whatsnew/3.2.rst:293 @@ -451,10 +452,11 @@ msgid "" "To solve this problem, Python's import machinery has been extended to use " "distinct filenames for each interpreter. Instead of Python 3.2 and Python " "3.3 and Unladen Swallow each competing for a file called \"mymodule.pyc\", " -"they will now look for \"mymodule.cpython-32.pyc\", \"mymodule.cpython-33." -"pyc\", and \"mymodule.unladen10.pyc\". And to prevent all of these new " -"files from cluttering source directories, the *pyc* files are now collected " -"in a \"__pycache__\" directory stored under the package directory." +"they will now look for \"mymodule.cpython-32.pyc\", " +"\"mymodule.cpython-33.pyc\", and \"mymodule.unladen10.pyc\". And to prevent " +"all of these new files from cluttering source directories, the *pyc* files " +"are now collected in a \"__pycache__\" directory stored under the package " +"directory." msgstr "" #: ../../whatsnew/3.2.rst:312 @@ -539,8 +541,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:373 msgid "" -"In Python itself, the tags are accessible from functions in the :mod:" -"`sysconfig` module::" +"In Python itself, the tags are accessible from functions in " +"the :mod:`sysconfig` module::" msgstr "" #: ../../whatsnew/3.2.rst:376 @@ -660,11 +662,11 @@ msgid "" "There is also a new :meth:`str.format_map` method that extends the " "capabilities of the existing :meth:`str.format` method by accepting " "arbitrary :term:`mapping` objects. This new method makes it possible to use " -"string formatting with any of Python's many dictionary-like objects such as :" -"class:`~collections.defaultdict`, :class:`~shelve.Shelf`, :class:" -"`~configparser.ConfigParser`, or :mod:`dbm`. It is also useful with custom :" -"class:`dict` subclasses that normalize keys before look-up or that supply a :" -"meth:`__missing__` method for unknown keys::" +"string formatting with any of Python's many dictionary-like objects such " +"as :class:`~collections.defaultdict`, :class:`~shelve.Shelf`, :class:`~configparser.ConfigParser`, " +"or :mod:`dbm`. It is also useful with custom :class:`dict` subclasses that " +"normalize keys before look-up or that supply a :meth:`__missing__` method " +"for unknown keys::" msgstr "" #: ../../whatsnew/3.2.rst:463 @@ -711,16 +713,16 @@ msgstr "" #: ../../whatsnew/3.2.rst:483 msgid "" -"(Suggested by Raymond Hettinger and implemented by Eric Smith in :issue:" -"`6081`.)" +"(Suggested by Raymond Hettinger and implemented by Eric Smith " +"in :issue:`6081`.)" msgstr "" #: ../../whatsnew/3.2.rst:486 msgid "" "The interpreter can now be started with a quiet option, ``-q``, to prevent " "the copyright and version information from being displayed in the " -"interactive mode. The option can be introspected using the :data:`sys." -"flags` attribute:" +"interactive mode. The option can be introspected using " +"the :data:`sys.flags` attribute:" msgstr "" #: ../../whatsnew/3.2.rst:490 @@ -745,11 +747,11 @@ msgstr "(由 Marcin Wojdyr 在 :issue:`1772833` 中貢獻)。" msgid "" "The :func:`hasattr` function works by calling :func:`getattr` and detecting " "whether an exception is raised. This technique allows it to detect methods " -"created dynamically by :meth:`~object.__getattr__` or :meth:`~object." -"__getattribute__` which would otherwise be absent from the class " -"dictionary. Formerly, *hasattr* would catch any exception, possibly masking " -"genuine errors. Now, *hasattr* has been tightened to only catch :exc:" -"`AttributeError` and let other exceptions pass through::" +"created dynamically by :meth:`~object.__getattr__` " +"or :meth:`~object.__getattribute__` which would otherwise be absent from the " +"class dictionary. Formerly, *hasattr* would catch any exception, possibly " +"masking genuine errors. Now, *hasattr* has been tightened to only " +"catch :exc:`AttributeError` and let other exceptions pass through::" msgstr "" #: ../../whatsnew/3.2.rst:508 @@ -783,10 +785,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:521 msgid "" -"The :func:`str` of a float or complex number is now the same as its :func:" -"`repr`. Previously, the :func:`str` form was shorter but that just caused " -"confusion and is no longer needed now that the shortest possible :func:" -"`repr` is displayed by default:" +"The :func:`str` of a float or complex number is now the same as " +"its :func:`repr`. Previously, the :func:`str` form was shorter but that just " +"caused confusion and is no longer needed now that the shortest " +"possible :func:`repr` is displayed by default:" msgstr "" #: ../../whatsnew/3.2.rst:532 @@ -851,11 +853,11 @@ msgstr "(請見 :issue:`4617`。)" #: ../../whatsnew/3.2.rst:569 msgid "" ":ref:`Struct sequence types <struct-sequence-objects>` are now subclasses of " -"tuple. This means that C structures like those returned by :func:`os.stat`, :" -"func:`time.gmtime`, and :data:`sys.version_info` now work like a :term:" -"`named tuple` and now work with functions and methods that expect a tuple as " -"an argument. This is a big step forward in making the C structures as " -"flexible as their pure Python counterparts:" +"tuple. This means that C structures like those returned " +"by :func:`os.stat`, :func:`time.gmtime`, and :data:`sys.version_info` now " +"work like a :term:`named tuple` and now work with functions and methods that " +"expect a tuple as an argument. This is a big step forward in making the C " +"structures as flexible as their pure Python counterparts:" msgstr "" #: ../../whatsnew/3.2.rst:582 @@ -878,8 +880,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:592 msgid "" -"(Suggested by Barry Warsaw and implemented by Philip Jenvey in :issue:" -"`7301`.)" +"(Suggested by Barry Warsaw and implemented by Philip Jenvey " +"in :issue:`7301`.)" msgstr "" #: ../../whatsnew/3.2.rst:594 @@ -893,10 +895,11 @@ msgstr "" #: ../../whatsnew/3.2.rst:600 msgid "" -"A :exc:`ResourceWarning` is issued at interpreter shutdown if the :data:`gc." -"garbage` list isn't empty, and if :const:`gc.DEBUG_UNCOLLECTABLE` is set, " -"all uncollectable objects are printed. This is meant to make the programmer " -"aware that their code contains object finalization issues." +"A :exc:`ResourceWarning` is issued at interpreter shutdown if " +"the :data:`gc.garbage` list isn't empty, and " +"if :const:`gc.DEBUG_UNCOLLECTABLE` is set, all uncollectable objects are " +"printed. This is meant to make the programmer aware that their code " +"contains object finalization issues." msgstr "" #: ../../whatsnew/3.2.rst:605 @@ -923,19 +926,19 @@ msgstr "" #: ../../whatsnew/3.2.rst:619 msgid "" -"(Added by Antoine Pitrou and Georg Brandl in :issue:`10093` and :issue:" -"`477863`.)" +"(Added by Antoine Pitrou and Georg Brandl in :issue:`10093` " +"and :issue:`477863`.)" msgstr "" #: ../../whatsnew/3.2.rst:621 msgid "" ":class:`range` objects now support *index* and *count* methods. This is part " -"of an effort to make more objects fully implement the :class:`collections." -"Sequence <collections.abc.Sequence>` :term:`abstract base class`. As a " -"result, the language will have a more uniform API. In addition, :class:" -"`range` objects now support slicing and negative indices, even with values " -"larger than :data:`sys.maxsize`. This makes *range* more interoperable with " -"lists::" +"of an effort to make more objects fully implement " +"the :class:`collections.Sequence <collections.abc.Sequence>` :term:`abstract " +"base class`. As a result, the language will have a more uniform API. In " +"addition, :class:`range` objects now support slicing and negative indices, " +"even with values larger than :data:`sys.maxsize`. This makes *range* more " +"interoperable with lists::" msgstr "" #: ../../whatsnew/3.2.rst:628 @@ -963,8 +966,8 @@ msgid "" "(Contributed by Daniel Stutzbach in :issue:`9213`, by Alexander Belopolsky " "in :issue:`2690`, and by Nick Coghlan in :issue:`10889`.)" msgstr "" -"(由 Daniel Stutzbach 在 :issue:`9213`、Alexander Belopolsky 在 :issue:" -"`2690`、Nick Coghlan 在 :issue:`10889` 中貢獻。)" +"(由 Daniel Stutzbach 在 :issue:`9213`、Alexander Belopolsky " +"在 :issue:`2690`、Nick Coghlan 在 :issue:`10889` 中貢獻。)" #: ../../whatsnew/3.2.rst:640 msgid "" @@ -1000,10 +1003,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:664 msgid "" -"The biggest news for Python 3.2 is that the :mod:`email` package, :mod:" -"`mailbox` module, and :mod:`!nntplib` modules now work correctly with the " -"bytes/text model in Python 3. For the first time, there is correct handling " -"of messages with mixed encodings." +"The biggest news for Python 3.2 is that the :mod:`email` " +"package, :mod:`mailbox` module, and :mod:`!nntplib` modules now work " +"correctly with the bytes/text model in Python 3. For the first time, there " +"is correct handling of messages with mixed encodings." msgstr "" #: ../../whatsnew/3.2.rst:669 @@ -1034,18 +1037,19 @@ msgstr "email" msgid "" "The usability of the :mod:`email` package in Python 3 has been mostly fixed " "by the extensive efforts of R. David Murray. The problem was that emails " -"are typically read and stored in the form of :class:`bytes` rather than :" -"class:`str` text, and they may contain multiple encodings within a single " -"email. So, the email package had to be extended to parse and generate email " -"messages in bytes format." +"are typically read and stored in the form of :class:`bytes` rather " +"than :class:`str` text, and they may contain multiple encodings within a " +"single email. So, the email package had to be extended to parse and " +"generate email messages in bytes format." msgstr "" #: ../../whatsnew/3.2.rst:690 msgid "" -"New functions :func:`~email.message_from_bytes` and :func:`~email." -"message_from_binary_file`, and new classes :class:`~email.parser." -"BytesFeedParser` and :class:`~email.parser.BytesParser` allow binary message " -"data to be parsed into model objects." +"New functions :func:`~email.message_from_bytes` " +"and :func:`~email.message_from_binary_file`, and new " +"classes :class:`~email.parser.BytesFeedParser` " +"and :class:`~email.parser.BytesParser` allow binary message data to be " +"parsed into model objects." msgstr "" #: ../../whatsnew/3.2.rst:695 @@ -1065,31 +1069,31 @@ msgstr "" #: ../../whatsnew/3.2.rst:704 msgid "" -"Headers with unencoded non-ASCII bytes are deemed to be :rfc:`2047`\\ -" -"encoded using the *unknown-8bit* character set." +"Headers with unencoded non-ASCII bytes are deemed to be :rfc:`2047`\\ " +"-encoded using the *unknown-8bit* character set." msgstr "" #: ../../whatsnew/3.2.rst:707 msgid "" "A new class :class:`~email.generator.BytesGenerator` produces bytes as " "output, preserving any unchanged non-ASCII data that was present in the " -"input used to build the model, including message bodies with a :mailheader:" -"`Content-Transfer-Encoding` of *8bit*." +"input used to build the model, including message bodies with " +"a :mailheader:`Content-Transfer-Encoding` of *8bit*." msgstr "" #: ../../whatsnew/3.2.rst:712 msgid "" "The :mod:`smtplib` :class:`~smtplib.SMTP` class now accepts a byte string " "for the *msg* argument to the :meth:`~smtplib.SMTP.sendmail` method, and a " -"new method, :meth:`~smtplib.SMTP.send_message` accepts a :class:`~email." -"message.Message` object and can optionally obtain the *from_addr* and " -"*to_addrs* addresses directly from the object." +"new method, :meth:`~smtplib.SMTP.send_message` accepts " +"a :class:`~email.message.Message` object and can optionally obtain the " +"*from_addr* and *to_addrs* addresses directly from the object." msgstr "" #: ../../whatsnew/3.2.rst:718 msgid "" -"(Proposed and implemented by R. David Murray, :issue:`4661` and :issue:" -"`10321`.)" +"(Proposed and implemented by R. David Murray, :issue:`4661` " +"and :issue:`10321`.)" msgstr "" #: ../../whatsnew/3.2.rst:721 @@ -1098,8 +1102,8 @@ msgstr "elementtree" #: ../../whatsnew/3.2.rst:723 msgid "" -"The :mod:`xml.etree.ElementTree` package and its :mod:`!xml.etree." -"cElementTree` counterpart have been updated to version 1.3." +"The :mod:`xml.etree.ElementTree` package and its :mod:`!" +"xml.etree.cElementTree` counterpart have been updated to version 1.3." msgstr "" #: ../../whatsnew/3.2.rst:726 @@ -1168,9 +1172,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:749 msgid "" -"For details of the update, see `Introducing ElementTree <https://web.archive." -"org/web/20200703234532/http://effbot.org/zone/elementtree-13-intro.htm>`_ on " -"Fredrik Lundh's website." +"For details of the update, see `Introducing ElementTree <https://" +"web.archive.org/web/20200703234532/http://effbot.org/zone/elementtree-13-" +"intro.htm>`_ on Fredrik Lundh's website." msgstr "" #: ../../whatsnew/3.2.rst:753 @@ -1209,20 +1213,20 @@ msgstr "" #: ../../whatsnew/3.2.rst:786 msgid "" "(Contributed by Raymond Hettinger and incorporating design ideas from Jim " -"Baker, Miki Tebeka, and Nick Coghlan; see `recipe 498245 <https://code." -"activestate.com/recipes/498245-lru-and-lfu-cache-decorators/>`_\\, `recipe " -"577479 <https://code.activestate.com/recipes/577479-simple-caching-decorator/" -">`_\\, :issue:`10586`, and :issue:`10593`.)" +"Baker, Miki Tebeka, and Nick Coghlan; see `recipe 498245 <https://" +"code.activestate.com/recipes/498245-lru-and-lfu-cache-decorators/>`_\\, " +"`recipe 577479 <https://code.activestate.com/recipes/577479-simple-caching-" +"decorator/>`_\\, :issue:`10586`, and :issue:`10593`.)" msgstr "" #: ../../whatsnew/3.2.rst:792 msgid "" "The :func:`functools.wraps` decorator now adds a :attr:`__wrapped__` " "attribute pointing to the original callable function. This allows wrapped " -"functions to be introspected. It also copies :attr:`~function." -"__annotations__` if defined. And now it also gracefully skips over missing " -"attributes such as :attr:`~function.__doc__` which might not be defined for " -"the wrapped callable." +"functions to be introspected. It also " +"copies :attr:`~function.__annotations__` if defined. And now it also " +"gracefully skips over missing attributes such as :attr:`~function.__doc__` " +"which might not be defined for the wrapped callable." msgstr "" #: ../../whatsnew/3.2.rst:799 @@ -1233,21 +1237,22 @@ msgstr "" #: ../../whatsnew/3.2.rst:804 msgid "" -"(By Nick Coghlan and Terrence Cole; :issue:`9567`, :issue:`3445`, and :issue:" -"`8814`.)" +"(By Nick Coghlan and Terrence Cole; :issue:`9567`, :issue:`3445`, " +"and :issue:`8814`.)" msgstr "" #: ../../whatsnew/3.2.rst:807 msgid "" -"To help write classes with rich comparison methods, a new decorator :func:" -"`functools.total_ordering` will use existing equality and inequality methods " -"to fill in the remaining methods." +"To help write classes with rich comparison methods, a new " +"decorator :func:`functools.total_ordering` will use existing equality and " +"inequality methods to fill in the remaining methods." msgstr "" #: ../../whatsnew/3.2.rst:811 msgid "" -"For example, supplying *__eq__* and *__lt__* will enable :func:`~functools." -"total_ordering` to fill-in *__le__*, *__gt__* and *__ge__*::" +"For example, supplying *__eq__* and *__lt__* will " +"enable :func:`~functools.total_ordering` to fill-in *__le__*, *__gt__* and " +"*__ge__*::" msgstr "" #: ../../whatsnew/3.2.rst:814 @@ -1328,18 +1333,19 @@ msgstr "collections" msgid "" "The :class:`collections.Counter` class now has two forms of in-place " "subtraction, the existing *-=* operator for `saturating subtraction <https://" -"en.wikipedia.org/wiki/Saturation_arithmetic>`_ and the new :meth:" -"`~collections.Counter.subtract` method for regular subtraction. The former " -"is suitable for `multisets <https://en.wikipedia.org/wiki/Multiset>`_ which " -"only have positive counts, and the latter is more suitable for use cases " -"that allow negative counts:" +"en.wikipedia.org/wiki/Saturation_arithmetic>`_ and the " +"new :meth:`~collections.Counter.subtract` method for regular subtraction. " +"The former is suitable for `multisets <https://en.wikipedia.org/wiki/" +"Multiset>`_ which only have positive counts, and the latter is more suitable " +"for use cases that allow negative counts:" msgstr "" #: ../../whatsnew/3.2.rst:885 msgid "" -"The :class:`collections.OrderedDict` class has a new method :meth:" -"`~collections.OrderedDict.move_to_end` which takes an existing key and moves " -"it to either the first or last position in the ordered sequence." +"The :class:`collections.OrderedDict` class has a new " +"method :meth:`~collections.OrderedDict.move_to_end` which takes an existing " +"key and moves it to either the first or last position in the ordered " +"sequence." msgstr "" #: ../../whatsnew/3.2.rst:889 @@ -1357,9 +1363,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:906 msgid "" -"The :class:`collections.deque` class grew two new methods :meth:" -"`~collections.deque.count` and :meth:`~collections.deque.reverse` that make " -"them more substitutable for :class:`list` objects:" +"The :class:`collections.deque` class grew two new " +"methods :meth:`~collections.deque.count` " +"and :meth:`~collections.deque.reverse` that make them more substitutable " +"for :class:`list` objects:" msgstr "" #: ../../whatsnew/3.2.rst:921 @@ -1495,8 +1502,8 @@ msgid "" ">>> from datetime import datetime, timezone\n" "\n" ">>> datetime.now(timezone.utc)\n" -"datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, tzinfo=datetime.timezone." -"utc)\n" +"datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, " +"tzinfo=datetime.timezone.utc)\n" "\n" ">>> datetime.strptime(\"01/01/2000 12:00 +0000\", \"%m/%d/%Y %H:%M %z\")\n" "datetime.datetime(2000, 1, 1, 12, 0, tzinfo=datetime.timezone.utc)" @@ -1504,17 +1511,17 @@ msgstr "" ">>> from datetime import datetime, timezone\n" "\n" ">>> datetime.now(timezone.utc)\n" -"datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, tzinfo=datetime.timezone." -"utc)\n" +"datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, " +"tzinfo=datetime.timezone.utc)\n" "\n" ">>> datetime.strptime(\"01/01/2000 12:00 +0000\", \"%m/%d/%Y %H:%M %z\")\n" "datetime.datetime(2000, 1, 1, 12, 0, tzinfo=datetime.timezone.utc)" #: ../../whatsnew/3.2.rst:1003 msgid "" -"Also, :class:`~datetime.timedelta` objects can now be multiplied by :class:" -"`float` and divided by :class:`float` and :class:`int` objects. And :class:" -"`~datetime.timedelta` objects can now divide one another." +"Also, :class:`~datetime.timedelta` objects can now be multiplied " +"by :class:`float` and divided by :class:`float` and :class:`int` objects. " +"And :class:`~datetime.timedelta` objects can now divide one another." msgstr "" #: ../../whatsnew/3.2.rst:1007 @@ -1533,9 +1540,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:1015 msgid "" -"Starting with Py3.2, use of the century guessing heuristic will emit a :exc:" -"`DeprecationWarning`. Instead, it is recommended that :data:`!time." -"accept2dyear` be set to ``False`` so that large date ranges can be used " +"Starting with Py3.2, use of the century guessing heuristic will emit " +"a :exc:`DeprecationWarning`. Instead, it is recommended that :data:`!" +"time.accept2dyear` be set to ``False`` so that large date ranges can be used " "without guesswork::" msgstr "" @@ -1560,20 +1567,20 @@ msgstr "" msgid "" "Several functions now have significantly expanded date ranges. When :data:`!" "time.accept2dyear` is false, the :func:`time.asctime` function will accept " -"any year that fits in a C int, while the :func:`time.mktime` and :func:`time." -"strftime` functions will accept the full range supported by the " -"corresponding operating system functions." +"any year that fits in a C int, while the :func:`time.mktime` " +"and :func:`time.strftime` functions will accept the full range supported by " +"the corresponding operating system functions." msgstr "" #: ../../whatsnew/3.2.rst:1040 msgid "" -"(Contributed by Alexander Belopolsky and Victor Stinner in :issue:" -"`1289118`, :issue:`5094`, :issue:`6641`, :issue:`2706`, :issue:`1777412`, :" -"issue:`8013`, and :issue:`10827`.)" +"(Contributed by Alexander Belopolsky and Victor Stinner " +"in :issue:`1289118`, :issue:`5094`, :issue:`6641`, :issue:`2706`, :issue:`1777412`, :issue:`8013`, " +"and :issue:`10827`.)" msgstr "" -"(由 Alexander Belopolsky 和 Victor Stinner 在 :issue:`1289118`、:issue:" -"`5094`、:issue:`6641`、:issue:`2706`、:issue:`1777412`、:issue:`8013` 和 :" -"issue:`10827` 中貢獻。)" +"(由 Alexander Belopolsky 和 Victor Stinner " +"在 :issue:`1289118`、:issue:`5094`、:issue:`6641`、:issue:`2706`、:issue:`1777412`、:issue:`8013` " +"和 :issue:`10827` 中貢獻。)" #: ../../whatsnew/3.2.rst:1047 msgid "math" @@ -1638,8 +1645,8 @@ msgstr "abc" #: ../../whatsnew/3.2.rst:1100 msgid "" -"The :mod:`abc` module now supports :func:`~abc.abstractclassmethod` and :" -"func:`~abc.abstractstaticmethod`." +"The :mod:`abc` module now supports :func:`~abc.abstractclassmethod` " +"and :func:`~abc.abstractstaticmethod`." msgstr "" #: ../../whatsnew/3.2.rst:1103 @@ -1739,9 +1746,9 @@ msgstr "reprlib" msgid "" "When writing a :meth:`~object.__repr__` method for a custom container, it is " "easy to forget to handle the case where a member refers back to the " -"container itself. Python's builtin objects such as :class:`list` and :class:" -"`set` handle self-reference by displaying \"...\" in the recursive part of " -"the representation string." +"container itself. Python's builtin objects such as :class:`list` " +"and :class:`set` handle self-reference by displaying \"...\" in the " +"recursive part of the representation string." msgstr "" #: ../../whatsnew/3.2.rst:1157 @@ -1786,8 +1793,8 @@ msgstr "logging" #: ../../whatsnew/3.2.rst:1177 msgid "" -"In addition to dictionary-based configuration described above, the :mod:" -"`logging` package has many other improvements." +"In addition to dictionary-based configuration described above, " +"the :mod:`logging` package has many other improvements." msgstr "" #: ../../whatsnew/3.2.rst:1180 @@ -1802,42 +1809,42 @@ msgstr "" msgid "" "The :func:`logging.basicConfig` set-up function gained a *style* argument to " "support three different types of string formatting. It defaults to \"%\" " -"for traditional %-formatting, can be set to \"{\" for the new :meth:`str." -"format` style, or can be set to \"$\" for the shell-style formatting " -"provided by :class:`string.Template`. The following three configurations " -"are equivalent::" +"for traditional %-formatting, can be set to \"{\" for the " +"new :meth:`str.format` style, or can be set to \"$\" for the shell-style " +"formatting provided by :class:`string.Template`. The following three " +"configurations are equivalent::" msgstr "" #: ../../whatsnew/3.2.rst:1191 msgid "" ">>> from logging import basicConfig\n" -">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: " -"%(message)s\")\n" +">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: %" +"(message)s\")\n" ">>> basicConfig(style='{', format=\"{name} -> {levelname} {message}\")\n" ">>> basicConfig(style='$', format=\"$name -> $levelname: $message\")" msgstr "" ">>> from logging import basicConfig\n" -">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: " -"%(message)s\")\n" +">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: %" +"(message)s\")\n" ">>> basicConfig(style='{', format=\"{name} -> {levelname} {message}\")\n" ">>> basicConfig(style='$', format=\"$name -> $levelname: $message\")" #: ../../whatsnew/3.2.rst:1196 msgid "" "If no configuration is set-up before a logging event occurs, there is now a " -"default configuration using a :class:`~logging.StreamHandler` directed to :" -"data:`sys.stderr` for events of ``WARNING`` level or higher. Formerly, an " -"event occurring before a configuration was set-up would either raise an " -"exception or silently drop the event depending on the value of :data:" -"`logging.raiseExceptions`. The new default handler is stored in :data:" -"`logging.lastResort`." +"default configuration using a :class:`~logging.StreamHandler` directed " +"to :data:`sys.stderr` for events of ``WARNING`` level or higher. Formerly, " +"an event occurring before a configuration was set-up would either raise an " +"exception or silently drop the event depending on the value " +"of :data:`logging.raiseExceptions`. The new default handler is stored " +"in :data:`logging.lastResort`." msgstr "" #: ../../whatsnew/3.2.rst:1204 msgid "" -"The use of filters has been simplified. Instead of creating a :class:" -"`~logging.Filter` object, the predicate can be any Python callable that " -"returns ``True`` or ``False``." +"The use of filters has been simplified. Instead of creating " +"a :class:`~logging.Filter` object, the predicate can be any Python callable " +"that returns ``True`` or ``False``." msgstr "" #: ../../whatsnew/3.2.rst:1208 @@ -1853,16 +1860,17 @@ msgstr "csv" #: ../../whatsnew/3.2.rst:1215 msgid "" -"The :mod:`csv` module now supports a new dialect, :class:`~csv." -"unix_dialect`, which applies quoting for all fields and a traditional Unix " -"style with ``'\\n'`` as the line terminator. The registered dialect name is " -"``unix``." +"The :mod:`csv` module now supports a new " +"dialect, :class:`~csv.unix_dialect`, which applies quoting for all fields " +"and a traditional Unix style with ``'\\n'`` as the line terminator. The " +"registered dialect name is ``unix``." msgstr "" #: ../../whatsnew/3.2.rst:1219 msgid "" -"The :class:`csv.DictWriter` has a new method, :meth:`~csv.DictWriter." -"writeheader` for writing-out an initial row to document the field names::" +"The :class:`csv.DictWriter` has a new " +"method, :meth:`~csv.DictWriter.writeheader` for writing-out an initial row " +"to document the field names::" msgstr "" #: ../../whatsnew/3.2.rst:1223 @@ -1899,15 +1907,16 @@ msgstr "contextlib" #: ../../whatsnew/3.2.rst:1239 msgid "" -"There is a new and slightly mind-blowing tool :class:`~contextlib." -"ContextDecorator` that is helpful for creating a :term:`context manager` " -"that does double duty as a function decorator." +"There is a new and slightly mind-blowing " +"tool :class:`~contextlib.ContextDecorator` that is helpful for creating " +"a :term:`context manager` that does double duty as a function decorator." msgstr "" #: ../../whatsnew/3.2.rst:1243 msgid "" -"As a convenience, this new functionality is used by :func:`~contextlib." -"contextmanager` so that no extra effort is needed to support both roles." +"As a convenience, this new functionality is used " +"by :func:`~contextlib.contextmanager` so that no extra effort is needed to " +"support both roles." msgstr "" #: ../../whatsnew/3.2.rst:1247 @@ -2016,10 +2025,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:1303 msgid "" -"Some of the hashing details are exposed through a new attribute, :data:`sys." -"hash_info`, which describes the bit width of the hash value, the prime " -"modulus, the hash values for *infinity* and *nan*, and the multiplier used " -"for the imaginary part of a number:" +"Some of the hashing details are exposed through a new " +"attribute, :data:`sys.hash_info`, which describes the bit width of the hash " +"value, the prime modulus, the hash values for *infinity* and *nan*, and the " +"multiplier used for the imaginary part of a number:" msgstr "" #: ../../whatsnew/3.2.rst:1311 @@ -2036,30 +2045,32 @@ msgstr "" #: ../../whatsnew/3.2.rst:1319 msgid "" "The :class:`decimal.Decimal` constructor now accepts :class:`float` objects " -"directly so there in no longer a need to use the :meth:`~decimal.Decimal." -"from_float` method (:issue:`8257`)." +"directly so there in no longer a need to use " +"the :meth:`~decimal.Decimal.from_float` method (:issue:`8257`)." msgstr "" #: ../../whatsnew/3.2.rst:1323 msgid "" -"Mixed type comparisons are now fully supported so that :class:`~decimal." -"Decimal` objects can be directly compared with :class:`float` and :class:" -"`fractions.Fraction` (:issue:`2531` and :issue:`8188`)." +"Mixed type comparisons are now fully supported so " +"that :class:`~decimal.Decimal` objects can be directly compared " +"with :class:`float` and :class:`fractions.Fraction` (:issue:`2531` " +"and :issue:`8188`)." msgstr "" #: ../../whatsnew/3.2.rst:1327 msgid "" -"Similar changes were made to :class:`fractions.Fraction` so that the :meth:" -"`~fractions.Fraction.from_float` and :meth:`~fractions.Fraction." -"from_decimal` methods are no longer needed (:issue:`8294`):" +"Similar changes were made to :class:`fractions.Fraction` so that " +"the :meth:`~fractions.Fraction.from_float` " +"and :meth:`~fractions.Fraction.from_decimal` methods are no longer needed " +"(:issue:`8294`):" msgstr "" #: ../../whatsnew/3.2.rst:1338 msgid "" -"Another useful change for the :mod:`decimal` module is that the :attr:" -"`Context.clamp <decimal.Context.clamp>` attribute is now public. This is " -"useful in creating contexts that correspond to the decimal interchange " -"formats specified in IEEE 754 (see :issue:`8540`)." +"Another useful change for the :mod:`decimal` module is that " +"the :attr:`Context.clamp <decimal.Context.clamp>` attribute is now public. " +"This is useful in creating contexts that correspond to the decimal " +"interchange formats specified in IEEE 754 (see :issue:`8540`)." msgstr "" #: ../../whatsnew/3.2.rst:1343 @@ -2103,8 +2114,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:1363 msgid "" -"Other file-like objects such as :class:`mmap.mmap` and :func:`fileinput." -"input` also grew auto-closing context managers::" +"Other file-like objects such as :class:`mmap.mmap` " +"and :func:`fileinput.input` also grew auto-closing context managers::" msgstr "" #: ../../whatsnew/3.2.rst:1366 @@ -2143,14 +2154,14 @@ msgstr "popen" #: ../../whatsnew/3.2.rst:1382 msgid "" -"The :func:`os.popen` and :func:`subprocess.Popen` functions now support :" -"keyword:`with` statements for auto-closing of the file descriptors." +"The :func:`os.popen` and :func:`subprocess.Popen` functions now " +"support :keyword:`with` statements for auto-closing of the file descriptors." msgstr "" #: ../../whatsnew/3.2.rst:1385 msgid "" -"(Contributed by Antoine Pitrou and Brian Curtin in :issue:`7461` and :issue:" -"`10554`.)" +"(Contributed by Antoine Pitrou and Brian Curtin in :issue:`7461` " +"and :issue:`10554`.)" msgstr "" "(由 Antoine Pitrou 和 Brian Curtin 在 :issue:`7461` 和 :issue:`10554` 中貢" "獻。)" @@ -2161,10 +2172,10 @@ msgstr "select" #: ../../whatsnew/3.2.rst:1391 msgid "" -"The :mod:`select` module now exposes a new, constant attribute, :const:" -"`~select.PIPE_BUF`, which gives the minimum number of bytes which are " -"guaranteed not to block when :func:`select.select` says a pipe is ready for " -"writing." +"The :mod:`select` module now exposes a new, constant " +"attribute, :const:`~select.PIPE_BUF`, which gives the minimum number of " +"bytes which are guaranteed not to block when :func:`select.select` says a " +"pipe is ready for writing." msgstr "" #: ../../whatsnew/3.2.rst:1400 @@ -2177,16 +2188,16 @@ msgstr "gzip 和 zipfile" #: ../../whatsnew/3.2.rst:1405 msgid "" -":class:`gzip.GzipFile` now implements the :class:`io.BufferedIOBase` :term:" -"`abstract base class` (except for ``truncate()``). It also has a :meth:" -"`~gzip.GzipFile.peek` method and supports unseekable as well as zero-padded " -"file objects." +":class:`gzip.GzipFile` now implements " +"the :class:`io.BufferedIOBase` :term:`abstract base class` (except for " +"``truncate()``). It also has a :meth:`~gzip.GzipFile.peek` method and " +"supports unseekable as well as zero-padded file objects." msgstr "" #: ../../whatsnew/3.2.rst:1410 msgid "" -"The :mod:`gzip` module also gains the :func:`~gzip.compress` and :func:" -"`~gzip.decompress` functions for easier in-memory compression and " +"The :mod:`gzip` module also gains the :func:`~gzip.compress` " +"and :func:`~gzip.decompress` functions for easier in-memory compression and " "decompression. Keep in mind that text needs to be encoded as :class:`bytes` " "before compressing and decompressing:" msgstr "" @@ -2198,16 +2209,17 @@ msgid "" "and :issue:`2846`.)" msgstr "" "(由 Anand B. Pillai 在 :issue:`3488` 中貢獻;由 Antoine Pitrou、Nir Aides " -"和 Brian Curtin 在 :issue:`9962`、:issue:`1675951`、:issue:`7471` 和 :issue:" -"`2846` 中貢獻。)" +"和 Brian Curtin 在 :issue:`9962`、:issue:`1675951`、:issue:`7471` " +"和 :issue:`2846` 中貢獻。)" #: ../../whatsnew/3.2.rst:1431 msgid "" "Also, the :class:`zipfile.ZipExtFile <zipfile.ZipFile.open>` class was " "reworked internally to represent files stored inside an archive. The new " -"implementation is significantly faster and can be wrapped in an :class:`io." -"BufferedReader` object for more speedups. It also solves an issue where " -"interleaved calls to *read* and *readline* gave the wrong results." +"implementation is significantly faster and can be wrapped in " +"an :class:`io.BufferedReader` object for more speedups. It also solves an " +"issue where interleaved calls to *read* and *readline* gave the wrong " +"results." msgstr "" #: ../../whatsnew/3.2.rst:1437 @@ -2231,9 +2243,9 @@ msgid "" "The new *filter* option replaces the older, less flexible *exclude* " "parameter which is now deprecated. If specified, the optional *filter* " "parameter needs to be a :term:`keyword argument`. The user-supplied filter " -"function accepts a :class:`~tarfile.TarInfo` object and returns an updated :" -"class:`~tarfile.TarInfo` object, or if it wants the file to be excluded, the " -"function can return ``None``::" +"function accepts a :class:`~tarfile.TarInfo` object and returns an " +"updated :class:`~tarfile.TarInfo` object, or if it wants the file to be " +"excluded, the function can return ``None``::" msgstr "" #: ../../whatsnew/3.2.rst:1454 @@ -2309,11 +2321,12 @@ msgstr "ast" #: ../../whatsnew/3.2.rst:1496 msgid "" "The :mod:`ast` module has a wonderful a general-purpose tool for safely " -"evaluating expression strings using the Python literal syntax. The :func:" -"`ast.literal_eval` function serves as a secure alternative to the builtin :" -"func:`eval` function which is easily abused. Python 3.2 adds :class:`bytes` " -"and :class:`set` literals to the list of supported types: strings, bytes, " -"numbers, tuples, lists, dicts, sets, booleans, and ``None``." +"evaluating expression strings using the Python literal syntax. " +"The :func:`ast.literal_eval` function serves as a secure alternative to the " +"builtin :func:`eval` function which is easily abused. Python 3.2 " +"adds :class:`bytes` and :class:`set` literals to the list of supported " +"types: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and " +"``None``." msgstr "" #: ../../whatsnew/3.2.rst:1505 @@ -2353,9 +2366,9 @@ msgstr "os" #: ../../whatsnew/3.2.rst:1522 msgid "" "Different operating systems use various encodings for filenames and " -"environment variables. The :mod:`os` module provides two new functions, :" -"func:`~os.fsencode` and :func:`~os.fsdecode`, for encoding and decoding " -"filenames:" +"environment variables. The :mod:`os` module provides two new " +"functions, :func:`~os.fsencode` and :func:`~os.fsdecode`, for encoding and " +"decoding filenames:" msgstr "" #: ../../whatsnew/3.2.rst:1532 @@ -2393,8 +2406,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:1551 msgid "" -"*copy_function*: is a callable that will be used to copy files. :func:" -"`shutil.copy2` is used by default." +"*copy_function*: is a callable that will be used to copy " +"files. :func:`shutil.copy2` is used by default." msgstr "" #: ../../whatsnew/3.2.rst:1554 ../../whatsnew/3.2.rst:1592 @@ -2412,11 +2425,11 @@ msgstr "" #: ../../whatsnew/3.2.rst:1561 msgid "" -"The principal functions are :func:`~shutil.make_archive` and :func:`~shutil." -"unpack_archive`. By default, both operate on the current directory (which " -"can be set by :func:`os.chdir`) and on any sub-directories. The archive " -"filename needs to be specified with a full pathname. The archiving step is " -"non-destructive (the original files are left unchanged)." +"The principal functions are :func:`~shutil.make_archive` " +"and :func:`~shutil.unpack_archive`. By default, both operate on the current " +"directory (which can be set by :func:`os.chdir`) and on any sub-directories. " +"The archive filename needs to be specified with a full pathname. The " +"archiving step is non-destructive (the original files are left unchanged)." msgstr "" #: ../../whatsnew/3.2.rst:1569 @@ -2463,10 +2476,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:1602 msgid "" -"The :meth:`sqlite3.Connection.enable_load_extension` and :meth:`sqlite3." -"Connection.load_extension` methods allows you to load SQLite extensions from " -"\".so\" files. One well-known extension is the fulltext-search extension " -"distributed with SQLite." +"The :meth:`sqlite3.Connection.enable_load_extension` " +"and :meth:`sqlite3.Connection.load_extension` methods allows you to load " +"SQLite extensions from \".so\" files. One well-known extension is the " +"fulltext-search extension distributed with SQLite." msgstr "" #: ../../whatsnew/3.2.rst:1607 @@ -2479,9 +2492,9 @@ msgstr "html" #: ../../whatsnew/3.2.rst:1612 msgid "" -"A new :mod:`html` module was introduced with only a single function, :func:" -"`~html.escape`, which is used for escaping reserved characters from HTML " -"markup:" +"A new :mod:`html` module was introduced with only a single " +"function, :func:`~html.escape`, which is used for escaping reserved " +"characters from HTML markup:" msgstr "" #: ../../whatsnew/3.2.rst:1621 @@ -2552,8 +2565,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:1661 msgid "" -"Various options have been added to the :mod:`ssl` module, such as :data:" -"`~ssl.OP_NO_SSLv2` which disables the insecure and obsolete SSLv2 protocol." +"Various options have been added to the :mod:`ssl` module, such " +"as :data:`~ssl.OP_NO_SSLv2` which disables the insecure and obsolete SSLv2 " +"protocol." msgstr "" #: ../../whatsnew/3.2.rst:1665 @@ -2566,18 +2580,20 @@ msgstr "" #: ../../whatsnew/3.2.rst:1669 msgid "" "The version of OpenSSL being used is now accessible using the module " -"attributes :const:`ssl.OPENSSL_VERSION` (a string), :const:`ssl." -"OPENSSL_VERSION_INFO` (a 5-tuple), and :const:`ssl.OPENSSL_VERSION_NUMBER` " -"(an integer)." +"attributes :const:`ssl.OPENSSL_VERSION` (a " +"string), :const:`ssl.OPENSSL_VERSION_INFO` (a 5-tuple), " +"and :const:`ssl.OPENSSL_VERSION_NUMBER` (an integer)." msgstr "" #: ../../whatsnew/3.2.rst:1674 msgid "" -"(Contributed by Antoine Pitrou in :issue:`8850`, :issue:`1589`, :issue:" -"`8322`, :issue:`5639`, :issue:`4870`, :issue:`8484`, and :issue:`8321`.)" +"(Contributed by Antoine Pitrou " +"in :issue:`8850`, :issue:`1589`, :issue:`8322`, :issue:`5639`, :issue:`4870`, :issue:`8484`, " +"and :issue:`8321`.)" msgstr "" -"(由 Antoine Pitrou 在 :issue:`8850`、:issue:`1589`、:issue:`8322`、:issue:" -"`5639`、:issue:`4870`、:issue:`8484` 和 :issue:`8321` 中貢獻。)" +"(由 Antoine Pitrou " +"在 :issue:`8850`、:issue:`1589`、:issue:`8322`、:issue:`5639`、:issue:`4870`、:issue:`8484` " +"和 :issue:`8321` 中貢獻。)" #: ../../whatsnew/3.2.rst:1678 msgid "nntp" @@ -2593,15 +2609,15 @@ msgstr "" #: ../../whatsnew/3.2.rst:1685 msgid "" -"Support for secure connections through both implicit (using :class:`!nntplib." -"NNTP_SSL`) and explicit (using :meth:`!nntplib.NNTP.starttls`) TLS has also " -"been added." +"Support for secure connections through both implicit (using :class:`!" +"nntplib.NNTP_SSL`) and explicit (using :meth:`!nntplib.NNTP.starttls`) TLS " +"has also been added." msgstr "" #: ../../whatsnew/3.2.rst:1689 msgid "" -"(Contributed by Antoine Pitrou in :issue:`9360` and Andrew Vant in :issue:" -"`1926`.)" +"(Contributed by Antoine Pitrou in :issue:`9360` and Andrew Vant " +"in :issue:`1926`.)" msgstr "" "(由 Antoine Pitrou 在 :issue:`9360` 中和 Andrew Vant 在 :issue:`1926` 中貢" "獻。)" @@ -2649,15 +2665,16 @@ msgstr "" #: ../../whatsnew/3.2.rst:1716 msgid "" -"The :class:`~http.client.HTTPConnection` and :class:`~http.client." -"HTTPSConnection` classes now have a *source_address* parameter for a (host, " -"port) tuple indicating where the HTTP connection is made from." +"The :class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` classes now have a " +"*source_address* parameter for a (host, port) tuple indicating where the " +"HTTP connection is made from." msgstr "" #: ../../whatsnew/3.2.rst:1721 msgid "" -"Support for certificate checking and HTTPS virtual hosts were added to :" -"class:`~http.client.HTTPSConnection`." +"Support for certificate checking and HTTPS virtual hosts were added " +"to :class:`~http.client.HTTPSConnection`." msgstr "" #: ../../whatsnew/3.2.rst:1724 @@ -2672,9 +2689,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:1731 msgid "" -"To establish an HTTPS connection through a proxy server, there is a new :" -"meth:`~http.client.HTTPConnection.set_tunnel` method that sets the host and " -"port for HTTP Connect tunneling." +"To establish an HTTPS connection through a proxy server, there is a " +"new :meth:`~http.client.HTTPConnection.set_tunnel` method that sets the host " +"and port for HTTP Connect tunneling." msgstr "" #: ../../whatsnew/3.2.rst:1735 @@ -2682,8 +2699,8 @@ msgid "" "To match the behavior of :mod:`http.server`, the HTTP client library now " "also encodes headers with ISO-8859-1 (Latin-1) encoding. It was already " "doing that for incoming headers, so now the behavior is consistent for both " -"incoming and outgoing traffic. (See work by Armin Ronacher in :issue:" -"`10980`.)" +"incoming and outgoing traffic. (See work by Armin Ronacher " +"in :issue:`10980`.)" msgstr "" #: ../../whatsnew/3.2.rst:1741 @@ -2719,15 +2736,17 @@ msgstr "(由 Michael Foord 貢獻。)" #: ../../whatsnew/3.2.rst:1761 msgid "" -"Experimentation at the interactive prompt is now easier because the :class:" -"`unittest.TestCase` class can now be instantiated without arguments:" +"Experimentation at the interactive prompt is now easier because " +"the :class:`unittest.TestCase` class can now be instantiated without " +"arguments:" msgstr "" #: ../../whatsnew/3.2.rst:1770 msgid "" -"The :mod:`unittest` module has two new methods, :meth:`~unittest.TestCase." -"assertWarns` and :meth:`~unittest.TestCase.assertWarnsRegex` to verify that " -"a given warning type is triggered by the code under test::" +"The :mod:`unittest` module has two new " +"methods, :meth:`~unittest.TestCase.assertWarns` " +"and :meth:`~unittest.TestCase.assertWarnsRegex` to verify that a given " +"warning type is triggered by the code under test::" msgstr "" #: ../../whatsnew/3.2.rst:1775 @@ -2776,12 +2795,13 @@ msgstr "" #: ../../whatsnew/3.2.rst:1799 msgid "" -"For example, :meth:`~unittest.TestCase.assertRegex` is the new name for :" -"meth:`!assertRegexpMatches` which was misnamed because the test uses :func:" -"`re.search`, not :func:`re.match`. Other methods using regular expressions " -"are now named using short form \"Regex\" in preference to \"Regexp\" -- this " -"matches the names used in other unittest implementations, matches Python's " -"old name for the :mod:`re` module, and it has unambiguous camel-casing." +"For example, :meth:`~unittest.TestCase.assertRegex` is the new name " +"for :meth:`!assertRegexpMatches` which was misnamed because the test " +"uses :func:`re.search`, not :func:`re.match`. Other methods using regular " +"expressions are now named using short form \"Regex\" in preference to " +"\"Regexp\" -- this matches the names used in other unittest implementations, " +"matches Python's old name for the :mod:`re` module, and it has unambiguous " +"camel-casing." msgstr "" #: ../../whatsnew/3.2.rst:1807 @@ -2856,8 +2876,8 @@ msgstr "(由 Ezio Melotti 貢獻;:issue:`9424`。)" msgid "" "The :meth:`!assertDictContainsSubset` method was deprecated because it was " "misimplemented with the arguments in the wrong order. This created hard-to-" -"debug optical illusions where tests like ``TestCase()." -"assertDictContainsSubset({'a':1, 'b':2}, {'a':1})`` would fail." +"debug optical illusions where tests like " +"``TestCase().assertDictContainsSubset({'a':1, 'b':2}, {'a':1})`` would fail." msgstr "" #: ../../whatsnew/3.2.rst:1835 @@ -2871,9 +2891,9 @@ msgid "" "``int(n*random())`` which had a slight bias whenever *n* was not a power of " "two. Now, multiple selections are made from a range up to the next power of " "two and a selection is kept only when it falls within the range ``0 <= x < " -"n``. The functions and methods affected are :func:`~random.randrange`, :" -"func:`~random.randint`, :func:`~random.choice`, :func:`~random.shuffle` and :" -"func:`~random.sample`." +"n``. The functions and methods affected " +"are :func:`~random.randrange`, :func:`~random.randint`, :func:`~random.choice`, :func:`~random.shuffle` " +"and :func:`~random.sample`." msgstr "" #: ../../whatsnew/3.2.rst:1846 @@ -2919,9 +2939,9 @@ msgstr "tempfile" #: ../../whatsnew/3.2.rst:1873 msgid "" -"The :mod:`tempfile` module has a new context manager, :class:`~tempfile." -"TemporaryDirectory` which provides easy deterministic cleanup of temporary " -"directories::" +"The :mod:`tempfile` module has a new context " +"manager, :class:`~tempfile.TemporaryDirectory` which provides easy " +"deterministic cleanup of temporary directories::" msgstr "" #: ../../whatsnew/3.2.rst:1877 @@ -2942,9 +2962,9 @@ msgstr "inspect" #: ../../whatsnew/3.2.rst:1885 msgid "" -"The :mod:`inspect` module has a new function :func:`~inspect." -"getgeneratorstate` to easily identify the current state of a generator-" -"iterator::" +"The :mod:`inspect` module has a new " +"function :func:`~inspect.getgeneratorstate` to easily identify the current " +"state of a generator-iterator::" msgstr "" #: ../../whatsnew/3.2.rst:1889 @@ -2986,9 +3006,9 @@ msgstr "(由 Rodolfo Eckhardt 和 Nick Coghlan 於 :issue:`10220` 貢獻。) #: ../../whatsnew/3.2.rst:1906 msgid "" "To support lookups without the possibility of activating a dynamic " -"attribute, the :mod:`inspect` module has a new function, :func:`~inspect." -"getattr_static`. Unlike :func:`hasattr`, this is a true read-only search, " -"guaranteed not to change state while it is searching::" +"attribute, the :mod:`inspect` module has a new " +"function, :func:`~inspect.getattr_static`. Unlike :func:`hasattr`, this is a " +"true read-only search, guaranteed not to change state while it is searching::" msgstr "" #: ../../whatsnew/3.2.rst:1911 @@ -3044,10 +3064,11 @@ msgstr "dis" #: ../../whatsnew/3.2.rst:1942 msgid "" -"The :mod:`dis` module gained two new functions for inspecting code, :func:" -"`~dis.code_info` and :func:`~dis.show_code`. Both provide detailed code " -"object information for the supplied function, method, source code string or " -"code object. The former returns a string and the latter prints it::" +"The :mod:`dis` module gained two new functions for inspecting " +"code, :func:`~dis.code_info` and :func:`~dis.show_code`. Both provide " +"detailed code object information for the supplied function, method, source " +"code string or code object. The former returns a string and the latter " +"prints it::" msgstr "" #: ../../whatsnew/3.2.rst:1947 @@ -3392,8 +3413,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:2117 msgid "" -":file:`pdb.py` now has a ``-c`` option that executes commands as given in a :" -"file:`.pdbrc` script file." +":file:`pdb.py` now has a ``-c`` option that executes commands as given in " +"a :file:`.pdbrc` script file." msgstr "" #: ../../whatsnew/3.2.rst:2119 @@ -3440,12 +3461,12 @@ msgstr "configparser" #: ../../whatsnew/3.2.rst:2135 msgid "" "The :mod:`configparser` module was modified to improve usability and " -"predictability of the default parser and its supported INI syntax. The old :" -"class:`!ConfigParser` class was removed in favor of :class:`!" -"SafeConfigParser` which has in turn been renamed to :class:`~configparser." -"ConfigParser`. Support for inline comments is now turned off by default and " -"section or option duplicates are not allowed in a single configuration " -"source." +"predictability of the default parser and its supported INI syntax. The " +"old :class:`!ConfigParser` class was removed in favor of :class:`!" +"SafeConfigParser` which has in turn been renamed " +"to :class:`~configparser.ConfigParser`. Support for inline comments is now " +"turned off by default and section or option duplicates are not allowed in a " +"single configuration source." msgstr "" #: ../../whatsnew/3.2.rst:2142 @@ -3610,8 +3631,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:2223 msgid "" -"The :func:`~urllib.parse.urlparse` function now supports `IPv6 <https://en." -"wikipedia.org/wiki/IPv6>`_ addresses as described in :rfc:`2732`:" +"The :func:`~urllib.parse.urlparse` function now supports `IPv6 <https://" +"en.wikipedia.org/wiki/IPv6>`_ addresses as described in :rfc:`2732`:" msgstr "" #: ../../whatsnew/3.2.rst:2235 @@ -3642,8 +3663,8 @@ msgstr "" msgid "" "And, the :func:`~urllib.parse.urlencode` function is now much more flexible, " "accepting either a string or bytes type for the *query* argument. If it is " -"a string, then the *safe*, *encoding*, and *error* parameters are sent to :" -"func:`~urllib.parse.quote_plus` for encoding::" +"a string, then the *safe*, *encoding*, and *error* parameters are sent " +"to :func:`~urllib.parse.quote_plus` for encoding::" msgstr "" #: ../../whatsnew/3.2.rst:2250 @@ -3662,17 +3683,17 @@ msgstr "" #: ../../whatsnew/3.2.rst:2256 msgid "" -"As detailed in :ref:`parsing-ascii-encoded-bytes`, all the :mod:`urllib." -"parse` functions now accept ASCII-encoded byte strings as input, so long as " -"they are not mixed with regular strings. If ASCII-encoded byte strings are " -"given as parameters, the return types will also be an ASCII-encoded byte " -"strings:" +"As detailed in :ref:`parsing-ascii-encoded-bytes`, all " +"the :mod:`urllib.parse` functions now accept ASCII-encoded byte strings as " +"input, so long as they are not mixed with regular strings. If ASCII-encoded " +"byte strings are given as parameters, the return types will also be an ASCII-" +"encoded byte strings:" msgstr "" #: ../../whatsnew/3.2.rst:2265 msgid "" -"(Work by Nick Coghlan, Dan Mahn, and Senthil Kumaran in :issue:`2987`, :" -"issue:`5468`, and :issue:`9873`.)" +"(Work by Nick Coghlan, Dan Mahn, and Senthil Kumaran " +"in :issue:`2987`, :issue:`5468`, and :issue:`9873`.)" msgstr "" #: ../../whatsnew/3.2.rst:2269 @@ -3697,8 +3718,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:2280 msgid "" -"As expected, the :meth:`~mailbox.Mailbox.add` method for :class:`mailbox." -"Mailbox` objects now accepts binary input." +"As expected, the :meth:`~mailbox.Mailbox.add` method " +"for :class:`mailbox.Mailbox` objects now accepts binary input." msgstr "" #: ../../whatsnew/3.2.rst:2283 @@ -3710,19 +3731,19 @@ msgstr "" #: ../../whatsnew/3.2.rst:2287 msgid "" -"There is also support for binary output. The :meth:`~mailbox.Mailbox." -"get_file` method now returns a file in the binary mode (where it used to " -"incorrectly set the file to text-mode). There is also a new :meth:`~mailbox." -"Mailbox.get_bytes` method that returns a :class:`bytes` representation of a " -"message corresponding to a given *key*." +"There is also support for binary output. " +"The :meth:`~mailbox.Mailbox.get_file` method now returns a file in the " +"binary mode (where it used to incorrectly set the file to text-mode). There " +"is also a new :meth:`~mailbox.Mailbox.get_bytes` method that returns " +"a :class:`bytes` representation of a message corresponding to a given *key*." msgstr "" #: ../../whatsnew/3.2.rst:2293 msgid "" -"It is still possible to get non-binary output using the old API's :meth:" -"`~mailbox.Mailbox.get_string` method, but that approach is not very useful. " -"Instead, it is best to extract messages from a :class:`~mailbox.Message` " -"object or to load them from binary input." +"It is still possible to get non-binary output using the old " +"API's :meth:`~mailbox.Mailbox.get_string` method, but that approach is not " +"very useful. Instead, it is best to extract messages from " +"a :class:`~mailbox.Message` object or to load them from binary input." msgstr "" #: ../../whatsnew/3.2.rst:2298 @@ -3764,8 +3785,9 @@ msgid "" "intervals and reduced overhead due to lock contention and the number of " "ensuing system calls. The notion of a \"check interval\" to allow thread " "switches has been abandoned and replaced by an absolute duration expressed " -"in seconds. This parameter is tunable through :func:`sys." -"setswitchinterval`. It currently defaults to 5 milliseconds." +"in seconds. This parameter is tunable " +"through :func:`sys.setswitchinterval`. It currently defaults to 5 " +"milliseconds." msgstr "" #: ../../whatsnew/3.2.rst:2327 @@ -3850,13 +3872,13 @@ msgid "" "(Contributed by Alexandre Vassalotti, Antoine Pitrou and the Unladen Swallow " "team in :issue:`9410` and :issue:`3873`.)" msgstr "" -"(由 Alexandre Vassalotti、Antoine Pitrou 和 Unladen Swallow 團隊在 :issue:" -"`9410` 和 :issue:`3873` 中貢獻。)" +"(由 Alexandre Vassalotti、Antoine Pitrou 和 Unladen Swallow 團隊" +"在 :issue:`9410` 和 :issue:`3873` 中貢獻。)" #: ../../whatsnew/3.2.rst:2374 msgid "" -"The `Timsort algorithm <https://en.wikipedia.org/wiki/Timsort>`_ used in :" -"meth:`list.sort` and :func:`sorted` now runs faster and uses less memory " +"The `Timsort algorithm <https://en.wikipedia.org/wiki/Timsort>`_ used " +"in :meth:`list.sort` and :func:`sorted` now runs faster and uses less memory " "when called with a :term:`key function`. Previously, every element of a " "list was wrapped with a temporary object that remembered the key value " "associated with each element. Now, two arrays of keys and values are sorted " @@ -3896,11 +3918,12 @@ msgstr "(由 Antoine Pitrou 貢獻;:issue:`3001`。)" #: ../../whatsnew/3.2.rst:2397 msgid "" -"The fast-search algorithm in stringlib is now used by the :meth:`~str." -"split`, :meth:`~str.rsplit`, :meth:`~str.splitlines` and :meth:`~str." -"replace` methods on :class:`bytes`, :class:`bytearray` and :class:`str` " -"objects. Likewise, the algorithm is also used by :meth:`~str.rfind`, :meth:" -"`~str.rindex`, :meth:`~str.rsplit` and :meth:`~str.rpartition`." +"The fast-search algorithm in stringlib is now used by " +"the :meth:`~str.split`, :meth:`~str.rsplit`, :meth:`~str.splitlines` " +"and :meth:`~str.replace` methods on :class:`bytes`, :class:`bytearray` " +"and :class:`str` objects. Likewise, the algorithm is also used " +"by :meth:`~str.rfind`, :meth:`~str.rindex`, :meth:`~str.rsplit` " +"and :meth:`~str.rpartition`." msgstr "" #: ../../whatsnew/3.2.rst:2403 @@ -3922,12 +3945,12 @@ msgid "" "There were several other minor optimizations. Set differencing now runs " "faster when one operand is much larger than the other (patch by Andress " "Bennetts in :issue:`8685`). The :meth:`!array.repeat` method has a faster " -"implementation (:issue:`1569291` by Alexander Belopolsky). The :class:`~http." -"server.BaseHTTPRequestHandler` has more efficient buffering (:issue:`3709` " -"by Andrew Schaaf). The :func:`operator.attrgetter` function has been sped-" -"up (:issue:`10160` by Christos Georgiou). And :class:`~configparser." -"ConfigParser` loads multi-line arguments a bit faster (:issue:`7113` by " -"Łukasz Langa)." +"implementation (:issue:`1569291` by Alexander Belopolsky). " +"The :class:`~http.server.BaseHTTPRequestHandler` has more efficient " +"buffering (:issue:`3709` by Andrew Schaaf). The :func:`operator.attrgetter` " +"function has been sped-up (:issue:`10160` by Christos Georgiou). " +"And :class:`~configparser.ConfigParser` loads multi-line arguments a bit " +"faster (:issue:`7113` by Łukasz Langa)." msgstr "" #: ../../whatsnew/3.2.rst:2422 @@ -4023,15 +4046,16 @@ msgstr "" #: ../../whatsnew/3.2.rst:2477 msgid "" -"(Contributed by Raymond Hettinger; see `rationale <https://rhettinger." -"wordpress.com/2011/01/28/open-your-source-more/>`_.)" +"(Contributed by Raymond Hettinger; see `rationale <https://" +"rhettinger.wordpress.com/2011/01/28/open-your-source-more/>`_.)" msgstr "" #: ../../whatsnew/3.2.rst:2480 msgid "" "The docs now contain more examples and recipes. In particular, :mod:`re` " -"module has an extensive section, :ref:`re-examples`. Likewise, the :mod:" -"`itertools` module continues to be updated with new :ref:`itertools-recipes`." +"module has an extensive section, :ref:`re-examples`. Likewise, " +"the :mod:`itertools` module continues to be updated with new :ref:`itertools-" +"recipes`." msgstr "" #: ../../whatsnew/3.2.rst:2485 @@ -4086,17 +4110,17 @@ msgstr "" #: ../../whatsnew/3.2.rst:2513 msgid "" -"In addition to the existing Subversion code repository at https://svn.python." -"org there is now a `Mercurial <https://www.mercurial-scm.org/>`_ repository " -"at https://hg.python.org/\\ ." +"In addition to the existing Subversion code repository at https://" +"svn.python.org there is now a `Mercurial <https://www.mercurial-scm.org/>`_ " +"repository at https://hg.python.org/\\ ." msgstr "" #: ../../whatsnew/3.2.rst:2517 msgid "" "After the 3.2 release, there are plans to switch to Mercurial as the primary " "repository. This distributed version control system should make it easier " -"for members of the community to create and share external changesets. See :" -"pep:`385` for details." +"for members of the community to create and share external changesets. " +"See :pep:`385` for details." msgstr "" #: ../../whatsnew/3.2.rst:2522 @@ -4108,11 +4132,11 @@ msgstr "" #: ../../whatsnew/3.2.rst:2528 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.2.rst:2530 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/3.2.rst:2532 msgid "" @@ -4168,8 +4192,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:2562 msgid "" -"(Suggested by Raymond Hettinger and implemented by Benjamin Peterson; :issue:" -"`9778`.)" +"(Suggested by Raymond Hettinger and implemented by Benjamin " +"Peterson; :issue:`9778`.)" msgstr "" "(由 Raymond Hettinger 建議並由 Benjamin Peterson 實作;:issue:`9778`。)" @@ -4210,10 +4234,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:2585 msgid "" -"There is a new function :c:func:`PyErr_NewExceptionWithDoc` that is like :c:" -"func:`PyErr_NewException` but allows a docstring to be specified. This lets " -"C exceptions have the same self-documenting capabilities as their pure " -"Python counterparts (:issue:`7033`)." +"There is a new function :c:func:`PyErr_NewExceptionWithDoc` that is " +"like :c:func:`PyErr_NewException` but allows a docstring to be specified. " +"This lets C exceptions have the same self-documenting capabilities as their " +"pure Python counterparts (:issue:`7033`)." msgstr "" #: ../../whatsnew/3.2.rst:2590 @@ -4245,8 +4269,8 @@ msgid "" "there is a known problem with the default Tcl/Tk on Mac OS X 10.6. " "Accordingly, we recommend installing an updated alternative such as " "`ActiveState Tcl/Tk 8.5.9 <https://web.archive.org/web/20101208191259/" -"https://www.activestate.com/activetcl/downloads>`_\\. See https://www.python." -"org/download/mac/tcltk/ for additional details." +"https://www.activestate.com/activetcl/downloads>`_\\. See https://" +"www.python.org/download/mac/tcltk/ for additional details." msgstr "" #: ../../whatsnew/3.2.rst:2611 @@ -4269,25 +4293,27 @@ msgstr "" #: ../../whatsnew/3.2.rst:2621 msgid "" -"The interpolation syntax is now validated on :meth:`~configparser." -"ConfigParser.get` and :meth:`~configparser.ConfigParser.set` operations. In " -"the default interpolation scheme, only two tokens with percent signs are " -"valid: ``%(name)s`` and ``%%``, the latter being an escaped percent sign." +"The interpolation syntax is now validated " +"on :meth:`~configparser.ConfigParser.get` " +"and :meth:`~configparser.ConfigParser.set` operations. In the default " +"interpolation scheme, only two tokens with percent signs are valid: ``%" +"(name)s`` and ``%%``, the latter being an escaped percent sign." msgstr "" #: ../../whatsnew/3.2.rst:2627 msgid "" -"The :meth:`~configparser.ConfigParser.set` and :meth:`~configparser." -"ConfigParser.add_section` methods now verify that values are actual " -"strings. Formerly, unsupported types could be introduced unintentionally." +"The :meth:`~configparser.ConfigParser.set` " +"and :meth:`~configparser.ConfigParser.add_section` methods now verify that " +"values are actual strings. Formerly, unsupported types could be introduced " +"unintentionally." msgstr "" #: ../../whatsnew/3.2.rst:2632 msgid "" -"Duplicate sections or options from a single source now raise either :exc:" -"`~configparser.DuplicateSectionError` or :exc:`~configparser." -"DuplicateOptionError`. Formerly, duplicates would silently overwrite a " -"previous entry." +"Duplicate sections or options from a single source now raise " +"either :exc:`~configparser.DuplicateSectionError` " +"or :exc:`~configparser.DuplicateOptionError`. Formerly, duplicates would " +"silently overwrite a previous entry." msgstr "" #: ../../whatsnew/3.2.rst:2637 @@ -4324,9 +4350,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:2653 msgid "" "The :meth:`!array.tostring` and :meth:`!array.fromstring` have been renamed " -"to :meth:`array.tobytes() <array.array.tobytes>` and :meth:`array." -"frombytes() <array.array.frombytes>` for clarity. The old names have been " -"deprecated. (See :issue:`8990`.)" +"to :meth:`array.tobytes() <array.array.tobytes>` " +"and :meth:`array.frombytes() <array.array.frombytes>` for clarity. The old " +"names have been deprecated. (See :issue:`8990`.)" msgstr "" #: ../../whatsnew/3.2.rst:2658 @@ -4359,19 +4385,19 @@ msgstr "" msgid "" "The :func:`random.seed` function and method now salt string seeds with an " "sha512 hash function. To access the previous version of *seed* in order to " -"reproduce Python 3.1 sequences, set the *version* argument to *1*, ``random." -"seed(s, version=1)``." +"reproduce Python 3.1 sequences, set the *version* argument to *1*, " +"``random.seed(s, version=1)``." msgstr "" #: ../../whatsnew/3.2.rst:2676 msgid "" "The previously deprecated :func:`!string.maketrans` function has been " -"removed in favor of the static methods :meth:`bytes.maketrans` and :meth:" -"`bytearray.maketrans`. This change solves the confusion around which types " -"were supported by the :mod:`string` module. Now, :class:`str`, :class:" -"`bytes`, and :class:`bytearray` each have their own **maketrans** and " -"**translate** methods with intermediate translation tables of the " -"appropriate type." +"removed in favor of the static methods :meth:`bytes.maketrans` " +"and :meth:`bytearray.maketrans`. This change solves the confusion around " +"which types were supported by the :mod:`string` module. " +"Now, :class:`str`, :class:`bytes`, and :class:`bytearray` each have their " +"own **maketrans** and **translate** methods with intermediate translation " +"tables of the appropriate type." msgstr "" #: ../../whatsnew/3.2.rst:2684 @@ -4430,9 +4456,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:2711 msgid "" -"The :class:`xml.etree.ElementTree` class now raises an :exc:`xml.etree." -"ElementTree.ParseError` when a parse fails. Previously it raised an :exc:" -"`xml.parsers.expat.ExpatError`." +"The :class:`xml.etree.ElementTree` class now raises " +"an :exc:`xml.etree.ElementTree.ParseError` when a parse fails. Previously it " +"raised an :exc:`xml.parsers.expat.ExpatError`." msgstr "" #: ../../whatsnew/3.2.rst:2715 @@ -4452,9 +4478,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:2725 msgid "" -"Support for legacy HTTP 0.9 has been removed from :mod:`urllib.request` and :" -"mod:`http.client`. Such support is still present on the server side (in :" -"mod:`http.server`)." +"Support for legacy HTTP 0.9 has been removed from :mod:`urllib.request` " +"and :mod:`http.client`. Such support is still present on the server side " +"(in :mod:`http.server`)." msgstr "" #: ../../whatsnew/3.2.rst:2729 @@ -4475,8 +4501,8 @@ msgstr "(由 Antoine Pitrou 於 :issue:`10272` 貢獻。)" msgid "" "The misleading functions :c:func:`!PyEval_AcquireLock` and :c:func:`!" "PyEval_ReleaseLock` have been officially deprecated. The thread-state aware " -"APIs (such as :c:func:`PyEval_SaveThread` and :c:func:" -"`PyEval_RestoreThread`) should be used instead." +"APIs (such as :c:func:`PyEval_SaveThread` " +"and :c:func:`PyEval_RestoreThread`) should be used instead." msgstr "" #: ../../whatsnew/3.2.rst:2741 diff --git a/whatsnew/3.3.po b/whatsnew/3.3.po index 32c61f5ff3..c713df08b6 100644 --- a/whatsnew/3.3.po +++ b/whatsnew/3.3.po @@ -108,7 +108,7 @@ msgstr "" #: ../../whatsnew/3.3.rst:84 msgid "Significantly Improved Library Modules:" -msgstr "" +msgstr "顯著改進的函式庫模組:" #: ../../whatsnew/3.3.rst:86 msgid "C Accelerator for the :ref:`decimal <new-decimal>` module." @@ -116,8 +116,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:87 msgid "" -"Better unicode handling in the :ref:`email <new-email>` module (:term:" -"`provisional <provisional package>`)." +"Better unicode handling in the :ref:`email <new-email>` module " +"(:term:`provisional <provisional package>`)." msgstr "" #: ../../whatsnew/3.3.rst:90 @@ -171,8 +171,8 @@ msgstr "" msgid "" "Native support for package directories that don't require ``__init__.py`` " "marker files and can automatically span multiple path segments (inspired by " -"various third party approaches to namespace packages, as described in :pep:" -"`420`)" +"various third party approaches to namespace packages, as described " +"in :pep:`420`)" msgstr "" #: ../../whatsnew/3.3.rst:132 @@ -498,18 +498,20 @@ msgstr "" #: ../../whatsnew/3.3.rst:332 msgid "" "You don't have to worry anymore about choosing the appropriate exception " -"type between :exc:`OSError`, :exc:`IOError`, :exc:`EnvironmentError`, :exc:" -"`WindowsError`, :exc:`mmap.error`, :exc:`socket.error` or :exc:`select." -"error`. All these exception types are now only one: :exc:`OSError`. The " -"other names are kept as aliases for compatibility reasons." +"type " +"between :exc:`OSError`, :exc:`IOError`, :exc:`EnvironmentError`, :exc:`WindowsError`, :exc:`mmap.error`, :exc:`socket.error` " +"or :exc:`select.error`. All these exception types are now only " +"one: :exc:`OSError`. The other names are kept as aliases for compatibility " +"reasons." msgstr "" #: ../../whatsnew/3.3.rst:339 msgid "" "Also, it is now easier to catch a specific error condition. Instead of " "inspecting the ``errno`` attribute (or ``args[0]``) for a particular " -"constant from the :mod:`errno` module, you can catch the adequate :exc:" -"`OSError` subclass. The available subclasses are the following:" +"constant from the :mod:`errno` module, you can catch the " +"adequate :exc:`OSError` subclass. The available subclasses are the " +"following:" msgstr "" #: ../../whatsnew/3.3.rst:344 @@ -877,10 +879,10 @@ msgstr "" msgid "" "Functions and class objects have a new :attr:`~definition.__qualname__` " "attribute representing the \"path\" from the module top-level to their " -"definition. For global functions and classes, this is the same as :attr:" -"`~definition.__name__`. For other functions and classes, it provides better " -"information about where they were actually defined, and how they might be " -"accessible from the global scope." +"definition. For global functions and classes, this is the same " +"as :attr:`~definition.__name__`. For other functions and classes, it " +"provides better information about where they were actually defined, and how " +"they might be accessible from the global scope." msgstr "" #: ../../whatsnew/3.3.rst:560 @@ -1021,10 +1023,11 @@ msgstr "PEP 362:函式簽名物件" msgid "" "A new function :func:`inspect.signature` makes introspection of python " "callables easy and straightforward. A broad range of callables is " -"supported: python functions, decorated or not, classes, and :func:`functools." -"partial` objects. New classes :class:`inspect.Signature`, :class:`inspect." -"Parameter` and :class:`inspect.BoundArguments` hold information about the " -"call signatures, such as, annotations, default values, parameters kinds, and " +"supported: python functions, decorated or not, classes, " +"and :func:`functools.partial` objects. New " +"classes :class:`inspect.Signature`, :class:`inspect.Parameter` " +"and :class:`inspect.BoundArguments` hold information about the call " +"signatures, such as, annotations, default values, parameters kinds, and " "bound arguments, which considerably simplifies writing decorators and any " "code that validates or amends calling signatures or arguments." msgstr "" @@ -1080,10 +1083,10 @@ msgstr "SimpleNamespace" msgid "" "The implementation of ``sys.implementation`` also introduces a new type to " "Python: :class:`types.SimpleNamespace`. In contrast to a mapping-based " -"namespace, like :class:`dict`, ``SimpleNamespace`` is attribute-based, like :" -"class:`object`. However, unlike ``object``, ``SimpleNamespace`` instances " -"are writable. This means that you can add, remove, and modify the namespace " -"through normal attribute access." +"namespace, like :class:`dict`, ``SimpleNamespace`` is attribute-based, " +"like :class:`object`. However, unlike ``object``, ``SimpleNamespace`` " +"instances are writable. This means that you can add, remove, and modify the " +"namespace through normal attribute access." msgstr "" #: ../../whatsnew/3.3.rst:681 @@ -1108,14 +1111,15 @@ msgstr "" #: ../../whatsnew/3.3.rst:694 msgid "" -"The :func:`__import__` function is now powered by :func:`importlib." -"__import__`. This work leads to the completion of \"phase 2\" of :pep:`302`. " -"There are multiple benefits to this change. First, it has allowed for more " -"of the machinery powering import to be exposed instead of being implicit and " -"hidden within the C code. It also provides a single implementation for all " -"Python VMs supporting Python 3.3 to use, helping to end any VM-specific " -"deviations in import semantics. And finally it eases the maintenance of " -"import, allowing for future growth to occur." +"The :func:`__import__` function is now powered " +"by :func:`importlib.__import__`. This work leads to the completion of " +"\"phase 2\" of :pep:`302`. There are multiple benefits to this change. " +"First, it has allowed for more of the machinery powering import to be " +"exposed instead of being implicit and hidden within the C code. It also " +"provides a single implementation for all Python VMs supporting Python 3.3 to " +"use, helping to end any VM-specific deviations in import semantics. And " +"finally it eases the maintenance of import, allowing for future growth to " +"occur." msgstr "" #: ../../whatsnew/3.3.rst:703 @@ -1141,11 +1145,11 @@ msgstr "" msgid "" "The abstract base classes defined in :mod:`importlib.abc` have been expanded " "to properly delineate between :term:`meta path finders <meta path finder>` " -"and :term:`path entry finders <path entry finder>` by introducing :class:" -"`importlib.abc.MetaPathFinder` and :class:`importlib.abc.PathEntryFinder`, " -"respectively. The old ABC of :class:`!importlib.abc.Finder` is now only " -"provided for backwards-compatibility and does not enforce any method " -"requirements." +"and :term:`path entry finders <path entry finder>` by " +"introducing :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.PathEntryFinder`, respectively. The old ABC " +"of :class:`!importlib.abc.Finder` is now only provided for backwards-" +"compatibility and does not enforce any method requirements." msgstr "" #: ../../whatsnew/3.3.rst:722 @@ -1159,10 +1163,11 @@ msgstr "" msgid "" "For loaders, the new abstract base class :class:`importlib.abc.FileLoader` " "helps write a loader that uses the file system as the storage mechanism for " -"a module's code. The loader for source files (:class:`importlib.machinery." -"SourceFileLoader`), sourceless bytecode files (:class:`importlib.machinery." -"SourcelessFileLoader`), and extension modules (:class:`importlib.machinery." -"ExtensionFileLoader`) are now available for direct use." +"a module's code. The loader for source files " +"(:class:`importlib.machinery.SourceFileLoader`), sourceless bytecode files " +"(:class:`importlib.machinery.SourcelessFileLoader`), and extension modules " +"(:class:`importlib.machinery.ExtensionFileLoader`) are now available for " +"direct use." msgstr "" #: ../../whatsnew/3.3.rst:734 @@ -1193,9 +1198,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:749 msgid "" "Beyond the expanse of what :mod:`importlib` now exposes, there are other " -"visible changes to import. The biggest is that :data:`sys.meta_path` and :" -"data:`sys.path_hooks` now store all of the meta path finders and path entry " -"hooks used by import. Previously the finders were implicit and hidden " +"visible changes to import. The biggest is that :data:`sys.meta_path` " +"and :data:`sys.path_hooks` now store all of the meta path finders and path " +"entry hooks used by import. Previously the finders were implicit and hidden " "within the C code of import instead of being directly exposed. This means " "that one can now easily remove or change the order of the various finders to " "fit one's needs." @@ -1213,9 +1218,10 @@ msgstr "" #: ../../whatsnew/3.3.rst:762 msgid "" -"Loaders are also now expected to set the ``__package__`` attribute from :pep:" -"`366`. Once again, import itself is already setting this on all loaders " -"from :mod:`importlib` and import itself is setting the attribute post-load." +"Loaders are also now expected to set the ``__package__`` attribute " +"from :pep:`366`. Once again, import itself is already setting this on all " +"loaders from :mod:`importlib` and import itself is setting the attribute " +"post-load." msgstr "" #: ../../whatsnew/3.3.rst:766 @@ -1247,9 +1253,9 @@ msgstr "對核心 Python 語言所做的一些較小的更改包括:" #: ../../whatsnew/3.3.rst:783 msgid "" -"Added support for Unicode name aliases and named sequences. Both :func:" -"`unicodedata.lookup` and ``'\\N{...}'`` now resolve name aliases, and :func:" -"`unicodedata.lookup` resolves named sequences too." +"Added support for Unicode name aliases and named sequences. " +"Both :func:`unicodedata.lookup` and ``'\\N{...}'`` now resolve name aliases, " +"and :func:`unicodedata.lookup` resolves named sequences too." msgstr "" #: ../../whatsnew/3.3.rst:787 @@ -1263,8 +1269,8 @@ msgstr "Unicode 資料庫更新至 UCD 版本 6.1.0" #: ../../whatsnew/3.3.rst:791 msgid "" "Equality comparisons on :func:`range` objects now return a result reflecting " -"the equality of the underlying sequences generated by those range objects. (:" -"issue:`13201`)" +"the equality of the underlying sequences generated by those range objects. " +"(:issue:`13201`)" msgstr "" #: ../../whatsnew/3.3.rst:795 @@ -1288,9 +1294,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:805 msgid "" "New methods have been added to :class:`list` and :class:`bytearray`: " -"``copy()`` and ``clear()`` (:issue:`10516`). Consequently, :class:" -"`~collections.abc.MutableSequence` now also defines a :meth:`~collections." -"abc.MutableSequence.clear` method (:issue:`11388`)." +"``copy()`` and ``clear()`` (:issue:`10516`). " +"Consequently, :class:`~collections.abc.MutableSequence` now also defines " +"a :meth:`~collections.abc.MutableSequence.clear` method (:issue:`11388`)." msgstr "" #: ../../whatsnew/3.3.rst:810 @@ -1331,8 +1337,8 @@ msgid "" "Previous versions of CPython have always relied on a global import lock. " "This led to unexpected annoyances, such as deadlocks when importing a module " "would trigger code execution in a different thread as a side-effect. Clumsy " -"workarounds were sometimes employed, such as the :c:func:" -"`PyImport_ImportModuleNoBlock` C API function." +"workarounds were sometimes employed, such as " +"the :c:func:`PyImport_ImportModuleNoBlock` C API function." msgstr "" #: ../../whatsnew/3.3.rst:834 @@ -1368,8 +1374,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:852 msgid "" -":func:`hash`: hash randomization is enabled by default, see :meth:`object." -"__hash__` and :envvar:`PYTHONHASHSEED`." +":func:`hash`: hash randomization is enabled by default, " +"see :meth:`object.__hash__` and :envvar:`PYTHONHASHSEED`." msgstr "" #: ../../whatsnew/3.3.rst:854 @@ -1383,8 +1389,8 @@ msgstr "" msgid "" "The sequence documentation has been substantially rewritten to better " "explain the binary/text sequence distinction and to provide specific " -"documentation sections for the individual builtin sequence types (:issue:" -"`4966`)." +"documentation sections for the individual builtin sequence types " +"(:issue:`4966`)." msgstr "" #: ../../whatsnew/3.3.rst:864 @@ -1400,10 +1406,11 @@ msgid "" "This new debug module :mod:`faulthandler` contains functions to dump Python " "tracebacks explicitly, on a fault (a crash like a segmentation fault), after " "a timeout, or on a user signal. Call :func:`faulthandler.enable` to install " -"fault handlers for the :const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :" -"const:`SIGBUS`, and :const:`SIGILL` signals. You can also enable them at " -"startup by setting the :envvar:`PYTHONFAULTHANDLER` environment variable or " -"by using :option:`-X` ``faulthandler`` command line option." +"fault handlers for " +"the :const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS`, " +"and :const:`SIGILL` signals. You can also enable them at startup by setting " +"the :envvar:`PYTHONFAULTHANDLER` environment variable or by using :option:`-" +"X` ``faulthandler`` command line option." msgstr "" #: ../../whatsnew/3.3.rst:877 @@ -1485,24 +1492,24 @@ msgid "" ":class:`abc.abstractproperty` has been deprecated, use :class:`property` " "with :func:`abc.abstractmethod` instead." msgstr "" -":class:`abc.abstractproperty` 已被棄用,請改 :class:`property` 和 :func:`abc." -"abstractmethod`。" +":class:`abc.abstractproperty` 已被棄用,請改 :class:`property` " +"和 :func:`abc.abstractmethod`。" #: ../../whatsnew/3.3.rst:924 ../../whatsnew/3.3.rst:2250 msgid "" -":class:`abc.abstractclassmethod` has been deprecated, use :class:" -"`classmethod` with :func:`abc.abstractmethod` instead." +":class:`abc.abstractclassmethod` has been deprecated, " +"use :class:`classmethod` with :func:`abc.abstractmethod` instead." msgstr "" -":class:`abc.abstractclassmethod` 已被棄用,請改用 :class:`classmethod` 和 :" -"func:`abc.abstractmethod`。" +":class:`abc.abstractclassmethod` 已被棄用,請改用 :class:`classmethod` " +"和 :func:`abc.abstractmethod`。" #: ../../whatsnew/3.3.rst:926 ../../whatsnew/3.3.rst:2252 msgid "" -":class:`abc.abstractstaticmethod` has been deprecated, use :class:" -"`staticmethod` with :func:`abc.abstractmethod` instead." +":class:`abc.abstractstaticmethod` has been deprecated, " +"use :class:`staticmethod` with :func:`abc.abstractmethod` instead." msgstr "" -":class:`abc.abstractstaticmethod` 已被棄用,請改用 :class:`staticmethod` 和 :" -"func:`abc.abstractmethod`。" +":class:`abc.abstractstaticmethod` 已被棄用,請改用 :class:`staticmethod` " +"和 :func:`abc.abstractmethod`。" #: ../../whatsnew/3.3.rst:929 msgid "(Contributed by Darren Dale in :issue:`11610`.)" @@ -1535,9 +1542,9 @@ msgstr "base64" #: ../../whatsnew/3.3.rst:947 msgid "" "ASCII-only Unicode strings are now accepted by the decoding functions of " -"the :mod:`base64` modern interface. For example, ``base64." -"b64decode('YWJj')`` returns ``b'abc'``. (Contributed by Catalin Iacob in :" -"issue:`13641`.)" +"the :mod:`base64` modern interface. For example, " +"``base64.b64decode('YWJj')`` returns ``b'abc'``. (Contributed by Catalin " +"Iacob in :issue:`13641`.)" msgstr "" #: ../../whatsnew/3.3.rst:953 @@ -1580,9 +1587,9 @@ msgstr "(由 Nadeem Vawda 在 :issue:`5863` 中貢獻。)" #: ../../whatsnew/3.3.rst:974 msgid "" ":class:`bz2.BZ2File` and :func:`bz2.decompress` can now decompress multi-" -"stream inputs (such as those produced by the :program:`pbzip2` tool). :class:" -"`bz2.BZ2File` can now also be used to create this type of file, using the " -"``'a'`` (append) mode." +"stream inputs (such as those produced by the :program:`pbzip2` " +"tool). :class:`bz2.BZ2File` can now also be used to create this type of " +"file, using the ``'a'`` (append) mode." msgstr "" #: ../../whatsnew/3.3.rst:979 @@ -1602,9 +1609,9 @@ msgstr "codecs" #: ../../whatsnew/3.3.rst:988 msgid "" "The :mod:`~encodings.mbcs` codec has been rewritten to handle correctly " -"``replace`` and ``ignore`` error handlers on all Windows versions. The :mod:" -"`~encodings.mbcs` codec now supports all error handlers, instead of only " -"``replace`` to encode and ``ignore`` to decode." +"``replace`` and ``ignore`` error handlers on all Windows versions. " +"The :mod:`~encodings.mbcs` codec now supports all error handlers, instead of " +"only ``replace`` to encode and ``ignore`` to decode." msgstr "" #: ../../whatsnew/3.3.rst:993 @@ -1618,9 +1625,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:998 msgid "" "Multibyte CJK decoders now resynchronize faster. They only ignore the first " -"byte of an invalid byte sequence. For example, ``b'\\xff\\n'." -"decode('gb2312', 'replace')`` now returns a ``\\n`` after the replacement " -"character." +"byte of an invalid byte sequence. For example, " +"``b'\\xff\\n'.decode('gb2312', 'replace')`` now returns a ``\\n`` after the " +"replacement character." msgstr "" #: ../../whatsnew/3.3.rst:1002 @@ -1668,16 +1675,16 @@ msgstr "collections" #: ../../whatsnew/3.3.rst:1023 msgid "" "Addition of a new :class:`~collections.ChainMap` class to allow treating a " -"number of mappings as a single unit. (Written by Raymond Hettinger for :" -"issue:`11089`, made public in :issue:`11297`.)" +"number of mappings as a single unit. (Written by Raymond Hettinger " +"for :issue:`11089`, made public in :issue:`11297`.)" msgstr "" #: ../../whatsnew/3.3.rst:1027 msgid "" "The abstract base classes have been moved in a new :mod:`collections.abc` " "module, to better differentiate between the abstract and the concrete " -"collections classes. Aliases for ABCs are still present in the :mod:" -"`collections` module to preserve existing imports. (:issue:`11085`)" +"collections classes. Aliases for ABCs are still present in " +"the :mod:`collections` module to preserve existing imports. (:issue:`11085`)" msgstr "" #: ../../whatsnew/3.3.rst:1034 @@ -1728,8 +1735,9 @@ msgstr "curses" #: ../../whatsnew/3.3.rst:1065 msgid "" "If the :mod:`curses` module is linked to the ncursesw library, use Unicode " -"functions when Unicode strings or characters are passed (e.g. :c:func:" -"`waddwstr`), and bytes functions otherwise (e.g. :c:func:`waddstr`)." +"functions when Unicode strings or characters are passed " +"(e.g. :c:func:`waddwstr`), and bytes functions otherwise " +"(e.g. :c:func:`waddstr`)." msgstr "" #: ../../whatsnew/3.3.rst:1068 @@ -1768,8 +1776,8 @@ msgstr "datetime" #: ../../whatsnew/3.3.rst:1081 msgid "" "Equality comparisons between naive and aware :class:`~datetime.datetime` " -"instances now return :const:`False` instead of raising :exc:`TypeError` (:" -"issue:`15006`)." +"instances now return :const:`False` instead of raising :exc:`TypeError` " +"(:issue:`15006`)." msgstr "" #: ../../whatsnew/3.3.rst:1084 @@ -1894,8 +1902,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:1130 msgid "" "If Python is compiled without threads, the C version automatically disables " -"the expensive thread local context machinery. In this case, the variable :" -"const:`~decimal.HAVE_THREADS` is set to ``False``." +"the expensive thread local context machinery. In this case, the " +"variable :const:`~decimal.HAVE_THREADS` is set to ``False``." msgstr "" #: ../../whatsnew/3.3.rst:1137 @@ -1942,10 +1950,11 @@ msgstr "``-999999999999999999``" #: ../../whatsnew/3.3.rst:1150 msgid "" -"In the context templates (:const:`~decimal.DefaultContext`, :const:`~decimal." -"BasicContext` and :const:`~decimal.ExtendedContext`) the magnitude of :attr:" -"`~decimal.Context.Emax` and :attr:`~decimal.Context.Emin` has changed to " -"``999999``." +"In the context templates " +"(:const:`~decimal.DefaultContext`, :const:`~decimal.BasicContext` " +"and :const:`~decimal.ExtendedContext`) the magnitude " +"of :attr:`~decimal.Context.Emax` and :attr:`~decimal.Context.Emin` has " +"changed to ``999999``." msgstr "" #: ../../whatsnew/3.3.rst:1155 @@ -1953,29 +1962,31 @@ msgid "" "The :class:`~decimal.Decimal` constructor in decimal.py does not observe the " "context limits and converts values with arbitrary exponents or precision " "exactly. Since the C version has internal limits, the following scheme is " -"used: If possible, values are converted exactly, otherwise :exc:`~decimal." -"InvalidOperation` is raised and the result is NaN. In the latter case it is " -"always possible to use :meth:`~decimal.Context.create_decimal` in order to " -"obtain a rounded or inexact value." +"used: If possible, values are converted exactly, " +"otherwise :exc:`~decimal.InvalidOperation` is raised and the result is NaN. " +"In the latter case it is always possible to " +"use :meth:`~decimal.Context.create_decimal` in order to obtain a rounded or " +"inexact value." msgstr "" #: ../../whatsnew/3.3.rst:1164 msgid "" "The power function in decimal.py is always correctly rounded. In the C " -"version, it is defined in terms of the correctly rounded :meth:`~decimal." -"Decimal.exp` and :meth:`~decimal.Decimal.ln` functions, but the final result " -"is only \"almost always correctly rounded\"." +"version, it is defined in terms of the correctly " +"rounded :meth:`~decimal.Decimal.exp` and :meth:`~decimal.Decimal.ln` " +"functions, but the final result is only \"almost always correctly rounded\"." msgstr "" #: ../../whatsnew/3.3.rst:1170 msgid "" -"In the C version, the context dictionary containing the signals is a :class:" -"`~collections.abc.MutableMapping`. For speed reasons, :attr:`~decimal." -"Context.flags` and :attr:`~decimal.Context.traps` always refer to the same :" -"class:`~collections.abc.MutableMapping` that the context was initialized " -"with. If a new signal dictionary is assigned, :attr:`~decimal.Context.flags` " -"and :attr:`~decimal.Context.traps` are updated with the new values, but they " -"do not reference the RHS dictionary." +"In the C version, the context dictionary containing the signals is " +"a :class:`~collections.abc.MutableMapping`. For speed " +"reasons, :attr:`~decimal.Context.flags` and :attr:`~decimal.Context.traps` " +"always refer to the same :class:`~collections.abc.MutableMapping` that the " +"context was initialized with. If a new signal dictionary is " +"assigned, :attr:`~decimal.Context.flags` and :attr:`~decimal.Context.traps` " +"are updated with the new values, but they do not reference the RHS " +"dictionary." msgstr "" #: ../../whatsnew/3.3.rst:1180 @@ -2006,18 +2017,18 @@ msgstr "" #: ../../whatsnew/3.3.rst:1200 msgid "" -"The email package now has a :mod:`~email.policy` framework. A :class:" -"`~email.policy.Policy` is an object with several methods and properties that " -"control how the email package behaves. The primary policy for Python 3.3 is " -"the :class:`~email.policy.Compat32` policy, which provides backward " -"compatibility with the email package in Python 3.2. A ``policy`` can be " -"specified when an email message is parsed by a :mod:`~email.parser`, or when " -"a :class:`~email.message.Message` object is created, or when an email is " -"serialized using a :mod:`~email.generator`. Unless overridden, a policy " -"passed to a ``parser`` is inherited by all the ``Message`` object and sub-" -"objects created by the ``parser``. By default a ``generator`` will use the " -"policy of the ``Message`` object it is serializing. The default policy is :" -"data:`~email.policy.compat32`." +"The email package now has a :mod:`~email.policy` framework. " +"A :class:`~email.policy.Policy` is an object with several methods and " +"properties that control how the email package behaves. The primary policy " +"for Python 3.3 is the :class:`~email.policy.Compat32` policy, which provides " +"backward compatibility with the email package in Python 3.2. A ``policy`` " +"can be specified when an email message is parsed by a :mod:`~email.parser`, " +"or when a :class:`~email.message.Message` object is created, or when an " +"email is serialized using a :mod:`~email.generator`. Unless overridden, a " +"policy passed to a ``parser`` is inherited by all the ``Message`` object and " +"sub-objects created by the ``parser``. By default a ``generator`` will use " +"the policy of the ``Message`` object it is serializing. The default policy " +"is :data:`~email.policy.compat32`." msgstr "" #: ../../whatsnew/3.3.rst:1213 @@ -2067,11 +2078,11 @@ msgstr "" #: ../../whatsnew/3.3.rst:1235 msgid "" -"A new policy instance, with new settings, is created using the :meth:`~email." -"policy.Policy.clone` method of policy objects. ``clone`` takes any of the " -"above controls as keyword arguments. Any control not specified in the call " -"retains its default value. Thus you can create a policy that uses " -"``\\r\\n`` linesep characters like this::" +"A new policy instance, with new settings, is created using " +"the :meth:`~email.policy.Policy.clone` method of policy objects. ``clone`` " +"takes any of the above controls as keyword arguments. Any control not " +"specified in the call retains its default value. Thus you can create a " +"policy that uses ``\\r\\n`` linesep characters like this::" msgstr "" #: ../../whatsnew/3.3.rst:1241 @@ -2101,10 +2112,10 @@ msgid "" "for introducing it is to allow the creation of new policies that implement " "new features for the email package in a way that maintains backward " "compatibility for those who do not use the new policies. Because the new " -"policies introduce a new API, we are releasing them in Python 3.3 as a :term:" -"`provisional policy <provisional package>`. Backwards incompatible changes " -"(up to and including removal of the code) may occur if deemed necessary by " -"the core developers." +"policies introduce a new API, we are releasing them in Python 3.3 as " +"a :term:`provisional policy <provisional package>`. Backwards incompatible " +"changes (up to and including removal of the code) may occur if deemed " +"necessary by the core developers." msgstr "" #: ../../whatsnew/3.3.rst:1265 @@ -2162,8 +2173,8 @@ msgid "" "'Éric'\n" ">>> m['Date'] = email.utils.localtime()\n" ">>> m['Date'].datetime\n" -"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, tzinfo=datetime." -"timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" +"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, " +"tzinfo=datetime.timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" ">>> m['Date']\n" "'Fri, 25 May 2012 21:44:27 -0400'\n" ">>> print(m)\n" @@ -2182,8 +2193,8 @@ msgstr "" "'Éric'\n" ">>> m['Date'] = email.utils.localtime()\n" ">>> m['Date'].datetime\n" -"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, tzinfo=datetime." -"timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" +"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, " +"tzinfo=datetime.timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" ">>> m['Date']\n" "'Fri, 25 May 2012 21:44:27 -0400'\n" ">>> print(m)\n" @@ -2195,8 +2206,8 @@ msgid "" "You will note that the unicode display name is automatically encoded as " "``utf-8`` when the message is serialized, but that when the header is " "accessed directly, you get the unicode version. This eliminates any need to " -"deal with the :mod:`email.header` :meth:`~email.header.decode_header` or :" -"meth:`~email.header.make_header` functions." +"deal with the :mod:`email.header` :meth:`~email.header.decode_header` " +"or :meth:`~email.header.make_header` functions." msgstr "" #: ../../whatsnew/3.3.rst:1318 @@ -2243,8 +2254,8 @@ msgid "" "(Group(display_name='pals', addresses=(Address(display_name='Bob', " "username='bob', domain='example.com'), Address(display_name='Sally', " "username='sally', domain='example.com')), Group(display_name=None, " -"addresses=(Address(display_name='Bonzo', username='bonz', domain='laugh." -"com'),))" +"addresses=(Address(display_name='Bonzo', username='bonz', " +"domain='laugh.com'),))" msgstr "" ">>> m2['cc'].addresses\n" "(Address(display_name='Bob', username='bob', domain='example.com'), " @@ -2254,8 +2265,8 @@ msgstr "" "(Group(display_name='pals', addresses=(Address(display_name='Bob', " "username='bob', domain='example.com'), Address(display_name='Sally', " "username='sally', domain='example.com')), Group(display_name=None, " -"addresses=(Address(display_name='Bonzo', username='bonz', domain='laugh." -"com'),))" +"addresses=(Address(display_name='Bonzo', username='bonz', " +"domain='laugh.com'),))" #: ../../whatsnew/3.3.rst:1343 msgid "" @@ -2271,9 +2282,9 @@ msgstr "其他 API 變更" #: ../../whatsnew/3.3.rst:1351 msgid "" -"New :class:`~email.parser.BytesHeaderParser`, added to the :mod:`~email." -"parser` module to complement :class:`~email.parser.HeaderParser` and " -"complete the Bytes API." +"New :class:`~email.parser.BytesHeaderParser`, added to " +"the :mod:`~email.parser` module to " +"complement :class:`~email.parser.HeaderParser` and complete the Bytes API." msgstr "" #: ../../whatsnew/3.3.rst:1355 @@ -2296,10 +2307,11 @@ msgstr "" #: ../../whatsnew/3.3.rst:1364 msgid "" ":func:`~email.utils.localtime`: With no argument, returns the current local " -"time as an aware :class:`~datetime.datetime` using the local :class:" -"`~datetime.timezone`. Given an aware :class:`~datetime.datetime`, converts " -"it into an aware :class:`~datetime.datetime` using the local :class:" -"`~datetime.timezone`." +"time as an aware :class:`~datetime.datetime` using the " +"local :class:`~datetime.timezone`. Given an " +"aware :class:`~datetime.datetime`, converts it into an " +"aware :class:`~datetime.datetime` using the " +"local :class:`~datetime.timezone`." msgstr "" #: ../../whatsnew/3.3.rst:1372 @@ -2310,24 +2322,25 @@ msgstr "ftplib" msgid "" ":class:`ftplib.FTP` now accepts a ``source_address`` keyword argument to " "specify the ``(host, port)`` to use as the source address in the bind call " -"when creating the outgoing socket. (Contributed by Giampaolo Rodolà in :" -"issue:`8594`.)" +"when creating the outgoing socket. (Contributed by Giampaolo Rodolà " +"in :issue:`8594`.)" msgstr "" #: ../../whatsnew/3.3.rst:1379 msgid "" -"The :class:`~ftplib.FTP_TLS` class now provides a new :func:`~ftplib.FTP_TLS." -"ccc` function to revert control channel back to plaintext. This can be " -"useful to take advantage of firewalls that know how to handle NAT with non-" -"secure FTP without opening fixed ports. (Contributed by Giampaolo Rodolà " -"in :issue:`12139`.)" +"The :class:`~ftplib.FTP_TLS` class now provides a " +"new :func:`~ftplib.FTP_TLS.ccc` function to revert control channel back to " +"plaintext. This can be useful to take advantage of firewalls that know how " +"to handle NAT with non-secure FTP without opening fixed ports. (Contributed " +"by Giampaolo Rodolà in :issue:`12139`.)" msgstr "" #: ../../whatsnew/3.3.rst:1385 msgid "" "Added :meth:`ftplib.FTP.mlsd` method which provides a parsable directory " -"listing format and deprecates :meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP." -"dir`. (Contributed by Giampaolo Rodolà in :issue:`11072`.)" +"listing format and deprecates :meth:`ftplib.FTP.nlst` " +"and :meth:`ftplib.FTP.dir`. (Contributed by Giampaolo Rodolà " +"in :issue:`11072`.)" msgstr "" #: ../../whatsnew/3.3.rst:1391 @@ -2370,11 +2383,11 @@ msgstr "http" #: ../../whatsnew/3.3.rst:1417 msgid "" ":class:`http.server.BaseHTTPRequestHandler` now buffers the headers and " -"writes them all at once when :meth:`~http.server.BaseHTTPRequestHandler." -"end_headers` is called. A new method :meth:`~http.server." -"BaseHTTPRequestHandler.flush_headers` can be used to directly manage when " -"the accumulated headers are sent. (Contributed by Andrew Schaaf in :issue:" -"`3709`.)" +"writes them all at once " +"when :meth:`~http.server.BaseHTTPRequestHandler.end_headers` is called. A " +"new method :meth:`~http.server.BaseHTTPRequestHandler.flush_headers` can be " +"used to directly manage when the accumulated headers are sent. (Contributed " +"by Andrew Schaaf in :issue:`3709`.)" msgstr "" #: ../../whatsnew/3.3.rst:1423 @@ -2385,9 +2398,10 @@ msgstr "" #: ../../whatsnew/3.3.rst:1426 msgid "" -":class:`http.client.HTTPResponse` now has a :meth:`~http.client.HTTPResponse." -"readinto` method, which means it can be used as an :class:`io.RawIOBase` " -"class. (Contributed by John Kuhn in :issue:`13464`.)" +":class:`http.client.HTTPResponse` now has " +"a :meth:`~http.client.HTTPResponse.readinto` method, which means it can be " +"used as an :class:`io.RawIOBase` class. (Contributed by John Kuhn " +"in :issue:`13464`.)" msgstr "" #: ../../whatsnew/3.3.rst:1433 @@ -2397,14 +2411,12 @@ msgstr "html" #: ../../whatsnew/3.3.rst:1435 msgid "" ":class:`html.parser.HTMLParser` is now able to parse broken markup without " -"raising errors, therefore the *strict* argument of the constructor and the :" -"exc:`~html.parser.HTMLParseError` exception are now deprecated. The ability " -"to parse broken markup is the result of a number of bug fixes that are also " -"available on the latest bug fix releases of Python 2.7/3.2. (Contributed by " -"Ezio Melotti in :issue:`15114`, and :issue:`14538`, :issue:`13993`, :issue:" -"`13960`, :issue:`13358`, :issue:`1745761`, :issue:`755670`, :issue:`13357`, :" -"issue:`12629`, :issue:`1200313`, :issue:`670664`, :issue:`13273`, :issue:" -"`12888`, :issue:`7311`.)" +"raising errors, therefore the *strict* argument of the constructor and " +"the :exc:`~html.parser.HTMLParseError` exception are now deprecated. The " +"ability to parse broken markup is the result of a number of bug fixes that " +"are also available on the latest bug fix releases of Python 2.7/3.2. " +"(Contributed by Ezio Melotti in :issue:`15114`, " +"and :issue:`14538`, :issue:`13993`, :issue:`13960`, :issue:`13358`, :issue:`1745761`, :issue:`755670`, :issue:`13357`, :issue:`12629`, :issue:`1200313`, :issue:`670664`, :issue:`13273`, :issue:`12888`, :issue:`7311`.)" msgstr "" #: ../../whatsnew/3.3.rst:1445 @@ -2476,10 +2488,10 @@ msgstr "(由 David Townshend 於 :issue:`12760` 中貢獻。)" #: ../../whatsnew/3.3.rst:1487 msgid "" "The constructor of the :class:`~io.TextIOWrapper` class has a new " -"*write_through* optional argument. If *write_through* is ``True``, calls to :" -"meth:`~io.TextIOWrapper.write` are guaranteed not to be buffered: any data " -"written on the :class:`~io.TextIOWrapper` object is immediately handled to " -"its underlying binary buffer." +"*write_through* optional argument. If *write_through* is ``True``, calls " +"to :meth:`~io.TextIOWrapper.write` are guaranteed not to be buffered: any " +"data written on the :class:`~io.TextIOWrapper` object is immediately handled " +"to its underlying binary buffer." msgstr "" #: ../../whatsnew/3.3.rst:1495 @@ -2552,8 +2564,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:1539 msgid "" ":class:`multiprocessing.Connection` objects can now be transferred over " -"multiprocessing connections. (Contributed by Richard Oudkerk in :issue:" -"`4892`.)" +"multiprocessing connections. (Contributed by Richard Oudkerk " +"in :issue:`4892`.)" msgstr "" #: ../../whatsnew/3.3.rst:1543 @@ -2572,11 +2584,12 @@ msgstr "" #: ../../whatsnew/3.3.rst:1552 msgid "" -"New methods :meth:`multiprocessing.pool.Pool.starmap` and :meth:" -"`~multiprocessing.pool.Pool.starmap_async` provide :func:`itertools.starmap` " -"equivalents to the existing :meth:`multiprocessing.pool.Pool.map` and :meth:" -"`~multiprocessing.pool.Pool.map_async` functions. (Contributed by Hynek " -"Schlawack in :issue:`12708`.)" +"New methods :meth:`multiprocessing.pool.Pool.starmap` " +"and :meth:`~multiprocessing.pool.Pool.starmap_async` " +"provide :func:`itertools.starmap` equivalents to the " +"existing :meth:`multiprocessing.pool.Pool.map` " +"and :meth:`~multiprocessing.pool.Pool.map_async` functions. (Contributed by " +"Hynek Schlawack in :issue:`12708`.)" msgstr "" #: ../../whatsnew/3.3.rst:1561 @@ -2596,16 +2609,16 @@ msgid "" ">>> with NNTP('news.gmane.org') as n:\n" "... n.group('gmane.comp.python.committers')\n" "...\n" -"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, 'gmane.comp." -"python.committers')\n" +"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, " +"'gmane.comp.python.committers')\n" ">>>" msgstr "" ">>> from nntplib import NNTP\n" ">>> with NNTP('news.gmane.org') as n:\n" "... n.group('gmane.comp.python.committers')\n" "...\n" -"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, 'gmane.comp." -"python.committers')\n" +"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, " +"'gmane.comp.python.committers')\n" ">>>" #: ../../whatsnew/3.3.rst:1574 @@ -2619,9 +2632,9 @@ msgstr "os" #: ../../whatsnew/3.3.rst:1580 msgid "" "The :mod:`os` module has a new :func:`~os.pipe2` function that makes it " -"possible to create a pipe with :const:`~os.O_CLOEXEC` or :const:`~os." -"O_NONBLOCK` flags set atomically. This is especially useful to avoid race " -"conditions in multi-threaded programs." +"possible to create a pipe with :const:`~os.O_CLOEXEC` " +"or :const:`~os.O_NONBLOCK` flags set atomically. This is especially useful " +"to avoid race conditions in multi-threaded programs." msgstr "" #: ../../whatsnew/3.3.rst:1585 @@ -2645,52 +2658,46 @@ msgid "" "To avoid race conditions like symlink attacks and issues with temporary " "files and directories, it is more reliable (and also faster) to manipulate " "file descriptors instead of file names. Python 3.3 enhances existing " -"functions and introduces new functions to work on file descriptors (:issue:" -"`4761`, :issue:`10755` and :issue:`14626`)." +"functions and introduces new functions to work on file descriptors " +"(:issue:`4761`, :issue:`10755` and :issue:`14626`)." msgstr "" #: ../../whatsnew/3.3.rst:1601 msgid "" -"The :mod:`os` module has a new :func:`~os.fwalk` function similar to :func:" -"`~os.walk` except that it also yields file descriptors referring to the " -"directories visited. This is especially useful to avoid symlink races." +"The :mod:`os` module has a new :func:`~os.fwalk` function similar " +"to :func:`~os.walk` except that it also yields file descriptors referring to " +"the directories visited. This is especially useful to avoid symlink races." msgstr "" #: ../../whatsnew/3.3.rst:1605 msgid "" "The following functions get new optional *dir_fd* (:ref:`paths relative to " "directory descriptors <dir_fd>`) and/or *follow_symlinks* (:ref:`not " -"following symlinks <follow_symlinks>`): :func:`~os.access`, :func:`~os." -"chflags`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os.link`, :func:`~os." -"lstat`, :func:`~os.mkdir`, :func:`~os.mkfifo`, :func:`~os.mknod`, :func:`~os." -"open`, :func:`~os.readlink`, :func:`~os.remove`, :func:`~os.rename`, :func:" -"`~os.replace`, :func:`~os.rmdir`, :func:`~os.stat`, :func:`~os.symlink`, :" -"func:`~os.unlink`, :func:`~os.utime`. Platform support for using these " -"parameters can be checked via the sets :data:`os.supports_dir_fd` and :data:" -"`os.supports_follows_symlinks`." +"following symlinks " +"<follow_symlinks>`): :func:`~os.access`, :func:`~os.chflags`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os.link`, :func:`~os.lstat`, :func:`~os.mkdir`, :func:`~os.mkfifo`, :func:`~os.mknod`, :func:`~os.open`, :func:`~os.readlink`, :func:`~os.remove`, :func:`~os.rename`, :func:`~os.replace`, :func:`~os.rmdir`, :func:`~os.stat`, :func:`~os.symlink`, :func:`~os.unlink`, :func:`~os.utime`. " +"Platform support for using these parameters can be checked via the " +"sets :data:`os.supports_dir_fd` and :data:`os.supports_follows_symlinks`." msgstr "" #: ../../whatsnew/3.3.rst:1616 msgid "" "The following functions now support a file descriptor for their path " -"argument: :func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`, :func:" -"`~os.execve`, :func:`~os.listdir`, :func:`~os.pathconf`, :func:`~os.path." -"exists`, :func:`~os.stat`, :func:`~os.statvfs`, :func:`~os.utime`. Platform " -"support for this can be checked via the :data:`os.supports_fd` set." +"argument: :func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os.execve`, :func:`~os.listdir`, :func:`~os.pathconf`, :func:`~os.path.exists`, :func:`~os.stat`, :func:`~os.statvfs`, :func:`~os.utime`. " +"Platform support for this can be checked via the :data:`os.supports_fd` set." msgstr "" #: ../../whatsnew/3.3.rst:1622 msgid "" ":func:`~os.access` accepts an ``effective_ids`` keyword argument to turn on " "using the effective uid/gid rather than the real uid/gid in the access " -"check. Platform support for this can be checked via the :data:`~os." -"supports_effective_ids` set." +"check. Platform support for this can be checked via " +"the :data:`~os.supports_effective_ids` set." msgstr "" #: ../../whatsnew/3.3.rst:1627 msgid "" -"The :mod:`os` module has two new functions: :func:`~os.getpriority` and :" -"func:`~os.setpriority`. They can be used to get or set process niceness/" +"The :mod:`os` module has two new functions: :func:`~os.getpriority` " +"and :func:`~os.setpriority`. They can be used to get or set process niceness/" "priority in a fashion similar to :func:`os.nice` but extended to all " "processes instead of just the current one." msgstr "" @@ -2709,37 +2716,32 @@ msgstr "" #: ../../whatsnew/3.3.rst:1640 msgid "" -"The stat family of functions (:func:`~os.stat`, :func:`~os.fstat`, and :func:" -"`~os.lstat`) now support reading a file's timestamps with nanosecond " -"precision. Symmetrically, :func:`~os.utime` can now write file timestamps " -"with nanosecond precision. (Contributed by Larry Hastings in :issue:" -"`14127`.)" +"The stat family of functions (:func:`~os.stat`, :func:`~os.fstat`, " +"and :func:`~os.lstat`) now support reading a file's timestamps with " +"nanosecond precision. Symmetrically, :func:`~os.utime` can now write file " +"timestamps with nanosecond precision. (Contributed by Larry Hastings " +"in :issue:`14127`.)" msgstr "" #: ../../whatsnew/3.3.rst:1646 msgid "" "The new :func:`os.get_terminal_size` function queries the size of the " -"terminal attached to a file descriptor. See also :func:`shutil." -"get_terminal_size`. (Contributed by Zbigniew Jędrzejewski-Szmek in :issue:" -"`13609`.)" +"terminal attached to a file descriptor. See " +"also :func:`shutil.get_terminal_size`. (Contributed by Zbigniew Jędrzejewski-" +"Szmek in :issue:`13609`.)" msgstr "" #: ../../whatsnew/3.3.rst:1653 msgid "" -"New functions to support Linux extended attributes (:issue:`12720`): :func:" -"`~os.getxattr`, :func:`~os.listxattr`, :func:`~os.removexattr`, :func:`~os." -"setxattr`." +"New functions to support Linux extended attributes " +"(:issue:`12720`): :func:`~os.getxattr`, :func:`~os.listxattr`, :func:`~os.removexattr`, :func:`~os.setxattr`." msgstr "" #: ../../whatsnew/3.3.rst:1657 msgid "" "New interface to the scheduler. These functions control how a process is " -"allocated CPU time by the operating system. New functions: :func:`~os." -"sched_get_priority_max`, :func:`~os.sched_get_priority_min`, :func:`~os." -"sched_getaffinity`, :func:`~os.sched_getparam`, :func:`~os." -"sched_getscheduler`, :func:`~os.sched_rr_get_interval`, :func:`~os." -"sched_setaffinity`, :func:`~os.sched_setparam`, :func:`~os." -"sched_setscheduler`, :func:`~os.sched_yield`," +"allocated CPU time by the operating system. New " +"functions: :func:`~os.sched_get_priority_max`, :func:`~os.sched_get_priority_min`, :func:`~os.sched_getaffinity`, :func:`~os.sched_getparam`, :func:`~os.sched_getscheduler`, :func:`~os.sched_rr_get_interval`, :func:`~os.sched_setaffinity`, :func:`~os.sched_setparam`, :func:`~os.sched_setscheduler`, :func:`~os.sched_yield`," msgstr "" #: ../../whatsnew/3.3.rst:1666 @@ -2827,12 +2829,12 @@ msgstr "" #: ../../whatsnew/3.3.rst:1696 msgid "" -"New constants :const:`~os.RTLD_LAZY`, :const:`~os.RTLD_NOW`, :const:`~os." -"RTLD_GLOBAL`, :const:`~os.RTLD_LOCAL`, :const:`~os.RTLD_NODELETE`, :const:" -"`~os.RTLD_NOLOAD`, and :const:`~os.RTLD_DEEPBIND` are available on platforms " -"that support them. These are for use with the :func:`sys.setdlopenflags` " -"function, and supersede the similar constants defined in :mod:`ctypes` and :" -"mod:`DLFCN`. (Contributed by Victor Stinner in :issue:`13226`.)" +"New " +"constants :const:`~os.RTLD_LAZY`, :const:`~os.RTLD_NOW`, :const:`~os.RTLD_GLOBAL`, :const:`~os.RTLD_LOCAL`, :const:`~os.RTLD_NODELETE`, :const:`~os.RTLD_NOLOAD`, " +"and :const:`~os.RTLD_DEEPBIND` are available on platforms that support " +"them. These are for use with the :func:`sys.setdlopenflags` function, and " +"supersede the similar constants defined in :mod:`ctypes` and :mod:`DLFCN`. " +"(Contributed by Victor Stinner in :issue:`13226`.)" msgstr "" #: ../../whatsnew/3.3.rst:1704 @@ -2862,8 +2864,9 @@ msgstr "pickle" #: ../../whatsnew/3.3.rst:1721 msgid "" -":class:`pickle.Pickler` objects now have an optional :attr:`~pickle.Pickler." -"dispatch_table` attribute allowing per-pickler reduction functions to be set." +":class:`pickle.Pickler` objects now have an " +"optional :attr:`~pickle.Pickler.dispatch_table` attribute allowing per-" +"pickler reduction functions to be set." msgstr "" #: ../../whatsnew/3.3.rst:1725 @@ -2876,8 +2879,8 @@ msgstr "pydoc" #: ../../whatsnew/3.3.rst:1731 msgid "" -"The Tk GUI and the :func:`~pydoc.serve` function have been removed from the :" -"mod:`pydoc` module: ``pydoc -g`` and :func:`~pydoc.serve` have been " +"The Tk GUI and the :func:`~pydoc.serve` function have been removed from " +"the :mod:`pydoc` module: ``pydoc -g`` and :func:`~pydoc.serve` have been " "deprecated in Python 3.2." msgstr "" @@ -2910,22 +2913,23 @@ msgstr "" #: ../../whatsnew/3.3.rst:1753 msgid "" ":class:`~sched.scheduler` class can now be safely used in multi-threaded " -"environments. (Contributed by Josiah Carlson and Giampaolo Rodolà in :issue:" -"`8684`.)" +"environments. (Contributed by Josiah Carlson and Giampaolo Rodolà " +"in :issue:`8684`.)" msgstr "" #: ../../whatsnew/3.3.rst:1757 msgid "" "*timefunc* and *delayfunct* parameters of :class:`~sched.scheduler` class " -"constructor are now optional and defaults to :func:`time.time` and :func:" -"`time.sleep` respectively. (Contributed by Chris Clark in :issue:`13245`.)" +"constructor are now optional and defaults to :func:`time.time` " +"and :func:`time.sleep` respectively. (Contributed by Chris Clark " +"in :issue:`13245`.)" msgstr "" #: ../../whatsnew/3.3.rst:1762 msgid "" ":meth:`~sched.scheduler.enter` and :meth:`~sched.scheduler.enterabs` " -"*argument* parameter is now optional. (Contributed by Chris Clark in :issue:" -"`13245`.)" +"*argument* parameter is now optional. (Contributed by Chris Clark " +"in :issue:`13245`.)" msgstr "" ":meth:`~sched.scheduler.enter` 和 :meth:`~sched.scheduler.enterabs` " "*argument* 參數現在是可選的。(由 Chris Clark 在 :issue:`13245` 中貢獻。)" @@ -2956,9 +2960,9 @@ msgstr "shlex" #: ../../whatsnew/3.3.rst:1782 msgid "" "The previously undocumented helper function ``quote`` from the :mod:`!pipes` " -"modules has been moved to the :mod:`shlex` module and documented. :func:" -"`~shlex.quote` properly escapes all characters in a string that might be " -"otherwise given special meaning by the shell." +"modules has been moved to the :mod:`shlex` module and " +"documented. :func:`~shlex.quote` properly escapes all characters in a " +"string that might be otherwise given special meaning by the shell." msgstr "" #: ../../whatsnew/3.3.rst:1789 @@ -3017,9 +3021,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:1818 msgid "" ":func:`~shutil.rmtree` is now resistant to symlink attacks on platforms " -"which support the new ``dir_fd`` parameter in :func:`os.open` and :func:`os." -"unlink`. (Contributed by Martin von Löwis and Hynek Schlawack in :issue:" -"`4489`.)" +"which support the new ``dir_fd`` parameter in :func:`os.open` " +"and :func:`os.unlink`. (Contributed by Martin von Löwis and Hynek Schlawack " +"in :issue:`4489`.)" msgstr "" #: ../../whatsnew/3.3.rst:1825 @@ -3082,9 +3086,10 @@ msgstr "smtpd" #: ../../whatsnew/3.3.rst:1850 msgid "" -"The :mod:`!smtpd` module now supports :rfc:`5321` (extended SMTP) and :rfc:" -"`1870` (size extension). Per the standard, these extensions are enabled if " -"and only if the client initiates the session with an ``EHLO`` command." +"The :mod:`!smtpd` module now supports :rfc:`5321` (extended SMTP) " +"and :rfc:`1870` (size extension). Per the standard, these extensions are " +"enabled if and only if the client initiates the session with an ``EHLO`` " +"command." msgstr "" #: ../../whatsnew/3.3.rst:1854 @@ -3100,11 +3105,11 @@ msgstr "smtplib" #: ../../whatsnew/3.3.rst:1862 msgid "" -"The :class:`~smtplib.SMTP`, :class:`~smtplib.SMTP_SSL`, and :class:`~smtplib." -"LMTP` classes now accept a ``source_address`` keyword argument to specify " -"the ``(host, port)`` to use as the source address in the bind call when " -"creating the outgoing socket. (Contributed by Paulo Scardine in :issue:" -"`11281`.)" +"The :class:`~smtplib.SMTP`, :class:`~smtplib.SMTP_SSL`, " +"and :class:`~smtplib.LMTP` classes now accept a ``source_address`` keyword " +"argument to specify the ``(host, port)`` to use as the source address in the " +"bind call when creating the outgoing socket. (Contributed by Paulo Scardine " +"in :issue:`11281`.)" msgstr "" #: ../../whatsnew/3.3.rst:1868 @@ -3118,9 +3123,10 @@ msgstr "" #: ../../whatsnew/3.3.rst:1872 msgid "" -"The :class:`~smtplib.SMTP_SSL` constructor and the :meth:`~smtplib.SMTP." -"starttls` method now accept an SSLContext parameter to control parameters of " -"the secure channel. (Contributed by Kasun Herath in :issue:`8809`.)" +"The :class:`~smtplib.SMTP_SSL` constructor and " +"the :meth:`~smtplib.SMTP.starttls` method now accept an SSLContext parameter " +"to control parameters of the secure channel. (Contributed by Kasun Herath " +"in :issue:`8809`.)" msgstr "" ":class:`~smtplib.SMTP_SSL` 構造函式和 :meth:`~smtplib.SMTP.starttls` 方法現在" "接受 SSLContext 參數來控制安全通道的參數。(由 Kasun Herath 在 :issue:`8809` " @@ -3168,22 +3174,22 @@ msgstr "" #: ../../whatsnew/3.3.rst:1894 msgid "" -"(Contributed by Matthias Fuchs, updated by Tiago Gonçalves in :issue:" -"`10141`.)" +"(Contributed by Matthias Fuchs, updated by Tiago Gonçalves " +"in :issue:`10141`.)" msgstr "" "(在 :issue:`10141` 中由 Matthias Fuchs 貢獻、並由 Tiago Gonçalves 更新。)" #: ../../whatsnew/3.3.rst:1896 msgid "" "The :class:`~socket.socket` class now supports the PF_RDS protocol family " -"(https://en.wikipedia.org/wiki/Reliable_Datagram_Sockets and `https://oss." -"oracle.com/projects/rds <https://web.archive.org/web/20130115155505/https://" -"oss.oracle.com/projects/rds/>`__)." +"(https://en.wikipedia.org/wiki/Reliable_Datagram_Sockets and `https://" +"oss.oracle.com/projects/rds <https://web.archive.org/web/20130115155505/" +"https://oss.oracle.com/projects/rds/>`__)." msgstr "" -":class:`~socket.socket` 類別現在支援 PF_RDS 協議系列(https://en.wikipedia." -"org/wiki/Reliable_Datagram_Sockets 和 `https://oss.oracle.com/projects/rds " -"<https://web.archive.org/web/20130115155505/https://oss.oracle.com/projects/" -"rds/>`__\\ )。" +":class:`~socket.socket` 類別現在支援 PF_RDS 協議系列(https://" +"en.wikipedia.org/wiki/Reliable_Datagram_Sockets 和 `https://oss.oracle.com/" +"projects/rds <https://web.archive.org/web/20130115155505/https://" +"oss.oracle.com/projects/rds/>`__\\ )。" #: ../../whatsnew/3.3.rst:1900 msgid "" @@ -3206,11 +3212,11 @@ msgstr "socketserver" #: ../../whatsnew/3.3.rst:1911 msgid "" -":class:`~socketserver.BaseServer` now has an overridable method :meth:" -"`~socketserver.BaseServer.service_actions` that is called by the :meth:" -"`~socketserver.BaseServer.serve_forever` method in the service loop. :class:" -"`~socketserver.ForkingMixIn` now uses this to clean up zombie child " -"processes. (Contributed by Justin Warkentin in :issue:`11109`.)" +":class:`~socketserver.BaseServer` now has an overridable " +"method :meth:`~socketserver.BaseServer.service_actions` that is called by " +"the :meth:`~socketserver.BaseServer.serve_forever` method in the service " +"loop. :class:`~socketserver.ForkingMixIn` now uses this to clean up zombie " +"child processes. (Contributed by Justin Warkentin in :issue:`11109`.)" msgstr "" #: ../../whatsnew/3.3.rst:1919 @@ -3219,9 +3225,10 @@ msgstr "sqlite3" #: ../../whatsnew/3.3.rst:1921 msgid "" -"New :class:`sqlite3.Connection` method :meth:`~sqlite3.Connection." -"set_trace_callback` can be used to capture a trace of all sql commands " -"processed by sqlite. (Contributed by Torsten Landschoff in :issue:`11688`.)" +"New :class:`sqlite3.Connection` " +"method :meth:`~sqlite3.Connection.set_trace_callback` can be used to capture " +"a trace of all sql commands processed by sqlite. (Contributed by Torsten " +"Landschoff in :issue:`11688`.)" msgstr "" #: ../../whatsnew/3.3.rst:1928 @@ -3256,16 +3263,16 @@ msgstr "" #: ../../whatsnew/3.3.rst:1942 msgid "" ":meth:`~ssl.SSLContext.load_cert_chain` now accepts a *password* argument to " -"be used if the private key is encrypted. (Contributed by Adam Simpkins in :" -"issue:`12803`.)" +"be used if the private key is encrypted. (Contributed by Adam Simpkins " +"in :issue:`12803`.)" msgstr "" #: ../../whatsnew/3.3.rst:1946 msgid "" "Diffie-Hellman key exchange, both regular and Elliptic Curve-based, is now " -"supported through the :meth:`~ssl.SSLContext.load_dh_params` and :meth:`~ssl." -"SSLContext.set_ecdh_curve` methods. (Contributed by Antoine Pitrou in :issue:" -"`13626` and :issue:`13627`.)" +"supported through the :meth:`~ssl.SSLContext.load_dh_params` " +"and :meth:`~ssl.SSLContext.set_ecdh_curve` methods. (Contributed by Antoine " +"Pitrou in :issue:`13626` and :issue:`13627`.)" msgstr "" #: ../../whatsnew/3.3.rst:1951 @@ -3278,9 +3285,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:1955 msgid "" "You can query the SSL compression algorithm used by an SSL socket, thanks to " -"its new :meth:`~ssl.SSLSocket.compression` method. The new attribute :const:" -"`~ssl.OP_NO_COMPRESSION` can be used to disable compression. (Contributed by " -"Antoine Pitrou in :issue:`13634`.)" +"its new :meth:`~ssl.SSLSocket.compression` method. The new " +"attribute :const:`~ssl.OP_NO_COMPRESSION` can be used to disable " +"compression. (Contributed by Antoine Pitrou in :issue:`13634`.)" msgstr "" #: ../../whatsnew/3.3.rst:1960 @@ -3292,9 +3299,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:1964 msgid "" -"SSL errors can now be introspected more easily thanks to :attr:`~ssl." -"SSLError.library` and :attr:`~ssl.SSLError.reason` attributes. (Contributed " -"by Antoine Pitrou in :issue:`14837`.)" +"SSL errors can now be introspected more easily thanks " +"to :attr:`~ssl.SSLError.library` and :attr:`~ssl.SSLError.reason` " +"attributes. (Contributed by Antoine Pitrou in :issue:`14837`.)" msgstr "" #: ../../whatsnew/3.3.rst:1968 @@ -3316,9 +3323,9 @@ msgstr "stat" #: ../../whatsnew/3.3.rst:1979 msgid "" -"The undocumented tarfile.filemode function has been moved to :func:`stat." -"filemode`. It can be used to convert a file's mode to a string of the form '-" -"rwxrwxrwx'." +"The undocumented tarfile.filemode function has been moved " +"to :func:`stat.filemode`. It can be used to convert a file's mode to a " +"string of the form '-rwxrwxrwx'." msgstr "" #: ../../whatsnew/3.3.rst:1983 @@ -3349,8 +3356,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:2000 msgid "" "A new constant :const:`~subprocess.DEVNULL` allows suppressing output in a " -"platform-independent fashion. (Contributed by Ross Lagerwall in :issue:" -"`5870`.)" +"platform-independent fashion. (Contributed by Ross Lagerwall " +"in :issue:`5870`.)" msgstr "" #: ../../whatsnew/3.3.rst:2006 @@ -3381,9 +3388,9 @@ msgstr "tempfile" #: ../../whatsnew/3.3.rst:2023 msgid "" -":class:`tempfile.SpooledTemporaryFile`\\'s :meth:`~tempfile." -"SpooledTemporaryFile.truncate` method now accepts a ``size`` parameter. " -"(Contributed by Ryan Kelly in :issue:`9957`.)" +":class:`tempfile.SpooledTemporaryFile`\\'s :meth:`~tempfile.SpooledTemporaryFile.truncate` " +"method now accepts a ``size`` parameter. (Contributed by Ryan Kelly " +"in :issue:`9957`.)" msgstr "" #: ../../whatsnew/3.3.rst:2029 @@ -3403,11 +3410,10 @@ msgstr "threading" #: ../../whatsnew/3.3.rst:2039 msgid "" -":class:`threading.Condition`, :class:`threading.Semaphore`, :class:" -"`threading.BoundedSemaphore`, :class:`threading.Event`, and :class:" -"`threading.Timer`, all of which used to be factory functions returning a " -"class instance, are now classes and may be subclassed. (Contributed by Éric " -"Araujo in :issue:`10968`.)" +":class:`threading.Condition`, :class:`threading.Semaphore`, :class:`threading.BoundedSemaphore`, :class:`threading.Event`, " +"and :class:`threading.Timer`, all of which used to be factory functions " +"returning a class instance, are now classes and may be subclassed. " +"(Contributed by Éric Araujo in :issue:`10968`.)" msgstr "" #: ../../whatsnew/3.3.rst:2045 @@ -3463,19 +3469,19 @@ msgstr "其他新功能:" #: ../../whatsnew/3.3.rst:2071 msgid "" -":func:`~time.clock_getres`, :func:`~time.clock_gettime` and :func:`~time." -"clock_settime` functions with :samp:`CLOCK_{xxx}` constants. (Contributed by " -"Victor Stinner in :issue:`10278`.)" +":func:`~time.clock_getres`, :func:`~time.clock_gettime` " +"and :func:`~time.clock_settime` functions with :samp:`CLOCK_{xxx}` " +"constants. (Contributed by Victor Stinner in :issue:`10278`.)" msgstr "" -":func:`~time.clock_getres`、:func:`~time.clock_gettime` 和 :func:`~time." -"clock_settime` 函式帶有 :samp:`CLOCK_{xxx}` 常數。(由 Victor Stinner 在 :" -"issue:`10278` 中貢獻。)" +":func:`~time.clock_getres`、:func:`~time.clock_gettime` " +"和 :func:`~time.clock_settime` 函式帶有 :samp:`CLOCK_{xxx}` 常數。(由 " +"Victor Stinner 在 :issue:`10278` 中貢獻。)" #: ../../whatsnew/3.3.rst:2075 msgid "" -"To improve cross platform consistency, :func:`~time.sleep` now raises a :exc:" -"`ValueError` when passed a negative sleep value. Previously this was an " -"error on posix, but produced an infinite sleep on Windows." +"To improve cross platform consistency, :func:`~time.sleep` now raises " +"a :exc:`ValueError` when passed a negative sleep value. Previously this was " +"an error on posix, but produced an infinite sleep on Windows." msgstr "" #: ../../whatsnew/3.3.rst:2081 @@ -3491,8 +3497,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:2087 msgid "" "The new functions :func:`types.new_class` and :func:`types.prepare_class` " -"provide support for :pep:`3115` compliant dynamic type creation. (:issue:" -"`14588`)" +"provide support for :pep:`3115` compliant dynamic type creation. " +"(:issue:`14588`)" msgstr "" #: ../../whatsnew/3.3.rst:2092 @@ -3503,8 +3509,8 @@ msgstr "unittest" msgid "" ":meth:`.assertRaises`, :meth:`.assertRaisesRegex`, :meth:`.assertWarns`, " "and :meth:`.assertWarnsRegex` now accept a keyword argument *msg* when used " -"as context managers. (Contributed by Ezio Melotti and Winston Ewert in :" -"issue:`10775`.)" +"as context managers. (Contributed by Ezio Melotti and Winston Ewert " +"in :issue:`10775`.)" msgstr "" #: ../../whatsnew/3.3.rst:2099 @@ -3540,12 +3546,12 @@ msgstr "webbrowser" #: ../../whatsnew/3.3.rst:2118 msgid "" "The :mod:`webbrowser` module supports more \"browsers\": Google Chrome " -"(named :program:`chrome`, :program:`chromium`, :program:`chrome-browser` or :" -"program:`chromium-browser` depending on the version and operating system), " -"and the generic launchers :program:`xdg-open`, from the FreeDesktop.org " -"project, and :program:`gvfs-open`, which is the default URI handler for " -"GNOME 3. (The former contributed by Arnaud Calmettes in :issue:`13620`, the " -"latter by Matthias Klose in :issue:`14493`.)" +"(named :program:`chrome`, :program:`chromium`, :program:`chrome-browser` " +"or :program:`chromium-browser` depending on the version and operating " +"system), and the generic launchers :program:`xdg-open`, from the " +"FreeDesktop.org project, and :program:`gvfs-open`, which is the default URI " +"handler for GNOME 3. (The former contributed by Arnaud Calmettes " +"in :issue:`13620`, the latter by Matthias Klose in :issue:`14493`.)" msgstr "" #: ../../whatsnew/3.3.rst:2128 @@ -3555,12 +3561,12 @@ msgstr "xml.etree.ElementTree" #: ../../whatsnew/3.3.rst:2130 msgid "" "The :mod:`xml.etree.ElementTree` module now imports its C accelerator by " -"default; there is no longer a need to explicitly import :mod:`xml.etree." -"cElementTree` (this module stays for backwards compatibility, but is now " -"deprecated). In addition, the ``iter`` family of methods of :class:`~xml." -"etree.ElementTree.Element` has been optimized (rewritten in C). The module's " -"documentation has also been greatly improved with added examples and a more " -"detailed reference." +"default; there is no longer a need to explicitly " +"import :mod:`xml.etree.cElementTree` (this module stays for backwards " +"compatibility, but is now deprecated). In addition, the ``iter`` family of " +"methods of :class:`~xml.etree.ElementTree.Element` has been optimized " +"(rewritten in C). The module's documentation has also been greatly improved " +"with added examples and a more detailed reference." msgstr "" #: ../../whatsnew/3.3.rst:2140 @@ -3620,19 +3626,19 @@ msgstr "" #: ../../whatsnew/3.3.rst:2167 msgid "" -"(Contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` and :issue:" -"`15026`.)" +"(Contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` " +"and :issue:`15026`.)" msgstr "" "(由 Serhiy Storchaka 於 :issue:`14624`、:issue:`14738` 和 :issue:`15026` 貢" "獻。)" #: ../../whatsnew/3.3.rst:2172 msgid "Build and C API Changes" -msgstr "建置和 C API 更改" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.3.rst:2174 msgid "Changes to Python's build process and to the C API include:" -msgstr "Python 建置程序和 C API 的更改包括:" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/3.3.rst:2176 msgid "New :pep:`3118` related function:" @@ -3699,27 +3705,18 @@ msgid ":c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`" msgstr ":c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`" #: ../../whatsnew/3.3.rst:2198 -msgid "" -":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:" -"`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" -msgstr "" -":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:" -"`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" +msgid ":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" +msgstr ":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" #: ../../whatsnew/3.3.rst:2200 msgid "" ":c:macro:`PyUnicode_KIND` with :c:enum:`PyUnicode_Kind` enum: :c:data:`!" -"PyUnicode_WCHAR_KIND`, :c:data:`PyUnicode_1BYTE_KIND`, :c:data:" -"`PyUnicode_2BYTE_KIND`, :c:data:`PyUnicode_4BYTE_KIND`" +"PyUnicode_WCHAR_KIND`, :c:data:`PyUnicode_1BYTE_KIND`, :c:data:`PyUnicode_2BYTE_KIND`, :c:data:`PyUnicode_4BYTE_KIND`" msgstr "" #: ../../whatsnew/3.3.rst:2203 -msgid "" -":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:" -"`PyUnicode_WRITE`" -msgstr "" -":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:" -"`PyUnicode_WRITE`" +msgid ":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:`PyUnicode_WRITE`" +msgstr ":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:`PyUnicode_WRITE`" #: ../../whatsnew/3.3.rst:2204 msgid ":c:macro:`PyUnicode_MAX_CHAR_VALUE`" @@ -3730,8 +3727,8 @@ msgid "" ":c:macro:`PyArg_ParseTuple` now accepts a :class:`bytearray` for the ``c`` " "format (:issue:`12380`)." msgstr "" -":c:macro:`PyArg_ParseTuple` 現在接受 :class:`bytearray` 為 ``c`` 格式 (:" -"issue:`12380`)。" +":c:macro:`PyArg_ParseTuple` 現在接受 :class:`bytearray` 為 ``c`` 格式 " +"(:issue:`12380`)。" #: ../../whatsnew/3.3.rst:2212 msgid "Deprecated" @@ -3767,26 +3764,26 @@ msgstr "" #: ../../whatsnew/3.3.rst:2230 msgid "" -"The ``unicode_internal`` codec has been deprecated because of the :pep:" -"`393`, use UTF-8, UTF-16 (``utf-16-le`` or ``utf-16-be``), or UTF-32 " -"(``utf-32-le`` or ``utf-32-be``)" +"The ``unicode_internal`` codec has been deprecated because of " +"the :pep:`393`, use UTF-8, UTF-16 (``utf-16-le`` or ``utf-16-be``), or " +"UTF-32 (``utf-32-le`` or ``utf-32-be``)" msgstr "" #: ../../whatsnew/3.3.rst:2233 msgid "" -":meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP.dir`: use :meth:`ftplib.FTP." -"mlsd`" +":meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP.dir`: " +"use :meth:`ftplib.FTP.mlsd`" msgstr "" -":meth:`ftplib.FTP.nlst` 和 :meth:`ftplib.FTP.dir`:使用 :meth:`ftplib.FTP." -"mlsd`" +":meth:`ftplib.FTP.nlst` 和 :meth:`ftplib.FTP.dir`:使" +"用 :meth:`ftplib.FTP.mlsd`" #: ../../whatsnew/3.3.rst:2235 msgid "" ":func:`platform.popen`: use the :mod:`subprocess` module. Check especially " "the :ref:`subprocess-replacements` section (:issue:`11377`)." msgstr "" -":func:`platform.popen`:使用 :mod:`subprocess` 模組。請特別檢查 :ref:" -"`subprocess-replacements` 部分 (:issue:`11377`)。" +":func:`platform.popen`:使用 :mod:`subprocess` 模組。請特別檢" +"查 :ref:`subprocess-replacements` 部分 (:issue:`11377`)。" #: ../../whatsnew/3.3.rst:2237 msgid "" @@ -3803,8 +3800,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:2242 msgid "" -"The behaviour of :func:`time.clock` depends on the platform: use the new :" -"func:`time.perf_counter` or :func:`time.process_time` function instead, " +"The behaviour of :func:`time.clock` depends on the platform: use the " +"new :func:`time.perf_counter` or :func:`time.process_time` function instead, " "depending on your requirements, to have a well defined behaviour." msgstr "" @@ -3842,17 +3839,17 @@ msgstr "" #: ../../whatsnew/3.3.rst:2272 msgid "" -"Unicode functions and methods using :c:type:`Py_UNICODE` and :c:expr:" -"`Py_UNICODE*` types:" +"Unicode functions and methods using :c:type:`Py_UNICODE` " +"and :c:expr:`Py_UNICODE*` types:" msgstr "" #: ../../whatsnew/3.3.rst:2275 msgid "" -":c:macro:`!PyUnicode_FromUnicode`: use :c:func:`PyUnicode_FromWideChar` or :" -"c:func:`PyUnicode_FromKindAndData`" +":c:macro:`!PyUnicode_FromUnicode`: use :c:func:`PyUnicode_FromWideChar` " +"or :c:func:`PyUnicode_FromKindAndData`" msgstr "" -":c:macro:`!PyUnicode_FromUnicode`:使用 :c:func:`PyUnicode_FromWideChar` 或 :" -"c:func:`PyUnicode_FromKindAndData`" +":c:macro:`!PyUnicode_FromUnicode`:使用 :c:func:`PyUnicode_FromWideChar` " +"或 :c:func:`PyUnicode_FromKindAndData`" #: ../../whatsnew/3.3.rst:2277 msgid "" @@ -3864,19 +3861,19 @@ msgstr "" #: ../../whatsnew/3.3.rst:2279 msgid "" -":c:macro:`!PyUnicode_AS_DATA`: use :c:macro:`PyUnicode_DATA` with :c:macro:" -"`PyUnicode_READ` and :c:macro:`PyUnicode_WRITE`" +":c:macro:`!PyUnicode_AS_DATA`: use :c:macro:`PyUnicode_DATA` " +"with :c:macro:`PyUnicode_READ` and :c:macro:`PyUnicode_WRITE`" msgstr "" -":c:macro:`!PyUnicode_AS_DATA`:將 :c:macro:`PyUnicode_DATA` 與 :c:macro:" -"`PyUnicode_READ` 和 :c:macro:`PyUnicode_WRITE` 一起使用" +":c:macro:`!PyUnicode_AS_DATA`:將 :c:macro:`PyUnicode_DATA` " +"與 :c:macro:`PyUnicode_READ` 和 :c:macro:`PyUnicode_WRITE` 一起使用" #: ../../whatsnew/3.3.rst:2281 msgid "" -":c:macro:`!PyUnicode_GET_SIZE`, :c:func:`!PyUnicode_GetSize`: use :c:macro:" -"`PyUnicode_GET_LENGTH` or :c:func:`PyUnicode_GetLength`" +":c:macro:`!PyUnicode_GET_SIZE`, :c:func:`!PyUnicode_GetSize`: " +"use :c:macro:`PyUnicode_GET_LENGTH` or :c:func:`PyUnicode_GetLength`" msgstr "" -":c:macro:`!PyUnicode_GET_SIZE`、:c:func:`!PyUnicode_GetSize`:使用 :c:macro:" -"`PyUnicode_GET_LENGTH` 或 :c:func:`PyUnicode_GetLength`" +":c:macro:`!PyUnicode_GET_SIZE`、:c:func:`!PyUnicode_GetSize`:使" +"用 :c:macro:`PyUnicode_GET_LENGTH` 或 :c:func:`PyUnicode_GetLength`" #: ../../whatsnew/3.3.rst:2283 msgid "" @@ -3888,11 +3885,11 @@ msgstr "" #: ../../whatsnew/3.3.rst:2286 msgid "" -":c:func:`!PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` or :c:" -"func:`PyUnicode_AsWideCharString`" +":c:func:`!PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` " +"or :c:func:`PyUnicode_AsWideCharString`" msgstr "" -":c:func:`!PyUnicode_AsUnicodeCopy`:使用 :c:func:`PyUnicode_AsUCS4Copy` 或 :" -"c:func:`PyUnicode_AsWideCharString`" +":c:func:`!PyUnicode_AsUnicodeCopy`:使用 :c:func:`PyUnicode_AsUCS4Copy` " +"或 :c:func:`PyUnicode_AsWideCharString`" #: ../../whatsnew/3.3.rst:2288 msgid ":c:func:`!PyUnicode_GetMax`" @@ -3904,29 +3901,29 @@ msgstr "操作 Py_UNICODE* 字串的函式和巨集:" #: ../../whatsnew/3.3.rst:2293 msgid "" -":c:macro:`!Py_UNICODE_strlen()`: use :c:func:`PyUnicode_GetLength` or :c:" -"macro:`PyUnicode_GET_LENGTH`" +":c:macro:`!Py_UNICODE_strlen()`: use :c:func:`PyUnicode_GetLength` " +"or :c:macro:`PyUnicode_GET_LENGTH`" msgstr "" -":c:macro:`!Py_UNICODE_strlen()`:使用 :c:func:`PyUnicode_GetLength` 或 :c:" -"macro:`PyUnicode_GET_LENGTH`" +":c:macro:`!Py_UNICODE_strlen()`:使用 :c:func:`PyUnicode_GetLength` " +"或 :c:macro:`PyUnicode_GET_LENGTH`" #: ../../whatsnew/3.3.rst:2295 msgid "" -":c:macro:`!Py_UNICODE_strcat()`: use :c:func:`PyUnicode_CopyCharacters` or :" -"c:func:`PyUnicode_FromFormat`" +":c:macro:`!Py_UNICODE_strcat()`: use :c:func:`PyUnicode_CopyCharacters` " +"or :c:func:`PyUnicode_FromFormat`" msgstr "" -":c:macro:`!Py_UNICODE_strcat()`:使用 :c:func:`PyUnicode_CopyCharacters` 或 :" -"c:func:`PyUnicode_FromFormat`" +":c:macro:`!Py_UNICODE_strcat()`:使用 :c:func:`PyUnicode_CopyCharacters` " +"或 :c:func:`PyUnicode_FromFormat`" #: ../../whatsnew/3.3.rst:2297 msgid "" -":c:macro:`!Py_UNICODE_strcpy()`, :c:macro:`!Py_UNICODE_strncpy()`, :c:macro:" -"`!Py_UNICODE_COPY()`: use :c:func:`PyUnicode_CopyCharacters` or :c:func:" -"`PyUnicode_Substring`" +":c:macro:`!Py_UNICODE_strcpy()`, :c:macro:`!" +"Py_UNICODE_strncpy()`, :c:macro:`!Py_UNICODE_COPY()`: " +"use :c:func:`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`" msgstr "" -":c:macro:`!Py_UNICODE_strcpy()`、:c:macro:`!Py_UNICODE_strncpy()`、:c:macro:" -"`!Py_UNICODE_COPY()`:使用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:" -"`PyUnicode_Substring`" +":c:macro:`!Py_UNICODE_strcpy()`、:c:macro:`!" +"Py_UNICODE_strncpy()`、:c:macro:`!Py_UNICODE_COPY()`:使" +"用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:`PyUnicode_Substring`" #: ../../whatsnew/3.3.rst:2300 msgid ":c:macro:`!Py_UNICODE_strcmp()`: use :c:func:`PyUnicode_Compare`" @@ -3938,11 +3935,11 @@ msgstr ":c:macro:`!Py_UNICODE_strncmp()`: 使用 :c:func:`PyUnicode_Tailmatch`" #: ../../whatsnew/3.3.rst:2302 msgid "" -":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: use :c:" -"func:`PyUnicode_FindChar`" +":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: " +"use :c:func:`PyUnicode_FindChar`" msgstr "" -":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: 使用 :c:" -"func:`PyUnicode_FindChar`" +":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: 使" +"用 :c:func:`PyUnicode_FindChar`" #: ../../whatsnew/3.3.rst:2304 msgid ":c:macro:`!Py_UNICODE_FILL()`: use :c:func:`PyUnicode_Fill`" @@ -3966,11 +3963,11 @@ msgstr ":c:func:`!PyUnicode_EncodeUTF7`" #: ../../whatsnew/3.3.rst:2311 msgid "" -":c:func:`!PyUnicode_EncodeUTF8`: use :c:func:`PyUnicode_AsUTF8` or :c:func:" -"`PyUnicode_AsUTF8String`" +":c:func:`!PyUnicode_EncodeUTF8`: use :c:func:`PyUnicode_AsUTF8` " +"or :c:func:`PyUnicode_AsUTF8String`" msgstr "" -":c:func:`!PyUnicode_EncodeUTF8`:使用 :c:func:`PyUnicode_AsUTF8` 或 :c:func:" -"`PyUnicode_AsUTF8String`" +":c:func:`!PyUnicode_EncodeUTF8`:使用 :c:func:`PyUnicode_AsUTF8` " +"或 :c:func:`PyUnicode_AsUTF8String`" #: ../../whatsnew/3.3.rst:2313 msgid ":c:func:`!PyUnicode_EncodeUTF32`" @@ -3982,19 +3979,19 @@ msgstr ":c:func:`!PyUnicode_EncodeUTF16`" #: ../../whatsnew/3.3.rst:2315 msgid "" -":c:func:`!PyUnicode_EncodeUnicodeEscape` use :c:func:" -"`PyUnicode_AsUnicodeEscapeString`" +":c:func:`!PyUnicode_EncodeUnicodeEscape` " +"use :c:func:`PyUnicode_AsUnicodeEscapeString`" msgstr "" -":c:func:`!PyUnicode_EncodeUnicodeEscape` 使用 :c:func:" -"`PyUnicode_AsUnicodeEscapeString`" +":c:func:`!PyUnicode_EncodeUnicodeEscape` 使" +"用 :c:func:`PyUnicode_AsUnicodeEscapeString`" #: ../../whatsnew/3.3.rst:2317 msgid "" -":c:func:`!PyUnicode_EncodeRawUnicodeEscape` use :c:func:" -"`PyUnicode_AsRawUnicodeEscapeString`" +":c:func:`!PyUnicode_EncodeRawUnicodeEscape` " +"use :c:func:`PyUnicode_AsRawUnicodeEscapeString`" msgstr "" -":c:func:`!PyUnicode_EncodeRawUnicodeEscape` 使用 :c:func:" -"`PyUnicode_AsRawUnicodeEscapeString`" +":c:func:`!PyUnicode_EncodeRawUnicodeEscape` 使" +"用 :c:func:`PyUnicode_AsRawUnicodeEscapeString`" #: ../../whatsnew/3.3.rst:2319 msgid "" @@ -4017,11 +4014,11 @@ msgstr ":c:func:`!PyUnicode_TranslateCharmap`" #: ../../whatsnew/3.3.rst:2323 msgid "" -":c:func:`!PyUnicode_EncodeMBCS`: use :c:func:`PyUnicode_AsMBCSString` or :c:" -"func:`PyUnicode_EncodeCodePage` (with ``CP_ACP`` code_page)" +":c:func:`!PyUnicode_EncodeMBCS`: use :c:func:`PyUnicode_AsMBCSString` " +"or :c:func:`PyUnicode_EncodeCodePage` (with ``CP_ACP`` code_page)" msgstr "" -":c:func:`!PyUnicode_EncodeMBCS`:使用 :c:func:`PyUnicode_AsMBCSString` 或 :c:" -"func:`PyUnicode_EncodeCodePage` (帶有 ``CP_ACP`` code_page)" +":c:func:`!PyUnicode_EncodeMBCS`:使用 :c:func:`PyUnicode_AsMBCSString` " +"或 :c:func:`PyUnicode_EncodeCodePage` (帶有 ``CP_ACP`` code_page)" #: ../../whatsnew/3.3.rst:2325 msgid "" @@ -4058,8 +4055,8 @@ msgstr "移植 Python 程式碼" #: ../../whatsnew/3.3.rst:2347 msgid "" "Hash randomization is enabled by default. Set the :envvar:`PYTHONHASHSEED` " -"environment variable to ``0`` to disable hash randomization. See also the :" -"meth:`object.__hash__` method." +"environment variable to ``0`` to disable hash randomization. See also " +"the :meth:`object.__hash__` method." msgstr "" #: ../../whatsnew/3.3.rst:2351 @@ -4073,19 +4070,19 @@ msgstr "" #: ../../whatsnew/3.3.rst:2357 msgid "" -":issue:`13847`, :issue:`14180`: :mod:`time` and :mod:`datetime`: :exc:" -"`OverflowError` is now raised instead of :exc:`ValueError` if a timestamp is " -"out of range. :exc:`OSError` is now raised if C functions :c:func:`gmtime` " -"or :c:func:`localtime` failed." +":issue:`13847`, :issue:`14180`: :mod:`time` " +"and :mod:`datetime`: :exc:`OverflowError` is now raised instead " +"of :exc:`ValueError` if a timestamp is out of range. :exc:`OSError` is now " +"raised if C functions :c:func:`gmtime` or :c:func:`localtime` failed." msgstr "" #: ../../whatsnew/3.3.rst:2362 msgid "" "The default finders used by import now utilize a cache of what is contained " "within a specific directory. If you create a Python source file or " -"sourceless bytecode file, make sure to call :func:`importlib." -"invalidate_caches` to clear out the cache for the finders to notice the new " -"file." +"sourceless bytecode file, make sure to " +"call :func:`importlib.invalidate_caches` to clear out the cache for the " +"finders to notice the new file." msgstr "" #: ../../whatsnew/3.3.rst:2367 @@ -4103,8 +4100,9 @@ msgid "" "was implemented that the default value remained -1. If you need to continue " "to perform a relative import followed by an absolute import, then perform " "the relative import using an index of 1, followed by another import using an " -"index of 0. It is preferred, though, that you use :func:`importlib." -"import_module` rather than call :func:`__import__` directly." +"index of 0. It is preferred, though, that you " +"use :func:`importlib.import_module` rather than call :func:`__import__` " +"directly." msgstr "" #: ../../whatsnew/3.3.rst:2380 @@ -4124,10 +4122,10 @@ msgstr "" msgid "" "Because ``None`` is now inserted into :data:`sys.path_importer_cache`, if " "you are clearing out entries in the dictionary of paths that do not have a " -"finder, you will need to remove keys paired with values of ``None`` **and** :" -"class:`!imp.NullImporter` to be backwards-compatible. This will lead to " -"extra overhead on older versions of Python that re-insert ``None`` into :" -"data:`sys.path_importer_cache` where it represents the use of implicit " +"finder, you will need to remove keys paired with values of ``None`` " +"**and** :class:`!imp.NullImporter` to be backwards-compatible. This will " +"lead to extra overhead on older versions of Python that re-insert ``None`` " +"into :data:`sys.path_importer_cache` where it represents the use of implicit " "finders, but semantically it should not change anything." msgstr "" @@ -4145,16 +4143,16 @@ msgid "" ":mod:`pkgutil` has been converted to use :mod:`importlib` internally. This " "eliminates many edge cases where the old behaviour of the :pep:`302` import " "emulation failed to match the behaviour of the real import system. The " -"import emulation itself is still present, but is now deprecated. The :func:" -"`pkgutil.iter_importers` and :func:`pkgutil.walk_packages` functions special " -"case the standard import hooks so they are still supported even though they " -"do not provide the non-standard ``iter_modules()`` method." +"import emulation itself is still present, but is now deprecated. " +"The :func:`pkgutil.iter_importers` and :func:`pkgutil.walk_packages` " +"functions special case the standard import hooks so they are still supported " +"even though they do not provide the non-standard ``iter_modules()`` method." msgstr "" #: ../../whatsnew/3.3.rst:2409 msgid "" -"A longstanding RFC-compliance bug (:issue:`1079`) in the parsing done by :" -"func:`email.header.decode_header` has been fixed. Code that uses the " +"A longstanding RFC-compliance bug (:issue:`1079`) in the parsing done " +"by :func:`email.header.decode_header` has been fixed. Code that uses the " "standard idiom to convert encoded headers into unicode " "(``str(make_header(decode_header(h))``) will see no change, but code that " "looks at the individual tuples returned by decode_header will see that " @@ -4176,9 +4174,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:2425 msgid "" ":meth:`poplib.POP3.quit` may now raise protocol errors like all other " -"``poplib`` methods. Code that assumes ``quit`` does not raise :exc:`poplib." -"error_proto` errors may need to be changed if errors on ``quit`` are " -"encountered by a particular application (:issue:`11291`)." +"``poplib`` methods. Code that assumes ``quit`` does not " +"raise :exc:`poplib.error_proto` errors may need to be changed if errors on " +"``quit`` are encountered by a particular application (:issue:`11291`)." msgstr "" #: ../../whatsnew/3.3.rst:2430 @@ -4201,9 +4199,9 @@ msgstr "已棄用的變數 ``time.accept2dyear`` 已被刪除。" #: ../../whatsnew/3.3.rst:2438 msgid "" -"The deprecated ``Context._clamp`` attribute has been removed from the :mod:" -"`decimal` module. It was previously replaced by the public attribute :attr:" -"`~decimal.Context.clamp`. (See :issue:`8540`.)" +"The deprecated ``Context._clamp`` attribute has been removed from " +"the :mod:`decimal` module. It was previously replaced by the public " +"attribute :attr:`~decimal.Context.clamp`. (See :issue:`8540`.)" msgstr "" #: ../../whatsnew/3.3.rst:2442 @@ -4264,16 +4262,16 @@ msgid "" "functions using this type are deprecated (but will stay available for at " "least five years). If you were using low-level Unicode APIs to construct " "and access unicode objects and you want to benefit of the memory footprint " -"reduction provided by :pep:`393`, you have to convert your code to the new :" -"doc:`Unicode API <../c-api/unicode>`." +"reduction provided by :pep:`393`, you have to convert your code to the " +"new :doc:`Unicode API <../c-api/unicode>`." msgstr "" #: ../../whatsnew/3.3.rst:2481 msgid "" -"However, if you only have been using high-level functions such as :c:func:" -"`PyUnicode_Concat()`, :c:func:`PyUnicode_Join` or :c:func:" -"`PyUnicode_FromFormat()`, your code will automatically take advantage of the " -"new unicode representations." +"However, if you only have been using high-level functions such " +"as :c:func:`PyUnicode_Concat()`, :c:func:`PyUnicode_Join` " +"or :c:func:`PyUnicode_FromFormat()`, your code will automatically take " +"advantage of the new unicode representations." msgstr "" #: ../../whatsnew/3.3.rst:2486 @@ -4284,8 +4282,8 @@ msgstr ":c:func:`PyImport_GetMagicNumber` 現在在失敗時回傳 ``-1``。" msgid "" "As a negative value for the *level* argument to :func:`__import__` is no " "longer valid, the same now holds for :c:func:`PyImport_ImportModuleLevel`. " -"This also means that the value of *level* used by :c:func:" -"`PyImport_ImportModuleEx` is now ``0`` instead of ``-1``." +"This also means that the value of *level* used " +"by :c:func:`PyImport_ImportModuleEx` is now ``0`` instead of ``-1``." msgstr "" #: ../../whatsnew/3.3.rst:2495 diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index 2d40afa84d..7c5cc676f0 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -53,11 +53,11 @@ msgstr "新增語法特性:" #: ../../whatsnew/3.4.rst:82 msgid "No new syntax features were added in Python 3.4." -msgstr "" +msgstr "Python 3.4 沒有新增任何新的語法特性。" #: ../../whatsnew/3.4.rst:84 msgid "Other new features:" -msgstr "" +msgstr "其他新特性:" #: ../../whatsnew/3.4.rst:86 msgid ":ref:`pip should always be available <whatsnew-pep-453>` (:pep:`453`)." @@ -71,8 +71,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:89 msgid "" -"command line option for :ref:`isolated mode <whatsnew-isolated-mode>` (:" -"issue:`16499`)." +"command line option for :ref:`isolated mode <whatsnew-isolated-mode>` " +"(:issue:`16499`)." msgstr "" #: ../../whatsnew/3.4.rst:91 @@ -83,8 +83,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:93 msgid "" -":ref:`A ModuleSpec Type <whatsnew-pep-451>` for the Import System (:pep:" -"`451`). (Affects importer authors.)" +":ref:`A ModuleSpec Type <whatsnew-pep-451>` for the Import System " +"(:pep:`451`). (Affects importer authors.)" msgstr "" #: ../../whatsnew/3.4.rst:95 @@ -102,30 +102,35 @@ msgid "" ":mod:`asyncio`: :ref:`New provisional API for asynchronous IO <whatsnew-" "asyncio>` (:pep:`3156`)." msgstr "" +":mod:`asyncio`: :ref:`新的用於非同步 IO 的臨時 API <whatsnew-asyncio>` " +"(:pep:`3156`)。" #: ../../whatsnew/3.4.rst:102 msgid "" ":mod:`ensurepip`: :ref:`Bootstrapping the pip installer <whatsnew-" "ensurepip>` (:pep:`453`)." msgstr "" +":mod:`ensurepip`: :ref:`初始建置 pip 安裝程式 <whatsnew-ensurepip>` " +"(:pep:`453`)。" #: ../../whatsnew/3.4.rst:104 msgid "" -":mod:`enum`: :ref:`Support for enumeration types <whatsnew-enum>` (:pep:" -"`435`)." -msgstr "" +":mod:`enum`: :ref:`Support for enumeration types <whatsnew-enum>` " +"(:pep:`435`)." +msgstr ":mod:`enum`: :ref:`支援列舉型別 <whatsnew-enum>` (:pep:`435`)。" #: ../../whatsnew/3.4.rst:106 msgid "" -":mod:`pathlib`: :ref:`Object-oriented filesystem paths <whatsnew-pathlib>` (:" -"pep:`428`)." +":mod:`pathlib`: :ref:`Object-oriented filesystem paths <whatsnew-pathlib>` " +"(:pep:`428`)." msgstr "" +":mod:`pathlib`: :ref:`物件導向檔案系統路徑 <whatsnew-pathlib>` (:pep:`428`)。" #: ../../whatsnew/3.4.rst:108 msgid "" ":mod:`selectors`: :ref:`High-level and efficient I/O multiplexing <whatsnew-" -"selectors>`, built upon the :mod:`select` module primitives (part of :pep:" -"`3156`)." +"selectors>`, built upon the :mod:`select` module primitives (part " +"of :pep:`3156`)." msgstr "" #: ../../whatsnew/3.4.rst:111 @@ -139,34 +144,38 @@ msgid "" ":mod:`tracemalloc`: :ref:`Trace Python memory allocations <whatsnew-" "tracemalloc>` (:pep:`454`)." msgstr "" +":mod:`tracemalloc`: :ref:`追蹤 Python 記憶體配置 <whatsnew-tracemalloc>` " +"(:pep:`454`)。" #: ../../whatsnew/3.4.rst:116 msgid "Significantly improved library modules:" -msgstr "" +msgstr "顯著改進的函式庫模組:" #: ../../whatsnew/3.4.rst:118 msgid "" -":ref:`Single-dispatch generic functions <whatsnew-singledispatch>` in :mod:" -"`functools` (:pep:`443`)." +":ref:`Single-dispatch generic functions <whatsnew-singledispatch>` " +"in :mod:`functools` (:pep:`443`)." msgstr "" #: ../../whatsnew/3.4.rst:120 msgid "" "New :mod:`pickle` :ref:`protocol 4 <whatsnew-protocol-4>` (:pep:`3154`)." -msgstr "" +msgstr "新的 :mod:`pickle` :ref:`協定 4 <whatsnew-protocol-4>` (:pep:`3154`)。" #: ../../whatsnew/3.4.rst:121 msgid "" ":mod:`multiprocessing` now has :ref:`an option to avoid using os.fork on " "Unix <whatsnew-multiprocessing-no-fork>` (:issue:`8713`)." msgstr "" +":mod:`multiprocessing` 現在有\\ :ref:`一個選項可以避免在 Unix 上使用 os.fork " +"<whatsnew-multiprocessing-no-fork>` (:issue:`8713`)。" #: ../../whatsnew/3.4.rst:123 msgid "" -":mod:`email` has a new submodule, :mod:`~email.contentmanager`, and a new :" -"mod:`~email.message.Message` subclass (:class:`~email.contentmanager." -"EmailMessage`) that :ref:`simplify MIME handling " -"<whatsnew_email_contentmanager>` (:issue:`18891`)." +":mod:`email` has a new submodule, :mod:`~email.contentmanager`, and a " +"new :mod:`~email.message.Message` subclass " +"(:class:`~email.contentmanager.EmailMessage`) that :ref:`simplify MIME " +"handling <whatsnew_email_contentmanager>` (:issue:`18891`)." msgstr "" #: ../../whatsnew/3.4.rst:127 @@ -178,7 +187,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:130 msgid "The :mod:`ipaddress` module API has been declared stable" -msgstr "" +msgstr ":mod:`ipaddress` 模組 API 已宣告為穩定版本" #: ../../whatsnew/3.4.rst:132 msgid "Security improvements:" @@ -186,8 +195,8 @@ msgstr "安全性改進:" #: ../../whatsnew/3.4.rst:134 msgid "" -":ref:`Secure and interchangeable hash algorithm <whatsnew-pep-456>` (:pep:" -"`456`)." +":ref:`Secure and interchangeable hash algorithm <whatsnew-pep-456>` " +"(:pep:`456`)." msgstr "" #: ../../whatsnew/3.4.rst:136 @@ -198,9 +207,11 @@ msgstr "" #: ../../whatsnew/3.4.rst:138 msgid "" -"New command line option for :ref:`isolated mode <whatsnew-isolated-mode>`, (:" -"issue:`16499`)." +"New command line option for :ref:`isolated mode <whatsnew-isolated-mode>`, " +"(:issue:`16499`)." msgstr "" +"用於\\ :ref:`隔離模式 <whatsnew-isolated-mode>`\\ 的新命令列選項 " +"(:issue:`16499`)。" #: ../../whatsnew/3.4.rst:140 msgid "" @@ -220,10 +231,12 @@ msgid "" "A new :func:`hashlib.pbkdf2_hmac` function provides the `PKCS#5 password-" "based key derivation function 2 <https://en.wikipedia.org/wiki/PBKDF2>`_." msgstr "" +"新的 :func:`hashlib.pbkdf2_hmac` 函式提供了\\ `基於密碼的 PKCS#5 密鑰生成函" +"式 2 <https://en.wikipedia.org/wiki/PBKDF2>`_。" #: ../../whatsnew/3.4.rst:148 msgid ":ref:`TLSv1.1 and TLSv1.2 support <whatsnew-tls-11-12>` for :mod:`ssl`." -msgstr "" +msgstr ":mod:`ssl` :ref:`對 TLSv1.1 和 TLSv1.2 的支援 <whatsnew-tls-11-12>`。" #: ../../whatsnew/3.4.rst:149 msgid "" @@ -246,14 +259,14 @@ msgstr "" #: ../../whatsnew/3.4.rst:155 msgid "" "All modules in the standard library that support SSL now support server " -"certificate verification, including hostname matching (:func:`ssl." -"match_hostname`) and CRLs (Certificate Revocation lists, see :func:`ssl." -"SSLContext.load_verify_locations`)." +"certificate verification, including hostname matching " +"(:func:`ssl.match_hostname`) and CRLs (Certificate Revocation lists, " +"see :func:`ssl.SSLContext.load_verify_locations`)." msgstr "" #: ../../whatsnew/3.4.rst:160 msgid "CPython implementation improvements:" -msgstr "" +msgstr "CPython 實作改進:" #: ../../whatsnew/3.4.rst:162 msgid ":ref:`Safe object finalization <whatsnew-pep-442>` (:pep:`442`)." @@ -363,7 +376,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:237 msgid "Documentation Changes" -msgstr "" +msgstr "文件更動" #: ../../whatsnew/3.4.rst:239 msgid "" @@ -378,8 +391,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:247 msgid "" "However, as this migration is currently still incomplete, the legacy " -"versions of those guides remaining available as :ref:`install-index` and :" -"ref:`setuptools-index`." +"versions of those guides remaining available as :ref:`install-index` " +"and :ref:`setuptools-index`." msgstr "" #: ../../whatsnew/3.4.rst:253 @@ -413,21 +426,19 @@ msgstr "" #: ../../whatsnew/3.4.rst:272 msgid ":func:`os.get_inheritable`, :func:`os.set_inheritable`" -msgstr ":func:`os.get_inheritable`, :func:`os.set_inheritable`" +msgstr ":func:`os.get_inheritable`、:func:`os.set_inheritable`" #: ../../whatsnew/3.4.rst:273 msgid ":func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`" -msgstr ":func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`" +msgstr ":func:`os.get_handle_inheritable`、:func:`os.set_handle_inheritable`" #: ../../whatsnew/3.4.rst:274 -msgid "" -":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" -msgstr "" -":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" +msgid ":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" +msgstr ":meth:`socket.socket.get_inheritable`、:meth:`socket.socket.set_inheritable`" #: ../../whatsnew/3.4.rst:278 msgid ":pep:`446` -- Make newly created file descriptors non-inheritable" -msgstr "" +msgstr ":pep:`446` - 使新建立的檔案描述器不可繼承" #: ../../whatsnew/3.4.rst:279 ../../whatsnew/3.4.rst:1811 msgid "PEP written and implemented by Victor Stinner." @@ -435,7 +446,7 @@ msgstr "由 Victor Stinner 撰寫 PEP 與實作。" #: ../../whatsnew/3.4.rst:285 msgid "Improvements to Codec Handling" -msgstr "" +msgstr "編解碼器處理的改進" #: ../../whatsnew/3.4.rst:287 msgid "" @@ -448,19 +459,20 @@ msgstr "" #: ../../whatsnew/3.4.rst:294 msgid "" -"As a key step in clarifying the situation, the :meth:`codecs.encode` and :" -"meth:`codecs.decode` convenience functions are now properly documented in " -"Python 2.7, 3.3 and 3.4. These functions have existed in the :mod:`codecs` " -"module (and have been covered by the regression test suite) since Python " -"2.4, but were previously only discoverable through runtime introspection." +"As a key step in clarifying the situation, the :meth:`codecs.encode` " +"and :meth:`codecs.decode` convenience functions are now properly documented " +"in Python 2.7, 3.3 and 3.4. These functions have existed in " +"the :mod:`codecs` module (and have been covered by the regression test " +"suite) since Python 2.4, but were previously only discoverable through " +"runtime introspection." msgstr "" #: ../../whatsnew/3.4.rst:300 msgid "" -"Unlike the convenience methods on :class:`str`, :class:`bytes` and :class:" -"`bytearray`, the :mod:`codecs` convenience functions support arbitrary " -"codecs in both Python 2 and Python 3, rather than being limited to Unicode " -"text encodings (in Python 3) or ``basestring`` <-> ``basestring`` " +"Unlike the convenience methods on :class:`str`, :class:`bytes` " +"and :class:`bytearray`, the :mod:`codecs` convenience functions support " +"arbitrary codecs in both Python 2 and Python 3, rather than being limited to " +"Unicode text encodings (in Python 3) or ``basestring`` <-> ``basestring`` " "conversions (in Python 2)." msgstr "" @@ -568,6 +580,11 @@ msgid "" ">>> decode(b\"68656c6c6f\", \"hex\")\n" "b'hello'" msgstr "" +">>> from codecs import encode, decode\n" +">>> encode(b\"hello\", \"hex\")\n" +"b'68656c6c6f'\n" +">>> decode(b\"68656c6c6f\", \"hex\")\n" +"b'hello'" #: ../../whatsnew/3.4.rst:370 msgid "" @@ -577,15 +594,15 @@ msgstr "" #: ../../whatsnew/3.4.rst:373 msgid "" -"(Contributed by Nick Coghlan in :issue:`7475`, :issue:`17827`, :issue:" -"`17828` and :issue:`19619`.)" +"(Contributed by Nick Coghlan " +"in :issue:`7475`, :issue:`17827`, :issue:`17828` and :issue:`19619`.)" msgstr "" -"(由 Nick Coghlan 在 :issue:`7475`、:issue:`17827`、:issue:`17828` 和 :issue:" -"`19619` 中貢獻。)" +"(由 Nick Coghlan 在 :issue:`7475`、:issue:`17827`、:issue:`17828` " +"和 :issue:`19619` 中貢獻。)" #: ../../whatsnew/3.4.rst:380 msgid "PEP 451: A ModuleSpec Type for the Import System" -msgstr "" +msgstr "PEP 451:用於引入系統的 ModuleSpec 型別" #: ../../whatsnew/3.4.rst:382 msgid "" @@ -602,9 +619,9 @@ msgid "" "Furthermore, they should be transparent to everyone but importer authors. " "Key finder and loader methods have been deprecated, but they will continue " "working. New importers should use the new methods described in the PEP. " -"Existing importers should be updated to implement the new methods. See the :" -"ref:`deprecated-3.4` section for a list of methods that should be replaced " -"and their replacements." +"Existing importers should be updated to implement the new methods. See " +"the :ref:`deprecated-3.4` section for a list of methods that should be " +"replaced and their replacements." msgstr "" #: ../../whatsnew/3.4.rst:400 @@ -623,8 +640,8 @@ msgstr "" msgid "" ":func:`min` and :func:`max` now accept a *default* keyword-only argument " "that can be used to specify the value they return if the iterable they are " -"evaluating has no elements. (Contributed by Julian Berman in :issue:" -"`18111`.)" +"evaluating has no elements. (Contributed by Julian Berman " +"in :issue:`18111`.)" msgstr "" #: ../../whatsnew/3.4.rst:411 @@ -634,9 +651,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:413 msgid "" "Module ``__file__`` attributes (and related values) should now always " -"contain absolute paths by default, with the sole exception of ``__main__." -"__file__`` when a script has been executed directly using a relative path. " -"(Contributed by Brett Cannon in :issue:`18416`.)" +"contain absolute paths by default, with the sole exception of " +"``__main__.__file__`` when a script has been executed directly using a " +"relative path. (Contributed by Brett Cannon in :issue:`18416`.)" msgstr "" #: ../../whatsnew/3.4.rst:418 @@ -664,8 +681,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:431 msgid "" ":class:`bytes`.join() and :class:`bytearray`.join() now accept arbitrary " -"buffer objects as arguments. (Contributed by Antoine Pitrou in :issue:" -"`15958`.)" +"buffer objects as arguments. (Contributed by Antoine Pitrou " +"in :issue:`15958`.)" msgstr "" #: ../../whatsnew/3.4.rst:435 @@ -684,9 +701,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:443 msgid "" -":class:`memoryview` is now registered as a :class:`Sequence <collections." -"abc>`, and supports the :func:`reversed` builtin. (Contributed by Nick " -"Coghlan and Claudiu Popa in :issue:`18690` and :issue:`19078`.)" +":class:`memoryview` is now registered as a :class:`Sequence " +"<collections.abc>`, and supports the :func:`reversed` builtin. (Contributed " +"by Nick Coghlan and Claudiu Popa in :issue:`18690` and :issue:`19078`.)" msgstr "" #: ../../whatsnew/3.4.rst:447 @@ -699,8 +716,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:451 msgid "" ":meth:`~object.__length_hint__` is now part of the formal language " -"specification (see :pep:`424`). (Contributed by Armin Ronacher in :issue:" -"`16148`.)" +"specification (see :pep:`424`). (Contributed by Armin Ronacher " +"in :issue:`16148`.)" msgstr "" #: ../../whatsnew/3.4.rst:457 @@ -737,11 +754,11 @@ msgstr "ensurepip" #: ../../whatsnew/3.4.rst:483 msgid "" -"The new :mod:`ensurepip` module is the primary infrastructure for the :pep:" -"`453` implementation. In the normal course of events end users will not " -"need to interact with this module, but it can be used to manually bootstrap " -"``pip`` if the automated bootstrapping into an installation or virtual " -"environment was declined." +"The new :mod:`ensurepip` module is the primary infrastructure for " +"the :pep:`453` implementation. In the normal course of events end users " +"will not need to interact with this module, but it can be used to manually " +"bootstrap ``pip`` if the automated bootstrapping into an installation or " +"virtual environment was declined." msgstr "" #: ../../whatsnew/3.4.rst:489 @@ -771,10 +788,10 @@ msgstr "enum" #: ../../whatsnew/3.4.rst:509 msgid "" "The new :mod:`enum` module (defined in :pep:`435`) provides a standard " -"implementation of enumeration types, allowing other modules (such as :mod:" -"`socket`) to provide more informative error messages and better debugging " -"support by replacing opaque integer constants with backwards compatible " -"enumeration values." +"implementation of enumeration types, allowing other modules (such " +"as :mod:`socket`) to provide more informative error messages and better " +"debugging support by replacing opaque integer constants with backwards " +"compatible enumeration values." msgstr "" #: ../../whatsnew/3.4.rst:517 @@ -814,9 +831,9 @@ msgstr "selectors" #: ../../whatsnew/3.4.rst:546 msgid "" -"The new :mod:`selectors` module (created as part of implementing :pep:" -"`3156`) allows high-level and efficient I/O multiplexing, built upon the :" -"mod:`select` module primitives." +"The new :mod:`selectors` module (created as part of " +"implementing :pep:`3156`) allows high-level and efficient I/O multiplexing, " +"built upon the :mod:`select` module primitives." msgstr "" #: ../../whatsnew/3.4.rst:554 @@ -916,9 +933,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:615 ../../whatsnew/3.4.rst:1542 msgid "" -"The :meth:`!writeframesraw` and :meth:`!writeframes` methods now accept any :" -"term:`bytes-like object`. (Contributed by Serhiy Storchaka in :issue:" -"`8311`.)" +"The :meth:`!writeframesraw` and :meth:`!writeframes` methods now accept " +"any :term:`bytes-like object`. (Contributed by Serhiy Storchaka " +"in :issue:`8311`.)" msgstr "" #: ../../whatsnew/3.4.rst:621 @@ -961,21 +978,22 @@ msgstr "base64" #: ../../whatsnew/3.4.rst:646 msgid "" -"The encoding and decoding functions in :mod:`base64` now accept any :term:" -"`bytes-like object` in cases where it previously required a :class:`bytes` " -"or :class:`bytearray` instance. (Contributed by Nick Coghlan in :issue:" -"`17839`.)" +"The encoding and decoding functions in :mod:`base64` now accept " +"any :term:`bytes-like object` in cases where it previously required " +"a :class:`bytes` or :class:`bytearray` instance. (Contributed by Nick " +"Coghlan in :issue:`17839`.)" msgstr "" #: ../../whatsnew/3.4.rst:651 msgid "" -"New functions :func:`~base64.a85encode`, :func:`~base64.a85decode`, :func:" -"`~base64.b85encode`, and :func:`~base64.b85decode` provide the ability to " -"encode and decode binary data from and to ``Ascii85`` and the git/mercurial " -"``Base85`` formats, respectively. The ``a85`` functions have options that " -"can be used to make them compatible with the variants of the ``Ascii85`` " -"encoding, including the Adobe variant. (Contributed by Martin Morrison, the " -"Mercurial project, Serhiy Storchaka, and Antoine Pitrou in :issue:`17618`.)" +"New " +"functions :func:`~base64.a85encode`, :func:`~base64.a85decode`, :func:`~base64.b85encode`, " +"and :func:`~base64.b85decode` provide the ability to encode and decode " +"binary data from and to ``Ascii85`` and the git/mercurial ``Base85`` " +"formats, respectively. The ``a85`` functions have options that can be used " +"to make them compatible with the variants of the ``Ascii85`` encoding, " +"including the Adobe variant. (Contributed by Martin Morrison, the Mercurial " +"project, Serhiy Storchaka, and Antoine Pitrou in :issue:`17618`.)" msgstr "" #: ../../whatsnew/3.4.rst:661 @@ -1017,21 +1035,21 @@ msgstr "" #: ../../whatsnew/3.4.rst:686 msgid "" "The new :func:`contextlib.redirect_stdout` context manager makes it easier " -"for utility scripts to handle inflexible APIs that write their output to :" -"data:`sys.stdout` and don't provide any options to redirect it. Using the " -"context manager, the :data:`sys.stdout` output can be redirected to any " +"for utility scripts to handle inflexible APIs that write their output " +"to :data:`sys.stdout` and don't provide any options to redirect it. Using " +"the context manager, the :data:`sys.stdout` output can be redirected to any " "other stream or, in conjunction with :class:`io.StringIO`, to a string. The " "latter can be especially useful, for example, to capture output from a " "function that was written to implement a command line interface. It is " -"recommended only for utility scripts because it affects the global state of :" -"data:`sys.stdout`. (Contributed by Raymond Hettinger in :issue:`15805`.)" +"recommended only for utility scripts because it affects the global state " +"of :data:`sys.stdout`. (Contributed by Raymond Hettinger in :issue:`15805`.)" msgstr "" #: ../../whatsnew/3.4.rst:697 msgid "" -"The :mod:`contextlib` documentation has also been updated to include a :ref:" -"`discussion <single-use-reusable-and-reentrant-cms>` of the differences " -"between single use, reusable and reentrant context managers." +"The :mod:`contextlib` documentation has also been updated to include " +"a :ref:`discussion <single-use-reusable-and-reentrant-cms>` of the " +"differences between single use, reusable and reentrant context managers." msgstr "" #: ../../whatsnew/3.4.rst:703 @@ -1052,8 +1070,8 @@ msgstr "dis" #: ../../whatsnew/3.4.rst:714 msgid "" -"Functions :func:`~dis.show_code`, :func:`~dis.dis`, :func:`~dis.distb`, and :" -"func:`~dis.disassemble` now accept a keyword-only *file* argument that " +"Functions :func:`~dis.show_code`, :func:`~dis.dis`, :func:`~dis.distb`, " +"and :func:`~dis.disassemble` now accept a keyword-only *file* argument that " "controls where they write their output." msgstr "" @@ -1101,12 +1119,13 @@ msgstr "" msgid "" "In addition, a new application-friendly class :class:`~dis.Bytecode` " "provides an object-oriented API for inspecting bytecode in both in human-" -"readable form and for iterating over instructions. The :class:`~dis." -"Bytecode` constructor takes the same arguments that :func:`~dis." -"get_instruction` does (plus an optional *current_offset*), and the resulting " -"object can be iterated to produce :class:`~dis.Instruction` objects. But it " -"also has a :mod:`~dis.Bytecode.dis` method, equivalent to calling :mod:`~dis." -"dis` on the constructor argument, but returned as a multi-line string::" +"readable form and for iterating over instructions. " +"The :class:`~dis.Bytecode` constructor takes the same arguments " +"that :func:`~dis.get_instruction` does (plus an optional *current_offset*), " +"and the resulting object can be iterated to " +"produce :class:`~dis.Instruction` objects. But it also has " +"a :mod:`~dis.Bytecode.dis` method, equivalent to calling :mod:`~dis.dis` on " +"the constructor argument, but returned as a multi-line string::" msgstr "" #: ../../whatsnew/3.4.rst:748 @@ -1118,25 +1137,37 @@ msgid "" "LOAD_CONST (100)\n" "BINARY_ADD (23)\n" "RETURN_VALUE (83)\n" -">>> bytecode.dis().splitlines() \n" +">>> bytecode.dis().splitlines()\n" "[' 1 0 LOAD_FAST 0 (x)',\n" " ' --> 3 LOAD_CONST 1 (1)',\n" " ' 6 BINARY_ADD',\n" " ' 7 RETURN_VALUE']" msgstr "" +">>> bytecode = dis.Bytecode(lambda x: x + 1, current_offset=3)\n" +">>> for instr in bytecode:\n" +"... print('{} ({})'.format(instr.opname, instr.opcode))\n" +"LOAD_FAST (124)\n" +"LOAD_CONST (100)\n" +"BINARY_ADD (23)\n" +"RETURN_VALUE (83)\n" +">>> bytecode.dis().splitlines()\n" +"[' 1 0 LOAD_FAST 0 (x)',\n" +" ' --> 3 LOAD_CONST 1 (1)',\n" +" ' 6 BINARY_ADD',\n" +" ' 7 RETURN_VALUE']" #: ../../whatsnew/3.4.rst:761 msgid "" -":class:`~dis.Bytecode` also has a class method, :meth:`~dis.Bytecode." -"from_traceback`, that provides the ability to manipulate a traceback (that " -"is, ``print(Bytecode.from_traceback(tb).dis())`` is equivalent to " -"``distb(tb)``)." +":class:`~dis.Bytecode` also has a class " +"method, :meth:`~dis.Bytecode.from_traceback`, that provides the ability to " +"manipulate a traceback (that is, " +"``print(Bytecode.from_traceback(tb).dis())`` is equivalent to ``distb(tb)``)." msgstr "" #: ../../whatsnew/3.4.rst:766 msgid "" -"(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in :issue:" -"`11816` and Claudiu Popa in :issue:`17916`.)" +"(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver " +"in :issue:`11816` and Claudiu Popa in :issue:`17916`.)" msgstr "" "(由 Nick Coghlan、Ryan Kelly 和 Thomas Kluyver 在 :issue:`11816` 中以及 " "Claudiu Popa 在 :issue:`17916` 中貢獻。)" @@ -1165,8 +1196,8 @@ msgid "" "two new options, ``-o`` and ``-f``. ``-o`` allows :ref:`doctest options " "<doctest-options>` to be specified on the command line, and ``-f`` is a " "shorthand for ``-o FAIL_FAST`` (to parallel the similar option supported by " -"the :mod:`unittest` CLI). (Contributed by R. David Murray in :issue:" -"`11390`.)" +"the :mod:`unittest` CLI). (Contributed by R. David Murray " +"in :issue:`11390`.)" msgstr "" #: ../../whatsnew/3.4.rst:787 @@ -1194,10 +1225,10 @@ msgid "" "New method :meth:`~email.message.Message.as_bytes` added to produce a bytes " "representation of the message in a fashion similar to how ``as_string`` " "produces a string representation. It does not accept the *maxheaderlen* " -"argument, but does accept the *unixfrom* and *policy* arguments. The :class:" -"`~email.message.Message` :meth:`~email.message.Message.__bytes__` method " -"calls it, meaning that ``bytes(mymsg)`` will now produce the intuitive " -"result: a bytes object containing the fully formatted message. " +"argument, but does accept the *unixfrom* and *policy* arguments. " +"The :class:`~email.message.Message` :meth:`~email.message.Message.__bytes__` " +"method calls it, meaning that ``bytes(mymsg)`` will now produce the " +"intuitive result: a bytes object containing the fully formatted message. " "(Contributed by R. David Murray in :issue:`18600`.)" msgstr "" @@ -1206,8 +1237,8 @@ msgid "" "The :meth:`.Message.set_param` message now accepts a *replace* keyword " "argument. When specified, the associated header will be updated without " "changing its location in the list of headers. For backward compatibility, " -"the default is ``False``. (Contributed by R. David Murray in :issue:" -"`18891`.)" +"the default is ``False``. (Contributed by R. David Murray " +"in :issue:`18891`.)" msgstr "" #: ../../whatsnew/3.4.rst:818 @@ -1219,12 +1250,13 @@ msgid "" "documentation is currently in the new module, which is being added as part " "of email's new :term:`provisional API`. These classes provide a number of " "new methods that make extracting content from and inserting content into " -"email messages much easier. For details, see the :mod:`~email." -"contentmanager` documentation and the :ref:`email-examples`. These API " -"additions complete the bulk of the work that was planned as part of the " -"email6 project. The currently provisional API is scheduled to become final " -"in Python 3.5 (possibly with a few minor additions in the area of error " -"handling). (Contributed by R. David Murray in :issue:`18891`.)" +"email messages much easier. For details, see " +"the :mod:`~email.contentmanager` documentation and the :ref:`email-" +"examples`. These API additions complete the bulk of the work that was " +"planned as part of the email6 project. The currently provisional API is " +"scheduled to become final in Python 3.5 (possibly with a few minor additions " +"in the area of error handling). (Contributed by R. David Murray " +"in :issue:`18891`.)" msgstr "" #: ../../whatsnew/3.4.rst:834 @@ -1245,8 +1277,8 @@ msgstr "" msgid "" "New module attribute :const:`~filecmp.DEFAULT_IGNORES` provides the list of " "directories that are used as the default value for the *ignore* parameter of " -"the :func:`~filecmp.dircmp` function. (Contributed by Eli Bendersky in :" -"issue:`15442`.)" +"the :func:`~filecmp.dircmp` function. (Contributed by Eli Bendersky " +"in :issue:`15442`.)" msgstr "" #: ../../whatsnew/3.4.rst:850 @@ -1283,9 +1315,9 @@ msgstr "由 Łukasz Langa 撰寫 PEP 與實作。" #: ../../whatsnew/3.4.rst:873 msgid "" -":func:`~functools.total_ordering` now supports a return value of :data:" -"`NotImplemented` from the underlying comparison function. (Contributed by " -"Katie Miller in :issue:`10042`.)" +":func:`~functools.total_ordering` now supports a return value " +"of :data:`NotImplemented` from the underlying comparison function. " +"(Contributed by Katie Miller in :issue:`10042`.)" msgstr "" #: ../../whatsnew/3.4.rst:877 @@ -1329,15 +1361,18 @@ msgid "" "based key derivation function 2 <https://en.wikipedia.org/wiki/PBKDF2>`_. " "(Contributed by Christian Heimes in :issue:`18582`.)" msgstr "" +"新的 :func:`hashlib.pbkdf2_hmac` 函式提供了\\ `基於密碼的 PKCS#5 密鑰生成函" +"式 2 <https://en.wikipedia.org/wiki/PBKDF2>`_。(由 Christian Heimes " +"在 :issue:`18582` 中貢獻。)" #: ../../whatsnew/3.4.rst:907 msgid "" "The :attr:`~hashlib.hash.name` attribute of :mod:`hashlib` hash objects is " -"now a formally supported interface. It has always existed in CPython's :mod:" -"`hashlib` (although it did not return lower case names for all supported " -"hashes), but it was not a public interface and so some other Python " -"implementations have not previously supported it. (Contributed by Jason R. " -"Coombs in :issue:`18532`.)" +"now a formally supported interface. It has always existed in " +"CPython's :mod:`hashlib` (although it did not return lower case names for " +"all supported hashes), but it was not a public interface and so some other " +"Python implementations have not previously supported it. (Contributed by " +"Jason R. Coombs in :issue:`18532`.)" msgstr "" #: ../../whatsnew/3.4.rst:916 @@ -1364,10 +1399,11 @@ msgstr "" #: ../../whatsnew/3.4.rst:930 msgid "" -"With the addition of :attr:`~hmac.HMAC.block_size` and :attr:`~hmac.HMAC." -"name` attributes (and the formal documentation of the :attr:`~hmac.HMAC." -"digest_size` attribute), the :mod:`hmac` module now conforms fully to the :" -"pep:`247` API. (Contributed by Christian Heimes in :issue:`18775`.)" +"With the addition of :attr:`~hmac.HMAC.block_size` " +"and :attr:`~hmac.HMAC.name` attributes (and the formal documentation of " +"the :attr:`~hmac.HMAC.digest_size` attribute), the :mod:`hmac` module now " +"conforms fully to the :pep:`247` API. (Contributed by Christian Heimes " +"in :issue:`18775`.)" msgstr "" #: ../../whatsnew/3.4.rst:937 @@ -1406,9 +1442,9 @@ msgid "" ":meth:`~http.server.BaseHTTPRequestHandler.send_error` now accepts an " "optional additional *explain* parameter which can be used to provide an " "extended error description, overriding the hardcoded default if there is " -"one. This extended error description will be formatted using the :attr:" -"`~http.server.HTTP.error_message_format` attribute and sent as the body of " -"the error response. (Contributed by Karl Cow in :issue:`12921`.)" +"one. This extended error description will be formatted using " +"the :attr:`~http.server.HTTP.error_message_format` attribute and sent as the " +"body of the error response. (Contributed by Karl Cow in :issue:`12921`.)" msgstr "" #: ../../whatsnew/3.4.rst:964 @@ -1425,10 +1461,10 @@ msgstr "idlelib 與 IDLE" #: ../../whatsnew/3.4.rst:972 msgid "" "Since idlelib implements the IDLE shell and editor and is not intended for " -"import by other programs, it gets improvements with every release. See :file:" -"`Lib/idlelib/NEWS.txt` for a cumulative list of changes since 3.3.0, as well " -"as changes made in future 3.4.x releases. This file is also available from " -"the IDLE :menuselection:`Help --> About IDLE` dialog." +"import by other programs, it gets improvements with every release. " +"See :file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since " +"3.3.0, as well as changes made in future 3.4.x releases. This file is also " +"available from the IDLE :menuselection:`Help --> About IDLE` dialog." msgstr "" #: ../../whatsnew/3.4.rst:980 @@ -1437,11 +1473,12 @@ msgstr "importlib" #: ../../whatsnew/3.4.rst:982 msgid "" -"The :class:`~importlib.abc.InspectLoader` ABC defines a new method, :meth:" -"`~importlib.abc.InspectLoader.source_to_code` that accepts source data and a " -"path and returns a code object. The default implementation is equivalent to " -"``compile(data, path, 'exec', dont_inherit=True)``. (Contributed by Eric " -"Snow and Brett Cannon in :issue:`15627`.)" +"The :class:`~importlib.abc.InspectLoader` ABC defines a new " +"method, :meth:`~importlib.abc.InspectLoader.source_to_code` that accepts " +"source data and a path and returns a code object. The default " +"implementation is equivalent to ``compile(data, path, 'exec', " +"dont_inherit=True)``. (Contributed by Eric Snow and Brett Cannon " +"in :issue:`15627`.)" msgstr "" #: ../../whatsnew/3.4.rst:988 @@ -1454,9 +1491,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:993 msgid "" -"The :func:`~importlib.reload` function has been moved from :mod:`!imp` to :" -"mod:`importlib` as part of the :mod:`!imp` module deprecation. (Contributed " -"by Berker Peksag in :issue:`18193`.)" +"The :func:`~importlib.reload` function has been moved from :mod:`!imp` " +"to :mod:`importlib` as part of the :mod:`!imp` module deprecation. " +"(Contributed by Berker Peksag in :issue:`18193`.)" msgstr "" #: ../../whatsnew/3.4.rst:997 @@ -1469,34 +1506,35 @@ msgstr "" #: ../../whatsnew/3.4.rst:1002 msgid "" -"New :mod:`importlib.util` functions :func:`~importlib.util." -"cache_from_source` and :func:`~importlib.util.source_from_cache` replace the " -"same-named functions in the deprecated :mod:`!imp` module. (Contributed by " -"Brett Cannon in :issue:`18194`.)" +"New :mod:`importlib.util` " +"functions :func:`~importlib.util.cache_from_source` " +"and :func:`~importlib.util.source_from_cache` replace the same-named " +"functions in the deprecated :mod:`!imp` module. (Contributed by Brett " +"Cannon in :issue:`18194`.)" msgstr "" #: ../../whatsnew/3.4.rst:1007 msgid "" "The :mod:`importlib` bootstrap :class:`.NamespaceLoader` now conforms to " -"the :class:`.InspectLoader` ABC, which means that ``runpy`` and ``python -" -"m`` can now be used with namespace packages. (Contributed by Brett Cannon " +"the :class:`.InspectLoader` ABC, which means that ``runpy`` and ``python " +"-m`` can now be used with namespace packages. (Contributed by Brett Cannon " "in :issue:`18058`.)" msgstr "" #: ../../whatsnew/3.4.rst:1012 msgid "" -":mod:`importlib.util` has a new function :func:`~importlib.util." -"decode_source` that decodes source from bytes using universal newline " -"processing. This is useful for implementing :meth:`.InspectLoader." -"get_source` methods." +":mod:`importlib.util` has a new " +"function :func:`~importlib.util.decode_source` that decodes source from " +"bytes using universal newline processing. This is useful for " +"implementing :meth:`.InspectLoader.get_source` methods." msgstr "" #: ../../whatsnew/3.4.rst:1016 msgid "" -":class:`importlib.machinery.ExtensionFileLoader` now has a :meth:`~importlib." -"machinery.ExtensionFileLoader.get_filename` method. This was inadvertently " -"omitted in the original implementation. (Contributed by Eric Snow in :issue:" -"`19152`.)" +":class:`importlib.machinery.ExtensionFileLoader` now has " +"a :meth:`~importlib.machinery.ExtensionFileLoader.get_filename` method. " +"This was inadvertently omitted in the original implementation. (Contributed " +"by Eric Snow in :issue:`19152`.)" msgstr "" #: ../../whatsnew/3.4.rst:1023 @@ -1521,21 +1559,23 @@ msgstr "" #: ../../whatsnew/3.4.rst:1035 msgid "" -"As part of the implementation of the new :mod:`enum` module, the :mod:" -"`inspect` module now has substantially better support for custom ``__dir__`` " -"methods and dynamic class attributes provided through metaclasses. " -"(Contributed by Ethan Furman in :issue:`18929` and :issue:`19030`.)" +"As part of the implementation of the new :mod:`enum` module, " +"the :mod:`inspect` module now has substantially better support for custom " +"``__dir__`` methods and dynamic class attributes provided through " +"metaclasses. (Contributed by Ethan Furman in :issue:`18929` " +"and :issue:`19030`.)" msgstr "" #: ../../whatsnew/3.4.rst:1041 msgid "" -":func:`~inspect.getfullargspec` and :func:`~inspect.getargspec` now use the :" -"func:`~inspect.signature` API. This allows them to support a much broader " -"range of callables, including those with ``__signature__`` attributes, those " -"with metadata provided by argument clinic, :func:`functools.partial` objects " -"and more. Note that, unlike :func:`~inspect.signature`, these functions " -"still ignore ``__wrapped__`` attributes, and report the already bound first " -"argument for bound methods, so it is still necessary to update your code to " +":func:`~inspect.getfullargspec` and :func:`~inspect.getargspec` now use " +"the :func:`~inspect.signature` API. This allows them to support a much " +"broader range of callables, including those with ``__signature__`` " +"attributes, those with metadata provided by argument " +"clinic, :func:`functools.partial` objects and more. Note that, " +"unlike :func:`~inspect.signature`, these functions still ignore " +"``__wrapped__`` attributes, and report the already bound first argument for " +"bound methods, so it is still necessary to update your code to " "use :func:`~inspect.signature` directly if those features are desired. " "(Contributed by Yury Selivanov in :issue:`17481`.)" msgstr "" @@ -1553,17 +1593,18 @@ msgstr "ipaddress" #: ../../whatsnew/3.4.rst:1060 msgid "" -":mod:`ipaddress` was added to the standard library in Python 3.3 as a :term:" -"`provisional API`. With the release of Python 3.4, this qualification has " -"been removed: :mod:`ipaddress` is now considered a stable API, covered by " -"the normal standard library requirements to maintain backwards compatibility." +":mod:`ipaddress` was added to the standard library in Python 3.3 as " +"a :term:`provisional API`. With the release of Python 3.4, this " +"qualification has been removed: :mod:`ipaddress` is now considered a stable " +"API, covered by the normal standard library requirements to maintain " +"backwards compatibility." msgstr "" #: ../../whatsnew/3.4.rst:1066 msgid "" "A new :attr:`~ipaddress.IPv4Address.is_global` property is ``True`` if an " -"address is globally routeable. (Contributed by Peter Moody in :issue:" -"`17400`.)" +"address is globally routeable. (Contributed by Peter Moody " +"in :issue:`17400`.)" msgstr "" #: ../../whatsnew/3.4.rst:1072 @@ -1579,27 +1620,29 @@ msgstr "" #: ../../whatsnew/3.4.rst:1078 msgid "" -":class:`~logging.handlers.SocketHandler` and :class:`~logging.handlers." -"DatagramHandler` now support Unix domain sockets (by setting *port* to " -"``None``). (Contributed by Vinay Sajip in commit ce46195b56a9.)" +":class:`~logging.handlers.SocketHandler` " +"and :class:`~logging.handlers.DatagramHandler` now support Unix domain " +"sockets (by setting *port* to ``None``). (Contributed by Vinay Sajip in " +"commit ce46195b56a9.)" msgstr "" #: ../../whatsnew/3.4.rst:1083 msgid "" -":func:`~logging.config.fileConfig` now accepts a :class:`configparser." -"RawConfigParser` subclass instance for the *fname* parameter. This " -"facilitates using a configuration file when logging configuration is just a " -"part of the overall application configuration, or where the application " -"modifies the configuration before passing it to :func:`~logging.config." -"fileConfig`. (Contributed by Vinay Sajip in :issue:`16110`.)" +":func:`~logging.config.fileConfig` now accepts " +"a :class:`configparser.RawConfigParser` subclass instance for the *fname* " +"parameter. This facilitates using a configuration file when logging " +"configuration is just a part of the overall application configuration, or " +"where the application modifies the configuration before passing it " +"to :func:`~logging.config.fileConfig`. (Contributed by Vinay Sajip " +"in :issue:`16110`.)" msgstr "" #: ../../whatsnew/3.4.rst:1091 msgid "" -"Logging configuration data received from a socket via the :func:`logging." -"config.listen` function can now be validated before being processed by " -"supplying a verification function as the argument to the new *verify* " -"keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.)" +"Logging configuration data received from a socket via " +"the :func:`logging.config.listen` function can now be validated before being " +"processed by supplying a verification function as the argument to the new " +"*verify* keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.)" msgstr "" #: ../../whatsnew/3.4.rst:1100 @@ -1612,11 +1655,11 @@ msgid "" "implementing the new version restores the Python2 behavior of recording only " "one copy of interned strings and preserving the interning on " "deserialization, and extends this \"one copy\" ability to any object type " -"(including handling recursive references). This reduces both the size of ``." -"pyc`` files and the amount of memory a module occupies in memory when it is " -"loaded from a ``.pyc`` (or ``.pyo``) file. (Contributed by Kristján Valur " -"Jónsson in :issue:`16475`, with additional speedups by Antoine Pitrou in :" -"issue:`19219`.)" +"(including handling recursive references). This reduces both the size of " +"``.pyc`` files and the amount of memory a module occupies in memory when it " +"is loaded from a ``.pyc`` (or ``.pyo``) file. (Contributed by Kristján " +"Valur Jónsson in :issue:`16475`, with additional speedups by Antoine Pitrou " +"in :issue:`19219`.)" msgstr "" #: ../../whatsnew/3.4.rst:1113 @@ -1636,12 +1679,13 @@ msgstr "multiprocessing" #: ../../whatsnew/3.4.rst:1124 msgid "" "On Unix two new :ref:`start methods <multiprocessing-start-methods>`, " -"``spawn`` and ``forkserver``, have been added for starting processes using :" -"mod:`multiprocessing`. These make the mixing of processes with threads more " -"robust, and the ``spawn`` method matches the semantics that multiprocessing " -"has always used on Windows. New function :func:`~multiprocessing." -"get_all_start_methods` reports all start methods available on the platform, :" -"func:`~multiprocessing.get_start_method` reports the current start method, " +"``spawn`` and ``forkserver``, have been added for starting processes " +"using :mod:`multiprocessing`. These make the mixing of processes with " +"threads more robust, and the ``spawn`` method matches the semantics that " +"multiprocessing has always used on Windows. New " +"function :func:`~multiprocessing.get_all_start_methods` reports all start " +"methods available on the platform, :func:`~multiprocessing.get_start_method` " +"reports the current start method, " "and :func:`~multiprocessing.set_start_method` sets the start method. " "(Contributed by Richard Oudkerk in :issue:`8713`.)" msgstr "" @@ -1649,21 +1693,22 @@ msgstr "" #: ../../whatsnew/3.4.rst:1134 msgid "" ":mod:`multiprocessing` also now has the concept of a ``context``, which " -"determines how child processes are created. New function :func:" -"`~multiprocessing.get_context` returns a context that uses a specified start " -"method. It has the same API as the :mod:`multiprocessing` module itself, so " -"you can use it to create :class:`~multiprocessing.pool.Pool`\\ s and other " -"objects that will operate within that context. This allows a framework and " -"an application or different parts of the same application to use " -"multiprocessing without interfering with each other. (Contributed by " -"Richard Oudkerk in :issue:`18999`.)" +"determines how child processes are created. New " +"function :func:`~multiprocessing.get_context` returns a context that uses a " +"specified start method. It has the same API as the :mod:`multiprocessing` " +"module itself, so you can use it to " +"create :class:`~multiprocessing.pool.Pool`\\ s and other objects that will " +"operate within that context. This allows a framework and an application or " +"different parts of the same application to use multiprocessing without " +"interfering with each other. (Contributed by Richard Oudkerk " +"in :issue:`18999`.)" msgstr "" #: ../../whatsnew/3.4.rst:1144 msgid "" "Except when using the old *fork* start method, child processes no longer " -"inherit unneeded handles/file descriptors from their parents (part of :issue:" -"`8713`)." +"inherit unneeded handles/file descriptors from their parents (part " +"of :issue:`8713`)." msgstr "" #: ../../whatsnew/3.4.rst:1148 @@ -1702,9 +1747,9 @@ msgstr "os" #: ../../whatsnew/3.4.rst:1172 msgid "" "There are new functions to get and set the :ref:`inheritable flag " -"<fd_inheritance>` of a file descriptor (:func:`os.get_inheritable`, :func:" -"`os.set_inheritable`) or a Windows handle (:func:`os." -"get_handle_inheritable`, :func:`os.set_handle_inheritable`)." +"<fd_inheritance>` of a file descriptor " +"(:func:`os.get_inheritable`, :func:`os.set_inheritable`) or a Windows handle " +"(:func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`)." msgstr "" #: ../../whatsnew/3.4.rst:1177 @@ -1713,14 +1758,14 @@ msgid "" "the platform on which Python is running (or ``None`` if the count can't be " "determined). The :func:`multiprocessing.cpu_count` function is now " "implemented in terms of this function). (Contributed by Trent Nelson, " -"Yogesh Chaudhari, Victor Stinner, and Charles-François Natali in :issue:" -"`17914`.)" +"Yogesh Chaudhari, Victor Stinner, and Charles-François Natali " +"in :issue:`17914`.)" msgstr "" #: ../../whatsnew/3.4.rst:1183 msgid "" -":func:`os.path.samestat` is now available on the Windows platform (and the :" -"func:`os.path.samefile` implementation is now shared between Unix and " +":func:`os.path.samestat` is now available on the Windows platform (and " +"the :func:`os.path.samefile` implementation is now shared between Unix and " "Windows). (Contributed by Brian Curtin in :issue:`11939`.)" msgstr "" @@ -1732,12 +1777,12 @@ msgstr "" #: ../../whatsnew/3.4.rst:1190 msgid "" -":func:`os.open` supports two new flags on platforms that provide them, :" -"const:`~os.O_PATH` (un-opened file descriptor), and :const:`~os.O_TMPFILE` " -"(unnamed temporary file; as of 3.4.0 release available only on Linux systems " -"with a kernel version of 3.11 or newer that have uapi headers). " -"(Contributed by Christian Heimes in :issue:`18673` and Benjamin Peterson, " -"respectively.)" +":func:`os.open` supports two new flags on platforms that provide " +"them, :const:`~os.O_PATH` (un-opened file descriptor), " +"and :const:`~os.O_TMPFILE` (unnamed temporary file; as of 3.4.0 release " +"available only on Linux systems with a kernel version of 3.11 or newer that " +"have uapi headers). (Contributed by Christian Heimes in :issue:`18673` and " +"Benjamin Peterson, respectively.)" msgstr "" #: ../../whatsnew/3.4.rst:1198 @@ -1774,14 +1819,14 @@ msgid "" ":mod:`pickle` now supports (but does not use by default) a new pickle " "protocol, protocol 4. This new protocol addresses a number of issues that " "were present in previous protocols, such as the serialization of nested " -"classes, very large strings and containers, and classes whose :meth:" -"`__new__` method takes keyword-only arguments. It also provides some " -"efficiency improvements." +"classes, very large strings and containers, and classes " +"whose :meth:`__new__` method takes keyword-only arguments. It also provides " +"some efficiency improvements." msgstr "" #: ../../whatsnew/3.4.rst:1229 msgid ":pep:`3154` -- Pickle protocol 4" -msgstr "" +msgstr ":pep:`3154` -- Pickle 協定 4" #: ../../whatsnew/3.4.rst:1230 msgid "PEP written by Antoine Pitrou and implemented by Alexandre Vassalotti." @@ -1794,12 +1839,13 @@ msgstr "plistlib" #: ../../whatsnew/3.4.rst:1236 msgid "" ":mod:`plistlib` now has an API that is similar to the standard pattern for " -"stdlib serialization protocols, with new :func:`~plistlib.load`, :func:" -"`~plistlib.dump`, :func:`~plistlib.loads`, and :func:`~plistlib.dumps` " -"functions. (The older API is now deprecated.) In addition to the already " -"supported XML plist format (:const:`~plistlib.FMT_XML`), it also now " -"supports the binary plist format (:const:`~plistlib.FMT_BINARY`). " -"(Contributed by Ronald Oussoren and others in :issue:`14455`.)" +"stdlib serialization protocols, with " +"new :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:`~plistlib.loads`, " +"and :func:`~plistlib.dumps` functions. (The older API is now deprecated.) " +"In addition to the already supported XML plist format " +"(:const:`~plistlib.FMT_XML`), it also now supports the binary plist format " +"(:const:`~plistlib.FMT_BINARY`). (Contributed by Ronald Oussoren and others " +"in :issue:`14455`.)" msgstr "" #: ../../whatsnew/3.4.rst:1246 @@ -1809,9 +1855,9 @@ msgstr "poplib" #: ../../whatsnew/3.4.rst:1248 msgid "" "Two new methods have been added to :mod:`poplib`: :meth:`~poplib.POP3.capa`, " -"which returns the list of capabilities advertised by the POP server, and :" -"meth:`~poplib.POP3.stls`, which switches a clear-text POP3 session into an " -"encrypted POP3 session if the POP server supports it. (Contributed by " +"which returns the list of capabilities advertised by the POP server, " +"and :meth:`~poplib.POP3.stls`, which switches a clear-text POP3 session into " +"an encrypted POP3 session if the POP server supports it. (Contributed by " "Lorenzo Catucci in :issue:`4473`.)" msgstr "" @@ -1821,8 +1867,8 @@ msgstr "pprint" #: ../../whatsnew/3.4.rst:1258 msgid "" -"The :mod:`pprint` module's :class:`~pprint.PrettyPrinter` class and its :" -"func:`~pprint.pformat`, and :func:`~pprint.pprint` functions have a new " +"The :mod:`pprint` module's :class:`~pprint.PrettyPrinter` class and " +"its :func:`~pprint.pformat`, and :func:`~pprint.pprint` functions have a new " "option, *compact*, that controls how the output is formatted. Currently " "setting *compact* to ``True`` means that sequences will be printed with as " "many sequence elements as will fit within *width* on each (indented) line. " @@ -1851,27 +1897,28 @@ msgstr "pydoc" #: ../../whatsnew/3.4.rst:1279 msgid "" -"The :mod:`pydoc` module is now based directly on the :func:`inspect." -"signature` introspection API, allowing it to provide signature information " -"for a wider variety of callable objects. This change also means that " -"``__wrapped__`` attributes are now taken into account when displaying help " -"information. (Contributed by Larry Hastings in :issue:`19674`.)" +"The :mod:`pydoc` module is now based directly on " +"the :func:`inspect.signature` introspection API, allowing it to provide " +"signature information for a wider variety of callable objects. This change " +"also means that ``__wrapped__`` attributes are now taken into account when " +"displaying help information. (Contributed by Larry Hastings " +"in :issue:`19674`.)" msgstr "" #: ../../whatsnew/3.4.rst:1285 msgid "" "The :mod:`pydoc` module no longer displays the ``self`` parameter for " "already bound methods. Instead, it aims to always display the exact current " -"signature of the supplied callable. (Contributed by Larry Hastings in :" -"issue:`20710`.)" +"signature of the supplied callable. (Contributed by Larry Hastings " +"in :issue:`20710`.)" msgstr "" #: ../../whatsnew/3.4.rst:1290 msgid "" "In addition to the changes that have been made to :mod:`pydoc` directly, its " "handling of custom ``__dir__`` methods and various descriptor behaviours has " -"also been improved substantially by the underlying changes in the :mod:" -"`inspect` module." +"also been improved substantially by the underlying changes in " +"the :mod:`inspect` module." msgstr "" #: ../../whatsnew/3.4.rst:1295 @@ -1917,17 +1964,18 @@ msgstr "" #: ../../whatsnew/3.4.rst:1324 msgid "" "On Linux kernel version 2.6.36 or later, there are also some new Linux " -"specific constants: :const:`~resource.RLIMIT_MSGQUEUE`, :const:`~resource." -"RLIMIT_NICE`, :const:`~resource.RLIMIT_RTPRIO`, :const:`~resource." -"RLIMIT_RTTIME`, and :const:`~resource.RLIMIT_SIGPENDING`. (Contributed by " -"Christian Heimes in :issue:`19324`.)" +"specific " +"constants: :const:`~resource.RLIMIT_MSGQUEUE`, :const:`~resource.RLIMIT_NICE`, :const:`~resource.RLIMIT_RTPRIO`, :const:`~resource.RLIMIT_RTTIME`, " +"and :const:`~resource.RLIMIT_SIGPENDING`. (Contributed by Christian Heimes " +"in :issue:`19324`.)" msgstr "" #: ../../whatsnew/3.4.rst:1330 msgid "" -"On FreeBSD version 9 and later, there some new FreeBSD specific constants: :" -"const:`~resource.RLIMIT_SBSIZE`, :const:`~resource.RLIMIT_SWAP`, and :const:" -"`~resource.RLIMIT_NPTS`. (Contributed by Claudiu Popa in :issue:`19343`.)" +"On FreeBSD version 9 and later, there some new FreeBSD specific " +"constants: :const:`~resource.RLIMIT_SBSIZE`, :const:`~resource.RLIMIT_SWAP`, " +"and :const:`~resource.RLIMIT_NPTS`. (Contributed by Claudiu Popa " +"in :issue:`19343`.)" msgstr "" #: ../../whatsnew/3.4.rst:1337 @@ -1945,8 +1993,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:1344 msgid "" ":class:`~select.devpoll` objects now have :meth:`~select.devpoll.fileno` " -"and :meth:`~select.devpoll.close` methods, as well as a new attribute :attr:" -"`~select.devpoll.closed`. (Contributed by Victor Stinner in :issue:`18794`.)" +"and :meth:`~select.devpoll.close` methods, as well as a new " +"attribute :attr:`~select.devpoll.closed`. (Contributed by Victor Stinner " +"in :issue:`18794`.)" msgstr "" #: ../../whatsnew/3.4.rst:1351 @@ -1969,8 +2018,8 @@ msgid "" ":func:`~shutil.copyfile` now raises a specific :exc:`~shutil.Error` " "subclass, :exc:`~shutil.SameFileError`, when the source and destination are " "the same file, which allows an application to take appropriate action on " -"this specific error. (Contributed by Atsuo Ishimoto and Hynek Schlawack in :" -"issue:`1492704`.)" +"this specific error. (Contributed by Atsuo Ishimoto and Hynek Schlawack " +"in :issue:`1492704`.)" msgstr "" #: ../../whatsnew/3.4.rst:1369 @@ -1982,8 +2031,8 @@ msgid "" "The :class:`!SMTPServer` and :class:`!SMTPChannel` classes now accept a " "*map* keyword argument which, if specified, is passed in to :class:`!" "asynchat.async_chat` as its *map* argument. This allows an application to " -"avoid affecting the global socket map. (Contributed by Vinay Sajip in :" -"issue:`11959`.)" +"avoid affecting the global socket map. (Contributed by Vinay Sajip " +"in :issue:`11959`.)" msgstr "" #: ../../whatsnew/3.4.rst:1379 @@ -2011,8 +2060,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:1393 msgid "" "Socket objects have new methods to get or set their :ref:`inheritable flag " -"<fd_inheritance>`, :meth:`~socket.socket.get_inheritable` and :meth:`~socket." -"socket.set_inheritable`." +"<fd_inheritance>`, :meth:`~socket.socket.get_inheritable` " +"and :meth:`~socket.socket.set_inheritable`." msgstr "" #: ../../whatsnew/3.4.rst:1397 @@ -2064,37 +2113,40 @@ msgid "" "more stringent than the defaults provided by the :class:`~ssl.SSLContext` " "constructor, and may be adjusted in the future, without prior deprecation, " "if best-practice security requirements change. The new recommended best " -"practice for using stdlib libraries that support SSL is to use :func:`~ssl." -"create_default_context` to obtain an :class:`~ssl.SSLContext` object, modify " -"it if needed, and then pass it as the *context* argument of the appropriate " -"stdlib API. (Contributed by Christian Heimes in :issue:`19689`.)" +"practice for using stdlib libraries that support SSL is to " +"use :func:`~ssl.create_default_context` to obtain " +"an :class:`~ssl.SSLContext` object, modify it if needed, and then pass it as " +"the *context* argument of the appropriate stdlib API. (Contributed by " +"Christian Heimes in :issue:`19689`.)" msgstr "" #: ../../whatsnew/3.4.rst:1440 msgid "" -":class:`~ssl.SSLContext` method :meth:`~ssl.SSLContext." -"load_verify_locations` accepts a new optional argument *cadata*, which can " -"be used to provide PEM or DER encoded certificates directly via strings or " -"bytes, respectively. (Contributed by Christian Heimes in :issue:`18138`.)" +":class:`~ssl.SSLContext` " +"method :meth:`~ssl.SSLContext.load_verify_locations` accepts a new optional " +"argument *cadata*, which can be used to provide PEM or DER encoded " +"certificates directly via strings or bytes, respectively. (Contributed by " +"Christian Heimes in :issue:`18138`.)" msgstr "" #: ../../whatsnew/3.4.rst:1445 msgid "" "New function :func:`~ssl.get_default_verify_paths` returns a named tuple of " -"the paths and environment variables that the :meth:`~ssl.SSLContext." -"set_default_verify_paths` method uses to set OpenSSL's default ``cafile`` " -"and ``capath``. This can be an aid in debugging default verification " -"issues. (Contributed by Christian Heimes in :issue:`18143`.)" +"the paths and environment variables that " +"the :meth:`~ssl.SSLContext.set_default_verify_paths` method uses to set " +"OpenSSL's default ``cafile`` and ``capath``. This can be an aid in " +"debugging default verification issues. (Contributed by Christian Heimes " +"in :issue:`18143`.)" msgstr "" #: ../../whatsnew/3.4.rst:1452 msgid "" -":class:`~ssl.SSLContext` has a new method, :meth:`~ssl.SSLContext." -"cert_store_stats`, that reports the number of loaded ``X.509`` certs, " -"``X.509 CA`` certs, and certificate revocation lists (``crl``\\ s), as well " -"as a :meth:`~ssl.SSLContext.get_ca_certs` method that returns a list of the " -"loaded ``CA`` certificates. (Contributed by Christian Heimes in :issue:" -"`18147`.)" +":class:`~ssl.SSLContext` has a new " +"method, :meth:`~ssl.SSLContext.cert_store_stats`, that reports the number of " +"loaded ``X.509`` certs, ``X.509 CA`` certs, and certificate revocation lists " +"(``crl``\\ s), as well as a :meth:`~ssl.SSLContext.get_ca_certs` method that " +"returns a list of the loaded ``CA`` certificates. (Contributed by Christian " +"Heimes in :issue:`18147`.)" msgstr "" #: ../../whatsnew/3.4.rst:1459 @@ -2102,45 +2154,46 @@ msgid "" "If OpenSSL 0.9.8 or later is available, :class:`~ssl.SSLContext` has a new " "attribute :attr:`~ssl.SSLContext.verify_flags` that can be used to control " "the certificate verification process by setting it to some combination of " -"the new constants :const:`~ssl.VERIFY_DEFAULT`, :const:`~ssl." -"VERIFY_CRL_CHECK_LEAF`, :const:`~ssl.VERIFY_CRL_CHECK_CHAIN`, or :const:" -"`~ssl.VERIFY_X509_STRICT`. OpenSSL does not do any CRL verification by " -"default. (Contributed by Christien Heimes in :issue:`8813`.)" +"the new " +"constants :const:`~ssl.VERIFY_DEFAULT`, :const:`~ssl.VERIFY_CRL_CHECK_LEAF`, :const:`~ssl.VERIFY_CRL_CHECK_CHAIN`, " +"or :const:`~ssl.VERIFY_X509_STRICT`. OpenSSL does not do any CRL " +"verification by default. (Contributed by Christien Heimes in :issue:`8813`.)" msgstr "" #: ../../whatsnew/3.4.rst:1467 msgid "" -"New :class:`~ssl.SSLContext` method :meth:`~ssl.SSLContext." -"load_default_certs` loads a set of default \"certificate authority\" (CA) " -"certificates from default locations, which vary according to the platform. " -"It can be used to load both TLS web server authentication certificates " -"(``purpose=``:data:`~ssl.Purpose.SERVER_AUTH`) for a client to use to verify " -"a server, and certificates for a server to use in verifying client " -"certificates (``purpose=``:data:`~ssl.Purpose.CLIENT_AUTH`). (Contributed " -"by Christian Heimes in :issue:`19292`.)" +"New :class:`~ssl.SSLContext` " +"method :meth:`~ssl.SSLContext.load_default_certs` loads a set of default " +"\"certificate authority\" (CA) certificates from default locations, which " +"vary according to the platform. It can be used to load both TLS web server " +"authentication certificates (``purpose=``:data:`~ssl.Purpose.SERVER_AUTH`) " +"for a client to use to verify a server, and certificates for a server to use " +"in verifying client certificates " +"(``purpose=``:data:`~ssl.Purpose.CLIENT_AUTH`). (Contributed by Christian " +"Heimes in :issue:`19292`.)" msgstr "" #: ../../whatsnew/3.4.rst:1478 msgid "" -"Two new windows-only functions, :func:`~ssl.enum_certificates` and :func:" -"`~ssl.enum_crls` provide the ability to retrieve certificates, certificate " -"information, and CRLs from the Windows cert store. (Contributed by " -"Christian Heimes in :issue:`17134`.)" +"Two new windows-only functions, :func:`~ssl.enum_certificates` " +"and :func:`~ssl.enum_crls` provide the ability to retrieve certificates, " +"certificate information, and CRLs from the Windows cert store. (Contributed " +"by Christian Heimes in :issue:`17134`.)" msgstr "" #: ../../whatsnew/3.4.rst:1485 msgid "" -"Support for server-side SNI (Server Name Indication) using the new :meth:" -"`ssl.SSLContext.set_servername_callback` method. (Contributed by Daniel " -"Black in :issue:`8109`.)" +"Support for server-side SNI (Server Name Indication) using the " +"new :meth:`ssl.SSLContext.set_servername_callback` method. (Contributed by " +"Daniel Black in :issue:`8109`.)" msgstr "" #: ../../whatsnew/3.4.rst:1489 msgid "" "The dictionary returned by :meth:`.SSLSocket.getpeercert` contains " "additional ``X509v3`` extension items: ``crlDistributionPoints``, " -"``calIssuers``, and ``OCSP`` URIs. (Contributed by Christian Heimes in :" -"issue:`18379`.)" +"``calIssuers``, and ``OCSP`` URIs. (Contributed by Christian Heimes " +"in :issue:`18379`.)" msgstr "" #: ../../whatsnew/3.4.rst:1495 @@ -2156,9 +2209,10 @@ msgstr "" #: ../../whatsnew/3.4.rst:1501 msgid "" -"The module supports new :mod:`~stat.ST_MODE` flags, :mod:`~stat.S_IFDOOR`, :" -"const:`~stat.S_IFPORT`, and :const:`~stat.S_IFWHT`. (Contributed by " -"Christian Hiemes in :issue:`11016`.)" +"The module supports new :mod:`~stat.ST_MODE` " +"flags, :mod:`~stat.S_IFDOOR`, :const:`~stat.S_IFPORT`, " +"and :const:`~stat.S_IFWHT`. (Contributed by Christian Hiemes " +"in :issue:`11016`.)" msgstr "" #: ../../whatsnew/3.4.rst:1507 @@ -2167,10 +2221,10 @@ msgstr "struct" #: ../../whatsnew/3.4.rst:1509 msgid "" -"New function :mod:`~struct.iter_unpack` and a new :meth:`struct.Struct." -"iter_unpack` method on compiled formats provide streamed unpacking of a " -"buffer containing repeated instances of a given format of data. (Contributed " -"by Antoine Pitrou in :issue:`17804`.)" +"New function :mod:`~struct.iter_unpack` and a " +"new :meth:`struct.Struct.iter_unpack` method on compiled formats provide " +"streamed unpacking of a buffer containing repeated instances of a given " +"format of data. (Contributed by Antoine Pitrou in :issue:`17804`.)" msgstr "" #: ../../whatsnew/3.4.rst:1516 @@ -2224,10 +2278,10 @@ msgstr "sys" msgid "" "New function :func:`sys.getallocatedblocks` returns the current number of " "blocks allocated by the interpreter. (In CPython with the default ``--with-" -"pymalloc`` setting, this is allocations made through the :c:func:" -"`PyObject_Malloc` API.) This can be useful for tracking memory leaks, " -"especially if automated via a test suite. (Contributed by Antoine Pitrou " -"in :issue:`13390`.)" +"pymalloc`` setting, this is allocations made through " +"the :c:func:`PyObject_Malloc` API.) This can be useful for tracking memory " +"leaks, especially if automated via a test suite. (Contributed by Antoine " +"Pitrou in :issue:`13390`.)" msgstr "" #: ../../whatsnew/3.4.rst:1557 @@ -2240,10 +2294,10 @@ msgid "" "The :mod:`site` module :ref:`sets it <rlcompleter-config>` to a function " "that enables tab completion and history saving (in :file:`~/.python-" "history`) if the platform supports :mod:`readline`. If you do not want this " -"(new) behavior, you can override it in :envvar:`PYTHONSTARTUP`, :mod:" -"`sitecustomize`, or :mod:`usercustomize` by deleting this attribute from :" -"mod:`sys` (or setting it to some other callable). (Contributed by Éric " -"Araujo and Antoine Pitrou in :issue:`5845`.)" +"(new) behavior, you can override it " +"in :envvar:`PYTHONSTARTUP`, :mod:`sitecustomize`, or :mod:`usercustomize` by " +"deleting this attribute from :mod:`sys` (or setting it to some other " +"callable). (Contributed by Éric Araujo and Antoine Pitrou in :issue:`5845`.)" msgstr "" #: ../../whatsnew/3.4.rst:1572 @@ -2254,8 +2308,8 @@ msgstr "tarfile" msgid "" "The :mod:`tarfile` module now supports a simple :ref:`tarfile-commandline` " "when called as a script directly or via ``-m``. This can be used to create " -"and extract tarfile archives. (Contributed by Berker Peksag in :issue:" -"`13477`.)" +"and extract tarfile archives. (Contributed by Berker Peksag " +"in :issue:`13477`.)" msgstr "" #: ../../whatsnew/3.4.rst:1580 @@ -2272,8 +2326,8 @@ msgid "" "convenience function :func:`~textwrap.shorten` collapses all of the " "whitespace in the input to single spaces and produces a single line of a " "given *width* that ends with the *placeholder* (by default, ``[...]``). " -"(Contributed by Antoine Pitrou and Serhiy Storchaka in :issue:`18585` and :" -"issue:`18725`.)" +"(Contributed by Antoine Pitrou and Serhiy Storchaka in :issue:`18585` " +"and :issue:`18725`.)" msgstr "" #: ../../whatsnew/3.4.rst:1594 @@ -2296,8 +2350,8 @@ msgstr "traceback" msgid "" "A new :func:`traceback.clear_frames` function takes a traceback object and " "clears the local variables in all of the frames it references, reducing the " -"amount of memory consumed. (Contributed by Andrew Kuchling in :issue:" -"`1565525`.)" +"amount of memory consumed. (Contributed by Andrew Kuchling " +"in :issue:`1565525`.)" msgstr "" #: ../../whatsnew/3.4.rst:1612 @@ -2320,40 +2374,41 @@ msgstr "urllib" #: ../../whatsnew/3.4.rst:1625 msgid "" -":mod:`urllib.request` now supports ``data:`` URLs via the :class:`~urllib." -"request.DataHandler` class. (Contributed by Mathias Panzenböck in :issue:" -"`16423`.)" +":mod:`urllib.request` now supports ``data:`` URLs via " +"the :class:`~urllib.request.DataHandler` class. (Contributed by Mathias " +"Panzenböck in :issue:`16423`.)" msgstr "" #: ../../whatsnew/3.4.rst:1629 msgid "" "The http method that will be used by a :class:`~urllib.request.Request` " -"class can now be specified by setting a :class:`~urllib.request.Request." -"method` class attribute on the subclass. (Contributed by Jason R Coombs in :" -"issue:`18978`.)" +"class can now be specified by setting " +"a :class:`~urllib.request.Request.method` class attribute on the subclass. " +"(Contributed by Jason R Coombs in :issue:`18978`.)" msgstr "" #: ../../whatsnew/3.4.rst:1634 msgid "" -":class:`~urllib.request.Request` objects are now reusable: if the :attr:" -"`~urllib.request.Request.full_url` or :attr:`~urllib.request.Request.data` " -"attributes are modified, all relevant internal properties are updated. This " -"means, for example, that it is now possible to use the same :class:`~urllib." -"request.Request` object in more than one :meth:`.OpenerDirector.open` call " -"with different *data* arguments, or to modify a :class:`~urllib.request." -"Request`\\ 's ``url`` rather than recomputing it from scratch. There is " -"also a new :meth:`~urllib.request.Request.remove_header` method that can be " -"used to remove headers from a :class:`~urllib.request.Request`. " -"(Contributed by Alexey Kachayev in :issue:`16464`, Daniel Wozniak in :issue:" -"`17485`, and Damien Brecht and Senthil Kumaran in :issue:`17272`.)" +":class:`~urllib.request.Request` objects are now reusable: if " +"the :attr:`~urllib.request.Request.full_url` " +"or :attr:`~urllib.request.Request.data` attributes are modified, all " +"relevant internal properties are updated. This means, for example, that it " +"is now possible to use the same :class:`~urllib.request.Request` object in " +"more than one :meth:`.OpenerDirector.open` call with different *data* " +"arguments, or to modify a :class:`~urllib.request.Request`\\ 's ``url`` " +"rather than recomputing it from scratch. There is also a " +"new :meth:`~urllib.request.Request.remove_header` method that can be used to " +"remove headers from a :class:`~urllib.request.Request`. (Contributed by " +"Alexey Kachayev in :issue:`16464`, Daniel Wozniak in :issue:`17485`, and " +"Damien Brecht and Senthil Kumaran in :issue:`17272`.)" msgstr "" #: ../../whatsnew/3.4.rst:1647 msgid "" -":class:`~urllib.error.HTTPError` objects now have a :attr:`~urllib.error." -"HTTPError.headers` attribute that provides access to the HTTP response " -"headers associated with the error. (Contributed by Berker Peksag in :issue:" -"`15701`.)" +":class:`~urllib.error.HTTPError` objects now have " +"a :attr:`~urllib.error.HTTPError.headers` attribute that provides access to " +"the HTTP response headers associated with the error. (Contributed by Berker " +"Peksag in :issue:`15701`.)" msgstr "" #: ../../whatsnew/3.4.rst:1654 @@ -2362,13 +2417,13 @@ msgstr "unittest" #: ../../whatsnew/3.4.rst:1656 msgid "" -"The :class:`~unittest.TestCase` class has a new method, :meth:`~unittest." -"TestCase.subTest`, that produces a context manager whose :keyword:`with` " -"block becomes a \"sub-test\". This context manager allows a test method to " -"dynamically generate subtests by, say, calling the ``subTest`` context " -"manager inside a loop. A single test method can thereby produce an " -"indefinite number of separately identified and separately counted tests, all " -"of which will run even if one or more of them fail. For example::" +"The :class:`~unittest.TestCase` class has a new " +"method, :meth:`~unittest.TestCase.subTest`, that produces a context manager " +"whose :keyword:`with` block becomes a \"sub-test\". This context manager " +"allows a test method to dynamically generate subtests by, say, calling the " +"``subTest`` context manager inside a loop. A single test method can thereby " +"produce an indefinite number of separately identified and separately counted " +"tests, all of which will run even if one or more of them fail. For example::" msgstr "" #: ../../whatsnew/3.4.rst:1664 @@ -2428,9 +2483,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:1695 msgid "" "A new test assertion context-manager, :meth:`~unittest.TestCase.assertLogs`, " -"will ensure that a given block of code emits a log message using the :mod:" -"`logging` module. By default the message can come from any logger and have " -"a priority of ``INFO`` or higher, but both the logger name and an " +"will ensure that a given block of code emits a log message using " +"the :mod:`logging` module. By default the message can come from any logger " +"and have a priority of ``INFO`` or higher, but both the logger name and an " "alternative minimum logging level may be specified. The object returned by " "the context manager can be queried for the :class:`~logging.LogRecord`\\ s " "and/or formatted messages that were logged. (Contributed by Antoine Pitrou " @@ -2472,8 +2527,8 @@ msgid "" ":class:`~venv.EnvBuilder` and the :func:`~venv.create` convenience function " "take a new keyword argument *with_pip*, which defaults to ``False``, that " "controls whether or not :class:`~venv.EnvBuilder` ensures that ``pip`` is " -"installed in the virtual environment. (Contributed by Nick Coghlan in :" -"issue:`19552` as part of the :pep:`453` implementation.)" +"installed in the virtual environment. (Contributed by Nick Coghlan " +"in :issue:`19552` as part of the :pep:`453` implementation.)" msgstr "" #: ../../whatsnew/3.4.rst:1730 @@ -2501,9 +2556,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:1742 msgid "" -"The :meth:`~wave.Wave_write.writeframesraw` and :meth:`~wave.Wave_write." -"writeframes` methods now accept any :term:`bytes-like object`. (Contributed " -"by Serhiy Storchaka in :issue:`8311`.)" +"The :meth:`~wave.Wave_write.writeframesraw` " +"and :meth:`~wave.Wave_write.writeframes` methods now accept any :term:`bytes-" +"like object`. (Contributed by Serhiy Storchaka in :issue:`8311`.)" msgstr "" #: ../../whatsnew/3.4.rst:1748 @@ -2538,21 +2593,21 @@ msgstr "xml.etree" #: ../../whatsnew/3.4.rst:1766 msgid "" "A new parser, :class:`~xml.etree.ElementTree.XMLPullParser`, allows a non-" -"blocking applications to parse XML documents. An example can be seen at :" -"ref:`elementtree-pull-parsing`. (Contributed by Antoine Pitrou in :issue:" -"`17741`.)" +"blocking applications to parse XML documents. An example can be seen " +"at :ref:`elementtree-pull-parsing`. (Contributed by Antoine Pitrou " +"in :issue:`17741`.)" msgstr "" #: ../../whatsnew/3.4.rst:1771 msgid "" "The :mod:`xml.etree.ElementTree` :func:`~xml.etree.ElementTree.tostring` " -"and :func:`~xml.etree.ElementTree.tostringlist` functions, and the :class:" -"`~xml.etree.ElementTree.ElementTree` :meth:`~xml.etree.ElementTree." -"ElementTree.write` method, now have a *short_empty_elements* :ref:`keyword-" -"only parameter <keyword-only_parameter>` providing control over whether " -"elements with no content are written in abbreviated (``<tag />``) or " -"expanded (``<tag></tag>``) form. (Contributed by Ariel Poliak and Serhiy " -"Storchaka in :issue:`14377`.)" +"and :func:`~xml.etree.ElementTree.tostringlist` functions, and " +"the :class:`~xml.etree.ElementTree.ElementTree` :meth:`~xml.etree.ElementTree.ElementTree.write` " +"method, now have a *short_empty_elements* :ref:`keyword-only parameter " +"<keyword-only_parameter>` providing control over whether elements with no " +"content are written in abbreviated (``<tag />``) or expanded (``<tag></" +"tag>``) form. (Contributed by Ariel Poliak and Serhiy Storchaka " +"in :issue:`14377`.)" msgstr "" #: ../../whatsnew/3.4.rst:1782 @@ -2561,18 +2616,18 @@ msgstr "zipfile" #: ../../whatsnew/3.4.rst:1784 msgid "" -"The :meth:`~zipfile.PyZipFile.writepy` method of the :class:`~zipfile." -"PyZipFile` class has a new *filterfunc* option that can be used to control " -"which directories and files are added to the archive. For example, this " -"could be used to exclude test files from the archive. (Contributed by " -"Christian Tismer in :issue:`19274`.)" +"The :meth:`~zipfile.PyZipFile.writepy` method of " +"the :class:`~zipfile.PyZipFile` class has a new *filterfunc* option that can " +"be used to control which directories and files are added to the archive. " +"For example, this could be used to exclude test files from the archive. " +"(Contributed by Christian Tismer in :issue:`19274`.)" msgstr "" #: ../../whatsnew/3.4.rst:1790 msgid "" -"The *allowZip64* parameter to :class:`~zipfile.ZipFile` and :class:`~zipfile." -"PyZipfile` is now ``True`` by default. (Contributed by William Mallard in :" -"issue:`17201`.)" +"The *allowZip64* parameter to :class:`~zipfile.ZipFile` " +"and :class:`~zipfile.PyZipfile` is now ``True`` by default. (Contributed by " +"William Mallard in :issue:`17201`.)" msgstr "" #: ../../whatsnew/3.4.rst:1797 @@ -2607,16 +2662,17 @@ msgstr "" #: ../../whatsnew/3.4.rst:1824 msgid "" -"As part of this change, module globals are no longer forcibly set to :const:" -"`None` during interpreter shutdown in most cases, instead relying on the " -"normal operation of the cyclic garbage collector. This avoids a whole class " -"of interpreter-shutdown-time errors, usually involving ``__del__`` methods, " -"that have plagued Python since the cyclic GC was first introduced." +"As part of this change, module globals are no longer forcibly set " +"to :const:`None` during interpreter shutdown in most cases, instead relying " +"on the normal operation of the cyclic garbage collector. This avoids a " +"whole class of interpreter-shutdown-time errors, usually involving " +"``__del__`` methods, that have plagued Python since the cyclic GC was first " +"introduced." msgstr "" #: ../../whatsnew/3.4.rst:1833 msgid ":pep:`442` -- Safe object finalization" -msgstr "" +msgstr ":pep:`442` -- 安全的物件最終化" #: ../../whatsnew/3.4.rst:1840 msgid "PEP 456: Secure and Interchangeable Hash Algorithm" @@ -2685,7 +2741,7 @@ msgstr "由 Larry Hastings 撰寫 PEP 與實作。" #: ../../whatsnew/3.4.rst:1887 msgid "Other Build and C API Changes" -msgstr "" +msgstr "其他建置和 C API 變更" #: ../../whatsnew/3.4.rst:1889 msgid "" @@ -2724,36 +2780,38 @@ msgstr "" #: ../../whatsnew/3.4.rst:1909 msgid "" -"New function :c:func:`PyStructSequence_InitType2` supplements the existing :" -"c:func:`PyStructSequence_InitType` function. The difference is that it " -"returns ``0`` on success and ``-1`` on failure." +"New function :c:func:`PyStructSequence_InitType2` supplements the " +"existing :c:func:`PyStructSequence_InitType` function. The difference is " +"that it returns ``0`` on success and ``-1`` on failure." msgstr "" #: ../../whatsnew/3.4.rst:1913 msgid "" "The CPython source can now be compiled using the address sanity checking " "features of recent versions of GCC and clang: the false alarms in the small " -"object allocator have been silenced. (Contributed by Dhiru Kholia in :issue:" -"`18596`.)" +"object allocator have been silenced. (Contributed by Dhiru Kholia " +"in :issue:`18596`.)" msgstr "" #: ../../whatsnew/3.4.rst:1918 msgid "" -"The Windows build now uses `Address Space Layout Randomization <https://en." -"wikipedia.org/wiki/Address_space_layout_randomization>`_ and `Data Execution " -"Prevention <https://en.wikipedia.org/wiki/Data_Execution_Prevention>`_. " -"(Contributed by Christian Heimes in :issue:`16632`.)" +"The Windows build now uses `Address Space Layout Randomization <https://" +"en.wikipedia.org/wiki/Address_space_layout_randomization>`_ and `Data " +"Execution Prevention <https://en.wikipedia.org/wiki/" +"Data_Execution_Prevention>`_. (Contributed by Christian Heimes " +"in :issue:`16632`.)" msgstr "" #: ../../whatsnew/3.4.rst:1923 msgid "" -"New function :c:func:`PyObject_LengthHint` is the C API equivalent of :func:" -"`operator.length_hint`. (Contributed by Armin Ronacher in :issue:`16148`.)" +"New function :c:func:`PyObject_LengthHint` is the C API equivalent " +"of :func:`operator.length_hint`. (Contributed by Armin Ronacher " +"in :issue:`16148`.)" msgstr "" #: ../../whatsnew/3.4.rst:1931 msgid "Other Improvements" -msgstr "" +msgstr "其他改進" #: ../../whatsnew/3.4.rst:1935 msgid "" @@ -2789,8 +2847,8 @@ msgstr "" msgid "" "The CPython Windows installer now adds ``.py`` to the :envvar:`PATHEXT` " "variable when extensions are registered, allowing users to run a python " -"script at the windows command prompt by just typing its name without the ``." -"py`` extension. (Contributed by Paul Moore in :issue:`18569`.)" +"script at the windows command prompt by just typing its name without the " +"``.py`` extension. (Contributed by Paul Moore in :issue:`18569`.)" msgstr "" #: ../../whatsnew/3.4.rst:1961 @@ -2804,13 +2862,17 @@ msgstr "" #: ../../whatsnew/3.4.rst:1967 msgid "" "The ``-R`` option to the :ref:`python regression test suite <regrtest>` now " -"also checks for memory allocation leaks, using :func:`sys." -"getallocatedblocks`. (Contributed by Antoine Pitrou in :issue:`13390`.)" +"also checks for memory allocation leaks, " +"using :func:`sys.getallocatedblocks`. (Contributed by Antoine Pitrou " +"in :issue:`13390`.)" msgstr "" +":ref:`python 迴歸測試套裝 <regrtest>` 的 ``-R`` 選項現在也可以透過使" +"用 :func:`sys.getallocatedblocks` 來檢查記憶體配置洩漏。(由 Antoine Pitrou " +"在 :issue:`13390` 貢獻。)" #: ../../whatsnew/3.4.rst:1972 msgid "``python -m`` now works with namespace packages." -msgstr "" +msgstr "``python -m`` 現在可以使用於命名空間套件。" #: ../../whatsnew/3.4.rst:1974 msgid "" @@ -2830,15 +2892,15 @@ msgstr "" msgid "" "A new opcode, :opcode:`!LOAD_CLASSDEREF`, has been added to fix a bug in the " "loading of free variables in class bodies that could be triggered by certain " -"uses of :ref:`__prepare__ <prepare>`. (Contributed by Benjamin Peterson in :" -"issue:`17853`.)" +"uses of :ref:`__prepare__ <prepare>`. (Contributed by Benjamin Peterson " +"in :issue:`17853`.)" msgstr "" #: ../../whatsnew/3.4.rst:1987 msgid "" "A number of MemoryError-related crashes were identified and fixed by Victor " -"Stinner using his :pep:`445`-based ``pyfailmalloc`` tool (:issue:`18408`, :" -"issue:`18520`)." +"Stinner using his :pep:`445`-based ``pyfailmalloc`` tool " +"(:issue:`18408`, :issue:`18520`)." msgstr "" #: ../../whatsnew/3.4.rst:1991 @@ -2858,10 +2920,10 @@ msgstr "" #: ../../whatsnew/3.4.rst:2000 msgid "" -"The encoding name is now optional in the value set for the :envvar:" -"`PYTHONIOENCODING` environment variable. This makes it possible to set just " -"the error handler, without changing the default encoding. (Contributed by " -"Serhiy Storchaka in :issue:`18818`.)" +"The encoding name is now optional in the value set for " +"the :envvar:`PYTHONIOENCODING` environment variable. This makes it possible " +"to set just the error handler, without changing the default encoding. " +"(Contributed by Serhiy Storchaka in :issue:`18818`.)" msgstr "" #: ../../whatsnew/3.4.rst:2005 @@ -2897,12 +2959,13 @@ msgstr "" #: ../../whatsnew/3.4.rst:2027 msgid "" "The interpreter starts about 30% faster. A couple of measures lead to the " -"speedup. The interpreter loads fewer modules on startup, e.g. the :mod:" -"`re`, :mod:`collections` and :mod:`locale` modules and their dependencies " -"are no longer imported by default. The marshal module has been improved to " -"load compiled Python code faster. (Contributed by Antoine Pitrou, Christian " -"Heimes and Victor Stinner in :issue:`19219`, :issue:`19218`, :issue:" -"`19209`, :issue:`19205` and :issue:`9548`.)" +"speedup. The interpreter loads fewer modules on startup, e.g. " +"the :mod:`re`, :mod:`collections` and :mod:`locale` modules and their " +"dependencies are no longer imported by default. The marshal module has been " +"improved to load compiled Python code faster. (Contributed by Antoine " +"Pitrou, Christian Heimes and Victor Stinner " +"in :issue:`19219`, :issue:`19218`, :issue:`19209`, :issue:`19205` " +"and :issue:`9548`.)" msgstr "" #: ../../whatsnew/3.4.rst:2035 @@ -2935,8 +2998,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2051 msgid "" -":func:`html.escape` is now 10x faster. (Contributed by Matt Bryant in :" -"issue:`18020`.)" +":func:`html.escape` is now 10x faster. (Contributed by Matt Bryant " +"in :issue:`18020`.)" msgstr "" #: ../../whatsnew/3.4.rst:2054 @@ -2961,36 +3024,38 @@ msgstr "已棄用" msgid "" "This section covers various APIs and other features that have been " "deprecated in Python 3.4, and will be removed in Python 3.5 or later. In " -"most (but not all) cases, using the deprecated APIs will produce a :exc:" -"`DeprecationWarning` when the interpreter is run with deprecation warnings " -"enabled (for example, by using ``-Wd``)." +"most (but not all) cases, using the deprecated APIs will produce " +"a :exc:`DeprecationWarning` when the interpreter is run with deprecation " +"warnings enabled (for example, by using ``-Wd``)." msgstr "" #: ../../whatsnew/3.4.rst:2076 msgid "Deprecations in the Python API" -msgstr "" +msgstr "已棄用的 Python API" #: ../../whatsnew/3.4.rst:2078 msgid "" "As mentioned in :ref:`whatsnew-pep-451`, a number of :mod:`importlib` " "methods and functions are deprecated: :meth:`!importlib.find_loader` is " -"replaced by :func:`importlib.util.find_spec`; :meth:`!importlib.machinery." -"PathFinder.find_module` is replaced by :meth:`importlib.machinery.PathFinder." -"find_spec`; :meth:`!importlib.abc.MetaPathFinder.find_module` is replaced " -"by :meth:`importlib.abc.MetaPathFinder.find_spec`; :meth:`!importlib.abc." -"PathEntryFinder.find_loader` and :meth:`!find_module` are replaced by :meth:" -"`importlib.abc.PathEntryFinder.find_spec`; all of the :samp:`{xxx}Loader` " -"ABC ``load_module`` methods (:meth:`!importlib.abc.Loader.load_module`, :" -"meth:`!importlib.abc.InspectLoader.load_module`, :meth:`!importlib.abc." -"FileLoader.load_module`, :meth:`!importlib.abc.SourceLoader.load_module`) " -"should no longer be implemented, instead loaders should implement an " -"``exec_module`` method (:meth:`importlib.abc.Loader.exec_module`, :meth:" -"`importlib.abc.InspectLoader.exec_module` :meth:`importlib.abc.SourceLoader." -"exec_module`) and let the import system take care of the rest; and :meth:`!" -"importlib.abc.Loader.module_repr`, :meth:`!importlib.util." -"module_for_loader`, :meth:`!importlib.util.set_loader`, and :meth:`!" -"importlib.util.set_package` are no longer needed because their functions are " -"now handled automatically by the import system." +"replaced by :func:`importlib.util.find_spec`; :meth:`!" +"importlib.machinery.PathFinder.find_module` is replaced " +"by :meth:`importlib.machinery.PathFinder.find_spec`; :meth:`!" +"importlib.abc.MetaPathFinder.find_module` is replaced " +"by :meth:`importlib.abc.MetaPathFinder.find_spec`; :meth:`!" +"importlib.abc.PathEntryFinder.find_loader` and :meth:`!find_module` are " +"replaced by :meth:`importlib.abc.PathEntryFinder.find_spec`; all of " +"the :samp:`{xxx}Loader` ABC ``load_module`` methods (:meth:`!" +"importlib.abc.Loader.load_module`, :meth:`!" +"importlib.abc.InspectLoader.load_module`, :meth:`!" +"importlib.abc.FileLoader.load_module`, :meth:`!" +"importlib.abc.SourceLoader.load_module`) should no longer be implemented, " +"instead loaders should implement an ``exec_module`` method " +"(:meth:`importlib.abc.Loader.exec_module`, :meth:`importlib.abc.InspectLoader.exec_module` :meth:`importlib.abc.SourceLoader.exec_module`) " +"and let the import system take care of the rest; and :meth:`!" +"importlib.abc.Loader.module_repr`, :meth:`!" +"importlib.util.module_for_loader`, :meth:`!importlib.util.set_loader`, " +"and :meth:`!importlib.util.set_package` are no longer needed because their " +"functions are now handled automatically by the import system." msgstr "" #: ../../whatsnew/3.4.rst:2103 @@ -3015,8 +3080,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2113 msgid "" "The internal ``Netrc`` class in the :mod:`ftplib` module has been documented " -"as deprecated in its docstring for quite some time. It now emits a :exc:" -"`DeprecationWarning` and will be removed completely in Python 3.5." +"as deprecated in its docstring for quite some time. It now emits " +"a :exc:`DeprecationWarning` and will be removed completely in Python 3.5." msgstr "" #: ../../whatsnew/3.4.rst:2117 @@ -3033,12 +3098,12 @@ msgstr "" #: ../../whatsnew/3.4.rst:2123 msgid "" -"The :mod:`plistlib` :func:`~plistlib.readPlist`, :func:`~plistlib." -"writePlist`, :func:`~plistlib.readPlistFromBytes`, and :func:`~plistlib." -"writePlistToBytes` functions are deprecated in favor of the corresponding " -"new functions :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:" -"`~plistlib.loads`, and :func:`~plistlib.dumps`. :func:`~plistlib.Data` is " -"deprecated in favor of just using the :class:`bytes` constructor." +"The :mod:`plistlib` :func:`~plistlib.readPlist`, :func:`~plistlib.writePlist`, :func:`~plistlib.readPlistFromBytes`, " +"and :func:`~plistlib.writePlistToBytes` functions are deprecated in favor of " +"the corresponding new " +"functions :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:`~plistlib.loads`, " +"and :func:`~plistlib.dumps`. :func:`~plistlib.Data` is deprecated in favor " +"of just using the :class:`bytes` constructor." msgstr "" #: ../../whatsnew/3.4.rst:2130 @@ -3058,9 +3123,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:2138 msgid "" "The *parser* argument of :func:`xml.etree.ElementTree.iterparse` has been " -"deprecated, as has the *html* argument of :func:`~xml.etree.ElementTree." -"XMLParser`. To prepare for the removal of the latter, all arguments to " -"``XMLParser`` should be passed by keyword." +"deprecated, as has the *html* argument " +"of :func:`~xml.etree.ElementTree.XMLParser`. To prepare for the removal of " +"the latter, all arguments to ``XMLParser`` should be passed by keyword." msgstr "" #: ../../whatsnew/3.4.rst:2145 @@ -3085,7 +3150,7 @@ msgstr "已移除" #: ../../whatsnew/3.4.rst:2160 msgid "Operating Systems No Longer Supported" -msgstr "" +msgstr "不再支援的作業系統" #: ../../whatsnew/3.4.rst:2162 msgid "" @@ -3136,8 +3201,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2184 msgid "" "The ``PyThreadState.tick_counter`` field has been removed; its value has " -"been meaningless since Python 3.2, when the \"new GIL\" was introduced (:" -"issue:`19199`)." +"been meaningless since Python 3.2, when the \"new GIL\" was introduced " +"(:issue:`19199`)." msgstr "" #: ../../whatsnew/3.4.rst:2188 @@ -3148,9 +3213,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:2191 msgid "" -"The *strict* argument to :class:`~http.client.HTTPConnection` and :class:" -"`~http.client.HTTPSConnection` has been removed. HTTP 0.9-style \"Simple " -"Responses\" are no longer supported." +"The *strict* argument to :class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` has been removed. HTTP 0.9-style " +"\"Simple Responses\" are no longer supported." msgstr "" #: ../../whatsnew/3.4.rst:2195 @@ -3163,8 +3228,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2200 msgid "" -"Support for loading the deprecated ``TYPE_INT64`` has been removed from :mod:" -"`marshal`. (Contributed by Dan Riti in :issue:`15480`.)" +"Support for loading the deprecated ``TYPE_INT64`` has been removed " +"from :mod:`marshal`. (Contributed by Dan Riti in :issue:`15480`.)" msgstr "" #: ../../whatsnew/3.4.rst:2203 @@ -3181,16 +3246,16 @@ msgid "" "situation where previously working (but incorrect) code would start failing " "if an object gained a __format__ method, which means that your code may now " "raise a :exc:`TypeError` if you are using an ``'s'`` format code with " -"objects that do not have a __format__ method that handles it. See :issue:" -"`7994` for background." +"objects that do not have a __format__ method that handles it. " +"See :issue:`7994` for background." msgstr "" #: ../../whatsnew/3.4.rst:2215 msgid "" -":meth:`difflib.SequenceMatcher.isbjunk` and :meth:`difflib.SequenceMatcher." -"isbpopular` were deprecated in 3.2, and have now been removed: use ``x in sm." -"bjunk`` and ``x in sm.bpopular``, where *sm* is a :class:`~difflib." -"SequenceMatcher` object (:issue:`13248`)." +":meth:`difflib.SequenceMatcher.isbjunk` " +"and :meth:`difflib.SequenceMatcher.isbpopular` were deprecated in 3.2, and " +"have now been removed: use ``x in sm.bjunk`` and ``x in sm.bpopular``, where " +"*sm* is a :class:`~difflib.SequenceMatcher` object (:issue:`13248`)." msgstr "" #: ../../whatsnew/3.4.rst:2223 @@ -3234,12 +3299,12 @@ msgstr "" #: ../../whatsnew/3.4.rst:2248 msgid "" "In a posix shell, setting the :envvar:`PATH` environment variable to an " -"empty value is equivalent to not setting it at all. However, setting :" -"envvar:`PYTHONPATH` to an empty value was *not* equivalent to not setting it " -"at all: setting :envvar:`PYTHONPATH` to an empty value was equivalent to " -"setting it to ``.``, which leads to confusion when reasoning by analogy to " -"how :envvar:`PATH` works. The behavior now conforms to the posix convention " -"for :envvar:`PATH`." +"empty value is equivalent to not setting it at all. However, " +"setting :envvar:`PYTHONPATH` to an empty value was *not* equivalent to not " +"setting it at all: setting :envvar:`PYTHONPATH` to an empty value was " +"equivalent to setting it to ``.``, which leads to confusion when reasoning " +"by analogy to how :envvar:`PATH` works. The behavior now conforms to the " +"posix convention for :envvar:`PATH`." msgstr "" #: ../../whatsnew/3.4.rst:2256 @@ -3263,18 +3328,20 @@ msgstr "Python API 的變更" #: ../../whatsnew/3.4.rst:2268 msgid "" "The ABCs defined in :mod:`importlib.abc` now either raise the appropriate " -"exception or return a default value instead of raising :exc:" -"`NotImplementedError` blindly. This will only affect code calling :func:" -"`super` and falling through all the way to the ABCs. For compatibility, " -"catch both :exc:`NotImplementedError` or the appropriate exception as needed." +"exception or return a default value instead of " +"raising :exc:`NotImplementedError` blindly. This will only affect code " +"calling :func:`super` and falling through all the way to the ABCs. For " +"compatibility, catch both :exc:`NotImplementedError` or the appropriate " +"exception as needed." msgstr "" #: ../../whatsnew/3.4.rst:2274 msgid "" -"The module type now initializes the :attr:`~module.__package__` and :attr:" -"`~module.__loader__` attributes to ``None`` by default. To determine if " -"these attributes were set in a backwards-compatible fashion, use e.g. " -"``getattr(module, '__loader__', None) is not None``. (:issue:`17115`.)" +"The module type now initializes the :attr:`~module.__package__` " +"and :attr:`~module.__loader__` attributes to ``None`` by default. To " +"determine if these attributes were set in a backwards-compatible fashion, " +"use e.g. ``getattr(module, '__loader__', None) is not None``. " +"(:issue:`17115`.)" msgstr "" #: ../../whatsnew/3.4.rst:2280 @@ -3309,9 +3376,9 @@ msgid "" "incorrect for frozen modules to set the attribute as they are not loaded " "from any explicit location. If you must know that a module comes from frozen " "code then you can see if the module's ``__spec__.location`` is set to " -"``'frozen'``, check if the loader is a subclass of :class:`importlib." -"machinery.FrozenImporter`, or if Python 2 compatibility is necessary you can " -"use :func:`!imp.is_frozen`." +"``'frozen'``, check if the loader is a subclass " +"of :class:`importlib.machinery.FrozenImporter`, or if Python 2 compatibility " +"is necessary you can use :func:`!imp.is_frozen`." msgstr "" #: ../../whatsnew/3.4.rst:2305 @@ -3324,14 +3391,14 @@ msgstr "" #: ../../whatsnew/3.4.rst:2310 msgid "" -":meth:`importlib.abc.SourceLoader.get_source` no longer raises :exc:" -"`ImportError` when the source code being loaded triggers a :exc:" -"`SyntaxError` or :exc:`UnicodeDecodeError`. As :exc:`ImportError` is meant " -"to be raised only when source code cannot be found but it should, it was " -"felt to be over-reaching/overloading of that meaning when the source code is " -"found but improperly structured. If you were catching ImportError before and " -"wish to continue to ignore syntax or decoding issues, catch all three " -"exceptions now." +":meth:`importlib.abc.SourceLoader.get_source` no longer " +"raises :exc:`ImportError` when the source code being loaded triggers " +"a :exc:`SyntaxError` or :exc:`UnicodeDecodeError`. As :exc:`ImportError` is " +"meant to be raised only when source code cannot be found but it should, it " +"was felt to be over-reaching/overloading of that meaning when the source " +"code is found but improperly structured. If you were catching ImportError " +"before and wish to continue to ignore syntax or decoding issues, catch all " +"three exceptions now." msgstr "" #: ../../whatsnew/3.4.rst:2319 @@ -3348,12 +3415,13 @@ msgstr "" #: ../../whatsnew/3.4.rst:2329 msgid "" -":func:`inspect.getfullargspec` has been reimplemented on top of :func:" -"`inspect.signature` and hence handles a much wider variety of callable " -"objects than it did in the past. It is expected that additional builtin and " -"extension module callables will gain signature metadata over the course of " -"the Python 3.4 series. Code that assumes that :func:`inspect.getfullargspec` " -"will fail on non-Python callables may need to be adjusted accordingly." +":func:`inspect.getfullargspec` has been reimplemented on top " +"of :func:`inspect.signature` and hence handles a much wider variety of " +"callable objects than it did in the past. It is expected that additional " +"builtin and extension module callables will gain signature metadata over the " +"course of the Python 3.4 series. Code that assumes " +"that :func:`inspect.getfullargspec` will fail on non-Python callables may " +"need to be adjusted accordingly." msgstr "" #: ../../whatsnew/3.4.rst:2337 @@ -3366,8 +3434,8 @@ msgid "" "working directory will also now have an absolute path, including when using " "``-m`` with the interpreter (except for ``__main__.__file__`` when a script " "has been executed directly using a relative path) (Contributed by Brett " -"Cannon in :issue:`18416`). is specified on the command-line) (:issue:" -"`18416`)." +"Cannon in :issue:`18416`). is specified on the command-line) " +"(:issue:`18416`)." msgstr "" #: ../../whatsnew/3.4.rst:2348 @@ -3384,66 +3452,69 @@ msgid "" "Strings between ``from __future__ import ...`` statements now *always* raise " "a :exc:`SyntaxError`. Previously if there was no leading docstring, an " "interstitial string would sometimes be ignored. This brings CPython into " -"compliance with the language spec; Jython and PyPy already were. (:issue:" -"`17434`)." +"compliance with the language spec; Jython and PyPy already were. " +"(:issue:`17434`)." msgstr "" #: ../../whatsnew/3.4.rst:2360 msgid "" ":meth:`ssl.SSLSocket.getpeercert` and :meth:`ssl.SSLSocket.do_handshake` now " "raise an :exc:`OSError` with ``ENOTCONN`` when the ``SSLSocket`` is not " -"connected, instead of the previous behavior of raising an :exc:" -"`AttributeError`. In addition, :meth:`~ssl.SSLSocket.getpeercert` will " -"raise a :exc:`ValueError` if the handshake has not yet been done." +"connected, instead of the previous behavior of raising " +"an :exc:`AttributeError`. In addition, :meth:`~ssl.SSLSocket.getpeercert` " +"will raise a :exc:`ValueError` if the handshake has not yet been done." msgstr "" #: ../../whatsnew/3.4.rst:2366 msgid "" ":func:`base64.b32decode` now raises a :exc:`binascii.Error` when the input " "string contains non-b32-alphabet characters, instead of a :exc:`TypeError`. " -"This particular :exc:`TypeError` was missed when the other :exc:" -"`TypeError`\\ s were converted. (Contributed by Serhiy Storchaka in :issue:" -"`18011`.) Note: this change was also inadvertently applied in Python 3.3.3." +"This particular :exc:`TypeError` was missed when the " +"other :exc:`TypeError`\\ s were converted. (Contributed by Serhiy Storchaka " +"in :issue:`18011`.) Note: this change was also inadvertently applied in " +"Python 3.3.3." msgstr "" #: ../../whatsnew/3.4.rst:2373 msgid "" -"The :attr:`!file` attribute is now automatically closed when the creating :" -"class:`!cgi.FieldStorage` instance is garbage collected. If you were pulling " -"the file object out separately from the :class:`!cgi.FieldStorage` instance " -"and not keeping the instance alive, then you should either store the entire :" -"class:`!cgi.FieldStorage` instance or read the contents of the file before " -"the :class:`!cgi.FieldStorage` instance is garbage collected." +"The :attr:`!file` attribute is now automatically closed when the " +"creating :class:`!cgi.FieldStorage` instance is garbage collected. If you " +"were pulling the file object out separately from the :class:`!" +"cgi.FieldStorage` instance and not keeping the instance alive, then you " +"should either store the entire :class:`!cgi.FieldStorage` instance or read " +"the contents of the file before the :class:`!cgi.FieldStorage` instance is " +"garbage collected." msgstr "" #: ../../whatsnew/3.4.rst:2380 msgid "" "Calling ``read`` or ``write`` on a closed SSL socket now raises an " -"informative :exc:`ValueError` rather than the previous more mysterious :exc:" -"`AttributeError` (:issue:`9177`)." +"informative :exc:`ValueError` rather than the previous more " +"mysterious :exc:`AttributeError` (:issue:`9177`)." msgstr "" #: ../../whatsnew/3.4.rst:2384 msgid "" ":meth:`slice.indices` no longer produces an :exc:`OverflowError` for huge " -"values. As a consequence of this fix, :meth:`slice.indices` now raises a :" -"exc:`ValueError` if given a negative length; previously it returned nonsense " -"values (:issue:`14794`)." +"values. As a consequence of this fix, :meth:`slice.indices` now raises " +"a :exc:`ValueError` if given a negative length; previously it returned " +"nonsense values (:issue:`14794`)." msgstr "" #: ../../whatsnew/3.4.rst:2389 msgid "" "The :class:`complex` constructor, unlike the :mod:`cmath` functions, was " "incorrectly accepting :class:`float` values if an object's ``__complex__`` " -"special method returned one. This now raises a :exc:`TypeError`. (:issue:" -"`16290`.)" +"special method returned one. This now raises a :exc:`TypeError`. " +"(:issue:`16290`.)" msgstr "" #: ../../whatsnew/3.4.rst:2394 msgid "" -"The :class:`int` constructor in 3.2 and 3.3 erroneously accepts :class:" -"`float` values for the *base* parameter. It is unlikely anyone was doing " -"this, but if so, it will now raise a :exc:`TypeError` (:issue:`16772`)." +"The :class:`int` constructor in 3.2 and 3.3 erroneously " +"accepts :class:`float` values for the *base* parameter. It is unlikely " +"anyone was doing this, but if so, it will now raise a :exc:`TypeError` " +"(:issue:`16772`)." msgstr "" #: ../../whatsnew/3.4.rst:2398 @@ -3484,8 +3555,8 @@ msgid "" "isolation that :mod:`unittest` is designed to provide. However, if the lack " "of isolation is considered acceptable, the old behavior can be restored by " "creating a :mod:`~unittest.TestSuite` subclass that defines a " -"``_removeTestAtIndex`` method that does nothing (see :meth:`.TestSuite." -"__iter__`) (:issue:`11798`)." +"``_removeTestAtIndex`` method that does nothing " +"(see :meth:`.TestSuite.__iter__`) (:issue:`11798`)." msgstr "" #: ../../whatsnew/3.4.rst:2425 @@ -3518,8 +3589,8 @@ msgid "" "The new *convert_charrefs* argument to :class:`~html.parser.HTMLParser` " "currently defaults to ``False`` for backward compatibility, but will " "eventually be changed to default to ``True``. It is recommended that you " -"add this keyword, with the appropriate value, to any :class:`~html.parser." -"HTMLParser` calls in your code (:issue:`13633`)." +"add this keyword, with the appropriate value, to " +"any :class:`~html.parser.HTMLParser` calls in your code (:issue:`13633`)." msgstr "" #: ../../whatsnew/3.4.rst:2446 @@ -3543,8 +3614,8 @@ msgid "" "is ineffective in Python3 and will eventually raise an error if used. " "Depending on the function, the equivalent of its old Python2 behavior can be " "achieved using either a *newline* argument, or if necessary by wrapping the " -"stream in :mod:`~io.TextIOWrapper` to use its *newline* argument (:issue:" -"`15204`)." +"stream in :mod:`~io.TextIOWrapper` to use its *newline* argument " +"(:issue:`15204`)." msgstr "" #: ../../whatsnew/3.4.rst:2462 @@ -3574,10 +3645,10 @@ msgstr "" msgid "" "The :mod:`collections.abc` module has been slightly refactored as part of " "the Python startup improvements. As a consequence of this, it is no longer " -"the case that importing :mod:`collections` automatically imports :mod:" -"`collections.abc`. If your program depended on the (undocumented) implicit " -"import, you will need to add an explicit ``import collections.abc`` (:issue:" -"`20784`)." +"the case that importing :mod:`collections` automatically " +"imports :mod:`collections.abc`. If your program depended on the " +"(undocumented) implicit import, you will need to add an explicit ``import " +"collections.abc`` (:issue:`20784`)." msgstr "" #: ../../whatsnew/3.4.rst:2486 @@ -3586,16 +3657,16 @@ msgstr "C API 中的改動" #: ../../whatsnew/3.4.rst:2488 msgid "" -":c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr`, and :c:func:" -"`PyObject_Str`, along with some other internal C APIs, now include a " -"debugging assertion that ensures they are not used in situations where they " -"may silently discard a currently active exception. In cases where discarding " -"the active exception is expected and desired (for example, because it has " -"already been saved locally with :c:func:`PyErr_Fetch` or is being " -"deliberately replaced with a different exception), an explicit :c:func:" -"`PyErr_Clear` call will be needed to avoid triggering the assertion when " -"invoking these operations (directly or indirectly) and running against a " -"version of Python that is compiled with assertions enabled." +":c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr`, " +"and :c:func:`PyObject_Str`, along with some other internal C APIs, now " +"include a debugging assertion that ensures they are not used in situations " +"where they may silently discard a currently active exception. In cases where " +"discarding the active exception is expected and desired (for example, " +"because it has already been saved locally with :c:func:`PyErr_Fetch` or is " +"being deliberately replaced with a different exception), an " +"explicit :c:func:`PyErr_Clear` call will be needed to avoid triggering the " +"assertion when invoking these operations (directly or indirectly) and " +"running against a version of Python that is compiled with assertions enabled." msgstr "" #: ../../whatsnew/3.4.rst:2500 @@ -3608,10 +3679,10 @@ msgstr "" #: ../../whatsnew/3.4.rst:2504 msgid "" "The result of the :c:data:`PyOS_ReadlineFunctionPointer` callback must now " -"be a string allocated by :c:func:`PyMem_RawMalloc` or :c:func:" -"`PyMem_RawRealloc`, or ``NULL`` if an error occurred, instead of a string " -"allocated by :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc` (:issue:" -"`16742`)" +"be a string allocated by :c:func:`PyMem_RawMalloc` " +"or :c:func:`PyMem_RawRealloc`, or ``NULL`` if an error occurred, instead of " +"a string allocated by :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc` " +"(:issue:`16742`)" msgstr "" #: ../../whatsnew/3.4.rst:2510 diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index 36ad7689e8..539167e103 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -75,7 +75,7 @@ msgstr "新的函式庫模組:" #: ../../whatsnew/3.5.rst:69 msgid ":mod:`typing`: :ref:`PEP 484 -- Type Hints <whatsnew-pep-484>`." -msgstr "" +msgstr ":mod:`typing`::ref:`PEP 484 -- 型別提示 <whatsnew-pep-484>`。" #: ../../whatsnew/3.5.rst:70 msgid "" @@ -124,10 +124,10 @@ msgstr "CPython 實作改進:" #: ../../whatsnew/3.5.rst:96 msgid "" -"When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale), :py:data:" -"`sys.stdin` and :py:data:`sys.stdout` now use the ``surrogateescape`` error " -"handler, instead of the ``strict`` error handler. (Contributed by Victor " -"Stinner in :issue:`19977`.)" +"When the ``LC_TYPE`` locale is the POSIX locale (``C`` " +"locale), :py:data:`sys.stdin` and :py:data:`sys.stdout` now use the " +"``surrogateescape`` error handler, instead of the ``strict`` error handler. " +"(Contributed by Victor Stinner in :issue:`19977`.)" msgstr "" #: ../../whatsnew/3.5.rst:101 @@ -191,8 +191,9 @@ msgstr "安全性改進:" #: ../../whatsnew/3.5.rst:138 msgid "" "SSLv3 is now disabled throughout the standard library. It can still be " -"enabled by instantiating a :class:`ssl.SSLContext` manually. (See :issue:" -"`22638` for more details; this change was backported to CPython 3.4 and 2.7.)" +"enabled by instantiating a :class:`ssl.SSLContext` manually. " +"(See :issue:`22638` for more details; this change was backported to CPython " +"3.4 and 2.7.)" msgstr "" #: ../../whatsnew/3.5.rst:143 @@ -374,9 +375,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:253 msgid "" -"Starting with CPython 3.5.2, ``__aiter__`` can directly return :term:" -"`asynchronous iterators <asynchronous iterator>`. Returning an :term:" -"`awaitable` object will result in a :exc:`PendingDeprecationWarning`." +"Starting with CPython 3.5.2, ``__aiter__`` can directly " +"return :term:`asynchronous iterators <asynchronous iterator>`. Returning " +"an :term:`awaitable` object will result in " +"a :exc:`PendingDeprecationWarning`." msgstr "" #: ../../whatsnew/3.5.rst:259 @@ -399,8 +401,8 @@ msgstr "" msgid "" ":pep:`465` adds the ``@`` infix operator for matrix multiplication. " "Currently, no builtin Python types implement the new operator, however, it " -"can be implemented by defining :meth:`__matmul__`, :meth:`__rmatmul__`, and :" -"meth:`__imatmul__` for regular, reflected, and in-place matrix " +"can be implemented by defining :meth:`__matmul__`, :meth:`__rmatmul__`, " +"and :meth:`__imatmul__` for regular, reflected, and in-place matrix " "multiplication. The semantics of these methods is similar to that of " "methods defining other infix arithmetic operators." msgstr "" @@ -629,12 +631,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:405 msgid "PEP 484 - Type Hints" -msgstr "" +msgstr "PEP 484 - 型別提示" #: ../../whatsnew/3.5.rst:407 msgid "" -"Function annotation syntax has been a Python feature since version 3.0 (:pep:" -"`3107`), however the semantics of annotations has been left undefined." +"Function annotation syntax has been a Python feature since version 3.0 " +"(:pep:`3107`), however the semantics of annotations has been left undefined." msgstr "" #: ../../whatsnew/3.5.rst:410 @@ -668,18 +670,18 @@ msgstr "" #: ../../whatsnew/3.5.rst:425 msgid "" -"While these annotations are available at runtime through the usual :attr:" -"`~object.__annotations__` attribute, *no automatic type checking happens at " -"runtime*. Instead, it is assumed that a separate off-line type checker (e." -"g. `mypy <https://mypy-lang.org>`_) will be used for on-demand source code " -"analysis." +"While these annotations are available at runtime through the " +"usual :attr:`~object.__annotations__` attribute, *no automatic type checking " +"happens at runtime*. Instead, it is assumed that a separate off-line type " +"checker (e.g. `mypy <https://mypy-lang.org>`_) will be used for on-demand " +"source code analysis." msgstr "" #: ../../whatsnew/3.5.rst:431 msgid "" -"The type system supports unions, generic types, and a special type named :" -"class:`~typing.Any` which is consistent with (i.e. assignable to and from) " -"all types." +"The type system supports unions, generic types, and a special type " +"named :class:`~typing.Any` which is consistent with (i.e. assignable to and " +"from) all types." msgstr "" #: ../../whatsnew/3.5.rst:437 @@ -688,7 +690,7 @@ msgstr ":mod:`typing` 模組文件" #: ../../whatsnew/3.5.rst:438 msgid ":pep:`484` -- Type Hints" -msgstr "" +msgstr ":pep:`484` -- 型別提示" #: ../../whatsnew/3.5.rst:439 msgid "" @@ -698,7 +700,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:441 msgid ":pep:`483` -- The Theory of Type Hints" -msgstr "" +msgstr ":pep:`483` -- 型別提示理論" #: ../../whatsnew/3.5.rst:442 msgid "PEP written by Guido van Rossum" @@ -832,37 +834,32 @@ msgstr ":mod:`faulthandler` 模組的函式;" #: ../../whatsnew/3.5.rst:519 msgid "" -":mod:`os` functions: :func:`~os.fchdir`, :func:`~os.fchmod`, :func:`~os." -"fchown`, :func:`~os.fdatasync`, :func:`~os.fstat`, :func:`~os.fstatvfs`, :" -"func:`~os.fsync`, :func:`~os.ftruncate`, :func:`~os.mkfifo`, :func:`~os." -"mknod`, :func:`~os.open`, :func:`~os.posix_fadvise`, :func:`~os." -"posix_fallocate`, :func:`~os.pread`, :func:`~os.pwrite`, :func:`~os.read`, :" -"func:`~os.readv`, :func:`~os.sendfile`, :func:`~os.wait3`, :func:`~os." -"wait4`, :func:`~os.wait`, :func:`~os.waitid`, :func:`~os.waitpid`, :func:" -"`~os.write`, :func:`~os.writev`;" +":mod:`os` " +"functions: :func:`~os.fchdir`, :func:`~os.fchmod`, :func:`~os.fchown`, :func:`~os.fdatasync`, :func:`~os.fstat`, :func:`~os.fstatvfs`, :func:`~os.fsync`, :func:`~os.ftruncate`, :func:`~os.mkfifo`, :func:`~os.mknod`, :func:`~os.open`, :func:`~os.posix_fadvise`, :func:`~os.posix_fallocate`, :func:`~os.pread`, :func:`~os.pwrite`, :func:`~os.read`, :func:`~os.readv`, :func:`~os.sendfile`, :func:`~os.wait3`, :func:`~os.wait4`, :func:`~os.wait`, :func:`~os.waitid`, :func:`~os.waitpid`, :func:`~os.write`, :func:`~os.writev`;" msgstr "" #: ../../whatsnew/3.5.rst:529 msgid "" -"special cases: :func:`os.close` and :func:`os.dup2` now ignore :py:const:" -"`~errno.EINTR` errors; the syscall is not retried (see the PEP for the " -"rationale);" +"special cases: :func:`os.close` and :func:`os.dup2` now " +"ignore :py:const:`~errno.EINTR` errors; the syscall is not retried (see the " +"PEP for the rationale);" msgstr "" #: ../../whatsnew/3.5.rst:533 msgid "" -":mod:`select` functions: :func:`devpoll.poll() <select.devpoll.poll>`, :func:" -"`epoll.poll() <select.epoll.poll>`, :func:`kqueue.control() <select.kqueue." -"control>`, :func:`poll.poll() <select.poll.poll>`, :func:`~select.select`;" +":mod:`select` functions: :func:`devpoll.poll() " +"<select.devpoll.poll>`, :func:`epoll.poll() " +"<select.epoll.poll>`, :func:`kqueue.control() " +"<select.kqueue.control>`, :func:`poll.poll() " +"<select.poll.poll>`, :func:`~select.select`;" msgstr "" #: ../../whatsnew/3.5.rst:538 msgid "" -"methods of the :class:`~socket.socket` class: :meth:`~socket.socket." -"accept`, :meth:`~socket.socket.connect` (except for non-blocking sockets), :" -"meth:`~socket.socket.recv`, :meth:`~socket.socket.recvfrom`, :meth:`~socket." -"socket.recvmsg`, :meth:`~socket.socket.send`, :meth:`~socket.socket." -"sendall`, :meth:`~socket.socket.sendmsg`, :meth:`~socket.socket.sendto`;" +"methods of the :class:`~socket.socket` " +"class: :meth:`~socket.socket.accept`, :meth:`~socket.socket.connect` (except " +"for non-blocking " +"sockets), :meth:`~socket.socket.recv`, :meth:`~socket.socket.recvfrom`, :meth:`~socket.socket.recvmsg`, :meth:`~socket.socket.send`, :meth:`~socket.socket.sendall`, :meth:`~socket.socket.sendmsg`, :meth:`~socket.socket.sendto`;" msgstr "" #: ../../whatsnew/3.5.rst:545 @@ -899,18 +896,18 @@ msgstr "" #: ../../whatsnew/3.5.rst:567 msgid "" ":pep:`479` changes the behavior of generators: when a ``StopIteration`` " -"exception is raised inside a generator, it is replaced with a :exc:" -"`RuntimeError` before it exits the generator frame. The main goal of this " -"change is to ease debugging in the situation where an unguarded :func:`next` " -"call raises ``StopIteration`` and causes the iteration controlled by the " -"generator to terminate silently. This is particularly pernicious in " -"combination with the ``yield from`` construct." +"exception is raised inside a generator, it is replaced with " +"a :exc:`RuntimeError` before it exits the generator frame. The main goal of " +"this change is to ease debugging in the situation where an " +"unguarded :func:`next` call raises ``StopIteration`` and causes the " +"iteration controlled by the generator to terminate silently. This is " +"particularly pernicious in combination with the ``yield from`` construct." msgstr "" #: ../../whatsnew/3.5.rst:575 msgid "" -"This is a backwards incompatible change, so to enable the new behavior, a :" -"term:`__future__` import is necessary::" +"This is a backwards incompatible change, so to enable the new behavior, " +"a :term:`__future__` import is necessary::" msgstr "" #: ../../whatsnew/3.5.rst:578 @@ -1057,15 +1054,15 @@ msgstr "" #: ../../whatsnew/3.5.rst:664 msgid "" -":pep:`488` does away with the concept of ``.pyo`` files. This means that ``." -"pyc`` files represent both unoptimized and optimized bytecode. To prevent " +":pep:`488` does away with the concept of ``.pyo`` files. This means that " +"``.pyc`` files represent both unoptimized and optimized bytecode. To prevent " "the need to constantly regenerate bytecode files, ``.pyc`` files now have an " "optional ``opt-`` tag in their name when the bytecode is optimized. This has " "the side-effect of no more bytecode file name clashes when running under " "either :option:`-O` or :option:`-OO`. Consequently, bytecode files generated " -"from :option:`-O`, and :option:`-OO` may now exist simultaneously. :func:" -"`importlib.util.cache_from_source` has an updated API to help with this " -"change." +"from :option:`-O`, and :option:`-OO` may now exist " +"simultaneously. :func:`importlib.util.cache_from_source` has an updated API " +"to help with this change." msgstr "" #: ../../whatsnew/3.5.rst:676 @@ -1121,22 +1118,22 @@ msgstr "" #: ../../whatsnew/3.5.rst:709 msgid "" -"The :option:`-b` option now affects comparisons of :class:`bytes` with :" -"class:`int`. (Contributed by Serhiy Storchaka in :issue:`23681`.)" +"The :option:`-b` option now affects comparisons of :class:`bytes` " +"with :class:`int`. (Contributed by Serhiy Storchaka in :issue:`23681`.)" msgstr "" #: ../../whatsnew/3.5.rst:712 msgid "" "New Kazakh ``kz1048`` and Tajik ``koi8_t`` :ref:`codecs <standard-" -"encodings>`. (Contributed by Serhiy Storchaka in :issue:`22682` and :issue:" -"`22681`.)" +"encodings>`. (Contributed by Serhiy Storchaka in :issue:`22682` " +"and :issue:`22681`.)" msgstr "" #: ../../whatsnew/3.5.rst:715 msgid "" -"Property docstrings are now writable. This is especially useful for :func:" -"`collections.namedtuple` docstrings. (Contributed by Berker Peksag in :issue:" -"`24064`.)" +"Property docstrings are now writable. This is especially useful " +"for :func:`collections.namedtuple` docstrings. (Contributed by Berker Peksag " +"in :issue:`24064`.)" msgstr "" #: ../../whatsnew/3.5.rst:719 @@ -1189,8 +1186,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:752 msgid "" -"The module implementation has been contributed by Paul Moore in :issue:" -"`23491`." +"The module implementation has been contributed by Paul Moore " +"in :issue:`23491`." msgstr "" #: ../../whatsnew/3.5.rst:757 @@ -1207,10 +1204,10 @@ msgstr "argparse" #: ../../whatsnew/3.5.rst:766 msgid "" -"The :class:`~argparse.ArgumentParser` class now allows disabling :ref:" -"`abbreviated usage <prefix-matching>` of long options by setting :ref:" -"`allow_abbrev` to ``False``. (Contributed by Jonathan Paugh, Steven " -"Bethard, paul j3 and Daniel Eriksson in :issue:`14910`.)" +"The :class:`~argparse.ArgumentParser` class now allows " +"disabling :ref:`abbreviated usage <prefix-matching>` of long options by " +"setting :ref:`allow_abbrev` to ``False``. (Contributed by Jonathan Paugh, " +"Steven Bethard, paul j3 and Daniel Eriksson in :issue:`14910`.)" msgstr "" #: ../../whatsnew/3.5.rst:773 @@ -1220,8 +1217,8 @@ msgstr "asyncio" #: ../../whatsnew/3.5.rst:775 msgid "" "Since the :mod:`asyncio` module is :term:`provisional <provisional API>`, " -"all changes introduced in Python 3.5 have also been backported to Python 3.4." -"x." +"all changes introduced in Python 3.5 have also been backported to Python " +"3.4.x." msgstr "" #: ../../whatsnew/3.5.rst:778 @@ -1230,9 +1227,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:780 msgid "" -"New debugging APIs: :meth:`loop.set_debug() <asyncio.loop.set_debug>` and :" -"meth:`loop.get_debug() <asyncio.loop.get_debug>` methods. (Contributed by " -"Victor Stinner.)" +"New debugging APIs: :meth:`loop.set_debug() <asyncio.loop.set_debug>` " +"and :meth:`loop.get_debug() <asyncio.loop.get_debug>` methods. (Contributed " +"by Victor Stinner.)" msgstr "" #: ../../whatsnew/3.5.rst:784 @@ -1258,23 +1255,24 @@ msgstr "" #: ../../whatsnew/3.5.rst:798 msgid "" -"A new :meth:`transport.get_write_buffer_limits() <asyncio.WriteTransport." -"get_write_buffer_limits>` method to inquire for *high-* and *low-* water " -"limits of the flow control. (Contributed by Victor Stinner.)" +"A new :meth:`transport.get_write_buffer_limits() " +"<asyncio.WriteTransport.get_write_buffer_limits>` method to inquire for " +"*high-* and *low-* water limits of the flow control. (Contributed by Victor " +"Stinner.)" msgstr "" #: ../../whatsnew/3.5.rst:803 msgid "" -"The :func:`~asyncio.async` function is deprecated in favor of :func:" -"`~asyncio.ensure_future`. (Contributed by Yury Selivanov.)" +"The :func:`~asyncio.async` function is deprecated in favor " +"of :func:`~asyncio.ensure_future`. (Contributed by Yury Selivanov.)" msgstr "" #: ../../whatsnew/3.5.rst:807 msgid "" -"New :meth:`loop.set_task_factory() <asyncio.loop.set_task_factory>` and :" -"meth:`loop.get_task_factory() <asyncio.loop.get_task_factory>` methods to " -"customize the task factory that :meth:`loop.create_task() <asyncio.loop." -"create_task>` method uses. (Contributed by Yury Selivanov.)" +"New :meth:`loop.set_task_factory() <asyncio.loop.set_task_factory>` " +"and :meth:`loop.get_task_factory() <asyncio.loop.get_task_factory>` methods " +"to customize the task factory that :meth:`loop.create_task() " +"<asyncio.loop.create_task>` method uses. (Contributed by Yury Selivanov.)" msgstr "" #: ../../whatsnew/3.5.rst:814 @@ -1285,8 +1283,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:818 msgid "" -"The ``JoinableQueue`` class was removed, in favor of the :class:`asyncio." -"Queue` class. (Contributed by Victor Stinner.)" +"The ``JoinableQueue`` class was removed, in favor of " +"the :class:`asyncio.Queue` class. (Contributed by Victor Stinner.)" msgstr "" #: ../../whatsnew/3.5.rst:822 @@ -1335,9 +1333,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:850 msgid "" -"New :meth:`loop.get_exception_handler() <asyncio.loop." -"get_exception_handler>` method to get the current exception handler. " -"(Contributed by Yury Selivanov.)" +"New :meth:`loop.get_exception_handler() " +"<asyncio.loop.get_exception_handler>` method to get the current exception " +"handler. (Contributed by Yury Selivanov.)" msgstr "" #: ../../whatsnew/3.5.rst:854 @@ -1349,8 +1347,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:859 msgid "" -"The :meth:`loop.create_connection() <asyncio.loop.create_connection>` and :" -"meth:`loop.create_server() <asyncio.loop.create_server>` methods are " +"The :meth:`loop.create_connection() <asyncio.loop.create_connection>` " +"and :meth:`loop.create_server() <asyncio.loop.create_server>` methods are " "optimized to avoid calling the system ``getaddrinfo`` function if the " "address is already resolved. (Contributed by A. Jesse Jiryu Davis.)" msgstr "" @@ -1399,10 +1397,10 @@ msgstr "code" #: ../../whatsnew/3.5.rst:895 msgid "" -"The :func:`InteractiveInterpreter.showtraceback() <code." -"InteractiveInterpreter.showtraceback>` method now prints the full chained " -"traceback, just like the interactive interpreter. (Contributed by Claudiu " -"Popa in :issue:`17442`.)" +"The :func:`InteractiveInterpreter.showtraceback() " +"<code.InteractiveInterpreter.showtraceback>` method now prints the full " +"chained traceback, just like the interactive interpreter. (Contributed by " +"Claudiu Popa in :issue:`17442`.)" msgstr "" #: ../../whatsnew/3.5.rst:901 @@ -1412,26 +1410,28 @@ msgstr "collections" #: ../../whatsnew/3.5.rst:905 msgid "" "The :class:`~collections.OrderedDict` class is now implemented in C, which " -"makes it 4 to 100 times faster. (Contributed by Eric Snow in :issue:" -"`16991`.)" +"makes it 4 to 100 times faster. (Contributed by Eric Snow " +"in :issue:`16991`.)" msgstr "" #: ../../whatsnew/3.5.rst:908 msgid "" -":meth:`OrderedDict.items() <collections.OrderedDict.items>`, :meth:" -"`OrderedDict.keys() <collections.OrderedDict.keys>`, :meth:`OrderedDict." -"values() <collections.OrderedDict.values>` views now support :func:" -"`reversed` iteration. (Contributed by Serhiy Storchaka in :issue:`19505`.)" +":meth:`OrderedDict.items() " +"<collections.OrderedDict.items>`, :meth:`OrderedDict.keys() " +"<collections.OrderedDict.keys>`, :meth:`OrderedDict.values() " +"<collections.OrderedDict.values>` views now support :func:`reversed` " +"iteration. (Contributed by Serhiy Storchaka in :issue:`19505`.)" msgstr "" #: ../../whatsnew/3.5.rst:914 msgid "" -"The :class:`~collections.deque` class now defines :meth:`~collections.deque." -"index`, :meth:`~collections.deque.insert`, and :meth:`~collections.deque." -"copy`, and supports the ``+`` and ``*`` operators. This allows deques to be " -"recognized as a :class:`~collections.abc.MutableSequence` and improves their " -"substitutability for lists. (Contributed by Raymond Hettinger in :issue:" -"`23704`.)" +"The :class:`~collections.deque` class now " +"defines :meth:`~collections.deque.index`, :meth:`~collections.deque.insert`, " +"and :meth:`~collections.deque.copy`, and supports the ``+`` and ``*`` " +"operators. This allows deques to be recognized as " +"a :class:`~collections.abc.MutableSequence` and improves their " +"substitutability for lists. (Contributed by Raymond Hettinger " +"in :issue:`23704`.)" msgstr "" #: ../../whatsnew/3.5.rst:921 @@ -1457,11 +1457,10 @@ msgstr "(由 Berker Peksag 在 :issue:`24064` 中貢獻。)" #: ../../whatsnew/3.5.rst:930 msgid "" -"The :class:`~collections.UserString` class now implements the :meth:" -"`__getnewargs__`, :meth:`__rmod__`, :meth:`~str.casefold`, :meth:`~str." -"format_map`, :meth:`~str.isprintable`, and :meth:`~str.maketrans` methods to " -"match the corresponding methods of :class:`str`. (Contributed by Joe Jevnik " -"in :issue:`22189`.)" +"The :class:`~collections.UserString` class now implements " +"the :meth:`__getnewargs__`, :meth:`__rmod__`, :meth:`~str.casefold`, :meth:`~str.format_map`, :meth:`~str.isprintable`, " +"and :meth:`~str.maketrans` methods to match the corresponding methods " +"of :class:`str`. (Contributed by Joe Jevnik in :issue:`22189`.)" msgstr "" #: ../../whatsnew/3.5.rst:938 @@ -1471,9 +1470,9 @@ msgstr "collections.abc" #: ../../whatsnew/3.5.rst:940 msgid "" "The :meth:`Sequence.index() <collections.abc.Sequence.index>` method now " -"accepts *start* and *stop* arguments to match the corresponding methods of :" -"class:`tuple`, :class:`list`, etc. (Contributed by Devin Jeanpierre in :" -"issue:`23086`.)" +"accepts *start* and *stop* arguments to match the corresponding methods " +"of :class:`tuple`, :class:`list`, etc. (Contributed by Devin Jeanpierre " +"in :issue:`23086`.)" msgstr "" #: ../../whatsnew/3.5.rst:945 @@ -1484,10 +1483,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:948 msgid "" -"New :class:`~collections.abc.Awaitable`, :class:`~collections.abc." -"Coroutine`, :class:`~collections.abc.AsyncIterator`, and :class:" -"`~collections.abc.AsyncIterable` abstract base classes. (Contributed by Yury " -"Selivanov in :issue:`24184`.)" +"New :class:`~collections.abc.Awaitable`, :class:`~collections.abc.Coroutine`, :class:`~collections.abc.AsyncIterator`, " +"and :class:`~collections.abc.AsyncIterable` abstract base classes. " +"(Contributed by Yury Selivanov in :issue:`24184`.)" msgstr "" #: ../../whatsnew/3.5.rst:953 @@ -1503,8 +1501,8 @@ msgstr "compileall" #: ../../whatsnew/3.5.rst:960 msgid "" "A new :mod:`compileall` option, :samp:`-j {N}`, allows running *N* workers " -"simultaneously to perform parallel bytecode compilation. The :func:" -"`~compileall.compile_dir` function has a corresponding ``workers`` " +"simultaneously to perform parallel bytecode compilation. " +"The :func:`~compileall.compile_dir` function has a corresponding ``workers`` " "parameter. (Contributed by Claudiu Popa in :issue:`16104`.)" msgstr "" @@ -1518,10 +1516,11 @@ msgstr "" msgid "" "The ``-q`` command line option can now be specified more than once, in which " "case all output, including errors, will be suppressed. The corresponding " -"``quiet`` parameter in :func:`~compileall.compile_dir`, :func:`~compileall." -"compile_file`, and :func:`~compileall.compile_path` can now accept an " -"integer value indicating the level of output suppression. (Contributed by " -"Thomas Kluyver in :issue:`21338`.)" +"``quiet`` parameter " +"in :func:`~compileall.compile_dir`, :func:`~compileall.compile_file`, " +"and :func:`~compileall.compile_path` can now accept an integer value " +"indicating the level of output suppression. (Contributed by Thomas Kluyver " +"in :issue:`21338`.)" msgstr "" #: ../../whatsnew/3.5.rst:977 @@ -1550,10 +1549,10 @@ msgstr "configparser" #: ../../whatsnew/3.5.rst:992 msgid "" ":mod:`configparser` now provides a way to customize the conversion of values " -"by specifying a dictionary of converters in the :class:`~configparser." -"ConfigParser` constructor, or by defining them as methods in " -"``ConfigParser`` subclasses. Converters defined in a parser instance are " -"inherited by its section proxies." +"by specifying a dictionary of converters in " +"the :class:`~configparser.ConfigParser` constructor, or by defining them as " +"methods in ``ConfigParser`` subclasses. Converters defined in a parser " +"instance are inherited by its section proxies." msgstr "" #: ../../whatsnew/3.5.rst:998 @@ -1660,8 +1659,8 @@ msgstr "dbm" #: ../../whatsnew/3.5.rst:1056 msgid "" ":func:`dumb.open <dbm.dumb.open>` always creates a new database when the " -"flag has the value ``\"n\"``. (Contributed by Claudiu Popa in :issue:" -"`18039`.)" +"flag has the value ``\"n\"``. (Contributed by Claudiu Popa " +"in :issue:`18039`.)" msgstr "" #: ../../whatsnew/3.5.rst:1061 @@ -1673,8 +1672,8 @@ msgid "" "The charset of HTML documents generated by :meth:`HtmlDiff.make_file() " "<difflib.HtmlDiff.make_file>` can now be customized by using a new *charset* " "keyword-only argument. The default charset of HTML document changed from " -"``\"ISO-8859-1\"`` to ``\"utf-8\"``. (Contributed by Berker Peksag in :issue:" -"`2052`.)" +"``\"ISO-8859-1\"`` to ``\"utf-8\"``. (Contributed by Berker Peksag " +"in :issue:`2052`.)" msgstr "" #: ../../whatsnew/3.5.rst:1070 @@ -1708,9 +1707,10 @@ msgstr "doctest" #: ../../whatsnew/3.5.rst:1090 msgid "" -"The :func:`~doctest.DocTestSuite` function returns an empty :class:`unittest." -"TestSuite` if *module* contains no docstrings, instead of raising :exc:" -"`ValueError`. (Contributed by Glenn Jones in :issue:`15916`.)" +"The :func:`~doctest.DocTestSuite` function returns an " +"empty :class:`unittest.TestSuite` if *module* contains no docstrings, " +"instead of raising :exc:`ValueError`. (Contributed by Glenn Jones " +"in :issue:`15916`.)" msgstr "" #: ../../whatsnew/3.5.rst:1096 @@ -1719,19 +1719,20 @@ msgstr "email" #: ../../whatsnew/3.5.rst:1098 msgid "" -"A new policy option :attr:`Policy.mangle_from_ <email.policy.Policy." -"mangle_from_>` controls whether or not lines that start with ``\"From \"`` " -"in email bodies are prefixed with a ``\">\"`` character by generators. The " -"default is ``True`` for :attr:`~email.policy.compat32` and ``False`` for all " -"other policies. (Contributed by Milan Oberkirch in :issue:`20098`.)" +"A new policy option :attr:`Policy.mangle_from_ " +"<email.policy.Policy.mangle_from_>` controls whether or not lines that start " +"with ``\"From \"`` in email bodies are prefixed with a ``\">\"`` character " +"by generators. The default is ``True`` for :attr:`~email.policy.compat32` " +"and ``False`` for all other policies. (Contributed by Milan Oberkirch " +"in :issue:`20098`.)" msgstr "" #: ../../whatsnew/3.5.rst:1104 msgid "" -"A new :meth:`Message.get_content_disposition() <email.message.Message." -"get_content_disposition>` method provides easy access to a canonical value " -"for the :mailheader:`Content-Disposition` header. (Contributed by Abhilash " -"Raj in :issue:`21083`.)" +"A new :meth:`Message.get_content_disposition() " +"<email.message.Message.get_content_disposition>` method provides easy access " +"to a canonical value for the :mailheader:`Content-Disposition` header. " +"(Contributed by Abhilash Raj in :issue:`21083`.)" msgstr "" #: ../../whatsnew/3.5.rst:1110 @@ -1739,9 +1740,9 @@ msgid "" "A new policy option :attr:`EmailPolicy.utf8 <email.policy.EmailPolicy.utf8>` " "can be set to ``True`` to encode email headers using the UTF-8 charset " "instead of using encoded words. This allows ``Messages`` to be formatted " -"according to :rfc:`6532` and used with an SMTP server that supports the :rfc:" -"`6531` ``SMTPUTF8`` extension. (Contributed by R. David Murray in :issue:" -"`24211`.)" +"according to :rfc:`6532` and used with an SMTP server that supports " +"the :rfc:`6531` ``SMTPUTF8`` extension. (Contributed by R. David Murray " +"in :issue:`24211`.)" msgstr "" #: ../../whatsnew/3.5.rst:1117 @@ -1785,10 +1786,10 @@ msgstr "faulthandler" #: ../../whatsnew/3.5.rst:1140 msgid "" -"The :func:`~faulthandler.enable`, :func:`~faulthandler.register`, :func:" -"`~faulthandler.dump_traceback` and :func:`~faulthandler." -"dump_traceback_later` functions now accept file descriptors in addition to " -"file-like objects. (Contributed by Wei Wu in :issue:`23566`.)" +"The :func:`~faulthandler.enable`, :func:`~faulthandler.register`, :func:`~faulthandler.dump_traceback` " +"and :func:`~faulthandler.dump_traceback_later` functions now accept file " +"descriptors in addition to file-like objects. (Contributed by Wei Wu " +"in :issue:`23566`.)" msgstr "" #: ../../whatsnew/3.5.rst:1148 @@ -1820,8 +1821,8 @@ msgstr "gzip" #: ../../whatsnew/3.5.rst:1168 msgid "" "The *mode* argument of the :class:`~gzip.GzipFile` constructor now accepts " -"``\"x\"`` to request exclusive creation. (Contributed by Tim Heaney in :" -"issue:`19222`.)" +"``\"x\"`` to request exclusive creation. (Contributed by Tim Heaney " +"in :issue:`19222`.)" msgstr "" #: ../../whatsnew/3.5.rst:1174 @@ -1875,10 +1876,11 @@ msgstr "http.client" #: ../../whatsnew/3.5.rst:1203 msgid "" -":meth:`HTTPConnection.getresponse() <http.client.HTTPConnection." -"getresponse>` now raises a :exc:`~http.client.RemoteDisconnected` exception " -"when a remote server connection is closed unexpectedly. Additionally, if a :" -"exc:`ConnectionError` (of which ``RemoteDisconnected`` is a subclass) is " +":meth:`HTTPConnection.getresponse() " +"<http.client.HTTPConnection.getresponse>` now raises " +"a :exc:`~http.client.RemoteDisconnected` exception when a remote server " +"connection is closed unexpectedly. Additionally, if " +"a :exc:`ConnectionError` (of which ``RemoteDisconnected`` is a subclass) is " "raised, the client socket is now closed automatically, and will reconnect on " "the next request::" msgstr "" @@ -1914,10 +1916,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1225 msgid "" "Since idlelib implements the IDLE shell and editor and is not intended for " -"import by other programs, it gets improvements with every release. See :" -"file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since 3.4.0, as " -"well as changes made in future 3.5.x releases. This file is also available " -"from the IDLE :menuselection:`Help --> About IDLE` dialog." +"import by other programs, it gets improvements with every release. " +"See :file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since " +"3.4.0, as well as changes made in future 3.5.x releases. This file is also " +"available from the IDLE :menuselection:`Help --> About IDLE` dialog." msgstr "" #: ../../whatsnew/3.5.rst:1233 @@ -1934,12 +1936,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:1240 msgid "" -"The :mod:`imaplib` module now supports :rfc:`5161` (ENABLE Extension) and :" -"rfc:`6855` (UTF-8 Support) via the :meth:`IMAP4.enable() <imaplib.IMAP4." -"enable>` method. A new :attr:`IMAP4.utf8_enabled <imaplib.IMAP4." -"utf8_enabled>` attribute tracks whether or not :rfc:`6855` support is " -"enabled. (Contributed by Milan Oberkirch, R. David Murray, and Maciej Szulik " -"in :issue:`21800`.)" +"The :mod:`imaplib` module now supports :rfc:`5161` (ENABLE Extension) " +"and :rfc:`6855` (UTF-8 Support) via the :meth:`IMAP4.enable() " +"<imaplib.IMAP4.enable>` method. A new :attr:`IMAP4.utf8_enabled " +"<imaplib.IMAP4.utf8_enabled>` attribute tracks whether or not :rfc:`6855` " +"support is enabled. (Contributed by Milan Oberkirch, R. David Murray, and " +"Maciej Szulik in :issue:`21800`.)" msgstr "" #: ../../whatsnew/3.5.rst:1247 @@ -1955,10 +1957,10 @@ msgstr "imghdr" #: ../../whatsnew/3.5.rst:1255 msgid "" -"The :func:`!what` function now recognizes the `OpenEXR <https://www.openexr." -"com>`_ format (contributed by Martin Vignali and Claudiu Popa in :issue:" -"`20295`), and the `WebP <https://en.wikipedia.org/wiki/WebP>`_ format " -"(contributed by Fabrice Aneche and Claudiu Popa in :issue:`20197`.)" +"The :func:`!what` function now recognizes the `OpenEXR <https://" +"www.openexr.com>`_ format (contributed by Martin Vignali and Claudiu Popa " +"in :issue:`20295`), and the `WebP <https://en.wikipedia.org/wiki/WebP>`_ " +"format (contributed by Fabrice Aneche and Claudiu Popa in :issue:`20197`.)" msgstr "" #: ../../whatsnew/3.5.rst:1263 @@ -1974,11 +1976,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:1269 msgid "" -"The :func:`abc.InspectLoader.source_to_code() <importlib.abc.InspectLoader." -"source_to_code>` method is now a static method. This makes it easier to " -"initialize a module object with code compiled from a string by running " -"``exec(code, module.__dict__)``. (Contributed by Brett Cannon in :issue:" -"`21156`.)" +"The :func:`abc.InspectLoader.source_to_code() " +"<importlib.abc.InspectLoader.source_to_code>` method is now a static " +"method. This makes it easier to initialize a module object with code " +"compiled from a string by running ``exec(code, module.__dict__)``. " +"(Contributed by Brett Cannon in :issue:`21156`.)" msgstr "" #: ../../whatsnew/3.5.rst:1275 @@ -1997,15 +1999,15 @@ msgstr "inspect" #: ../../whatsnew/3.5.rst:1285 msgid "" "Both the :class:`~inspect.Signature` and :class:`~inspect.Parameter` classes " -"are now picklable and hashable. (Contributed by Yury Selivanov in :issue:" -"`20726` and :issue:`20334`.)" +"are now picklable and hashable. (Contributed by Yury Selivanov " +"in :issue:`20726` and :issue:`20334`.)" msgstr "" #: ../../whatsnew/3.5.rst:1289 msgid "" -"A new :meth:`BoundArguments.apply_defaults() <inspect.BoundArguments." -"apply_defaults>` method provides a way to set default values for missing " -"arguments::" +"A new :meth:`BoundArguments.apply_defaults() " +"<inspect.BoundArguments.apply_defaults>` method provides a way to set " +"default values for missing arguments::" msgstr "" #: ../../whatsnew/3.5.rst:1293 @@ -2028,34 +2030,34 @@ msgstr "(由 Yury Selivanov 在 :issue:`24190` 中貢獻。)" #: ../../whatsnew/3.5.rst:1301 msgid "" -"A new class method :meth:`Signature.from_callable() <inspect.Signature." -"from_callable>` makes subclassing of :class:`~inspect.Signature` easier. " -"(Contributed by Yury Selivanov and Eric Snow in :issue:`17373`.)" +"A new class method :meth:`Signature.from_callable() " +"<inspect.Signature.from_callable>` makes subclassing " +"of :class:`~inspect.Signature` easier. (Contributed by Yury Selivanov and " +"Eric Snow in :issue:`17373`.)" msgstr "" #: ../../whatsnew/3.5.rst:1306 msgid "" "The :func:`~inspect.signature` function now accepts a *follow_wrapped* " "optional keyword argument, which, when set to ``False``, disables automatic " -"following of ``__wrapped__`` links. (Contributed by Yury Selivanov in :issue:" -"`20691`.)" +"following of ``__wrapped__`` links. (Contributed by Yury Selivanov " +"in :issue:`20691`.)" msgstr "" #: ../../whatsnew/3.5.rst:1311 msgid "" "A set of new functions to inspect :term:`coroutine functions <coroutine " -"function>` and :term:`coroutine objects <coroutine>` has been added: :func:" -"`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`, :func:" -"`~inspect.isawaitable`, :func:`~inspect.getcoroutinelocals`, and :func:" -"`~inspect.getcoroutinestate`. (Contributed by Yury Selivanov in :issue:" -"`24017` and :issue:`24400`.)" +"function>` and :term:`coroutine objects <coroutine>` has been " +"added: :func:`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`, :func:`~inspect.isawaitable`, :func:`~inspect.getcoroutinelocals`, " +"and :func:`~inspect.getcoroutinestate`. (Contributed by Yury Selivanov " +"in :issue:`24017` and :issue:`24400`.)" msgstr "" #: ../../whatsnew/3.5.rst:1319 msgid "" -"The :func:`~inspect.stack`, :func:`~inspect.trace`, :func:`~inspect." -"getouterframes`, and :func:`~inspect.getinnerframes` functions now return a " -"list of named tuples. (Contributed by Daniel Shahaf in :issue:`16808`.)" +"The :func:`~inspect.stack`, :func:`~inspect.trace`, :func:`~inspect.getouterframes`, " +"and :func:`~inspect.getinnerframes` functions now return a list of named " +"tuples. (Contributed by Daniel Shahaf in :issue:`16808`.)" msgstr "" #: ../../whatsnew/3.5.rst:1326 @@ -2065,10 +2067,10 @@ msgstr "io" #: ../../whatsnew/3.5.rst:1328 msgid "" "A new :meth:`BufferedIOBase.readinto1() <io.BufferedIOBase.readinto1>` " -"method, that uses at most one call to the underlying raw stream's :meth:" -"`RawIOBase.read() <io.RawIOBase.read>` or :meth:`RawIOBase.readinto() <io." -"RawIOBase.readinto>` methods. (Contributed by Nikolaus Rath in :issue:" -"`20578`.)" +"method, that uses at most one call to the underlying raw " +"stream's :meth:`RawIOBase.read() <io.RawIOBase.read>` " +"or :meth:`RawIOBase.readinto() <io.RawIOBase.readinto>` methods. " +"(Contributed by Nikolaus Rath in :issue:`20578`.)" msgstr "" #: ../../whatsnew/3.5.rst:1336 @@ -2102,9 +2104,9 @@ msgstr "(由 Peter Moody 和 Antoine Pitrou 在 :issue:`16531` 中貢獻。) #: ../../whatsnew/3.5.rst:1350 msgid "" -"A new :attr:`~ipaddress.IPv4Network.reverse_pointer` attribute for the :" -"class:`~ipaddress.IPv4Network` and :class:`~ipaddress.IPv6Network` classes " -"returns the name of the reverse DNS PTR record::" +"A new :attr:`~ipaddress.IPv4Network.reverse_pointer` attribute for " +"the :class:`~ipaddress.IPv4Network` and :class:`~ipaddress.IPv6Network` " +"classes returns the name of the reverse DNS PTR record::" msgstr "" #: ../../whatsnew/3.5.rst:1354 @@ -2137,14 +2139,14 @@ msgstr "json" msgid "" "The :mod:`json.tool` command line interface now preserves the order of keys " "in JSON objects passed in input. The new ``--sort-keys`` option can be used " -"to sort the keys alphabetically. (Contributed by Berker Peksag in :issue:" -"`21650`.)" +"to sort the keys alphabetically. (Contributed by Berker Peksag " +"in :issue:`21650`.)" msgstr "" #: ../../whatsnew/3.5.rst:1373 msgid "" -"JSON decoder now raises :exc:`~json.JSONDecodeError` instead of :exc:" -"`ValueError` to provide better context information about the error. " +"JSON decoder now raises :exc:`~json.JSONDecodeError` instead " +"of :exc:`ValueError` to provide better context information about the error. " "(Contributed by Serhiy Storchaka in :issue:`19361`.)" msgstr "" @@ -2204,10 +2206,10 @@ msgstr "logging" #: ../../whatsnew/3.5.rst:1410 msgid "" -"All logging methods (:class:`~logging.Logger` :meth:`~logging.Logger.log`, :" -"meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`, :meth:" -"`~logging.Logger.debug`, etc.), now accept exception instances as an " -"*exc_info* argument, in addition to boolean values and exception tuples::" +"All logging methods " +"(:class:`~logging.Logger` :meth:`~logging.Logger.log`, :meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`, :meth:`~logging.Logger.debug`, " +"etc.), now accept exception instances as an *exc_info* argument, in addition " +"to boolean values and exception tuples::" msgstr "" #: ../../whatsnew/3.5.rst:1416 @@ -2234,8 +2236,8 @@ msgstr "(由 Yury Selivanov 在 :issue:`20537` 中貢獻。)" msgid "" "The :class:`handlers.HTTPHandler <logging.handlers.HTTPHandler>` class now " "accepts an optional :class:`ssl.SSLContext` instance to configure SSL " -"settings used in an HTTP connection. (Contributed by Alex Gaynor in :issue:" -"`22788`.)" +"settings used in an HTTP connection. (Contributed by Alex Gaynor " +"in :issue:`22788`.)" msgstr "" #: ../../whatsnew/3.5.rst:1430 @@ -2263,9 +2265,9 @@ msgstr "math" #: ../../whatsnew/3.5.rst:1448 msgid "" -"Two new constants have been added to the :mod:`math` module: :data:`~math." -"inf` and :data:`~math.nan`. (Contributed by Mark Dickinson in :issue:" -"`23185`.)" +"Two new constants have been added to the :mod:`math` " +"module: :data:`~math.inf` and :data:`~math.nan`. (Contributed by Mark " +"Dickinson in :issue:`23185`.)" msgstr "" #: ../../whatsnew/3.5.rst:1451 @@ -2287,9 +2289,10 @@ msgstr "multiprocessing" #: ../../whatsnew/3.5.rst:1462 msgid "" -":func:`sharedctypes.synchronized() <multiprocessing.sharedctypes." -"synchronized>` objects now support the :term:`context manager` protocol. " -"(Contributed by Charles-François Natali in :issue:`21565`.)" +":func:`sharedctypes.synchronized() " +"<multiprocessing.sharedctypes.synchronized>` objects now support " +"the :term:`context manager` protocol. (Contributed by Charles-François " +"Natali in :issue:`21565`.)" msgstr "" #: ../../whatsnew/3.5.rst:1468 @@ -2298,16 +2301,16 @@ msgstr "operator" #: ../../whatsnew/3.5.rst:1470 msgid "" -":func:`~operator.attrgetter`, :func:`~operator.itemgetter`, and :func:" -"`~operator.methodcaller` objects now support pickling. (Contributed by Josh " -"Rosenberg and Serhiy Storchaka in :issue:`22955`.)" +":func:`~operator.attrgetter`, :func:`~operator.itemgetter`, " +"and :func:`~operator.methodcaller` objects now support pickling. " +"(Contributed by Josh Rosenberg and Serhiy Storchaka in :issue:`22955`.)" msgstr "" #: ../../whatsnew/3.5.rst:1474 msgid "" "New :func:`~operator.matmul` and :func:`~operator.imatmul` functions to " -"perform matrix multiplication. (Contributed by Benjamin Peterson in :issue:" -"`21176`.)" +"perform matrix multiplication. (Contributed by Benjamin Peterson " +"in :issue:`21176`.)" msgstr "" #: ../../whatsnew/3.5.rst:1480 @@ -2316,21 +2319,22 @@ msgstr "os" #: ../../whatsnew/3.5.rst:1482 msgid "" -"The new :func:`~os.scandir` function returning an iterator of :class:`~os." -"DirEntry` objects has been added. If possible, :func:`~os.scandir` extracts " -"file attributes while scanning a directory, removing the need to perform " -"subsequent system calls to determine file type or attributes, which may " -"significantly improve performance. (Contributed by Ben Hoyt with the help " -"of Victor Stinner in :issue:`22524`.)" +"The new :func:`~os.scandir` function returning an iterator " +"of :class:`~os.DirEntry` objects has been added. If " +"possible, :func:`~os.scandir` extracts file attributes while scanning a " +"directory, removing the need to perform subsequent system calls to determine " +"file type or attributes, which may significantly improve performance. " +"(Contributed by Ben Hoyt with the help of Victor Stinner in :issue:`22524`.)" msgstr "" #: ../../whatsnew/3.5.rst:1489 msgid "" -"On Windows, a new :attr:`stat_result.st_file_attributes <os.stat_result." -"st_file_attributes>` attribute is now available. It corresponds to the " -"``dwFileAttributes`` member of the ``BY_HANDLE_FILE_INFORMATION`` structure " -"returned by ``GetFileInformationByHandle()``. (Contributed by Ben Hoyt in :" -"issue:`21719`.)" +"On Windows, a new :attr:`stat_result.st_file_attributes " +"<os.stat_result.st_file_attributes>` attribute is now available. It " +"corresponds to the ``dwFileAttributes`` member of the " +"``BY_HANDLE_FILE_INFORMATION`` structure returned by " +"``GetFileInformationByHandle()``. (Contributed by Ben Hoyt " +"in :issue:`21719`.)" msgstr "" #: ../../whatsnew/3.5.rst:1495 @@ -2344,8 +2348,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:1500 msgid "" "New :func:`~os.get_blocking` and :func:`~os.set_blocking` functions allow " -"getting and setting a file descriptor's blocking mode (:const:`~os." -"O_NONBLOCK`.) (Contributed by Victor Stinner in :issue:`22054`.)" +"getting and setting a file descriptor's blocking mode " +"(:const:`~os.O_NONBLOCK`.) (Contributed by Victor Stinner in :issue:`22054`.)" msgstr "" #: ../../whatsnew/3.5.rst:1504 @@ -2357,8 +2361,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:1507 msgid "" "There is a new :func:`os.path.commonpath` function returning the longest " -"common sub-path of each passed pathname. Unlike the :func:`os.path." -"commonprefix` function, it always returns a valid path::" +"common sub-path of each passed pathname. Unlike " +"the :func:`os.path.commonprefix` function, it always returns a valid path::" msgstr "" #: ../../whatsnew/3.5.rst:1512 @@ -2426,16 +2430,18 @@ msgstr "" msgid "" "A new :meth:`Path.home() <pathlib.Path.home>` class method can be used to " "get a :class:`~pathlib.Path` instance representing the user’s home " -"directory. (Contributed by Victor Salgado and Mayank Tripathi in :issue:" -"`19777`.)" +"directory. (Contributed by Victor Salgado and Mayank Tripathi " +"in :issue:`19777`.)" msgstr "" #: ../../whatsnew/3.5.rst:1549 msgid "" -"New :meth:`Path.write_text() <pathlib.Path.write_text>`, :meth:`Path." -"read_text() <pathlib.Path.read_text>`, :meth:`Path.write_bytes() <pathlib." -"Path.write_bytes>`, :meth:`Path.read_bytes() <pathlib.Path.read_bytes>` " -"methods to simplify read/write operations on files." +"New :meth:`Path.write_text() " +"<pathlib.Path.write_text>`, :meth:`Path.read_text() " +"<pathlib.Path.read_text>`, :meth:`Path.write_bytes() " +"<pathlib.Path.write_bytes>`, :meth:`Path.read_bytes() " +"<pathlib.Path.read_bytes>` methods to simplify read/write operations on " +"files." msgstr "" #: ../../whatsnew/3.5.rst:1555 @@ -2528,10 +2534,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1605 msgid "" -"The :class:`re.error` exceptions have new attributes, :attr:`~re.error." -"msg`, :attr:`~re.error.pattern`, :attr:`~re.error.pos`, :attr:`~re.error." -"lineno`, and :attr:`~re.error.colno`, that provide better context " -"information about the error::" +"The :class:`re.error` exceptions have new " +"attributes, :attr:`~re.error.msg`, :attr:`~re.error.pattern`, :attr:`~re.error.pos`, :attr:`~re.error.lineno`, " +"and :attr:`~re.error.colno`, that provide better context information about " +"the error::" msgstr "" #: ../../whatsnew/3.5.rst:1611 @@ -2631,9 +2637,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:1677 msgid "" -"The :class:`!SMTPServer` class now advertises the ``8BITMIME`` extension (:" -"rfc:`6152`) if *decode_data* has been set ``True``. If the client specifies " -"``BODY=8BITMIME`` on the ``MAIL`` command, it is passed to :meth:`!" +"The :class:`!SMTPServer` class now advertises the ``8BITMIME`` extension " +"(:rfc:`6152`) if *decode_data* has been set ``True``. If the client " +"specifies ``BODY=8BITMIME`` on the ``MAIL`` command, it is passed to :meth:`!" "SMTPServer.process_message` via the *mail_options* keyword. (Contributed by " "Milan Oberkirch and R. David Murray in :issue:`21795`.)" msgstr "" @@ -2670,16 +2676,16 @@ msgstr "" msgid "" "The :meth:`SMTP.set_debuglevel() <smtplib.SMTP.set_debuglevel>` method now " "accepts an additional debuglevel (2), which enables timestamps in debug " -"messages. (Contributed by Gavin Chappell and Maciej Szulik in :issue:" -"`16914`.)" +"messages. (Contributed by Gavin Chappell and Maciej Szulik " +"in :issue:`16914`.)" msgstr "" #: ../../whatsnew/3.5.rst:1708 msgid "" -"Both the :meth:`SMTP.sendmail() <smtplib.SMTP.sendmail>` and :meth:`SMTP." -"send_message() <smtplib.SMTP.send_message>` methods now support :rfc:`6531` " -"(SMTPUTF8). (Contributed by Milan Oberkirch and R. David Murray in :issue:" -"`22027`.)" +"Both the :meth:`SMTP.sendmail() <smtplib.SMTP.sendmail>` " +"and :meth:`SMTP.send_message() <smtplib.SMTP.send_message>` methods now " +"support :rfc:`6531` (SMTPUTF8). (Contributed by Milan Oberkirch and R. David " +"Murray in :issue:`22027`.)" msgstr "" #: ../../whatsnew/3.5.rst:1715 @@ -2688,8 +2694,9 @@ msgstr "sndhdr" #: ../../whatsnew/3.5.rst:1717 msgid "" -"The :func:`!what` and :func:`!whathdr` functions now return a :func:" -"`~collections.namedtuple`. (Contributed by Claudiu Popa in :issue:`18615`.)" +"The :func:`!what` and :func:`!whathdr` functions now return " +"a :func:`~collections.namedtuple`. (Contributed by Claudiu Popa " +"in :issue:`18615`.)" msgstr "" #: ../../whatsnew/3.5.rst:1723 @@ -2705,10 +2712,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1728 msgid "" "A new :meth:`socket.sendfile() <socket.socket.sendfile>` method allows " -"sending a file over a socket by using the high-performance :func:`os." -"sendfile` function on UNIX, resulting in uploads being from 2 to 3 times " -"faster than when using plain :meth:`socket.send() <socket.socket.send>`. " -"(Contributed by Giampaolo Rodola' in :issue:`17552`.)" +"sending a file over a socket by using the high-" +"performance :func:`os.sendfile` function on UNIX, resulting in uploads being " +"from 2 to 3 times faster than when using plain :meth:`socket.send() " +"<socket.socket.send>`. (Contributed by Giampaolo Rodola' in :issue:`17552`.)" msgstr "" #: ../../whatsnew/3.5.rst:1734 @@ -2722,9 +2729,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:1739 msgid "" "The *backlog* argument of the :meth:`socket.listen() <socket.socket.listen>` " -"method is now optional. By default it is set to :data:`SOMAXCONN <socket." -"SOMAXCONN>` or to ``128``, whichever is less. (Contributed by Charles-" -"François Natali in :issue:`21455`.)" +"method is now optional. By default it is set to :data:`SOMAXCONN " +"<socket.SOMAXCONN>` or to ``128``, whichever is less. (Contributed by " +"Charles-François Natali in :issue:`21455`.)" msgstr "" #: ../../whatsnew/3.5.rst:1746 @@ -2742,11 +2749,12 @@ msgstr "(由 Geert Jansen 在 :issue:`21965` 中貢獻。)" #: ../../whatsnew/3.5.rst:1755 msgid "" "The new :class:`~ssl.SSLObject` class has been added to provide SSL protocol " -"support for cases when the network I/O capabilities of :class:`~ssl." -"SSLSocket` are not necessary or are suboptimal. ``SSLObject`` represents an " -"SSL protocol instance, but does not implement any network I/O methods, and " -"instead provides a memory buffer interface. The new :class:`~ssl.MemoryBIO` " -"class can be used to pass data between Python and an SSL protocol instance." +"support for cases when the network I/O capabilities " +"of :class:`~ssl.SSLSocket` are not necessary or are suboptimal. " +"``SSLObject`` represents an SSL protocol instance, but does not implement " +"any network I/O methods, and instead provides a memory buffer interface. " +"The new :class:`~ssl.MemoryBIO` class can be used to pass data between " +"Python and an SSL protocol instance." msgstr "" #: ../../whatsnew/3.5.rst:1762 @@ -2773,23 +2781,23 @@ msgstr "(由 Benjamin Peterson 在 :issue:`20188` 中貢獻。)" #: ../../whatsnew/3.5.rst:1775 msgid "" "Where OpenSSL support is present, the :mod:`ssl` module now implements the " -"*Application-Layer Protocol Negotiation* TLS extension as described in :rfc:" -"`7301`." +"*Application-Layer Protocol Negotiation* TLS extension as described " +"in :rfc:`7301`." msgstr "" #: ../../whatsnew/3.5.rst:1779 msgid "" -"The new :meth:`SSLContext.set_alpn_protocols() <ssl.SSLContext." -"set_alpn_protocols>` can be used to specify which protocols a socket should " -"advertise during the TLS handshake." +"The new :meth:`SSLContext.set_alpn_protocols() " +"<ssl.SSLContext.set_alpn_protocols>` can be used to specify which protocols " +"a socket should advertise during the TLS handshake." msgstr "" #: ../../whatsnew/3.5.rst:1783 msgid "" -"The new :meth:`SSLSocket.selected_alpn_protocol() <ssl.SSLSocket." -"selected_alpn_protocol>` returns the protocol that was selected during the " -"TLS handshake. The :const:`~ssl.HAS_ALPN` flag indicates whether ALPN " -"support is present." +"The new :meth:`SSLSocket.selected_alpn_protocol() " +"<ssl.SSLSocket.selected_alpn_protocol>` returns the protocol that was " +"selected during the TLS handshake. The :const:`~ssl.HAS_ALPN` flag indicates " +"whether ALPN support is present." msgstr "" #: ../../whatsnew/3.5.rst:1790 @@ -2799,15 +2807,15 @@ msgstr "" #: ../../whatsnew/3.5.rst:1792 msgid "" "There is a new :meth:`SSLSocket.version() <ssl.SSLSocket.version>` method to " -"query the actual protocol version in use. (Contributed by Antoine Pitrou in :" -"issue:`20421`.)" +"query the actual protocol version in use. (Contributed by Antoine Pitrou " +"in :issue:`20421`.)" msgstr "" #: ../../whatsnew/3.5.rst:1796 msgid "" -"The :class:`~ssl.SSLSocket` class now implements a :meth:`SSLSocket." -"sendfile() <ssl.SSLSocket.sendfile>` method. (Contributed by Giampaolo " -"Rodola' in :issue:`17552`.)" +"The :class:`~ssl.SSLSocket` class now implements " +"a :meth:`SSLSocket.sendfile() <ssl.SSLSocket.sendfile>` method. (Contributed " +"by Giampaolo Rodola' in :issue:`17552`.)" msgstr "" #: ../../whatsnew/3.5.rst:1800 @@ -2827,21 +2835,22 @@ msgstr "" #: ../../whatsnew/3.5.rst:1809 msgid "" -"New :meth:`SSLObject.shared_ciphers() <ssl.SSLObject.shared_ciphers>` and :" -"meth:`SSLSocket.shared_ciphers() <ssl.SSLSocket.shared_ciphers>` methods " -"return the list of ciphers sent by the client during the handshake. " +"New :meth:`SSLObject.shared_ciphers() <ssl.SSLObject.shared_ciphers>` " +"and :meth:`SSLSocket.shared_ciphers() <ssl.SSLSocket.shared_ciphers>` " +"methods return the list of ciphers sent by the client during the handshake. " "(Contributed by Benjamin Peterson in :issue:`23186`.)" msgstr "" #: ../../whatsnew/3.5.rst:1814 msgid "" -"The :meth:`SSLSocket.do_handshake() <ssl.SSLSocket.do_handshake>`, :meth:" -"`SSLSocket.read() <ssl.SSLSocket.read>`, :meth:`SSLSocket.shutdown() <ssl." -"SSLSocket.shutdown>`, and :meth:`SSLSocket.write() <ssl.SSLSocket.write>` " -"methods of the :class:`~ssl.SSLSocket` class no longer reset the socket " -"timeout every time bytes are received or sent. The socket timeout is now the " -"maximum total duration of the method. (Contributed by Victor Stinner in :" -"issue:`23853`.)" +"The :meth:`SSLSocket.do_handshake() " +"<ssl.SSLSocket.do_handshake>`, :meth:`SSLSocket.read() " +"<ssl.SSLSocket.read>`, :meth:`SSLSocket.shutdown() " +"<ssl.SSLSocket.shutdown>`, and :meth:`SSLSocket.write() " +"<ssl.SSLSocket.write>` methods of the :class:`~ssl.SSLSocket` class no " +"longer reset the socket timeout every time bytes are received or sent. The " +"socket timeout is now the maximum total duration of the method. (Contributed " +"by Victor Stinner in :issue:`23853`.)" msgstr "" #: ../../whatsnew/3.5.rst:1822 @@ -2912,10 +2921,11 @@ msgstr "sys" msgid "" "A new :func:`~sys.set_coroutine_wrapper` function allows setting a global " "hook that will be called whenever a :term:`coroutine object <coroutine>` is " -"created by an :keyword:`async def` function. A corresponding :func:`~sys." -"get_coroutine_wrapper` can be used to obtain a currently set wrapper. Both " -"functions are :term:`provisional <provisional API>`, and are intended for " -"debugging purposes only. (Contributed by Yury Selivanov in :issue:`24017`.)" +"created by an :keyword:`async def` function. A " +"corresponding :func:`~sys.get_coroutine_wrapper` can be used to obtain a " +"currently set wrapper. Both functions are :term:`provisional <provisional " +"API>`, and are intended for debugging purposes only. (Contributed by Yury " +"Selivanov in :issue:`24017`.)" msgstr "" #: ../../whatsnew/3.5.rst:1874 @@ -2932,8 +2942,8 @@ msgstr "sysconfig" #: ../../whatsnew/3.5.rst:1882 msgid "" "The name of the user scripts directory on Windows now includes the first two " -"components of the Python version. (Contributed by Paul Moore in :issue:" -"`23437`.)" +"components of the Python version. (Contributed by Paul Moore " +"in :issue:`23437`.)" msgstr "" #: ../../whatsnew/3.5.rst:1888 @@ -2943,16 +2953,16 @@ msgstr "tarfile" #: ../../whatsnew/3.5.rst:1890 msgid "" "The *mode* argument of the :func:`~tarfile.open` function now accepts " -"``\"x\"`` to request exclusive creation. (Contributed by Berker Peksag in :" -"issue:`21717`.)" +"``\"x\"`` to request exclusive creation. (Contributed by Berker Peksag " +"in :issue:`21717`.)" msgstr "" #: ../../whatsnew/3.5.rst:1893 msgid "" -"The :meth:`TarFile.extractall() <tarfile.TarFile.extractall>` and :meth:" -"`TarFile.extract() <tarfile.TarFile.extract>` methods now take a keyword " -"argument *numeric_owner*. If set to ``True``, the extracted files and " -"directories will be owned by the numeric ``uid`` and ``gid`` from the " +"The :meth:`TarFile.extractall() <tarfile.TarFile.extractall>` " +"and :meth:`TarFile.extract() <tarfile.TarFile.extract>` methods now take a " +"keyword argument *numeric_owner*. If set to ``True``, the extracted files " +"and directories will be owned by the numeric ``uid`` and ``gid`` from the " "tarfile. If set to ``False`` (the default, and the behavior in versions " "prior to 3.5), they will be owned by the named user and group in the " "tarfile. (Contributed by Michael Vogt and Eric Smith in :issue:`23193`.)" @@ -2972,9 +2982,10 @@ msgstr "threading" #: ../../whatsnew/3.5.rst:1910 msgid "" -"Both the :meth:`Lock.acquire() <threading.Lock.acquire>` and :meth:`RLock." -"acquire() <threading.RLock.acquire>` methods now use a monotonic clock for " -"timeout management. (Contributed by Victor Stinner in :issue:`22043`.)" +"Both the :meth:`Lock.acquire() <threading.Lock.acquire>` " +"and :meth:`RLock.acquire() <threading.RLock.acquire>` methods now use a " +"monotonic clock for timeout management. (Contributed by Victor Stinner " +"in :issue:`22043`.)" msgstr "" #: ../../whatsnew/3.5.rst:1917 @@ -3030,9 +3041,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1954 msgid "" -"New lightweight classes: :class:`~traceback.TracebackException`, :class:" -"`~traceback.StackSummary`, and :class:`~traceback.FrameSummary`. " -"(Contributed by Robert Collins in :issue:`17911`.)" +"New lightweight " +"classes: :class:`~traceback.TracebackException`, :class:`~traceback.StackSummary`, " +"and :class:`~traceback.FrameSummary`. (Contributed by Robert Collins " +"in :issue:`17911`.)" msgstr "" #: ../../whatsnew/3.5.rst:1958 @@ -3049,16 +3061,16 @@ msgstr "types" #: ../../whatsnew/3.5.rst:1966 msgid "" "A new :func:`~types.coroutine` function to transform :term:`generator " -"<generator iterator>` and :class:`generator-like <collections.abc." -"Generator>` objects into :term:`awaitables <awaitable>`. (Contributed by " -"Yury Selivanov in :issue:`24017`.)" +"<generator iterator>` and :class:`generator-like " +"<collections.abc.Generator>` objects into :term:`awaitables <awaitable>`. " +"(Contributed by Yury Selivanov in :issue:`24017`.)" msgstr "" #: ../../whatsnew/3.5.rst:1972 msgid "" -"A new type called :class:`~types.CoroutineType`, which is used for :term:" -"`coroutine` objects created by :keyword:`async def` functions. (Contributed " -"by Yury Selivanov in :issue:`24400`.)" +"A new type called :class:`~types.CoroutineType`, which is used " +"for :term:`coroutine` objects created by :keyword:`async def` functions. " +"(Contributed by Yury Selivanov in :issue:`24400`.)" msgstr "" #: ../../whatsnew/3.5.rst:1978 @@ -3077,13 +3089,13 @@ msgstr "unittest" #: ../../whatsnew/3.5.rst:1987 msgid "" -"The :meth:`TestLoader.loadTestsFromModule() <unittest.TestLoader." -"loadTestsFromModule>` method now accepts a keyword-only argument *pattern* " -"which is passed to ``load_tests`` as the third argument. Found packages are " -"now checked for ``load_tests`` regardless of whether their path matches " -"*pattern*, because it is impossible for a package name to match the default " -"pattern. (Contributed by Robert Collins and Barry A. Warsaw in :issue:" -"`16662`.)" +"The :meth:`TestLoader.loadTestsFromModule() " +"<unittest.TestLoader.loadTestsFromModule>` method now accepts a keyword-only " +"argument *pattern* which is passed to ``load_tests`` as the third argument. " +"Found packages are now checked for ``load_tests`` regardless of whether " +"their path matches *pattern*, because it is impossible for a package name to " +"match the default pattern. (Contributed by Robert Collins and Barry A. " +"Warsaw in :issue:`16662`.)" msgstr "" #: ../../whatsnew/3.5.rst:1994 @@ -3116,24 +3128,24 @@ msgstr "" #: ../../whatsnew/3.5.rst:2013 msgid "" -"A new :meth:`Mock.assert_not_called() <unittest.mock.Mock." -"assert_not_called>` method to check if the mock object was called. " -"(Contributed by Kushal Das in :issue:`21262`.)" +"A new :meth:`Mock.assert_not_called() " +"<unittest.mock.Mock.assert_not_called>` method to check if the mock object " +"was called. (Contributed by Kushal Das in :issue:`21262`.)" msgstr "" #: ../../whatsnew/3.5.rst:2017 msgid "" -"The :class:`~unittest.mock.MagicMock` class now supports :meth:" -"`__truediv__`, :meth:`__divmod__` and :meth:`__matmul__` operators. " -"(Contributed by Johannes Baiter in :issue:`20968`, and Håkan Lövdahl in :" -"issue:`23581` and :issue:`23568`.)" +"The :class:`~unittest.mock.MagicMock` class now " +"supports :meth:`__truediv__`, :meth:`__divmod__` and :meth:`__matmul__` " +"operators. (Contributed by Johannes Baiter in :issue:`20968`, and Håkan " +"Lövdahl in :issue:`23581` and :issue:`23568`.)" msgstr "" #: ../../whatsnew/3.5.rst:2022 msgid "" -"It is no longer necessary to explicitly pass ``create=True`` to the :func:" -"`~unittest.mock.patch` function when patching builtin names. (Contributed by " -"Kushal Das in :issue:`17660`.)" +"It is no longer necessary to explicitly pass ``create=True`` to " +"the :func:`~unittest.mock.patch` function when patching builtin names. " +"(Contributed by Kushal Das in :issue:`17660`.)" msgstr "" #: ../../whatsnew/3.5.rst:2028 @@ -3142,35 +3154,38 @@ msgstr "urllib" #: ../../whatsnew/3.5.rst:2030 msgid "" -"A new :class:`request.HTTPPasswordMgrWithPriorAuth <urllib.request." -"HTTPPasswordMgrWithPriorAuth>` class allows HTTP Basic Authentication " -"credentials to be managed so as to eliminate unnecessary ``401`` response " -"handling, or to unconditionally send credentials on the first request in " -"order to communicate with servers that return a ``404`` response instead of " -"a ``401`` if the ``Authorization`` header is not sent. (Contributed by Matej " -"Cepl in :issue:`19494` and Akshit Khurana in :issue:`7159`.)" +"A new :class:`request.HTTPPasswordMgrWithPriorAuth " +"<urllib.request.HTTPPasswordMgrWithPriorAuth>` class allows HTTP Basic " +"Authentication credentials to be managed so as to eliminate unnecessary " +"``401`` response handling, or to unconditionally send credentials on the " +"first request in order to communicate with servers that return a ``404`` " +"response instead of a ``401`` if the ``Authorization`` header is not sent. " +"(Contributed by Matej Cepl in :issue:`19494` and Akshit Khurana " +"in :issue:`7159`.)" msgstr "" #: ../../whatsnew/3.5.rst:2039 msgid "" -"A new *quote_via* argument for the :func:`parse.urlencode() <urllib.parse." -"urlencode>` function provides a way to control the encoding of query parts " -"if needed. (Contributed by Samwyse and Arnon Yaari in :issue:`13866`.)" +"A new *quote_via* argument for the :func:`parse.urlencode() " +"<urllib.parse.urlencode>` function provides a way to control the encoding of " +"query parts if needed. (Contributed by Samwyse and Arnon Yaari " +"in :issue:`13866`.)" msgstr "" #: ../../whatsnew/3.5.rst:2044 msgid "" -"The :func:`request.urlopen() <urllib.request.urlopen>` function accepts an :" -"class:`ssl.SSLContext` object as a *context* argument, which will be used " -"for the HTTPS connection. (Contributed by Alex Gaynor in :issue:`22366`.)" +"The :func:`request.urlopen() <urllib.request.urlopen>` function accepts " +"an :class:`ssl.SSLContext` object as a *context* argument, which will be " +"used for the HTTPS connection. (Contributed by Alex Gaynor " +"in :issue:`22366`.)" msgstr "" #: ../../whatsnew/3.5.rst:2048 msgid "" -"The :func:`parse.urljoin() <urllib.parse.urljoin>` was updated to use the :" -"rfc:`3986` semantics for the resolution of relative URLs, rather than :rfc:" -"`1808` and :rfc:`2396`. (Contributed by Demian Brecht and Senthil Kumaran " -"in :issue:`22118`.)" +"The :func:`parse.urljoin() <urllib.parse.urljoin>` was updated to use " +"the :rfc:`3986` semantics for the resolution of relative URLs, rather " +"than :rfc:`1808` and :rfc:`2396`. (Contributed by Demian Brecht and Senthil " +"Kumaran in :issue:`22118`.)" msgstr "" #: ../../whatsnew/3.5.rst:2055 @@ -3179,9 +3194,9 @@ msgstr "wsgiref" #: ../../whatsnew/3.5.rst:2057 msgid "" -"The *headers* argument of the :class:`headers.Headers <wsgiref.headers." -"Headers>` class constructor is now optional. (Contributed by Pablo Torres " -"Navarrete and SilentGhost in :issue:`5800`.)" +"The *headers* argument of the :class:`headers.Headers " +"<wsgiref.headers.Headers>` class constructor is now optional. (Contributed " +"by Pablo Torres Navarrete and SilentGhost in :issue:`5800`.)" msgstr "" #: ../../whatsnew/3.5.rst:2063 @@ -3208,9 +3223,9 @@ msgstr "xml.sax" #: ../../whatsnew/3.5.rst:2077 msgid "" -"SAX parsers now support a character stream of the :class:`xmlreader." -"InputSource <xml.sax.xmlreader.InputSource>` object. (Contributed by Serhiy " -"Storchaka in :issue:`2175`.)" +"SAX parsers now support a character stream of " +"the :class:`xmlreader.InputSource <xml.sax.xmlreader.InputSource>` object. " +"(Contributed by Serhiy Storchaka in :issue:`2175`.)" msgstr "" #: ../../whatsnew/3.5.rst:2081 @@ -3242,10 +3257,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:2099 msgid "" -"Many functions in the :mod:`mmap`, :mod:`!ossaudiodev`, :mod:`socket`, :mod:" -"`ssl`, and :mod:`codecs` modules now accept writable :term:`bytes-like " -"objects <bytes-like object>`. (Contributed by Serhiy Storchaka in :issue:" -"`23001`.)" +"Many functions in the :mod:`mmap`, :mod:`!" +"ossaudiodev`, :mod:`socket`, :mod:`ssl`, and :mod:`codecs` modules now " +"accept writable :term:`bytes-like objects <bytes-like object>`. (Contributed " +"by Serhiy Storchaka in :issue:`23001`.)" msgstr "" #: ../../whatsnew/3.5.rst:2106 @@ -3255,9 +3270,9 @@ msgstr "最佳化" #: ../../whatsnew/3.5.rst:2108 msgid "" "The :func:`os.walk` function has been sped up by 3 to 5 times on POSIX " -"systems, and by 7 to 20 times on Windows. This was done using the new :func:" -"`os.scandir` function, which exposes file information from the underlying " -"``readdir`` or ``FindFirstFile``/``FindNextFile`` system calls. " +"systems, and by 7 to 20 times on Windows. This was done using the " +"new :func:`os.scandir` function, which exposes file information from the " +"underlying ``readdir`` or ``FindFirstFile``/``FindNextFile`` system calls. " "(Contributed by Ben Hoyt with help from Victor Stinner in :issue:`23605`.)" msgstr "" @@ -3265,19 +3280,18 @@ msgstr "" msgid "" "Construction of ``bytes(int)`` (filled by zero bytes) is faster and uses " "less memory for large objects. ``calloc()`` is used instead of ``malloc()`` " -"to allocate memory for these objects. (Contributed by Victor Stinner in :" -"issue:`21233`.)" +"to allocate memory for these objects. (Contributed by Victor Stinner " +"in :issue:`21233`.)" msgstr "" #: ../../whatsnew/3.5.rst:2119 msgid "" -"Some operations on :mod:`ipaddress` :class:`~ipaddress.IPv4Network` and :" -"class:`~ipaddress.IPv6Network` have been massively sped up, such as :meth:" -"`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`, :" -"func:`~ipaddress.summarize_address_range`, :func:`~ipaddress." -"collapse_addresses`. The speed up can range from 3 to 15 times. (Contributed " -"by Antoine Pitrou, Michel Albert, and Markus in :issue:`21486`, :issue:" -"`21487`, :issue:`20826`, :issue:`23266`.)" +"Some operations on :mod:`ipaddress` :class:`~ipaddress.IPv4Network` " +"and :class:`~ipaddress.IPv6Network` have been massively sped up, such " +"as :meth:`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`, :func:`~ipaddress.summarize_address_range`, :func:`~ipaddress.collapse_addresses`. " +"The speed up can range from 3 to 15 times. (Contributed by Antoine Pitrou, " +"Michel Albert, and Markus " +"in :issue:`21486`, :issue:`21487`, :issue:`20826`, :issue:`23266`.)" msgstr "" #: ../../whatsnew/3.5.rst:2127 @@ -3289,16 +3303,16 @@ msgstr "" #: ../../whatsnew/3.5.rst:2130 msgid "" "Many operations on :class:`io.BytesIO` are now 50% to 100% faster. " -"(Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson in :" -"issue:`22003`.)" +"(Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson " +"in :issue:`22003`.)" msgstr "" #: ../../whatsnew/3.5.rst:2134 msgid "" "The :func:`marshal.dumps` function is now faster: 65--85% with versions 3 " "and 4, 20--25% with versions 0 to 2 on typical data, and up to 5 times in " -"best cases. (Contributed by Serhiy Storchaka in :issue:`20416` and :issue:" -"`23344`.)" +"best cases. (Contributed by Serhiy Storchaka in :issue:`20416` " +"and :issue:`23344`.)" msgstr "" #: ../../whatsnew/3.5.rst:2139 @@ -3323,16 +3337,16 @@ msgstr "" #: ../../whatsnew/3.5.rst:2149 msgid "" "The :c:func:`PyObject_IsInstance` and :c:func:`PyObject_IsSubclass` " -"functions have been sped up in the common case that the second argument has :" -"class:`type` as its metaclass. (Contributed Georg Brandl by in :issue:" -"`22540`.)" +"functions have been sped up in the common case that the second argument " +"has :class:`type` as its metaclass. (Contributed Georg Brandl by " +"in :issue:`22540`.)" msgstr "" #: ../../whatsnew/3.5.rst:2154 msgid "" "Method caching was slightly improved, yielding up to 5% performance " -"improvement in some benchmarks. (Contributed by Antoine Pitrou in :issue:" -"`22847`.)" +"improvement in some benchmarks. (Contributed by Antoine Pitrou " +"in :issue:`22847`.)" msgstr "" #: ../../whatsnew/3.5.rst:2158 @@ -3355,15 +3369,16 @@ msgstr "" #: ../../whatsnew/3.5.rst:2167 msgid "" -"String methods :meth:`~str.find`, :meth:`~str.rfind`, :meth:`~str.split`, :" -"meth:`~str.partition` and the :keyword:`in` string operator are now " -"significantly faster for searching 1-character substrings. (Contributed by " -"Serhiy Storchaka in :issue:`23573`.)" +"String " +"methods :meth:`~str.find`, :meth:`~str.rfind`, :meth:`~str.split`, :meth:`~str.partition` " +"and the :keyword:`in` string operator are now significantly faster for " +"searching 1-character substrings. (Contributed by Serhiy Storchaka " +"in :issue:`23573`.)" msgstr "" #: ../../whatsnew/3.5.rst:2174 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.5.rst:2176 msgid "New ``calloc`` functions were added:" @@ -3391,11 +3406,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:2186 msgid ":c:func:`Py_DecodeLocale` (replaced ``_Py_char2wchar()``)," -msgstr "" +msgstr ":c:func:`Py_DecodeLocale`\\ (取代 ``_Py_char2wchar()``)," #: ../../whatsnew/3.5.rst:2187 msgid ":c:func:`Py_EncodeLocale` (replaced ``_Py_wchar2char()``)." -msgstr "" +msgstr ":c:func:`Py_EncodeLocale`\\ (取代 ``_Py_wchar2char()``)。" #: ../../whatsnew/3.5.rst:2189 msgid "(Contributed by Victor Stinner in :issue:`18395`.)" @@ -3404,15 +3419,15 @@ msgstr "(由 Victor Stinner 在 :issue:`18395` 中貢獻。)" #: ../../whatsnew/3.5.rst:2191 msgid "" "A new :c:func:`PyCodec_NameReplaceErrors` function to replace the unicode " -"encode error with ``\\N{...}`` escapes. (Contributed by Serhiy Storchaka in :" -"issue:`19676`.)" +"encode error with ``\\N{...}`` escapes. (Contributed by Serhiy Storchaka " +"in :issue:`19676`.)" msgstr "" #: ../../whatsnew/3.5.rst:2195 msgid "" "A new :c:func:`PyErr_FormatV` function similar to :c:func:`PyErr_Format`, " -"but accepts a :c:type:`va_list` argument. (Contributed by Antoine Pitrou in :" -"issue:`18711`.)" +"but accepts a :c:type:`va_list` argument. (Contributed by Antoine Pitrou " +"in :issue:`18711`.)" msgstr "" #: ../../whatsnew/3.5.rst:2199 @@ -3425,16 +3440,16 @@ msgstr "" msgid "" "New :c:func:`PyModule_FromDefAndSpec`, :c:func:`PyModule_FromDefAndSpec2`, " "and :c:func:`PyModule_ExecDef` functions introduced by :pep:`489` -- multi-" -"phase extension module initialization. (Contributed by Petr Viktorin in :" -"issue:`24268`.)" +"phase extension module initialization. (Contributed by Petr Viktorin " +"in :issue:`24268`.)" msgstr "" #: ../../whatsnew/3.5.rst:2207 msgid "" -"New :c:func:`PyNumber_MatrixMultiply` and :c:func:" -"`PyNumber_InPlaceMatrixMultiply` functions to perform matrix multiplication. " -"(Contributed by Benjamin Peterson in :issue:`21176`. See also :pep:`465` " -"for details.)" +"New :c:func:`PyNumber_MatrixMultiply` " +"and :c:func:`PyNumber_InPlaceMatrixMultiply` functions to perform matrix " +"multiplication. (Contributed by Benjamin Peterson in :issue:`21176`. See " +"also :pep:`465` for details.)" msgstr "" #: ../../whatsnew/3.5.rst:2213 @@ -3542,8 +3557,8 @@ msgstr "" msgid "" "Raising the :exc:`StopIteration` exception inside a generator will now " "generate a silent :exc:`PendingDeprecationWarning`, which will become a non-" -"silent deprecation warning in Python 3.6 and will trigger a :exc:" -"`RuntimeError` in Python 3.7. See :ref:`PEP 479: Change StopIteration " +"silent deprecation warning in Python 3.6 and will trigger " +"a :exc:`RuntimeError` in Python 3.7. See :ref:`PEP 479: Change StopIteration " "handling inside generators <whatsnew-pep-479>` for details." msgstr "" @@ -3569,8 +3584,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:2296 msgid "" -"The :func:`asyncio.async` function is deprecated in favor of :func:`~asyncio." -"ensure_future`." +"The :func:`asyncio.async` function is deprecated in favor " +"of :func:`~asyncio.ensure_future`." msgstr "" #: ../../whatsnew/3.5.rst:2299 @@ -3584,19 +3599,20 @@ msgstr "" #: ../../whatsnew/3.5.rst:2305 msgid "" -"Directly assigning values to the :attr:`~http.cookies.Morsel.key`, :attr:" -"`~http.cookies.Morsel.value` and :attr:`~http.cookies.Morsel.coded_value` " -"of :class:`http.cookies.Morsel` objects is deprecated. Use the :meth:`~http." -"cookies.Morsel.set` method instead. In addition, the undocumented " -"*LegalChars* parameter of :meth:`~http.cookies.Morsel.set` is deprecated, " -"and is now ignored." +"Directly assigning values to " +"the :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel.value` " +"and :attr:`~http.cookies.Morsel.coded_value` of :class:`http.cookies.Morsel` " +"objects is deprecated. Use the :meth:`~http.cookies.Morsel.set` method " +"instead. In addition, the undocumented *LegalChars* parameter " +"of :meth:`~http.cookies.Morsel.set` is deprecated, and is now ignored." msgstr "" #: ../../whatsnew/3.5.rst:2312 msgid "" -"Passing a format string as keyword argument *format_string* to the :meth:" -"`~string.Formatter.format` method of the :class:`string.Formatter` class has " -"been deprecated. (Contributed by Serhiy Storchaka in :issue:`23671`.)" +"Passing a format string as keyword argument *format_string* to " +"the :meth:`~string.Formatter.format` method of the :class:`string.Formatter` " +"class has been deprecated. (Contributed by Serhiy Storchaka " +"in :issue:`23671`.)" msgstr "" #: ../../whatsnew/3.5.rst:2317 @@ -3610,9 +3626,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:2322 msgid "" "The previously undocumented ``from_function`` and ``from_builtin`` methods " -"of :class:`inspect.Signature` are deprecated. Use the new :meth:`Signature." -"from_callable() <inspect.Signature.from_callable>` method instead. " -"(Contributed by Yury Selivanov in :issue:`24248`.)" +"of :class:`inspect.Signature` are deprecated. Use the " +"new :meth:`Signature.from_callable() <inspect.Signature.from_callable>` " +"method instead. (Contributed by Yury Selivanov in :issue:`24248`.)" msgstr "" #: ../../whatsnew/3.5.rst:2327 @@ -3623,9 +3639,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:2330 msgid "" -"The :mod:`inspect` :func:`~inspect.getfullargspec`, :func:`~inspect." -"getcallargs`, and :func:`~inspect.formatargspec` functions are deprecated in " -"favor of the :func:`inspect.signature` API. (Contributed by Yury Selivanov " +"The :mod:`inspect` :func:`~inspect.getfullargspec`, :func:`~inspect.getcallargs`, " +"and :func:`~inspect.formatargspec` functions are deprecated in favor of " +"the :func:`inspect.signature` API. (Contributed by Yury Selivanov " "in :issue:`20438`.)" msgstr "" @@ -3651,10 +3667,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:2346 msgid "" -"The undocumented and unofficial *use_load_tests* default argument of the :" -"meth:`unittest.TestLoader.loadTestsFromModule` method now is deprecated and " -"ignored. (Contributed by Robert Collins and Barry A. Warsaw in :issue:" -"`16662`.)" +"The undocumented and unofficial *use_load_tests* default argument of " +"the :meth:`unittest.TestLoader.loadTestsFromModule` method now is deprecated " +"and ignored. (Contributed by Robert Collins and Barry A. Warsaw " +"in :issue:`16662`.)" msgstr "" #: ../../whatsnew/3.5.rst:2353 @@ -3663,7 +3679,7 @@ msgstr "已移除" #: ../../whatsnew/3.5.rst:2356 msgid "API and Feature Removals" -msgstr "" +msgstr "API 與功能的移除" #: ../../whatsnew/3.5.rst:2358 msgid "" @@ -3707,7 +3723,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:2384 msgid "Changes in Python behavior" -msgstr "" +msgstr "Python 行為的改變" #: ../../whatsnew/3.5.rst:2386 msgid "" @@ -3731,7 +3747,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:2397 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.5.rst:2399 msgid "" @@ -3744,16 +3760,16 @@ msgstr "" msgid "" "Before Python 3.5, a :class:`datetime.time` object was considered to be " "false if it represented midnight in UTC. This behavior was considered " -"obscure and error-prone and has been removed in Python 3.5. See :issue:" -"`13936` for full details." +"obscure and error-prone and has been removed in Python 3.5. " +"See :issue:`13936` for full details." msgstr "" #: ../../whatsnew/3.5.rst:2408 msgid "" -"The :meth:`ssl.SSLSocket.send` method now raises either :exc:`ssl." -"SSLWantReadError` or :exc:`ssl.SSLWantWriteError` on a non-blocking socket " -"if the operation would block. Previously, it would return ``0``. " -"(Contributed by Nikolaus Rath in :issue:`20951`.)" +"The :meth:`ssl.SSLSocket.send` method now raises " +"either :exc:`ssl.SSLWantReadError` or :exc:`ssl.SSLWantWriteError` on a non-" +"blocking socket if the operation would block. Previously, it would return " +"``0``. (Contributed by Nikolaus Rath in :issue:`20951`.)" msgstr "" #: ../../whatsnew/3.5.rst:2413 @@ -3767,12 +3783,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:2420 msgid "" -"The deprecated \"strict\" mode and argument of :class:`~html.parser." -"HTMLParser`, :meth:`!HTMLParser.error`, and the :exc:`!HTMLParserError` " -"exception have been removed. (Contributed by Ezio Melotti in :issue:" -"`15114`.) The *convert_charrefs* argument of :class:`~html.parser." -"HTMLParser` is now ``True`` by default. (Contributed by Berker Peksag in :" -"issue:`21047`.)" +"The deprecated \"strict\" mode and argument " +"of :class:`~html.parser.HTMLParser`, :meth:`!HTMLParser.error`, and " +"the :exc:`!HTMLParserError` exception have been removed. (Contributed by " +"Ezio Melotti in :issue:`15114`.) The *convert_charrefs* argument " +"of :class:`~html.parser.HTMLParser` is now ``True`` by default. " +"(Contributed by Berker Peksag in :issue:`21047`.)" msgstr "" #: ../../whatsnew/3.5.rst:2426 @@ -3786,11 +3802,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:2432 msgid "" -"If the current directory is set to a directory that no longer exists then :" -"exc:`FileNotFoundError` will no longer be raised and instead :meth:" -"`~importlib.machinery.FileFinder.find_spec` will return ``None`` **without** " -"caching ``None`` in :data:`sys.path_importer_cache`, which is different than " -"the typical case (:issue:`22834`)." +"If the current directory is set to a directory that no longer exists " +"then :exc:`FileNotFoundError` will no longer be raised and " +"instead :meth:`~importlib.machinery.FileFinder.find_spec` will return " +"``None`` **without** caching ``None`` in :data:`sys.path_importer_cache`, " +"which is different than the typical case (:issue:`22834`)." msgstr "" #: ../../whatsnew/3.5.rst:2438 @@ -3804,12 +3820,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:2443 msgid "" "When an import loader defines :meth:`importlib.machinery.Loader.exec_module` " -"it is now expected to also define :meth:`~importlib.machinery.Loader." -"create_module` (raises a :exc:`DeprecationWarning` now, will be an error in " -"Python 3.6). If the loader inherits from :class:`importlib.abc.Loader` then " -"there is nothing to do, else simply define :meth:`~importlib.machinery." -"Loader.create_module` to return ``None``. (Contributed by Brett Cannon in :" -"issue:`23014`.)" +"it is now expected to also " +"define :meth:`~importlib.machinery.Loader.create_module` (raises " +"a :exc:`DeprecationWarning` now, will be an error in Python 3.6). If the " +"loader inherits from :class:`importlib.abc.Loader` then there is nothing to " +"do, else simply define :meth:`~importlib.machinery.Loader.create_module` to " +"return ``None``. (Contributed by Brett Cannon in :issue:`23014`.)" msgstr "" #: ../../whatsnew/3.5.rst:2451 @@ -3826,28 +3842,29 @@ msgstr "" #: ../../whatsnew/3.5.rst:2459 msgid "" "The :class:`http.cookies.Morsel` dict-like interface has been made self " -"consistent: morsel comparison now takes the :attr:`~http.cookies.Morsel." -"key` and :attr:`~http.cookies.Morsel.value` into account, :meth:`~http." -"cookies.Morsel.copy` now results in a :class:`~http.cookies.Morsel` instance " -"rather than a :class:`dict`, and :meth:`~http.cookies.Morsel.update` will " -"now raise an exception if any of the keys in the update dictionary are " -"invalid. In addition, the undocumented *LegalChars* parameter of :func:" -"`~http.cookies.Morsel.set` is deprecated and is now ignored. (Contributed " -"by Demian Brecht in :issue:`2211`.)" +"consistent: morsel comparison now takes " +"the :attr:`~http.cookies.Morsel.key` and :attr:`~http.cookies.Morsel.value` " +"into account, :meth:`~http.cookies.Morsel.copy` now results in " +"a :class:`~http.cookies.Morsel` instance rather than a :class:`dict`, " +"and :meth:`~http.cookies.Morsel.update` will now raise an exception if any " +"of the keys in the update dictionary are invalid. In addition, the " +"undocumented *LegalChars* parameter of :func:`~http.cookies.Morsel.set` is " +"deprecated and is now ignored. (Contributed by Demian Brecht " +"in :issue:`2211`.)" msgstr "" #: ../../whatsnew/3.5.rst:2469 msgid "" ":pep:`488` has removed ``.pyo`` files from Python and introduced the " -"optional ``opt-`` tag in ``.pyc`` file names. The :func:`importlib.util." -"cache_from_source` has gained an *optimization* parameter to help control " -"the ``opt-`` tag. Because of this, the *debug_override* parameter of the " -"function is now deprecated. ``.pyo`` files are also no longer supported as a " -"file argument to the Python interpreter and thus serve no purpose when " -"distributed on their own (i.e. sourceless code distribution). Due to the " -"fact that the magic number for bytecode has changed in Python 3.5, all old " -"``.pyo`` files from previous versions of Python are invalid regardless of " -"this PEP." +"optional ``opt-`` tag in ``.pyc`` file names. " +"The :func:`importlib.util.cache_from_source` has gained an *optimization* " +"parameter to help control the ``opt-`` tag. Because of this, the " +"*debug_override* parameter of the function is now deprecated. ``.pyo`` files " +"are also no longer supported as a file argument to the Python interpreter " +"and thus serve no purpose when distributed on their own (i.e. sourceless " +"code distribution). Due to the fact that the magic number for bytecode has " +"changed in Python 3.5, all old ``.pyo`` files from previous versions of " +"Python are invalid regardless of this PEP." msgstr "" #: ../../whatsnew/3.5.rst:2480 @@ -3891,16 +3908,17 @@ msgid "" "duplicated if the inherited documentation is appropriate. To suppress an " "inherited string, an empty string must be specified (or the documentation " "may be filled in). This change affects the output of the :mod:`pydoc` " -"module and the :func:`help` function. (Contributed by Serhiy Storchaka in :" -"issue:`15582`.)" +"module and the :func:`help` function. (Contributed by Serhiy Storchaka " +"in :issue:`15582`.)" msgstr "" #: ../../whatsnew/3.5.rst:2507 msgid "" "Nested :func:`functools.partial` calls are now flattened. If you were " -"relying on the previous behavior, you can now either add an attribute to a :" -"func:`functools.partial` object or you can create a subclass of :func:" -"`functools.partial`. (Contributed by Alexander Belopolsky in :issue:`7830`.)" +"relying on the previous behavior, you can now either add an attribute to " +"a :func:`functools.partial` object or you can create a subclass " +"of :func:`functools.partial`. (Contributed by Alexander Belopolsky " +"in :issue:`7830`.)" msgstr "" #: ../../whatsnew/3.5.rst:2514 @@ -3909,15 +3927,16 @@ msgstr "C API 中的改動" #: ../../whatsnew/3.5.rst:2516 msgid "" -"The undocumented :c:member:`!format` member of the (non-public) :c:type:" -"`PyMemoryViewObject` structure has been removed. All extensions relying on " -"the relevant parts in ``memoryobject.h`` must be rebuilt." +"The undocumented :c:member:`!format` member of the (non-" +"public) :c:type:`PyMemoryViewObject` structure has been removed. All " +"extensions relying on the relevant parts in ``memoryobject.h`` must be " +"rebuilt." msgstr "" #: ../../whatsnew/3.5.rst:2521 msgid "" -"The :c:type:`PyMemAllocator` structure was renamed to :c:type:" -"`PyMemAllocatorEx` and a new ``calloc`` field was added." +"The :c:type:`PyMemAllocator` structure was renamed " +"to :c:type:`PyMemAllocatorEx` and a new ``calloc`` field was added." msgstr "" #: ../../whatsnew/3.5.rst:2524 @@ -3932,17 +3951,17 @@ msgstr "" msgid "" "Because the lack of the :attr:`~type.__module__` attribute breaks pickling " "and introspection, a deprecation warning is now raised for builtin types " -"without the :attr:`~type.__module__` attribute. This will be an :exc:" -"`AttributeError` in the future. (Contributed by Serhiy Storchaka in :issue:" -"`20204`.)" +"without the :attr:`~type.__module__` attribute. This will be " +"an :exc:`AttributeError` in the future. (Contributed by Serhiy Storchaka " +"in :issue:`20204`.)" msgstr "" #: ../../whatsnew/3.5.rst:2535 msgid "" -"As part of the :pep:`492` implementation, the ``tp_reserved`` slot of :c:" -"type:`PyTypeObject` was replaced with a :c:member:`~PyTypeObject." -"tp_as_async` slot. Refer to :ref:`coro-objects` for new types, structures " -"and functions." +"As part of the :pep:`492` implementation, the ``tp_reserved`` slot " +"of :c:type:`PyTypeObject` was replaced with " +"a :c:member:`~PyTypeObject.tp_as_async` slot. Refer to :ref:`coro-objects` " +"for new types, structures and functions." msgstr "" #: ../../whatsnew/3.5.rst:2542 @@ -3970,8 +3989,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:2556 msgid "" -"More selective regeneration targets are also defined - see :source:`Makefile." -"pre.in` for details." +"More selective regeneration targets are also defined - " +"see :source:`Makefile.pre.in` for details." msgstr "" #: ../../whatsnew/3.5.rst:2559 ../../whatsnew/3.5.rst:2572 diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index 2b7dfedd6b..1597fc5373 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -80,16 +80,16 @@ msgstr "" #: ../../whatsnew/3.6.rst:78 msgid "CPython implementation improvements:" -msgstr "" +msgstr "CPython 實作改進:" #: ../../whatsnew/3.6.rst:80 msgid "" -"The :ref:`dict <typesmapping>` type has been reimplemented to use a :ref:" -"`more compact representation <whatsnew36-compactdict>` based on `a proposal " -"by Raymond Hettinger <https://mail.python.org/pipermail/python-dev/2012-" -"December/123028.html>`_ and similar to the `PyPy dict implementation`_. " -"This resulted in dictionaries using 20% to 25% less memory when compared to " -"Python 3.5." +"The :ref:`dict <typesmapping>` type has been reimplemented to use " +"a :ref:`more compact representation <whatsnew36-compactdict>` based on `a " +"proposal by Raymond Hettinger <https://mail.python.org/pipermail/python-dev/" +"2012-December/123028.html>`_ and similar to the `PyPy dict " +"implementation`_. This resulted in dictionaries using 20% to 25% less " +"memory when compared to Python 3.5." msgstr "" #: ../../whatsnew/3.6.rst:87 @@ -217,8 +217,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:159 msgid "" "``python.exe`` and ``pythonw.exe`` have been marked as long-path aware, " -"which means that the 260 character path limit may no longer apply. See :ref:" -"`removing the MAX_PATH limitation <max-path>` for details." +"which means that the 260 character path limit may no longer apply. " +"See :ref:`removing the MAX_PATH limitation <max-path>` for details." msgstr "" #: ../../whatsnew/3.6.rst:163 @@ -230,9 +230,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:167 msgid "" -"A ``python36.zip`` file now works as a landmark to infer :envvar:" -"`PYTHONHOME`. See :ref:`the documentation <windows_finding_modules>` for " -"more information." +"A ``python36.zip`` file now works as a landmark to " +"infer :envvar:`PYTHONHOME`. See :ref:`the documentation " +"<windows_finding_modules>` for more information." msgstr "" #: ../../whatsnew/3.6.rst:176 @@ -245,8 +245,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:183 msgid "" -":pep:`498` introduces a new kind of string literals: *f-strings*, or :ref:" -"`formatted string literals <f-strings>`." +":pep:`498` introduces a new kind of string literals: *f-strings*, " +"or :ref:`formatted string literals <f-strings>`." msgstr "" #: ../../whatsnew/3.6.rst:186 @@ -494,9 +494,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:348 msgid "" -"In order to allow zero-argument :func:`super` calls to work correctly from :" -"meth:`~object.__init_subclass__` implementations, custom metaclasses must " -"ensure that the new ``__classcell__`` namespace entry is propagated to " +"In order to allow zero-argument :func:`super` calls to work correctly " +"from :meth:`~object.__init_subclass__` implementations, custom metaclasses " +"must ensure that the new ``__classcell__`` namespace entry is propagated to " "``type.__new__`` (as described in :ref:`class-object-creation`)." msgstr "" @@ -518,13 +518,13 @@ msgstr "" #: ../../whatsnew/3.6.rst:366 msgid "" -":pep:`487` extends the descriptor protocol to include the new optional :meth:" -"`~object.__set_name__` method. Whenever a new class is defined, the new " -"method will be called on all descriptors included in the definition, " -"providing them with a reference to the class being defined and the name " -"given to the descriptor within the class namespace. In other words, " -"instances of descriptors can now know the attribute name of the descriptor " -"in the owner class::" +":pep:`487` extends the descriptor protocol to include the new " +"optional :meth:`~object.__set_name__` method. Whenever a new class is " +"defined, the new method will be called on all descriptors included in the " +"definition, providing them with a reference to the class being defined and " +"the name given to the descriptor within the class namespace. In other " +"words, instances of descriptors can now know the attribute name of the " +"descriptor in the owner class::" msgstr "" #: ../../whatsnew/3.6.rst:374 @@ -556,13 +556,13 @@ msgstr "" #: ../../whatsnew/3.6.rst:404 msgid "" -"File system paths have historically been represented as :class:`str` or :" -"class:`bytes` objects. This has led to people who write code which operate " -"on file system paths to assume that such objects are only one of those two " -"types (an :class:`int` representing a file descriptor does not count as that " -"is not a file path). Unfortunately that assumption prevents alternative " -"object representations of file system paths like :mod:`pathlib` from working " -"with pre-existing code, including Python's standard library." +"File system paths have historically been represented as :class:`str` " +"or :class:`bytes` objects. This has led to people who write code which " +"operate on file system paths to assume that such objects are only one of " +"those two types (an :class:`int` representing a file descriptor does not " +"count as that is not a file path). Unfortunately that assumption prevents " +"alternative object representations of file system paths like :mod:`pathlib` " +"from working with pre-existing code, including Python's standard library." msgstr "" #: ../../whatsnew/3.6.rst:413 @@ -572,8 +572,8 @@ msgid "" "method, an object signals that it represents a path. An object can then " "provide a low-level representation of a file system path as a :class:`str` " "or :class:`bytes` object. This means an object is considered :term:`path-" -"like <path-like object>` if it implements :class:`os.PathLike` or is a :" -"class:`str` or :class:`bytes` object which represents a file system path. " +"like <path-like object>` if it implements :class:`os.PathLike` or is " +"a :class:`str` or :class:`bytes` object which represents a file system path. " "Code can use :func:`os.fspath`, :func:`os.fsdecode`, or :func:`os.fsencode` " "to explicitly get a :class:`str` and/or :class:`bytes` representation of a " "path-like object." @@ -581,26 +581,28 @@ msgstr "" #: ../../whatsnew/3.6.rst:426 msgid "" -"The built-in :func:`open` function has been updated to accept :class:`os." -"PathLike` objects, as have all relevant functions in the :mod:`os` and :mod:" -"`os.path` modules, and most other functions and classes in the standard " -"library. The :class:`os.DirEntry` class and relevant classes in :mod:" -"`pathlib` have also been updated to implement :class:`os.PathLike`." +"The built-in :func:`open` function has been updated to " +"accept :class:`os.PathLike` objects, as have all relevant functions in " +"the :mod:`os` and :mod:`os.path` modules, and most other functions and " +"classes in the standard library. The :class:`os.DirEntry` class and " +"relevant classes in :mod:`pathlib` have also been updated to " +"implement :class:`os.PathLike`." msgstr "" #: ../../whatsnew/3.6.rst:433 msgid "" "The hope is that updating the fundamental functions for operating on file " -"system paths will lead to third-party code to implicitly support all :term:" -"`path-like objects <path-like object>` without any code changes, or at least " -"very minimal ones (e.g. calling :func:`os.fspath` at the beginning of code " -"before operating on a path-like object)." +"system paths will lead to third-party code to implicitly support " +"all :term:`path-like objects <path-like object>` without any code changes, " +"or at least very minimal ones (e.g. calling :func:`os.fspath` at the " +"beginning of code before operating on a path-like object)." msgstr "" #: ../../whatsnew/3.6.rst:440 msgid "" -"Here are some examples of how the new interface allows for :class:`pathlib." -"Path` to be used more easily and transparently with pre-existing code::" +"Here are some examples of how the new interface allows " +"for :class:`pathlib.Path` to be used more easily and transparently with pre-" +"existing code::" msgstr "" #: ../../whatsnew/3.6.rst:444 @@ -660,9 +662,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:476 msgid "" -":pep:`495` adds the new *fold* attribute to instances of :class:`datetime." -"datetime` and :class:`datetime.time` classes to differentiate between two " -"moments in time for which local times are the same::" +":pep:`495` adds the new *fold* attribute to instances " +"of :class:`datetime.datetime` and :class:`datetime.time` classes to " +"differentiate between two moments in time for which local times are the " +"same::" msgstr "" #: ../../whatsnew/3.6.rst:480 @@ -721,17 +724,17 @@ msgstr "" msgid "" "Prior to Python 3.6, data loss could result when using bytes paths on " "Windows. With this change, using bytes to represent paths is now supported " -"on Windows, provided those bytes are encoded with the encoding returned by :" -"func:`sys.getfilesystemencoding`, which now defaults to ``'utf-8'``." +"on Windows, provided those bytes are encoded with the encoding returned " +"by :func:`sys.getfilesystemencoding`, which now defaults to ``'utf-8'``." msgstr "" #: ../../whatsnew/3.6.rst:516 msgid "" -"Applications that do not use str to represent paths should use :func:`os." -"fsencode` and :func:`os.fsdecode` to ensure their bytes are correctly " -"encoded. To revert to the previous behaviour, set :envvar:" -"`PYTHONLEGACYWINDOWSFSENCODING` or call :func:`sys." -"_enablelegacywindowsfsencoding`." +"Applications that do not use str to represent paths should " +"use :func:`os.fsencode` and :func:`os.fsdecode` to ensure their bytes are " +"correctly encoded. To revert to the previous behaviour, " +"set :envvar:`PYTHONLEGACYWINDOWSFSENCODING` or " +"call :func:`sys._enablelegacywindowsfsencoding`." msgstr "" #: ../../whatsnew/3.6.rst:522 @@ -747,8 +750,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:531 msgid "" "The default console on Windows will now accept all Unicode characters and " -"provide correctly read str objects to Python code. ``sys.stdin``, ``sys." -"stdout`` and ``sys.stderr`` now default to utf-8 encoding." +"provide correctly read str objects to Python code. ``sys.stdin``, " +"``sys.stdout`` and ``sys.stderr`` now default to utf-8 encoding." msgstr "" #: ../../whatsnew/3.6.rst:535 @@ -779,8 +782,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:554 msgid "" -"Also, the effective default class *execution* namespace (returned from :ref:" -"`type.__prepare__() <prepare>`) is now an insertion-order-preserving mapping." +"Also, the effective default class *execution* namespace (returned " +"from :ref:`type.__prepare__() <prepare>`) is now an insertion-order-" +"preserving mapping." msgstr "" #: ../../whatsnew/3.6.rst:560 @@ -814,9 +818,9 @@ msgid "" "The :ref:`dict <typesmapping>` type now uses a \"compact\" representation " "based on `a proposal by Raymond Hettinger <https://mail.python.org/pipermail/" "python-dev/2012-December/123028.html>`_ which was `first implemented by PyPy " -"<https://morepypy.blogspot.com/2015/01/faster-more-memory-efficient-and-more." -"html>`_. The memory usage of the new :func:`dict` is between 20% and 25% " -"smaller compared to Python 3.5." +"<https://morepypy.blogspot.com/2015/01/faster-more-memory-efficient-and-" +"more.html>`_. The memory usage of the new :func:`dict` is between 20% and " +"25% smaller compared to Python 3.5." msgstr "" #: ../../whatsnew/3.6.rst:591 @@ -827,8 +831,8 @@ msgid "" "language for a few releases before changing the language spec to mandate " "order-preserving semantics for all current and future Python " "implementations; this also helps preserve backwards-compatibility with older " -"versions of the language where random iteration order is still in effect, e." -"g. Python 3.5)." +"versions of the language where random iteration order is still in effect, " +"e.g. Python 3.5)." msgstr "" #: ../../whatsnew/3.6.rst:600 @@ -903,8 +907,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:647 msgid "" -"Detect violations of the Python memory allocator API. For example, :c:func:" -"`PyObject_Free` called on a memory block allocated by :c:func:`PyMem_Malloc`." +"Detect violations of the Python memory allocator API. For " +"example, :c:func:`PyObject_Free` called on a memory block allocated " +"by :c:func:`PyMem_Malloc`." msgstr "" #: ../../whatsnew/3.6.rst:650 @@ -943,8 +948,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:666 msgid "" -"On error, the debug hooks on Python memory allocators now use the :mod:" -"`tracemalloc` module to get the traceback where a memory block was allocated." +"On error, the debug hooks on Python memory allocators now use " +"the :mod:`tracemalloc` module to get the traceback where a memory block was " +"allocated." msgstr "" #: ../../whatsnew/3.6.rst:670 @@ -1085,8 +1091,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:742 msgid "" "A ``global`` or ``nonlocal`` statement must now textually appear before the " -"first use of the affected name in the same scope. Previously this was a :exc:" -"`SyntaxWarning`." +"first use of the affected name in the same scope. Previously this was " +"a :exc:`SyntaxWarning`." msgstr "" #: ../../whatsnew/3.6.rst:746 @@ -1106,10 +1112,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:757 msgid "" -"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass of :" -"exc:`ImportError`) when it cannot find a module. Code that currently checks " -"for ImportError (in try-except) will still work. (Contributed by Eric Snow " -"in :issue:`15767`.)" +"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass " +"of :exc:`ImportError`) when it cannot find a module. Code that currently " +"checks for ImportError (in try-except) will still work. (Contributed by Eric " +"Snow in :issue:`15767`.)" msgstr "" #: ../../whatsnew/3.6.rst:762 @@ -1138,8 +1144,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:781 msgid "" "Note that the pseudo-random generators in the :mod:`random` module should " -"*NOT* be used for security purposes. Use :mod:`secrets` on Python 3.6+ and :" -"func:`os.urandom` on Python 3.5 and earlier." +"*NOT* be used for security purposes. Use :mod:`secrets` on Python 3.6+ " +"and :func:`os.urandom` on Python 3.5 and earlier." msgstr "" #: ../../whatsnew/3.6.rst:787 @@ -1244,9 +1250,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:850 msgid "" -"New :meth:`loop.get_exception_handler() <asyncio.loop." -"get_exception_handler>` method to get the current exception handler. " -"(Contributed by Yury Selivanov in :issue:`27040`.)" +"New :meth:`loop.get_exception_handler() " +"<asyncio.loop.get_exception_handler>` method to get the current exception " +"handler. (Contributed by Yury Selivanov in :issue:`27040`.)" msgstr "" #: ../../whatsnew/3.6.rst:854 @@ -1258,9 +1264,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:859 msgid "" -"The performance of :meth:`StreamReader.readexactly() <asyncio.StreamReader." -"readexactly>` has been improved. (Contributed by Mark Korenberg in :issue:" -"`28370`.)" +"The performance of :meth:`StreamReader.readexactly() " +"<asyncio.StreamReader.readexactly>` has been improved. (Contributed by Mark " +"Korenberg in :issue:`28370`.)" msgstr "" #: ../../whatsnew/3.6.rst:863 @@ -1287,9 +1293,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:879 msgid "" -"New :meth:`loop.connect_accepted_socket() <asyncio.loop." -"connect_accepted_socket>` method to be used by servers that accept " -"connections outside of asyncio, but that use asyncio to handle them. " +"New :meth:`loop.connect_accepted_socket() " +"<asyncio.loop.connect_accepted_socket>` method to be used by servers that " +"accept connections outside of asyncio, but that use asyncio to handle them. " "(Contributed by Jim Fulton in :issue:`27392`.)" msgstr "" @@ -1337,10 +1343,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:914 msgid "" -"New constants: :const:`cmath.inf` and :const:`cmath.nan` to match :const:" -"`math.inf` and :const:`math.nan`, and also :const:`cmath.infj` and :const:" -"`cmath.nanj` to match the format used by complex repr. (Contributed by Mark " -"Dickinson in :issue:`23229`.)" +"New constants: :const:`cmath.inf` and :const:`cmath.nan` to " +"match :const:`math.inf` and :const:`math.nan`, and also :const:`cmath.infj` " +"and :const:`cmath.nanj` to match the format used by complex repr. " +"(Contributed by Mark Dickinson in :issue:`23229`.)" msgstr "" #: ../../whatsnew/3.6.rst:921 @@ -1364,16 +1370,16 @@ msgstr "" #: ../../whatsnew/3.6.rst:931 msgid "" "The new :class:`~collections.abc.AsyncGenerator` abstract base class " -"represents asynchronous generators. (Contributed by Yury Selivanov in :issue:" -"`28720`.)" +"represents asynchronous generators. (Contributed by Yury Selivanov " +"in :issue:`28720`.)" msgstr "" #: ../../whatsnew/3.6.rst:935 msgid "" "The :func:`~collections.namedtuple` function now accepts an optional keyword " -"argument *module*, which, when specified, is used for the :attr:`~type." -"__module__` attribute of the returned named tuple class. (Contributed by " -"Raymond Hettinger in :issue:`17941`.)" +"argument *module*, which, when specified, is used for " +"the :attr:`~type.__module__` attribute of the returned named tuple class. " +"(Contributed by Raymond Hettinger in :issue:`17941`.)" msgstr "" #: ../../whatsnew/3.6.rst:940 ../../whatsnew/3.6.rst:2295 @@ -1409,9 +1415,9 @@ msgid "" "The :class:`contextlib.AbstractContextManager` class has been added to " "provide an abstract base class for context managers. It provides a sensible " "default implementation for ``__enter__()`` which returns ``self`` and leaves " -"``__exit__()`` an abstract method. A matching class has been added to the :" -"mod:`typing` module as :class:`typing.ContextManager`. (Contributed by Brett " -"Cannon in :issue:`25609`.)" +"``__exit__()`` an abstract method. A matching class has been added to " +"the :mod:`typing` module as :class:`typing.ContextManager`. (Contributed by " +"Brett Cannon in :issue:`25609`.)" msgstr "" #: ../../whatsnew/3.6.rst:971 @@ -1430,10 +1436,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:981 msgid "" -"The :meth:`datetime.strftime() <datetime.datetime.strftime>` and :meth:`date." -"strftime() <datetime.date.strftime>` methods now support ISO 8601 date " -"directives ``%G``, ``%u`` and ``%V``. (Contributed by Ashley Anderson in :" -"issue:`12006`.)" +"The :meth:`datetime.strftime() <datetime.datetime.strftime>` " +"and :meth:`date.strftime() <datetime.date.strftime>` methods now support ISO " +"8601 date directives ``%G``, ``%u`` and ``%V``. (Contributed by Ashley " +"Anderson in :issue:`12006`.)" msgstr "" #: ../../whatsnew/3.6.rst:986 @@ -1447,8 +1453,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:991 msgid "" "The :meth:`datetime.combine() <datetime.datetime.combine>` now accepts an " -"optional *tzinfo* argument. (Contributed by Alexander Belopolsky in :issue:" -"`27661`.)" +"optional *tzinfo* argument. (Contributed by Alexander Belopolsky " +"in :issue:`27661`.)" msgstr "" #: ../../whatsnew/3.6.rst:997 @@ -1458,9 +1464,9 @@ msgstr "decimal" #: ../../whatsnew/3.6.rst:999 msgid "" "New :meth:`Decimal.as_integer_ratio() <decimal.Decimal.as_integer_ratio>` " -"method that returns a pair ``(n, d)`` of integers that represent the given :" -"class:`~decimal.Decimal` instance as a fraction, in lowest terms and with a " -"positive denominator::" +"method that returns a pair ``(n, d)`` of integers that represent the " +"given :class:`~decimal.Decimal` instance as a fraction, in lowest terms and " +"with a positive denominator::" msgstr "" #: ../../whatsnew/3.6.rst:1004 @@ -1481,9 +1487,9 @@ msgstr "distutils" #: ../../whatsnew/3.6.rst:1014 msgid "" -"The ``default_format`` attribute has been removed from ``distutils.command." -"sdist.sdist`` and the ``formats`` attribute defaults to ``['gztar']``. " -"Although not anticipated, any code relying on the presence of " +"The ``default_format`` attribute has been removed from " +"``distutils.command.sdist.sdist`` and the ``formats`` attribute defaults to " +"``['gztar']``. Although not anticipated, any code relying on the presence of " "``default_format`` may need to be adapted. See :issue:`27819` for more " "details." msgstr "" @@ -1497,8 +1503,8 @@ msgid "" "The new email API, enabled via the *policy* keyword to various constructors, " "is no longer provisional. The :mod:`email` documentation has been " "reorganized and rewritten to focus on the new API, while retaining the old " -"documentation for the legacy API. (Contributed by R. David Murray in :issue:" -"`24277`.)" +"documentation for the legacy API. (Contributed by R. David Murray " +"in :issue:`24277`.)" msgstr "" #: ../../whatsnew/3.6.rst:1029 @@ -1515,12 +1521,13 @@ msgstr "" #: ../../whatsnew/3.6.rst:1035 msgid "" -"There is a new :mod:`~email.policy` attribute, :attr:`~email.policy.Policy." -"message_factory`, that controls what class is used by default when the " -"parser creates new message objects. For the :attr:`email.policy.compat32` " -"policy this is :class:`~email.message.Message`, for the new policies it is :" -"class:`~email.message.EmailMessage`. (Contributed by R. David Murray in :" -"issue:`20476`.)" +"There is a new :mod:`~email.policy` " +"attribute, :attr:`~email.policy.Policy.message_factory`, that controls what " +"class is used by default when the parser creates new message objects. For " +"the :attr:`email.policy.compat32` policy this " +"is :class:`~email.message.Message`, for the new policies it " +"is :class:`~email.message.EmailMessage`. (Contributed by R. David Murray " +"in :issue:`20476`.)" msgstr "" #: ../../whatsnew/3.6.rst:1044 @@ -1540,16 +1547,16 @@ msgstr "enum" #: ../../whatsnew/3.6.rst:1054 msgid "" -"Two new enumeration base classes have been added to the :mod:`enum` module: :" -"class:`~enum.Flag` and :class:`~enum.IntFlags`. Both are used to define " -"constants that can be combined using the bitwise operators. (Contributed by " -"Ethan Furman in :issue:`23591`.)" +"Two new enumeration base classes have been added to the :mod:`enum` " +"module: :class:`~enum.Flag` and :class:`~enum.IntFlags`. Both are used to " +"define constants that can be combined using the bitwise operators. " +"(Contributed by Ethan Furman in :issue:`23591`.)" msgstr "" #: ../../whatsnew/3.6.rst:1059 msgid "" -"Many standard library modules have been updated to use the :class:`~enum." -"IntFlags` class for their constants." +"Many standard library modules have been updated to use " +"the :class:`~enum.IntFlags` class for their constants." msgstr "" #: ../../whatsnew/3.6.rst:1062 @@ -1620,19 +1627,19 @@ msgstr "" #: ../../whatsnew/3.6.rst:1102 msgid "" -"The SHA-3 hash functions :func:`~hashlib.sha3_224`, :func:`~hashlib." -"sha3_256`, :func:`~hashlib.sha3_384`, :func:`~hashlib.sha3_512`, and SHAKE " -"hash functions :func:`~hashlib.shake_128` and :func:`~hashlib.shake_256` " -"were added. (Contributed by Christian Heimes in :issue:`16113`. Keccak Code " -"Package by Guido Bertoni, Joan Daemen, Michaël Peeters, Gilles Van Assche, " -"and Ronny Van Keer.)" +"The SHA-3 hash " +"functions :func:`~hashlib.sha3_224`, :func:`~hashlib.sha3_256`, :func:`~hashlib.sha3_384`, :func:`~hashlib.sha3_512`, " +"and SHAKE hash functions :func:`~hashlib.shake_128` " +"and :func:`~hashlib.shake_256` were added. (Contributed by Christian Heimes " +"in :issue:`16113`. Keccak Code Package by Guido Bertoni, Joan Daemen, " +"Michaël Peeters, Gilles Van Assche, and Ronny Van Keer.)" msgstr "" #: ../../whatsnew/3.6.rst:1109 msgid "" "The password-based key derivation function :func:`~hashlib.scrypt` is now " -"available with OpenSSL 1.1.0 and newer. (Contributed by Christian Heimes in :" -"issue:`27928`.)" +"available with OpenSSL 1.1.0 and newer. (Contributed by Christian Heimes " +"in :issue:`27928`.)" msgstr "" #: ../../whatsnew/3.6.rst:1114 @@ -1641,10 +1648,10 @@ msgstr "http.client" #: ../../whatsnew/3.6.rst:1116 msgid "" -":meth:`HTTPConnection.request() <http.client.HTTPConnection.request>` and :" -"meth:`~http.client.HTTPConnection.endheaders` both now support chunked " -"encoding request bodies. (Contributed by Demian Brecht and Rolf Krahl in :" -"issue:`12319`.)" +":meth:`HTTPConnection.request() <http.client.HTTPConnection.request>` " +"and :meth:`~http.client.HTTPConnection.endheaders` both now support chunked " +"encoding request bodies. (Contributed by Demian Brecht and Rolf Krahl " +"in :issue:`12319`.)" msgstr "" #: ../../whatsnew/3.6.rst:1123 @@ -1667,10 +1674,10 @@ msgid "" "renaming of files with partial uppercase names is similar to the renaming " "of, for instance, Tkinter and TkFont to tkinter and tkinter.font in 3.0. As " "a result, imports of idlelib files that worked in 3.5 will usually not work " -"in 3.6. At least a module name change will be needed (see idlelib/README." -"txt), sometimes more. (Name changes contributed by Al Swiegart and Terry " -"Reedy in :issue:`24225`. Most idlelib patches since have been and will be " -"part of the process.)" +"in 3.6. At least a module name change will be needed (see idlelib/" +"README.txt), sometimes more. (Name changes contributed by Al Swiegart and " +"Terry Reedy in :issue:`24225`. Most idlelib patches since have been and " +"will be part of the process.)" msgstr "" #: ../../whatsnew/3.6.rst:1141 @@ -1686,8 +1693,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1147 msgid "" -"Multiple fixes for autocompletion. (Contributed by Louie Lu in :issue:" -"`15786`.)" +"Multiple fixes for autocompletion. (Contributed by Louie Lu " +"in :issue:`15786`.)" msgstr "" #: ../../whatsnew/3.6.rst:1149 @@ -1738,8 +1745,8 @@ msgid "" "Editor code context option revised. Box displays all context lines up to " "maxlines. Clicking on a context line jumps the editor to that line. " "Context colors for custom themes is added to Highlights tab of Settings " -"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy in :issue:" -"`33642`, :issue:`33768`, and :issue:`33679`.)" +"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy " +"in :issue:`33642`, :issue:`33768`, and :issue:`33679`.)" msgstr "" #: ../../whatsnew/3.6.rst:1182 @@ -1771,26 +1778,26 @@ msgstr "importlib" #: ../../whatsnew/3.6.rst:1201 msgid "" -"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass of :" -"exc:`ImportError`) when it cannot find a module. Code that current checks " -"for ``ImportError`` (in try-except) will still work. (Contributed by Eric " -"Snow in :issue:`15767`.)" +"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass " +"of :exc:`ImportError`) when it cannot find a module. Code that current " +"checks for ``ImportError`` (in try-except) will still work. (Contributed by " +"Eric Snow in :issue:`15767`.)" msgstr "" #: ../../whatsnew/3.6.rst:1206 msgid "" -":class:`importlib.util.LazyLoader` now calls :meth:`~importlib.abc.Loader." -"create_module` on the wrapped loader, removing the restriction that :class:" -"`importlib.machinery.BuiltinImporter` and :class:`importlib.machinery." -"ExtensionFileLoader` couldn't be used with :class:`importlib.util." -"LazyLoader`." +":class:`importlib.util.LazyLoader` now " +"calls :meth:`~importlib.abc.Loader.create_module` on the wrapped loader, " +"removing the restriction that :class:`importlib.machinery.BuiltinImporter` " +"and :class:`importlib.machinery.ExtensionFileLoader` couldn't be used " +"with :class:`importlib.util.LazyLoader`." msgstr "" #: ../../whatsnew/3.6.rst:1212 msgid "" -":func:`importlib.util.cache_from_source`, :func:`importlib.util." -"source_from_cache`, and :func:`importlib.util.spec_from_file_location` now " -"accept a :term:`path-like object`." +":func:`importlib.util.cache_from_source`, :func:`importlib.util.source_from_cache`, " +"and :func:`importlib.util.spec_from_file_location` now accept a :term:`path-" +"like object`." msgstr "" #: ../../whatsnew/3.6.rst:1219 @@ -1807,12 +1814,12 @@ msgstr "" #: ../../whatsnew/3.6.rst:1226 msgid "" -"To reduce code churn when upgrading from Python 2.7 and the legacy :func:" -"`inspect.getargspec` API, the previously documented deprecation of :func:" -"`inspect.getfullargspec` has been reversed. While this function is " -"convenient for single/source Python 2/3 code bases, the richer :func:" -"`inspect.signature` interface remains the recommended approach for new code. " -"(Contributed by Nick Coghlan in :issue:`27172`)" +"To reduce code churn when upgrading from Python 2.7 and the " +"legacy :func:`inspect.getargspec` API, the previously documented deprecation " +"of :func:`inspect.getfullargspec` has been reversed. While this function is " +"convenient for single/source Python 2/3 code bases, the " +"richer :func:`inspect.signature` interface remains the recommended approach " +"for new code. (Contributed by Nick Coghlan in :issue:`27172`)" msgstr "" #: ../../whatsnew/3.6.rst:1235 @@ -1832,10 +1839,10 @@ msgstr "logging" #: ../../whatsnew/3.6.rst:1245 msgid "" -"The new :meth:`WatchedFileHandler.reopenIfNeeded() <logging.handlers." -"WatchedFileHandler.reopenIfNeeded>` method has been added to add the ability " -"to check if the log file needs to be reopened. (Contributed by Marian Horban " -"in :issue:`24884`.)" +"The new :meth:`WatchedFileHandler.reopenIfNeeded() " +"<logging.handlers.WatchedFileHandler.reopenIfNeeded>` method has been added " +"to add the ability to check if the log file needs to be reopened. " +"(Contributed by Marian Horban in :issue:`24884`.)" msgstr "" #: ../../whatsnew/3.6.rst:1252 @@ -1855,9 +1862,9 @@ msgstr "multiprocessing" #: ../../whatsnew/3.6.rst:1262 msgid "" -":ref:`Proxy Objects <multiprocessing-proxy_objects>` returned by :func:" -"`multiprocessing.Manager` can now be nested. (Contributed by Davin Potts in :" -"issue:`6766`.)" +":ref:`Proxy Objects <multiprocessing-proxy_objects>` returned " +"by :func:`multiprocessing.Manager` can now be nested. (Contributed by Davin " +"Potts in :issue:`6766`.)" msgstr "" #: ../../whatsnew/3.6.rst:1268 ../../whatsnew/3.6.rst:2021 @@ -1877,11 +1884,12 @@ msgstr "" #: ../../whatsnew/3.6.rst:1276 msgid "" -"A new :meth:`~os.scandir.close` method allows explicitly closing a :func:" -"`~os.scandir` iterator. The :func:`~os.scandir` iterator now supports the :" -"term:`context manager` protocol. If a :func:`scandir` iterator is neither " -"exhausted nor explicitly closed a :exc:`ResourceWarning` will be emitted in " -"its destructor. (Contributed by Serhiy Storchaka in :issue:`25994`.)" +"A new :meth:`~os.scandir.close` method allows explicitly closing " +"a :func:`~os.scandir` iterator. The :func:`~os.scandir` iterator now " +"supports the :term:`context manager` protocol. If a :func:`scandir` " +"iterator is neither exhausted nor explicitly closed a :exc:`ResourceWarning` " +"will be emitted in its destructor. (Contributed by Serhiy Storchaka " +"in :issue:`25994`.)" msgstr "" #: ../../whatsnew/3.6.rst:1286 @@ -1971,24 +1979,24 @@ msgstr "re" #: ../../whatsnew/3.6.rst:1347 msgid "" -"Added support of modifier spans in regular expressions. Examples: ``'(?i:" -"p)ython'`` matches ``'python'`` and ``'Python'``, but not ``'PYTHON'``; ``'(?" -"i)g(?-i:v)r'`` matches ``'GvR'`` and ``'gvr'``, but not ``'GVR'``. " +"Added support of modifier spans in regular expressions. Examples: ``'(?" +"i:p)ython'`` matches ``'python'`` and ``'Python'``, but not ``'PYTHON'``; " +"``'(?i)g(?-i:v)r'`` matches ``'GvR'`` and ``'gvr'``, but not ``'GVR'``. " "(Contributed by Serhiy Storchaka in :issue:`433028`.)" msgstr "" #: ../../whatsnew/3.6.rst:1352 msgid "" "Match object groups can be accessed by ``__getitem__``, which is equivalent " -"to ``group()``. So ``mo['name']`` is now equivalent to ``mo." -"group('name')``. (Contributed by Eric Smith in :issue:`24454`.)" +"to ``group()``. So ``mo['name']`` is now equivalent to " +"``mo.group('name')``. (Contributed by Eric Smith in :issue:`24454`.)" msgstr "" #: ../../whatsnew/3.6.rst:1356 msgid "" -":class:`~re.Match` objects now support :meth:`index-like objects <object." -"__index__>` as group indices. (Contributed by Jeroen Demeyer and Xiang Zhang " -"in :issue:`27177`.)" +":class:`~re.Match` objects now support :meth:`index-like objects " +"<object.__index__>` as group indices. (Contributed by Jeroen Demeyer and " +"Xiang Zhang in :issue:`27177`.)" msgstr "" #: ../../whatsnew/3.6.rst:1363 @@ -1998,8 +2006,8 @@ msgstr "readline" #: ../../whatsnew/3.6.rst:1365 msgid "" "Added :func:`~readline.set_auto_history` to enable or disable automatic " -"addition of input to the history list. (Contributed by Tyler Crompton in :" -"issue:`26870`.)" +"addition of input to the history list. (Contributed by Tyler Crompton " +"in :issue:`26870`.)" msgstr "" #: ../../whatsnew/3.6.rst:1371 @@ -2010,8 +2018,8 @@ msgstr "rlcompleter" msgid "" "Private and special attribute names now are omitted unless the prefix starts " "with underscores. A space or a colon is added after some completed " -"keywords. (Contributed by Serhiy Storchaka in :issue:`25011` and :issue:" -"`25209`.)" +"keywords. (Contributed by Serhiy Storchaka in :issue:`25011` " +"and :issue:`25209`.)" msgstr "" #: ../../whatsnew/3.6.rst:1379 @@ -2053,9 +2061,9 @@ msgstr "socket" #: ../../whatsnew/3.6.rst:1406 msgid "" -"The :func:`~socket.socket.ioctl` function now supports the :const:`~socket." -"SIO_LOOPBACK_FAST_PATH` control code. (Contributed by Daniel Stokes in :" -"issue:`26536`.)" +"The :func:`~socket.socket.ioctl` function now supports " +"the :const:`~socket.SIO_LOOPBACK_FAST_PATH` control code. (Contributed by " +"Daniel Stokes in :issue:`26536`.)" msgstr "" #: ../../whatsnew/3.6.rst:1410 @@ -2068,16 +2076,16 @@ msgstr "" #: ../../whatsnew/3.6.rst:1414 msgid "" "The :meth:`~socket.socket.setsockopt` now supports the ``setsockopt(level, " -"optname, None, optlen: int)`` form. (Contributed by Christian Heimes in :" -"issue:`27744`.)" +"optname, None, optlen: int)`` form. (Contributed by Christian Heimes " +"in :issue:`27744`.)" msgstr "" #: ../../whatsnew/3.6.rst:1418 msgid "" "The socket module now supports the address family :const:`~socket.AF_ALG` to " -"interface with Linux Kernel crypto API. ``ALG_*``, ``SOL_ALG`` and :meth:" -"`~socket.socket.sendmsg_afalg` were added. (Contributed by Christian Heimes " -"in :issue:`27744` with support from Victor Stinner.)" +"interface with Linux Kernel crypto API. ``ALG_*``, ``SOL_ALG`` " +"and :meth:`~socket.socket.sendmsg_afalg` were added. (Contributed by " +"Christian Heimes in :issue:`27744` with support from Victor Stinner.)" msgstr "" #: ../../whatsnew/3.6.rst:1424 @@ -2092,19 +2100,19 @@ msgstr "socketserver" #: ../../whatsnew/3.6.rst:1431 msgid "" -"Servers based on the :mod:`socketserver` module, including those defined in :" -"mod:`http.server`, :mod:`xmlrpc.server` and :mod:`wsgiref.simple_server`, " -"now support the :term:`context manager` protocol. (Contributed by Aviv " -"Palivoda in :issue:`26404`.)" +"Servers based on the :mod:`socketserver` module, including those defined " +"in :mod:`http.server`, :mod:`xmlrpc.server` " +"and :mod:`wsgiref.simple_server`, now support the :term:`context manager` " +"protocol. (Contributed by Aviv Palivoda in :issue:`26404`.)" msgstr "" #: ../../whatsnew/3.6.rst:1437 msgid "" -"The :attr:`~socketserver.StreamRequestHandler.wfile` attribute of :class:" -"`~socketserver.StreamRequestHandler` classes now implements the :class:`io." -"BufferedIOBase` writable interface. In particular, calling :meth:`~io." -"BufferedIOBase.write` is now guaranteed to send the data in full. " -"(Contributed by Martin Panter in :issue:`26721`.)" +"The :attr:`~socketserver.StreamRequestHandler.wfile` attribute " +"of :class:`~socketserver.StreamRequestHandler` classes now implements " +"the :class:`io.BufferedIOBase` writable interface. In particular, " +"calling :meth:`~io.BufferedIOBase.write` is now guaranteed to send the data " +"in full. (Contributed by Martin Panter in :issue:`26721`.)" msgstr "" #: ../../whatsnew/3.6.rst:1445 ../../whatsnew/3.6.rst:2037 @@ -2120,8 +2128,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1450 msgid "" "3DES has been removed from the default cipher suites and ChaCha20 Poly1305 " -"cipher suites have been added. (Contributed by Christian Heimes in :issue:" -"`27850` and :issue:`27766`.)" +"cipher suites have been added. (Contributed by Christian Heimes " +"in :issue:`27850` and :issue:`27766`.)" msgstr "" #: ../../whatsnew/3.6.rst:1454 @@ -2146,8 +2154,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:1467 msgid "" -"All constants and flags have been converted to :class:`~enum.IntEnum` and :" -"class:`~enum.IntFlags`. (Contributed by Christian Heimes in :issue:`28025`.)" +"All constants and flags have been converted to :class:`~enum.IntEnum` " +"and :class:`~enum.IntFlags`. (Contributed by Christian Heimes " +"in :issue:`28025`.)" msgstr "" #: ../../whatsnew/3.6.rst:1471 @@ -2158,9 +2167,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:1475 msgid "" -"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable and :meth:`ssl." -"SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 post-handshake " -"authentication. (Contributed by Christian Heimes in :gh:`78851`.)" +"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable " +"and :meth:`ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 " +"post-handshake authentication. (Contributed by Christian Heimes " +"in :gh:`78851`.)" msgstr "" #: ../../whatsnew/3.6.rst:1481 @@ -2180,8 +2190,8 @@ msgstr "struct" #: ../../whatsnew/3.6.rst:1490 msgid "" ":mod:`struct` now supports IEEE 754 half-precision floats via the ``'e'`` " -"format specifier. (Contributed by Eli Stevens, Mark Dickinson in :issue:" -"`11734`.)" +"format specifier. (Contributed by Eli Stevens, Mark Dickinson " +"in :issue:`11734`.)" msgstr "" #: ../../whatsnew/3.6.rst:1496 @@ -2192,9 +2202,9 @@ msgstr "subprocess" msgid "" ":class:`subprocess.Popen` destructor now emits a :exc:`ResourceWarning` " "warning if the child process is still running. Use the context manager " -"protocol (``with proc: ...``) or explicitly call the :meth:`~subprocess." -"Popen.wait` method to read the exit status of the child process. " -"(Contributed by Victor Stinner in :issue:`26741`.)" +"protocol (``with proc: ...``) or explicitly call " +"the :meth:`~subprocess.Popen.wait` method to read the exit status of the " +"child process. (Contributed by Victor Stinner in :issue:`26741`.)" msgstr "" #: ../../whatsnew/3.6.rst:1504 @@ -2241,8 +2251,8 @@ msgstr "time" #: ../../whatsnew/3.6.rst:1534 msgid "" -"The :class:`~time.struct_time` attributes :attr:`tm_gmtoff` and :attr:" -"`tm_zone` are now available on all platforms." +"The :class:`~time.struct_time` attributes :attr:`tm_gmtoff` " +"and :attr:`tm_zone` are now available on all platforms." msgstr "" #: ../../whatsnew/3.6.rst:1539 @@ -2269,13 +2279,14 @@ msgstr "tkinter" #: ../../whatsnew/3.6.rst:1554 msgid "" -"Added methods :meth:`~tkinter.Variable.trace_add`, :meth:`~tkinter.Variable." -"trace_remove` and :meth:`~tkinter.Variable.trace_info` in the :class:" -"`tkinter.Variable` class. They replace old methods :meth:`~tkinter.Variable." -"trace_variable`, :meth:`~tkinter.Variable.trace`, :meth:`~tkinter.Variable." -"trace_vdelete` and :meth:`~tkinter.Variable.trace_vinfo` that use obsolete " -"Tcl commands and might not work in future versions of Tcl. (Contributed by " -"Serhiy Storchaka in :issue:`22115`)." +"Added " +"methods :meth:`~tkinter.Variable.trace_add`, :meth:`~tkinter.Variable.trace_remove` " +"and :meth:`~tkinter.Variable.trace_info` in the :class:`tkinter.Variable` " +"class. They replace old " +"methods :meth:`~tkinter.Variable.trace_variable`, :meth:`~tkinter.Variable.trace`, :meth:`~tkinter.Variable.trace_vdelete` " +"and :meth:`~tkinter.Variable.trace_vinfo` that use obsolete Tcl commands and " +"might not work in future versions of Tcl. (Contributed by Serhiy Storchaka " +"in :issue:`22115`)." msgstr "" #: ../../whatsnew/3.6.rst:1567 @@ -2351,22 +2362,22 @@ msgstr "" msgid "" "The :mod:`typing` module has a much improved support for generic type " "aliases. For example ``Dict[str, Tuple[S, T]]`` is now a valid type " -"annotation. (Contributed by Guido van Rossum in `Github #195 <https://github." -"com/python/typing/pull/195>`_.)" +"annotation. (Contributed by Guido van Rossum in `Github #195 <https://" +"github.com/python/typing/pull/195>`_.)" msgstr "" #: ../../whatsnew/3.6.rst:1614 msgid "" -"The :class:`typing.ContextManager` class has been added for representing :" -"class:`contextlib.AbstractContextManager`. (Contributed by Brett Cannon in :" -"issue:`25609`.)" +"The :class:`typing.ContextManager` class has been added for " +"representing :class:`contextlib.AbstractContextManager`. (Contributed by " +"Brett Cannon in :issue:`25609`.)" msgstr "" #: ../../whatsnew/3.6.rst:1618 msgid "" -"The :class:`typing.Collection` class has been added for representing :class:" -"`collections.abc.Collection`. (Contributed by Ivan Levkivskyi in :issue:" -"`27598`.)" +"The :class:`typing.Collection` class has been added for " +"representing :class:`collections.abc.Collection`. (Contributed by Ivan " +"Levkivskyi in :issue:`27598`.)" msgstr "" #: ../../whatsnew/3.6.rst:1622 @@ -2375,16 +2386,16 @@ msgid "" "variables. As introduced in :pep:`526`, a variable annotation wrapped in " "ClassVar indicates that a given attribute is intended to be used as a class " "variable and should not be set on instances of that class. (Contributed by " -"Ivan Levkivskyi in `Github #280 <https://github.com/python/typing/" -"pull/280>`_.)" +"Ivan Levkivskyi in `Github #280 <https://github.com/python/typing/pull/" +"280>`_.)" msgstr "" #: ../../whatsnew/3.6.rst:1629 msgid "" "A new :const:`~typing.TYPE_CHECKING` constant that is assumed to be ``True`` " "by the static type checkers, but is ``False`` at runtime. (Contributed by " -"Guido van Rossum in `Github #230 <https://github.com/python/typing/" -"issues/230>`_.)" +"Guido van Rossum in `Github #230 <https://github.com/python/typing/issues/" +"230>`_.)" msgstr "" #: ../../whatsnew/3.6.rst:1634 @@ -2432,10 +2443,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:1660 msgid "" -"Two new methods, :meth:`Mock.assert_called() <unittest.mock.Mock." -"assert_called>` and :meth:`Mock.assert_called_once() <unittest.mock.Mock." -"assert_called_once>` to check if the mock object was called. (Contributed by " -"Amit Saha in :issue:`26323`.)" +"Two new methods, :meth:`Mock.assert_called() " +"<unittest.mock.Mock.assert_called>` and :meth:`Mock.assert_called_once() " +"<unittest.mock.Mock.assert_called_once>` to check if the mock object was " +"called. (Contributed by Amit Saha in :issue:`26323`.)" msgstr "" #: ../../whatsnew/3.6.rst:1666 @@ -2452,9 +2463,10 @@ msgstr "urllib.request" #: ../../whatsnew/3.6.rst:1675 msgid "" "If a HTTP request has a file or iterable body (other than a bytes object) " -"but no ``Content-Length`` header, rather than throwing an error, :class:" -"`~urllib.request.AbstractHTTPHandler` now falls back to use chunked transfer " -"encoding. (Contributed by Demian Brecht and Rolf Krahl in :issue:`12319`.)" +"but no ``Content-Length`` header, rather than throwing an " +"error, :class:`~urllib.request.AbstractHTTPHandler` now falls back to use " +"chunked transfer encoding. (Contributed by Demian Brecht and Rolf Krahl " +"in :issue:`12319`.)" msgstr "" #: ../../whatsnew/3.6.rst:1683 @@ -2485,11 +2497,11 @@ msgstr "warnings" #: ../../whatsnew/3.6.rst:1701 msgid "" -"A new optional *source* parameter has been added to the :func:`warnings." -"warn_explicit` function: the destroyed object which emitted a :exc:" -"`ResourceWarning`. A *source* attribute has also been added to :class:" -"`warnings.WarningMessage` (contributed by Victor Stinner in :issue:`26568` " -"and :issue:`26567`)." +"A new optional *source* parameter has been added to " +"the :func:`warnings.warn_explicit` function: the destroyed object which " +"emitted a :exc:`ResourceWarning`. A *source* attribute has also been added " +"to :class:`warnings.WarningMessage` (contributed by Victor Stinner " +"in :issue:`26568` and :issue:`26567`)." msgstr "" #: ../../whatsnew/3.6.rst:1707 @@ -2547,9 +2559,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:1730 msgid "" -"The \"Object allocated at\" traceback is new and is only displayed if :mod:" -"`tracemalloc` is tracing Python memory allocations and if the :mod:" -"`warnings` module was already imported." +"The \"Object allocated at\" traceback is new and is only displayed " +"if :mod:`tracemalloc` is tracing Python memory allocations and if " +"the :mod:`warnings` module was already imported." msgstr "" #: ../../whatsnew/3.6.rst:1736 @@ -2568,9 +2580,9 @@ msgstr "winsound" #: ../../whatsnew/3.6.rst:1745 msgid "" -"Allowed keyword arguments to be passed to :func:`Beep <winsound.Beep>`, :" -"func:`MessageBeep <winsound.MessageBeep>`, and :func:`PlaySound <winsound." -"PlaySound>` (:issue:`27982`)." +"Allowed keyword arguments to be passed to :func:`Beep " +"<winsound.Beep>`, :func:`MessageBeep <winsound.MessageBeep>`, " +"and :func:`PlaySound <winsound.PlaySound>` (:issue:`27982`)." msgstr "" #: ../../whatsnew/3.6.rst:1751 @@ -2623,8 +2635,8 @@ msgstr "最佳化" msgid "" "The Python interpreter now uses a 16-bit wordcode instead of bytecode which " "made a number of opcode optimizations possible. (Contributed by Demur Rumed " -"with input and reviews from Serhiy Storchaka and Victor Stinner in :issue:" -"`26647` and :issue:`28050`.)" +"with input and reviews from Serhiy Storchaka and Victor Stinner " +"in :issue:`26647` and :issue:`28050`.)" msgstr "" #: ../../whatsnew/3.6.rst:1790 @@ -2656,8 +2668,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1804 msgid "" "The ASCII and the Latin1 encoders are now up to 3 times as fast for the " -"error handler ``surrogateescape`` (Contributed by Victor Stinner in :issue:" -"`25227`)." +"error handler ``surrogateescape`` (Contributed by Victor Stinner " +"in :issue:`25227`)." msgstr "" #: ../../whatsnew/3.6.rst:1808 @@ -2689,8 +2701,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1822 msgid "" "Optimize :meth:`bytes.fromhex` and :meth:`bytearray.fromhex`: they are now " -"between 2x and 3.5x faster. (Contributed by Victor Stinner in :issue:" -"`25401`)." +"between 2x and 3.5x faster. (Contributed by Victor Stinner " +"in :issue:`25401`)." msgstr "" #: ../../whatsnew/3.6.rst:1825 @@ -2701,19 +2713,19 @@ msgstr "" #: ../../whatsnew/3.6.rst:1828 msgid "" -"Allocator functions of the :c:func:`PyMem_Malloc` domain (:c:macro:" -"`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc memory allocator <pymalloc>` " -"instead of :c:func:`malloc` function of the C library. The pymalloc " -"allocator is optimized for objects smaller or equal to 512 bytes with a " -"short lifetime, and use :c:func:`malloc` for larger memory blocks. " +"Allocator functions of the :c:func:`PyMem_Malloc` domain " +"(:c:macro:`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc memory allocator " +"<pymalloc>` instead of :c:func:`malloc` function of the C library. The " +"pymalloc allocator is optimized for objects smaller or equal to 512 bytes " +"with a short lifetime, and use :c:func:`malloc` for larger memory blocks. " "(Contributed by Victor Stinner in :issue:`26249`)." msgstr "" #: ../../whatsnew/3.6.rst:1835 msgid "" ":func:`pickle.load` and :func:`pickle.loads` are now up to 10% faster when " -"deserializing many small objects (Contributed by Victor Stinner in :issue:" -"`27056`)." +"deserializing many small objects (Contributed by Victor Stinner " +"in :issue:`27056`)." msgstr "" #: ../../whatsnew/3.6.rst:1839 @@ -2727,42 +2739,42 @@ msgstr "" #: ../../whatsnew/3.6.rst:1845 msgid "" -"Optimized :func:`~glob.glob` and :func:`~glob.iglob` functions in the :mod:" -"`glob` module; they are now about 3--6 times faster. (Contributed by Serhiy " -"Storchaka in :issue:`25596`)." +"Optimized :func:`~glob.glob` and :func:`~glob.iglob` functions in " +"the :mod:`glob` module; they are now about 3--6 times faster. (Contributed " +"by Serhiy Storchaka in :issue:`25596`)." msgstr "" #: ../../whatsnew/3.6.rst:1849 msgid "" "Optimized globbing in :mod:`pathlib` by using :func:`os.scandir`; it is now " -"about 1.5--4 times faster. (Contributed by Serhiy Storchaka in :issue:" -"`26032`)." +"about 1.5--4 times faster. (Contributed by Serhiy Storchaka " +"in :issue:`26032`)." msgstr "" #: ../../whatsnew/3.6.rst:1853 msgid "" ":class:`xml.etree.ElementTree` parsing, iteration and deepcopy performance " -"has been significantly improved. (Contributed by Serhiy Storchaka in :issue:" -"`25638`, :issue:`25873`, and :issue:`25869`.)" +"has been significantly improved. (Contributed by Serhiy Storchaka " +"in :issue:`25638`, :issue:`25873`, and :issue:`25869`.)" msgstr "" #: ../../whatsnew/3.6.rst:1858 msgid "" "Creation of :class:`fractions.Fraction` instances from floats and decimals " -"is now 2 to 3 times faster. (Contributed by Serhiy Storchaka in :issue:" -"`25971`.)" +"is now 2 to 3 times faster. (Contributed by Serhiy Storchaka " +"in :issue:`25971`.)" msgstr "" #: ../../whatsnew/3.6.rst:1864 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.6.rst:1866 msgid "" "Python now requires some C99 support in the toolchain to build. Most " "notably, Python now uses standard integer types and macros in place of " -"custom macros like ``PY_LONG_LONG``. For more information, see :pep:`7` and :" -"issue:`17884`." +"custom macros like ``PY_LONG_LONG``. For more information, see :pep:`7` " +"and :issue:`17884`." msgstr "" #: ../../whatsnew/3.6.rst:1871 @@ -2770,8 +2782,8 @@ msgid "" "Cross-compiling CPython with the Android NDK and the Android API level set " "to 21 (Android 5.0 Lollipop) or greater runs successfully. While Android is " "not yet a supported platform, the Python test suite runs on the Android " -"emulator with only about 16 tests failures. See the Android meta-issue :" -"issue:`26865`." +"emulator with only about 16 tests failures. See the Android meta-" +"issue :issue:`26865`." msgstr "" #: ../../whatsnew/3.6.rst:1876 @@ -2818,8 +2830,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1901 msgid "" -"The new :c:func:`PyErr_ResourceWarning` function can be used to generate a :" -"exc:`ResourceWarning` providing the source of the resource allocation. " +"The new :c:func:`PyErr_ResourceWarning` function can be used to generate " +"a :exc:`ResourceWarning` providing the source of the resource allocation. " "(Contributed by Victor Stinner in :issue:`26567`.)" msgstr "" @@ -2838,7 +2850,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:1914 msgid "Other Improvements" -msgstr "" +msgstr "其他改進" #: ../../whatsnew/3.6.rst:1916 msgid "" @@ -2888,16 +2900,16 @@ msgid "" "The :meth:`__aiter__` method is now expected to return an asynchronous " "iterator directly instead of returning an awaitable as previously. Doing the " "former will trigger a :exc:`DeprecationWarning`. Backward compatibility " -"will be removed in Python 3.7. (Contributed by Yury Selivanov in :issue:" -"`27243`.)" +"will be removed in Python 3.7. (Contributed by Yury Selivanov " +"in :issue:`27243`.)" msgstr "" #: ../../whatsnew/3.6.rst:1951 msgid "" "A backslash-character pair that is not a valid escape sequence now generates " -"a :exc:`DeprecationWarning`. Although this will eventually become a :exc:" -"`SyntaxError`, that will not be for several Python releases. (Contributed by " -"Emanuel Barry in :issue:`27364`.)" +"a :exc:`DeprecationWarning`. Although this will eventually become " +"a :exc:`SyntaxError`, that will not be for several Python releases. " +"(Contributed by Emanuel Barry in :issue:`27364`.)" msgstr "" #: ../../whatsnew/3.6.rst:1956 @@ -2948,8 +2960,8 @@ msgstr "" msgid "" "The undocumented ``extra_path`` argument to the ``distutils.Distribution`` " "constructor is now considered deprecated and will raise a warning if set. " -"Support for this parameter will be removed in a future Python release. See :" -"issue:`27919` for details." +"Support for this parameter will be removed in a future Python release. " +"See :issue:`27919` for details." msgstr "" #: ../../whatsnew/3.6.rst:1999 @@ -2964,12 +2976,12 @@ msgstr "" #: ../../whatsnew/3.6.rst:2009 msgid "" -"The :meth:`importlib.machinery.SourceFileLoader.load_module` and :meth:" -"`importlib.machinery.SourcelessFileLoader.load_module` methods are now " -"deprecated. They were the only remaining implementations of :meth:`importlib." -"abc.Loader.load_module` in :mod:`importlib` that had not been deprecated in " -"previous versions of Python in favour of :meth:`importlib.abc.Loader." -"exec_module`." +"The :meth:`importlib.machinery.SourceFileLoader.load_module` " +"and :meth:`importlib.machinery.SourcelessFileLoader.load_module` methods are " +"now deprecated. They were the only remaining implementations " +"of :meth:`importlib.abc.Loader.load_module` in :mod:`importlib` that had not " +"been deprecated in previous versions of Python in favour " +"of :meth:`importlib.abc.Loader.exec_module`." msgstr "" #: ../../whatsnew/3.6.rst:2016 @@ -2983,8 +2995,8 @@ msgstr "" msgid "" "Undocumented support of general :term:`bytes-like objects <bytes-like " "object>` as paths in :mod:`os` functions, :func:`compile` and similar " -"functions is now deprecated. (Contributed by Serhiy Storchaka in :issue:" -"`25791` and :issue:`26754`.)" +"functions is now deprecated. (Contributed by Serhiy Storchaka " +"in :issue:`25791` and :issue:`26754`.)" msgstr "" #: ../../whatsnew/3.6.rst:2031 @@ -3005,9 +3017,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:2043 msgid "" "SSL-related arguments like ``certfile``, ``keyfile`` and ``check_hostname`` " -"in :mod:`ftplib`, :mod:`http.client`, :mod:`imaplib`, :mod:`poplib`, and :" -"mod:`smtplib` have been deprecated in favor of ``context``. (Contributed by " -"Christian Heimes in :issue:`28022`.)" +"in :mod:`ftplib`, :mod:`http.client`, :mod:`imaplib`, :mod:`poplib`, " +"and :mod:`smtplib` have been deprecated in favor of ``context``. " +"(Contributed by Christian Heimes in :issue:`28022`.)" msgstr "" #: ../../whatsnew/3.6.rst:2048 @@ -3038,9 +3050,10 @@ msgstr "xml" #: ../../whatsnew/3.6.rst:2073 msgid "" -"As mitigation against DTD and external entity retrieval, the :mod:`xml.dom." -"minidom` and :mod:`xml.sax` modules no longer process external entities by " -"default. (Contributed by Christian Heimes in :gh:`61441`.)" +"As mitigation against DTD and external entity retrieval, " +"the :mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process " +"external entities by default. (Contributed by Christian Heimes " +"in :gh:`61441`.)" msgstr "" #: ../../whatsnew/3.6.rst:2080 @@ -3050,9 +3063,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:2082 msgid "" "Undocumented functions :c:func:`!PyUnicode_AsEncodedObject`, :c:func:`!" -"PyUnicode_AsDecodedObject`, :c:func:`!PyUnicode_AsEncodedUnicode` and :c:" -"func:`!PyUnicode_AsDecodedUnicode` are deprecated now. Use the :ref:`generic " -"codec based API <codec-registry>` instead." +"PyUnicode_AsDecodedObject`, :c:func:`!PyUnicode_AsEncodedUnicode` " +"and :c:func:`!PyUnicode_AsDecodedUnicode` are deprecated now. Use " +"the :ref:`generic codec based API <codec-registry>` instead." msgstr "" #: ../../whatsnew/3.6.rst:2089 @@ -3074,46 +3087,46 @@ msgstr "已移除" #: ../../whatsnew/3.6.rst:2102 msgid "API and Feature Removals" -msgstr "" +msgstr "API 與功能的移除" #: ../../whatsnew/3.6.rst:2104 msgid "" "Unknown escapes consisting of ``'\\'`` and an ASCII letter in regular " -"expressions will now cause an error. In replacement templates for :func:`re." -"sub` they are still allowed, but deprecated. The :const:`re.LOCALE` flag can " -"now only be used with binary patterns." +"expressions will now cause an error. In replacement templates " +"for :func:`re.sub` they are still allowed, but deprecated. " +"The :const:`re.LOCALE` flag can now only be used with binary patterns." msgstr "" #: ../../whatsnew/3.6.rst:2109 msgid "" -"``inspect.getmoduleinfo()`` was removed (was deprecated since CPython 3.3). :" -"func:`inspect.getmodulename` should be used for obtaining the module name " -"for a given path. (Contributed by Yury Selivanov in :issue:`13248`.)" +"``inspect.getmoduleinfo()`` was removed (was deprecated since CPython " +"3.3). :func:`inspect.getmodulename` should be used for obtaining the module " +"name for a given path. (Contributed by Yury Selivanov in :issue:`13248`.)" msgstr "" #: ../../whatsnew/3.6.rst:2114 msgid "" "``traceback.Ignore`` class and ``traceback.usage``, ``traceback.modname``, " -"``traceback.fullmodname``, ``traceback.find_lines_from_code``, ``traceback." -"find_lines``, ``traceback.find_strings``, ``traceback." -"find_executable_lines`` methods were removed from the :mod:`traceback` " -"module. They were undocumented methods deprecated since Python 3.2 and " -"equivalent functionality is available from private methods." +"``traceback.fullmodname``, ``traceback.find_lines_from_code``, " +"``traceback.find_lines``, ``traceback.find_strings``, " +"``traceback.find_executable_lines`` methods were removed from " +"the :mod:`traceback` module. They were undocumented methods deprecated since " +"Python 3.2 and equivalent functionality is available from private methods." msgstr "" #: ../../whatsnew/3.6.rst:2121 msgid "" -"The ``tk_menuBar()`` and ``tk_bindForTraversal()`` dummy methods in :mod:" -"`tkinter` widget classes were removed (corresponding Tk commands were " -"obsolete since Tk 4.0)." +"The ``tk_menuBar()`` and ``tk_bindForTraversal()`` dummy methods " +"in :mod:`tkinter` widget classes were removed (corresponding Tk commands " +"were obsolete since Tk 4.0)." msgstr "" #: ../../whatsnew/3.6.rst:2125 msgid "" "The :meth:`~zipfile.ZipFile.open` method of the :class:`zipfile.ZipFile` " "class no longer supports the ``'U'`` mode (was deprecated since Python 3.4). " -"Use :class:`io.TextIOWrapper` for reading compressed text files in :term:" -"`universal newlines` mode." +"Use :class:`io.TextIOWrapper` for reading compressed text files " +"in :term:`universal newlines` mode." msgstr "" #: ../../whatsnew/3.6.rst:2130 @@ -3150,19 +3163,19 @@ msgid "" "The output of a special Python build with defined ``COUNT_ALLOCS``, " "``SHOW_ALLOC_COUNT`` or ``SHOW_TRACK_COUNT`` macros is now off by default. " "It can be re-enabled using the ``-X showalloccount`` option. It now outputs " -"to ``stderr`` instead of ``stdout``. (Contributed by Serhiy Storchaka in :" -"issue:`23034`.)" +"to ``stderr`` instead of ``stdout``. (Contributed by Serhiy Storchaka " +"in :issue:`23034`.)" msgstr "" #: ../../whatsnew/3.6.rst:2158 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.6.rst:2160 msgid "" ":func:`open() <open>` will no longer allow combining the ``'U'`` mode flag " -"with ``'+'``. (Contributed by Jeff Balogh and John O'Connor in :issue:" -"`2091`.)" +"with ``'+'``. (Contributed by Jeff Balogh and John O'Connor " +"in :issue:`2091`.)" msgstr "" #: ../../whatsnew/3.6.rst:2164 @@ -3179,8 +3192,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:2170 msgid "" -"When :meth:`importlib.abc.Loader.exec_module` is defined, :meth:`importlib." -"abc.Loader.create_module` must also be defined." +"When :meth:`importlib.abc.Loader.exec_module` is " +"defined, :meth:`importlib.abc.Loader.create_module` must also be defined." msgstr "" #: ../../whatsnew/3.6.rst:2173 @@ -3193,13 +3206,14 @@ msgstr "" msgid "" "The format of the :attr:`~codeobject.co_lnotab` attribute of code objects " "changed to support a negative line number delta. By default, Python does not " -"emit bytecode with a negative line number delta. Functions using :attr:" -"`frame.f_lineno`, ``PyFrame_GetLineNumber()`` or ``PyCode_Addr2Line()`` are " -"not affected. Functions directly decoding :attr:`!co_lnotab` should be " -"updated to use a signed 8-bit integer type for the line number delta, but " -"this is only required to support applications using a negative line number " -"delta. See ``Objects/lnotab_notes.txt`` for the :attr:`!co_lnotab` format " -"and how to decode it, and see the :pep:`511` for the rationale." +"emit bytecode with a negative line number delta. Functions " +"using :attr:`frame.f_lineno`, ``PyFrame_GetLineNumber()`` or " +"``PyCode_Addr2Line()`` are not affected. Functions directly decoding :attr:`!" +"co_lnotab` should be updated to use a signed 8-bit integer type for the line " +"number delta, but this is only required to support applications using a " +"negative line number delta. See ``Objects/lnotab_notes.txt`` for the :attr:`!" +"co_lnotab` format and how to decode it, and see the :pep:`511` for the " +"rationale." msgstr "" #: ../../whatsnew/3.6.rst:2187 @@ -3212,28 +3226,26 @@ msgstr "" #: ../../whatsnew/3.6.rst:2192 msgid "" -"Reading the :attr:`~urllib.parse.SplitResult.port` attribute of :func:" -"`urllib.parse.urlsplit` and :func:`~urllib.parse.urlparse` results now " -"raises :exc:`ValueError` for out-of-range values, rather than returning :" -"const:`None`. See :issue:`20059`." +"Reading the :attr:`~urllib.parse.SplitResult.port` attribute " +"of :func:`urllib.parse.urlsplit` and :func:`~urllib.parse.urlparse` results " +"now raises :exc:`ValueError` for out-of-range values, rather than " +"returning :const:`None`. See :issue:`20059`." msgstr "" #: ../../whatsnew/3.6.rst:2197 msgid "" -"The :mod:`!imp` module now raises a :exc:`DeprecationWarning` instead of :" -"exc:`PendingDeprecationWarning`." +"The :mod:`!imp` module now raises a :exc:`DeprecationWarning` instead " +"of :exc:`PendingDeprecationWarning`." msgstr "" #: ../../whatsnew/3.6.rst:2200 msgid "" "The following modules have had missing APIs added to their :attr:`__all__` " -"attributes to match the documented APIs: :mod:`calendar`, :mod:`!cgi`, :mod:" -"`csv`, :mod:`~xml.etree.ElementTree`, :mod:`enum`, :mod:`fileinput`, :mod:" -"`ftplib`, :mod:`logging`, :mod:`mailbox`, :mod:`mimetypes`, :mod:" -"`optparse`, :mod:`plistlib`, :mod:`!smtpd`, :mod:`subprocess`, :mod:" -"`tarfile`, :mod:`threading` and :mod:`wave`. This means they will export " -"new symbols when ``import *`` is used. (Contributed by Joel Taddei and Jacek " -"Kołodziej in :issue:`23883`.)" +"attributes to match the documented APIs: :mod:`calendar`, :mod:`!" +"cgi`, :mod:`csv`, :mod:`~xml.etree.ElementTree`, :mod:`enum`, :mod:`fileinput`, :mod:`ftplib`, :mod:`logging`, :mod:`mailbox`, :mod:`mimetypes`, :mod:`optparse`, :mod:`plistlib`, :mod:`!" +"smtpd`, :mod:`subprocess`, :mod:`tarfile`, :mod:`threading` " +"and :mod:`wave`. This means they will export new symbols when ``import *`` " +"is used. (Contributed by Joel Taddei and Jacek Kołodziej in :issue:`23883`.)" msgstr "" #: ../../whatsnew/3.6.rst:2211 @@ -3245,26 +3257,27 @@ msgstr "" #: ../../whatsnew/3.6.rst:2215 msgid "" -"When a relative import is performed and no parent package is known, then :" -"exc:`ImportError` will be raised. Previously, :exc:`SystemError` could be " -"raised. (Contributed by Brett Cannon in :issue:`18018`.)" +"When a relative import is performed and no parent package is known, " +"then :exc:`ImportError` will be raised. Previously, :exc:`SystemError` could " +"be raised. (Contributed by Brett Cannon in :issue:`18018`.)" msgstr "" #: ../../whatsnew/3.6.rst:2219 msgid "" -"Servers based on the :mod:`socketserver` module, including those defined in :" -"mod:`http.server`, :mod:`xmlrpc.server` and :mod:`wsgiref.simple_server`, " -"now only catch exceptions derived from :exc:`Exception`. Therefore if a " -"request handler raises an exception like :exc:`SystemExit` or :exc:" -"`KeyboardInterrupt`, :meth:`~socketserver.BaseServer.handle_error` is no " -"longer called, and the exception will stop a single-threaded server. " +"Servers based on the :mod:`socketserver` module, including those defined " +"in :mod:`http.server`, :mod:`xmlrpc.server` " +"and :mod:`wsgiref.simple_server`, now only catch exceptions derived " +"from :exc:`Exception`. Therefore if a request handler raises an exception " +"like :exc:`SystemExit` " +"or :exc:`KeyboardInterrupt`, :meth:`~socketserver.BaseServer.handle_error` " +"is no longer called, and the exception will stop a single-threaded server. " "(Contributed by Martin Panter in :issue:`23430`.)" msgstr "" #: ../../whatsnew/3.6.rst:2228 msgid "" -":func:`!spwd.getspnam` now raises a :exc:`PermissionError` instead of :exc:" -"`KeyError` if the user doesn't have privileges." +":func:`!spwd.getspnam` now raises a :exc:`PermissionError` instead " +"of :exc:`KeyError` if the user doesn't have privileges." msgstr "" #: ../../whatsnew/3.6.rst:2231 @@ -3286,11 +3299,12 @@ msgstr "" #: ../../whatsnew/3.6.rst:2243 msgid "" -"All optional arguments of the :func:`~json.dump`, :func:`~json.dumps`, :func:" -"`~json.load` and :func:`~json.loads` functions and :class:`~json." -"JSONEncoder` and :class:`~json.JSONDecoder` class constructors in the :mod:" -"`json` module are now :ref:`keyword-only <keyword-only_parameter>`. " -"(Contributed by Serhiy Storchaka in :issue:`18726`.)" +"All optional arguments of " +"the :func:`~json.dump`, :func:`~json.dumps`, :func:`~json.load` " +"and :func:`~json.loads` functions and :class:`~json.JSONEncoder` " +"and :class:`~json.JSONDecoder` class constructors in the :mod:`json` module " +"are now :ref:`keyword-only <keyword-only_parameter>`. (Contributed by Serhiy " +"Storchaka in :issue:`18726`.)" msgstr "" #: ../../whatsnew/3.6.rst:2250 @@ -3301,14 +3315,15 @@ msgstr "" #: ../../whatsnew/3.6.rst:2253 msgid "" -"As part of :pep:`487`, the handling of keyword arguments passed to :class:" -"`type` (other than the metaclass hint, ``metaclass``) is now consistently " -"delegated to :meth:`object.__init_subclass__`. This means that :meth:`type." -"__new__` and :meth:`type.__init__` both now accept arbitrary keyword " -"arguments, but :meth:`object.__init_subclass__` (which is called from :meth:" -"`type.__new__`) will reject them by default. Custom metaclasses accepting " -"additional keyword arguments will need to adjust their calls to :meth:`type." -"__new__` (whether direct or via :class:`super`) accordingly." +"As part of :pep:`487`, the handling of keyword arguments passed " +"to :class:`type` (other than the metaclass hint, ``metaclass``) is now " +"consistently delegated to :meth:`object.__init_subclass__`. This means " +"that :meth:`type.__new__` and :meth:`type.__init__` both now accept " +"arbitrary keyword arguments, but :meth:`object.__init_subclass__` (which is " +"called from :meth:`type.__new__`) will reject them by default. Custom " +"metaclasses accepting additional keyword arguments will need to adjust their " +"calls to :meth:`type.__new__` (whether direct or via :class:`super`) " +"accordingly." msgstr "" #: ../../whatsnew/3.6.rst:2262 @@ -3337,26 +3352,27 @@ msgstr "" #: ../../whatsnew/3.6.rst:2278 msgid "" -"In the :mod:`urllib.request` module and the :meth:`http.client." -"HTTPConnection.request` method, if no Content-Length header field has been " -"specified and the request body is a file object, it is now sent with HTTP " -"1.1 chunked encoding. If a file object has to be sent to a HTTP 1.0 server, " -"the Content-Length value now has to be specified by the caller. (Contributed " -"by Demian Brecht and Rolf Krahl with tweaks from Martin Panter in :issue:" -"`12319`.)" +"In the :mod:`urllib.request` module and " +"the :meth:`http.client.HTTPConnection.request` method, if no Content-Length " +"header field has been specified and the request body is a file object, it is " +"now sent with HTTP 1.1 chunked encoding. If a file object has to be sent to " +"a HTTP 1.0 server, the Content-Length value now has to be specified by the " +"caller. (Contributed by Demian Brecht and Rolf Krahl with tweaks from Martin " +"Panter in :issue:`12319`.)" msgstr "" #: ../../whatsnew/3.6.rst:2287 msgid "" -"The :class:`~csv.DictReader` now returns rows of type :class:`~collections." -"OrderedDict`. (Contributed by Steve Holden in :issue:`27842`.)" +"The :class:`~csv.DictReader` now returns rows of " +"type :class:`~collections.OrderedDict`. (Contributed by Steve Holden " +"in :issue:`27842`.)" msgstr "" #: ../../whatsnew/3.6.rst:2291 msgid "" -"The :const:`!crypt.METHOD_CRYPT` will no longer be added to ``crypt." -"methods`` if unsupported by the platform. (Contributed by Victor Stinner in :" -"issue:`25287`.)" +"The :const:`!crypt.METHOD_CRYPT` will no longer be added to " +"``crypt.methods`` if unsupported by the platform. (Contributed by Victor " +"Stinner in :issue:`25287`.)" msgstr "" #: ../../whatsnew/3.6.rst:2299 @@ -3375,8 +3391,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:2308 msgid "" "The :func:`mmap.write() <mmap.write>` function now returns the number of " -"bytes written like other write methods. (Contributed by Jakub Stasiak in :" -"issue:`26335`.)" +"bytes written like other write methods. (Contributed by Jakub Stasiak " +"in :issue:`26335`.)" msgstr "" #: ../../whatsnew/3.6.rst:2312 @@ -3401,8 +3417,8 @@ msgid "" "unrecognized compression values. Previously a plain :exc:`RuntimeError` was " "raised. Additionally, calling :class:`~zipfile.ZipFile` methods on a closed " "ZipFile or calling the :meth:`~zipfile.ZipFile.write` method on a ZipFile " -"created with mode ``'r'`` will raise a :exc:`ValueError`. Previously, a :exc:" -"`RuntimeError` was raised in those scenarios." +"created with mode ``'r'`` will raise a :exc:`ValueError`. Previously, " +"a :exc:`RuntimeError` was raised in those scenarios." msgstr "" #: ../../whatsnew/3.6.rst:2329 @@ -3419,13 +3435,14 @@ msgstr "" msgid "" "With the introduction of :exc:`ModuleNotFoundError`, import system consumers " "may start expecting import system replacements to raise that more specific " -"exception when appropriate, rather than the less-specific :exc:" -"`ImportError`. To provide future compatibility with such consumers, " -"implementers of alternative import systems that completely replace :func:" -"`__import__` will need to update their implementations to raise the new " -"subclass when a module can't be found at all. Implementers of compliant " -"plugins to the default import system shouldn't need to make any changes, as " -"the default import system will raise the new subclass when appropriate." +"exception when appropriate, rather than the less-" +"specific :exc:`ImportError`. To provide future compatibility with such " +"consumers, implementers of alternative import systems that completely " +"replace :func:`__import__` will need to update their implementations to " +"raise the new subclass when a module can't be found at all. Implementers of " +"compliant plugins to the default import system shouldn't need to make any " +"changes, as the default import system will raise the new subclass when " +"appropriate." msgstr "" #: ../../whatsnew/3.6.rst:2348 @@ -3467,15 +3484,15 @@ msgstr "" msgid "" "The new :opcode:`!FORMAT_VALUE` and :opcode:`BUILD_STRING` opcodes as part " "of the :ref:`formatted string literal <whatsnew36-pep498>` implementation. " -"(Contributed by Eric Smith in :issue:`25483` and Serhiy Storchaka in :issue:" -"`27078`.)" +"(Contributed by Eric Smith in :issue:`25483` and Serhiy Storchaka " +"in :issue:`27078`.)" msgstr "" #: ../../whatsnew/3.6.rst:2374 msgid "" "The new :opcode:`BUILD_CONST_KEY_MAP` opcode to optimize the creation of " -"dictionaries with constant keys. (Contributed by Serhiy Storchaka in :issue:" -"`27140`.)" +"dictionaries with constant keys. (Contributed by Serhiy Storchaka " +"in :issue:`27140`.)" msgstr "" #: ../../whatsnew/3.6.rst:2378 @@ -3483,11 +3500,11 @@ msgid "" "The function call opcodes have been heavily reworked for better performance " "and simpler implementation. The :opcode:`MAKE_FUNCTION`, :opcode:`!" "CALL_FUNCTION`, :opcode:`!CALL_FUNCTION_KW` and :opcode:`!" -"BUILD_MAP_UNPACK_WITH_CALL` opcodes have been modified, the new :opcode:" -"`CALL_FUNCTION_EX` and :opcode:`!BUILD_TUPLE_UNPACK_WITH_CALL` have been " -"added, and ``CALL_FUNCTION_VAR``, ``CALL_FUNCTION_VAR_KW`` and " -"``MAKE_CLOSURE`` opcodes have been removed. (Contributed by Demur Rumed in :" -"issue:`27095`, and Serhiy Storchaka in :issue:`27213`, :issue:`28257`.)" +"BUILD_MAP_UNPACK_WITH_CALL` opcodes have been modified, the " +"new :opcode:`CALL_FUNCTION_EX` and :opcode:`!BUILD_TUPLE_UNPACK_WITH_CALL` " +"have been added, and ``CALL_FUNCTION_VAR``, ``CALL_FUNCTION_VAR_KW`` and " +"``MAKE_CLOSURE`` opcodes have been removed. (Contributed by Demur Rumed " +"in :issue:`27095`, and Serhiy Storchaka in :issue:`27213`, :issue:`28257`.)" msgstr "" #: ../../whatsnew/3.6.rst:2389 @@ -3522,8 +3539,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:2409 msgid "" -"More selective regeneration targets are also defined - see :source:`Makefile." -"pre.in` for details." +"More selective regeneration targets are also defined - " +"see :source:`Makefile.pre.in` for details." msgstr "" #: ../../whatsnew/3.6.rst:2412 ../../whatsnew/3.6.rst:2425 @@ -3553,8 +3570,8 @@ msgstr "Python 3.6.4 中顯著的變更" msgid "" "The ``PyExc_RecursionErrorInst`` singleton that was part of the public API " "has been removed as its members being never cleared may cause a segfault " -"during finalization of the interpreter. (Contributed by Xavier de Gaye in :" -"issue:`22898` and :issue:`30697`.)" +"during finalization of the interpreter. (Contributed by Xavier de Gaye " +"in :issue:`22898` and :issue:`30697`.)" msgstr "" #: ../../whatsnew/3.6.rst:2440 @@ -3592,12 +3609,12 @@ msgstr "Python 3.6.10 中顯著的變更" #: ../../whatsnew/3.6.rst:2461 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" #: ../../whatsnew/3.6.rst:2469 @@ -3607,13 +3624,14 @@ msgstr "Python 3.6.13 中顯著的變更" #: ../../whatsnew/3.6.rst:2471 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" msgstr "" #: ../../whatsnew/3.6.rst:2482 @@ -3635,6 +3653,6 @@ msgid "" "forms of attacks. Following the WHATWG specification that updates RFC 3986, " "ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are stripped from " "the URL by the parser :func:`urllib.parse` preventing such attacks. The " -"removal characters are controlled by a new module level variable ``urllib." -"parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" +"removal characters are controlled by a new module level variable " +"``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 9416588394..25a4bd766c 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -29,8 +29,8 @@ msgstr "Elvis Pranskevichus <elvis@magic.io>" #: ../../whatsnew/3.7.rst:47 msgid "" "This article explains the new features in Python 3.7, compared to 3.6. " -"Python 3.7 was released on June 27, 2018. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.7 was released on June 27, 2018. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.7 與 3.6 相比多了哪些新功能。Python 3.7 已於 2018 年 6 " "月 27 日發布。有關完整詳細資訊,請參閱 :ref:`changelog <changelog>`。" @@ -111,8 +111,9 @@ msgstr "標準函式庫中的顯著改進" #: ../../whatsnew/3.7.rst:92 msgid "" -"The :mod:`asyncio` module has received new features, significant :ref:" -"`usability and performance improvements <whatsnew37_asyncio>`." +"The :mod:`asyncio` module has received new features, " +"significant :ref:`usability and performance improvements " +"<whatsnew37_asyncio>`." msgstr "" #: ../../whatsnew/3.7.rst:95 @@ -123,7 +124,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:98 msgid "CPython implementation improvements:" -msgstr "" +msgstr "CPython 實作改進:" #: ../../whatsnew/3.7.rst:100 msgid "Avoiding the use of ASCII as a default text encoding:" @@ -170,14 +171,14 @@ msgstr "" #: ../../whatsnew/3.7.rst:116 msgid "" "New documentation translations: `Japanese <https://docs.python.org/ja/>`_, " -"`French <https://docs.python.org/fr/>`_, and `Korean <https://docs.python." -"org/ko/>`_." +"`French <https://docs.python.org/fr/>`_, and `Korean <https://" +"docs.python.org/ko/>`_." msgstr "" #: ../../whatsnew/3.7.rst:120 msgid "" -"This release features notable performance improvements in many areas. The :" -"ref:`whatsnew37-perf` section lists them in detail." +"This release features notable performance improvements in many areas. " +"The :ref:`whatsnew37-perf` section lists them in detail." msgstr "" #: ../../whatsnew/3.7.rst:123 @@ -192,7 +193,7 @@ msgstr "新增功能" #: ../../whatsnew/3.7.rst:133 msgid "PEP 563: Postponed Evaluation of Annotations" -msgstr "" +msgstr "PEP 563:延後評估註釋" #: ../../whatsnew/3.7.rst:135 msgid "" @@ -295,9 +296,9 @@ msgid "" "automatically coerce that locale to an available UTF-8 based locale as " "described in the documentation of the new :envvar:`PYTHONCOERCECLOCALE` " "environment variable. Automatically setting ``LC_CTYPE`` this way means that " -"both the core interpreter and locale-aware C extensions (such as :mod:" -"`readline`) will assume the use of UTF-8 as the default text encoding, " -"rather than ASCII." +"both the core interpreter and locale-aware C extensions (such " +"as :mod:`readline`) will assume the use of UTF-8 as the default text " +"encoding, rather than ASCII." msgstr "" #: ../../whatsnew/3.7.rst:200 @@ -310,16 +311,17 @@ msgstr "" msgid "" "As part of this change, the default error handler for :data:`~sys.stdin` " "and :data:`~sys.stdout` is now ``surrogateescape`` (rather than ``strict``) " -"when using any of the defined coercion target locales (currently ``C." -"UTF-8``, ``C.utf8``, and ``UTF-8``). The default error handler for :data:" -"`~sys.stderr` continues to be ``backslashreplace``, regardless of locale." +"when using any of the defined coercion target locales (currently " +"``C.UTF-8``, ``C.utf8``, and ``UTF-8``). The default error handler " +"for :data:`~sys.stderr` continues to be ``backslashreplace``, regardless of " +"locale." msgstr "" #: ../../whatsnew/3.7.rst:209 msgid "" "Locale coercion is silent by default, but to assist in debugging potentially " -"locale related integration problems, explicit warnings (emitted directly on :" -"data:`~sys.stderr`) can be requested by setting " +"locale related integration problems, explicit warnings (emitted directly " +"on :data:`~sys.stderr`) can be requested by setting " "``PYTHONCOERCECLOCALE=warn``. This setting will also cause the Python " "runtime to emit a warning if the legacy C locale remains active when the " "core interpreter is initialized." @@ -358,8 +360,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:238 msgid "" "When in UTF-8 mode, CPython ignores the locale settings, and uses the UTF-8 " -"encoding by default. The error handlers for :data:`sys.stdin` and :data:" -"`sys.stdout` streams are set to ``surrogateescape``." +"encoding by default. The error handlers for :data:`sys.stdin` " +"and :data:`sys.stdout` streams are set to ``surrogateescape``." msgstr "" #: ../../whatsnew/3.7.rst:242 @@ -410,9 +412,10 @@ msgid "" "Built-in ``breakpoint()`` calls :func:`sys.breakpointhook`. By default, the " "latter imports :mod:`pdb` and then calls ``pdb.set_trace()``, but by binding " "``sys.breakpointhook()`` to the function of your choosing, ``breakpoint()`` " -"can enter any debugger. Additionally, the environment variable :envvar:" -"`PYTHONBREAKPOINT` can be set to the callable of your debugger of choice. " -"Set ``PYTHONBREAKPOINT=0`` to completely disable built-in ``breakpoint()``." +"can enter any debugger. Additionally, the environment " +"variable :envvar:`PYTHONBREAKPOINT` can be set to the callable of your " +"debugger of choice. Set ``PYTHONBREAKPOINT=0`` to completely disable built-" +"in ``breakpoint()``." msgstr "" #: ../../whatsnew/3.7.rst:282 @@ -441,11 +444,11 @@ msgid "" ":pep:`539` changes this by providing a new :ref:`Thread Specific Storage " "(TSS) API <thread-specific-storage-api>` to CPython which supersedes use of " "the existing TLS API within the CPython interpreter, while deprecating the " -"existing API. The TSS API uses a new type :c:type:`Py_tss_t` instead of :c:" -"expr:`int` to represent TSS keys--an opaque type the definition of which may " -"depend on the underlying TLS implementation. Therefore, this will allow to " -"build CPython on platforms where the native TLS key is defined in a way that " -"cannot be safely cast to :c:expr:`int`." +"existing API. The TSS API uses a new type :c:type:`Py_tss_t` instead " +"of :c:expr:`int` to represent TSS keys--an opaque type the definition of " +"which may depend on the underlying TLS implementation. Therefore, this will " +"allow to build CPython on platforms where the native TLS key is defined in a " +"way that cannot be safely cast to :c:expr:`int`." msgstr "" #: ../../whatsnew/3.7.rst:306 @@ -472,8 +475,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:323 msgid "" "Python 3.7 allows defining :meth:`__getattr__` on modules and will call it " -"whenever a module attribute is otherwise not found. Defining :meth:" -"`__dir__` on modules is now also allowed." +"whenever a module attribute is otherwise not found. " +"Defining :meth:`__dir__` on modules is now also allowed." msgstr "" #: ../../whatsnew/3.7.rst:327 @@ -587,10 +590,11 @@ msgstr "" #: ../../whatsnew/3.7.rst:393 msgid "" -"Previously both :exc:`DeprecationWarning` and :exc:" -"`PendingDeprecationWarning` were only visible when running tests, which " -"meant that developers primarily writing single file scripts or using Python " -"interactively could be surprised by breaking changes in the APIs they used." +"Previously both :exc:`DeprecationWarning` " +"and :exc:`PendingDeprecationWarning` were only visible when running tests, " +"which meant that developers primarily writing single file scripts or using " +"Python interactively could be surprised by breaking changes in the APIs they " +"used." msgstr "" #: ../../whatsnew/3.7.rst:400 @@ -608,14 +612,14 @@ msgstr "" #: ../../whatsnew/3.7.rst:409 msgid "" "Initially :pep:`484` was designed in such way that it would not introduce " -"*any* changes to the core CPython interpreter. Now type hints and the :mod:" -"`typing` module are extensively used by the community, so this restriction " -"is removed. The PEP introduces two special methods :meth:`__class_getitem__` " -"and ``__mro_entries__``, these methods are now used by most classes and " -"special constructs in :mod:`typing`. As a result, the speed of various " -"operations with types increased up to 7 times, the generic types can be used " -"without metaclass conflicts, and several long standing bugs in :mod:`typing` " -"module are fixed." +"*any* changes to the core CPython interpreter. Now type hints and " +"the :mod:`typing` module are extensively used by the community, so this " +"restriction is removed. The PEP introduces two special " +"methods :meth:`__class_getitem__` and ``__mro_entries__``, these methods are " +"now used by most classes and special constructs in :mod:`typing`. As a " +"result, the speed of various operations with types increased up to 7 times, " +"the generic types can be used without metaclass conflicts, and several long " +"standing bugs in :mod:`typing` module are fixed." msgstr "" #: ../../whatsnew/3.7.rst:421 @@ -644,8 +648,8 @@ msgid "" "used for invalidation instead of the source timestamp. Such ``.pyc`` files " "are called \"hash-based\". By default, Python still uses timestamp-based " "invalidation and does not generate hash-based ``.pyc`` files at runtime. " -"Hash-based ``.pyc`` files may be generated with :mod:`py_compile` or :mod:" -"`compileall`." +"Hash-based ``.pyc`` files may be generated with :mod:`py_compile` " +"or :mod:`compileall`." msgstr "" #: ../../whatsnew/3.7.rst:445 @@ -712,12 +716,12 @@ msgstr "" #: ../../whatsnew/3.7.rst:486 msgid "" -"The new :option:`-X` ``dev`` command line option or the new :envvar:" -"`PYTHONDEVMODE` environment variable can be used to enable :ref:`Python " -"Development Mode <devmode>`. When in development mode, Python performs " -"additional runtime checks that are too expensive to be enabled by default. " -"See :ref:`Python Development Mode <devmode>` documentation for the full " -"description." +"The new :option:`-X` ``dev`` command line option or the " +"new :envvar:`PYTHONDEVMODE` environment variable can be used to " +"enable :ref:`Python Development Mode <devmode>`. When in development mode, " +"Python performs additional runtime checks that are too expensive to be " +"enabled by default. See :ref:`Python Development Mode <devmode>` " +"documentation for the full description." msgstr "" #: ../../whatsnew/3.7.rst:495 @@ -726,17 +730,17 @@ msgstr "其他語言更動" #: ../../whatsnew/3.7.rst:497 msgid "" -"An :keyword:`await` expression and comprehensions containing an :keyword:" -"`async for` clause were illegal in the expressions in :ref:`formatted string " -"literals <f-strings>` due to a problem with the implementation. In Python " -"3.7 this restriction was lifted." +"An :keyword:`await` expression and comprehensions containing " +"an :keyword:`async for` clause were illegal in the expressions " +"in :ref:`formatted string literals <f-strings>` due to a problem with the " +"implementation. In Python 3.7 this restriction was lifted." msgstr "" #: ../../whatsnew/3.7.rst:502 msgid "" "More than 255 arguments can now be passed to a function, and a function can " -"now have more than 255 parameters. (Contributed by Serhiy Storchaka in :" -"issue:`12844` and :issue:`18896`.)" +"now have more than 255 parameters. (Contributed by Serhiy Storchaka " +"in :issue:`12844` and :issue:`18896`.)" msgstr "" #: ../../whatsnew/3.7.rst:506 @@ -756,8 +760,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:514 msgid "" ":exc:`ImportError` now displays module name and module ``__file__`` path " -"when ``from ... import ...`` fails. (Contributed by Matthias Bussonnier in :" -"issue:`29546`.)" +"when ``from ... import ...`` fails. (Contributed by Matthias Bussonnier " +"in :issue:`29546`.)" msgstr "" #: ../../whatsnew/3.7.rst:518 @@ -769,16 +773,17 @@ msgstr "" #: ../../whatsnew/3.7.rst:522 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " -"``format(str(self), '')``. (Contributed by Serhiy Storchaka in :issue:" -"`28974`.)" +"``format(str(self), '')``. (Contributed by Serhiy Storchaka " +"in :issue:`28974`.)" msgstr "" #: ../../whatsnew/3.7.rst:526 msgid "" -"In order to better support dynamic creation of stack traces, :class:`types." -"TracebackType` can now be instantiated from Python code, and the :attr:" -"`~traceback.tb_next` attribute on :ref:`tracebacks <traceback-objects>` is " -"now writable. (Contributed by Nathaniel J. Smith in :issue:`30579`.)" +"In order to better support dynamic creation of stack " +"traces, :class:`types.TracebackType` can now be instantiated from Python " +"code, and the :attr:`~traceback.tb_next` attribute on :ref:`tracebacks " +"<traceback-objects>` is now writable. (Contributed by Nathaniel J. Smith " +"in :issue:`30579`.)" msgstr "" #: ../../whatsnew/3.7.rst:532 @@ -791,9 +796,10 @@ msgstr "" #: ../../whatsnew/3.7.rst:538 msgid "" -"The new :option:`-X` ``importtime`` option or the :envvar:" -"`PYTHONPROFILEIMPORTTIME` environment variable can be used to show the " -"timing of each module import. (Contributed by Inada Naoki in :issue:`31415`.)" +"The new :option:`-X` ``importtime`` option or " +"the :envvar:`PYTHONPROFILEIMPORTTIME` environment variable can be used to " +"show the timing of each module import. (Contributed by Inada Naoki " +"in :issue:`31415`.)" msgstr "" #: ../../whatsnew/3.7.rst:545 @@ -836,9 +842,9 @@ msgstr "dataclasses" msgid "" "The new :func:`~dataclasses.dataclass` decorator provides a way to declare " "*data classes*. A data class describes its attributes using class variable " -"annotations. Its constructor and other magic methods, such as :meth:" -"`~object.__repr__`, :meth:`~object.__eq__`, and :meth:`~object.__hash__` are " -"generated automatically." +"annotations. Its constructor and other magic methods, such " +"as :meth:`~object.__repr__`, :meth:`~object.__eq__`, " +"and :meth:`~object.__hash__` are generated automatically." msgstr "" #: ../../whatsnew/3.7.rst:580 @@ -874,10 +880,10 @@ msgid "" "The new :mod:`importlib.resources` module provides several new APIs and one " "new ABC for access to, opening, and reading *resources* inside packages. " "Resources are roughly similar to files inside packages, but they needn't be " -"actual files on the physical file system. Module loaders can provide a :" -"meth:`get_resource_reader` function which returns a :class:`importlib.abc." -"ResourceReader` instance to support this new API. Built-in file path " -"loaders and zip file loaders both support this." +"actual files on the physical file system. Module loaders can provide " +"a :meth:`get_resource_reader` function which returns " +"a :class:`importlib.abc.ResourceReader` instance to support this new API. " +"Built-in file path loaders and zip file loaders both support this." msgstr "" #: ../../whatsnew/3.7.rst:610 @@ -900,9 +906,9 @@ msgstr "argparse" #: ../../whatsnew/3.7.rst:625 msgid "" -"The new :meth:`ArgumentParser.parse_intermixed_args() <argparse." -"ArgumentParser.parse_intermixed_args>` method allows intermixing options and " -"positional arguments. (Contributed by paul.j3 in :issue:`14191`.)" +"The new :meth:`ArgumentParser.parse_intermixed_args() " +"<argparse.ArgumentParser.parse_intermixed_args>` method allows intermixing " +"options and positional arguments. (Contributed by paul.j3 in :issue:`14191`.)" msgstr "" #: ../../whatsnew/3.7.rst:634 ../../whatsnew/3.7.rst:1964 @@ -911,29 +917,29 @@ msgstr "asyncio" #: ../../whatsnew/3.7.rst:636 msgid "" -"The :mod:`asyncio` module has received many new features, usability and :ref:" -"`performance improvements <whatsnew37-asyncio-perf>`. Notable changes " -"include:" +"The :mod:`asyncio` module has received many new features, usability " +"and :ref:`performance improvements <whatsnew37-asyncio-perf>`. Notable " +"changes include:" msgstr "" #: ../../whatsnew/3.7.rst:640 msgid "" "The new :term:`provisional <provisional API>` :func:`asyncio.run` function " "can be used to run a coroutine from synchronous code by automatically " -"creating and destroying the event loop. (Contributed by Yury Selivanov in :" -"issue:`32314`.)" +"creating and destroying the event loop. (Contributed by Yury Selivanov " +"in :issue:`32314`.)" msgstr "" #: ../../whatsnew/3.7.rst:645 msgid "" "asyncio gained support for :mod:`contextvars`. :meth:`loop.call_soon() " -"<asyncio.loop.call_soon>`, :meth:`loop.call_soon_threadsafe() <asyncio.loop." -"call_soon_threadsafe>`, :meth:`loop.call_later() <asyncio.loop." -"call_later>`, :meth:`loop.call_at() <asyncio.loop.call_at>`, and :meth:" -"`Future.add_done_callback() <asyncio.Future.add_done_callback>` have a new " -"optional keyword-only *context* parameter. :class:`Tasks <asyncio.Task>` now " -"track their context automatically. See :pep:`567` for more details. " -"(Contributed by Yury Selivanov in :issue:`32436`.)" +"<asyncio.loop.call_soon>`, :meth:`loop.call_soon_threadsafe() " +"<asyncio.loop.call_soon_threadsafe>`, :meth:`loop.call_later() " +"<asyncio.loop.call_later>`, :meth:`loop.call_at() <asyncio.loop.call_at>`, " +"and :meth:`Future.add_done_callback() <asyncio.Future.add_done_callback>` " +"have a new optional keyword-only *context* parameter. :class:`Tasks " +"<asyncio.Task>` now track their context automatically. See :pep:`567` for " +"more details. (Contributed by Yury Selivanov in :issue:`32436`.)" msgstr "" #: ../../whatsnew/3.7.rst:656 @@ -946,25 +952,26 @@ msgstr "" #: ../../whatsnew/3.7.rst:660 msgid "" "The new :meth:`loop.start_tls() <asyncio.loop.start_tls>` method can be used " -"to upgrade an existing connection to TLS. (Contributed by Yury Selivanov in :" -"issue:`23749`.)" +"to upgrade an existing connection to TLS. (Contributed by Yury Selivanov " +"in :issue:`23749`.)" msgstr "" #: ../../whatsnew/3.7.rst:664 msgid "" "The new :meth:`loop.sock_recv_into() <asyncio.loop.sock_recv_into>` method " "allows reading data from a socket directly into a provided buffer making it " -"possible to reduce data copies. (Contributed by Antoine Pitrou in :issue:" -"`31819`.)" +"possible to reduce data copies. (Contributed by Antoine Pitrou " +"in :issue:`31819`.)" msgstr "" #: ../../whatsnew/3.7.rst:669 msgid "" -"The new :func:`asyncio.current_task` function returns the currently running :" -"class:`~asyncio.Task` instance, and the new :func:`asyncio.all_tasks` " -"function returns a set of all existing ``Task`` instances in a given loop. " -"The :meth:`!Task.current_task` and :meth:`!Task.all_tasks` methods have been " -"deprecated. (Contributed by Andrew Svetlov in :issue:`32250`.)" +"The new :func:`asyncio.current_task` function returns the currently " +"running :class:`~asyncio.Task` instance, and the " +"new :func:`asyncio.all_tasks` function returns a set of all existing " +"``Task`` instances in a given loop. The :meth:`!Task.current_task` " +"and :meth:`!Task.all_tasks` methods have been deprecated. (Contributed by " +"Andrew Svetlov in :issue:`32250`.)" msgstr "" #: ../../whatsnew/3.7.rst:676 @@ -979,17 +986,17 @@ msgid "" "The new :func:`asyncio.get_running_loop` function returns the currently " "running loop, and raises a :exc:`RuntimeError` if no loop is running. This " "is in contrast with :func:`asyncio.get_event_loop`, which will *create* a " -"new event loop if none is running. (Contributed by Yury Selivanov in :issue:" -"`32269`.)" +"new event loop if none is running. (Contributed by Yury Selivanov " +"in :issue:`32269`.)" msgstr "" #: ../../whatsnew/3.7.rst:686 msgid "" -"The new :meth:`StreamWriter.wait_closed() <asyncio.StreamWriter." -"wait_closed>` coroutine method allows waiting until the stream writer is " -"closed. The new :meth:`StreamWriter.is_closing() <asyncio.StreamWriter." -"is_closing>` method can be used to determine if the writer is closing. " -"(Contributed by Andrew Svetlov in :issue:`32391`.)" +"The new :meth:`StreamWriter.wait_closed() " +"<asyncio.StreamWriter.wait_closed>` coroutine method allows waiting until " +"the stream writer is closed. The new :meth:`StreamWriter.is_closing() " +"<asyncio.StreamWriter.is_closing>` method can be used to determine if the " +"writer is closing. (Contributed by Andrew Svetlov in :issue:`32391`.)" msgstr "" #: ../../whatsnew/3.7.rst:692 @@ -1001,27 +1008,27 @@ msgstr "" #: ../../whatsnew/3.7.rst:696 msgid "" -"The new :meth:`Future.get_loop() <asyncio.Future.get_loop>` and ``Task." -"get_loop()`` methods return the instance of the loop on which a task or a " -"future were created. :meth:`Server.get_loop() <asyncio.Server.get_loop>` " -"allows doing the same for :class:`asyncio.Server` objects. (Contributed by " -"Yury Selivanov in :issue:`32415` and Srinivas Reddy Thatiparthy in :issue:" -"`32418`.)" +"The new :meth:`Future.get_loop() <asyncio.Future.get_loop>` and " +"``Task.get_loop()`` methods return the instance of the loop on which a task " +"or a future were created. :meth:`Server.get_loop() " +"<asyncio.Server.get_loop>` allows doing the same for :class:`asyncio.Server` " +"objects. (Contributed by Yury Selivanov in :issue:`32415` and Srinivas Reddy " +"Thatiparthy in :issue:`32418`.)" msgstr "" #: ../../whatsnew/3.7.rst:704 msgid "" "It is now possible to control how instances of :class:`asyncio.Server` begin " "serving. Previously, the server would start serving immediately when " -"created. The new *start_serving* keyword argument to :meth:`loop." -"create_server() <asyncio.loop.create_server>` and :meth:`loop." -"create_unix_server() <asyncio.loop.create_unix_server>`, as well as :meth:" -"`Server.start_serving() <asyncio.Server.start_serving>`, and :meth:`Server." -"serve_forever() <asyncio.Server.serve_forever>` can be used to decouple " -"server instantiation and serving. The new :meth:`Server.is_serving() " -"<asyncio.Server.is_serving>` method returns ``True`` if the server is " -"serving. :class:`~asyncio.Server` objects are now asynchronous context " -"managers::" +"created. The new *start_serving* keyword argument " +"to :meth:`loop.create_server() <asyncio.loop.create_server>` " +"and :meth:`loop.create_unix_server() <asyncio.loop.create_unix_server>`, as " +"well as :meth:`Server.start_serving() <asyncio.Server.start_serving>`, " +"and :meth:`Server.serve_forever() <asyncio.Server.serve_forever>` can be " +"used to decouple server instantiation and serving. The " +"new :meth:`Server.is_serving() <asyncio.Server.is_serving>` method returns " +"``True`` if the server is serving. :class:`~asyncio.Server` objects are now " +"asynchronous context managers::" msgstr "" #: ../../whatsnew/3.7.rst:716 @@ -1040,27 +1047,27 @@ msgstr "(由 Yury Selivanov 在 :issue:`32662` 中貢獻。)" #: ../../whatsnew/3.7.rst:725 msgid "" -"Callback objects returned by :func:`loop.call_later() <asyncio.loop." -"call_later>` gained the new :meth:`when() <asyncio.TimerHandle.when>` method " -"which returns an absolute scheduled callback timestamp. (Contributed by " -"Andrew Svetlov in :issue:`32741`.)" +"Callback objects returned by :func:`loop.call_later() " +"<asyncio.loop.call_later>` gained the new :meth:`when() " +"<asyncio.TimerHandle.when>` method which returns an absolute scheduled " +"callback timestamp. (Contributed by Andrew Svetlov in :issue:`32741`.)" msgstr "" #: ../../whatsnew/3.7.rst:731 msgid "" -"The :meth:`loop.create_datagram_endpoint() \\ <asyncio.loop." -"create_datagram_endpoint>` method gained support for Unix sockets. " -"(Contributed by Quentin Dawans in :issue:`31245`.)" +"The :meth:`loop.create_datagram_endpoint() \\ " +"<asyncio.loop.create_datagram_endpoint>` method gained support for Unix " +"sockets. (Contributed by Quentin Dawans in :issue:`31245`.)" msgstr "" #: ../../whatsnew/3.7.rst:736 msgid "" "The :func:`asyncio.open_connection`, :func:`asyncio.start_server` " -"functions, :meth:`loop.create_connection() <asyncio.loop." -"create_connection>`, :meth:`loop.create_server() <asyncio.loop." -"create_server>`, :meth:`loop.create_accepted_socket() <asyncio.loop." -"connect_accepted_socket>` methods and their corresponding UNIX socket " -"variants now accept the *ssl_handshake_timeout* keyword argument. " +"functions, :meth:`loop.create_connection() " +"<asyncio.loop.create_connection>`, :meth:`loop.create_server() " +"<asyncio.loop.create_server>`, :meth:`loop.create_accepted_socket() " +"<asyncio.loop.connect_accepted_socket>` methods and their corresponding UNIX " +"socket variants now accept the *ssl_handshake_timeout* keyword argument. " "(Contributed by Neil Aspinall in :issue:`29970`.)" msgstr "" @@ -1073,32 +1080,35 @@ msgstr "" #: ../../whatsnew/3.7.rst:748 msgid "" -"The asyncio source has been converted to use the :keyword:`async`/:keyword:" -"`await` syntax. (Contributed by Andrew Svetlov in :issue:`32193`.)" +"The asyncio source has been converted to use " +"the :keyword:`async`/:keyword:`await` syntax. (Contributed by Andrew Svetlov " +"in :issue:`32193`.)" msgstr "" #: ../../whatsnew/3.7.rst:752 msgid "" -"The new :meth:`ReadTransport.is_reading() <asyncio.ReadTransport." -"is_reading>` method can be used to determine the reading state of the " -"transport. Additionally, calls to :meth:`ReadTransport.resume_reading() " -"<asyncio.ReadTransport.resume_reading>` and :meth:`ReadTransport." -"pause_reading() <asyncio.ReadTransport.pause_reading>` are now idempotent. " -"(Contributed by Yury Selivanov in :issue:`32356`.)" +"The new :meth:`ReadTransport.is_reading() " +"<asyncio.ReadTransport.is_reading>` method can be used to determine the " +"reading state of the transport. Additionally, calls " +"to :meth:`ReadTransport.resume_reading() " +"<asyncio.ReadTransport.resume_reading>` " +"and :meth:`ReadTransport.pause_reading() " +"<asyncio.ReadTransport.pause_reading>` are now idempotent. (Contributed by " +"Yury Selivanov in :issue:`32356`.)" msgstr "" #: ../../whatsnew/3.7.rst:760 msgid "" "Loop methods which accept socket paths now support passing :term:`path-like " -"objects <path-like object>`. (Contributed by Yury Selivanov in :issue:" -"`32066`.)" +"objects <path-like object>`. (Contributed by Yury Selivanov " +"in :issue:`32066`.)" msgstr "" #: ../../whatsnew/3.7.rst:764 msgid "" "In :mod:`asyncio` TCP sockets on Linux are now created with ``TCP_NODELAY`` " -"flag set by default. (Contributed by Yury Selivanov and Victor Stinner in :" -"issue:`27456`.)" +"flag set by default. (Contributed by Yury Selivanov and Victor Stinner " +"in :issue:`27456`.)" msgstr "" #: ../../whatsnew/3.7.rst:768 @@ -1171,8 +1181,8 @@ msgstr "concurrent.futures" #: ../../whatsnew/3.7.rst:816 msgid "" -":class:`ProcessPoolExecutor <concurrent.futures.ProcessPoolExecutor>` and :" -"class:`ThreadPoolExecutor <concurrent.futures.ThreadPoolExecutor>` now " +":class:`ProcessPoolExecutor <concurrent.futures.ProcessPoolExecutor>` " +"and :class:`ThreadPoolExecutor <concurrent.futures.ThreadPoolExecutor>` now " "support the new *initializer* and *initargs* constructor arguments. " "(Contributed by Antoine Pitrou in :issue:`21423`.)" msgstr "" @@ -1197,11 +1207,12 @@ msgstr "" #: ../../whatsnew/3.7.rst:833 msgid "" -"The new :func:`~contextlib.asynccontextmanager`, :class:`~contextlib." -"AbstractAsyncContextManager`, and :class:`~contextlib.AsyncExitStack` have " -"been added to complement their synchronous counterparts. (Contributed by " -"Jelle Zijlstra in :issue:`29679` and :issue:`30241`, and by Alexander Mohr " -"and Ilya Kulakov in :issue:`29302`.)" +"The " +"new :func:`~contextlib.asynccontextmanager`, :class:`~contextlib.AbstractAsyncContextManager`, " +"and :class:`~contextlib.AsyncExitStack` have been added to complement their " +"synchronous counterparts. (Contributed by Jelle Zijlstra in :issue:`29679` " +"and :issue:`30241`, and by Alexander Mohr and Ilya Kulakov " +"in :issue:`29302`.)" msgstr "" #: ../../whatsnew/3.7.rst:842 @@ -1211,8 +1222,8 @@ msgstr "cProfile" #: ../../whatsnew/3.7.rst:844 msgid "" "The :mod:`cProfile` command line now accepts ``-m module_name`` as an " -"alternative to script path. (Contributed by Sanyam Khurana in :issue:" -"`21862`.)" +"alternative to script path. (Contributed by Sanyam Khurana " +"in :issue:`21862`.)" msgstr "" #: ../../whatsnew/3.7.rst:849 @@ -1239,8 +1250,9 @@ msgstr "datetime" msgid "" "The new :meth:`datetime.fromisoformat() <datetime.datetime.fromisoformat>` " "method constructs a :class:`~datetime.datetime` object from a string in one " -"of the formats output by :meth:`datetime.isoformat() <datetime.datetime." -"isoformat>`. (Contributed by Paul Ganssle in :issue:`15873`.)" +"of the formats output by :meth:`datetime.isoformat() " +"<datetime.datetime.isoformat>`. (Contributed by Paul Ganssle " +"in :issue:`15873`.)" msgstr "" #: ../../whatsnew/3.7.rst:867 @@ -1266,8 +1278,8 @@ msgstr "decimal" #: ../../whatsnew/3.7.rst:881 msgid "" "The :mod:`decimal` module now uses :ref:`context variables <whatsnew37-" -"pep567>` to store the decimal context. (Contributed by Yury Selivanov in :" -"issue:`32630`.)" +"pep567>` to store the decimal context. (Contributed by Yury Selivanov " +"in :issue:`32630`.)" msgstr "" #: ../../whatsnew/3.7.rst:887 @@ -1336,8 +1348,8 @@ msgid "" "be used before a POSIX ``fork()`` call to make the GC copy-on-write friendly " "or to speed up collection. The new :func:`gc.unfreeze` functions reverses " "this operation. Additionally, :func:`gc.get_freeze_count` can be used to " -"obtain the number of frozen objects. (Contributed by Li Zekun in :issue:" -"`31558`.)" +"obtain the number of frozen objects. (Contributed by Li Zekun " +"in :issue:`31558`.)" msgstr "" #: ../../whatsnew/3.7.rst:942 @@ -1357,9 +1369,10 @@ msgstr "http.client" #: ../../whatsnew/3.7.rst:952 msgid "" -":class:`~http.client.HTTPConnection` and :class:`~http.client." -"HTTPSConnection` now support the new *blocksize* argument for improved " -"upload throughput. (Contributed by Nir Soffer in :issue:`31945`.)" +":class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` now support the new *blocksize* " +"argument for improved upload throughput. (Contributed by Nir Soffer " +"in :issue:`31945`.)" msgstr "" #: ../../whatsnew/3.7.rst:958 @@ -1397,8 +1410,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:980 msgid "" -"Multiple fixes for autocompletion. (Contributed by Louie Lu in :issue:" -"`15786`.)" +"Multiple fixes for autocompletion. (Contributed by Louie Lu " +"in :issue:`15786`.)" msgstr "" #: ../../whatsnew/3.7.rst:982 @@ -1437,8 +1450,8 @@ msgid "" "Editor code context option revised. Box displays all context lines up to " "maxlines. Clicking on a context line jumps the editor to that line. " "Context colors for custom themes is added to Highlights tab of Settings " -"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy in :issue:" -"`33642`, :issue:`33768`, and :issue:`33679`.)" +"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy " +"in :issue:`33642`, :issue:`33768`, and :issue:`33679`.)" msgstr "" #: ../../whatsnew/3.7.rst:1009 @@ -1490,8 +1503,8 @@ msgid "" "Add optional line numbers for IDLE editor windows. Windows open without line " "numbers unless set otherwise in the General tab of the configuration " "dialog. Line numbers for an existing window are shown and hidden in the " -"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar in :issue:" -"`17535`.)" +"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar " +"in :issue:`17535`.)" msgstr "" #: ../../whatsnew/3.7.rst:1044 ../../whatsnew/3.7.rst:2017 @@ -1501,9 +1514,9 @@ msgstr "importlib" #: ../../whatsnew/3.7.rst:1046 msgid "" "The :class:`importlib.abc.ResourceReader` ABC was introduced to support the " -"loading of resources from packages. See also :ref:" -"`whatsnew37_importlib_resources`. (Contributed by Barry Warsaw, Brett Cannon " -"in :issue:`32248`.)" +"loading of resources from packages. See " +"also :ref:`whatsnew37_importlib_resources`. (Contributed by Barry Warsaw, " +"Brett Cannon in :issue:`32248`.)" msgstr "" #: ../../whatsnew/3.7.rst:1051 @@ -1515,9 +1528,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1055 msgid "" ":func:`importlib.find_spec` now raises :exc:`ModuleNotFoundError` instead " -"of :exc:`AttributeError` if the specified parent module is not a package (i." -"e. lacks a ``__path__`` attribute). (Contributed by Milan Oberkirch in :" -"issue:`30436`.)" +"of :exc:`AttributeError` if the specified parent module is not a package " +"(i.e. lacks a ``__path__`` attribute). (Contributed by Milan Oberkirch " +"in :issue:`30436`.)" msgstr "" #: ../../whatsnew/3.7.rst:1060 @@ -1535,8 +1548,8 @@ msgstr "io" msgid "" "The new :meth:`TextIOWrapper.reconfigure() <io.TextIOWrapper.reconfigure>` " "method can be used to reconfigure the text stream with the new settings. " -"(Contributed by Antoine Pitrou in :issue:`30526` and INADA Naoki in :issue:" -"`15216`.)" +"(Contributed by Antoine Pitrou in :issue:`30526` and INADA Naoki " +"in :issue:`15216`.)" msgstr "" #: ../../whatsnew/3.7.rst:1075 @@ -1545,10 +1558,10 @@ msgstr "ipaddress" #: ../../whatsnew/3.7.rst:1077 msgid "" -"The new ``subnet_of()`` and ``supernet_of()`` methods of :class:`ipaddress." -"IPv6Network` and :class:`ipaddress.IPv4Network` can be used for network " -"containment tests. (Contributed by Michel Albert and Cheryl Sabella in :" -"issue:`20825`.)" +"The new ``subnet_of()`` and ``supernet_of()`` methods " +"of :class:`ipaddress.IPv6Network` and :class:`ipaddress.IPv4Network` can be " +"used for network containment tests. (Contributed by Michel Albert and Cheryl " +"Sabella in :issue:`20825`.)" msgstr "" #: ../../whatsnew/3.7.rst:1084 @@ -1557,9 +1570,9 @@ msgstr "itertools" #: ../../whatsnew/3.7.rst:1086 msgid "" -":func:`itertools.islice` now accepts :meth:`integer-like objects <object." -"__index__>` as start, stop, and slice arguments. (Contributed by Will " -"Roberts in :issue:`30537`.)" +":func:`itertools.islice` now accepts :meth:`integer-like objects " +"<object.__index__>` as start, stop, and slice arguments. (Contributed by " +"Will Roberts in :issue:`30537`.)" msgstr "" #: ../../whatsnew/3.7.rst:1093 ../../whatsnew/3.7.rst:2035 @@ -1678,16 +1691,16 @@ msgstr "" #: ../../whatsnew/3.7.rst:1168 msgid "" "The new :func:`~os.register_at_fork` function allows registering Python " -"callbacks to be executed at process fork. (Contributed by Antoine Pitrou in :" -"issue:`16500`.)" +"callbacks to be executed at process fork. (Contributed by Antoine Pitrou " +"in :issue:`16500`.)" msgstr "" #: ../../whatsnew/3.7.rst:1172 msgid "" -"Added :func:`os.preadv` (combine the functionality of :func:`os.readv` and :" -"func:`os.pread`) and :func:`os.pwritev` functions (combine the functionality " -"of :func:`os.writev` and :func:`os.pwrite`). (Contributed by Pablo Galindo " -"in :issue:`31368`.)" +"Added :func:`os.preadv` (combine the functionality of :func:`os.readv` " +"and :func:`os.pread`) and :func:`os.pwritev` functions (combine the " +"functionality of :func:`os.writev` and :func:`os.pwrite`). (Contributed by " +"Pablo Galindo in :issue:`31368`.)" msgstr "" #: ../../whatsnew/3.7.rst:1177 @@ -1705,9 +1718,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1185 msgid "" -"The structure returned by :func:`os.stat` now contains the :attr:`~os." -"stat_result.st_fstype` attribute on Solaris and its derivatives. " -"(Contributed by Jesús Cea Avión in :issue:`32659`.)" +"The structure returned by :func:`os.stat` now contains " +"the :attr:`~os.stat_result.st_fstype` attribute on Solaris and its " +"derivatives. (Contributed by Jesús Cea Avión in :issue:`32659`.)" msgstr "" #: ../../whatsnew/3.7.rst:1191 @@ -1747,9 +1760,9 @@ msgid "" ":func:`py_compile.compile` -- and by extension, :mod:`compileall` -- now " "respects the :envvar:`SOURCE_DATE_EPOCH` environment variable by " "unconditionally creating ``.pyc`` files for hash-based validation. This " -"allows for guaranteeing `reproducible builds <https://reproducible-builds." -"org/>`_ of ``.pyc`` files when they are created eagerly. (Contributed by " -"Bernhard M. Wiedemann in :issue:`29708`.)" +"allows for guaranteeing `reproducible builds <https://reproducible-" +"builds.org/>`_ of ``.pyc`` files when they are created eagerly. (Contributed " +"by Bernhard M. Wiedemann in :issue:`29708`.)" msgstr "" #: ../../whatsnew/3.7.rst:1222 @@ -1759,8 +1772,8 @@ msgstr "pydoc" #: ../../whatsnew/3.7.rst:1224 msgid "" "The pydoc server can now bind to an arbitrary hostname specified by the new " -"``-n`` command-line argument. (Contributed by Feanil Patel in :issue:" -"`31128`.)" +"``-n`` command-line argument. (Contributed by Feanil Patel " +"in :issue:`31128`.)" msgstr "" #: ../../whatsnew/3.7.rst:1230 @@ -1780,8 +1793,8 @@ msgstr "re" #: ../../whatsnew/3.7.rst:1239 msgid "" "The flags :const:`re.ASCII`, :const:`re.LOCALE` and :const:`re.UNICODE` can " -"be set within the scope of a group. (Contributed by Serhiy Storchaka in :" -"issue:`31690`.)" +"be set within the scope of a group. (Contributed by Serhiy Storchaka " +"in :issue:`31690`.)" msgstr "" #: ../../whatsnew/3.7.rst:1243 @@ -1803,15 +1816,15 @@ msgstr "" msgid "" ":exc:`FutureWarning` is now emitted if a regular expression contains " "character set constructs that will change semantically in the future, such " -"as nested sets and set operations. (Contributed by Serhiy Storchaka in :" -"issue:`30349`.)" +"as nested sets and set operations. (Contributed by Serhiy Storchaka " +"in :issue:`30349`.)" msgstr "" #: ../../whatsnew/3.7.rst:1257 msgid "" -"Compiled regular expression and match objects can now be copied using :func:" -"`copy.copy` and :func:`copy.deepcopy`. (Contributed by Serhiy Storchaka in :" -"issue:`10076`.)" +"Compiled regular expression and match objects can now be copied " +"using :func:`copy.copy` and :func:`copy.deepcopy`. (Contributed by Serhiy " +"Storchaka in :issue:`10076`.)" msgstr "" #: ../../whatsnew/3.7.rst:1263 @@ -1841,16 +1854,16 @@ msgstr "" msgid "" "The new :func:`socket.close` function closes the passed socket file " "descriptor. This function should be used instead of :func:`os.close` for " -"better compatibility across platforms. (Contributed by Christian Heimes in :" -"issue:`32454`.)" +"better compatibility across platforms. (Contributed by Christian Heimes " +"in :issue:`32454`.)" msgstr "" #: ../../whatsnew/3.7.rst:1283 msgid "" "The :mod:`socket` module now exposes the :const:`socket.TCP_CONGESTION` " -"(Linux 2.6.13), :const:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37), and :const:" -"`socket.TCP_NOTSENT_LOWAT` (Linux 3.12) constants. (Contributed by Omar " -"Sandoval in :issue:`26273` and Nathaniel J. Smith in :issue:`29728`.)" +"(Linux 2.6.13), :const:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37), " +"and :const:`socket.TCP_NOTSENT_LOWAT` (Linux 3.12) constants. (Contributed " +"by Omar Sandoval in :issue:`26273` and Nathaniel J. Smith in :issue:`29728`.)" msgstr "" #: ../../whatsnew/3.7.rst:1289 @@ -1880,9 +1893,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1305 msgid "" "Add a new :attr:`socketserver.ForkingMixIn.block_on_close` class attribute " -"to :class:`socketserver.ForkingMixIn` and :class:`socketserver." -"ThreadingMixIn` classes. Set the class attribute to ``False`` to get the " -"pre-3.7 behaviour." +"to :class:`socketserver.ForkingMixIn` " +"and :class:`socketserver.ThreadingMixIn` classes. Set the class attribute to " +"``False`` to get the pre-3.7 behaviour." msgstr "" #: ../../whatsnew/3.7.rst:1311 @@ -1891,16 +1904,17 @@ msgstr "sqlite3" #: ../../whatsnew/3.7.rst:1313 msgid "" -":class:`sqlite3.Connection` now exposes the :meth:`~sqlite3.Connection." -"backup` method when the underlying SQLite library is at version 3.6.11 or " -"higher. (Contributed by Lele Gaifax in :issue:`27645`.)" +":class:`sqlite3.Connection` now exposes " +"the :meth:`~sqlite3.Connection.backup` method when the underlying SQLite " +"library is at version 3.6.11 or higher. (Contributed by Lele Gaifax " +"in :issue:`27645`.)" msgstr "" #: ../../whatsnew/3.7.rst:1317 msgid "" -"The *database* argument of :func:`sqlite3.connect` now accepts any :term:" -"`path-like object`, instead of just a string. (Contributed by Anders " -"Lorentsen in :issue:`31843`.)" +"The *database* argument of :func:`sqlite3.connect` now accepts " +"any :term:`path-like object`, instead of just a string. (Contributed by " +"Anders Lorentsen in :issue:`31843`.)" msgstr "" #: ../../whatsnew/3.7.rst:1323 ../../whatsnew/3.7.rst:2067 @@ -1909,15 +1923,16 @@ msgstr "ssl" #: ../../whatsnew/3.7.rst:1325 msgid "" -"The :mod:`ssl` module now uses OpenSSL's builtin API instead of :func:`~ssl." -"match_hostname` to check a host name or an IP address. Values are validated " -"during TLS handshake. Any certificate validation error including failing " -"the host name check now raises :exc:`~ssl.SSLCertVerificationError` and " -"aborts the handshake with a proper TLS Alert message. The new exception " -"contains additional information. Host name validation can be customized " -"with :attr:`SSLContext.hostname_checks_common_name <ssl.SSLContext." -"hostname_checks_common_name>`. (Contributed by Christian Heimes in :issue:" -"`31399`.)" +"The :mod:`ssl` module now uses OpenSSL's builtin API instead " +"of :func:`~ssl.match_hostname` to check a host name or an IP address. " +"Values are validated during TLS handshake. Any certificate validation error " +"including failing the host name check now " +"raises :exc:`~ssl.SSLCertVerificationError` and aborts the handshake with a " +"proper TLS Alert message. The new exception contains additional " +"information. Host name validation can be customized " +"with :attr:`SSLContext.hostname_checks_common_name " +"<ssl.SSLContext.hostname_checks_common_name>`. (Contributed by Christian " +"Heimes in :issue:`31399`.)" msgstr "" #: ../../whatsnew/3.7.rst:1336 @@ -1936,9 +1951,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1344 msgid "" -":func:`~ssl.match_hostname` no longer supports partial wildcards like ``www*." -"example.org``. (Contributed by Mandeep Singh in :issue:`23033` and Christian " -"Heimes in :issue:`31399`.)" +":func:`~ssl.match_hostname` no longer supports partial wildcards like " +"``www*.example.org``. (Contributed by Mandeep Singh in :issue:`23033` and " +"Christian Heimes in :issue:`31399`.)" msgstr "" #: ../../whatsnew/3.7.rst:1349 @@ -1953,11 +1968,11 @@ msgstr "" #: ../../whatsnew/3.7.rst:1355 msgid "" "Validation of server certificates containing internationalized domain names " -"(IDNs) is now supported. As part of this change, the :attr:`SSLSocket." -"server_hostname <ssl.SSLSocket.server_hostname>` attribute now stores the " -"expected hostname in A-label form (``\"xn--pythn-mua.org\"``), rather than " -"the U-label form (``\"pythön.org\"``). (Contributed by Nathaniel J. Smith " -"and Christian Heimes in :issue:`28414`.)" +"(IDNs) is now supported. As part of this change, " +"the :attr:`SSLSocket.server_hostname <ssl.SSLSocket.server_hostname>` " +"attribute now stores the expected hostname in A-label form (``\"xn--pythn-" +"mua.org\"``), rather than the U-label form (``\"pythön.org\"``). " +"(Contributed by Nathaniel J. Smith and Christian Heimes in :issue:`28414`.)" msgstr "" #: ../../whatsnew/3.7.rst:1362 @@ -1966,34 +1981,37 @@ msgid "" "OpenSSL 1.1.1. At the time of Python 3.7.0 release, OpenSSL 1.1.1 is still " "under development and TLS 1.3 hasn't been finalized yet. The TLS 1.3 " "handshake and protocol behaves slightly differently than TLS 1.2 and " -"earlier, see :ref:`ssl-tlsv1_3`. (Contributed by Christian Heimes in :issue:" -"`32947`, :issue:`20995`, :issue:`29136`, :issue:`30622` and :issue:`33618`)" +"earlier, see :ref:`ssl-tlsv1_3`. (Contributed by Christian Heimes " +"in :issue:`32947`, :issue:`20995`, :issue:`29136`, :issue:`30622` " +"and :issue:`33618`)" msgstr "" #: ../../whatsnew/3.7.rst:1370 msgid "" ":class:`~ssl.SSLSocket` and :class:`~ssl.SSLObject` no longer have a public " "constructor. Direct instantiation was never a documented and supported " -"feature. Instances must be created with :class:`~ssl.SSLContext` methods :" -"meth:`~ssl.SSLContext.wrap_socket` and :meth:`~ssl.SSLContext.wrap_bio`. " -"(Contributed by Christian Heimes in :issue:`32951`)" +"feature. Instances must be created with :class:`~ssl.SSLContext` " +"methods :meth:`~ssl.SSLContext.wrap_socket` " +"and :meth:`~ssl.SSLContext.wrap_bio`. (Contributed by Christian Heimes " +"in :issue:`32951`)" msgstr "" #: ../../whatsnew/3.7.rst:1376 msgid "" "OpenSSL 1.1 APIs for setting the minimum and maximum TLS protocol version " -"are available as :attr:`SSLContext.minimum_version <ssl.SSLContext." -"minimum_version>` and :attr:`SSLContext.maximum_version <ssl.SSLContext." -"maximum_version>`. Supported protocols are indicated by several new flags, " -"such as :data:`~ssl.HAS_TLSv1_1`. (Contributed by Christian Heimes in :issue:" -"`32609`.)" +"are available as :attr:`SSLContext.minimum_version " +"<ssl.SSLContext.minimum_version>` and :attr:`SSLContext.maximum_version " +"<ssl.SSLContext.maximum_version>`. Supported protocols are indicated by " +"several new flags, such as :data:`~ssl.HAS_TLSv1_1`. (Contributed by " +"Christian Heimes in :issue:`32609`.)" msgstr "" #: ../../whatsnew/3.7.rst:1383 msgid "" -"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable and :meth:`ssl." -"SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 post-handshake " -"authentication. (Contributed by Christian Heimes in :gh:`78851`.)" +"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable " +"and :meth:`ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 " +"post-handshake authentication. (Contributed by Christian Heimes " +"in :gh:`78851`.)" msgstr "" #: ../../whatsnew/3.7.rst:1389 @@ -2030,19 +2048,21 @@ msgstr "" msgid "" "On Windows the default for *close_fds* was changed from ``False`` to " "``True`` when redirecting the standard handles. It's now possible to set " -"*close_fds* to true when redirecting the standard handles. See :class:" -"`subprocess.Popen`. This means that *close_fds* now defaults to ``True`` on " -"all supported platforms. (Contributed by Segev Finer in :issue:`19764`.)" +"*close_fds* to true when redirecting the standard handles. " +"See :class:`subprocess.Popen`. This means that *close_fds* now defaults to " +"``True`` on all supported platforms. (Contributed by Segev Finer " +"in :issue:`19764`.)" msgstr "" #: ../../whatsnew/3.7.rst:1417 msgid "" -"The subprocess module is now more graceful when handling :exc:" -"`KeyboardInterrupt` during :func:`subprocess.call`, :func:`subprocess.run`, " -"or in a :class:`~subprocess.Popen` context manager. It now waits a short " -"amount of time for the child to exit, before continuing the handling of the " -"``KeyboardInterrupt`` exception. (Contributed by Gregory P. Smith in :issue:" -"`25942`.)" +"The subprocess module is now more graceful when " +"handling :exc:`KeyboardInterrupt` " +"during :func:`subprocess.call`, :func:`subprocess.run`, or in " +"a :class:`~subprocess.Popen` context manager. It now waits a short amount " +"of time for the child to exit, before continuing the handling of the " +"``KeyboardInterrupt`` exception. (Contributed by Gregory P. Smith " +"in :issue:`25942`.)" msgstr "" #: ../../whatsnew/3.7.rst:1427 ../../whatsnew/3.7.rst:2083 @@ -2051,8 +2071,8 @@ msgstr "sys" #: ../../whatsnew/3.7.rst:1429 msgid "" -"The new :func:`sys.breakpointhook` hook function is called by the built-in :" -"func:`breakpoint`. (Contributed by Barry Warsaw in :issue:`31353`.)" +"The new :func:`sys.breakpointhook` hook function is called by the built-" +"in :func:`breakpoint`. (Contributed by Barry Warsaw in :issue:`31353`.)" msgstr "" #: ../../whatsnew/3.7.rst:1433 @@ -2064,11 +2084,11 @@ msgstr "" #: ../../whatsnew/3.7.rst:1437 msgid "" "The new :func:`sys.get_coroutine_origin_tracking_depth` function returns the " -"current coroutine origin tracking depth, as set by the new :func:`sys." -"set_coroutine_origin_tracking_depth`. :mod:`asyncio` has been converted to " -"use this new API instead of the deprecated :func:`sys." -"set_coroutine_wrapper`. (Contributed by Nathaniel J. Smith in :issue:" -"`32591`.)" +"current coroutine origin tracking depth, as set by the " +"new :func:`sys.set_coroutine_origin_tracking_depth`. :mod:`asyncio` has " +"been converted to use this new API instead of the " +"deprecated :func:`sys.set_coroutine_wrapper`. (Contributed by Nathaniel J. " +"Smith in :issue:`32591`.)" msgstr "" #: ../../whatsnew/3.7.rst:1446 @@ -2077,8 +2097,8 @@ msgstr "time" #: ../../whatsnew/3.7.rst:1448 msgid "" -":pep:`564` adds six new functions with nanosecond resolution to the :mod:" -"`time` module:" +":pep:`564` adds six new functions with nanosecond resolution to " +"the :mod:`time` module:" msgstr "" #: ../../whatsnew/3.7.rst:1458 @@ -2087,9 +2107,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1460 msgid "" -":const:`time.CLOCK_BOOTTIME` (Linux): Identical to :const:`time." -"CLOCK_MONOTONIC`, except it also includes any time that the system is " -"suspended." +":const:`time.CLOCK_BOOTTIME` (Linux): Identical " +"to :const:`time.CLOCK_MONOTONIC`, except it also includes any time that the " +"system is suspended." msgstr "" #: ../../whatsnew/3.7.rst:1463 @@ -2148,18 +2168,18 @@ msgstr "types" #: ../../whatsnew/3.7.rst:1499 msgid "" -"The new :class:`~types.WrapperDescriptorType`, :class:`~types." -"MethodWrapperType`, :class:`~types.MethodDescriptorType`, and :class:`~types." -"ClassMethodDescriptorType` classes are now available. (Contributed by Manuel " -"Krebber and Guido van Rossum in :issue:`29377`, and Serhiy Storchaka in :" -"issue:`32265`.)" +"The " +"new :class:`~types.WrapperDescriptorType`, :class:`~types.MethodWrapperType`, :class:`~types.MethodDescriptorType`, " +"and :class:`~types.ClassMethodDescriptorType` classes are now available. " +"(Contributed by Manuel Krebber and Guido van Rossum in :issue:`29377`, and " +"Serhiy Storchaka in :issue:`32265`.)" msgstr "" #: ../../whatsnew/3.7.rst:1505 msgid "" "The new :func:`types.resolve_bases` function resolves MRO entries " -"dynamically as specified by :pep:`560`. (Contributed by Ivan Levkivskyi in :" -"issue:`32717`.)" +"dynamically as specified by :pep:`560`. (Contributed by Ivan Levkivskyi " +"in :issue:`32717`.)" msgstr "" #: ../../whatsnew/3.7.rst:1511 @@ -2181,9 +2201,10 @@ msgstr "unittest" msgid "" "The new ``-k`` command-line option allows filtering tests by a name " "substring or a Unix shell-like pattern. For example, ``python -m unittest -k " -"foo`` runs ``foo_tests.SomeTest.test_something``, ``bar_tests.SomeTest." -"test_foo``, but not ``bar_tests.FooTest.test_something``. (Contributed by " -"Jonas Haag in :issue:`32071`.)" +"foo`` runs ``foo_tests.SomeTest.test_something``, " +"``bar_tests.SomeTest.test_foo``, but not " +"``bar_tests.FooTest.test_something``. (Contributed by Jonas Haag " +"in :issue:`32071`.)" msgstr "" #: ../../whatsnew/3.7.rst:1530 @@ -2199,10 +2220,11 @@ msgstr "" #: ../../whatsnew/3.7.rst:1536 msgid "" -"The new :func:`~unittest.mock.seal` function allows sealing :class:" -"`~unittest.mock.Mock` instances, which will disallow further creation of " -"attribute mocks. The seal is applied recursively to all attributes that are " -"themselves mocks. (Contributed by Mario Corchero in :issue:`30541`.)" +"The new :func:`~unittest.mock.seal` function allows " +"sealing :class:`~unittest.mock.Mock` instances, which will disallow further " +"creation of attribute mocks. The seal is applied recursively to all " +"attributes that are themselves mocks. (Contributed by Mario Corchero " +"in :issue:`30541`.)" msgstr "" #: ../../whatsnew/3.7.rst:1544 @@ -2235,8 +2257,8 @@ msgstr "uuid" msgid "" "The new :attr:`UUID.is_safe <uuid.UUID.is_safe>` attribute relays " "information from the platform about whether generated UUIDs are generated " -"with a multiprocessing-safe method. (Contributed by Barry Warsaw in :issue:" -"`22807`.)" +"with a multiprocessing-safe method. (Contributed by Barry Warsaw " +"in :issue:`22807`.)" msgstr "" #: ../../whatsnew/3.7.rst:1567 @@ -2301,11 +2323,11 @@ msgstr "" #: ../../whatsnew/3.7.rst:1598 msgid "" -"(Contributed by Nick Coghlan and Victor Stinner in :issue:`20361`, :issue:" -"`32043`, and :issue:`32230`.)" +"(Contributed by Nick Coghlan and Victor Stinner " +"in :issue:`20361`, :issue:`32043`, and :issue:`32230`.)" msgstr "" -"(由 Nick Coghlan 和 Victor Stinner 在 :issue:`20361`、:issue:`32043` 和 :" -"issue:`32230` 中貢獻。)" +"(由 Nick Coghlan 和 Victor Stinner 在 :issue:`20361`、:issue:`32043` " +"和 :issue:`32230` 中貢獻。)" #: ../../whatsnew/3.7.rst:1601 msgid "" @@ -2320,9 +2342,10 @@ msgstr "xml" #: ../../whatsnew/3.7.rst:1609 msgid "" -"As mitigation against DTD and external entity retrieval, the :mod:`xml.dom." -"minidom` and :mod:`xml.sax` modules no longer process external entities by " -"default. (Contributed by Christian Heimes in :gh:`61441`.)" +"As mitigation against DTD and external entity retrieval, " +"the :mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process " +"external entities by default. (Contributed by Christian Heimes " +"in :gh:`61441`.)" msgstr "" #: ../../whatsnew/3.7.rst:1616 @@ -2343,9 +2366,9 @@ msgstr "xmlrpc.server" #: ../../whatsnew/3.7.rst:1627 msgid "" -":meth:`SimpleXMLRPCDispatcher.register_function <xmlrpc.server." -"SimpleXMLRPCDispatcher>` can now be used as a decorator. (Contributed by " -"Xiang Zhang in :issue:`7769`.)" +":meth:`SimpleXMLRPCDispatcher.register_function " +"<xmlrpc.server.SimpleXMLRPCDispatcher>` can now be used as a decorator. " +"(Contributed by Xiang Zhang in :issue:`7769`.)" msgstr "" #: ../../whatsnew/3.7.rst:1633 @@ -2389,10 +2412,10 @@ msgstr "C API 變更" #: ../../whatsnew/3.7.rst:1660 msgid "" -"A new API for thread-local storage has been implemented. See :ref:" -"`whatsnew37-pep539` for an overview and :ref:`thread-specific-storage-api` " -"for a complete reference. (Contributed by Masayuki Yamamoto in :issue:" -"`25658`.)" +"A new API for thread-local storage has been implemented. " +"See :ref:`whatsnew37-pep539` for an overview and :ref:`thread-specific-" +"storage-api` for a complete reference. (Contributed by Masayuki Yamamoto " +"in :issue:`25658`.)" msgstr "" #: ../../whatsnew/3.7.rst:1665 @@ -2404,8 +2427,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:1668 msgid "" "The new :c:func:`PyImport_GetModule` function returns the previously " -"imported module with the given name. (Contributed by Eric Snow in :issue:" -"`28411`.)" +"imported module with the given name. (Contributed by Eric Snow " +"in :issue:`28411`.)" msgstr "" #: ../../whatsnew/3.7.rst:1672 @@ -2422,76 +2445,79 @@ msgstr "" #: ../../whatsnew/3.7.rst:1680 msgid "" -"The :mod:`tracemalloc` now exposes a C API through the new :c:func:" -"`PyTraceMalloc_Track` and :c:func:`PyTraceMalloc_Untrack` functions. " -"(Contributed by Victor Stinner in :issue:`30054`.)" +"The :mod:`tracemalloc` now exposes a C API through the " +"new :c:func:`PyTraceMalloc_Track` and :c:func:`PyTraceMalloc_Untrack` " +"functions. (Contributed by Victor Stinner in :issue:`30054`.)" msgstr "" #: ../../whatsnew/3.7.rst:1685 msgid "" -"The new :c:func:`import__find__load__start` and :c:func:" -"`import__find__load__done` static markers can be used to trace module " -"imports. (Contributed by Christian Heimes in :issue:`31574`.)" +"The new :c:func:`import__find__load__start` " +"and :c:func:`import__find__load__done` static markers can be used to trace " +"module imports. (Contributed by Christian Heimes in :issue:`31574`.)" msgstr "" #: ../../whatsnew/3.7.rst:1690 msgid "" -"The fields :c:member:`!name` and :c:member:`!doc` of structures :c:type:" -"`PyMemberDef`, :c:type:`PyGetSetDef`, :c:type:`PyStructSequence_Field`, :c:" -"type:`PyStructSequence_Desc`, and :c:struct:`wrapperbase` are now of type " -"``const char *`` rather of ``char *``. (Contributed by Serhiy Storchaka in :" -"issue:`28761`.)" +"The fields :c:member:`!name` and :c:member:`!doc` of " +"structures :c:type:`PyMemberDef`, :c:type:`PyGetSetDef`, :c:type:`PyStructSequence_Field`, :c:type:`PyStructSequence_Desc`, " +"and :c:struct:`wrapperbase` are now of type ``const char *`` rather of " +"``char *``. (Contributed by Serhiy Storchaka in :issue:`28761`.)" msgstr "" #: ../../whatsnew/3.7.rst:1696 msgid "" -"The result of :c:func:`PyUnicode_AsUTF8AndSize` and :c:func:" -"`PyUnicode_AsUTF8` is now of type ``const char *`` rather of ``char *``. " -"(Contributed by Serhiy Storchaka in :issue:`28769`.)" +"The result of :c:func:`PyUnicode_AsUTF8AndSize` " +"and :c:func:`PyUnicode_AsUTF8` is now of type ``const char *`` rather of " +"``char *``. (Contributed by Serhiy Storchaka in :issue:`28769`.)" msgstr "" #: ../../whatsnew/3.7.rst:1700 msgid "" -"The result of :c:func:`PyMapping_Keys`, :c:func:`PyMapping_Values` and :c:" -"func:`PyMapping_Items` is now always a list, rather than a list or a tuple. " -"(Contributed by Oren Milman in :issue:`28280`.)" +"The result of :c:func:`PyMapping_Keys`, :c:func:`PyMapping_Values` " +"and :c:func:`PyMapping_Items` is now always a list, rather than a list or a " +"tuple. (Contributed by Oren Milman in :issue:`28280`.)" msgstr "" #: ../../whatsnew/3.7.rst:1704 msgid "" -"Added functions :c:func:`PySlice_Unpack` and :c:func:" -"`PySlice_AdjustIndices`. (Contributed by Serhiy Storchaka in :issue:`27867`.)" +"Added functions :c:func:`PySlice_Unpack` " +"and :c:func:`PySlice_AdjustIndices`. (Contributed by Serhiy Storchaka " +"in :issue:`27867`.)" msgstr "" #: ../../whatsnew/3.7.rst:1707 msgid "" -":c:func:`PyOS_AfterFork` is deprecated in favour of the new functions :c:" -"func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` and :c:func:" -"`PyOS_AfterFork_Child`. (Contributed by Antoine Pitrou in :issue:`16500`.)" +":c:func:`PyOS_AfterFork` is deprecated in favour of the new " +"functions :c:func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` " +"and :c:func:`PyOS_AfterFork_Child`. (Contributed by Antoine Pitrou " +"in :issue:`16500`.)" msgstr "" #: ../../whatsnew/3.7.rst:1712 msgid "" "The ``PyExc_RecursionErrorInst`` singleton that was part of the public API " "has been removed as its members being never cleared may cause a segfault " -"during finalization of the interpreter. Contributed by Xavier de Gaye in :" -"issue:`22898` and :issue:`30697`." +"during finalization of the interpreter. Contributed by Xavier de Gaye " +"in :issue:`22898` and :issue:`30697`." msgstr "" #: ../../whatsnew/3.7.rst:1717 msgid "" -"Added C API support for timezones with timezone constructors :c:func:" -"`PyTimeZone_FromOffset` and :c:func:`PyTimeZone_FromOffsetAndName`, and " -"access to the UTC singleton with :c:data:`PyDateTime_TimeZone_UTC`. " -"Contributed by Paul Ganssle in :issue:`10381`." +"Added C API support for timezones with timezone " +"constructors :c:func:`PyTimeZone_FromOffset` " +"and :c:func:`PyTimeZone_FromOffsetAndName`, and access to the UTC singleton " +"with :c:data:`PyDateTime_TimeZone_UTC`. Contributed by Paul Ganssle " +"in :issue:`10381`." msgstr "" #: ../../whatsnew/3.7.rst:1722 msgid "" -"The type of results of :c:func:`PyThread_start_new_thread` and :c:func:" -"`PyThread_get_thread_ident`, and the *id* parameter of :c:func:" -"`PyThreadState_SetAsyncExc` changed from :c:expr:`long` to :c:expr:`unsigned " -"long`. (Contributed by Serhiy Storchaka in :issue:`6532`.)" +"The type of results of :c:func:`PyThread_start_new_thread` " +"and :c:func:`PyThread_get_thread_ident`, and the *id* parameter " +"of :c:func:`PyThreadState_SetAsyncExc` changed from :c:expr:`long` " +"to :c:expr:`unsigned long`. (Contributed by Serhiy Storchaka " +"in :issue:`6532`.)" msgstr "" #: ../../whatsnew/3.7.rst:1728 @@ -2504,12 +2530,12 @@ msgstr "" #: ../../whatsnew/3.7.rst:1732 msgid "" "Changes to the startup sequence and the management of dynamic memory " -"allocators mean that the long documented requirement to call :c:func:" -"`Py_Initialize` before calling most C API functions is now relied on more " -"heavily, and failing to abide by it may lead to segfaults in embedding " -"applications. See the :ref:`porting-to-python-37` section in this document " -"and the :ref:`pre-init-safe` section in the C API documentation for more " -"details." +"allocators mean that the long documented requirement to " +"call :c:func:`Py_Initialize` before calling most C API functions is now " +"relied on more heavily, and failing to abide by it may lead to segfaults in " +"embedding applications. See the :ref:`porting-to-python-37` section in this " +"document and the :ref:`pre-init-safe` section in the C API documentation for " +"more details." msgstr "" #: ../../whatsnew/3.7.rst:1740 @@ -2535,8 +2561,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:1752 msgid "" "The *start* and *end* parameters of :c:func:`PyUnicode_FindChar` are now " -"adjusted to behave like string slices. (Contributed by Xiang Zhang in :issue:" -"`28822`.)" +"adjusted to behave like string slices. (Contributed by Xiang Zhang " +"in :issue:`28822`.)" msgstr "" #: ../../whatsnew/3.7.rst:1758 @@ -2545,16 +2571,16 @@ msgstr "建置變更" #: ../../whatsnew/3.7.rst:1760 msgid "" -"Support for building ``--without-threads`` has been removed. The :mod:" -"`threading` module is now always available. (Contributed by Antoine Pitrou " -"in :issue:`31370`.)." +"Support for building ``--without-threads`` has been removed. " +"The :mod:`threading` module is now always available. (Contributed by Antoine " +"Pitrou in :issue:`31370`.)." msgstr "" #: ../../whatsnew/3.7.rst:1764 msgid "" -"A full copy of libffi is no longer bundled for use when building the :mod:" -"`_ctypes <ctypes>` module on non-OSX UNIX platforms. An installed copy of " -"libffi is now required when building ``_ctypes`` on such platforms. " +"A full copy of libffi is no longer bundled for use when building " +"the :mod:`_ctypes <ctypes>` module on non-OSX UNIX platforms. An installed " +"copy of libffi is now required when building ``_ctypes`` on such platforms. " "(Contributed by Zachary Ware in :issue:`27979`.)" msgstr "" @@ -2583,15 +2609,15 @@ msgstr "最佳化" msgid "" "The overhead of calling many methods of various standard library classes " "implemented in C has been significantly reduced by porting more code to use " -"the ``METH_FASTCALL`` convention. (Contributed by Victor Stinner in :issue:" -"`29300`, :issue:`29507`, :issue:`29452`, and :issue:`29286`.)" +"the ``METH_FASTCALL`` convention. (Contributed by Victor Stinner " +"in :issue:`29300`, :issue:`29507`, :issue:`29452`, and :issue:`29286`.)" msgstr "" #: ../../whatsnew/3.7.rst:1792 msgid "" "Various optimizations have reduced Python startup time by 10% on Linux and " -"up to 30% on macOS. (Contributed by Victor Stinner, INADA Naoki in :issue:" -"`29585`, and Ivan Levkivskyi in :issue:`31333`.)" +"up to 30% on macOS. (Contributed by Victor Stinner, INADA Naoki " +"in :issue:`29585`, and Ivan Levkivskyi in :issue:`31333`.)" msgstr "" #: ../../whatsnew/3.7.rst:1797 @@ -2610,8 +2636,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:1806 msgid "" "The :func:`asyncio.get_event_loop` function has been reimplemented in C to " -"make it up to 15 times faster. (Contributed by Yury Selivanov in :issue:" -"`32296`.)" +"make it up to 15 times faster. (Contributed by Yury Selivanov " +"in :issue:`32296`.)" msgstr "" #: ../../whatsnew/3.7.rst:1810 @@ -2640,16 +2666,17 @@ msgstr "" #: ../../whatsnew/3.7.rst:1823 msgid "" -"As a result of :ref:`PEP 560 work <whatsnew37-pep560>`, the import time of :" -"mod:`typing` has been reduced by a factor of 7, and many typing operations " -"are now faster. (Contributed by Ivan Levkivskyi in :issue:`32226`.)" +"As a result of :ref:`PEP 560 work <whatsnew37-pep560>`, the import time " +"of :mod:`typing` has been reduced by a factor of 7, and many typing " +"operations are now faster. (Contributed by Ivan Levkivskyi " +"in :issue:`32226`.)" msgstr "" #: ../../whatsnew/3.7.rst:1828 msgid "" ":func:`sorted` and :meth:`list.sort` have been optimized for common cases to " -"be up to 40-75% faster. (Contributed by Elliot Gorokhovsky in :issue:" -"`28685`.)" +"be up to 40-75% faster. (Contributed by Elliot Gorokhovsky " +"in :issue:`28685`.)" msgstr "" #: ../../whatsnew/3.7.rst:1832 @@ -2661,8 +2688,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1835 msgid "" ":func:`hasattr` and :func:`getattr` are now about 4 times faster when *name* " -"is not found and *obj* does not override :meth:`object.__getattr__` or :meth:" -"`object.__getattribute__`. (Contributed by INADA Naoki in :issue:`32544`.)" +"is not found and *obj* does not override :meth:`object.__getattr__` " +"or :meth:`object.__getattribute__`. (Contributed by INADA Naoki " +"in :issue:`32544`.)" msgstr "" #: ../../whatsnew/3.7.rst:1840 @@ -2711,39 +2739,39 @@ msgstr "" msgid "" ":func:`re.compile` now converts ``flags`` parameter to int object if it is " "``RegexFlag``. It is now as fast as Python 3.5, and faster than Python 3.6 " -"by about 10% depending on the pattern. (Contributed by INADA Naoki in :issue:" -"`31671`.)" +"by about 10% depending on the pattern. (Contributed by INADA Naoki " +"in :issue:`31671`.)" msgstr "" #: ../../whatsnew/3.7.rst:1871 msgid "" -"The :meth:`~selectors.BaseSelector.modify` methods of classes :class:" -"`selectors.EpollSelector`, :class:`selectors.PollSelector` and :class:" -"`selectors.DevpollSelector` may be around 10% faster under heavy loads. " -"(Contributed by Giampaolo Rodola' in :issue:`30014`)" +"The :meth:`~selectors.BaseSelector.modify` methods of " +"classes :class:`selectors.EpollSelector`, :class:`selectors.PollSelector` " +"and :class:`selectors.DevpollSelector` may be around 10% faster under heavy " +"loads. (Contributed by Giampaolo Rodola' in :issue:`30014`)" msgstr "" #: ../../whatsnew/3.7.rst:1876 msgid "" "Constant folding has been moved from the peephole optimizer to the new AST " "optimizer, which is able perform optimizations more consistently. " -"(Contributed by Eugene Toder and INADA Naoki in :issue:`29469` and :issue:" -"`11549`.)" +"(Contributed by Eugene Toder and INADA Naoki in :issue:`29469` " +"and :issue:`11549`.)" msgstr "" #: ../../whatsnew/3.7.rst:1881 msgid "" "Most functions and methods in :mod:`abc` have been rewritten in C. This " -"makes creation of abstract base classes, and calling :func:`isinstance` and :" -"func:`issubclass` on them 1.5x faster. This also reduces Python start-up " -"time by up to 10%. (Contributed by Ivan Levkivskyi and INADA Naoki in :issue:" -"`31333`)" +"makes creation of abstract base classes, and calling :func:`isinstance` " +"and :func:`issubclass` on them 1.5x faster. This also reduces Python start-" +"up time by up to 10%. (Contributed by Ivan Levkivskyi and INADA Naoki " +"in :issue:`31333`)" msgstr "" #: ../../whatsnew/3.7.rst:1887 msgid "" -"Significant speed improvements to alternate constructors for :class:" -"`datetime.date` and :class:`datetime.datetime` by using fast-path " +"Significant speed improvements to alternate constructors " +"for :class:`datetime.date` and :class:`datetime.datetime` by using fast-path " "constructors when not constructing subclasses. (Contributed by Paul Ganssle " "in :issue:`32403`)" msgstr "" @@ -2770,9 +2798,10 @@ msgstr "" #: ../../whatsnew/3.7.rst:1905 msgid "" "Trace hooks may now opt out of receiving the ``line`` and opt into receiving " -"the ``opcode`` events from the interpreter by setting the corresponding new :" -"attr:`~frame.f_trace_lines` and :attr:`~frame.f_trace_opcodes` attributes on " -"the frame being traced. (Contributed by Nick Coghlan in :issue:`31344`.)" +"the ``opcode`` events from the interpreter by setting the corresponding " +"new :attr:`~frame.f_trace_lines` and :attr:`~frame.f_trace_opcodes` " +"attributes on the frame being traced. (Contributed by Nick Coghlan " +"in :issue:`31344`.)" msgstr "" #: ../../whatsnew/3.7.rst:1910 @@ -2782,8 +2811,8 @@ msgid "" "(previously unset), and their ``__spec__.origin`` is also set to ``None`` " "(previously the string ``\"namespace\"``). See :issue:`32305`. Also, the " "namespace module object's ``__spec__.loader`` is set to the same value as " -"``__loader__`` (previously, the former was set to ``None``). See :issue:" -"`32303`." +"``__loader__`` (previously, the former was set to ``None``). " +"See :issue:`32303`." msgstr "" #: ../../whatsnew/3.7.rst:1918 @@ -2797,8 +2826,8 @@ msgstr "" msgid "" "The ``distutils`` ``upload`` command no longer tries to change CR end-of-" "line characters to CRLF. This fixes a corruption issue with sdists that " -"ended with a byte equivalent to CR. (Contributed by Bo Bayles in :issue:" -"`32304`.)" +"ended with a byte equivalent to CR. (Contributed by Bo Bayles " +"in :issue:`32304`.)" msgstr "" #: ../../whatsnew/3.7.rst:1929 @@ -2823,8 +2852,9 @@ msgstr "" msgid "" "Returning a subclass of :class:`complex` from :meth:`object.__complex__` is " "deprecated and will be an error in future Python versions. This makes " -"``__complex__()`` consistent with :meth:`object.__int__` and :meth:`object." -"__float__`. (Contributed by Serhiy Storchaka in :issue:`28894`.)" +"``__complex__()`` consistent with :meth:`object.__int__` " +"and :meth:`object.__float__`. (Contributed by Serhiy Storchaka " +"in :issue:`28894`.)" msgstr "" #: ../../whatsnew/3.7.rst:1951 @@ -2838,8 +2868,8 @@ msgstr "aifc" #: ../../whatsnew/3.7.rst:1956 msgid "" ":func:`!aifc.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`!aifc.open` instead. (Contributed by Brian Curtin in :issue:" -"`31985`.)" +"Use :func:`!aifc.open` instead. (Contributed by Brian Curtin " +"in :issue:`31985`.)" msgstr "" #: ../../whatsnew/3.7.rst:1966 @@ -2847,15 +2877,15 @@ msgid "" "Support for directly ``await``-ing instances of :class:`asyncio.Lock` and " "other asyncio synchronization primitives has been deprecated. An " "asynchronous context manager must be used in order to acquire and release " -"the synchronization resource. (Contributed by Andrew Svetlov in :issue:" -"`32253`.)" +"the synchronization resource. (Contributed by Andrew Svetlov " +"in :issue:`32253`.)" msgstr "" #: ../../whatsnew/3.7.rst:1972 msgid "" "The :meth:`!asyncio.Task.current_task` and :meth:`!asyncio.Task.all_tasks` " -"methods have been deprecated. (Contributed by Andrew Svetlov in :issue:" -"`32250`.)" +"methods have been deprecated. (Contributed by Andrew Svetlov " +"in :issue:`32250`.)" msgstr "" #: ../../whatsnew/3.7.rst:1980 @@ -2881,8 +2911,8 @@ msgid "" "classes will raise a :exc:`TypeError` (e.g. ``1 in Color``); similarly, " "attempting to check for non-Flag objects in a :class:`Flag` member will " "raise :exc:`TypeError` (e.g. ``1 in Perm.RW``); currently, both operations " -"return :const:`False` instead. (Contributed by Ethan Furman in :issue:" -"`33217`.)" +"return :const:`False` instead. (Contributed by Ethan Furman " +"in :issue:`33217`.)" msgstr "" #: ../../whatsnew/3.7.rst:2009 @@ -2892,18 +2922,19 @@ msgstr "gettext" #: ../../whatsnew/3.7.rst:2011 msgid "" "Using non-integer value for selecting a plural form in :mod:`gettext` is now " -"deprecated. It never correctly worked. (Contributed by Serhiy Storchaka in :" -"issue:`28692`.)" +"deprecated. It never correctly worked. (Contributed by Serhiy Storchaka " +"in :issue:`28692`.)" msgstr "" #: ../../whatsnew/3.7.rst:2019 msgid "" -"Methods :meth:`!MetaPathFinder.find_module` (replaced by :meth:" -"`MetaPathFinder.find_spec() <importlib.abc.MetaPathFinder.find_spec>`) and :" -"meth:`!PathEntryFinder.find_loader` (replaced by :meth:`PathEntryFinder." -"find_spec() <importlib.abc.PathEntryFinder.find_spec>`) both deprecated in " -"Python 3.4 now emit :exc:`DeprecationWarning`. (Contributed by Matthias " -"Bussonnier in :issue:`29576`.)" +"Methods :meth:`!MetaPathFinder.find_module` (replaced " +"by :meth:`MetaPathFinder.find_spec() " +"<importlib.abc.MetaPathFinder.find_spec>`) and :meth:`!" +"PathEntryFinder.find_loader` (replaced by :meth:`PathEntryFinder.find_spec() " +"<importlib.abc.PathEntryFinder.find_spec>`) both deprecated in Python 3.4 " +"now emit :exc:`DeprecationWarning`. (Contributed by Matthias Bussonnier " +"in :issue:`29576`.)" msgstr "" #: ../../whatsnew/3.7.rst:2030 @@ -2935,22 +2966,24 @@ msgstr "threading" #: ../../whatsnew/3.7.rst:2051 msgid "" ":mod:`!dummy_threading` and :mod:`!_dummy_thread` have been deprecated. It " -"is no longer possible to build Python with threading disabled. Use :mod:" -"`threading` instead. (Contributed by Antoine Pitrou in :issue:`31370`.)" +"is no longer possible to build Python with threading disabled. " +"Use :mod:`threading` instead. (Contributed by Antoine Pitrou " +"in :issue:`31370`.)" msgstr "" #: ../../whatsnew/3.7.rst:2060 msgid "" -"The silent argument value truncation in :func:`socket.htons` and :func:" -"`socket.ntohs` has been deprecated. In future versions of Python, if the " -"passed argument is larger than 16 bits, an exception will be raised. " +"The silent argument value truncation in :func:`socket.htons` " +"and :func:`socket.ntohs` has been deprecated. In future versions of Python, " +"if the passed argument is larger than 16 bits, an exception will be raised. " "(Contributed by Oren Milman in :issue:`28332`.)" msgstr "" #: ../../whatsnew/3.7.rst:2069 msgid "" -":func:`ssl.wrap_socket` is deprecated. Use :meth:`ssl.SSLContext." -"wrap_socket` instead. (Contributed by Christian Heimes in :issue:`28124`.)" +":func:`ssl.wrap_socket` is deprecated. " +"Use :meth:`ssl.SSLContext.wrap_socket` instead. (Contributed by Christian " +"Heimes in :issue:`28124`.)" msgstr "" #: ../../whatsnew/3.7.rst:2075 @@ -2960,21 +2993,21 @@ msgstr "sunau" #: ../../whatsnew/3.7.rst:2077 msgid "" ":func:`!sunau.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`!sunau.open` instead. (Contributed by Brian Curtin in :issue:" -"`31985`.)" +"Use :func:`!sunau.open` instead. (Contributed by Brian Curtin " +"in :issue:`31985`.)" msgstr "" #: ../../whatsnew/3.7.rst:2085 msgid "" -"Deprecated :func:`sys.set_coroutine_wrapper` and :func:`sys." -"get_coroutine_wrapper`." +"Deprecated :func:`sys.set_coroutine_wrapper` " +"and :func:`sys.get_coroutine_wrapper`." msgstr "" #: ../../whatsnew/3.7.rst:2088 msgid "" "The undocumented ``sys.callstats()`` function has been deprecated and will " -"be removed in a future Python version. (Contributed by Victor Stinner in :" -"issue:`28799`.)" +"be removed in a future Python version. (Contributed by Victor Stinner " +"in :issue:`28799`.)" msgstr "" #: ../../whatsnew/3.7.rst:2094 @@ -2984,8 +3017,8 @@ msgstr "wave" #: ../../whatsnew/3.7.rst:2096 msgid "" ":func:`wave.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`wave.open` instead. (Contributed by Brian Curtin in :issue:" -"`31985`.)" +"Use :func:`wave.open` instead. (Contributed by Brian Curtin " +"in :issue:`31985`.)" msgstr "" #: ../../whatsnew/3.7.rst:2102 @@ -2997,16 +3030,16 @@ msgid "" "Function :c:func:`PySlice_GetIndicesEx` is deprecated and replaced with a " "macro if ``Py_LIMITED_API`` is not set or set to a value in the range " "between ``0x03050400`` and ``0x03060000`` (not inclusive), or is " -"``0x03060100`` or higher. (Contributed by Serhiy Storchaka in :issue:" -"`27867`.)" +"``0x03060100`` or higher. (Contributed by Serhiy Storchaka " +"in :issue:`27867`.)" msgstr "" #: ../../whatsnew/3.7.rst:2109 msgid "" -":c:func:`PyOS_AfterFork` has been deprecated. Use :c:func:" -"`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` or :c:func:" -"`PyOS_AfterFork_Child()` instead. (Contributed by Antoine Pitrou in :issue:" -"`16500`.)" +":c:func:`PyOS_AfterFork` has been deprecated. " +"Use :c:func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` " +"or :c:func:`PyOS_AfterFork_Child()` instead. (Contributed by Antoine Pitrou " +"in :issue:`16500`.)" msgstr "" #: ../../whatsnew/3.7.rst:2117 @@ -3051,15 +3084,15 @@ msgstr "" #: ../../whatsnew/3.7.rst:2136 msgid "" "CPython's own `CI configuration file <https://github.com/python/cpython/blob/" -"v3.7.13/.travis.yml>`_ provides an example of using the SSL :source:" -"`compatibility testing infrastructure <Tools/ssl/multissltests.py>` in " -"CPython's test suite to build and link against OpenSSL 1.1.0 rather than an " -"outdated system provided OpenSSL." +"v3.7.13/.travis.yml>`_ provides an example of using the " +"SSL :source:`compatibility testing infrastructure <Tools/ssl/" +"multissltests.py>` in CPython's test suite to build and link against OpenSSL " +"1.1.0 rather than an outdated system provided OpenSSL." msgstr "" #: ../../whatsnew/3.7.rst:2145 msgid "API and Feature Removals" -msgstr "" +msgstr "API 與功能的移除" #: ../../whatsnew/3.7.rst:2147 msgid "The following features and APIs have been removed from Python 3.7:" @@ -3111,9 +3144,9 @@ msgstr "" msgid "" "Removed previously deprecated in Python 2.4 classes ``Plist``, ``Dict`` and " "``_InternalDict`` in the :mod:`plistlib` module. Dict values in the result " -"of functions :func:`~plistlib.readPlist` and :func:`~plistlib." -"readPlistFromBytes` are now normal dicts. You no longer can use attribute " -"access to access items of these dictionaries." +"of functions :func:`~plistlib.readPlist` " +"and :func:`~plistlib.readPlistFromBytes` are now normal dicts. You no " +"longer can use attribute access to access items of these dictionaries." msgstr "" #: ../../whatsnew/3.7.rst:2180 @@ -3135,9 +3168,9 @@ msgstr "" msgid "" "Direct instantiation of :class:`ssl.SSLSocket` and :class:`ssl.SSLObject` " "objects is now prohibited. The constructors were never documented, tested, " -"or designed as public constructors. Users were supposed to use :func:`ssl." -"wrap_socket` or :class:`ssl.SSLContext`. (Contributed by Christian Heimes " -"in :issue:`32951`.)" +"or designed as public constructors. Users were supposed to " +"use :func:`ssl.wrap_socket` or :class:`ssl.SSLContext`. (Contributed by " +"Christian Heimes in :issue:`32951`.)" msgstr "" #: ../../whatsnew/3.7.rst:2197 @@ -3193,7 +3226,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:2237 msgid "Changes in Python Behavior" -msgstr "" +msgstr "Python 行為的改變" #: ../../whatsnew/3.7.rst:2239 msgid "" @@ -3204,10 +3237,10 @@ msgstr "" #: ../../whatsnew/3.7.rst:2243 msgid "" -":pep:`479` is enabled for all code in Python 3.7, meaning that :exc:" -"`StopIteration` exceptions raised directly or indirectly in coroutines and " -"generators are transformed into :exc:`RuntimeError` exceptions. (Contributed " -"by Yury Selivanov in :issue:`32670`.)" +":pep:`479` is enabled for all code in Python 3.7, meaning " +"that :exc:`StopIteration` exceptions raised directly or indirectly in " +"coroutines and generators are transformed into :exc:`RuntimeError` " +"exceptions. (Contributed by Yury Selivanov in :issue:`32670`.)" msgstr "" #: ../../whatsnew/3.7.rst:2249 @@ -3239,8 +3272,8 @@ msgid "" "Python 3.7 now correctly raises a :exc:`SyntaxError`, as a generator " "expression always needs to be directly inside a set of parentheses and " "cannot have a comma on either side, and the duplication of the parentheses " -"can be omitted only on calls. (Contributed by Serhiy Storchaka in :issue:" -"`32012` and :issue:`32023`.)" +"can be omitted only on calls. (Contributed by Serhiy Storchaka " +"in :issue:`32012` and :issue:`32023`.)" msgstr "" #: ../../whatsnew/3.7.rst:2266 @@ -3257,22 +3290,24 @@ msgstr "" #: ../../whatsnew/3.7.rst:2276 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.7.rst:2278 msgid "" ":meth:`socketserver.ThreadingMixIn.server_close` now waits until all non-" -"daemon threads complete. Set the new :attr:`socketserver.ThreadingMixIn." -"block_on_close` class attribute to ``False`` to get the pre-3.7 behaviour. " -"(Contributed by Victor Stinner in :issue:`31233` and :issue:`33540`.)" +"daemon threads complete. Set the " +"new :attr:`socketserver.ThreadingMixIn.block_on_close` class attribute to " +"``False`` to get the pre-3.7 behaviour. (Contributed by Victor Stinner " +"in :issue:`31233` and :issue:`33540`.)" msgstr "" #: ../../whatsnew/3.7.rst:2284 msgid "" ":meth:`socketserver.ForkingMixIn.server_close` now waits until all child " -"processes complete. Set the new :attr:`socketserver.ForkingMixIn." -"block_on_close` class attribute to ``False`` to get the pre-3.7 behaviour. " -"(Contributed by Victor Stinner in :issue:`31151` and :issue:`33540`.)" +"processes complete. Set the " +"new :attr:`socketserver.ForkingMixIn.block_on_close` class attribute to " +"``False`` to get the pre-3.7 behaviour. (Contributed by Victor Stinner " +"in :issue:`31151` and :issue:`33540`.)" msgstr "" #: ../../whatsnew/3.7.rst:2290 @@ -3291,19 +3326,19 @@ msgstr "" #: ../../whatsnew/3.7.rst:2298 msgid "" -"A format string argument for :meth:`string.Formatter.format` is now :ref:" -"`positional-only <positional-only_parameter>`. Passing it as a keyword " -"argument was deprecated in Python 3.5. (Contributed by Serhiy Storchaka in :" -"issue:`29193`.)" +"A format string argument for :meth:`string.Formatter.format` is " +"now :ref:`positional-only <positional-only_parameter>`. Passing it as a " +"keyword argument was deprecated in Python 3.5. (Contributed by Serhiy " +"Storchaka in :issue:`29193`.)" msgstr "" #: ../../whatsnew/3.7.rst:2303 msgid "" -"Attributes :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel." -"value` and :attr:`~http.cookies.Morsel.coded_value` of class :class:`http." -"cookies.Morsel` are now read-only. Assigning to them was deprecated in " -"Python 3.5. Use the :meth:`~http.cookies.Morsel.set` method for setting " -"them. (Contributed by Serhiy Storchaka in :issue:`29192`.)" +"Attributes :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel.value` " +"and :attr:`~http.cookies.Morsel.coded_value` of " +"class :class:`http.cookies.Morsel` are now read-only. Assigning to them was " +"deprecated in Python 3.5. Use the :meth:`~http.cookies.Morsel.set` method " +"for setting them. (Contributed by Serhiy Storchaka in :issue:`29192`.)" msgstr "" #: ../../whatsnew/3.7.rst:2311 @@ -3316,8 +3351,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:2317 msgid "" -"The :attr:`struct.Struct.format` type is now :class:`str` instead of :class:" -"`bytes`. (Contributed by Victor Stinner in :issue:`21071`.)" +"The :attr:`struct.Struct.format` type is now :class:`str` instead " +"of :class:`bytes`. (Contributed by Victor Stinner in :issue:`21071`.)" msgstr "" #: ../../whatsnew/3.7.rst:2320 @@ -3350,10 +3385,10 @@ msgstr "" #: ../../whatsnew/3.7.rst:2337 msgid "" -"Because :func:`shutil.rmtree` is now implemented using the :func:`os." -"scandir` function, the user specified handler *onerror* is now called with " -"the first argument ``os.scandir`` instead of ``os.listdir`` when listing the " -"directory is failed." +"Because :func:`shutil.rmtree` is now implemented using " +"the :func:`os.scandir` function, the user specified handler *onerror* is now " +"called with the first argument ``os.scandir`` instead of ``os.listdir`` when " +"listing the directory is failed." msgstr "" #: ../../whatsnew/3.7.rst:2342 @@ -3416,40 +3451,43 @@ msgstr "" #: ../../whatsnew/3.7.rst:2385 msgid "" -"On OSes that support :const:`socket.SOCK_NONBLOCK` or :const:`socket." -"SOCK_CLOEXEC` bit flags, the :attr:`socket.type <socket.socket.type>` no " -"longer has them applied. Therefore, checks like ``if sock.type == socket." -"SOCK_STREAM`` work as expected on all platforms. (Contributed by Yury " -"Selivanov in :issue:`32331`.)" +"On OSes that support :const:`socket.SOCK_NONBLOCK` " +"or :const:`socket.SOCK_CLOEXEC` bit flags, the :attr:`socket.type " +"<socket.socket.type>` no longer has them applied. Therefore, checks like " +"``if sock.type == socket.SOCK_STREAM`` work as expected on all platforms. " +"(Contributed by Yury Selivanov in :issue:`32331`.)" msgstr "" #: ../../whatsnew/3.7.rst:2392 msgid "" -"On Windows the default for the *close_fds* argument of :class:`subprocess." -"Popen` was changed from :const:`False` to :const:`True` when redirecting the " -"standard handles. If you previously depended on handles being inherited when " -"using :class:`subprocess.Popen` with standard io redirection, you will have " -"to pass ``close_fds=False`` to preserve the previous behaviour, or use :attr:" -"`STARTUPINFO.lpAttributeList <subprocess.STARTUPINFO.lpAttributeList>`." +"On Windows the default for the *close_fds* argument " +"of :class:`subprocess.Popen` was changed from :const:`False` " +"to :const:`True` when redirecting the standard handles. If you previously " +"depended on handles being inherited when using :class:`subprocess.Popen` " +"with standard io redirection, you will have to pass ``close_fds=False`` to " +"preserve the previous behaviour, or use :attr:`STARTUPINFO.lpAttributeList " +"<subprocess.STARTUPINFO.lpAttributeList>`." msgstr "" #: ../../whatsnew/3.7.rst:2400 msgid "" ":meth:`importlib.machinery.PathFinder.invalidate_caches` -- which implicitly " -"affects :func:`importlib.invalidate_caches` -- now deletes entries in :data:" -"`sys.path_importer_cache` which are set to ``None``. (Contributed by Brett " -"Cannon in :issue:`33169`.)" +"affects :func:`importlib.invalidate_caches` -- now deletes entries " +"in :data:`sys.path_importer_cache` which are set to ``None``. (Contributed " +"by Brett Cannon in :issue:`33169`.)" msgstr "" #: ../../whatsnew/3.7.rst:2405 msgid "" -"In :mod:`asyncio`, :meth:`loop.sock_recv() <asyncio.loop.sock_recv>`, :meth:" -"`loop.sock_sendall() <asyncio.loop.sock_sendall>`, :meth:`loop.sock_accept() " -"<asyncio.loop.sock_accept>`, :meth:`loop.getaddrinfo() <asyncio.loop." -"getaddrinfo>`, :meth:`loop.getnameinfo() <asyncio.loop.getnameinfo>` have " -"been changed to be proper coroutine methods to match their documentation. " -"Previously, these methods returned :class:`asyncio.Future` instances. " -"(Contributed by Yury Selivanov in :issue:`32327`.)" +"In :mod:`asyncio`, :meth:`loop.sock_recv() " +"<asyncio.loop.sock_recv>`, :meth:`loop.sock_sendall() " +"<asyncio.loop.sock_sendall>`, :meth:`loop.sock_accept() " +"<asyncio.loop.sock_accept>`, :meth:`loop.getaddrinfo() " +"<asyncio.loop.getaddrinfo>`, :meth:`loop.getnameinfo() " +"<asyncio.loop.getnameinfo>` have been changed to be proper coroutine methods " +"to match their documentation. Previously, these methods " +"returned :class:`asyncio.Future` instances. (Contributed by Yury Selivanov " +"in :issue:`32327`.)" msgstr "" #: ../../whatsnew/3.7.rst:2416 @@ -3462,16 +3500,16 @@ msgstr "" #: ../../whatsnew/3.7.rst:2420 msgid "" ":attr:`Struct.format <struct.Struct.format>` is now a :class:`str` instance " -"instead of a :class:`bytes` instance. (Contributed by Victor Stinner in :" -"issue:`21071`.)" +"instead of a :class:`bytes` instance. (Contributed by Victor Stinner " +"in :issue:`21071`.)" msgstr "" #: ../../whatsnew/3.7.rst:2424 msgid "" ":mod:`argparse` subparsers can now be made mandatory by passing " -"``required=True`` to :meth:`ArgumentParser.add_subparsers() <argparse." -"ArgumentParser.add_subparsers>`. (Contributed by Anthony Sottile in :issue:" -"`26510`.)" +"``required=True`` to :meth:`ArgumentParser.add_subparsers() " +"<argparse.ArgumentParser.add_subparsers>`. (Contributed by Anthony Sottile " +"in :issue:`26510`.)" msgstr "" #: ../../whatsnew/3.7.rst:2428 @@ -3489,8 +3527,9 @@ msgid "" "cannot tolerate such exceptions, the new :meth:`Calendar.itermonthdays3 " "<calendar.Calendar.itermonthdays3>` and :meth:`Calendar.itermonthdays4 " "<calendar.Calendar.itermonthdays4>` can be used. The new methods return " -"tuples and are not restricted by the range supported by :class:`datetime." -"date`. (Contributed by Alexander Belopolsky in :issue:`28292`.)" +"tuples and are not restricted by the range supported " +"by :class:`datetime.date`. (Contributed by Alexander Belopolsky " +"in :issue:`28292`.)" msgstr "" #: ../../whatsnew/3.7.rst:2442 @@ -3502,9 +3541,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:2445 msgid "" "The ``submit()`` method of :class:`concurrent.futures.ThreadPoolExecutor` " -"and :class:`concurrent.futures.ProcessPoolExecutor` now raises a :exc:" -"`RuntimeError` if called during interpreter shutdown. (Contributed by Mark " -"Nemec in :issue:`33097`.)" +"and :class:`concurrent.futures.ProcessPoolExecutor` now raises " +"a :exc:`RuntimeError` if called during interpreter shutdown. (Contributed by " +"Mark Nemec in :issue:`33097`.)" msgstr "" #: ../../whatsnew/3.7.rst:2450 @@ -3518,9 +3557,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:2456 msgid "" -"Several undocumented internal imports were removed. One example is that ``os." -"errno`` is no longer available; use ``import errno`` directly instead. Note " -"that such undocumented internal imports may be removed any time without " +"Several undocumented internal imports were removed. One example is that " +"``os.errno`` is no longer available; use ``import errno`` directly instead. " +"Note that such undocumented internal imports may be removed any time without " "notice, even in micro version releases." msgstr "" @@ -3531,13 +3570,13 @@ msgstr "C API 中的改動" #: ../../whatsnew/3.7.rst:2466 msgid "" "The function :c:func:`PySlice_GetIndicesEx` is considered unsafe for " -"resizable sequences. If the slice indices are not instances of :class:" -"`int`, but objects that implement the :meth:`!__index__` method, the " -"sequence can be resized after passing its length to :c:func:`!" +"resizable sequences. If the slice indices are not instances " +"of :class:`int`, but objects that implement the :meth:`!__index__` method, " +"the sequence can be resized after passing its length to :c:func:`!" "PySlice_GetIndicesEx`. This can lead to returning indices out of the length " -"of the sequence. For avoiding possible problems use new functions :c:func:" -"`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices`. (Contributed by Serhiy " -"Storchaka in :issue:`27867`.)" +"of the sequence. For avoiding possible problems use new " +"functions :c:func:`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices`. " +"(Contributed by Serhiy Storchaka in :issue:`27867`.)" msgstr "" #: ../../whatsnew/3.7.rst:2477 @@ -3559,9 +3598,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:2489 msgid "" "The file used to override :data:`sys.path` is now called ``<python-" -"executable>._pth`` instead of ``'sys.path'``. See :ref:" -"`windows_finding_modules` for more information. (Contributed by Steve Dower " -"in :issue:`28137`.)" +"executable>._pth`` instead of ``'sys.path'``. " +"See :ref:`windows_finding_modules` for more information. (Contributed by " +"Steve Dower in :issue:`28137`.)" msgstr "" #: ../../whatsnew/3.7.rst:2496 @@ -3603,8 +3642,8 @@ msgid "" "setting :c:data:`Py_BytesWarningFlag` to a value greater than one is no " "longer sufficient to both emit :exc:`BytesWarning` messages and have them " "converted to exceptions. Instead, the flag must be set (to cause the " -"warnings to be emitted in the first place), and an explicit ``error::" -"BytesWarning`` warnings filter added to convert them to exceptions." +"warnings to be emitted in the first place), and an explicit " +"``error::BytesWarning`` warnings filter added to convert them to exceptions." msgstr "" #: ../../whatsnew/3.7.rst:2526 @@ -3633,8 +3672,9 @@ msgid "" "respects all of the same environment settings as :c:func:`Py_Main` (in " "earlier Python versions, it respected an ill-defined subset of those " "environment variables, while in Python 3.7.0 it didn't read any of them due " -"to :issue:`34247`). If this behavior is unwanted, set :c:data:" -"`Py_IgnoreEnvironmentFlag` to 1 before calling :c:func:`Py_Initialize`." +"to :issue:`34247`). If this behavior is unwanted, " +"set :c:data:`Py_IgnoreEnvironmentFlag` to 1 before " +"calling :c:func:`Py_Initialize`." msgstr "" #: ../../whatsnew/3.7.rst:2546 @@ -3672,12 +3712,12 @@ msgstr "Python 3.7.6 中顯著的變更" #: ../../whatsnew/3.7.rst:2568 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" #: ../../whatsnew/3.7.rst:2576 @@ -3687,13 +3727,14 @@ msgstr "Python 3.7.10 中顯著的變更" #: ../../whatsnew/3.7.rst:2578 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" msgstr "" #: ../../whatsnew/3.7.rst:2589 @@ -3715,8 +3756,8 @@ msgid "" "forms of attacks. Following the WHATWG specification that updates RFC 3986, " "ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are stripped from " "the URL by the parser :func:`urllib.parse` preventing such attacks. The " -"removal characters are controlled by a new module level variable ``urllib." -"parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" +"removal characters are controlled by a new module level variable " +"``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" #: ../../whatsnew/3.7.rst:2606 diff --git a/whatsnew/3.8.po b/whatsnew/3.8.po index a537637276..d736d9a29a 100644 --- a/whatsnew/3.8.po +++ b/whatsnew/3.8.po @@ -32,8 +32,8 @@ msgstr "Raymond Hettinger" #: ../../whatsnew/3.8.rst:47 msgid "" "This article explains the new features in Python 3.8, compared to 3.7. " -"Python 3.8 was released on October 14, 2019. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.8 was released on October 14, 2019. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.8 與 3.7 相比多了哪些新功能。Python 3.8 已於 2019 年 10 " "月 14 日發布。有關完整詳細資訊,請參閱 :ref:`changelog <changelog>`。" @@ -54,8 +54,9 @@ msgstr "" msgid "" "There is new syntax ``:=`` that assigns values to variables as part of a " "larger expression. It is affectionately known as \"the walrus operator\" due " -"to its resemblance to `the eyes and tusks of a walrus <https://en.wikipedia." -"org/wiki/Walrus#/media/File:Pacific_Walrus_-_Bull_(8247646168).jpg>`_." +"to its resemblance to `the eyes and tusks of a walrus <https://" +"en.wikipedia.org/wiki/Walrus#/media/File:Pacific_Walrus_-" +"_Bull_(8247646168).jpg>`_." msgstr "" #: ../../whatsnew/3.8.rst:82 @@ -138,8 +139,8 @@ msgid "" "There is a new function parameter syntax ``/`` to indicate that some " "function parameters must be specified positionally and cannot be used as " "keyword arguments. This is the same notation shown by ``help()`` for C " -"functions annotated with Larry Hastings' `Argument Clinic <https://devguide." -"python.org/development-tools/clinic/>`__ tool." +"functions annotated with Larry Hastings' `Argument Clinic <https://" +"devguide.python.org/development-tools/clinic/>`__ tool." msgstr "" #: ../../whatsnew/3.8.rst:128 @@ -272,8 +273,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:201 msgid "" -"The location of the cache is reported in :data:`sys.pycache_prefix` (:const:" -"`None` indicates the default location in ``__pycache__`` subdirectories)." +"The location of the cache is reported in :data:`sys.pycache_prefix` " +"(:const:`None` indicates the default location in ``__pycache__`` " +"subdirectories)." msgstr "" #: ../../whatsnew/3.8.rst:205 @@ -296,10 +298,10 @@ msgid "" "Release builds and :ref:`debug builds <debug-build>` are now ABI compatible: " "defining the ``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` " "macro, which introduces the only ABI incompatibility. The ``Py_TRACE_REFS`` " -"macro, which adds the :func:`sys.getobjects` function and the :envvar:" -"`PYTHONDUMPREFS` environment variable, can be set using the new :option:`./" -"configure --with-trace-refs <--with-trace-refs>` build option. (Contributed " -"by Victor Stinner in :issue:`36465`.)" +"macro, which adds the :func:`sys.getobjects` function and " +"the :envvar:`PYTHONDUMPREFS` environment variable, can be set using the " +"new :option:`./configure --with-trace-refs <--with-trace-refs>` build " +"option. (Contributed by Victor Stinner in :issue:`36465`.)" msgstr "" #: ../../whatsnew/3.8.rst:223 @@ -341,8 +343,8 @@ msgid "" "On the other hand, ``pkg-config python3.8 --libs`` no longer contains ``-" "lpython3.8``. C extensions must not be linked to libpython (except on " "Android and Cygwin, whose cases are handled by the script); this change is " -"backward incompatible on purpose. (Contributed by Victor Stinner in :issue:" -"`36721`.)" +"backward incompatible on purpose. (Contributed by Victor Stinner " +"in :issue:`36721`.)" msgstr "" #: ../../whatsnew/3.8.rst:256 @@ -576,8 +578,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:354 msgid "" ":ref:`vectorcall` is added to the Python/C API. It is meant to formalize " -"existing optimizations which were already done for various classes. Any :ref:" -"`static type <static-types>` implementing a callable can use this protocol." +"existing optimizations which were already done for various classes. " +"Any :ref:`static type <static-types>` implementing a callable can use this " +"protocol." msgstr "" #: ../../whatsnew/3.8.rst:360 @@ -592,8 +595,8 @@ msgstr "完整敘述請見 :pep:`590`。" #: ../../whatsnew/3.8.rst:365 msgid "" -"(Contributed by Jeroen Demeyer, Mark Shannon and Petr Viktorin in :issue:" -"`36974`.)" +"(Contributed by Jeroen Demeyer, Mark Shannon and Petr Viktorin " +"in :issue:`36974`.)" msgstr "" "(由 Jeroen Demeyer、Mark Shannon 和 Petr Viktorin 在 :issue:`36974` 中貢" "獻。)" @@ -639,19 +642,19 @@ msgstr "" #: ../../whatsnew/3.8.rst:393 msgid "" "The :class:`bool`, :class:`int`, and :class:`fractions.Fraction` types now " -"have an :meth:`~int.as_integer_ratio` method like that found in :class:" -"`float` and :class:`decimal.Decimal`. This minor API extension makes it " -"possible to write ``numerator, denominator = x.as_integer_ratio()`` and have " -"it work across multiple numeric types. (Contributed by Lisa Roach in :issue:" -"`33073` and Raymond Hettinger in :issue:`37819`.)" +"have an :meth:`~int.as_integer_ratio` method like that found " +"in :class:`float` and :class:`decimal.Decimal`. This minor API extension " +"makes it possible to write ``numerator, denominator = x.as_integer_ratio()`` " +"and have it work across multiple numeric types. (Contributed by Lisa Roach " +"in :issue:`33073` and Raymond Hettinger in :issue:`37819`.)" msgstr "" #: ../../whatsnew/3.8.rst:401 msgid "" "Constructors of :class:`int`, :class:`float` and :class:`complex` will now " "use the :meth:`~object.__index__` special method, if available and the " -"corresponding method :meth:`~object.__int__`, :meth:`~object.__float__` or :" -"meth:`~object.__complex__` is not available. (Contributed by Serhiy " +"corresponding method :meth:`~object.__int__`, :meth:`~object.__float__` " +"or :meth:`~object.__complex__` is not available. (Contributed by Serhiy " "Storchaka in :issue:`20092`.)" msgstr "" @@ -680,8 +683,8 @@ msgstr "(由 Jonathan Eunice 和 Serhiy Storchaka 在 :issue:`30688` 中貢獻 #: ../../whatsnew/3.8.rst:416 msgid "" -"Dict and dictviews are now iterable in reversed insertion order using :func:" -"`reversed`. (Contributed by Rémi Lapeyre in :issue:`33462`.)" +"Dict and dictviews are now iterable in reversed insertion order " +"using :func:`reversed`. (Contributed by Rémi Lapeyre in :issue:`33462`.)" msgstr "" #: ../../whatsnew/3.8.rst:419 @@ -689,8 +692,8 @@ msgid "" "The syntax allowed for keyword names in function calls was further " "restricted. In particular, ``f((keyword)=arg)`` is no longer allowed. It was " "never intended to permit more than a bare name on the left-hand side of a " -"keyword argument assignment term. (Contributed by Benjamin Peterson in :" -"issue:`34641`.)" +"keyword argument assignment term. (Contributed by Benjamin Peterson " +"in :issue:`34641`.)" msgstr "" #: ../../whatsnew/3.8.rst:425 @@ -730,12 +733,13 @@ msgstr "" #: ../../whatsnew/3.8.rst:445 msgid "" -"Arithmetic operations between subclasses of :class:`datetime.date` or :class:" -"`datetime.datetime` and :class:`datetime.timedelta` objects now return an " -"instance of the subclass, rather than the base class. This also affects the " -"return type of operations whose implementation (directly or indirectly) " -"uses :class:`datetime.timedelta` arithmetic, such as :meth:`~datetime." -"datetime.astimezone`. (Contributed by Paul Ganssle in :issue:`32417`.)" +"Arithmetic operations between subclasses of :class:`datetime.date` " +"or :class:`datetime.datetime` and :class:`datetime.timedelta` objects now " +"return an instance of the subclass, rather than the base class. This also " +"affects the return type of operations whose implementation (directly or " +"indirectly) uses :class:`datetime.timedelta` arithmetic, such " +"as :meth:`~datetime.datetime.astimezone`. (Contributed by Paul Ganssle " +"in :issue:`32417`.)" msgstr "" #: ../../whatsnew/3.8.rst:453 @@ -750,12 +754,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:460 msgid "" -"Some advanced styles of programming require updating the :class:`types." -"CodeType` object for an existing function. Since code objects are " -"immutable, a new code object needs to be created, one that is modeled on the " -"existing code object. With 19 parameters, this was somewhat tedious. Now, " -"the new ``replace()`` method makes it possible to create a clone with a few " -"altered parameters." +"Some advanced styles of programming require updating " +"the :class:`types.CodeType` object for an existing function. Since code " +"objects are immutable, a new code object needs to be created, one that is " +"modeled on the existing code object. With 19 parameters, this was somewhat " +"tedious. Now, the new ``replace()`` method makes it possible to create a " +"clone with a few altered parameters." msgstr "" #: ../../whatsnew/3.8.rst:467 @@ -877,9 +881,9 @@ msgid "" "elements long. Formerly, five was the limit. The new, optional sixth " "element is a callable with a ``(obj, state)`` signature. This allows the " "direct control over the state-updating behavior of a specific object. If " -"not *None*, this callable will have priority over the object's :meth:" -"`~__setstate__` method. (Contributed by Pierre Glaser and Olivier Grisel in :" -"issue:`35900`.)" +"not *None*, this callable will have priority over the " +"object's :meth:`~__setstate__` method. (Contributed by Pierre Glaser and " +"Olivier Grisel in :issue:`35900`.)" msgstr "" #: ../../whatsnew/3.8.rst:543 @@ -946,8 +950,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:584 msgid "" -"``type_comments=True`` causes it to return the text of :pep:`484` and :pep:" -"`526` type comments associated with certain AST nodes;" +"``type_comments=True`` causes it to return the text of :pep:`484` " +"and :pep:`526` type comments associated with certain AST nodes;" msgstr "" #: ../../whatsnew/3.8.rst:587 @@ -959,8 +963,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:590 msgid "" "``feature_version=(3, N)`` allows specifying an earlier Python 3 version. " -"For example, ``feature_version=(3, 4)`` will treat :keyword:`async` and :" -"keyword:`await` as non-reserved words." +"For example, ``feature_version=(3, 4)`` will treat :keyword:`async` " +"and :keyword:`await` as non-reserved words." msgstr "" #: ../../whatsnew/3.8.rst:594 @@ -1032,8 +1036,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:629 msgid "" -"The actual implementation is significantly more complex. Thus, :func:" -"`asyncio.run` should be the preferred way of running asyncio programs." +"The actual implementation is significantly more complex. " +"Thus, :func:`asyncio.run` should be the preferred way of running asyncio " +"programs." msgstr "" #: ../../whatsnew/3.8.rst:632 @@ -1074,16 +1079,17 @@ msgstr "(由 Yury Selivanov 在 :issue:`37028` 中貢獻。)" #: ../../whatsnew/3.8.rst:651 ../../whatsnew/3.8.rst:1970 msgid "" -"The exception :class:`asyncio.CancelledError` now inherits from :class:" -"`BaseException` rather than :class:`Exception` and no longer inherits from :" -"class:`concurrent.futures.CancelledError`. (Contributed by Yury Selivanov " -"in :issue:`32528`.)" +"The exception :class:`asyncio.CancelledError` now inherits " +"from :class:`BaseException` rather than :class:`Exception` and no longer " +"inherits from :class:`concurrent.futures.CancelledError`. (Contributed by " +"Yury Selivanov in :issue:`32528`.)" msgstr "" #: ../../whatsnew/3.8.rst:656 msgid "" -"On Windows, the default event loop is now :class:`~asyncio." -"ProactorEventLoop`. (Contributed by Victor Stinner in :issue:`34687`.)" +"On Windows, the default event loop is " +"now :class:`~asyncio.ProactorEventLoop`. (Contributed by Victor Stinner " +"in :issue:`34687`.)" msgstr "" #: ../../whatsnew/3.8.rst:659 @@ -1094,9 +1100,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:662 msgid "" -":class:`~asyncio.ProactorEventLoop` can now be interrupted by :exc:" -"`KeyboardInterrupt` (\"CTRL+C\"). (Contributed by Vladimir Matveev in :issue:" -"`23057`.)" +":class:`~asyncio.ProactorEventLoop` can now be interrupted " +"by :exc:`KeyboardInterrupt` (\"CTRL+C\"). (Contributed by Vladimir Matveev " +"in :issue:`23057`.)" msgstr "" #: ../../whatsnew/3.8.rst:666 @@ -1108,12 +1114,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:670 msgid "" "Asyncio tasks can now be named, either by passing the ``name`` keyword " -"argument to :func:`asyncio.create_task` or the :meth:`~asyncio.loop." -"create_task` event loop method, or by calling the :meth:`~asyncio.Task." -"set_name` method on the task object. The task name is visible in the " -"``repr()`` output of :class:`asyncio.Task` and can also be retrieved using " -"the :meth:`~asyncio.Task.get_name` method. (Contributed by Alex Grönholm in :" -"issue:`34270`.)" +"argument to :func:`asyncio.create_task` or " +"the :meth:`~asyncio.loop.create_task` event loop method, or by calling " +"the :meth:`~asyncio.Task.set_name` method on the task object. The task name " +"is visible in the ``repr()`` output of :class:`asyncio.Task` and can also be " +"retrieved using the :meth:`~asyncio.Task.get_name` method. (Contributed by " +"Alex Grönholm in :issue:`34270`.)" msgstr "" #: ../../whatsnew/3.8.rst:678 @@ -1132,12 +1138,12 @@ msgstr "builtins(內建)" #: ../../whatsnew/3.8.rst:690 msgid "" -"The :func:`compile` built-in has been improved to accept the ``ast." -"PyCF_ALLOW_TOP_LEVEL_AWAIT`` flag. With this new flag passed, :func:" -"`compile` will allow top-level ``await``, ``async for`` and ``async with`` " -"constructs that are usually considered invalid syntax. Asynchronous code " -"object marked with the ``CO_COROUTINE`` flag may then be returned. " -"(Contributed by Matthias Bussonnier in :issue:`34616`)" +"The :func:`compile` built-in has been improved to accept the " +"``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` flag. With this new flag " +"passed, :func:`compile` will allow top-level ``await``, ``async for`` and " +"``async with`` constructs that are usually considered invalid syntax. " +"Asynchronous code object marked with the ``CO_COROUTINE`` flag may then be " +"returned. (Contributed by Matthias Bussonnier in :issue:`34616`)" msgstr "" #: ../../whatsnew/3.8.rst:699 @@ -1146,13 +1152,13 @@ msgstr "collections" #: ../../whatsnew/3.8.rst:701 msgid "" -"The :meth:`~collections.somenamedtuple._asdict` method for :func:" -"`collections.namedtuple` now returns a :class:`dict` instead of a :class:" -"`collections.OrderedDict`. This works because regular dicts have guaranteed " -"ordering since Python 3.7. If the extra features of :class:`OrderedDict` are " -"required, the suggested remediation is to cast the result to the desired " -"type: ``OrderedDict(nt._asdict())``. (Contributed by Raymond Hettinger in :" -"issue:`35864`.)" +"The :meth:`~collections.somenamedtuple._asdict` method " +"for :func:`collections.namedtuple` now returns a :class:`dict` instead of " +"a :class:`collections.OrderedDict`. This works because regular dicts have " +"guaranteed ordering since Python 3.7. If the extra features " +"of :class:`OrderedDict` are required, the suggested remediation is to cast " +"the result to the desired type: ``OrderedDict(nt._asdict())``. (Contributed " +"by Raymond Hettinger in :issue:`35864`.)" msgstr "" #: ../../whatsnew/3.8.rst:711 @@ -1211,8 +1217,9 @@ msgid "" "parameter to specify flags for the underlying ``LoadLibraryEx`` call. The " "default flags are set to only load DLL dependencies from trusted locations, " "including the path where the DLL is stored (if a full or partial path is " -"used to load the initial DLL) and paths added by :func:`~os." -"add_dll_directory`. (Contributed by Steve Dower in :issue:`36085`.)" +"used to load the initial DLL) and paths added " +"by :func:`~os.add_dll_directory`. (Contributed by Steve Dower " +"in :issue:`36085`.)" msgstr "" #: ../../whatsnew/3.8.rst:754 @@ -1221,11 +1228,12 @@ msgstr "datetime" #: ../../whatsnew/3.8.rst:756 msgid "" -"Added new alternate constructors :meth:`datetime.date.fromisocalendar` and :" -"meth:`datetime.datetime.fromisocalendar`, which construct :class:`~datetime." -"date` and :class:`~datetime.datetime` objects respectively from ISO year, " -"week number, and weekday; these are the inverse of each class's " -"``isocalendar`` method. (Contributed by Paul Ganssle in :issue:`36004`.)" +"Added new alternate constructors :meth:`datetime.date.fromisocalendar` " +"and :meth:`datetime.datetime.fromisocalendar`, which " +"construct :class:`~datetime.date` and :class:`~datetime.datetime` objects " +"respectively from ISO year, week number, and weekday; these are the inverse " +"of each class's ``isocalendar`` method. (Contributed by Paul Ganssle " +"in :issue:`36004`.)" msgstr "" #: ../../whatsnew/3.8.rst:764 @@ -1298,8 +1306,8 @@ msgstr "(由 Carl Meyer 在 :issue:`21145` 中貢獻)" #: ../../whatsnew/3.8.rst:796 msgid "" "Added a new :func:`functools.singledispatchmethod` decorator that converts " -"methods into :term:`generic functions <generic function>` using :term:" -"`single dispatch`::" +"methods into :term:`generic functions <generic function>` " +"using :term:`single dispatch`::" msgstr "" #: ../../whatsnew/3.8.rst:800 @@ -1410,8 +1418,8 @@ msgid "" "Added optional line numbers for IDLE editor windows. Windows open without " "line numbers unless set otherwise in the General tab of the configuration " "dialog. Line numbers for an existing window are shown and hidden in the " -"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar in :issue:" -"`17535`.)" +"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar " +"in :issue:`17535`.)" msgstr "" #: ../../whatsnew/3.8.rst:869 @@ -1430,8 +1438,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:878 msgid "" -"Add option to toggle cursor blink off. (Contributed by Zackery Spytz in :" -"issue:`4603`.)" +"Add option to toggle cursor blink off. (Contributed by Zackery Spytz " +"in :issue:`4603`.)" msgstr "" #: ../../whatsnew/3.8.rst:881 @@ -1590,8 +1598,8 @@ msgstr "(由 Pablo Galindo 在 :issue:`35606` 中貢獻。)" #: ../../whatsnew/3.8.rst:975 msgid "" -"Added two new combinatoric functions :func:`math.perm` and :func:`math." -"comb`::" +"Added two new combinatoric functions :func:`math.perm` " +"and :func:`math.comb`::" msgstr "" #: ../../whatsnew/3.8.rst:977 @@ -1607,8 +1615,8 @@ msgid "" "(Contributed by Yash Aggarwal, Keller Fuchs, Serhiy Storchaka, and Raymond " "Hettinger in :issue:`37128`, :issue:`37178`, and :issue:`35431`.)" msgstr "" -"(由 Yash Aggarwal、Keller Fuchs、Serhiy Storchaka 和 Raymond Hettinger 在 :" -"issue:`37128`、:issue:`37178` 和 :issue:`35431` 中貢獻。)" +"(由 Yash Aggarwal、Keller Fuchs、Serhiy Storchaka 和 Raymond Hettinger " +"在 :issue:`37128`、:issue:`37178` 和 :issue:`35431` 中貢獻。)" #: ../../whatsnew/3.8.rst:985 msgid "" @@ -1627,6 +1635,12 @@ msgid "" ">>> floor(sqrt(s - 1)) # incorrect\n" "650320427" msgstr "" +">>> r = 650320427\n" +">>> s = r ** 2\n" +">>> isqrt(s - 1) # 正確\n" +"650320426\n" +">>> floor(sqrt(s - 1)) # 錯誤\n" +"650320427" #: ../../whatsnew/3.8.rst:997 msgid "(Contributed by Mark Dickinson in :issue:`36887`.)" @@ -1645,8 +1659,8 @@ msgstr "mmap" #: ../../whatsnew/3.8.rst:1006 msgid "" "The :class:`mmap.mmap` class now has an :meth:`~mmap.mmap.madvise` method to " -"access the ``madvise()`` system call. (Contributed by Zackery Spytz in :" -"issue:`32941`.)" +"access the ``madvise()`` system call. (Contributed by Zackery Spytz " +"in :issue:`32941`.)" msgstr "" #: ../../whatsnew/3.8.rst:1012 @@ -1673,8 +1687,8 @@ msgstr "os" msgid "" "Added new function :func:`~os.add_dll_directory` on Windows for providing " "additional search paths for native dependencies when importing extension " -"modules or loading DLLs using :mod:`ctypes`. (Contributed by Steve Dower in :" -"issue:`36085`.)" +"modules or loading DLLs using :mod:`ctypes`. (Contributed by Steve Dower " +"in :issue:`36085`.)" msgstr "" #: ../../whatsnew/3.8.rst:1029 @@ -1690,11 +1704,11 @@ msgid "" "symlinks and directory junctions) has been delegated to the operating " "system. Specifically, :func:`os.stat` will now traverse anything supported " "by the operating system, while :func:`os.lstat` will only open reparse " -"points that identify as \"name surrogates\" while others are opened as for :" -"func:`os.stat`. In all cases, :attr:`stat_result.st_mode` will only have " -"``S_IFLNK`` set for symbolic links and not other kinds of reparse points. To " -"identify other kinds of reparse point, check the new :attr:`stat_result." -"st_reparse_tag` attribute." +"points that identify as \"name surrogates\" while others are opened as " +"for :func:`os.stat`. In all cases, :attr:`stat_result.st_mode` will only " +"have ``S_IFLNK`` set for symbolic links and not other kinds of reparse " +"points. To identify other kinds of reparse point, check the " +"new :attr:`stat_result.st_reparse_tag` attribute." msgstr "" #: ../../whatsnew/3.8.rst:1042 @@ -1702,8 +1716,8 @@ msgid "" "On Windows, :func:`os.readlink` is now able to read directory junctions. " "Note that :func:`~os.path.islink` will return ``False`` for directory " "junctions, and so code that checks ``islink`` first will continue to treat " -"junctions as directories, while code that handles errors from :func:`os." -"readlink` may now treat junctions as links." +"junctions as directories, while code that handles errors " +"from :func:`os.readlink` may now treat junctions as links." msgstr "" #: ../../whatsnew/3.8.rst:1048 ../../whatsnew/3.8.rst:1073 @@ -1716,21 +1730,21 @@ msgstr "os.path" #: ../../whatsnew/3.8.rst:1054 msgid "" -":mod:`os.path` functions that return a boolean result like :func:`~os.path." -"exists`, :func:`~os.path.lexists`, :func:`~os.path.isdir`, :func:`~os.path." -"isfile`, :func:`~os.path.islink`, and :func:`~os.path.ismount` now return " -"``False`` instead of raising :exc:`ValueError` or its subclasses :exc:" -"`UnicodeEncodeError` and :exc:`UnicodeDecodeError` for paths that contain " -"characters or bytes unrepresentable at the OS level. (Contributed by Serhiy " -"Storchaka in :issue:`33721`.)" +":mod:`os.path` functions that return a boolean result " +"like :func:`~os.path.exists`, :func:`~os.path.lexists`, :func:`~os.path.isdir`, :func:`~os.path.isfile`, :func:`~os.path.islink`, " +"and :func:`~os.path.ismount` now return ``False`` instead of " +"raising :exc:`ValueError` or its subclasses :exc:`UnicodeEncodeError` " +"and :exc:`UnicodeDecodeError` for paths that contain characters or bytes " +"unrepresentable at the OS level. (Contributed by Serhiy Storchaka " +"in :issue:`33721`.)" msgstr "" #: ../../whatsnew/3.8.rst:1062 ../../whatsnew/3.8.rst:1965 msgid "" ":func:`~os.path.expanduser` on Windows now prefers the :envvar:`USERPROFILE` " "environment variable and does not use :envvar:`HOME`, which is not normally " -"set for regular user accounts. (Contributed by Anthony Sottile in :issue:" -"`36264`.)" +"set for regular user accounts. (Contributed by Anthony Sottile " +"in :issue:`36264`.)" msgstr "" #: ../../whatsnew/3.8.rst:1067 @@ -1751,14 +1765,12 @@ msgstr "pathlib" #: ../../whatsnew/3.8.rst:1079 msgid "" -":mod:`pathlib.Path` methods that return a boolean result like :meth:" -"`~pathlib.Path.exists`, :meth:`~pathlib.Path.is_dir`, :meth:`~pathlib.Path." -"is_file`, :meth:`~pathlib.Path.is_mount`, :meth:`~pathlib.Path.is_symlink`, :" -"meth:`~pathlib.Path.is_block_device`, :meth:`~pathlib.Path.is_char_device`, :" -"meth:`~pathlib.Path.is_fifo`, :meth:`~pathlib.Path.is_socket` now return " -"``False`` instead of raising :exc:`ValueError` or its subclass :exc:" -"`UnicodeEncodeError` for paths that contain characters unrepresentable at " -"the OS level. (Contributed by Serhiy Storchaka in :issue:`33721`.)" +":mod:`pathlib.Path` methods that return a boolean result " +"like :meth:`~pathlib.Path.exists`, :meth:`~pathlib.Path.is_dir`, :meth:`~pathlib.Path.is_file`, :meth:`~pathlib.Path.is_mount`, :meth:`~pathlib.Path.is_symlink`, :meth:`~pathlib.Path.is_block_device`, :meth:`~pathlib.Path.is_char_device`, :meth:`~pathlib.Path.is_fifo`, :meth:`~pathlib.Path.is_socket` " +"now return ``False`` instead of raising :exc:`ValueError` or its " +"subclass :exc:`UnicodeEncodeError` for paths that contain characters " +"unrepresentable at the OS level. (Contributed by Serhiy Storchaka " +"in :issue:`33721`.)" msgstr "" #: ../../whatsnew/3.8.rst:1089 @@ -1776,10 +1788,11 @@ msgstr "pickle" #: ../../whatsnew/3.8.rst:1100 msgid "" -":mod:`pickle` extensions subclassing the C-optimized :class:`~pickle." -"Pickler` can now override the pickling logic of functions and classes by " -"defining the special :meth:`~pickle.Pickler.reducer_override` method. " -"(Contributed by Pierre Glaser and Olivier Grisel in :issue:`35900`.)" +":mod:`pickle` extensions subclassing the C-" +"optimized :class:`~pickle.Pickler` can now override the pickling logic of " +"functions and classes by defining the " +"special :meth:`~pickle.Pickler.reducer_override` method. (Contributed by " +"Pierre Glaser and Olivier Grisel in :issue:`35900`.)" msgstr "" #: ../../whatsnew/3.8.rst:1107 @@ -1789,8 +1802,8 @@ msgstr "plistlib" #: ../../whatsnew/3.8.rst:1109 msgid "" "Added new :class:`plistlib.UID` and enabled support for reading and writing " -"NSKeyedArchiver-encoded binary plists. (Contributed by Jon Janzen in :issue:" -"`26707`.)" +"NSKeyedArchiver-encoded binary plists. (Contributed by Jon Janzen " +"in :issue:`26707`.)" msgstr "" #: ../../whatsnew/3.8.rst:1115 @@ -1815,8 +1828,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:1126 msgid "" ">>> from pprint import pprint, pp\n" -">>> d = dict(source='input.txt', operation='filter', destination='output." -"txt')\n" +">>> d = dict(source='input.txt', operation='filter', " +"destination='output.txt')\n" ">>> pp(d, width=40) # Original order\n" "{'source': 'input.txt',\n" " 'operation': 'filter',\n" @@ -1847,8 +1860,8 @@ msgstr "shlex" #: ../../whatsnew/3.8.rst:1150 msgid "" -"The new :func:`shlex.join` function acts as the inverse of :func:`shlex." -"split`. (Contributed by Bo Bayles in :issue:`32102`.)" +"The new :func:`shlex.join` function acts as the inverse " +"of :func:`shlex.split`. (Contributed by Bo Bayles in :issue:`32102`.)" msgstr "" #: ../../whatsnew/3.8.rst:1155 @@ -1872,8 +1885,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:1165 msgid "" ":func:`shutil.rmtree` on Windows now removes directory junctions without " -"recursively removing their contents first. (Contributed by Steve Dower in :" -"issue:`37834`.)" +"recursively removing their contents first. (Contributed by Steve Dower " +"in :issue:`37834`.)" msgstr "" #: ../../whatsnew/3.8.rst:1171 @@ -1890,9 +1903,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:1178 msgid "" -"The :func:`socket.if_nameindex`, :func:`socket.if_nametoindex`, and :func:" -"`socket.if_indextoname` functions have been implemented on Windows. " -"(Contributed by Zackery Spytz in :issue:`37007`.)" +"The :func:`socket.if_nameindex`, :func:`socket.if_nametoindex`, " +"and :func:`socket.if_indextoname` functions have been implemented on " +"Windows. (Contributed by Zackery Spytz in :issue:`37007`.)" msgstr "" #: ../../whatsnew/3.8.rst:1184 @@ -1901,9 +1914,10 @@ msgstr "ssl" #: ../../whatsnew/3.8.rst:1186 msgid "" -"Added :attr:`~ssl.SSLContext.post_handshake_auth` to enable and :meth:`~ssl." -"SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 post-handshake " -"authentication. (Contributed by Christian Heimes in :issue:`34670`.)" +"Added :attr:`~ssl.SSLContext.post_handshake_auth` to enable " +"and :meth:`~ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 " +"post-handshake authentication. (Contributed by Christian Heimes " +"in :issue:`34670`.)" msgstr "" #: ../../whatsnew/3.8.rst:1193 @@ -1912,9 +1926,9 @@ msgstr "statistics" #: ../../whatsnew/3.8.rst:1195 msgid "" -"Added :func:`statistics.fmean` as a faster, floating-point variant of :func:" -"`statistics.mean`. (Contributed by Raymond Hettinger and Steven D'Aprano " -"in :issue:`35904`.)" +"Added :func:`statistics.fmean` as a faster, floating-point variant " +"of :func:`statistics.mean`. (Contributed by Raymond Hettinger and Steven " +"D'Aprano in :issue:`35904`.)" msgstr "" #: ../../whatsnew/3.8.rst:1199 @@ -1922,8 +1936,8 @@ msgid "" "Added :func:`statistics.geometric_mean` (Contributed by Raymond Hettinger " "in :issue:`27181`.)" msgstr "" -"新增 :func:`statistics.geometric_mean`\\ (由 Raymond Hettinger 在 :issue:" -"`27181` 中貢獻。)" +"新增 :func:`statistics.geometric_mean`\\ (由 Raymond Hettinger " +"在 :issue:`27181` 中貢獻。)" #: ../../whatsnew/3.8.rst:1202 msgid "" @@ -2002,20 +2016,21 @@ msgstr "threading" #: ../../whatsnew/3.8.rst:1262 msgid "" -"Add a new :func:`threading.excepthook` function which handles uncaught :meth:" -"`threading.Thread.run` exception. It can be overridden to control how " -"uncaught :meth:`threading.Thread.run` exceptions are handled. (Contributed " -"by Victor Stinner in :issue:`1230540`.)" +"Add a new :func:`threading.excepthook` function which handles " +"uncaught :meth:`threading.Thread.run` exception. It can be overridden to " +"control how uncaught :meth:`threading.Thread.run` exceptions are handled. " +"(Contributed by Victor Stinner in :issue:`1230540`.)" msgstr "" #: ../../whatsnew/3.8.rst:1267 msgid "" -"Add a new :func:`threading.get_native_id` function and a :data:`~threading." -"Thread.native_id` attribute to the :class:`threading.Thread` class. These " -"return the native integral Thread ID of the current thread assigned by the " -"kernel. This feature is only available on certain platforms, see :func:" -"`get_native_id <threading.get_native_id>` for more information. (Contributed " -"by Jake Tesler in :issue:`36084`.)" +"Add a new :func:`threading.get_native_id` function and " +"a :data:`~threading.Thread.native_id` attribute to " +"the :class:`threading.Thread` class. These return the native integral Thread " +"ID of the current thread assigned by the kernel. This feature is only " +"available on certain platforms, see :func:`get_native_id " +"<threading.get_native_id>` for more information. (Contributed by Jake Tesler " +"in :issue:`36084`.)" msgstr "" #: ../../whatsnew/3.8.rst:1277 @@ -2036,10 +2051,10 @@ msgstr "tkinter" #: ../../whatsnew/3.8.rst:1288 msgid "" -"Added methods :meth:`~tkinter.Spinbox.selection_from`, :meth:`~tkinter." -"Spinbox.selection_present`, :meth:`~tkinter.Spinbox.selection_range` and :" -"meth:`~tkinter.Spinbox.selection_to` in the :class:`tkinter.Spinbox` class. " -"(Contributed by Juliette Monsel in :issue:`34829`.)" +"Added " +"methods :meth:`~tkinter.Spinbox.selection_from`, :meth:`~tkinter.Spinbox.selection_present`, :meth:`~tkinter.Spinbox.selection_range` " +"and :meth:`~tkinter.Spinbox.selection_to` in the :class:`tkinter.Spinbox` " +"class. (Contributed by Juliette Monsel in :issue:`34829`.)" msgstr "" #: ../../whatsnew/3.8.rst:1295 @@ -2050,9 +2065,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1299 msgid "" -"The :class:`tkinter.PhotoImage` class now has :meth:`~tkinter.PhotoImage." -"transparency_get` and :meth:`~tkinter.PhotoImage.transparency_set` methods. " -"(Contributed by Zackery Spytz in :issue:`25451`.)" +"The :class:`tkinter.PhotoImage` class now " +"has :meth:`~tkinter.PhotoImage.transparency_get` " +"and :meth:`~tkinter.PhotoImage.transparency_set` methods. (Contributed by " +"Zackery Spytz in :issue:`25451`.)" msgstr "" #: ../../whatsnew/3.8.rst:1306 @@ -2075,10 +2091,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1317 msgid "" -"A dictionary type with per-key types. See :pep:`589` and :class:`typing." -"TypedDict`. TypedDict uses only string keys. By default, every key is " -"required to be present. Specify \"total=False\" to allow keys to be " -"optional::" +"A dictionary type with per-key types. See :pep:`589` " +"and :class:`typing.TypedDict`. TypedDict uses only string keys. By default, " +"every key is required to be present. Specify \"total=False\" to allow keys " +"to be optional::" msgstr "" #: ../../whatsnew/3.8.rst:1322 @@ -2110,9 +2126,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1334 msgid "" -"\"Final\" variables, functions, methods and classes. See :pep:`591`, :class:" -"`typing.Final` and :func:`typing.final`. The final qualifier instructs a " -"static type checker to restrict subclassing, overriding, or reassignment::" +"\"Final\" variables, functions, methods and classes. " +"See :pep:`591`, :class:`typing.Final` and :func:`typing.final`. The final " +"qualifier instructs a static type checker to restrict subclassing, " +"overriding, or reassignment::" msgstr "" #: ../../whatsnew/3.8.rst:1339 @@ -2121,9 +2138,9 @@ msgstr "pi: Final[float] = 3.1415926536" #: ../../whatsnew/3.8.rst:1341 msgid "" -"Protocol definitions. See :pep:`544`, :class:`typing.Protocol` and :func:" -"`typing.runtime_checkable`. Simple ABCs like :class:`typing.SupportsInt` " -"are now ``Protocol`` subclasses." +"Protocol definitions. See :pep:`544`, :class:`typing.Protocol` " +"and :func:`typing.runtime_checkable`. Simple ABCs " +"like :class:`typing.SupportsInt` are now ``Protocol`` subclasses." msgstr "" #: ../../whatsnew/3.8.rst:1345 @@ -2160,16 +2177,17 @@ msgstr "unittest" msgid "" "Added :class:`~unittest.mock.AsyncMock` to support an asynchronous version " "of :class:`~unittest.mock.Mock`. Appropriate new assert functions for " -"testing have been added as well. (Contributed by Lisa Roach in :issue:" -"`26467`)." +"testing have been added as well. (Contributed by Lisa Roach " +"in :issue:`26467`)." msgstr "" #: ../../whatsnew/3.8.rst:1370 msgid "" -"Added :func:`~unittest.addModuleCleanup` and :meth:`~unittest.TestCase." -"addClassCleanup` to unittest to support cleanups for :func:`~unittest." -"setUpModule` and :meth:`~unittest.TestCase.setUpClass`. (Contributed by Lisa " -"Roach in :issue:`24412`.)" +"Added :func:`~unittest.addModuleCleanup` " +"and :meth:`~unittest.TestCase.addClassCleanup` to unittest to support " +"cleanups for :func:`~unittest.setUpModule` " +"and :meth:`~unittest.TestCase.setUpClass`. (Contributed by Lisa Roach " +"in :issue:`24412`.)" msgstr "" #: ../../whatsnew/3.8.rst:1376 @@ -2257,9 +2275,10 @@ msgstr "xml" #: ../../whatsnew/3.8.rst:1424 msgid "" -"As mitigation against DTD and external entity retrieval, the :mod:`xml.dom." -"minidom` and :mod:`xml.sax` modules no longer process external entities by " -"default. (Contributed by Christian Heimes in :issue:`17239`.)" +"As mitigation against DTD and external entity retrieval, " +"the :mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process " +"external entities by default. (Contributed by Christian Heimes " +"in :issue:`17239`.)" msgstr "" #: ../../whatsnew/3.8.rst:1429 @@ -2272,19 +2291,20 @@ msgstr "" #: ../../whatsnew/3.8.rst:1434 msgid "" -"The :mod:`xml.etree.ElementTree` module provides a new function :func:`–xml." -"etree.ElementTree.canonicalize` that implements C14N 2.0. (Contributed by " -"Stefan Behnel in :issue:`13611`.)" +"The :mod:`xml.etree.ElementTree` module provides a new function :func:`–" +"xml.etree.ElementTree.canonicalize` that implements C14N 2.0. (Contributed " +"by Stefan Behnel in :issue:`13611`.)" msgstr "" #: ../../whatsnew/3.8.rst:1438 msgid "" "The target object of :class:`xml.etree.ElementTree.XMLParser` can receive " "namespace declaration events through the new callback methods ``start_ns()`` " -"and ``end_ns()``. Additionally, the :class:`xml.etree.ElementTree." -"TreeBuilder` target can be configured to process events about comments and " -"processing instructions to include them in the generated tree. (Contributed " -"by Stefan Behnel in :issue:`36676` and :issue:`36673`.)" +"and ``end_ns()``. Additionally, " +"the :class:`xml.etree.ElementTree.TreeBuilder` target can be configured to " +"process events about comments and processing instructions to include them in " +"the generated tree. (Contributed by Stefan Behnel in :issue:`36676` " +"and :issue:`36673`.)" msgstr "" #: ../../whatsnew/3.8.rst:1448 @@ -2331,15 +2351,15 @@ msgstr "(由 Joannah Nanjekye 和 Victor Stinner 在 :issue:`35537` 中貢獻 #: ../../whatsnew/3.8.rst:1471 msgid "" -":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:" -"`shutil.copytree` and :func:`shutil.move` use platform-specific \"fast-" -"copy\" syscalls on Linux and macOS in order to copy the file more " -"efficiently. \"fast-copy\" means that the copying operation occurs within " -"the kernel, avoiding the use of userspace buffers in Python as in \"``outfd." -"write(infd.read())``\". On Windows :func:`shutil.copyfile` uses a bigger " -"default buffer size (1 MiB instead of 16 KiB) and a :func:`memoryview`-based " -"variant of :func:`shutil.copyfileobj` is used. The speedup for copying a 512 " -"MiB file within the same partition is about +26% on Linux, +50% on macOS and " +":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:`shutil.copytree` " +"and :func:`shutil.move` use platform-specific \"fast-copy\" syscalls on " +"Linux and macOS in order to copy the file more efficiently. \"fast-copy\" " +"means that the copying operation occurs within the kernel, avoiding the use " +"of userspace buffers in Python as in \"``outfd.write(infd.read())``\". On " +"Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " +"instead of 16 KiB) and a :func:`memoryview`-based variant " +"of :func:`shutil.copyfileobj` is used. The speedup for copying a 512 MiB " +"file within the same partition is about +26% on Linux, +50% on macOS and " "+40% on Windows. Also, much less CPU cycles are consumed. See :ref:`shutil-" "platform-dependent-efficient-copy-operations` section. (Contributed by " "Giampaolo Rodolà in :issue:`33671`.)" @@ -2411,27 +2431,27 @@ msgstr "" msgid "" "Reduced an overhead of converting arguments passed to many builtin functions " "and methods. This sped up calling some simple builtin functions and methods " -"up to 20--50%. (Contributed by Serhiy Storchaka in :issue:`23867`, :issue:" -"`35582` and :issue:`36127`.)" +"up to 20--50%. (Contributed by Serhiy Storchaka " +"in :issue:`23867`, :issue:`35582` and :issue:`36127`.)" msgstr "" #: ../../whatsnew/3.8.rst:1531 msgid "" "``LOAD_GLOBAL`` instruction now uses new \"per opcode cache\" mechanism. It " -"is about 40% faster now. (Contributed by Yury Selivanov and Inada Naoki in :" -"issue:`26219`.)" +"is about 40% faster now. (Contributed by Yury Selivanov and Inada Naoki " +"in :issue:`26219`.)" msgstr "" #: ../../whatsnew/3.8.rst:1537 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.8.rst:1539 msgid "" "Default :data:`sys.abiflags` became an empty string: the ``m`` flag for " "pymalloc became useless (builds with and without pymalloc are ABI " -"compatible) and so has been removed. (Contributed by Victor Stinner in :" -"issue:`36707`.)" +"compatible) and so has been removed. (Contributed by Victor Stinner " +"in :issue:`36707`.)" msgstr "" #: ../../whatsnew/3.8.rst:1543 @@ -2531,8 +2551,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:1587 msgid "" "The result of :c:func:`PyExceptionClass_Name` is now of type ``const char " -"*`` rather of ``char *``. (Contributed by Serhiy Storchaka in :issue:" -"`33818`.)" +"*`` rather of ``char *``. (Contributed by Serhiy Storchaka " +"in :issue:`33818`.)" msgstr "" #: ../../whatsnew/3.8.rst:1591 @@ -2560,27 +2580,28 @@ msgstr "(由 Antoine Pitrou 在 :issue:`32430` 中貢獻。)" #: ../../whatsnew/3.8.rst:1606 msgid "" -"Functions that convert Python number to C integer like :c:func:" -"`PyLong_AsLong` and argument parsing functions like :c:func:" -"`PyArg_ParseTuple` with integer converting format units like ``'i'`` will " -"now use the :meth:`~object.__index__` special method instead of :meth:" -"`~object.__int__`, if available. The deprecation warning will be emitted " -"for objects with the ``__int__()`` method but without the ``__index__()`` " -"method (like :class:`~decimal.Decimal` and :class:`~fractions.Fraction`). :" -"c:func:`PyNumber_Check` will now return ``1`` for objects implementing " -"``__index__()``. :c:func:`PyNumber_Long`, :c:func:`PyNumber_Float` and :c:" -"func:`PyFloat_AsDouble` also now use the ``__index__()`` method if " -"available. (Contributed by Serhiy Storchaka in :issue:`36048` and :issue:" -"`20092`.)" +"Functions that convert Python number to C integer " +"like :c:func:`PyLong_AsLong` and argument parsing functions " +"like :c:func:`PyArg_ParseTuple` with integer converting format units like " +"``'i'`` will now use the :meth:`~object.__index__` special method instead " +"of :meth:`~object.__int__`, if available. The deprecation warning will be " +"emitted for objects with the ``__int__()`` method but without the " +"``__index__()`` method (like :class:`~decimal.Decimal` " +"and :class:`~fractions.Fraction`). :c:func:`PyNumber_Check` will now return " +"``1`` for objects implementing " +"``__index__()``. :c:func:`PyNumber_Long`, :c:func:`PyNumber_Float` " +"and :c:func:`PyFloat_AsDouble` also now use the ``__index__()`` method if " +"available. (Contributed by Serhiy Storchaka in :issue:`36048` " +"and :issue:`20092`.)" msgstr "" #: ../../whatsnew/3.8.rst:1620 msgid "" -"Heap-allocated type objects will now increase their reference count in :c:" -"func:`PyObject_Init` (and its parallel macro ``PyObject_INIT``) instead of " -"in :c:func:`PyType_GenericAlloc`. Types that modify instance allocation or " -"deallocation may need to be adjusted. (Contributed by Eddie Elizondo in :" -"issue:`35810`.)" +"Heap-allocated type objects will now increase their reference count " +"in :c:func:`PyObject_Init` (and its parallel macro ``PyObject_INIT``) " +"instead of in :c:func:`PyType_GenericAlloc`. Types that modify instance " +"allocation or deallocation may need to be adjusted. (Contributed by Eddie " +"Elizondo in :issue:`35810`.)" msgstr "" #: ../../whatsnew/3.8.rst:1626 @@ -2594,8 +2615,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:1631 msgid "" ":c:func:`!Py_SetPath` now sets :data:`sys.executable` to the program full " -"path (:c:func:`Py_GetProgramFullPath`) rather than to the program name (:c:" -"func:`Py_GetProgramName`). (Contributed by Victor Stinner in :issue:`38234`.)" +"path (:c:func:`Py_GetProgramFullPath`) rather than to the program name " +"(:c:func:`Py_GetProgramName`). (Contributed by Victor Stinner " +"in :issue:`38234`.)" msgstr "" #: ../../whatsnew/3.8.rst:1638 @@ -2605,38 +2627,40 @@ msgstr "已棄用" #: ../../whatsnew/3.8.rst:1640 msgid "" "The distutils ``bdist_wininst`` command is now deprecated, use " -"``bdist_wheel`` (wheel packages) instead. (Contributed by Victor Stinner in :" -"issue:`37481`.)" +"``bdist_wheel`` (wheel packages) instead. (Contributed by Victor Stinner " +"in :issue:`37481`.)" msgstr "" #: ../../whatsnew/3.8.rst:1644 msgid "" -"Deprecated methods ``getchildren()`` and ``getiterator()`` in the :mod:`~xml." -"etree.ElementTree` module now emit a :exc:`DeprecationWarning` instead of :" -"exc:`PendingDeprecationWarning`. They will be removed in Python 3.9. " -"(Contributed by Serhiy Storchaka in :issue:`29209`.)" +"Deprecated methods ``getchildren()`` and ``getiterator()`` in " +"the :mod:`~xml.etree.ElementTree` module now emit " +"a :exc:`DeprecationWarning` instead of :exc:`PendingDeprecationWarning`. " +"They will be removed in Python 3.9. (Contributed by Serhiy Storchaka " +"in :issue:`29209`.)" msgstr "" #: ../../whatsnew/3.8.rst:1650 msgid "" -"Passing an object that is not an instance of :class:`concurrent.futures." -"ThreadPoolExecutor` to :meth:`loop.set_default_executor() <asyncio.loop." -"set_default_executor>` is deprecated and will be prohibited in Python 3.9. " -"(Contributed by Elvis Pranskevichus in :issue:`34075`.)" +"Passing an object that is not an instance " +"of :class:`concurrent.futures.ThreadPoolExecutor` " +"to :meth:`loop.set_default_executor() <asyncio.loop.set_default_executor>` " +"is deprecated and will be prohibited in Python 3.9. (Contributed by Elvis " +"Pranskevichus in :issue:`34075`.)" msgstr "" #: ../../whatsnew/3.8.rst:1656 msgid "" -"The :meth:`~object.__getitem__` methods of :class:`xml.dom.pulldom." -"DOMEventStream`, :class:`wsgiref.util.FileWrapper` and :class:`fileinput." -"FileInput` have been deprecated." +"The :meth:`~object.__getitem__` methods " +"of :class:`xml.dom.pulldom.DOMEventStream`, :class:`wsgiref.util.FileWrapper` " +"and :class:`fileinput.FileInput` have been deprecated." msgstr "" #: ../../whatsnew/3.8.rst:1660 msgid "" "Implementations of these methods have been ignoring their *index* parameter, " -"and returning the next item instead. (Contributed by Berker Peksag in :issue:" -"`9372`.)" +"and returning the next item instead. (Contributed by Berker Peksag " +"in :issue:`9372`.)" msgstr "" #: ../../whatsnew/3.8.rst:1664 @@ -2658,28 +2682,25 @@ msgstr "" msgid "" ":class:`ast.NodeVisitor` methods ``visit_Num()``, ``visit_Str()``, " "``visit_Bytes()``, ``visit_NameConstant()`` and ``visit_Ellipsis()`` are " -"deprecated now and will not be called in future Python versions. Add the :" -"meth:`~ast.NodeVisitor.visit_Constant` method to handle all constant nodes. " -"(Contributed by Serhiy Storchaka in :issue:`36917`.)" +"deprecated now and will not be called in future Python versions. Add " +"the :meth:`~ast.NodeVisitor.visit_Constant` method to handle all constant " +"nodes. (Contributed by Serhiy Storchaka in :issue:`36917`.)" msgstr "" #: ../../whatsnew/3.8.rst:1680 msgid "" "The :func:`asyncio.coroutine` :term:`decorator` is deprecated and will be " -"removed in version 3.10. Instead of ``@asyncio.coroutine``, use :keyword:" -"`async def` instead. (Contributed by Andrew Svetlov in :issue:`36921`.)" +"removed in version 3.10. Instead of ``@asyncio.coroutine``, " +"use :keyword:`async def` instead. (Contributed by Andrew Svetlov " +"in :issue:`36921`.)" msgstr "" #: ../../whatsnew/3.8.rst:1685 msgid "" "In :mod:`asyncio`, the explicit passing of a *loop* argument has been " -"deprecated and will be removed in version 3.10 for the following: :func:" -"`asyncio.sleep`, :func:`asyncio.gather`, :func:`asyncio.shield`, :func:" -"`asyncio.wait_for`, :func:`asyncio.wait`, :func:`asyncio.as_completed`, :" -"class:`asyncio.Task`, :class:`asyncio.Lock`, :class:`asyncio.Event`, :class:" -"`asyncio.Condition`, :class:`asyncio.Semaphore`, :class:`asyncio." -"BoundedSemaphore`, :class:`asyncio.Queue`, :func:`asyncio." -"create_subprocess_exec`, and :func:`asyncio.create_subprocess_shell`." +"deprecated and will be removed in version 3.10 for the " +"following: :func:`asyncio.sleep`, :func:`asyncio.gather`, :func:`asyncio.shield`, :func:`asyncio.wait_for`, :func:`asyncio.wait`, :func:`asyncio.as_completed`, :class:`asyncio.Task`, :class:`asyncio.Lock`, :class:`asyncio.Event`, :class:`asyncio.Condition`, :class:`asyncio.Semaphore`, :class:`asyncio.BoundedSemaphore`, :class:`asyncio.Queue`, :func:`asyncio.create_subprocess_exec`, " +"and :func:`asyncio.create_subprocess_shell`." msgstr "" #: ../../whatsnew/3.8.rst:1695 @@ -2692,22 +2713,23 @@ msgstr "" #: ../../whatsnew/3.8.rst:1699 msgid "" "The following functions and methods are deprecated in the :mod:`gettext` " -"module: :func:`~gettext.lgettext`, :func:`~gettext.ldgettext`, :func:" -"`~gettext.lngettext` and :func:`~gettext.ldngettext`. They return encoded " -"bytes, and it's possible that you will get unexpected Unicode-related " -"exceptions if there are encoding problems with the translated strings. It's " -"much better to use alternatives which return Unicode strings in Python 3. " -"These functions have been broken for a long time." +"module: :func:`~gettext.lgettext`, :func:`~gettext.ldgettext`, :func:`~gettext.lngettext` " +"and :func:`~gettext.ldngettext`. They return encoded bytes, and it's " +"possible that you will get unexpected Unicode-related exceptions if there " +"are encoding problems with the translated strings. It's much better to use " +"alternatives which return Unicode strings in Python 3. These functions have " +"been broken for a long time." msgstr "" #: ../../whatsnew/3.8.rst:1707 msgid "" -"Function :func:`~gettext.bind_textdomain_codeset`, methods :meth:`~gettext." -"NullTranslations.output_charset` and :meth:`~gettext.NullTranslations." -"set_output_charset`, and the *codeset* parameter of functions :func:" -"`~gettext.translation` and :func:`~gettext.install` are also deprecated, " -"since they are only used for the ``l*gettext()`` functions. (Contributed by " -"Serhiy Storchaka in :issue:`33710`.)" +"Function :func:`~gettext.bind_textdomain_codeset`, " +"methods :meth:`~gettext.NullTranslations.output_charset` " +"and :meth:`~gettext.NullTranslations.set_output_charset`, and the *codeset* " +"parameter of functions :func:`~gettext.translation` " +"and :func:`~gettext.install` are also deprecated, since they are only used " +"for the ``l*gettext()`` functions. (Contributed by Serhiy Storchaka " +"in :issue:`33710`.)" msgstr "" #: ../../whatsnew/3.8.rst:1715 @@ -2719,11 +2741,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:1719 msgid "" "Many builtin and extension functions that take integer arguments will now " -"emit a deprecation warning for :class:`~decimal.Decimal`\\ s, :class:" -"`~fractions.Fraction`\\ s and any other objects that can be converted to " -"integers only with a loss (e.g. that have the :meth:`~object.__int__` method " -"but do not have the :meth:`~object.__index__` method). In future version " -"they will be errors. (Contributed by Serhiy Storchaka in :issue:`36048`.)" +"emit a deprecation warning for :class:`~decimal.Decimal`\\ " +"s, :class:`~fractions.Fraction`\\ s and any other objects that can be " +"converted to integers only with a loss (e.g. that have " +"the :meth:`~object.__int__` method but do not have " +"the :meth:`~object.__index__` method). In future version they will be " +"errors. (Contributed by Serhiy Storchaka in :issue:`36048`.)" msgstr "" #: ../../whatsnew/3.8.rst:1727 @@ -2732,9 +2755,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:1729 msgid "" -"*func* in :func:`functools.partialmethod`, :func:`weakref.finalize`, :meth:" -"`profile.Profile.runcall`, :meth:`cProfile.Profile.runcall`, :meth:`bdb.Bdb." -"runcall`, :meth:`trace.Trace.runfunc` and :func:`curses.wrapper`." +"*func* " +"in :func:`functools.partialmethod`, :func:`weakref.finalize`, :meth:`profile.Profile.runcall`, :meth:`cProfile.Profile.runcall`, :meth:`bdb.Bdb.runcall`, :meth:`trace.Trace.runfunc` " +"and :func:`curses.wrapper`." msgstr "" #: ../../whatsnew/3.8.rst:1733 @@ -2743,23 +2766,23 @@ msgstr "" #: ../../whatsnew/3.8.rst:1734 msgid "" -"*fn* in the :meth:`~concurrent.futures.Executor.submit` method of :class:" -"`concurrent.futures.ThreadPoolExecutor` and :class:`concurrent.futures." -"ProcessPoolExecutor`." +"*fn* in the :meth:`~concurrent.futures.Executor.submit` method " +"of :class:`concurrent.futures.ThreadPoolExecutor` " +"and :class:`concurrent.futures.ProcessPoolExecutor`." msgstr "" #: ../../whatsnew/3.8.rst:1737 msgid "" -"*callback* in :meth:`contextlib.ExitStack.callback`, :meth:`contextlib." -"AsyncExitStack.callback` and :meth:`contextlib.AsyncExitStack." -"push_async_callback`." +"*callback* " +"in :meth:`contextlib.ExitStack.callback`, :meth:`contextlib.AsyncExitStack.callback` " +"and :meth:`contextlib.AsyncExitStack.push_async_callback`." msgstr "" #: ../../whatsnew/3.8.rst:1740 msgid "" "*c* and *typeid* in the :meth:`~multiprocessing.managers.Server.create` " -"method of :class:`multiprocessing.managers.Server` and :class:" -"`multiprocessing.managers.SharedMemoryServer`." +"method of :class:`multiprocessing.managers.Server` " +"and :class:`multiprocessing.managers.SharedMemoryServer`." msgstr "" #: ../../whatsnew/3.8.rst:1743 @@ -2774,7 +2797,7 @@ msgstr "" #: ../../whatsnew/3.8.rst:1751 msgid "API and Feature Removals" -msgstr "" +msgstr "API 與功能的移除" #: ../../whatsnew/3.8.rst:1753 msgid "The following features and APIs have been removed from Python 3.8:" @@ -2804,9 +2827,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1767 msgid "" "The function :func:`time.clock` has been removed, after having been " -"deprecated since Python 3.3: use :func:`time.perf_counter` or :func:`time." -"process_time` instead, depending on your requirements, to have well-defined " -"behavior. (Contributed by Matthias Bussonnier in :issue:`36895`.)" +"deprecated since Python 3.3: use :func:`time.perf_counter` " +"or :func:`time.process_time` instead, depending on your requirements, to " +"have well-defined behavior. (Contributed by Matthias Bussonnier " +"in :issue:`36895`.)" msgstr "" #: ../../whatsnew/3.8.rst:1773 @@ -2839,14 +2863,15 @@ msgstr "" #: ../../whatsnew/3.8.rst:1789 msgid "" -"Removed the ``doctype()`` method of :class:`~xml.etree.ElementTree." -"XMLParser`. (Contributed by Serhiy Storchaka in :issue:`29209`.)" +"Removed the ``doctype()`` method " +"of :class:`~xml.etree.ElementTree.XMLParser`. (Contributed by Serhiy " +"Storchaka in :issue:`29209`.)" msgstr "" #: ../../whatsnew/3.8.rst:1792 msgid "" -"\"unicode_internal\" codec is removed. (Contributed by Inada Naoki in :issue:" -"`36297`.)" +"\"unicode_internal\" codec is removed. (Contributed by Inada Naoki " +"in :issue:`36297`.)" msgstr "" #: ../../whatsnew/3.8.rst:1795 @@ -2857,16 +2882,17 @@ msgstr "" #: ../../whatsnew/3.8.rst:1799 msgid "" -"The ``bufsize`` keyword argument of :func:`fileinput.input` and :func:" -"`fileinput.FileInput` which was ignored and deprecated since Python 3.6 has " -"been removed. :issue:`36952` (Contributed by Matthias Bussonnier.)" +"The ``bufsize`` keyword argument of :func:`fileinput.input` " +"and :func:`fileinput.FileInput` which was ignored and deprecated since " +"Python 3.6 has been removed. :issue:`36952` (Contributed by Matthias " +"Bussonnier.)" msgstr "" #: ../../whatsnew/3.8.rst:1803 msgid "" -"The functions :func:`sys.set_coroutine_wrapper` and :func:`sys." -"get_coroutine_wrapper` deprecated in Python 3.7 have been removed; :issue:" -"`36933` (Contributed by Matthias Bussonnier.)" +"The functions :func:`sys.set_coroutine_wrapper` " +"and :func:`sys.get_coroutine_wrapper` deprecated in Python 3.7 have been " +"removed; :issue:`36933` (Contributed by Matthias Bussonnier.)" msgstr "" #: ../../whatsnew/3.8.rst:1809 @@ -2881,7 +2907,7 @@ msgstr "" #: ../../whatsnew/3.8.rst:1816 msgid "Changes in Python behavior" -msgstr "" +msgstr "Python 行為的改變" #: ../../whatsnew/3.8.rst:1818 msgid "" @@ -2897,8 +2923,8 @@ msgid "" "(``is`` and ``is not``) are used with certain types of literals (e.g. " "strings, numbers). These can often work by accident in CPython, but are not " "guaranteed by the language spec. The warning advises users to use equality " -"tests (``==`` and ``!=``) instead. (Contributed by Serhiy Storchaka in :" -"issue:`34850`.)" +"tests (``==`` and ``!=``) instead. (Contributed by Serhiy Storchaka " +"in :issue:`34850`.)" msgstr "" #: ../../whatsnew/3.8.rst:1830 @@ -2911,12 +2937,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:1835 msgid "" -"Removed ``__str__`` implementations from builtin types :class:`bool`, :class:" -"`int`, :class:`float`, :class:`complex` and few classes from the standard " -"library. They now inherit ``__str__()`` from :class:`object`. As result, " -"defining the ``__repr__()`` method in the subclass of these classes will " -"affect their string representation. (Contributed by Serhiy Storchaka in :" -"issue:`36793`.)" +"Removed ``__str__`` implementations from builtin " +"types :class:`bool`, :class:`int`, :class:`float`, :class:`complex` and few " +"classes from the standard library. They now inherit ``__str__()`` " +"from :class:`object`. As result, defining the ``__repr__()`` method in the " +"subclass of these classes will affect their string representation. " +"(Contributed by Serhiy Storchaka in :issue:`36793`.)" msgstr "" #: ../../whatsnew/3.8.rst:1842 @@ -2924,23 +2950,24 @@ msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'aix'``, instead of ``'aix3'`` .. ``'aix7'``. Since older " "Python versions include the version number, so it is recommended to always " -"use ``sys.platform.startswith('aix')``. (Contributed by M. Felt in :issue:" -"`36588`.)" +"use ``sys.platform.startswith('aix')``. (Contributed by M. Felt " +"in :issue:`36588`.)" msgstr "" #: ../../whatsnew/3.8.rst:1848 msgid "" ":c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_AcquireThread` now " "terminate the current thread if called while the interpreter is finalizing, " -"making them consistent with :c:func:`PyEval_RestoreThread`, :c:func:" -"`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`. If this behavior is " -"not desired, guard the call by checking :c:func:`!_Py_IsFinalizing` or :func:" -"`sys.is_finalizing`. (Contributed by Joannah Nanjekye in :issue:`36475`.)" +"making them consistent " +"with :c:func:`PyEval_RestoreThread`, :c:func:`Py_END_ALLOW_THREADS`, " +"and :c:func:`PyGILState_Ensure`. If this behavior is not desired, guard the " +"call by checking :c:func:`!_Py_IsFinalizing` or :func:`sys.is_finalizing`. " +"(Contributed by Joannah Nanjekye in :issue:`36475`.)" msgstr "" #: ../../whatsnew/3.8.rst:1858 ../../whatsnew/3.8.rst:2321 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.8.rst:1860 msgid "" @@ -2964,8 +2991,8 @@ msgstr "" msgid "" "The *preexec_fn* argument of * :class:`subprocess.Popen` is no longer " "compatible with subinterpreters. The use of the parameter in a " -"subinterpreter now raises :exc:`RuntimeError`. (Contributed by Eric Snow in :" -"issue:`34651`, modified by Christian Heimes in :issue:`37951`.)" +"subinterpreter now raises :exc:`RuntimeError`. (Contributed by Eric Snow " +"in :issue:`34651`, modified by Christian Heimes in :issue:`37951`.)" msgstr "" #: ../../whatsnew/3.8.rst:1878 @@ -2983,44 +3010,45 @@ msgstr "" #: ../../whatsnew/3.8.rst:1891 msgid "" -"The :meth:`~tkinter.ttk.Treeview.selection` method of the :class:`tkinter." -"ttk.Treeview` class no longer takes arguments. Using it with arguments for " -"changing the selection was deprecated in Python 3.6. Use specialized " -"methods like :meth:`~tkinter.ttk.Treeview.selection_set` for changing the " -"selection. (Contributed by Serhiy Storchaka in :issue:`31508`.)" +"The :meth:`~tkinter.ttk.Treeview.selection` method of " +"the :class:`tkinter.ttk.Treeview` class no longer takes arguments. Using it " +"with arguments for changing the selection was deprecated in Python 3.6. Use " +"specialized methods like :meth:`~tkinter.ttk.Treeview.selection_set` for " +"changing the selection. (Contributed by Serhiy Storchaka in :issue:`31508`.)" msgstr "" #: ../../whatsnew/3.8.rst:1897 msgid "" -"The :meth:`writexml`, :meth:`toxml` and :meth:`toprettyxml` methods of :mod:" -"`xml.dom.minidom`, and the :meth:`write` method of :mod:`xml.etree`, now " -"preserve the attribute order specified by the user. (Contributed by Diego " -"Rojas and Raymond Hettinger in :issue:`34160`.)" +"The :meth:`writexml`, :meth:`toxml` and :meth:`toprettyxml` methods " +"of :mod:`xml.dom.minidom`, and the :meth:`write` method of :mod:`xml.etree`, " +"now preserve the attribute order specified by the user. (Contributed by " +"Diego Rojas and Raymond Hettinger in :issue:`34160`.)" msgstr "" #: ../../whatsnew/3.8.rst:1902 msgid "" -"A :mod:`dbm.dumb` database opened with flags ``'r'`` is now read-only. :func:" -"`dbm.dumb.open` with flags ``'r'`` and ``'w'`` no longer creates a database " -"if it does not exist. (Contributed by Serhiy Storchaka in :issue:`32749`.)" +"A :mod:`dbm.dumb` database opened with flags ``'r'`` is now read-" +"only. :func:`dbm.dumb.open` with flags ``'r'`` and ``'w'`` no longer creates " +"a database if it does not exist. (Contributed by Serhiy Storchaka " +"in :issue:`32749`.)" msgstr "" #: ../../whatsnew/3.8.rst:1907 msgid "" -"The ``doctype()`` method defined in a subclass of :class:`~xml.etree." -"ElementTree.XMLParser` will no longer be called and will emit a :exc:" -"`RuntimeWarning` instead of a :exc:`DeprecationWarning`. Define the :meth:" -"`doctype() <xml.etree.ElementTree.TreeBuilder.doctype>` method on a target " -"for handling an XML doctype declaration. (Contributed by Serhiy Storchaka " -"in :issue:`29209`.)" +"The ``doctype()`` method defined in a subclass " +"of :class:`~xml.etree.ElementTree.XMLParser` will no longer be called and " +"will emit a :exc:`RuntimeWarning` instead of a :exc:`DeprecationWarning`. " +"Define the :meth:`doctype() <xml.etree.ElementTree.TreeBuilder.doctype>` " +"method on a target for handling an XML doctype declaration. (Contributed by " +"Serhiy Storchaka in :issue:`29209`.)" msgstr "" #: ../../whatsnew/3.8.rst:1914 msgid "" "A :exc:`RuntimeError` is now raised when the custom metaclass doesn't " -"provide the ``__classcell__`` entry in the namespace passed to ``type." -"__new__``. A :exc:`DeprecationWarning` was emitted in Python 3.6--3.7. " -"(Contributed by Serhiy Storchaka in :issue:`23722`.)" +"provide the ``__classcell__`` entry in the namespace passed to " +"``type.__new__``. A :exc:`DeprecationWarning` was emitted in Python " +"3.6--3.7. (Contributed by Serhiy Storchaka in :issue:`23722`.)" msgstr "" #: ../../whatsnew/3.8.rst:1919 @@ -3031,10 +3059,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:1922 msgid "" -":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:" -"`shutil.copytree` and :func:`shutil.move` use platform-specific \"fast-" -"copy\" syscalls (see :ref:`shutil-platform-dependent-efficient-copy-" -"operations` section)." +":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:`shutil.copytree` " +"and :func:`shutil.move` use platform-specific \"fast-copy\" syscalls " +"(see :ref:`shutil-platform-dependent-efficient-copy-operations` section)." msgstr "" #: ../../whatsnew/3.8.rst:1927 @@ -3079,18 +3106,19 @@ msgstr "" #: ../../whatsnew/3.8.rst:1954 msgid "" -"Deleting a key from a read-only :mod:`dbm` database (:mod:`dbm.dumb`, :mod:" -"`dbm.gnu` or :mod:`dbm.ndbm`) raises :attr:`error` (:exc:`dbm.dumb.error`, :" -"exc:`dbm.gnu.error` or :exc:`dbm.ndbm.error`) instead of :exc:`KeyError`. " -"(Contributed by Xiang Zhang in :issue:`33106`.)" +"Deleting a key from a read-only :mod:`dbm` database " +"(:mod:`dbm.dumb`, :mod:`dbm.gnu` or :mod:`dbm.ndbm`) raises :attr:`error` " +"(:exc:`dbm.dumb.error`, :exc:`dbm.gnu.error` or :exc:`dbm.ndbm.error`) " +"instead of :exc:`KeyError`. (Contributed by Xiang Zhang in :issue:`33106`.)" msgstr "" #: ../../whatsnew/3.8.rst:1959 msgid "" -"Simplified AST for literals. All constants will be represented as :class:" -"`ast.Constant` instances. Instantiating old classes ``Num``, ``Str``, " -"``Bytes``, ``NameConstant`` and ``Ellipsis`` will return an instance of " -"``Constant``. (Contributed by Serhiy Storchaka in :issue:`32892`.)" +"Simplified AST for literals. All constants will be represented " +"as :class:`ast.Constant` instances. Instantiating old classes ``Num``, " +"``Str``, ``Bytes``, ``NameConstant`` and ``Ellipsis`` will return an " +"instance of ``Constant``. (Contributed by Serhiy Storchaka " +"in :issue:`32892`.)" msgstr "" #: ../../whatsnew/3.8.rst:1975 @@ -3116,15 +3144,16 @@ msgstr "" msgid "" "DLL dependencies for extension modules and DLLs loaded with :mod:`ctypes` on " "Windows are now resolved more securely. Only the system paths, the directory " -"containing the DLL or PYD file, and directories added with :func:`~os." -"add_dll_directory` are searched for load-time dependencies. Specifically, :" -"envvar:`PATH` and the current working directory are no longer used, and " -"modifications to these will no longer have any effect on normal DLL " -"resolution. If your application relies on these mechanisms, you should check " -"for :func:`~os.add_dll_directory` and if it exists, use it to add your DLLs " -"directory while loading your library. Note that Windows 7 users will need to " -"ensure that Windows Update KB2533623 has been installed (this is also " -"verified by the installer). (Contributed by Steve Dower in :issue:`36085`.)" +"containing the DLL or PYD file, and directories added " +"with :func:`~os.add_dll_directory` are searched for load-time dependencies. " +"Specifically, :envvar:`PATH` and the current working directory are no longer " +"used, and modifications to these will no longer have any effect on normal " +"DLL resolution. If your application relies on these mechanisms, you should " +"check for :func:`~os.add_dll_directory` and if it exists, use it to add your " +"DLLs directory while loading your library. Note that Windows 7 users will " +"need to ensure that Windows Update KB2533623 has been installed (this is " +"also verified by the installer). (Contributed by Steve Dower " +"in :issue:`36085`.)" msgstr "" #: ../../whatsnew/3.8.rst:2001 @@ -3182,21 +3211,22 @@ msgstr "" #: ../../whatsnew/3.8.rst:2037 msgid "" -"Use of ``#`` variants of formats in parsing or building value (e.g. :c:func:" -"`PyArg_ParseTuple`, :c:func:`Py_BuildValue`, :c:func:" -"`PyObject_CallFunction`, etc.) without ``PY_SSIZE_T_CLEAN`` defined raises " -"``DeprecationWarning`` now. It will be removed in 3.10 or 4.0. Read :ref:" -"`arg-parsing` for detail. (Contributed by Inada Naoki in :issue:`36381`.)" +"Use of ``#`` variants of formats in parsing or building value " +"(e.g. :c:func:`PyArg_ParseTuple`, :c:func:`Py_BuildValue`, :c:func:`PyObject_CallFunction`, " +"etc.) without ``PY_SSIZE_T_CLEAN`` defined raises ``DeprecationWarning`` " +"now. It will be removed in 3.10 or 4.0. Read :ref:`arg-parsing` for detail. " +"(Contributed by Inada Naoki in :issue:`36381`.)" msgstr "" #: ../../whatsnew/3.8.rst:2043 msgid "" -"Instances of heap-allocated types (such as those created with :c:func:" -"`PyType_FromSpec`) hold a reference to their type object. Increasing the " -"reference count of these type objects has been moved from :c:func:" -"`PyType_GenericAlloc` to the more low-level functions, :c:func:" -"`PyObject_Init` and :c:func:`PyObject_INIT`. This makes types created " -"through :c:func:`PyType_FromSpec` behave like other classes in managed code." +"Instances of heap-allocated types (such as those created " +"with :c:func:`PyType_FromSpec`) hold a reference to their type object. " +"Increasing the reference count of these type objects has been moved " +"from :c:func:`PyType_GenericAlloc` to the more low-level " +"functions, :c:func:`PyObject_Init` and :c:func:`PyObject_INIT`. This makes " +"types created through :c:func:`PyType_FromSpec` behave like other classes in " +"managed code." msgstr "" #: ../../whatsnew/3.8.rst:2051 @@ -3220,10 +3250,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:2062 msgid "" "Remove :c:macro:`Py_INCREF` on the type object after allocating an instance " -"- if any. This may happen after calling :c:macro:`PyObject_New`, :c:macro:" -"`PyObject_NewVar`, :c:func:`PyObject_GC_New`, :c:func:`PyObject_GC_NewVar`, " -"or any other custom allocator that uses :c:func:`PyObject_Init` or :c:func:" -"`PyObject_INIT`." +"- if any. This may happen after " +"calling :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, :c:func:`PyObject_GC_New`, :c:func:`PyObject_GC_NewVar`, " +"or any other custom allocator that uses :c:func:`PyObject_Init` " +"or :c:func:`PyObject_INIT`." msgstr "" #: ../../whatsnew/3.8.rst:2069 ../../whatsnew/3.8.rst:2088 @@ -3288,9 +3318,10 @@ msgid "" "The interpreter does not pretend to support binary compatibility of " "extension types across feature releases, anymore. A :c:type:`PyTypeObject` " "exported by a third-party extension module is supposed to have all the slots " -"expected in the current Python version, including :c:member:`~PyTypeObject." -"tp_finalize` (:c:macro:`Py_TPFLAGS_HAVE_FINALIZE` is not checked anymore " -"before reading :c:member:`~PyTypeObject.tp_finalize`)." +"expected in the current Python version, " +"including :c:member:`~PyTypeObject.tp_finalize` " +"(:c:macro:`Py_TPFLAGS_HAVE_FINALIZE` is not checked anymore before " +"reading :c:member:`~PyTypeObject.tp_finalize`)." msgstr "" #: ../../whatsnew/3.8.rst:2122 @@ -3324,10 +3355,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:2137 msgid "" "The location of an installed :file:`pythonXY.dll` will depend on the " -"installation options and the version and language of Windows. See :ref:" -"`using-on-windows` for more information. The resulting library should be " -"placed in the same directory as :file:`pythonXY.lib`, which is generally " -"the :file:`libs` directory under your Python installation." +"installation options and the version and language of Windows. " +"See :ref:`using-on-windows` for more information. The resulting library " +"should be placed in the same directory as :file:`pythonXY.lib`, which is " +"generally the :file:`libs` directory under your Python installation." msgstr "" #: ../../whatsnew/3.8.rst:2143 @@ -3357,8 +3388,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:2161 msgid "" -"(Contributed by Mark Shannon, Antoine Pitrou and Serhiy Storchaka in :issue:" -"`17611`.)" +"(Contributed by Mark Shannon, Antoine Pitrou and Serhiy Storchaka " +"in :issue:`17611`.)" msgstr "" "(由 Mark Shannon、Antoine Pitrou 和 Serhiy Storchaka 在 :issue:`17611` 中貢" "獻。)" @@ -3556,12 +3587,12 @@ msgstr "Python 3.8.1 中顯著的變更" #: ../../whatsnew/3.8.rst:2239 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" #: ../../whatsnew/3.8.rst:2247 @@ -3594,13 +3625,14 @@ msgstr "Python 3.8.8 中顯著的變更" #: ../../whatsnew/3.8.rst:2264 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" msgstr "" #: ../../whatsnew/3.8.rst:2275 @@ -3639,9 +3671,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:2299 msgid "" -"(Originally contributed by Ronald Oussoren and Lawrence D'Anna in :gh:" -"`85272`, with fixes by FX Coudert and Eli Rykoff, and backported to 3.8 by " -"Maxime Bélanger and Ned Deily)" +"(Originally contributed by Ronald Oussoren and Lawrence D'Anna " +"in :gh:`85272`, with fixes by FX Coudert and Eli Rykoff, and backported to " +"3.8 by Maxime Bélanger and Ned Deily)" msgstr "" #: ../../whatsnew/3.8.rst:2307 @@ -3651,11 +3683,12 @@ msgstr "urllib.parse" #: ../../whatsnew/3.8.rst:2309 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " -"forms of attacks. Following the WHATWG specification that updates :rfc:" -"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " -"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " -"attacks. The removal characters are controlled by a new module level " -"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :issue:`43882`)" +"forms of attacks. Following the WHATWG specification that " +"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " +"characters are stripped from the URL by the parser in :mod:`urllib.parse` " +"preventing such attacks. The removal characters are controlled by a new " +"module level variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. " +"(See :issue:`43882`)" msgstr "" #: ../../whatsnew/3.8.rst:2318 diff --git a/whatsnew/3.9.po b/whatsnew/3.9.po index c85271fcb3..0d12d8d64e 100644 --- a/whatsnew/3.9.po +++ b/whatsnew/3.9.po @@ -32,8 +32,8 @@ msgstr "Łukasz Langa" #: ../../whatsnew/3.9.rst:45 msgid "" "This article explains the new features in Python 3.9, compared to 3.8. " -"Python 3.9 was released on October 5, 2020. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.9 was released on October 5, 2020. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.9 與 3.8 相比多了哪些新功能。Python 3.9 已於 2020 年 10 " "月 5 日發布。有關完整詳細資訊,請參閱 :ref:`changelog <changelog>`。" @@ -109,19 +109,19 @@ msgstr "" #: ../../whatsnew/3.9.rst:84 msgid "" -"a number of Python modules (:mod:`!_abc`, :mod:`!audioop`, :mod:`!_bz2`, :" -"mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!_functools`, :" -"mod:`!_json`, :mod:`!_locale`, :mod:`math`, :mod:`operator`, :mod:" -"`resource`, :mod:`time`, :mod:`!_weakref`) now use multiphase initialization " -"as defined by PEP 489;" +"a number of Python modules (:mod:`!_abc`, :mod:`!audioop`, :mod:`!" +"_bz2`, :mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!" +"_functools`, :mod:`!_json`, :mod:`!" +"_locale`, :mod:`math`, :mod:`operator`, :mod:`resource`, :mod:`time`, :mod:`!" +"_weakref`) now use multiphase initialization as defined by PEP 489;" msgstr "" #: ../../whatsnew/3.9.rst:89 msgid "" -"a number of standard library modules (:mod:`!audioop`, :mod:`ast`, :mod:" -"`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!_posixsubprocess`, :mod:" -"`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) are now " -"using the stable ABI defined by PEP 384." +"a number of standard library modules (:mod:`!" +"audioop`, :mod:`ast`, :mod:`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!" +"_posixsubprocess`, :mod:`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) " +"are now using the stable ABI defined by PEP 384." msgstr "" #: ../../whatsnew/3.9.rst:94 @@ -182,9 +182,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:126 msgid "" "Aliases to :ref:`Abstract Base Classes <collections-abstract-base-classes>` " -"in the :mod:`collections` module, like ``collections.Mapping`` alias to :" -"class:`collections.abc.Mapping`, are kept for one last release for backward " -"compatibility. They will be removed from Python 3.10." +"in the :mod:`collections` module, like ``collections.Mapping`` alias " +"to :class:`collections.abc.Mapping`, are kept for one last release for " +"backward compatibility. They will be removed from Python 3.10." msgstr "" #: ../../whatsnew/3.9.rst:131 @@ -210,8 +210,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:145 msgid "" -"Merge (``|``) and update (``|=``) operators have been added to the built-in :" -"class:`dict` class. Those complement the existing ``dict.update`` and " +"Merge (``|``) and update (``|=``) operators have been added to the built-" +"in :class:`dict` class. Those complement the existing ``dict.update`` and " "``{**d1, **d2}`` methods of merging dictionaries." msgstr "" @@ -237,8 +237,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:158 msgid "" -"See :pep:`584` for a full description. (Contributed by Brandt Bucher in :" -"issue:`36144`.)" +"See :pep:`584` for a full description. (Contributed by Brandt Bucher " +"in :issue:`36144`.)" msgstr "" #: ../../whatsnew/3.9.rst:162 @@ -247,12 +247,12 @@ msgstr "" #: ../../whatsnew/3.9.rst:164 msgid "" -":meth:`str.removeprefix(prefix)<str.removeprefix>` and :meth:`str." -"removesuffix(suffix)<str.removesuffix>` have been added to easily remove an " -"unneeded prefix or a suffix from a string. Corresponding ``bytes``, " -"``bytearray``, and ``collections.UserString`` methods have also been added. " -"See :pep:`616` for a full description. (Contributed by Dennis Sweeney in :" -"issue:`39939`.)" +":meth:`str.removeprefix(prefix)<str.removeprefix>` " +"and :meth:`str.removesuffix(suffix)<str.removesuffix>` have been added to " +"easily remove an unneeded prefix or a suffix from a string. Corresponding " +"``bytes``, ``bytearray``, and ``collections.UserString`` methods have also " +"been added. See :pep:`616` for a full description. (Contributed by Dennis " +"Sweeney in :issue:`39939`.)" msgstr "" #: ../../whatsnew/3.9.rst:172 @@ -329,28 +329,28 @@ msgstr "其他語言更動" #: ../../whatsnew/3.9.rst:218 msgid "" -":func:`__import__` now raises :exc:`ImportError` instead of :exc:" -"`ValueError`, which used to occur when a relative import went past its top-" -"level package. (Contributed by Ngalim Siregar in :issue:`37444`.)" +":func:`__import__` now raises :exc:`ImportError` instead " +"of :exc:`ValueError`, which used to occur when a relative import went past " +"its top-level package. (Contributed by Ngalim Siregar in :issue:`37444`.)" msgstr "" #: ../../whatsnew/3.9.rst:223 msgid "" "Python now gets the absolute path of the script filename specified on the " -"command line (ex: ``python3 script.py``): the ``__file__`` attribute of the :" -"mod:`__main__` module became an absolute path, rather than a relative path. " -"These paths now remain valid after the current directory is changed by :func:" -"`os.chdir`. As a side effect, the traceback also displays the absolute path " -"for :mod:`__main__` module frames in this case. (Contributed by Victor " -"Stinner in :issue:`20443`.)" +"command line (ex: ``python3 script.py``): the ``__file__`` attribute of " +"the :mod:`__main__` module became an absolute path, rather than a relative " +"path. These paths now remain valid after the current directory is changed " +"by :func:`os.chdir`. As a side effect, the traceback also displays the " +"absolute path for :mod:`__main__` module frames in this case. (Contributed " +"by Victor Stinner in :issue:`20443`.)" msgstr "" #: ../../whatsnew/3.9.rst:231 msgid "" "In the :ref:`Python Development Mode <devmode>` and in :ref:`debug build " "<debug-build>`, the *encoding* and *errors* arguments are now checked for " -"string encoding and decoding operations. Examples: :func:`open`, :meth:`str." -"encode` and :meth:`bytes.decode`." +"string encoding and decoding operations. " +"Examples: :func:`open`, :meth:`str.encode` and :meth:`bytes.decode`." msgstr "" #: ../../whatsnew/3.9.rst:236 @@ -386,25 +386,26 @@ msgstr "" #: ../../whatsnew/3.9.rst:256 msgid "" -"Parallel running of :meth:`~agen.aclose` / :meth:`~agen.asend` / :meth:" -"`~agen.athrow` is now prohibited, and ``ag_running`` now reflects the actual " -"running status of the async generator. (Contributed by Yury Selivanov in :" -"issue:`30773`.)" +"Parallel running " +"of :meth:`~agen.aclose` / :meth:`~agen.asend` / :meth:`~agen.athrow` is now " +"prohibited, and ``ag_running`` now reflects the actual running status of the " +"async generator. (Contributed by Yury Selivanov in :issue:`30773`.)" msgstr "" #: ../../whatsnew/3.9.rst:261 msgid "" "Unexpected errors in calling the ``__iter__`` method are no longer masked by " -"``TypeError`` in the :keyword:`in` operator and functions :func:`~operator." -"contains`, :func:`~operator.indexOf` and :func:`~operator.countOf` of the :" -"mod:`operator` module. (Contributed by Serhiy Storchaka in :issue:`40824`.)" +"``TypeError`` in the :keyword:`in` operator and " +"functions :func:`~operator.contains`, :func:`~operator.indexOf` " +"and :func:`~operator.countOf` of the :mod:`operator` module. (Contributed by " +"Serhiy Storchaka in :issue:`40824`.)" msgstr "" #: ../../whatsnew/3.9.rst:267 msgid "" "Unparenthesized lambda expressions can no longer be the expression part in " -"an ``if`` clause in comprehensions and generator expressions. See :issue:" -"`41848` and :issue:`43755` for details." +"an ``if`` clause in comprehensions and generator expressions. " +"See :issue:`41848` and :issue:`43755` for details." msgstr "" #: ../../whatsnew/3.9.rst:273 @@ -418,8 +419,9 @@ msgstr "zoneinfo" #: ../../whatsnew/3.9.rst:278 msgid "" "The :mod:`zoneinfo` module brings support for the IANA time zone database to " -"the standard library. It adds :class:`zoneinfo.ZoneInfo`, a concrete :class:" -"`datetime.tzinfo` implementation backed by the system's time zone data." +"the standard library. It adds :class:`zoneinfo.ZoneInfo`, a " +"concrete :class:`datetime.tzinfo` implementation backed by the system's time " +"zone data." msgstr "" #: ../../whatsnew/3.9.rst:284 @@ -465,10 +467,10 @@ msgstr "graphlib" #: ../../whatsnew/3.9.rst:315 msgid "" -"A new module, :mod:`graphlib`, was added that contains the :class:`graphlib." -"TopologicalSorter` class to offer functionality to perform topological " -"sorting of graphs. (Contributed by Pablo Galindo, Tim Peters and Larry " -"Hastings in :issue:`17005`.)" +"A new module, :mod:`graphlib`, was added that contains " +"the :class:`graphlib.TopologicalSorter` class to offer functionality to " +"perform topological sorting of graphs. (Contributed by Pablo Galindo, Tim " +"Peters and Larry Hastings in :issue:`17005`.)" msgstr "" #: ../../whatsnew/3.9.rst:322 @@ -482,8 +484,8 @@ msgstr "ast" #: ../../whatsnew/3.9.rst:327 msgid "" "Added the *indent* option to :func:`~ast.dump` which allows it to produce a " -"multiline indented output. (Contributed by Serhiy Storchaka in :issue:" -"`37995`.)" +"multiline indented output. (Contributed by Serhiy Storchaka " +"in :issue:`37995`.)" msgstr "" #: ../../whatsnew/3.9.rst:331 @@ -506,21 +508,22 @@ msgstr "asyncio" #: ../../whatsnew/3.9.rst:342 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" #: ../../whatsnew/3.9.rst:349 msgid "" -"Added a new :term:`coroutine` :meth:`~asyncio.loop." -"shutdown_default_executor` that schedules a shutdown for the default " -"executor that waits on the :class:`~concurrent.futures.ThreadPoolExecutor` " -"to finish closing. Also, :func:`asyncio.run` has been updated to use the " -"new :term:`coroutine`. (Contributed by Kyle Stanley in :issue:`34037`.)" +"Added a " +"new :term:`coroutine` :meth:`~asyncio.loop.shutdown_default_executor` that " +"schedules a shutdown for the default executor that waits on " +"the :class:`~concurrent.futures.ThreadPoolExecutor` to finish closing. " +"Also, :func:`asyncio.run` has been updated to use the new :term:`coroutine`. " +"(Contributed by Kyle Stanley in :issue:`34037`.)" msgstr "" #: ../../whatsnew/3.9.rst:355 @@ -533,9 +536,10 @@ msgstr "" msgid "" "Added a new :term:`coroutine` :func:`asyncio.to_thread`. It is mainly used " "for running IO-bound functions in a separate thread to avoid blocking the " -"event loop, and essentially works as a high-level version of :meth:`~asyncio." -"loop.run_in_executor` that can directly take keyword arguments. (Contributed " -"by Kyle Stanley and Yury Selivanov in :issue:`32309`.)" +"event loop, and essentially works as a high-level version " +"of :meth:`~asyncio.loop.run_in_executor` that can directly take keyword " +"arguments. (Contributed by Kyle Stanley and Yury Selivanov " +"in :issue:`32309`.)" msgstr "" #: ../../whatsnew/3.9.rst:364 @@ -549,8 +553,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:369 msgid "" ":mod:`asyncio` now raises :exc:`TypeError` when calling incompatible methods " -"with an :class:`ssl.SSLSocket` socket. (Contributed by Ido Michael in :issue:" -"`37404`.)" +"with an :class:`ssl.SSLSocket` socket. (Contributed by Ido Michael " +"in :issue:`37404`.)" msgstr "" #: ../../whatsnew/3.9.rst:374 @@ -569,8 +573,8 @@ msgid "" "Added new options for path manipulation in resulting ``.pyc`` files: " "*stripdir*, *prependdir*, *limit_sl_dest* parameters and -s, -p, -e command " "line options. Added the possibility to specify the option for an " -"optimization level multiple times. (Contributed by Lumír 'Frenzy' Balhar in :" -"issue:`38112`.)" +"optimization level multiple times. (Contributed by Lumír 'Frenzy' Balhar " +"in :issue:`38112`.)" msgstr "" #: ../../whatsnew/3.9.rst:384 @@ -579,10 +583,11 @@ msgstr "concurrent.futures" #: ../../whatsnew/3.9.rst:386 msgid "" -"Added a new *cancel_futures* parameter to :meth:`concurrent.futures.Executor." -"shutdown` that cancels all pending futures which have not started running, " -"instead of waiting for them to complete before shutting down the executor. " -"(Contributed by Kyle Stanley in :issue:`39349`.)" +"Added a new *cancel_futures* parameter " +"to :meth:`concurrent.futures.Executor.shutdown` that cancels all pending " +"futures which have not started running, instead of waiting for them to " +"complete before shutting down the executor. (Contributed by Kyle Stanley " +"in :issue:`39349`.)" msgstr "" #: ../../whatsnew/3.9.rst:392 @@ -607,9 +612,9 @@ msgstr "curses" #: ../../whatsnew/3.9.rst:405 msgid "" -"Added :func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:" -"`curses.get_tabsize`, and :func:`curses.set_tabsize` functions. (Contributed " -"by Anthony Sottile in :issue:`38312`.)" +"Added :func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:`curses.get_tabsize`, " +"and :func:`curses.set_tabsize` functions. (Contributed by Anthony Sottile " +"in :issue:`38312`.)" msgstr "" #: ../../whatsnew/3.9.rst:410 @@ -618,10 +623,10 @@ msgstr "datetime" #: ../../whatsnew/3.9.rst:411 msgid "" -"The :meth:`~datetime.date.isocalendar` of :class:`datetime.date` and :meth:" -"`~datetime.datetime.isocalendar` of :class:`datetime.datetime` methods now " -"returns a :func:`~collections.namedtuple` instead of a :class:`tuple`. " -"(Contributed by Donghee Na in :issue:`24416`.)" +"The :meth:`~datetime.date.isocalendar` of :class:`datetime.date` " +"and :meth:`~datetime.datetime.isocalendar` of :class:`datetime.datetime` " +"methods now returns a :func:`~collections.namedtuple` instead of " +"a :class:`tuple`. (Contributed by Donghee Na in :issue:`24416`.)" msgstr "" #: ../../whatsnew/3.9.rst:417 @@ -642,8 +647,8 @@ msgstr "fcntl" #: ../../whatsnew/3.9.rst:426 msgid "" "Added constants :const:`~fcntl.F_OFD_GETLK`, :const:`~fcntl.F_OFD_SETLK` " -"and :const:`~fcntl.F_OFD_SETLKW`. (Contributed by Donghee Na in :issue:" -"`38602`.)" +"and :const:`~fcntl.F_OFD_SETLKW`. (Contributed by Donghee Na " +"in :issue:`38602`.)" msgstr "" #: ../../whatsnew/3.9.rst:431 @@ -652,10 +657,10 @@ msgstr "ftplib" #: ../../whatsnew/3.9.rst:433 msgid "" -":class:`~ftplib.FTP` and :class:`~ftplib.FTP_TLS` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`~ftplib.FTP` and :class:`~ftplib.FTP_TLS` now raise " +"a :class:`ValueError` if the given timeout for their constructor is zero to " +"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " +"in :issue:`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:438 @@ -667,15 +672,15 @@ msgid "" "When the garbage collector makes a collection in which some objects " "resurrect (they are reachable from outside the isolated cycles after the " "finalizers have been executed), do not block the collection of all objects " -"that are still unreachable. (Contributed by Pablo Galindo and Tim Peters in :" -"issue:`38379`.)" +"that are still unreachable. (Contributed by Pablo Galindo and Tim Peters " +"in :issue:`38379`.)" msgstr "" #: ../../whatsnew/3.9.rst:445 msgid "" "Added a new function :func:`gc.is_finalized` to check if an object has been " -"finalized by the garbage collector. (Contributed by Pablo Galindo in :issue:" -"`39322`.)" +"finalized by the garbage collector. (Contributed by Pablo Galindo " +"in :issue:`39322`.)" msgstr "" #: ../../whatsnew/3.9.rst:450 @@ -713,8 +718,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:472 msgid "" -"Added option to toggle cursor blink off. (Contributed by Zackery Spytz in :" -"issue:`4603`.)" +"Added option to toggle cursor blink off. (Contributed by Zackery Spytz " +"in :issue:`4603`.)" msgstr "" #: ../../whatsnew/3.9.rst:475 @@ -736,8 +741,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:483 msgid "" "Make IDLE invoke :func:`sys.excepthook` (when started without '-n'). User " -"hooks were previously ignored. (Contributed by Ken Hilton in :issue:" -"`43008`.)" +"hooks were previously ignored. (Contributed by Ken Hilton " +"in :issue:`43008`.)" msgstr "" #: ../../whatsnew/3.9.rst:487 @@ -749,10 +754,10 @@ msgid "" "Rearrange the settings dialog. Split the General tab into Windows and Shell/" "Ed tabs. Move help sources, which extend the Help menu, to the Extensions " "tab. Make space for new options and shorten the dialog. The latter makes " -"the dialog better fit small screens. (Contributed by Terry Jan Reedy in :" -"issue:`40468`.) Move the indent space setting from the Font tab to the new " -"Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy in :issue:" -"`33962`.)" +"the dialog better fit small screens. (Contributed by Terry Jan Reedy " +"in :issue:`40468`.) Move the indent space setting from the Font tab to the " +"new Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy " +"in :issue:`33962`.)" msgstr "" #: ../../whatsnew/3.9.rst:497 @@ -768,11 +773,11 @@ msgstr "imaplib" #: ../../whatsnew/3.9.rst:503 msgid "" ":class:`~imaplib.IMAP4` and :class:`~imaplib.IMAP4_SSL` now have an optional " -"*timeout* parameter for their constructors. Also, the :meth:`~imaplib.IMAP4." -"open` method now has an optional *timeout* parameter with this change. The " -"overridden methods of :class:`~imaplib.IMAP4_SSL` and :class:`~imaplib." -"IMAP4_stream` were applied to this change. (Contributed by Donghee Na in :" -"issue:`38615`.)" +"*timeout* parameter for their constructors. Also, " +"the :meth:`~imaplib.IMAP4.open` method now has an optional *timeout* " +"parameter with this change. The overridden methods " +"of :class:`~imaplib.IMAP4_SSL` and :class:`~imaplib.IMAP4_stream` were " +"applied to this change. (Contributed by Donghee Na in :issue:`38615`.)" msgstr "" #: ../../whatsnew/3.9.rst:510 @@ -791,10 +796,10 @@ msgstr "importlib" #: ../../whatsnew/3.9.rst:520 msgid "" -"To improve consistency with import statements, :func:`importlib.util." -"resolve_name` now raises :exc:`ImportError` instead of :exc:`ValueError` for " -"invalid relative import attempts. (Contributed by Ngalim Siregar in :issue:" -"`37444`.)" +"To improve consistency with import " +"statements, :func:`importlib.util.resolve_name` now " +"raises :exc:`ImportError` instead of :exc:`ValueError` for invalid relative " +"import attempts. (Contributed by Ngalim Siregar in :issue:`37444`.)" msgstr "" #: ../../whatsnew/3.9.rst:525 @@ -823,8 +828,8 @@ msgstr "inspect" #: ../../whatsnew/3.9.rst:539 msgid "" ":attr:`inspect.BoundArguments.arguments` is changed from ``OrderedDict`` to " -"regular dict. (Contributed by Inada Naoki in :issue:`36350` and :issue:" -"`39775`.)" +"regular dict. (Contributed by Inada Naoki in :issue:`36350` " +"and :issue:`39775`.)" msgstr "" #: ../../whatsnew/3.9.rst:543 @@ -840,16 +845,16 @@ msgstr "" #: ../../whatsnew/3.9.rst:547 msgid "" "Scoped IPv6 addresses can be parsed using :class:`ipaddress.IPv6Address`. If " -"present, scope zone ID is available through the :attr:`~ipaddress." -"IPv6Address.scope_id` attribute. (Contributed by Oleksandr Pavliuk in :issue:" -"`34788`.)" +"present, scope zone ID is available through " +"the :attr:`~ipaddress.IPv6Address.scope_id` attribute. (Contributed by " +"Oleksandr Pavliuk in :issue:`34788`.)" msgstr "" #: ../../whatsnew/3.9.rst:551 msgid "" "Starting with Python 3.9.5 the :mod:`ipaddress` module no longer accepts any " -"leading zeros in IPv4 address strings. (Contributed by Christian Heimes in :" -"issue:`36384`)." +"leading zeros in IPv4 address strings. (Contributed by Christian Heimes " +"in :issue:`36384`)." msgstr "" #: ../../whatsnew/3.9.rst:556 @@ -888,9 +893,9 @@ msgstr "multiprocessing" #: ../../whatsnew/3.9.rst:577 msgid "" -"The :class:`multiprocessing.SimpleQueue` class has a new :meth:" -"`~multiprocessing.SimpleQueue.close` method to explicitly close the queue. " -"(Contributed by Victor Stinner in :issue:`30966`.)" +"The :class:`multiprocessing.SimpleQueue` class has a " +"new :meth:`~multiprocessing.SimpleQueue.close` method to explicitly close " +"the queue. (Contributed by Victor Stinner in :issue:`30966`.)" msgstr "" #: ../../whatsnew/3.9.rst:583 @@ -916,8 +921,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:595 msgid "" -"Exposed the Linux-specific :func:`os.pidfd_open` (:issue:`38692`) and :const:" -"`os.P_PIDFD` (:issue:`38713`) for process management with file descriptors." +"Exposed the Linux-specific :func:`os.pidfd_open` (:issue:`38692`) " +"and :const:`os.P_PIDFD` (:issue:`38713`) for process management with file " +"descriptors." msgstr "" #: ../../whatsnew/3.9.rst:599 @@ -944,8 +950,8 @@ msgstr "pathlib" #: ../../whatsnew/3.9.rst:613 msgid "" -"Added :meth:`pathlib.Path.readlink` which acts similarly to :func:`os." -"readlink`. (Contributed by Girts Folkmanis in :issue:`30618`)" +"Added :meth:`pathlib.Path.readlink` which acts similarly " +"to :func:`os.readlink`. (Contributed by Girts Folkmanis in :issue:`30618`)" msgstr "" #: ../../whatsnew/3.9.rst:618 @@ -964,10 +970,10 @@ msgstr "poplib" #: ../../whatsnew/3.9.rst:626 msgid "" -":class:`~poplib.POP3` and :class:`~poplib.POP3_SSL` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`~poplib.POP3` and :class:`~poplib.POP3_SSL` now raise " +"a :class:`ValueError` if the given timeout for their constructor is zero to " +"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " +"in :issue:`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:631 @@ -1008,8 +1014,8 @@ msgstr "signal" #: ../../whatsnew/3.9.rst:653 msgid "" "Exposed the Linux-specific :func:`signal.pidfd_send_signal` for sending to " -"signals to a process using a file descriptor instead of a pid. (:issue:" -"`38712`)" +"signals to a process using a file descriptor instead of a pid. " +"(:issue:`38712`)" msgstr "" #: ../../whatsnew/3.9.rst:657 @@ -1018,10 +1024,10 @@ msgstr "smtplib" #: ../../whatsnew/3.9.rst:659 msgid "" -":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise " +"a :class:`ValueError` if the given timeout for their constructor is zero to " +"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " +"in :issue:`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:663 @@ -1036,9 +1042,9 @@ msgstr "socket" #: ../../whatsnew/3.9.rst:669 msgid "" -"The :mod:`socket` module now exports the :const:`~socket." -"CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. (Contributed by " -"Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" +"The :mod:`socket` module now exports " +"the :const:`~socket.CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. " +"(Contributed by Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" msgstr "" #: ../../whatsnew/3.9.rst:673 @@ -1049,9 +1055,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:676 msgid "" -"The socket module now has the :func:`socket.send_fds` and :func:`socket." -"recv_fds` functions. (Contributed by Joannah Nanjekye, Shinya Okano and " -"Victor Stinner in :issue:`28724`.)" +"The socket module now has the :func:`socket.send_fds` " +"and :func:`socket.recv_fds` functions. (Contributed by Joannah Nanjekye, " +"Shinya Okano and Victor Stinner in :issue:`28724`.)" msgstr "" #: ../../whatsnew/3.9.rst:682 @@ -1139,10 +1145,11 @@ msgstr "xml" #: ../../whatsnew/3.9.rst:735 msgid "" -"White space characters within attributes are now preserved when serializing :" -"mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer normalized to " -"\"\\n\". This is the result of discussion about how to interpret section " -"2.11 of XML spec. (Contributed by Mefistotelis in :issue:`39011`.)" +"White space characters within attributes are now preserved when " +"serializing :mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer " +"normalized to \"\\n\". This is the result of discussion about how to " +"interpret section 2.11 of XML spec. (Contributed by Mefistotelis " +"in :issue:`39011`.)" msgstr "" #: ../../whatsnew/3.9.rst:743 @@ -1182,8 +1189,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:762 msgid "" "Previously, the bytecode evaluation loop was interrupted at each instruction " -"until the main thread handles signals. (Contributed by Victor Stinner in :" -"issue:`40010`.)" +"until the main thread handles signals. (Contributed by Victor Stinner " +"in :issue:`40010`.)" msgstr "" #: ../../whatsnew/3.9.rst:766 @@ -1201,10 +1208,11 @@ msgstr "" #: ../../whatsnew/3.9.rst:774 msgid "" -"A number of Python builtins (:class:`range`, :class:`tuple`, :class:`set`, :" -"class:`frozenset`, :class:`list`, :class:`dict`) are now sped up by using :" -"pep:`590` vectorcall protocol. (Contributed by Donghee Na, Mark Shannon, " -"Jeroen Demeyer and Petr Viktorin in :issue:`37207`.)" +"A number of Python builtins " +"(:class:`range`, :class:`tuple`, :class:`set`, :class:`frozenset`, :class:`list`, :class:`dict`) " +"are now sped up by using :pep:`590` vectorcall protocol. (Contributed by " +"Donghee Na, Mark Shannon, Jeroen Demeyer and Petr Viktorin " +"in :issue:`37207`.)" msgstr "" #: ../../whatsnew/3.9.rst:779 @@ -1395,10 +1403,10 @@ msgid "" "These results were generated from the variable access benchmark script at: " "``Tools/scripts/var_access_benchmark.py``. The benchmark script displays " "timings in nanoseconds. The benchmarks were measured on an `Intel® Core™ " -"i7-4960HQ processor <https://ark.intel.com/content/www/us/en/ark/" -"products/76088/intel-core-i7-4960hq-processor-6m-cache-up-to-3-80-ghz." -"html>`_ running the macOS 64-bit builds found at `python.org <https://www." -"python.org/downloads/macos/>`_." +"i7-4960HQ processor <https://ark.intel.com/content/www/us/en/ark/products/" +"76088/intel-core-i7-4960hq-processor-6m-cache-up-to-3-80-ghz.html>`_ running " +"the macOS 64-bit builds found at `python.org <https://www.python.org/" +"downloads/macos/>`_." msgstr "" #: ../../whatsnew/3.9.rst:853 @@ -1408,8 +1416,8 @@ msgstr "已棄用" #: ../../whatsnew/3.9.rst:855 msgid "" "The distutils ``bdist_msi`` command is now deprecated, use ``bdist_wheel`` " -"(wheel packages) instead. (Contributed by Hugo van Kemenade in :issue:" -"`39586`.)" +"(wheel packages) instead. (Contributed by Hugo van Kemenade " +"in :issue:`39586`.)" msgstr "" #: ../../whatsnew/3.9.rst:859 @@ -1431,8 +1439,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:870 msgid "" -"The Public C API functions :c:func:`!PyParser_SimpleParseStringFlags`, :c:" -"func:`!PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" +"The Public C API functions :c:func:`!" +"PyParser_SimpleParseStringFlags`, :c:func:`!" +"PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" "PyParser_SimpleParseFileFlags` and :c:func:`!PyNode_Compile` are deprecated " "and will be removed in Python 3.10 together with the old parser." msgstr "" @@ -1450,8 +1459,9 @@ msgid "" "The :mod:`random` module currently accepts any hashable type as a possible " "seed value. Unfortunately, some of those types are not guaranteed to have a " "deterministic hash value. After Python 3.9, the module will restrict its " -"seeds to :const:`None`, :class:`int`, :class:`float`, :class:`str`, :class:" -"`bytes`, and :class:`bytearray`." +"seeds " +"to :const:`None`, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, " +"and :class:`bytearray`." msgstr "" #: ../../whatsnew/3.9.rst:887 @@ -1459,8 +1469,8 @@ msgid "" "Opening the :class:`~gzip.GzipFile` file for writing without specifying the " "*mode* argument is deprecated. In future Python versions it will always be " "opened for reading by default. Specify the *mode* argument for opening it " -"for writing and silencing a warning. (Contributed by Serhiy Storchaka in :" -"issue:`28286`.)" +"for writing and silencing a warning. (Contributed by Serhiy Storchaka " +"in :issue:`28286`.)" msgstr "" #: ../../whatsnew/3.9.rst:893 @@ -1509,17 +1519,17 @@ msgid "" ":mod:`ast` classes ``Suite``, ``Param``, ``AugLoad`` and ``AugStore`` are " "considered deprecated and will be removed in future Python versions. They " "were not generated by the parser and not accepted by the code generator in " -"Python 3. (Contributed by Batuhan Taskaya in :issue:`39639` and :issue:" -"`39969` and Serhiy Storchaka in :issue:`39988`.)" +"Python 3. (Contributed by Batuhan Taskaya in :issue:`39639` " +"and :issue:`39969` and Serhiy Storchaka in :issue:`39988`.)" msgstr "" #: ../../whatsnew/3.9.rst:923 msgid "" "The :c:func:`!PyEval_InitThreads` and :c:func:`!PyEval_ThreadsInitialized` " -"functions are now deprecated and will be removed in Python 3.11. Calling :c:" -"func:`!PyEval_InitThreads` now does nothing. The :term:`GIL` is initialized " -"by :c:func:`Py_Initialize` since Python 3.7. (Contributed by Victor Stinner " -"in :issue:`39877`.)" +"functions are now deprecated and will be removed in Python 3.11. " +"Calling :c:func:`!PyEval_InitThreads` now does nothing. The :term:`GIL` is " +"initialized by :c:func:`Py_Initialize` since Python 3.7. (Contributed by " +"Victor Stinner in :issue:`39877`.)" msgstr "" #: ../../whatsnew/3.9.rst:929 @@ -1531,8 +1541,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:932 msgid "" ":func:`!smtpd.MailmanProxy` is now deprecated as it is unusable without an " -"external module, ``mailman``. (Contributed by Samuel Colvin in :issue:" -"`35800`.)" +"external module, ``mailman``. (Contributed by Samuel Colvin " +"in :issue:`35800`.)" msgstr "" #: ../../whatsnew/3.9.rst:935 @@ -1566,8 +1576,8 @@ msgid "" "removed. These methods are deprecated since Python 3.3. Generally, these " "extensions are not supported or not enabled by NNTP server administrators. " "For ``xgtitle()``, please use :meth:`!nntplib.NNTP.descriptions` or :meth:`!" -"nntplib.NNTP.description` instead. (Contributed by Donghee Na in :issue:" -"`39366`.)" +"nntplib.NNTP.description` instead. (Contributed by Donghee Na " +"in :issue:`39366`.)" msgstr "" #: ../../whatsnew/3.9.rst:963 @@ -1588,9 +1598,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:973 msgid "" "The ``sys.getcheckinterval()`` and ``sys.setcheckinterval()`` functions have " -"been removed. They were deprecated since Python 3.2. Use :func:`sys." -"getswitchinterval` and :func:`sys.setswitchinterval` instead. (Contributed " -"by Victor Stinner in :issue:`37392`.)" +"been removed. They were deprecated since Python 3.2. " +"Use :func:`sys.getswitchinterval` and :func:`sys.setswitchinterval` instead. " +"(Contributed by Victor Stinner in :issue:`37392`.)" msgstr "" #: ../../whatsnew/3.9.rst:978 @@ -1624,21 +1634,23 @@ msgstr "" #: ../../whatsnew/3.9.rst:996 msgid "" -"Methods ``getchildren()`` and ``getiterator()`` of classes :class:`~xml." -"etree.ElementTree.ElementTree` and :class:`~xml.etree.ElementTree.Element` " -"in the :mod:`~xml.etree.ElementTree` module have been removed. They were " -"deprecated in Python 3.2. Use ``iter(x)`` or ``list(x)`` instead of ``x." -"getchildren()`` and ``x.iter()`` or ``list(x.iter())`` instead of ``x." -"getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" +"Methods ``getchildren()`` and ``getiterator()`` of " +"classes :class:`~xml.etree.ElementTree.ElementTree` " +"and :class:`~xml.etree.ElementTree.Element` in " +"the :mod:`~xml.etree.ElementTree` module have been removed. They were " +"deprecated in Python 3.2. Use ``iter(x)`` or ``list(x)`` instead of " +"``x.getchildren()`` and ``x.iter()`` or ``list(x.iter())`` instead of " +"``x.getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" msgstr "" #: ../../whatsnew/3.9.rst:1004 msgid "" "The old :mod:`plistlib` API has been removed, it was deprecated since Python " -"3.4. Use the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:" -"`~plistlib.dump`, and :func:`~plistlib.dumps` functions. Additionally, the " -"*use_builtin_types* parameter was removed, standard :class:`bytes` objects " -"are always used instead. (Contributed by Jon Janzen in :issue:`36409`.)" +"3.4. Use " +"the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:`~plistlib.dump`, " +"and :func:`~plistlib.dumps` functions. Additionally, the *use_builtin_types* " +"parameter was removed, standard :class:`bytes` objects are always used " +"instead. (Contributed by Jon Janzen in :issue:`36409`.)" msgstr "" #: ../../whatsnew/3.9.rst:1010 @@ -1652,9 +1664,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:1015 msgid "" "``base64.encodestring()`` and ``base64.decodestring()``, aliases deprecated " -"since Python 3.1, have been removed: use :func:`base64.encodebytes` and :" -"func:`base64.decodebytes` instead. (Contributed by Victor Stinner in :issue:" -"`39351`.)" +"since Python 3.1, have been removed: use :func:`base64.encodebytes` " +"and :func:`base64.decodebytes` instead. (Contributed by Victor Stinner " +"in :issue:`39351`.)" msgstr "" #: ../../whatsnew/3.9.rst:1020 @@ -1675,9 +1687,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:1029 msgid "" "The *encoding* parameter of :func:`json.loads` has been removed. As of " -"Python 3.1, it was deprecated and ignored; using it has emitted a :exc:" -"`DeprecationWarning` since Python 3.8. (Contributed by Inada Naoki in :issue:" -"`39377`)" +"Python 3.1, it was deprecated and ignored; using it has emitted " +"a :exc:`DeprecationWarning` since Python 3.8. (Contributed by Inada Naoki " +"in :issue:`39377`)" msgstr "" #: ../../whatsnew/3.9.rst:1034 @@ -1691,18 +1703,18 @@ msgstr "" #: ../../whatsnew/3.9.rst:1039 msgid "" "The :func:`!sys.getcounts` function, the ``-X showalloccount`` command line " -"option and the ``show_alloc_count`` field of the C structure :c:type:" -"`PyConfig` have been removed. They required a special Python build by " -"defining ``COUNT_ALLOCS`` macro. (Contributed by Victor Stinner in :issue:" -"`39489`.)" +"option and the ``show_alloc_count`` field of the C " +"structure :c:type:`PyConfig` have been removed. They required a special " +"Python build by defining ``COUNT_ALLOCS`` macro. (Contributed by Victor " +"Stinner in :issue:`39489`.)" msgstr "" #: ../../whatsnew/3.9.rst:1045 msgid "" "The ``_field_types`` attribute of the :class:`typing.NamedTuple` class has " "been removed. It was deprecated since Python 3.8. Use the " -"``__annotations__`` attribute instead. (Contributed by Serhiy Storchaka in :" -"issue:`40182`.)" +"``__annotations__`` attribute instead. (Contributed by Serhiy Storchaka " +"in :issue:`40182`.)" msgstr "" #: ../../whatsnew/3.9.rst:1050 @@ -1715,8 +1727,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:1054 msgid "" "The :meth:`!asyncio.Task.current_task` and :meth:`!asyncio.Task.all_tasks` " -"have been removed. They were deprecated since Python 3.7 and you can use :" -"func:`asyncio.current_task` and :func:`asyncio.all_tasks` instead. " +"have been removed. They were deprecated since Python 3.7 and you can " +"use :func:`asyncio.current_task` and :func:`asyncio.all_tasks` instead. " "(Contributed by Rémi Lapeyre in :issue:`40967`)" msgstr "" @@ -1740,14 +1752,15 @@ msgstr "" #: ../../whatsnew/3.9.rst:1073 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.9.rst:1075 msgid "" -":func:`__import__` and :func:`importlib.util.resolve_name` now raise :exc:" -"`ImportError` where it previously raised :exc:`ValueError`. Callers catching " -"the specific exception type and supporting both Python 3.9 and earlier " -"versions will need to catch both using ``except (ImportError, ValueError):``." +":func:`__import__` and :func:`importlib.util.resolve_name` now " +"raise :exc:`ImportError` where it previously raised :exc:`ValueError`. " +"Callers catching the specific exception type and supporting both Python 3.9 " +"and earlier versions will need to catch both using ``except (ImportError, " +"ValueError):``." msgstr "" #: ../../whatsnew/3.9.rst:1080 @@ -1758,8 +1771,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:1083 msgid "" -"The :meth:`select.epoll.unregister` method no longer ignores the :const:" -"`~errno.EBADF` error. (Contributed by Victor Stinner in :issue:`39239`.)" +"The :meth:`select.epoll.unregister` method no longer ignores " +"the :const:`~errno.EBADF` error. (Contributed by Victor Stinner " +"in :issue:`39239`.)" msgstr "" #: ../../whatsnew/3.9.rst:1087 @@ -1793,10 +1807,10 @@ msgstr "" #: ../../whatsnew/3.9.rst:1105 msgid "" -":meth:`asyncio.loop.shutdown_default_executor` has been added to :class:" -"`~asyncio.AbstractEventLoop`, meaning alternative event loops that inherit " -"from it should have this method defined. (Contributed by Kyle Stanley in :" -"issue:`34037`.)" +":meth:`asyncio.loop.shutdown_default_executor` has been added " +"to :class:`~asyncio.AbstractEventLoop`, meaning alternative event loops that " +"inherit from it should have this method defined. (Contributed by Kyle " +"Stanley in :issue:`34037`.)" msgstr "" #: ../../whatsnew/3.9.rst:1110 @@ -1820,18 +1834,19 @@ msgid "" "The :func:`logging.getLogger` API now returns the root logger when passed " "the name ``'root'``, whereas previously it returned a non-root logger named " "``'root'``. This could affect cases where user code explicitly wants a non-" -"root logger named ``'root'``, or instantiates a logger using ``logging." -"getLogger(__name__)`` in some top-level module called ``'root.py'``. " -"(Contributed by Vinay Sajip in :issue:`37742`.)" +"root logger named ``'root'``, or instantiates a logger using " +"``logging.getLogger(__name__)`` in some top-level module called " +"``'root.py'``. (Contributed by Vinay Sajip in :issue:`37742`.)" msgstr "" #: ../../whatsnew/3.9.rst:1127 msgid "" -"Division handling of :class:`~pathlib.PurePath` now returns :data:" -"`NotImplemented` instead of raising a :exc:`TypeError` when passed something " -"other than an instance of ``str`` or :class:`~pathlib.PurePath`. This " -"allows creating compatible classes that don't inherit from those mentioned " -"types. (Contributed by Roger Aiudi in :issue:`34775`)." +"Division handling of :class:`~pathlib.PurePath` now " +"returns :data:`NotImplemented` instead of raising a :exc:`TypeError` when " +"passed something other than an instance of ``str`` " +"or :class:`~pathlib.PurePath`. This allows creating compatible classes that " +"don't inherit from those mentioned types. (Contributed by Roger Aiudi " +"in :issue:`34775`)." msgstr "" #: ../../whatsnew/3.9.rst:1133 @@ -1846,11 +1861,11 @@ msgstr "" #: ../../whatsnew/3.9.rst:1141 msgid "" -":func:`codecs.lookup` now normalizes the encoding name the same way as :func:" -"`encodings.normalize_encoding`, except that :func:`codecs.lookup` also " -"converts the name to lower case. For example, ``\"latex+latin1\"`` encoding " -"name is now normalized to ``\"latex_latin1\"``. (Contributed by Jordon Xu " -"in :issue:`37751`.)" +":func:`codecs.lookup` now normalizes the encoding name the same way " +"as :func:`encodings.normalize_encoding`, except that :func:`codecs.lookup` " +"also converts the name to lower case. For example, ``\"latex+latin1\"`` " +"encoding name is now normalized to ``\"latex_latin1\"``. (Contributed by " +"Jordon Xu in :issue:`37751`.)" msgstr "" #: ../../whatsnew/3.9.rst:1149 @@ -1863,9 +1878,10 @@ msgid "" "with :c:func:`PyType_FromSpec` and similar APIs) hold a reference to their " "type object since Python 3.8. As indicated in the \"Changes in the C API\" " "of Python 3.8, for the vast majority of cases, there should be no side " -"effect but for types that have a custom :c:member:`~PyTypeObject." -"tp_traverse` function, ensure that all custom ``tp_traverse`` functions of " -"heap-allocated types visit the object's type." +"effect but for types that have a " +"custom :c:member:`~PyTypeObject.tp_traverse` function, ensure that all " +"custom ``tp_traverse`` functions of heap-allocated types visit the object's " +"type." msgstr "" #: ../../whatsnew/3.9.rst:1161 @@ -1920,8 +1936,8 @@ msgstr "(更多資訊請見 :issue:`35810` 與 :issue:`40217`。)" msgid "" "The functions ``PyEval_CallObject``, ``PyEval_CallFunction``, " "``PyEval_CallMethod`` and ``PyEval_CallObjectWithKeywords`` are deprecated. " -"Use :c:func:`PyObject_Call` and its variants instead. (See more details in :" -"issue:`29548`.)" +"Use :c:func:`PyObject_Call` and its variants instead. (See more details " +"in :issue:`29548`.)" msgstr "" #: ../../whatsnew/3.9.rst:1204 @@ -1930,9 +1946,9 @@ msgstr "CPython 位元組碼變更" #: ../../whatsnew/3.9.rst:1206 msgid "" -"The :opcode:`LOAD_ASSERTION_ERROR` opcode was added for handling the :" -"keyword:`assert` statement. Previously, the assert statement would not work " -"correctly if the :exc:`AssertionError` exception was being shadowed. " +"The :opcode:`LOAD_ASSERTION_ERROR` opcode was added for handling " +"the :keyword:`assert` statement. Previously, the assert statement would not " +"work correctly if the :exc:`AssertionError` exception was being shadowed. " "(Contributed by Zackery Spytz in :issue:`34880`.)" msgstr "" @@ -1969,10 +1985,10 @@ msgstr "建置變更" #: ../../whatsnew/3.9.rst:1225 msgid "" "Added ``--with-platlibdir`` option to the ``configure`` script: name of the " -"platform-specific library directory, stored in the new :data:`sys." -"platlibdir` attribute. See :data:`sys.platlibdir` attribute for more " -"information. (Contributed by Jan Matějek, Matěj Cepl, Charalampos Stratakis " -"and Victor Stinner in :issue:`1294959`.)" +"platform-specific library directory, stored in the " +"new :data:`sys.platlibdir` attribute. See :data:`sys.platlibdir` attribute " +"for more information. (Contributed by Jan Matějek, Matěj Cepl, Charalampos " +"Stratakis and Victor Stinner in :issue:`1294959`.)" msgstr "" #: ../../whatsnew/3.9.rst:1231 @@ -2035,16 +2051,16 @@ msgstr "C API 變更" msgid "" ":pep:`573`: Added :c:func:`PyType_FromModuleAndSpec` to associate a module " "with a class; :c:func:`PyType_GetModule` and :c:func:`PyType_GetModuleState` " -"to retrieve the module and its state; and :c:type:`PyCMethod` and :c:macro:" -"`METH_METHOD` to allow a method to access the class it was defined in. " -"(Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" +"to retrieve the module and its state; and :c:type:`PyCMethod` " +"and :c:macro:`METH_METHOD` to allow a method to access the class it was " +"defined in. (Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" msgstr "" #: ../../whatsnew/3.9.rst:1280 msgid "" -"Added :c:func:`PyFrame_GetCode` function: get a frame code. Added :c:func:" -"`PyFrame_GetBack` function: get the frame next outer frame. (Contributed by " -"Victor Stinner in :issue:`40421`.)" +"Added :c:func:`PyFrame_GetCode` function: get a frame code. " +"Added :c:func:`PyFrame_GetBack` function: get the frame next outer frame. " +"(Contributed by Victor Stinner in :issue:`40421`.)" msgstr "" #: ../../whatsnew/3.9.rst:1284 @@ -2055,12 +2071,12 @@ msgstr "" #: ../../whatsnew/3.9.rst:1287 msgid "" -"Added :c:func:`PyThreadState_GetInterpreter` and :c:func:" -"`PyInterpreterState_Get` functions to get the interpreter. Added :c:func:" -"`PyThreadState_GetFrame` function to get the current frame of a Python " -"thread state. Added :c:func:`PyThreadState_GetID` function: get the unique " -"identifier of a Python thread state. (Contributed by Victor Stinner in :" -"issue:`39947`.)" +"Added :c:func:`PyThreadState_GetInterpreter` " +"and :c:func:`PyInterpreterState_Get` functions to get the interpreter. " +"Added :c:func:`PyThreadState_GetFrame` function to get the current frame of " +"a Python thread state. Added :c:func:`PyThreadState_GetID` function: get the " +"unique identifier of a Python thread state. (Contributed by Victor Stinner " +"in :issue:`39947`.)" msgstr "" #: ../../whatsnew/3.9.rst:1295 @@ -2102,18 +2118,18 @@ msgstr "" #: ../../whatsnew/3.9.rst:1317 msgid "" -"Added the functions :c:func:`PyObject_GC_IsTracked` and :c:func:" -"`PyObject_GC_IsFinalized` to the public API to allow to query if Python " -"objects are being currently tracked or have been already finalized by the " -"garbage collector respectively. (Contributed by Pablo Galindo Salgado in :" -"issue:`40241`.)" +"Added the functions :c:func:`PyObject_GC_IsTracked` " +"and :c:func:`PyObject_GC_IsFinalized` to the public API to allow to query if " +"Python objects are being currently tracked or have been already finalized by " +"the garbage collector respectively. (Contributed by Pablo Galindo Salgado " +"in :issue:`40241`.)" msgstr "" #: ../../whatsnew/3.9.rst:1323 msgid "" "Added :c:func:`!_PyObject_FunctionStr` to get a user-friendly string " -"representation of a function-like object. (Patch by Jeroen Demeyer in :issue:" -"`37645`.)" +"representation of a function-like object. (Patch by Jeroen Demeyer " +"in :issue:`37645`.)" msgstr "" #: ../../whatsnew/3.9.rst:1327 @@ -2125,20 +2141,21 @@ msgstr "" #: ../../whatsnew/3.9.rst:1335 msgid "" "``PyInterpreterState.eval_frame`` (:pep:`523`) now requires a new mandatory " -"*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner in :" -"issue:`38500`.)" +"*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner " +"in :issue:`38500`.)" msgstr "" #: ../../whatsnew/3.9.rst:1339 msgid "" -"Extension modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:" -"`~PyModuleDef.m_clear` and :c:member:`~PyModuleDef.m_free` functions of :c:" -"type:`PyModuleDef` are no longer called if the module state was requested " -"but is not allocated yet. This is the case immediately after the module is " -"created and before the module is executed (:c:data:`Py_mod_exec` function). " -"More precisely, these functions are not called if :c:member:`~PyModuleDef." -"m_size` is greater than 0 and the module state (as returned by :c:func:" -"`PyModule_GetState`) is ``NULL``." +"Extension " +"modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:`~PyModuleDef.m_clear` " +"and :c:member:`~PyModuleDef.m_free` functions of :c:type:`PyModuleDef` are " +"no longer called if the module state was requested but is not allocated yet. " +"This is the case immediately after the module is created and before the " +"module is executed (:c:data:`Py_mod_exec` function). More precisely, these " +"functions are not called if :c:member:`~PyModuleDef.m_size` is greater than " +"0 and the module state (as returned by :c:func:`PyModule_GetState`) is " +"``NULL``." msgstr "" #: ../../whatsnew/3.9.rst:1348 @@ -2172,25 +2189,26 @@ msgstr "" #: ../../whatsnew/3.9.rst:1365 msgid "" "The :c:type:`!PyGC_Head` structure is now opaque. It is only defined in the " -"internal C API (``pycore_gc.h``). (Contributed by Victor Stinner in :issue:" -"`40241`.)" +"internal C API (``pycore_gc.h``). (Contributed by Victor Stinner " +"in :issue:`40241`.)" msgstr "" #: ../../whatsnew/3.9.rst:1369 msgid "" -"The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, ``PyUnicode_WSTR_LENGTH``, :c:" -"func:`!PyUnicode_FromUnicode`, :c:func:`!PyUnicode_AsUnicode`, " -"``_PyUnicode_AsUnicode``, and :c:func:`!PyUnicode_AsUnicodeAndSize` are " -"marked as deprecated in C. They have been deprecated by :pep:`393` since " -"Python 3.3. (Contributed by Inada Naoki in :issue:`36346`.)" +"The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, " +"``PyUnicode_WSTR_LENGTH``, :c:func:`!PyUnicode_FromUnicode`, :c:func:`!" +"PyUnicode_AsUnicode`, ``_PyUnicode_AsUnicode``, and :c:func:`!" +"PyUnicode_AsUnicodeAndSize` are marked as deprecated in C. They have been " +"deprecated by :pep:`393` since Python 3.3. (Contributed by Inada Naoki " +"in :issue:`36346`.)" msgstr "" #: ../../whatsnew/3.9.rst:1376 msgid "" "The :c:func:`Py_FatalError` function is replaced with a macro which logs " "automatically the name of the current function, unless the " -"``Py_LIMITED_API`` macro is defined. (Contributed by Victor Stinner in :" -"issue:`39882`.)" +"``Py_LIMITED_API`` macro is defined. (Contributed by Victor Stinner " +"in :issue:`39882`.)" msgstr "" #: ../../whatsnew/3.9.rst:1381 @@ -2210,10 +2228,10 @@ msgstr "" #: ../../whatsnew/3.9.rst:1388 msgid "" -"The :c:func:`!PyObject_NEW` macro becomes an alias to the :c:macro:" -"`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro becomes an " -"alias to the :c:macro:`PyObject_NewVar` macro. They no longer access " -"directly the :c:member:`PyTypeObject.tp_basicsize` member." +"The :c:func:`!PyObject_NEW` macro becomes an alias to " +"the :c:macro:`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro " +"becomes an alias to the :c:macro:`PyObject_NewVar` macro. They no longer " +"access directly the :c:member:`PyTypeObject.tp_basicsize` member." msgstr "" #: ../../whatsnew/3.9.rst:1393 @@ -2243,8 +2261,8 @@ msgstr "(更多資訊請見 :issue:`40170`。)" #: ../../whatsnew/3.9.rst:1409 msgid "" "Excluded ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros of " -"``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner in :issue:" -"`38835`.)" +"``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner " +"in :issue:`38835`.)" msgstr "" #: ../../whatsnew/3.9.rst:1413 @@ -2261,8 +2279,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:1422 msgid "" -"``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye in :issue:" -"`37878`.)" +"``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye " +"in :issue:`37878`.)" msgstr "" #: ../../whatsnew/3.9.rst:1424 @@ -2419,8 +2437,8 @@ msgid "" "``_Py_InitializeFromWideArgs``, ``_PyFloat_Repr``, ``_PyFloat_Digits``, " "``_PyFloat_DigitsInit``, ``PyFrame_ExtendStack``, ``_PyAIterWrapper_Type``, " "``PyNullImporter_Type``, ``PyCmpWrapper_Type``, ``PySortWrapper_Type``, " -"``PyNoArgsFunction``. (Contributed by Pablo Galindo Salgado in :issue:" -"`39372`.)" +"``PyNoArgsFunction``. (Contributed by Pablo Galindo Salgado " +"in :issue:`39372`.)" msgstr "" #: ../../whatsnew/3.9.rst:1490 @@ -2429,8 +2447,9 @@ msgstr "Python 3.9.1 中顯著的變更" #: ../../whatsnew/3.9.rst:1495 msgid "" -"The behavior of :class:`typing.Literal` was changed to conform with :pep:" -"`586` and to match the behavior of static type checkers specified in the PEP." +"The behavior of :class:`typing.Literal` was changed to conform " +"with :pep:`586` and to match the behavior of static type checkers specified " +"in the PEP." msgstr "" #: ../../whatsnew/3.9.rst:1498 @@ -2513,13 +2532,14 @@ msgid "" "``collections.abc.Callable[[int, str], str]`` will have ``__args__`` of " "``(int, str, str)``; previously this was ``([int, str], str)``. To allow " "this change, :class:`types.GenericAlias` can now be subclassed, and a " -"subclass will be returned when subscripting the :class:`collections.abc." -"Callable` type. Code which accesses the arguments via :func:`typing." -"get_args` or ``__args__`` need to account for this change. A :exc:" -"`DeprecationWarning` may be emitted for invalid forms of parameterizing :" -"class:`collections.abc.Callable` which may have passed silently in Python " -"3.9.1. This :exc:`DeprecationWarning` will become a :exc:`TypeError` in " -"Python 3.10. (Contributed by Ken Jin in :issue:`42195`.)" +"subclass will be returned when subscripting " +"the :class:`collections.abc.Callable` type. Code which accesses the " +"arguments via :func:`typing.get_args` or ``__args__`` need to account for " +"this change. A :exc:`DeprecationWarning` may be emitted for invalid forms " +"of parameterizing :class:`collections.abc.Callable` which may have passed " +"silently in Python 3.9.1. This :exc:`DeprecationWarning` will become " +"a :exc:`TypeError` in Python 3.10. (Contributed by Ken Jin " +"in :issue:`42195`.)" msgstr "" #: ../../whatsnew/3.9.rst:1552 ../../whatsnew/3.9.rst:1577 @@ -2529,13 +2549,14 @@ msgstr "urllib.parse" #: ../../whatsnew/3.9.rst:1554 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" msgstr "" #: ../../whatsnew/3.9.rst:1565 @@ -2558,11 +2579,12 @@ msgstr "Python 3.9.5 中顯著的變更" #: ../../whatsnew/3.9.rst:1579 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " -"forms of attacks. Following the WHATWG specification that updates :rfc:" -"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " -"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " -"attacks. The removal characters are controlled by a new module level " -"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" +"forms of attacks. Following the WHATWG specification that " +"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " +"characters are stripped from the URL by the parser in :mod:`urllib.parse` " +"preventing such attacks. The removal characters are controlled by a new " +"module level variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. " +"(See :gh:`88048`)" msgstr "" #: ../../whatsnew/3.9.rst:1587